@aptos-labs/ts-sdk 1.5.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 (169) hide show
  1. package/dist/browser/index.global.js +1 -1
  2. package/dist/browser/index.global.js.map +1 -1
  3. package/dist/common/index.js +1 -1
  4. package/dist/common/index.js.map +1 -1
  5. package/dist/esm/api/account.mjs +1 -1
  6. package/dist/esm/api/ans.mjs +1 -1
  7. package/dist/esm/api/aptos.mjs +1 -1
  8. package/dist/esm/api/coin.mjs +1 -1
  9. package/dist/esm/api/digitalAsset.mjs +1 -1
  10. package/dist/esm/api/event.mjs +1 -1
  11. package/dist/esm/api/faucet.mjs +1 -1
  12. package/dist/esm/api/fungibleAsset.mjs +1 -1
  13. package/dist/esm/api/general.mjs +1 -1
  14. package/dist/esm/api/index.mjs +1 -1
  15. package/dist/esm/api/staking.mjs +1 -1
  16. package/dist/esm/api/transaction.mjs +1 -1
  17. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  18. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  19. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  20. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  21. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  22. package/dist/esm/api/utils.mjs +1 -1
  23. package/dist/esm/bcs/index.mjs +1 -1
  24. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  25. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  26. package/dist/esm/{chunk-5YEWYQYB.mjs → chunk-25YXK6L2.mjs} +2 -2
  27. package/dist/esm/{chunk-UUDSB4PL.mjs → chunk-2BSSYT6I.mjs} +2 -2
  28. package/dist/esm/{chunk-27YNIEGN.mjs → chunk-2MOYURM2.mjs} +2 -2
  29. package/dist/esm/{chunk-YWXYB7J2.mjs → chunk-2RN7N3EO.mjs} +2 -2
  30. package/dist/esm/{chunk-LT3YQOAJ.mjs → chunk-3T4NSGK5.mjs} +2 -2
  31. package/dist/esm/{chunk-NWRKJFHV.mjs → chunk-4QWK47EH.mjs} +2 -2
  32. package/dist/esm/{chunk-AEM3D7EJ.mjs → chunk-4TGKQEEE.mjs} +2 -2
  33. package/dist/esm/{chunk-4YLVLXBU.mjs → chunk-6IMEQXW4.mjs} +2 -2
  34. package/dist/esm/{chunk-UFNOMNAH.mjs → chunk-6KILJ43F.mjs} +2 -2
  35. package/dist/esm/{chunk-7G6Q5OZU.mjs → chunk-6XQ33PLM.mjs} +2 -2
  36. package/dist/esm/{chunk-SBMJNU2O.mjs → chunk-7WQA7OMS.mjs} +2 -2
  37. package/dist/esm/{chunk-YVSIS6BA.mjs → chunk-ACMNL2LL.mjs} +2 -2
  38. package/dist/esm/{chunk-2QV6HI3M.mjs → chunk-APOQ4ODM.mjs} +2 -2
  39. package/dist/esm/{chunk-7FQQLRCP.mjs → chunk-ATHZ7INX.mjs} +2 -2
  40. package/dist/esm/{chunk-VVSHMXN7.mjs → chunk-BDHRLMQP.mjs} +2 -2
  41. package/dist/esm/{chunk-7OEIQQ6R.mjs → chunk-BQYQ45QQ.mjs} +2 -2
  42. package/dist/esm/{chunk-AKKHTLMY.mjs → chunk-C53MNMPH.mjs} +2 -2
  43. package/dist/esm/{chunk-NIGVPRZ6.mjs → chunk-CFQDJZBD.mjs} +2 -2
  44. package/dist/esm/{chunk-ZDDVIMPX.mjs → chunk-DHFOORW6.mjs} +2 -2
  45. package/dist/esm/{chunk-LQO2NP7Q.mjs → chunk-DIWRS4YQ.mjs} +2 -2
  46. package/dist/esm/{chunk-2L25JUOZ.mjs → chunk-DSGIOUTJ.mjs} +2 -2
  47. package/dist/esm/{chunk-IHBKJDF3.mjs → chunk-ED2OMOMT.mjs} +2 -2
  48. package/dist/esm/{chunk-5LVAL5L5.mjs → chunk-FE2DRPX7.mjs} +2 -2
  49. package/dist/esm/{chunk-ERWQOVBF.mjs → chunk-FGHNLZRH.mjs} +2 -2
  50. package/dist/esm/{chunk-OZWFV4NN.mjs → chunk-FHUT4EJH.mjs} +2 -2
  51. package/dist/esm/{chunk-6DJNNRXC.mjs → chunk-HT6K4NWZ.mjs} +2 -2
  52. package/dist/esm/{chunk-DGHZH65W.mjs → chunk-HV4ZPHSZ.mjs} +2 -2
  53. package/dist/esm/{chunk-FDHCHIQ7.mjs → chunk-IK7JAKXG.mjs} +2 -2
  54. package/dist/esm/{chunk-UCHGKGCF.mjs → chunk-J46VAO6L.mjs} +2 -2
  55. package/dist/esm/{chunk-SNPLEVUU.mjs → chunk-J4CN3Q2R.mjs} +2 -2
  56. package/dist/esm/{chunk-BYMM43DU.mjs → chunk-JBWJE4IP.mjs} +2 -2
  57. package/dist/esm/{chunk-A4FV3LLX.mjs → chunk-JMV2QDNW.mjs} +2 -2
  58. package/dist/esm/{chunk-WYHDRLPQ.mjs → chunk-JRQMEVDE.mjs} +2 -2
  59. package/dist/esm/{chunk-VO2CATMP.mjs → chunk-K6IBDLVC.mjs} +2 -2
  60. package/dist/esm/{chunk-C65GKQ3P.mjs → chunk-LFWMWCS3.mjs} +2 -2
  61. package/dist/esm/{chunk-RR2M6HEQ.mjs → chunk-NXAHJ4KY.mjs} +2 -2
  62. package/dist/esm/{chunk-FBFMQZTM.mjs → chunk-P7B32QR3.mjs} +2 -2
  63. package/dist/esm/{chunk-RNO5ZG3C.mjs → chunk-PPNI7SJK.mjs} +2 -2
  64. package/dist/esm/{chunk-JZTWL2U4.mjs → chunk-QYB75IJ6.mjs} +2 -2
  65. package/dist/esm/{chunk-TXZRELMU.mjs → chunk-R3URESCV.mjs} +2 -2
  66. package/dist/esm/{chunk-NI7GRYCP.mjs → chunk-TRTTUBC4.mjs} +2 -2
  67. package/dist/esm/{chunk-VEH3IYGS.mjs → chunk-VP5JCW6I.mjs} +2 -2
  68. package/dist/esm/{chunk-NTCYNTCE.mjs → chunk-W5PZ5Z4H.mjs} +2 -2
  69. package/dist/esm/{chunk-FP5DPRYL.mjs → chunk-WXWFKCGO.mjs} +2 -2
  70. package/dist/esm/chunk-X3SXV2RB.mjs +2 -0
  71. package/dist/esm/{chunk-3ZXA5RXM.mjs.map → chunk-X3SXV2RB.mjs.map} +1 -1
  72. package/dist/esm/{chunk-4RCHQ5OG.mjs → chunk-ZDT4TIOP.mjs} +2 -2
  73. package/dist/esm/client/core.mjs +1 -1
  74. package/dist/esm/client/get.mjs +1 -1
  75. package/dist/esm/client/index.mjs +1 -1
  76. package/dist/esm/client/post.mjs +1 -1
  77. package/dist/esm/core/account.mjs +1 -1
  78. package/dist/esm/core/accountAddress.mjs +1 -1
  79. package/dist/esm/core/authenticationKey.mjs +1 -1
  80. package/dist/esm/core/crypto/anyPublicKey.mjs +1 -1
  81. package/dist/esm/core/crypto/anySignature.mjs +1 -1
  82. package/dist/esm/core/crypto/asymmetricCrypto.mjs +1 -1
  83. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  84. package/dist/esm/core/crypto/index.mjs +1 -1
  85. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  86. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  87. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  88. package/dist/esm/core/index.mjs +1 -1
  89. package/dist/esm/index.mjs +1 -1
  90. package/dist/esm/internal/account.mjs +1 -1
  91. package/dist/esm/internal/ans.mjs +1 -1
  92. package/dist/esm/internal/coin.mjs +1 -1
  93. package/dist/esm/internal/digitalAsset.mjs +1 -1
  94. package/dist/esm/internal/event.mjs +1 -1
  95. package/dist/esm/internal/faucet.mjs +1 -1
  96. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  97. package/dist/esm/internal/general.mjs +1 -1
  98. package/dist/esm/internal/staking.mjs +1 -1
  99. package/dist/esm/internal/transaction.mjs +1 -1
  100. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  101. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  102. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  103. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  104. package/dist/esm/transactions/index.mjs +1 -1
  105. package/dist/esm/transactions/instances/index.mjs +1 -1
  106. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  107. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  108. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  109. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  110. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  111. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  112. package/dist/esm/transactions/management/index.mjs +1 -1
  113. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  114. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  115. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  116. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  117. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  118. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  119. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  120. package/dist/esm/version.d.mts +1 -1
  121. package/dist/esm/version.mjs +1 -1
  122. package/package.json +3 -3
  123. package/src/version.ts +1 -1
  124. package/dist/esm/chunk-3ZXA5RXM.mjs +0 -2
  125. /package/dist/esm/{chunk-5YEWYQYB.mjs.map → chunk-25YXK6L2.mjs.map} +0 -0
  126. /package/dist/esm/{chunk-UUDSB4PL.mjs.map → chunk-2BSSYT6I.mjs.map} +0 -0
  127. /package/dist/esm/{chunk-27YNIEGN.mjs.map → chunk-2MOYURM2.mjs.map} +0 -0
  128. /package/dist/esm/{chunk-YWXYB7J2.mjs.map → chunk-2RN7N3EO.mjs.map} +0 -0
  129. /package/dist/esm/{chunk-LT3YQOAJ.mjs.map → chunk-3T4NSGK5.mjs.map} +0 -0
  130. /package/dist/esm/{chunk-NWRKJFHV.mjs.map → chunk-4QWK47EH.mjs.map} +0 -0
  131. /package/dist/esm/{chunk-AEM3D7EJ.mjs.map → chunk-4TGKQEEE.mjs.map} +0 -0
  132. /package/dist/esm/{chunk-4YLVLXBU.mjs.map → chunk-6IMEQXW4.mjs.map} +0 -0
  133. /package/dist/esm/{chunk-UFNOMNAH.mjs.map → chunk-6KILJ43F.mjs.map} +0 -0
  134. /package/dist/esm/{chunk-7G6Q5OZU.mjs.map → chunk-6XQ33PLM.mjs.map} +0 -0
  135. /package/dist/esm/{chunk-SBMJNU2O.mjs.map → chunk-7WQA7OMS.mjs.map} +0 -0
  136. /package/dist/esm/{chunk-YVSIS6BA.mjs.map → chunk-ACMNL2LL.mjs.map} +0 -0
  137. /package/dist/esm/{chunk-2QV6HI3M.mjs.map → chunk-APOQ4ODM.mjs.map} +0 -0
  138. /package/dist/esm/{chunk-7FQQLRCP.mjs.map → chunk-ATHZ7INX.mjs.map} +0 -0
  139. /package/dist/esm/{chunk-VVSHMXN7.mjs.map → chunk-BDHRLMQP.mjs.map} +0 -0
  140. /package/dist/esm/{chunk-7OEIQQ6R.mjs.map → chunk-BQYQ45QQ.mjs.map} +0 -0
  141. /package/dist/esm/{chunk-AKKHTLMY.mjs.map → chunk-C53MNMPH.mjs.map} +0 -0
  142. /package/dist/esm/{chunk-NIGVPRZ6.mjs.map → chunk-CFQDJZBD.mjs.map} +0 -0
  143. /package/dist/esm/{chunk-ZDDVIMPX.mjs.map → chunk-DHFOORW6.mjs.map} +0 -0
  144. /package/dist/esm/{chunk-LQO2NP7Q.mjs.map → chunk-DIWRS4YQ.mjs.map} +0 -0
  145. /package/dist/esm/{chunk-2L25JUOZ.mjs.map → chunk-DSGIOUTJ.mjs.map} +0 -0
  146. /package/dist/esm/{chunk-IHBKJDF3.mjs.map → chunk-ED2OMOMT.mjs.map} +0 -0
  147. /package/dist/esm/{chunk-5LVAL5L5.mjs.map → chunk-FE2DRPX7.mjs.map} +0 -0
  148. /package/dist/esm/{chunk-ERWQOVBF.mjs.map → chunk-FGHNLZRH.mjs.map} +0 -0
  149. /package/dist/esm/{chunk-OZWFV4NN.mjs.map → chunk-FHUT4EJH.mjs.map} +0 -0
  150. /package/dist/esm/{chunk-6DJNNRXC.mjs.map → chunk-HT6K4NWZ.mjs.map} +0 -0
  151. /package/dist/esm/{chunk-DGHZH65W.mjs.map → chunk-HV4ZPHSZ.mjs.map} +0 -0
  152. /package/dist/esm/{chunk-FDHCHIQ7.mjs.map → chunk-IK7JAKXG.mjs.map} +0 -0
  153. /package/dist/esm/{chunk-UCHGKGCF.mjs.map → chunk-J46VAO6L.mjs.map} +0 -0
  154. /package/dist/esm/{chunk-SNPLEVUU.mjs.map → chunk-J4CN3Q2R.mjs.map} +0 -0
  155. /package/dist/esm/{chunk-BYMM43DU.mjs.map → chunk-JBWJE4IP.mjs.map} +0 -0
  156. /package/dist/esm/{chunk-A4FV3LLX.mjs.map → chunk-JMV2QDNW.mjs.map} +0 -0
  157. /package/dist/esm/{chunk-WYHDRLPQ.mjs.map → chunk-JRQMEVDE.mjs.map} +0 -0
  158. /package/dist/esm/{chunk-VO2CATMP.mjs.map → chunk-K6IBDLVC.mjs.map} +0 -0
  159. /package/dist/esm/{chunk-C65GKQ3P.mjs.map → chunk-LFWMWCS3.mjs.map} +0 -0
  160. /package/dist/esm/{chunk-RR2M6HEQ.mjs.map → chunk-NXAHJ4KY.mjs.map} +0 -0
  161. /package/dist/esm/{chunk-FBFMQZTM.mjs.map → chunk-P7B32QR3.mjs.map} +0 -0
  162. /package/dist/esm/{chunk-RNO5ZG3C.mjs.map → chunk-PPNI7SJK.mjs.map} +0 -0
  163. /package/dist/esm/{chunk-JZTWL2U4.mjs.map → chunk-QYB75IJ6.mjs.map} +0 -0
  164. /package/dist/esm/{chunk-TXZRELMU.mjs.map → chunk-R3URESCV.mjs.map} +0 -0
  165. /package/dist/esm/{chunk-NI7GRYCP.mjs.map → chunk-TRTTUBC4.mjs.map} +0 -0
  166. /package/dist/esm/{chunk-VEH3IYGS.mjs.map → chunk-VP5JCW6I.mjs.map} +0 -0
  167. /package/dist/esm/{chunk-NTCYNTCE.mjs.map → chunk-W5PZ5Z4H.mjs.map} +0 -0
  168. /package/dist/esm/{chunk-FP5DPRYL.mjs.map → chunk-WXWFKCGO.mjs.map} +0 -0
  169. /package/dist/esm/{chunk-4RCHQ5OG.mjs.map → chunk-ZDT4TIOP.mjs.map} +0 -0
@@ -1,4 +1,4 @@
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.0";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=`
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