@aptos-labs/ts-sdk 1.4.0 → 1.5.1

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 (190) hide show
  1. package/README.md +1 -1
  2. package/dist/browser/index.d.ts +306 -226
  3. package/dist/browser/index.global.js +30 -30
  4. package/dist/browser/index.global.js.map +1 -1
  5. package/dist/common/index.d.ts +306 -226
  6. package/dist/common/index.js +24 -24
  7. package/dist/common/index.js.map +1 -1
  8. package/dist/esm/api/account.mjs +1 -1
  9. package/dist/esm/api/ans.mjs +1 -1
  10. package/dist/esm/api/aptos.d.mts +6 -1
  11. package/dist/esm/api/aptos.mjs +1 -1
  12. package/dist/esm/api/coin.mjs +1 -1
  13. package/dist/esm/api/digitalAsset.mjs +1 -1
  14. package/dist/esm/api/event.mjs +1 -1
  15. package/dist/esm/api/faucet.mjs +1 -1
  16. package/dist/esm/api/fungibleAsset.mjs +1 -1
  17. package/dist/esm/api/general.mjs +1 -1
  18. package/dist/esm/api/index.d.mts +5 -0
  19. package/dist/esm/api/index.mjs +1 -1
  20. package/dist/esm/api/staking.mjs +1 -1
  21. package/dist/esm/api/transaction.d.mts +8 -0
  22. package/dist/esm/api/transaction.mjs +1 -1
  23. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  24. package/dist/esm/api/transactionSubmission/management.d.mts +89 -0
  25. package/dist/esm/api/transactionSubmission/management.mjs +2 -0
  26. package/dist/esm/api/transactionSubmission/management.mjs.map +1 -0
  27. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  28. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  29. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  30. package/dist/esm/api/utils.mjs +1 -1
  31. package/dist/esm/bcs/index.mjs +1 -1
  32. package/dist/esm/{chunk-KYI7YRRQ.mjs → chunk-25YXK6L2.mjs} +2 -2
  33. package/dist/esm/{chunk-Q7B4KMTR.mjs → chunk-2BSSYT6I.mjs} +2 -2
  34. package/dist/esm/chunk-2MOYURM2.mjs +2 -0
  35. package/dist/esm/chunk-2MOYURM2.mjs.map +1 -0
  36. package/dist/esm/{chunk-JHKU4VAL.mjs → chunk-2RN7N3EO.mjs} +2 -2
  37. package/dist/esm/{chunk-LGC5FYCC.mjs → chunk-3T4NSGK5.mjs} +2 -2
  38. package/dist/esm/{chunk-NWRKJFHV.mjs → chunk-4QWK47EH.mjs} +2 -2
  39. package/dist/esm/{chunk-RKWCYC3Y.mjs → chunk-4TGKQEEE.mjs} +2 -2
  40. package/dist/esm/{chunk-GGCQNE7J.mjs → chunk-6IMEQXW4.mjs} +2 -2
  41. package/dist/esm/{chunk-3PPUHF6D.mjs → chunk-6KILJ43F.mjs} +2 -2
  42. package/dist/esm/chunk-6XQ33PLM.mjs +2 -0
  43. package/dist/esm/chunk-6XQ33PLM.mjs.map +1 -0
  44. package/dist/esm/{chunk-SBMJNU2O.mjs → chunk-7WQA7OMS.mjs} +2 -2
  45. package/dist/esm/{chunk-3DM36HLF.mjs → chunk-ACMNL2LL.mjs} +2 -2
  46. package/dist/esm/{chunk-2QV6HI3M.mjs → chunk-APOQ4ODM.mjs} +2 -2
  47. package/dist/esm/{chunk-FXXTTZOI.mjs → chunk-ATHZ7INX.mjs} +2 -2
  48. package/dist/esm/{chunk-TN4RHL6A.mjs → chunk-BDHRLMQP.mjs} +2 -2
  49. package/dist/esm/{chunk-LLONKHWW.mjs → chunk-BQYQ45QQ.mjs} +2 -2
  50. package/dist/esm/{chunk-QQMEPYJ3.mjs → chunk-C53MNMPH.mjs} +2 -2
  51. package/dist/esm/{chunk-4RFWMHWT.mjs → chunk-CFQDJZBD.mjs} +2 -2
  52. package/dist/esm/{chunk-4DEYLX4E.mjs → chunk-DHFOORW6.mjs} +2 -2
  53. package/dist/esm/{chunk-BBJ3YXGC.mjs → chunk-DIWRS4YQ.mjs} +2 -2
  54. package/dist/esm/{chunk-CBMEWHLK.mjs → chunk-DSGIOUTJ.mjs} +2 -2
  55. package/dist/esm/{chunk-MJW4JGUR.mjs → chunk-ED2OMOMT.mjs} +2 -2
  56. package/dist/esm/{chunk-CHK4FLX4.mjs → chunk-FE2DRPX7.mjs} +2 -2
  57. package/dist/esm/{chunk-ERWQOVBF.mjs → chunk-FGHNLZRH.mjs} +2 -2
  58. package/dist/esm/{chunk-FW7B46XZ.mjs → chunk-FHUT4EJH.mjs} +2 -2
  59. package/dist/esm/{chunk-PXNW26UO.mjs → chunk-HT6K4NWZ.mjs} +2 -2
  60. package/dist/esm/{chunk-O74RSNEJ.mjs → chunk-HV4ZPHSZ.mjs} +2 -2
  61. package/dist/esm/{chunk-4BGNLZ5Y.mjs → chunk-IK7JAKXG.mjs} +2 -2
  62. package/dist/esm/{chunk-UCHGKGCF.mjs → chunk-J46VAO6L.mjs} +2 -2
  63. package/dist/esm/{chunk-YJQQF4GI.mjs → chunk-J4CN3Q2R.mjs} +2 -2
  64. package/dist/esm/{chunk-XSM3SOZY.mjs → chunk-JBWJE4IP.mjs} +2 -2
  65. package/dist/esm/{chunk-F362Q4BJ.mjs → chunk-JMV2QDNW.mjs} +2 -2
  66. package/dist/esm/{chunk-DHR4YEUH.mjs → chunk-JRQMEVDE.mjs} +2 -2
  67. package/dist/esm/{chunk-TJJSQSO3.mjs → chunk-K6IBDLVC.mjs} +2 -2
  68. package/dist/esm/chunk-LFWMWCS3.mjs +2 -0
  69. package/dist/esm/chunk-LFWMWCS3.mjs.map +1 -0
  70. package/dist/esm/{chunk-I4EKXYTB.mjs → chunk-NXAHJ4KY.mjs} +2 -2
  71. package/dist/esm/{chunk-FBFMQZTM.mjs → chunk-P7B32QR3.mjs} +2 -2
  72. package/dist/esm/{chunk-4OI7MPFH.mjs → chunk-PPNI7SJK.mjs} +2 -2
  73. package/dist/esm/chunk-QYB75IJ6.mjs +2 -0
  74. package/dist/esm/chunk-QYB75IJ6.mjs.map +1 -0
  75. package/dist/esm/{chunk-457LDQ3A.mjs → chunk-R3URESCV.mjs} +2 -2
  76. package/dist/esm/{chunk-XGM33CR7.mjs → chunk-TRTTUBC4.mjs} +2 -2
  77. package/dist/esm/{chunk-7Z4DTVZN.mjs → chunk-VP5JCW6I.mjs} +2 -2
  78. package/dist/esm/chunk-W5PZ5Z4H.mjs +2 -0
  79. package/dist/esm/chunk-W5PZ5Z4H.mjs.map +1 -0
  80. package/dist/esm/{chunk-FP5DPRYL.mjs → chunk-WXWFKCGO.mjs} +2 -2
  81. package/dist/esm/chunk-X3SXV2RB.mjs +2 -0
  82. package/dist/esm/{chunk-NXPN5XLB.mjs.map → chunk-X3SXV2RB.mjs.map} +1 -1
  83. package/dist/esm/{chunk-V6J34VOD.mjs → chunk-ZDT4TIOP.mjs} +2 -2
  84. package/dist/esm/client/core.mjs +1 -1
  85. package/dist/esm/client/get.mjs +1 -1
  86. package/dist/esm/client/index.mjs +1 -1
  87. package/dist/esm/client/post.mjs +1 -1
  88. package/dist/esm/core/account.mjs +1 -1
  89. package/dist/esm/core/authenticationKey.mjs +1 -1
  90. package/dist/esm/core/crypto/anyPublicKey.mjs +1 -1
  91. package/dist/esm/core/crypto/anySignature.mjs +1 -1
  92. package/dist/esm/core/crypto/asymmetricCrypto.mjs +1 -1
  93. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  94. package/dist/esm/core/crypto/index.mjs +1 -1
  95. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  96. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  97. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  98. package/dist/esm/core/index.mjs +1 -1
  99. package/dist/esm/index.d.mts +3 -1
  100. package/dist/esm/index.mjs +1 -1
  101. package/dist/esm/internal/account.mjs +1 -1
  102. package/dist/esm/internal/ans.mjs +1 -1
  103. package/dist/esm/internal/coin.mjs +1 -1
  104. package/dist/esm/internal/digitalAsset.mjs +1 -1
  105. package/dist/esm/internal/event.mjs +1 -1
  106. package/dist/esm/internal/faucet.mjs +1 -1
  107. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  108. package/dist/esm/internal/general.mjs +1 -1
  109. package/dist/esm/internal/staking.mjs +1 -1
  110. package/dist/esm/internal/transaction.mjs +1 -1
  111. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  112. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  113. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  114. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  115. package/dist/esm/transactions/index.mjs +1 -1
  116. package/dist/esm/transactions/instances/index.mjs +1 -1
  117. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  118. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  119. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  120. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  121. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  122. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  123. package/dist/esm/transactions/management/index.d.mts +2 -1
  124. package/dist/esm/transactions/management/index.mjs +1 -1
  125. package/dist/esm/transactions/management/transactionWorker.d.mts +29 -3
  126. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  127. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  128. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  129. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  130. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  131. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  132. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  133. package/dist/esm/version.d.mts +1 -1
  134. package/dist/esm/version.mjs +1 -1
  135. package/package.json +3 -2
  136. package/src/api/aptos.ts +1 -1
  137. package/src/api/transaction.ts +7 -9
  138. package/src/api/transactionSubmission/management.ts +106 -0
  139. package/src/client/core.ts +1 -1
  140. package/src/transactions/management/transactionWorker.ts +74 -14
  141. package/src/version.ts +1 -1
  142. package/dist/esm/chunk-2EQNGCPL.mjs +0 -2
  143. package/dist/esm/chunk-2EQNGCPL.mjs.map +0 -1
  144. package/dist/esm/chunk-ATV7SH7J.mjs +0 -2
  145. package/dist/esm/chunk-ATV7SH7J.mjs.map +0 -1
  146. package/dist/esm/chunk-NXPN5XLB.mjs +0 -2
  147. package/dist/esm/chunk-QLAW63UU.mjs +0 -2
  148. package/dist/esm/chunk-QLAW63UU.mjs.map +0 -1
  149. package/dist/esm/chunk-RVQGLEBY.mjs +0 -2
  150. package/dist/esm/chunk-RVQGLEBY.mjs.map +0 -1
  151. /package/dist/esm/{chunk-KYI7YRRQ.mjs.map → chunk-25YXK6L2.mjs.map} +0 -0
  152. /package/dist/esm/{chunk-Q7B4KMTR.mjs.map → chunk-2BSSYT6I.mjs.map} +0 -0
  153. /package/dist/esm/{chunk-JHKU4VAL.mjs.map → chunk-2RN7N3EO.mjs.map} +0 -0
  154. /package/dist/esm/{chunk-LGC5FYCC.mjs.map → chunk-3T4NSGK5.mjs.map} +0 -0
  155. /package/dist/esm/{chunk-NWRKJFHV.mjs.map → chunk-4QWK47EH.mjs.map} +0 -0
  156. /package/dist/esm/{chunk-RKWCYC3Y.mjs.map → chunk-4TGKQEEE.mjs.map} +0 -0
  157. /package/dist/esm/{chunk-GGCQNE7J.mjs.map → chunk-6IMEQXW4.mjs.map} +0 -0
  158. /package/dist/esm/{chunk-3PPUHF6D.mjs.map → chunk-6KILJ43F.mjs.map} +0 -0
  159. /package/dist/esm/{chunk-SBMJNU2O.mjs.map → chunk-7WQA7OMS.mjs.map} +0 -0
  160. /package/dist/esm/{chunk-3DM36HLF.mjs.map → chunk-ACMNL2LL.mjs.map} +0 -0
  161. /package/dist/esm/{chunk-2QV6HI3M.mjs.map → chunk-APOQ4ODM.mjs.map} +0 -0
  162. /package/dist/esm/{chunk-FXXTTZOI.mjs.map → chunk-ATHZ7INX.mjs.map} +0 -0
  163. /package/dist/esm/{chunk-TN4RHL6A.mjs.map → chunk-BDHRLMQP.mjs.map} +0 -0
  164. /package/dist/esm/{chunk-LLONKHWW.mjs.map → chunk-BQYQ45QQ.mjs.map} +0 -0
  165. /package/dist/esm/{chunk-QQMEPYJ3.mjs.map → chunk-C53MNMPH.mjs.map} +0 -0
  166. /package/dist/esm/{chunk-4RFWMHWT.mjs.map → chunk-CFQDJZBD.mjs.map} +0 -0
  167. /package/dist/esm/{chunk-4DEYLX4E.mjs.map → chunk-DHFOORW6.mjs.map} +0 -0
  168. /package/dist/esm/{chunk-BBJ3YXGC.mjs.map → chunk-DIWRS4YQ.mjs.map} +0 -0
  169. /package/dist/esm/{chunk-CBMEWHLK.mjs.map → chunk-DSGIOUTJ.mjs.map} +0 -0
  170. /package/dist/esm/{chunk-MJW4JGUR.mjs.map → chunk-ED2OMOMT.mjs.map} +0 -0
  171. /package/dist/esm/{chunk-CHK4FLX4.mjs.map → chunk-FE2DRPX7.mjs.map} +0 -0
  172. /package/dist/esm/{chunk-ERWQOVBF.mjs.map → chunk-FGHNLZRH.mjs.map} +0 -0
  173. /package/dist/esm/{chunk-FW7B46XZ.mjs.map → chunk-FHUT4EJH.mjs.map} +0 -0
  174. /package/dist/esm/{chunk-PXNW26UO.mjs.map → chunk-HT6K4NWZ.mjs.map} +0 -0
  175. /package/dist/esm/{chunk-O74RSNEJ.mjs.map → chunk-HV4ZPHSZ.mjs.map} +0 -0
  176. /package/dist/esm/{chunk-4BGNLZ5Y.mjs.map → chunk-IK7JAKXG.mjs.map} +0 -0
  177. /package/dist/esm/{chunk-UCHGKGCF.mjs.map → chunk-J46VAO6L.mjs.map} +0 -0
  178. /package/dist/esm/{chunk-YJQQF4GI.mjs.map → chunk-J4CN3Q2R.mjs.map} +0 -0
  179. /package/dist/esm/{chunk-XSM3SOZY.mjs.map → chunk-JBWJE4IP.mjs.map} +0 -0
  180. /package/dist/esm/{chunk-F362Q4BJ.mjs.map → chunk-JMV2QDNW.mjs.map} +0 -0
  181. /package/dist/esm/{chunk-DHR4YEUH.mjs.map → chunk-JRQMEVDE.mjs.map} +0 -0
  182. /package/dist/esm/{chunk-TJJSQSO3.mjs.map → chunk-K6IBDLVC.mjs.map} +0 -0
  183. /package/dist/esm/{chunk-I4EKXYTB.mjs.map → chunk-NXAHJ4KY.mjs.map} +0 -0
  184. /package/dist/esm/{chunk-FBFMQZTM.mjs.map → chunk-P7B32QR3.mjs.map} +0 -0
  185. /package/dist/esm/{chunk-4OI7MPFH.mjs.map → chunk-PPNI7SJK.mjs.map} +0 -0
  186. /package/dist/esm/{chunk-457LDQ3A.mjs.map → chunk-R3URESCV.mjs.map} +0 -0
  187. /package/dist/esm/{chunk-XGM33CR7.mjs.map → chunk-TRTTUBC4.mjs.map} +0 -0
  188. /package/dist/esm/{chunk-7Z4DTVZN.mjs.map → chunk-VP5JCW6I.mjs.map} +0 -0
  189. /package/dist/esm/{chunk-FP5DPRYL.mjs.map → chunk-WXWFKCGO.mjs.map} +0 -0
  190. /package/dist/esm/{chunk-V6J34VOD.mjs.map → chunk-ZDT4TIOP.mjs.map} +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";var aptosSDK=(()=>{var Gp=Object.create;var Lo=Object.defineProperty;var Mu=Object.getOwnPropertyDescriptor;var Lp=Object.getOwnPropertyNames;var qp=Object.getPrototypeOf,Kp=Object.prototype.hasOwnProperty;var Gu=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var Lu=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Gs=(r,t)=>{for(var e in t)Lo(r,e,{get:t[e],enumerable:!0})},qu=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Lp(t))!Kp.call(r,o)&&o!==e&&Lo(r,o,{get:()=>t[o],enumerable:!(n=Mu(t,o))||n.enumerable});return r};var Hp=(r,t,e)=>(e=r!=null?Gp(qp(r)):{},qu(t||!r||!r.__esModule?Lo(e,"default",{value:r,enumerable:!0}):e,r)),Fp=r=>qu(Lo({},"__esModule",{value:!0}),r),Et=(r,t,e,n)=>{for(var o=n>1?void 0:n?Mu(t,e):t,s=r.length-1,i;s>=0;s--)(i=r[s])&&(o=(n?i(t,e,o):i(o))||o);return n&&o&&Lo(t,e,o),o};var df=Lu(()=>{"use strict"});var lf=Lu(($0,ti)=>{"use strict";(function(r){"use strict";var t=function(u){var p,d=new Float64Array(16);if(u)for(p=0;p<u.length;p++)d[p]=u[p];return d},e=function(){throw new Error("no PRNG")},n=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var s=t(),i=t([1]),c=t([56129,1]),f=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),l=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),h=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),m=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),T=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function v(u,p,d,a){u[p]=d>>24&255,u[p+1]=d>>16&255,u[p+2]=d>>8&255,u[p+3]=d&255,u[p+4]=a>>24&255,u[p+5]=a>>16&255,u[p+6]=a>>8&255,u[p+7]=a&255}function b(u,p,d,a,g){var x,S=0;for(x=0;x<g;x++)S|=u[p+x]^d[a+x];return(1&S-1>>>8)-1}function y(u,p,d,a){return b(u,p,d,a,16)}function w(u,p,d,a){return b(u,p,d,a,32)}function E(u,p,d,a){for(var g=a[0]&255|(a[1]&255)<<8|(a[2]&255)<<16|(a[3]&255)<<24,x=d[0]&255|(d[1]&255)<<8|(d[2]&255)<<16|(d[3]&255)<<24,S=d[4]&255|(d[5]&255)<<8|(d[6]&255)<<16|(d[7]&255)<<24,O=d[8]&255|(d[9]&255)<<8|(d[10]&255)<<16|(d[11]&255)<<24,q=d[12]&255|(d[13]&255)<<8|(d[14]&255)<<16|(d[15]&255)<<24,ee=a[4]&255|(a[5]&255)<<8|(a[6]&255)<<16|(a[7]&255)<<24,j=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,Re=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,Y=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,ce=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,ue=a[8]&255|(a[9]&255)<<8|(a[10]&255)<<16|(a[11]&255)<<24,ge=d[16]&255|(d[17]&255)<<8|(d[18]&255)<<16|(d[19]&255)<<24,pe=d[20]&255|(d[21]&255)<<8|(d[22]&255)<<16|(d[23]&255)<<24,fe=d[24]&255|(d[25]&255)<<8|(d[26]&255)<<16|(d[27]&255)<<24,le=d[28]&255|(d[29]&255)<<8|(d[30]&255)<<16|(d[31]&255)<<24,de=a[12]&255|(a[13]&255)<<8|(a[14]&255)<<16|(a[15]&255)<<24,Z=g,oe=x,Q=S,X=O,J=q,V=ee,C=j,U=Re,D=Y,R=ce,N=ue,G=ge,ie=pe,me=fe,he=le,ye=de,A,_e=0;_e<20;_e+=2)A=Z+ie|0,J^=A<<7|A>>>25,A=J+Z|0,D^=A<<9|A>>>23,A=D+J|0,ie^=A<<13|A>>>19,A=ie+D|0,Z^=A<<18|A>>>14,A=V+oe|0,R^=A<<7|A>>>25,A=R+V|0,me^=A<<9|A>>>23,A=me+R|0,oe^=A<<13|A>>>19,A=oe+me|0,V^=A<<18|A>>>14,A=N+C|0,he^=A<<7|A>>>25,A=he+N|0,Q^=A<<9|A>>>23,A=Q+he|0,C^=A<<13|A>>>19,A=C+Q|0,N^=A<<18|A>>>14,A=ye+G|0,X^=A<<7|A>>>25,A=X+ye|0,U^=A<<9|A>>>23,A=U+X|0,G^=A<<13|A>>>19,A=G+U|0,ye^=A<<18|A>>>14,A=Z+X|0,oe^=A<<7|A>>>25,A=oe+Z|0,Q^=A<<9|A>>>23,A=Q+oe|0,X^=A<<13|A>>>19,A=X+Q|0,Z^=A<<18|A>>>14,A=V+J|0,C^=A<<7|A>>>25,A=C+V|0,U^=A<<9|A>>>23,A=U+C|0,J^=A<<13|A>>>19,A=J+U|0,V^=A<<18|A>>>14,A=N+R|0,G^=A<<7|A>>>25,A=G+N|0,D^=A<<9|A>>>23,A=D+G|0,R^=A<<13|A>>>19,A=R+D|0,N^=A<<18|A>>>14,A=ye+he|0,ie^=A<<7|A>>>25,A=ie+ye|0,me^=A<<9|A>>>23,A=me+ie|0,he^=A<<13|A>>>19,A=he+me|0,ye^=A<<18|A>>>14;Z=Z+g|0,oe=oe+x|0,Q=Q+S|0,X=X+O|0,J=J+q|0,V=V+ee|0,C=C+j|0,U=U+Re|0,D=D+Y|0,R=R+ce|0,N=N+ue|0,G=G+ge|0,ie=ie+pe|0,me=me+fe|0,he=he+le|0,ye=ye+de|0,u[0]=Z>>>0&255,u[1]=Z>>>8&255,u[2]=Z>>>16&255,u[3]=Z>>>24&255,u[4]=oe>>>0&255,u[5]=oe>>>8&255,u[6]=oe>>>16&255,u[7]=oe>>>24&255,u[8]=Q>>>0&255,u[9]=Q>>>8&255,u[10]=Q>>>16&255,u[11]=Q>>>24&255,u[12]=X>>>0&255,u[13]=X>>>8&255,u[14]=X>>>16&255,u[15]=X>>>24&255,u[16]=J>>>0&255,u[17]=J>>>8&255,u[18]=J>>>16&255,u[19]=J>>>24&255,u[20]=V>>>0&255,u[21]=V>>>8&255,u[22]=V>>>16&255,u[23]=V>>>24&255,u[24]=C>>>0&255,u[25]=C>>>8&255,u[26]=C>>>16&255,u[27]=C>>>24&255,u[28]=U>>>0&255,u[29]=U>>>8&255,u[30]=U>>>16&255,u[31]=U>>>24&255,u[32]=D>>>0&255,u[33]=D>>>8&255,u[34]=D>>>16&255,u[35]=D>>>24&255,u[36]=R>>>0&255,u[37]=R>>>8&255,u[38]=R>>>16&255,u[39]=R>>>24&255,u[40]=N>>>0&255,u[41]=N>>>8&255,u[42]=N>>>16&255,u[43]=N>>>24&255,u[44]=G>>>0&255,u[45]=G>>>8&255,u[46]=G>>>16&255,u[47]=G>>>24&255,u[48]=ie>>>0&255,u[49]=ie>>>8&255,u[50]=ie>>>16&255,u[51]=ie>>>24&255,u[52]=me>>>0&255,u[53]=me>>>8&255,u[54]=me>>>16&255,u[55]=me>>>24&255,u[56]=he>>>0&255,u[57]=he>>>8&255,u[58]=he>>>16&255,u[59]=he>>>24&255,u[60]=ye>>>0&255,u[61]=ye>>>8&255,u[62]=ye>>>16&255,u[63]=ye>>>24&255}function k(u,p,d,a){for(var g=a[0]&255|(a[1]&255)<<8|(a[2]&255)<<16|(a[3]&255)<<24,x=d[0]&255|(d[1]&255)<<8|(d[2]&255)<<16|(d[3]&255)<<24,S=d[4]&255|(d[5]&255)<<8|(d[6]&255)<<16|(d[7]&255)<<24,O=d[8]&255|(d[9]&255)<<8|(d[10]&255)<<16|(d[11]&255)<<24,q=d[12]&255|(d[13]&255)<<8|(d[14]&255)<<16|(d[15]&255)<<24,ee=a[4]&255|(a[5]&255)<<8|(a[6]&255)<<16|(a[7]&255)<<24,j=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,Re=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,Y=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,ce=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,ue=a[8]&255|(a[9]&255)<<8|(a[10]&255)<<16|(a[11]&255)<<24,ge=d[16]&255|(d[17]&255)<<8|(d[18]&255)<<16|(d[19]&255)<<24,pe=d[20]&255|(d[21]&255)<<8|(d[22]&255)<<16|(d[23]&255)<<24,fe=d[24]&255|(d[25]&255)<<8|(d[26]&255)<<16|(d[27]&255)<<24,le=d[28]&255|(d[29]&255)<<8|(d[30]&255)<<16|(d[31]&255)<<24,de=a[12]&255|(a[13]&255)<<8|(a[14]&255)<<16|(a[15]&255)<<24,Z=g,oe=x,Q=S,X=O,J=q,V=ee,C=j,U=Re,D=Y,R=ce,N=ue,G=ge,ie=pe,me=fe,he=le,ye=de,A,_e=0;_e<20;_e+=2)A=Z+ie|0,J^=A<<7|A>>>25,A=J+Z|0,D^=A<<9|A>>>23,A=D+J|0,ie^=A<<13|A>>>19,A=ie+D|0,Z^=A<<18|A>>>14,A=V+oe|0,R^=A<<7|A>>>25,A=R+V|0,me^=A<<9|A>>>23,A=me+R|0,oe^=A<<13|A>>>19,A=oe+me|0,V^=A<<18|A>>>14,A=N+C|0,he^=A<<7|A>>>25,A=he+N|0,Q^=A<<9|A>>>23,A=Q+he|0,C^=A<<13|A>>>19,A=C+Q|0,N^=A<<18|A>>>14,A=ye+G|0,X^=A<<7|A>>>25,A=X+ye|0,U^=A<<9|A>>>23,A=U+X|0,G^=A<<13|A>>>19,A=G+U|0,ye^=A<<18|A>>>14,A=Z+X|0,oe^=A<<7|A>>>25,A=oe+Z|0,Q^=A<<9|A>>>23,A=Q+oe|0,X^=A<<13|A>>>19,A=X+Q|0,Z^=A<<18|A>>>14,A=V+J|0,C^=A<<7|A>>>25,A=C+V|0,U^=A<<9|A>>>23,A=U+C|0,J^=A<<13|A>>>19,A=J+U|0,V^=A<<18|A>>>14,A=N+R|0,G^=A<<7|A>>>25,A=G+N|0,D^=A<<9|A>>>23,A=D+G|0,R^=A<<13|A>>>19,A=R+D|0,N^=A<<18|A>>>14,A=ye+he|0,ie^=A<<7|A>>>25,A=ie+ye|0,me^=A<<9|A>>>23,A=me+ie|0,he^=A<<13|A>>>19,A=he+me|0,ye^=A<<18|A>>>14;u[0]=Z>>>0&255,u[1]=Z>>>8&255,u[2]=Z>>>16&255,u[3]=Z>>>24&255,u[4]=V>>>0&255,u[5]=V>>>8&255,u[6]=V>>>16&255,u[7]=V>>>24&255,u[8]=N>>>0&255,u[9]=N>>>8&255,u[10]=N>>>16&255,u[11]=N>>>24&255,u[12]=ye>>>0&255,u[13]=ye>>>8&255,u[14]=ye>>>16&255,u[15]=ye>>>24&255,u[16]=C>>>0&255,u[17]=C>>>8&255,u[18]=C>>>16&255,u[19]=C>>>24&255,u[20]=U>>>0&255,u[21]=U>>>8&255,u[22]=U>>>16&255,u[23]=U>>>24&255,u[24]=D>>>0&255,u[25]=D>>>8&255,u[26]=D>>>16&255,u[27]=D>>>24&255,u[28]=R>>>0&255,u[29]=R>>>8&255,u[30]=R>>>16&255,u[31]=R>>>24&255}function P(u,p,d,a){E(u,p,d,a)}function $(u,p,d,a){k(u,p,d,a)}var M=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function z(u,p,d,a,g,x,S){var O=new Uint8Array(16),q=new Uint8Array(64),ee,j;for(j=0;j<16;j++)O[j]=0;for(j=0;j<8;j++)O[j]=x[j];for(;g>=64;){for(P(q,O,S,M),j=0;j<64;j++)u[p+j]=d[a+j]^q[j];for(ee=1,j=8;j<16;j++)ee=ee+(O[j]&255)|0,O[j]=ee&255,ee>>>=8;g-=64,p+=64,a+=64}if(g>0)for(P(q,O,S,M),j=0;j<g;j++)u[p+j]=d[a+j]^q[j];return 0}function L(u,p,d,a,g){var x=new Uint8Array(16),S=new Uint8Array(64),O,q;for(q=0;q<16;q++)x[q]=0;for(q=0;q<8;q++)x[q]=a[q];for(;d>=64;){for(P(S,x,g,M),q=0;q<64;q++)u[p+q]=S[q];for(O=1,q=8;q<16;q++)O=O+(x[q]&255)|0,x[q]=O&255,O>>>=8;d-=64,p+=64}if(d>0)for(P(S,x,g,M),q=0;q<d;q++)u[p+q]=S[q];return 0}function K(u,p,d,a,g){var x=new Uint8Array(32);$(x,a,g,M);for(var S=new Uint8Array(8),O=0;O<8;O++)S[O]=a[O+16];return L(u,p,d,S,x)}function we(u,p,d,a,g,x,S){var O=new Uint8Array(32);$(O,x,S,M);for(var q=new Uint8Array(8),ee=0;ee<8;ee++)q[ee]=x[ee+16];return z(u,p,d,a,g,q,O)}var te=function(u){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var p,d,a,g,x,S,O,q;p=u[0]&255|(u[1]&255)<<8,this.r[0]=p&8191,d=u[2]&255|(u[3]&255)<<8,this.r[1]=(p>>>13|d<<3)&8191,a=u[4]&255|(u[5]&255)<<8,this.r[2]=(d>>>10|a<<6)&7939,g=u[6]&255|(u[7]&255)<<8,this.r[3]=(a>>>7|g<<9)&8191,x=u[8]&255|(u[9]&255)<<8,this.r[4]=(g>>>4|x<<12)&255,this.r[5]=x>>>1&8190,S=u[10]&255|(u[11]&255)<<8,this.r[6]=(x>>>14|S<<2)&8191,O=u[12]&255|(u[13]&255)<<8,this.r[7]=(S>>>11|O<<5)&8065,q=u[14]&255|(u[15]&255)<<8,this.r[8]=(O>>>8|q<<8)&8191,this.r[9]=q>>>5&127,this.pad[0]=u[16]&255|(u[17]&255)<<8,this.pad[1]=u[18]&255|(u[19]&255)<<8,this.pad[2]=u[20]&255|(u[21]&255)<<8,this.pad[3]=u[22]&255|(u[23]&255)<<8,this.pad[4]=u[24]&255|(u[25]&255)<<8,this.pad[5]=u[26]&255|(u[27]&255)<<8,this.pad[6]=u[28]&255|(u[29]&255)<<8,this.pad[7]=u[30]&255|(u[31]&255)<<8};te.prototype.blocks=function(u,p,d){for(var a=this.fin?0:2048,g,x,S,O,q,ee,j,Re,Y,ce,ue,ge,pe,fe,le,de,Z,oe,Q,X=this.h[0],J=this.h[1],V=this.h[2],C=this.h[3],U=this.h[4],D=this.h[5],R=this.h[6],N=this.h[7],G=this.h[8],ie=this.h[9],me=this.r[0],he=this.r[1],ye=this.r[2],A=this.r[3],_e=this.r[4],Oe=this.r[5],Ne=this.r[6],be=this.r[7],Ue=this.r[8],Ie=this.r[9];d>=16;)g=u[p+0]&255|(u[p+1]&255)<<8,X+=g&8191,x=u[p+2]&255|(u[p+3]&255)<<8,J+=(g>>>13|x<<3)&8191,S=u[p+4]&255|(u[p+5]&255)<<8,V+=(x>>>10|S<<6)&8191,O=u[p+6]&255|(u[p+7]&255)<<8,C+=(S>>>7|O<<9)&8191,q=u[p+8]&255|(u[p+9]&255)<<8,U+=(O>>>4|q<<12)&8191,D+=q>>>1&8191,ee=u[p+10]&255|(u[p+11]&255)<<8,R+=(q>>>14|ee<<2)&8191,j=u[p+12]&255|(u[p+13]&255)<<8,N+=(ee>>>11|j<<5)&8191,Re=u[p+14]&255|(u[p+15]&255)<<8,G+=(j>>>8|Re<<8)&8191,ie+=Re>>>5|a,Y=0,ce=Y,ce+=X*me,ce+=J*(5*Ie),ce+=V*(5*Ue),ce+=C*(5*be),ce+=U*(5*Ne),Y=ce>>>13,ce&=8191,ce+=D*(5*Oe),ce+=R*(5*_e),ce+=N*(5*A),ce+=G*(5*ye),ce+=ie*(5*he),Y+=ce>>>13,ce&=8191,ue=Y,ue+=X*he,ue+=J*me,ue+=V*(5*Ie),ue+=C*(5*Ue),ue+=U*(5*be),Y=ue>>>13,ue&=8191,ue+=D*(5*Ne),ue+=R*(5*Oe),ue+=N*(5*_e),ue+=G*(5*A),ue+=ie*(5*ye),Y+=ue>>>13,ue&=8191,ge=Y,ge+=X*ye,ge+=J*he,ge+=V*me,ge+=C*(5*Ie),ge+=U*(5*Ue),Y=ge>>>13,ge&=8191,ge+=D*(5*be),ge+=R*(5*Ne),ge+=N*(5*Oe),ge+=G*(5*_e),ge+=ie*(5*A),Y+=ge>>>13,ge&=8191,pe=Y,pe+=X*A,pe+=J*ye,pe+=V*he,pe+=C*me,pe+=U*(5*Ie),Y=pe>>>13,pe&=8191,pe+=D*(5*Ue),pe+=R*(5*be),pe+=N*(5*Ne),pe+=G*(5*Oe),pe+=ie*(5*_e),Y+=pe>>>13,pe&=8191,fe=Y,fe+=X*_e,fe+=J*A,fe+=V*ye,fe+=C*he,fe+=U*me,Y=fe>>>13,fe&=8191,fe+=D*(5*Ie),fe+=R*(5*Ue),fe+=N*(5*be),fe+=G*(5*Ne),fe+=ie*(5*Oe),Y+=fe>>>13,fe&=8191,le=Y,le+=X*Oe,le+=J*_e,le+=V*A,le+=C*ye,le+=U*he,Y=le>>>13,le&=8191,le+=D*me,le+=R*(5*Ie),le+=N*(5*Ue),le+=G*(5*be),le+=ie*(5*Ne),Y+=le>>>13,le&=8191,de=Y,de+=X*Ne,de+=J*Oe,de+=V*_e,de+=C*A,de+=U*ye,Y=de>>>13,de&=8191,de+=D*he,de+=R*me,de+=N*(5*Ie),de+=G*(5*Ue),de+=ie*(5*be),Y+=de>>>13,de&=8191,Z=Y,Z+=X*be,Z+=J*Ne,Z+=V*Oe,Z+=C*_e,Z+=U*A,Y=Z>>>13,Z&=8191,Z+=D*ye,Z+=R*he,Z+=N*me,Z+=G*(5*Ie),Z+=ie*(5*Ue),Y+=Z>>>13,Z&=8191,oe=Y,oe+=X*Ue,oe+=J*be,oe+=V*Ne,oe+=C*Oe,oe+=U*_e,Y=oe>>>13,oe&=8191,oe+=D*A,oe+=R*ye,oe+=N*he,oe+=G*me,oe+=ie*(5*Ie),Y+=oe>>>13,oe&=8191,Q=Y,Q+=X*Ie,Q+=J*Ue,Q+=V*be,Q+=C*Ne,Q+=U*Oe,Y=Q>>>13,Q&=8191,Q+=D*_e,Q+=R*A,Q+=N*ye,Q+=G*he,Q+=ie*me,Y+=Q>>>13,Q&=8191,Y=(Y<<2)+Y|0,Y=Y+ce|0,ce=Y&8191,Y=Y>>>13,ue+=Y,X=ce,J=ue,V=ge,C=pe,U=fe,D=le,R=de,N=Z,G=oe,ie=Q,p+=16,d-=16;this.h[0]=X,this.h[1]=J,this.h[2]=V,this.h[3]=C,this.h[4]=U,this.h[5]=D,this.h[6]=R,this.h[7]=N,this.h[8]=G,this.h[9]=ie},te.prototype.finish=function(u,p){var d=new Uint16Array(10),a,g,x,S;if(this.leftover){for(S=this.leftover,this.buffer[S++]=1;S<16;S++)this.buffer[S]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(a=this.h[1]>>>13,this.h[1]&=8191,S=2;S<10;S++)this.h[S]+=a,a=this.h[S]>>>13,this.h[S]&=8191;for(this.h[0]+=a*5,a=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=a,a=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=a,d[0]=this.h[0]+5,a=d[0]>>>13,d[0]&=8191,S=1;S<10;S++)d[S]=this.h[S]+a,a=d[S]>>>13,d[S]&=8191;for(d[9]-=8192,g=(a^1)-1,S=0;S<10;S++)d[S]&=g;for(g=~g,S=0;S<10;S++)this.h[S]=this.h[S]&g|d[S];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,x=this.h[0]+this.pad[0],this.h[0]=x&65535,S=1;S<8;S++)x=(this.h[S]+this.pad[S]|0)+(x>>>16)|0,this.h[S]=x&65535;u[p+0]=this.h[0]>>>0&255,u[p+1]=this.h[0]>>>8&255,u[p+2]=this.h[1]>>>0&255,u[p+3]=this.h[1]>>>8&255,u[p+4]=this.h[2]>>>0&255,u[p+5]=this.h[2]>>>8&255,u[p+6]=this.h[3]>>>0&255,u[p+7]=this.h[3]>>>8&255,u[p+8]=this.h[4]>>>0&255,u[p+9]=this.h[4]>>>8&255,u[p+10]=this.h[5]>>>0&255,u[p+11]=this.h[5]>>>8&255,u[p+12]=this.h[6]>>>0&255,u[p+13]=this.h[6]>>>8&255,u[p+14]=this.h[7]>>>0&255,u[p+15]=this.h[7]>>>8&255},te.prototype.update=function(u,p,d){var a,g;if(this.leftover){for(g=16-this.leftover,g>d&&(g=d),a=0;a<g;a++)this.buffer[this.leftover+a]=u[p+a];if(d-=g,p+=g,this.leftover+=g,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(d>=16&&(g=d-d%16,this.blocks(u,p,g),p+=g,d-=g),d){for(a=0;a<d;a++)this.buffer[this.leftover+a]=u[p+a];this.leftover+=d}};function W(u,p,d,a,g,x){var S=new te(x);return S.update(d,a,g),S.finish(u,p),0}function ve(u,p,d,a,g,x){var S=new Uint8Array(16);return W(S,0,d,a,g,x),y(u,p,S,0)}function Ce(u,p,d,a,g){var x;if(d<32)return-1;for(we(u,0,p,0,d,a,g),W(u,16,u,32,d-32,u),x=0;x<16;x++)u[x]=0;return 0}function Ve(u,p,d,a,g){var x,S=new Uint8Array(32);if(d<32||(K(S,0,32,a,g),ve(p,16,p,32,d-32,S)!==0))return-1;for(we(u,0,p,0,d,a,g),x=0;x<32;x++)u[x]=0;return 0}function _(u,p){var d;for(d=0;d<16;d++)u[d]=p[d]|0}function B(u){var p,d,a=1;for(p=0;p<16;p++)d=u[p]+a+65535,a=Math.floor(d/65536),u[p]=d-a*65536;u[0]+=a-1+37*(a-1)}function F(u,p,d){for(var a,g=~(d-1),x=0;x<16;x++)a=g&(u[x]^p[x]),u[x]^=a,p[x]^=a}function re(u,p){var d,a,g,x=t(),S=t();for(d=0;d<16;d++)S[d]=p[d];for(B(S),B(S),B(S),a=0;a<2;a++){for(x[0]=S[0]-65517,d=1;d<15;d++)x[d]=S[d]-65535-(x[d-1]>>16&1),x[d-1]&=65535;x[15]=S[15]-32767-(x[14]>>16&1),g=x[15]>>16&1,x[14]&=65535,F(S,x,1-g)}for(d=0;d<16;d++)u[2*d]=S[d]&255,u[2*d+1]=S[d]>>8}function ne(u,p){var d=new Uint8Array(32),a=new Uint8Array(32);return re(d,u),re(a,p),w(d,0,a,0)}function xe(u){var p=new Uint8Array(32);return re(p,u),p[0]&1}function ke(u,p){var d;for(d=0;d<16;d++)u[d]=p[2*d]+(p[2*d+1]<<8);u[15]&=32767}function Te(u,p,d){for(var a=0;a<16;a++)u[a]=p[a]+d[a]}function De(u,p,d){for(var a=0;a<16;a++)u[a]=p[a]-d[a]}function se(u,p,d){var a,g,x=0,S=0,O=0,q=0,ee=0,j=0,Re=0,Y=0,ce=0,ue=0,ge=0,pe=0,fe=0,le=0,de=0,Z=0,oe=0,Q=0,X=0,J=0,V=0,C=0,U=0,D=0,R=0,N=0,G=0,ie=0,me=0,he=0,ye=0,A=d[0],_e=d[1],Oe=d[2],Ne=d[3],be=d[4],Ue=d[5],Ie=d[6],nt=d[7],Me=d[8],We=d[9],Ye=d[10],Ze=d[11],at=d[12],gt=d[13],mt=d[14],yt=d[15];a=p[0],x+=a*A,S+=a*_e,O+=a*Oe,q+=a*Ne,ee+=a*be,j+=a*Ue,Re+=a*Ie,Y+=a*nt,ce+=a*Me,ue+=a*We,ge+=a*Ye,pe+=a*Ze,fe+=a*at,le+=a*gt,de+=a*mt,Z+=a*yt,a=p[1],S+=a*A,O+=a*_e,q+=a*Oe,ee+=a*Ne,j+=a*be,Re+=a*Ue,Y+=a*Ie,ce+=a*nt,ue+=a*Me,ge+=a*We,pe+=a*Ye,fe+=a*Ze,le+=a*at,de+=a*gt,Z+=a*mt,oe+=a*yt,a=p[2],O+=a*A,q+=a*_e,ee+=a*Oe,j+=a*Ne,Re+=a*be,Y+=a*Ue,ce+=a*Ie,ue+=a*nt,ge+=a*Me,pe+=a*We,fe+=a*Ye,le+=a*Ze,de+=a*at,Z+=a*gt,oe+=a*mt,Q+=a*yt,a=p[3],q+=a*A,ee+=a*_e,j+=a*Oe,Re+=a*Ne,Y+=a*be,ce+=a*Ue,ue+=a*Ie,ge+=a*nt,pe+=a*Me,fe+=a*We,le+=a*Ye,de+=a*Ze,Z+=a*at,oe+=a*gt,Q+=a*mt,X+=a*yt,a=p[4],ee+=a*A,j+=a*_e,Re+=a*Oe,Y+=a*Ne,ce+=a*be,ue+=a*Ue,ge+=a*Ie,pe+=a*nt,fe+=a*Me,le+=a*We,de+=a*Ye,Z+=a*Ze,oe+=a*at,Q+=a*gt,X+=a*mt,J+=a*yt,a=p[5],j+=a*A,Re+=a*_e,Y+=a*Oe,ce+=a*Ne,ue+=a*be,ge+=a*Ue,pe+=a*Ie,fe+=a*nt,le+=a*Me,de+=a*We,Z+=a*Ye,oe+=a*Ze,Q+=a*at,X+=a*gt,J+=a*mt,V+=a*yt,a=p[6],Re+=a*A,Y+=a*_e,ce+=a*Oe,ue+=a*Ne,ge+=a*be,pe+=a*Ue,fe+=a*Ie,le+=a*nt,de+=a*Me,Z+=a*We,oe+=a*Ye,Q+=a*Ze,X+=a*at,J+=a*gt,V+=a*mt,C+=a*yt,a=p[7],Y+=a*A,ce+=a*_e,ue+=a*Oe,ge+=a*Ne,pe+=a*be,fe+=a*Ue,le+=a*Ie,de+=a*nt,Z+=a*Me,oe+=a*We,Q+=a*Ye,X+=a*Ze,J+=a*at,V+=a*gt,C+=a*mt,U+=a*yt,a=p[8],ce+=a*A,ue+=a*_e,ge+=a*Oe,pe+=a*Ne,fe+=a*be,le+=a*Ue,de+=a*Ie,Z+=a*nt,oe+=a*Me,Q+=a*We,X+=a*Ye,J+=a*Ze,V+=a*at,C+=a*gt,U+=a*mt,D+=a*yt,a=p[9],ue+=a*A,ge+=a*_e,pe+=a*Oe,fe+=a*Ne,le+=a*be,de+=a*Ue,Z+=a*Ie,oe+=a*nt,Q+=a*Me,X+=a*We,J+=a*Ye,V+=a*Ze,C+=a*at,U+=a*gt,D+=a*mt,R+=a*yt,a=p[10],ge+=a*A,pe+=a*_e,fe+=a*Oe,le+=a*Ne,de+=a*be,Z+=a*Ue,oe+=a*Ie,Q+=a*nt,X+=a*Me,J+=a*We,V+=a*Ye,C+=a*Ze,U+=a*at,D+=a*gt,R+=a*mt,N+=a*yt,a=p[11],pe+=a*A,fe+=a*_e,le+=a*Oe,de+=a*Ne,Z+=a*be,oe+=a*Ue,Q+=a*Ie,X+=a*nt,J+=a*Me,V+=a*We,C+=a*Ye,U+=a*Ze,D+=a*at,R+=a*gt,N+=a*mt,G+=a*yt,a=p[12],fe+=a*A,le+=a*_e,de+=a*Oe,Z+=a*Ne,oe+=a*be,Q+=a*Ue,X+=a*Ie,J+=a*nt,V+=a*Me,C+=a*We,U+=a*Ye,D+=a*Ze,R+=a*at,N+=a*gt,G+=a*mt,ie+=a*yt,a=p[13],le+=a*A,de+=a*_e,Z+=a*Oe,oe+=a*Ne,Q+=a*be,X+=a*Ue,J+=a*Ie,V+=a*nt,C+=a*Me,U+=a*We,D+=a*Ye,R+=a*Ze,N+=a*at,G+=a*gt,ie+=a*mt,me+=a*yt,a=p[14],de+=a*A,Z+=a*_e,oe+=a*Oe,Q+=a*Ne,X+=a*be,J+=a*Ue,V+=a*Ie,C+=a*nt,U+=a*Me,D+=a*We,R+=a*Ye,N+=a*Ze,G+=a*at,ie+=a*gt,me+=a*mt,he+=a*yt,a=p[15],Z+=a*A,oe+=a*_e,Q+=a*Oe,X+=a*Ne,J+=a*be,V+=a*Ue,C+=a*Ie,U+=a*nt,D+=a*Me,R+=a*We,N+=a*Ye,G+=a*Ze,ie+=a*at,me+=a*gt,he+=a*mt,ye+=a*yt,x+=38*oe,S+=38*Q,O+=38*X,q+=38*J,ee+=38*V,j+=38*C,Re+=38*U,Y+=38*D,ce+=38*R,ue+=38*N,ge+=38*G,pe+=38*ie,fe+=38*me,le+=38*he,de+=38*ye,g=1,a=x+g+65535,g=Math.floor(a/65536),x=a-g*65536,a=S+g+65535,g=Math.floor(a/65536),S=a-g*65536,a=O+g+65535,g=Math.floor(a/65536),O=a-g*65536,a=q+g+65535,g=Math.floor(a/65536),q=a-g*65536,a=ee+g+65535,g=Math.floor(a/65536),ee=a-g*65536,a=j+g+65535,g=Math.floor(a/65536),j=a-g*65536,a=Re+g+65535,g=Math.floor(a/65536),Re=a-g*65536,a=Y+g+65535,g=Math.floor(a/65536),Y=a-g*65536,a=ce+g+65535,g=Math.floor(a/65536),ce=a-g*65536,a=ue+g+65535,g=Math.floor(a/65536),ue=a-g*65536,a=ge+g+65535,g=Math.floor(a/65536),ge=a-g*65536,a=pe+g+65535,g=Math.floor(a/65536),pe=a-g*65536,a=fe+g+65535,g=Math.floor(a/65536),fe=a-g*65536,a=le+g+65535,g=Math.floor(a/65536),le=a-g*65536,a=de+g+65535,g=Math.floor(a/65536),de=a-g*65536,a=Z+g+65535,g=Math.floor(a/65536),Z=a-g*65536,x+=g-1+37*(g-1),g=1,a=x+g+65535,g=Math.floor(a/65536),x=a-g*65536,a=S+g+65535,g=Math.floor(a/65536),S=a-g*65536,a=O+g+65535,g=Math.floor(a/65536),O=a-g*65536,a=q+g+65535,g=Math.floor(a/65536),q=a-g*65536,a=ee+g+65535,g=Math.floor(a/65536),ee=a-g*65536,a=j+g+65535,g=Math.floor(a/65536),j=a-g*65536,a=Re+g+65535,g=Math.floor(a/65536),Re=a-g*65536,a=Y+g+65535,g=Math.floor(a/65536),Y=a-g*65536,a=ce+g+65535,g=Math.floor(a/65536),ce=a-g*65536,a=ue+g+65535,g=Math.floor(a/65536),ue=a-g*65536,a=ge+g+65535,g=Math.floor(a/65536),ge=a-g*65536,a=pe+g+65535,g=Math.floor(a/65536),pe=a-g*65536,a=fe+g+65535,g=Math.floor(a/65536),fe=a-g*65536,a=le+g+65535,g=Math.floor(a/65536),le=a-g*65536,a=de+g+65535,g=Math.floor(a/65536),de=a-g*65536,a=Z+g+65535,g=Math.floor(a/65536),Z=a-g*65536,x+=g-1+37*(g-1),u[0]=x,u[1]=S,u[2]=O,u[3]=q,u[4]=ee,u[5]=j,u[6]=Re,u[7]=Y,u[8]=ce,u[9]=ue,u[10]=ge,u[11]=pe,u[12]=fe,u[13]=le,u[14]=de,u[15]=Z}function Ke(u,p){se(u,p,p)}function St(u,p){var d=t(),a;for(a=0;a<16;a++)d[a]=p[a];for(a=253;a>=0;a--)Ke(d,d),a!==2&&a!==4&&se(d,d,p);for(a=0;a<16;a++)u[a]=d[a]}function ot(u,p){var d=t(),a;for(a=0;a<16;a++)d[a]=p[a];for(a=250;a>=0;a--)Ke(d,d),a!==1&&se(d,d,p);for(a=0;a<16;a++)u[a]=d[a]}function kt(u,p,d){var a=new Uint8Array(32),g=new Float64Array(80),x,S,O=t(),q=t(),ee=t(),j=t(),Re=t(),Y=t();for(S=0;S<31;S++)a[S]=p[S];for(a[31]=p[31]&127|64,a[0]&=248,ke(g,d),S=0;S<16;S++)q[S]=g[S],j[S]=O[S]=ee[S]=0;for(O[0]=j[0]=1,S=254;S>=0;--S)x=a[S>>>3]>>>(S&7)&1,F(O,q,x),F(ee,j,x),Te(Re,O,ee),De(O,O,ee),Te(ee,q,j),De(q,q,j),Ke(j,Re),Ke(Y,O),se(O,ee,O),se(ee,q,Re),Te(Re,O,ee),De(O,O,ee),Ke(q,O),De(ee,j,Y),se(O,ee,c),Te(O,O,j),se(ee,ee,O),se(O,j,Y),se(j,q,g),Ke(q,Re),F(O,q,x),F(ee,j,x);for(S=0;S<16;S++)g[S+16]=O[S],g[S+32]=ee[S],g[S+48]=q[S],g[S+64]=j[S];var ce=g.subarray(32),ue=g.subarray(16);return St(ce,ce),se(ue,ue,ce),re(u,ue),0}function st(u,p){return kt(u,p,o)}function pt(u,p){return e(p,32),st(u,p)}function ar(u,p,d){var a=new Uint8Array(32);return kt(a,d,p),$(u,n,a,M)}var Fe=Ce,xt=Ve;function Qt(u,p,d,a,g,x){var S=new Uint8Array(32);return ar(S,g,x),Fe(u,p,d,a,S)}function hn(u,p,d,a,g,x){var S=new Uint8Array(32);return ar(S,g,x),xt(u,p,d,a,S)}var qr=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ru(u,p,d,a){for(var g=new Int32Array(16),x=new Int32Array(16),S,O,q,ee,j,Re,Y,ce,ue,ge,pe,fe,le,de,Z,oe,Q,X,J,V,C,U,D,R,N,G,ie=u[0],me=u[1],he=u[2],ye=u[3],A=u[4],_e=u[5],Oe=u[6],Ne=u[7],be=p[0],Ue=p[1],Ie=p[2],nt=p[3],Me=p[4],We=p[5],Ye=p[6],Ze=p[7],at=0;a>=128;){for(J=0;J<16;J++)V=8*J+at,g[J]=d[V+0]<<24|d[V+1]<<16|d[V+2]<<8|d[V+3],x[J]=d[V+4]<<24|d[V+5]<<16|d[V+6]<<8|d[V+7];for(J=0;J<80;J++)if(S=ie,O=me,q=he,ee=ye,j=A,Re=_e,Y=Oe,ce=Ne,ue=be,ge=Ue,pe=Ie,fe=nt,le=Me,de=We,Z=Ye,oe=Ze,C=Ne,U=Ze,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=(A>>>14|Me<<18)^(A>>>18|Me<<14)^(Me>>>9|A<<23),U=(Me>>>14|A<<18)^(Me>>>18|A<<14)^(A>>>9|Me<<23),D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,C=A&_e^~A&Oe,U=Me&We^~Me&Ye,D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,C=qr[J*2],U=qr[J*2+1],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,C=g[J%16],U=x[J%16],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,Q=N&65535|G<<16,X=D&65535|R<<16,C=Q,U=X,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=(ie>>>28|be<<4)^(be>>>2|ie<<30)^(be>>>7|ie<<25),U=(be>>>28|ie<<4)^(ie>>>2|be<<30)^(ie>>>7|be<<25),D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,C=ie&me^ie&he^me&he,U=be&Ue^be&Ie^Ue&Ie,D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,ce=N&65535|G<<16,oe=D&65535|R<<16,C=ee,U=fe,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=Q,U=X,D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,ee=N&65535|G<<16,fe=D&65535|R<<16,me=S,he=O,ye=q,A=ee,_e=j,Oe=Re,Ne=Y,ie=ce,Ue=ue,Ie=ge,nt=pe,Me=fe,We=le,Ye=de,Ze=Z,be=oe,J%16===15)for(V=0;V<16;V++)C=g[V],U=x[V],D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=g[(V+9)%16],U=x[(V+9)%16],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,Q=g[(V+1)%16],X=x[(V+1)%16],C=(Q>>>1|X<<31)^(Q>>>8|X<<24)^Q>>>7,U=(X>>>1|Q<<31)^(X>>>8|Q<<24)^(X>>>7|Q<<25),D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,Q=g[(V+14)%16],X=x[(V+14)%16],C=(Q>>>19|X<<13)^(X>>>29|Q<<3)^Q>>>6,U=(X>>>19|Q<<13)^(Q>>>29|X<<3)^(X>>>6|Q<<26),D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,g[V]=N&65535|G<<16,x[V]=D&65535|R<<16;C=ie,U=be,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=u[0],U=p[0],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,u[0]=ie=N&65535|G<<16,p[0]=be=D&65535|R<<16,C=me,U=Ue,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=u[1],U=p[1],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,u[1]=me=N&65535|G<<16,p[1]=Ue=D&65535|R<<16,C=he,U=Ie,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=u[2],U=p[2],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,u[2]=he=N&65535|G<<16,p[2]=Ie=D&65535|R<<16,C=ye,U=nt,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=u[3],U=p[3],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,u[3]=ye=N&65535|G<<16,p[3]=nt=D&65535|R<<16,C=A,U=Me,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=u[4],U=p[4],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,u[4]=A=N&65535|G<<16,p[4]=Me=D&65535|R<<16,C=_e,U=We,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=u[5],U=p[5],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,u[5]=_e=N&65535|G<<16,p[5]=We=D&65535|R<<16,C=Oe,U=Ye,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=u[6],U=p[6],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,u[6]=Oe=N&65535|G<<16,p[6]=Ye=D&65535|R<<16,C=Ne,U=Ze,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=u[7],U=p[7],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,u[7]=Ne=N&65535|G<<16,p[7]=Ze=D&65535|R<<16,at+=128,a-=128}return a}function An(u,p,d){var a=new Int32Array(8),g=new Int32Array(8),x=new Uint8Array(256),S,O=d;for(a[0]=1779033703,a[1]=3144134277,a[2]=1013904242,a[3]=2773480762,a[4]=1359893119,a[5]=2600822924,a[6]=528734635,a[7]=1541459225,g[0]=4089235720,g[1]=2227873595,g[2]=4271175723,g[3]=1595750129,g[4]=2917565137,g[5]=725511199,g[6]=4215389547,g[7]=327033209,Ru(a,g,p,d),d%=128,S=0;S<d;S++)x[S]=p[O-d+S];for(x[d]=128,d=256-128*(d<112?1:0),x[d-9]=0,v(x,d-8,O/536870912|0,O<<3),Ru(a,g,x,d),S=0;S<8;S++)v(u,8*S,a[S],g[S]);return 0}function Ns(u,p){var d=t(),a=t(),g=t(),x=t(),S=t(),O=t(),q=t(),ee=t(),j=t();De(d,u[1],u[0]),De(j,p[1],p[0]),se(d,d,j),Te(a,u[0],u[1]),Te(j,p[0],p[1]),se(a,a,j),se(g,u[3],p[3]),se(g,g,l),se(x,u[2],p[2]),Te(x,x,x),De(S,a,d),De(O,x,g),Te(q,x,g),Te(ee,a,d),se(u[0],S,O),se(u[1],ee,q),se(u[2],q,O),se(u[3],S,ee)}function Ou(u,p,d){var a;for(a=0;a<4;a++)F(u[a],p[a],d)}function pa(u,p){var d=t(),a=t(),g=t();St(g,p[2]),se(d,p[0],g),se(a,p[1],g),re(u,a),u[31]^=xe(d)<<7}function ga(u,p,d){var a,g;for(_(u[0],s),_(u[1],i),_(u[2],i),_(u[3],s),g=255;g>=0;--g)a=d[g/8|0]>>(g&7)&1,Ou(u,p,a),Ns(p,u),Ns(u,u),Ou(u,p,a)}function ks(u,p){var d=[t(),t(),t(),t()];_(d[0],h),_(d[1],m),_(d[2],i),se(d[3],h,m),ga(u,d,p)}function ma(u,p,d){var a=new Uint8Array(64),g=[t(),t(),t(),t()],x;for(d||e(p,32),An(a,p,32),a[0]&=248,a[31]&=127,a[31]|=64,ks(g,a),pa(u,g),x=0;x<32;x++)p[x+32]=u[x];return 0}var zs=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ya(u,p){var d,a,g,x;for(a=63;a>=32;--a){for(d=0,g=a-32,x=a-12;g<x;++g)p[g]+=d-16*p[a]*zs[g-(a-32)],d=Math.floor((p[g]+128)/256),p[g]-=d*256;p[g]+=d,p[a]=0}for(d=0,g=0;g<32;g++)p[g]+=d-(p[31]>>4)*zs[g],d=p[g]>>8,p[g]&=255;for(g=0;g<32;g++)p[g]-=d*zs[g];for(a=0;a<32;a++)p[a+1]+=p[a]>>8,u[a]=p[a]&255}function ha(u){var p=new Float64Array(64),d;for(d=0;d<64;d++)p[d]=u[d];for(d=0;d<64;d++)u[d]=0;ya(u,p)}function Nu(u,p,d,a){var g=new Uint8Array(64),x=new Uint8Array(64),S=new Uint8Array(64),O,q,ee=new Float64Array(64),j=[t(),t(),t(),t()];An(g,a,32),g[0]&=248,g[31]&=127,g[31]|=64;var Re=d+64;for(O=0;O<d;O++)u[64+O]=p[O];for(O=0;O<32;O++)u[32+O]=g[32+O];for(An(S,u.subarray(32),d+32),ha(S),ks(j,S),pa(u,j),O=32;O<64;O++)u[O]=a[O];for(An(x,u,d+64),ha(x),O=0;O<64;O++)ee[O]=0;for(O=0;O<32;O++)ee[O]=S[O];for(O=0;O<32;O++)for(q=0;q<32;q++)ee[O+q]+=x[O]*g[q];return ya(u.subarray(32),ee),Re}function kp(u,p){var d=t(),a=t(),g=t(),x=t(),S=t(),O=t(),q=t();return _(u[2],i),ke(u[1],p),Ke(g,u[1]),se(x,g,f),De(g,g,u[2]),Te(x,u[2],x),Ke(S,x),Ke(O,S),se(q,O,S),se(d,q,g),se(d,d,x),ot(d,d),se(d,d,g),se(d,d,x),se(d,d,x),se(u[0],d,x),Ke(a,u[0]),se(a,a,x),ne(a,g)&&se(u[0],u[0],T),Ke(a,u[0]),se(a,a,x),ne(a,g)?-1:(xe(u[0])===p[31]>>7&&De(u[0],s,u[0]),se(u[3],u[0],u[1]),0)}function Aa(u,p,d,a){var g,x=new Uint8Array(32),S=new Uint8Array(64),O=[t(),t(),t(),t()],q=[t(),t(),t(),t()];if(d<64||kp(q,a))return-1;for(g=0;g<d;g++)u[g]=p[g];for(g=0;g<32;g++)u[g+32]=a[g];if(An(S,u,d),ha(S),ga(O,q,S),ks(q,p.subarray(32)),Ns(O,q),pa(x,O),d-=64,w(p,0,x,0)){for(g=0;g<d;g++)u[g]=0;return-1}for(g=0;g<d;g++)u[g]=p[g+64];return d}var xa=32,Ds=24,zo=32,so=16,Do=32,Ms=32,Mo=32,Go=32,ba=32,ku=Ds,zp=zo,Dp=so,wr=64,xn=32,io=64,wa=32,Ta=64;r.lowlevel={crypto_core_hsalsa20:$,crypto_stream_xor:we,crypto_stream:K,crypto_stream_salsa20_xor:z,crypto_stream_salsa20:L,crypto_onetimeauth:W,crypto_onetimeauth_verify:ve,crypto_verify_16:y,crypto_verify_32:w,crypto_secretbox:Ce,crypto_secretbox_open:Ve,crypto_scalarmult:kt,crypto_scalarmult_base:st,crypto_box_beforenm:ar,crypto_box_afternm:Fe,crypto_box:Qt,crypto_box_open:hn,crypto_box_keypair:pt,crypto_hash:An,crypto_sign:Nu,crypto_sign_keypair:ma,crypto_sign_open:Aa,crypto_secretbox_KEYBYTES:xa,crypto_secretbox_NONCEBYTES:Ds,crypto_secretbox_ZEROBYTES:zo,crypto_secretbox_BOXZEROBYTES:so,crypto_scalarmult_BYTES:Do,crypto_scalarmult_SCALARBYTES:Ms,crypto_box_PUBLICKEYBYTES:Mo,crypto_box_SECRETKEYBYTES:Go,crypto_box_BEFORENMBYTES:ba,crypto_box_NONCEBYTES:ku,crypto_box_ZEROBYTES:zp,crypto_box_BOXZEROBYTES:Dp,crypto_sign_BYTES:wr,crypto_sign_PUBLICKEYBYTES:xn,crypto_sign_SECRETKEYBYTES:io,crypto_sign_SEEDBYTES:wa,crypto_hash_BYTES:Ta,gf:t,D:f,L:zs,pack25519:re,unpack25519:ke,M:se,A:Te,S:Ke,Z:De,pow2523:ot,add:Ns,set25519:_,modL:ya,scalarmult:ga,scalarbase:ks};function zu(u,p){if(u.length!==xa)throw new Error("bad key size");if(p.length!==Ds)throw new Error("bad nonce size")}function Mp(u,p){if(u.length!==Mo)throw new Error("bad public key size");if(p.length!==Go)throw new Error("bad secret key size")}function Ct(){for(var u=0;u<arguments.length;u++)if(!(arguments[u]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Du(u){for(var p=0;p<u.length;p++)u[p]=0}r.randomBytes=function(u){var p=new Uint8Array(u);return e(p,u),p},r.secretbox=function(u,p,d){Ct(u,p,d),zu(d,p);for(var a=new Uint8Array(zo+u.length),g=new Uint8Array(a.length),x=0;x<u.length;x++)a[x+zo]=u[x];return Ce(g,a,a.length,p,d),g.subarray(so)},r.secretbox.open=function(u,p,d){Ct(u,p,d),zu(d,p);for(var a=new Uint8Array(so+u.length),g=new Uint8Array(a.length),x=0;x<u.length;x++)a[x+so]=u[x];return a.length<32||Ve(g,a,a.length,p,d)!==0?null:g.subarray(zo)},r.secretbox.keyLength=xa,r.secretbox.nonceLength=Ds,r.secretbox.overheadLength=so,r.scalarMult=function(u,p){if(Ct(u,p),u.length!==Ms)throw new Error("bad n size");if(p.length!==Do)throw new Error("bad p size");var d=new Uint8Array(Do);return kt(d,u,p),d},r.scalarMult.base=function(u){if(Ct(u),u.length!==Ms)throw new Error("bad n size");var p=new Uint8Array(Do);return st(p,u),p},r.scalarMult.scalarLength=Ms,r.scalarMult.groupElementLength=Do,r.box=function(u,p,d,a){var g=r.box.before(d,a);return r.secretbox(u,p,g)},r.box.before=function(u,p){Ct(u,p),Mp(u,p);var d=new Uint8Array(ba);return ar(d,u,p),d},r.box.after=r.secretbox,r.box.open=function(u,p,d,a){var g=r.box.before(d,a);return r.secretbox.open(u,p,g)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var u=new Uint8Array(Mo),p=new Uint8Array(Go);return pt(u,p),{publicKey:u,secretKey:p}},r.box.keyPair.fromSecretKey=function(u){if(Ct(u),u.length!==Go)throw new Error("bad secret key size");var p=new Uint8Array(Mo);return st(p,u),{publicKey:p,secretKey:new Uint8Array(u)}},r.box.publicKeyLength=Mo,r.box.secretKeyLength=Go,r.box.sharedKeyLength=ba,r.box.nonceLength=ku,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(u,p){if(Ct(u,p),p.length!==io)throw new Error("bad secret key size");var d=new Uint8Array(wr+u.length);return Nu(d,u,u.length,p),d},r.sign.open=function(u,p){if(Ct(u,p),p.length!==xn)throw new Error("bad public key size");var d=new Uint8Array(u.length),a=Aa(d,u,u.length,p);if(a<0)return null;for(var g=new Uint8Array(a),x=0;x<g.length;x++)g[x]=d[x];return g},r.sign.detached=function(u,p){for(var d=r.sign(u,p),a=new Uint8Array(wr),g=0;g<a.length;g++)a[g]=d[g];return a},r.sign.detached.verify=function(u,p,d){if(Ct(u,p,d),p.length!==wr)throw new Error("bad signature size");if(d.length!==xn)throw new Error("bad public key size");var a=new Uint8Array(wr+u.length),g=new Uint8Array(wr+u.length),x;for(x=0;x<wr;x++)a[x]=p[x];for(x=0;x<u.length;x++)a[x+wr]=u[x];return Aa(g,a,a.length,d)>=0},r.sign.keyPair=function(){var u=new Uint8Array(xn),p=new Uint8Array(io);return ma(u,p),{publicKey:u,secretKey:p}},r.sign.keyPair.fromSecretKey=function(u){if(Ct(u),u.length!==io)throw new Error("bad secret key size");for(var p=new Uint8Array(xn),d=0;d<p.length;d++)p[d]=u[32+d];return{publicKey:p,secretKey:new Uint8Array(u)}},r.sign.keyPair.fromSeed=function(u){if(Ct(u),u.length!==wa)throw new Error("bad seed size");for(var p=new Uint8Array(xn),d=new Uint8Array(io),a=0;a<32;a++)d[a]=u[a];return ma(p,d,!0),{publicKey:p,secretKey:d}},r.sign.publicKeyLength=xn,r.sign.secretKeyLength=io,r.sign.seedLength=wa,r.sign.signatureLength=wr,r.hash=function(u){Ct(u);var p=new Uint8Array(Ta);return An(p,u,u.length),p},r.hash.hashLength=Ta,r.verify=function(u,p){return Ct(u,p),u.length===0||p.length===0||u.length!==p.length?!1:b(u,0,p,0,u.length)===0},r.setPRNG=function(u){e=u},function(){var u=typeof self<"u"?self.crypto||self.msCrypto:null;if(u&&u.getRandomValues){var p=65536;r.setPRNG(function(d,a){var g,x=new Uint8Array(a);for(g=0;g<a;g+=p)u.getRandomValues(x.subarray(g,g+Math.min(a-g,p)));for(g=0;g<a;g++)d[g]=x[g];Du(x)})}else typeof Gu<"u"&&(u=df(),u&&u.randomBytes&&r.setPRNG(function(d,a){var g,x=u.randomBytes(a);for(g=0;g<a;g++)d[g]=x[g];Du(x)}))}()})(typeof ti<"u"&&ti.exports?ti.exports:self.nacl=self.nacl||{})});var Ph={};Gs(Ph,{APTOS_BIP44_REGEX:()=>hf,APTOS_COIN:()=>$o,APTOS_HARDENED_REGEX:()=>yf,Account:()=>Dr,AccountAddress:()=>H,AccountAuthenticator:()=>vt,AccountAuthenticatorEd25519:()=>mr,AccountAuthenticatorMultiEd25519:()=>ps,AccountAuthenticatorMultiKey:()=>Ln,AccountAuthenticatorSingleKey:()=>sr,AccountAuthenticatorVariant:()=>Ca,AccountSequenceNumber:()=>Ps,AddressInvalidReason:()=>rf,AnyPublicKey:()=>je,AnyPublicKeyVariant:()=>Ua,AnySignature:()=>lr,AnySignatureVariant:()=>Ia,Aptos:()=>Nt,AptosApiError:()=>cr,AptosApiType:()=>Ho,AptosConfig:()=>ds,AuthenticationKey:()=>or,Bool:()=>Xe,CKDPriv:()=>ec,ChainId:()=>$n,DEFAULT_MAX_GAS_AMOUNT:()=>Na,DEFAULT_NETWORK:()=>Oa,DEFAULT_TXN_EXP_SEC_FROM_NOW:()=>ka,DEFAULT_TXN_TIMEOUT_SEC:()=>Fo,DeriveScheme:()=>Vu,Deserializer:()=>Qa,Ed25519PrivateKey:()=>Ur,Ed25519PublicKey:()=>qe,Ed25519Signature:()=>Je,EntryFunction:()=>ro,EntryFunctionBytes:()=>Qo,FeePayerRawTransaction:()=>xr,FixedBytes:()=>$r,HARDENED_OFFSET:()=>Za,Hex:()=>Be,HexInvalidReason:()=>ef,Identifier:()=>Qe,KeyType:()=>Af,MimeType:()=>Ls,ModuleId:()=>So,MoveAbility:()=>Fu,MoveFunctionVisibility:()=>Hu,MoveOption:()=>Cr,MoveString:()=>ht,MoveVector:()=>Le,MultiAgentRawTransaction:()=>Ar,MultiEd25519PublicKey:()=>er,MultiEd25519Signature:()=>Bn,MultiKey:()=>Gn,MultiSig:()=>Io,MultiSigTransactionPayload:()=>Bo,Network:()=>Ko,NetworkToChainId:()=>Hs,NetworkToFaucetAPI:()=>Ra,NetworkToIndexerAPI:()=>Ks,NetworkToNetworkName:()=>tg,NetworkToNodeAPI:()=>Pa,ParsingError:()=>bt,PrivateKey:()=>Un,ProcessorType:()=>bn,PublicKey:()=>It,RAW_TRANSACTION_SALT:()=>za,RAW_TRANSACTION_WITH_DATA_SALT:()=>Fs,RawTransaction:()=>Vt,RawTransactionWithData:()=>ms,RoleType:()=>$u,RotationProofChallenge:()=>ls,Script:()=>Uo,ScriptTransactionArgumentVariants:()=>ao,Secp256k1PrivateKey:()=>Nr,Secp256k1PublicKey:()=>Ft,Secp256k1Signature:()=>kr,Serializable:()=>ae,Serializer:()=>Zt,Signature:()=>Jt,SignedTransaction:()=>ir,SigningScheme:()=>co,SigningSchemeInput:()=>Ba,StructTag:()=>hr,TransactionAuthenticator:()=>yr,TransactionAuthenticatorEd25519:()=>qn,TransactionAuthenticatorFeePayer:()=>Hn,TransactionAuthenticatorMultiAgent:()=>Kn,TransactionAuthenticatorMultiEd25519:()=>ji,TransactionAuthenticatorSingleSender:()=>Fn,TransactionAuthenticatorVariant:()=>va,TransactionPayload:()=>gn,TransactionPayloadEntryFunction:()=>vo,TransactionPayloadMultiSig:()=>Co,TransactionPayloadScript:()=>Eo,TransactionPayloadVariants:()=>Sa,TransactionResponseType:()=>qs,TransactionVariants:()=>Ea,TransactionWorker:()=>Rs,TypeTag:()=>rt,TypeTagAddress:()=>Jn,TypeTagBool:()=>Vn,TypeTagGeneric:()=>eo,TypeTagParserError:()=>He,TypeTagParserErrorType:()=>Nl,TypeTagReference:()=>gs,TypeTagSigner:()=>pn,TypeTagStruct:()=>Gr,TypeTagU128:()=>Zn,TypeTagU16:()=>Qn,TypeTagU256:()=>Xn,TypeTagU32:()=>Wn,TypeTagU64:()=>Yn,TypeTagU8:()=>jn,TypeTagVariants:()=>_a,TypeTagVector:()=>to,U128:()=>Mt,U16:()=>zt,U256:()=>Gt,U32:()=>Dt,U64:()=>ft,U8:()=>lt,aptosCoinStructTag:()=>mh,aptosRequest:()=>qo,buildTransaction:()=>sa,checkOrConvertArgument:()=>oo,convertArgument:()=>Au,deriveKey:()=>ni,deriveTransactionType:()=>Tu,deserializeFromScriptArgument:()=>Pl,ensureBoolean:()=>Ys,fetchEntryFunctionAbi:()=>hu,findFirstNonSignerArg:()=>gu,generateMultiSignersSignedTransaction:()=>Gl,generateRawTransaction:()=>Ml,generateSignedTransaction:()=>wu,generateSignedTransactionForSimulation:()=>xu,generateSigningMessage:()=>ia,generateTransactionPayload:()=>bs,generateTransactionPayloadWithABI:()=>zl,get:()=>Da,getAptosFullNode:()=>Ut,getAuthenticatorForSimulation:()=>xs,getFunctionParts:()=>oa,isBcsAddress:()=>As,isBcsBool:()=>Wi,isBcsFixedBytes:()=>kl,isBcsString:()=>Yi,isBcsU128:()=>ta,isBcsU16:()=>Xi,isBcsU256:()=>ra,isBcsU32:()=>Ji,isBcsU64:()=>ea,isBcsU8:()=>Zi,isBlockMetadataTransactionResponse:()=>Qp,isBool:()=>du,isEd25519Signature:()=>Yp,isEncodedEntryFunctionArgument:()=>pu,isFeePayerSignature:()=>Jp,isGenesisTransactionResponse:()=>jp,isLargeNumber:()=>hs,isMultiAgentSignature:()=>Xp,isMultiEd25519Signature:()=>eg,isNull:()=>lu,isNumber:()=>ys,isPendingTransactionResponse:()=>$p,isScriptDataInput:()=>na,isSecp256k1Signature:()=>Zp,isStateCheckpointTransactionResponse:()=>Wp,isString:()=>no,isUserTransactionResponse:()=>Vp,isValidBIP44Path:()=>Xa,isValidHardenedPath:()=>Ja,mnemonicToSeed:()=>Yo,objectStructTag:()=>Ah,optionStructTag:()=>hh,outOfRangeErrorMessage:()=>tf,paginateWithCursor:()=>wn,parseTypeTag:()=>Po,post:()=>$s,postAptosFaucet:()=>Ga,postAptosFullNode:()=>Tn,postAptosIndexer:()=>Ma,request:()=>Qu,sign:()=>bu,splitPath:()=>tc,standardizeTypeTags:()=>yu,stringStructTag:()=>yh,throwTypeMismatch:()=>$e,validateNumberInRange:()=>Sr});var cr=class extends Error{constructor(e,n,o){super(o);this.name="AptosApiError",this.url=n.url,this.status=n.status,this.statusText=n.statusText,this.data=n.data,this.request=e}};var Ku="1.4.0";var Ls=(n=>(n.JSON="application/json",n.BCS="application/x-bcs",n.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",n))(Ls||{}),_a=(v=>(v[v.Bool=0]="Bool",v[v.U8=1]="U8",v[v.U64=2]="U64",v[v.U128=3]="U128",v[v.Address=4]="Address",v[v.Signer=5]="Signer",v[v.Vector=6]="Vector",v[v.Struct=7]="Struct",v[v.U16=8]="U16",v[v.U32=9]="U32",v[v.U256=10]="U256",v[v.Reference=254]="Reference",v[v.Generic=255]="Generic",v))(_a||{}),ao=(l=>(l[l.U8=0]="U8",l[l.U64=1]="U64",l[l.U128=2]="U128",l[l.Address=3]="Address",l[l.U8Vector=4]="U8Vector",l[l.Bool=5]="Bool",l[l.U16=6]="U16",l[l.U32=7]="U32",l[l.U256=8]="U256",l))(ao||{}),Sa=(n=>(n[n.Script=0]="Script",n[n.EntryFunction=2]="EntryFunction",n[n.Multisig=3]="Multisig",n))(Sa||{}),Ea=(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(Ea||{}),va=(s=>(s[s.Ed25519=0]="Ed25519",s[s.MultiEd25519=1]="MultiEd25519",s[s.MultiAgent=2]="MultiAgent",s[s.FeePayer=3]="FeePayer",s[s.SingleSender=4]="SingleSender",s))(va||{}),Ca=(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(Ca||{}),Ua=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(Ua||{}),Ia=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(Ia||{}),qs=(s=>(s.Pending="pending_transaction",s.User="user_transaction",s.Genesis="genesis_transaction",s.BlockMetadata="block_metadata_transaction",s.StateCheckpoint="state_checkpoint_transaction",s))(qs||{});function $p(r){return r.type==="pending_transaction"}function Vp(r){return r.type==="user_transaction"}function jp(r){return r.type==="genesis_transaction"}function Qp(r){return r.type==="block_metadata_transaction"}function Wp(r){return r.type==="state_checkpoint_transaction"}function Yp(r){return"signature"in r&&r.signature==="ed25519_signature"}function Zp(r){return"signature"in r&&r.signature==="secp256k1_ecdsa_signature"}function Xp(r){return r.type==="multi_agent_signature"}function Jp(r){return r.type==="fee_payer_signature"}function eg(r){return r.type==="multi_ed25519_signature"}var Hu=(n=>(n.PRIVATE="private",n.PUBLIC="public",n.FRIEND="friend",n))(Hu||{}),Fu=(o=>(o.STORE="store",o.DROP="drop",o.KEY="key",o.COPY="copy",o))(Fu||{}),$u=(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))($u||{}),co=(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(co||{}),Ba=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",e))(Ba||{}),Vu=(s=>(s[s.DeriveAuid=251]="DeriveAuid",s[s.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",s[s.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",s[s.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",s[s.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",s))(Vu||{});var ju={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"};async function Qu(r,t){let{url:e,method:n,body:o,contentType:s,params:i,overrides:c}=r,f={...c?.HEADERS,"x-aptos-client":`aptos-typescript-sdk/${Ku}`,"content-type":s??"application/json"};return c?.AUTH_TOKEN&&e.includes("faucet")&&(f.Authorization=`Bearer ${c?.AUTH_TOKEN}`),c?.API_KEY&&!e.includes("faucet")&&(f.Authorization=`Bearer ${c?.API_KEY}`),t.provider({url:e,method:n,body:o,params:i,headers:f,overrides:c})}async function qo(r,t){let{url:e,path:n}=r,o=`${e}/${n??""}`,s=await Qu({...r,url:o},t.client),i={status:s.status,statusText:s.statusText,data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(t.isIndexerRequest(e)){let f=i.data;if(f.errors)throw new cr(r,i,f.errors[0].message??`Unhandled Error ${s.status} : ${s.statusText}`);i.data=f.data}if(i.status>=200&&i.status<300)return i;let c;throw i&&i.data&&"message"in i.data&&"error_code"in i.data?c=JSON.stringify(i.data):i.status in ju?c=ju[i.status]:c=`Unhandled Error ${i.status} : ${i.statusText}`,new cr(r,i,c)}var Ks={mainnet:"https://indexer.mainnet.aptoslabs.com/v1/graphql",testnet:"https://indexer-testnet.staging.gcp.aptosdev.com/v1/graphql",devnet:"https://indexer-devnet.staging.gcp.aptosdev.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},Pa={mainnet:"https://fullnode.mainnet.aptoslabs.com/v1",testnet:"https://fullnode.testnet.aptoslabs.com/v1",devnet:"https://fullnode.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},Ra={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},Ko=(s=>(s.MAINNET="mainnet",s.TESTNET="testnet",s.DEVNET="devnet",s.LOCAL="local",s.CUSTOM="custom",s))(Ko||{}),Hs={mainnet:1,testnet:2},tg={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};var Ho=(n=>(n[n.FULLNODE=0]="FULLNODE",n[n.INDEXER=1]="INDEXER",n[n.FAUCET=2]="FAUCET",n))(Ho||{}),Oa="devnet",Na=2e5,ka=20,Fo=20,$o="0x1::aptos_coin::AptosCoin",za="APTOS::RawTransaction",Fs="APTOS::RawTransactionWithData",bn=(c=>(c.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",c.DEFAULT="default_processor",c.EVENTS_PROCESSOR="events_processor",c.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",c.STAKE_PROCESSOR="stake_processor",c.TOKEN_V2_PROCESSOR="token_v2_processor",c.USER_TRANSACTION_PROCESSOR="user_transaction_processor",c))(bn||{});async function Da(r){let{aptosConfig:t,overrides:e,params:n,contentType:o,acceptType:s,path:i,originMethod:c,type:f}=r,l=t.getRequestUrl(f);return qo({url:l,method:"GET",originMethod:c,path:i,contentType:o?.valueOf(),acceptType:s?.valueOf(),params:n,overrides:{...t.clientConfig,...e}},t)}async function Ut(r){return Da({...r,type:0})}async function wn(r){let t=[],e,n=r.params;for(;;){n.start=e;let o=await Da({type:0,aptosConfig:r.aptosConfig,originMethod:r.originMethod,path:r.path,params:n,overrides:r.overrides});if(e=o.headers["x-aptos-cursor"],delete o.headers,t.push(...o.data),e==null)break}return t}async function $s(r){let{type:t,originMethod:e,path:n,body:o,acceptType:s,contentType:i,params:c,aptosConfig:f,overrides:l}=r,h=f.getRequestUrl(t);return qo({url:h,method:"POST",originMethod:e,path:n,body:o,contentType:i?.valueOf(),acceptType:s?.valueOf(),params:c,overrides:{...f.clientConfig,...l}},f)}async function Tn(r){return $s({...r,type:0})}async function Ma(r){return $s({...r,type:1})}async function Ga(r){return $s({...r,type:2})}var Vs=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var Yu=r=>new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4));function La(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}var ur=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),Wt=(r,t)=>r<<32-t|r>>>t,rg=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!rg)throw new Error("Non little-endian hardware is not supported");var ng=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function _n(r){if(!La(r))throw new Error("Uint8Array expected");let t="";for(let e=0;e<r.length;e++)t+=ng[r[e]];return t}var Tr={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Wu(r){if(r>=Tr._0&&r<=Tr._9)return r-Tr._0;if(r>=Tr._A&&r<=Tr._F)return r-(Tr._A-10);if(r>=Tr._a&&r<=Tr._f)return r-(Tr._a-10)}function uo(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.length,e=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(e);for(let o=0,s=0;o<e;o++,s+=2){let i=Wu(r.charCodeAt(s)),c=Wu(r.charCodeAt(s+1));if(i===void 0||c===void 0){let f=r[s]+r[s+1];throw new Error('hex string expected, got non-hex character "'+f+'" at index '+s)}n[o]=i*16+c}return n}function qa(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function Yt(r){if(typeof r=="string"&&(r=qa(r)),!La(r))throw new Error(`expected Uint8Array, got ${typeof r}`);return r}function Sn(...r){let t=0;for(let n=0;n<r.length;n++){let o=r[n];if(!La(o))throw new Error("Uint8Array expected");t+=o.length}let e=new Uint8Array(t);for(let n=0,o=0;n<r.length;n++){let s=r[n];e.set(s,o),o+=s.length}return e}var Kr=class{clone(){return this._cloneInto()}},og={}.toString;function Zu(r,t){if(t!==void 0&&og.call(t)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(r,t)}function Hr(r){let t=n=>r().update(Yt(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function Xu(r){let t=(n,o)=>r(o).update(Yt(n)).digest(),e=r({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>r(n),t}function Ju(r=32){if(Vs&&typeof Vs.getRandomValues=="function")return Vs.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}var js=255,Qs=65535,_r=4294967295,En=18446744073709551615n,Vo=340282366920938463463374607431768211455n,Ws=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var bt=class extends Error{constructor(e,n){super(e);this.invalidReason=n}};var ef=(n=>(n.TOO_SHORT="too_short",n.INVALID_LENGTH="invalid_length",n.INVALID_HEX_CHARS="invalid_hex_chars",n))(ef||{}),Be=class r{constructor(t){this.data=t}toUint8Array(){return this.data}toStringWithoutPrefix(){return _n(this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromString(t){let e=t;if(e.startsWith("0x")&&(e=e.slice(2)),e.length===0)throw new bt("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(e.length%2!==0)throw new bt("Hex string must be an even number of hex characters.","invalid_length");try{return new r(uo(e))}catch(n){throw new bt(`Hex string contains invalid hex characters: ${n?.message}`,"invalid_hex_chars")}}static fromHexInput(t){return t instanceof Uint8Array?new r(t):r.fromString(t)}static isValid(t){try{return r.fromString(t),{valid:!0}}catch(e){return{valid:!1,invalidReason:e?.invalidReason,invalidReasonMessage:e?.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((e,n)=>e===t.data[n])}};var ae=class{bcsToBytes(){let t=new Zt;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return Be.fromHexInput(t)}},Zt=class{constructor(t=64){if(t<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(t),this.offset=0}ensureBufferWillHandleSize(t){for(;this.buffer.byteLength<this.offset+t;){let e=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e}}appendToBuffer(t){this.ensureBufferWillHandleSize(t.length),new Uint8Array(this.buffer,this.offset).set(t),this.offset+=t.length}serializeWithFunction(t,e,n){this.ensureBufferWillHandleSize(e);let o=new DataView(this.buffer,this.offset);t.apply(o,[0,n,!0]),this.offset+=e}serializeStr(t){let e=new TextEncoder;this.serializeBytes(e.encode(t))}serializeBytes(t){this.serializeU32AsUleb128(t.length),this.appendToBuffer(t)}serializeFixedBytes(t){this.appendToBuffer(t)}serializeBool(t){Ys(t);let e=t?1:0;this.appendToBuffer(new Uint8Array([e]))}serializeU8(t){this.appendToBuffer(new Uint8Array([t]))}serializeU16(t){this.serializeWithFunction(DataView.prototype.setUint16,2,t)}serializeU32(t){this.serializeWithFunction(DataView.prototype.setUint32,4,t)}serializeU64(t){let e=BigInt(t)&BigInt(_r),n=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(n))}serializeU128(t){let e=BigInt(t)&En,n=BigInt(t)>>BigInt(64);this.serializeU64(e),this.serializeU64(n)}serializeU256(t){let e=BigInt(t)&Vo,n=BigInt(t)>>BigInt(128);this.serializeU128(e),this.serializeU128(n)}serializeU32AsUleb128(t){let e=t,n=[];for(;e>>>7;)n.push(e&127|128),e>>>=7;n.push(e),this.appendToBuffer(new Uint8Array(n))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(t){t.serialize(this)}serializeVector(t){this.serializeU32AsUleb128(t.length),t.forEach(e=>{e.serialize(this)})}};Et([vn(0,js)],Zt.prototype,"serializeU8",1),Et([vn(0,Qs)],Zt.prototype,"serializeU16",1),Et([vn(0,_r)],Zt.prototype,"serializeU32",1),Et([vn(BigInt(0),En)],Zt.prototype,"serializeU64",1),Et([vn(BigInt(0),Vo)],Zt.prototype,"serializeU128",1),Et([vn(BigInt(0),Ws)],Zt.prototype,"serializeU256",1),Et([vn(0,_r)],Zt.prototype,"serializeU32AsUleb128",1);function Ys(r){if(typeof r!="boolean")throw new Error(`${r} is not a boolean value`)}var tf=(r,t,e)=>`${r} is out of range: [${t}, ${e}]`;function Sr(r,t,e){let n=BigInt(r);if(n>BigInt(e)||n<BigInt(t))throw new Error(tf(r,t,e))}function vn(r,t){return(e,n,o)=>{let s=o.value;return o.value=function(c){return Sr(c,r,t),s.apply(this,[c])},o}}var rf=(c=>(c.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",c.INVALID_HEX_CHARS="invalid_hex_chars",c.TOO_SHORT="too_short",c.TOO_LONG="too_long",c.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",c.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",c.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",c))(rf||{}),Ge=class Ge extends ae{constructor(e){super();if(e.length!==Ge.LENGTH)throw new bt("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=e}isSpecial(){return this.data.slice(0,this.data.length-1).every(e=>e===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let e=_n(this.data);return this.isSpecial()&&(e=e[e.length-1]),e}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return _n(this.data)}toUint8Array(){return this.data}serialize(e){e.serializeFixedBytes(this.data)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(3),e.serialize(this)}static deserialize(e){let n=e.deserializeFixedBytes(Ge.LENGTH);return new Ge(n)}static fromStringStrict(e){if(!e.startsWith("0x"))throw new bt("Hex string must start with a leading 0x.","leading_zero_x_required");let n=Ge.fromString(e);if(e.length!==Ge.LONG_STRING_LENGTH+2)if(n.isSpecial()){if(e.length!==3)throw new bt(`The given hex string ${e} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new bt(`The given hex string ${e} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return n}static fromString(e){let n=e;if(e.startsWith("0x")&&(n=e.slice(2)),n.length===0)throw new bt("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(n.length>64)throw new bt("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let o;try{o=uo(n.padStart(64,"0"))}catch(s){throw new bt(`Hex characters are invalid: ${s?.message}`,"invalid_hex_chars")}return new Ge(o)}static from(e){return e instanceof Ge?e:e instanceof Uint8Array?new Ge(e):Ge.fromString(e)}static fromStrict(e){return e instanceof Ge?e:e instanceof Uint8Array?new Ge(e):Ge.fromStringStrict(e)}static isValid(e){try{return e.strict?Ge.fromStrict(e.input):Ge.from(e.input),{valid:!0}}catch(n){return{valid:!1,invalidReason:n?.invalidReason,invalidReasonMessage:n?.message}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((n,o)=>n===e.data[o])}};Ge.LENGTH=32,Ge.LONG_STRING_LENGTH=64,Ge.ZERO=Ge.from("0x0"),Ge.ONE=Ge.from("0x1"),Ge.TWO=Ge.from("0x2"),Ge.THREE=Ge.from("0x3"),Ge.FOUR=Ge.from("0x4");var H=Ge;function Er(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function sg(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function Xt(r,...t){if(!sg(r))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(r.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${r.length}`)}function Zs(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Er(r.outputLen),Er(r.blockLen)}function vr(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function Xs(r,t){Xt(r);let e=t.outputLen;if(r.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var Js=BigInt(4294967295),Ka=BigInt(32);function nf(r,t=!1){return t?{h:Number(r&Js),l:Number(r>>Ka&Js)}:{h:Number(r>>Ka&Js)|0,l:Number(r&Js)|0}}function Ha(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let o=0;o<r.length;o++){let{h:s,l:i}=nf(r[o],t);[e[o],n[o]]=[s,i]}return[e,n]}var ig=(r,t)=>BigInt(r>>>0)<<Ka|BigInt(t>>>0),ag=(r,t,e)=>r>>>e,cg=(r,t,e)=>r<<32-e|t>>>e,ug=(r,t,e)=>r>>>e|t<<32-e,fg=(r,t,e)=>r<<32-e|t>>>e,dg=(r,t,e)=>r<<64-e|t>>>e-32,lg=(r,t,e)=>r>>>e-32|t<<64-e,pg=(r,t)=>t,gg=(r,t)=>r,Fa=(r,t,e)=>r<<e|t>>>32-e,$a=(r,t,e)=>t<<e|r>>>32-e,Va=(r,t,e)=>t<<e-32|r>>>64-e,ja=(r,t,e)=>r<<e-32|t>>>64-e;function mg(r,t,e,n){let o=(t>>>0)+(n>>>0);return{h:r+e+(o/2**32|0)|0,l:o|0}}var yg=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),hg=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,Ag=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),xg=(r,t,e,n,o)=>t+e+n+o+(r/2**32|0)|0,bg=(r,t,e,n,o)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(o>>>0),wg=(r,t,e,n,o,s)=>t+e+n+o+s+(r/2**32|0)|0;var Tg={fromBig:nf,split:Ha,toBig:ig,shrSH:ag,shrSL:cg,rotrSH:ug,rotrSL:fg,rotrBH:dg,rotrBL:lg,rotr32H:pg,rotr32L:gg,rotlSH:Fa,rotlSL:$a,rotlBH:Va,rotlBL:ja,add:mg,add3L:yg,add3H:hg,add4L:Ag,add4H:xg,add5H:wg,add5L:bg},Ae=Tg;var[af,cf,uf]=[[],[],[]],_g=BigInt(0),jo=BigInt(1),Sg=BigInt(2),Eg=BigInt(7),vg=BigInt(256),Cg=BigInt(113);for(let r=0,t=jo,e=1,n=0;r<24;r++){[e,n]=[n,(2*e+3*n)%5],af.push(2*(5*n+e)),cf.push((r+1)*(r+2)/2%64);let o=_g;for(let s=0;s<7;s++)t=(t<<jo^(t>>Eg)*Cg)%vg,t&Sg&&(o^=jo<<(jo<<BigInt(s))-jo);uf.push(o)}var[Ug,Ig]=Ha(uf,!0),of=(r,t,e)=>e>32?Va(r,t,e):Fa(r,t,e),sf=(r,t,e)=>e>32?ja(r,t,e):$a(r,t,e);function Bg(r,t=24){let e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let i=0;i<10;i++)e[i]=r[i]^r[i+10]^r[i+20]^r[i+30]^r[i+40];for(let i=0;i<10;i+=2){let c=(i+8)%10,f=(i+2)%10,l=e[f],h=e[f+1],m=of(l,h,1)^e[c],T=sf(l,h,1)^e[c+1];for(let v=0;v<50;v+=10)r[i+v]^=m,r[i+v+1]^=T}let o=r[2],s=r[3];for(let i=0;i<24;i++){let c=cf[i],f=of(o,s,c),l=sf(o,s,c),h=af[i];o=r[h],s=r[h+1],r[h]=f,r[h+1]=l}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)e[c]=r[i+c];for(let c=0;c<10;c++)r[i+c]^=~e[(c+2)%10]&e[(c+4)%10]}r[0]^=Ug[n],r[1]^=Ig[n]}e.fill(0)}var ei=class r extends Kr{constructor(t,e,n,o=!1,s=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=o,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Er(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Yu(this.state)}keccak(){Bg(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){vr(this);let{blockLen:e,state:n}=this;t=Yt(t);let o=t.length;for(let s=0;s<o;){let i=Math.min(e-this.pos,o-s);for(let c=0;c<i;c++)n[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:e,pos:n,blockLen:o}=this;t[n]^=e,e&128&&n===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){vr(this,!1),Xt(t),this.finish();let e=this.state,{blockLen:n}=this;for(let o=0,s=t.length;o<s;){this.posOut>=n&&this.keccak();let i=Math.min(n-this.posOut,s-o);t.set(e.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Er(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Xs(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:e,suffix:n,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new r(e,n,o,i,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=o,t.enableXOF=i,t.destroyed=this.destroyed,t}},Fr=(r,t,e)=>Hr(()=>new ei(t,r,e)),O0=Fr(6,144,224/8),Cn=Fr(6,136,256/8),N0=Fr(6,104,384/8),k0=Fr(6,72,512/8),z0=Fr(1,144,224/8),D0=Fr(1,136,256/8),M0=Fr(1,104,384/8),G0=Fr(1,72,512/8),ff=(r,t,e)=>Xu((n={})=>new ei(t,r,n.dkLen===void 0?e:n.dkLen,!0)),L0=ff(31,168,128/8),q0=ff(31,136,256/8);var Zo=Hp(lf());var Qa=class{constructor(t){this.buffer=new ArrayBuffer(t.length),new Uint8Array(this.buffer).set(t,0),this.offset=0}read(t){if(this.offset+t>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}deserializeStr(){let t=this.deserializeBytes();return new TextDecoder().decode(t)}deserializeBytes(){let t=this.deserializeUleb128AsU32();return new Uint8Array(this.read(t))}deserializeFixedBytes(t){return new Uint8Array(this.read(t))}deserializeBool(){let t=new Uint8Array(this.read(1))[0];if(t!==1&&t!==0)throw new Error("Invalid boolean value");return t===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let t=this.deserializeU32(),e=this.deserializeU32();return BigInt(BigInt(e)<<BigInt(32)|BigInt(t))}deserializeU128(){let t=this.deserializeU64(),e=this.deserializeU64();return BigInt(e<<BigInt(64)|t)}deserializeU256(){let t=this.deserializeU128(),e=this.deserializeU128();return BigInt(e<<BigInt(128)|t)}deserializeUleb128AsU32(){let t=BigInt(0),e=0;for(;t<_r;){let n=this.deserializeU8();if(t|=BigInt(n&127)<<BigInt(e),!(n&128))break;e+=7}if(t>_r)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(t)}deserialize(t){return t.deserialize(this)}deserializeVector(t){let e=this.deserializeUleb128AsU32(),n=new Array;for(let o=0;o<e;o+=1)n.push(this.deserialize(t));return n}};var $r=class r extends ae{constructor(e){super();this.value=Be.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,n){let o=e.deserializeFixedBytes(n);return new r(o)}};var Qo=class r extends ae{constructor(e){super();this.value=new $r(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,n){let o=$r.deserialize(e,n);return new r(o.value)}};var Xe=class r extends ae{constructor(e){super();Ys(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}static deserialize(e){return new r(e.deserializeBool())}},lt=class r extends ae{constructor(e){super();Sr(e,0,js),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new r(e.deserializeU8())}},zt=class r extends ae{constructor(e){super();Sr(e,0,Qs),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new r(e.deserializeU16())}},Dt=class r extends ae{constructor(e){super();Sr(e,0,_r),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new r(e.deserializeU32())}},ft=class r extends ae{constructor(e){super();Sr(e,BigInt(0),En),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new r(e.deserializeU64())}},Mt=class r extends ae{constructor(e){super();Sr(e,BigInt(0),Vo),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new r(e.deserializeU128())}},Gt=class r extends ae{constructor(e){super();Sr(e,BigInt(0),Ws),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new r(e.deserializeU256())}};var Le=class r extends ae{constructor(e){super();this.values=e}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){if(!(this.values[0]instanceof lt)&&this.values[0]!==void 0)throw new Error("Script function arguments only accept u8 vectors");e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let n;if(Array.isArray(e)&&typeof e[0]=="number")n=e;else if(typeof e=="string"){let o=Be.fromHexInput(e);n=Array.from(o.toUint8Array())}else if(e instanceof Uint8Array)n=Array.from(e);else throw new Error("Invalid input type");return new r(n.map(o=>new lt(o)))}static U16(e){return new r(e.map(n=>new zt(n)))}static U32(e){return new r(e.map(n=>new Dt(n)))}static U64(e){return new r(e.map(n=>new ft(n)))}static U128(e){return new r(e.map(n=>new Mt(n)))}static U256(e){return new r(e.map(n=>new Gt(n)))}static Bool(e){return new r(e.map(n=>new Xe(n)))}static MoveString(e){return new r(e.map(n=>new ht(n)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,n){let o=e.deserializeUleb128AsU32(),s=new Array;for(let i=0;i<o;i+=1)s.push(n.deserialize(e));return new r(s)}},ht=class r extends ae{constructor(e){super();this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){let n=this.bcsToBytes().slice(1);Le.U8(n).serializeForScriptFunction(e)}static deserialize(e){return new r(e.deserializeStr())}},Cr=class r extends ae{constructor(e){super();typeof e<"u"&&e!==null?this.vec=new Le([e]):this.vec=new Le([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new r(e!=null?new lt(e):void 0)}static U16(e){return new r(e!=null?new zt(e):void 0)}static U32(e){return new r(e!=null?new Dt(e):void 0)}static U64(e){return new r(e!=null?new ft(e):void 0)}static U128(e){return new r(e!=null?new Mt(e):void 0)}static U256(e){return new r(e!=null?new Gt(e):void 0)}static Bool(e){return new r(e!=null?new Xe(e):void 0)}static MoveString(e){return new r(e!=null?new ht(e):void 0)}static deserialize(e,n){let o=Le.deserialize(e,n);return new r(o.values[0])}};var It=class extends ae{},Un=class extends ae{},Jt=class extends ae{};var ri=class extends Kr{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,Zs(t);let n=Yt(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,s=new Uint8Array(o);s.set(n.length>o?t.create().update(n).digest():n);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),s.fill(0)}update(t){return vr(this),this.iHash.update(t),this}digestInto(t){vr(this),Xt(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:e,iHash:n,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},fr=(r,t,e)=>new ri(r,t).update(e).digest();fr.create=(r,t)=>new ri(r,t);function Pg(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);let o=BigInt(32),s=BigInt(4294967295),i=Number(e>>o&s),c=Number(e&s),f=n?4:0,l=n?0:4;r.setUint32(t+f,i,n),r.setUint32(t+l,c,n)}var Vr=class extends Kr{constructor(t,e,n,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=ur(this.buffer)}update(t){vr(this);let{view:e,buffer:n,blockLen:o}=this;t=Yt(t);let s=t.length;for(let i=0;i<s;){let c=Math.min(o-this.pos,s-i);if(c===o){let f=ur(t);for(;o<=s-i;i+=o)this.process(f,i);continue}n.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){vr(this),Xs(t,this),this.finished=!0;let{buffer:e,view:n,blockLen:o,isLE:s}=this,{pos:i}=this;e[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(n,0),i=0);for(let m=i;m<o;m++)e[m]=0;Pg(n,o-8,BigInt(this.length*8),s),this.process(n,0);let c=ur(t),f=this.outputLen;if(f%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let l=f/4,h=this.get();if(l>h.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<l;m++)c.setUint32(4*m,h[m],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:n,length:o,finished:s,destroyed:i,pos:c}=this;return t.length=o,t.pos=c,t.finished=s,t.destroyed=i,o%e&&t.buffer.set(n),t}};var[Rg,Og]=Ae.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),jr=new Uint32Array(80),Qr=new Uint32Array(80),Wa=class extends Vr{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:e,Bh:n,Bl:o,Ch:s,Cl:i,Dh:c,Dl:f,Eh:l,El:h,Fh:m,Fl:T,Gh:v,Gl:b,Hh:y,Hl:w}=this;return[t,e,n,o,s,i,c,f,l,h,m,T,v,b,y,w]}set(t,e,n,o,s,i,c,f,l,h,m,T,v,b,y,w){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=o|0,this.Ch=s|0,this.Cl=i|0,this.Dh=c|0,this.Dl=f|0,this.Eh=l|0,this.El=h|0,this.Fh=m|0,this.Fl=T|0,this.Gh=v|0,this.Gl=b|0,this.Hh=y|0,this.Hl=w|0}process(t,e){for(let P=0;P<16;P++,e+=4)jr[P]=t.getUint32(e),Qr[P]=t.getUint32(e+=4);for(let P=16;P<80;P++){let $=jr[P-15]|0,M=Qr[P-15]|0,z=Ae.rotrSH($,M,1)^Ae.rotrSH($,M,8)^Ae.shrSH($,M,7),L=Ae.rotrSL($,M,1)^Ae.rotrSL($,M,8)^Ae.shrSL($,M,7),K=jr[P-2]|0,we=Qr[P-2]|0,te=Ae.rotrSH(K,we,19)^Ae.rotrBH(K,we,61)^Ae.shrSH(K,we,6),W=Ae.rotrSL(K,we,19)^Ae.rotrBL(K,we,61)^Ae.shrSL(K,we,6),ve=Ae.add4L(L,W,Qr[P-7],Qr[P-16]),Ce=Ae.add4H(ve,z,te,jr[P-7],jr[P-16]);jr[P]=Ce|0,Qr[P]=ve|0}let{Ah:n,Al:o,Bh:s,Bl:i,Ch:c,Cl:f,Dh:l,Dl:h,Eh:m,El:T,Fh:v,Fl:b,Gh:y,Gl:w,Hh:E,Hl:k}=this;for(let P=0;P<80;P++){let $=Ae.rotrSH(m,T,14)^Ae.rotrSH(m,T,18)^Ae.rotrBH(m,T,41),M=Ae.rotrSL(m,T,14)^Ae.rotrSL(m,T,18)^Ae.rotrBL(m,T,41),z=m&v^~m&y,L=T&b^~T&w,K=Ae.add5L(k,M,L,Og[P],Qr[P]),we=Ae.add5H(K,E,$,z,Rg[P],jr[P]),te=K|0,W=Ae.rotrSH(n,o,28)^Ae.rotrBH(n,o,34)^Ae.rotrBH(n,o,39),ve=Ae.rotrSL(n,o,28)^Ae.rotrBL(n,o,34)^Ae.rotrBL(n,o,39),Ce=n&s^n&c^s&c,Ve=o&i^o&f^i&f;E=y|0,k=w|0,y=v|0,w=b|0,v=m|0,b=T|0,{h:m,l:T}=Ae.add(l|0,h|0,we|0,te|0),l=c|0,h=f|0,c=s|0,f=i|0,s=n|0,i=o|0;let _=Ae.add3L(te,ve,Ve);n=Ae.add3H(_,we,W,Ce),o=_|0}({h:n,l:o}=Ae.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:s,l:i}=Ae.add(this.Bh|0,this.Bl|0,s|0,i|0),{h:c,l:f}=Ae.add(this.Ch|0,this.Cl|0,c|0,f|0),{h:l,l:h}=Ae.add(this.Dh|0,this.Dl|0,l|0,h|0),{h:m,l:T}=Ae.add(this.Eh|0,this.El|0,m|0,T|0),{h:v,l:b}=Ae.add(this.Fh|0,this.Fl|0,v|0,b|0),{h:y,l:w}=Ae.add(this.Gh|0,this.Gl|0,y|0,w|0),{h:E,l:k}=Ae.add(this.Hh|0,this.Hl|0,E|0,k|0),this.set(n,o,s,i,c,f,l,h,m,T,v,b,y,w,E,k)}roundClean(){jr.fill(0),Qr.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var In=Hr(()=>new Wa);function Ng(r,t,e,n){Zs(r);let o=Zu({dkLen:32,asyncTick:10},n),{c:s,dkLen:i,asyncTick:c}=o;if(Er(s),Er(i),Er(c),s<1)throw new Error("PBKDF2: iterations (c) should be >= 1");let f=Yt(t),l=Yt(e),h=new Uint8Array(i),m=fr.create(r,f),T=m._cloneInto().update(l);return{c:s,dkLen:i,asyncTick:c,DK:h,PRF:m,PRFSalt:T}}function kg(r,t,e,n,o){return r.destroy(),t.destroy(),n&&n.destroy(),o.fill(0),e}function pf(r,t,e,n){let{c:o,dkLen:s,DK:i,PRF:c,PRFSalt:f}=Ng(r,t,e,n),l,h=new Uint8Array(4),m=ur(h),T=new Uint8Array(c.outputLen);for(let v=1,b=0;b<s;v++,b+=c.outputLen){let y=i.subarray(b,b+c.outputLen);m.setInt32(0,v,!1),(l=f._cloneInto(l)).update(h).digestInto(T),y.set(T.subarray(0,y.length));for(let w=1;w<o;w++){c._cloneInto(l).update(T).digestInto(T);for(let E=0;E<y.length;E++)y[E]^=T[E]}}return kg(c,f,i,l,T)}var zg=(r,t,e)=>r&t^~r&e,Dg=(r,t,e)=>r&t^r&e^t&e,Mg=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Wr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Yr=new Uint32Array(64),Ya=class extends Vr{constructor(){super(64,32,8,!1),this.A=Wr[0]|0,this.B=Wr[1]|0,this.C=Wr[2]|0,this.D=Wr[3]|0,this.E=Wr[4]|0,this.F=Wr[5]|0,this.G=Wr[6]|0,this.H=Wr[7]|0}get(){let{A:t,B:e,C:n,D:o,E:s,F:i,G:c,H:f}=this;return[t,e,n,o,s,i,c,f]}set(t,e,n,o,s,i,c,f){this.A=t|0,this.B=e|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=f|0}process(t,e){for(let m=0;m<16;m++,e+=4)Yr[m]=t.getUint32(e,!1);for(let m=16;m<64;m++){let T=Yr[m-15],v=Yr[m-2],b=Wt(T,7)^Wt(T,18)^T>>>3,y=Wt(v,17)^Wt(v,19)^v>>>10;Yr[m]=y+Yr[m-7]+b+Yr[m-16]|0}let{A:n,B:o,C:s,D:i,E:c,F:f,G:l,H:h}=this;for(let m=0;m<64;m++){let T=Wt(c,6)^Wt(c,11)^Wt(c,25),v=h+T+zg(c,f,l)+Mg[m]+Yr[m]|0,y=(Wt(n,2)^Wt(n,13)^Wt(n,22))+Dg(n,o,s)|0;h=l,l=f,f=c,c=i+v|0,i=s,s=o,o=n,n=v+y|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,f=f+this.F|0,l=l+this.G|0,h=h+this.H|0,this.set(n,o,s,i,c,f,l,h)}roundClean(){Yr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Wo=Hr(()=>new Ya);function gf(r){if(typeof r!="string")throw new TypeError(`Invalid mnemonic type: ${typeof r}`);return r.normalize("NFKD")}function Gg(r){let t=gf(r),e=t.split(" ");if(![12,15,18,21,24].includes(e.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:e}}var Lg=r=>gf(`mnemonic${r}`);function mf(r,t=""){return pf(In,Gg(r).nfkd,Lg(t),{c:2048,dkLen:64})}var yf=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,hf=/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,Af=(t=>(t.ED25519="ed25519 seed",t))(Af||{}),Za=2147483648;function Xa(r){return hf.test(r)}function Ja(r){return yf.test(r)}var ni=(r,t)=>{let e=fr.create(In,r).update(t).digest();return{key:e.slice(0,32),chainCode:e.slice(32)}},ec=({key:r,chainCode:t},e)=>{let n=new ArrayBuffer(4);new DataView(n).setUint32(0,e);let o=new Uint8Array(n),s=new Uint8Array([0]),i=new Uint8Array([...s,...r,...o]);return ni(t,i)},Kg=r=>r.replace("'",""),tc=r=>r.split("/").slice(1).map(Kg),Yo=r=>{let t=r.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return mf(t)};var Zr=class Zr extends It{constructor(e){super();let n=Be.fromHexInput(e);if(n.toUint8Array().length!==Zr.LENGTH)throw new Error(`PublicKey length should be ${Zr.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:n,signature:o}=e,s=Be.fromHexInput(n).toUint8Array(),i=o.toUint8Array();return Zo.default.sign.detached.verify(s,i,this.key.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new Zr(n)}static load(e){let n=e.deserializeBytes();return new Zr(n)}static isPublicKey(e){return e instanceof Zr}};Zr.LENGTH=32;var qe=Zr,wt=class wt extends Un{constructor(e){super();let n=Be.fromHexInput(e);if(n.toUint8Array().length!==wt.LENGTH)throw new Error(`PrivateKey length should be ${wt.LENGTH}`);this.signingKeyPair=Zo.default.sign.keyPair.fromSeed(n.toUint8Array().slice(0,wt.LENGTH))}toUint8Array(){return this.signingKeyPair.secretKey.slice(0,wt.LENGTH)}toString(){return Be.fromHexInput(this.toUint8Array()).toString()}sign(e){let n=Be.fromHexInput(e),o=Zo.default.sign.detached(n.toUint8Array(),this.signingKeyPair.secretKey);return new Je(o)}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new wt(n)}static generate(){let e=Zo.default.sign.keyPair();return new wt(e.secretKey.slice(0,wt.LENGTH))}publicKey(){let e=this.signingKeyPair.publicKey;return new qe(e)}static fromDerivationPath(e,n){if(!Ja(e))throw new Error(`Invalid derivation path ${e}`);return wt.fromDerivationPathInner(e,Yo(n))}static fromDerivationPathInner(e,n,o=Za){let{key:s,chainCode:i}=ni(wt.SLIP_0010_SEED,n),c=tc(e).map(l=>parseInt(l,10)),{key:f}=c.reduce((l,h)=>ec(l,h+o),{key:s,chainCode:i});return new wt(f)}static isPrivateKey(e){return e instanceof wt}};wt.LENGTH=32,wt.SLIP_0010_SEED="ed25519 seed";var Ur=wt,Xr=class Xr extends Jt{constructor(e){super();let n=Be.fromHexInput(e);if(n.toUint8Array().length!==Xr.LENGTH)throw new Error(`Signature length should be ${Xr.LENGTH}`);this.data=n}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new Xr(n)}static load(e){let n=e.deserializeBytes();return new Xr(n)}static isSignature(e){return e instanceof Xr}};Xr.LENGTH=64;var Je=Xr;var Lt=class Lt extends It{constructor(e){super();let{publicKeys:n,threshold:o}=e;if(n.length>Lt.MAX_KEYS||n.length<Lt.MIN_KEYS)throw new Error(`Must have between ${Lt.MIN_KEYS} and ${Lt.MAX_KEYS} public keys, inclusive`);if(o<Lt.MIN_THRESHOLD||o>n.length)throw new Error(`Threshold must be between ${Lt.MIN_THRESHOLD} and ${n.length}, inclusive`);this.publicKeys=n,this.threshold=o}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*qe.LENGTH+1);return this.publicKeys.forEach((n,o)=>{e.set(n.toUint8Array(),o*qe.LENGTH)}),e[this.publicKeys.length*qe.LENGTH]=this.threshold,e}toString(){return Be.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("TODO - Method not implemented.")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes(),o=n[n.length-1],s=[];for(let i=0;i<n.length-1;i+=qe.LENGTH){let c=i;s.push(new qe(n.subarray(c,c+qe.LENGTH)))}return new Lt({publicKeys:s,threshold:o})}};Lt.MAX_KEYS=32,Lt.MIN_KEYS=2,Lt.MIN_THRESHOLD=1;var er=Lt,qt=class qt extends Jt{constructor(e){super();let{signatures:n,bitmap:o}=e;if(o.length!==qt.BITMAP_LEN)throw new Error(`"bitmap" length should be ${qt.BITMAP_LEN}`);if(n.length>qt.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${qt.MAX_SIGNATURES_SUPPORTED}`);this.signatures=n,this.bitmap=o}toUint8Array(){let e=new Uint8Array(this.signatures.length*Je.LENGTH+qt.BITMAP_LEN);return this.signatures.forEach((n,o)=>{e.set(n.toUint8Array(),o*Je.LENGTH)}),e.set(this.bitmap,this.signatures.length*Je.LENGTH),e}toString(){return Be.fromHexInput(this.toUint8Array()).toString()}static createBitmap(e){let{bits:n}=e,o=128,s=new Uint8Array([0,0,0,0]),i=new Set;return n.forEach(c=>{if(c>=qt.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${qt.MAX_SIGNATURES_SUPPORTED-1}.`);if(i.has(c))throw new Error("Duplicate bits detected.");i.add(c);let f=Math.floor(c/8),l=s[f];l|=o>>c%8,s[f]=l}),s}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes(),o=n.subarray(n.length-4),s=[];for(let i=0;i<n.length-o.length;i+=Je.LENGTH){let c=i;s.push(new Je(n.subarray(c,c+Je.LENGTH)))}return new qt({signatures:s,bitmap:o})}};qt.MAX_SIGNATURES_SUPPORTED=32,qt.BITMAP_LEN=4;var Bn=qt;function xf(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function rc(r,...t){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(r.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${r.length}`)}function bf(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");xf(r.outputLen),xf(r.blockLen)}function fo(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function wf(r,t){rc(r);let e=t.outputLen;if(r.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var oi=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var Tf=r=>r instanceof Uint8Array;var si=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),tr=(r,t)=>r<<32-t|r>>>t,Hg=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Hg)throw new Error("Non little-endian hardware is not supported");function Fg(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function Xo(r){if(typeof r=="string"&&(r=Fg(r)),!Tf(r))throw new Error(`expected Uint8Array, got ${typeof r}`);return r}function _f(...r){let t=new Uint8Array(r.reduce((n,o)=>n+o.length,0)),e=0;return r.forEach(n=>{if(!Tf(n))throw new Error("Uint8Array expected");t.set(n,e),e+=n.length}),t}var lo=class{clone(){return this._cloneInto()}},dx={}.toString;function Sf(r){let t=n=>r().update(Xo(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function Ef(r=32){if(oi&&typeof oi.getRandomValues=="function")return oi.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}function $g(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);let o=BigInt(32),s=BigInt(4294967295),i=Number(e>>o&s),c=Number(e&s),f=n?4:0,l=n?0:4;r.setUint32(t+f,i,n),r.setUint32(t+l,c,n)}var ii=class extends lo{constructor(t,e,n,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=si(this.buffer)}update(t){fo(this);let{view:e,buffer:n,blockLen:o}=this;t=Xo(t);let s=t.length;for(let i=0;i<s;){let c=Math.min(o-this.pos,s-i);if(c===o){let f=si(t);for(;o<=s-i;i+=o)this.process(f,i);continue}n.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){fo(this),wf(t,this),this.finished=!0;let{buffer:e,view:n,blockLen:o,isLE:s}=this,{pos:i}=this;e[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(n,0),i=0);for(let m=i;m<o;m++)e[m]=0;$g(n,o-8,BigInt(this.length*8),s),this.process(n,0);let c=si(t),f=this.outputLen;if(f%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let l=f/4,h=this.get();if(l>h.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<l;m++)c.setUint32(4*m,h[m],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:n,length:o,finished:s,destroyed:i,pos:c}=this;return t.length=o,t.pos=c,t.finished=s,t.destroyed=i,o%e&&t.buffer.set(n),t}};var Vg=(r,t,e)=>r&t^~r&e,jg=(r,t,e)=>r&t^r&e^t&e,Qg=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Jr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),en=new Uint32Array(64),nc=class extends ii{constructor(){super(64,32,8,!1),this.A=Jr[0]|0,this.B=Jr[1]|0,this.C=Jr[2]|0,this.D=Jr[3]|0,this.E=Jr[4]|0,this.F=Jr[5]|0,this.G=Jr[6]|0,this.H=Jr[7]|0}get(){let{A:t,B:e,C:n,D:o,E:s,F:i,G:c,H:f}=this;return[t,e,n,o,s,i,c,f]}set(t,e,n,o,s,i,c,f){this.A=t|0,this.B=e|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=f|0}process(t,e){for(let m=0;m<16;m++,e+=4)en[m]=t.getUint32(e,!1);for(let m=16;m<64;m++){let T=en[m-15],v=en[m-2],b=tr(T,7)^tr(T,18)^T>>>3,y=tr(v,17)^tr(v,19)^v>>>10;en[m]=y+en[m-7]+b+en[m-16]|0}let{A:n,B:o,C:s,D:i,E:c,F:f,G:l,H:h}=this;for(let m=0;m<64;m++){let T=tr(c,6)^tr(c,11)^tr(c,25),v=h+T+Vg(c,f,l)+Qg[m]+en[m]|0,y=(tr(n,2)^tr(n,13)^tr(n,22))+jg(n,o,s)|0;h=l,l=f,f=c,c=i+v|0,i=s,s=o,o=n,n=v+y|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,f=f+this.F|0,l=l+this.G|0,h=h+this.H|0,this.set(n,o,s,i,c,f,l,h)}roundClean(){en.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var vf=Sf(()=>new nc);var ac={};Gs(ac,{bitGet:()=>tm,bitLen:()=>em,bitMask:()=>Jo,bitSet:()=>rm,bytesToHex:()=>Pn,bytesToNumberBE:()=>Ir,bytesToNumberLE:()=>ui,concatBytes:()=>po,createHmacDrbg:()=>ic,ensureBytes:()=>Bt,equalBytes:()=>Xg,hexToBytes:()=>Rn,hexToNumber:()=>sc,numberToBytesBE:()=>tn,numberToBytesLE:()=>fi,numberToHexUnpadded:()=>If,numberToVarBytesBE:()=>Zg,utf8ToBytes:()=>Jg,validateObject:()=>rn});var Uf=BigInt(0),ai=BigInt(1),Wg=BigInt(2),ci=r=>r instanceof Uint8Array,Yg=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function Pn(r){if(!ci(r))throw new Error("Uint8Array expected");let t="";for(let e=0;e<r.length;e++)t+=Yg[r[e]];return t}function If(r){let t=r.toString(16);return t.length&1?`0${t}`:t}function sc(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}function Rn(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let e=new Uint8Array(t/2);for(let n=0;n<e.length;n++){let o=n*2,s=r.slice(o,o+2),i=Number.parseInt(s,16);if(Number.isNaN(i)||i<0)throw new Error("Invalid byte sequence");e[n]=i}return e}function Ir(r){return sc(Pn(r))}function ui(r){if(!ci(r))throw new Error("Uint8Array expected");return sc(Pn(Uint8Array.from(r).reverse()))}function tn(r,t){return Rn(r.toString(16).padStart(t*2,"0"))}function fi(r,t){return tn(r,t).reverse()}function Zg(r){return Rn(If(r))}function Bt(r,t,e){let n;if(typeof t=="string")try{n=Rn(t)}catch(s){throw new Error(`${r} must be valid hex string, got "${t}". Cause: ${s}`)}else if(ci(t))n=Uint8Array.from(t);else throw new Error(`${r} must be hex string or Uint8Array`);let o=n.length;if(typeof e=="number"&&o!==e)throw new Error(`${r} expected ${e} bytes, got ${o}`);return n}function po(...r){let t=new Uint8Array(r.reduce((n,o)=>n+o.length,0)),e=0;return r.forEach(n=>{if(!ci(n))throw new Error("Uint8Array expected");t.set(n,e),e+=n.length}),t}function Xg(r,t){if(r.length!==t.length)return!1;for(let e=0;e<r.length;e++)if(r[e]!==t[e])return!1;return!0}function Jg(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function em(r){let t;for(t=0;r>Uf;r>>=ai,t+=1);return t}function tm(r,t){return r>>BigInt(t)&ai}var rm=(r,t,e)=>r|(e?ai:Uf)<<BigInt(t),Jo=r=>(Wg<<BigInt(r-1))-ai,oc=r=>new Uint8Array(r),Cf=r=>Uint8Array.from(r);function ic(r,t,e){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let n=oc(r),o=oc(r),s=0,i=()=>{n.fill(1),o.fill(0),s=0},c=(...m)=>e(o,n,...m),f=(m=oc())=>{o=c(Cf([0]),m),n=c(),m.length!==0&&(o=c(Cf([1]),m),n=c())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let m=0,T=[];for(;m<t;){n=c();let v=n.slice();T.push(v),m+=n.length}return po(...T)};return(m,T)=>{i(),f(m);let v;for(;!(v=T(l()));)f();return i(),v}}var nm={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||r instanceof Uint8Array,isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function rn(r,t,e={}){let n=(o,s,i)=>{let c=nm[s];if(typeof c!="function")throw new Error(`Invalid validator "${s}", expected function`);let f=r[o];if(!(i&&f===void 0)&&!c(f,r))throw new Error(`Invalid param ${String(o)}=${f} (${typeof f}), expected ${s}`)};for(let[o,s]of Object.entries(t))n(o,s,!1);for(let[o,s]of Object.entries(e))n(o,s,!0);return r}var ct=BigInt(0),et=BigInt(1),On=BigInt(2),om=BigInt(3),cc=BigInt(4),Bf=BigInt(5),Pf=BigInt(8),sm=BigInt(9),im=BigInt(16);function At(r,t){let e=r%t;return e>=ct?e:t+e}function am(r,t,e){if(e<=ct||t<ct)throw new Error("Expected power/modulo > 0");if(e===et)return ct;let n=et;for(;t>ct;)t&et&&(n=n*r%e),r=r*r%e,t>>=et;return n}function Pt(r,t,e){let n=r;for(;t-- >ct;)n*=n,n%=e;return n}function di(r,t){if(r===ct||t<=ct)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=At(r,t),n=t,o=ct,s=et,i=et,c=ct;for(;e!==ct;){let l=n/e,h=n%e,m=o-i*l,T=s-c*l;n=e,e=h,o=i,s=c,i=m,c=T}if(n!==et)throw new Error("invert: does not exist");return At(o,t)}function cm(r){let t=(r-et)/On,e,n,o;for(e=r-et,n=0;e%On===ct;e/=On,n++);for(o=On;o<r&&am(o,t,r)!==r-et;o++);if(n===1){let i=(r+et)/cc;return function(f,l){let h=f.pow(l,i);if(!f.eql(f.sqr(h),l))throw new Error("Cannot find square root");return h}}let s=(e+et)/On;return function(c,f){if(c.pow(f,t)===c.neg(c.ONE))throw new Error("Cannot find square root");let l=n,h=c.pow(c.mul(c.ONE,o),e),m=c.pow(f,s),T=c.pow(f,e);for(;!c.eql(T,c.ONE);){if(c.eql(T,c.ZERO))return c.ZERO;let v=1;for(let y=c.sqr(T);v<l&&!c.eql(y,c.ONE);v++)y=c.sqr(y);let b=c.pow(h,et<<BigInt(l-v-1));h=c.sqr(b),m=c.mul(m,b),T=c.mul(T,h),l=v}return m}}function um(r){if(r%cc===om){let t=(r+et)/cc;return function(n,o){let s=n.pow(o,t);if(!n.eql(n.sqr(s),o))throw new Error("Cannot find square root");return s}}if(r%Pf===Bf){let t=(r-Bf)/Pf;return function(n,o){let s=n.mul(o,On),i=n.pow(s,t),c=n.mul(o,i),f=n.mul(n.mul(c,On),i),l=n.mul(c,n.sub(f,n.ONE));if(!n.eql(n.sqr(l),o))throw new Error("Cannot find square root");return l}}return r%im,cm(r)}var fm=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function uc(r){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=fm.reduce((n,o)=>(n[o]="function",n),t);return rn(r,e)}function dm(r,t,e){if(e<ct)throw new Error("Expected power > 0");if(e===ct)return r.ONE;if(e===et)return t;let n=r.ONE,o=t;for(;e>ct;)e&et&&(n=r.mul(n,o)),o=r.sqr(o),e>>=et;return n}function lm(r,t){let e=new Array(t.length),n=t.reduce((s,i,c)=>r.is0(i)?s:(e[c]=s,r.mul(s,i)),r.ONE),o=r.inv(n);return t.reduceRight((s,i,c)=>r.is0(i)?s:(e[c]=r.mul(s,e[c]),r.mul(s,i)),o),e}function fc(r,t){let e=t!==void 0?t:r.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function Rf(r,t,e=!1,n={}){if(r<=ct)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:o,nByteLength:s}=fc(r,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let i=um(r),c=Object.freeze({ORDER:r,BITS:o,BYTES:s,MASK:Jo(o),ZERO:ct,ONE:et,create:f=>At(f,r),isValid:f=>{if(typeof f!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof f}`);return ct<=f&&f<r},is0:f=>f===ct,isOdd:f=>(f&et)===et,neg:f=>At(-f,r),eql:(f,l)=>f===l,sqr:f=>At(f*f,r),add:(f,l)=>At(f+l,r),sub:(f,l)=>At(f-l,r),mul:(f,l)=>At(f*l,r),pow:(f,l)=>dm(c,f,l),div:(f,l)=>At(f*di(l,r),r),sqrN:f=>f*f,addN:(f,l)=>f+l,subN:(f,l)=>f-l,mulN:(f,l)=>f*l,inv:f=>di(f,r),sqrt:n.sqrt||(f=>i(c,f)),invertBatch:f=>lm(c,f),cmov:(f,l,h)=>h?l:f,toBytes:f=>e?fi(f,s):tn(f,s),fromBytes:f=>{if(f.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${f.length}`);return e?ui(f):Ir(f)}});return Object.freeze(c)}function Of(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let t=r.toString(2).length;return Math.ceil(t/8)}function dc(r){let t=Of(r);return t+Math.ceil(t/2)}function Nf(r,t,e=!1){let n=r.length,o=Of(t),s=dc(t);if(n<16||n<s||n>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);let i=e?Ir(r):ui(r),c=At(i,t-et)+et;return e?fi(c,o):tn(c,o)}var gm=BigInt(0),lc=BigInt(1);function kf(r,t){let e=(o,s)=>{let i=s.negate();return o?i:s},n=o=>{let s=Math.ceil(t/o)+1,i=2**(o-1);return{windows:s,windowSize:i}};return{constTimeNegate:e,unsafeLadder(o,s){let i=r.ZERO,c=o;for(;s>gm;)s&lc&&(i=i.add(c)),c=c.double(),s>>=lc;return i},precomputeWindow(o,s){let{windows:i,windowSize:c}=n(s),f=[],l=o,h=l;for(let m=0;m<i;m++){h=l,f.push(h);for(let T=1;T<c;T++)h=h.add(l),f.push(h);l=h.double()}return f},wNAF(o,s,i){let{windows:c,windowSize:f}=n(o),l=r.ZERO,h=r.BASE,m=BigInt(2**o-1),T=2**o,v=BigInt(o);for(let b=0;b<c;b++){let y=b*f,w=Number(i&m);i>>=v,w>f&&(w-=T,i+=lc);let E=y,k=y+Math.abs(w)-1,P=b%2!==0,$=w<0;w===0?h=h.add(e(P,s[E])):l=l.add(e($,s[k]))}return{p:l,f:h}},wNAFCached(o,s,i,c){let f=o._WINDOW_SIZE||1,l=s.get(o);return l||(l=this.precomputeWindow(o,f),f!==1&&s.set(o,c(l))),this.wNAF(f,l,i)}}}function pc(r){return uc(r.Fp),rn(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...fc(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}function mm(r){let t=pc(r);rn(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:e,Fp:n,a:o}=t;if(e){if(!n.eql(o,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof e!="object"||typeof e.beta!="bigint"||typeof e.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}var{bytesToNumberBE:ym,hexToBytes:hm}=ac,Nn={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(r){let{Err:t}=Nn;if(r.length<2||r[0]!==2)throw new t("Invalid signature integer tag");let e=r[1],n=r.subarray(2,e+2);if(!e||n.length!==e)throw new t("Invalid signature integer: wrong length");if(n[0]&128)throw new t("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:ym(n),l:r.subarray(e+2)}},toSig(r){let{Err:t}=Nn,e=typeof r=="string"?hm(r):r;if(!(e instanceof Uint8Array))throw new Error("ui8a expected");let n=e.length;if(n<2||e[0]!=48)throw new t("Invalid signature tag");if(e[1]!==n-2)throw new t("Invalid signature: incorrect length");let{d:o,l:s}=Nn._parseInt(e.subarray(2)),{d:i,l:c}=Nn._parseInt(s);if(c.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,s:i}},hexFromSig(r){let t=l=>Number.parseInt(l[0],16)&8?"00"+l:l,e=l=>{let h=l.toString(16);return h.length&1?`0${h}`:h},n=t(e(r.s)),o=t(e(r.r)),s=n.length/2,i=o.length/2,c=e(s),f=e(i);return`30${e(i+s+4)}02${f}${o}02${c}${n}`}},Br=BigInt(0),Kt=BigInt(1),vx=BigInt(2),zf=BigInt(3),Cx=BigInt(4);function Am(r){let t=mm(r),{Fp:e}=t,n=t.toBytes||((b,y,w)=>{let E=y.toAffine();return po(Uint8Array.from([4]),e.toBytes(E.x),e.toBytes(E.y))}),o=t.fromBytes||(b=>{let y=b.subarray(1),w=e.fromBytes(y.subarray(0,e.BYTES)),E=e.fromBytes(y.subarray(e.BYTES,2*e.BYTES));return{x:w,y:E}});function s(b){let{a:y,b:w}=t,E=e.sqr(b),k=e.mul(E,b);return e.add(e.add(k,e.mul(b,y)),w)}if(!e.eql(e.sqr(t.Gy),s(t.Gx)))throw new Error("bad generator point: equation left != right");function i(b){return typeof b=="bigint"&&Br<b&&b<t.n}function c(b){if(!i(b))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function f(b){let{allowedPrivateKeyLengths:y,nByteLength:w,wrapPrivateKey:E,n:k}=t;if(y&&typeof b!="bigint"){if(b instanceof Uint8Array&&(b=Pn(b)),typeof b!="string"||!y.includes(b.length))throw new Error("Invalid key");b=b.padStart(w*2,"0")}let P;try{P=typeof b=="bigint"?b:Ir(Bt("private key",b,w))}catch{throw new Error(`private key must be ${w} bytes, hex or bigint, not ${typeof b}`)}return E&&(P=At(P,k)),c(P),P}let l=new Map;function h(b){if(!(b instanceof m))throw new Error("ProjectivePoint expected")}class m{constructor(y,w,E){if(this.px=y,this.py=w,this.pz=E,y==null||!e.isValid(y))throw new Error("x required");if(w==null||!e.isValid(w))throw new Error("y required");if(E==null||!e.isValid(E))throw new Error("z required")}static fromAffine(y){let{x:w,y:E}=y||{};if(!y||!e.isValid(w)||!e.isValid(E))throw new Error("invalid affine point");if(y instanceof m)throw new Error("projective point not allowed");let k=P=>e.eql(P,e.ZERO);return k(w)&&k(E)?m.ZERO:new m(w,E,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(y){let w=e.invertBatch(y.map(E=>E.pz));return y.map((E,k)=>E.toAffine(w[k])).map(m.fromAffine)}static fromHex(y){let w=m.fromAffine(o(Bt("pointHex",y)));return w.assertValidity(),w}static fromPrivateKey(y){return m.BASE.multiply(f(y))}_setWindowSize(y){this._WINDOW_SIZE=y,l.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!e.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:y,y:w}=this.toAffine();if(!e.isValid(y)||!e.isValid(w))throw new Error("bad point: x or y not FE");let E=e.sqr(w),k=s(y);if(!e.eql(E,k))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y}=this.toAffine();if(e.isOdd)return!e.isOdd(y);throw new Error("Field doesn't support isOdd")}equals(y){h(y);let{px:w,py:E,pz:k}=this,{px:P,py:$,pz:M}=y,z=e.eql(e.mul(w,M),e.mul(P,k)),L=e.eql(e.mul(E,M),e.mul($,k));return z&&L}negate(){return new m(this.px,e.neg(this.py),this.pz)}double(){let{a:y,b:w}=t,E=e.mul(w,zf),{px:k,py:P,pz:$}=this,M=e.ZERO,z=e.ZERO,L=e.ZERO,K=e.mul(k,k),we=e.mul(P,P),te=e.mul($,$),W=e.mul(k,P);return W=e.add(W,W),L=e.mul(k,$),L=e.add(L,L),M=e.mul(y,L),z=e.mul(E,te),z=e.add(M,z),M=e.sub(we,z),z=e.add(we,z),z=e.mul(M,z),M=e.mul(W,M),L=e.mul(E,L),te=e.mul(y,te),W=e.sub(K,te),W=e.mul(y,W),W=e.add(W,L),L=e.add(K,K),K=e.add(L,K),K=e.add(K,te),K=e.mul(K,W),z=e.add(z,K),te=e.mul(P,$),te=e.add(te,te),K=e.mul(te,W),M=e.sub(M,K),L=e.mul(te,we),L=e.add(L,L),L=e.add(L,L),new m(M,z,L)}add(y){h(y);let{px:w,py:E,pz:k}=this,{px:P,py:$,pz:M}=y,z=e.ZERO,L=e.ZERO,K=e.ZERO,we=t.a,te=e.mul(t.b,zf),W=e.mul(w,P),ve=e.mul(E,$),Ce=e.mul(k,M),Ve=e.add(w,E),_=e.add(P,$);Ve=e.mul(Ve,_),_=e.add(W,ve),Ve=e.sub(Ve,_),_=e.add(w,k);let B=e.add(P,M);return _=e.mul(_,B),B=e.add(W,Ce),_=e.sub(_,B),B=e.add(E,k),z=e.add($,M),B=e.mul(B,z),z=e.add(ve,Ce),B=e.sub(B,z),K=e.mul(we,_),z=e.mul(te,Ce),K=e.add(z,K),z=e.sub(ve,K),K=e.add(ve,K),L=e.mul(z,K),ve=e.add(W,W),ve=e.add(ve,W),Ce=e.mul(we,Ce),_=e.mul(te,_),ve=e.add(ve,Ce),Ce=e.sub(W,Ce),Ce=e.mul(we,Ce),_=e.add(_,Ce),W=e.mul(ve,_),L=e.add(L,W),W=e.mul(B,_),z=e.mul(Ve,z),z=e.sub(z,W),W=e.mul(Ve,ve),K=e.mul(B,K),K=e.add(K,W),new m(z,L,K)}subtract(y){return this.add(y.negate())}is0(){return this.equals(m.ZERO)}wNAF(y){return v.wNAFCached(this,l,y,w=>{let E=e.invertBatch(w.map(k=>k.pz));return w.map((k,P)=>k.toAffine(E[P])).map(m.fromAffine)})}multiplyUnsafe(y){let w=m.ZERO;if(y===Br)return w;if(c(y),y===Kt)return this;let{endo:E}=t;if(!E)return v.unsafeLadder(this,y);let{k1neg:k,k1:P,k2neg:$,k2:M}=E.splitScalar(y),z=w,L=w,K=this;for(;P>Br||M>Br;)P&Kt&&(z=z.add(K)),M&Kt&&(L=L.add(K)),K=K.double(),P>>=Kt,M>>=Kt;return k&&(z=z.negate()),$&&(L=L.negate()),L=new m(e.mul(L.px,E.beta),L.py,L.pz),z.add(L)}multiply(y){c(y);let w=y,E,k,{endo:P}=t;if(P){let{k1neg:$,k1:M,k2neg:z,k2:L}=P.splitScalar(w),{p:K,f:we}=this.wNAF(M),{p:te,f:W}=this.wNAF(L);K=v.constTimeNegate($,K),te=v.constTimeNegate(z,te),te=new m(e.mul(te.px,P.beta),te.py,te.pz),E=K.add(te),k=we.add(W)}else{let{p:$,f:M}=this.wNAF(w);E=$,k=M}return m.normalizeZ([E,k])[0]}multiplyAndAddUnsafe(y,w,E){let k=m.BASE,P=(M,z)=>z===Br||z===Kt||!M.equals(k)?M.multiplyUnsafe(z):M.multiply(z),$=P(this,w).add(P(y,E));return $.is0()?void 0:$}toAffine(y){let{px:w,py:E,pz:k}=this,P=this.is0();y==null&&(y=P?e.ONE:e.inv(k));let $=e.mul(w,y),M=e.mul(E,y),z=e.mul(k,y);if(P)return{x:e.ZERO,y:e.ZERO};if(!e.eql(z,e.ONE))throw new Error("invZ was invalid");return{x:$,y:M}}isTorsionFree(){let{h:y,isTorsionFree:w}=t;if(y===Kt)return!0;if(w)return w(m,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:y,clearCofactor:w}=t;return y===Kt?this:w?w(m,this):this.multiplyUnsafe(t.h)}toRawBytes(y=!0){return this.assertValidity(),n(m,this,y)}toHex(y=!0){return Pn(this.toRawBytes(y))}}m.BASE=new m(t.Gx,t.Gy,e.ONE),m.ZERO=new m(e.ZERO,e.ONE,e.ZERO);let T=t.nBitLength,v=kf(m,t.endo?Math.ceil(T/2):T);return{CURVE:t,ProjectivePoint:m,normPrivateKeyToScalar:f,weierstrassEquation:s,isWithinCurveOrder:i}}function xm(r){let t=pc(r);return rn(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Df(r){let t=xm(r),{Fp:e,n}=t,o=e.BYTES+1,s=2*e.BYTES+1;function i(_){return Br<_&&_<e.ORDER}function c(_){return At(_,n)}function f(_){return di(_,n)}let{ProjectivePoint:l,normPrivateKeyToScalar:h,weierstrassEquation:m,isWithinCurveOrder:T}=Am({...t,toBytes(_,B,F){let re=B.toAffine(),ne=e.toBytes(re.x),xe=po;return F?xe(Uint8Array.from([B.hasEvenY()?2:3]),ne):xe(Uint8Array.from([4]),ne,e.toBytes(re.y))},fromBytes(_){let B=_.length,F=_[0],re=_.subarray(1);if(B===o&&(F===2||F===3)){let ne=Ir(re);if(!i(ne))throw new Error("Point is not on curve");let xe=m(ne),ke=e.sqrt(xe),Te=(ke&Kt)===Kt;return(F&1)===1!==Te&&(ke=e.neg(ke)),{x:ne,y:ke}}else if(B===s&&F===4){let ne=e.fromBytes(re.subarray(0,e.BYTES)),xe=e.fromBytes(re.subarray(e.BYTES,2*e.BYTES));return{x:ne,y:xe}}else throw new Error(`Point of length ${B} was invalid. Expected ${o} compressed bytes or ${s} uncompressed bytes`)}}),v=_=>Pn(tn(_,t.nByteLength));function b(_){let B=n>>Kt;return _>B}function y(_){return b(_)?c(-_):_}let w=(_,B,F)=>Ir(_.slice(B,F));class E{constructor(B,F,re){this.r=B,this.s=F,this.recovery=re,this.assertValidity()}static fromCompact(B){let F=t.nByteLength;return B=Bt("compactSignature",B,F*2),new E(w(B,0,F),w(B,F,2*F))}static fromDER(B){let{r:F,s:re}=Nn.toSig(Bt("DER",B));return new E(F,re)}assertValidity(){if(!T(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!T(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(B){return new E(this.r,this.s,B)}recoverPublicKey(B){let{r:F,s:re,recovery:ne}=this,xe=L(Bt("msgHash",B));if(ne==null||![0,1,2,3].includes(ne))throw new Error("recovery id invalid");let ke=ne===2||ne===3?F+t.n:F;if(ke>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let Te=ne&1?"03":"02",De=l.fromHex(Te+v(ke)),se=f(ke),Ke=c(-xe*se),St=c(re*se),ot=l.BASE.multiplyAndAddUnsafe(De,Ke,St);if(!ot)throw new Error("point at infinify");return ot.assertValidity(),ot}hasHighS(){return b(this.s)}normalizeS(){return this.hasHighS()?new E(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return Rn(this.toDERHex())}toDERHex(){return Nn.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Rn(this.toCompactHex())}toCompactHex(){return v(this.r)+v(this.s)}}let k={isValidPrivateKey(_){try{return h(_),!0}catch{return!1}},normPrivateKeyToScalar:h,randomPrivateKey:()=>{let _=dc(t.n);return Nf(t.randomBytes(_),t.n)},precompute(_=8,B=l.BASE){return B._setWindowSize(_),B.multiply(BigInt(3)),B}};function P(_,B=!0){return l.fromPrivateKey(_).toRawBytes(B)}function $(_){let B=_ instanceof Uint8Array,F=typeof _=="string",re=(B||F)&&_.length;return B?re===o||re===s:F?re===2*o||re===2*s:_ instanceof l}function M(_,B,F=!0){if($(_))throw new Error("first arg must be private key");if(!$(B))throw new Error("second arg must be public key");return l.fromHex(B).multiply(h(_)).toRawBytes(F)}let z=t.bits2int||function(_){let B=Ir(_),F=_.length*8-t.nBitLength;return F>0?B>>BigInt(F):B},L=t.bits2int_modN||function(_){return c(z(_))},K=Jo(t.nBitLength);function we(_){if(typeof _!="bigint")throw new Error("bigint expected");if(!(Br<=_&&_<K))throw new Error(`bigint expected < 2^${t.nBitLength}`);return tn(_,t.nByteLength)}function te(_,B,F=W){if(["recovered","canonical"].some(st=>st in F))throw new Error("sign() legacy options not supported");let{hash:re,randomBytes:ne}=t,{lowS:xe,prehash:ke,extraEntropy:Te}=F;xe==null&&(xe=!0),_=Bt("msgHash",_),ke&&(_=Bt("prehashed msgHash",re(_)));let De=L(_),se=h(B),Ke=[we(se),we(De)];if(Te!=null){let st=Te===!0?ne(e.BYTES):Te;Ke.push(Bt("extraEntropy",st))}let St=po(...Ke),ot=De;function kt(st){let pt=z(st);if(!T(pt))return;let ar=f(pt),Fe=l.BASE.multiply(pt).toAffine(),xt=c(Fe.x);if(xt===Br)return;let Qt=c(ar*c(ot+xt*se));if(Qt===Br)return;let hn=(Fe.x===xt?0:2)|Number(Fe.y&Kt),qr=Qt;return xe&&b(Qt)&&(qr=y(Qt),hn^=1),new E(xt,qr,hn)}return{seed:St,k2sig:kt}}let W={lowS:t.lowS,prehash:!1},ve={lowS:t.lowS,prehash:!1};function Ce(_,B,F=W){let{seed:re,k2sig:ne}=te(_,B,F),xe=t;return ic(xe.hash.outputLen,xe.nByteLength,xe.hmac)(re,ne)}l.BASE._setWindowSize(8);function Ve(_,B,F,re=ve){let ne=_;if(B=Bt("msgHash",B),F=Bt("publicKey",F),"strict"in re)throw new Error("options.strict was renamed to lowS");let{lowS:xe,prehash:ke}=re,Te,De;try{if(typeof ne=="string"||ne instanceof Uint8Array)try{Te=E.fromDER(ne)}catch(Fe){if(!(Fe instanceof Nn.Err))throw Fe;Te=E.fromCompact(ne)}else if(typeof ne=="object"&&typeof ne.r=="bigint"&&typeof ne.s=="bigint"){let{r:Fe,s:xt}=ne;Te=new E(Fe,xt)}else throw new Error("PARSE");De=l.fromHex(F)}catch(Fe){if(Fe.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(xe&&Te.hasHighS())return!1;ke&&(B=t.hash(B));let{r:se,s:Ke}=Te,St=L(B),ot=f(Ke),kt=c(St*ot),st=c(se*ot),pt=l.BASE.multiplyAndAddUnsafe(De,kt,st)?.toAffine();return pt?c(pt.x)===se:!1}return{CURVE:t,getPublicKey:P,getSharedSecret:M,sign:Ce,verify:Ve,ProjectivePoint:l,Signature:E,utils:k}}var li=class extends lo{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,bf(t);let n=Xo(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,s=new Uint8Array(o);s.set(n.length>o?t.create().update(n).digest():n);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),s.fill(0)}update(t){return fo(this),this.iHash.update(t),this}digestInto(t){fo(this),rc(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:e,iHash:n,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},gc=(r,t,e)=>new li(r,t).update(e).digest();gc.create=(r,t)=>new li(r,t);function bm(r){return{hash:r,hmac:(t,...e)=>gc(r,t,_f(...e)),randomBytes:Ef}}function Mf(r,t){let e=n=>Df({...r,...bm(n)});return Object.freeze({...e(t),create:e})}var qf=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Gf=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),wm=BigInt(1),mc=BigInt(2),Lf=(r,t)=>(r+t/mc)/t;function Tm(r){let t=qf,e=BigInt(3),n=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),f=BigInt(88),l=r*r*r%t,h=l*l*r%t,m=Pt(h,e,t)*h%t,T=Pt(m,e,t)*h%t,v=Pt(T,mc,t)*l%t,b=Pt(v,o,t)*v%t,y=Pt(b,s,t)*b%t,w=Pt(y,c,t)*y%t,E=Pt(w,f,t)*w%t,k=Pt(E,c,t)*y%t,P=Pt(k,e,t)*h%t,$=Pt(P,i,t)*b%t,M=Pt($,n,t)*l%t,z=Pt(M,mc,t);if(!yc.eql(yc.sqr(z),r))throw new Error("Cannot find square root");return z}var yc=Rf(qf,void 0,void 0,{sqrt:Tm}),go=Mf({a:BigInt(0),b:BigInt(7),Fp:yc,n:Gf,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{let t=Gf,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-wm*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=e,i=BigInt("0x100000000000000000000000000000000"),c=Lf(s*r,t),f=Lf(-n*r,t),l=At(r-c*e-f*o,t),h=At(-c*n-f*s,t),m=l>i,T=h>i;if(m&&(l=t-l),T&&(h=t-h),l>i||h>i)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:m,k1:l,k2neg:T,k2:h}}}},vf),Gx=BigInt(0);var Lx=go.ProjectivePoint;var _m=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Hf=Uint8Array.from({length:16},(r,t)=>t),Sm=Hf.map(r=>(9*r+5)%16),Ac=[Hf],xc=[Sm];for(let r=0;r<4;r++)for(let t of[Ac,xc])t.push(t[r].map(e=>_m[e]));var Ff=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(r=>new Uint8Array(r)),Em=Ac.map((r,t)=>r.map(e=>Ff[t][e])),vm=xc.map((r,t)=>r.map(e=>Ff[t][e])),Cm=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),Um=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),pi=(r,t)=>r<<t|r>>>32-t;function Kf(r,t,e,n){return r===0?t^e^n:r===1?t&e|~t&n:r===2?(t|~e)^n:r===3?t&n|e&~n:t^(e|~n)}var gi=new Uint32Array(16),hc=class extends Vr{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){let{h0:t,h1:e,h2:n,h3:o,h4:s}=this;return[t,e,n,o,s]}set(t,e,n,o,s){this.h0=t|0,this.h1=e|0,this.h2=n|0,this.h3=o|0,this.h4=s|0}process(t,e){for(let v=0;v<16;v++,e+=4)gi[v]=t.getUint32(e,!0);let n=this.h0|0,o=n,s=this.h1|0,i=s,c=this.h2|0,f=c,l=this.h3|0,h=l,m=this.h4|0,T=m;for(let v=0;v<5;v++){let b=4-v,y=Cm[v],w=Um[v],E=Ac[v],k=xc[v],P=Em[v],$=vm[v];for(let M=0;M<16;M++){let z=pi(n+Kf(v,s,c,l)+gi[E[M]]+y,P[M])+m|0;n=m,m=l,l=pi(c,10)|0,c=s,s=z}for(let M=0;M<16;M++){let z=pi(o+Kf(b,i,f,h)+gi[k[M]]+w,$[M])+T|0;o=T,T=h,h=pi(f,10)|0,f=i,i=z}}this.set(this.h1+c+h|0,this.h2+l+T|0,this.h3+m+o|0,this.h4+n+i|0,this.h0+s+f|0)}roundClean(){gi.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}},$f=Hr(()=>new hc);var _c={};Gs(_c,{bitGet:()=>km,bitLen:()=>Nm,bitMask:()=>es,bitSet:()=>zm,bytesToHex:()=>kn,bytesToNumberBE:()=>Rr,bytesToNumberLE:()=>yi,concatBytes:()=>mo,createHmacDrbg:()=>Tc,ensureBytes:()=>Rt,equalBytes:()=>Rm,hexToBytes:()=>zn,hexToNumber:()=>wc,isBytes:()=>rr,numberToBytesBE:()=>nn,numberToBytesLE:()=>hi,numberToHexUnpadded:()=>Wf,numberToVarBytesBE:()=>Pm,utf8ToBytes:()=>Om,validateObject:()=>on});var Qf=BigInt(0),mi=BigInt(1),Im=BigInt(2);function rr(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}var Bm=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function kn(r){if(!rr(r))throw new Error("Uint8Array expected");let t="";for(let e=0;e<r.length;e++)t+=Bm[r[e]];return t}function Wf(r){let t=r.toString(16);return t.length&1?`0${t}`:t}function wc(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}var Pr={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Vf(r){if(r>=Pr._0&&r<=Pr._9)return r-Pr._0;if(r>=Pr._A&&r<=Pr._F)return r-(Pr._A-10);if(r>=Pr._a&&r<=Pr._f)return r-(Pr._a-10)}function zn(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.length,e=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(e);for(let o=0,s=0;o<e;o++,s+=2){let i=Vf(r.charCodeAt(s)),c=Vf(r.charCodeAt(s+1));if(i===void 0||c===void 0){let f=r[s]+r[s+1];throw new Error('hex string expected, got non-hex character "'+f+'" at index '+s)}n[o]=i*16+c}return n}function Rr(r){return wc(kn(r))}function yi(r){if(!rr(r))throw new Error("Uint8Array expected");return wc(kn(Uint8Array.from(r).reverse()))}function nn(r,t){return zn(r.toString(16).padStart(t*2,"0"))}function hi(r,t){return nn(r,t).reverse()}function Pm(r){return zn(Wf(r))}function Rt(r,t,e){let n;if(typeof t=="string")try{n=zn(t)}catch(s){throw new Error(`${r} must be valid hex string, got "${t}". Cause: ${s}`)}else if(rr(t))n=Uint8Array.from(t);else throw new Error(`${r} must be hex string or Uint8Array`);let o=n.length;if(typeof e=="number"&&o!==e)throw new Error(`${r} expected ${e} bytes, got ${o}`);return n}function mo(...r){let t=0;for(let o=0;o<r.length;o++){let s=r[o];if(!rr(s))throw new Error("Uint8Array expected");t+=s.length}let e=new Uint8Array(t),n=0;for(let o=0;o<r.length;o++){let s=r[o];e.set(s,n),n+=s.length}return e}function Rm(r,t){if(r.length!==t.length)return!1;let e=0;for(let n=0;n<r.length;n++)e|=r[n]^t[n];return e===0}function Om(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function Nm(r){let t;for(t=0;r>Qf;r>>=mi,t+=1);return t}function km(r,t){return r>>BigInt(t)&mi}var zm=(r,t,e)=>r|(e?mi:Qf)<<BigInt(t),es=r=>(Im<<BigInt(r-1))-mi,bc=r=>new Uint8Array(r),jf=r=>Uint8Array.from(r);function Tc(r,t,e){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let n=bc(r),o=bc(r),s=0,i=()=>{n.fill(1),o.fill(0),s=0},c=(...m)=>e(o,n,...m),f=(m=bc())=>{o=c(jf([0]),m),n=c(),m.length!==0&&(o=c(jf([1]),m),n=c())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let m=0,T=[];for(;m<t;){n=c();let v=n.slice();T.push(v),m+=n.length}return mo(...T)};return(m,T)=>{i(),f(m);let v;for(;!(v=T(l()));)f();return i(),v}}var Dm={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||rr(r),isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function on(r,t,e={}){let n=(o,s,i)=>{let c=Dm[s];if(typeof c!="function")throw new Error(`Invalid validator "${s}", expected function`);let f=r[o];if(!(i&&f===void 0)&&!c(f,r))throw new Error(`Invalid param ${String(o)}=${f} (${typeof f}), expected ${s}`)};for(let[o,s]of Object.entries(t))n(o,s,!1);for(let[o,s]of Object.entries(e))n(o,s,!0);return r}var ut=BigInt(0),tt=BigInt(1),Dn=BigInt(2),Mm=BigInt(3),Sc=BigInt(4),Yf=BigInt(5),Zf=BigInt(8),Gm=BigInt(9),Lm=BigInt(16);function dt(r,t){let e=r%t;return e>=ut?e:t+e}function qm(r,t,e){if(e<=ut||t<ut)throw new Error("Expected power/modulo > 0");if(e===tt)return ut;let n=tt;for(;t>ut;)t&tt&&(n=n*r%e),r=r*r%e,t>>=tt;return n}function Ot(r,t,e){let n=r;for(;t-- >ut;)n*=n,n%=e;return n}function Ai(r,t){if(r===ut||t<=ut)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=dt(r,t),n=t,o=ut,s=tt,i=tt,c=ut;for(;e!==ut;){let l=n/e,h=n%e,m=o-i*l,T=s-c*l;n=e,e=h,o=i,s=c,i=m,c=T}if(n!==tt)throw new Error("invert: does not exist");return dt(o,t)}function Km(r){let t=(r-tt)/Dn,e,n,o;for(e=r-tt,n=0;e%Dn===ut;e/=Dn,n++);for(o=Dn;o<r&&qm(o,t,r)!==r-tt;o++);if(n===1){let i=(r+tt)/Sc;return function(f,l){let h=f.pow(l,i);if(!f.eql(f.sqr(h),l))throw new Error("Cannot find square root");return h}}let s=(e+tt)/Dn;return function(c,f){if(c.pow(f,t)===c.neg(c.ONE))throw new Error("Cannot find square root");let l=n,h=c.pow(c.mul(c.ONE,o),e),m=c.pow(f,s),T=c.pow(f,e);for(;!c.eql(T,c.ONE);){if(c.eql(T,c.ZERO))return c.ZERO;let v=1;for(let y=c.sqr(T);v<l&&!c.eql(y,c.ONE);v++)y=c.sqr(y);let b=c.pow(h,tt<<BigInt(l-v-1));h=c.sqr(b),m=c.mul(m,b),T=c.mul(T,h),l=v}return m}}function Hm(r){if(r%Sc===Mm){let t=(r+tt)/Sc;return function(n,o){let s=n.pow(o,t);if(!n.eql(n.sqr(s),o))throw new Error("Cannot find square root");return s}}if(r%Zf===Yf){let t=(r-Yf)/Zf;return function(n,o){let s=n.mul(o,Dn),i=n.pow(s,t),c=n.mul(o,i),f=n.mul(n.mul(c,Dn),i),l=n.mul(c,n.sub(f,n.ONE));if(!n.eql(n.sqr(l),o))throw new Error("Cannot find square root");return l}}return r%Lm,Km(r)}var Fm=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ec(r){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=Fm.reduce((n,o)=>(n[o]="function",n),t);return on(r,e)}function $m(r,t,e){if(e<ut)throw new Error("Expected power > 0");if(e===ut)return r.ONE;if(e===tt)return t;let n=r.ONE,o=t;for(;e>ut;)e&tt&&(n=r.mul(n,o)),o=r.sqr(o),e>>=tt;return n}function Vm(r,t){let e=new Array(t.length),n=t.reduce((s,i,c)=>r.is0(i)?s:(e[c]=s,r.mul(s,i)),r.ONE),o=r.inv(n);return t.reduceRight((s,i,c)=>r.is0(i)?s:(e[c]=r.mul(s,e[c]),r.mul(s,i)),o),e}function vc(r,t){let e=t!==void 0?t:r.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function Xf(r,t,e=!1,n={}){if(r<=ut)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:o,nByteLength:s}=vc(r,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let i=Hm(r),c=Object.freeze({ORDER:r,BITS:o,BYTES:s,MASK:es(o),ZERO:ut,ONE:tt,create:f=>dt(f,r),isValid:f=>{if(typeof f!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof f}`);return ut<=f&&f<r},is0:f=>f===ut,isOdd:f=>(f&tt)===tt,neg:f=>dt(-f,r),eql:(f,l)=>f===l,sqr:f=>dt(f*f,r),add:(f,l)=>dt(f+l,r),sub:(f,l)=>dt(f-l,r),mul:(f,l)=>dt(f*l,r),pow:(f,l)=>$m(c,f,l),div:(f,l)=>dt(f*Ai(l,r),r),sqrN:f=>f*f,addN:(f,l)=>f+l,subN:(f,l)=>f-l,mulN:(f,l)=>f*l,inv:f=>Ai(f,r),sqrt:n.sqrt||(f=>i(c,f)),invertBatch:f=>Vm(c,f),cmov:(f,l,h)=>h?l:f,toBytes:f=>e?hi(f,s):nn(f,s),fromBytes:f=>{if(f.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${f.length}`);return e?yi(f):Rr(f)}});return Object.freeze(c)}function Jf(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let t=r.toString(2).length;return Math.ceil(t/8)}function Cc(r){let t=Jf(r);return t+Math.ceil(t/2)}function ed(r,t,e=!1){let n=r.length,o=Jf(t),s=Cc(t);if(n<16||n<s||n>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);let i=e?Rr(r):yi(r),c=dt(i,t-tt)+tt;return e?hi(c,o):nn(c,o)}var Qm=BigInt(0),Uc=BigInt(1);function td(r,t){let e=(o,s)=>{let i=s.negate();return o?i:s},n=o=>{let s=Math.ceil(t/o)+1,i=2**(o-1);return{windows:s,windowSize:i}};return{constTimeNegate:e,unsafeLadder(o,s){let i=r.ZERO,c=o;for(;s>Qm;)s&Uc&&(i=i.add(c)),c=c.double(),s>>=Uc;return i},precomputeWindow(o,s){let{windows:i,windowSize:c}=n(s),f=[],l=o,h=l;for(let m=0;m<i;m++){h=l,f.push(h);for(let T=1;T<c;T++)h=h.add(l),f.push(h);l=h.double()}return f},wNAF(o,s,i){let{windows:c,windowSize:f}=n(o),l=r.ZERO,h=r.BASE,m=BigInt(2**o-1),T=2**o,v=BigInt(o);for(let b=0;b<c;b++){let y=b*f,w=Number(i&m);i>>=v,w>f&&(w-=T,i+=Uc);let E=y,k=y+Math.abs(w)-1,P=b%2!==0,$=w<0;w===0?h=h.add(e(P,s[E])):l=l.add(e($,s[k]))}return{p:l,f:h}},wNAFCached(o,s,i,c){let f=o._WINDOW_SIZE||1,l=s.get(o);return l||(l=this.precomputeWindow(o,f),f!==1&&s.set(o,c(l))),this.wNAF(f,l,i)}}}function Ic(r){return Ec(r.Fp),on(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...vc(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}function Wm(r){let t=Ic(r);on(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:e,Fp:n,a:o}=t;if(e){if(!n.eql(o,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof e!="object"||typeof e.beta!="bigint"||typeof e.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}var{bytesToNumberBE:Ym,hexToBytes:Zm}=_c,Mn={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(r){let{Err:t}=Mn;if(r.length<2||r[0]!==2)throw new t("Invalid signature integer tag");let e=r[1],n=r.subarray(2,e+2);if(!e||n.length!==e)throw new t("Invalid signature integer: wrong length");if(n[0]&128)throw new t("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:Ym(n),l:r.subarray(e+2)}},toSig(r){let{Err:t}=Mn,e=typeof r=="string"?Zm(r):r;if(!rr(e))throw new Error("ui8a expected");let n=e.length;if(n<2||e[0]!=48)throw new t("Invalid signature tag");if(e[1]!==n-2)throw new t("Invalid signature: incorrect length");let{d:o,l:s}=Mn._parseInt(e.subarray(2)),{d:i,l:c}=Mn._parseInt(s);if(c.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,s:i}},hexFromSig(r){let t=l=>Number.parseInt(l[0],16)&8?"00"+l:l,e=l=>{let h=l.toString(16);return h.length&1?`0${h}`:h},n=t(e(r.s)),o=t(e(r.r)),s=n.length/2,i=o.length/2,c=e(s),f=e(i);return`30${e(i+s+4)}02${f}${o}02${c}${n}`}},Or=BigInt(0),Ht=BigInt(1),Xx=BigInt(2),rd=BigInt(3),Jx=BigInt(4);function Xm(r){let t=Wm(r),{Fp:e}=t,n=t.toBytes||((b,y,w)=>{let E=y.toAffine();return mo(Uint8Array.from([4]),e.toBytes(E.x),e.toBytes(E.y))}),o=t.fromBytes||(b=>{let y=b.subarray(1),w=e.fromBytes(y.subarray(0,e.BYTES)),E=e.fromBytes(y.subarray(e.BYTES,2*e.BYTES));return{x:w,y:E}});function s(b){let{a:y,b:w}=t,E=e.sqr(b),k=e.mul(E,b);return e.add(e.add(k,e.mul(b,y)),w)}if(!e.eql(e.sqr(t.Gy),s(t.Gx)))throw new Error("bad generator point: equation left != right");function i(b){return typeof b=="bigint"&&Or<b&&b<t.n}function c(b){if(!i(b))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function f(b){let{allowedPrivateKeyLengths:y,nByteLength:w,wrapPrivateKey:E,n:k}=t;if(y&&typeof b!="bigint"){if(rr(b)&&(b=kn(b)),typeof b!="string"||!y.includes(b.length))throw new Error("Invalid key");b=b.padStart(w*2,"0")}let P;try{P=typeof b=="bigint"?b:Rr(Rt("private key",b,w))}catch{throw new Error(`private key must be ${w} bytes, hex or bigint, not ${typeof b}`)}return E&&(P=dt(P,k)),c(P),P}let l=new Map;function h(b){if(!(b instanceof m))throw new Error("ProjectivePoint expected")}class m{constructor(y,w,E){if(this.px=y,this.py=w,this.pz=E,y==null||!e.isValid(y))throw new Error("x required");if(w==null||!e.isValid(w))throw new Error("y required");if(E==null||!e.isValid(E))throw new Error("z required")}static fromAffine(y){let{x:w,y:E}=y||{};if(!y||!e.isValid(w)||!e.isValid(E))throw new Error("invalid affine point");if(y instanceof m)throw new Error("projective point not allowed");let k=P=>e.eql(P,e.ZERO);return k(w)&&k(E)?m.ZERO:new m(w,E,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(y){let w=e.invertBatch(y.map(E=>E.pz));return y.map((E,k)=>E.toAffine(w[k])).map(m.fromAffine)}static fromHex(y){let w=m.fromAffine(o(Rt("pointHex",y)));return w.assertValidity(),w}static fromPrivateKey(y){return m.BASE.multiply(f(y))}_setWindowSize(y){this._WINDOW_SIZE=y,l.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!e.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:y,y:w}=this.toAffine();if(!e.isValid(y)||!e.isValid(w))throw new Error("bad point: x or y not FE");let E=e.sqr(w),k=s(y);if(!e.eql(E,k))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y}=this.toAffine();if(e.isOdd)return!e.isOdd(y);throw new Error("Field doesn't support isOdd")}equals(y){h(y);let{px:w,py:E,pz:k}=this,{px:P,py:$,pz:M}=y,z=e.eql(e.mul(w,M),e.mul(P,k)),L=e.eql(e.mul(E,M),e.mul($,k));return z&&L}negate(){return new m(this.px,e.neg(this.py),this.pz)}double(){let{a:y,b:w}=t,E=e.mul(w,rd),{px:k,py:P,pz:$}=this,M=e.ZERO,z=e.ZERO,L=e.ZERO,K=e.mul(k,k),we=e.mul(P,P),te=e.mul($,$),W=e.mul(k,P);return W=e.add(W,W),L=e.mul(k,$),L=e.add(L,L),M=e.mul(y,L),z=e.mul(E,te),z=e.add(M,z),M=e.sub(we,z),z=e.add(we,z),z=e.mul(M,z),M=e.mul(W,M),L=e.mul(E,L),te=e.mul(y,te),W=e.sub(K,te),W=e.mul(y,W),W=e.add(W,L),L=e.add(K,K),K=e.add(L,K),K=e.add(K,te),K=e.mul(K,W),z=e.add(z,K),te=e.mul(P,$),te=e.add(te,te),K=e.mul(te,W),M=e.sub(M,K),L=e.mul(te,we),L=e.add(L,L),L=e.add(L,L),new m(M,z,L)}add(y){h(y);let{px:w,py:E,pz:k}=this,{px:P,py:$,pz:M}=y,z=e.ZERO,L=e.ZERO,K=e.ZERO,we=t.a,te=e.mul(t.b,rd),W=e.mul(w,P),ve=e.mul(E,$),Ce=e.mul(k,M),Ve=e.add(w,E),_=e.add(P,$);Ve=e.mul(Ve,_),_=e.add(W,ve),Ve=e.sub(Ve,_),_=e.add(w,k);let B=e.add(P,M);return _=e.mul(_,B),B=e.add(W,Ce),_=e.sub(_,B),B=e.add(E,k),z=e.add($,M),B=e.mul(B,z),z=e.add(ve,Ce),B=e.sub(B,z),K=e.mul(we,_),z=e.mul(te,Ce),K=e.add(z,K),z=e.sub(ve,K),K=e.add(ve,K),L=e.mul(z,K),ve=e.add(W,W),ve=e.add(ve,W),Ce=e.mul(we,Ce),_=e.mul(te,_),ve=e.add(ve,Ce),Ce=e.sub(W,Ce),Ce=e.mul(we,Ce),_=e.add(_,Ce),W=e.mul(ve,_),L=e.add(L,W),W=e.mul(B,_),z=e.mul(Ve,z),z=e.sub(z,W),W=e.mul(Ve,ve),K=e.mul(B,K),K=e.add(K,W),new m(z,L,K)}subtract(y){return this.add(y.negate())}is0(){return this.equals(m.ZERO)}wNAF(y){return v.wNAFCached(this,l,y,w=>{let E=e.invertBatch(w.map(k=>k.pz));return w.map((k,P)=>k.toAffine(E[P])).map(m.fromAffine)})}multiplyUnsafe(y){let w=m.ZERO;if(y===Or)return w;if(c(y),y===Ht)return this;let{endo:E}=t;if(!E)return v.unsafeLadder(this,y);let{k1neg:k,k1:P,k2neg:$,k2:M}=E.splitScalar(y),z=w,L=w,K=this;for(;P>Or||M>Or;)P&Ht&&(z=z.add(K)),M&Ht&&(L=L.add(K)),K=K.double(),P>>=Ht,M>>=Ht;return k&&(z=z.negate()),$&&(L=L.negate()),L=new m(e.mul(L.px,E.beta),L.py,L.pz),z.add(L)}multiply(y){c(y);let w=y,E,k,{endo:P}=t;if(P){let{k1neg:$,k1:M,k2neg:z,k2:L}=P.splitScalar(w),{p:K,f:we}=this.wNAF(M),{p:te,f:W}=this.wNAF(L);K=v.constTimeNegate($,K),te=v.constTimeNegate(z,te),te=new m(e.mul(te.px,P.beta),te.py,te.pz),E=K.add(te),k=we.add(W)}else{let{p:$,f:M}=this.wNAF(w);E=$,k=M}return m.normalizeZ([E,k])[0]}multiplyAndAddUnsafe(y,w,E){let k=m.BASE,P=(M,z)=>z===Or||z===Ht||!M.equals(k)?M.multiplyUnsafe(z):M.multiply(z),$=P(this,w).add(P(y,E));return $.is0()?void 0:$}toAffine(y){let{px:w,py:E,pz:k}=this,P=this.is0();y==null&&(y=P?e.ONE:e.inv(k));let $=e.mul(w,y),M=e.mul(E,y),z=e.mul(k,y);if(P)return{x:e.ZERO,y:e.ZERO};if(!e.eql(z,e.ONE))throw new Error("invZ was invalid");return{x:$,y:M}}isTorsionFree(){let{h:y,isTorsionFree:w}=t;if(y===Ht)return!0;if(w)return w(m,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:y,clearCofactor:w}=t;return y===Ht?this:w?w(m,this):this.multiplyUnsafe(t.h)}toRawBytes(y=!0){return this.assertValidity(),n(m,this,y)}toHex(y=!0){return kn(this.toRawBytes(y))}}m.BASE=new m(t.Gx,t.Gy,e.ONE),m.ZERO=new m(e.ZERO,e.ONE,e.ZERO);let T=t.nBitLength,v=td(m,t.endo?Math.ceil(T/2):T);return{CURVE:t,ProjectivePoint:m,normPrivateKeyToScalar:f,weierstrassEquation:s,isWithinCurveOrder:i}}function Jm(r){let t=Ic(r);return on(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function nd(r){let t=Jm(r),{Fp:e,n}=t,o=e.BYTES+1,s=2*e.BYTES+1;function i(_){return Or<_&&_<e.ORDER}function c(_){return dt(_,n)}function f(_){return Ai(_,n)}let{ProjectivePoint:l,normPrivateKeyToScalar:h,weierstrassEquation:m,isWithinCurveOrder:T}=Xm({...t,toBytes(_,B,F){let re=B.toAffine(),ne=e.toBytes(re.x),xe=mo;return F?xe(Uint8Array.from([B.hasEvenY()?2:3]),ne):xe(Uint8Array.from([4]),ne,e.toBytes(re.y))},fromBytes(_){let B=_.length,F=_[0],re=_.subarray(1);if(B===o&&(F===2||F===3)){let ne=Rr(re);if(!i(ne))throw new Error("Point is not on curve");let xe=m(ne),ke=e.sqrt(xe),Te=(ke&Ht)===Ht;return(F&1)===1!==Te&&(ke=e.neg(ke)),{x:ne,y:ke}}else if(B===s&&F===4){let ne=e.fromBytes(re.subarray(0,e.BYTES)),xe=e.fromBytes(re.subarray(e.BYTES,2*e.BYTES));return{x:ne,y:xe}}else throw new Error(`Point of length ${B} was invalid. Expected ${o} compressed bytes or ${s} uncompressed bytes`)}}),v=_=>kn(nn(_,t.nByteLength));function b(_){let B=n>>Ht;return _>B}function y(_){return b(_)?c(-_):_}let w=(_,B,F)=>Rr(_.slice(B,F));class E{constructor(B,F,re){this.r=B,this.s=F,this.recovery=re,this.assertValidity()}static fromCompact(B){let F=t.nByteLength;return B=Rt("compactSignature",B,F*2),new E(w(B,0,F),w(B,F,2*F))}static fromDER(B){let{r:F,s:re}=Mn.toSig(Rt("DER",B));return new E(F,re)}assertValidity(){if(!T(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!T(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(B){return new E(this.r,this.s,B)}recoverPublicKey(B){let{r:F,s:re,recovery:ne}=this,xe=L(Rt("msgHash",B));if(ne==null||![0,1,2,3].includes(ne))throw new Error("recovery id invalid");let ke=ne===2||ne===3?F+t.n:F;if(ke>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let Te=ne&1?"03":"02",De=l.fromHex(Te+v(ke)),se=f(ke),Ke=c(-xe*se),St=c(re*se),ot=l.BASE.multiplyAndAddUnsafe(De,Ke,St);if(!ot)throw new Error("point at infinify");return ot.assertValidity(),ot}hasHighS(){return b(this.s)}normalizeS(){return this.hasHighS()?new E(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return zn(this.toDERHex())}toDERHex(){return Mn.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return zn(this.toCompactHex())}toCompactHex(){return v(this.r)+v(this.s)}}let k={isValidPrivateKey(_){try{return h(_),!0}catch{return!1}},normPrivateKeyToScalar:h,randomPrivateKey:()=>{let _=Cc(t.n);return ed(t.randomBytes(_),t.n)},precompute(_=8,B=l.BASE){return B._setWindowSize(_),B.multiply(BigInt(3)),B}};function P(_,B=!0){return l.fromPrivateKey(_).toRawBytes(B)}function $(_){let B=rr(_),F=typeof _=="string",re=(B||F)&&_.length;return B?re===o||re===s:F?re===2*o||re===2*s:_ instanceof l}function M(_,B,F=!0){if($(_))throw new Error("first arg must be private key");if(!$(B))throw new Error("second arg must be public key");return l.fromHex(B).multiply(h(_)).toRawBytes(F)}let z=t.bits2int||function(_){let B=Rr(_),F=_.length*8-t.nBitLength;return F>0?B>>BigInt(F):B},L=t.bits2int_modN||function(_){return c(z(_))},K=es(t.nBitLength);function we(_){if(typeof _!="bigint")throw new Error("bigint expected");if(!(Or<=_&&_<K))throw new Error(`bigint expected < 2^${t.nBitLength}`);return nn(_,t.nByteLength)}function te(_,B,F=W){if(["recovered","canonical"].some(st=>st in F))throw new Error("sign() legacy options not supported");let{hash:re,randomBytes:ne}=t,{lowS:xe,prehash:ke,extraEntropy:Te}=F;xe==null&&(xe=!0),_=Rt("msgHash",_),ke&&(_=Rt("prehashed msgHash",re(_)));let De=L(_),se=h(B),Ke=[we(se),we(De)];if(Te!=null){let st=Te===!0?ne(e.BYTES):Te;Ke.push(Rt("extraEntropy",st))}let St=mo(...Ke),ot=De;function kt(st){let pt=z(st);if(!T(pt))return;let ar=f(pt),Fe=l.BASE.multiply(pt).toAffine(),xt=c(Fe.x);if(xt===Or)return;let Qt=c(ar*c(ot+xt*se));if(Qt===Or)return;let hn=(Fe.x===xt?0:2)|Number(Fe.y&Ht),qr=Qt;return xe&&b(Qt)&&(qr=y(Qt),hn^=1),new E(xt,qr,hn)}return{seed:St,k2sig:kt}}let W={lowS:t.lowS,prehash:!1},ve={lowS:t.lowS,prehash:!1};function Ce(_,B,F=W){let{seed:re,k2sig:ne}=te(_,B,F),xe=t;return Tc(xe.hash.outputLen,xe.nByteLength,xe.hmac)(re,ne)}l.BASE._setWindowSize(8);function Ve(_,B,F,re=ve){let ne=_;if(B=Rt("msgHash",B),F=Rt("publicKey",F),"strict"in re)throw new Error("options.strict was renamed to lowS");let{lowS:xe,prehash:ke}=re,Te,De;try{if(typeof ne=="string"||rr(ne))try{Te=E.fromDER(ne)}catch(Fe){if(!(Fe instanceof Mn.Err))throw Fe;Te=E.fromCompact(ne)}else if(typeof ne=="object"&&typeof ne.r=="bigint"&&typeof ne.s=="bigint"){let{r:Fe,s:xt}=ne;Te=new E(Fe,xt)}else throw new Error("PARSE");De=l.fromHex(F)}catch(Fe){if(Fe.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(xe&&Te.hasHighS())return!1;ke&&(B=t.hash(B));let{r:se,s:Ke}=Te,St=L(B),ot=f(Ke),kt=c(St*ot),st=c(se*ot),pt=l.BASE.multiplyAndAddUnsafe(De,kt,st)?.toAffine();return pt?c(pt.x)===se:!1}return{CURVE:t,getPublicKey:P,getSharedSecret:M,sign:Ce,verify:Ve,ProjectivePoint:l,Signature:E,utils:k}}function ey(r){return{hash:r,hmac:(t,...e)=>fr(r,t,Sn(...e)),randomBytes:Ju}}function od(r,t){let e=n=>nd({...r,...ey(n)});return Object.freeze({...e(t),create:e})}var ad=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),sd=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),ty=BigInt(1),Bc=BigInt(2),id=(r,t)=>(r+t/Bc)/t;function ry(r){let t=ad,e=BigInt(3),n=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),f=BigInt(88),l=r*r*r%t,h=l*l*r%t,m=Ot(h,e,t)*h%t,T=Ot(m,e,t)*h%t,v=Ot(T,Bc,t)*l%t,b=Ot(v,o,t)*v%t,y=Ot(b,s,t)*b%t,w=Ot(y,c,t)*y%t,E=Ot(w,f,t)*w%t,k=Ot(E,c,t)*y%t,P=Ot(k,e,t)*h%t,$=Ot(P,i,t)*b%t,M=Ot($,n,t)*l%t,z=Ot(M,Bc,t);if(!Pc.eql(Pc.sqr(z),r))throw new Error("Cannot find square root");return z}var Pc=Xf(ad,void 0,void 0,{sqrt:ry}),nr=od({a:BigInt(0),b:BigInt(7),Fp:Pc,n:sd,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{let t=sd,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-ty*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=e,i=BigInt("0x100000000000000000000000000000000"),c=id(s*r,t),f=id(-n*r,t),l=dt(r-c*e-f*o,t),h=dt(-c*n-f*s,t),m=l>i,T=h>i;if(m&&(l=t-l),T&&(h=t-h),l>i||h>i)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:m,k1:l,k2neg:T,k2:h}}}},Wo),cb=BigInt(0);var ub=nr.ProjectivePoint;function xi(r){if(!Number.isSafeInteger(r))throw new Error(`Wrong integer: ${r}`)}function Rc(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function ud(...r){let t=s=>s,e=(s,i)=>c=>s(i(c)),n=r.map(s=>s.encode).reduceRight(e,t),o=r.map(s=>s.decode).reduce(e,t);return{encode:n,decode:o}}function ny(r){return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return t.map(e=>{if(e<0||e>=r.length)throw new Error(`Digit index outside alphabet: ${e} (alphabet: ${r.length})`);return r[e]})},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("alphabet.decode input should be array of strings");return t.map(e=>{if(typeof e!="string")throw new Error(`alphabet.decode: not string element=${e}`);let n=r.indexOf(e);if(n===-1)throw new Error(`Unknown letter: "${e}". Allowed: ${r}`);return n})}}}function oy(r=""){if(typeof r!="string")throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("join.encode input should be array of strings");for(let e of t)if(typeof e!="string")throw new Error(`join.encode: non-string input=${e}`);return t.join(r)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(r)}}}function cd(r,t,e){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(e<2)throw new Error(`convertRadix: wrong to=${e}, base cannot be less than 2`);if(!Array.isArray(r))throw new Error("convertRadix: data should be array");if(!r.length)return[];let n=0,o=[],s=Array.from(r);for(s.forEach(i=>{if(i<0||i>=t)throw new Error(`Wrong integer: ${i}`)});;){let i=0,c=!0;for(let f=n;f<s.length;f++){let l=s[f],h=t*i+l;if(!Number.isSafeInteger(h)||t*i/t!==i||h-l!==t*i)throw new Error("convertRadix: carry overflow");i=h%e;let m=Math.floor(h/e);if(s[f]=m,!Number.isSafeInteger(m)||m*e+i!==h)throw new Error("convertRadix: carry overflow");if(c)m?c=!1:n=f;else continue}if(o.push(i),c)break}for(let i=0;i<r.length-1&&r[i]===0;i++)o.push(0);return o.reverse()}function sy(r){return{encode:t=>{if(!Rc(t))throw new Error("radix.encode input should be Uint8Array");return cd(Array.from(t),2**8,r)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of numbers");return Uint8Array.from(cd(t,r,2**8))}}}function iy(r,t){if(typeof t!="function")throw new Error("checksum fn should be function");return{encode(e){if(!Rc(e))throw new Error("checksum.encode: input should be Uint8Array");let n=t(e).slice(0,r),o=new Uint8Array(e.length+r);return o.set(e),o.set(n,e.length),o},decode(e){if(!Rc(e))throw new Error("checksum.decode: input should be Uint8Array");let n=e.slice(0,-r),o=t(n).slice(0,r),s=e.slice(-r);for(let i=0;i<r;i++)if(o[i]!==s[i])throw new Error("Invalid checksum");return n}}}var ay=r=>ud(sy(58),ny(r),oy("")),cy=ay("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var fd=r=>ud(iy(4,t=>r(r(t))),cy);var bi=nr.ProjectivePoint,Oc=fd(Wo);function dd(r){return BigInt(`0x${_n(r)}`)}function uy(r){return uo(r.toString(16).padStart(64,"0"))}var fy=qa("Bitcoin seed"),Nc={private:76066276,public:76067358},kc=2147483648,dy=r=>$f(Wo(r)),ly=r=>ur(r).getUint32(0,!1),wi=r=>{if(!Number.isSafeInteger(r)||r<0||r>2**32-1)throw new Error(`Invalid number=${r}. Should be from 0 to 2 ** 32 - 1`);let t=new Uint8Array(4);return ur(t).setUint32(0,r,!1),t},Ti=class r{get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return ly(this.pubHash)}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this.privKeyBytes||null}get publicKey(){return this.pubKey||null}get privateExtendedKey(){let t=this.privateKey;if(!t)throw new Error("No private key");return Oc.encode(this.serialize(this.versions.private,Sn(new Uint8Array([0]),t)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return Oc.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(t,e=Nc){if(Xt(t),8*t.length<128||8*t.length>512)throw new Error(`HDKey: wrong seed length=${t.length}. Should be between 128 and 512 bits; 256 bits is advised)`);let n=fr(In,fy,t);return new r({versions:e,chainCode:n.slice(32),privateKey:n.slice(0,32)})}static fromExtendedKey(t,e=Nc){let n=Oc.decode(t),o=ur(n),s=o.getUint32(0,!1),i={versions:e,depth:n[4],parentFingerprint:o.getUint32(5,!1),index:o.getUint32(9,!1),chainCode:n.slice(13,45)},c=n.slice(45),f=c[0]===0;if(s!==e[f?"private":"public"])throw new Error("Version mismatch");return f?new r({...i,privateKey:c.slice(1)}):new r({...i,publicKey:c})}static fromJSON(t){return r.fromExtendedKey(t.xpriv)}constructor(t){if(this.depth=0,this.index=0,this.chainCode=null,this.parentFingerprint=0,!t||typeof t!="object")throw new Error("HDKey.constructor must not be called directly");if(this.versions=t.versions||Nc,this.depth=t.depth||0,this.chainCode=t.chainCode,this.index=t.index||0,this.parentFingerprint=t.parentFingerprint||0,!this.depth&&(this.parentFingerprint||this.index))throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");if(t.publicKey&&t.privateKey)throw new Error("HDKey: publicKey and privateKey at same time.");if(t.privateKey){if(!nr.utils.isValidPrivateKey(t.privateKey))throw new Error("Invalid private key");this.privKey=typeof t.privateKey=="bigint"?t.privateKey:dd(t.privateKey),this.privKeyBytes=uy(this.privKey),this.pubKey=nr.getPublicKey(t.privateKey,!0)}else if(t.publicKey)this.pubKey=bi.fromHex(t.publicKey).toRawBytes(!0);else throw new Error("HDKey: no public or private key provided");this.pubHash=dy(this.pubKey)}derive(t){if(!/^[mM]'?/.test(t))throw new Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(t))return this;let e=t.replace(/^[mM]'?\//,"").split("/"),n=this;for(let o of e){let s=/^(\d+)('?)$/.exec(o),i=s&&s[1];if(!s||s.length!==3||typeof i!="string")throw new Error(`Invalid child index: ${o}`);let c=+i;if(!Number.isSafeInteger(c)||c>=kc)throw new Error("Invalid index");s[2]==="'"&&(c+=kc),n=n.deriveChild(c)}return n}deriveChild(t){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let e=wi(t);if(t>=kc){let c=this.privateKey;if(!c)throw new Error("Could not derive hardened child key");e=Sn(new Uint8Array([0]),c,e)}else e=Sn(this.pubKey,e);let n=fr(In,this.chainCode,e),o=dd(n.slice(0,32)),s=n.slice(32);if(!nr.utils.isValidPrivateKey(o))throw new Error("Tweak bigger than curve order");let i={versions:this.versions,chainCode:s,depth:this.depth+1,parentFingerprint:this.fingerprint,index:t};try{if(this.privateKey){let c=dt(this.privKey+o,nr.CURVE.n);if(!nr.utils.isValidPrivateKey(c))throw new Error("The tweak was out of range or the resulted private key is invalid");i.privateKey=c}else{let c=bi.fromHex(this.pubKey).add(bi.fromPrivateKey(o));if(c.equals(bi.ZERO))throw new Error("The tweak was equal to negative P, which made the result key invalid");i.publicKey=c.toRawBytes(!0)}return new r(i)}catch{return this.deriveChild(t+1)}}sign(t){if(!this.privateKey)throw new Error("No privateKey set!");return Xt(t,32),nr.sign(t,this.privKey).toCompactRawBytes()}verify(t,e){if(Xt(t,32),Xt(e,64),!this.publicKey)throw new Error("No publicKey set!");let n;try{n=nr.Signature.fromCompact(e)}catch{return!1}return nr.verify(n,t,this.publicKey)}wipePrivateData(){return this.privKey=void 0,this.privKeyBytes&&(this.privKeyBytes.fill(0),this.privKeyBytes=void 0),this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(t,e){if(!this.chainCode)throw new Error("No chainCode set");return Xt(e,33),Sn(wi(t),new Uint8Array([this.depth]),wi(this.parentFingerprint),wi(this.index),this.chainCode,e)}};var sn=class sn extends It{constructor(e){super();let n=Be.fromHexInput(e);if(n.toUint8Array().length!==sn.LENGTH)throw new Error(`PublicKey length should be ${sn.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:n,signature:o}=e,s=Be.fromHexInput(n).toUint8Array(),i=Cn(s),c=o.toUint8Array();return go.verify(c,i,this.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new sn(n)}static load(e){let n=e.deserializeBytes();return new sn(n)}static isPublicKey(e){return e instanceof sn}};sn.LENGTH=65;var Ft=sn,dr=class dr extends Un{constructor(e){super();let n=Be.fromHexInput(e);if(n.toUint8Array().length!==dr.LENGTH)throw new Error(`PrivateKey length should be ${dr.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}sign(e){let n=Be.fromHexInput(e),o=Cn(n.toUint8Array()),s=go.sign(o,this.key.toUint8Array());return new kr(s.toCompactRawBytes())}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new dr(n)}static generate(){let e=go.utils.randomPrivateKey();return new dr(e)}publicKey(){let e=go.getPublicKey(this.key.toUint8Array(),!1);return new Ft(e)}static fromDerivationPath(e,n){if(!Xa(e))throw new Error(`Invalid derivation path ${e}`);return dr.fromDerivationPathInner(e,Yo(n))}static fromDerivationPathInner(e,n){let{privateKey:o}=Ti.fromMasterSeed(n).derive(e);if(o===null)throw new Error("Invalid key");return new dr(o)}static isPrivateKey(e){return e instanceof dr}};dr.LENGTH=32;var Nr=dr,an=class an extends Jt{constructor(e){super();let n=Be.fromHexInput(e);if(n.toUint8Array().length!==an.LENGTH)throw new Error(`Signature length should be ${an.LENGTH}, recieved ${n.toUint8Array().length}`);this.data=n}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new an(n)}static load(e){let n=e.deserializeBytes();return new an(n)}static isSignature(e){return e instanceof an}};an.LENGTH=64;var kr=an;var je=class r extends It{constructor(e){super();this.publicKey=e}toUint8Array(){return this.publicKey.toUint8Array()}toString(){return this.publicKey.toString()}verifySignature(e){let{message:n,signature:o}=e;return this.publicKey.verifySignature({message:n,signature:o})}serialize(e){if(this.publicKey instanceof qe)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else if(this.publicKey instanceof Ft)e.serializeU32AsUleb128(1),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let n=e.deserializeUleb128AsU32();switch(n){case 0:return new r(qe.load(e));case 1:return new r(Ft.load(e));default:throw new Error(`Unknown variant index for AnyPublicKey: ${n}`)}}static isPublicKey(e){return e instanceof r}isEd25519(){return this.publicKey instanceof qe}isSecp256k1PublicKey(){return this.publicKey instanceof Ft}};var Gn=class r extends It{constructor(e){super();let{publicKeys:n,signaturesRequired:o}=e;if(o<1)throw new Error("The number of required signatures needs to be greater then 0");if(n.length<o)throw new Error(`Provided ${n.length} public keys is smaller than the ${o} required signatures`);let s=[];n.forEach(i=>{i instanceof je?s.push(i):s.push(new je(i))}),this.publicKeys=s,this.signaturesRequired=o}toUint8Array(){return this.bcsToBytes()}createBitmap(e){let{bits:n}=e,o=128,s=new Uint8Array([0,0,0,0]),i=new Set;return n.forEach((c,f)=>{if(f+1>this.publicKeys.length)throw new Error(`Signature index ${f+1} is out of public keys range, ${this.publicKeys.length}.`);if(i.has(c))throw new Error(`Duplicate bit ${c} detected.`);i.add(c);let l=Math.floor(c/8),h=s[l];h|=o>>c%8,s[l]=h}),s}toString(){return Be.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("not implemented")}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let n=e.deserializeVector(je),o=e.deserializeU8();return new r({publicKeys:n,signaturesRequired:o})}};var zr=class zr extends ae{constructor(e){super();let{data:n}=e,o=Be.fromHexInput(n);if(o.toUint8Array().length!==zr.LENGTH)throw new Error(`Authentication Key length should be ${zr.LENGTH}`);this.data=o}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let n=e.deserializeFixedBytes(zr.LENGTH);return new zr({data:n})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromPublicKeyAndScheme(e){let{publicKey:n,scheme:o}=e,s;switch(o){case 3:case 2:{let f=n.bcsToBytes();s=new Uint8Array([...f,o]);break}case 0:case 1:{let f=n.toUint8Array(),l=Be.fromHexInput(f).toUint8Array();s=new Uint8Array([...l,o]);break}default:throw new Error(`Scheme ${o} is not supported`)}let i=Cn.create();i.update(s);let c=i.digest();return new zr({data:c})}static fromPublicKey(e){let{publicKey:n}=e,o;if(n instanceof qe)o=0 .valueOf();else if(n instanceof er)o=1 .valueOf();else if(n instanceof je)o=2 .valueOf();else if(n instanceof Gn)o=3 .valueOf();else throw new Error("No supported authentication scheme for public key");return zr.fromPublicKeyAndScheme({publicKey:n,scheme:o})}derivedAddress(){return new H(this.data.toUint8Array())}};zr.LENGTH=32;var or=zr;var Dr=class r{constructor(t){let{privateKey:e,address:n,legacy:o}=t,s=o??!0;if(this.publicKey=e.publicKey(),this.publicKey instanceof qe)s?this.signingScheme=0:(this.publicKey=new je(this.publicKey),this.signingScheme=2);else if(this.publicKey instanceof er)this.signingScheme=1;else if(this.publicKey instanceof Ft)this.publicKey=new je(this.publicKey),this.signingScheme=2;else throw new Error("Can not create new Account, unsupported public key type");this.privateKey=e,this.accountAddress=n}static generate(t){let e=t?.legacy??!0,n,o;switch(t?.scheme){case 2:n=Nr.generate(),o=new je(n.publicKey());break;default:n=Ur.generate(),e===!1?o=new je(n.publicKey()):o=n.publicKey()}let i=or.fromPublicKey({publicKey:o}).derivedAddress();return new r({privateKey:n,address:i,legacy:t?.legacy})}static fromPrivateKey(t){let{privateKey:e,legacy:n}=t,o=n??!0,s;if(e instanceof Nr)s=new je(e.publicKey());else if(e instanceof Ur)o?s=e.publicKey():s=new je(e.publicKey());else throw new Error(`Unsupported private key ${e}`);let c=or.fromPublicKey({publicKey:s}).derivedAddress();return new r({privateKey:e,address:c,legacy:o})}static fromPrivateKeyAndAddress(t){let{privateKey:e,address:n,legacy:o}=t;return new r({privateKey:e,address:n,legacy:o})}static fromDerivationPath(t){let{path:e,mnemonic:n,scheme:o,legacy:s}=t,i;switch(o){case 2:i=Nr.fromDerivationPath(e,n);break;case 0:i=Ur.fromDerivationPath(e,n);break;default:throw new Error(`Unsupported scheme ${o}`)}return r.fromPrivateKey({privateKey:i,legacy:s})}static authKey(t){let{publicKey:e}=t;return or.fromPublicKey({publicKey:e})}sign(t){return this.privateKey.sign(t)}verifySignature(t){let{message:e,signature:n}=t,o=Be.fromHexInput(e).toUint8Array();return this.publicKey.verifySignature({message:o,signature:n})}};var py=`
1
+ "use strict";var aptosSDK=(()=>{var Zp=Object.create;var Ko=Object.defineProperty;var Wu=Object.getOwnPropertyDescriptor;var Xp=Object.getOwnPropertyNames;var Jp=Object.getPrototypeOf,eg=Object.prototype.hasOwnProperty;var Qu=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var Ia=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),Ks=(n,t)=>{for(var e in t)Ko(n,e,{get:t[e],enumerable:!0})},Yu=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Xp(t))!eg.call(n,o)&&o!==e&&Ko(n,o,{get:()=>t[o],enumerable:!(r=Wu(t,o))||r.enumerable});return n};var Zu=(n,t,e)=>(e=n!=null?Zp(Jp(n)):{},Yu(t||!n||!n.__esModule?Ko(e,"default",{value:n,enumerable:!0}):e,n)),tg=n=>Yu(Ko({},"__esModule",{value:!0}),n),Ct=(n,t,e,r)=>{for(var o=r>1?void 0:r?Wu(t,e):t,s=n.length-1,i;s>=0;s--)(i=n[s])&&(o=(r?i(t,e,o):i(o))||o);return r&&o&&Ko(t,e,o),o};var wf=Ia(()=>{"use strict"});var Tf=Ia((oA,oi)=>{"use strict";(function(n){"use strict";var t=function(f){var p,l=new Float64Array(16);if(f)for(p=0;p<f.length;p++)l[p]=f[p];return l},e=function(){throw new Error("no PRNG")},r=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var s=t(),i=t([1]),c=t([56129,1]),u=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),d=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),h=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),g=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),T=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function S(f,p,l,a){f[p]=l>>24&255,f[p+1]=l>>16&255,f[p+2]=l>>8&255,f[p+3]=l&255,f[p+4]=a>>24&255,f[p+5]=a>>16&255,f[p+6]=a>>8&255,f[p+7]=a&255}function b(f,p,l,a,m){var x,E=0;for(x=0;x<m;x++)E|=f[p+x]^l[a+x];return(1&E-1>>>8)-1}function y(f,p,l,a){return b(f,p,l,a,16)}function w(f,p,l,a){return b(f,p,l,a,32)}function v(f,p,l,a){for(var m=a[0]&255|(a[1]&255)<<8|(a[2]&255)<<16|(a[3]&255)<<24,x=l[0]&255|(l[1]&255)<<8|(l[2]&255)<<16|(l[3]&255)<<24,E=l[4]&255|(l[5]&255)<<8|(l[6]&255)<<16|(l[7]&255)<<24,O=l[8]&255|(l[9]&255)<<8|(l[10]&255)<<16|(l[11]&255)<<24,q=l[12]&255|(l[13]&255)<<8|(l[14]&255)<<16|(l[15]&255)<<24,ee=a[4]&255|(a[5]&255)<<8|(a[6]&255)<<16|(a[7]&255)<<24,j=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,Re=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,Y=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,ce=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,ue=a[8]&255|(a[9]&255)<<8|(a[10]&255)<<16|(a[11]&255)<<24,ge=l[16]&255|(l[17]&255)<<8|(l[18]&255)<<16|(l[19]&255)<<24,pe=l[20]&255|(l[21]&255)<<8|(l[22]&255)<<16|(l[23]&255)<<24,fe=l[24]&255|(l[25]&255)<<8|(l[26]&255)<<16|(l[27]&255)<<24,le=l[28]&255|(l[29]&255)<<8|(l[30]&255)<<16|(l[31]&255)<<24,de=a[12]&255|(a[13]&255)<<8|(a[14]&255)<<16|(a[15]&255)<<24,Z=m,oe=x,W=E,X=O,J=q,V=ee,C=j,U=Re,D=Y,R=ce,N=ue,G=ge,ie=pe,me=fe,ye=le,he=de,A,_e=0;_e<20;_e+=2)A=Z+ie|0,J^=A<<7|A>>>25,A=J+Z|0,D^=A<<9|A>>>23,A=D+J|0,ie^=A<<13|A>>>19,A=ie+D|0,Z^=A<<18|A>>>14,A=V+oe|0,R^=A<<7|A>>>25,A=R+V|0,me^=A<<9|A>>>23,A=me+R|0,oe^=A<<13|A>>>19,A=oe+me|0,V^=A<<18|A>>>14,A=N+C|0,ye^=A<<7|A>>>25,A=ye+N|0,W^=A<<9|A>>>23,A=W+ye|0,C^=A<<13|A>>>19,A=C+W|0,N^=A<<18|A>>>14,A=he+G|0,X^=A<<7|A>>>25,A=X+he|0,U^=A<<9|A>>>23,A=U+X|0,G^=A<<13|A>>>19,A=G+U|0,he^=A<<18|A>>>14,A=Z+X|0,oe^=A<<7|A>>>25,A=oe+Z|0,W^=A<<9|A>>>23,A=W+oe|0,X^=A<<13|A>>>19,A=X+W|0,Z^=A<<18|A>>>14,A=V+J|0,C^=A<<7|A>>>25,A=C+V|0,U^=A<<9|A>>>23,A=U+C|0,J^=A<<13|A>>>19,A=J+U|0,V^=A<<18|A>>>14,A=N+R|0,G^=A<<7|A>>>25,A=G+N|0,D^=A<<9|A>>>23,A=D+G|0,R^=A<<13|A>>>19,A=R+D|0,N^=A<<18|A>>>14,A=he+ye|0,ie^=A<<7|A>>>25,A=ie+he|0,me^=A<<9|A>>>23,A=me+ie|0,ye^=A<<13|A>>>19,A=ye+me|0,he^=A<<18|A>>>14;Z=Z+m|0,oe=oe+x|0,W=W+E|0,X=X+O|0,J=J+q|0,V=V+ee|0,C=C+j|0,U=U+Re|0,D=D+Y|0,R=R+ce|0,N=N+ue|0,G=G+ge|0,ie=ie+pe|0,me=me+fe|0,ye=ye+le|0,he=he+de|0,f[0]=Z>>>0&255,f[1]=Z>>>8&255,f[2]=Z>>>16&255,f[3]=Z>>>24&255,f[4]=oe>>>0&255,f[5]=oe>>>8&255,f[6]=oe>>>16&255,f[7]=oe>>>24&255,f[8]=W>>>0&255,f[9]=W>>>8&255,f[10]=W>>>16&255,f[11]=W>>>24&255,f[12]=X>>>0&255,f[13]=X>>>8&255,f[14]=X>>>16&255,f[15]=X>>>24&255,f[16]=J>>>0&255,f[17]=J>>>8&255,f[18]=J>>>16&255,f[19]=J>>>24&255,f[20]=V>>>0&255,f[21]=V>>>8&255,f[22]=V>>>16&255,f[23]=V>>>24&255,f[24]=C>>>0&255,f[25]=C>>>8&255,f[26]=C>>>16&255,f[27]=C>>>24&255,f[28]=U>>>0&255,f[29]=U>>>8&255,f[30]=U>>>16&255,f[31]=U>>>24&255,f[32]=D>>>0&255,f[33]=D>>>8&255,f[34]=D>>>16&255,f[35]=D>>>24&255,f[36]=R>>>0&255,f[37]=R>>>8&255,f[38]=R>>>16&255,f[39]=R>>>24&255,f[40]=N>>>0&255,f[41]=N>>>8&255,f[42]=N>>>16&255,f[43]=N>>>24&255,f[44]=G>>>0&255,f[45]=G>>>8&255,f[46]=G>>>16&255,f[47]=G>>>24&255,f[48]=ie>>>0&255,f[49]=ie>>>8&255,f[50]=ie>>>16&255,f[51]=ie>>>24&255,f[52]=me>>>0&255,f[53]=me>>>8&255,f[54]=me>>>16&255,f[55]=me>>>24&255,f[56]=ye>>>0&255,f[57]=ye>>>8&255,f[58]=ye>>>16&255,f[59]=ye>>>24&255,f[60]=he>>>0&255,f[61]=he>>>8&255,f[62]=he>>>16&255,f[63]=he>>>24&255}function k(f,p,l,a){for(var m=a[0]&255|(a[1]&255)<<8|(a[2]&255)<<16|(a[3]&255)<<24,x=l[0]&255|(l[1]&255)<<8|(l[2]&255)<<16|(l[3]&255)<<24,E=l[4]&255|(l[5]&255)<<8|(l[6]&255)<<16|(l[7]&255)<<24,O=l[8]&255|(l[9]&255)<<8|(l[10]&255)<<16|(l[11]&255)<<24,q=l[12]&255|(l[13]&255)<<8|(l[14]&255)<<16|(l[15]&255)<<24,ee=a[4]&255|(a[5]&255)<<8|(a[6]&255)<<16|(a[7]&255)<<24,j=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,Re=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,Y=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,ce=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,ue=a[8]&255|(a[9]&255)<<8|(a[10]&255)<<16|(a[11]&255)<<24,ge=l[16]&255|(l[17]&255)<<8|(l[18]&255)<<16|(l[19]&255)<<24,pe=l[20]&255|(l[21]&255)<<8|(l[22]&255)<<16|(l[23]&255)<<24,fe=l[24]&255|(l[25]&255)<<8|(l[26]&255)<<16|(l[27]&255)<<24,le=l[28]&255|(l[29]&255)<<8|(l[30]&255)<<16|(l[31]&255)<<24,de=a[12]&255|(a[13]&255)<<8|(a[14]&255)<<16|(a[15]&255)<<24,Z=m,oe=x,W=E,X=O,J=q,V=ee,C=j,U=Re,D=Y,R=ce,N=ue,G=ge,ie=pe,me=fe,ye=le,he=de,A,_e=0;_e<20;_e+=2)A=Z+ie|0,J^=A<<7|A>>>25,A=J+Z|0,D^=A<<9|A>>>23,A=D+J|0,ie^=A<<13|A>>>19,A=ie+D|0,Z^=A<<18|A>>>14,A=V+oe|0,R^=A<<7|A>>>25,A=R+V|0,me^=A<<9|A>>>23,A=me+R|0,oe^=A<<13|A>>>19,A=oe+me|0,V^=A<<18|A>>>14,A=N+C|0,ye^=A<<7|A>>>25,A=ye+N|0,W^=A<<9|A>>>23,A=W+ye|0,C^=A<<13|A>>>19,A=C+W|0,N^=A<<18|A>>>14,A=he+G|0,X^=A<<7|A>>>25,A=X+he|0,U^=A<<9|A>>>23,A=U+X|0,G^=A<<13|A>>>19,A=G+U|0,he^=A<<18|A>>>14,A=Z+X|0,oe^=A<<7|A>>>25,A=oe+Z|0,W^=A<<9|A>>>23,A=W+oe|0,X^=A<<13|A>>>19,A=X+W|0,Z^=A<<18|A>>>14,A=V+J|0,C^=A<<7|A>>>25,A=C+V|0,U^=A<<9|A>>>23,A=U+C|0,J^=A<<13|A>>>19,A=J+U|0,V^=A<<18|A>>>14,A=N+R|0,G^=A<<7|A>>>25,A=G+N|0,D^=A<<9|A>>>23,A=D+G|0,R^=A<<13|A>>>19,A=R+D|0,N^=A<<18|A>>>14,A=he+ye|0,ie^=A<<7|A>>>25,A=ie+he|0,me^=A<<9|A>>>23,A=me+ie|0,ye^=A<<13|A>>>19,A=ye+me|0,he^=A<<18|A>>>14;f[0]=Z>>>0&255,f[1]=Z>>>8&255,f[2]=Z>>>16&255,f[3]=Z>>>24&255,f[4]=V>>>0&255,f[5]=V>>>8&255,f[6]=V>>>16&255,f[7]=V>>>24&255,f[8]=N>>>0&255,f[9]=N>>>8&255,f[10]=N>>>16&255,f[11]=N>>>24&255,f[12]=he>>>0&255,f[13]=he>>>8&255,f[14]=he>>>16&255,f[15]=he>>>24&255,f[16]=C>>>0&255,f[17]=C>>>8&255,f[18]=C>>>16&255,f[19]=C>>>24&255,f[20]=U>>>0&255,f[21]=U>>>8&255,f[22]=U>>>16&255,f[23]=U>>>24&255,f[24]=D>>>0&255,f[25]=D>>>8&255,f[26]=D>>>16&255,f[27]=D>>>24&255,f[28]=R>>>0&255,f[29]=R>>>8&255,f[30]=R>>>16&255,f[31]=R>>>24&255}function P(f,p,l,a){v(f,p,l,a)}function $(f,p,l,a){k(f,p,l,a)}var M=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function z(f,p,l,a,m,x,E){var O=new Uint8Array(16),q=new Uint8Array(64),ee,j;for(j=0;j<16;j++)O[j]=0;for(j=0;j<8;j++)O[j]=x[j];for(;m>=64;){for(P(q,O,E,M),j=0;j<64;j++)f[p+j]=l[a+j]^q[j];for(ee=1,j=8;j<16;j++)ee=ee+(O[j]&255)|0,O[j]=ee&255,ee>>>=8;m-=64,p+=64,a+=64}if(m>0)for(P(q,O,E,M),j=0;j<m;j++)f[p+j]=l[a+j]^q[j];return 0}function L(f,p,l,a,m){var x=new Uint8Array(16),E=new Uint8Array(64),O,q;for(q=0;q<16;q++)x[q]=0;for(q=0;q<8;q++)x[q]=a[q];for(;l>=64;){for(P(E,x,m,M),q=0;q<64;q++)f[p+q]=E[q];for(O=1,q=8;q<16;q++)O=O+(x[q]&255)|0,x[q]=O&255,O>>>=8;l-=64,p+=64}if(l>0)for(P(E,x,m,M),q=0;q<l;q++)f[p+q]=E[q];return 0}function K(f,p,l,a,m){var x=new Uint8Array(32);$(x,a,m,M);for(var E=new Uint8Array(8),O=0;O<8;O++)E[O]=a[O+16];return L(f,p,l,E,x)}function we(f,p,l,a,m,x,E){var O=new Uint8Array(32);$(O,x,E,M);for(var q=new Uint8Array(8),ee=0;ee<8;ee++)q[ee]=x[ee+16];return z(f,p,l,a,m,q,O)}var te=function(f){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var p,l,a,m,x,E,O,q;p=f[0]&255|(f[1]&255)<<8,this.r[0]=p&8191,l=f[2]&255|(f[3]&255)<<8,this.r[1]=(p>>>13|l<<3)&8191,a=f[4]&255|(f[5]&255)<<8,this.r[2]=(l>>>10|a<<6)&7939,m=f[6]&255|(f[7]&255)<<8,this.r[3]=(a>>>7|m<<9)&8191,x=f[8]&255|(f[9]&255)<<8,this.r[4]=(m>>>4|x<<12)&255,this.r[5]=x>>>1&8190,E=f[10]&255|(f[11]&255)<<8,this.r[6]=(x>>>14|E<<2)&8191,O=f[12]&255|(f[13]&255)<<8,this.r[7]=(E>>>11|O<<5)&8065,q=f[14]&255|(f[15]&255)<<8,this.r[8]=(O>>>8|q<<8)&8191,this.r[9]=q>>>5&127,this.pad[0]=f[16]&255|(f[17]&255)<<8,this.pad[1]=f[18]&255|(f[19]&255)<<8,this.pad[2]=f[20]&255|(f[21]&255)<<8,this.pad[3]=f[22]&255|(f[23]&255)<<8,this.pad[4]=f[24]&255|(f[25]&255)<<8,this.pad[5]=f[26]&255|(f[27]&255)<<8,this.pad[6]=f[28]&255|(f[29]&255)<<8,this.pad[7]=f[30]&255|(f[31]&255)<<8};te.prototype.blocks=function(f,p,l){for(var a=this.fin?0:2048,m,x,E,O,q,ee,j,Re,Y,ce,ue,ge,pe,fe,le,de,Z,oe,W,X=this.h[0],J=this.h[1],V=this.h[2],C=this.h[3],U=this.h[4],D=this.h[5],R=this.h[6],N=this.h[7],G=this.h[8],ie=this.h[9],me=this.r[0],ye=this.r[1],he=this.r[2],A=this.r[3],_e=this.r[4],Oe=this.r[5],Ne=this.r[6],be=this.r[7],Ue=this.r[8],Ie=this.r[9];l>=16;)m=f[p+0]&255|(f[p+1]&255)<<8,X+=m&8191,x=f[p+2]&255|(f[p+3]&255)<<8,J+=(m>>>13|x<<3)&8191,E=f[p+4]&255|(f[p+5]&255)<<8,V+=(x>>>10|E<<6)&8191,O=f[p+6]&255|(f[p+7]&255)<<8,C+=(E>>>7|O<<9)&8191,q=f[p+8]&255|(f[p+9]&255)<<8,U+=(O>>>4|q<<12)&8191,D+=q>>>1&8191,ee=f[p+10]&255|(f[p+11]&255)<<8,R+=(q>>>14|ee<<2)&8191,j=f[p+12]&255|(f[p+13]&255)<<8,N+=(ee>>>11|j<<5)&8191,Re=f[p+14]&255|(f[p+15]&255)<<8,G+=(j>>>8|Re<<8)&8191,ie+=Re>>>5|a,Y=0,ce=Y,ce+=X*me,ce+=J*(5*Ie),ce+=V*(5*Ue),ce+=C*(5*be),ce+=U*(5*Ne),Y=ce>>>13,ce&=8191,ce+=D*(5*Oe),ce+=R*(5*_e),ce+=N*(5*A),ce+=G*(5*he),ce+=ie*(5*ye),Y+=ce>>>13,ce&=8191,ue=Y,ue+=X*ye,ue+=J*me,ue+=V*(5*Ie),ue+=C*(5*Ue),ue+=U*(5*be),Y=ue>>>13,ue&=8191,ue+=D*(5*Ne),ue+=R*(5*Oe),ue+=N*(5*_e),ue+=G*(5*A),ue+=ie*(5*he),Y+=ue>>>13,ue&=8191,ge=Y,ge+=X*he,ge+=J*ye,ge+=V*me,ge+=C*(5*Ie),ge+=U*(5*Ue),Y=ge>>>13,ge&=8191,ge+=D*(5*be),ge+=R*(5*Ne),ge+=N*(5*Oe),ge+=G*(5*_e),ge+=ie*(5*A),Y+=ge>>>13,ge&=8191,pe=Y,pe+=X*A,pe+=J*he,pe+=V*ye,pe+=C*me,pe+=U*(5*Ie),Y=pe>>>13,pe&=8191,pe+=D*(5*Ue),pe+=R*(5*be),pe+=N*(5*Ne),pe+=G*(5*Oe),pe+=ie*(5*_e),Y+=pe>>>13,pe&=8191,fe=Y,fe+=X*_e,fe+=J*A,fe+=V*he,fe+=C*ye,fe+=U*me,Y=fe>>>13,fe&=8191,fe+=D*(5*Ie),fe+=R*(5*Ue),fe+=N*(5*be),fe+=G*(5*Ne),fe+=ie*(5*Oe),Y+=fe>>>13,fe&=8191,le=Y,le+=X*Oe,le+=J*_e,le+=V*A,le+=C*he,le+=U*ye,Y=le>>>13,le&=8191,le+=D*me,le+=R*(5*Ie),le+=N*(5*Ue),le+=G*(5*be),le+=ie*(5*Ne),Y+=le>>>13,le&=8191,de=Y,de+=X*Ne,de+=J*Oe,de+=V*_e,de+=C*A,de+=U*he,Y=de>>>13,de&=8191,de+=D*ye,de+=R*me,de+=N*(5*Ie),de+=G*(5*Ue),de+=ie*(5*be),Y+=de>>>13,de&=8191,Z=Y,Z+=X*be,Z+=J*Ne,Z+=V*Oe,Z+=C*_e,Z+=U*A,Y=Z>>>13,Z&=8191,Z+=D*he,Z+=R*ye,Z+=N*me,Z+=G*(5*Ie),Z+=ie*(5*Ue),Y+=Z>>>13,Z&=8191,oe=Y,oe+=X*Ue,oe+=J*be,oe+=V*Ne,oe+=C*Oe,oe+=U*_e,Y=oe>>>13,oe&=8191,oe+=D*A,oe+=R*he,oe+=N*ye,oe+=G*me,oe+=ie*(5*Ie),Y+=oe>>>13,oe&=8191,W=Y,W+=X*Ie,W+=J*Ue,W+=V*be,W+=C*Ne,W+=U*Oe,Y=W>>>13,W&=8191,W+=D*_e,W+=R*A,W+=N*he,W+=G*ye,W+=ie*me,Y+=W>>>13,W&=8191,Y=(Y<<2)+Y|0,Y=Y+ce|0,ce=Y&8191,Y=Y>>>13,ue+=Y,X=ce,J=ue,V=ge,C=pe,U=fe,D=le,R=de,N=Z,G=oe,ie=W,p+=16,l-=16;this.h[0]=X,this.h[1]=J,this.h[2]=V,this.h[3]=C,this.h[4]=U,this.h[5]=D,this.h[6]=R,this.h[7]=N,this.h[8]=G,this.h[9]=ie},te.prototype.finish=function(f,p){var l=new Uint16Array(10),a,m,x,E;if(this.leftover){for(E=this.leftover,this.buffer[E++]=1;E<16;E++)this.buffer[E]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(a=this.h[1]>>>13,this.h[1]&=8191,E=2;E<10;E++)this.h[E]+=a,a=this.h[E]>>>13,this.h[E]&=8191;for(this.h[0]+=a*5,a=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=a,a=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=a,l[0]=this.h[0]+5,a=l[0]>>>13,l[0]&=8191,E=1;E<10;E++)l[E]=this.h[E]+a,a=l[E]>>>13,l[E]&=8191;for(l[9]-=8192,m=(a^1)-1,E=0;E<10;E++)l[E]&=m;for(m=~m,E=0;E<10;E++)this.h[E]=this.h[E]&m|l[E];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,x=this.h[0]+this.pad[0],this.h[0]=x&65535,E=1;E<8;E++)x=(this.h[E]+this.pad[E]|0)+(x>>>16)|0,this.h[E]=x&65535;f[p+0]=this.h[0]>>>0&255,f[p+1]=this.h[0]>>>8&255,f[p+2]=this.h[1]>>>0&255,f[p+3]=this.h[1]>>>8&255,f[p+4]=this.h[2]>>>0&255,f[p+5]=this.h[2]>>>8&255,f[p+6]=this.h[3]>>>0&255,f[p+7]=this.h[3]>>>8&255,f[p+8]=this.h[4]>>>0&255,f[p+9]=this.h[4]>>>8&255,f[p+10]=this.h[5]>>>0&255,f[p+11]=this.h[5]>>>8&255,f[p+12]=this.h[6]>>>0&255,f[p+13]=this.h[6]>>>8&255,f[p+14]=this.h[7]>>>0&255,f[p+15]=this.h[7]>>>8&255},te.prototype.update=function(f,p,l){var a,m;if(this.leftover){for(m=16-this.leftover,m>l&&(m=l),a=0;a<m;a++)this.buffer[this.leftover+a]=f[p+a];if(l-=m,p+=m,this.leftover+=m,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(l>=16&&(m=l-l%16,this.blocks(f,p,m),p+=m,l-=m),l){for(a=0;a<l;a++)this.buffer[this.leftover+a]=f[p+a];this.leftover+=l}};function Q(f,p,l,a,m,x){var E=new te(x);return E.update(l,a,m),E.finish(f,p),0}function ve(f,p,l,a,m,x){var E=new Uint8Array(16);return Q(E,0,l,a,m,x),y(f,p,E,0)}function Ce(f,p,l,a,m){var x;if(l<32)return-1;for(we(f,0,p,0,l,a,m),Q(f,16,f,32,l-32,f),x=0;x<16;x++)f[x]=0;return 0}function Ve(f,p,l,a,m){var x,E=new Uint8Array(32);if(l<32||(K(E,0,32,a,m),ve(p,16,p,32,l-32,E)!==0))return-1;for(we(f,0,p,0,l,a,m),x=0;x<32;x++)f[x]=0;return 0}function _(f,p){var l;for(l=0;l<16;l++)f[l]=p[l]|0}function B(f){var p,l,a=1;for(p=0;p<16;p++)l=f[p]+a+65535,a=Math.floor(l/65536),f[p]=l-a*65536;f[0]+=a-1+37*(a-1)}function H(f,p,l){for(var a,m=~(l-1),x=0;x<16;x++)a=m&(f[x]^p[x]),f[x]^=a,p[x]^=a}function ne(f,p){var l,a,m,x=t(),E=t();for(l=0;l<16;l++)E[l]=p[l];for(B(E),B(E),B(E),a=0;a<2;a++){for(x[0]=E[0]-65517,l=1;l<15;l++)x[l]=E[l]-65535-(x[l-1]>>16&1),x[l-1]&=65535;x[15]=E[15]-32767-(x[14]>>16&1),m=x[15]>>16&1,x[14]&=65535,H(E,x,1-m)}for(l=0;l<16;l++)f[2*l]=E[l]&255,f[2*l+1]=E[l]>>8}function re(f,p){var l=new Uint8Array(32),a=new Uint8Array(32);return ne(l,f),ne(a,p),w(l,0,a,0)}function xe(f){var p=new Uint8Array(32);return ne(p,f),p[0]&1}function ke(f,p){var l;for(l=0;l<16;l++)f[l]=p[2*l]+(p[2*l+1]<<8);f[15]&=32767}function Te(f,p,l){for(var a=0;a<16;a++)f[a]=p[a]+l[a]}function De(f,p,l){for(var a=0;a<16;a++)f[a]=p[a]-l[a]}function se(f,p,l){var a,m,x=0,E=0,O=0,q=0,ee=0,j=0,Re=0,Y=0,ce=0,ue=0,ge=0,pe=0,fe=0,le=0,de=0,Z=0,oe=0,W=0,X=0,J=0,V=0,C=0,U=0,D=0,R=0,N=0,G=0,ie=0,me=0,ye=0,he=0,A=l[0],_e=l[1],Oe=l[2],Ne=l[3],be=l[4],Ue=l[5],Ie=l[6],rt=l[7],Me=l[8],Qe=l[9],Ye=l[10],Ze=l[11],at=l[12],gt=l[13],mt=l[14],ht=l[15];a=p[0],x+=a*A,E+=a*_e,O+=a*Oe,q+=a*Ne,ee+=a*be,j+=a*Ue,Re+=a*Ie,Y+=a*rt,ce+=a*Me,ue+=a*Qe,ge+=a*Ye,pe+=a*Ze,fe+=a*at,le+=a*gt,de+=a*mt,Z+=a*ht,a=p[1],E+=a*A,O+=a*_e,q+=a*Oe,ee+=a*Ne,j+=a*be,Re+=a*Ue,Y+=a*Ie,ce+=a*rt,ue+=a*Me,ge+=a*Qe,pe+=a*Ye,fe+=a*Ze,le+=a*at,de+=a*gt,Z+=a*mt,oe+=a*ht,a=p[2],O+=a*A,q+=a*_e,ee+=a*Oe,j+=a*Ne,Re+=a*be,Y+=a*Ue,ce+=a*Ie,ue+=a*rt,ge+=a*Me,pe+=a*Qe,fe+=a*Ye,le+=a*Ze,de+=a*at,Z+=a*gt,oe+=a*mt,W+=a*ht,a=p[3],q+=a*A,ee+=a*_e,j+=a*Oe,Re+=a*Ne,Y+=a*be,ce+=a*Ue,ue+=a*Ie,ge+=a*rt,pe+=a*Me,fe+=a*Qe,le+=a*Ye,de+=a*Ze,Z+=a*at,oe+=a*gt,W+=a*mt,X+=a*ht,a=p[4],ee+=a*A,j+=a*_e,Re+=a*Oe,Y+=a*Ne,ce+=a*be,ue+=a*Ue,ge+=a*Ie,pe+=a*rt,fe+=a*Me,le+=a*Qe,de+=a*Ye,Z+=a*Ze,oe+=a*at,W+=a*gt,X+=a*mt,J+=a*ht,a=p[5],j+=a*A,Re+=a*_e,Y+=a*Oe,ce+=a*Ne,ue+=a*be,ge+=a*Ue,pe+=a*Ie,fe+=a*rt,le+=a*Me,de+=a*Qe,Z+=a*Ye,oe+=a*Ze,W+=a*at,X+=a*gt,J+=a*mt,V+=a*ht,a=p[6],Re+=a*A,Y+=a*_e,ce+=a*Oe,ue+=a*Ne,ge+=a*be,pe+=a*Ue,fe+=a*Ie,le+=a*rt,de+=a*Me,Z+=a*Qe,oe+=a*Ye,W+=a*Ze,X+=a*at,J+=a*gt,V+=a*mt,C+=a*ht,a=p[7],Y+=a*A,ce+=a*_e,ue+=a*Oe,ge+=a*Ne,pe+=a*be,fe+=a*Ue,le+=a*Ie,de+=a*rt,Z+=a*Me,oe+=a*Qe,W+=a*Ye,X+=a*Ze,J+=a*at,V+=a*gt,C+=a*mt,U+=a*ht,a=p[8],ce+=a*A,ue+=a*_e,ge+=a*Oe,pe+=a*Ne,fe+=a*be,le+=a*Ue,de+=a*Ie,Z+=a*rt,oe+=a*Me,W+=a*Qe,X+=a*Ye,J+=a*Ze,V+=a*at,C+=a*gt,U+=a*mt,D+=a*ht,a=p[9],ue+=a*A,ge+=a*_e,pe+=a*Oe,fe+=a*Ne,le+=a*be,de+=a*Ue,Z+=a*Ie,oe+=a*rt,W+=a*Me,X+=a*Qe,J+=a*Ye,V+=a*Ze,C+=a*at,U+=a*gt,D+=a*mt,R+=a*ht,a=p[10],ge+=a*A,pe+=a*_e,fe+=a*Oe,le+=a*Ne,de+=a*be,Z+=a*Ue,oe+=a*Ie,W+=a*rt,X+=a*Me,J+=a*Qe,V+=a*Ye,C+=a*Ze,U+=a*at,D+=a*gt,R+=a*mt,N+=a*ht,a=p[11],pe+=a*A,fe+=a*_e,le+=a*Oe,de+=a*Ne,Z+=a*be,oe+=a*Ue,W+=a*Ie,X+=a*rt,J+=a*Me,V+=a*Qe,C+=a*Ye,U+=a*Ze,D+=a*at,R+=a*gt,N+=a*mt,G+=a*ht,a=p[12],fe+=a*A,le+=a*_e,de+=a*Oe,Z+=a*Ne,oe+=a*be,W+=a*Ue,X+=a*Ie,J+=a*rt,V+=a*Me,C+=a*Qe,U+=a*Ye,D+=a*Ze,R+=a*at,N+=a*gt,G+=a*mt,ie+=a*ht,a=p[13],le+=a*A,de+=a*_e,Z+=a*Oe,oe+=a*Ne,W+=a*be,X+=a*Ue,J+=a*Ie,V+=a*rt,C+=a*Me,U+=a*Qe,D+=a*Ye,R+=a*Ze,N+=a*at,G+=a*gt,ie+=a*mt,me+=a*ht,a=p[14],de+=a*A,Z+=a*_e,oe+=a*Oe,W+=a*Ne,X+=a*be,J+=a*Ue,V+=a*Ie,C+=a*rt,U+=a*Me,D+=a*Qe,R+=a*Ye,N+=a*Ze,G+=a*at,ie+=a*gt,me+=a*mt,ye+=a*ht,a=p[15],Z+=a*A,oe+=a*_e,W+=a*Oe,X+=a*Ne,J+=a*be,V+=a*Ue,C+=a*Ie,U+=a*rt,D+=a*Me,R+=a*Qe,N+=a*Ye,G+=a*Ze,ie+=a*at,me+=a*gt,ye+=a*mt,he+=a*ht,x+=38*oe,E+=38*W,O+=38*X,q+=38*J,ee+=38*V,j+=38*C,Re+=38*U,Y+=38*D,ce+=38*R,ue+=38*N,ge+=38*G,pe+=38*ie,fe+=38*me,le+=38*ye,de+=38*he,m=1,a=x+m+65535,m=Math.floor(a/65536),x=a-m*65536,a=E+m+65535,m=Math.floor(a/65536),E=a-m*65536,a=O+m+65535,m=Math.floor(a/65536),O=a-m*65536,a=q+m+65535,m=Math.floor(a/65536),q=a-m*65536,a=ee+m+65535,m=Math.floor(a/65536),ee=a-m*65536,a=j+m+65535,m=Math.floor(a/65536),j=a-m*65536,a=Re+m+65535,m=Math.floor(a/65536),Re=a-m*65536,a=Y+m+65535,m=Math.floor(a/65536),Y=a-m*65536,a=ce+m+65535,m=Math.floor(a/65536),ce=a-m*65536,a=ue+m+65535,m=Math.floor(a/65536),ue=a-m*65536,a=ge+m+65535,m=Math.floor(a/65536),ge=a-m*65536,a=pe+m+65535,m=Math.floor(a/65536),pe=a-m*65536,a=fe+m+65535,m=Math.floor(a/65536),fe=a-m*65536,a=le+m+65535,m=Math.floor(a/65536),le=a-m*65536,a=de+m+65535,m=Math.floor(a/65536),de=a-m*65536,a=Z+m+65535,m=Math.floor(a/65536),Z=a-m*65536,x+=m-1+37*(m-1),m=1,a=x+m+65535,m=Math.floor(a/65536),x=a-m*65536,a=E+m+65535,m=Math.floor(a/65536),E=a-m*65536,a=O+m+65535,m=Math.floor(a/65536),O=a-m*65536,a=q+m+65535,m=Math.floor(a/65536),q=a-m*65536,a=ee+m+65535,m=Math.floor(a/65536),ee=a-m*65536,a=j+m+65535,m=Math.floor(a/65536),j=a-m*65536,a=Re+m+65535,m=Math.floor(a/65536),Re=a-m*65536,a=Y+m+65535,m=Math.floor(a/65536),Y=a-m*65536,a=ce+m+65535,m=Math.floor(a/65536),ce=a-m*65536,a=ue+m+65535,m=Math.floor(a/65536),ue=a-m*65536,a=ge+m+65535,m=Math.floor(a/65536),ge=a-m*65536,a=pe+m+65535,m=Math.floor(a/65536),pe=a-m*65536,a=fe+m+65535,m=Math.floor(a/65536),fe=a-m*65536,a=le+m+65535,m=Math.floor(a/65536),le=a-m*65536,a=de+m+65535,m=Math.floor(a/65536),de=a-m*65536,a=Z+m+65535,m=Math.floor(a/65536),Z=a-m*65536,x+=m-1+37*(m-1),f[0]=x,f[1]=E,f[2]=O,f[3]=q,f[4]=ee,f[5]=j,f[6]=Re,f[7]=Y,f[8]=ce,f[9]=ue,f[10]=ge,f[11]=pe,f[12]=fe,f[13]=le,f[14]=de,f[15]=Z}function Ke(f,p){se(f,p,p)}function vt(f,p){var l=t(),a;for(a=0;a<16;a++)l[a]=p[a];for(a=253;a>=0;a--)Ke(l,l),a!==2&&a!==4&&se(l,l,p);for(a=0;a<16;a++)f[a]=l[a]}function ot(f,p){var l=t(),a;for(a=0;a<16;a++)l[a]=p[a];for(a=250;a>=0;a--)Ke(l,l),a!==1&&se(l,l,p);for(a=0;a<16;a++)f[a]=l[a]}function Dt(f,p,l){var a=new Uint8Array(32),m=new Float64Array(80),x,E,O=t(),q=t(),ee=t(),j=t(),Re=t(),Y=t();for(E=0;E<31;E++)a[E]=p[E];for(a[31]=p[31]&127|64,a[0]&=248,ke(m,l),E=0;E<16;E++)q[E]=m[E],j[E]=O[E]=ee[E]=0;for(O[0]=j[0]=1,E=254;E>=0;--E)x=a[E>>>3]>>>(E&7)&1,H(O,q,x),H(ee,j,x),Te(Re,O,ee),De(O,O,ee),Te(ee,q,j),De(q,q,j),Ke(j,Re),Ke(Y,O),se(O,ee,O),se(ee,q,Re),Te(Re,O,ee),De(O,O,ee),Ke(q,O),De(ee,j,Y),se(O,ee,c),Te(O,O,j),se(ee,ee,O),se(O,j,Y),se(j,q,m),Ke(q,Re),H(O,q,x),H(ee,j,x);for(E=0;E<16;E++)m[E+16]=O[E],m[E+32]=ee[E],m[E+48]=q[E],m[E+64]=j[E];var ce=m.subarray(32),ue=m.subarray(16);return vt(ce,ce),se(ue,ue,ce),ne(f,ue),0}function st(f,p){return Dt(f,p,o)}function pt(f,p){return e(p,32),st(f,p)}function fn(f,p,l){var a=new Uint8Array(32);return Dt(a,l,p),$(f,r,a,M)}var He=Ce,bt=Ve;function Yt(f,p,l,a,m,x){var E=new Uint8Array(32);return fn(E,m,x),He(f,p,l,a,E)}function xr(f,p,l,a,m,x){var E=new Uint8Array(32);return fn(E,m,x),bt(f,p,l,a,E)}var Hn=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Ku(f,p,l,a){for(var m=new Int32Array(16),x=new Int32Array(16),E,O,q,ee,j,Re,Y,ce,ue,ge,pe,fe,le,de,Z,oe,W,X,J,V,C,U,D,R,N,G,ie=f[0],me=f[1],ye=f[2],he=f[3],A=f[4],_e=f[5],Oe=f[6],Ne=f[7],be=p[0],Ue=p[1],Ie=p[2],rt=p[3],Me=p[4],Qe=p[5],Ye=p[6],Ze=p[7],at=0;a>=128;){for(J=0;J<16;J++)V=8*J+at,m[J]=l[V+0]<<24|l[V+1]<<16|l[V+2]<<8|l[V+3],x[J]=l[V+4]<<24|l[V+5]<<16|l[V+6]<<8|l[V+7];for(J=0;J<80;J++)if(E=ie,O=me,q=ye,ee=he,j=A,Re=_e,Y=Oe,ce=Ne,ue=be,ge=Ue,pe=Ie,fe=rt,le=Me,de=Qe,Z=Ye,oe=Ze,C=Ne,U=Ze,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=(A>>>14|Me<<18)^(A>>>18|Me<<14)^(Me>>>9|A<<23),U=(Me>>>14|A<<18)^(Me>>>18|A<<14)^(A>>>9|Me<<23),D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,C=A&_e^~A&Oe,U=Me&Qe^~Me&Ye,D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,C=Hn[J*2],U=Hn[J*2+1],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,C=m[J%16],U=x[J%16],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,W=N&65535|G<<16,X=D&65535|R<<16,C=W,U=X,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=(ie>>>28|be<<4)^(be>>>2|ie<<30)^(be>>>7|ie<<25),U=(be>>>28|ie<<4)^(ie>>>2|be<<30)^(ie>>>7|be<<25),D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,C=ie&me^ie&ye^me&ye,U=be&Ue^be&Ie^Ue&Ie,D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,ce=N&65535|G<<16,oe=D&65535|R<<16,C=ee,U=fe,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=W,U=X,D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,ee=N&65535|G<<16,fe=D&65535|R<<16,me=E,ye=O,he=q,A=ee,_e=j,Oe=Re,Ne=Y,ie=ce,Ue=ue,Ie=ge,rt=pe,Me=fe,Qe=le,Ye=de,Ze=Z,be=oe,J%16===15)for(V=0;V<16;V++)C=m[V],U=x[V],D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=m[(V+9)%16],U=x[(V+9)%16],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,W=m[(V+1)%16],X=x[(V+1)%16],C=(W>>>1|X<<31)^(W>>>8|X<<24)^W>>>7,U=(X>>>1|W<<31)^(X>>>8|W<<24)^(X>>>7|W<<25),D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,W=m[(V+14)%16],X=x[(V+14)%16],C=(W>>>19|X<<13)^(X>>>29|W<<3)^W>>>6,U=(X>>>19|W<<13)^(W>>>29|X<<3)^(X>>>6|W<<26),D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,m[V]=N&65535|G<<16,x[V]=D&65535|R<<16;C=ie,U=be,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=f[0],U=p[0],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,f[0]=ie=N&65535|G<<16,p[0]=be=D&65535|R<<16,C=me,U=Ue,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=f[1],U=p[1],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,f[1]=me=N&65535|G<<16,p[1]=Ue=D&65535|R<<16,C=ye,U=Ie,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=f[2],U=p[2],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,f[2]=ye=N&65535|G<<16,p[2]=Ie=D&65535|R<<16,C=he,U=rt,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=f[3],U=p[3],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,f[3]=he=N&65535|G<<16,p[3]=rt=D&65535|R<<16,C=A,U=Me,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=f[4],U=p[4],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,f[4]=A=N&65535|G<<16,p[4]=Me=D&65535|R<<16,C=_e,U=Qe,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=f[5],U=p[5],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,f[5]=_e=N&65535|G<<16,p[5]=Qe=D&65535|R<<16,C=Oe,U=Ye,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=f[6],U=p[6],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,f[6]=Oe=N&65535|G<<16,p[6]=Ye=D&65535|R<<16,C=Ne,U=Ze,D=U&65535,R=U>>>16,N=C&65535,G=C>>>16,C=f[7],U=p[7],D+=U&65535,R+=U>>>16,N+=C&65535,G+=C>>>16,R+=D>>>16,N+=R>>>16,G+=N>>>16,f[7]=Ne=N&65535|G<<16,p[7]=Ze=D&65535|R<<16,at+=128,a-=128}return a}function br(f,p,l){var a=new Int32Array(8),m=new Int32Array(8),x=new Uint8Array(256),E,O=l;for(a[0]=1779033703,a[1]=3144134277,a[2]=1013904242,a[3]=2773480762,a[4]=1359893119,a[5]=2600822924,a[6]=528734635,a[7]=1541459225,m[0]=4089235720,m[1]=2227873595,m[2]=4271175723,m[3]=1595750129,m[4]=2917565137,m[5]=725511199,m[6]=4215389547,m[7]=327033209,Ku(a,m,p,l),l%=128,E=0;E<l;E++)x[E]=p[O-l+E];for(x[l]=128,l=256-128*(l<112?1:0),x[l-9]=0,S(x,l-8,O/536870912|0,O<<3),Ku(a,m,x,l),E=0;E<8;E++)S(f,8*E,a[E],m[E]);return 0}function Ds(f,p){var l=t(),a=t(),m=t(),x=t(),E=t(),O=t(),q=t(),ee=t(),j=t();De(l,f[1],f[0]),De(j,p[1],p[0]),se(l,l,j),Te(a,f[0],f[1]),Te(j,p[0],p[1]),se(a,a,j),se(m,f[3],p[3]),se(m,m,d),se(x,f[2],p[2]),Te(x,x,x),De(E,a,l),De(O,x,m),Te(q,x,m),Te(ee,a,l),se(f[0],E,O),se(f[1],ee,q),se(f[2],q,O),se(f[3],E,ee)}function Fu(f,p,l){var a;for(a=0;a<4;a++)H(f[a],p[a],l)}function xa(f,p){var l=t(),a=t(),m=t();vt(m,p[2]),se(l,p[0],m),se(a,p[1],m),ne(f,a),f[31]^=xe(l)<<7}function ba(f,p,l){var a,m;for(_(f[0],s),_(f[1],i),_(f[2],i),_(f[3],s),m=255;m>=0;--m)a=l[m/8|0]>>(m&7)&1,Fu(f,p,a),Ds(p,f),Ds(f,f),Fu(f,p,a)}function Ms(f,p){var l=[t(),t(),t(),t()];_(l[0],h),_(l[1],g),_(l[2],i),se(l[3],h,g),ba(f,l,p)}function wa(f,p,l){var a=new Uint8Array(64),m=[t(),t(),t(),t()],x;for(l||e(p,32),br(a,p,32),a[0]&=248,a[31]&=127,a[31]|=64,Ms(m,a),xa(f,m),x=0;x<32;x++)p[x+32]=f[x];return 0}var Gs=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Ta(f,p){var l,a,m,x;for(a=63;a>=32;--a){for(l=0,m=a-32,x=a-12;m<x;++m)p[m]+=l-16*p[a]*Gs[m-(a-32)],l=Math.floor((p[m]+128)/256),p[m]-=l*256;p[m]+=l,p[a]=0}for(l=0,m=0;m<32;m++)p[m]+=l-(p[31]>>4)*Gs[m],l=p[m]>>8,p[m]&=255;for(m=0;m<32;m++)p[m]-=l*Gs[m];for(a=0;a<32;a++)p[a+1]+=p[a]>>8,f[a]=p[a]&255}function _a(f){var p=new Float64Array(64),l;for(l=0;l<64;l++)p[l]=f[l];for(l=0;l<64;l++)f[l]=0;Ta(f,p)}function Hu(f,p,l,a){var m=new Uint8Array(64),x=new Uint8Array(64),E=new Uint8Array(64),O,q,ee=new Float64Array(64),j=[t(),t(),t(),t()];br(m,a,32),m[0]&=248,m[31]&=127,m[31]|=64;var Re=l+64;for(O=0;O<l;O++)f[64+O]=p[O];for(O=0;O<32;O++)f[32+O]=m[32+O];for(br(E,f.subarray(32),l+32),_a(E),Ms(j,E),xa(f,j),O=32;O<64;O++)f[O]=a[O];for(br(x,f,l+64),_a(x),O=0;O<64;O++)ee[O]=0;for(O=0;O<32;O++)ee[O]=E[O];for(O=0;O<32;O++)for(q=0;q<32;q++)ee[O+q]+=x[O]*m[q];return Ta(f.subarray(32),ee),Re}function jp(f,p){var l=t(),a=t(),m=t(),x=t(),E=t(),O=t(),q=t();return _(f[2],i),ke(f[1],p),Ke(m,f[1]),se(x,m,u),De(m,m,f[2]),Te(x,f[2],x),Ke(E,x),Ke(O,E),se(q,O,E),se(l,q,m),se(l,l,x),ot(l,l),se(l,l,m),se(l,l,x),se(l,l,x),se(f[0],l,x),Ke(a,f[0]),se(a,a,x),re(a,m)&&se(f[0],f[0],T),Ke(a,f[0]),se(a,a,x),re(a,m)?-1:(xe(f[0])===p[31]>>7&&De(f[0],s,f[0]),se(f[3],f[0],f[1]),0)}function Ea(f,p,l,a){var m,x=new Uint8Array(32),E=new Uint8Array(64),O=[t(),t(),t(),t()],q=[t(),t(),t(),t()];if(l<64||jp(q,a))return-1;for(m=0;m<l;m++)f[m]=p[m];for(m=0;m<32;m++)f[m+32]=a[m];if(br(E,f,l),_a(E),ba(O,q,E),Ms(q,p.subarray(32)),Ds(O,q),xa(x,O),l-=64,w(p,0,x,0)){for(m=0;m<l;m++)f[m]=0;return-1}for(m=0;m<l;m++)f[m]=p[m+64];return l}var Sa=32,Ls=24,Mo=32,ao=16,Go=32,qs=32,Lo=32,qo=32,va=32,$u=Ls,Wp=Mo,Qp=ao,En=64,wr=32,co=64,Ca=32,Ua=64;n.lowlevel={crypto_core_hsalsa20:$,crypto_stream_xor:we,crypto_stream:K,crypto_stream_salsa20_xor:z,crypto_stream_salsa20:L,crypto_onetimeauth:Q,crypto_onetimeauth_verify:ve,crypto_verify_16:y,crypto_verify_32:w,crypto_secretbox:Ce,crypto_secretbox_open:Ve,crypto_scalarmult:Dt,crypto_scalarmult_base:st,crypto_box_beforenm:fn,crypto_box_afternm:He,crypto_box:Yt,crypto_box_open:xr,crypto_box_keypair:pt,crypto_hash:br,crypto_sign:Hu,crypto_sign_keypair:wa,crypto_sign_open:Ea,crypto_secretbox_KEYBYTES:Sa,crypto_secretbox_NONCEBYTES:Ls,crypto_secretbox_ZEROBYTES:Mo,crypto_secretbox_BOXZEROBYTES:ao,crypto_scalarmult_BYTES:Go,crypto_scalarmult_SCALARBYTES:qs,crypto_box_PUBLICKEYBYTES:Lo,crypto_box_SECRETKEYBYTES:qo,crypto_box_BEFORENMBYTES:va,crypto_box_NONCEBYTES:$u,crypto_box_ZEROBYTES:Wp,crypto_box_BOXZEROBYTES:Qp,crypto_sign_BYTES:En,crypto_sign_PUBLICKEYBYTES:wr,crypto_sign_SECRETKEYBYTES:co,crypto_sign_SEEDBYTES:Ca,crypto_hash_BYTES:Ua,gf:t,D:u,L:Gs,pack25519:ne,unpack25519:ke,M:se,A:Te,S:Ke,Z:De,pow2523:ot,add:Ds,set25519:_,modL:Ta,scalarmult:ba,scalarbase:Ms};function Vu(f,p){if(f.length!==Sa)throw new Error("bad key size");if(p.length!==Ls)throw new Error("bad nonce size")}function Yp(f,p){if(f.length!==Lo)throw new Error("bad public key size");if(p.length!==qo)throw new Error("bad secret key size")}function It(){for(var f=0;f<arguments.length;f++)if(!(arguments[f]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function ju(f){for(var p=0;p<f.length;p++)f[p]=0}n.randomBytes=function(f){var p=new Uint8Array(f);return e(p,f),p},n.secretbox=function(f,p,l){It(f,p,l),Vu(l,p);for(var a=new Uint8Array(Mo+f.length),m=new Uint8Array(a.length),x=0;x<f.length;x++)a[x+Mo]=f[x];return Ce(m,a,a.length,p,l),m.subarray(ao)},n.secretbox.open=function(f,p,l){It(f,p,l),Vu(l,p);for(var a=new Uint8Array(ao+f.length),m=new Uint8Array(a.length),x=0;x<f.length;x++)a[x+ao]=f[x];return a.length<32||Ve(m,a,a.length,p,l)!==0?null:m.subarray(Mo)},n.secretbox.keyLength=Sa,n.secretbox.nonceLength=Ls,n.secretbox.overheadLength=ao,n.scalarMult=function(f,p){if(It(f,p),f.length!==qs)throw new Error("bad n size");if(p.length!==Go)throw new Error("bad p size");var l=new Uint8Array(Go);return Dt(l,f,p),l},n.scalarMult.base=function(f){if(It(f),f.length!==qs)throw new Error("bad n size");var p=new Uint8Array(Go);return st(p,f),p},n.scalarMult.scalarLength=qs,n.scalarMult.groupElementLength=Go,n.box=function(f,p,l,a){var m=n.box.before(l,a);return n.secretbox(f,p,m)},n.box.before=function(f,p){It(f,p),Yp(f,p);var l=new Uint8Array(va);return fn(l,f,p),l},n.box.after=n.secretbox,n.box.open=function(f,p,l,a){var m=n.box.before(l,a);return n.secretbox.open(f,p,m)},n.box.open.after=n.secretbox.open,n.box.keyPair=function(){var f=new Uint8Array(Lo),p=new Uint8Array(qo);return pt(f,p),{publicKey:f,secretKey:p}},n.box.keyPair.fromSecretKey=function(f){if(It(f),f.length!==qo)throw new Error("bad secret key size");var p=new Uint8Array(Lo);return st(p,f),{publicKey:p,secretKey:new Uint8Array(f)}},n.box.publicKeyLength=Lo,n.box.secretKeyLength=qo,n.box.sharedKeyLength=va,n.box.nonceLength=$u,n.box.overheadLength=n.secretbox.overheadLength,n.sign=function(f,p){if(It(f,p),p.length!==co)throw new Error("bad secret key size");var l=new Uint8Array(En+f.length);return Hu(l,f,f.length,p),l},n.sign.open=function(f,p){if(It(f,p),p.length!==wr)throw new Error("bad public key size");var l=new Uint8Array(f.length),a=Ea(l,f,f.length,p);if(a<0)return null;for(var m=new Uint8Array(a),x=0;x<m.length;x++)m[x]=l[x];return m},n.sign.detached=function(f,p){for(var l=n.sign(f,p),a=new Uint8Array(En),m=0;m<a.length;m++)a[m]=l[m];return a},n.sign.detached.verify=function(f,p,l){if(It(f,p,l),p.length!==En)throw new Error("bad signature size");if(l.length!==wr)throw new Error("bad public key size");var a=new Uint8Array(En+f.length),m=new Uint8Array(En+f.length),x;for(x=0;x<En;x++)a[x]=p[x];for(x=0;x<f.length;x++)a[x+En]=f[x];return Ea(m,a,a.length,l)>=0},n.sign.keyPair=function(){var f=new Uint8Array(wr),p=new Uint8Array(co);return wa(f,p),{publicKey:f,secretKey:p}},n.sign.keyPair.fromSecretKey=function(f){if(It(f),f.length!==co)throw new Error("bad secret key size");for(var p=new Uint8Array(wr),l=0;l<p.length;l++)p[l]=f[32+l];return{publicKey:p,secretKey:new Uint8Array(f)}},n.sign.keyPair.fromSeed=function(f){if(It(f),f.length!==Ca)throw new Error("bad seed size");for(var p=new Uint8Array(wr),l=new Uint8Array(co),a=0;a<32;a++)l[a]=f[a];return wa(p,l,!0),{publicKey:p,secretKey:l}},n.sign.publicKeyLength=wr,n.sign.secretKeyLength=co,n.sign.seedLength=Ca,n.sign.signatureLength=En,n.hash=function(f){It(f);var p=new Uint8Array(Ua);return br(p,f,f.length),p},n.hash.hashLength=Ua,n.verify=function(f,p){return It(f,p),f.length===0||p.length===0||f.length!==p.length?!1:b(f,0,p,0,f.length)===0},n.setPRNG=function(f){e=f},function(){var f=typeof self<"u"?self.crypto||self.msCrypto:null;if(f&&f.getRandomValues){var p=65536;n.setPRNG(function(l,a){var m,x=new Uint8Array(a);for(m=0;m<a;m+=p)f.getRandomValues(x.subarray(m,m+Math.min(a-m,p)));for(m=0;m<a;m++)l[m]=x[m];ju(x)})}else typeof Qu<"u"&&(f=wf(),f&&f.randomBytes&&n.setPRNG(function(l,a){var m,x=f.randomBytes(a);for(m=0;m<a;m++)l[m]=x[m];ju(x)}))}()})(typeof oi<"u"&&oi.exports?oi.exports:self.nacl=self.nacl||{})});var $p=Ia((Q6,Gu)=>{"use strict";var Ky=Object.prototype.hasOwnProperty,St="~";function Os(){}Object.create&&(Os.prototype=Object.create(null),new Os().__proto__||(St=!1));function Fy(n,t,e){this.fn=n,this.context=t,this.once=e||!1}function Hp(n,t,e,r,o){if(typeof e!="function")throw new TypeError("The listener must be a function");var s=new Fy(e,r||n,o),i=St?St+t:t;return n._events[i]?n._events[i].fn?n._events[i]=[n._events[i],s]:n._events[i].push(s):(n._events[i]=s,n._eventsCount++),n}function ma(n,t){--n._eventsCount===0?n._events=new Os:delete n._events[t]}function xt(){this._events=new Os,this._eventsCount=0}xt.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)Ky.call(e,r)&&t.push(St?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};xt.prototype.listeners=function(t){var e=St?St+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,s=r.length,i=new Array(s);o<s;o++)i[o]=r[o].fn;return i};xt.prototype.listenerCount=function(t){var e=St?St+t:t,r=this._events[e];return r?r.fn?1:r.length:0};xt.prototype.emit=function(t,e,r,o,s,i){var c=St?St+t:t;if(!this._events[c])return!1;var u=this._events[c],d=arguments.length,h,g;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,r),!0;case 4:return u.fn.call(u.context,e,r,o),!0;case 5:return u.fn.call(u.context,e,r,o,s),!0;case 6:return u.fn.call(u.context,e,r,o,s,i),!0}for(g=1,h=new Array(d-1);g<d;g++)h[g-1]=arguments[g];u.fn.apply(u.context,h)}else{var T=u.length,S;for(g=0;g<T;g++)switch(u[g].once&&this.removeListener(t,u[g].fn,void 0,!0),d){case 1:u[g].fn.call(u[g].context);break;case 2:u[g].fn.call(u[g].context,e);break;case 3:u[g].fn.call(u[g].context,e,r);break;case 4:u[g].fn.call(u[g].context,e,r,o);break;default:if(!h)for(S=1,h=new Array(d-1);S<d;S++)h[S-1]=arguments[S];u[g].fn.apply(u[g].context,h)}}return!0};xt.prototype.on=function(t,e,r){return Hp(this,t,e,r,!1)};xt.prototype.once=function(t,e,r){return Hp(this,t,e,r,!0)};xt.prototype.removeListener=function(t,e,r,o){var s=St?St+t:t;if(!this._events[s])return this;if(!e)return ma(this,s),this;var i=this._events[s];if(i.fn)i.fn===e&&(!o||i.once)&&(!r||i.context===r)&&ma(this,s);else{for(var c=0,u=[],d=i.length;c<d;c++)(i[c].fn!==e||o&&!i[c].once||r&&i[c].context!==r)&&u.push(i[c]);u.length?this._events[s]=u.length===1?u[0]:u:ma(this,s)}return this};xt.prototype.removeAllListeners=function(t){var e;return t?(e=St?St+t:t,this._events[e]&&ma(this,e)):(this._events=new Os,this._eventsCount=0),this};xt.prototype.off=xt.prototype.removeListener;xt.prototype.addListener=xt.prototype.on;xt.prefixed=St;xt.EventEmitter=xt;typeof Gu<"u"&&(Gu.exports=xt)});var Hy={};Ks(Hy,{APTOS_BIP44_REGEX:()=>Cf,APTOS_COIN:()=>jo,APTOS_HARDENED_REGEX:()=>vf,Account:()=>Ln,AccountAddress:()=>F,AccountAuthenticator:()=>Ut,AccountAuthenticatorEd25519:()=>An,AccountAuthenticatorMultiEd25519:()=>ms,AccountAuthenticatorMultiKey:()=>Kr,AccountAuthenticatorSingleKey:()=>cn,AccountAuthenticatorVariant:()=>Na,AccountSequenceNumber:()=>Ns,AddressInvalidReason:()=>pf,AnyPublicKey:()=>je,AnyPublicKeyVariant:()=>ka,AnySignature:()=>mn,AnySignatureVariant:()=>za,Aptos:()=>zt,AptosApiError:()=>dn,AptosApiType:()=>$o,AptosConfig:()=>ps,AuthenticationKey:()=>an,Bool:()=>Xe,CKDPriv:()=>ac,ChainId:()=>jr,DEFAULT_MAX_GAS_AMOUNT:()=>qa,DEFAULT_NETWORK:()=>La,DEFAULT_TXN_EXP_SEC_FROM_NOW:()=>Ka,DEFAULT_TXN_TIMEOUT_SEC:()=>Vo,DeriveScheme:()=>nf,Deserializer:()=>tc,Ed25519PrivateKey:()=>Pn,Ed25519PublicKey:()=>qe,Ed25519Signature:()=>Je,EntryFunction:()=>oo,EntryFunctionBytes:()=>Yo,FeePayerRawTransaction:()=>Tn,FixedBytes:()=>Wn,HARDENED_OFFSET:()=>oc,Hex:()=>Be,HexInvalidReason:()=>df,Identifier:()=>We,KeyType:()=>Uf,MimeType:()=>Fs,ModuleId:()=>vo,MoveAbility:()=>ef,MoveFunctionVisibility:()=>Ju,MoveOption:()=>Bn,MoveString:()=>yt,MoveVector:()=>Le,MultiAgentRawTransaction:()=>wn,MultiEd25519PublicKey:()=>nn,MultiEd25519Signature:()=>Rr,MultiKey:()=>qr,MultiSig:()=>Po,MultiSigTransactionPayload:()=>Ro,Network:()=>Ho,NetworkToChainId:()=>Vs,NetworkToFaucetAPI:()=>Ga,NetworkToIndexerAPI:()=>$s,NetworkToNetworkName:()=>lg,NetworkToNodeAPI:()=>Ma,ParsingError:()=>wt,PrivateKey:()=>Br,ProcessorType:()=>Tr,PublicKey:()=>Pt,RAW_TRANSACTION_SALT:()=>Fa,RAW_TRANSACTION_WITH_DATA_SALT:()=>js,RawTransaction:()=>Wt,RawTransactionWithData:()=>ys,RoleType:()=>tf,RotationProofChallenge:()=>gs,Script:()=>Bo,ScriptTransactionArgumentVariants:()=>uo,Secp256k1PrivateKey:()=>Dn,Secp256k1PublicKey:()=>Vt,Secp256k1Signature:()=>Mn,Serializable:()=>ae,Serializer:()=>Jt,Signature:()=>tn,SignedTransaction:()=>un,SigningScheme:()=>fo,SigningSchemeInput:()=>Da,StructTag:()=>bn,TransactionAuthenticator:()=>xn,TransactionAuthenticatorEd25519:()=>Fr,TransactionAuthenticatorFeePayer:()=>$r,TransactionAuthenticatorMultiAgent:()=>Hr,TransactionAuthenticatorMultiEd25519:()=>Yi,TransactionAuthenticatorSingleSender:()=>Vr,TransactionAuthenticatorVariant:()=>Oa,TransactionPayload:()=>hr,TransactionPayloadEntryFunction:()=>Uo,TransactionPayloadMultiSig:()=>Io,TransactionPayloadScript:()=>Co,TransactionPayloadVariants:()=>Pa,TransactionResponseType:()=>Hs,TransactionVariants:()=>Ra,TransactionWorker:()=>ks,TransactionWorkerEventsEnum:()=>qu,TypeTag:()=>nt,TypeTagAddress:()=>to,TypeTagBool:()=>Wr,TypeTagGeneric:()=>no,TypeTagParserError:()=>Fe,TypeTagParserErrorType:()=>Hl,TypeTagReference:()=>hs,TypeTagSigner:()=>mr,TypeTagStruct:()=>Kn,TypeTagU128:()=>Jr,TypeTagU16:()=>Yr,TypeTagU256:()=>eo,TypeTagU32:()=>Zr,TypeTagU64:()=>Xr,TypeTagU8:()=>Qr,TypeTagVariants:()=>Ba,TypeTagVector:()=>ro,U128:()=>Lt,U16:()=>Mt,U256:()=>qt,U32:()=>Gt,U64:()=>ft,U8:()=>lt,aptosCoinStructTag:()=>vy,aptosRequest:()=>Fo,buildTransaction:()=>ca,checkOrConvertArgument:()=>io,convertArgument:()=>Su,deriveKey:()=>ii,deriveTransactionType:()=>Iu,deserializeFromScriptArgument:()=>ql,ensureBoolean:()=>Js,fetchEntryFunctionAbi:()=>Eu,findFirstNonSignerArg:()=>wu,generateMultiSignersSignedTransaction:()=>Ql,generateRawTransaction:()=>Wl,generateSignedTransaction:()=>Uu,generateSignedTransactionForSimulation:()=>vu,generateSigningMessage:()=>ua,generateTransactionPayload:()=>Ts,generateTransactionPayloadWithABI:()=>Vl,get:()=>Ha,getAptosFullNode:()=>Bt,getAuthenticatorForSimulation:()=>ws,getFunctionParts:()=>aa,isBcsAddress:()=>bs,isBcsBool:()=>Xi,isBcsFixedBytes:()=>$l,isBcsString:()=>Ji,isBcsU128:()=>oa,isBcsU16:()=>ta,isBcsU256:()=>sa,isBcsU32:()=>na,isBcsU64:()=>ra,isBcsU8:()=>ea,isBlockMetadataTransactionResponse:()=>sg,isBool:()=>Au,isEd25519Signature:()=>ag,isEncodedEntryFunctionArgument:()=>bu,isFeePayerSignature:()=>fg,isGenesisTransactionResponse:()=>og,isLargeNumber:()=>xs,isMultiAgentSignature:()=>ug,isMultiEd25519Signature:()=>dg,isNull:()=>xu,isNumber:()=>As,isPendingTransactionResponse:()=>ng,isScriptDataInput:()=>ia,isSecp256k1Signature:()=>cg,isStateCheckpointTransactionResponse:()=>ig,isString:()=>so,isUserTransactionResponse:()=>rg,isValidBIP44Path:()=>sc,isValidHardenedPath:()=>ic,mnemonicToSeed:()=>Xo,objectStructTag:()=>Iy,optionStructTag:()=>Uy,outOfRangeErrorMessage:()=>lf,paginateWithCursor:()=>_r,parseTypeTag:()=>Oo,post:()=>Ws,postAptosFaucet:()=>Va,postAptosFullNode:()=>Er,postAptosIndexer:()=>$a,promiseFulfilledStatus:()=>Lu,request:()=>of,sign:()=>Cu,splitPath:()=>cc,standardizeTypeTags:()=>_u,stringStructTag:()=>Cy,throwTypeMismatch:()=>$e,validateNumberInRange:()=>Cn});var dn=class extends Error{constructor(e,r,o){super(o);this.name="AptosApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.data=r.data,this.request=e}};var Xu="1.5.1";var Fs=(r=>(r.JSON="application/json",r.BCS="application/x-bcs",r.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",r))(Fs||{}),Ba=(S=>(S[S.Bool=0]="Bool",S[S.U8=1]="U8",S[S.U64=2]="U64",S[S.U128=3]="U128",S[S.Address=4]="Address",S[S.Signer=5]="Signer",S[S.Vector=6]="Vector",S[S.Struct=7]="Struct",S[S.U16=8]="U16",S[S.U32=9]="U32",S[S.U256=10]="U256",S[S.Reference=254]="Reference",S[S.Generic=255]="Generic",S))(Ba||{}),uo=(d=>(d[d.U8=0]="U8",d[d.U64=1]="U64",d[d.U128=2]="U128",d[d.Address=3]="Address",d[d.U8Vector=4]="U8Vector",d[d.Bool=5]="Bool",d[d.U16=6]="U16",d[d.U32=7]="U32",d[d.U256=8]="U256",d))(uo||{}),Pa=(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(Pa||{}),Ra=(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(Ra||{}),Oa=(s=>(s[s.Ed25519=0]="Ed25519",s[s.MultiEd25519=1]="MultiEd25519",s[s.MultiAgent=2]="MultiAgent",s[s.FeePayer=3]="FeePayer",s[s.SingleSender=4]="SingleSender",s))(Oa||{}),Na=(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(Na||{}),ka=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(ka||{}),za=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(za||{}),Hs=(s=>(s.Pending="pending_transaction",s.User="user_transaction",s.Genesis="genesis_transaction",s.BlockMetadata="block_metadata_transaction",s.StateCheckpoint="state_checkpoint_transaction",s))(Hs||{});function ng(n){return n.type==="pending_transaction"}function rg(n){return n.type==="user_transaction"}function og(n){return n.type==="genesis_transaction"}function sg(n){return n.type==="block_metadata_transaction"}function ig(n){return n.type==="state_checkpoint_transaction"}function ag(n){return"signature"in n&&n.signature==="ed25519_signature"}function cg(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function ug(n){return n.type==="multi_agent_signature"}function fg(n){return n.type==="fee_payer_signature"}function dg(n){return n.type==="multi_ed25519_signature"}var Ju=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(Ju||{}),ef=(o=>(o.STORE="store",o.DROP="drop",o.KEY="key",o.COPY="copy",o))(ef||{}),tf=(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))(tf||{}),fo=(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(fo||{}),Da=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",e))(Da||{}),nf=(s=>(s[s.DeriveAuid=251]="DeriveAuid",s[s.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",s[s.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",s[s.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",s[s.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",s))(nf||{});var rf={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"};async function of(n,t){let{url:e,method:r,body:o,contentType:s,params:i,overrides:c}=n,u={...c?.HEADERS,"x-aptos-client":`aptos-typescript-sdk/${Xu}`,"content-type":s??"application/json"};return c?.AUTH_TOKEN&&e.includes("faucet")&&(u.Authorization=`Bearer ${c?.AUTH_TOKEN}`),c?.API_KEY&&!e.includes("faucet")&&(u.Authorization=`Bearer ${c?.API_KEY}`),t.provider({url:e,method:r,body:o,params:i,headers:u,overrides:c})}async function Fo(n,t){let{url:e,path:r}=n,o=r?`${e}/${r}`:e,s=await of({...n,url:o},t.client),i={status:s.status,statusText:s.statusText,data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(t.isIndexerRequest(e)){let u=i.data;if(u.errors)throw new dn(n,i,u.errors[0].message??`Unhandled Error ${s.status} : ${s.statusText}`);i.data=u.data}if(i.status>=200&&i.status<300)return i;let c;throw i&&i.data&&"message"in i.data&&"error_code"in i.data?c=JSON.stringify(i.data):i.status in rf?c=rf[i.status]:c=`Unhandled Error ${i.status} : ${i.statusText}`,new dn(n,i,c)}var $s={mainnet:"https://indexer.mainnet.aptoslabs.com/v1/graphql",testnet:"https://indexer-testnet.staging.gcp.aptosdev.com/v1/graphql",devnet:"https://indexer-devnet.staging.gcp.aptosdev.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},Ma={mainnet:"https://fullnode.mainnet.aptoslabs.com/v1",testnet:"https://fullnode.testnet.aptoslabs.com/v1",devnet:"https://fullnode.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},Ga={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},Ho=(s=>(s.MAINNET="mainnet",s.TESTNET="testnet",s.DEVNET="devnet",s.LOCAL="local",s.CUSTOM="custom",s))(Ho||{}),Vs={mainnet:1,testnet:2},lg={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};var $o=(r=>(r[r.FULLNODE=0]="FULLNODE",r[r.INDEXER=1]="INDEXER",r[r.FAUCET=2]="FAUCET",r))($o||{}),La="devnet",qa=2e5,Ka=20,Vo=20,jo="0x1::aptos_coin::AptosCoin",Fa="APTOS::RawTransaction",js="APTOS::RawTransactionWithData",Tr=(c=>(c.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",c.DEFAULT="default_processor",c.EVENTS_PROCESSOR="events_processor",c.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",c.STAKE_PROCESSOR="stake_processor",c.TOKEN_V2_PROCESSOR="token_v2_processor",c.USER_TRANSACTION_PROCESSOR="user_transaction_processor",c))(Tr||{});async function Ha(n){let{aptosConfig:t,overrides:e,params:r,contentType:o,acceptType:s,path:i,originMethod:c,type:u}=n,d=t.getRequestUrl(u);return Fo({url:d,method:"GET",originMethod:c,path:i,contentType:o?.valueOf(),acceptType:s?.valueOf(),params:r,overrides:{...t.clientConfig,...e}},t)}async function Bt(n){return Ha({...n,type:0})}async function _r(n){let t=[],e,r=n.params;for(;;){r.start=e;let o=await Ha({type:0,aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});if(e=o.headers["x-aptos-cursor"],delete o.headers,t.push(...o.data),e==null)break}return t}async function Ws(n){let{type:t,originMethod:e,path:r,body:o,acceptType:s,contentType:i,params:c,aptosConfig:u,overrides:d}=n,h=u.getRequestUrl(t);return Fo({url:h,method:"POST",originMethod:e,path:r,body:o,contentType:i?.valueOf(),acceptType:s?.valueOf(),params:c,overrides:{...u.clientConfig,...d}},u)}async function Er(n){return Ws({...n,type:0})}async function $a(n){return Ws({...n,type:1})}async function Va(n){return Ws({...n,type:2})}var Qs=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var af=n=>new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4));function ja(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}var ln=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),Zt=(n,t)=>n<<32-t|n>>>t,pg=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!pg)throw new Error("Non little-endian hardware is not supported");var gg=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function Sr(n){if(!ja(n))throw new Error("Uint8Array expected");let t="";for(let e=0;e<n.length;e++)t+=gg[n[e]];return t}var Sn={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function sf(n){if(n>=Sn._0&&n<=Sn._9)return n-Sn._0;if(n>=Sn._A&&n<=Sn._F)return n-(Sn._A-10);if(n>=Sn._a&&n<=Sn._f)return n-(Sn._a-10)}function lo(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);let t=n.length,e=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let r=new Uint8Array(e);for(let o=0,s=0;o<e;o++,s+=2){let i=sf(n.charCodeAt(s)),c=sf(n.charCodeAt(s+1));if(i===void 0||c===void 0){let u=n[s]+n[s+1];throw new Error('hex string expected, got non-hex character "'+u+'" at index '+s)}r[o]=i*16+c}return r}function Wa(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function Xt(n){if(typeof n=="string"&&(n=Wa(n)),!ja(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}function vr(...n){let t=0;for(let r=0;r<n.length;r++){let o=n[r];if(!ja(o))throw new Error("Uint8Array expected");t+=o.length}let e=new Uint8Array(t);for(let r=0,o=0;r<n.length;r++){let s=n[r];e.set(s,o),o+=s.length}return e}var $n=class{clone(){return this._cloneInto()}},mg={}.toString;function cf(n,t){if(t!==void 0&&mg.call(t)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(n,t)}function Vn(n){let t=r=>n().update(Xt(r)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}function uf(n){let t=(r,o)=>n(o).update(Xt(r)).digest(),e=n({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=r=>n(r),t}function ff(n=32){if(Qs&&typeof Qs.getRandomValues=="function")return Qs.getRandomValues(new Uint8Array(n));throw new Error("crypto.getRandomValues must be defined")}var Ys=255,Zs=65535,vn=4294967295,Cr=18446744073709551615n,Wo=340282366920938463463374607431768211455n,Xs=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var wt=class extends Error{constructor(e,r){super(e);this.invalidReason=r}};var df=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(df||{}),Be=class n{constructor(t){this.data=t}toUint8Array(){return this.data}toStringWithoutPrefix(){return Sr(this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromString(t){let e=t;if(e.startsWith("0x")&&(e=e.slice(2)),e.length===0)throw new wt("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(e.length%2!==0)throw new wt("Hex string must be an even number of hex characters.","invalid_length");try{return new n(lo(e))}catch(r){throw new wt(`Hex string contains invalid hex characters: ${r?.message}`,"invalid_hex_chars")}}static fromHexInput(t){return t instanceof Uint8Array?new n(t):n.fromString(t)}static isValid(t){try{return n.fromString(t),{valid:!0}}catch(e){return{valid:!1,invalidReason:e?.invalidReason,invalidReasonMessage:e?.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((e,r)=>e===t.data[r])}};var ae=class{bcsToBytes(){let t=new Jt;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return Be.fromHexInput(t)}},Jt=class{constructor(t=64){if(t<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(t),this.offset=0}ensureBufferWillHandleSize(t){for(;this.buffer.byteLength<this.offset+t;){let e=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e}}appendToBuffer(t){this.ensureBufferWillHandleSize(t.length),new Uint8Array(this.buffer,this.offset).set(t),this.offset+=t.length}serializeWithFunction(t,e,r){this.ensureBufferWillHandleSize(e);let o=new DataView(this.buffer,this.offset);t.apply(o,[0,r,!0]),this.offset+=e}serializeStr(t){let e=new TextEncoder;this.serializeBytes(e.encode(t))}serializeBytes(t){this.serializeU32AsUleb128(t.length),this.appendToBuffer(t)}serializeFixedBytes(t){this.appendToBuffer(t)}serializeBool(t){Js(t);let e=t?1:0;this.appendToBuffer(new Uint8Array([e]))}serializeU8(t){this.appendToBuffer(new Uint8Array([t]))}serializeU16(t){this.serializeWithFunction(DataView.prototype.setUint16,2,t)}serializeU32(t){this.serializeWithFunction(DataView.prototype.setUint32,4,t)}serializeU64(t){let e=BigInt(t)&BigInt(vn),r=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(r))}serializeU128(t){let e=BigInt(t)&Cr,r=BigInt(t)>>BigInt(64);this.serializeU64(e),this.serializeU64(r)}serializeU256(t){let e=BigInt(t)&Wo,r=BigInt(t)>>BigInt(128);this.serializeU128(e),this.serializeU128(r)}serializeU32AsUleb128(t){let e=t,r=[];for(;e>>>7;)r.push(e&127|128),e>>>=7;r.push(e),this.appendToBuffer(new Uint8Array(r))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(t){t.serialize(this)}serializeVector(t){this.serializeU32AsUleb128(t.length),t.forEach(e=>{e.serialize(this)})}};Ct([Ur(0,Ys)],Jt.prototype,"serializeU8",1),Ct([Ur(0,Zs)],Jt.prototype,"serializeU16",1),Ct([Ur(0,vn)],Jt.prototype,"serializeU32",1),Ct([Ur(BigInt(0),Cr)],Jt.prototype,"serializeU64",1),Ct([Ur(BigInt(0),Wo)],Jt.prototype,"serializeU128",1),Ct([Ur(BigInt(0),Xs)],Jt.prototype,"serializeU256",1),Ct([Ur(0,vn)],Jt.prototype,"serializeU32AsUleb128",1);function Js(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var lf=(n,t,e)=>`${n} is out of range: [${t}, ${e}]`;function Cn(n,t,e){let r=BigInt(n);if(r>BigInt(e)||r<BigInt(t))throw new Error(lf(n,t,e))}function Ur(n,t){return(e,r,o)=>{let s=o.value;return o.value=function(c){return Cn(c,n,t),s.apply(this,[c])},o}}var pf=(c=>(c.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",c.INVALID_HEX_CHARS="invalid_hex_chars",c.TOO_SHORT="too_short",c.TOO_LONG="too_long",c.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",c.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",c.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",c))(pf||{}),Ge=class Ge extends ae{constructor(e){super();if(e.length!==Ge.LENGTH)throw new wt("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=e}isSpecial(){return this.data.slice(0,this.data.length-1).every(e=>e===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let e=Sr(this.data);return this.isSpecial()&&(e=e[e.length-1]),e}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return Sr(this.data)}toUint8Array(){return this.data}serialize(e){e.serializeFixedBytes(this.data)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(3),e.serialize(this)}static deserialize(e){let r=e.deserializeFixedBytes(Ge.LENGTH);return new Ge(r)}static fromStringStrict(e){if(!e.startsWith("0x"))throw new wt("Hex string must start with a leading 0x.","leading_zero_x_required");let r=Ge.fromString(e);if(e.length!==Ge.LONG_STRING_LENGTH+2)if(r.isSpecial()){if(e.length!==3)throw new wt(`The given hex string ${e} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new wt(`The given hex string ${e} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return r}static fromString(e){let r=e;if(e.startsWith("0x")&&(r=e.slice(2)),r.length===0)throw new wt("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(r.length>64)throw new wt("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let o;try{o=lo(r.padStart(64,"0"))}catch(s){throw new wt(`Hex characters are invalid: ${s?.message}`,"invalid_hex_chars")}return new Ge(o)}static from(e){return e instanceof Ge?e:e instanceof Uint8Array?new Ge(e):Ge.fromString(e)}static fromStrict(e){return e instanceof Ge?e:e instanceof Uint8Array?new Ge(e):Ge.fromStringStrict(e)}static isValid(e){try{return e.strict?Ge.fromStrict(e.input):Ge.from(e.input),{valid:!0}}catch(r){return{valid:!1,invalidReason:r?.invalidReason,invalidReasonMessage:r?.message}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((r,o)=>r===e.data[o])}};Ge.LENGTH=32,Ge.LONG_STRING_LENGTH=64,Ge.ZERO=Ge.from("0x0"),Ge.ONE=Ge.from("0x1"),Ge.TWO=Ge.from("0x2"),Ge.THREE=Ge.from("0x3"),Ge.FOUR=Ge.from("0x4");var F=Ge;function Un(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function hg(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}function en(n,...t){if(!hg(n))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(n.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${n.length}`)}function ei(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Un(n.outputLen),Un(n.blockLen)}function In(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function ti(n,t){en(n);let e=t.outputLen;if(n.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var ni=BigInt(4294967295),Qa=BigInt(32);function gf(n,t=!1){return t?{h:Number(n&ni),l:Number(n>>Qa&ni)}:{h:Number(n>>Qa&ni)|0,l:Number(n&ni)|0}}function Ya(n,t=!1){let e=new Uint32Array(n.length),r=new Uint32Array(n.length);for(let o=0;o<n.length;o++){let{h:s,l:i}=gf(n[o],t);[e[o],r[o]]=[s,i]}return[e,r]}var yg=(n,t)=>BigInt(n>>>0)<<Qa|BigInt(t>>>0),Ag=(n,t,e)=>n>>>e,xg=(n,t,e)=>n<<32-e|t>>>e,bg=(n,t,e)=>n>>>e|t<<32-e,wg=(n,t,e)=>n<<32-e|t>>>e,Tg=(n,t,e)=>n<<64-e|t>>>e-32,_g=(n,t,e)=>n>>>e-32|t<<64-e,Eg=(n,t)=>t,Sg=(n,t)=>n,Za=(n,t,e)=>n<<e|t>>>32-e,Xa=(n,t,e)=>t<<e|n>>>32-e,Ja=(n,t,e)=>t<<e-32|n>>>64-e,ec=(n,t,e)=>n<<e-32|t>>>64-e;function vg(n,t,e,r){let o=(t>>>0)+(r>>>0);return{h:n+e+(o/2**32|0)|0,l:o|0}}var Cg=(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0),Ug=(n,t,e,r)=>t+e+r+(n/2**32|0)|0,Ig=(n,t,e,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0),Bg=(n,t,e,r,o)=>t+e+r+o+(n/2**32|0)|0,Pg=(n,t,e,r,o)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(o>>>0),Rg=(n,t,e,r,o,s)=>t+e+r+o+s+(n/2**32|0)|0;var Og={fromBig:gf,split:Ya,toBig:yg,shrSH:Ag,shrSL:xg,rotrSH:bg,rotrSL:wg,rotrBH:Tg,rotrBL:_g,rotr32H:Eg,rotr32L:Sg,rotlSH:Za,rotlSL:Xa,rotlBH:Ja,rotlBL:ec,add:vg,add3L:Cg,add3H:Ug,add4L:Ig,add4H:Bg,add5H:Rg,add5L:Pg},Ae=Og;var[yf,Af,xf]=[[],[],[]],Ng=BigInt(0),Qo=BigInt(1),kg=BigInt(2),zg=BigInt(7),Dg=BigInt(256),Mg=BigInt(113);for(let n=0,t=Qo,e=1,r=0;n<24;n++){[e,r]=[r,(2*e+3*r)%5],yf.push(2*(5*r+e)),Af.push((n+1)*(n+2)/2%64);let o=Ng;for(let s=0;s<7;s++)t=(t<<Qo^(t>>zg)*Mg)%Dg,t&kg&&(o^=Qo<<(Qo<<BigInt(s))-Qo);xf.push(o)}var[Gg,Lg]=Ya(xf,!0),mf=(n,t,e)=>e>32?Ja(n,t,e):Za(n,t,e),hf=(n,t,e)=>e>32?ec(n,t,e):Xa(n,t,e);function qg(n,t=24){let e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)e[i]=n[i]^n[i+10]^n[i+20]^n[i+30]^n[i+40];for(let i=0;i<10;i+=2){let c=(i+8)%10,u=(i+2)%10,d=e[u],h=e[u+1],g=mf(d,h,1)^e[c],T=hf(d,h,1)^e[c+1];for(let S=0;S<50;S+=10)n[i+S]^=g,n[i+S+1]^=T}let o=n[2],s=n[3];for(let i=0;i<24;i++){let c=Af[i],u=mf(o,s,c),d=hf(o,s,c),h=yf[i];o=n[h],s=n[h+1],n[h]=u,n[h+1]=d}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)e[c]=n[i+c];for(let c=0;c<10;c++)n[i+c]^=~e[(c+2)%10]&e[(c+4)%10]}n[0]^=Gg[r],n[1]^=Lg[r]}e.fill(0)}var ri=class n extends $n{constructor(t,e,r,o=!1,s=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=o,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Un(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=af(this.state)}keccak(){qg(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){In(this);let{blockLen:e,state:r}=this;t=Xt(t);let o=t.length;for(let s=0;s<o;){let i=Math.min(e-this.pos,o-s);for(let c=0;c<i;c++)r[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:e,pos:r,blockLen:o}=this;t[r]^=e,e&128&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){In(this,!1),en(t),this.finish();let e=this.state,{blockLen:r}=this;for(let o=0,s=t.length;o<s;){this.posOut>=r&&this.keccak();let i=Math.min(r-this.posOut,s-o);t.set(e.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Un(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(ti(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:e,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new n(e,r,o,i,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=o,t.enableXOF=i,t.destroyed=this.destroyed,t}},jn=(n,t,e)=>Vn(()=>new ri(t,n,e)),V0=jn(6,144,224/8),Ir=jn(6,136,256/8),j0=jn(6,104,384/8),W0=jn(6,72,512/8),Q0=jn(1,144,224/8),Y0=jn(1,136,256/8),Z0=jn(1,104,384/8),X0=jn(1,72,512/8),bf=(n,t,e)=>uf((r={})=>new ri(t,n,r.dkLen===void 0?e:r.dkLen,!0)),J0=bf(31,168,128/8),eA=bf(31,136,256/8);var Jo=Zu(Tf());var tc=class{constructor(t){this.buffer=new ArrayBuffer(t.length),new Uint8Array(this.buffer).set(t,0),this.offset=0}read(t){if(this.offset+t>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}deserializeStr(){let t=this.deserializeBytes();return new TextDecoder().decode(t)}deserializeBytes(){let t=this.deserializeUleb128AsU32();return new Uint8Array(this.read(t))}deserializeFixedBytes(t){return new Uint8Array(this.read(t))}deserializeBool(){let t=new Uint8Array(this.read(1))[0];if(t!==1&&t!==0)throw new Error("Invalid boolean value");return t===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let t=this.deserializeU32(),e=this.deserializeU32();return BigInt(BigInt(e)<<BigInt(32)|BigInt(t))}deserializeU128(){let t=this.deserializeU64(),e=this.deserializeU64();return BigInt(e<<BigInt(64)|t)}deserializeU256(){let t=this.deserializeU128(),e=this.deserializeU128();return BigInt(e<<BigInt(128)|t)}deserializeUleb128AsU32(){let t=BigInt(0),e=0;for(;t<vn;){let r=this.deserializeU8();if(t|=BigInt(r&127)<<BigInt(e),!(r&128))break;e+=7}if(t>vn)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(t)}deserialize(t){return t.deserialize(this)}deserializeVector(t){let e=this.deserializeUleb128AsU32(),r=new Array;for(let o=0;o<e;o+=1)r.push(this.deserialize(t));return r}};var Wn=class n extends ae{constructor(e){super();this.value=Be.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,r){let o=e.deserializeFixedBytes(r);return new n(o)}};var Yo=class n extends ae{constructor(e){super();this.value=new Wn(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,r){let o=Wn.deserialize(e,r);return new n(o.value)}};var Xe=class n extends ae{constructor(e){super();Js(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}static deserialize(e){return new n(e.deserializeBool())}},lt=class n extends ae{constructor(e){super();Cn(e,0,Ys),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new n(e.deserializeU8())}},Mt=class n extends ae{constructor(e){super();Cn(e,0,Zs),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new n(e.deserializeU16())}},Gt=class n extends ae{constructor(e){super();Cn(e,0,vn),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new n(e.deserializeU32())}},ft=class n extends ae{constructor(e){super();Cn(e,BigInt(0),Cr),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new n(e.deserializeU64())}},Lt=class n extends ae{constructor(e){super();Cn(e,BigInt(0),Wo),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new n(e.deserializeU128())}},qt=class n extends ae{constructor(e){super();Cn(e,BigInt(0),Xs),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new n(e.deserializeU256())}};var Le=class n extends ae{constructor(e){super();this.values=e}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){if(!(this.values[0]instanceof lt)&&this.values[0]!==void 0)throw new Error("Script function arguments only accept u8 vectors");e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let r;if(Array.isArray(e)&&typeof e[0]=="number")r=e;else if(typeof e=="string"){let o=Be.fromHexInput(e);r=Array.from(o.toUint8Array())}else if(e instanceof Uint8Array)r=Array.from(e);else throw new Error("Invalid input type");return new n(r.map(o=>new lt(o)))}static U16(e){return new n(e.map(r=>new Mt(r)))}static U32(e){return new n(e.map(r=>new Gt(r)))}static U64(e){return new n(e.map(r=>new ft(r)))}static U128(e){return new n(e.map(r=>new Lt(r)))}static U256(e){return new n(e.map(r=>new qt(r)))}static Bool(e){return new n(e.map(r=>new Xe(r)))}static MoveString(e){return new n(e.map(r=>new yt(r)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,r){let o=e.deserializeUleb128AsU32(),s=new Array;for(let i=0;i<o;i+=1)s.push(r.deserialize(e));return new n(s)}},yt=class n extends ae{constructor(e){super();this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){let r=this.bcsToBytes().slice(1);Le.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},Bn=class n extends ae{constructor(e){super();typeof e<"u"&&e!==null?this.vec=new Le([e]):this.vec=new Le([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new n(e!=null?new lt(e):void 0)}static U16(e){return new n(e!=null?new Mt(e):void 0)}static U32(e){return new n(e!=null?new Gt(e):void 0)}static U64(e){return new n(e!=null?new ft(e):void 0)}static U128(e){return new n(e!=null?new Lt(e):void 0)}static U256(e){return new n(e!=null?new qt(e):void 0)}static Bool(e){return new n(e!=null?new Xe(e):void 0)}static MoveString(e){return new n(e!=null?new yt(e):void 0)}static deserialize(e,r){let o=Le.deserialize(e,r);return new n(o.values[0])}};var Pt=class extends ae{},Br=class extends ae{},tn=class extends ae{};var si=class extends $n{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,ei(t);let r=Xt(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),s.fill(0)}update(t){return In(this),this.iHash.update(t),this}digestInto(t){In(this),en(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:e,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},pn=(n,t,e)=>new si(n,t).update(e).digest();pn.create=(n,t)=>new si(n,t);function Kg(n,t,e,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(t,e,r);let o=BigInt(32),s=BigInt(4294967295),i=Number(e>>o&s),c=Number(e&s),u=r?4:0,d=r?0:4;n.setUint32(t+u,i,r),n.setUint32(t+d,c,r)}var Qn=class extends $n{constructor(t,e,r,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=ln(this.buffer)}update(t){In(this);let{view:e,buffer:r,blockLen:o}=this;t=Xt(t);let s=t.length;for(let i=0;i<s;){let c=Math.min(o-this.pos,s-i);if(c===o){let u=ln(t);for(;o<=s-i;i+=o)this.process(u,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){In(this),ti(t,this),this.finished=!0;let{buffer:e,view:r,blockLen:o,isLE:s}=this,{pos:i}=this;e[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(r,0),i=0);for(let g=i;g<o;g++)e[g]=0;Kg(r,o-8,BigInt(this.length*8),s),this.process(r,0);let c=ln(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let d=u/4,h=this.get();if(d>h.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g<d;g++)c.setUint32(4*g,h[g],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:r,length:o,finished:s,destroyed:i,pos:c}=this;return t.length=o,t.pos=c,t.finished=s,t.destroyed=i,o%e&&t.buffer.set(r),t}};var[Fg,Hg]=Ae.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))),Yn=new Uint32Array(80),Zn=new Uint32Array(80),nc=class extends Qn{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:e,Bh:r,Bl:o,Ch:s,Cl:i,Dh:c,Dl:u,Eh:d,El:h,Fh:g,Fl:T,Gh:S,Gl:b,Hh:y,Hl:w}=this;return[t,e,r,o,s,i,c,u,d,h,g,T,S,b,y,w]}set(t,e,r,o,s,i,c,u,d,h,g,T,S,b,y,w){this.Ah=t|0,this.Al=e|0,this.Bh=r|0,this.Bl=o|0,this.Ch=s|0,this.Cl=i|0,this.Dh=c|0,this.Dl=u|0,this.Eh=d|0,this.El=h|0,this.Fh=g|0,this.Fl=T|0,this.Gh=S|0,this.Gl=b|0,this.Hh=y|0,this.Hl=w|0}process(t,e){for(let P=0;P<16;P++,e+=4)Yn[P]=t.getUint32(e),Zn[P]=t.getUint32(e+=4);for(let P=16;P<80;P++){let $=Yn[P-15]|0,M=Zn[P-15]|0,z=Ae.rotrSH($,M,1)^Ae.rotrSH($,M,8)^Ae.shrSH($,M,7),L=Ae.rotrSL($,M,1)^Ae.rotrSL($,M,8)^Ae.shrSL($,M,7),K=Yn[P-2]|0,we=Zn[P-2]|0,te=Ae.rotrSH(K,we,19)^Ae.rotrBH(K,we,61)^Ae.shrSH(K,we,6),Q=Ae.rotrSL(K,we,19)^Ae.rotrBL(K,we,61)^Ae.shrSL(K,we,6),ve=Ae.add4L(L,Q,Zn[P-7],Zn[P-16]),Ce=Ae.add4H(ve,z,te,Yn[P-7],Yn[P-16]);Yn[P]=Ce|0,Zn[P]=ve|0}let{Ah:r,Al:o,Bh:s,Bl:i,Ch:c,Cl:u,Dh:d,Dl:h,Eh:g,El:T,Fh:S,Fl:b,Gh:y,Gl:w,Hh:v,Hl:k}=this;for(let P=0;P<80;P++){let $=Ae.rotrSH(g,T,14)^Ae.rotrSH(g,T,18)^Ae.rotrBH(g,T,41),M=Ae.rotrSL(g,T,14)^Ae.rotrSL(g,T,18)^Ae.rotrBL(g,T,41),z=g&S^~g&y,L=T&b^~T&w,K=Ae.add5L(k,M,L,Hg[P],Zn[P]),we=Ae.add5H(K,v,$,z,Fg[P],Yn[P]),te=K|0,Q=Ae.rotrSH(r,o,28)^Ae.rotrBH(r,o,34)^Ae.rotrBH(r,o,39),ve=Ae.rotrSL(r,o,28)^Ae.rotrBL(r,o,34)^Ae.rotrBL(r,o,39),Ce=r&s^r&c^s&c,Ve=o&i^o&u^i&u;v=y|0,k=w|0,y=S|0,w=b|0,S=g|0,b=T|0,{h:g,l:T}=Ae.add(d|0,h|0,we|0,te|0),d=c|0,h=u|0,c=s|0,u=i|0,s=r|0,i=o|0;let _=Ae.add3L(te,ve,Ve);r=Ae.add3H(_,we,Q,Ce),o=_|0}({h:r,l:o}=Ae.add(this.Ah|0,this.Al|0,r|0,o|0)),{h:s,l:i}=Ae.add(this.Bh|0,this.Bl|0,s|0,i|0),{h:c,l:u}=Ae.add(this.Ch|0,this.Cl|0,c|0,u|0),{h:d,l:h}=Ae.add(this.Dh|0,this.Dl|0,d|0,h|0),{h:g,l:T}=Ae.add(this.Eh|0,this.El|0,g|0,T|0),{h:S,l:b}=Ae.add(this.Fh|0,this.Fl|0,S|0,b|0),{h:y,l:w}=Ae.add(this.Gh|0,this.Gl|0,y|0,w|0),{h:v,l:k}=Ae.add(this.Hh|0,this.Hl|0,v|0,k|0),this.set(r,o,s,i,c,u,d,h,g,T,S,b,y,w,v,k)}roundClean(){Yn.fill(0),Zn.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var Pr=Vn(()=>new nc);function $g(n,t,e,r){ei(n);let o=cf({dkLen:32,asyncTick:10},r),{c:s,dkLen:i,asyncTick:c}=o;if(Un(s),Un(i),Un(c),s<1)throw new Error("PBKDF2: iterations (c) should be >= 1");let u=Xt(t),d=Xt(e),h=new Uint8Array(i),g=pn.create(n,u),T=g._cloneInto().update(d);return{c:s,dkLen:i,asyncTick:c,DK:h,PRF:g,PRFSalt:T}}function Vg(n,t,e,r,o){return n.destroy(),t.destroy(),r&&r.destroy(),o.fill(0),e}function _f(n,t,e,r){let{c:o,dkLen:s,DK:i,PRF:c,PRFSalt:u}=$g(n,t,e,r),d,h=new Uint8Array(4),g=ln(h),T=new Uint8Array(c.outputLen);for(let S=1,b=0;b<s;S++,b+=c.outputLen){let y=i.subarray(b,b+c.outputLen);g.setInt32(0,S,!1),(d=u._cloneInto(d)).update(h).digestInto(T),y.set(T.subarray(0,y.length));for(let w=1;w<o;w++){c._cloneInto(d).update(T).digestInto(T);for(let v=0;v<y.length;v++)y[v]^=T[v]}}return Vg(c,u,i,d,T)}var jg=(n,t,e)=>n&t^~n&e,Wg=(n,t,e)=>n&t^n&e^t&e,Qg=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Xn=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Jn=new Uint32Array(64),rc=class extends Qn{constructor(){super(64,32,8,!1),this.A=Xn[0]|0,this.B=Xn[1]|0,this.C=Xn[2]|0,this.D=Xn[3]|0,this.E=Xn[4]|0,this.F=Xn[5]|0,this.G=Xn[6]|0,this.H=Xn[7]|0}get(){let{A:t,B:e,C:r,D:o,E:s,F:i,G:c,H:u}=this;return[t,e,r,o,s,i,c,u]}set(t,e,r,o,s,i,c,u){this.A=t|0,this.B=e|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=u|0}process(t,e){for(let g=0;g<16;g++,e+=4)Jn[g]=t.getUint32(e,!1);for(let g=16;g<64;g++){let T=Jn[g-15],S=Jn[g-2],b=Zt(T,7)^Zt(T,18)^T>>>3,y=Zt(S,17)^Zt(S,19)^S>>>10;Jn[g]=y+Jn[g-7]+b+Jn[g-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:u,G:d,H:h}=this;for(let g=0;g<64;g++){let T=Zt(c,6)^Zt(c,11)^Zt(c,25),S=h+T+jg(c,u,d)+Qg[g]+Jn[g]|0,y=(Zt(r,2)^Zt(r,13)^Zt(r,22))+Wg(r,o,s)|0;h=d,d=u,u=c,c=i+S|0,i=s,s=o,o=r,r=S+y|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,u=u+this.F|0,d=d+this.G|0,h=h+this.H|0,this.set(r,o,s,i,c,u,d,h)}roundClean(){Jn.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Zo=Vn(()=>new rc);function Ef(n){if(typeof n!="string")throw new TypeError(`Invalid mnemonic type: ${typeof n}`);return n.normalize("NFKD")}function Yg(n){let t=Ef(n),e=t.split(" ");if(![12,15,18,21,24].includes(e.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:e}}var Zg=n=>Ef(`mnemonic${n}`);function Sf(n,t=""){return _f(Pr,Yg(n).nfkd,Zg(t),{c:2048,dkLen:64})}var vf=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,Cf=/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,Uf=(t=>(t.ED25519="ed25519 seed",t))(Uf||{}),oc=2147483648;function sc(n){return Cf.test(n)}function ic(n){return vf.test(n)}var ii=(n,t)=>{let e=pn.create(Pr,n).update(t).digest();return{key:e.slice(0,32),chainCode:e.slice(32)}},ac=({key:n,chainCode:t},e)=>{let r=new ArrayBuffer(4);new DataView(r).setUint32(0,e);let o=new Uint8Array(r),s=new Uint8Array([0]),i=new Uint8Array([...s,...n,...o]);return ii(t,i)},Jg=n=>n.replace("'",""),cc=n=>n.split("/").slice(1).map(Jg),Xo=n=>{let t=n.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return Sf(t)};var er=class er extends Pt{constructor(e){super();let r=Be.fromHexInput(e);if(r.toUint8Array().length!==er.LENGTH)throw new Error(`PublicKey length should be ${er.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:r,signature:o}=e,s=Be.fromHexInput(r).toUint8Array(),i=o.toUint8Array();return Jo.default.sign.detached.verify(s,i,this.key.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new er(r)}static load(e){let r=e.deserializeBytes();return new er(r)}static isPublicKey(e){return e instanceof er}};er.LENGTH=32;var qe=er,Tt=class Tt extends Br{constructor(e){super();let r=Be.fromHexInput(e);if(r.toUint8Array().length!==Tt.LENGTH)throw new Error(`PrivateKey length should be ${Tt.LENGTH}`);this.signingKeyPair=Jo.default.sign.keyPair.fromSeed(r.toUint8Array().slice(0,Tt.LENGTH))}toUint8Array(){return this.signingKeyPair.secretKey.slice(0,Tt.LENGTH)}toString(){return Be.fromHexInput(this.toUint8Array()).toString()}sign(e){let r=Be.fromHexInput(e),o=Jo.default.sign.detached(r.toUint8Array(),this.signingKeyPair.secretKey);return new Je(o)}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Tt(r)}static generate(){let e=Jo.default.sign.keyPair();return new Tt(e.secretKey.slice(0,Tt.LENGTH))}publicKey(){let e=this.signingKeyPair.publicKey;return new qe(e)}static fromDerivationPath(e,r){if(!ic(e))throw new Error(`Invalid derivation path ${e}`);return Tt.fromDerivationPathInner(e,Xo(r))}static fromDerivationPathInner(e,r,o=oc){let{key:s,chainCode:i}=ii(Tt.SLIP_0010_SEED,r),c=cc(e).map(d=>parseInt(d,10)),{key:u}=c.reduce((d,h)=>ac(d,h+o),{key:s,chainCode:i});return new Tt(u)}static isPrivateKey(e){return e instanceof Tt}};Tt.LENGTH=32,Tt.SLIP_0010_SEED="ed25519 seed";var Pn=Tt,tr=class tr extends tn{constructor(e){super();let r=Be.fromHexInput(e);if(r.toUint8Array().length!==tr.LENGTH)throw new Error(`Signature length should be ${tr.LENGTH}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new tr(r)}static load(e){let r=e.deserializeBytes();return new tr(r)}static isSignature(e){return e instanceof tr}};tr.LENGTH=64;var Je=tr;var Kt=class Kt extends Pt{constructor(e){super();let{publicKeys:r,threshold:o}=e;if(r.length>Kt.MAX_KEYS||r.length<Kt.MIN_KEYS)throw new Error(`Must have between ${Kt.MIN_KEYS} and ${Kt.MAX_KEYS} public keys, inclusive`);if(o<Kt.MIN_THRESHOLD||o>r.length)throw new Error(`Threshold must be between ${Kt.MIN_THRESHOLD} and ${r.length}, inclusive`);this.publicKeys=r,this.threshold=o}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*qe.LENGTH+1);return this.publicKeys.forEach((r,o)=>{e.set(r.toUint8Array(),o*qe.LENGTH)}),e[this.publicKeys.length*qe.LENGTH]=this.threshold,e}toString(){return Be.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("TODO - Method not implemented.")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),o=r[r.length-1],s=[];for(let i=0;i<r.length-1;i+=qe.LENGTH){let c=i;s.push(new qe(r.subarray(c,c+qe.LENGTH)))}return new Kt({publicKeys:s,threshold:o})}};Kt.MAX_KEYS=32,Kt.MIN_KEYS=2,Kt.MIN_THRESHOLD=1;var nn=Kt,Ft=class Ft extends tn{constructor(e){super();let{signatures:r,bitmap:o}=e;if(o.length!==Ft.BITMAP_LEN)throw new Error(`"bitmap" length should be ${Ft.BITMAP_LEN}`);if(r.length>Ft.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${Ft.MAX_SIGNATURES_SUPPORTED}`);this.signatures=r,this.bitmap=o}toUint8Array(){let e=new Uint8Array(this.signatures.length*Je.LENGTH+Ft.BITMAP_LEN);return this.signatures.forEach((r,o)=>{e.set(r.toUint8Array(),o*Je.LENGTH)}),e.set(this.bitmap,this.signatures.length*Je.LENGTH),e}toString(){return Be.fromHexInput(this.toUint8Array()).toString()}static createBitmap(e){let{bits:r}=e,o=128,s=new Uint8Array([0,0,0,0]),i=new Set;return r.forEach(c=>{if(c>=Ft.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${Ft.MAX_SIGNATURES_SUPPORTED-1}.`);if(i.has(c))throw new Error("Duplicate bits detected.");i.add(c);let u=Math.floor(c/8),d=s[u];d|=o>>c%8,s[u]=d}),s}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),o=r.subarray(r.length-4),s=[];for(let i=0;i<r.length-o.length;i+=Je.LENGTH){let c=i;s.push(new Je(r.subarray(c,c+Je.LENGTH)))}return new Ft({signatures:s,bitmap:o})}};Ft.MAX_SIGNATURES_SUPPORTED=32,Ft.BITMAP_LEN=4;var Rr=Ft;function If(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function uc(n,...t){if(!(n instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(n.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${n.length}`)}function Bf(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");If(n.outputLen),If(n.blockLen)}function po(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function Pf(n,t){uc(n);let e=t.outputLen;if(n.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var ai=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var Rf=n=>n instanceof Uint8Array;var ci=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),rn=(n,t)=>n<<32-t|n>>>t,em=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!em)throw new Error("Non little-endian hardware is not supported");function tm(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function es(n){if(typeof n=="string"&&(n=tm(n)),!Rf(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}function Of(...n){let t=new Uint8Array(n.reduce((r,o)=>r+o.length,0)),e=0;return n.forEach(r=>{if(!Rf(r))throw new Error("Uint8Array expected");t.set(r,e),e+=r.length}),t}var go=class{clone(){return this._cloneInto()}},Ex={}.toString;function Nf(n){let t=r=>n().update(es(r)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}function kf(n=32){if(ai&&typeof ai.getRandomValues=="function")return ai.getRandomValues(new Uint8Array(n));throw new Error("crypto.getRandomValues must be defined")}function nm(n,t,e,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(t,e,r);let o=BigInt(32),s=BigInt(4294967295),i=Number(e>>o&s),c=Number(e&s),u=r?4:0,d=r?0:4;n.setUint32(t+u,i,r),n.setUint32(t+d,c,r)}var ui=class extends go{constructor(t,e,r,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=ci(this.buffer)}update(t){po(this);let{view:e,buffer:r,blockLen:o}=this;t=es(t);let s=t.length;for(let i=0;i<s;){let c=Math.min(o-this.pos,s-i);if(c===o){let u=ci(t);for(;o<=s-i;i+=o)this.process(u,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){po(this),Pf(t,this),this.finished=!0;let{buffer:e,view:r,blockLen:o,isLE:s}=this,{pos:i}=this;e[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(r,0),i=0);for(let g=i;g<o;g++)e[g]=0;nm(r,o-8,BigInt(this.length*8),s),this.process(r,0);let c=ci(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let d=u/4,h=this.get();if(d>h.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g<d;g++)c.setUint32(4*g,h[g],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:r,length:o,finished:s,destroyed:i,pos:c}=this;return t.length=o,t.pos=c,t.finished=s,t.destroyed=i,o%e&&t.buffer.set(r),t}};var rm=(n,t,e)=>n&t^~n&e,om=(n,t,e)=>n&t^n&e^t&e,sm=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),nr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),rr=new Uint32Array(64),fc=class extends ui{constructor(){super(64,32,8,!1),this.A=nr[0]|0,this.B=nr[1]|0,this.C=nr[2]|0,this.D=nr[3]|0,this.E=nr[4]|0,this.F=nr[5]|0,this.G=nr[6]|0,this.H=nr[7]|0}get(){let{A:t,B:e,C:r,D:o,E:s,F:i,G:c,H:u}=this;return[t,e,r,o,s,i,c,u]}set(t,e,r,o,s,i,c,u){this.A=t|0,this.B=e|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=u|0}process(t,e){for(let g=0;g<16;g++,e+=4)rr[g]=t.getUint32(e,!1);for(let g=16;g<64;g++){let T=rr[g-15],S=rr[g-2],b=rn(T,7)^rn(T,18)^T>>>3,y=rn(S,17)^rn(S,19)^S>>>10;rr[g]=y+rr[g-7]+b+rr[g-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:u,G:d,H:h}=this;for(let g=0;g<64;g++){let T=rn(c,6)^rn(c,11)^rn(c,25),S=h+T+rm(c,u,d)+sm[g]+rr[g]|0,y=(rn(r,2)^rn(r,13)^rn(r,22))+om(r,o,s)|0;h=d,d=u,u=c,c=i+S|0,i=s,s=o,o=r,r=S+y|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,u=u+this.F|0,d=d+this.G|0,h=h+this.H|0,this.set(r,o,s,i,c,u,d,h)}roundClean(){rr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var zf=Nf(()=>new fc);var gc={};Ks(gc,{bitGet:()=>lm,bitLen:()=>dm,bitMask:()=>ts,bitSet:()=>pm,bytesToHex:()=>Or,bytesToNumberBE:()=>Rn,bytesToNumberLE:()=>li,concatBytes:()=>mo,createHmacDrbg:()=>pc,ensureBytes:()=>Rt,equalBytes:()=>um,hexToBytes:()=>Nr,hexToNumber:()=>lc,numberToBytesBE:()=>or,numberToBytesLE:()=>pi,numberToHexUnpadded:()=>Gf,numberToVarBytesBE:()=>cm,utf8ToBytes:()=>fm,validateObject:()=>sr});var Mf=BigInt(0),fi=BigInt(1),im=BigInt(2),di=n=>n instanceof Uint8Array,am=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function Or(n){if(!di(n))throw new Error("Uint8Array expected");let t="";for(let e=0;e<n.length;e++)t+=am[n[e]];return t}function Gf(n){let t=n.toString(16);return t.length&1?`0${t}`:t}function lc(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return BigInt(n===""?"0":`0x${n}`)}function Nr(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);let t=n.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let e=new Uint8Array(t/2);for(let r=0;r<e.length;r++){let o=r*2,s=n.slice(o,o+2),i=Number.parseInt(s,16);if(Number.isNaN(i)||i<0)throw new Error("Invalid byte sequence");e[r]=i}return e}function Rn(n){return lc(Or(n))}function li(n){if(!di(n))throw new Error("Uint8Array expected");return lc(Or(Uint8Array.from(n).reverse()))}function or(n,t){return Nr(n.toString(16).padStart(t*2,"0"))}function pi(n,t){return or(n,t).reverse()}function cm(n){return Nr(Gf(n))}function Rt(n,t,e){let r;if(typeof t=="string")try{r=Nr(t)}catch(s){throw new Error(`${n} must be valid hex string, got "${t}". Cause: ${s}`)}else if(di(t))r=Uint8Array.from(t);else throw new Error(`${n} must be hex string or Uint8Array`);let o=r.length;if(typeof e=="number"&&o!==e)throw new Error(`${n} expected ${e} bytes, got ${o}`);return r}function mo(...n){let t=new Uint8Array(n.reduce((r,o)=>r+o.length,0)),e=0;return n.forEach(r=>{if(!di(r))throw new Error("Uint8Array expected");t.set(r,e),e+=r.length}),t}function um(n,t){if(n.length!==t.length)return!1;for(let e=0;e<n.length;e++)if(n[e]!==t[e])return!1;return!0}function fm(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function dm(n){let t;for(t=0;n>Mf;n>>=fi,t+=1);return t}function lm(n,t){return n>>BigInt(t)&fi}var pm=(n,t,e)=>n|(e?fi:Mf)<<BigInt(t),ts=n=>(im<<BigInt(n-1))-fi,dc=n=>new Uint8Array(n),Df=n=>Uint8Array.from(n);function pc(n,t,e){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let r=dc(n),o=dc(n),s=0,i=()=>{r.fill(1),o.fill(0),s=0},c=(...g)=>e(o,r,...g),u=(g=dc())=>{o=c(Df([0]),g),r=c(),g.length!==0&&(o=c(Df([1]),g),r=c())},d=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let g=0,T=[];for(;g<t;){r=c();let S=r.slice();T.push(S),g+=r.length}return mo(...T)};return(g,T)=>{i(),u(g);let S;for(;!(S=T(d()));)u();return i(),S}}var gm={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||n instanceof Uint8Array,isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,t)=>t.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function sr(n,t,e={}){let r=(o,s,i)=>{let c=gm[s];if(typeof c!="function")throw new Error(`Invalid validator "${s}", expected function`);let u=n[o];if(!(i&&u===void 0)&&!c(u,n))throw new Error(`Invalid param ${String(o)}=${u} (${typeof u}), expected ${s}`)};for(let[o,s]of Object.entries(t))r(o,s,!1);for(let[o,s]of Object.entries(e))r(o,s,!0);return n}var ct=BigInt(0),et=BigInt(1),kr=BigInt(2),mm=BigInt(3),mc=BigInt(4),Lf=BigInt(5),qf=BigInt(8),hm=BigInt(9),ym=BigInt(16);function At(n,t){let e=n%t;return e>=ct?e:t+e}function Am(n,t,e){if(e<=ct||t<ct)throw new Error("Expected power/modulo > 0");if(e===et)return ct;let r=et;for(;t>ct;)t&et&&(r=r*n%e),n=n*n%e,t>>=et;return r}function Ot(n,t,e){let r=n;for(;t-- >ct;)r*=r,r%=e;return r}function gi(n,t){if(n===ct||t<=ct)throw new Error(`invert: expected positive integers, got n=${n} mod=${t}`);let e=At(n,t),r=t,o=ct,s=et,i=et,c=ct;for(;e!==ct;){let d=r/e,h=r%e,g=o-i*d,T=s-c*d;r=e,e=h,o=i,s=c,i=g,c=T}if(r!==et)throw new Error("invert: does not exist");return At(o,t)}function xm(n){let t=(n-et)/kr,e,r,o;for(e=n-et,r=0;e%kr===ct;e/=kr,r++);for(o=kr;o<n&&Am(o,t,n)!==n-et;o++);if(r===1){let i=(n+et)/mc;return function(u,d){let h=u.pow(d,i);if(!u.eql(u.sqr(h),d))throw new Error("Cannot find square root");return h}}let s=(e+et)/kr;return function(c,u){if(c.pow(u,t)===c.neg(c.ONE))throw new Error("Cannot find square root");let d=r,h=c.pow(c.mul(c.ONE,o),e),g=c.pow(u,s),T=c.pow(u,e);for(;!c.eql(T,c.ONE);){if(c.eql(T,c.ZERO))return c.ZERO;let S=1;for(let y=c.sqr(T);S<d&&!c.eql(y,c.ONE);S++)y=c.sqr(y);let b=c.pow(h,et<<BigInt(d-S-1));h=c.sqr(b),g=c.mul(g,b),T=c.mul(T,h),d=S}return g}}function bm(n){if(n%mc===mm){let t=(n+et)/mc;return function(r,o){let s=r.pow(o,t);if(!r.eql(r.sqr(s),o))throw new Error("Cannot find square root");return s}}if(n%qf===Lf){let t=(n-Lf)/qf;return function(r,o){let s=r.mul(o,kr),i=r.pow(s,t),c=r.mul(o,i),u=r.mul(r.mul(c,kr),i),d=r.mul(c,r.sub(u,r.ONE));if(!r.eql(r.sqr(d),o))throw new Error("Cannot find square root");return d}}return n%ym,xm(n)}var wm=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function hc(n){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=wm.reduce((r,o)=>(r[o]="function",r),t);return sr(n,e)}function Tm(n,t,e){if(e<ct)throw new Error("Expected power > 0");if(e===ct)return n.ONE;if(e===et)return t;let r=n.ONE,o=t;for(;e>ct;)e&et&&(r=n.mul(r,o)),o=n.sqr(o),e>>=et;return r}function _m(n,t){let e=new Array(t.length),r=t.reduce((s,i,c)=>n.is0(i)?s:(e[c]=s,n.mul(s,i)),n.ONE),o=n.inv(r);return t.reduceRight((s,i,c)=>n.is0(i)?s:(e[c]=n.mul(s,e[c]),n.mul(s,i)),o),e}function yc(n,t){let e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}function Kf(n,t,e=!1,r={}){if(n<=ct)throw new Error(`Expected Field ORDER > 0, got ${n}`);let{nBitLength:o,nByteLength:s}=yc(n,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let i=bm(n),c=Object.freeze({ORDER:n,BITS:o,BYTES:s,MASK:ts(o),ZERO:ct,ONE:et,create:u=>At(u,n),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return ct<=u&&u<n},is0:u=>u===ct,isOdd:u=>(u&et)===et,neg:u=>At(-u,n),eql:(u,d)=>u===d,sqr:u=>At(u*u,n),add:(u,d)=>At(u+d,n),sub:(u,d)=>At(u-d,n),mul:(u,d)=>At(u*d,n),pow:(u,d)=>Tm(c,u,d),div:(u,d)=>At(u*gi(d,n),n),sqrN:u=>u*u,addN:(u,d)=>u+d,subN:(u,d)=>u-d,mulN:(u,d)=>u*d,inv:u=>gi(u,n),sqrt:r.sqrt||(u=>i(c,u)),invertBatch:u=>_m(c,u),cmov:(u,d,h)=>h?d:u,toBytes:u=>e?pi(u,s):or(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return e?li(u):Rn(u)}});return Object.freeze(c)}function Ff(n){if(typeof n!="bigint")throw new Error("field order must be bigint");let t=n.toString(2).length;return Math.ceil(t/8)}function Ac(n){let t=Ff(n);return t+Math.ceil(t/2)}function Hf(n,t,e=!1){let r=n.length,o=Ff(t),s=Ac(t);if(r<16||r<s||r>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${r}`);let i=e?Rn(n):li(n),c=At(i,t-et)+et;return e?pi(c,o):or(c,o)}var Sm=BigInt(0),xc=BigInt(1);function $f(n,t){let e=(o,s)=>{let i=s.negate();return o?i:s},r=o=>{let s=Math.ceil(t/o)+1,i=2**(o-1);return{windows:s,windowSize:i}};return{constTimeNegate:e,unsafeLadder(o,s){let i=n.ZERO,c=o;for(;s>Sm;)s&xc&&(i=i.add(c)),c=c.double(),s>>=xc;return i},precomputeWindow(o,s){let{windows:i,windowSize:c}=r(s),u=[],d=o,h=d;for(let g=0;g<i;g++){h=d,u.push(h);for(let T=1;T<c;T++)h=h.add(d),u.push(h);d=h.double()}return u},wNAF(o,s,i){let{windows:c,windowSize:u}=r(o),d=n.ZERO,h=n.BASE,g=BigInt(2**o-1),T=2**o,S=BigInt(o);for(let b=0;b<c;b++){let y=b*u,w=Number(i&g);i>>=S,w>u&&(w-=T,i+=xc);let v=y,k=y+Math.abs(w)-1,P=b%2!==0,$=w<0;w===0?h=h.add(e(P,s[v])):d=d.add(e($,s[k]))}return{p:d,f:h}},wNAFCached(o,s,i,c){let u=o._WINDOW_SIZE||1,d=s.get(o);return d||(d=this.precomputeWindow(o,u),u!==1&&s.set(o,c(d))),this.wNAF(u,d,i)}}}function bc(n){return hc(n.Fp),sr(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...yc(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}function vm(n){let t=bc(n);sr(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:e,Fp:r,a:o}=t;if(e){if(!r.eql(o,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof e!="object"||typeof e.beta!="bigint"||typeof e.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}var{bytesToNumberBE:Cm,hexToBytes:Um}=gc,zr={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(n){let{Err:t}=zr;if(n.length<2||n[0]!==2)throw new t("Invalid signature integer tag");let e=n[1],r=n.subarray(2,e+2);if(!e||r.length!==e)throw new t("Invalid signature integer: wrong length");if(r[0]&128)throw new t("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:Cm(r),l:n.subarray(e+2)}},toSig(n){let{Err:t}=zr,e=typeof n=="string"?Um(n):n;if(!(e instanceof Uint8Array))throw new Error("ui8a expected");let r=e.length;if(r<2||e[0]!=48)throw new t("Invalid signature tag");if(e[1]!==r-2)throw new t("Invalid signature: incorrect length");let{d:o,l:s}=zr._parseInt(e.subarray(2)),{d:i,l:c}=zr._parseInt(s);if(c.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,s:i}},hexFromSig(n){let t=d=>Number.parseInt(d[0],16)&8?"00"+d:d,e=d=>{let h=d.toString(16);return h.length&1?`0${h}`:h},r=t(e(n.s)),o=t(e(n.r)),s=r.length/2,i=o.length/2,c=e(s),u=e(i);return`30${e(i+s+4)}02${u}${o}02${c}${r}`}},On=BigInt(0),Ht=BigInt(1),Gx=BigInt(2),Vf=BigInt(3),Lx=BigInt(4);function Im(n){let t=vm(n),{Fp:e}=t,r=t.toBytes||((b,y,w)=>{let v=y.toAffine();return mo(Uint8Array.from([4]),e.toBytes(v.x),e.toBytes(v.y))}),o=t.fromBytes||(b=>{let y=b.subarray(1),w=e.fromBytes(y.subarray(0,e.BYTES)),v=e.fromBytes(y.subarray(e.BYTES,2*e.BYTES));return{x:w,y:v}});function s(b){let{a:y,b:w}=t,v=e.sqr(b),k=e.mul(v,b);return e.add(e.add(k,e.mul(b,y)),w)}if(!e.eql(e.sqr(t.Gy),s(t.Gx)))throw new Error("bad generator point: equation left != right");function i(b){return typeof b=="bigint"&&On<b&&b<t.n}function c(b){if(!i(b))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function u(b){let{allowedPrivateKeyLengths:y,nByteLength:w,wrapPrivateKey:v,n:k}=t;if(y&&typeof b!="bigint"){if(b instanceof Uint8Array&&(b=Or(b)),typeof b!="string"||!y.includes(b.length))throw new Error("Invalid key");b=b.padStart(w*2,"0")}let P;try{P=typeof b=="bigint"?b:Rn(Rt("private key",b,w))}catch{throw new Error(`private key must be ${w} bytes, hex or bigint, not ${typeof b}`)}return v&&(P=At(P,k)),c(P),P}let d=new Map;function h(b){if(!(b instanceof g))throw new Error("ProjectivePoint expected")}class g{constructor(y,w,v){if(this.px=y,this.py=w,this.pz=v,y==null||!e.isValid(y))throw new Error("x required");if(w==null||!e.isValid(w))throw new Error("y required");if(v==null||!e.isValid(v))throw new Error("z required")}static fromAffine(y){let{x:w,y:v}=y||{};if(!y||!e.isValid(w)||!e.isValid(v))throw new Error("invalid affine point");if(y instanceof g)throw new Error("projective point not allowed");let k=P=>e.eql(P,e.ZERO);return k(w)&&k(v)?g.ZERO:new g(w,v,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(y){let w=e.invertBatch(y.map(v=>v.pz));return y.map((v,k)=>v.toAffine(w[k])).map(g.fromAffine)}static fromHex(y){let w=g.fromAffine(o(Rt("pointHex",y)));return w.assertValidity(),w}static fromPrivateKey(y){return g.BASE.multiply(u(y))}_setWindowSize(y){this._WINDOW_SIZE=y,d.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!e.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:y,y:w}=this.toAffine();if(!e.isValid(y)||!e.isValid(w))throw new Error("bad point: x or y not FE");let v=e.sqr(w),k=s(y);if(!e.eql(v,k))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y}=this.toAffine();if(e.isOdd)return!e.isOdd(y);throw new Error("Field doesn't support isOdd")}equals(y){h(y);let{px:w,py:v,pz:k}=this,{px:P,py:$,pz:M}=y,z=e.eql(e.mul(w,M),e.mul(P,k)),L=e.eql(e.mul(v,M),e.mul($,k));return z&&L}negate(){return new g(this.px,e.neg(this.py),this.pz)}double(){let{a:y,b:w}=t,v=e.mul(w,Vf),{px:k,py:P,pz:$}=this,M=e.ZERO,z=e.ZERO,L=e.ZERO,K=e.mul(k,k),we=e.mul(P,P),te=e.mul($,$),Q=e.mul(k,P);return Q=e.add(Q,Q),L=e.mul(k,$),L=e.add(L,L),M=e.mul(y,L),z=e.mul(v,te),z=e.add(M,z),M=e.sub(we,z),z=e.add(we,z),z=e.mul(M,z),M=e.mul(Q,M),L=e.mul(v,L),te=e.mul(y,te),Q=e.sub(K,te),Q=e.mul(y,Q),Q=e.add(Q,L),L=e.add(K,K),K=e.add(L,K),K=e.add(K,te),K=e.mul(K,Q),z=e.add(z,K),te=e.mul(P,$),te=e.add(te,te),K=e.mul(te,Q),M=e.sub(M,K),L=e.mul(te,we),L=e.add(L,L),L=e.add(L,L),new g(M,z,L)}add(y){h(y);let{px:w,py:v,pz:k}=this,{px:P,py:$,pz:M}=y,z=e.ZERO,L=e.ZERO,K=e.ZERO,we=t.a,te=e.mul(t.b,Vf),Q=e.mul(w,P),ve=e.mul(v,$),Ce=e.mul(k,M),Ve=e.add(w,v),_=e.add(P,$);Ve=e.mul(Ve,_),_=e.add(Q,ve),Ve=e.sub(Ve,_),_=e.add(w,k);let B=e.add(P,M);return _=e.mul(_,B),B=e.add(Q,Ce),_=e.sub(_,B),B=e.add(v,k),z=e.add($,M),B=e.mul(B,z),z=e.add(ve,Ce),B=e.sub(B,z),K=e.mul(we,_),z=e.mul(te,Ce),K=e.add(z,K),z=e.sub(ve,K),K=e.add(ve,K),L=e.mul(z,K),ve=e.add(Q,Q),ve=e.add(ve,Q),Ce=e.mul(we,Ce),_=e.mul(te,_),ve=e.add(ve,Ce),Ce=e.sub(Q,Ce),Ce=e.mul(we,Ce),_=e.add(_,Ce),Q=e.mul(ve,_),L=e.add(L,Q),Q=e.mul(B,_),z=e.mul(Ve,z),z=e.sub(z,Q),Q=e.mul(Ve,ve),K=e.mul(B,K),K=e.add(K,Q),new g(z,L,K)}subtract(y){return this.add(y.negate())}is0(){return this.equals(g.ZERO)}wNAF(y){return S.wNAFCached(this,d,y,w=>{let v=e.invertBatch(w.map(k=>k.pz));return w.map((k,P)=>k.toAffine(v[P])).map(g.fromAffine)})}multiplyUnsafe(y){let w=g.ZERO;if(y===On)return w;if(c(y),y===Ht)return this;let{endo:v}=t;if(!v)return S.unsafeLadder(this,y);let{k1neg:k,k1:P,k2neg:$,k2:M}=v.splitScalar(y),z=w,L=w,K=this;for(;P>On||M>On;)P&Ht&&(z=z.add(K)),M&Ht&&(L=L.add(K)),K=K.double(),P>>=Ht,M>>=Ht;return k&&(z=z.negate()),$&&(L=L.negate()),L=new g(e.mul(L.px,v.beta),L.py,L.pz),z.add(L)}multiply(y){c(y);let w=y,v,k,{endo:P}=t;if(P){let{k1neg:$,k1:M,k2neg:z,k2:L}=P.splitScalar(w),{p:K,f:we}=this.wNAF(M),{p:te,f:Q}=this.wNAF(L);K=S.constTimeNegate($,K),te=S.constTimeNegate(z,te),te=new g(e.mul(te.px,P.beta),te.py,te.pz),v=K.add(te),k=we.add(Q)}else{let{p:$,f:M}=this.wNAF(w);v=$,k=M}return g.normalizeZ([v,k])[0]}multiplyAndAddUnsafe(y,w,v){let k=g.BASE,P=(M,z)=>z===On||z===Ht||!M.equals(k)?M.multiplyUnsafe(z):M.multiply(z),$=P(this,w).add(P(y,v));return $.is0()?void 0:$}toAffine(y){let{px:w,py:v,pz:k}=this,P=this.is0();y==null&&(y=P?e.ONE:e.inv(k));let $=e.mul(w,y),M=e.mul(v,y),z=e.mul(k,y);if(P)return{x:e.ZERO,y:e.ZERO};if(!e.eql(z,e.ONE))throw new Error("invZ was invalid");return{x:$,y:M}}isTorsionFree(){let{h:y,isTorsionFree:w}=t;if(y===Ht)return!0;if(w)return w(g,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:y,clearCofactor:w}=t;return y===Ht?this:w?w(g,this):this.multiplyUnsafe(t.h)}toRawBytes(y=!0){return this.assertValidity(),r(g,this,y)}toHex(y=!0){return Or(this.toRawBytes(y))}}g.BASE=new g(t.Gx,t.Gy,e.ONE),g.ZERO=new g(e.ZERO,e.ONE,e.ZERO);let T=t.nBitLength,S=$f(g,t.endo?Math.ceil(T/2):T);return{CURVE:t,ProjectivePoint:g,normPrivateKeyToScalar:u,weierstrassEquation:s,isWithinCurveOrder:i}}function Bm(n){let t=bc(n);return sr(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function jf(n){let t=Bm(n),{Fp:e,n:r}=t,o=e.BYTES+1,s=2*e.BYTES+1;function i(_){return On<_&&_<e.ORDER}function c(_){return At(_,r)}function u(_){return gi(_,r)}let{ProjectivePoint:d,normPrivateKeyToScalar:h,weierstrassEquation:g,isWithinCurveOrder:T}=Im({...t,toBytes(_,B,H){let ne=B.toAffine(),re=e.toBytes(ne.x),xe=mo;return H?xe(Uint8Array.from([B.hasEvenY()?2:3]),re):xe(Uint8Array.from([4]),re,e.toBytes(ne.y))},fromBytes(_){let B=_.length,H=_[0],ne=_.subarray(1);if(B===o&&(H===2||H===3)){let re=Rn(ne);if(!i(re))throw new Error("Point is not on curve");let xe=g(re),ke=e.sqrt(xe),Te=(ke&Ht)===Ht;return(H&1)===1!==Te&&(ke=e.neg(ke)),{x:re,y:ke}}else if(B===s&&H===4){let re=e.fromBytes(ne.subarray(0,e.BYTES)),xe=e.fromBytes(ne.subarray(e.BYTES,2*e.BYTES));return{x:re,y:xe}}else throw new Error(`Point of length ${B} was invalid. Expected ${o} compressed bytes or ${s} uncompressed bytes`)}}),S=_=>Or(or(_,t.nByteLength));function b(_){let B=r>>Ht;return _>B}function y(_){return b(_)?c(-_):_}let w=(_,B,H)=>Rn(_.slice(B,H));class v{constructor(B,H,ne){this.r=B,this.s=H,this.recovery=ne,this.assertValidity()}static fromCompact(B){let H=t.nByteLength;return B=Rt("compactSignature",B,H*2),new v(w(B,0,H),w(B,H,2*H))}static fromDER(B){let{r:H,s:ne}=zr.toSig(Rt("DER",B));return new v(H,ne)}assertValidity(){if(!T(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!T(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(B){return new v(this.r,this.s,B)}recoverPublicKey(B){let{r:H,s:ne,recovery:re}=this,xe=L(Rt("msgHash",B));if(re==null||![0,1,2,3].includes(re))throw new Error("recovery id invalid");let ke=re===2||re===3?H+t.n:H;if(ke>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let Te=re&1?"03":"02",De=d.fromHex(Te+S(ke)),se=u(ke),Ke=c(-xe*se),vt=c(ne*se),ot=d.BASE.multiplyAndAddUnsafe(De,Ke,vt);if(!ot)throw new Error("point at infinify");return ot.assertValidity(),ot}hasHighS(){return b(this.s)}normalizeS(){return this.hasHighS()?new v(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return Nr(this.toDERHex())}toDERHex(){return zr.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Nr(this.toCompactHex())}toCompactHex(){return S(this.r)+S(this.s)}}let k={isValidPrivateKey(_){try{return h(_),!0}catch{return!1}},normPrivateKeyToScalar:h,randomPrivateKey:()=>{let _=Ac(t.n);return Hf(t.randomBytes(_),t.n)},precompute(_=8,B=d.BASE){return B._setWindowSize(_),B.multiply(BigInt(3)),B}};function P(_,B=!0){return d.fromPrivateKey(_).toRawBytes(B)}function $(_){let B=_ instanceof Uint8Array,H=typeof _=="string",ne=(B||H)&&_.length;return B?ne===o||ne===s:H?ne===2*o||ne===2*s:_ instanceof d}function M(_,B,H=!0){if($(_))throw new Error("first arg must be private key");if(!$(B))throw new Error("second arg must be public key");return d.fromHex(B).multiply(h(_)).toRawBytes(H)}let z=t.bits2int||function(_){let B=Rn(_),H=_.length*8-t.nBitLength;return H>0?B>>BigInt(H):B},L=t.bits2int_modN||function(_){return c(z(_))},K=ts(t.nBitLength);function we(_){if(typeof _!="bigint")throw new Error("bigint expected");if(!(On<=_&&_<K))throw new Error(`bigint expected < 2^${t.nBitLength}`);return or(_,t.nByteLength)}function te(_,B,H=Q){if(["recovered","canonical"].some(st=>st in H))throw new Error("sign() legacy options not supported");let{hash:ne,randomBytes:re}=t,{lowS:xe,prehash:ke,extraEntropy:Te}=H;xe==null&&(xe=!0),_=Rt("msgHash",_),ke&&(_=Rt("prehashed msgHash",ne(_)));let De=L(_),se=h(B),Ke=[we(se),we(De)];if(Te!=null){let st=Te===!0?re(e.BYTES):Te;Ke.push(Rt("extraEntropy",st))}let vt=mo(...Ke),ot=De;function Dt(st){let pt=z(st);if(!T(pt))return;let fn=u(pt),He=d.BASE.multiply(pt).toAffine(),bt=c(He.x);if(bt===On)return;let Yt=c(fn*c(ot+bt*se));if(Yt===On)return;let xr=(He.x===bt?0:2)|Number(He.y&Ht),Hn=Yt;return xe&&b(Yt)&&(Hn=y(Yt),xr^=1),new v(bt,Hn,xr)}return{seed:vt,k2sig:Dt}}let Q={lowS:t.lowS,prehash:!1},ve={lowS:t.lowS,prehash:!1};function Ce(_,B,H=Q){let{seed:ne,k2sig:re}=te(_,B,H),xe=t;return pc(xe.hash.outputLen,xe.nByteLength,xe.hmac)(ne,re)}d.BASE._setWindowSize(8);function Ve(_,B,H,ne=ve){let re=_;if(B=Rt("msgHash",B),H=Rt("publicKey",H),"strict"in ne)throw new Error("options.strict was renamed to lowS");let{lowS:xe,prehash:ke}=ne,Te,De;try{if(typeof re=="string"||re instanceof Uint8Array)try{Te=v.fromDER(re)}catch(He){if(!(He instanceof zr.Err))throw He;Te=v.fromCompact(re)}else if(typeof re=="object"&&typeof re.r=="bigint"&&typeof re.s=="bigint"){let{r:He,s:bt}=re;Te=new v(He,bt)}else throw new Error("PARSE");De=d.fromHex(H)}catch(He){if(He.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(xe&&Te.hasHighS())return!1;ke&&(B=t.hash(B));let{r:se,s:Ke}=Te,vt=L(B),ot=u(Ke),Dt=c(vt*ot),st=c(se*ot),pt=d.BASE.multiplyAndAddUnsafe(De,Dt,st)?.toAffine();return pt?c(pt.x)===se:!1}return{CURVE:t,getPublicKey:P,getSharedSecret:M,sign:Ce,verify:Ve,ProjectivePoint:d,Signature:v,utils:k}}var mi=class extends go{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,Bf(t);let r=es(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),s.fill(0)}update(t){return po(this),this.iHash.update(t),this}digestInto(t){po(this),uc(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:e,iHash:r,finished:o,destroyed:s,blockLen:i,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=c,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},wc=(n,t,e)=>new mi(n,t).update(e).digest();wc.create=(n,t)=>new mi(n,t);function Pm(n){return{hash:n,hmac:(t,...e)=>wc(n,t,Of(...e)),randomBytes:kf}}function Wf(n,t){let e=r=>jf({...n,...Pm(r)});return Object.freeze({...e(t),create:e})}var Zf=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Qf=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Rm=BigInt(1),Tc=BigInt(2),Yf=(n,t)=>(n+t/Tc)/t;function Om(n){let t=Zf,e=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),u=BigInt(88),d=n*n*n%t,h=d*d*n%t,g=Ot(h,e,t)*h%t,T=Ot(g,e,t)*h%t,S=Ot(T,Tc,t)*d%t,b=Ot(S,o,t)*S%t,y=Ot(b,s,t)*b%t,w=Ot(y,c,t)*y%t,v=Ot(w,u,t)*w%t,k=Ot(v,c,t)*y%t,P=Ot(k,e,t)*h%t,$=Ot(P,i,t)*b%t,M=Ot($,r,t)*d%t,z=Ot(M,Tc,t);if(!_c.eql(_c.sqr(z),n))throw new Error("Cannot find square root");return z}var _c=Kf(Zf,void 0,void 0,{sqrt:Om}),ho=Wf({a:BigInt(0),b:BigInt(7),Fp:_c,n:Qf,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{let t=Qf,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Rm*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=e,i=BigInt("0x100000000000000000000000000000000"),c=Yf(s*n,t),u=Yf(-r*n,t),d=At(n-c*e-u*o,t),h=At(-c*r-u*s,t),g=d>i,T=h>i;if(g&&(d=t-d),T&&(h=t-h),d>i||h>i)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:g,k1:d,k2neg:T,k2:h}}}},zf),Xx=BigInt(0);var Jx=ho.ProjectivePoint;var Nm=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Jf=Uint8Array.from({length:16},(n,t)=>t),km=Jf.map(n=>(9*n+5)%16),Sc=[Jf],vc=[km];for(let n=0;n<4;n++)for(let t of[Sc,vc])t.push(t[n].map(e=>Nm[e]));var ed=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(n=>new Uint8Array(n)),zm=Sc.map((n,t)=>n.map(e=>ed[t][e])),Dm=vc.map((n,t)=>n.map(e=>ed[t][e])),Mm=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),Gm=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),hi=(n,t)=>n<<t|n>>>32-t;function Xf(n,t,e,r){return n===0?t^e^r:n===1?t&e|~t&r:n===2?(t|~e)^r:n===3?t&r|e&~r:t^(e|~r)}var yi=new Uint32Array(16),Ec=class extends Qn{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){let{h0:t,h1:e,h2:r,h3:o,h4:s}=this;return[t,e,r,o,s]}set(t,e,r,o,s){this.h0=t|0,this.h1=e|0,this.h2=r|0,this.h3=o|0,this.h4=s|0}process(t,e){for(let S=0;S<16;S++,e+=4)yi[S]=t.getUint32(e,!0);let r=this.h0|0,o=r,s=this.h1|0,i=s,c=this.h2|0,u=c,d=this.h3|0,h=d,g=this.h4|0,T=g;for(let S=0;S<5;S++){let b=4-S,y=Mm[S],w=Gm[S],v=Sc[S],k=vc[S],P=zm[S],$=Dm[S];for(let M=0;M<16;M++){let z=hi(r+Xf(S,s,c,d)+yi[v[M]]+y,P[M])+g|0;r=g,g=d,d=hi(c,10)|0,c=s,s=z}for(let M=0;M<16;M++){let z=hi(o+Xf(b,i,u,h)+yi[k[M]]+w,$[M])+T|0;o=T,T=h,h=hi(u,10)|0,u=i,i=z}}this.set(this.h1+c+h|0,this.h2+d+T|0,this.h3+g+o|0,this.h4+r+i|0,this.h0+s+u|0)}roundClean(){yi.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}},td=Vn(()=>new Ec);var Bc={};Ks(Bc,{bitGet:()=>Vm,bitLen:()=>$m,bitMask:()=>ns,bitSet:()=>jm,bytesToHex:()=>Dr,bytesToNumberBE:()=>kn,bytesToNumberLE:()=>xi,concatBytes:()=>yo,createHmacDrbg:()=>Ic,ensureBytes:()=>Nt,equalBytes:()=>Fm,hexToBytes:()=>Mr,hexToNumber:()=>Uc,isBytes:()=>on,numberToBytesBE:()=>ir,numberToBytesLE:()=>bi,numberToHexUnpadded:()=>sd,numberToVarBytesBE:()=>Km,utf8ToBytes:()=>Hm,validateObject:()=>ar});var od=BigInt(0),Ai=BigInt(1),Lm=BigInt(2);function on(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}var qm=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function Dr(n){if(!on(n))throw new Error("Uint8Array expected");let t="";for(let e=0;e<n.length;e++)t+=qm[n[e]];return t}function sd(n){let t=n.toString(16);return t.length&1?`0${t}`:t}function Uc(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return BigInt(n===""?"0":`0x${n}`)}var Nn={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function nd(n){if(n>=Nn._0&&n<=Nn._9)return n-Nn._0;if(n>=Nn._A&&n<=Nn._F)return n-(Nn._A-10);if(n>=Nn._a&&n<=Nn._f)return n-(Nn._a-10)}function Mr(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);let t=n.length,e=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let r=new Uint8Array(e);for(let o=0,s=0;o<e;o++,s+=2){let i=nd(n.charCodeAt(s)),c=nd(n.charCodeAt(s+1));if(i===void 0||c===void 0){let u=n[s]+n[s+1];throw new Error('hex string expected, got non-hex character "'+u+'" at index '+s)}r[o]=i*16+c}return r}function kn(n){return Uc(Dr(n))}function xi(n){if(!on(n))throw new Error("Uint8Array expected");return Uc(Dr(Uint8Array.from(n).reverse()))}function ir(n,t){return Mr(n.toString(16).padStart(t*2,"0"))}function bi(n,t){return ir(n,t).reverse()}function Km(n){return Mr(sd(n))}function Nt(n,t,e){let r;if(typeof t=="string")try{r=Mr(t)}catch(s){throw new Error(`${n} must be valid hex string, got "${t}". Cause: ${s}`)}else if(on(t))r=Uint8Array.from(t);else throw new Error(`${n} must be hex string or Uint8Array`);let o=r.length;if(typeof e=="number"&&o!==e)throw new Error(`${n} expected ${e} bytes, got ${o}`);return r}function yo(...n){let t=0;for(let o=0;o<n.length;o++){let s=n[o];if(!on(s))throw new Error("Uint8Array expected");t+=s.length}let e=new Uint8Array(t),r=0;for(let o=0;o<n.length;o++){let s=n[o];e.set(s,r),r+=s.length}return e}function Fm(n,t){if(n.length!==t.length)return!1;let e=0;for(let r=0;r<n.length;r++)e|=n[r]^t[r];return e===0}function Hm(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function $m(n){let t;for(t=0;n>od;n>>=Ai,t+=1);return t}function Vm(n,t){return n>>BigInt(t)&Ai}var jm=(n,t,e)=>n|(e?Ai:od)<<BigInt(t),ns=n=>(Lm<<BigInt(n-1))-Ai,Cc=n=>new Uint8Array(n),rd=n=>Uint8Array.from(n);function Ic(n,t,e){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let r=Cc(n),o=Cc(n),s=0,i=()=>{r.fill(1),o.fill(0),s=0},c=(...g)=>e(o,r,...g),u=(g=Cc())=>{o=c(rd([0]),g),r=c(),g.length!==0&&(o=c(rd([1]),g),r=c())},d=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let g=0,T=[];for(;g<t;){r=c();let S=r.slice();T.push(S),g+=r.length}return yo(...T)};return(g,T)=>{i(),u(g);let S;for(;!(S=T(d()));)u();return i(),S}}var Wm={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||on(n),isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,t)=>t.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function ar(n,t,e={}){let r=(o,s,i)=>{let c=Wm[s];if(typeof c!="function")throw new Error(`Invalid validator "${s}", expected function`);let u=n[o];if(!(i&&u===void 0)&&!c(u,n))throw new Error(`Invalid param ${String(o)}=${u} (${typeof u}), expected ${s}`)};for(let[o,s]of Object.entries(t))r(o,s,!1);for(let[o,s]of Object.entries(e))r(o,s,!0);return n}var ut=BigInt(0),tt=BigInt(1),Gr=BigInt(2),Qm=BigInt(3),Pc=BigInt(4),id=BigInt(5),ad=BigInt(8),Ym=BigInt(9),Zm=BigInt(16);function dt(n,t){let e=n%t;return e>=ut?e:t+e}function Xm(n,t,e){if(e<=ut||t<ut)throw new Error("Expected power/modulo > 0");if(e===tt)return ut;let r=tt;for(;t>ut;)t&tt&&(r=r*n%e),n=n*n%e,t>>=tt;return r}function kt(n,t,e){let r=n;for(;t-- >ut;)r*=r,r%=e;return r}function wi(n,t){if(n===ut||t<=ut)throw new Error(`invert: expected positive integers, got n=${n} mod=${t}`);let e=dt(n,t),r=t,o=ut,s=tt,i=tt,c=ut;for(;e!==ut;){let d=r/e,h=r%e,g=o-i*d,T=s-c*d;r=e,e=h,o=i,s=c,i=g,c=T}if(r!==tt)throw new Error("invert: does not exist");return dt(o,t)}function Jm(n){let t=(n-tt)/Gr,e,r,o;for(e=n-tt,r=0;e%Gr===ut;e/=Gr,r++);for(o=Gr;o<n&&Xm(o,t,n)!==n-tt;o++);if(r===1){let i=(n+tt)/Pc;return function(u,d){let h=u.pow(d,i);if(!u.eql(u.sqr(h),d))throw new Error("Cannot find square root");return h}}let s=(e+tt)/Gr;return function(c,u){if(c.pow(u,t)===c.neg(c.ONE))throw new Error("Cannot find square root");let d=r,h=c.pow(c.mul(c.ONE,o),e),g=c.pow(u,s),T=c.pow(u,e);for(;!c.eql(T,c.ONE);){if(c.eql(T,c.ZERO))return c.ZERO;let S=1;for(let y=c.sqr(T);S<d&&!c.eql(y,c.ONE);S++)y=c.sqr(y);let b=c.pow(h,tt<<BigInt(d-S-1));h=c.sqr(b),g=c.mul(g,b),T=c.mul(T,h),d=S}return g}}function eh(n){if(n%Pc===Qm){let t=(n+tt)/Pc;return function(r,o){let s=r.pow(o,t);if(!r.eql(r.sqr(s),o))throw new Error("Cannot find square root");return s}}if(n%ad===id){let t=(n-id)/ad;return function(r,o){let s=r.mul(o,Gr),i=r.pow(s,t),c=r.mul(o,i),u=r.mul(r.mul(c,Gr),i),d=r.mul(c,r.sub(u,r.ONE));if(!r.eql(r.sqr(d),o))throw new Error("Cannot find square root");return d}}return n%Zm,Jm(n)}var th=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Rc(n){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=th.reduce((r,o)=>(r[o]="function",r),t);return ar(n,e)}function nh(n,t,e){if(e<ut)throw new Error("Expected power > 0");if(e===ut)return n.ONE;if(e===tt)return t;let r=n.ONE,o=t;for(;e>ut;)e&tt&&(r=n.mul(r,o)),o=n.sqr(o),e>>=tt;return r}function rh(n,t){let e=new Array(t.length),r=t.reduce((s,i,c)=>n.is0(i)?s:(e[c]=s,n.mul(s,i)),n.ONE),o=n.inv(r);return t.reduceRight((s,i,c)=>n.is0(i)?s:(e[c]=n.mul(s,e[c]),n.mul(s,i)),o),e}function Oc(n,t){let e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}function cd(n,t,e=!1,r={}){if(n<=ut)throw new Error(`Expected Field ORDER > 0, got ${n}`);let{nBitLength:o,nByteLength:s}=Oc(n,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let i=eh(n),c=Object.freeze({ORDER:n,BITS:o,BYTES:s,MASK:ns(o),ZERO:ut,ONE:tt,create:u=>dt(u,n),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return ut<=u&&u<n},is0:u=>u===ut,isOdd:u=>(u&tt)===tt,neg:u=>dt(-u,n),eql:(u,d)=>u===d,sqr:u=>dt(u*u,n),add:(u,d)=>dt(u+d,n),sub:(u,d)=>dt(u-d,n),mul:(u,d)=>dt(u*d,n),pow:(u,d)=>nh(c,u,d),div:(u,d)=>dt(u*wi(d,n),n),sqrN:u=>u*u,addN:(u,d)=>u+d,subN:(u,d)=>u-d,mulN:(u,d)=>u*d,inv:u=>wi(u,n),sqrt:r.sqrt||(u=>i(c,u)),invertBatch:u=>rh(c,u),cmov:(u,d,h)=>h?d:u,toBytes:u=>e?bi(u,s):ir(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return e?xi(u):kn(u)}});return Object.freeze(c)}function ud(n){if(typeof n!="bigint")throw new Error("field order must be bigint");let t=n.toString(2).length;return Math.ceil(t/8)}function Nc(n){let t=ud(n);return t+Math.ceil(t/2)}function fd(n,t,e=!1){let r=n.length,o=ud(t),s=Nc(t);if(r<16||r<s||r>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${r}`);let i=e?kn(n):xi(n),c=dt(i,t-tt)+tt;return e?bi(c,o):ir(c,o)}var sh=BigInt(0),kc=BigInt(1);function dd(n,t){let e=(o,s)=>{let i=s.negate();return o?i:s},r=o=>{let s=Math.ceil(t/o)+1,i=2**(o-1);return{windows:s,windowSize:i}};return{constTimeNegate:e,unsafeLadder(o,s){let i=n.ZERO,c=o;for(;s>sh;)s&kc&&(i=i.add(c)),c=c.double(),s>>=kc;return i},precomputeWindow(o,s){let{windows:i,windowSize:c}=r(s),u=[],d=o,h=d;for(let g=0;g<i;g++){h=d,u.push(h);for(let T=1;T<c;T++)h=h.add(d),u.push(h);d=h.double()}return u},wNAF(o,s,i){let{windows:c,windowSize:u}=r(o),d=n.ZERO,h=n.BASE,g=BigInt(2**o-1),T=2**o,S=BigInt(o);for(let b=0;b<c;b++){let y=b*u,w=Number(i&g);i>>=S,w>u&&(w-=T,i+=kc);let v=y,k=y+Math.abs(w)-1,P=b%2!==0,$=w<0;w===0?h=h.add(e(P,s[v])):d=d.add(e($,s[k]))}return{p:d,f:h}},wNAFCached(o,s,i,c){let u=o._WINDOW_SIZE||1,d=s.get(o);return d||(d=this.precomputeWindow(o,u),u!==1&&s.set(o,c(d))),this.wNAF(u,d,i)}}}function zc(n){return Rc(n.Fp),ar(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Oc(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}function ih(n){let t=zc(n);ar(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:e,Fp:r,a:o}=t;if(e){if(!r.eql(o,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof e!="object"||typeof e.beta!="bigint"||typeof e.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}var{bytesToNumberBE:ah,hexToBytes:ch}=Bc,Lr={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(n){let{Err:t}=Lr;if(n.length<2||n[0]!==2)throw new t("Invalid signature integer tag");let e=n[1],r=n.subarray(2,e+2);if(!e||r.length!==e)throw new t("Invalid signature integer: wrong length");if(r[0]&128)throw new t("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:ah(r),l:n.subarray(e+2)}},toSig(n){let{Err:t}=Lr,e=typeof n=="string"?ch(n):n;if(!on(e))throw new Error("ui8a expected");let r=e.length;if(r<2||e[0]!=48)throw new t("Invalid signature tag");if(e[1]!==r-2)throw new t("Invalid signature: incorrect length");let{d:o,l:s}=Lr._parseInt(e.subarray(2)),{d:i,l:c}=Lr._parseInt(s);if(c.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,s:i}},hexFromSig(n){let t=d=>Number.parseInt(d[0],16)&8?"00"+d:d,e=d=>{let h=d.toString(16);return h.length&1?`0${h}`:h},r=t(e(n.s)),o=t(e(n.r)),s=r.length/2,i=o.length/2,c=e(s),u=e(i);return`30${e(i+s+4)}02${u}${o}02${c}${r}`}},zn=BigInt(0),$t=BigInt(1),db=BigInt(2),ld=BigInt(3),lb=BigInt(4);function uh(n){let t=ih(n),{Fp:e}=t,r=t.toBytes||((b,y,w)=>{let v=y.toAffine();return yo(Uint8Array.from([4]),e.toBytes(v.x),e.toBytes(v.y))}),o=t.fromBytes||(b=>{let y=b.subarray(1),w=e.fromBytes(y.subarray(0,e.BYTES)),v=e.fromBytes(y.subarray(e.BYTES,2*e.BYTES));return{x:w,y:v}});function s(b){let{a:y,b:w}=t,v=e.sqr(b),k=e.mul(v,b);return e.add(e.add(k,e.mul(b,y)),w)}if(!e.eql(e.sqr(t.Gy),s(t.Gx)))throw new Error("bad generator point: equation left != right");function i(b){return typeof b=="bigint"&&zn<b&&b<t.n}function c(b){if(!i(b))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function u(b){let{allowedPrivateKeyLengths:y,nByteLength:w,wrapPrivateKey:v,n:k}=t;if(y&&typeof b!="bigint"){if(on(b)&&(b=Dr(b)),typeof b!="string"||!y.includes(b.length))throw new Error("Invalid key");b=b.padStart(w*2,"0")}let P;try{P=typeof b=="bigint"?b:kn(Nt("private key",b,w))}catch{throw new Error(`private key must be ${w} bytes, hex or bigint, not ${typeof b}`)}return v&&(P=dt(P,k)),c(P),P}let d=new Map;function h(b){if(!(b instanceof g))throw new Error("ProjectivePoint expected")}class g{constructor(y,w,v){if(this.px=y,this.py=w,this.pz=v,y==null||!e.isValid(y))throw new Error("x required");if(w==null||!e.isValid(w))throw new Error("y required");if(v==null||!e.isValid(v))throw new Error("z required")}static fromAffine(y){let{x:w,y:v}=y||{};if(!y||!e.isValid(w)||!e.isValid(v))throw new Error("invalid affine point");if(y instanceof g)throw new Error("projective point not allowed");let k=P=>e.eql(P,e.ZERO);return k(w)&&k(v)?g.ZERO:new g(w,v,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(y){let w=e.invertBatch(y.map(v=>v.pz));return y.map((v,k)=>v.toAffine(w[k])).map(g.fromAffine)}static fromHex(y){let w=g.fromAffine(o(Nt("pointHex",y)));return w.assertValidity(),w}static fromPrivateKey(y){return g.BASE.multiply(u(y))}_setWindowSize(y){this._WINDOW_SIZE=y,d.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!e.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:y,y:w}=this.toAffine();if(!e.isValid(y)||!e.isValid(w))throw new Error("bad point: x or y not FE");let v=e.sqr(w),k=s(y);if(!e.eql(v,k))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y}=this.toAffine();if(e.isOdd)return!e.isOdd(y);throw new Error("Field doesn't support isOdd")}equals(y){h(y);let{px:w,py:v,pz:k}=this,{px:P,py:$,pz:M}=y,z=e.eql(e.mul(w,M),e.mul(P,k)),L=e.eql(e.mul(v,M),e.mul($,k));return z&&L}negate(){return new g(this.px,e.neg(this.py),this.pz)}double(){let{a:y,b:w}=t,v=e.mul(w,ld),{px:k,py:P,pz:$}=this,M=e.ZERO,z=e.ZERO,L=e.ZERO,K=e.mul(k,k),we=e.mul(P,P),te=e.mul($,$),Q=e.mul(k,P);return Q=e.add(Q,Q),L=e.mul(k,$),L=e.add(L,L),M=e.mul(y,L),z=e.mul(v,te),z=e.add(M,z),M=e.sub(we,z),z=e.add(we,z),z=e.mul(M,z),M=e.mul(Q,M),L=e.mul(v,L),te=e.mul(y,te),Q=e.sub(K,te),Q=e.mul(y,Q),Q=e.add(Q,L),L=e.add(K,K),K=e.add(L,K),K=e.add(K,te),K=e.mul(K,Q),z=e.add(z,K),te=e.mul(P,$),te=e.add(te,te),K=e.mul(te,Q),M=e.sub(M,K),L=e.mul(te,we),L=e.add(L,L),L=e.add(L,L),new g(M,z,L)}add(y){h(y);let{px:w,py:v,pz:k}=this,{px:P,py:$,pz:M}=y,z=e.ZERO,L=e.ZERO,K=e.ZERO,we=t.a,te=e.mul(t.b,ld),Q=e.mul(w,P),ve=e.mul(v,$),Ce=e.mul(k,M),Ve=e.add(w,v),_=e.add(P,$);Ve=e.mul(Ve,_),_=e.add(Q,ve),Ve=e.sub(Ve,_),_=e.add(w,k);let B=e.add(P,M);return _=e.mul(_,B),B=e.add(Q,Ce),_=e.sub(_,B),B=e.add(v,k),z=e.add($,M),B=e.mul(B,z),z=e.add(ve,Ce),B=e.sub(B,z),K=e.mul(we,_),z=e.mul(te,Ce),K=e.add(z,K),z=e.sub(ve,K),K=e.add(ve,K),L=e.mul(z,K),ve=e.add(Q,Q),ve=e.add(ve,Q),Ce=e.mul(we,Ce),_=e.mul(te,_),ve=e.add(ve,Ce),Ce=e.sub(Q,Ce),Ce=e.mul(we,Ce),_=e.add(_,Ce),Q=e.mul(ve,_),L=e.add(L,Q),Q=e.mul(B,_),z=e.mul(Ve,z),z=e.sub(z,Q),Q=e.mul(Ve,ve),K=e.mul(B,K),K=e.add(K,Q),new g(z,L,K)}subtract(y){return this.add(y.negate())}is0(){return this.equals(g.ZERO)}wNAF(y){return S.wNAFCached(this,d,y,w=>{let v=e.invertBatch(w.map(k=>k.pz));return w.map((k,P)=>k.toAffine(v[P])).map(g.fromAffine)})}multiplyUnsafe(y){let w=g.ZERO;if(y===zn)return w;if(c(y),y===$t)return this;let{endo:v}=t;if(!v)return S.unsafeLadder(this,y);let{k1neg:k,k1:P,k2neg:$,k2:M}=v.splitScalar(y),z=w,L=w,K=this;for(;P>zn||M>zn;)P&$t&&(z=z.add(K)),M&$t&&(L=L.add(K)),K=K.double(),P>>=$t,M>>=$t;return k&&(z=z.negate()),$&&(L=L.negate()),L=new g(e.mul(L.px,v.beta),L.py,L.pz),z.add(L)}multiply(y){c(y);let w=y,v,k,{endo:P}=t;if(P){let{k1neg:$,k1:M,k2neg:z,k2:L}=P.splitScalar(w),{p:K,f:we}=this.wNAF(M),{p:te,f:Q}=this.wNAF(L);K=S.constTimeNegate($,K),te=S.constTimeNegate(z,te),te=new g(e.mul(te.px,P.beta),te.py,te.pz),v=K.add(te),k=we.add(Q)}else{let{p:$,f:M}=this.wNAF(w);v=$,k=M}return g.normalizeZ([v,k])[0]}multiplyAndAddUnsafe(y,w,v){let k=g.BASE,P=(M,z)=>z===zn||z===$t||!M.equals(k)?M.multiplyUnsafe(z):M.multiply(z),$=P(this,w).add(P(y,v));return $.is0()?void 0:$}toAffine(y){let{px:w,py:v,pz:k}=this,P=this.is0();y==null&&(y=P?e.ONE:e.inv(k));let $=e.mul(w,y),M=e.mul(v,y),z=e.mul(k,y);if(P)return{x:e.ZERO,y:e.ZERO};if(!e.eql(z,e.ONE))throw new Error("invZ was invalid");return{x:$,y:M}}isTorsionFree(){let{h:y,isTorsionFree:w}=t;if(y===$t)return!0;if(w)return w(g,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:y,clearCofactor:w}=t;return y===$t?this:w?w(g,this):this.multiplyUnsafe(t.h)}toRawBytes(y=!0){return this.assertValidity(),r(g,this,y)}toHex(y=!0){return Dr(this.toRawBytes(y))}}g.BASE=new g(t.Gx,t.Gy,e.ONE),g.ZERO=new g(e.ZERO,e.ONE,e.ZERO);let T=t.nBitLength,S=dd(g,t.endo?Math.ceil(T/2):T);return{CURVE:t,ProjectivePoint:g,normPrivateKeyToScalar:u,weierstrassEquation:s,isWithinCurveOrder:i}}function fh(n){let t=zc(n);return ar(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function pd(n){let t=fh(n),{Fp:e,n:r}=t,o=e.BYTES+1,s=2*e.BYTES+1;function i(_){return zn<_&&_<e.ORDER}function c(_){return dt(_,r)}function u(_){return wi(_,r)}let{ProjectivePoint:d,normPrivateKeyToScalar:h,weierstrassEquation:g,isWithinCurveOrder:T}=uh({...t,toBytes(_,B,H){let ne=B.toAffine(),re=e.toBytes(ne.x),xe=yo;return H?xe(Uint8Array.from([B.hasEvenY()?2:3]),re):xe(Uint8Array.from([4]),re,e.toBytes(ne.y))},fromBytes(_){let B=_.length,H=_[0],ne=_.subarray(1);if(B===o&&(H===2||H===3)){let re=kn(ne);if(!i(re))throw new Error("Point is not on curve");let xe=g(re),ke=e.sqrt(xe),Te=(ke&$t)===$t;return(H&1)===1!==Te&&(ke=e.neg(ke)),{x:re,y:ke}}else if(B===s&&H===4){let re=e.fromBytes(ne.subarray(0,e.BYTES)),xe=e.fromBytes(ne.subarray(e.BYTES,2*e.BYTES));return{x:re,y:xe}}else throw new Error(`Point of length ${B} was invalid. Expected ${o} compressed bytes or ${s} uncompressed bytes`)}}),S=_=>Dr(ir(_,t.nByteLength));function b(_){let B=r>>$t;return _>B}function y(_){return b(_)?c(-_):_}let w=(_,B,H)=>kn(_.slice(B,H));class v{constructor(B,H,ne){this.r=B,this.s=H,this.recovery=ne,this.assertValidity()}static fromCompact(B){let H=t.nByteLength;return B=Nt("compactSignature",B,H*2),new v(w(B,0,H),w(B,H,2*H))}static fromDER(B){let{r:H,s:ne}=Lr.toSig(Nt("DER",B));return new v(H,ne)}assertValidity(){if(!T(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!T(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(B){return new v(this.r,this.s,B)}recoverPublicKey(B){let{r:H,s:ne,recovery:re}=this,xe=L(Nt("msgHash",B));if(re==null||![0,1,2,3].includes(re))throw new Error("recovery id invalid");let ke=re===2||re===3?H+t.n:H;if(ke>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let Te=re&1?"03":"02",De=d.fromHex(Te+S(ke)),se=u(ke),Ke=c(-xe*se),vt=c(ne*se),ot=d.BASE.multiplyAndAddUnsafe(De,Ke,vt);if(!ot)throw new Error("point at infinify");return ot.assertValidity(),ot}hasHighS(){return b(this.s)}normalizeS(){return this.hasHighS()?new v(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return Mr(this.toDERHex())}toDERHex(){return Lr.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Mr(this.toCompactHex())}toCompactHex(){return S(this.r)+S(this.s)}}let k={isValidPrivateKey(_){try{return h(_),!0}catch{return!1}},normPrivateKeyToScalar:h,randomPrivateKey:()=>{let _=Nc(t.n);return fd(t.randomBytes(_),t.n)},precompute(_=8,B=d.BASE){return B._setWindowSize(_),B.multiply(BigInt(3)),B}};function P(_,B=!0){return d.fromPrivateKey(_).toRawBytes(B)}function $(_){let B=on(_),H=typeof _=="string",ne=(B||H)&&_.length;return B?ne===o||ne===s:H?ne===2*o||ne===2*s:_ instanceof d}function M(_,B,H=!0){if($(_))throw new Error("first arg must be private key");if(!$(B))throw new Error("second arg must be public key");return d.fromHex(B).multiply(h(_)).toRawBytes(H)}let z=t.bits2int||function(_){let B=kn(_),H=_.length*8-t.nBitLength;return H>0?B>>BigInt(H):B},L=t.bits2int_modN||function(_){return c(z(_))},K=ns(t.nBitLength);function we(_){if(typeof _!="bigint")throw new Error("bigint expected");if(!(zn<=_&&_<K))throw new Error(`bigint expected < 2^${t.nBitLength}`);return ir(_,t.nByteLength)}function te(_,B,H=Q){if(["recovered","canonical"].some(st=>st in H))throw new Error("sign() legacy options not supported");let{hash:ne,randomBytes:re}=t,{lowS:xe,prehash:ke,extraEntropy:Te}=H;xe==null&&(xe=!0),_=Nt("msgHash",_),ke&&(_=Nt("prehashed msgHash",ne(_)));let De=L(_),se=h(B),Ke=[we(se),we(De)];if(Te!=null){let st=Te===!0?re(e.BYTES):Te;Ke.push(Nt("extraEntropy",st))}let vt=yo(...Ke),ot=De;function Dt(st){let pt=z(st);if(!T(pt))return;let fn=u(pt),He=d.BASE.multiply(pt).toAffine(),bt=c(He.x);if(bt===zn)return;let Yt=c(fn*c(ot+bt*se));if(Yt===zn)return;let xr=(He.x===bt?0:2)|Number(He.y&$t),Hn=Yt;return xe&&b(Yt)&&(Hn=y(Yt),xr^=1),new v(bt,Hn,xr)}return{seed:vt,k2sig:Dt}}let Q={lowS:t.lowS,prehash:!1},ve={lowS:t.lowS,prehash:!1};function Ce(_,B,H=Q){let{seed:ne,k2sig:re}=te(_,B,H),xe=t;return Ic(xe.hash.outputLen,xe.nByteLength,xe.hmac)(ne,re)}d.BASE._setWindowSize(8);function Ve(_,B,H,ne=ve){let re=_;if(B=Nt("msgHash",B),H=Nt("publicKey",H),"strict"in ne)throw new Error("options.strict was renamed to lowS");let{lowS:xe,prehash:ke}=ne,Te,De;try{if(typeof re=="string"||on(re))try{Te=v.fromDER(re)}catch(He){if(!(He instanceof Lr.Err))throw He;Te=v.fromCompact(re)}else if(typeof re=="object"&&typeof re.r=="bigint"&&typeof re.s=="bigint"){let{r:He,s:bt}=re;Te=new v(He,bt)}else throw new Error("PARSE");De=d.fromHex(H)}catch(He){if(He.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(xe&&Te.hasHighS())return!1;ke&&(B=t.hash(B));let{r:se,s:Ke}=Te,vt=L(B),ot=u(Ke),Dt=c(vt*ot),st=c(se*ot),pt=d.BASE.multiplyAndAddUnsafe(De,Dt,st)?.toAffine();return pt?c(pt.x)===se:!1}return{CURVE:t,getPublicKey:P,getSharedSecret:M,sign:Ce,verify:Ve,ProjectivePoint:d,Signature:v,utils:k}}function dh(n){return{hash:n,hmac:(t,...e)=>pn(n,t,vr(...e)),randomBytes:ff}}function gd(n,t){let e=r=>pd({...n,...dh(r)});return Object.freeze({...e(t),create:e})}var yd=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),md=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),lh=BigInt(1),Dc=BigInt(2),hd=(n,t)=>(n+t/Dc)/t;function ph(n){let t=yd,e=BigInt(3),r=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),c=BigInt(44),u=BigInt(88),d=n*n*n%t,h=d*d*n%t,g=kt(h,e,t)*h%t,T=kt(g,e,t)*h%t,S=kt(T,Dc,t)*d%t,b=kt(S,o,t)*S%t,y=kt(b,s,t)*b%t,w=kt(y,c,t)*y%t,v=kt(w,u,t)*w%t,k=kt(v,c,t)*y%t,P=kt(k,e,t)*h%t,$=kt(P,i,t)*b%t,M=kt($,r,t)*d%t,z=kt(M,Dc,t);if(!Mc.eql(Mc.sqr(z),n))throw new Error("Cannot find square root");return z}var Mc=cd(yd,void 0,void 0,{sqrt:ph}),sn=gd({a:BigInt(0),b:BigInt(7),Fp:Mc,n:md,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{let t=md,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-lh*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=e,i=BigInt("0x100000000000000000000000000000000"),c=hd(s*n,t),u=hd(-r*n,t),d=dt(n-c*e-u*o,t),h=dt(-c*r-u*s,t),g=d>i,T=h>i;if(g&&(d=t-d),T&&(h=t-h),d>i||h>i)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:g,k1:d,k2neg:T,k2:h}}}},Zo),wb=BigInt(0);var Tb=sn.ProjectivePoint;function Ti(n){if(!Number.isSafeInteger(n))throw new Error(`Wrong integer: ${n}`)}function Gc(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}function xd(...n){let t=s=>s,e=(s,i)=>c=>s(i(c)),r=n.map(s=>s.encode).reduceRight(e,t),o=n.map(s=>s.decode).reduce(e,t);return{encode:r,decode:o}}function gh(n){return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return t.map(e=>{if(e<0||e>=n.length)throw new Error(`Digit index outside alphabet: ${e} (alphabet: ${n.length})`);return n[e]})},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("alphabet.decode input should be array of strings");return t.map(e=>{if(typeof e!="string")throw new Error(`alphabet.decode: not string element=${e}`);let r=n.indexOf(e);if(r===-1)throw new Error(`Unknown letter: "${e}". Allowed: ${n}`);return r})}}}function mh(n=""){if(typeof n!="string")throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("join.encode input should be array of strings");for(let e of t)if(typeof e!="string")throw new Error(`join.encode: non-string input=${e}`);return t.join(n)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(n)}}}function Ad(n,t,e){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(e<2)throw new Error(`convertRadix: wrong to=${e}, base cannot be less than 2`);if(!Array.isArray(n))throw new Error("convertRadix: data should be array");if(!n.length)return[];let r=0,o=[],s=Array.from(n);for(s.forEach(i=>{if(i<0||i>=t)throw new Error(`Wrong integer: ${i}`)});;){let i=0,c=!0;for(let u=r;u<s.length;u++){let d=s[u],h=t*i+d;if(!Number.isSafeInteger(h)||t*i/t!==i||h-d!==t*i)throw new Error("convertRadix: carry overflow");i=h%e;let g=Math.floor(h/e);if(s[u]=g,!Number.isSafeInteger(g)||g*e+i!==h)throw new Error("convertRadix: carry overflow");if(c)g?c=!1:r=u;else continue}if(o.push(i),c)break}for(let i=0;i<n.length-1&&n[i]===0;i++)o.push(0);return o.reverse()}function hh(n){return{encode:t=>{if(!Gc(t))throw new Error("radix.encode input should be Uint8Array");return Ad(Array.from(t),2**8,n)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of numbers");return Uint8Array.from(Ad(t,n,2**8))}}}function yh(n,t){if(typeof t!="function")throw new Error("checksum fn should be function");return{encode(e){if(!Gc(e))throw new Error("checksum.encode: input should be Uint8Array");let r=t(e).slice(0,n),o=new Uint8Array(e.length+n);return o.set(e),o.set(r,e.length),o},decode(e){if(!Gc(e))throw new Error("checksum.decode: input should be Uint8Array");let r=e.slice(0,-n),o=t(r).slice(0,n),s=e.slice(-n);for(let i=0;i<n;i++)if(o[i]!==s[i])throw new Error("Invalid checksum");return r}}}var Ah=n=>xd(hh(58),gh(n),mh("")),xh=Ah("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var bd=n=>xd(yh(4,t=>n(n(t))),xh);var _i=sn.ProjectivePoint,Lc=bd(Zo);function wd(n){return BigInt(`0x${Sr(n)}`)}function bh(n){return lo(n.toString(16).padStart(64,"0"))}var wh=Wa("Bitcoin seed"),qc={private:76066276,public:76067358},Kc=2147483648,Th=n=>td(Zo(n)),_h=n=>ln(n).getUint32(0,!1),Ei=n=>{if(!Number.isSafeInteger(n)||n<0||n>2**32-1)throw new Error(`Invalid number=${n}. Should be from 0 to 2 ** 32 - 1`);let t=new Uint8Array(4);return ln(t).setUint32(0,n,!1),t},Si=class n{get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return _h(this.pubHash)}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this.privKeyBytes||null}get publicKey(){return this.pubKey||null}get privateExtendedKey(){let t=this.privateKey;if(!t)throw new Error("No private key");return Lc.encode(this.serialize(this.versions.private,vr(new Uint8Array([0]),t)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return Lc.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(t,e=qc){if(en(t),8*t.length<128||8*t.length>512)throw new Error(`HDKey: wrong seed length=${t.length}. Should be between 128 and 512 bits; 256 bits is advised)`);let r=pn(Pr,wh,t);return new n({versions:e,chainCode:r.slice(32),privateKey:r.slice(0,32)})}static fromExtendedKey(t,e=qc){let r=Lc.decode(t),o=ln(r),s=o.getUint32(0,!1),i={versions:e,depth:r[4],parentFingerprint:o.getUint32(5,!1),index:o.getUint32(9,!1),chainCode:r.slice(13,45)},c=r.slice(45),u=c[0]===0;if(s!==e[u?"private":"public"])throw new Error("Version mismatch");return u?new n({...i,privateKey:c.slice(1)}):new n({...i,publicKey:c})}static fromJSON(t){return n.fromExtendedKey(t.xpriv)}constructor(t){if(this.depth=0,this.index=0,this.chainCode=null,this.parentFingerprint=0,!t||typeof t!="object")throw new Error("HDKey.constructor must not be called directly");if(this.versions=t.versions||qc,this.depth=t.depth||0,this.chainCode=t.chainCode,this.index=t.index||0,this.parentFingerprint=t.parentFingerprint||0,!this.depth&&(this.parentFingerprint||this.index))throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");if(t.publicKey&&t.privateKey)throw new Error("HDKey: publicKey and privateKey at same time.");if(t.privateKey){if(!sn.utils.isValidPrivateKey(t.privateKey))throw new Error("Invalid private key");this.privKey=typeof t.privateKey=="bigint"?t.privateKey:wd(t.privateKey),this.privKeyBytes=bh(this.privKey),this.pubKey=sn.getPublicKey(t.privateKey,!0)}else if(t.publicKey)this.pubKey=_i.fromHex(t.publicKey).toRawBytes(!0);else throw new Error("HDKey: no public or private key provided");this.pubHash=Th(this.pubKey)}derive(t){if(!/^[mM]'?/.test(t))throw new Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(t))return this;let e=t.replace(/^[mM]'?\//,"").split("/"),r=this;for(let o of e){let s=/^(\d+)('?)$/.exec(o),i=s&&s[1];if(!s||s.length!==3||typeof i!="string")throw new Error(`Invalid child index: ${o}`);let c=+i;if(!Number.isSafeInteger(c)||c>=Kc)throw new Error("Invalid index");s[2]==="'"&&(c+=Kc),r=r.deriveChild(c)}return r}deriveChild(t){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let e=Ei(t);if(t>=Kc){let c=this.privateKey;if(!c)throw new Error("Could not derive hardened child key");e=vr(new Uint8Array([0]),c,e)}else e=vr(this.pubKey,e);let r=pn(Pr,this.chainCode,e),o=wd(r.slice(0,32)),s=r.slice(32);if(!sn.utils.isValidPrivateKey(o))throw new Error("Tweak bigger than curve order");let i={versions:this.versions,chainCode:s,depth:this.depth+1,parentFingerprint:this.fingerprint,index:t};try{if(this.privateKey){let c=dt(this.privKey+o,sn.CURVE.n);if(!sn.utils.isValidPrivateKey(c))throw new Error("The tweak was out of range or the resulted private key is invalid");i.privateKey=c}else{let c=_i.fromHex(this.pubKey).add(_i.fromPrivateKey(o));if(c.equals(_i.ZERO))throw new Error("The tweak was equal to negative P, which made the result key invalid");i.publicKey=c.toRawBytes(!0)}return new n(i)}catch{return this.deriveChild(t+1)}}sign(t){if(!this.privateKey)throw new Error("No privateKey set!");return en(t,32),sn.sign(t,this.privKey).toCompactRawBytes()}verify(t,e){if(en(t,32),en(e,64),!this.publicKey)throw new Error("No publicKey set!");let r;try{r=sn.Signature.fromCompact(e)}catch{return!1}return sn.verify(r,t,this.publicKey)}wipePrivateData(){return this.privKey=void 0,this.privKeyBytes&&(this.privKeyBytes.fill(0),this.privKeyBytes=void 0),this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(t,e){if(!this.chainCode)throw new Error("No chainCode set");return en(e,33),vr(Ei(t),new Uint8Array([this.depth]),Ei(this.parentFingerprint),Ei(this.index),this.chainCode,e)}};var cr=class cr extends Pt{constructor(e){super();let r=Be.fromHexInput(e);if(r.toUint8Array().length!==cr.LENGTH)throw new Error(`PublicKey length should be ${cr.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:r,signature:o}=e,s=Be.fromHexInput(r).toUint8Array(),i=Ir(s),c=o.toUint8Array();return ho.verify(c,i,this.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new cr(r)}static load(e){let r=e.deserializeBytes();return new cr(r)}static isPublicKey(e){return e instanceof cr}};cr.LENGTH=65;var Vt=cr,gn=class gn extends Br{constructor(e){super();let r=Be.fromHexInput(e);if(r.toUint8Array().length!==gn.LENGTH)throw new Error(`PrivateKey length should be ${gn.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}sign(e){let r=Be.fromHexInput(e),o=Ir(r.toUint8Array()),s=ho.sign(o,this.key.toUint8Array());return new Mn(s.toCompactRawBytes())}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new gn(r)}static generate(){let e=ho.utils.randomPrivateKey();return new gn(e)}publicKey(){let e=ho.getPublicKey(this.key.toUint8Array(),!1);return new Vt(e)}static fromDerivationPath(e,r){if(!sc(e))throw new Error(`Invalid derivation path ${e}`);return gn.fromDerivationPathInner(e,Xo(r))}static fromDerivationPathInner(e,r){let{privateKey:o}=Si.fromMasterSeed(r).derive(e);if(o===null)throw new Error("Invalid key");return new gn(o)}static isPrivateKey(e){return e instanceof gn}};gn.LENGTH=32;var Dn=gn,ur=class ur extends tn{constructor(e){super();let r=Be.fromHexInput(e);if(r.toUint8Array().length!==ur.LENGTH)throw new Error(`Signature length should be ${ur.LENGTH}, recieved ${r.toUint8Array().length}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new ur(r)}static load(e){let r=e.deserializeBytes();return new ur(r)}static isSignature(e){return e instanceof ur}};ur.LENGTH=64;var Mn=ur;var je=class n extends Pt{constructor(e){super();this.publicKey=e}toUint8Array(){return this.publicKey.toUint8Array()}toString(){return this.publicKey.toString()}verifySignature(e){let{message:r,signature:o}=e;return this.publicKey.verifySignature({message:r,signature:o})}serialize(e){if(this.publicKey instanceof qe)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else if(this.publicKey instanceof Vt)e.serializeU32AsUleb128(1),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(qe.load(e));case 1:return new n(Vt.load(e));default:throw new Error(`Unknown variant index for AnyPublicKey: ${r}`)}}static isPublicKey(e){return e instanceof n}isEd25519(){return this.publicKey instanceof qe}isSecp256k1PublicKey(){return this.publicKey instanceof Vt}};var qr=class n extends Pt{constructor(e){super();let{publicKeys:r,signaturesRequired:o}=e;if(o<1)throw new Error("The number of required signatures needs to be greater then 0");if(r.length<o)throw new Error(`Provided ${r.length} public keys is smaller than the ${o} required signatures`);let s=[];r.forEach(i=>{i instanceof je?s.push(i):s.push(new je(i))}),this.publicKeys=s,this.signaturesRequired=o}toUint8Array(){return this.bcsToBytes()}createBitmap(e){let{bits:r}=e,o=128,s=new Uint8Array([0,0,0,0]),i=new Set;return r.forEach((c,u)=>{if(u+1>this.publicKeys.length)throw new Error(`Signature index ${u+1} is out of public keys range, ${this.publicKeys.length}.`);if(i.has(c))throw new Error(`Duplicate bit ${c} detected.`);i.add(c);let d=Math.floor(c/8),h=s[d];h|=o>>c%8,s[d]=h}),s}toString(){return Be.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("not implemented")}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let r=e.deserializeVector(je),o=e.deserializeU8();return new n({publicKeys:r,signaturesRequired:o})}};var Gn=class Gn extends ae{constructor(e){super();let{data:r}=e,o=Be.fromHexInput(r);if(o.toUint8Array().length!==Gn.LENGTH)throw new Error(`Authentication Key length should be ${Gn.LENGTH}`);this.data=o}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeFixedBytes(Gn.LENGTH);return new Gn({data:r})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromPublicKeyAndScheme(e){let{publicKey:r,scheme:o}=e,s;switch(o){case 3:case 2:{let u=r.bcsToBytes();s=new Uint8Array([...u,o]);break}case 0:case 1:{let u=r.toUint8Array(),d=Be.fromHexInput(u).toUint8Array();s=new Uint8Array([...d,o]);break}default:throw new Error(`Scheme ${o} is not supported`)}let i=Ir.create();i.update(s);let c=i.digest();return new Gn({data:c})}static fromPublicKey(e){let{publicKey:r}=e,o;if(r instanceof qe)o=0 .valueOf();else if(r instanceof nn)o=1 .valueOf();else if(r instanceof je)o=2 .valueOf();else if(r instanceof qr)o=3 .valueOf();else throw new Error("No supported authentication scheme for public key");return Gn.fromPublicKeyAndScheme({publicKey:r,scheme:o})}derivedAddress(){return new F(this.data.toUint8Array())}};Gn.LENGTH=32;var an=Gn;var Ln=class n{constructor(t){let{privateKey:e,address:r,legacy:o}=t,s=o??!0;if(this.publicKey=e.publicKey(),this.publicKey instanceof qe)s?this.signingScheme=0:(this.publicKey=new je(this.publicKey),this.signingScheme=2);else if(this.publicKey instanceof nn)this.signingScheme=1;else if(this.publicKey instanceof Vt)this.publicKey=new je(this.publicKey),this.signingScheme=2;else throw new Error("Can not create new Account, unsupported public key type");this.privateKey=e,this.accountAddress=r}static generate(t){let e=t?.legacy??!0,r,o;switch(t?.scheme){case 2:r=Dn.generate(),o=new je(r.publicKey());break;default:r=Pn.generate(),e===!1?o=new je(r.publicKey()):o=r.publicKey()}let i=an.fromPublicKey({publicKey:o}).derivedAddress();return new n({privateKey:r,address:i,legacy:t?.legacy})}static fromPrivateKey(t){let{privateKey:e,legacy:r}=t,o=r??!0,s;if(e instanceof Dn)s=new je(e.publicKey());else if(e instanceof Pn)o?s=e.publicKey():s=new je(e.publicKey());else throw new Error(`Unsupported private key ${e}`);let c=an.fromPublicKey({publicKey:s}).derivedAddress();return new n({privateKey:e,address:c,legacy:o})}static fromPrivateKeyAndAddress(t){let{privateKey:e,address:r,legacy:o}=t;return new n({privateKey:e,address:r,legacy:o})}static fromDerivationPath(t){let{path:e,mnemonic:r,scheme:o,legacy:s}=t,i;switch(o){case 2:i=Dn.fromDerivationPath(e,r);break;case 0:i=Pn.fromDerivationPath(e,r);break;default:throw new Error(`Unsupported scheme ${o}`)}return n.fromPrivateKey({privateKey:i,legacy:s})}static authKey(t){let{publicKey:e}=t;return an.fromPublicKey({publicKey:e})}sign(t){return this.privateKey.sign(t)}verifySignature(t){let{message:e,signature:r}=t,o=Be.fromHexInput(e).toUint8Array();return this.publicKey.verifySignature({message:o,signature:r})}};var Eh=`
2
2
  fragment TokenActivitiesFields on token_activities_v2 {
3
3
  after_value
4
4
  before_value
@@ -16,7 +16,7 @@
16
16
  transaction_version
17
17
  type
18
18
  }
19
- `,gy=`
19
+ `,Sh=`
20
20
  fragment AnsTokenFragment on current_aptos_names {
21
21
  domain
22
22
  expiration_timestamp
@@ -26,7 +26,7 @@
26
26
  is_primary
27
27
  owner_address
28
28
  }
29
- `,_i=`
29
+ `,vi=`
30
30
  fragment CurrentTokenOwnershipFields on current_token_ownerships_v2 {
31
31
  token_standard
32
32
  token_properties_mutated_v1
@@ -72,7 +72,7 @@
72
72
  }
73
73
  }
74
74
  }
75
- `,ld=`
75
+ `,Td=`
76
76
  query getAccountCoinsCount($address: String) {
77
77
  current_fungible_asset_balances_aggregate(
78
78
  where: {owner_address: {_eq: $address}}
@@ -82,7 +82,7 @@
82
82
  }
83
83
  }
84
84
  }
85
- `,pd=`
85
+ `,_d=`
86
86
  query getAccountCoinsData($where_condition: current_fungible_asset_balances_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_fungible_asset_balances_order_by!]) {
87
87
  current_fungible_asset_balances(
88
88
  where: $where_condition
@@ -115,7 +115,7 @@
115
115
  }
116
116
  }
117
117
  }
118
- `,gd=`
118
+ `,Ed=`
119
119
  query getAccountCollectionsWithOwnedTokens($where_condition: current_collection_ownership_v2_view_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_collection_ownership_v2_view_order_by!]) {
120
120
  current_collection_ownership_v2_view(
121
121
  where: $where_condition
@@ -149,7 +149,7 @@
149
149
  single_token_uri
150
150
  }
151
151
  }
152
- `,md=`
152
+ `,Sd=`
153
153
  query getAccountOwnedObjects($where_condition: current_objects_bool_exp, $offset: Int, $limit: Int, $order_by: [current_objects_order_by!]) {
154
154
  current_objects(
155
155
  where: $where_condition
@@ -166,7 +166,7 @@
166
166
  is_deleted
167
167
  }
168
168
  }
169
- `,yd=`
169
+ `,vd=`
170
170
  query getAccountOwnedTokens($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
171
171
  current_token_ownerships_v2(
172
172
  where: $where_condition
@@ -177,7 +177,7 @@
177
177
  ...CurrentTokenOwnershipFields
178
178
  }
179
179
  }
180
- ${_i}`,cw=`
180
+ ${vi}`,ww=`
181
181
  query getAccountOwnedTokensByTokenData($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
182
182
  current_token_ownerships_v2(
183
183
  where: $where_condition
@@ -188,7 +188,7 @@
188
188
  ...CurrentTokenOwnershipFields
189
189
  }
190
190
  }
191
- ${_i}`,hd=`
191
+ ${vi}`,Cd=`
192
192
  query getAccountOwnedTokensFromCollection($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
193
193
  current_token_ownerships_v2(
194
194
  where: $where_condition
@@ -199,7 +199,7 @@
199
199
  ...CurrentTokenOwnershipFields
200
200
  }
201
201
  }
202
- ${_i}`,Ad=`
202
+ ${vi}`,Ud=`
203
203
  query getAccountTokensCount($where_condition: current_token_ownerships_v2_bool_exp, $offset: Int, $limit: Int) {
204
204
  current_token_ownerships_v2_aggregate(
205
205
  where: $where_condition
@@ -211,7 +211,7 @@
211
211
  }
212
212
  }
213
213
  }
214
- `,xd=`
214
+ `,Id=`
215
215
  query getAccountTransactionsCount($address: String) {
216
216
  account_transactions_aggregate(where: {account_address: {_eq: $address}}) {
217
217
  aggregate {
@@ -219,13 +219,13 @@
219
219
  }
220
220
  }
221
221
  }
222
- `,bd=`
222
+ `,Bd=`
223
223
  query getChainTopUserTransactions($limit: Int) {
224
224
  user_transactions(limit: $limit, order_by: {version: desc}) {
225
225
  version
226
226
  }
227
227
  }
228
- `,wd=`
228
+ `,Pd=`
229
229
  query getCollectionData($where_condition: current_collections_v2_bool_exp!) {
230
230
  current_collections_v2(where: $where_condition) {
231
231
  collection_id
@@ -244,7 +244,7 @@
244
244
  uri
245
245
  }
246
246
  }
247
- `,Td=`
247
+ `,Rd=`
248
248
  query getCurrentFungibleAssetBalances($where_condition: current_fungible_asset_balances_bool_exp, $offset: Int, $limit: Int) {
249
249
  current_fungible_asset_balances(
250
250
  where: $where_condition
@@ -262,7 +262,7 @@
262
262
  token_standard
263
263
  }
264
264
  }
265
- `,_d=`
265
+ `,Od=`
266
266
  query getDelegatedStakingActivities($delegatorAddress: String, $poolAddress: String) {
267
267
  delegated_staking_activities(
268
268
  where: {delegator_address: {_eq: $delegatorAddress}, pool_address: {_eq: $poolAddress}}
@@ -275,7 +275,7 @@
275
275
  transaction_version
276
276
  }
277
277
  }
278
- `,Sd=`
278
+ `,Nd=`
279
279
  query getEvents($where_condition: events_bool_exp, $offset: Int, $limit: Int, $order_by: [events_order_by!]) {
280
280
  events(
281
281
  where: $where_condition
@@ -294,7 +294,7 @@
294
294
  indexed_type
295
295
  }
296
296
  }
297
- `,Ed=`
297
+ `,kd=`
298
298
  query getFungibleAssetActivities($where_condition: fungible_asset_activities_bool_exp, $offset: Int, $limit: Int) {
299
299
  fungible_asset_activities(
300
300
  where: $where_condition
@@ -319,7 +319,7 @@
319
319
  type
320
320
  }
321
321
  }
322
- `,vd=`
322
+ `,zd=`
323
323
  query getFungibleAssetMetadata($where_condition: fungible_asset_metadata_bool_exp, $offset: Int, $limit: Int) {
324
324
  fungible_asset_metadata(where: $where_condition, offset: $offset, limit: $limit) {
325
325
  icon_uri
@@ -336,7 +336,7 @@
336
336
  token_standard
337
337
  }
338
338
  }
339
- `,yo=`
339
+ `,Ao=`
340
340
  query getNames($offset: Int, $limit: Int, $where_condition: current_aptos_names_bool_exp, $order_by: [current_aptos_names_order_by!]) {
341
341
  current_aptos_names(
342
342
  limit: $limit
@@ -347,14 +347,14 @@
347
347
  ...AnsTokenFragment
348
348
  }
349
349
  }
350
- ${gy}`,zc=`
350
+ ${Sh}`,Fc=`
351
351
  query getNumberOfDelegators($where_condition: num_active_delegator_per_pool_bool_exp, $order_by: [num_active_delegator_per_pool_order_by!]) {
352
352
  num_active_delegator_per_pool(where: $where_condition, order_by: $order_by) {
353
353
  num_active_delegator
354
354
  pool_address
355
355
  }
356
356
  }
357
- `,Dc=`
357
+ `,Hc=`
358
358
  query getProcessorStatus($where_condition: processor_status_bool_exp) {
359
359
  processor_status(where: $where_condition) {
360
360
  last_success_version
@@ -362,7 +362,7 @@
362
362
  last_updated
363
363
  }
364
364
  }
365
- `,Cd=`
365
+ `,Dd=`
366
366
  query getTokenActivity($where_condition: token_activities_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [token_activities_v2_order_by!]) {
367
367
  token_activities_v2(
368
368
  where: $where_condition
@@ -373,7 +373,7 @@
373
373
  ...TokenActivitiesFields
374
374
  }
375
375
  }
376
- ${py}`,Mc=`
376
+ ${Eh}`,$c=`
377
377
  query getCurrentTokenOwnership($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
378
378
  current_token_ownerships_v2(
379
379
  where: $where_condition
@@ -384,7 +384,7 @@
384
384
  ...CurrentTokenOwnershipFields
385
385
  }
386
386
  }
387
- ${_i}`,Ud=`
387
+ ${vi}`,Md=`
388
388
  query getTokenData($where_condition: current_token_datas_v2_bool_exp, $offset: Int, $limit: Int, $order_by: [current_token_datas_v2_order_by!]) {
389
389
  current_token_datas_v2(
390
390
  where: $where_condition
@@ -423,11 +423,11 @@
423
423
  }
424
424
  }
425
425
  }
426
- `;async function Si(r){let{aptosConfig:t}=r,{data:e}=await Ut({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function Id(r){let{aptosConfig:t,ledgerVersion:e,options:n}=r,{data:o}=await Ut({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:n?.withTransactions}});return o}async function Bd(r){let{aptosConfig:t,blockHeight:e,options:n}=r,{data:o}=await Ut({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:n?.withTransactions}});return o}async function Ei(r){let{aptosConfig:t,handle:e,data:n,options:o}=r;return(await Tn({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:o?.ledgerVersion},body:n})).data}async function cn(r){let{aptosConfig:t,payload:e,options:n}=r,{data:o}=await Tn({aptosConfig:t,originMethod:"view",path:"view",params:{ledger_version:n?.ledgerVersion},body:{function:e.function,type_arguments:e.typeArguments??[],arguments:e.functionArguments??[]}});return o}async function Pd(r){let{aptosConfig:t,limit:e}=r;return(await Ee({aptosConfig:t,query:{query:bd,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function Ee(r){let{aptosConfig:t,query:e,originMethod:n}=r,{data:o}=await Ma({aptosConfig:t,originMethod:n??"queryIndexer",path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return o}async function my(r){let{aptosConfig:t}=r;return(await Ee({aptosConfig:t,query:{query:Dc},originMethod:"getProcessorStatuses"})).processor_status}async function vi(r){let t=await my({aptosConfig:r.aptosConfig});return BigInt(t[0].last_success_version)}async function Ci(r){let{aptosConfig:t,processorType:e}=r,n={processor:{_eq:e.valueOf()}};return(await Ee({aptosConfig:t,query:{query:Dc,variables:{where_condition:n}},originMethod:"getProcessorStatus"})).processor_status[0]}var Gc=new Map;function ho(r,t,e){return async(...n)=>{if(Gc.has(t)){let{value:s,timestamp:i}=Gc.get(t);if(e===void 0||Date.now()-i<=e)return s}let o=await r(...n);return Gc.set(t,{value:o,timestamp:Date.now()}),o}}var lr=class r extends Jt{constructor(e){super();this.signature=e}toUint8Array(){return this.signature.toUint8Array()}toString(){return this.signature.toString()}serialize(e){if(this.signature instanceof Je)e.serializeU32AsUleb128(0),this.signature.serialize(e);else if(this.signature instanceof kr)e.serializeU32AsUleb128(1),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let n=e.deserializeUleb128AsU32();switch(n){case 0:return new r(Je.load(e));case 1:return new r(kr.load(e));default:throw new Error(`Unknown variant index for AnySignature: ${n}`)}}};async function pr(r){let{aptosConfig:t,accountAddress:e}=r,{data:n}=await Ut({aptosConfig:t,originMethod:"getInfo",path:`accounts/${H.from(e).toString()}`});return n}async function Nd(r){let{aptosConfig:t,accountAddress:e,options:n}=r;return wn({aptosConfig:t,originMethod:"getModules",path:`accounts/${H.from(e).toString()}/modules`,params:{ledger_version:n?.ledgerVersion,start:n?.offset,limit:n?.limit??1e3}})}async function Ui(r){return r.options?.ledgerVersion!==void 0?Rd(r):ho(async()=>Rd(r),`module-${r.accountAddress}-${r.moduleName}`,1e3*60*5)()}async function Rd(r){let{aptosConfig:t,accountAddress:e,moduleName:n,options:o}=r,{data:s}=await Ut({aptosConfig:t,originMethod:"getModule",path:`accounts/${H.from(e).toString()}/module/${n}`,params:{ledger_version:o?.ledgerVersion}});return s}async function kd(r){let{aptosConfig:t,accountAddress:e,options:n}=r;return wn({aptosConfig:t,originMethod:"getTransactions",path:`accounts/${H.from(e).toString()}/transactions`,params:{start:n?.offset,limit:n?.limit}})}async function zd(r){let{aptosConfig:t,accountAddress:e,options:n}=r;return wn({aptosConfig:t,originMethod:"getResources",path:`accounts/${H.from(e).toString()}/resources`,params:{ledger_version:n?.ledgerVersion,start:n?.offset,limit:n?.limit??999}})}async function Lc(r){let{aptosConfig:t,accountAddress:e,resourceType:n,options:o}=r,{data:s}=await Ut({aptosConfig:t,originMethod:"getResource",path:`accounts/${H.from(e).toString()}/resource/${n}`,params:{ledger_version:o?.ledgerVersion}});return s.data}async function qc(r){let{aptosConfig:t,authenticationKey:e,options:n}=r,o=await Lc({aptosConfig:t,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:n}),{address_map:{handle:s}}=o,i=H.from(e);try{let c=await Ei({aptosConfig:t,handle:s,data:{key:i.toString(),key_type:"address",value_type:"address"},options:n});return H.from(c)}catch(c){if(c instanceof cr&&c.data.error_code==="table_item_not_found")return i;throw c}}async function Dd(r){let{aptosConfig:t,accountAddress:e}=r,o={owner_address:{_eq:H.from(e).toStringLong()},amount:{_gt:0}},i=await Ee({aptosConfig:t,query:{query:Ad,variables:{where_condition:o}},originMethod:"getAccountTokensCount"});return i.current_token_ownerships_v2_aggregate.aggregate?i.current_token_ownerships_v2_aggregate.aggregate.count:0}async function Md(r){let{aptosConfig:t,accountAddress:e,options:n}=r,s={owner_address:{_eq:H.from(e).toStringLong()},amount:{_gt:0}};n?.tokenStandard&&(s.token_standard={_eq:n?.tokenStandard});let i={query:yd,variables:{where_condition:s,offset:n?.offset,limit:n?.limit,order_by:n?.orderBy}};return(await Ee({aptosConfig:t,query:i,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Gd(r){let{aptosConfig:t,accountAddress:e,collectionAddress:n,options:o}=r,s=H.from(e).toStringLong(),i=H.from(n).toStringLong(),c={owner_address:{_eq:s},current_token_data:{collection_id:{_eq:i}},amount:{_gt:0}};o?.tokenStandard&&(c.token_standard={_eq:o?.tokenStandard});let f={query:hd,variables:{where_condition:c,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await Ee({aptosConfig:t,query:f,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function Ld(r){let{aptosConfig:t,accountAddress:e,options:n}=r,s={owner_address:{_eq:H.from(e).toStringLong()},amount:{_gt:0}};n?.tokenStandard&&(s.current_collection={token_standard:{_eq:n?.tokenStandard}});let i={query:gd,variables:{where_condition:s,offset:n?.offset,limit:n?.limit,order_by:n?.orderBy}};return(await Ee({aptosConfig:t,query:i,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function qd(r){let{aptosConfig:t,accountAddress:e}=r,n=H.from(e).toStringLong(),s=await Ee({aptosConfig:t,query:{query:xd,variables:{address:n}},originMethod:"getAccountTransactionsCount"});return s.account_transactions_aggregate.aggregate?s.account_transactions_aggregate.aggregate.count:0}async function Kd(r){let{aptosConfig:t,accountAddress:e,coinType:n}=r,o=H.from(e).toStringLong(),s=await Kc({aptosConfig:t,accountAddress:o,options:{where:{asset_type:{_eq:n}}}});return s[0]?s[0].amount:0}async function Kc(r){let{aptosConfig:t,accountAddress:e,options:n}=r,o=H.from(e).toStringLong(),s={...n?.where,owner_address:{_eq:o}},i={query:pd,variables:{where_condition:s,offset:n?.offset,limit:n?.limit,order_by:n?.orderBy}};return(await Ee({aptosConfig:t,query:i,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Hd(r){let{aptosConfig:t,accountAddress:e}=r,n=H.from(e).toStringLong(),s=await Ee({aptosConfig:t,query:{query:ld,variables:{address:n}},originMethod:"getAccountCoinsCount"});if(!s.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return s.current_fungible_asset_balances_aggregate.aggregate.count}async function Fd(r){let{aptosConfig:t,accountAddress:e,options:n}=r,s={owner_address:{_eq:H.from(e).toStringLong()}},i={query:md,variables:{where_condition:s,offset:n?.offset,limit:n?.limit,order_by:n?.orderBy}};return(await Ee({aptosConfig:t,query:i,originMethod:"getAccountOwnedObjects"})).current_objects}async function $d(r){let{aptosConfig:t,privateKey:e}=r,n=new je(e.publicKey());if(e instanceof Nr){let s=or.fromPublicKeyAndScheme({publicKey:n,scheme:2}).derivedAddress();return Dr.fromPrivateKeyAndAddress({privateKey:e,address:s})}if(e instanceof Ur){let o=or.fromPublicKeyAndScheme({publicKey:n,scheme:2});if(await Od({authKey:o,aptosConfig:t})){let f=o.derivedAddress();return Dr.fromPrivateKeyAndAddress({privateKey:e,address:f,legacy:!1})}let i=or.fromPublicKeyAndScheme({publicKey:n,scheme:0});if(await Od({authKey:i,aptosConfig:t})){let f=i.derivedAddress();return Dr.fromPrivateKeyAndAddress({privateKey:e,address:f,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function Od(r){let{aptosConfig:t,authKey:e}=r,n=await qc({aptosConfig:t,authenticationKey:e.derivedAddress()});try{return await pr({aptosConfig:t,accountAddress:n}),!0}catch(o){if(o.status===404)return!1;throw new Error(`Error while looking for an account info ${n.toString()}`)}}async function un(r){return new Promise(t=>{setTimeout(t,r)})}async function Vd(r){let{aptosConfig:t,options:e}=r;return wn({aptosConfig:t,originMethod:"getTransactions",path:"transactions",params:{start:e?.offset,limit:e?.limit}})}async function Bi(r){let{aptosConfig:t}=r;return ho(async()=>{let{data:e}=await Ut({aptosConfig:t,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return e},`gas-price-${t.network}`,1e3*60*5)()}async function jd(r){let{aptosConfig:t,ledgerVersion:e}=r,{data:n}=await Ut({aptosConfig:t,originMethod:"getTransactionByVersion",path:`transactions/by_version/${e}`});return n}async function Pi(r){let{aptosConfig:t,transactionHash:e}=r,{data:n}=await Ut({aptosConfig:t,path:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash"});return n}async function Qd(r){let{aptosConfig:t,transactionHash:e}=r;try{return(await Pi({aptosConfig:t,transactionHash:e})).type==="pending_transaction"}catch(n){if(n?.status===404)return!0;throw n}}async function Ao(r){let{aptosConfig:t,transactionHash:e,options:n}=r,o=n?.timeoutSecs??Fo,s=n?.checkSuccess??!0,i=!0,c=0,f,l,h=200,m=1.5;for(;i&&!(c>=o);){try{if(f=await Pi({aptosConfig:t,transactionHash:e}),i=f.type==="pending_transaction",!i)break}catch(T){if(!(T instanceof cr)||(l=T,T.status!==404&&T.status>=400&&T.status<500))throw T}await un(h),c+=h/1e3,h*=m}if(f===void 0)throw l||new Ii(`Fetching transaction ${e} failed and timed out after ${o} seconds`,f);if(f.type==="pending_transaction")throw new Ii(`Transaction ${e} timed out in pending state after ${o} seconds`,f);if(!s)return f;if(!f.success)throw new Hc(`Transaction ${e} failed with an error: ${f.vm_status}`,f);return f}async function Ri(r){let{aptosConfig:t,processorType:e}=r,n=BigInt(r.minimumLedgerVersion),o=3e3,s=new Date().getTime(),i=BigInt(-1);for(;i<n;){if(new Date().getTime()-s>o)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(e===void 0?i=await vi({aptosConfig:t}):i=(await Ci({aptosConfig:t,processorType:e})).last_success_version,i>=n)break;await un(200)}}var Ii=class extends Error{constructor(e,n){super(e);this.lastSubmittedTransaction=n}},Hc=class extends Error{constructor(e,n){super(e);this.transaction=n}};async function ze(r){r.minimumLedgerVersion!==void 0&&await Ri({aptosConfig:r.config,minimumLedgerVersion:r.minimumLedgerVersion,processorType:r.processorType})}var ts=class{constructor(t){this.config=t}async getAccountInfo(t){return pr({aptosConfig:this.config,...t})}async getAccountModules(t){return Nd({aptosConfig:this.config,...t})}async getAccountModule(t){return Ui({aptosConfig:this.config,...t})}async getAccountTransactions(t){return kd({aptosConfig:this.config,...t})}async getAccountResources(t){return zd({aptosConfig:this.config,...t})}async getAccountResource(t){return Lc({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return qc({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),Dd({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Md({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Gd({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Ld({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),qd({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Kc({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Hd({aptosConfig:this.config,...t})}async getAccountAPTAmount(t){return this.getAccountCoinAmount({coinType:$o,...t})}async getAccountCoinAmount(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Kd({aptosConfig:this.config,...t})}async getAccountOwnedObjects(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),Fd({aptosConfig:this.config,...t})}async deriveAccountFromPrivateKey(t){return $d({aptosConfig:this.config,...t})}};function rs(r,t){return function(){return r.apply(t,arguments)}}var{toString:yy}=Object.prototype,{getPrototypeOf:Vc}=Object,Ni=(r=>t=>{let e=yy.call(t);return r[e]||(r[e]=e.slice(8,-1).toLowerCase())})(Object.create(null)),gr=r=>(r=r.toLowerCase(),t=>Ni(t)===r),ki=r=>t=>typeof t===r,{isArray:xo}=Array,ns=ki("undefined");function hy(r){return r!==null&&!ns(r)&&r.constructor!==null&&!ns(r.constructor)&&$t(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}var Zd=gr("ArrayBuffer");function Ay(r){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(r):t=r&&r.buffer&&Zd(r.buffer),t}var xy=ki("string"),$t=ki("function"),Xd=ki("number"),zi=r=>r!==null&&typeof r=="object",by=r=>r===!0||r===!1,Oi=r=>{if(Ni(r)!=="object")return!1;let t=Vc(r);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)},wy=gr("Date"),Ty=gr("File"),_y=gr("Blob"),Sy=gr("FileList"),Ey=r=>zi(r)&&$t(r.pipe),vy=r=>{let t;return r&&(typeof FormData=="function"&&r instanceof FormData||$t(r.append)&&((t=Ni(r))==="formdata"||t==="object"&&$t(r.toString)&&r.toString()==="[object FormData]"))},Cy=gr("URLSearchParams"),Uy=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function os(r,t,{allOwnKeys:e=!1}={}){if(r===null||typeof r>"u")return;let n,o;if(typeof r!="object"&&(r=[r]),xo(r))for(n=0,o=r.length;n<o;n++)t.call(null,r[n],n,r);else{let s=e?Object.getOwnPropertyNames(r):Object.keys(r),i=s.length,c;for(n=0;n<i;n++)c=s[n],t.call(null,r[c],c,r)}}function Jd(r,t){t=t.toLowerCase();let e=Object.keys(r),n=e.length,o;for(;n-- >0;)if(o=e[n],t===o.toLowerCase())return o;return null}var el=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,tl=r=>!ns(r)&&r!==el;function $c(){let{caseless:r}=tl(this)&&this||{},t={},e=(n,o)=>{let s=r&&Jd(t,o)||o;Oi(t[s])&&Oi(n)?t[s]=$c(t[s],n):Oi(n)?t[s]=$c({},n):xo(n)?t[s]=n.slice():t[s]=n};for(let n=0,o=arguments.length;n<o;n++)arguments[n]&&os(arguments[n],e);return t}var Iy=(r,t,e,{allOwnKeys:n}={})=>(os(t,(o,s)=>{e&&$t(o)?r[s]=rs(o,e):r[s]=o},{allOwnKeys:n}),r),By=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),Py=(r,t,e,n)=>{r.prototype=Object.create(t.prototype,n),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:t.prototype}),e&&Object.assign(r.prototype,e)},Ry=(r,t,e,n)=>{let o,s,i,c={};if(t=t||{},r==null)return t;do{for(o=Object.getOwnPropertyNames(r),s=o.length;s-- >0;)i=o[s],(!n||n(i,r,t))&&!c[i]&&(t[i]=r[i],c[i]=!0);r=e!==!1&&Vc(r)}while(r&&(!e||e(r,t))&&r!==Object.prototype);return t},Oy=(r,t,e)=>{r=String(r),(e===void 0||e>r.length)&&(e=r.length),e-=t.length;let n=r.indexOf(t,e);return n!==-1&&n===e},Ny=r=>{if(!r)return null;if(xo(r))return r;let t=r.length;if(!Xd(t))return null;let e=new Array(t);for(;t-- >0;)e[t]=r[t];return e},ky=(r=>t=>r&&t instanceof r)(typeof Uint8Array<"u"&&Vc(Uint8Array)),zy=(r,t)=>{let n=(r&&r[Symbol.iterator]).call(r),o;for(;(o=n.next())&&!o.done;){let s=o.value;t.call(r,s[0],s[1])}},Dy=(r,t)=>{let e,n=[];for(;(e=r.exec(t))!==null;)n.push(e);return n},My=gr("HTMLFormElement"),Gy=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,n,o){return n.toUpperCase()+o}),Wd=(({hasOwnProperty:r})=>(t,e)=>r.call(t,e))(Object.prototype),Ly=gr("RegExp"),rl=(r,t)=>{let e=Object.getOwnPropertyDescriptors(r),n={};os(e,(o,s)=>{let i;(i=t(o,s,r))!==!1&&(n[s]=i||o)}),Object.defineProperties(r,n)},qy=r=>{rl(r,(t,e)=>{if($t(r)&&["arguments","caller","callee"].indexOf(e)!==-1)return!1;let n=r[e];if($t(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+e+"'")})}})},Ky=(r,t)=>{let e={},n=o=>{o.forEach(s=>{e[s]=!0})};return xo(r)?n(r):n(String(r).split(t)),e},Hy=()=>{},Fy=(r,t)=>(r=+r,Number.isFinite(r)?r:t),Fc="abcdefghijklmnopqrstuvwxyz",Yd="0123456789",nl={DIGIT:Yd,ALPHA:Fc,ALPHA_DIGIT:Fc+Fc.toUpperCase()+Yd},$y=(r=16,t=nl.ALPHA_DIGIT)=>{let e="",{length:n}=t;for(;r--;)e+=t[Math.random()*n|0];return e};function Vy(r){return!!(r&&$t(r.append)&&r[Symbol.toStringTag]==="FormData"&&r[Symbol.iterator])}var jy=r=>{let t=new Array(10),e=(n,o)=>{if(zi(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[o]=n;let s=xo(n)?[]:{};return os(n,(i,c)=>{let f=e(i,o+1);!ns(f)&&(s[c]=f)}),t[o]=void 0,s}}return n};return e(r,0)},Qy=gr("AsyncFunction"),Wy=r=>r&&(zi(r)||$t(r))&&$t(r.then)&&$t(r.catch),I={isArray:xo,isArrayBuffer:Zd,isBuffer:hy,isFormData:vy,isArrayBufferView:Ay,isString:xy,isNumber:Xd,isBoolean:by,isObject:zi,isPlainObject:Oi,isUndefined:ns,isDate:wy,isFile:Ty,isBlob:_y,isRegExp:Ly,isFunction:$t,isStream:Ey,isURLSearchParams:Cy,isTypedArray:ky,isFileList:Sy,forEach:os,merge:$c,extend:Iy,trim:Uy,stripBOM:By,inherits:Py,toFlatObject:Ry,kindOf:Ni,kindOfTest:gr,endsWith:Oy,toArray:Ny,forEachEntry:zy,matchAll:Dy,isHTMLForm:My,hasOwnProperty:Wd,hasOwnProp:Wd,reduceDescriptors:rl,freezeMethods:qy,toObjectSet:Ky,toCamelCase:Gy,noop:Hy,toFiniteNumber:Fy,findKey:Jd,global:el,isContextDefined:tl,ALPHABET:nl,generateString:$y,isSpecCompliantForm:Vy,toJSONObject:jy,isAsyncFn:Qy,isThenable:Wy};function bo(r,t,e,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",t&&(this.code=t),e&&(this.config=e),n&&(this.request=n),o&&(this.response=o)}I.inherits(bo,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:I.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var ol=bo.prototype,sl={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(r=>{sl[r]={value:r}});Object.defineProperties(bo,sl);Object.defineProperty(ol,"isAxiosError",{value:!0});bo.from=(r,t,e,n,o,s)=>{let i=Object.create(ol);return I.toFlatObject(r,i,function(f){return f!==Error.prototype},c=>c!=="isAxiosError"),bo.call(i,r.message,t,e,n,o),i.cause=r,i.name=r.name,s&&Object.assign(i,s),i};var Se=bo;var Di=null;function jc(r){return I.isPlainObject(r)||I.isArray(r)}function al(r){return I.endsWith(r,"[]")?r.slice(0,-2):r}function il(r,t,e){return r?r.concat(t).map(function(o,s){return o=al(o),!e&&s?"["+o+"]":o}).join(e?".":""):t}function Yy(r){return I.isArray(r)&&!r.some(jc)}var Zy=I.toFlatObject(I,{},null,function(t){return/^is[A-Z]/.test(t)});function Xy(r,t,e){if(!I.isObject(r))throw new TypeError("target must be an object");t=t||new(Di||FormData),e=I.toFlatObject(e,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,w){return!I.isUndefined(w[y])});let n=e.metaTokens,o=e.visitor||h,s=e.dots,i=e.indexes,f=(e.Blob||typeof Blob<"u"&&Blob)&&I.isSpecCompliantForm(t);if(!I.isFunction(o))throw new TypeError("visitor must be a function");function l(b){if(b===null)return"";if(I.isDate(b))return b.toISOString();if(!f&&I.isBlob(b))throw new Se("Blob is not supported. Use a Buffer instead.");return I.isArrayBuffer(b)||I.isTypedArray(b)?f&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function h(b,y,w){let E=b;if(b&&!w&&typeof b=="object"){if(I.endsWith(y,"{}"))y=n?y:y.slice(0,-2),b=JSON.stringify(b);else if(I.isArray(b)&&Yy(b)||(I.isFileList(b)||I.endsWith(y,"[]"))&&(E=I.toArray(b)))return y=al(y),E.forEach(function(P,$){!(I.isUndefined(P)||P===null)&&t.append(i===!0?il([y],$,s):i===null?y:y+"[]",l(P))}),!1}return jc(b)?!0:(t.append(il(w,y,s),l(b)),!1)}let m=[],T=Object.assign(Zy,{defaultVisitor:h,convertValue:l,isVisitable:jc});function v(b,y){if(!I.isUndefined(b)){if(m.indexOf(b)!==-1)throw Error("Circular reference detected in "+y.join("."));m.push(b),I.forEach(b,function(E,k){(!(I.isUndefined(E)||E===null)&&o.call(t,E,I.isString(k)?k.trim():k,y,T))===!0&&v(E,y?y.concat(k):[k])}),m.pop()}}if(!I.isObject(r))throw new TypeError("data must be an object");return v(r),t}var fn=Xy;function cl(r){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function ul(r,t){this._pairs=[],r&&fn(r,this,t)}var fl=ul.prototype;fl.append=function(t,e){this._pairs.push([t,e])};fl.toString=function(t){let e=t?function(n){return t.call(this,n,cl)}:cl;return this._pairs.map(function(o){return e(o[0])+"="+e(o[1])},"").join("&")};var Mi=ul;function Jy(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ss(r,t,e){if(!t)return r;let n=e&&e.encode||Jy,o=e&&e.serialize,s;if(o?s=o(t,e):s=I.isURLSearchParams(t)?t.toString():new Mi(t,e).toString(n),s){let i=r.indexOf("#");i!==-1&&(r=r.slice(0,i)),r+=(r.indexOf("?")===-1?"?":"&")+s}return r}var Qc=class{constructor(){this.handlers=[]}use(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){I.forEach(this.handlers,function(n){n!==null&&t(n)})}},Wc=Qc;var Gi={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var dl=typeof URLSearchParams<"u"?URLSearchParams:Mi;var ll=typeof FormData<"u"?FormData:null;var pl=typeof Blob<"u"?Blob:null;var gl={isBrowser:!0,classes:{URLSearchParams:dl,FormData:ll,Blob:pl},protocols:["http","https","file","blob","url","data"]};var Yc={};Gs(Yc,{hasBrowserEnv:()=>ml,hasStandardBrowserEnv:()=>eh,hasStandardBrowserWebWorkerEnv:()=>th});var ml=typeof window<"u"&&typeof document<"u",eh=(r=>ml&&["ReactNative","NativeScript","NS"].indexOf(r)<0)(typeof navigator<"u"&&navigator.product),th=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function";var Tt={...Yc,...gl};function Zc(r,t){return fn(r,new Tt.classes.URLSearchParams,Object.assign({visitor:function(e,n,o,s){return Tt.isNode&&I.isBuffer(e)?(this.append(n,e.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function rh(r){return I.matchAll(/\w+|\[(\w*)]/g,r).map(t=>t[0]==="[]"?"":t[1]||t[0])}function nh(r){let t={},e=Object.keys(r),n,o=e.length,s;for(n=0;n<o;n++)s=e[n],t[s]=r[s];return t}function oh(r){function t(e,n,o,s){let i=e[s++],c=Number.isFinite(+i),f=s>=e.length;return i=!i&&I.isArray(o)?o.length:i,f?(I.hasOwnProp(o,i)?o[i]=[o[i],n]:o[i]=n,!c):((!o[i]||!I.isObject(o[i]))&&(o[i]=[]),t(e,n,o[i],s)&&I.isArray(o[i])&&(o[i]=nh(o[i])),!c)}if(I.isFormData(r)&&I.isFunction(r.entries)){let e={};return I.forEachEntry(r,(n,o)=>{t(rh(n),o,e,0)}),e}return null}var Li=oh;function sh(r,t,e){if(I.isString(r))try{return(t||JSON.parse)(r),I.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(e||JSON.stringify)(r)}var Xc={transitional:Gi,adapter:["xhr","http"],transformRequest:[function(t,e){let n=e.getContentType()||"",o=n.indexOf("application/json")>-1,s=I.isObject(t);if(s&&I.isHTMLForm(t)&&(t=new FormData(t)),I.isFormData(t))return o&&o?JSON.stringify(Li(t)):t;if(I.isArrayBuffer(t)||I.isBuffer(t)||I.isStream(t)||I.isFile(t)||I.isBlob(t))return t;if(I.isArrayBufferView(t))return t.buffer;if(I.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Zc(t,this.formSerializer).toString();if((c=I.isFileList(t))||n.indexOf("multipart/form-data")>-1){let f=this.env&&this.env.FormData;return fn(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return s||o?(e.setContentType("application/json",!1),sh(t)):t}],transformResponse:[function(t){let e=this.transitional||Xc.transitional,n=e&&e.forcedJSONParsing,o=this.responseType==="json";if(t&&I.isString(t)&&(n&&!this.responseType||o)){let i=!(e&&e.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(c){if(i)throw c.name==="SyntaxError"?Se.from(c,Se.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Tt.classes.FormData,Blob:Tt.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};I.forEach(["delete","get","head","post","put","patch"],r=>{Xc.headers[r]={}});var wo=Xc;var ih=I.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),yl=r=>{let t={},e,n,o;return r&&r.split(`
427
- `).forEach(function(i){o=i.indexOf(":"),e=i.substring(0,o).trim().toLowerCase(),n=i.substring(o+1).trim(),!(!e||t[e]&&ih[e])&&(e==="set-cookie"?t[e]?t[e].push(n):t[e]=[n]:t[e]=t[e]?t[e]+", "+n:n)}),t};var hl=Symbol("internals");function is(r){return r&&String(r).trim().toLowerCase()}function qi(r){return r===!1||r==null?r:I.isArray(r)?r.map(qi):String(r)}function ah(r){let t=Object.create(null),e=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=e.exec(r);)t[n[1]]=n[2];return t}var ch=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function Jc(r,t,e,n,o){if(I.isFunction(n))return n.call(this,t,e);if(o&&(t=e),!!I.isString(t)){if(I.isString(n))return t.indexOf(n)!==-1;if(I.isRegExp(n))return n.test(t)}}function uh(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,e,n)=>e.toUpperCase()+n)}function fh(r,t){let e=I.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(r,n+e,{value:function(o,s,i){return this[n].call(this,t,o,s,i)},configurable:!0})})}var To=class{constructor(t){t&&this.set(t)}set(t,e,n){let o=this;function s(c,f,l){let h=is(f);if(!h)throw new Error("header name must be a non-empty string");let m=I.findKey(o,h);(!m||o[m]===void 0||l===!0||l===void 0&&o[m]!==!1)&&(o[m||f]=qi(c))}let i=(c,f)=>I.forEach(c,(l,h)=>s(l,h,f));return I.isPlainObject(t)||t instanceof this.constructor?i(t,e):I.isString(t)&&(t=t.trim())&&!ch(t)?i(yl(t),e):t!=null&&s(e,t,n),this}get(t,e){if(t=is(t),t){let n=I.findKey(this,t);if(n){let o=this[n];if(!e)return o;if(e===!0)return ah(o);if(I.isFunction(e))return e.call(this,o,n);if(I.isRegExp(e))return e.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=is(t),t){let n=I.findKey(this,t);return!!(n&&this[n]!==void 0&&(!e||Jc(this,this[n],n,e)))}return!1}delete(t,e){let n=this,o=!1;function s(i){if(i=is(i),i){let c=I.findKey(n,i);c&&(!e||Jc(n,n[c],c,e))&&(delete n[c],o=!0)}}return I.isArray(t)?t.forEach(s):s(t),o}clear(t){let e=Object.keys(this),n=e.length,o=!1;for(;n--;){let s=e[n];(!t||Jc(this,this[s],s,t,!0))&&(delete this[s],o=!0)}return o}normalize(t){let e=this,n={};return I.forEach(this,(o,s)=>{let i=I.findKey(n,s);if(i){e[i]=qi(o),delete e[s];return}let c=t?uh(s):String(s).trim();c!==s&&delete e[s],e[c]=qi(o),n[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let e=Object.create(null);return I.forEach(this,(n,o)=>{n!=null&&n!==!1&&(e[o]=t&&I.isArray(n)?n.join(", "):n)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join(`
428
- `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){let n=new this(t);return e.forEach(o=>n.set(o)),n}static accessor(t){let n=(this[hl]=this[hl]={accessors:{}}).accessors,o=this.prototype;function s(i){let c=is(i);n[c]||(fh(o,i),n[c]=!0)}return I.isArray(t)?t.forEach(s):s(t),this}};To.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);I.reduceDescriptors(To.prototype,({value:r},t)=>{let e=t[0].toUpperCase()+t.slice(1);return{get:()=>r,set(n){this[e]=n}}});I.freezeMethods(To);var _t=To;function as(r,t){let e=this||wo,n=t||e,o=_t.from(n.headers),s=n.data;return I.forEach(r,function(c){s=c.call(e,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function cs(r){return!!(r&&r.__CANCEL__)}function Al(r,t,e){Se.call(this,r??"canceled",Se.ERR_CANCELED,t,e),this.name="CanceledError"}I.inherits(Al,Se,{__CANCEL__:!0});var dn=Al;function eu(r,t,e){let n=e.config.validateStatus;!e.status||!n||n(e.status)?r(e):t(new Se("Request failed with status code "+e.status,[Se.ERR_BAD_REQUEST,Se.ERR_BAD_RESPONSE][Math.floor(e.status/100)-4],e.config,e.request,e))}var xl=Tt.hasStandardBrowserEnv?{write(r,t,e,n,o,s){let i=[r+"="+encodeURIComponent(t)];I.isNumber(e)&&i.push("expires="+new Date(e).toGMTString()),I.isString(n)&&i.push("path="+n),I.isString(o)&&i.push("domain="+o),s===!0&&i.push("secure"),document.cookie=i.join("; ")},read(r){let t=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(r){this.write(r,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function tu(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function ru(r,t){return t?r.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):r}function us(r,t){return r&&!tu(t)?ru(r,t):t}var bl=Tt.hasStandardBrowserEnv?function(){let t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a"),n;function o(s){let i=s;return t&&(e.setAttribute("href",i),i=e.href),e.setAttribute("href",i),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:e.pathname.charAt(0)==="/"?e.pathname:"/"+e.pathname}}return n=o(window.location.href),function(i){let c=I.isString(i)?o(i):i;return c.protocol===n.protocol&&c.host===n.host}}():function(){return function(){return!0}}();function nu(r){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return t&&t[1]||""}function dh(r,t){r=r||10;let e=new Array(r),n=new Array(r),o=0,s=0,i;return t=t!==void 0?t:1e3,function(f){let l=Date.now(),h=n[s];i||(i=l),e[o]=f,n[o]=l;let m=s,T=0;for(;m!==o;)T+=e[m++],m=m%r;if(o=(o+1)%r,o===s&&(s=(s+1)%r),l-i<t)return;let v=h&&l-h;return v?Math.round(T*1e3/v):void 0}}var wl=dh;function Tl(r,t){let e=0,n=wl(50,250);return o=>{let s=o.loaded,i=o.lengthComputable?o.total:void 0,c=s-e,f=n(c),l=s<=i;e=s;let h={loaded:s,total:i,progress:i?s/i:void 0,bytes:c,rate:f||void 0,estimated:f&&i&&l?(i-s)/f:void 0,event:o};h[t?"download":"upload"]=!0,r(h)}}var lh=typeof XMLHttpRequest<"u",_l=lh&&function(r){return new Promise(function(e,n){let o=r.data,s=_t.from(r.headers).normalize(),{responseType:i,withXSRFToken:c}=r,f;function l(){r.cancelToken&&r.cancelToken.unsubscribe(f),r.signal&&r.signal.removeEventListener("abort",f)}let h;if(I.isFormData(o)){if(Tt.hasStandardBrowserEnv||Tt.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((h=s.getContentType())!==!1){let[y,...w]=h?h.split(";").map(E=>E.trim()).filter(Boolean):[];s.setContentType([y||"multipart/form-data",...w].join("; "))}}let m=new XMLHttpRequest;if(r.auth){let y=r.auth.username||"",w=r.auth.password?unescape(encodeURIComponent(r.auth.password)):"";s.set("Authorization","Basic "+btoa(y+":"+w))}let T=us(r.baseURL,r.url);m.open(r.method.toUpperCase(),ss(T,r.params,r.paramsSerializer),!0),m.timeout=r.timeout;function v(){if(!m)return;let y=_t.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),E={data:!i||i==="text"||i==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:y,config:r,request:m};eu(function(P){e(P),l()},function(P){n(P),l()},E),m=null}if("onloadend"in m?m.onloadend=v:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(v)},m.onabort=function(){m&&(n(new Se("Request aborted",Se.ECONNABORTED,r,m)),m=null)},m.onerror=function(){n(new Se("Network Error",Se.ERR_NETWORK,r,m)),m=null},m.ontimeout=function(){let w=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded",E=r.transitional||Gi;r.timeoutErrorMessage&&(w=r.timeoutErrorMessage),n(new Se(w,E.clarifyTimeoutError?Se.ETIMEDOUT:Se.ECONNABORTED,r,m)),m=null},Tt.hasStandardBrowserEnv&&(c&&I.isFunction(c)&&(c=c(r)),c||c!==!1&&bl(T))){let y=r.xsrfHeaderName&&r.xsrfCookieName&&xl.read(r.xsrfCookieName);y&&s.set(r.xsrfHeaderName,y)}o===void 0&&s.setContentType(null),"setRequestHeader"in m&&I.forEach(s.toJSON(),function(w,E){m.setRequestHeader(E,w)}),I.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),i&&i!=="json"&&(m.responseType=r.responseType),typeof r.onDownloadProgress=="function"&&m.addEventListener("progress",Tl(r.onDownloadProgress,!0)),typeof r.onUploadProgress=="function"&&m.upload&&m.upload.addEventListener("progress",Tl(r.onUploadProgress)),(r.cancelToken||r.signal)&&(f=y=>{m&&(n(!y||y.type?new dn(null,r,m):y),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(f),r.signal&&(r.signal.aborted?f():r.signal.addEventListener("abort",f)));let b=nu(T);if(b&&Tt.protocols.indexOf(b)===-1){n(new Se("Unsupported protocol "+b+":",Se.ERR_BAD_REQUEST,r));return}m.send(o||null)})};var ou={http:Di,xhr:_l};I.forEach(ou,(r,t)=>{if(r){try{Object.defineProperty(r,"name",{value:t})}catch{}Object.defineProperty(r,"adapterName",{value:t})}});var Sl=r=>`- ${r}`,ph=r=>I.isFunction(r)||r===null||r===!1,Ki={getAdapter:r=>{r=I.isArray(r)?r:[r];let{length:t}=r,e,n,o={};for(let s=0;s<t;s++){e=r[s];let i;if(n=e,!ph(e)&&(n=ou[(i=String(e)).toLowerCase()],n===void 0))throw new Se(`Unknown adapter '${i}'`);if(n)break;o[i||"#"+s]=n}if(!n){let s=Object.entries(o).map(([c,f])=>`adapter ${c} `+(f===!1?"is not supported by the environment":"is not available in the build")),i=t?s.length>1?`since :
429
- `+s.map(Sl).join(`
430
- `):" "+Sl(s[0]):"as no adapter specified";throw new Se("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return n},adapters:ou};function su(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new dn(null,r)}function Hi(r){return su(r),r.headers=_t.from(r.headers),r.data=as.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),Ki.getAdapter(r.adapter||wo.adapter)(r).then(function(n){return su(r),n.data=as.call(r,r.transformResponse,n),n.headers=_t.from(n.headers),n},function(n){return cs(n)||(su(r),n&&n.response&&(n.response.data=as.call(r,r.transformResponse,n.response),n.response.headers=_t.from(n.response.headers))),Promise.reject(n)})}var El=r=>r instanceof _t?r.toJSON():r;function Mr(r,t){t=t||{};let e={};function n(l,h,m){return I.isPlainObject(l)&&I.isPlainObject(h)?I.merge.call({caseless:m},l,h):I.isPlainObject(h)?I.merge({},h):I.isArray(h)?h.slice():h}function o(l,h,m){if(I.isUndefined(h)){if(!I.isUndefined(l))return n(void 0,l,m)}else return n(l,h,m)}function s(l,h){if(!I.isUndefined(h))return n(void 0,h)}function i(l,h){if(I.isUndefined(h)){if(!I.isUndefined(l))return n(void 0,l)}else return n(void 0,h)}function c(l,h,m){if(m in t)return n(l,h);if(m in r)return n(void 0,l)}let f={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(l,h)=>o(El(l),El(h),!0)};return I.forEach(Object.keys(Object.assign({},r,t)),function(h){let m=f[h]||o,T=m(r[h],t[h],h);I.isUndefined(T)&&m!==c||(e[h]=T)}),e}var Fi="1.6.2";var iu={};["object","boolean","number","function","string","symbol"].forEach((r,t)=>{iu[r]=function(n){return typeof n===r||"a"+(t<1?"n ":" ")+r}});var vl={};iu.transitional=function(t,e,n){function o(s,i){return"[Axios v"+Fi+"] Transitional option '"+s+"'"+i+(n?". "+n:"")}return(s,i,c)=>{if(t===!1)throw new Se(o(i," has been removed"+(e?" in "+e:"")),Se.ERR_DEPRECATED);return e&&!vl[i]&&(vl[i]=!0,console.warn(o(i," has been deprecated since v"+e+" and will be removed in the near future"))),t?t(s,i,c):!0}};function gh(r,t,e){if(typeof r!="object")throw new Se("options must be an object",Se.ERR_BAD_OPTION_VALUE);let n=Object.keys(r),o=n.length;for(;o-- >0;){let s=n[o],i=t[s];if(i){let c=r[s],f=c===void 0||i(c,s,r);if(f!==!0)throw new Se("option "+s+" must be "+f,Se.ERR_BAD_OPTION_VALUE);continue}if(e!==!0)throw new Se("Unknown option "+s,Se.ERR_BAD_OPTION)}}var $i={assertOptions:gh,validators:iu};var ln=$i.validators,_o=class{constructor(t){this.defaults=t,this.interceptors={request:new Wc,response:new Wc}}request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=Mr(this.defaults,e);let{transitional:n,paramsSerializer:o,headers:s}=e;n!==void 0&&$i.assertOptions(n,{silentJSONParsing:ln.transitional(ln.boolean),forcedJSONParsing:ln.transitional(ln.boolean),clarifyTimeoutError:ln.transitional(ln.boolean)},!1),o!=null&&(I.isFunction(o)?e.paramsSerializer={serialize:o}:$i.assertOptions(o,{encode:ln.function,serialize:ln.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let i=s&&I.merge(s.common,s[e.method]);s&&I.forEach(["delete","get","head","post","put","patch","common"],b=>{delete s[b]}),e.headers=_t.concat(i,s);let c=[],f=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(e)===!1||(f=f&&y.synchronous,c.unshift(y.fulfilled,y.rejected))});let l=[];this.interceptors.response.forEach(function(y){l.push(y.fulfilled,y.rejected)});let h,m=0,T;if(!f){let b=[Hi.bind(this),void 0];for(b.unshift.apply(b,c),b.push.apply(b,l),T=b.length,h=Promise.resolve(e);m<T;)h=h.then(b[m++],b[m++]);return h}T=c.length;let v=e;for(m=0;m<T;){let b=c[m++],y=c[m++];try{v=b(v)}catch(w){y.call(this,w);break}}try{h=Hi.call(this,v)}catch(b){return Promise.reject(b)}for(m=0,T=l.length;m<T;)h=h.then(l[m++],l[m++]);return h}getUri(t){t=Mr(this.defaults,t);let e=us(t.baseURL,t.url);return ss(e,t.params,t.paramsSerializer)}};I.forEach(["delete","get","head","options"],function(t){_o.prototype[t]=function(e,n){return this.request(Mr(n||{},{method:t,url:e,data:(n||{}).data}))}});I.forEach(["post","put","patch"],function(t){function e(n){return function(s,i,c){return this.request(Mr(c||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}_o.prototype[t]=e(),_o.prototype[t+"Form"]=e(!0)});var fs=_o;var au=class r{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(s){e=s});let n=this;this.promise.then(o=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](o);n._listeners=null}),this.promise.then=o=>{let s,i=new Promise(c=>{n.subscribe(c),s=c}).then(o);return i.cancel=function(){n.unsubscribe(s)},i},t(function(s,i,c){n.reason||(n.reason=new dn(s,i,c),e(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let e=this._listeners.indexOf(t);e!==-1&&this._listeners.splice(e,1)}static source(){let t;return{token:new r(function(o){t=o}),cancel:t}}},Cl=au;function cu(r){return function(e){return r.apply(null,e)}}function uu(r){return I.isObject(r)&&r.isAxiosError===!0}var fu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(fu).forEach(([r,t])=>{fu[t]=r});var Ul=fu;function Il(r){let t=new fs(r),e=rs(fs.prototype.request,t);return I.extend(e,fs.prototype,t,{allOwnKeys:!0}),I.extend(e,t,null,{allOwnKeys:!0}),e.create=function(o){return Il(Mr(r,o))},e}var it=Il(wo);it.Axios=fs;it.CanceledError=dn;it.CancelToken=Cl;it.isCancel=cs;it.VERSION=Fi;it.toFormData=fn;it.AxiosError=Se;it.Cancel=it.CanceledError;it.all=function(t){return Promise.all(t)};it.spread=cu;it.isAxiosError=uu;it.mergeConfig=Mr;it.AxiosHeaders=_t;it.formToJSON=r=>Li(I.isHTMLForm(r)?new FormData(r):r);it.getAdapter=Ki.getAdapter;it.HttpStatusCode=Ul;it.default=it;var Vi=it;var{Axios:JT,AxiosError:e_,CanceledError:t_,isCancel:r_,CancelToken:n_,VERSION:o_,all:s_,Cancel:i_,isAxiosError:a_,spread:c_,toFormData:u_,AxiosHeaders:f_,HttpStatusCode:d_,formToJSON:l_,getAdapter:p_,mergeConfig:g_}=Vi;async function Bl(r){var t;let{params:e,method:n,url:o,headers:s,body:i,overrides:c}=r,f={headers:s,method:n,url:o,params:e,data:i,withCredentials:(t=c?.WITH_CREDENTIALS)!=null?t:!0};try{let l=await Vi(f);return{status:l.status,statusText:l.statusText,data:l.data,headers:l.headers,config:l.config}}catch(l){let h=l;if(h.response)return h.response;throw l}}var ds=class{constructor(t){this.network=t?.network??Oa,this.fullnode=t?.fullnode,this.faucet=t?.faucet,this.indexer=t?.indexer,this.client=t?.client??{provider:Bl},this.clientConfig=t?.clientConfig??{}}getRequestUrl(t){switch(t){case 0:if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return Pa[this.network];case 2:if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return Ra[this.network];case 1:if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return Ks[this.network];default:throw Error(`apiType ${t} is not supported`)}}isIndexerRequest(t){return Ks[this.network]===t}};var ls=class extends ae{constructor(e){super();this.accountAddress=H.ONE;this.moduleName=new ht("account");this.structName=new ht("RotationProofChallenge");this.sequenceNumber=new ft(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=Le.U8(e.newPublicKey.toUint8Array())}serialize(e){e.serialize(this.accountAddress),e.serialize(this.moduleName),e.serialize(this.structName),e.serialize(this.sequenceNumber),e.serialize(this.originator),e.serialize(this.currentAuthKey),e.serialize(this.newPublicKey)}};var vt=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return mr.load(t);case 1:return ps.load(t);case 2:return sr.load(t);case 3:return Ln.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}isEd25519(){return this instanceof mr}isMultiEd25519(){return this instanceof ps}isSingleKey(){return this instanceof sr}isMultiKey(){return this instanceof Ln}},mr=class r extends vt{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=qe.deserialize(e),o=Je.deserialize(e);return new r(n,o)}},ps=class r extends vt{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=er.deserialize(e),o=Bn.deserialize(e);return new r(n,o)}},sr=class r extends vt{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=je.deserialize(e),o=lr.deserialize(e);return new r(n,o)}},Ln=class r extends vt{constructor(e,n,o){super();this.public_keys=e,this.signatures=n,this.signatures_bitmap=o}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),e.serializeVector(this.signatures),e.serializeBytes(this.signatures_bitmap)}static load(e){let n=Gn.deserialize(e),o=e.deserializeVector(lr),s=e.deserializeBytes();return new r(n,o,s)}};var yr=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return qn.load(t);case 1:return ji.load(t);case 2:return Kn.load(t);case 3:return Hn.load(t);case 4:return Fn.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},qn=class r extends yr{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=qe.deserialize(e),o=Je.deserialize(e);return new r(n,o)}},ji=class r extends yr{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=er.deserialize(e),o=Bn.deserialize(e);return new r(n,o)}},Kn=class r extends yr{constructor(e,n,o){super();this.sender=e,this.secondary_signer_addresses=n,this.secondary_signers=o}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let n=vt.deserialize(e),o=e.deserializeVector(H),s=e.deserializeVector(vt);return new r(n,o,s)}},Hn=class r extends yr{constructor(e,n,o,s){super();this.sender=e,this.secondary_signer_addresses=n,this.secondary_signers=o,this.fee_payer=s}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let n=vt.deserialize(e),o=e.deserializeVector(H),s=e.deserializeVector(vt),i=H.deserialize(e),c=vt.deserialize(e),f={address:i,authenticator:c};return new r(n,o,s,f)}},Fn=class r extends yr{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let n=vt.deserialize(e);return new r(n)}};var $n=class r extends ae{constructor(e){super();this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let n=e.deserializeU8();return new r(n)}};var Qe=class r extends ae{constructor(e){super();this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let n=e.deserializeStr();return new r(n)}};var So=class r extends ae{constructor(e,n){super();this.address=e,this.name=n}static fromStr(e){let n=e.split("::");if(n.length!==2)throw new Error("Invalid module id.");return new r(H.fromString(n[0]),new Qe(n[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let n=H.deserialize(e),o=Qe.deserialize(e);return new r(n,o)}};var rt=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Vn.load(t);case 1:return jn.load(t);case 2:return Yn.load(t);case 3:return Zn.load(t);case 4:return Jn.load(t);case 5:return pn.load(t);case 6:return to.load(t);case 7:return Gr.load(t);case 8:return Qn.load(t);case 9:return Wn.load(t);case 10:return Xn.load(t);case 255:return eo.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}isBool(){return this instanceof Vn}isAddress(){return this instanceof Jn}isGeneric(){return this instanceof eo}isSigner(){return this instanceof pn}isVector(){return this instanceof to}isStruct(){return this instanceof Gr}isU8(){return this instanceof jn}isU16(){return this instanceof Qn}isU32(){return this instanceof Wn}isU64(){return this instanceof Yn}isU128(){return this instanceof Zn}isU256(){return this instanceof Xn}},Vn=class r extends rt{toString(){return"bool"}serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new r}},jn=class r extends rt{toString(){return"u8"}serialize(t){t.serializeU32AsUleb128(1)}static load(t){return new r}},Qn=class r extends rt{toString(){return"u16"}serialize(t){t.serializeU32AsUleb128(8)}static load(t){return new r}},Wn=class r extends rt{toString(){return"u32"}serialize(t){t.serializeU32AsUleb128(9)}static load(t){return new r}},Yn=class r extends rt{toString(){return"u64"}serialize(t){t.serializeU32AsUleb128(2)}static load(t){return new r}},Zn=class r extends rt{toString(){return"u128"}serialize(t){t.serializeU32AsUleb128(3)}static load(t){return new r}},Xn=class r extends rt{toString(){return"u256"}serialize(t){t.serializeU32AsUleb128(10)}static load(t){return new r}},Jn=class r extends rt{toString(){return"address"}serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new r}},pn=class r extends rt{toString(){return"signer"}serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new r}},gs=class r extends rt{constructor(e){super();this.value=e}toString(){return`&${this.value.toString()}`}serialize(e){e.serializeU32AsUleb128(254)}static load(e){let n=rt.deserialize(e);return new r(n)}},eo=class r extends rt{constructor(e){super();this.value=e;if(e<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(e){e.serializeU32AsUleb128(255),e.serializeU32(this.value)}static load(e){let n=e.deserializeU32();return new r(n)}},to=class r extends rt{constructor(e){super();this.value=e}toString(){return`vector<${this.value.toString()}>`}serialize(e){e.serializeU32AsUleb128(6),this.value.serialize(e)}static load(e){let n=rt.deserialize(e);return new r(n)}},Gr=class r extends rt{constructor(e){super();this.value=e}toString(){let e="";return this.value.typeArgs.length>0&&(e=`<${this.value.typeArgs.map(n=>n.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${e}`}serialize(e){e.serializeU32AsUleb128(7),this.value.serialize(e)}static load(e){let n=hr.deserialize(e);return new r(n)}isTypeTag(e,n,o){return this.value.moduleName.identifier===n&&this.value.name.identifier===o&&this.value.address.equals(e)}isString(){return this.isTypeTag(H.ONE,"string","String")}isOption(){return this.isTypeTag(H.ONE,"option","Option")}isObject(){return this.isTypeTag(H.ONE,"object","Object")}},hr=class r extends ae{constructor(e,n,o,s){super();this.address=e,this.moduleName=n,this.name=o,this.typeArgs=s}serialize(e){e.serialize(this.address),e.serialize(this.moduleName),e.serialize(this.name),e.serializeVector(this.typeArgs)}static deserialize(e){let n=H.deserialize(e),o=Qe.deserialize(e),s=Qe.deserialize(e),i=e.deserializeVector(rt);return new r(n,o,s,i)}};function mh(){return new hr(H.ONE,new Qe("aptos_coin"),new Qe("AptosCoin"),[])}function yh(){return new hr(H.ONE,new Qe("string"),new Qe("String"),[])}function hh(r){return new hr(H.ONE,new Qe("option"),new Qe("Option"),[r])}function Ah(r){return new hr(H.ONE,new Qe("object"),new Qe("Object"),[r])}function Pl(r){let t=r.deserializeUleb128AsU32();switch(t){case 0:return lt.deserialize(r);case 1:return ft.deserialize(r);case 2:return Mt.deserialize(r);case 3:return H.deserialize(r);case 4:return Le.deserialize(r,lt);case 5:return Xe.deserialize(r);case 6:return zt.deserialize(r);case 7:return Dt.deserialize(r);case 8:return Gt.deserialize(r);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var gn=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Eo.load(t);case 2:return vo.load(t);case 3:return Co.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},Eo=class r extends gn{constructor(e){super();this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let n=Uo.deserialize(e);return new r(n)}},vo=class r extends gn{constructor(e){super();this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let n=ro.deserialize(e);return new r(n)}},Co=class r extends gn{constructor(e){super();this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let n=Io.deserialize(e);return new r(n)}},ro=class r{constructor(t,e,n,o){this.module_name=t,this.function_name=e,this.type_args=n,this.args=o}static build(t,e,n,o){return new r(So.fromStr(t),new Qe(e),n,o)}serialize(t){this.module_name.serialize(t),this.function_name.serialize(t),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForEntryFunction(t)})}static deserialize(t){let e=So.deserialize(t),n=Qe.deserialize(t),o=t.deserializeVector(rt),s=t.deserializeUleb128AsU32(),i=new Array;for(let c=0;c<s;c+=1){let f=t.deserializeUleb128AsU32(),l=Qo.deserialize(t,f);i.push(l)}return new r(e,n,o,i)}},Uo=class r{constructor(t,e,n){this.bytecode=t,this.type_args=e,this.args=n}serialize(t){t.serializeBytes(this.bytecode),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForScriptFunction(t)})}static deserialize(t){let e=t.deserializeBytes(),n=t.deserializeVector(rt),o=t.deserializeUleb128AsU32(),s=new Array;for(let i=0;i<o;i+=1){let c=Pl(t);s.push(c)}return new r(e,n,s)}},Io=class r{constructor(t,e){this.multisig_address=t,this.transaction_payload=e}serialize(t){this.multisig_address.serialize(t),this.transaction_payload===void 0?t.serializeBool(!1):(t.serializeBool(!0),this.transaction_payload.serialize(t))}static deserialize(t){let e=H.deserialize(t),n=t.deserializeBool(),o;return n&&(o=Bo.deserialize(t)),new r(e,o)}},Bo=class r extends ae{constructor(e){super();this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new r(ro.deserialize(e))}};var Vt=class r extends ae{constructor(e,n,o,s,i,c,f){super();this.sender=e,this.sequence_number=n,this.payload=o,this.max_gas_amount=s,this.gas_unit_price=i,this.expiration_timestamp_secs=c,this.chain_id=f}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let n=H.deserialize(e),o=e.deserializeU64(),s=gn.deserialize(e),i=e.deserializeU64(),c=e.deserializeU64(),f=e.deserializeU64(),l=$n.deserialize(e);return new r(n,o,s,i,c,f,l)}},ms=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Ar.load(t);case 1:return xr.load(t);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},Ar=class r extends ms{constructor(e,n){super();this.raw_txn=e,this.secondary_signer_addresses=n}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let n=Vt.deserialize(e),o=e.deserializeVector(H);return new r(n,o)}},xr=class r extends ms{constructor(e,n,o){super();this.raw_txn=e,this.secondary_signer_addresses=n,this.fee_payer_address=o}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(e)}static load(e){let n=Vt.deserialize(e),o=e.deserializeVector(H),s=H.deserialize(e);return new r(n,o,s)}};var ir=class r extends ae{constructor(e,n){super();this.raw_txn=e,this.authenticator=n}serialize(e){this.raw_txn.serialize(e),this.authenticator.serialize(e)}static deserialize(e){let n=Vt.deserialize(e),o=yr.deserialize(e);return new r(n,o)}};function Rl(r){return!!r.match(/^[_a-zA-Z0-9]+$/)}function Ol(r){return!!r.match(/\s/)}function xh(r){return!!r.match(/^T[0-9]+$/)}function bh(r,t){let e=t;for(;e<r.length;e+=1){let n=r[e];if(!Ol(n))break}return e}var Nl=(T=>(T.InvalidTypeTag="unknown type",T.UnexpectedGenericType="unexpected generic type",T.UnexpectedTypeArgumentClose="unexpected '>'",T.UnexpectedWhitespaceCharacter="unexpected whitespace character",T.UnexpectedComma="unexpected ','",T.TypeArgumentCountMismatch="type argument count doesn't match expected amount",T.MissingTypeArgumentClose="no matching '>' for '<'",T.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",T.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",T.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",T.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",T.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",T))(Nl||{}),He=class extends Error{constructor(t,e){super(`Failed to parse typeTag '${t}', ${e}`)}};function Po(r,t){let e=t?.allowGenerics??!1,n=[],o=[],s=[],i=0,c="",f=1;for(;i<r.length;){let l=r[i];if(l==="<")n.push({savedExpectedTypes:f,savedStr:c,savedTypes:s}),c="",s=[],f=1;else if(l===">"){if(c!==""){let b=Qi(c,o,e);s.push(b)}let h=n.pop();if(h===void 0)throw new He(r,"unexpected '>'");if(f!==s.length)throw new He(r,"type argument count doesn't match expected amount");let{savedStr:m,savedTypes:T,savedExpectedTypes:v}=h;o=s,s=T,c=m,f=v}else if(l===","){if(c.length!==0){let h=Qi(c,o,e);o=[],s.push(h),c="",f+=1}}else if(Ol(l)){let h=!1;if(c.length!==0){let T=Qi(c,o,e);o=[],s.push(T),c="",h=!0}i=bh(r,i);let m=r[i];if(i<r.length&&h&&m!==","&&m!==">")throw new He(r,"unexpected whitespace character");continue}else c+=l;i+=1}if(n.length>0)throw new He(r,"no matching '>' for '<'");switch(s.length){case 0:return Qi(c,o,e);case 1:if(c==="")return s[0];throw new He(r,"unexpected ','");default:throw new He(r,"unexpected whitespace character")}}function Qi(r,t,e){switch(r){case"&signer":if(t.length>0)throw new He(r,"primitive types not expected to have type arguments");return new gs(new pn);case"signer":if(t.length>0)throw new He(r,"primitive types not expected to have type arguments");return new pn;case"bool":if(t.length>0)throw new He(r,"primitive types not expected to have type arguments");return new Vn;case"address":if(t.length>0)throw new He(r,"primitive types not expected to have type arguments");return new Jn;case"u8":if(t.length>0)throw new He(r,"primitive types not expected to have type arguments");return new jn;case"u16":if(t.length>0)throw new He(r,"primitive types not expected to have type arguments");return new Qn;case"u32":if(t.length>0)throw new He(r,"primitive types not expected to have type arguments");return new Wn;case"u64":if(t.length>0)throw new He(r,"primitive types not expected to have type arguments");return new Yn;case"u128":if(t.length>0)throw new He(r,"primitive types not expected to have type arguments");return new Zn;case"u256":if(t.length>0)throw new He(r,"primitive types not expected to have type arguments");return new Xn;case"vector":if(t.length!==1)throw new He(r,"vector type expected to have exactly one type argument");return new to(t[0]);default:if(xh(r)){if(e)return new eo(Number(r.split("T")[1]));throw new He(r,"unexpected generic type")}if(!r.match(/.*:.*/))throw new He(r,"unknown type");let n=r.split("::");if(n.length!==3)throw new He(r,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");if(!Rl(n[1]))throw new He(r,"module name must only contain alphanumeric or '_' characters");if(!Rl(n[2]))throw new He(r,"struct name must only contain alphanumeric or '_' characters");return new Gr(new hr(H.fromString(n[0]),new Qe(n[1]),new Qe(n[2]),t))}}function du(r){return typeof r=="boolean"}function no(r){return typeof r=="string"}function ys(r){return typeof r=="number"}function hs(r){return typeof r=="number"||typeof r=="bigint"||typeof r=="string"}function lu(r){return r==null}function pu(r){return Wi(r)||Zi(r)||Xi(r)||Ji(r)||ea(r)||ta(r)||ra(r)||As(r)||Yi(r)||kl(r)||r instanceof Le||r instanceof Cr}function Wi(r){return r instanceof Xe}function As(r){return r instanceof H}function Yi(r){return r instanceof ht}function kl(r){return r instanceof $r}function Zi(r){return r instanceof lt}function Xi(r){return r instanceof zt}function Ji(r){return r instanceof Dt}function ea(r){return r instanceof ft}function ta(r){return r instanceof Mt}function ra(r){return r instanceof Gt}function na(r){return"bytecode"in r}function $e(r,t){throw new Error(`Type mismatch for argument ${t}, expected '${r}'`)}function gu(r){let t=r.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?r.params.length:t}function oa(r){let t=r.split("::");if(t.length!==3)throw new Error(`Invalid function ${r}`);let e=t[0],n=t[1],o=t[2];return{moduleAddress:e,moduleName:n,functionName:o}}var wh=new TextEncoder;function yu(r){return r?.map(t=>no(t)?Po(t):t)??[]}async function hu(r,t,e,n){let s=(await Ui({aptosConfig:n,accountAddress:r,moduleName:t})).abi?.exposed_functions.find(f=>f.name===e);if(!s)throw new Error(`Could not find entry function ABI for '${r}::${t}::${e}'`);if(!s.is_entry)throw new Error(`'${r}::${t}::${e}' is not an entry function`);let i=gu(s),c=[];for(let f=i;f<s.params.length;f+=1)c.push(Po(s.params[f],{allowGenerics:!0}));return{typeParameters:s.generic_type_params,parameters:c}}function Au(r,t,e,n,o){if(n>=t.parameters.length)throw new Error(`Too many arguments for '${r}', expected ${t.parameters.length}`);let s=t.parameters[n];return oo(e,s,n,o)}function oo(r,t,e,n){return pu(r)?(mu(t,r,e),r):Th(r,t,e,n)}function Th(r,t,e,n){if(t.isBool()){if(du(r))return new Xe(r);$e("boolean",e)}if(t.isAddress()){if(no(r))return H.fromString(r);$e("string | AccountAddress",e)}if(t.isU8()){if(ys(r))return new lt(r);$e("number",e)}if(t.isU16()){if(ys(r))return new zt(r);$e("number",e)}if(t.isU32()){if(ys(r))return new Dt(r);$e("number",e)}if(t.isU64()){if(hs(r))return new ft(BigInt(r));$e("bigint | number | string",e)}if(t.isU128()){if(hs(r))return new Mt(BigInt(r));$e("bigint | number | string",e)}if(t.isU256()){if(hs(r))return new Gt(BigInt(r));$e("bigint | number | string",e)}if(t.isGeneric()){let o=t.value;if(o<0||o>=n.length)throw new Error(`Generic argument ${t.toString()} is invalid for argument ${e}`);return oo(r,n[o],e,n)}if(t.isVector()){if(t.value.isU8()){if(no(r))return Le.U8(wh.encode(r));if(r instanceof Uint8Array)return Le.U8(r);if(r instanceof ArrayBuffer)return Le.U8(new Uint8Array(r))}if(Array.isArray(r))return new Le(r.map(o=>oo(o,t.value,e,n)));throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}if(t.isStruct()){if(t.isString()){if(no(r))return new ht(r);$e("string",e)}if(t.isObject()){if(no(r))return H.fromString(r);$e("string | AccountAddress",e)}if(t.isOption())return lu(r)?new Cr(null):new Cr(oo(r,t.value.typeArgs[0],e,n));throw new Error(`Unsupported struct input type for argument ${e}, type '${t.toString()}'`)}throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}function mu(r,t,e){if(r.isBool()){if(Wi(t))return;$e("Bool",e)}if(r.isAddress()){if(As(t))return;$e("AccountAddress",e)}if(r.isU8()){if(Zi(t))return;$e("U8",e)}if(r.isU16()){if(Xi(t))return;$e("U16",e)}if(r.isU32()){if(Ji(t))return;$e("U32",e)}if(r.isU64()){if(ea(t))return;$e("U64",e)}if(r.isU128()){if(ta(t))return;$e("U128",e)}if(r.isU256()){if(ra(t))return;$e("U256",e)}if(r.isVector()){if(t instanceof Le){t.values.length>0&&mu(r.value,t.values[0],e);return}$e("MoveVector",e)}if(r instanceof Gr){if(r.isString()){if(Yi(t))return;$e("MoveString",e)}if(r.isObject()){if(As(t))return;$e("AccountAddress",e)}if(r.isOption()){if(t instanceof Cr){t.value!==void 0&&mu(r.value.typeArgs[0],t.value,e);return}$e("MoveOption",e)}}throw new Error(`Type mismatch for argument ${e}, expected '${r.toString()}'`)}async function bs(r){if(na(r))return Dl(r);let{moduleAddress:t,moduleName:e,functionName:n}=oa(r.function),o=await ho(async()=>hu(t,e,n,r.aptosConfig),`entry-function-${r.aptosConfig.network}-${t}-${e}-${n}`,1e3*60*5)();return zl(r,o)}function zl(r,t){if(na(r))return Dl(r);let{moduleAddress:e,moduleName:n,functionName:o}=oa(r.function),s=yu(r.typeArguments);if(s.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${s.length}`);let i=r.functionArguments.map((f,l)=>Au(r.function,t,f,l,s));if(i.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${n}::${o}', expected ${t.parameters.length} but got ${i.length}`);let c=ro.build(`${e}::${n}`,o,s,i);if("multisigAddress"in r){let f=H.from(r.multisigAddress);return new Co(new Io(f,new Bo(c)))}return new vo(c)}function Dl(r){return new Eo(new Uo(Be.fromHexInput(r.bytecode).toUint8Array(),r.typeArguments??[],r.functionArguments))}async function Ml(r){let{aptosConfig:t,sender:e,payload:n,options:o}=r,s=o?.accountSequenceNumber!==void 0?Promise.resolve({sequence_number:o.accountSequenceNumber}):pr({aptosConfig:t,accountAddress:e}),i=Hs[t.network]?Promise.resolve({chain_id:Hs[t.network]}):Si({aptosConfig:t}),c=o?.gasUnitPrice?Promise.resolve({gas_estimate:o.gasUnitPrice}):Bi({aptosConfig:t}),[{sequence_number:f},{chain_id:l},{gas_estimate:h}]=await Promise.all([s,i,c]),{maxGasAmount:m,gasUnitPrice:T,expireTimestamp:v}={maxGasAmount:o?.maxGasAmount?BigInt(o.maxGasAmount):BigInt(Na),gasUnitPrice:BigInt(h),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+ka),...o};return new Vt(H.from(e),BigInt(f),n,BigInt(m),BigInt(T),BigInt(v),new $n(l))}async function sa(r){let{aptosConfig:t,sender:e,payload:n,options:o}=r,s=await Ml({aptosConfig:t,sender:e,payload:n,options:o});if("secondarySignerAddresses"in r){let i=r.secondarySignerAddresses?.map(c=>H.from(c))??[];return{rawTransaction:s,secondarySignerAddresses:i,feePayerAddress:r.feePayerAddress?H.from(r.feePayerAddress):void 0}}return{rawTransaction:s,feePayerAddress:r.feePayerAddress?H.from(r.feePayerAddress):void 0}}function xu(r){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:n,feePayerPublicKey:o}=r,s=xs(t);if(e.feePayerAddress){let c=new xr(e.rawTransaction,e.secondarySignerAddresses??[],e.feePayerAddress),f=[];n&&(f=n.map(m=>xs(m)));let l=xs(o),h=new Hn(s,e.secondarySignerAddresses??[],f,{address:e.feePayerAddress,authenticator:l});return new ir(c.raw_txn,h).bcsToBytes()}if(e.secondarySignerAddresses){let c=new Ar(e.rawTransaction,e.secondarySignerAddresses),f=[];f=n.map(h=>xs(h));let l=new Kn(s,e.secondarySignerAddresses,f);return new ir(c.raw_txn,l).bcsToBytes()}let i;if(s instanceof mr)i=new qn(s.public_key,s.signature);else if(s instanceof sr)i=new Fn(s);else throw new Error("Invalid public key");return new ir(e.rawTransaction,i).bcsToBytes()}function xs(r){if(r instanceof je){if(r.publicKey instanceof qe)return new sr(r,new lr(new Je(new Uint8Array(64))));if(r.publicKey instanceof Ft)return new sr(r,new lr(new kr(new Uint8Array(64))))}return new mr(new qe(r.toUint8Array()),new Je(new Uint8Array(64)))}function bu(r){let{signer:t,transaction:e}=r,n=ia(e),o=t.sign(n);switch(t.signingScheme){case 0:return new mr(new qe(t.publicKey.toUint8Array()),new Je(o.toUint8Array()));case 2:if(!je.isPublicKey(t.publicKey))throw new Error(`Cannot sign transaction, public key does not match ${t.signingScheme}`);return new sr(t.publicKey,new lr(o));default:throw new Error(`Cannot sign transaction, signing scheme ${t.signingScheme} not supported`)}}function wu(r){let{transaction:t,senderAuthenticator:e,feePayerAuthenticator:n,additionalSignersAuthenticators:o}=r,s=Tu(t);if((n||o)&&(s instanceof Ar||s instanceof xr))return Gl(s,e,n,o);if(e instanceof mr&&s instanceof Vt){let i=new qn(e.public_key,e.signature);return new ir(s,i).bcsToBytes()}if((e instanceof sr||e instanceof Ln)&&s instanceof Vt){let i=new Fn(e);return new ir(s,i).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${e} is not a supported account authentication scheme`)}function Tu(r){return r.feePayerAddress?new xr(r.rawTransaction,r.secondarySignerAddresses??[],r.feePayerAddress):r.secondarySignerAddresses?new Ar(r.rawTransaction,r.secondarySignerAddresses):r.rawTransaction}function Gl(r,t,e,n){if(r instanceof xr){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let o=new Hn(t,r.secondary_signer_addresses,n??[],{address:r.fee_payer_address,authenticator:e});return new ir(r.raw_txn,o).bcsToBytes()}if(r instanceof Ar){if(!n)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let o=new Kn(t,r.secondary_signer_addresses,n??[]);return new ir(r.raw_txn,o).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof r} transaction is not supported`)}function ia(r){let t=Tu(r),e=Cn.create();if(t instanceof Vt)e.update(za);else if(t instanceof Ar)e.update(Fs);else if(t instanceof xr)e.update(Fs);else throw new Error(`Unknown transaction type to sign on: ${t}`);let n=e.digest(),o=t.bcsToBytes(),s=new Uint8Array(n.length+o.length);return s.set(n),s.set(o,n.length),s}async function Pe(r){let t=await _h(r);return Sh(r,t)}async function _h(r){let{aptosConfig:t,data:e}=r,n,o;return"bytecode"in e?(n=e,o=await bs(n)):"multisigAddress"in e?(n={aptosConfig:t,multisigAddress:e.multisigAddress,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments},o=await bs(n)):(n={aptosConfig:t,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments},o=await bs(n)),o}async function Sh(r,t){let{aptosConfig:e,sender:n,options:o}=r,s;if(Eh(r)&&(s=H.ZERO.toString()),vh(r)){let{secondarySignerAddresses:i}=r;return sa({aptosConfig:e,sender:n,payload:t,options:o,secondarySignerAddresses:i,feePayerAddress:s})}return sa({aptosConfig:e,sender:n,payload:t,options:o,feePayerAddress:s})}function Eh(r){return r.withFeePayer===!0}function vh(r){return"secondarySignerAddresses"in r}function Ll(r){let{transaction:t}=r;return ia(t)}function aa(r){return bu({...r})}async function _u(r){let{aptosConfig:t,transaction:e,signerPublicKey:n,secondarySignersPublicKeys:o,feePayerPublicKey:s,options:i}=r,c=xu({transaction:e,signerPublicKey:n,secondarySignersPublicKeys:o,feePayerPublicKey:s,options:i}),{data:f}=await Tn({aptosConfig:t,body:c,path:"transactions/simulate",params:{estimate_gas_unit_price:r.options?.estimateGasUnitPrice??!1,estimate_max_gas_amount:r.options?.estimateMaxGasAmount??!1,estimate_prioritized_gas_unit_price:r.options?.estimatePrioritizedGasUnitPrice??!1},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return f}async function ca(r){let{aptosConfig:t}=r,e=wu({...r}),{data:n}=await Tn({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return n}async function ws(r){let{aptosConfig:t,signer:e,transaction:n}=r,o=aa({signer:e,transaction:n});return ca({aptosConfig:t,transaction:n,senderAuthenticator:o})}async function ql(r){let{aptosConfig:t,account:e,metadataBytes:n,moduleBytecode:o,options:s}=r,i=o.map(f=>Le.U8(f));return await Pe({aptosConfig:t,sender:H.from(e),data:{function:"0x1::code::publish_package_txn",functionArguments:[Le.U8(n),new Le(i)]},options:s})}async function Kl(r){let{aptosConfig:t,fromAccount:e,toNewPrivateKey:n}=r,o=await pr({aptosConfig:t,accountAddress:e.accountAddress}),s=Dr.fromPrivateKey({privateKey:n,legacy:!0}),c=new ls({sequenceNumber:BigInt(o.sequence_number),originator:e.accountAddress,currentAuthKey:H.from(o.authentication_key),newPublicKey:s.publicKey}).bcsToBytes(),f=e.sign(c),l=s.sign(c),h=await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new lt(e.signingScheme.valueOf()),Le.U8(e.publicKey.toUint8Array()),new lt(s.signingScheme.valueOf()),Le.U8(s.publicKey.toUint8Array()),Le.U8(f.toUint8Array()),Le.U8(l.toUint8Array())]}});return await ws({aptosConfig:t,signer:e,transaction:h})}async function Hl(r){let{aptosConfig:t,sender:e,recipient:n,amount:o,coinType:s,options:i}=r;return await Pe({aptosConfig:t,sender:e,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[s??$o],functionArguments:[n,o]},options:i})}var Ts=class{constructor(t){this.config=t}async transferCoinTransaction(t){return Hl({aptosConfig:this.config,...t})}};var mn={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},jt="0x4::token::Token";async function Fl(r){let{aptosConfig:t,digitalAssetAddress:e}=r,n={token_data_id:{_eq:H.from(e).toStringLong()}};return(await Ee({aptosConfig:t,query:{query:Ud,variables:{where_condition:n}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function $l(r){let{aptosConfig:t,digitalAssetAddress:e}=r,n={token_data_id:{_eq:H.from(e).toStringLong()}};return(await Ee({aptosConfig:t,query:{query:Mc,variables:{where_condition:n}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function Vl(r){let{aptosConfig:t,ownerAddress:e,options:n}=r,o={owner_address:{_eq:H.from(e).toStringLong()},amount:{_gt:0}},s={query:Mc,variables:{where_condition:o,offset:n?.offset,limit:n?.limit,order_by:n?.orderBy}};return(await Ee({aptosConfig:t,query:s,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function jl(r){let{aptosConfig:t,digitalAssetAddress:e,options:n}=r,o={token_data_id:{_eq:H.from(e).toStringLong()}},s={query:Cd,variables:{where_condition:o,offset:n?.offset,limit:n?.limit,order_by:n?.orderBy}};return(await Ee({aptosConfig:t,query:s,originMethod:"getDigitalAssetActivity"})).token_activities_v2}async function Ql(r){let{aptosConfig:t,options:e,creator:n}=r;return await Pe({aptosConfig:t,sender:n.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new ht(r.description),new ft(r.maxSupply??En),new ht(r.name),new ht(r.uri),new Xe(r.mutableDescription??!0),new Xe(r.mutableRoyalty??!0),new Xe(r.mutableURI??!0),new Xe(r.mutableTokenDescription??!0),new Xe(r.mutableTokenName??!0),new Xe(r.mutableTokenProperties??!0),new Xe(r.mutableTokenURI??!0),new Xe(r.tokensBurnableByCreator??!0),new Xe(r.tokensFreezableByCreator??!0),new ft(r.royaltyNumerator??0),new ft(r.royaltyDenominator??1)]},options:e})}async function Su(r){let{aptosConfig:t,creatorAddress:e,collectionName:n,options:o}=r,s=H.from(e),i={collection_name:{_eq:n},creator_address:{_eq:s.toStringLong()}};return o?.tokenStandard&&(i.token_standard={_eq:o?.tokenStandard??"v2"}),(await Ee({aptosConfig:t,query:{query:wd,variables:{where_condition:i}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function Wl(r){return(await Su(r)).collection_id}async function Yl(r){let{aptosConfig:t,options:e,creator:n,collection:o,description:s,name:i,uri:c,propertyKeys:f,propertyTypes:l,propertyValues:h}=r,m=l?.map(v=>mn[v]);return await Pe({aptosConfig:t,sender:n.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[o,s,i,c,f??[],m??[],fp(h??[],m??[])]},options:e})}async function Zl(r){let{aptosConfig:t,sender:e,digitalAssetAddress:n,recipient:o,digitalAssetType:s,options:i}=r;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[s??jt],functionArguments:[n,o]},options:i})}async function Xl(r){let{aptosConfig:t,account:e,collection:n,description:o,name:s,uri:i,recipient:c,propertyKeys:f,propertyTypes:l,propertyValues:h,options:m}=r;if(f?.length!==h?.length)throw new Error("Property keys and property values counts do not match");if(l?.length!==h?.length)throw new Error("Property types and property values counts do not match");let T=l?.map(b=>mn[b]);return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[n,o,s,i,f??[],T??[],fp(h??[],T??[]),c]},options:m})}async function Jl(r){let{aptosConfig:t,creator:e,digitalAssetAddress:n,digitalAssetType:o,options:s}=r;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[o??jt],functionArguments:[n]},options:s})}async function ep(r){let{aptosConfig:t,creator:e,digitalAssetAddress:n,digitalAssetType:o,options:s}=r;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[o??jt],functionArguments:[n]},options:s})}async function tp(r){let{aptosConfig:t,creator:e,digitalAssetAddress:n,digitalAssetType:o,options:s}=r;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[o??jt],functionArguments:[n]},options:s})}async function rp(r){let{aptosConfig:t,creator:e,description:n,digitalAssetAddress:o,digitalAssetType:s,options:i}=r;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[s??jt],functionArguments:[o,n]},options:i})}async function np(r){let{aptosConfig:t,creator:e,name:n,digitalAssetAddress:o,digitalAssetType:s,options:i}=r;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[s??jt],functionArguments:[o,n]},options:i})}async function op(r){let{aptosConfig:t,creator:e,uri:n,digitalAssetAddress:o,digitalAssetType:s,options:i}=r;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[s??jt],functionArguments:[o,n]},options:i})}async function sp(r){let{aptosConfig:t,creator:e,propertyKey:n,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:c,options:f}=r;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[c??jt],functionArguments:[i,n,mn[o],Eu(s,mn[o])]},options:f})}async function ip(r){let{aptosConfig:t,creator:e,propertyKey:n,digitalAssetAddress:o,digitalAssetType:s,options:i}=r;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[s??jt],functionArguments:[o,n]},options:i})}async function ap(r){let{aptosConfig:t,creator:e,propertyKey:n,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:c,options:f}=r;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[c??jt],functionArguments:[i,n,mn[o],Eu(s,mn[o])]},options:f})}async function cp(r){let{aptosConfig:t,creator:e,propertyKey:n,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:c,options:f}=r;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[c??jt,mn[o]],functionArguments:[i,n,s]},options:f})}async function up(r){let{aptosConfig:t,creator:e,propertyKey:n,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:c,options:f}=r;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[c??jt,mn[o]],functionArguments:[i,n,s]},options:f})}function fp(r,t){let e=new Array;return t.forEach((n,o)=>{e.push(Eu(r[o],n))}),e}function Eu(r,t){let e=Po(t);return oo(r,e,0,[]).bcsToBytes()}var _s=class{constructor(t){this.config=t}async getCollectionData(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Su({aptosConfig:this.config,...t})}async getCollectionId(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Wl({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Fl({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),$l({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Vl({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),jl({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return Ql({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return Yl({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return Zl({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return Xl({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return Jl({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return ep({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return tp({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return rp({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return np({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return op({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return sp({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return ip({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return ap({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return cp({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return up({aptosConfig:this.config,...t})}};async function dp(r){let{accountAddress:t,aptosConfig:e,creationNumber:n}=r,s={account_address:{_eq:H.from(t).toStringLong()},creation_number:{_eq:n}};return ua({aptosConfig:e,options:{where:s}})}async function lp(r){let{accountAddress:t,aptosConfig:e,eventType:n,options:o}=r,c={where:{account_address:{_eq:H.from(t).toStringLong()},indexed_type:{_eq:n}},pagination:o,orderBy:o?.orderBy};return ua({aptosConfig:e,options:c})}async function ua(r){let{aptosConfig:t,options:e}=r,n={query:Sd,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await Ee({aptosConfig:t,query:n,originMethod:"getEvents"})).events}var Ss=class{constructor(t){this.config=t}async getAccountEventsByCreationNumber(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),dp({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),lp({aptosConfig:this.config,...t})}async getEvents(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"events_processor"}),ua({aptosConfig:this.config,...t})}};async function pp(r){let{aptosConfig:t,accountAddress:e,amount:n,options:o}=r,s=o?.timeoutSecs||Fo,{data:i}=await Ga({aptosConfig:t,path:"fund",body:{address:H.from(e).toString(),amount:n},originMethod:"fundAccount"}),c=i.txn_hashes[0],f=await Ao({aptosConfig:t,transactionHash:c,options:{timeoutSecs:s,checkSuccess:o?.checkSuccess}});if(f.type==="user_transaction")return f;throw new Error(`Unexpected transaction received for fund account: ${f.type}`)}var Es=class{constructor(t){this.config=t}async fundAccount(t){let e=await pp({aptosConfig:this.config,...t});return t.options?.waitForIndexer!==!1&&await Ri({aptosConfig:this.config,minimumLedgerVersion:BigInt(e.version)}),e}};async function vu(r){let{aptosConfig:t,options:e}=r,n={query:vd,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await Ee({aptosConfig:t,query:n,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function gp(r){let{aptosConfig:t,options:e}=r,n={query:Ed,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await Ee({aptosConfig:t,query:n,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function mp(r){let{aptosConfig:t,options:e}=r,n={query:Td,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await Ee({aptosConfig:t,query:n,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}async function yp(r){let{aptosConfig:t,sender:e,fungibleAssetMetadataAddress:n,recipient:o,amount:s,options:i}=r;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[n,o,s]},options:i})}var vs=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),vu({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),(await vu({aptosConfig:this.config,options:{where:{asset_type:{_eq:t.assetType}}}}))[0]}async getFungibleAssetActivities(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),gp({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),mp({aptosConfig:this.config,...t})}async transferFungibleAsset(t){return yp({aptosConfig:this.config,...t})}};var Cs=class{constructor(t){this.config=t}async getLedgerInfo(){return Si({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(t){return Id({aptosConfig:this.config,...t})}async getBlockByHeight(t){return Bd({aptosConfig:this.config,...t})}async getTableItem(t){return Ei({aptosConfig:this.config,...t})}async view(t){return cn({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return Pd({aptosConfig:this.config,...t})}async queryIndexer(t){return Ee({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return vi({aptosConfig:this.config})}async getProcessorStatus(t){return Ci({aptosConfig:this.config,processorType:t})}};var hp=["A name must be between 3 and 63 characters long,","and can only contain lowercase a-z, 0-9, and hyphens.","A name may not start or end with a hyphen."].join(" ");function Ap(r){return!(!r||r.length<3||r.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(r))}function yn(r){let[t,e,...n]=r.replace(/\.apt$/,"").split(".");if(n.length>0)throw new Error(`${r} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!Ap(t))throw new Error(`${t} is not valid. ${hp}`);if(e&&!Ap(e))throw new Error(`${e} is not valid. ${hp}`);return{domainName:e||t,subdomainName:e?t:void 0}}var Ch="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",Uh={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:Ch,custom:null,devnet:null};function Lr(r){let t=Uh[r.network];if(!t)throw new Error(`The ANS contract is not deployed to ${r.network}`);return t}var Ih=r=>({vec:[r]}),Bh=()=>({vec:[]}),Cu=r=>r!=null?Ih(r):Bh(),fa=r=>{if(r&&typeof r=="object"&&"vec"in r&&Array.isArray(r.vec))return r.vec[0]};async function xp(r){let{aptosConfig:t,name:e}=r,n=Lr(t),{domainName:o,subdomainName:s}=yn(e),i=await cn({aptosConfig:t,payload:{function:`${n}::router::get_owner_addr`,functionArguments:[o,Cu(s)]}}),c=fa(i[0]);return c?H.from(c).toString():void 0}async function bp(r){let{aptosConfig:t,expiration:e,name:n,sender:o,targetAddress:s,toAddress:i,options:c,transferable:f}=r,l=Lr(t),{domainName:h,subdomainName:m}=yn(n),T=e.policy==="subdomain:independent"||e.policy==="subdomain:follow-domain";if(m&&!T)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(T&&!m)throw new Error(`Policy is set to ${e.policy} but no subdomain was provided`);if(e.policy==="domain"){let w=e.years??1;if(w!==1)throw new Error("For now, names can only be registered for 1 year at a time");let k=w*31536e3;return await Pe({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${l}::router::register_domain`,functionArguments:[h,k,s,i]},options:c})}if(!m)throw new Error(`${e.policy} requires a subdomain to be provided.`);let v=await Uu({aptosConfig:t,name:h});if(!v)throw new Error("The domain does not exist");let b=e.policy==="subdomain:independent"?e.expirationDate:v;if(b>v)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await Pe({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${l}::router::register_subdomain`,functionArguments:[h,m,Math.round(b/1e3),e.policy==="subdomain:follow-domain"?1:0,!!f,s,i]},options:c})}async function Uu(r){let{aptosConfig:t,name:e}=r,n=Lr(t),{domainName:o,subdomainName:s}=yn(e);try{let i=await cn({aptosConfig:t,payload:{function:`${n}::router::get_expiration`,functionArguments:[o,Cu(s)]}});return Number(i[0])*1e3}catch{return}}async function wp(r){let{aptosConfig:t,address:e}=r,n=Lr(t),o=await cn({aptosConfig:t,payload:{function:`${n}::router::get_primary_name`,functionArguments:[H.from(e).toString()]}}),s=fa(o[1]),i=fa(o[0]);if(s)return[i,s].filter(Boolean).join(".")}async function Tp(r){let{aptosConfig:t,sender:e,name:n,options:o}=r,s=Lr(t);if(!n)return await Pe({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::clear_primary_name`,functionArguments:[]},options:o});let{domainName:i,subdomainName:c}=yn(n);return await Pe({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::set_primary_name`,functionArguments:[i,c]},options:o})}async function _p(r){let{aptosConfig:t,name:e}=r,n=Lr(t),{domainName:o,subdomainName:s}=yn(e),i=await cn({aptosConfig:t,payload:{function:`${n}::router::get_target_addr`,functionArguments:[o,Cu(s)]}}),c=fa(i[0]);return c?H.from(c).toString():void 0}async function Sp(r){let{aptosConfig:t,sender:e,name:n,address:o,options:s}=r,i=Lr(t),{domainName:c,subdomainName:f}=yn(n);return await Pe({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${i}::router::set_target_addr`,functionArguments:[c,f,o]},options:s})}async function Ep(r){let{aptosConfig:t,name:e}=r,{domainName:n,subdomainName:o=""}=yn(e),c=(await Ee({aptosConfig:t,query:{query:yo,variables:{where_condition:{domain:{_eq:n},subdomain:{_eq:o}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return c&&(c=Us(c)),c}async function vp(r){let{aptosConfig:t,options:e,accountAddress:n}=r,o=await Iu({aptosConfig:t});return(await Ee({aptosConfig:t,originMethod:"getAccountNames",query:{query:yo,variables:{limit:e?.limit,offset:e?.offset,order_by:e?.orderBy,where_condition:{...r.options?.where??{},owner_address:{_eq:n.toString()},expiration_timestamp:{_gte:o}}}}})).current_aptos_names.map(Us)}async function Cp(r){let{aptosConfig:t,options:e,accountAddress:n}=r,o=await Iu({aptosConfig:t});return(await Ee({aptosConfig:t,originMethod:"getAccountDomains",query:{query:yo,variables:{limit:e?.limit,offset:e?.offset,order_by:e?.orderBy,where_condition:{...r.options?.where??{},owner_address:{_eq:n.toString()},expiration_timestamp:{_gte:o},subdomain:{_eq:""}}}}})).current_aptos_names.map(Us)}async function Up(r){let{aptosConfig:t,options:e,accountAddress:n}=r,o=await Iu({aptosConfig:t});return(await Ee({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:yo,variables:{limit:e?.limit,offset:e?.offset,order_by:e?.orderBy,where_condition:{...r.options?.where??{},owner_address:{_eq:n.toString()},expiration_timestamp:{_gte:o},subdomain:{_neq:""}}}}})).current_aptos_names.map(Us)}async function Ip(r){let{aptosConfig:t,options:e,domain:n}=r;return(await Ee({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:yo,variables:{limit:e?.limit,offset:e?.offset,order_by:e?.orderBy,where_condition:{...r.options?.where??{},domain:{_eq:n},subdomain:{_neq:""}}}}})).current_aptos_names.map(Us)}async function Iu(r){let{aptosConfig:t}=r,e=Lr(t),[n]=await cn({aptosConfig:t,payload:{function:`${e}::config::reregistration_grace_sec`,functionArguments:[]}}),o=n/60/60/24,s=()=>new Date;return new Date(s().setDate(s().getDate()-o)).toISOString()}async function Bp(r){let{aptosConfig:t,sender:e,name:n,years:o=1,options:s}=r,i=Lr(t),c=o*31536e3,{domainName:f,subdomainName:l}=yn(n);if(l)throw new Error("Subdomains cannot be renewed");if(o!==1)throw new Error("Currently, only 1 year renewals are supported");return await Pe({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${i}::router::renew_domain`,functionArguments:[f,c]},options:s})}function Us(r){return{...r,expiration_timestamp:new Date(r.expiration_timestamp).valueOf()}}var Is=class{constructor(t){this.config=t}async getOwnerAddress(t){return xp({aptosConfig:this.config,...t})}async getExpiration(t){return Uu({aptosConfig:this.config,...t})}async getTargetAddress(t){return _p({aptosConfig:this.config,...t})}async setTargetAddress(t){return Sp({aptosConfig:this.config,...t})}async getPrimaryName(t){return wp({aptosConfig:this.config,...t})}async setPrimaryName(t){return Tp({aptosConfig:this.config,...t})}async registerName(t){return bp({aptosConfig:this.config,...t})}async renewDomain(t){return Bp({aptosConfig:this.config,...t})}async getName(t){return Ep({aptosConfig:this.config,...t})}async getAccountNames(t){return vp({aptosConfig:this.config,...t})}async getAccountDomains(t){return Cp({aptosConfig:this.config,...t})}async getAccountSubdomains(t){return Up({aptosConfig:this.config,...t})}async getDomainSubdomains(t){return Ip({aptosConfig:this.config,...t})}};async function Pp(r){let{aptosConfig:t,poolAddress:e}=r,n=H.from(e).toStringLong(),s=await Ee({aptosConfig:t,query:{query:zc,variables:{where_condition:{pool_address:{_eq:n}}}}});return s.num_active_delegator_per_pool[0]?s.num_active_delegator_per_pool[0].num_active_delegator:0}async function Rp(r){let{aptosConfig:t,options:e}=r,n={query:zc,variables:{order_by:e?.orderBy}};return(await Ee({aptosConfig:t,query:n})).num_active_delegator_per_pool}async function Op(r){let{aptosConfig:t,delegatorAddress:e,poolAddress:n}=r,o={query:_d,variables:{delegatorAddress:H.from(e).toStringLong(),poolAddress:H.from(n).toStringLong()}};return(await Ee({aptosConfig:t,query:o})).delegated_staking_activities}var Bs=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"stake_processor"}),Pp({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"stake_processor"}),Rp({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"stake_processor"}),Op({aptosConfig:this.config,...t})}};var da=()=>Math.floor(Date.now()/1e3),Ps=class{constructor(t,e,n,o,s){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=t,this.account=e,this.maxWaitTime=n,this.maximumInFlight=o,this.sleepTime=s}async nextSequenceNumber(){for(;this.lock;)await un(this.sleepTime);this.lock=!0;let t=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let e=da();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await un(this.sleepTime),da()-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}t=this.currentNumber,this.currentNumber+=BigInt(1)}catch(e){console.error("error in getting next sequence number for this account",e)}finally{this.lock=!1}return t}async initialize(){let{sequence_number:t}=await pr({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await pr({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(t),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await un(this.sleepTime);this.lock=!0;try{await this.update();let t=da();for(;this.lastUncommintedNumber!==this.currentNumber;)da()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await un(this.sleepTime),await this.update())}catch(t){console.error("error in synchronizing this account sequence number with the one on chain",t)}finally{this.lock=!1}}}};var Ro=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(t){if(this.cancelled=!1,this.pendingDequeue.length>0){this.pendingDequeue.shift()?.resolve(t);return}this.queue.push(t)}async dequeue(){return this.queue.length>0?Promise.resolve(this.queue.shift()):new Promise((t,e)=>{this.pendingDequeue.push({resolve:t,reject:e})})}isEmpty(){return this.queue.length===0}cancel(){this.cancelled=!0,this.pendingDequeue.forEach(async({reject:t})=>{t(new Oo("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},Oo=class extends Error{};var Np="fulfilled",Rs=class{constructor(t,e,n=30,o=100,s=10){this.taskQueue=new Ro;this.transactionsQueue=new Ro;this.outstandingTransactions=new Ro;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=e,this.started=!1,this.accountSequnceNumber=new Ps(t,e,n,o,s)}async submitNextTransaction(){try{for(;;){if(this.transactionsQueue.isEmpty())return;let t=await this.accountSequnceNumber.nextSequenceNumber();if(t===null)return;let e=await this.generateNextTransaction(this.account,t);if(!e)return;let n=ws({aptosConfig:this.aptosConfig,transaction:e,signer:this.account});await this.outstandingTransactions.enqueue([n,t])}}catch(t){if(t instanceof Oo)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async processTransactions(){try{for(;;){let t=[],e=[],[n,o]=await this.outstandingTransactions.dequeue();for(t.push(n),e.push(o);!this.outstandingTransactions.isEmpty();)[n,o]=await this.outstandingTransactions.dequeue(),t.push(n),e.push(o);let s=await Promise.allSettled(t);for(let i=0;i<s.length&&i<e.length;i+=1){let c=s[i];o=e[i],c.status===Np?(this.sentTransactions.push([c.value.hash,o,null]),await this.checkTransaction(c,o)):this.sentTransactions.push([c.status,o,c.reason])}}}catch(t){if(t instanceof Oo)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,e){try{let n=[];n.push(Ao({aptosConfig:this.aptosConfig,transactionHash:t.value.hash}));let o=await Promise.allSettled(n);for(let s=0;s<o.length;s+=1){let i=o[s];i.status===Np?this.executedTransactions.push([i.value.hash,e,null]):this.executedTransactions.push([i.status,e,i.reason])}}catch(n){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${n}`)}}async push(t,e){await this.transactionsQueue.enqueue([t,e])}async generateNextTransaction(t,e){if(this.transactionsQueue.isEmpty())return;let[n,o]=await this.transactionsQueue.dequeue();return await Pe({aptosConfig:this.aptosConfig,sender:t.accountAddress,data:n,options:{...o,accountSequenceNumber:e}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(t){throw new Error(`Unable to start transaction batching: ${t}`)}}start(){if(this.started)throw new Error("worker has already started");this.started=!0,this.taskQueue.enqueue(()=>this.submitNextTransaction()),this.taskQueue.enqueue(()=>this.processTransactions()),this.run()}stop(){if(this.taskQueue.isCancelled())throw new Error("worker has already stopped");this.started=!1,this.taskQueue.cancel()}};var la=class{constructor(t){this.config=t}async simple(t){return Pe({aptosConfig:this.config,...t})}async multiAgent(t){return Pe({aptosConfig:this.config,...t})}};function Bu(r,t,e){let n=e.value;return e.value=async function(...o){let[s]=o;if(s.transaction.feePayerAddress&&!s.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return n.apply(this,o)},e}function Pu(r,t,e){let n=e.value;return e.value=async function(...o){let[s]=o;if(s.transaction.feePayerAddress&&!s.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return n.apply(this,o)},e}var No=class{constructor(t){this.config=t}async simple(t){return _u({aptosConfig:this.config,...t})}async multiAgent(t){return _u({aptosConfig:this.config,...t})}};Et([Pu],No.prototype,"simple",1),Et([Pu],No.prototype,"multiAgent",1);var ko=class{constructor(t){this.config=t}async simple(t){return ca({aptosConfig:this.config,...t})}async multiAgent(t){return ca({aptosConfig:this.config,...t})}};Et([Bu],ko.prototype,"simple",1),Et([Bu],ko.prototype,"multiAgent",1);var Os=class{constructor(t){this.config=t,this.build=new la(this.config),this.simulate=new No(this.config),this.submit=new ko(this.config)}async getTransactions(t){return Vd({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return jd({aptosConfig:this.config,...t})}async getTransactionByHash(t){return Pi({aptosConfig:this.config,...t})}async isPendingTransaction(t){return Qd({aptosConfig:this.config,...t})}async waitForTransaction(t){return Ao({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return Bi({aptosConfig:this.config})}getSigningMessage(t){return Ll(t)}async publishPackageTransaction(t){return ql({aptosConfig:this.config,...t})}async rotateAuthKey(t){return Kl({aptosConfig:this.config,...t})}sign(t){return aa({...t})}signAsFeePayer(t){let{signer:e,transaction:n}=t;if(!n.feePayerAddress)throw new Error(`Transaction ${n} is not a Fee Payer transaction`);return n.feePayerAddress=e.accountAddress,aa({signer:e,transaction:n})}async batchTransactionsForSingleAccount(t){try{let{sender:e,data:n,options:o}=t,s=new Rs(this.config,e);s.start();for(let i of n)await s.push(i,o)}catch(e){throw new Error(`failed to submit transactions with error: ${e}`)}}async signAndSubmitTransaction(t){let{signer:e,transaction:n}=t;return ws({aptosConfig:this.config,signer:e,transaction:n})}};var Nt=class{constructor(t){this.config=new ds(t),this.account=new ts(this.config),this.ans=new Is(this.config),this.coin=new Ts(this.config),this.digitalAsset=new _s(this.config),this.event=new Ss(this.config),this.faucet=new Es(this.config),this.fungibleAsset=new vs(this.config),this.general=new Cs(this.config),this.staking=new Bs(this.config),this.transaction=new Os(this.config)}};function br(r,t,e){Object.getOwnPropertyNames(t.prototype).forEach(n=>{let o=Object.getOwnPropertyDescriptor(t.prototype,n);o&&(o.value=function(...s){return this[e][n](...s)},Object.defineProperty(r.prototype,n,o))})}br(Nt,ts,"account");br(Nt,Is,"ans");br(Nt,Ts,"coin");br(Nt,_s,"digitalAsset");br(Nt,Ss,"event");br(Nt,Es,"faucet");br(Nt,vs,"fungibleAsset");br(Nt,Cs,"general");br(Nt,Bs,"staking");br(Nt,Os,"transaction");return Fp(Ph);})();
426
+ `;async function Ci(n){let{aptosConfig:t}=n,{data:e}=await Bt({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function Gd(n){let{aptosConfig:t,ledgerVersion:e,options:r}=n,{data:o}=await Bt({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:r?.withTransactions}});return o}async function Ld(n){let{aptosConfig:t,blockHeight:e,options:r}=n,{data:o}=await Bt({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:r?.withTransactions}});return o}async function Ui(n){let{aptosConfig:t,handle:e,data:r,options:o}=n;return(await Er({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:o?.ledgerVersion},body:r})).data}async function fr(n){let{aptosConfig:t,payload:e,options:r}=n,{data:o}=await Er({aptosConfig:t,originMethod:"view",path:"view",params:{ledger_version:r?.ledgerVersion},body:{function:e.function,type_arguments:e.typeArguments??[],arguments:e.functionArguments??[]}});return o}async function qd(n){let{aptosConfig:t,limit:e}=n;return(await Se({aptosConfig:t,query:{query:Bd,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function Se(n){let{aptosConfig:t,query:e,originMethod:r}=n,{data:o}=await $a({aptosConfig:t,originMethod:r??"queryIndexer",path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return o}async function vh(n){let{aptosConfig:t}=n;return(await Se({aptosConfig:t,query:{query:Hc},originMethod:"getProcessorStatuses"})).processor_status}async function Ii(n){let t=await vh({aptosConfig:n.aptosConfig});return BigInt(t[0].last_success_version)}async function Bi(n){let{aptosConfig:t,processorType:e}=n,r={processor:{_eq:e.valueOf()}};return(await Se({aptosConfig:t,query:{query:Hc,variables:{where_condition:r}},originMethod:"getProcessorStatus"})).processor_status[0]}var Vc=new Map;function xo(n,t,e){return async(...r)=>{if(Vc.has(t)){let{value:s,timestamp:i}=Vc.get(t);if(e===void 0||Date.now()-i<=e)return s}let o=await n(...r);return Vc.set(t,{value:o,timestamp:Date.now()}),o}}var mn=class n extends tn{constructor(e){super();this.signature=e}toUint8Array(){return this.signature.toUint8Array()}toString(){return this.signature.toString()}serialize(e){if(this.signature instanceof Je)e.serializeU32AsUleb128(0),this.signature.serialize(e);else if(this.signature instanceof Mn)e.serializeU32AsUleb128(1),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(Je.load(e));case 1:return new n(Mn.load(e));default:throw new Error(`Unknown variant index for AnySignature: ${r}`)}}};async function hn(n){let{aptosConfig:t,accountAddress:e}=n,{data:r}=await Bt({aptosConfig:t,originMethod:"getInfo",path:`accounts/${F.from(e).toString()}`});return r}async function Hd(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return _r({aptosConfig:t,originMethod:"getModules",path:`accounts/${F.from(e).toString()}/modules`,params:{ledger_version:r?.ledgerVersion,start:r?.offset,limit:r?.limit??1e3}})}async function Pi(n){return n.options?.ledgerVersion!==void 0?Kd(n):xo(async()=>Kd(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function Kd(n){let{aptosConfig:t,accountAddress:e,moduleName:r,options:o}=n,{data:s}=await Bt({aptosConfig:t,originMethod:"getModule",path:`accounts/${F.from(e).toString()}/module/${r}`,params:{ledger_version:o?.ledgerVersion}});return s}async function $d(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return _r({aptosConfig:t,originMethod:"getTransactions",path:`accounts/${F.from(e).toString()}/transactions`,params:{start:r?.offset,limit:r?.limit}})}async function Vd(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return _r({aptosConfig:t,originMethod:"getResources",path:`accounts/${F.from(e).toString()}/resources`,params:{ledger_version:r?.ledgerVersion,start:r?.offset,limit:r?.limit??999}})}async function jc(n){let{aptosConfig:t,accountAddress:e,resourceType:r,options:o}=n,{data:s}=await Bt({aptosConfig:t,originMethod:"getResource",path:`accounts/${F.from(e).toString()}/resource/${r}`,params:{ledger_version:o?.ledgerVersion}});return s.data}async function Wc(n){let{aptosConfig:t,authenticationKey:e,options:r}=n,o=await jc({aptosConfig:t,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:s}}=o,i=F.from(e);try{let c=await Ui({aptosConfig:t,handle:s,data:{key:i.toString(),key_type:"address",value_type:"address"},options:r});return F.from(c)}catch(c){if(c instanceof dn&&c.data.error_code==="table_item_not_found")return i;throw c}}async function jd(n){let{aptosConfig:t,accountAddress:e}=n,o={owner_address:{_eq:F.from(e).toStringLong()},amount:{_gt:0}},i=await Se({aptosConfig:t,query:{query:Ud,variables:{where_condition:o}},originMethod:"getAccountTokensCount"});return i.current_token_ownerships_v2_aggregate.aggregate?i.current_token_ownerships_v2_aggregate.aggregate.count:0}async function Wd(n){let{aptosConfig:t,accountAddress:e,options:r}=n,s={owner_address:{_eq:F.from(e).toStringLong()},amount:{_gt:0}};r?.tokenStandard&&(s.token_standard={_eq:r?.tokenStandard});let i={query:vd,variables:{where_condition:s,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await Se({aptosConfig:t,query:i,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Qd(n){let{aptosConfig:t,accountAddress:e,collectionAddress:r,options:o}=n,s=F.from(e).toStringLong(),i=F.from(r).toStringLong(),c={owner_address:{_eq:s},current_token_data:{collection_id:{_eq:i}},amount:{_gt:0}};o?.tokenStandard&&(c.token_standard={_eq:o?.tokenStandard});let u={query:Cd,variables:{where_condition:c,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await Se({aptosConfig:t,query:u,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function Yd(n){let{aptosConfig:t,accountAddress:e,options:r}=n,s={owner_address:{_eq:F.from(e).toStringLong()},amount:{_gt:0}};r?.tokenStandard&&(s.current_collection={token_standard:{_eq:r?.tokenStandard}});let i={query:Ed,variables:{where_condition:s,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await Se({aptosConfig:t,query:i,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function Zd(n){let{aptosConfig:t,accountAddress:e}=n,r=F.from(e).toStringLong(),s=await Se({aptosConfig:t,query:{query:Id,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return s.account_transactions_aggregate.aggregate?s.account_transactions_aggregate.aggregate.count:0}async function Xd(n){let{aptosConfig:t,accountAddress:e,coinType:r}=n,o=F.from(e).toStringLong(),s=await Qc({aptosConfig:t,accountAddress:o,options:{where:{asset_type:{_eq:r}}}});return s[0]?s[0].amount:0}async function Qc(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o=F.from(e).toStringLong(),s={...r?.where,owner_address:{_eq:o}},i={query:_d,variables:{where_condition:s,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await Se({aptosConfig:t,query:i,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Jd(n){let{aptosConfig:t,accountAddress:e}=n,r=F.from(e).toStringLong(),s=await Se({aptosConfig:t,query:{query:Td,variables:{address:r}},originMethod:"getAccountCoinsCount"});if(!s.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return s.current_fungible_asset_balances_aggregate.aggregate.count}async function el(n){let{aptosConfig:t,accountAddress:e,options:r}=n,s={owner_address:{_eq:F.from(e).toStringLong()}},i={query:Sd,variables:{where_condition:s,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await Se({aptosConfig:t,query:i,originMethod:"getAccountOwnedObjects"})).current_objects}async function tl(n){let{aptosConfig:t,privateKey:e}=n,r=new je(e.publicKey());if(e instanceof Dn){let s=an.fromPublicKeyAndScheme({publicKey:r,scheme:2}).derivedAddress();return Ln.fromPrivateKeyAndAddress({privateKey:e,address:s})}if(e instanceof Pn){let o=an.fromPublicKeyAndScheme({publicKey:r,scheme:2});if(await Fd({authKey:o,aptosConfig:t})){let u=o.derivedAddress();return Ln.fromPrivateKeyAndAddress({privateKey:e,address:u,legacy:!1})}let i=an.fromPublicKeyAndScheme({publicKey:r,scheme:0});if(await Fd({authKey:i,aptosConfig:t})){let u=i.derivedAddress();return Ln.fromPrivateKeyAndAddress({privateKey:e,address:u,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function Fd(n){let{aptosConfig:t,authKey:e}=n,r=await Wc({aptosConfig:t,authenticationKey:e.derivedAddress()});try{return await hn({aptosConfig:t,accountAddress:r}),!0}catch(o){if(o.status===404)return!1;throw new Error(`Error while looking for an account info ${r.toString()}`)}}async function dr(n){return new Promise(t=>{setTimeout(t,n)})}async function nl(n){let{aptosConfig:t,options:e}=n;return _r({aptosConfig:t,originMethod:"getTransactions",path:"transactions",params:{start:e?.offset,limit:e?.limit}})}async function Oi(n){let{aptosConfig:t}=n;return xo(async()=>{let{data:e}=await Bt({aptosConfig:t,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return e},`gas-price-${t.network}`,1e3*60*5)()}async function rl(n){let{aptosConfig:t,ledgerVersion:e}=n,{data:r}=await Bt({aptosConfig:t,originMethod:"getTransactionByVersion",path:`transactions/by_version/${e}`});return r}async function Ni(n){let{aptosConfig:t,transactionHash:e}=n,{data:r}=await Bt({aptosConfig:t,path:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash"});return r}async function ol(n){let{aptosConfig:t,transactionHash:e}=n;try{return(await Ni({aptosConfig:t,transactionHash:e})).type==="pending_transaction"}catch(r){if(r?.status===404)return!0;throw r}}async function bo(n){let{aptosConfig:t,transactionHash:e,options:r}=n,o=r?.timeoutSecs??Vo,s=r?.checkSuccess??!0,i=!0,c=0,u,d,h=200,g=1.5;for(;i&&!(c>=o);){try{if(u=await Ni({aptosConfig:t,transactionHash:e}),i=u.type==="pending_transaction",!i)break}catch(T){if(!(T instanceof dn)||(d=T,T.status!==404&&T.status>=400&&T.status<500))throw T}await dr(h),c+=h/1e3,h*=g}if(u===void 0)throw d||new Ri(`Fetching transaction ${e} failed and timed out after ${o} seconds`,u);if(u.type==="pending_transaction")throw new Ri(`Transaction ${e} timed out in pending state after ${o} seconds`,u);if(!s)return u;if(!u.success)throw new Yc(`Transaction ${e} failed with an error: ${u.vm_status}`,u);return u}async function ki(n){let{aptosConfig:t,processorType:e}=n,r=BigInt(n.minimumLedgerVersion),o=3e3,s=new Date().getTime(),i=BigInt(-1);for(;i<r;){if(new Date().getTime()-s>o)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(e===void 0?i=await Ii({aptosConfig:t}):i=(await Bi({aptosConfig:t,processorType:e})).last_success_version,i>=r)break;await dr(200)}}var Ri=class extends Error{constructor(e,r){super(e);this.lastSubmittedTransaction=r}},Yc=class extends Error{constructor(e,r){super(e);this.transaction=r}};async function ze(n){n.minimumLedgerVersion!==void 0&&await ki({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}var rs=class{constructor(t){this.config=t}async getAccountInfo(t){return hn({aptosConfig:this.config,...t})}async getAccountModules(t){return Hd({aptosConfig:this.config,...t})}async getAccountModule(t){return Pi({aptosConfig:this.config,...t})}async getAccountTransactions(t){return $d({aptosConfig:this.config,...t})}async getAccountResources(t){return Vd({aptosConfig:this.config,...t})}async getAccountResource(t){return jc({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return Wc({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),jd({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Wd({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Qd({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Yd({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),Zd({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Qc({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Jd({aptosConfig:this.config,...t})}async getAccountAPTAmount(t){return this.getAccountCoinAmount({coinType:jo,...t})}async getAccountCoinAmount(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Xd({aptosConfig:this.config,...t})}async getAccountOwnedObjects(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),el({aptosConfig:this.config,...t})}async deriveAccountFromPrivateKey(t){return tl({aptosConfig:this.config,...t})}};function os(n,t){return function(){return n.apply(t,arguments)}}var{toString:Ch}=Object.prototype,{getPrototypeOf:Jc}=Object,Di=(n=>t=>{let e=Ch.call(t);return n[e]||(n[e]=e.slice(8,-1).toLowerCase())})(Object.create(null)),yn=n=>(n=n.toLowerCase(),t=>Di(t)===n),Mi=n=>t=>typeof t===n,{isArray:wo}=Array,ss=Mi("undefined");function Uh(n){return n!==null&&!ss(n)&&n.constructor!==null&&!ss(n.constructor)&&jt(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}var al=yn("ArrayBuffer");function Ih(n){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(n):t=n&&n.buffer&&al(n.buffer),t}var Bh=Mi("string"),jt=Mi("function"),cl=Mi("number"),Gi=n=>n!==null&&typeof n=="object",Ph=n=>n===!0||n===!1,zi=n=>{if(Di(n)!=="object")return!1;let t=Jc(n);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},Rh=yn("Date"),Oh=yn("File"),Nh=yn("Blob"),kh=yn("FileList"),zh=n=>Gi(n)&&jt(n.pipe),Dh=n=>{let t;return n&&(typeof FormData=="function"&&n instanceof FormData||jt(n.append)&&((t=Di(n))==="formdata"||t==="object"&&jt(n.toString)&&n.toString()==="[object FormData]"))},Mh=yn("URLSearchParams"),Gh=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function is(n,t,{allOwnKeys:e=!1}={}){if(n===null||typeof n>"u")return;let r,o;if(typeof n!="object"&&(n=[n]),wo(n))for(r=0,o=n.length;r<o;r++)t.call(null,n[r],r,n);else{let s=e?Object.getOwnPropertyNames(n):Object.keys(n),i=s.length,c;for(r=0;r<i;r++)c=s[r],t.call(null,n[c],c,n)}}function ul(n,t){t=t.toLowerCase();let e=Object.keys(n),r=e.length,o;for(;r-- >0;)if(o=e[r],t===o.toLowerCase())return o;return null}var fl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,dl=n=>!ss(n)&&n!==fl;function Xc(){let{caseless:n}=dl(this)&&this||{},t={},e=(r,o)=>{let s=n&&ul(t,o)||o;zi(t[s])&&zi(r)?t[s]=Xc(t[s],r):zi(r)?t[s]=Xc({},r):wo(r)?t[s]=r.slice():t[s]=r};for(let r=0,o=arguments.length;r<o;r++)arguments[r]&&is(arguments[r],e);return t}var Lh=(n,t,e,{allOwnKeys:r}={})=>(is(t,(o,s)=>{e&&jt(o)?n[s]=os(o,e):n[s]=o},{allOwnKeys:r}),n),qh=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),Kh=(n,t,e,r)=>{n.prototype=Object.create(t.prototype,r),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:t.prototype}),e&&Object.assign(n.prototype,e)},Fh=(n,t,e,r)=>{let o,s,i,c={};if(t=t||{},n==null)return t;do{for(o=Object.getOwnPropertyNames(n),s=o.length;s-- >0;)i=o[s],(!r||r(i,n,t))&&!c[i]&&(t[i]=n[i],c[i]=!0);n=e!==!1&&Jc(n)}while(n&&(!e||e(n,t))&&n!==Object.prototype);return t},Hh=(n,t,e)=>{n=String(n),(e===void 0||e>n.length)&&(e=n.length),e-=t.length;let r=n.indexOf(t,e);return r!==-1&&r===e},$h=n=>{if(!n)return null;if(wo(n))return n;let t=n.length;if(!cl(t))return null;let e=new Array(t);for(;t-- >0;)e[t]=n[t];return e},Vh=(n=>t=>n&&t instanceof n)(typeof Uint8Array<"u"&&Jc(Uint8Array)),jh=(n,t)=>{let r=(n&&n[Symbol.iterator]).call(n),o;for(;(o=r.next())&&!o.done;){let s=o.value;t.call(n,s[0],s[1])}},Wh=(n,t)=>{let e,r=[];for(;(e=n.exec(t))!==null;)r.push(e);return r},Qh=yn("HTMLFormElement"),Yh=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,r,o){return r.toUpperCase()+o}),sl=(({hasOwnProperty:n})=>(t,e)=>n.call(t,e))(Object.prototype),Zh=yn("RegExp"),ll=(n,t)=>{let e=Object.getOwnPropertyDescriptors(n),r={};is(e,(o,s)=>{let i;(i=t(o,s,n))!==!1&&(r[s]=i||o)}),Object.defineProperties(n,r)},Xh=n=>{ll(n,(t,e)=>{if(jt(n)&&["arguments","caller","callee"].indexOf(e)!==-1)return!1;let r=n[e];if(jt(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+e+"'")})}})},Jh=(n,t)=>{let e={},r=o=>{o.forEach(s=>{e[s]=!0})};return wo(n)?r(n):r(String(n).split(t)),e},ey=()=>{},ty=(n,t)=>(n=+n,Number.isFinite(n)?n:t),Zc="abcdefghijklmnopqrstuvwxyz",il="0123456789",pl={DIGIT:il,ALPHA:Zc,ALPHA_DIGIT:Zc+Zc.toUpperCase()+il},ny=(n=16,t=pl.ALPHA_DIGIT)=>{let e="",{length:r}=t;for(;n--;)e+=t[Math.random()*r|0];return e};function ry(n){return!!(n&&jt(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}var oy=n=>{let t=new Array(10),e=(r,o)=>{if(Gi(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[o]=r;let s=wo(r)?[]:{};return is(r,(i,c)=>{let u=e(i,o+1);!ss(u)&&(s[c]=u)}),t[o]=void 0,s}}return r};return e(n,0)},sy=yn("AsyncFunction"),iy=n=>n&&(Gi(n)||jt(n))&&jt(n.then)&&jt(n.catch),I={isArray:wo,isArrayBuffer:al,isBuffer:Uh,isFormData:Dh,isArrayBufferView:Ih,isString:Bh,isNumber:cl,isBoolean:Ph,isObject:Gi,isPlainObject:zi,isUndefined:ss,isDate:Rh,isFile:Oh,isBlob:Nh,isRegExp:Zh,isFunction:jt,isStream:zh,isURLSearchParams:Mh,isTypedArray:Vh,isFileList:kh,forEach:is,merge:Xc,extend:Lh,trim:Gh,stripBOM:qh,inherits:Kh,toFlatObject:Fh,kindOf:Di,kindOfTest:yn,endsWith:Hh,toArray:$h,forEachEntry:jh,matchAll:Wh,isHTMLForm:Qh,hasOwnProperty:sl,hasOwnProp:sl,reduceDescriptors:ll,freezeMethods:Xh,toObjectSet:Jh,toCamelCase:Yh,noop:ey,toFiniteNumber:ty,findKey:ul,global:fl,isContextDefined:dl,ALPHABET:pl,generateString:ny,isSpecCompliantForm:ry,toJSONObject:oy,isAsyncFn:sy,isThenable:iy};function To(n,t,e,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",t&&(this.code=t),e&&(this.config=e),r&&(this.request=r),o&&(this.response=o)}I.inherits(To,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:I.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var gl=To.prototype,ml={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{ml[n]={value:n}});Object.defineProperties(To,ml);Object.defineProperty(gl,"isAxiosError",{value:!0});To.from=(n,t,e,r,o,s)=>{let i=Object.create(gl);return I.toFlatObject(n,i,function(u){return u!==Error.prototype},c=>c!=="isAxiosError"),To.call(i,n.message,t,e,r,o),i.cause=n,i.name=n.name,s&&Object.assign(i,s),i};var Ee=To;var Li=null;function eu(n){return I.isPlainObject(n)||I.isArray(n)}function yl(n){return I.endsWith(n,"[]")?n.slice(0,-2):n}function hl(n,t,e){return n?n.concat(t).map(function(o,s){return o=yl(o),!e&&s?"["+o+"]":o}).join(e?".":""):t}function ay(n){return I.isArray(n)&&!n.some(eu)}var cy=I.toFlatObject(I,{},null,function(t){return/^is[A-Z]/.test(t)});function uy(n,t,e){if(!I.isObject(n))throw new TypeError("target must be an object");t=t||new(Li||FormData),e=I.toFlatObject(e,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,w){return!I.isUndefined(w[y])});let r=e.metaTokens,o=e.visitor||h,s=e.dots,i=e.indexes,u=(e.Blob||typeof Blob<"u"&&Blob)&&I.isSpecCompliantForm(t);if(!I.isFunction(o))throw new TypeError("visitor must be a function");function d(b){if(b===null)return"";if(I.isDate(b))return b.toISOString();if(!u&&I.isBlob(b))throw new Ee("Blob is not supported. Use a Buffer instead.");return I.isArrayBuffer(b)||I.isTypedArray(b)?u&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function h(b,y,w){let v=b;if(b&&!w&&typeof b=="object"){if(I.endsWith(y,"{}"))y=r?y:y.slice(0,-2),b=JSON.stringify(b);else if(I.isArray(b)&&ay(b)||(I.isFileList(b)||I.endsWith(y,"[]"))&&(v=I.toArray(b)))return y=yl(y),v.forEach(function(P,$){!(I.isUndefined(P)||P===null)&&t.append(i===!0?hl([y],$,s):i===null?y:y+"[]",d(P))}),!1}return eu(b)?!0:(t.append(hl(w,y,s),d(b)),!1)}let g=[],T=Object.assign(cy,{defaultVisitor:h,convertValue:d,isVisitable:eu});function S(b,y){if(!I.isUndefined(b)){if(g.indexOf(b)!==-1)throw Error("Circular reference detected in "+y.join("."));g.push(b),I.forEach(b,function(v,k){(!(I.isUndefined(v)||v===null)&&o.call(t,v,I.isString(k)?k.trim():k,y,T))===!0&&S(v,y?y.concat(k):[k])}),g.pop()}}if(!I.isObject(n))throw new TypeError("data must be an object");return S(n),t}var lr=uy;function Al(n){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function xl(n,t){this._pairs=[],n&&lr(n,this,t)}var bl=xl.prototype;bl.append=function(t,e){this._pairs.push([t,e])};bl.toString=function(t){let e=t?function(r){return t.call(this,r,Al)}:Al;return this._pairs.map(function(o){return e(o[0])+"="+e(o[1])},"").join("&")};var qi=xl;function fy(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function as(n,t,e){if(!t)return n;let r=e&&e.encode||fy,o=e&&e.serialize,s;if(o?s=o(t,e):s=I.isURLSearchParams(t)?t.toString():new qi(t,e).toString(r),s){let i=n.indexOf("#");i!==-1&&(n=n.slice(0,i)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}var tu=class{constructor(){this.handlers=[]}use(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){I.forEach(this.handlers,function(r){r!==null&&t(r)})}},nu=tu;var Ki={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var wl=typeof URLSearchParams<"u"?URLSearchParams:qi;var Tl=typeof FormData<"u"?FormData:null;var _l=typeof Blob<"u"?Blob:null;var El={isBrowser:!0,classes:{URLSearchParams:wl,FormData:Tl,Blob:_l},protocols:["http","https","file","blob","url","data"]};var ru={};Ks(ru,{hasBrowserEnv:()=>Sl,hasStandardBrowserEnv:()=>dy,hasStandardBrowserWebWorkerEnv:()=>ly});var Sl=typeof window<"u"&&typeof document<"u",dy=(n=>Sl&&["ReactNative","NativeScript","NS"].indexOf(n)<0)(typeof navigator<"u"&&navigator.product),ly=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function";var _t={...ru,...El};function ou(n,t){return lr(n,new _t.classes.URLSearchParams,Object.assign({visitor:function(e,r,o,s){return _t.isNode&&I.isBuffer(e)?(this.append(r,e.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function py(n){return I.matchAll(/\w+|\[(\w*)]/g,n).map(t=>t[0]==="[]"?"":t[1]||t[0])}function gy(n){let t={},e=Object.keys(n),r,o=e.length,s;for(r=0;r<o;r++)s=e[r],t[s]=n[s];return t}function my(n){function t(e,r,o,s){let i=e[s++],c=Number.isFinite(+i),u=s>=e.length;return i=!i&&I.isArray(o)?o.length:i,u?(I.hasOwnProp(o,i)?o[i]=[o[i],r]:o[i]=r,!c):((!o[i]||!I.isObject(o[i]))&&(o[i]=[]),t(e,r,o[i],s)&&I.isArray(o[i])&&(o[i]=gy(o[i])),!c)}if(I.isFormData(n)&&I.isFunction(n.entries)){let e={};return I.forEachEntry(n,(r,o)=>{t(py(r),o,e,0)}),e}return null}var Fi=my;function hy(n,t,e){if(I.isString(n))try{return(t||JSON.parse)(n),I.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(e||JSON.stringify)(n)}var su={transitional:Ki,adapter:["xhr","http"],transformRequest:[function(t,e){let r=e.getContentType()||"",o=r.indexOf("application/json")>-1,s=I.isObject(t);if(s&&I.isHTMLForm(t)&&(t=new FormData(t)),I.isFormData(t))return o&&o?JSON.stringify(Fi(t)):t;if(I.isArrayBuffer(t)||I.isBuffer(t)||I.isStream(t)||I.isFile(t)||I.isBlob(t))return t;if(I.isArrayBufferView(t))return t.buffer;if(I.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return ou(t,this.formSerializer).toString();if((c=I.isFileList(t))||r.indexOf("multipart/form-data")>-1){let u=this.env&&this.env.FormData;return lr(c?{"files[]":t}:t,u&&new u,this.formSerializer)}}return s||o?(e.setContentType("application/json",!1),hy(t)):t}],transformResponse:[function(t){let e=this.transitional||su.transitional,r=e&&e.forcedJSONParsing,o=this.responseType==="json";if(t&&I.isString(t)&&(r&&!this.responseType||o)){let i=!(e&&e.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(c){if(i)throw c.name==="SyntaxError"?Ee.from(c,Ee.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:_t.classes.FormData,Blob:_t.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};I.forEach(["delete","get","head","post","put","patch"],n=>{su.headers[n]={}});var _o=su;var yy=I.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),vl=n=>{let t={},e,r,o;return n&&n.split(`
427
+ `).forEach(function(i){o=i.indexOf(":"),e=i.substring(0,o).trim().toLowerCase(),r=i.substring(o+1).trim(),!(!e||t[e]&&yy[e])&&(e==="set-cookie"?t[e]?t[e].push(r):t[e]=[r]:t[e]=t[e]?t[e]+", "+r:r)}),t};var Cl=Symbol("internals");function cs(n){return n&&String(n).trim().toLowerCase()}function Hi(n){return n===!1||n==null?n:I.isArray(n)?n.map(Hi):String(n)}function Ay(n){let t=Object.create(null),e=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=e.exec(n);)t[r[1]]=r[2];return t}var xy=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function iu(n,t,e,r,o){if(I.isFunction(r))return r.call(this,t,e);if(o&&(t=e),!!I.isString(t)){if(I.isString(r))return t.indexOf(r)!==-1;if(I.isRegExp(r))return r.test(t)}}function by(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,e,r)=>e.toUpperCase()+r)}function wy(n,t){let e=I.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(n,r+e,{value:function(o,s,i){return this[r].call(this,t,o,s,i)},configurable:!0})})}var Eo=class{constructor(t){t&&this.set(t)}set(t,e,r){let o=this;function s(c,u,d){let h=cs(u);if(!h)throw new Error("header name must be a non-empty string");let g=I.findKey(o,h);(!g||o[g]===void 0||d===!0||d===void 0&&o[g]!==!1)&&(o[g||u]=Hi(c))}let i=(c,u)=>I.forEach(c,(d,h)=>s(d,h,u));return I.isPlainObject(t)||t instanceof this.constructor?i(t,e):I.isString(t)&&(t=t.trim())&&!xy(t)?i(vl(t),e):t!=null&&s(e,t,r),this}get(t,e){if(t=cs(t),t){let r=I.findKey(this,t);if(r){let o=this[r];if(!e)return o;if(e===!0)return Ay(o);if(I.isFunction(e))return e.call(this,o,r);if(I.isRegExp(e))return e.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=cs(t),t){let r=I.findKey(this,t);return!!(r&&this[r]!==void 0&&(!e||iu(this,this[r],r,e)))}return!1}delete(t,e){let r=this,o=!1;function s(i){if(i=cs(i),i){let c=I.findKey(r,i);c&&(!e||iu(r,r[c],c,e))&&(delete r[c],o=!0)}}return I.isArray(t)?t.forEach(s):s(t),o}clear(t){let e=Object.keys(this),r=e.length,o=!1;for(;r--;){let s=e[r];(!t||iu(this,this[s],s,t,!0))&&(delete this[s],o=!0)}return o}normalize(t){let e=this,r={};return I.forEach(this,(o,s)=>{let i=I.findKey(r,s);if(i){e[i]=Hi(o),delete e[s];return}let c=t?by(s):String(s).trim();c!==s&&delete e[s],e[c]=Hi(o),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let e=Object.create(null);return I.forEach(this,(r,o)=>{r!=null&&r!==!1&&(e[o]=t&&I.isArray(r)?r.join(", "):r)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join(`
428
+ `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){let r=new this(t);return e.forEach(o=>r.set(o)),r}static accessor(t){let r=(this[Cl]=this[Cl]={accessors:{}}).accessors,o=this.prototype;function s(i){let c=cs(i);r[c]||(wy(o,i),r[c]=!0)}return I.isArray(t)?t.forEach(s):s(t),this}};Eo.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);I.reduceDescriptors(Eo.prototype,({value:n},t)=>{let e=t[0].toUpperCase()+t.slice(1);return{get:()=>n,set(r){this[e]=r}}});I.freezeMethods(Eo);var Et=Eo;function us(n,t){let e=this||_o,r=t||e,o=Et.from(r.headers),s=r.data;return I.forEach(n,function(c){s=c.call(e,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function fs(n){return!!(n&&n.__CANCEL__)}function Ul(n,t,e){Ee.call(this,n??"canceled",Ee.ERR_CANCELED,t,e),this.name="CanceledError"}I.inherits(Ul,Ee,{__CANCEL__:!0});var pr=Ul;function au(n,t,e){let r=e.config.validateStatus;!e.status||!r||r(e.status)?n(e):t(new Ee("Request failed with status code "+e.status,[Ee.ERR_BAD_REQUEST,Ee.ERR_BAD_RESPONSE][Math.floor(e.status/100)-4],e.config,e.request,e))}var Il=_t.hasStandardBrowserEnv?{write(n,t,e,r,o,s){let i=[n+"="+encodeURIComponent(t)];I.isNumber(e)&&i.push("expires="+new Date(e).toGMTString()),I.isString(r)&&i.push("path="+r),I.isString(o)&&i.push("domain="+o),s===!0&&i.push("secure"),document.cookie=i.join("; ")},read(n){let t=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function cu(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function uu(n,t){return t?n.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):n}function ds(n,t){return n&&!cu(t)?uu(n,t):t}var Bl=_t.hasStandardBrowserEnv?function(){let t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a"),r;function o(s){let i=s;return t&&(e.setAttribute("href",i),i=e.href),e.setAttribute("href",i),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:e.pathname.charAt(0)==="/"?e.pathname:"/"+e.pathname}}return r=o(window.location.href),function(i){let c=I.isString(i)?o(i):i;return c.protocol===r.protocol&&c.host===r.host}}():function(){return function(){return!0}}();function fu(n){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return t&&t[1]||""}function Ty(n,t){n=n||10;let e=new Array(n),r=new Array(n),o=0,s=0,i;return t=t!==void 0?t:1e3,function(u){let d=Date.now(),h=r[s];i||(i=d),e[o]=u,r[o]=d;let g=s,T=0;for(;g!==o;)T+=e[g++],g=g%n;if(o=(o+1)%n,o===s&&(s=(s+1)%n),d-i<t)return;let S=h&&d-h;return S?Math.round(T*1e3/S):void 0}}var Pl=Ty;function Rl(n,t){let e=0,r=Pl(50,250);return o=>{let s=o.loaded,i=o.lengthComputable?o.total:void 0,c=s-e,u=r(c),d=s<=i;e=s;let h={loaded:s,total:i,progress:i?s/i:void 0,bytes:c,rate:u||void 0,estimated:u&&i&&d?(i-s)/u:void 0,event:o};h[t?"download":"upload"]=!0,n(h)}}var _y=typeof XMLHttpRequest<"u",Ol=_y&&function(n){return new Promise(function(e,r){let o=n.data,s=Et.from(n.headers).normalize(),{responseType:i,withXSRFToken:c}=n,u;function d(){n.cancelToken&&n.cancelToken.unsubscribe(u),n.signal&&n.signal.removeEventListener("abort",u)}let h;if(I.isFormData(o)){if(_t.hasStandardBrowserEnv||_t.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((h=s.getContentType())!==!1){let[y,...w]=h?h.split(";").map(v=>v.trim()).filter(Boolean):[];s.setContentType([y||"multipart/form-data",...w].join("; "))}}let g=new XMLHttpRequest;if(n.auth){let y=n.auth.username||"",w=n.auth.password?unescape(encodeURIComponent(n.auth.password)):"";s.set("Authorization","Basic "+btoa(y+":"+w))}let T=ds(n.baseURL,n.url);g.open(n.method.toUpperCase(),as(T,n.params,n.paramsSerializer),!0),g.timeout=n.timeout;function S(){if(!g)return;let y=Et.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),v={data:!i||i==="text"||i==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:y,config:n,request:g};au(function(P){e(P),d()},function(P){r(P),d()},v),g=null}if("onloadend"in g?g.onloadend=S:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(S)},g.onabort=function(){g&&(r(new Ee("Request aborted",Ee.ECONNABORTED,n,g)),g=null)},g.onerror=function(){r(new Ee("Network Error",Ee.ERR_NETWORK,n,g)),g=null},g.ontimeout=function(){let w=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded",v=n.transitional||Ki;n.timeoutErrorMessage&&(w=n.timeoutErrorMessage),r(new Ee(w,v.clarifyTimeoutError?Ee.ETIMEDOUT:Ee.ECONNABORTED,n,g)),g=null},_t.hasStandardBrowserEnv&&(c&&I.isFunction(c)&&(c=c(n)),c||c!==!1&&Bl(T))){let y=n.xsrfHeaderName&&n.xsrfCookieName&&Il.read(n.xsrfCookieName);y&&s.set(n.xsrfHeaderName,y)}o===void 0&&s.setContentType(null),"setRequestHeader"in g&&I.forEach(s.toJSON(),function(w,v){g.setRequestHeader(v,w)}),I.isUndefined(n.withCredentials)||(g.withCredentials=!!n.withCredentials),i&&i!=="json"&&(g.responseType=n.responseType),typeof n.onDownloadProgress=="function"&&g.addEventListener("progress",Rl(n.onDownloadProgress,!0)),typeof n.onUploadProgress=="function"&&g.upload&&g.upload.addEventListener("progress",Rl(n.onUploadProgress)),(n.cancelToken||n.signal)&&(u=y=>{g&&(r(!y||y.type?new pr(null,n,g):y),g.abort(),g=null)},n.cancelToken&&n.cancelToken.subscribe(u),n.signal&&(n.signal.aborted?u():n.signal.addEventListener("abort",u)));let b=fu(T);if(b&&_t.protocols.indexOf(b)===-1){r(new Ee("Unsupported protocol "+b+":",Ee.ERR_BAD_REQUEST,n));return}g.send(o||null)})};var du={http:Li,xhr:Ol};I.forEach(du,(n,t)=>{if(n){try{Object.defineProperty(n,"name",{value:t})}catch{}Object.defineProperty(n,"adapterName",{value:t})}});var Nl=n=>`- ${n}`,Ey=n=>I.isFunction(n)||n===null||n===!1,$i={getAdapter:n=>{n=I.isArray(n)?n:[n];let{length:t}=n,e,r,o={};for(let s=0;s<t;s++){e=n[s];let i;if(r=e,!Ey(e)&&(r=du[(i=String(e)).toLowerCase()],r===void 0))throw new Ee(`Unknown adapter '${i}'`);if(r)break;o[i||"#"+s]=r}if(!r){let s=Object.entries(o).map(([c,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build")),i=t?s.length>1?`since :
429
+ `+s.map(Nl).join(`
430
+ `):" "+Nl(s[0]):"as no adapter specified";throw new Ee("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:du};function lu(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new pr(null,n)}function Vi(n){return lu(n),n.headers=Et.from(n.headers),n.data=us.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),$i.getAdapter(n.adapter||_o.adapter)(n).then(function(r){return lu(n),r.data=us.call(n,n.transformResponse,r),r.headers=Et.from(r.headers),r},function(r){return fs(r)||(lu(n),r&&r.response&&(r.response.data=us.call(n,n.transformResponse,r.response),r.response.headers=Et.from(r.response.headers))),Promise.reject(r)})}var kl=n=>n instanceof Et?n.toJSON():n;function qn(n,t){t=t||{};let e={};function r(d,h,g){return I.isPlainObject(d)&&I.isPlainObject(h)?I.merge.call({caseless:g},d,h):I.isPlainObject(h)?I.merge({},h):I.isArray(h)?h.slice():h}function o(d,h,g){if(I.isUndefined(h)){if(!I.isUndefined(d))return r(void 0,d,g)}else return r(d,h,g)}function s(d,h){if(!I.isUndefined(h))return r(void 0,h)}function i(d,h){if(I.isUndefined(h)){if(!I.isUndefined(d))return r(void 0,d)}else return r(void 0,h)}function c(d,h,g){if(g in t)return r(d,h);if(g in n)return r(void 0,d)}let u={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(d,h)=>o(kl(d),kl(h),!0)};return I.forEach(Object.keys(Object.assign({},n,t)),function(h){let g=u[h]||o,T=g(n[h],t[h],h);I.isUndefined(T)&&g!==c||(e[h]=T)}),e}var ji="1.6.2";var pu={};["object","boolean","number","function","string","symbol"].forEach((n,t)=>{pu[n]=function(r){return typeof r===n||"a"+(t<1?"n ":" ")+n}});var zl={};pu.transitional=function(t,e,r){function o(s,i){return"[Axios v"+ji+"] Transitional option '"+s+"'"+i+(r?". "+r:"")}return(s,i,c)=>{if(t===!1)throw new Ee(o(i," has been removed"+(e?" in "+e:"")),Ee.ERR_DEPRECATED);return e&&!zl[i]&&(zl[i]=!0,console.warn(o(i," has been deprecated since v"+e+" and will be removed in the near future"))),t?t(s,i,c):!0}};function Sy(n,t,e){if(typeof n!="object")throw new Ee("options must be an object",Ee.ERR_BAD_OPTION_VALUE);let r=Object.keys(n),o=r.length;for(;o-- >0;){let s=r[o],i=t[s];if(i){let c=n[s],u=c===void 0||i(c,s,n);if(u!==!0)throw new Ee("option "+s+" must be "+u,Ee.ERR_BAD_OPTION_VALUE);continue}if(e!==!0)throw new Ee("Unknown option "+s,Ee.ERR_BAD_OPTION)}}var Wi={assertOptions:Sy,validators:pu};var gr=Wi.validators,So=class{constructor(t){this.defaults=t,this.interceptors={request:new nu,response:new nu}}request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=qn(this.defaults,e);let{transitional:r,paramsSerializer:o,headers:s}=e;r!==void 0&&Wi.assertOptions(r,{silentJSONParsing:gr.transitional(gr.boolean),forcedJSONParsing:gr.transitional(gr.boolean),clarifyTimeoutError:gr.transitional(gr.boolean)},!1),o!=null&&(I.isFunction(o)?e.paramsSerializer={serialize:o}:Wi.assertOptions(o,{encode:gr.function,serialize:gr.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let i=s&&I.merge(s.common,s[e.method]);s&&I.forEach(["delete","get","head","post","put","patch","common"],b=>{delete s[b]}),e.headers=Et.concat(i,s);let c=[],u=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(e)===!1||(u=u&&y.synchronous,c.unshift(y.fulfilled,y.rejected))});let d=[];this.interceptors.response.forEach(function(y){d.push(y.fulfilled,y.rejected)});let h,g=0,T;if(!u){let b=[Vi.bind(this),void 0];for(b.unshift.apply(b,c),b.push.apply(b,d),T=b.length,h=Promise.resolve(e);g<T;)h=h.then(b[g++],b[g++]);return h}T=c.length;let S=e;for(g=0;g<T;){let b=c[g++],y=c[g++];try{S=b(S)}catch(w){y.call(this,w);break}}try{h=Vi.call(this,S)}catch(b){return Promise.reject(b)}for(g=0,T=d.length;g<T;)h=h.then(d[g++],d[g++]);return h}getUri(t){t=qn(this.defaults,t);let e=ds(t.baseURL,t.url);return as(e,t.params,t.paramsSerializer)}};I.forEach(["delete","get","head","options"],function(t){So.prototype[t]=function(e,r){return this.request(qn(r||{},{method:t,url:e,data:(r||{}).data}))}});I.forEach(["post","put","patch"],function(t){function e(r){return function(s,i,c){return this.request(qn(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:i}))}}So.prototype[t]=e(),So.prototype[t+"Form"]=e(!0)});var ls=So;var gu=class n{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(s){e=s});let r=this;this.promise.then(o=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](o);r._listeners=null}),this.promise.then=o=>{let s,i=new Promise(c=>{r.subscribe(c),s=c}).then(o);return i.cancel=function(){r.unsubscribe(s)},i},t(function(s,i,c){r.reason||(r.reason=new pr(s,i,c),e(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let e=this._listeners.indexOf(t);e!==-1&&this._listeners.splice(e,1)}static source(){let t;return{token:new n(function(o){t=o}),cancel:t}}},Dl=gu;function mu(n){return function(e){return n.apply(null,e)}}function hu(n){return I.isObject(n)&&n.isAxiosError===!0}var yu={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(yu).forEach(([n,t])=>{yu[t]=n});var Ml=yu;function Gl(n){let t=new ls(n),e=os(ls.prototype.request,t);return I.extend(e,ls.prototype,t,{allOwnKeys:!0}),I.extend(e,t,null,{allOwnKeys:!0}),e.create=function(o){return Gl(qn(n,o))},e}var it=Gl(_o);it.Axios=ls;it.CanceledError=pr;it.CancelToken=Dl;it.isCancel=fs;it.VERSION=ji;it.toFormData=lr;it.AxiosError=Ee;it.Cancel=it.CanceledError;it.all=function(t){return Promise.all(t)};it.spread=mu;it.isAxiosError=hu;it.mergeConfig=qn;it.AxiosHeaders=Et;it.formToJSON=n=>Fi(I.isHTMLForm(n)?new FormData(n):n);it.getAdapter=$i.getAdapter;it.HttpStatusCode=Ml;it.default=it;var Qi=it;var{Axios:l_,AxiosError:p_,CanceledError:g_,isCancel:m_,CancelToken:h_,VERSION:y_,all:A_,Cancel:x_,isAxiosError:b_,spread:w_,toFormData:T_,AxiosHeaders:__,HttpStatusCode:E_,formToJSON:S_,getAdapter:v_,mergeConfig:C_}=Qi;async function Ll(n){var t;let{params:e,method:r,url:o,headers:s,body:i,overrides:c}=n,u={headers:s,method:r,url:o,params:e,data:i,withCredentials:(t=c?.WITH_CREDENTIALS)!=null?t:!0};try{let d=await Qi(u);return{status:d.status,statusText:d.statusText,data:d.data,headers:d.headers,config:d.config}}catch(d){let h=d;if(h.response)return h.response;throw d}}var ps=class{constructor(t){this.network=t?.network??La,this.fullnode=t?.fullnode,this.faucet=t?.faucet,this.indexer=t?.indexer,this.client=t?.client??{provider:Ll},this.clientConfig=t?.clientConfig??{}}getRequestUrl(t){switch(t){case 0:if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return Ma[this.network];case 2:if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return Ga[this.network];case 1:if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return $s[this.network];default:throw Error(`apiType ${t} is not supported`)}}isIndexerRequest(t){return $s[this.network]===t}};var gs=class extends ae{constructor(e){super();this.accountAddress=F.ONE;this.moduleName=new yt("account");this.structName=new yt("RotationProofChallenge");this.sequenceNumber=new ft(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=Le.U8(e.newPublicKey.toUint8Array())}serialize(e){e.serialize(this.accountAddress),e.serialize(this.moduleName),e.serialize(this.structName),e.serialize(this.sequenceNumber),e.serialize(this.originator),e.serialize(this.currentAuthKey),e.serialize(this.newPublicKey)}};var Ut=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return An.load(t);case 1:return ms.load(t);case 2:return cn.load(t);case 3:return Kr.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}isEd25519(){return this instanceof An}isMultiEd25519(){return this instanceof ms}isSingleKey(){return this instanceof cn}isMultiKey(){return this instanceof Kr}},An=class n extends Ut{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=qe.deserialize(e),o=Je.deserialize(e);return new n(r,o)}},ms=class n extends Ut{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=nn.deserialize(e),o=Rr.deserialize(e);return new n(r,o)}},cn=class n extends Ut{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=je.deserialize(e),o=mn.deserialize(e);return new n(r,o)}},Kr=class n extends Ut{constructor(e,r,o){super();this.public_keys=e,this.signatures=r,this.signatures_bitmap=o}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),e.serializeVector(this.signatures),e.serializeBytes(this.signatures_bitmap)}static load(e){let r=qr.deserialize(e),o=e.deserializeVector(mn),s=e.deserializeBytes();return new n(r,o,s)}};var xn=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Fr.load(t);case 1:return Yi.load(t);case 2:return Hr.load(t);case 3:return $r.load(t);case 4:return Vr.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},Fr=class n extends xn{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=qe.deserialize(e),o=Je.deserialize(e);return new n(r,o)}},Yi=class n extends xn{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=nn.deserialize(e),o=Rr.deserialize(e);return new n(r,o)}},Hr=class n extends xn{constructor(e,r,o){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=o}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let r=Ut.deserialize(e),o=e.deserializeVector(F),s=e.deserializeVector(Ut);return new n(r,o,s)}},$r=class n extends xn{constructor(e,r,o,s){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=o,this.fee_payer=s}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let r=Ut.deserialize(e),o=e.deserializeVector(F),s=e.deserializeVector(Ut),i=F.deserialize(e),c=Ut.deserialize(e),u={address:i,authenticator:c};return new n(r,o,s,u)}},Vr=class n extends xn{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let r=Ut.deserialize(e);return new n(r)}};var jr=class n extends ae{constructor(e){super();this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let r=e.deserializeU8();return new n(r)}};var We=class n extends ae{constructor(e){super();this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let r=e.deserializeStr();return new n(r)}};var vo=class n extends ae{constructor(e,r){super();this.address=e,this.name=r}static fromStr(e){let r=e.split("::");if(r.length!==2)throw new Error("Invalid module id.");return new n(F.fromString(r[0]),new We(r[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let r=F.deserialize(e),o=We.deserialize(e);return new n(r,o)}};var nt=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Wr.load(t);case 1:return Qr.load(t);case 2:return Xr.load(t);case 3:return Jr.load(t);case 4:return to.load(t);case 5:return mr.load(t);case 6:return ro.load(t);case 7:return Kn.load(t);case 8:return Yr.load(t);case 9:return Zr.load(t);case 10:return eo.load(t);case 255:return no.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}isBool(){return this instanceof Wr}isAddress(){return this instanceof to}isGeneric(){return this instanceof no}isSigner(){return this instanceof mr}isVector(){return this instanceof ro}isStruct(){return this instanceof Kn}isU8(){return this instanceof Qr}isU16(){return this instanceof Yr}isU32(){return this instanceof Zr}isU64(){return this instanceof Xr}isU128(){return this instanceof Jr}isU256(){return this instanceof eo}},Wr=class n extends nt{toString(){return"bool"}serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new n}},Qr=class n extends nt{toString(){return"u8"}serialize(t){t.serializeU32AsUleb128(1)}static load(t){return new n}},Yr=class n extends nt{toString(){return"u16"}serialize(t){t.serializeU32AsUleb128(8)}static load(t){return new n}},Zr=class n extends nt{toString(){return"u32"}serialize(t){t.serializeU32AsUleb128(9)}static load(t){return new n}},Xr=class n extends nt{toString(){return"u64"}serialize(t){t.serializeU32AsUleb128(2)}static load(t){return new n}},Jr=class n extends nt{toString(){return"u128"}serialize(t){t.serializeU32AsUleb128(3)}static load(t){return new n}},eo=class n extends nt{toString(){return"u256"}serialize(t){t.serializeU32AsUleb128(10)}static load(t){return new n}},to=class n extends nt{toString(){return"address"}serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new n}},mr=class n extends nt{toString(){return"signer"}serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new n}},hs=class n extends nt{constructor(e){super();this.value=e}toString(){return`&${this.value.toString()}`}serialize(e){e.serializeU32AsUleb128(254)}static load(e){let r=nt.deserialize(e);return new n(r)}},no=class n extends nt{constructor(e){super();this.value=e;if(e<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(e){e.serializeU32AsUleb128(255),e.serializeU32(this.value)}static load(e){let r=e.deserializeU32();return new n(r)}},ro=class n extends nt{constructor(e){super();this.value=e}toString(){return`vector<${this.value.toString()}>`}serialize(e){e.serializeU32AsUleb128(6),this.value.serialize(e)}static load(e){let r=nt.deserialize(e);return new n(r)}},Kn=class n extends nt{constructor(e){super();this.value=e}toString(){let e="";return this.value.typeArgs.length>0&&(e=`<${this.value.typeArgs.map(r=>r.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${e}`}serialize(e){e.serializeU32AsUleb128(7),this.value.serialize(e)}static load(e){let r=bn.deserialize(e);return new n(r)}isTypeTag(e,r,o){return this.value.moduleName.identifier===r&&this.value.name.identifier===o&&this.value.address.equals(e)}isString(){return this.isTypeTag(F.ONE,"string","String")}isOption(){return this.isTypeTag(F.ONE,"option","Option")}isObject(){return this.isTypeTag(F.ONE,"object","Object")}},bn=class n extends ae{constructor(e,r,o,s){super();this.address=e,this.moduleName=r,this.name=o,this.typeArgs=s}serialize(e){e.serialize(this.address),e.serialize(this.moduleName),e.serialize(this.name),e.serializeVector(this.typeArgs)}static deserialize(e){let r=F.deserialize(e),o=We.deserialize(e),s=We.deserialize(e),i=e.deserializeVector(nt);return new n(r,o,s,i)}};function vy(){return new bn(F.ONE,new We("aptos_coin"),new We("AptosCoin"),[])}function Cy(){return new bn(F.ONE,new We("string"),new We("String"),[])}function Uy(n){return new bn(F.ONE,new We("option"),new We("Option"),[n])}function Iy(n){return new bn(F.ONE,new We("object"),new We("Object"),[n])}function ql(n){let t=n.deserializeUleb128AsU32();switch(t){case 0:return lt.deserialize(n);case 1:return ft.deserialize(n);case 2:return Lt.deserialize(n);case 3:return F.deserialize(n);case 4:return Le.deserialize(n,lt);case 5:return Xe.deserialize(n);case 6:return Mt.deserialize(n);case 7:return Gt.deserialize(n);case 8:return qt.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var hr=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Co.load(t);case 2:return Uo.load(t);case 3:return Io.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},Co=class n extends hr{constructor(e){super();this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=Bo.deserialize(e);return new n(r)}},Uo=class n extends hr{constructor(e){super();this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=oo.deserialize(e);return new n(r)}},Io=class n extends hr{constructor(e){super();this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=Po.deserialize(e);return new n(r)}},oo=class n{constructor(t,e,r,o){this.module_name=t,this.function_name=e,this.type_args=r,this.args=o}static build(t,e,r,o){return new n(vo.fromStr(t),new We(e),r,o)}serialize(t){this.module_name.serialize(t),this.function_name.serialize(t),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForEntryFunction(t)})}static deserialize(t){let e=vo.deserialize(t),r=We.deserialize(t),o=t.deserializeVector(nt),s=t.deserializeUleb128AsU32(),i=new Array;for(let c=0;c<s;c+=1){let u=t.deserializeUleb128AsU32(),d=Yo.deserialize(t,u);i.push(d)}return new n(e,r,o,i)}},Bo=class n{constructor(t,e,r){this.bytecode=t,this.type_args=e,this.args=r}serialize(t){t.serializeBytes(this.bytecode),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForScriptFunction(t)})}static deserialize(t){let e=t.deserializeBytes(),r=t.deserializeVector(nt),o=t.deserializeUleb128AsU32(),s=new Array;for(let i=0;i<o;i+=1){let c=ql(t);s.push(c)}return new n(e,r,s)}},Po=class n{constructor(t,e){this.multisig_address=t,this.transaction_payload=e}serialize(t){this.multisig_address.serialize(t),this.transaction_payload===void 0?t.serializeBool(!1):(t.serializeBool(!0),this.transaction_payload.serialize(t))}static deserialize(t){let e=F.deserialize(t),r=t.deserializeBool(),o;return r&&(o=Ro.deserialize(t)),new n(e,o)}},Ro=class n extends ae{constructor(e){super();this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new n(oo.deserialize(e))}};var Wt=class n extends ae{constructor(e,r,o,s,i,c,u){super();this.sender=e,this.sequence_number=r,this.payload=o,this.max_gas_amount=s,this.gas_unit_price=i,this.expiration_timestamp_secs=c,this.chain_id=u}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let r=F.deserialize(e),o=e.deserializeU64(),s=hr.deserialize(e),i=e.deserializeU64(),c=e.deserializeU64(),u=e.deserializeU64(),d=jr.deserialize(e);return new n(r,o,s,i,c,u,d)}},ys=class extends ae{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return wn.load(t);case 1:return Tn.load(t);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},wn=class n extends ys{constructor(e,r){super();this.raw_txn=e,this.secondary_signer_addresses=r}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let r=Wt.deserialize(e),o=e.deserializeVector(F);return new n(r,o)}},Tn=class n extends ys{constructor(e,r,o){super();this.raw_txn=e,this.secondary_signer_addresses=r,this.fee_payer_address=o}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(e)}static load(e){let r=Wt.deserialize(e),o=e.deserializeVector(F),s=F.deserialize(e);return new n(r,o,s)}};var un=class n extends ae{constructor(e,r){super();this.raw_txn=e,this.authenticator=r}serialize(e){this.raw_txn.serialize(e),this.authenticator.serialize(e)}static deserialize(e){let r=Wt.deserialize(e),o=xn.deserialize(e);return new n(r,o)}};function Kl(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function Fl(n){return!!n.match(/\s/)}function By(n){return!!n.match(/^T[0-9]+$/)}function Py(n,t){let e=t;for(;e<n.length;e+=1){let r=n[e];if(!Fl(r))break}return e}var Hl=(T=>(T.InvalidTypeTag="unknown type",T.UnexpectedGenericType="unexpected generic type",T.UnexpectedTypeArgumentClose="unexpected '>'",T.UnexpectedWhitespaceCharacter="unexpected whitespace character",T.UnexpectedComma="unexpected ','",T.TypeArgumentCountMismatch="type argument count doesn't match expected amount",T.MissingTypeArgumentClose="no matching '>' for '<'",T.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",T.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",T.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",T.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",T.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",T))(Hl||{}),Fe=class extends Error{constructor(t,e){super(`Failed to parse typeTag '${t}', ${e}`)}};function Oo(n,t){let e=t?.allowGenerics??!1,r=[],o=[],s=[],i=0,c="",u=1;for(;i<n.length;){let d=n[i];if(d==="<")r.push({savedExpectedTypes:u,savedStr:c,savedTypes:s}),c="",s=[],u=1;else if(d===">"){if(c!==""){let b=Zi(c,o,e);s.push(b)}let h=r.pop();if(h===void 0)throw new Fe(n,"unexpected '>'");if(u!==s.length)throw new Fe(n,"type argument count doesn't match expected amount");let{savedStr:g,savedTypes:T,savedExpectedTypes:S}=h;o=s,s=T,c=g,u=S}else if(d===","){if(c.length!==0){let h=Zi(c,o,e);o=[],s.push(h),c="",u+=1}}else if(Fl(d)){let h=!1;if(c.length!==0){let T=Zi(c,o,e);o=[],s.push(T),c="",h=!0}i=Py(n,i);let g=n[i];if(i<n.length&&h&&g!==","&&g!==">")throw new Fe(n,"unexpected whitespace character");continue}else c+=d;i+=1}if(r.length>0)throw new Fe(n,"no matching '>' for '<'");switch(s.length){case 0:return Zi(c,o,e);case 1:if(c==="")return s[0];throw new Fe(n,"unexpected ','");default:throw new Fe(n,"unexpected whitespace character")}}function Zi(n,t,e){switch(n){case"&signer":if(t.length>0)throw new Fe(n,"primitive types not expected to have type arguments");return new hs(new mr);case"signer":if(t.length>0)throw new Fe(n,"primitive types not expected to have type arguments");return new mr;case"bool":if(t.length>0)throw new Fe(n,"primitive types not expected to have type arguments");return new Wr;case"address":if(t.length>0)throw new Fe(n,"primitive types not expected to have type arguments");return new to;case"u8":if(t.length>0)throw new Fe(n,"primitive types not expected to have type arguments");return new Qr;case"u16":if(t.length>0)throw new Fe(n,"primitive types not expected to have type arguments");return new Yr;case"u32":if(t.length>0)throw new Fe(n,"primitive types not expected to have type arguments");return new Zr;case"u64":if(t.length>0)throw new Fe(n,"primitive types not expected to have type arguments");return new Xr;case"u128":if(t.length>0)throw new Fe(n,"primitive types not expected to have type arguments");return new Jr;case"u256":if(t.length>0)throw new Fe(n,"primitive types not expected to have type arguments");return new eo;case"vector":if(t.length!==1)throw new Fe(n,"vector type expected to have exactly one type argument");return new ro(t[0]);default:if(By(n)){if(e)return new no(Number(n.split("T")[1]));throw new Fe(n,"unexpected generic type")}if(!n.match(/.*:.*/))throw new Fe(n,"unknown type");let r=n.split("::");if(r.length!==3)throw new Fe(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");if(!Kl(r[1]))throw new Fe(n,"module name must only contain alphanumeric or '_' characters");if(!Kl(r[2]))throw new Fe(n,"struct name must only contain alphanumeric or '_' characters");return new Kn(new bn(F.fromString(r[0]),new We(r[1]),new We(r[2]),t))}}function Au(n){return typeof n=="boolean"}function so(n){return typeof n=="string"}function As(n){return typeof n=="number"}function xs(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function xu(n){return n==null}function bu(n){return Xi(n)||ea(n)||ta(n)||na(n)||ra(n)||oa(n)||sa(n)||bs(n)||Ji(n)||$l(n)||n instanceof Le||n instanceof Bn}function Xi(n){return n instanceof Xe}function bs(n){return n instanceof F}function Ji(n){return n instanceof yt}function $l(n){return n instanceof Wn}function ea(n){return n instanceof lt}function ta(n){return n instanceof Mt}function na(n){return n instanceof Gt}function ra(n){return n instanceof ft}function oa(n){return n instanceof Lt}function sa(n){return n instanceof qt}function ia(n){return"bytecode"in n}function $e(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function wu(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function aa(n){let t=n.split("::");if(t.length!==3)throw new Error(`Invalid function ${n}`);let e=t[0],r=t[1],o=t[2];return{moduleAddress:e,moduleName:r,functionName:o}}var Ry=new TextEncoder;function _u(n){return n?.map(t=>so(t)?Oo(t):t)??[]}async function Eu(n,t,e,r){let s=(await Pi({aptosConfig:r,accountAddress:n,moduleName:t})).abi?.exposed_functions.find(u=>u.name===e);if(!s)throw new Error(`Could not find entry function ABI for '${n}::${t}::${e}'`);if(!s.is_entry)throw new Error(`'${n}::${t}::${e}' is not an entry function`);let i=wu(s),c=[];for(let u=i;u<s.params.length;u+=1)c.push(Oo(s.params[u],{allowGenerics:!0}));return{typeParameters:s.generic_type_params,parameters:c}}function Su(n,t,e,r,o){if(r>=t.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${t.parameters.length}`);let s=t.parameters[r];return io(e,s,r,o)}function io(n,t,e,r){return bu(n)?(Tu(t,n,e),n):Oy(n,t,e,r)}function Oy(n,t,e,r){if(t.isBool()){if(Au(n))return new Xe(n);$e("boolean",e)}if(t.isAddress()){if(so(n))return F.fromString(n);$e("string | AccountAddress",e)}if(t.isU8()){if(As(n))return new lt(n);$e("number",e)}if(t.isU16()){if(As(n))return new Mt(n);$e("number",e)}if(t.isU32()){if(As(n))return new Gt(n);$e("number",e)}if(t.isU64()){if(xs(n))return new ft(BigInt(n));$e("bigint | number | string",e)}if(t.isU128()){if(xs(n))return new Lt(BigInt(n));$e("bigint | number | string",e)}if(t.isU256()){if(xs(n))return new qt(BigInt(n));$e("bigint | number | string",e)}if(t.isGeneric()){let o=t.value;if(o<0||o>=r.length)throw new Error(`Generic argument ${t.toString()} is invalid for argument ${e}`);return io(n,r[o],e,r)}if(t.isVector()){if(t.value.isU8()){if(so(n))return Le.U8(Ry.encode(n));if(n instanceof Uint8Array)return Le.U8(n);if(n instanceof ArrayBuffer)return Le.U8(new Uint8Array(n))}if(Array.isArray(n))return new Le(n.map(o=>io(o,t.value,e,r)));throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}if(t.isStruct()){if(t.isString()){if(so(n))return new yt(n);$e("string",e)}if(t.isObject()){if(so(n))return F.fromString(n);$e("string | AccountAddress",e)}if(t.isOption())return xu(n)?new Bn(null):new Bn(io(n,t.value.typeArgs[0],e,r));throw new Error(`Unsupported struct input type for argument ${e}, type '${t.toString()}'`)}throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}function Tu(n,t,e){if(n.isBool()){if(Xi(t))return;$e("Bool",e)}if(n.isAddress()){if(bs(t))return;$e("AccountAddress",e)}if(n.isU8()){if(ea(t))return;$e("U8",e)}if(n.isU16()){if(ta(t))return;$e("U16",e)}if(n.isU32()){if(na(t))return;$e("U32",e)}if(n.isU64()){if(ra(t))return;$e("U64",e)}if(n.isU128()){if(oa(t))return;$e("U128",e)}if(n.isU256()){if(sa(t))return;$e("U256",e)}if(n.isVector()){if(t instanceof Le){t.values.length>0&&Tu(n.value,t.values[0],e);return}$e("MoveVector",e)}if(n instanceof Kn){if(n.isString()){if(Ji(t))return;$e("MoveString",e)}if(n.isObject()){if(bs(t))return;$e("AccountAddress",e)}if(n.isOption()){if(t instanceof Bn){t.value!==void 0&&Tu(n.value.typeArgs[0],t.value,e);return}$e("MoveOption",e)}}throw new Error(`Type mismatch for argument ${e}, expected '${n.toString()}'`)}async function Ts(n){if(ia(n))return jl(n);let{moduleAddress:t,moduleName:e,functionName:r}=aa(n.function),o=await xo(async()=>Eu(t,e,r,n.aptosConfig),`entry-function-${n.aptosConfig.network}-${t}-${e}-${r}`,1e3*60*5)();return Vl(n,o)}function Vl(n,t){if(ia(n))return jl(n);let{moduleAddress:e,moduleName:r,functionName:o}=aa(n.function),s=_u(n.typeArguments);if(s.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${s.length}`);let i=n.functionArguments.map((u,d)=>Su(n.function,t,u,d,s));if(i.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${r}::${o}', expected ${t.parameters.length} but got ${i.length}`);let c=oo.build(`${e}::${r}`,o,s,i);if("multisigAddress"in n){let u=F.from(n.multisigAddress);return new Io(new Po(u,new Ro(c)))}return new Uo(c)}function jl(n){return new Co(new Bo(Be.fromHexInput(n.bytecode).toUint8Array(),n.typeArguments??[],n.functionArguments))}async function Wl(n){let{aptosConfig:t,sender:e,payload:r,options:o}=n,s=o?.accountSequenceNumber!==void 0?Promise.resolve({sequence_number:o.accountSequenceNumber}):hn({aptosConfig:t,accountAddress:e}),i=Vs[t.network]?Promise.resolve({chain_id:Vs[t.network]}):Ci({aptosConfig:t}),c=o?.gasUnitPrice?Promise.resolve({gas_estimate:o.gasUnitPrice}):Oi({aptosConfig:t}),[{sequence_number:u},{chain_id:d},{gas_estimate:h}]=await Promise.all([s,i,c]),{maxGasAmount:g,gasUnitPrice:T,expireTimestamp:S}={maxGasAmount:o?.maxGasAmount?BigInt(o.maxGasAmount):BigInt(qa),gasUnitPrice:BigInt(h),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+Ka),...o};return new Wt(F.from(e),BigInt(u),r,BigInt(g),BigInt(T),BigInt(S),new jr(d))}async function ca(n){let{aptosConfig:t,sender:e,payload:r,options:o}=n,s=await Wl({aptosConfig:t,sender:e,payload:r,options:o});if("secondarySignerAddresses"in n){let i=n.secondarySignerAddresses?.map(c=>F.from(c))??[];return{rawTransaction:s,secondarySignerAddresses:i,feePayerAddress:n.feePayerAddress?F.from(n.feePayerAddress):void 0}}return{rawTransaction:s,feePayerAddress:n.feePayerAddress?F.from(n.feePayerAddress):void 0}}function vu(n){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:r,feePayerPublicKey:o}=n,s=ws(t);if(e.feePayerAddress){let c=new Tn(e.rawTransaction,e.secondarySignerAddresses??[],e.feePayerAddress),u=[];r&&(u=r.map(g=>ws(g)));let d=ws(o),h=new $r(s,e.secondarySignerAddresses??[],u,{address:e.feePayerAddress,authenticator:d});return new un(c.raw_txn,h).bcsToBytes()}if(e.secondarySignerAddresses){let c=new wn(e.rawTransaction,e.secondarySignerAddresses),u=[];u=r.map(h=>ws(h));let d=new Hr(s,e.secondarySignerAddresses,u);return new un(c.raw_txn,d).bcsToBytes()}let i;if(s instanceof An)i=new Fr(s.public_key,s.signature);else if(s instanceof cn)i=new Vr(s);else throw new Error("Invalid public key");return new un(e.rawTransaction,i).bcsToBytes()}function ws(n){if(n instanceof je){if(n.publicKey instanceof qe)return new cn(n,new mn(new Je(new Uint8Array(64))));if(n.publicKey instanceof Vt)return new cn(n,new mn(new Mn(new Uint8Array(64))))}return new An(new qe(n.toUint8Array()),new Je(new Uint8Array(64)))}function Cu(n){let{signer:t,transaction:e}=n,r=ua(e),o=t.sign(r);switch(t.signingScheme){case 0:return new An(new qe(t.publicKey.toUint8Array()),new Je(o.toUint8Array()));case 2:if(!je.isPublicKey(t.publicKey))throw new Error(`Cannot sign transaction, public key does not match ${t.signingScheme}`);return new cn(t.publicKey,new mn(o));default:throw new Error(`Cannot sign transaction, signing scheme ${t.signingScheme} not supported`)}}function Uu(n){let{transaction:t,senderAuthenticator:e,feePayerAuthenticator:r,additionalSignersAuthenticators:o}=n,s=Iu(t);if((r||o)&&(s instanceof wn||s instanceof Tn))return Ql(s,e,r,o);if(e instanceof An&&s instanceof Wt){let i=new Fr(e.public_key,e.signature);return new un(s,i).bcsToBytes()}if((e instanceof cn||e instanceof Kr)&&s instanceof Wt){let i=new Vr(e);return new un(s,i).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${e} is not a supported account authentication scheme`)}function Iu(n){return n.feePayerAddress?new Tn(n.rawTransaction,n.secondarySignerAddresses??[],n.feePayerAddress):n.secondarySignerAddresses?new wn(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function Ql(n,t,e,r){if(n instanceof Tn){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let o=new $r(t,n.secondary_signer_addresses,r??[],{address:n.fee_payer_address,authenticator:e});return new un(n.raw_txn,o).bcsToBytes()}if(n instanceof wn){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let o=new Hr(t,n.secondary_signer_addresses,r??[]);return new un(n.raw_txn,o).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof n} transaction is not supported`)}function ua(n){let t=Iu(n),e=Ir.create();if(t instanceof Wt)e.update(Fa);else if(t instanceof wn)e.update(js);else if(t instanceof Tn)e.update(js);else throw new Error(`Unknown transaction type to sign on: ${t}`);let r=e.digest(),o=t.bcsToBytes(),s=new Uint8Array(r.length+o.length);return s.set(r),s.set(o,r.length),s}async function Pe(n){let t=await Ny(n);return ky(n,t)}async function Ny(n){let{aptosConfig:t,data:e}=n,r,o;return"bytecode"in e?(r=e,o=await Ts(r)):"multisigAddress"in e?(r={aptosConfig:t,multisigAddress:e.multisigAddress,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments},o=await Ts(r)):(r={aptosConfig:t,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments},o=await Ts(r)),o}async function ky(n,t){let{aptosConfig:e,sender:r,options:o}=n,s;if(zy(n)&&(s=F.ZERO.toString()),Dy(n)){let{secondarySignerAddresses:i}=n;return ca({aptosConfig:e,sender:r,payload:t,options:o,secondarySignerAddresses:i,feePayerAddress:s})}return ca({aptosConfig:e,sender:r,payload:t,options:o,feePayerAddress:s})}function zy(n){return n.withFeePayer===!0}function Dy(n){return"secondarySignerAddresses"in n}function Yl(n){let{transaction:t}=n;return ua(t)}function fa(n){return Cu({...n})}async function Bu(n){let{aptosConfig:t,transaction:e,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:s,options:i}=n,c=vu({transaction:e,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:s,options:i}),{data:u}=await Er({aptosConfig:t,body:c,path:"transactions/simulate",params:{estimate_gas_unit_price:n.options?.estimateGasUnitPrice??!1,estimate_max_gas_amount:n.options?.estimateMaxGasAmount??!1,estimate_prioritized_gas_unit_price:n.options?.estimatePrioritizedGasUnitPrice??!1},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return u}async function da(n){let{aptosConfig:t}=n,e=Uu({...n}),{data:r}=await Er({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function _s(n){let{aptosConfig:t,signer:e,transaction:r}=n,o=fa({signer:e,transaction:r});return da({aptosConfig:t,transaction:r,senderAuthenticator:o})}async function Zl(n){let{aptosConfig:t,account:e,metadataBytes:r,moduleBytecode:o,options:s}=n,i=o.map(u=>Le.U8(u));return await Pe({aptosConfig:t,sender:F.from(e),data:{function:"0x1::code::publish_package_txn",functionArguments:[Le.U8(r),new Le(i)]},options:s})}async function Xl(n){let{aptosConfig:t,fromAccount:e,toNewPrivateKey:r}=n,o=await hn({aptosConfig:t,accountAddress:e.accountAddress}),s=Ln.fromPrivateKey({privateKey:r,legacy:!0}),c=new gs({sequenceNumber:BigInt(o.sequence_number),originator:e.accountAddress,currentAuthKey:F.from(o.authentication_key),newPublicKey:s.publicKey}).bcsToBytes(),u=e.sign(c),d=s.sign(c),h=await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new lt(e.signingScheme.valueOf()),Le.U8(e.publicKey.toUint8Array()),new lt(s.signingScheme.valueOf()),Le.U8(s.publicKey.toUint8Array()),Le.U8(u.toUint8Array()),Le.U8(d.toUint8Array())]}});return await _s({aptosConfig:t,signer:e,transaction:h})}async function Jl(n){let{aptosConfig:t,sender:e,recipient:r,amount:o,coinType:s,options:i}=n;return await Pe({aptosConfig:t,sender:e,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[s??jo],functionArguments:[r,o]},options:i})}var Es=class{constructor(t){this.config=t}async transferCoinTransaction(t){return Jl({aptosConfig:this.config,...t})}};var yr={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},Qt="0x4::token::Token";async function ep(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:F.from(e).toStringLong()}};return(await Se({aptosConfig:t,query:{query:Md,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function tp(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:F.from(e).toStringLong()}};return(await Se({aptosConfig:t,query:{query:$c,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function np(n){let{aptosConfig:t,ownerAddress:e,options:r}=n,o={owner_address:{_eq:F.from(e).toStringLong()},amount:{_gt:0}},s={query:$c,variables:{where_condition:o,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await Se({aptosConfig:t,query:s,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function rp(n){let{aptosConfig:t,digitalAssetAddress:e,options:r}=n,o={token_data_id:{_eq:F.from(e).toStringLong()}},s={query:Dd,variables:{where_condition:o,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await Se({aptosConfig:t,query:s,originMethod:"getDigitalAssetActivity"})).token_activities_v2}async function op(n){let{aptosConfig:t,options:e,creator:r}=n;return await Pe({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new yt(n.description),new ft(n.maxSupply??Cr),new yt(n.name),new yt(n.uri),new Xe(n.mutableDescription??!0),new Xe(n.mutableRoyalty??!0),new Xe(n.mutableURI??!0),new Xe(n.mutableTokenDescription??!0),new Xe(n.mutableTokenName??!0),new Xe(n.mutableTokenProperties??!0),new Xe(n.mutableTokenURI??!0),new Xe(n.tokensBurnableByCreator??!0),new Xe(n.tokensFreezableByCreator??!0),new ft(n.royaltyNumerator??0),new ft(n.royaltyDenominator??1)]},options:e})}async function Pu(n){let{aptosConfig:t,creatorAddress:e,collectionName:r,options:o}=n,s=F.from(e),i={collection_name:{_eq:r},creator_address:{_eq:s.toStringLong()}};return o?.tokenStandard&&(i.token_standard={_eq:o?.tokenStandard??"v2"}),(await Se({aptosConfig:t,query:{query:Pd,variables:{where_condition:i}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function sp(n){return(await Pu(n)).collection_id}async function ip(n){let{aptosConfig:t,options:e,creator:r,collection:o,description:s,name:i,uri:c,propertyKeys:u,propertyTypes:d,propertyValues:h}=n,g=d?.map(S=>yr[S]);return await Pe({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[o,s,i,c,u??[],g??[],bp(h??[],g??[])]},options:e})}async function ap(n){let{aptosConfig:t,sender:e,digitalAssetAddress:r,recipient:o,digitalAssetType:s,options:i}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[s??Qt],functionArguments:[r,o]},options:i})}async function cp(n){let{aptosConfig:t,account:e,collection:r,description:o,name:s,uri:i,recipient:c,propertyKeys:u,propertyTypes:d,propertyValues:h,options:g}=n;if(u?.length!==h?.length)throw new Error("Property keys and property values counts do not match");if(d?.length!==h?.length)throw new Error("Property types and property values counts do not match");let T=d?.map(b=>yr[b]);return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,o,s,i,u??[],T??[],bp(h??[],T??[]),c]},options:g})}async function up(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:o,options:s}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[o??Qt],functionArguments:[r]},options:s})}async function fp(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:o,options:s}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[o??Qt],functionArguments:[r]},options:s})}async function dp(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:o,options:s}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[o??Qt],functionArguments:[r]},options:s})}async function lp(n){let{aptosConfig:t,creator:e,description:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[s??Qt],functionArguments:[o,r]},options:i})}async function pp(n){let{aptosConfig:t,creator:e,name:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[s??Qt],functionArguments:[o,r]},options:i})}async function gp(n){let{aptosConfig:t,creator:e,uri:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[s??Qt],functionArguments:[o,r]},options:i})}async function mp(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:c,options:u}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[c??Qt],functionArguments:[i,r,yr[o],Ru(s,yr[o])]},options:u})}async function hp(n){let{aptosConfig:t,creator:e,propertyKey:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[s??Qt],functionArguments:[o,r]},options:i})}async function yp(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:c,options:u}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[c??Qt],functionArguments:[i,r,yr[o],Ru(s,yr[o])]},options:u})}async function Ap(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:c,options:u}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[c??Qt,yr[o]],functionArguments:[i,r,s]},options:u})}async function xp(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:c,options:u}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[c??Qt,yr[o]],functionArguments:[i,r,s]},options:u})}function bp(n,t){let e=new Array;return t.forEach((r,o)=>{e.push(Ru(n[o],r))}),e}function Ru(n,t){let e=Oo(t);return io(n,e,0,[]).bcsToBytes()}var Ss=class{constructor(t){this.config=t}async getCollectionData(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Pu({aptosConfig:this.config,...t})}async getCollectionId(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),sp({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ep({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),tp({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),np({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),rp({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return op({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return ip({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return ap({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return cp({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return up({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return fp({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return dp({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return lp({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return pp({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return gp({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return mp({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return hp({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return yp({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return Ap({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return xp({aptosConfig:this.config,...t})}};async function wp(n){let{accountAddress:t,aptosConfig:e,creationNumber:r}=n,s={account_address:{_eq:F.from(t).toStringLong()},creation_number:{_eq:r}};return la({aptosConfig:e,options:{where:s}})}async function Tp(n){let{accountAddress:t,aptosConfig:e,eventType:r,options:o}=n,c={where:{account_address:{_eq:F.from(t).toStringLong()},indexed_type:{_eq:r}},pagination:o,orderBy:o?.orderBy};return la({aptosConfig:e,options:c})}async function la(n){let{aptosConfig:t,options:e}=n,r={query:Nd,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await Se({aptosConfig:t,query:r,originMethod:"getEvents"})).events}var vs=class{constructor(t){this.config=t}async getAccountEventsByCreationNumber(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),wp({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return await ze({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),Tp({aptosConfig:this.config,...t})}async getEvents(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"events_processor"}),la({aptosConfig:this.config,...t})}};async function _p(n){let{aptosConfig:t,accountAddress:e,amount:r,options:o}=n,s=o?.timeoutSecs||Vo,{data:i}=await Va({aptosConfig:t,path:"fund",body:{address:F.from(e).toString(),amount:r},originMethod:"fundAccount"}),c=i.txn_hashes[0],u=await bo({aptosConfig:t,transactionHash:c,options:{timeoutSecs:s,checkSuccess:o?.checkSuccess}});if(u.type==="user_transaction")return u;throw new Error(`Unexpected transaction received for fund account: ${u.type}`)}var Cs=class{constructor(t){this.config=t}async fundAccount(t){let e=await _p({aptosConfig:this.config,...t});return t.options?.waitForIndexer!==!1&&await ki({aptosConfig:this.config,minimumLedgerVersion:BigInt(e.version)}),e}};async function Ou(n){let{aptosConfig:t,options:e}=n,r={query:zd,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await Se({aptosConfig:t,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function Ep(n){let{aptosConfig:t,options:e}=n,r={query:kd,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await Se({aptosConfig:t,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Sp(n){let{aptosConfig:t,options:e}=n,r={query:Rd,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await Se({aptosConfig:t,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}async function vp(n){let{aptosConfig:t,sender:e,fungibleAssetMetadataAddress:r,recipient:o,amount:s,options:i}=n;return await Pe({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,o,s]},options:i})}var Us=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Ou({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),(await Ou({aptosConfig:this.config,options:{where:{asset_type:{_eq:t.assetType}}}}))[0]}async getFungibleAssetActivities(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Ep({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Sp({aptosConfig:this.config,...t})}async transferFungibleAsset(t){return vp({aptosConfig:this.config,...t})}};var Is=class{constructor(t){this.config=t}async getLedgerInfo(){return Ci({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(t){return Gd({aptosConfig:this.config,...t})}async getBlockByHeight(t){return Ld({aptosConfig:this.config,...t})}async getTableItem(t){return Ui({aptosConfig:this.config,...t})}async view(t){return fr({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return qd({aptosConfig:this.config,...t})}async queryIndexer(t){return Se({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return Ii({aptosConfig:this.config})}async getProcessorStatus(t){return Bi({aptosConfig:this.config,processorType:t})}};var Cp=["A name must be between 3 and 63 characters long,","and can only contain lowercase a-z, 0-9, and hyphens.","A name may not start or end with a hyphen."].join(" ");function Up(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function Ar(n){let[t,e,...r]=n.replace(/\.apt$/,"").split(".");if(r.length>0)throw new Error(`${n} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!Up(t))throw new Error(`${t} is not valid. ${Cp}`);if(e&&!Up(e))throw new Error(`${e} is not valid. ${Cp}`);return{domainName:e||t,subdomainName:e?t:void 0}}var My="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",Gy={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:My,custom:null,devnet:null};function Fn(n){let t=Gy[n.network];if(!t)throw new Error(`The ANS contract is not deployed to ${n.network}`);return t}var Ly=n=>({vec:[n]}),qy=()=>({vec:[]}),Nu=n=>n!=null?Ly(n):qy(),pa=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function Ip(n){let{aptosConfig:t,name:e}=n,r=Fn(t),{domainName:o,subdomainName:s}=Ar(e),i=await fr({aptosConfig:t,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[o,Nu(s)]}}),c=pa(i[0]);return c?F.from(c).toString():void 0}async function Bp(n){let{aptosConfig:t,expiration:e,name:r,sender:o,targetAddress:s,toAddress:i,options:c,transferable:u}=n,d=Fn(t),{domainName:h,subdomainName:g}=Ar(r),T=e.policy==="subdomain:independent"||e.policy==="subdomain:follow-domain";if(g&&!T)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(T&&!g)throw new Error(`Policy is set to ${e.policy} but no subdomain was provided`);if(e.policy==="domain"){let w=e.years??1;if(w!==1)throw new Error("For now, names can only be registered for 1 year at a time");let k=w*31536e3;return await Pe({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${d}::router::register_domain`,functionArguments:[h,k,s,i]},options:c})}if(!g)throw new Error(`${e.policy} requires a subdomain to be provided.`);let S=await ku({aptosConfig:t,name:h});if(!S)throw new Error("The domain does not exist");let b=e.policy==="subdomain:independent"?e.expirationDate:S;if(b>S)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await Pe({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${d}::router::register_subdomain`,functionArguments:[h,g,Math.round(b/1e3),e.policy==="subdomain:follow-domain"?1:0,!!u,s,i]},options:c})}async function ku(n){let{aptosConfig:t,name:e}=n,r=Fn(t),{domainName:o,subdomainName:s}=Ar(e);try{let i=await fr({aptosConfig:t,payload:{function:`${r}::router::get_expiration`,functionArguments:[o,Nu(s)]}});return Number(i[0])*1e3}catch{return}}async function Pp(n){let{aptosConfig:t,address:e}=n,r=Fn(t),o=await fr({aptosConfig:t,payload:{function:`${r}::router::get_primary_name`,functionArguments:[F.from(e).toString()]}}),s=pa(o[1]),i=pa(o[0]);if(s)return[i,s].filter(Boolean).join(".")}async function Rp(n){let{aptosConfig:t,sender:e,name:r,options:o}=n,s=Fn(t);if(!r)return await Pe({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::clear_primary_name`,functionArguments:[]},options:o});let{domainName:i,subdomainName:c}=Ar(r);return await Pe({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::set_primary_name`,functionArguments:[i,c]},options:o})}async function Op(n){let{aptosConfig:t,name:e}=n,r=Fn(t),{domainName:o,subdomainName:s}=Ar(e),i=await fr({aptosConfig:t,payload:{function:`${r}::router::get_target_addr`,functionArguments:[o,Nu(s)]}}),c=pa(i[0]);return c?F.from(c).toString():void 0}async function Np(n){let{aptosConfig:t,sender:e,name:r,address:o,options:s}=n,i=Fn(t),{domainName:c,subdomainName:u}=Ar(r);return await Pe({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${i}::router::set_target_addr`,functionArguments:[c,u,o]},options:s})}async function kp(n){let{aptosConfig:t,name:e}=n,{domainName:r,subdomainName:o=""}=Ar(e),c=(await Se({aptosConfig:t,query:{query:Ao,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:o}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return c&&(c=Bs(c)),c}async function zp(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await zu({aptosConfig:t});return(await Se({aptosConfig:t,originMethod:"getAccountNames",query:{query:Ao,variables:{limit:e?.limit,offset:e?.offset,order_by:e?.orderBy,where_condition:{...n.options?.where??{},owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o}}}}})).current_aptos_names.map(Bs)}async function Dp(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await zu({aptosConfig:t});return(await Se({aptosConfig:t,originMethod:"getAccountDomains",query:{query:Ao,variables:{limit:e?.limit,offset:e?.offset,order_by:e?.orderBy,where_condition:{...n.options?.where??{},owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o},subdomain:{_eq:""}}}}})).current_aptos_names.map(Bs)}async function Mp(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await zu({aptosConfig:t});return(await Se({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:Ao,variables:{limit:e?.limit,offset:e?.offset,order_by:e?.orderBy,where_condition:{...n.options?.where??{},owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o},subdomain:{_neq:""}}}}})).current_aptos_names.map(Bs)}async function Gp(n){let{aptosConfig:t,options:e,domain:r}=n;return(await Se({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:Ao,variables:{limit:e?.limit,offset:e?.offset,order_by:e?.orderBy,where_condition:{...n.options?.where??{},domain:{_eq:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(Bs)}async function zu(n){let{aptosConfig:t}=n,e=Fn(t),[r]=await fr({aptosConfig:t,payload:{function:`${e}::config::reregistration_grace_sec`,functionArguments:[]}}),o=r/60/60/24,s=()=>new Date;return new Date(s().setDate(s().getDate()-o)).toISOString()}async function Lp(n){let{aptosConfig:t,sender:e,name:r,years:o=1,options:s}=n,i=Fn(t),c=o*31536e3,{domainName:u,subdomainName:d}=Ar(r);if(d)throw new Error("Subdomains cannot be renewed");if(o!==1)throw new Error("Currently, only 1 year renewals are supported");return await Pe({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${i}::router::renew_domain`,functionArguments:[u,c]},options:s})}function Bs(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).valueOf()}}var Ps=class{constructor(t){this.config=t}async getOwnerAddress(t){return Ip({aptosConfig:this.config,...t})}async getExpiration(t){return ku({aptosConfig:this.config,...t})}async getTargetAddress(t){return Op({aptosConfig:this.config,...t})}async setTargetAddress(t){return Np({aptosConfig:this.config,...t})}async getPrimaryName(t){return Pp({aptosConfig:this.config,...t})}async setPrimaryName(t){return Rp({aptosConfig:this.config,...t})}async registerName(t){return Bp({aptosConfig:this.config,...t})}async renewDomain(t){return Lp({aptosConfig:this.config,...t})}async getName(t){return kp({aptosConfig:this.config,...t})}async getAccountNames(t){return zp({aptosConfig:this.config,...t})}async getAccountDomains(t){return Dp({aptosConfig:this.config,...t})}async getAccountSubdomains(t){return Mp({aptosConfig:this.config,...t})}async getDomainSubdomains(t){return Gp({aptosConfig:this.config,...t})}};async function qp(n){let{aptosConfig:t,poolAddress:e}=n,r=F.from(e).toStringLong(),s=await Se({aptosConfig:t,query:{query:Fc,variables:{where_condition:{pool_address:{_eq:r}}}}});return s.num_active_delegator_per_pool[0]?s.num_active_delegator_per_pool[0].num_active_delegator:0}async function Kp(n){let{aptosConfig:t,options:e}=n,r={query:Fc,variables:{order_by:e?.orderBy}};return(await Se({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function Fp(n){let{aptosConfig:t,delegatorAddress:e,poolAddress:r}=n,o={query:Od,variables:{delegatorAddress:F.from(e).toStringLong(),poolAddress:F.from(r).toStringLong()}};return(await Se({aptosConfig:t,query:o})).delegated_staking_activities}var Rs=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"stake_processor"}),qp({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"stake_processor"}),Kp({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return await ze({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorType:"stake_processor"}),Fp({aptosConfig:this.config,...t})}};var ga=class{constructor(t){this.config=t}async simple(t){return Pe({aptosConfig:this.config,...t})}async multiAgent(t){return Pe({aptosConfig:this.config,...t})}};function Du(n,t,e){let r=e.value;return e.value=async function(...o){let[s]=o;if(s.transaction.feePayerAddress&&!s.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return r.apply(this,o)},e}function Mu(n,t,e){let r=e.value;return e.value=async function(...o){let[s]=o;if(s.transaction.feePayerAddress&&!s.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,o)},e}var No=class{constructor(t){this.config=t}async simple(t){return Bu({aptosConfig:this.config,...t})}async multiAgent(t){return Bu({aptosConfig:this.config,...t})}};Ct([Mu],No.prototype,"simple",1),Ct([Mu],No.prototype,"multiAgent",1);var ko=class{constructor(t){this.config=t}async simple(t){return da({aptosConfig:this.config,...t})}async multiAgent(t){return da({aptosConfig:this.config,...t})}};Ct([Du],ko.prototype,"simple",1),Ct([Du],ko.prototype,"multiAgent",1);var Vp=Zu($p(),1);var ha=Vp.default;var ya=()=>Math.floor(Date.now()/1e3),Ns=class{constructor(t,e,r,o,s){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=t,this.account=e,this.maxWaitTime=r,this.maximumInFlight=o,this.sleepTime=s}async nextSequenceNumber(){for(;this.lock;)await dr(this.sleepTime);this.lock=!0;let t=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let e=ya();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await dr(this.sleepTime),ya()-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}t=this.currentNumber,this.currentNumber+=BigInt(1)}catch(e){console.error("error in getting next sequence number for this account",e)}finally{this.lock=!1}return t}async initialize(){let{sequence_number:t}=await hn({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await hn({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(t),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await dr(this.sleepTime);this.lock=!0;try{await this.update();let t=ya();for(;this.lastUncommintedNumber!==this.currentNumber;)ya()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await dr(this.sleepTime),await this.update())}catch(t){console.error("error in synchronizing this account sequence number with the one on chain",t)}finally{this.lock=!1}}}};var zo=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(t){if(this.cancelled=!1,this.pendingDequeue.length>0){this.pendingDequeue.shift()?.resolve(t);return}this.queue.push(t)}async dequeue(){return this.queue.length>0?Promise.resolve(this.queue.shift()):new Promise((t,e)=>{this.pendingDequeue.push({resolve:t,reject:e})})}isEmpty(){return this.queue.length===0}cancel(){this.cancelled=!0,this.pendingDequeue.forEach(async({reject:t})=>{t(new Do("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},Do=class extends Error{};var Lu="fulfilled",qu=(s=>(s.TransactionSent="transactionSent",s.TransactionSendFailed="transactionSendFailed",s.TransactionExecuted="transactionExecuted",s.TransactionExecutionFailed="transactionExecutionFailed",s.ExecutionFinish="executionFinish",s))(qu||{}),ks=class extends ha{constructor(e,r,o=30,s=100,i=10){super();this.taskQueue=new zo;this.transactionsQueue=new zo;this.outstandingTransactions=new zo;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=e,this.account=r,this.started=!1,this.accountSequnceNumber=new Ns(e,r,o,s,i)}async submitNextTransaction(){try{for(;;){let e=await this.accountSequnceNumber.nextSequenceNumber();if(e===null)return;let r=await this.generateNextTransaction(this.account,e);if(!r)return;let o=_s({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([o,e])}}catch(e){if(e instanceof Do)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${e}`)}}async processTransactions(){try{for(;;){let e=[],r=[],[o,s]=await this.outstandingTransactions.dequeue();for(e.push(o),r.push(s);!this.outstandingTransactions.isEmpty();)[o,s]=await this.outstandingTransactions.dequeue(),e.push(o),r.push(s);let i=await Promise.allSettled(e);for(let c=0;c<i.length&&c<r.length;c+=1){let u=i[c];s=r[c],u.status===Lu?(this.sentTransactions.push([u.value.hash,s,null]),this.emit("transactionSent",{message:`transaction hash ${u.value.hash} has been committed to chain`,transactionHash:u.value.hash}),await this.checkTransaction(u,s)):(this.sentTransactions.push([u.status,s,u.reason]),this.emit("transactionSendFailed",{message:`failed to commit transaction ${this.sentTransactions.length} with error ${u.reason}`,error:u.reason}))}this.emit("executionFinish",{message:`execute ${i.length} transactions finished`})}}catch(e){if(e instanceof Do)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${e}`)}}async checkTransaction(e,r){try{let o=[];o.push(bo({aptosConfig:this.aptosConfig,transactionHash:e.value.hash}));let s=await Promise.allSettled(o);for(let i=0;i<s.length;i+=1){let c=s[i];c.status===Lu?(this.executedTransactions.push([c.value.hash,r,null]),this.emit("transactionExecuted",{message:`transaction hash ${c.value.hash} has been executed on chain`,transactionHash:e.value.hash})):(this.executedTransactions.push([c.status,r,c.reason]),this.emit("transactionExecutionFailed",{message:`failed to execute transaction ${this.executedTransactions.length} with error ${c.reason}`,error:c.reason}))}}catch(o){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${o}`)}}async push(e,r){await this.transactionsQueue.enqueue([e,r])}async generateNextTransaction(e,r){if(this.transactionsQueue.isEmpty())return;let[o,s]=await this.transactionsQueue.dequeue();return await Pe({aptosConfig:this.aptosConfig,sender:e.accountAddress,data:o,options:{...s,accountSequenceNumber:r}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(e){throw new Error(`Unable to start transaction batching: ${e}`)}}start(){if(this.started)throw new Error("worker has already started");this.started=!0,this.taskQueue.enqueue(()=>this.submitNextTransaction()),this.taskQueue.enqueue(()=>this.processTransactions()),this.run()}stop(){if(this.taskQueue.isCancelled())throw new Error("worker has already stopped");this.started=!1,this.taskQueue.cancel()}};var Aa=class extends ha{constructor(e){super();this.config=e}start(e){let{sender:r}=e;this.account=r,this.transactionWorker=new ks(this.config,r),this.transactionWorker.start(),this.registerToEvents()}push(e){let{data:r,options:o}=e;for(let s of r)this.transactionWorker.push(s,o)}registerToEvents(){this.transactionWorker.on("transactionSent",async e=>{this.emit("transactionSent",e)}),this.transactionWorker.on("transactionSendFailed",async e=>{this.emit("transactionSendFailed",e)}),this.transactionWorker.on("transactionExecuted",async e=>{this.emit("transactionExecuted",e)}),this.transactionWorker.on("transactionExecutionFailed",async e=>{this.emit("transactionExecutionFailed",e)}),this.transactionWorker.on("executionFinish",async e=>{this.emit("executionFinish",e)})}forSingleAccount(e){try{let{sender:r,data:o,options:s}=e;this.start({sender:r}),this.push({data:o,options:s})}catch(r){throw new Error(`failed to submit transactions with error: ${r}`)}}};var zs=class{constructor(t){this.config=t,this.build=new ga(this.config),this.simulate=new No(this.config),this.submit=new ko(this.config),this.batch=new Aa(this.config)}async getTransactions(t){return nl({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return rl({aptosConfig:this.config,...t})}async getTransactionByHash(t){return Ni({aptosConfig:this.config,...t})}async isPendingTransaction(t){return ol({aptosConfig:this.config,...t})}async waitForTransaction(t){return bo({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return Oi({aptosConfig:this.config})}getSigningMessage(t){return Yl(t)}async publishPackageTransaction(t){return Zl({aptosConfig:this.config,...t})}async rotateAuthKey(t){return Xl({aptosConfig:this.config,...t})}sign(t){return fa({...t})}signAsFeePayer(t){let{signer:e,transaction:r}=t;if(!r.feePayerAddress)throw new Error(`Transaction ${r} is not a Fee Payer transaction`);return r.feePayerAddress=e.accountAddress,fa({signer:e,transaction:r})}async batchTransactionsForSingleAccount(t){try{let{sender:e,data:r,options:o}=t;this.batch.forSingleAccount({sender:e,data:r,options:o})}catch(e){throw new Error(`failed to submit transactions with error: ${e}`)}}async signAndSubmitTransaction(t){let{signer:e,transaction:r}=t;return _s({aptosConfig:this.config,signer:e,transaction:r})}};var zt=class{constructor(t){this.config=new ps(t),this.account=new rs(this.config),this.ans=new Ps(this.config),this.coin=new Es(this.config),this.digitalAsset=new Ss(this.config),this.event=new vs(this.config),this.faucet=new Cs(this.config),this.fungibleAsset=new Us(this.config),this.general=new Is(this.config),this.staking=new Rs(this.config),this.transaction=new zs(this.config)}};function _n(n,t,e){Object.getOwnPropertyNames(t.prototype).forEach(r=>{let o=Object.getOwnPropertyDescriptor(t.prototype,r);o&&(o.value=function(...s){return this[e][r](...s)},Object.defineProperty(n.prototype,r,o))})}_n(zt,rs,"account");_n(zt,Ps,"ans");_n(zt,Es,"coin");_n(zt,Ss,"digitalAsset");_n(zt,vs,"event");_n(zt,Cs,"faucet");_n(zt,Us,"fungibleAsset");_n(zt,Is,"general");_n(zt,Rs,"staking");_n(zt,zs,"transaction");return tg(Hy);})();
431
431
  /*! Bundled license information:
432
432
 
433
433
  @noble/hashes/esm/utils.js: