@laceio/sdk 0.1.1 → 0.1.2-canary.0

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 (388) hide show
  1. package/dist/{TransactionBuilder-DrB3NVTi.cjs → TransactionBuilder-CCjOn7NA.cjs} +42 -0
  2. package/dist/{TransactionBuilder-V6aLx4SV.js → TransactionBuilder-CIzdw18M.js} +1 -1
  3. package/dist/{_polyfill-buffer-patch-BnPVerlG.cjs → _polyfill-buffer-patch-CM8X7JiY.cjs} +21 -2
  4. package/dist/_polyfill-buffer-patch-yNxN4d5E.js +1467 -0
  5. package/dist/_web-crypto-random-bytes-Bo-GTcRS.js +197 -0
  6. package/dist/acc-module-4iIUv6My.cjs +27654 -0
  7. package/dist/acc-module-Cmj8EsIb.js +27624 -0
  8. package/dist/account-BOQruszJ.js +6 -0
  9. package/dist/account-BUOj4pYJ.cjs +11 -0
  10. package/dist/account-call-7wnopBq0.cjs +5 -0
  11. package/dist/account-call-B9d_2Xwi.js +4 -0
  12. package/dist/account-call-Bd4Rpbvt.cjs +323 -0
  13. package/dist/account-call-C3CkDqEC.js +276 -0
  14. package/dist/account-guards-BtjTGxDZ.cjs +42 -0
  15. package/dist/account-guards-D9Lu5T3W.js +36 -0
  16. package/dist/account-tokens-DvkOFVON.js +16 -0
  17. package/dist/account-tokens-nwcvwLu4.cjs +21 -0
  18. package/dist/{activity-type.stable-BJEfeLxL.cjs → activity-type-Ch6ljxBy.cjs} +2 -1
  19. package/dist/{activity-type.stable-C76_hWd7.js → activity-type-GsJGWs-3.js} +2 -1
  20. package/dist/address-B9ntKL8K.js +13761 -0
  21. package/dist/address-BXp-mY8H.cjs +11270 -0
  22. package/dist/{address-book-address-validator-DIUolI-s.js → address-book-address-validator-0J9XAADH.js} +2 -2
  23. package/dist/address-book-address-validator-DK0dnsRS.cjs +41 -0
  24. package/dist/address-book-address-validator-Di_ywo8M.js +39 -0
  25. package/dist/{address-book-address-validator-DNwQGlOB.cjs → address-book-address-validator-Dte_YQ2L.cjs} +2 -2
  26. package/dist/artefact-loader-BWWYAD7E.cjs +183 -0
  27. package/dist/artefact-loader-Dik4HIfv.js +160 -0
  28. package/dist/auto-dismiss-failure-on-success-C-qoJuid.cjs +37 -0
  29. package/dist/auto-dismiss-failure-on-success-s8MGDEIu.js +31 -0
  30. package/dist/bip32-D6wd_QMn.cjs +3851 -0
  31. package/dist/bitcoin-data-provider-BYPSmuZS.js +21 -0
  32. package/dist/bitcoin-data-provider-w1oEDSU3.cjs +26 -0
  33. package/dist/bitcoin.cjs +45 -0
  34. package/dist/bitcoin.d.ts +29906 -1
  35. package/dist/bitcoin.js +20 -0
  36. package/dist/{blockfrost-tx-submit-provider-DPTrapz-.js → blockfrost-tx-submit-provider-CBWQ0wK9.js} +5 -157
  37. package/dist/{blockfrost-tx-submit-provider-BAIzV5o3.cjs → blockfrost-tx-submit-provider-CLNQ5ycR.cjs} +3 -167
  38. package/dist/bn-d3nSOIf7.cjs +2553 -0
  39. package/dist/browser-B1eMbDwh.js +7468 -0
  40. package/dist/bytes.vo-BB7_4JK6.js +23 -0
  41. package/dist/bytes.vo-BNRquqaO.cjs +34 -0
  42. package/dist/cardano-DfPwhwm-.js +3 -0
  43. package/dist/{cardano-network-id.vo-DSxrFk9S.cjs → cardano-network-id.vo-BEDPn6Li.cjs} +1 -1
  44. package/dist/{cardano-network-id.vo-CK1tNQDg.js → cardano-network-id.vo-Cfpvbod9.js} +1 -1
  45. package/dist/cardano.cjs +22 -18
  46. package/dist/cardano.d.ts +16956 -1716
  47. package/dist/cardano.js +16 -11
  48. package/dist/client-DXBLHk7K.cjs +808 -0
  49. package/dist/codecs-Cswkg7Tm.cjs +4051 -0
  50. package/dist/codecs-Dc1Krpbt.js +3903 -0
  51. package/dist/{const-C84qHkjp.js → const-BJfIK_G-.js} +4 -4
  52. package/dist/const-BhYOdznB.cjs +42 -0
  53. package/dist/const-BsnjG2_Q.cjs +32071 -0
  54. package/dist/const-CUnCl5U0.js +13 -0
  55. package/dist/{const-DXk2tFyv.js → const-CjmfjBP3.js} +1 -1
  56. package/dist/{const-BDEg2Trq.cjs → const-D-eZIS4n.cjs} +4 -4
  57. package/dist/const-D0CbQlo4.js +154 -0
  58. package/dist/{const-BY8B3_0_.cjs → const-iwzZEE_w.cjs} +1 -1
  59. package/dist/contract-1R86jhSw.js +171 -0
  60. package/dist/contract-MKLzYVkW.cjs +189 -0
  61. package/dist/create-add-accounts-Brqk84vF.js +102 -0
  62. package/dist/create-add-accounts-DzXIh7Ot.cjs +114 -0
  63. package/dist/{delegation-tx-builder-CRpLP6jH.cjs → delegation-tx-builder-CCjiakoy.cjs} +6 -6
  64. package/dist/{delegation-tx-builder-CGVqlaFE.js → delegation-tx-builder-DZFjHDS8.js} +5 -5
  65. package/dist/{deregistration-tx-builder-B-CrUyX6.js → deregistration-tx-builder-Bf6xAYp4.js} +5 -5
  66. package/dist/{deregistration-tx-builder-DZGwB4cz.cjs → deregistration-tx-builder-CQP35yex.cjs} +6 -6
  67. package/dist/device-commitment-hex.vo-5wFtQvDS.js +26 -0
  68. package/dist/device-commitment-hex.vo-CT3RmAug.cjs +31 -0
  69. package/dist/device-readers-CUHYoYOH.js +145 -0
  70. package/dist/device-readers-CdxS2btd.cjs +168 -0
  71. package/dist/device-readers-D_JZeNL2.cjs +8 -0
  72. package/dist/device-readers-DwSNCGPP.js +4 -0
  73. package/dist/dist-BMi5ZjEq.cjs +43175 -0
  74. package/dist/dist-BtIq4XFn.cjs +535 -0
  75. package/dist/dist-C3SHC_Ho.cjs +1394 -0
  76. package/dist/dist-CykEjYEX.cjs +3814 -0
  77. package/dist/dist-Dcsxh3be.cjs +3452 -0
  78. package/dist/dist-DqJfSlTd.cjs +4413 -0
  79. package/dist/dist-nTZ70qj7.cjs +1306 -0
  80. package/dist/{earn-rewards-tx-builder-BDbTDZmD.js → earn-rewards-tx-builder-Bsga3yFb.js} +5 -5
  81. package/dist/{earn-rewards-tx-builder-D5sUT5v8.cjs → earn-rewards-tx-builder-GuxofYns.cjs} +6 -6
  82. package/dist/enc-key-circuits-B7BjgUL9.js +13 -0
  83. package/dist/enc-key-circuits-BLrZrBVI.cjs +24 -0
  84. package/dist/english-Byb9M0E_.cjs +2057 -0
  85. package/dist/envelopes-BGoO_v8m.js +1621 -0
  86. package/dist/envelopes-CH25R-DN.cjs +1722 -0
  87. package/dist/errors-BIftM8ZN.cjs +688 -0
  88. package/dist/errors-DSq5wUwt.js +466 -0
  89. package/dist/esm-HBSUQw3w.js +384 -0
  90. package/dist/esm-LZuaZjMf.cjs +389 -0
  91. package/dist/experimental.cjs +7349 -0
  92. package/dist/experimental.d.ts +86273 -0
  93. package/dist/experimental.js +7184 -0
  94. package/dist/gated-call-CDCVZIK-.cjs +5 -0
  95. package/dist/gated-call-D-tT7P_t.js +722 -0
  96. package/dist/gated-call-D_VT2quk.js +4 -0
  97. package/dist/gated-call-DgJm1Mi_.cjs +787 -0
  98. package/dist/grant-circuits-DswmW3nI.cjs +71 -0
  99. package/dist/grant-circuits-Jxb5y1HW.js +42 -0
  100. package/dist/grant-rules-By07_eDi.js +6824 -0
  101. package/dist/grant-rules-BzVTWXS7.cjs +7099 -0
  102. package/dist/grant-spend-B3Md9L0n.js +215 -0
  103. package/dist/grant-spend-oWmzRsjH.cjs +217 -0
  104. package/dist/grant-status-B2y49iIu.js +2688 -0
  105. package/dist/grant-status-DOr3t_u8.cjs +2820 -0
  106. package/dist/grants-2BZ-qEVQ.js +5 -0
  107. package/dist/grants-BPoLSiMt.cjs +18 -0
  108. package/dist/grants-BoI5uwSF.cjs +272 -0
  109. package/dist/grants-CtofFu-e.js +213 -0
  110. package/dist/{group-cardano-addresses-by-account-B533oVXR.cjs → group-cardano-addresses-by-account-Bp0g4wEY.cjs} +3 -39
  111. package/dist/{group-cardano-addresses-by-account-RHKoEskR.js → group-cardano-addresses-by-account-SR8MMrZf.js} +5 -35
  112. package/dist/{guarded-transaction-signer-Bxl6_XNd.cjs → guarded-transaction-signer-MFpPg98D.cjs} +17 -18
  113. package/dist/{guarded-transaction-signer-CpKLj8Kp.js → guarded-transaction-signer-P6Rp1faj.js} +8 -15
  114. package/dist/hex-D9ITYbwt.cjs +263 -0
  115. package/dist/hex-mkXcV3pN.js +191 -0
  116. package/dist/http-client-B3N-TMxu.cjs +167 -0
  117. package/dist/http-client-TRlhDZGh.js +155 -0
  118. package/dist/identity-BMLuufva.cjs +263 -0
  119. package/dist/identity-DII6f-h7.js +233 -0
  120. package/dist/in-memory-wallet-integration-B2xzxORj.cjs +20741 -0
  121. package/dist/in-memory-wallet-integration-CBRiPjLO.js +130 -0
  122. package/dist/in-memory-wallet-integration-CULUB5Tf.cjs +240 -0
  123. package/dist/{in-memory-wallet-integration-D-qn65Kx.js → in-memory-wallet-integration-ChIOirMW.js} +5 -2
  124. package/dist/{in-memory-wallet-integration-Croiuopx.js → in-memory-wallet-integration-CljprQQV.js} +7 -104
  125. package/dist/{in-memory-wallet-integration-DVh9sRXa.cjs → in-memory-wallet-integration-Cm6P8sk6.cjs} +3 -2
  126. package/dist/in-memory-wallet-integration-TM9bBphA.js +20738 -0
  127. package/dist/{in-memory-wallet-integration-CnLYeX4-.cjs → in-memory-wallet-integration-t9I00R_V.cjs} +17 -108
  128. package/dist/index.cjs +84 -47
  129. package/dist/index.d.ts +37496 -10033
  130. package/dist/index.js +52 -24
  131. package/dist/{init-CLHuAMB-.js → init-0zzs9aqU.js} +4 -4
  132. package/dist/{init-U8c9yHYx.cjs → init-5KcGcBb5.cjs} +1 -1
  133. package/dist/init-8v_n8boO.js +1177 -0
  134. package/dist/{init-CigestoM.js → init-B3-1ghyx.js} +2 -2
  135. package/dist/init-B8U3ABhS.cjs +107 -0
  136. package/dist/init-BJn-8_hf.js +141 -0
  137. package/dist/init-BPU3j8sT.cjs +6 -0
  138. package/dist/init-BRzH6xu-2.cjs +2797 -0
  139. package/dist/init-BmzfDaKL.js +1142 -0
  140. package/dist/{init-C-jErzp5.cjs → init-BopV9ed4.cjs} +2 -2
  141. package/dist/init-BpHTq2R5.js +105 -0
  142. package/dist/init-BpSITBfF.js +39 -0
  143. package/dist/{init-DX4WyB0R.cjs → init-BrdVzxei.cjs} +3 -3
  144. package/dist/{init-LfyMo-sS.cjs → init-BwkU0ruo.cjs} +2 -2
  145. package/dist/{init-CB__aLD7.cjs → init-C-G32J12.cjs} +2 -2
  146. package/dist/init-C00gw1zi.js +422 -0
  147. package/dist/{init-TkPq_Ny_.js → init-C2RgrfZe.js} +1 -1
  148. package/dist/{init-DcYY6zMD.js → init-C8URA2OX.js} +1 -1
  149. package/dist/init-CDkRynJa.js +2796 -0
  150. package/dist/{init-Cg9XdAru.js → init-CNM5m7M2.js} +4 -4
  151. package/dist/init-CR7BfztQ.cjs +18 -0
  152. package/dist/{init-CSHwHnfg.cjs → init-CSDpdu0Q.cjs} +2 -2
  153. package/dist/{init-aJHl-7AO.js → init-CX0AMQUn.js} +2 -2
  154. package/dist/{init-FMGDET-9.js → init-CfTbSEKy.js} +259 -60
  155. package/dist/{init-CR6tpw1B.js → init-Cigr_tKx.js} +47 -43
  156. package/dist/init-CuW7rHNA.js +3584 -0
  157. package/dist/{init-CFYsq82V.js → init-CyAY4Lzl.js} +1 -1
  158. package/dist/init-Cz0rz5fU.cjs +3585 -0
  159. package/dist/{init-BKhH6mVR.cjs → init-D6BxBs7e.cjs} +1 -1
  160. package/dist/init-D8OeObDF.cjs +1141 -0
  161. package/dist/init-D9g1HXYf.cjs +40 -0
  162. package/dist/{init-CNLGJJRx.js → init-DA7zmptx.js} +1 -1
  163. package/dist/{init-DkIc5nqF.cjs → init-DFMiP2ZH.cjs} +1 -1
  164. package/dist/{init-zSzCjoor.js → init-DFjT8YvT.js} +4 -4
  165. package/dist/init-DGjXwWs2.cjs +143 -0
  166. package/dist/init-DHrCbpkW.cjs +121 -0
  167. package/dist/{init-B64zCLxG.cjs → init-DUF4ar8P.cjs} +4 -4
  168. package/dist/init-DlqJuHhl.js +119 -0
  169. package/dist/{init-y2Ra0vZP.js → init-Dnsv155v.js} +3 -3
  170. package/dist/init-DrRdf5sZ.cjs +1176 -0
  171. package/dist/init-DuYENxci.js +17 -0
  172. package/dist/{init-D6DBUsD3.cjs → init-Dv3zKj0r.cjs} +4 -4
  173. package/dist/{init-BtzMZ7Pk.cjs → init-Dy-05ktr.cjs} +1 -1
  174. package/dist/{init-BsCBAGWf.cjs → init-EP0CUWNK.cjs} +2 -2
  175. package/dist/{init-BJVU54pI.cjs → init-EhzD7a8i.cjs} +1 -1
  176. package/dist/{init-w9GEs73W.js → init-Fw89ZmrR.js} +2 -2
  177. package/dist/init-GsT2AEa4.cjs +424 -0
  178. package/dist/{init-Rxohwpmu.js → init-NCjgwCZy.js} +2 -2
  179. package/dist/{init-DxUHsN53.cjs → init-NdhG_VrF.cjs} +6 -6
  180. package/dist/{init-DDdhguVC.js → init-SZ01tARX2.js} +2 -2
  181. package/dist/{init-BAJJzBza.js → init-Y3mkB4XS.js} +2 -2
  182. package/dist/init-c4l6r-o-.js +5 -0
  183. package/dist/{init-Dku4b2lG.js → init-kEfUTuG2.js} +1 -1
  184. package/dist/{init-C7IeJwQR.cjs → init-lzHt4Cli.cjs} +256 -59
  185. package/dist/{init-anYu6XB7.cjs → init-rmt7-fQE.cjs} +2 -2
  186. package/dist/{init-C4Bkib9u.cjs → init-zU-_9Gsp.cjs} +67 -65
  187. package/dist/{is-retriable-error-BU0e3hVI.js → is-retriable-error-BUiVJDwH.js} +1 -1
  188. package/dist/{is-retriable-error-CeeuHqDa.cjs → is-retriable-error-Dpt860if.cjs} +1 -1
  189. package/dist/jubjub-authoriser-D7zDXu3V.js +86 -0
  190. package/dist/jubjub-authoriser-Dgu6o3Sv.cjs +87 -0
  191. package/dist/key-source-5oUBFiC7.cjs +583 -0
  192. package/dist/key-source-B08HukZg.js +2550 -0
  193. package/dist/keyDerivation-D3k9XyHg.js +4077 -0
  194. package/dist/keyDerivation-u0nBA93T.cjs +274 -0
  195. package/dist/{lace-context-CZcNHr4M.js → lace-context-BZciB9c7.js} +4 -4
  196. package/dist/{lace-context-fJTDghdp.cjs → lace-context-DgR6vLli.cjs} +4 -4
  197. package/dist/lib--iqvW4O_.js +2354 -0
  198. package/dist/lib-Yk6Upl5D.cjs +2359 -0
  199. package/dist/{libsodium-wrappers-UH0LaOUE.js → libsodium-wrappers-BhbOA8dQ.js} +3 -1647
  200. package/dist/midnight-account-id.vo-0x9X-r3l.cjs +10 -0
  201. package/dist/midnight-account-id.vo-DjCAGcqc.js +5 -0
  202. package/dist/midnight-engine-DpemplKO.js +5 -0
  203. package/dist/midnight-engine-xU1wotne.cjs +6 -0
  204. package/dist/midnight-wallet-DIsAlSn6.js +18 -0
  205. package/dist/midnight-wallet-XTZc2li7.cjs +24 -0
  206. package/dist/midnight.cjs +1408 -0
  207. package/dist/midnight.d.ts +28934 -0
  208. package/dist/midnight.js +1352 -0
  209. package/dist/modules-cardano-B1nDUWqy.js +995 -0
  210. package/dist/modules-cardano-BYeYHrRm.cjs +1108 -0
  211. package/dist/node-relay-DWe1U0w2.cjs +49 -0
  212. package/dist/node-relay-h4i5IlAQ.js +48 -0
  213. package/dist/outputs-Bd2yZVjx.js +720 -0
  214. package/dist/outputs-CJoQBIA2.cjs +990 -0
  215. package/dist/pbkdf2-CIW-oWrm.cjs +1337 -0
  216. package/dist/pending-operation-B0_P78Jo.cjs +26 -0
  217. package/dist/pending-operation-BIS6mpjB.js +21 -0
  218. package/dist/providers-FjhM47BH.cjs +388 -0
  219. package/dist/providers-WtiSuxFu.js +365 -0
  220. package/dist/redacted-BmE2aXqr.js +81 -0
  221. package/dist/redacted-CRZJLS3w.cjs +86 -0
  222. package/dist/{retry-config-DC5IMaH7.cjs → retry-config-BaCfVC1H.cjs} +1 -1
  223. package/dist/{retry-config-BcUmMS--.js → retry-config-Dmgt28wM.js} +1 -1
  224. package/dist/safe-buffer-B_vMqJWU.js +43 -0
  225. package/dist/safe-buffer-DYOwEfHB.cjs +48 -0
  226. package/dist/sdk-Cb-gZnS9.js +1241 -0
  227. package/dist/sdk-DffwmX8b.cjs +1439 -0
  228. package/dist/sdk-init-Bln9rFtn.js +4138 -0
  229. package/dist/sdk-init-CYViTJY_.cjs +3841 -0
  230. package/dist/{seam-cardano-CATqBEyK.js → seam-cardano-B_etH4F4.js} +1 -1
  231. package/dist/{bytes.vo-TgiwogWF.js → secret-box-DUR0ACYz.js} +3 -25
  232. package/dist/{bytes.vo-Ck5u40RA.cjs → secret-box-DrjLZuS1.cjs} +1 -35
  233. package/dist/send-proof-progress-C-ljq1x5.js +30 -0
  234. package/dist/send-proof-progress-vmsaSfbz.cjs +47 -0
  235. package/dist/side-effects-BnqYz7Nl.js +768 -0
  236. package/dist/side-effects-CngaeXi0.cjs +804 -0
  237. package/dist/sign-bitcoin-transaction-with-seed-D4z62-jV.js +147 -0
  238. package/dist/sign-bitcoin-transaction-with-seed-DsLYXnCY.cjs +158 -0
  239. package/dist/signer-3fk8lZtE.cjs +7 -0
  240. package/dist/signer-CsL28DrK.cjs +121 -0
  241. package/dist/signer-DGluibtn.js +92 -0
  242. package/dist/signer-RqB5pu3K.js +2 -0
  243. package/dist/signer-factory-BA7WFJVZ.js +282 -0
  244. package/dist/signer-factory-Cwd6o-lG.cjs +281 -0
  245. package/dist/{signer-factory-9URFliA5.js → signer-factory-DObB55D4.js} +6 -3
  246. package/dist/signer-factory-DhZiE03y.cjs +149 -0
  247. package/dist/{signer-factory-BWGUmnvm.cjs → signer-factory-Ds6G2AZk.cjs} +4 -3
  248. package/dist/signer-factory-hzSRaIw2.js +148 -0
  249. package/dist/{slice-CuHUaPZx.cjs → slice-7G2xxYKJ.cjs} +3 -3
  250. package/dist/{slice-DZmQJNV8.cjs → slice-B4CdYoPu.cjs} +2 -2
  251. package/dist/slice-BPNuHKfw.js +9091 -0
  252. package/dist/{slice-DGcNrbPR.cjs → slice-Bg6HEr3K.cjs} +4 -4
  253. package/dist/{slice-DtaO72qY.cjs → slice-Bs2aMERu.cjs} +3 -3
  254. package/dist/{slice-HeHCv3bl.cjs → slice-C34iOOUH.cjs} +7 -7
  255. package/dist/{slice-Do2R2CYW.cjs → slice-C9TT5KhY.cjs} +6 -6
  256. package/dist/{slice-eIwcwKHI.js → slice-CK07EBCo.js} +4 -4
  257. package/dist/{slice-CnyWevM9.js → slice-CU80pbiu.js} +3 -3
  258. package/dist/{slice-CobanYgn.js → slice-CwyYrh1H.js} +2 -2
  259. package/dist/slice-Czfp6t84.cjs +436 -0
  260. package/dist/{slice-d0p6-xj5.js → slice-D-9aPKG-.js} +6 -6
  261. package/dist/{slice-maaskdUn.js → slice-DBpJ2QGf.js} +6 -6
  262. package/dist/{slice-mxLQ_FeY.cjs → slice-DTZTiJle.cjs} +352 -39
  263. package/dist/{slice-zJ9XVYjZ.js → slice-Da426sf9.js} +1 -1
  264. package/dist/{slice-D11m2EKl.cjs → slice-DayJvMRD.cjs} +1 -1
  265. package/dist/slice-DnBWfA-k.cjs +9109 -0
  266. package/dist/{slice-oqm_r1cS.cjs → slice-DnG-yvpI.cjs} +2 -2
  267. package/dist/{slice-BNu73oBa.js → slice-DyNs7oWp.js} +2 -2
  268. package/dist/{slice-CB4SnzMm.js → slice-GwiiJRoq.js} +3 -3
  269. package/dist/slice-oWnc7YVD.js +412 -0
  270. package/dist/{slice-B2PhoWAg.js → slice-qt0uBExh.js} +325 -37
  271. package/dist/slice-t8Gzj55G2.cjs +106 -0
  272. package/dist/slice-t8Q1cHm-.js +88 -0
  273. package/dist/src-BDzYIksE.cjs +20637 -0
  274. package/dist/src-BFoefPv_.js +20755 -0
  275. package/dist/store-B1Lq3cEf.cjs +66 -0
  276. package/dist/store-DuBG8qh5.js +37 -0
  277. package/dist/submit-Bs77dPn_.cjs +413 -0
  278. package/dist/submit-DOv8Z0Vf.js +336 -0
  279. package/dist/submit-bitcoin-tx-D6oYgH5S.js +983 -0
  280. package/dist/submit-bitcoin-tx-goFuRL7K.cjs +1049 -0
  281. package/dist/{sync-operation-utils-BYXLO80m.js → sync-operation-utils-31iFLExW.js} +2 -38
  282. package/dist/{sync-operation-utils-SdPbwFoD.cjs → sync-operation-utils-COIZ66-I.cjs} +1 -67
  283. package/dist/token-id-mapper-Bnds3xKH.cjs +18 -0
  284. package/dist/{token-id-mapper-DsPAL6Nh.cjs → token-id-mapper-CVyQJUKY.cjs} +2 -2
  285. package/dist/token-id-mapper-CnKHQ8DV.js +16 -0
  286. package/dist/{token-id-mapper-B2ivlLv3.js → token-id-mapper-D29Ggv8h.js} +2 -2
  287. package/dist/tokens-Cevp7rdU.cjs +62 -0
  288. package/dist/tokens-Diw4MLRM.js +44 -0
  289. package/dist/types-B8uiJn-X.js +12 -0
  290. package/dist/types-BHC12eSa.js +33 -0
  291. package/dist/types-CJT6XF2c.js +10 -0
  292. package/dist/types-CLRUYpfe.cjs +23 -0
  293. package/dist/types-Cc3mC8u0.cjs +50 -0
  294. package/dist/types-DWbVZpnF.cjs +15 -0
  295. package/dist/unwrap-provider-result-BZSiwabU.js +32 -0
  296. package/dist/unwrap-provider-result-ZqfBsTkk.cjs +39 -0
  297. package/dist/{util-CGzqQ8IV.cjs → util-Bu4W5lF4.cjs} +1 -1
  298. package/dist/{util-BaLzwa32.js → util-Cp5cZkfK.js} +1 -1
  299. package/dist/{utils-o8aMjfln.js → utils-BfBEUvWA.js} +2 -2
  300. package/dist/utils-DFwzEvbv.js +65 -0
  301. package/dist/{utils-5JvjbqH3.cjs → utils-DsElZgCI.cjs} +7 -1
  302. package/dist/utils-IXxR-Djh.cjs +112 -0
  303. package/dist/v8Signatures-CO_Uloy7.cjs +71 -0
  304. package/dist/{vote-delegation-tx-builder-BpEMSti4.cjs → vote-delegation-tx-builder-BUg1S2Ep.cjs} +6 -6
  305. package/dist/{vote-delegation-tx-builder-CmKv6GoG.js → vote-delegation-tx-builder-C6FiS7zI.js} +5 -5
  306. package/dist/watch-CUEvcP-V.js +21997 -0
  307. package/dist/watch-DMF2s-II.cjs +52281 -0
  308. package/package.json +96 -4
  309. package/dist/account-guards.stable-B1DSSh9D.cjs +0 -10
  310. package/dist/account-guards.stable-JRQ5qx2V.js +0 -5
  311. package/dist/codecs-B7X9pAsK.cjs +0 -1945
  312. package/dist/codecs-CC1Xjntz.js +0 -1882
  313. package/dist/init-Bv53hpLM.js +0 -19
  314. package/dist/init-CRbjI7p1.js +0 -3494
  315. package/dist/init-DAna1KCg.cjs +0 -3495
  316. package/dist/init-DGe47B22.cjs +0 -364
  317. package/dist/init-DMtyvYfC.cjs +0 -21
  318. package/dist/init-TkPDD750.js +0 -363
  319. package/dist/modules-cardano-BDvuL4Xx.js +0 -5248
  320. package/dist/modules-cardano-D2G3De2P.cjs +0 -5432
  321. package/dist/slice-CGVHXHDt.cjs +0 -125
  322. package/dist/slice-DhvF7L6X.js +0 -107
  323. /package/dist/{account-id.vo-LvCBVn5r.cjs → account-id.vo-DwqFjK5u.cjs} +0 -0
  324. /package/dist/{account-id.vo-MYSI7YFm.js → account-id.vo-OPz2v-JZ.js} +0 -0
  325. /package/dist/{actions-DdGbj7c7.cjs → actions-B2BJ4RTy.cjs} +0 -0
  326. /package/dist/{actions-9QSQR-GB.js → actions-iLXdgL5Y.js} +0 -0
  327. /package/dist/{apply-vkey-witnesses-ClZbpk5w.js → apply-vkey-witnesses-BKx3lcs0.js} +0 -0
  328. /package/dist/{apply-vkey-witnesses-CLzVSWxl.cjs → apply-vkey-witnesses-ZnFS0jnJ.cjs} +0 -0
  329. /package/dist/{asyncoption-Cw07zPH7.js → asyncoption-CruEYOBI.js} +0 -0
  330. /package/dist/{asyncoption-DYoGuQfP.cjs → asyncoption-i0VbqVTq.cjs} +0 -0
  331. /package/dist/{bignum.vo-B0rK_PQ1.js → bignum.vo-CEXOIew0.js} +0 -0
  332. /package/dist/{bignum.vo-DsG3kNiZ.cjs → bignum.vo-hx2kuqlA.cjs} +0 -0
  333. /package/dist/{bip32ed25519-1ApqeAZk.cjs → bip32ed25519-B7Yat217.cjs} +0 -0
  334. /package/dist/{bip32ed25519-DetAdGwD.js → bip32ed25519-FQ8qvdcq.js} +0 -0
  335. /package/dist/{blake2b-DOEVc57D.js → blake2b-BiQTw3GC.js} +0 -0
  336. /package/dist/{blake2b-B9tftbvG.cjs → blake2b-DEeVUdKR.cjs} +0 -0
  337. /package/dist/{blockchain-network-id.vo-BXpZhvvQ.cjs → blockchain-network-id.vo-BAKEwGjG.cjs} +0 -0
  338. /package/dist/{blockchain-network-id.vo-DNRkuT5B.js → blockchain-network-id.vo-CiVykuqG.js} +0 -0
  339. /package/dist/{blockingWithLatestFrom-C5wp_uA-.js → blockingWithLatestFrom-Cd8c8EPG.js} +0 -0
  340. /package/dist/{blockingWithLatestFrom-DY8OPg0w.cjs → blockingWithLatestFrom-D8kBPBMX.cjs} +0 -0
  341. /package/dist/{cardano-network-id-to-network-type-CrZfUcyP.js → cardano-network-id-to-network-type-BWwzeEtM.js} +0 -0
  342. /package/dist/{cardano-network-id-to-network-type-BDTF-HmK.cjs → cardano-network-id-to-network-type-C0ufJOyE.cjs} +0 -0
  343. /package/dist/{cardano-tx-id.vo-BPhV-AmZ.cjs → cardano-tx-id.vo-TLjJZHCI.cjs} +0 -0
  344. /package/dist/{cardano-tx-id.vo-DF9NzZXk.js → cardano-tx-id.vo-eVnKuzlm.js} +0 -0
  345. /package/dist/{composite-signer-factory-_46QsNBz.js → composite-signer-factory-CR8YHA1y.js} +0 -0
  346. /package/dist/{composite-signer-factory-BpF1mIYA.cjs → composite-signer-factory-m5cVs9h_.cjs} +0 -0
  347. /package/dist/{error-CNIquqT5.cjs → error-Cb3EnD0u.cjs} +0 -0
  348. /package/dist/{error-BCp9NkPi.js → error-DIZOY2Lw.js} +0 -0
  349. /package/dist/{esm-browser-C93Q-EOI.js → esm-browser-MG97cre9.js} +0 -0
  350. /package/dist/{esm-browser-DTc9IK3D.cjs → esm-browser-bweqfBlL.cjs} +0 -0
  351. /package/dist/{feature-flag-key.vo-ofrB6ZVQ.js → feature-flag-key.vo-DN_-4-sG.js} +0 -0
  352. /package/dist/{feature-flag-key.vo-BPz-ZAp6.cjs → feature-flag-key.vo-RlfHL3hq.cjs} +0 -0
  353. /package/dist/{first-state-of-status-OROkXcRv.cjs → first-state-of-status-CbT7hPa4.cjs} +0 -0
  354. /package/dist/{first-state-of-status-DQnMT3ya.js → first-state-of-status-unPynOuM.js} +0 -0
  355. /package/dist/{init-Es3wHW7D.js → init-829HRYcz.js} +0 -0
  356. /package/dist/{init-CKipPE_c.js → init-A-VyGSNW2.js} +0 -0
  357. /package/dist/{init-DFQQ9dTW.cjs → init-Atisw4x2.cjs} +0 -0
  358. /package/dist/{init-C5CEZ1m0.cjs → init-BFcvPHL-.cjs} +0 -0
  359. /package/dist/{init-IAk_CkGa.cjs → init-BgNobbNq.cjs} +0 -0
  360. /package/dist/{init-cqN3uX2j.js → init-atCFur0v.js} +0 -0
  361. /package/dist/{is-redux-persist-state-CTn3WZVh.cjs → is-redux-persist-state-BCFnSm36.cjs} +0 -0
  362. /package/dist/{is-redux-persist-state-Cxcd0_bM.js → is-redux-persist-state-yBfq0h_E.js} +0 -0
  363. /package/dist/{key-value-store-8cMzeNyG.js → key-value-store--W3SrMaw.js} +0 -0
  364. /package/dist/{key-value-store-DUAepXQf.cjs → key-value-store-C2Xt5Emp.cjs} +0 -0
  365. /package/dist/{repo-slice-WxetRhMY.cjs → repo-slice-7X4AYYVm.cjs} +0 -0
  366. /package/dist/{repo-slice-DwyMhCR1.js → repo-slice-RxFm0zDZ.js} +0 -0
  367. /package/dist/{reselect-CRDqmQY9.cjs → reselect-Bd94u0K-.cjs} +0 -0
  368. /package/dist/{reselect-C06X06oX.js → reselect-CGoLzEPv.js} +0 -0
  369. /package/dist/{serializable-B8GahgE1.js → serializable-BHdKIgk3.js} +0 -0
  370. /package/dist/{serializable-CRdnFaLZ.cjs → serializable-BxHkoPdk.cjs} +0 -0
  371. /package/dist/{slice-D11FHQuQ.cjs → slice-BiRsDKOK.cjs} +0 -0
  372. /package/dist/{slice-Be7hj4Iy.js → slice-Bk0Sv05J.js} +0 -0
  373. /package/dist/{slice-FioKeHtA.cjs → slice-Dqw1ecum.cjs} +0 -0
  374. /package/dist/{slice-B87b52iM.js → slice-obCSLm1x.js} +0 -0
  375. /package/dist/{src-vq1wS9sZ.js → src-BlxEp6Mm.js} +0 -0
  376. /package/dist/{src-BTPIvlDI.cjs → src-Cqp0B2M_.cjs} +0 -0
  377. /package/dist/{time.vo-CQ8pSXz2.cjs → time.vo-D3wWRw9L.cjs} +0 -0
  378. /package/dist/{time.vo-DkYYGYp6.js → time.vo-tNheinXm.js} +0 -0
  379. /package/dist/{toEmpty-CgAl3097.js → toEmpty-8Zax1MPd.js} +0 -0
  380. /package/dist/{toEmpty-DAMmNB5r.cjs → toEmpty-CYAbupM4.cjs} +0 -0
  381. /package/dist/{token-id.vo-ClsroxHO.js → token-id.vo-Bvwhr3ZE.js} +0 -0
  382. /package/dist/{token-id.vo-BxG9TG0O.cjs → token-id.vo-DXv5uS9n.cjs} +0 -0
  383. /package/dist/{util-DxzlYNS5.js → util-C8a4fA9p.js} +0 -0
  384. /package/dist/{util-CmdAhheh.cjs → util-CzeB3hfa.cjs} +0 -0
  385. /package/dist/{util-selector-CcK-GAdE.js → util-selector-BSTsxgne.js} +0 -0
  386. /package/dist/{util-selector-BcAncU4L.cjs → util-selector-BWPH68_l.cjs} +0 -0
  387. /package/dist/{while-active-BpppWuCs.js → while-active-B0lWy_6l.js} +0 -0
  388. /package/dist/{while-active-Dhc2LwOm.cjs → while-active-Dsowp0Fi.cjs} +0 -0
@@ -0,0 +1,4051 @@
1
+ const require_rolldown_runtime = require("./rolldown-runtime-Br2OG8yv.cjs");
2
+ let node_crypto = require("node:crypto");
3
+ node_crypto = require_rolldown_runtime.__toESM(node_crypto);
4
+ //#region ../../node_modules/@noble/hashes/esm/_u64.js
5
+ /**
6
+ * Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.
7
+ * @todo re-check https://issues.chromium.org/issues/42212588
8
+ * @module
9
+ */
10
+ const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
11
+ const _32n = /* @__PURE__ */ BigInt(32);
12
+ function fromBig(n, le = false) {
13
+ if (le) return {
14
+ h: Number(n & U32_MASK64),
15
+ l: Number(n >> _32n & U32_MASK64)
16
+ };
17
+ return {
18
+ h: Number(n >> _32n & U32_MASK64) | 0,
19
+ l: Number(n & U32_MASK64) | 0
20
+ };
21
+ }
22
+ function split(lst, le = false) {
23
+ const len = lst.length;
24
+ let Ah = new Uint32Array(len);
25
+ let Al = new Uint32Array(len);
26
+ for (let i = 0; i < len; i++) {
27
+ const { h, l } = fromBig(lst[i], le);
28
+ [Ah[i], Al[i]] = [h, l];
29
+ }
30
+ return [Ah, Al];
31
+ }
32
+ const shrSH = (h, _l, s) => h >>> s;
33
+ const shrSL = (h, l, s) => h << 32 - s | l >>> s;
34
+ const rotrSH = (h, l, s) => h >>> s | l << 32 - s;
35
+ const rotrSL = (h, l, s) => h << 32 - s | l >>> s;
36
+ const rotrBH = (h, l, s) => h << 64 - s | l >>> s - 32;
37
+ const rotrBL = (h, l, s) => h >>> s - 32 | l << 64 - s;
38
+ const rotr32H = (_h, l) => l;
39
+ const rotr32L = (h, _l) => h;
40
+ function add(Ah, Al, Bh, Bl) {
41
+ const l = (Al >>> 0) + (Bl >>> 0);
42
+ return {
43
+ h: Ah + Bh + (l / 2 ** 32 | 0) | 0,
44
+ l: l | 0
45
+ };
46
+ }
47
+ const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
48
+ const add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
49
+ const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
50
+ const add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
51
+ const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
52
+ const add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
53
+ //#endregion
54
+ //#region ../../node_modules/@noble/hashes/esm/cryptoNode.js
55
+ /**
56
+ * Internal webcrypto alias.
57
+ * We prefer WebCrypto aka globalThis.crypto, which exists in node.js 16+.
58
+ * Falls back to Node.js built-in crypto for Node.js <=v14.
59
+ * See utils.ts for details.
60
+ * @module
61
+ */
62
+ const crypto = node_crypto && typeof node_crypto === "object" && "webcrypto" in node_crypto ? node_crypto.webcrypto : node_crypto && typeof node_crypto === "object" && "randomBytes" in node_crypto ? node_crypto : void 0;
63
+ //#endregion
64
+ //#region ../../node_modules/@noble/hashes/esm/utils.js
65
+ /**
66
+ * Utilities for hex, bytes, CSPRNG.
67
+ * @module
68
+ */
69
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
70
+ /** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */
71
+ function isBytes(a) {
72
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
73
+ }
74
+ /** Asserts something is positive integer. */
75
+ function anumber(n) {
76
+ if (!Number.isSafeInteger(n) || n < 0) throw new Error("positive integer expected, got " + n);
77
+ }
78
+ /** Asserts something is Uint8Array. */
79
+ function abytes(b, ...lengths) {
80
+ if (!isBytes(b)) throw new Error("Uint8Array expected");
81
+ if (lengths.length > 0 && !lengths.includes(b.length)) throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
82
+ }
83
+ /** Asserts something is hash */
84
+ function ahash(h) {
85
+ if (typeof h !== "function" || typeof h.create !== "function") throw new Error("Hash should be wrapped by utils.createHasher");
86
+ anumber(h.outputLen);
87
+ anumber(h.blockLen);
88
+ }
89
+ /** Asserts a hash instance has not been destroyed / finished */
90
+ function aexists(instance, checkFinished = true) {
91
+ if (instance.destroyed) throw new Error("Hash instance has been destroyed");
92
+ if (checkFinished && instance.finished) throw new Error("Hash#digest() has already been called");
93
+ }
94
+ /** Asserts output is properly-sized byte array */
95
+ function aoutput(out, instance) {
96
+ abytes(out);
97
+ const min = instance.outputLen;
98
+ if (out.length < min) throw new Error("digestInto() expects output buffer of length at least " + min);
99
+ }
100
+ /** Cast u8 / u16 / u32 to u8. */
101
+ function u8(arr) {
102
+ return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
103
+ }
104
+ /** Cast u8 / u16 / u32 to u32. */
105
+ function u32(arr) {
106
+ return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
107
+ }
108
+ /** Zeroize a byte array. Warning: JS provides no guarantees. */
109
+ function clean(...arrays) {
110
+ for (let i = 0; i < arrays.length; i++) arrays[i].fill(0);
111
+ }
112
+ /** Create DataView of an array for easy byte-level manipulation. */
113
+ function createView(arr) {
114
+ return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
115
+ }
116
+ /** The rotate right (circular right shift) operation for uint32 */
117
+ function rotr(word, shift) {
118
+ return word << 32 - shift | word >>> shift;
119
+ }
120
+ /** Is current platform little-endian? Most are. Big-Endian platform: IBM */
121
+ const isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
122
+ /** The byte swap operation for uint32 */
123
+ function byteSwap(word) {
124
+ return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
125
+ }
126
+ /** Conditionally byte swap if on a big-endian platform */
127
+ const swap8IfBE = isLE ? (n) => n : (n) => byteSwap(n);
128
+ /** In place byte swap for Uint32Array */
129
+ function byteSwap32(arr) {
130
+ for (let i = 0; i < arr.length; i++) arr[i] = byteSwap(arr[i]);
131
+ return arr;
132
+ }
133
+ const swap32IfBE = isLE ? (u) => u : byteSwap32;
134
+ const hasHexBuiltin = typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function";
135
+ const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
136
+ /**
137
+ * Convert byte array to hex string. Uses built-in function, when available.
138
+ * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'
139
+ */
140
+ function bytesToHex(bytes) {
141
+ abytes(bytes);
142
+ if (hasHexBuiltin) return bytes.toHex();
143
+ let hex = "";
144
+ for (let i = 0; i < bytes.length; i++) hex += hexes[bytes[i]];
145
+ return hex;
146
+ }
147
+ const asciis = {
148
+ _0: 48,
149
+ _9: 57,
150
+ A: 65,
151
+ F: 70,
152
+ a: 97,
153
+ f: 102
154
+ };
155
+ function asciiToBase16(ch) {
156
+ if (ch >= asciis._0 && ch <= asciis._9) return ch - asciis._0;
157
+ if (ch >= asciis.A && ch <= asciis.F) return ch - (asciis.A - 10);
158
+ if (ch >= asciis.a && ch <= asciis.f) return ch - (asciis.a - 10);
159
+ }
160
+ /**
161
+ * Convert hex string to byte array. Uses built-in function, when available.
162
+ * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])
163
+ */
164
+ function hexToBytes(hex) {
165
+ if (typeof hex !== "string") throw new Error("hex string expected, got " + typeof hex);
166
+ if (hasHexBuiltin) return Uint8Array.fromHex(hex);
167
+ const hl = hex.length;
168
+ const al = hl / 2;
169
+ if (hl % 2) throw new Error("hex string expected, got unpadded hex of length " + hl);
170
+ const array = new Uint8Array(al);
171
+ for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
172
+ const n1 = asciiToBase16(hex.charCodeAt(hi));
173
+ const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
174
+ if (n1 === void 0 || n2 === void 0) {
175
+ const char = hex[hi] + hex[hi + 1];
176
+ throw new Error("hex string expected, got non-hex character \"" + char + "\" at index " + hi);
177
+ }
178
+ array[ai] = n1 * 16 + n2;
179
+ }
180
+ return array;
181
+ }
182
+ /**
183
+ * There is no setImmediate in browser and setTimeout is slow.
184
+ * Call of async fn will return Promise, which will be fullfiled only on
185
+ * next scheduler queue processing step and this is exactly what we need.
186
+ */
187
+ const nextTick = async () => {};
188
+ /**
189
+ * Converts string to bytes using UTF8 encoding.
190
+ * @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])
191
+ */
192
+ function utf8ToBytes(str) {
193
+ if (typeof str !== "string") throw new Error("string expected");
194
+ return new Uint8Array(new TextEncoder().encode(str));
195
+ }
196
+ /**
197
+ * Normalizes (non-hex) string or Uint8Array to Uint8Array.
198
+ * Warning: when Uint8Array is passed, it would NOT get copied.
199
+ * Keep in mind for future mutable operations.
200
+ */
201
+ function toBytes(data) {
202
+ if (typeof data === "string") data = utf8ToBytes(data);
203
+ abytes(data);
204
+ return data;
205
+ }
206
+ /**
207
+ * Helper for KDFs: consumes uint8array or string.
208
+ * When string is passed, does utf8 decoding, using TextDecoder.
209
+ */
210
+ function kdfInputToBytes(data) {
211
+ if (typeof data === "string") data = utf8ToBytes(data);
212
+ abytes(data);
213
+ return data;
214
+ }
215
+ /** Copies several Uint8Arrays into one. */
216
+ function concatBytes(...arrays) {
217
+ let sum = 0;
218
+ for (let i = 0; i < arrays.length; i++) {
219
+ const a = arrays[i];
220
+ abytes(a);
221
+ sum += a.length;
222
+ }
223
+ const res = new Uint8Array(sum);
224
+ for (let i = 0, pad = 0; i < arrays.length; i++) {
225
+ const a = arrays[i];
226
+ res.set(a, pad);
227
+ pad += a.length;
228
+ }
229
+ return res;
230
+ }
231
+ function checkOpts(defaults, opts) {
232
+ if (opts !== void 0 && {}.toString.call(opts) !== "[object Object]") throw new Error("options should be object or undefined");
233
+ return Object.assign(defaults, opts);
234
+ }
235
+ /** For runtime check if class implements interface */
236
+ var Hash = class {};
237
+ /** Wraps hash function, creating an interface on top of it */
238
+ function createHasher(hashCons) {
239
+ const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
240
+ const tmp = hashCons();
241
+ hashC.outputLen = tmp.outputLen;
242
+ hashC.blockLen = tmp.blockLen;
243
+ hashC.create = () => hashCons();
244
+ return hashC;
245
+ }
246
+ function createOptHasher(hashCons) {
247
+ const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
248
+ const tmp = hashCons({});
249
+ hashC.outputLen = tmp.outputLen;
250
+ hashC.blockLen = tmp.blockLen;
251
+ hashC.create = (opts) => hashCons(opts);
252
+ return hashC;
253
+ }
254
+ /** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */
255
+ function randomBytes(bytesLength = 32) {
256
+ if (crypto && typeof crypto.getRandomValues === "function") return crypto.getRandomValues(new Uint8Array(bytesLength));
257
+ if (crypto && typeof crypto.randomBytes === "function") return Uint8Array.from(crypto.randomBytes(bytesLength));
258
+ throw new Error("crypto.getRandomValues must be defined");
259
+ }
260
+ //#endregion
261
+ //#region ../../node_modules/@noble/hashes/esm/_blake.js
262
+ /**
263
+ * Internal blake variable.
264
+ * For BLAKE2b, the two extra permutations for rounds 10 and 11 are SIGMA[10..11] = SIGMA[0..1].
265
+ */
266
+ const BSIGMA = /* @__PURE__ */ Uint8Array.from([
267
+ 0,
268
+ 1,
269
+ 2,
270
+ 3,
271
+ 4,
272
+ 5,
273
+ 6,
274
+ 7,
275
+ 8,
276
+ 9,
277
+ 10,
278
+ 11,
279
+ 12,
280
+ 13,
281
+ 14,
282
+ 15,
283
+ 14,
284
+ 10,
285
+ 4,
286
+ 8,
287
+ 9,
288
+ 15,
289
+ 13,
290
+ 6,
291
+ 1,
292
+ 12,
293
+ 0,
294
+ 2,
295
+ 11,
296
+ 7,
297
+ 5,
298
+ 3,
299
+ 11,
300
+ 8,
301
+ 12,
302
+ 0,
303
+ 5,
304
+ 2,
305
+ 15,
306
+ 13,
307
+ 10,
308
+ 14,
309
+ 3,
310
+ 6,
311
+ 7,
312
+ 1,
313
+ 9,
314
+ 4,
315
+ 7,
316
+ 9,
317
+ 3,
318
+ 1,
319
+ 13,
320
+ 12,
321
+ 11,
322
+ 14,
323
+ 2,
324
+ 6,
325
+ 5,
326
+ 10,
327
+ 4,
328
+ 0,
329
+ 15,
330
+ 8,
331
+ 9,
332
+ 0,
333
+ 5,
334
+ 7,
335
+ 2,
336
+ 4,
337
+ 10,
338
+ 15,
339
+ 14,
340
+ 1,
341
+ 11,
342
+ 12,
343
+ 6,
344
+ 8,
345
+ 3,
346
+ 13,
347
+ 2,
348
+ 12,
349
+ 6,
350
+ 10,
351
+ 0,
352
+ 11,
353
+ 8,
354
+ 3,
355
+ 4,
356
+ 13,
357
+ 7,
358
+ 5,
359
+ 15,
360
+ 14,
361
+ 1,
362
+ 9,
363
+ 12,
364
+ 5,
365
+ 1,
366
+ 15,
367
+ 14,
368
+ 13,
369
+ 4,
370
+ 10,
371
+ 0,
372
+ 7,
373
+ 6,
374
+ 3,
375
+ 9,
376
+ 2,
377
+ 8,
378
+ 11,
379
+ 13,
380
+ 11,
381
+ 7,
382
+ 14,
383
+ 12,
384
+ 1,
385
+ 3,
386
+ 9,
387
+ 5,
388
+ 0,
389
+ 15,
390
+ 4,
391
+ 8,
392
+ 6,
393
+ 2,
394
+ 10,
395
+ 6,
396
+ 15,
397
+ 14,
398
+ 9,
399
+ 11,
400
+ 3,
401
+ 0,
402
+ 8,
403
+ 12,
404
+ 2,
405
+ 13,
406
+ 7,
407
+ 1,
408
+ 4,
409
+ 10,
410
+ 5,
411
+ 10,
412
+ 2,
413
+ 8,
414
+ 4,
415
+ 7,
416
+ 6,
417
+ 1,
418
+ 5,
419
+ 15,
420
+ 11,
421
+ 9,
422
+ 14,
423
+ 3,
424
+ 12,
425
+ 13,
426
+ 0,
427
+ 0,
428
+ 1,
429
+ 2,
430
+ 3,
431
+ 4,
432
+ 5,
433
+ 6,
434
+ 7,
435
+ 8,
436
+ 9,
437
+ 10,
438
+ 11,
439
+ 12,
440
+ 13,
441
+ 14,
442
+ 15,
443
+ 14,
444
+ 10,
445
+ 4,
446
+ 8,
447
+ 9,
448
+ 15,
449
+ 13,
450
+ 6,
451
+ 1,
452
+ 12,
453
+ 0,
454
+ 2,
455
+ 11,
456
+ 7,
457
+ 5,
458
+ 3,
459
+ 11,
460
+ 8,
461
+ 12,
462
+ 0,
463
+ 5,
464
+ 2,
465
+ 15,
466
+ 13,
467
+ 10,
468
+ 14,
469
+ 3,
470
+ 6,
471
+ 7,
472
+ 1,
473
+ 9,
474
+ 4,
475
+ 7,
476
+ 9,
477
+ 3,
478
+ 1,
479
+ 13,
480
+ 12,
481
+ 11,
482
+ 14,
483
+ 2,
484
+ 6,
485
+ 5,
486
+ 10,
487
+ 4,
488
+ 0,
489
+ 15,
490
+ 8,
491
+ 9,
492
+ 0,
493
+ 5,
494
+ 7,
495
+ 2,
496
+ 4,
497
+ 10,
498
+ 15,
499
+ 14,
500
+ 1,
501
+ 11,
502
+ 12,
503
+ 6,
504
+ 8,
505
+ 3,
506
+ 13,
507
+ 2,
508
+ 12,
509
+ 6,
510
+ 10,
511
+ 0,
512
+ 11,
513
+ 8,
514
+ 3,
515
+ 4,
516
+ 13,
517
+ 7,
518
+ 5,
519
+ 15,
520
+ 14,
521
+ 1,
522
+ 9
523
+ ]);
524
+ //#endregion
525
+ //#region ../../node_modules/@noble/hashes/esm/_md.js
526
+ /**
527
+ * Internal Merkle-Damgard hash utils.
528
+ * @module
529
+ */
530
+ /** Polyfill for Safari 14. https://caniuse.com/mdn-javascript_builtins_dataview_setbiguint64 */
531
+ function setBigUint64(view, byteOffset, value, isLE) {
532
+ if (typeof view.setBigUint64 === "function") return view.setBigUint64(byteOffset, value, isLE);
533
+ const _32n = BigInt(32);
534
+ const _u32_max = BigInt(4294967295);
535
+ const wh = Number(value >> _32n & _u32_max);
536
+ const wl = Number(value & _u32_max);
537
+ const h = isLE ? 4 : 0;
538
+ const l = isLE ? 0 : 4;
539
+ view.setUint32(byteOffset + h, wh, isLE);
540
+ view.setUint32(byteOffset + l, wl, isLE);
541
+ }
542
+ /** Choice: a ? b : c */
543
+ function Chi(a, b, c) {
544
+ return a & b ^ ~a & c;
545
+ }
546
+ /** Majority function, true if any two inputs is true. */
547
+ function Maj(a, b, c) {
548
+ return a & b ^ a & c ^ b & c;
549
+ }
550
+ /**
551
+ * Merkle-Damgard hash construction base class.
552
+ * Could be used to create MD5, RIPEMD, SHA1, SHA2.
553
+ */
554
+ var HashMD = class extends Hash {
555
+ constructor(blockLen, outputLen, padOffset, isLE) {
556
+ super();
557
+ this.finished = false;
558
+ this.length = 0;
559
+ this.pos = 0;
560
+ this.destroyed = false;
561
+ this.blockLen = blockLen;
562
+ this.outputLen = outputLen;
563
+ this.padOffset = padOffset;
564
+ this.isLE = isLE;
565
+ this.buffer = new Uint8Array(blockLen);
566
+ this.view = createView(this.buffer);
567
+ }
568
+ update(data) {
569
+ aexists(this);
570
+ data = toBytes(data);
571
+ abytes(data);
572
+ const { view, buffer, blockLen } = this;
573
+ const len = data.length;
574
+ for (let pos = 0; pos < len;) {
575
+ const take = Math.min(blockLen - this.pos, len - pos);
576
+ if (take === blockLen) {
577
+ const dataView = createView(data);
578
+ for (; blockLen <= len - pos; pos += blockLen) this.process(dataView, pos);
579
+ continue;
580
+ }
581
+ buffer.set(data.subarray(pos, pos + take), this.pos);
582
+ this.pos += take;
583
+ pos += take;
584
+ if (this.pos === blockLen) {
585
+ this.process(view, 0);
586
+ this.pos = 0;
587
+ }
588
+ }
589
+ this.length += data.length;
590
+ this.roundClean();
591
+ return this;
592
+ }
593
+ digestInto(out) {
594
+ aexists(this);
595
+ aoutput(out, this);
596
+ this.finished = true;
597
+ const { buffer, view, blockLen, isLE } = this;
598
+ let { pos } = this;
599
+ buffer[pos++] = 128;
600
+ clean(this.buffer.subarray(pos));
601
+ if (this.padOffset > blockLen - pos) {
602
+ this.process(view, 0);
603
+ pos = 0;
604
+ }
605
+ for (let i = pos; i < blockLen; i++) buffer[i] = 0;
606
+ setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
607
+ this.process(view, 0);
608
+ const oview = createView(out);
609
+ const len = this.outputLen;
610
+ if (len % 4) throw new Error("_sha2: outputLen should be aligned to 32bit");
611
+ const outLen = len / 4;
612
+ const state = this.get();
613
+ if (outLen > state.length) throw new Error("_sha2: outputLen bigger than state");
614
+ for (let i = 0; i < outLen; i++) oview.setUint32(4 * i, state[i], isLE);
615
+ }
616
+ digest() {
617
+ const { buffer, outputLen } = this;
618
+ this.digestInto(buffer);
619
+ const res = buffer.slice(0, outputLen);
620
+ this.destroy();
621
+ return res;
622
+ }
623
+ _cloneInto(to) {
624
+ to || (to = new this.constructor());
625
+ to.set(...this.get());
626
+ const { blockLen, buffer, length, finished, destroyed, pos } = this;
627
+ to.destroyed = destroyed;
628
+ to.finished = finished;
629
+ to.length = length;
630
+ to.pos = pos;
631
+ if (length % blockLen) to.buffer.set(buffer);
632
+ return to;
633
+ }
634
+ clone() {
635
+ return this._cloneInto();
636
+ }
637
+ };
638
+ /**
639
+ * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.
640
+ * Check out `test/misc/sha2-gen-iv.js` for recomputation guide.
641
+ */
642
+ /** Initial SHA256 state. Bits 0..32 of frac part of sqrt of primes 2..19 */
643
+ const SHA256_IV = /* @__PURE__ */ Uint32Array.from([
644
+ 1779033703,
645
+ 3144134277,
646
+ 1013904242,
647
+ 2773480762,
648
+ 1359893119,
649
+ 2600822924,
650
+ 528734635,
651
+ 1541459225
652
+ ]);
653
+ /** Initial SHA512 state. Bits 0..64 of frac part of sqrt of primes 2..19 */
654
+ const SHA512_IV = /* @__PURE__ */ Uint32Array.from([
655
+ 1779033703,
656
+ 4089235720,
657
+ 3144134277,
658
+ 2227873595,
659
+ 1013904242,
660
+ 4271175723,
661
+ 2773480762,
662
+ 1595750129,
663
+ 1359893119,
664
+ 2917565137,
665
+ 2600822924,
666
+ 725511199,
667
+ 528734635,
668
+ 4215389547,
669
+ 1541459225,
670
+ 327033209
671
+ ]);
672
+ //#endregion
673
+ //#region ../../node_modules/@noble/hashes/esm/blake2.js
674
+ /**
675
+ * blake2b (64-bit) & blake2s (8 to 32-bit) hash functions.
676
+ * b could have been faster, but there is no fast u64 in js, so s is 1.5x faster.
677
+ * @module
678
+ */
679
+ const B2B_IV = /* @__PURE__ */ Uint32Array.from([
680
+ 4089235720,
681
+ 1779033703,
682
+ 2227873595,
683
+ 3144134277,
684
+ 4271175723,
685
+ 1013904242,
686
+ 1595750129,
687
+ 2773480762,
688
+ 2917565137,
689
+ 1359893119,
690
+ 725511199,
691
+ 2600822924,
692
+ 4215389547,
693
+ 528734635,
694
+ 327033209,
695
+ 1541459225
696
+ ]);
697
+ const BBUF = /* @__PURE__ */ new Uint32Array(32);
698
+ function G1b(a, b, c, d, msg, x) {
699
+ const Xl = msg[x], Xh = msg[x + 1];
700
+ let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1];
701
+ let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1];
702
+ let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1];
703
+ let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1];
704
+ let ll = add3L(Al, Bl, Xl);
705
+ Ah = add3H(ll, Ah, Bh, Xh);
706
+ Al = ll | 0;
707
+ ({Dh, Dl} = {
708
+ Dh: Dh ^ Ah,
709
+ Dl: Dl ^ Al
710
+ });
711
+ ({Dh, Dl} = {
712
+ Dh: rotr32H(Dh, Dl),
713
+ Dl: rotr32L(Dh, Dl)
714
+ });
715
+ ({h: Ch, l: Cl} = add(Ch, Cl, Dh, Dl));
716
+ ({Bh, Bl} = {
717
+ Bh: Bh ^ Ch,
718
+ Bl: Bl ^ Cl
719
+ });
720
+ ({Bh, Bl} = {
721
+ Bh: rotrSH(Bh, Bl, 24),
722
+ Bl: rotrSL(Bh, Bl, 24)
723
+ });
724
+ BBUF[2 * a] = Al, BBUF[2 * a + 1] = Ah;
725
+ BBUF[2 * b] = Bl, BBUF[2 * b + 1] = Bh;
726
+ BBUF[2 * c] = Cl, BBUF[2 * c + 1] = Ch;
727
+ BBUF[2 * d] = Dl, BBUF[2 * d + 1] = Dh;
728
+ }
729
+ function G2b(a, b, c, d, msg, x) {
730
+ const Xl = msg[x], Xh = msg[x + 1];
731
+ let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1];
732
+ let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1];
733
+ let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1];
734
+ let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1];
735
+ let ll = add3L(Al, Bl, Xl);
736
+ Ah = add3H(ll, Ah, Bh, Xh);
737
+ Al = ll | 0;
738
+ ({Dh, Dl} = {
739
+ Dh: Dh ^ Ah,
740
+ Dl: Dl ^ Al
741
+ });
742
+ ({Dh, Dl} = {
743
+ Dh: rotrSH(Dh, Dl, 16),
744
+ Dl: rotrSL(Dh, Dl, 16)
745
+ });
746
+ ({h: Ch, l: Cl} = add(Ch, Cl, Dh, Dl));
747
+ ({Bh, Bl} = {
748
+ Bh: Bh ^ Ch,
749
+ Bl: Bl ^ Cl
750
+ });
751
+ ({Bh, Bl} = {
752
+ Bh: rotrBH(Bh, Bl, 63),
753
+ Bl: rotrBL(Bh, Bl, 63)
754
+ });
755
+ BBUF[2 * a] = Al, BBUF[2 * a + 1] = Ah;
756
+ BBUF[2 * b] = Bl, BBUF[2 * b + 1] = Bh;
757
+ BBUF[2 * c] = Cl, BBUF[2 * c + 1] = Ch;
758
+ BBUF[2 * d] = Dl, BBUF[2 * d + 1] = Dh;
759
+ }
760
+ function checkBlake2Opts(outputLen, opts = {}, keyLen, saltLen, persLen) {
761
+ anumber(keyLen);
762
+ if (outputLen < 0 || outputLen > keyLen) throw new Error("outputLen bigger than keyLen");
763
+ const { key, salt, personalization } = opts;
764
+ if (key !== void 0 && (key.length < 1 || key.length > keyLen)) throw new Error("key length must be undefined or 1.." + keyLen);
765
+ if (salt !== void 0 && salt.length !== saltLen) throw new Error("salt must be undefined or " + saltLen);
766
+ if (personalization !== void 0 && personalization.length !== persLen) throw new Error("personalization must be undefined or " + persLen);
767
+ }
768
+ /** Class, from which others are subclassed. */
769
+ var BLAKE2 = class extends Hash {
770
+ constructor(blockLen, outputLen) {
771
+ super();
772
+ this.finished = false;
773
+ this.destroyed = false;
774
+ this.length = 0;
775
+ this.pos = 0;
776
+ anumber(blockLen);
777
+ anumber(outputLen);
778
+ this.blockLen = blockLen;
779
+ this.outputLen = outputLen;
780
+ this.buffer = new Uint8Array(blockLen);
781
+ this.buffer32 = u32(this.buffer);
782
+ }
783
+ update(data) {
784
+ aexists(this);
785
+ data = toBytes(data);
786
+ abytes(data);
787
+ const { blockLen, buffer, buffer32 } = this;
788
+ const len = data.length;
789
+ const offset = data.byteOffset;
790
+ const buf = data.buffer;
791
+ for (let pos = 0; pos < len;) {
792
+ if (this.pos === blockLen) {
793
+ swap32IfBE(buffer32);
794
+ this.compress(buffer32, 0, false);
795
+ swap32IfBE(buffer32);
796
+ this.pos = 0;
797
+ }
798
+ const take = Math.min(blockLen - this.pos, len - pos);
799
+ const dataOffset = offset + pos;
800
+ if (take === blockLen && !(dataOffset % 4) && pos + take < len) {
801
+ const data32 = new Uint32Array(buf, dataOffset, Math.floor((len - pos) / 4));
802
+ swap32IfBE(data32);
803
+ for (let pos32 = 0; pos + blockLen < len; pos32 += buffer32.length, pos += blockLen) {
804
+ this.length += blockLen;
805
+ this.compress(data32, pos32, false);
806
+ }
807
+ swap32IfBE(data32);
808
+ continue;
809
+ }
810
+ buffer.set(data.subarray(pos, pos + take), this.pos);
811
+ this.pos += take;
812
+ this.length += take;
813
+ pos += take;
814
+ }
815
+ return this;
816
+ }
817
+ digestInto(out) {
818
+ aexists(this);
819
+ aoutput(out, this);
820
+ const { pos, buffer32 } = this;
821
+ this.finished = true;
822
+ clean(this.buffer.subarray(pos));
823
+ swap32IfBE(buffer32);
824
+ this.compress(buffer32, 0, true);
825
+ swap32IfBE(buffer32);
826
+ const out32 = u32(out);
827
+ this.get().forEach((v, i) => out32[i] = swap8IfBE(v));
828
+ }
829
+ digest() {
830
+ const { buffer, outputLen } = this;
831
+ this.digestInto(buffer);
832
+ const res = buffer.slice(0, outputLen);
833
+ this.destroy();
834
+ return res;
835
+ }
836
+ _cloneInto(to) {
837
+ const { buffer, length, finished, destroyed, outputLen, pos } = this;
838
+ to || (to = new this.constructor({ dkLen: outputLen }));
839
+ to.set(...this.get());
840
+ to.buffer.set(buffer);
841
+ to.destroyed = destroyed;
842
+ to.finished = finished;
843
+ to.length = length;
844
+ to.pos = pos;
845
+ to.outputLen = outputLen;
846
+ return to;
847
+ }
848
+ clone() {
849
+ return this._cloneInto();
850
+ }
851
+ };
852
+ var BLAKE2b = class extends BLAKE2 {
853
+ constructor(opts = {}) {
854
+ const olen = opts.dkLen === void 0 ? 64 : opts.dkLen;
855
+ super(128, olen);
856
+ this.v0l = B2B_IV[0] | 0;
857
+ this.v0h = B2B_IV[1] | 0;
858
+ this.v1l = B2B_IV[2] | 0;
859
+ this.v1h = B2B_IV[3] | 0;
860
+ this.v2l = B2B_IV[4] | 0;
861
+ this.v2h = B2B_IV[5] | 0;
862
+ this.v3l = B2B_IV[6] | 0;
863
+ this.v3h = B2B_IV[7] | 0;
864
+ this.v4l = B2B_IV[8] | 0;
865
+ this.v4h = B2B_IV[9] | 0;
866
+ this.v5l = B2B_IV[10] | 0;
867
+ this.v5h = B2B_IV[11] | 0;
868
+ this.v6l = B2B_IV[12] | 0;
869
+ this.v6h = B2B_IV[13] | 0;
870
+ this.v7l = B2B_IV[14] | 0;
871
+ this.v7h = B2B_IV[15] | 0;
872
+ checkBlake2Opts(olen, opts, 64, 16, 16);
873
+ let { key, personalization, salt } = opts;
874
+ let keyLength = 0;
875
+ if (key !== void 0) {
876
+ key = toBytes(key);
877
+ keyLength = key.length;
878
+ }
879
+ this.v0l ^= this.outputLen | keyLength << 8 | 16842752;
880
+ if (salt !== void 0) {
881
+ salt = toBytes(salt);
882
+ const slt = u32(salt);
883
+ this.v4l ^= swap8IfBE(slt[0]);
884
+ this.v4h ^= swap8IfBE(slt[1]);
885
+ this.v5l ^= swap8IfBE(slt[2]);
886
+ this.v5h ^= swap8IfBE(slt[3]);
887
+ }
888
+ if (personalization !== void 0) {
889
+ personalization = toBytes(personalization);
890
+ const pers = u32(personalization);
891
+ this.v6l ^= swap8IfBE(pers[0]);
892
+ this.v6h ^= swap8IfBE(pers[1]);
893
+ this.v7l ^= swap8IfBE(pers[2]);
894
+ this.v7h ^= swap8IfBE(pers[3]);
895
+ }
896
+ if (key !== void 0) {
897
+ const tmp = new Uint8Array(this.blockLen);
898
+ tmp.set(key);
899
+ this.update(tmp);
900
+ }
901
+ }
902
+ get() {
903
+ let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this;
904
+ return [
905
+ v0l,
906
+ v0h,
907
+ v1l,
908
+ v1h,
909
+ v2l,
910
+ v2h,
911
+ v3l,
912
+ v3h,
913
+ v4l,
914
+ v4h,
915
+ v5l,
916
+ v5h,
917
+ v6l,
918
+ v6h,
919
+ v7l,
920
+ v7h
921
+ ];
922
+ }
923
+ set(v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h) {
924
+ this.v0l = v0l | 0;
925
+ this.v0h = v0h | 0;
926
+ this.v1l = v1l | 0;
927
+ this.v1h = v1h | 0;
928
+ this.v2l = v2l | 0;
929
+ this.v2h = v2h | 0;
930
+ this.v3l = v3l | 0;
931
+ this.v3h = v3h | 0;
932
+ this.v4l = v4l | 0;
933
+ this.v4h = v4h | 0;
934
+ this.v5l = v5l | 0;
935
+ this.v5h = v5h | 0;
936
+ this.v6l = v6l | 0;
937
+ this.v6h = v6h | 0;
938
+ this.v7l = v7l | 0;
939
+ this.v7h = v7h | 0;
940
+ }
941
+ compress(msg, offset, isLast) {
942
+ this.get().forEach((v, i) => BBUF[i] = v);
943
+ BBUF.set(B2B_IV, 16);
944
+ let { h, l } = fromBig(BigInt(this.length));
945
+ BBUF[24] = B2B_IV[8] ^ l;
946
+ BBUF[25] = B2B_IV[9] ^ h;
947
+ if (isLast) {
948
+ BBUF[28] = ~BBUF[28];
949
+ BBUF[29] = ~BBUF[29];
950
+ }
951
+ let j = 0;
952
+ const s = BSIGMA;
953
+ for (let i = 0; i < 12; i++) {
954
+ G1b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
955
+ G2b(0, 4, 8, 12, msg, offset + 2 * s[j++]);
956
+ G1b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
957
+ G2b(1, 5, 9, 13, msg, offset + 2 * s[j++]);
958
+ G1b(2, 6, 10, 14, msg, offset + 2 * s[j++]);
959
+ G2b(2, 6, 10, 14, msg, offset + 2 * s[j++]);
960
+ G1b(3, 7, 11, 15, msg, offset + 2 * s[j++]);
961
+ G2b(3, 7, 11, 15, msg, offset + 2 * s[j++]);
962
+ G1b(0, 5, 10, 15, msg, offset + 2 * s[j++]);
963
+ G2b(0, 5, 10, 15, msg, offset + 2 * s[j++]);
964
+ G1b(1, 6, 11, 12, msg, offset + 2 * s[j++]);
965
+ G2b(1, 6, 11, 12, msg, offset + 2 * s[j++]);
966
+ G1b(2, 7, 8, 13, msg, offset + 2 * s[j++]);
967
+ G2b(2, 7, 8, 13, msg, offset + 2 * s[j++]);
968
+ G1b(3, 4, 9, 14, msg, offset + 2 * s[j++]);
969
+ G2b(3, 4, 9, 14, msg, offset + 2 * s[j++]);
970
+ }
971
+ this.v0l ^= BBUF[0] ^ BBUF[16];
972
+ this.v0h ^= BBUF[1] ^ BBUF[17];
973
+ this.v1l ^= BBUF[2] ^ BBUF[18];
974
+ this.v1h ^= BBUF[3] ^ BBUF[19];
975
+ this.v2l ^= BBUF[4] ^ BBUF[20];
976
+ this.v2h ^= BBUF[5] ^ BBUF[21];
977
+ this.v3l ^= BBUF[6] ^ BBUF[22];
978
+ this.v3h ^= BBUF[7] ^ BBUF[23];
979
+ this.v4l ^= BBUF[8] ^ BBUF[24];
980
+ this.v4h ^= BBUF[9] ^ BBUF[25];
981
+ this.v5l ^= BBUF[10] ^ BBUF[26];
982
+ this.v5h ^= BBUF[11] ^ BBUF[27];
983
+ this.v6l ^= BBUF[12] ^ BBUF[28];
984
+ this.v6h ^= BBUF[13] ^ BBUF[29];
985
+ this.v7l ^= BBUF[14] ^ BBUF[30];
986
+ this.v7h ^= BBUF[15] ^ BBUF[31];
987
+ clean(BBUF);
988
+ }
989
+ destroy() {
990
+ this.destroyed = true;
991
+ clean(this.buffer32);
992
+ this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
993
+ }
994
+ };
995
+ /**
996
+ * Blake2b hash function. 64-bit. 1.5x slower than blake2s in JS.
997
+ * @param msg - message that would be hashed
998
+ * @param opts - dkLen output length, key for MAC mode, salt, personalization
999
+ */
1000
+ const blake2b = /* @__PURE__ */ createOptHasher((opts) => new BLAKE2b(opts));
1001
+ //#endregion
1002
+ //#region ../../node_modules/@noble/hashes/esm/argon2.js
1003
+ /**
1004
+ * Argon2 KDF from RFC 9106. Can be used to create a key from password and salt.
1005
+ * We suggest to use Scrypt. JS Argon is 2-10x slower than native code because of 64-bitness:
1006
+ * * argon uses uint64, but JS doesn't have fast uint64array
1007
+ * * uint64 multiplication is 1/3 of time
1008
+ * * `P` function would be very nice with u64, because most of value will be in registers,
1009
+ * hovewer with u32 it will require 32 registers, which is too much.
1010
+ * * JS arrays do slow bound checks, so reading from `A2_BUF` slows it down
1011
+ * @module
1012
+ */
1013
+ const AT = {
1014
+ Argond2d: 0,
1015
+ Argon2i: 1,
1016
+ Argon2id: 2
1017
+ };
1018
+ const ARGON2_SYNC_POINTS = 4;
1019
+ const abytesOrZero = (buf) => {
1020
+ if (buf === void 0) return Uint8Array.of();
1021
+ return kdfInputToBytes(buf);
1022
+ };
1023
+ function mul(a, b) {
1024
+ const aL = a & 65535;
1025
+ const aH = a >>> 16;
1026
+ const bL = b & 65535;
1027
+ const bH = b >>> 16;
1028
+ const ll = Math.imul(aL, bL);
1029
+ const hl = Math.imul(aH, bL);
1030
+ const lh = Math.imul(aL, bH);
1031
+ const hh = Math.imul(aH, bH);
1032
+ const carry = (ll >>> 16) + (hl & 65535) + lh;
1033
+ return {
1034
+ h: hh + (hl >>> 16) + (carry >>> 16) | 0,
1035
+ l: carry << 16 | ll & 65535
1036
+ };
1037
+ }
1038
+ function mul2(a, b) {
1039
+ const { h, l } = mul(a, b);
1040
+ return {
1041
+ h: (h << 1 | l >>> 31) & 4294967295,
1042
+ l: l << 1 & 4294967295
1043
+ };
1044
+ }
1045
+ function blamka(Ah, Al, Bh, Bl) {
1046
+ const { h: Ch, l: Cl } = mul2(Al, Bl);
1047
+ const Rll = add3L(Al, Bl, Cl);
1048
+ return {
1049
+ h: add3H(Rll, Ah, Bh, Ch),
1050
+ l: Rll | 0
1051
+ };
1052
+ }
1053
+ const A2_BUF = new Uint32Array(256);
1054
+ function G(a, b, c, d) {
1055
+ let Al = A2_BUF[2 * a], Ah = A2_BUF[2 * a + 1];
1056
+ let Bl = A2_BUF[2 * b], Bh = A2_BUF[2 * b + 1];
1057
+ let Cl = A2_BUF[2 * c], Ch = A2_BUF[2 * c + 1];
1058
+ let Dl = A2_BUF[2 * d], Dh = A2_BUF[2 * d + 1];
1059
+ ({h: Ah, l: Al} = blamka(Ah, Al, Bh, Bl));
1060
+ ({Dh, Dl} = {
1061
+ Dh: Dh ^ Ah,
1062
+ Dl: Dl ^ Al
1063
+ });
1064
+ ({Dh, Dl} = {
1065
+ Dh: rotr32H(Dh, Dl),
1066
+ Dl: rotr32L(Dh, Dl)
1067
+ });
1068
+ ({h: Ch, l: Cl} = blamka(Ch, Cl, Dh, Dl));
1069
+ ({Bh, Bl} = {
1070
+ Bh: Bh ^ Ch,
1071
+ Bl: Bl ^ Cl
1072
+ });
1073
+ ({Bh, Bl} = {
1074
+ Bh: rotrSH(Bh, Bl, 24),
1075
+ Bl: rotrSL(Bh, Bl, 24)
1076
+ });
1077
+ ({h: Ah, l: Al} = blamka(Ah, Al, Bh, Bl));
1078
+ ({Dh, Dl} = {
1079
+ Dh: Dh ^ Ah,
1080
+ Dl: Dl ^ Al
1081
+ });
1082
+ ({Dh, Dl} = {
1083
+ Dh: rotrSH(Dh, Dl, 16),
1084
+ Dl: rotrSL(Dh, Dl, 16)
1085
+ });
1086
+ ({h: Ch, l: Cl} = blamka(Ch, Cl, Dh, Dl));
1087
+ ({Bh, Bl} = {
1088
+ Bh: Bh ^ Ch,
1089
+ Bl: Bl ^ Cl
1090
+ });
1091
+ ({Bh, Bl} = {
1092
+ Bh: rotrBH(Bh, Bl, 63),
1093
+ Bl: rotrBL(Bh, Bl, 63)
1094
+ });
1095
+ A2_BUF[2 * a] = Al, A2_BUF[2 * a + 1] = Ah;
1096
+ A2_BUF[2 * b] = Bl, A2_BUF[2 * b + 1] = Bh;
1097
+ A2_BUF[2 * c] = Cl, A2_BUF[2 * c + 1] = Ch;
1098
+ A2_BUF[2 * d] = Dl, A2_BUF[2 * d + 1] = Dh;
1099
+ }
1100
+ function P(v00, v01, v02, v03, v04, v05, v06, v07, v08, v09, v10, v11, v12, v13, v14, v15) {
1101
+ G(v00, v04, v08, v12);
1102
+ G(v01, v05, v09, v13);
1103
+ G(v02, v06, v10, v14);
1104
+ G(v03, v07, v11, v15);
1105
+ G(v00, v05, v10, v15);
1106
+ G(v01, v06, v11, v12);
1107
+ G(v02, v07, v08, v13);
1108
+ G(v03, v04, v09, v14);
1109
+ }
1110
+ function block(x, xPos, yPos, outPos, needXor) {
1111
+ for (let i = 0; i < 256; i++) A2_BUF[i] = x[xPos + i] ^ x[yPos + i];
1112
+ for (let i = 0; i < 128; i += 16) P(i, i + 1, i + 2, i + 3, i + 4, i + 5, i + 6, i + 7, i + 8, i + 9, i + 10, i + 11, i + 12, i + 13, i + 14, i + 15);
1113
+ for (let i = 0; i < 16; i += 2) P(i, i + 1, i + 16, i + 17, i + 32, i + 33, i + 48, i + 49, i + 64, i + 65, i + 80, i + 81, i + 96, i + 97, i + 112, i + 113);
1114
+ if (needXor) for (let i = 0; i < 256; i++) x[outPos + i] ^= A2_BUF[i] ^ x[xPos + i] ^ x[yPos + i];
1115
+ else for (let i = 0; i < 256; i++) x[outPos + i] = A2_BUF[i] ^ x[xPos + i] ^ x[yPos + i];
1116
+ clean(A2_BUF);
1117
+ }
1118
+ function Hp(A, dkLen) {
1119
+ const A8 = u8(A);
1120
+ const T = new Uint32Array(1);
1121
+ const T8 = u8(T);
1122
+ T[0] = dkLen;
1123
+ if (dkLen <= 64) return blake2b.create({ dkLen }).update(T8).update(A8).digest();
1124
+ const out = new Uint8Array(dkLen);
1125
+ let V = blake2b.create({}).update(T8).update(A8).digest();
1126
+ let pos = 0;
1127
+ out.set(V.subarray(0, 32));
1128
+ pos += 32;
1129
+ for (; dkLen - pos > 64; pos += 32) {
1130
+ const Vh = blake2b.create({}).update(V);
1131
+ Vh.digestInto(V);
1132
+ Vh.destroy();
1133
+ out.set(V.subarray(0, 32), pos);
1134
+ }
1135
+ out.set(blake2b(V, { dkLen: dkLen - pos }), pos);
1136
+ clean(V, T);
1137
+ return u32(out);
1138
+ }
1139
+ function indexAlpha(r, s, laneLen, segmentLen, index, randL, sameLane = false) {
1140
+ let area;
1141
+ if (r === 0) if (s === 0) area = index - 1;
1142
+ else if (sameLane) area = s * segmentLen + index - 1;
1143
+ else area = s * segmentLen + (index == 0 ? -1 : 0);
1144
+ else if (sameLane) area = laneLen - segmentLen + index - 1;
1145
+ else area = laneLen - segmentLen + (index == 0 ? -1 : 0);
1146
+ return ((r !== 0 && s !== ARGON2_SYNC_POINTS - 1 ? (s + 1) * segmentLen : 0) + (area - 1 - mul(area, mul(randL, randL).h).h)) % laneLen;
1147
+ }
1148
+ const maxUint32 = Math.pow(2, 32);
1149
+ function isU32(num) {
1150
+ return Number.isSafeInteger(num) && num >= 0 && num < maxUint32;
1151
+ }
1152
+ function argon2Opts(opts) {
1153
+ const merged = {
1154
+ version: 19,
1155
+ dkLen: 32,
1156
+ maxmem: maxUint32 - 1,
1157
+ asyncTick: 10
1158
+ };
1159
+ for (let [k, v] of Object.entries(opts)) if (v != null) merged[k] = v;
1160
+ const { dkLen, p, m, t, version, onProgress } = merged;
1161
+ if (!isU32(dkLen) || dkLen < 4) throw new Error("dkLen should be at least 4 bytes");
1162
+ if (!isU32(p) || p < 1 || p >= Math.pow(2, 24)) throw new Error("p should be 1 <= p < 2^24");
1163
+ if (!isU32(m)) throw new Error("m should be 0 <= m < 2^32");
1164
+ if (!isU32(t) || t < 1) throw new Error("t (iterations) should be 1 <= t < 2^32");
1165
+ if (onProgress !== void 0 && typeof onProgress !== "function") throw new Error("progressCb should be function");
1166
+ if (!isU32(m) || m < 8 * p) throw new Error("memory should be at least 8*p bytes");
1167
+ if (version !== 16 && version !== 19) throw new Error("unknown version=" + version);
1168
+ return merged;
1169
+ }
1170
+ function argon2Init(password, salt, type, opts) {
1171
+ password = kdfInputToBytes(password);
1172
+ salt = kdfInputToBytes(salt);
1173
+ abytes(password);
1174
+ abytes(salt);
1175
+ if (!isU32(password.length)) throw new Error("password should be less than 4 GB");
1176
+ if (!isU32(salt.length) || salt.length < 8) throw new Error("salt should be at least 8 bytes and less than 4 GB");
1177
+ if (!Object.values(AT).includes(type)) throw new Error("invalid type");
1178
+ let { p, dkLen, m, t, version, key, personalization, maxmem, onProgress, asyncTick } = argon2Opts(opts);
1179
+ key = abytesOrZero(key);
1180
+ personalization = abytesOrZero(personalization);
1181
+ const h = blake2b.create({});
1182
+ const BUF = new Uint32Array(1);
1183
+ const BUF8 = u8(BUF);
1184
+ for (let item of [
1185
+ p,
1186
+ dkLen,
1187
+ m,
1188
+ t,
1189
+ version,
1190
+ type
1191
+ ]) {
1192
+ BUF[0] = item;
1193
+ h.update(BUF8);
1194
+ }
1195
+ for (let i of [
1196
+ password,
1197
+ salt,
1198
+ key,
1199
+ personalization
1200
+ ]) {
1201
+ BUF[0] = i.length;
1202
+ h.update(BUF8).update(i);
1203
+ }
1204
+ const H0 = new Uint32Array(18);
1205
+ const H0_8 = u8(H0);
1206
+ h.digestInto(H0_8);
1207
+ const lanes = p;
1208
+ const mP = 4 * p * Math.floor(m / (ARGON2_SYNC_POINTS * p));
1209
+ const laneLen = Math.floor(mP / p);
1210
+ const segmentLen = Math.floor(laneLen / ARGON2_SYNC_POINTS);
1211
+ const memUsed = mP * 256;
1212
+ if (!isU32(maxmem) || memUsed > maxmem) throw new Error("mem should be less than 2**32, got: maxmem=" + maxmem + ", memused=" + memUsed);
1213
+ const B = new Uint32Array(memUsed);
1214
+ for (let l = 0; l < p; l++) {
1215
+ const i = 256 * laneLen * l;
1216
+ H0[17] = l;
1217
+ H0[16] = 0;
1218
+ B.set(Hp(H0, 1024), i);
1219
+ H0[16] = 1;
1220
+ B.set(Hp(H0, 1024), i + 256);
1221
+ }
1222
+ let perBlock = () => {};
1223
+ if (onProgress) {
1224
+ const totalBlock = t * ARGON2_SYNC_POINTS * p * segmentLen;
1225
+ const callbackPer = Math.max(Math.floor(totalBlock / 1e4), 1);
1226
+ let blockCnt = 0;
1227
+ perBlock = () => {
1228
+ blockCnt++;
1229
+ if (onProgress && (!(blockCnt % callbackPer) || blockCnt === totalBlock)) onProgress(blockCnt / totalBlock);
1230
+ };
1231
+ }
1232
+ clean(BUF, H0);
1233
+ return {
1234
+ type,
1235
+ mP,
1236
+ p,
1237
+ t,
1238
+ version,
1239
+ B,
1240
+ laneLen,
1241
+ lanes,
1242
+ segmentLen,
1243
+ dkLen,
1244
+ perBlock,
1245
+ asyncTick
1246
+ };
1247
+ }
1248
+ function argon2Output(B, p, laneLen, dkLen) {
1249
+ const B_final = new Uint32Array(256);
1250
+ for (let l = 0; l < p; l++) for (let j = 0; j < 256; j++) B_final[j] ^= B[256 * (laneLen * l + laneLen - 1) + j];
1251
+ const res = u8(Hp(B_final, dkLen));
1252
+ clean(B_final);
1253
+ return res;
1254
+ }
1255
+ function processBlock(B, address, l, r, s, index, laneLen, segmentLen, lanes, offset, prev, dataIndependent, needXor) {
1256
+ if (offset % laneLen) prev = offset - 1;
1257
+ let randL, randH;
1258
+ if (dataIndependent) {
1259
+ let i128 = index % 128;
1260
+ if (i128 === 0) {
1261
+ address[268]++;
1262
+ block(address, 256, 2 * 256, 0, false);
1263
+ block(address, 0, 2 * 256, 0, false);
1264
+ }
1265
+ randL = address[2 * i128];
1266
+ randH = address[2 * i128 + 1];
1267
+ } else {
1268
+ const T = 256 * prev;
1269
+ randL = B[T];
1270
+ randH = B[T + 1];
1271
+ }
1272
+ const refLane = r === 0 && s === 0 ? l : randH % lanes;
1273
+ const refPos = indexAlpha(r, s, laneLen, segmentLen, index, randL, refLane == l);
1274
+ const refBlock = laneLen * refLane + refPos;
1275
+ block(B, 256 * prev, 256 * refBlock, offset * 256, needXor);
1276
+ }
1277
+ async function argon2Async(type, password, salt, opts) {
1278
+ const { mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock, asyncTick } = argon2Init(password, salt, type, opts);
1279
+ const address = new Uint32Array(3 * 256);
1280
+ address[262] = mP;
1281
+ address[264] = t;
1282
+ address[266] = type;
1283
+ let ts = Date.now();
1284
+ for (let r = 0; r < t; r++) {
1285
+ const needXor = r !== 0 && version === 19;
1286
+ address[256] = r;
1287
+ for (let s = 0; s < ARGON2_SYNC_POINTS; s++) {
1288
+ address[260] = s;
1289
+ const dataIndependent = type == AT.Argon2i || type == AT.Argon2id && r === 0 && s < 2;
1290
+ for (let l = 0; l < p; l++) {
1291
+ address[258] = l;
1292
+ address[268] = 0;
1293
+ let startPos = 0;
1294
+ if (r === 0 && s === 0) {
1295
+ startPos = 2;
1296
+ if (dataIndependent) {
1297
+ address[268]++;
1298
+ block(address, 256, 2 * 256, 0, false);
1299
+ block(address, 0, 2 * 256, 0, false);
1300
+ }
1301
+ }
1302
+ let offset = l * laneLen + s * segmentLen + startPos;
1303
+ let prev = offset % laneLen ? offset - 1 : offset + laneLen - 1;
1304
+ for (let index = startPos; index < segmentLen; index++, offset++, prev++) {
1305
+ perBlock();
1306
+ processBlock(B, address, l, r, s, index, laneLen, segmentLen, lanes, offset, prev, dataIndependent, needXor);
1307
+ const diff = Date.now() - ts;
1308
+ if (!(diff >= 0 && diff < asyncTick)) {
1309
+ await nextTick();
1310
+ ts += diff;
1311
+ }
1312
+ }
1313
+ }
1314
+ }
1315
+ }
1316
+ clean(address);
1317
+ return argon2Output(B, p, laneLen, dkLen);
1318
+ }
1319
+ /** argon2id async, combining i+d, the most popular version from RFC 9106 */
1320
+ const argon2idAsync = (password, salt, opts) => argon2Async(AT.Argon2id, password, salt, opts);
1321
+ //#endregion
1322
+ //#region ../../node_modules/@noble/hashes/cryptoNode.js
1323
+ var require_cryptoNode = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
1324
+ Object.defineProperty(exports, "__esModule", { value: true });
1325
+ exports.crypto = void 0;
1326
+ /**
1327
+ * Internal webcrypto alias.
1328
+ * We prefer WebCrypto aka globalThis.crypto, which exists in node.js 16+.
1329
+ * Falls back to Node.js built-in crypto for Node.js <=v14.
1330
+ * See utils.ts for details.
1331
+ * @module
1332
+ */
1333
+ const nc = require("node:crypto");
1334
+ exports.crypto = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : nc && typeof nc === "object" && "randomBytes" in nc ? nc : void 0;
1335
+ }));
1336
+ //#endregion
1337
+ //#region ../../node_modules/@noble/hashes/utils.js
1338
+ var require_utils = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
1339
+ /**
1340
+ * Utilities for hex, bytes, CSPRNG.
1341
+ * @module
1342
+ */
1343
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
1344
+ Object.defineProperty(exports, "__esModule", { value: true });
1345
+ exports.wrapXOFConstructorWithOpts = exports.wrapConstructorWithOpts = exports.wrapConstructor = exports.Hash = exports.nextTick = exports.swap32IfBE = exports.byteSwapIfBE = exports.swap8IfBE = exports.isLE = void 0;
1346
+ exports.isBytes = isBytes;
1347
+ exports.anumber = anumber;
1348
+ exports.abytes = abytes;
1349
+ exports.ahash = ahash;
1350
+ exports.aexists = aexists;
1351
+ exports.aoutput = aoutput;
1352
+ exports.u8 = u8;
1353
+ exports.u32 = u32;
1354
+ exports.clean = clean;
1355
+ exports.createView = createView;
1356
+ exports.rotr = rotr;
1357
+ exports.rotl = rotl;
1358
+ exports.byteSwap = byteSwap;
1359
+ exports.byteSwap32 = byteSwap32;
1360
+ exports.bytesToHex = bytesToHex;
1361
+ exports.hexToBytes = hexToBytes;
1362
+ exports.asyncLoop = asyncLoop;
1363
+ exports.utf8ToBytes = utf8ToBytes;
1364
+ exports.bytesToUtf8 = bytesToUtf8;
1365
+ exports.toBytes = toBytes;
1366
+ exports.kdfInputToBytes = kdfInputToBytes;
1367
+ exports.concatBytes = concatBytes;
1368
+ exports.checkOpts = checkOpts;
1369
+ exports.createHasher = createHasher;
1370
+ exports.createOptHasher = createOptHasher;
1371
+ exports.createXOFer = createXOFer;
1372
+ exports.randomBytes = randomBytes;
1373
+ const crypto_1 = require_cryptoNode();
1374
+ /** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */
1375
+ function isBytes(a) {
1376
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
1377
+ }
1378
+ /** Asserts something is positive integer. */
1379
+ function anumber(n) {
1380
+ if (!Number.isSafeInteger(n) || n < 0) throw new Error("positive integer expected, got " + n);
1381
+ }
1382
+ /** Asserts something is Uint8Array. */
1383
+ function abytes(b, ...lengths) {
1384
+ if (!isBytes(b)) throw new Error("Uint8Array expected");
1385
+ if (lengths.length > 0 && !lengths.includes(b.length)) throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
1386
+ }
1387
+ /** Asserts something is hash */
1388
+ function ahash(h) {
1389
+ if (typeof h !== "function" || typeof h.create !== "function") throw new Error("Hash should be wrapped by utils.createHasher");
1390
+ anumber(h.outputLen);
1391
+ anumber(h.blockLen);
1392
+ }
1393
+ /** Asserts a hash instance has not been destroyed / finished */
1394
+ function aexists(instance, checkFinished = true) {
1395
+ if (instance.destroyed) throw new Error("Hash instance has been destroyed");
1396
+ if (checkFinished && instance.finished) throw new Error("Hash#digest() has already been called");
1397
+ }
1398
+ /** Asserts output is properly-sized byte array */
1399
+ function aoutput(out, instance) {
1400
+ abytes(out);
1401
+ const min = instance.outputLen;
1402
+ if (out.length < min) throw new Error("digestInto() expects output buffer of length at least " + min);
1403
+ }
1404
+ /** Cast u8 / u16 / u32 to u8. */
1405
+ function u8(arr) {
1406
+ return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
1407
+ }
1408
+ /** Cast u8 / u16 / u32 to u32. */
1409
+ function u32(arr) {
1410
+ return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
1411
+ }
1412
+ /** Zeroize a byte array. Warning: JS provides no guarantees. */
1413
+ function clean(...arrays) {
1414
+ for (let i = 0; i < arrays.length; i++) arrays[i].fill(0);
1415
+ }
1416
+ /** Create DataView of an array for easy byte-level manipulation. */
1417
+ function createView(arr) {
1418
+ return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
1419
+ }
1420
+ /** The rotate right (circular right shift) operation for uint32 */
1421
+ function rotr(word, shift) {
1422
+ return word << 32 - shift | word >>> shift;
1423
+ }
1424
+ /** The rotate left (circular left shift) operation for uint32 */
1425
+ function rotl(word, shift) {
1426
+ return word << shift | word >>> 32 - shift >>> 0;
1427
+ }
1428
+ /** Is current platform little-endian? Most are. Big-Endian platform: IBM */
1429
+ exports.isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
1430
+ /** The byte swap operation for uint32 */
1431
+ function byteSwap(word) {
1432
+ return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
1433
+ }
1434
+ /** Conditionally byte swap if on a big-endian platform */
1435
+ exports.swap8IfBE = exports.isLE ? (n) => n : (n) => byteSwap(n);
1436
+ /** @deprecated */
1437
+ exports.byteSwapIfBE = exports.swap8IfBE;
1438
+ /** In place byte swap for Uint32Array */
1439
+ function byteSwap32(arr) {
1440
+ for (let i = 0; i < arr.length; i++) arr[i] = byteSwap(arr[i]);
1441
+ return arr;
1442
+ }
1443
+ exports.swap32IfBE = exports.isLE ? (u) => u : byteSwap32;
1444
+ const hasHexBuiltin = typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function";
1445
+ const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
1446
+ /**
1447
+ * Convert byte array to hex string. Uses built-in function, when available.
1448
+ * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'
1449
+ */
1450
+ function bytesToHex(bytes) {
1451
+ abytes(bytes);
1452
+ if (hasHexBuiltin) return bytes.toHex();
1453
+ let hex = "";
1454
+ for (let i = 0; i < bytes.length; i++) hex += hexes[bytes[i]];
1455
+ return hex;
1456
+ }
1457
+ const asciis = {
1458
+ _0: 48,
1459
+ _9: 57,
1460
+ A: 65,
1461
+ F: 70,
1462
+ a: 97,
1463
+ f: 102
1464
+ };
1465
+ function asciiToBase16(ch) {
1466
+ if (ch >= asciis._0 && ch <= asciis._9) return ch - asciis._0;
1467
+ if (ch >= asciis.A && ch <= asciis.F) return ch - (asciis.A - 10);
1468
+ if (ch >= asciis.a && ch <= asciis.f) return ch - (asciis.a - 10);
1469
+ }
1470
+ /**
1471
+ * Convert hex string to byte array. Uses built-in function, when available.
1472
+ * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])
1473
+ */
1474
+ function hexToBytes(hex) {
1475
+ if (typeof hex !== "string") throw new Error("hex string expected, got " + typeof hex);
1476
+ if (hasHexBuiltin) return Uint8Array.fromHex(hex);
1477
+ const hl = hex.length;
1478
+ const al = hl / 2;
1479
+ if (hl % 2) throw new Error("hex string expected, got unpadded hex of length " + hl);
1480
+ const array = new Uint8Array(al);
1481
+ for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
1482
+ const n1 = asciiToBase16(hex.charCodeAt(hi));
1483
+ const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
1484
+ if (n1 === void 0 || n2 === void 0) {
1485
+ const char = hex[hi] + hex[hi + 1];
1486
+ throw new Error("hex string expected, got non-hex character \"" + char + "\" at index " + hi);
1487
+ }
1488
+ array[ai] = n1 * 16 + n2;
1489
+ }
1490
+ return array;
1491
+ }
1492
+ /**
1493
+ * There is no setImmediate in browser and setTimeout is slow.
1494
+ * Call of async fn will return Promise, which will be fullfiled only on
1495
+ * next scheduler queue processing step and this is exactly what we need.
1496
+ */
1497
+ const nextTick = async () => {};
1498
+ exports.nextTick = nextTick;
1499
+ /** Returns control to thread each 'tick' ms to avoid blocking. */
1500
+ async function asyncLoop(iters, tick, cb) {
1501
+ let ts = Date.now();
1502
+ for (let i = 0; i < iters; i++) {
1503
+ cb(i);
1504
+ const diff = Date.now() - ts;
1505
+ if (diff >= 0 && diff < tick) continue;
1506
+ await (0, exports.nextTick)();
1507
+ ts += diff;
1508
+ }
1509
+ }
1510
+ /**
1511
+ * Converts string to bytes using UTF8 encoding.
1512
+ * @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])
1513
+ */
1514
+ function utf8ToBytes(str) {
1515
+ if (typeof str !== "string") throw new Error("string expected");
1516
+ return new Uint8Array(new TextEncoder().encode(str));
1517
+ }
1518
+ /**
1519
+ * Converts bytes to string using UTF8 encoding.
1520
+ * @example bytesToUtf8(Uint8Array.from([97, 98, 99])) // 'abc'
1521
+ */
1522
+ function bytesToUtf8(bytes) {
1523
+ return new TextDecoder().decode(bytes);
1524
+ }
1525
+ /**
1526
+ * Normalizes (non-hex) string or Uint8Array to Uint8Array.
1527
+ * Warning: when Uint8Array is passed, it would NOT get copied.
1528
+ * Keep in mind for future mutable operations.
1529
+ */
1530
+ function toBytes(data) {
1531
+ if (typeof data === "string") data = utf8ToBytes(data);
1532
+ abytes(data);
1533
+ return data;
1534
+ }
1535
+ /**
1536
+ * Helper for KDFs: consumes uint8array or string.
1537
+ * When string is passed, does utf8 decoding, using TextDecoder.
1538
+ */
1539
+ function kdfInputToBytes(data) {
1540
+ if (typeof data === "string") data = utf8ToBytes(data);
1541
+ abytes(data);
1542
+ return data;
1543
+ }
1544
+ /** Copies several Uint8Arrays into one. */
1545
+ function concatBytes(...arrays) {
1546
+ let sum = 0;
1547
+ for (let i = 0; i < arrays.length; i++) {
1548
+ const a = arrays[i];
1549
+ abytes(a);
1550
+ sum += a.length;
1551
+ }
1552
+ const res = new Uint8Array(sum);
1553
+ for (let i = 0, pad = 0; i < arrays.length; i++) {
1554
+ const a = arrays[i];
1555
+ res.set(a, pad);
1556
+ pad += a.length;
1557
+ }
1558
+ return res;
1559
+ }
1560
+ function checkOpts(defaults, opts) {
1561
+ if (opts !== void 0 && {}.toString.call(opts) !== "[object Object]") throw new Error("options should be object or undefined");
1562
+ return Object.assign(defaults, opts);
1563
+ }
1564
+ /** For runtime check if class implements interface */
1565
+ var Hash = class {};
1566
+ exports.Hash = Hash;
1567
+ /** Wraps hash function, creating an interface on top of it */
1568
+ function createHasher(hashCons) {
1569
+ const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
1570
+ const tmp = hashCons();
1571
+ hashC.outputLen = tmp.outputLen;
1572
+ hashC.blockLen = tmp.blockLen;
1573
+ hashC.create = () => hashCons();
1574
+ return hashC;
1575
+ }
1576
+ function createOptHasher(hashCons) {
1577
+ const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
1578
+ const tmp = hashCons({});
1579
+ hashC.outputLen = tmp.outputLen;
1580
+ hashC.blockLen = tmp.blockLen;
1581
+ hashC.create = (opts) => hashCons(opts);
1582
+ return hashC;
1583
+ }
1584
+ function createXOFer(hashCons) {
1585
+ const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
1586
+ const tmp = hashCons({});
1587
+ hashC.outputLen = tmp.outputLen;
1588
+ hashC.blockLen = tmp.blockLen;
1589
+ hashC.create = (opts) => hashCons(opts);
1590
+ return hashC;
1591
+ }
1592
+ exports.wrapConstructor = createHasher;
1593
+ exports.wrapConstructorWithOpts = createOptHasher;
1594
+ exports.wrapXOFConstructorWithOpts = createXOFer;
1595
+ /** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */
1596
+ function randomBytes(bytesLength = 32) {
1597
+ if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === "function") return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength));
1598
+ if (crypto_1.crypto && typeof crypto_1.crypto.randomBytes === "function") return Uint8Array.from(crypto_1.crypto.randomBytes(bytesLength));
1599
+ throw new Error("crypto.getRandomValues must be defined");
1600
+ }
1601
+ }));
1602
+ //#endregion
1603
+ //#region ../../node_modules/@noble/hashes/_md.js
1604
+ var require__md = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
1605
+ Object.defineProperty(exports, "__esModule", { value: true });
1606
+ exports.SHA512_IV = exports.SHA384_IV = exports.SHA224_IV = exports.SHA256_IV = exports.HashMD = void 0;
1607
+ exports.setBigUint64 = setBigUint64;
1608
+ exports.Chi = Chi;
1609
+ exports.Maj = Maj;
1610
+ /**
1611
+ * Internal Merkle-Damgard hash utils.
1612
+ * @module
1613
+ */
1614
+ const utils_ts_1 = require_utils();
1615
+ /** Polyfill for Safari 14. https://caniuse.com/mdn-javascript_builtins_dataview_setbiguint64 */
1616
+ function setBigUint64(view, byteOffset, value, isLE) {
1617
+ if (typeof view.setBigUint64 === "function") return view.setBigUint64(byteOffset, value, isLE);
1618
+ const _32n = BigInt(32);
1619
+ const _u32_max = BigInt(4294967295);
1620
+ const wh = Number(value >> _32n & _u32_max);
1621
+ const wl = Number(value & _u32_max);
1622
+ const h = isLE ? 4 : 0;
1623
+ const l = isLE ? 0 : 4;
1624
+ view.setUint32(byteOffset + h, wh, isLE);
1625
+ view.setUint32(byteOffset + l, wl, isLE);
1626
+ }
1627
+ /** Choice: a ? b : c */
1628
+ function Chi(a, b, c) {
1629
+ return a & b ^ ~a & c;
1630
+ }
1631
+ /** Majority function, true if any two inputs is true. */
1632
+ function Maj(a, b, c) {
1633
+ return a & b ^ a & c ^ b & c;
1634
+ }
1635
+ /**
1636
+ * Merkle-Damgard hash construction base class.
1637
+ * Could be used to create MD5, RIPEMD, SHA1, SHA2.
1638
+ */
1639
+ var HashMD = class extends utils_ts_1.Hash {
1640
+ constructor(blockLen, outputLen, padOffset, isLE) {
1641
+ super();
1642
+ this.finished = false;
1643
+ this.length = 0;
1644
+ this.pos = 0;
1645
+ this.destroyed = false;
1646
+ this.blockLen = blockLen;
1647
+ this.outputLen = outputLen;
1648
+ this.padOffset = padOffset;
1649
+ this.isLE = isLE;
1650
+ this.buffer = new Uint8Array(blockLen);
1651
+ this.view = (0, utils_ts_1.createView)(this.buffer);
1652
+ }
1653
+ update(data) {
1654
+ (0, utils_ts_1.aexists)(this);
1655
+ data = (0, utils_ts_1.toBytes)(data);
1656
+ (0, utils_ts_1.abytes)(data);
1657
+ const { view, buffer, blockLen } = this;
1658
+ const len = data.length;
1659
+ for (let pos = 0; pos < len;) {
1660
+ const take = Math.min(blockLen - this.pos, len - pos);
1661
+ if (take === blockLen) {
1662
+ const dataView = (0, utils_ts_1.createView)(data);
1663
+ for (; blockLen <= len - pos; pos += blockLen) this.process(dataView, pos);
1664
+ continue;
1665
+ }
1666
+ buffer.set(data.subarray(pos, pos + take), this.pos);
1667
+ this.pos += take;
1668
+ pos += take;
1669
+ if (this.pos === blockLen) {
1670
+ this.process(view, 0);
1671
+ this.pos = 0;
1672
+ }
1673
+ }
1674
+ this.length += data.length;
1675
+ this.roundClean();
1676
+ return this;
1677
+ }
1678
+ digestInto(out) {
1679
+ (0, utils_ts_1.aexists)(this);
1680
+ (0, utils_ts_1.aoutput)(out, this);
1681
+ this.finished = true;
1682
+ const { buffer, view, blockLen, isLE } = this;
1683
+ let { pos } = this;
1684
+ buffer[pos++] = 128;
1685
+ (0, utils_ts_1.clean)(this.buffer.subarray(pos));
1686
+ if (this.padOffset > blockLen - pos) {
1687
+ this.process(view, 0);
1688
+ pos = 0;
1689
+ }
1690
+ for (let i = pos; i < blockLen; i++) buffer[i] = 0;
1691
+ setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
1692
+ this.process(view, 0);
1693
+ const oview = (0, utils_ts_1.createView)(out);
1694
+ const len = this.outputLen;
1695
+ if (len % 4) throw new Error("_sha2: outputLen should be aligned to 32bit");
1696
+ const outLen = len / 4;
1697
+ const state = this.get();
1698
+ if (outLen > state.length) throw new Error("_sha2: outputLen bigger than state");
1699
+ for (let i = 0; i < outLen; i++) oview.setUint32(4 * i, state[i], isLE);
1700
+ }
1701
+ digest() {
1702
+ const { buffer, outputLen } = this;
1703
+ this.digestInto(buffer);
1704
+ const res = buffer.slice(0, outputLen);
1705
+ this.destroy();
1706
+ return res;
1707
+ }
1708
+ _cloneInto(to) {
1709
+ to || (to = new this.constructor());
1710
+ to.set(...this.get());
1711
+ const { blockLen, buffer, length, finished, destroyed, pos } = this;
1712
+ to.destroyed = destroyed;
1713
+ to.finished = finished;
1714
+ to.length = length;
1715
+ to.pos = pos;
1716
+ if (length % blockLen) to.buffer.set(buffer);
1717
+ return to;
1718
+ }
1719
+ clone() {
1720
+ return this._cloneInto();
1721
+ }
1722
+ };
1723
+ exports.HashMD = HashMD;
1724
+ /**
1725
+ * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.
1726
+ * Check out `test/misc/sha2-gen-iv.js` for recomputation guide.
1727
+ */
1728
+ /** Initial SHA256 state. Bits 0..32 of frac part of sqrt of primes 2..19 */
1729
+ exports.SHA256_IV = Uint32Array.from([
1730
+ 1779033703,
1731
+ 3144134277,
1732
+ 1013904242,
1733
+ 2773480762,
1734
+ 1359893119,
1735
+ 2600822924,
1736
+ 528734635,
1737
+ 1541459225
1738
+ ]);
1739
+ /** Initial SHA224 state. Bits 32..64 of frac part of sqrt of primes 23..53 */
1740
+ exports.SHA224_IV = Uint32Array.from([
1741
+ 3238371032,
1742
+ 914150663,
1743
+ 812702999,
1744
+ 4144912697,
1745
+ 4290775857,
1746
+ 1750603025,
1747
+ 1694076839,
1748
+ 3204075428
1749
+ ]);
1750
+ /** Initial SHA384 state. Bits 0..64 of frac part of sqrt of primes 23..53 */
1751
+ exports.SHA384_IV = Uint32Array.from([
1752
+ 3418070365,
1753
+ 3238371032,
1754
+ 1654270250,
1755
+ 914150663,
1756
+ 2438529370,
1757
+ 812702999,
1758
+ 355462360,
1759
+ 4144912697,
1760
+ 1731405415,
1761
+ 4290775857,
1762
+ 2394180231,
1763
+ 1750603025,
1764
+ 3675008525,
1765
+ 1694076839,
1766
+ 1203062813,
1767
+ 3204075428
1768
+ ]);
1769
+ /** Initial SHA512 state. Bits 0..64 of frac part of sqrt of primes 2..19 */
1770
+ exports.SHA512_IV = Uint32Array.from([
1771
+ 1779033703,
1772
+ 4089235720,
1773
+ 3144134277,
1774
+ 2227873595,
1775
+ 1013904242,
1776
+ 4271175723,
1777
+ 2773480762,
1778
+ 1595750129,
1779
+ 1359893119,
1780
+ 2917565137,
1781
+ 2600822924,
1782
+ 725511199,
1783
+ 528734635,
1784
+ 4215389547,
1785
+ 1541459225,
1786
+ 327033209
1787
+ ]);
1788
+ }));
1789
+ //#endregion
1790
+ //#region ../../node_modules/@noble/hashes/legacy.js
1791
+ var require_legacy = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
1792
+ Object.defineProperty(exports, "__esModule", { value: true });
1793
+ exports.ripemd160 = exports.RIPEMD160 = exports.md5 = exports.MD5 = exports.sha1 = exports.SHA1 = void 0;
1794
+ /**
1795
+
1796
+ SHA1 (RFC 3174), MD5 (RFC 1321) and RIPEMD160 (RFC 2286) legacy, weak hash functions.
1797
+ Don't use them in a new protocol. What "weak" means:
1798
+
1799
+ - Collisions can be made with 2^18 effort in MD5, 2^60 in SHA1, 2^80 in RIPEMD160.
1800
+ - No practical pre-image attacks (only theoretical, 2^123.4)
1801
+ - HMAC seems kinda ok: https://datatracker.ietf.org/doc/html/rfc6151
1802
+ * @module
1803
+ */
1804
+ const _md_ts_1 = require__md();
1805
+ const utils_ts_1 = require_utils();
1806
+ /** Initial SHA1 state */
1807
+ const SHA1_IV = /* @__PURE__ */ Uint32Array.from([
1808
+ 1732584193,
1809
+ 4023233417,
1810
+ 2562383102,
1811
+ 271733878,
1812
+ 3285377520
1813
+ ]);
1814
+ const SHA1_W = /* @__PURE__ */ new Uint32Array(80);
1815
+ /** SHA1 legacy hash class. */
1816
+ var SHA1 = class extends _md_ts_1.HashMD {
1817
+ constructor() {
1818
+ super(64, 20, 8, false);
1819
+ this.A = SHA1_IV[0] | 0;
1820
+ this.B = SHA1_IV[1] | 0;
1821
+ this.C = SHA1_IV[2] | 0;
1822
+ this.D = SHA1_IV[3] | 0;
1823
+ this.E = SHA1_IV[4] | 0;
1824
+ }
1825
+ get() {
1826
+ const { A, B, C, D, E } = this;
1827
+ return [
1828
+ A,
1829
+ B,
1830
+ C,
1831
+ D,
1832
+ E
1833
+ ];
1834
+ }
1835
+ set(A, B, C, D, E) {
1836
+ this.A = A | 0;
1837
+ this.B = B | 0;
1838
+ this.C = C | 0;
1839
+ this.D = D | 0;
1840
+ this.E = E | 0;
1841
+ }
1842
+ process(view, offset) {
1843
+ for (let i = 0; i < 16; i++, offset += 4) SHA1_W[i] = view.getUint32(offset, false);
1844
+ for (let i = 16; i < 80; i++) SHA1_W[i] = (0, utils_ts_1.rotl)(SHA1_W[i - 3] ^ SHA1_W[i - 8] ^ SHA1_W[i - 14] ^ SHA1_W[i - 16], 1);
1845
+ let { A, B, C, D, E } = this;
1846
+ for (let i = 0; i < 80; i++) {
1847
+ let F, K;
1848
+ if (i < 20) {
1849
+ F = (0, _md_ts_1.Chi)(B, C, D);
1850
+ K = 1518500249;
1851
+ } else if (i < 40) {
1852
+ F = B ^ C ^ D;
1853
+ K = 1859775393;
1854
+ } else if (i < 60) {
1855
+ F = (0, _md_ts_1.Maj)(B, C, D);
1856
+ K = 2400959708;
1857
+ } else {
1858
+ F = B ^ C ^ D;
1859
+ K = 3395469782;
1860
+ }
1861
+ const T = (0, utils_ts_1.rotl)(A, 5) + F + E + K + SHA1_W[i] | 0;
1862
+ E = D;
1863
+ D = C;
1864
+ C = (0, utils_ts_1.rotl)(B, 30);
1865
+ B = A;
1866
+ A = T;
1867
+ }
1868
+ A = A + this.A | 0;
1869
+ B = B + this.B | 0;
1870
+ C = C + this.C | 0;
1871
+ D = D + this.D | 0;
1872
+ E = E + this.E | 0;
1873
+ this.set(A, B, C, D, E);
1874
+ }
1875
+ roundClean() {
1876
+ (0, utils_ts_1.clean)(SHA1_W);
1877
+ }
1878
+ destroy() {
1879
+ this.set(0, 0, 0, 0, 0);
1880
+ (0, utils_ts_1.clean)(this.buffer);
1881
+ }
1882
+ };
1883
+ exports.SHA1 = SHA1;
1884
+ /** SHA1 (RFC 3174) legacy hash function. It was cryptographically broken. */
1885
+ exports.sha1 = (0, utils_ts_1.createHasher)(() => new SHA1());
1886
+ /** Per-round constants */
1887
+ const p32 = /* @__PURE__ */ Math.pow(2, 32);
1888
+ const K = /* @__PURE__ */ Array.from({ length: 64 }, (_, i) => Math.floor(p32 * Math.abs(Math.sin(i + 1))));
1889
+ /** md5 initial state: same as sha1, but 4 u32 instead of 5. */
1890
+ const MD5_IV = /* @__PURE__ */ SHA1_IV.slice(0, 4);
1891
+ const MD5_W = /* @__PURE__ */ new Uint32Array(16);
1892
+ /** MD5 legacy hash class. */
1893
+ var MD5 = class extends _md_ts_1.HashMD {
1894
+ constructor() {
1895
+ super(64, 16, 8, true);
1896
+ this.A = MD5_IV[0] | 0;
1897
+ this.B = MD5_IV[1] | 0;
1898
+ this.C = MD5_IV[2] | 0;
1899
+ this.D = MD5_IV[3] | 0;
1900
+ }
1901
+ get() {
1902
+ const { A, B, C, D } = this;
1903
+ return [
1904
+ A,
1905
+ B,
1906
+ C,
1907
+ D
1908
+ ];
1909
+ }
1910
+ set(A, B, C, D) {
1911
+ this.A = A | 0;
1912
+ this.B = B | 0;
1913
+ this.C = C | 0;
1914
+ this.D = D | 0;
1915
+ }
1916
+ process(view, offset) {
1917
+ for (let i = 0; i < 16; i++, offset += 4) MD5_W[i] = view.getUint32(offset, true);
1918
+ let { A, B, C, D } = this;
1919
+ for (let i = 0; i < 64; i++) {
1920
+ let F, g, s;
1921
+ if (i < 16) {
1922
+ F = (0, _md_ts_1.Chi)(B, C, D);
1923
+ g = i;
1924
+ s = [
1925
+ 7,
1926
+ 12,
1927
+ 17,
1928
+ 22
1929
+ ];
1930
+ } else if (i < 32) {
1931
+ F = (0, _md_ts_1.Chi)(D, B, C);
1932
+ g = (5 * i + 1) % 16;
1933
+ s = [
1934
+ 5,
1935
+ 9,
1936
+ 14,
1937
+ 20
1938
+ ];
1939
+ } else if (i < 48) {
1940
+ F = B ^ C ^ D;
1941
+ g = (3 * i + 5) % 16;
1942
+ s = [
1943
+ 4,
1944
+ 11,
1945
+ 16,
1946
+ 23
1947
+ ];
1948
+ } else {
1949
+ F = C ^ (B | ~D);
1950
+ g = 7 * i % 16;
1951
+ s = [
1952
+ 6,
1953
+ 10,
1954
+ 15,
1955
+ 21
1956
+ ];
1957
+ }
1958
+ F = F + A + K[i] + MD5_W[g];
1959
+ A = D;
1960
+ D = C;
1961
+ C = B;
1962
+ B = B + (0, utils_ts_1.rotl)(F, s[i % 4]);
1963
+ }
1964
+ A = A + this.A | 0;
1965
+ B = B + this.B | 0;
1966
+ C = C + this.C | 0;
1967
+ D = D + this.D | 0;
1968
+ this.set(A, B, C, D);
1969
+ }
1970
+ roundClean() {
1971
+ (0, utils_ts_1.clean)(MD5_W);
1972
+ }
1973
+ destroy() {
1974
+ this.set(0, 0, 0, 0);
1975
+ (0, utils_ts_1.clean)(this.buffer);
1976
+ }
1977
+ };
1978
+ exports.MD5 = MD5;
1979
+ /**
1980
+ * MD5 (RFC 1321) legacy hash function. It was cryptographically broken.
1981
+ * MD5 architecture is similar to SHA1, with some differences:
1982
+ * - Reduced output length: 16 bytes (128 bit) instead of 20
1983
+ * - 64 rounds, instead of 80
1984
+ * - Little-endian: could be faster, but will require more code
1985
+ * - Non-linear index selection: huge speed-up for unroll
1986
+ * - Per round constants: more memory accesses, additional speed-up for unroll
1987
+ */
1988
+ exports.md5 = (0, utils_ts_1.createHasher)(() => new MD5());
1989
+ const Rho160 = /* @__PURE__ */ Uint8Array.from([
1990
+ 7,
1991
+ 4,
1992
+ 13,
1993
+ 1,
1994
+ 10,
1995
+ 6,
1996
+ 15,
1997
+ 3,
1998
+ 12,
1999
+ 0,
2000
+ 9,
2001
+ 5,
2002
+ 2,
2003
+ 14,
2004
+ 11,
2005
+ 8
2006
+ ]);
2007
+ const Id160 = Uint8Array.from(new Array(16).fill(0).map((_, i) => i));
2008
+ const Pi160 = Id160.map((i) => (9 * i + 5) % 16);
2009
+ const idxLR = /* @__PURE__ */ (() => {
2010
+ const res = [[Id160], [Pi160]];
2011
+ for (let i = 0; i < 4; i++) for (let j of res) j.push(j[i].map((k) => Rho160[k]));
2012
+ return res;
2013
+ })();
2014
+ const idxL = idxLR[0];
2015
+ const idxR = idxLR[1];
2016
+ const shifts160 = /* @__PURE__ */ [
2017
+ [
2018
+ 11,
2019
+ 14,
2020
+ 15,
2021
+ 12,
2022
+ 5,
2023
+ 8,
2024
+ 7,
2025
+ 9,
2026
+ 11,
2027
+ 13,
2028
+ 14,
2029
+ 15,
2030
+ 6,
2031
+ 7,
2032
+ 9,
2033
+ 8
2034
+ ],
2035
+ [
2036
+ 12,
2037
+ 13,
2038
+ 11,
2039
+ 15,
2040
+ 6,
2041
+ 9,
2042
+ 9,
2043
+ 7,
2044
+ 12,
2045
+ 15,
2046
+ 11,
2047
+ 13,
2048
+ 7,
2049
+ 8,
2050
+ 7,
2051
+ 7
2052
+ ],
2053
+ [
2054
+ 13,
2055
+ 15,
2056
+ 14,
2057
+ 11,
2058
+ 7,
2059
+ 7,
2060
+ 6,
2061
+ 8,
2062
+ 13,
2063
+ 14,
2064
+ 13,
2065
+ 12,
2066
+ 5,
2067
+ 5,
2068
+ 6,
2069
+ 9
2070
+ ],
2071
+ [
2072
+ 14,
2073
+ 11,
2074
+ 12,
2075
+ 14,
2076
+ 8,
2077
+ 6,
2078
+ 5,
2079
+ 5,
2080
+ 15,
2081
+ 12,
2082
+ 15,
2083
+ 14,
2084
+ 9,
2085
+ 9,
2086
+ 8,
2087
+ 6
2088
+ ],
2089
+ [
2090
+ 15,
2091
+ 12,
2092
+ 13,
2093
+ 13,
2094
+ 9,
2095
+ 5,
2096
+ 8,
2097
+ 6,
2098
+ 14,
2099
+ 11,
2100
+ 12,
2101
+ 11,
2102
+ 8,
2103
+ 6,
2104
+ 5,
2105
+ 5
2106
+ ]
2107
+ ].map((i) => Uint8Array.from(i));
2108
+ const shiftsL160 = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts160[i][j]));
2109
+ const shiftsR160 = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts160[i][j]));
2110
+ const Kl160 = /* @__PURE__ */ Uint32Array.from([
2111
+ 0,
2112
+ 1518500249,
2113
+ 1859775393,
2114
+ 2400959708,
2115
+ 2840853838
2116
+ ]);
2117
+ const Kr160 = /* @__PURE__ */ Uint32Array.from([
2118
+ 1352829926,
2119
+ 1548603684,
2120
+ 1836072691,
2121
+ 2053994217,
2122
+ 0
2123
+ ]);
2124
+ function ripemd_f(group, x, y, z) {
2125
+ if (group === 0) return x ^ y ^ z;
2126
+ if (group === 1) return x & y | ~x & z;
2127
+ if (group === 2) return (x | ~y) ^ z;
2128
+ if (group === 3) return x & z | y & ~z;
2129
+ return x ^ (y | ~z);
2130
+ }
2131
+ const BUF_160 = /* @__PURE__ */ new Uint32Array(16);
2132
+ var RIPEMD160 = class extends _md_ts_1.HashMD {
2133
+ constructor() {
2134
+ super(64, 20, 8, true);
2135
+ this.h0 = 1732584193;
2136
+ this.h1 = -271733879;
2137
+ this.h2 = -1732584194;
2138
+ this.h3 = 271733878;
2139
+ this.h4 = -1009589776;
2140
+ }
2141
+ get() {
2142
+ const { h0, h1, h2, h3, h4 } = this;
2143
+ return [
2144
+ h0,
2145
+ h1,
2146
+ h2,
2147
+ h3,
2148
+ h4
2149
+ ];
2150
+ }
2151
+ set(h0, h1, h2, h3, h4) {
2152
+ this.h0 = h0 | 0;
2153
+ this.h1 = h1 | 0;
2154
+ this.h2 = h2 | 0;
2155
+ this.h3 = h3 | 0;
2156
+ this.h4 = h4 | 0;
2157
+ }
2158
+ process(view, offset) {
2159
+ for (let i = 0; i < 16; i++, offset += 4) BUF_160[i] = view.getUint32(offset, true);
2160
+ let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el;
2161
+ for (let group = 0; group < 5; group++) {
2162
+ const rGroup = 4 - group;
2163
+ const hbl = Kl160[group], hbr = Kr160[group];
2164
+ const rl = idxL[group], rr = idxR[group];
2165
+ const sl = shiftsL160[group], sr = shiftsR160[group];
2166
+ for (let i = 0; i < 16; i++) {
2167
+ const tl = (0, utils_ts_1.rotl)(al + ripemd_f(group, bl, cl, dl) + BUF_160[rl[i]] + hbl, sl[i]) + el | 0;
2168
+ al = el, el = dl, dl = (0, utils_ts_1.rotl)(cl, 10) | 0, cl = bl, bl = tl;
2169
+ }
2170
+ for (let i = 0; i < 16; i++) {
2171
+ const tr = (0, utils_ts_1.rotl)(ar + ripemd_f(rGroup, br, cr, dr) + BUF_160[rr[i]] + hbr, sr[i]) + er | 0;
2172
+ ar = er, er = dr, dr = (0, utils_ts_1.rotl)(cr, 10) | 0, cr = br, br = tr;
2173
+ }
2174
+ }
2175
+ this.set(this.h1 + cl + dr | 0, this.h2 + dl + er | 0, this.h3 + el + ar | 0, this.h4 + al + br | 0, this.h0 + bl + cr | 0);
2176
+ }
2177
+ roundClean() {
2178
+ (0, utils_ts_1.clean)(BUF_160);
2179
+ }
2180
+ destroy() {
2181
+ this.destroyed = true;
2182
+ (0, utils_ts_1.clean)(this.buffer);
2183
+ this.set(0, 0, 0, 0, 0);
2184
+ }
2185
+ };
2186
+ exports.RIPEMD160 = RIPEMD160;
2187
+ /**
2188
+ * RIPEMD-160 - a legacy hash function from 1990s.
2189
+ * * https://homes.esat.kuleuven.be/~bosselae/ripemd160.html
2190
+ * * https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf
2191
+ */
2192
+ exports.ripemd160 = (0, utils_ts_1.createHasher)(() => new RIPEMD160());
2193
+ }));
2194
+ //#endregion
2195
+ //#region ../../node_modules/@noble/hashes/ripemd160.js
2196
+ var require_ripemd160 = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
2197
+ Object.defineProperty(exports, "__esModule", { value: true });
2198
+ exports.ripemd160 = exports.RIPEMD160 = void 0;
2199
+ /**
2200
+ * RIPEMD-160 legacy hash function.
2201
+ * https://homes.esat.kuleuven.be/~bosselae/ripemd160.html
2202
+ * https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf
2203
+ * @module
2204
+ * @deprecated
2205
+ */
2206
+ const legacy_ts_1 = require_legacy();
2207
+ /** @deprecated Use import from `noble/hashes/legacy` module */
2208
+ exports.RIPEMD160 = legacy_ts_1.RIPEMD160;
2209
+ /** @deprecated Use import from `noble/hashes/legacy` module */
2210
+ exports.ripemd160 = legacy_ts_1.ripemd160;
2211
+ }));
2212
+ //#endregion
2213
+ //#region ../../node_modules/@noble/hashes/sha1.js
2214
+ var require_sha1 = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
2215
+ Object.defineProperty(exports, "__esModule", { value: true });
2216
+ exports.sha1 = exports.SHA1 = void 0;
2217
+ /**
2218
+ * SHA1 (RFC 3174) legacy hash function.
2219
+ * @module
2220
+ * @deprecated
2221
+ */
2222
+ const legacy_ts_1 = require_legacy();
2223
+ /** @deprecated Use import from `noble/hashes/legacy` module */
2224
+ exports.SHA1 = legacy_ts_1.SHA1;
2225
+ /** @deprecated Use import from `noble/hashes/legacy` module */
2226
+ exports.sha1 = legacy_ts_1.sha1;
2227
+ }));
2228
+ //#endregion
2229
+ //#region ../../node_modules/@noble/hashes/_u64.js
2230
+ var require__u64 = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
2231
+ Object.defineProperty(exports, "__esModule", { value: true });
2232
+ exports.toBig = exports.shrSL = exports.shrSH = exports.rotrSL = exports.rotrSH = exports.rotrBL = exports.rotrBH = exports.rotr32L = exports.rotr32H = exports.rotlSL = exports.rotlSH = exports.rotlBL = exports.rotlBH = exports.add5L = exports.add5H = exports.add4L = exports.add4H = exports.add3L = exports.add3H = void 0;
2233
+ exports.add = add;
2234
+ exports.fromBig = fromBig;
2235
+ exports.split = split;
2236
+ /**
2237
+ * Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.
2238
+ * @todo re-check https://issues.chromium.org/issues/42212588
2239
+ * @module
2240
+ */
2241
+ const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
2242
+ const _32n = /* @__PURE__ */ BigInt(32);
2243
+ function fromBig(n, le = false) {
2244
+ if (le) return {
2245
+ h: Number(n & U32_MASK64),
2246
+ l: Number(n >> _32n & U32_MASK64)
2247
+ };
2248
+ return {
2249
+ h: Number(n >> _32n & U32_MASK64) | 0,
2250
+ l: Number(n & U32_MASK64) | 0
2251
+ };
2252
+ }
2253
+ function split(lst, le = false) {
2254
+ const len = lst.length;
2255
+ let Ah = new Uint32Array(len);
2256
+ let Al = new Uint32Array(len);
2257
+ for (let i = 0; i < len; i++) {
2258
+ const { h, l } = fromBig(lst[i], le);
2259
+ [Ah[i], Al[i]] = [h, l];
2260
+ }
2261
+ return [Ah, Al];
2262
+ }
2263
+ const toBig = (h, l) => BigInt(h >>> 0) << _32n | BigInt(l >>> 0);
2264
+ exports.toBig = toBig;
2265
+ const shrSH = (h, _l, s) => h >>> s;
2266
+ exports.shrSH = shrSH;
2267
+ const shrSL = (h, l, s) => h << 32 - s | l >>> s;
2268
+ exports.shrSL = shrSL;
2269
+ const rotrSH = (h, l, s) => h >>> s | l << 32 - s;
2270
+ exports.rotrSH = rotrSH;
2271
+ const rotrSL = (h, l, s) => h << 32 - s | l >>> s;
2272
+ exports.rotrSL = rotrSL;
2273
+ const rotrBH = (h, l, s) => h << 64 - s | l >>> s - 32;
2274
+ exports.rotrBH = rotrBH;
2275
+ const rotrBL = (h, l, s) => h >>> s - 32 | l << 64 - s;
2276
+ exports.rotrBL = rotrBL;
2277
+ const rotr32H = (_h, l) => l;
2278
+ exports.rotr32H = rotr32H;
2279
+ const rotr32L = (h, _l) => h;
2280
+ exports.rotr32L = rotr32L;
2281
+ const rotlSH = (h, l, s) => h << s | l >>> 32 - s;
2282
+ exports.rotlSH = rotlSH;
2283
+ const rotlSL = (h, l, s) => l << s | h >>> 32 - s;
2284
+ exports.rotlSL = rotlSL;
2285
+ const rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
2286
+ exports.rotlBH = rotlBH;
2287
+ const rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
2288
+ exports.rotlBL = rotlBL;
2289
+ function add(Ah, Al, Bh, Bl) {
2290
+ const l = (Al >>> 0) + (Bl >>> 0);
2291
+ return {
2292
+ h: Ah + Bh + (l / 2 ** 32 | 0) | 0,
2293
+ l: l | 0
2294
+ };
2295
+ }
2296
+ const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
2297
+ exports.add3L = add3L;
2298
+ const add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
2299
+ exports.add3H = add3H;
2300
+ const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
2301
+ exports.add4L = add4L;
2302
+ const add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
2303
+ exports.add4H = add4H;
2304
+ const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
2305
+ exports.add5L = add5L;
2306
+ const add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
2307
+ exports.add5H = add5H;
2308
+ exports.default = {
2309
+ fromBig,
2310
+ split,
2311
+ toBig,
2312
+ shrSH,
2313
+ shrSL,
2314
+ rotrSH,
2315
+ rotrSL,
2316
+ rotrBH,
2317
+ rotrBL,
2318
+ rotr32H,
2319
+ rotr32L,
2320
+ rotlSH,
2321
+ rotlSL,
2322
+ rotlBH,
2323
+ rotlBL,
2324
+ add,
2325
+ add3L,
2326
+ add3H,
2327
+ add4L,
2328
+ add4H,
2329
+ add5H,
2330
+ add5L
2331
+ };
2332
+ }));
2333
+ //#endregion
2334
+ //#region ../../node_modules/@noble/hashes/sha2.js
2335
+ var require_sha2 = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
2336
+ Object.defineProperty(exports, "__esModule", { value: true });
2337
+ exports.sha512_224 = exports.sha512_256 = exports.sha384 = exports.sha512 = exports.sha224 = exports.sha256 = exports.SHA512_256 = exports.SHA512_224 = exports.SHA384 = exports.SHA512 = exports.SHA224 = exports.SHA256 = void 0;
2338
+ /**
2339
+ * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.
2340
+ * SHA256 is the fastest hash implementable in JS, even faster than Blake3.
2341
+ * Check out [RFC 4634](https://datatracker.ietf.org/doc/html/rfc4634) and
2342
+ * [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
2343
+ * @module
2344
+ */
2345
+ const _md_ts_1 = require__md();
2346
+ const u64 = require__u64();
2347
+ const utils_ts_1 = require_utils();
2348
+ /**
2349
+ * Round constants:
2350
+ * First 32 bits of fractional parts of the cube roots of the first 64 primes 2..311)
2351
+ */
2352
+ const SHA256_K = /* @__PURE__ */ Uint32Array.from([
2353
+ 1116352408,
2354
+ 1899447441,
2355
+ 3049323471,
2356
+ 3921009573,
2357
+ 961987163,
2358
+ 1508970993,
2359
+ 2453635748,
2360
+ 2870763221,
2361
+ 3624381080,
2362
+ 310598401,
2363
+ 607225278,
2364
+ 1426881987,
2365
+ 1925078388,
2366
+ 2162078206,
2367
+ 2614888103,
2368
+ 3248222580,
2369
+ 3835390401,
2370
+ 4022224774,
2371
+ 264347078,
2372
+ 604807628,
2373
+ 770255983,
2374
+ 1249150122,
2375
+ 1555081692,
2376
+ 1996064986,
2377
+ 2554220882,
2378
+ 2821834349,
2379
+ 2952996808,
2380
+ 3210313671,
2381
+ 3336571891,
2382
+ 3584528711,
2383
+ 113926993,
2384
+ 338241895,
2385
+ 666307205,
2386
+ 773529912,
2387
+ 1294757372,
2388
+ 1396182291,
2389
+ 1695183700,
2390
+ 1986661051,
2391
+ 2177026350,
2392
+ 2456956037,
2393
+ 2730485921,
2394
+ 2820302411,
2395
+ 3259730800,
2396
+ 3345764771,
2397
+ 3516065817,
2398
+ 3600352804,
2399
+ 4094571909,
2400
+ 275423344,
2401
+ 430227734,
2402
+ 506948616,
2403
+ 659060556,
2404
+ 883997877,
2405
+ 958139571,
2406
+ 1322822218,
2407
+ 1537002063,
2408
+ 1747873779,
2409
+ 1955562222,
2410
+ 2024104815,
2411
+ 2227730452,
2412
+ 2361852424,
2413
+ 2428436474,
2414
+ 2756734187,
2415
+ 3204031479,
2416
+ 3329325298
2417
+ ]);
2418
+ /** Reusable temporary buffer. "W" comes straight from spec. */
2419
+ const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
2420
+ var SHA256 = class extends _md_ts_1.HashMD {
2421
+ constructor(outputLen = 32) {
2422
+ super(64, outputLen, 8, false);
2423
+ this.A = _md_ts_1.SHA256_IV[0] | 0;
2424
+ this.B = _md_ts_1.SHA256_IV[1] | 0;
2425
+ this.C = _md_ts_1.SHA256_IV[2] | 0;
2426
+ this.D = _md_ts_1.SHA256_IV[3] | 0;
2427
+ this.E = _md_ts_1.SHA256_IV[4] | 0;
2428
+ this.F = _md_ts_1.SHA256_IV[5] | 0;
2429
+ this.G = _md_ts_1.SHA256_IV[6] | 0;
2430
+ this.H = _md_ts_1.SHA256_IV[7] | 0;
2431
+ }
2432
+ get() {
2433
+ const { A, B, C, D, E, F, G, H } = this;
2434
+ return [
2435
+ A,
2436
+ B,
2437
+ C,
2438
+ D,
2439
+ E,
2440
+ F,
2441
+ G,
2442
+ H
2443
+ ];
2444
+ }
2445
+ set(A, B, C, D, E, F, G, H) {
2446
+ this.A = A | 0;
2447
+ this.B = B | 0;
2448
+ this.C = C | 0;
2449
+ this.D = D | 0;
2450
+ this.E = E | 0;
2451
+ this.F = F | 0;
2452
+ this.G = G | 0;
2453
+ this.H = H | 0;
2454
+ }
2455
+ process(view, offset) {
2456
+ for (let i = 0; i < 16; i++, offset += 4) SHA256_W[i] = view.getUint32(offset, false);
2457
+ for (let i = 16; i < 64; i++) {
2458
+ const W15 = SHA256_W[i - 15];
2459
+ const W2 = SHA256_W[i - 2];
2460
+ const s0 = (0, utils_ts_1.rotr)(W15, 7) ^ (0, utils_ts_1.rotr)(W15, 18) ^ W15 >>> 3;
2461
+ SHA256_W[i] = ((0, utils_ts_1.rotr)(W2, 17) ^ (0, utils_ts_1.rotr)(W2, 19) ^ W2 >>> 10) + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
2462
+ }
2463
+ let { A, B, C, D, E, F, G, H } = this;
2464
+ for (let i = 0; i < 64; i++) {
2465
+ const sigma1 = (0, utils_ts_1.rotr)(E, 6) ^ (0, utils_ts_1.rotr)(E, 11) ^ (0, utils_ts_1.rotr)(E, 25);
2466
+ const T1 = H + sigma1 + (0, _md_ts_1.Chi)(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
2467
+ const T2 = ((0, utils_ts_1.rotr)(A, 2) ^ (0, utils_ts_1.rotr)(A, 13) ^ (0, utils_ts_1.rotr)(A, 22)) + (0, _md_ts_1.Maj)(A, B, C) | 0;
2468
+ H = G;
2469
+ G = F;
2470
+ F = E;
2471
+ E = D + T1 | 0;
2472
+ D = C;
2473
+ C = B;
2474
+ B = A;
2475
+ A = T1 + T2 | 0;
2476
+ }
2477
+ A = A + this.A | 0;
2478
+ B = B + this.B | 0;
2479
+ C = C + this.C | 0;
2480
+ D = D + this.D | 0;
2481
+ E = E + this.E | 0;
2482
+ F = F + this.F | 0;
2483
+ G = G + this.G | 0;
2484
+ H = H + this.H | 0;
2485
+ this.set(A, B, C, D, E, F, G, H);
2486
+ }
2487
+ roundClean() {
2488
+ (0, utils_ts_1.clean)(SHA256_W);
2489
+ }
2490
+ destroy() {
2491
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
2492
+ (0, utils_ts_1.clean)(this.buffer);
2493
+ }
2494
+ };
2495
+ exports.SHA256 = SHA256;
2496
+ var SHA224 = class extends SHA256 {
2497
+ constructor() {
2498
+ super(28);
2499
+ this.A = _md_ts_1.SHA224_IV[0] | 0;
2500
+ this.B = _md_ts_1.SHA224_IV[1] | 0;
2501
+ this.C = _md_ts_1.SHA224_IV[2] | 0;
2502
+ this.D = _md_ts_1.SHA224_IV[3] | 0;
2503
+ this.E = _md_ts_1.SHA224_IV[4] | 0;
2504
+ this.F = _md_ts_1.SHA224_IV[5] | 0;
2505
+ this.G = _md_ts_1.SHA224_IV[6] | 0;
2506
+ this.H = _md_ts_1.SHA224_IV[7] | 0;
2507
+ }
2508
+ };
2509
+ exports.SHA224 = SHA224;
2510
+ const K512 = u64.split([
2511
+ "0x428a2f98d728ae22",
2512
+ "0x7137449123ef65cd",
2513
+ "0xb5c0fbcfec4d3b2f",
2514
+ "0xe9b5dba58189dbbc",
2515
+ "0x3956c25bf348b538",
2516
+ "0x59f111f1b605d019",
2517
+ "0x923f82a4af194f9b",
2518
+ "0xab1c5ed5da6d8118",
2519
+ "0xd807aa98a3030242",
2520
+ "0x12835b0145706fbe",
2521
+ "0x243185be4ee4b28c",
2522
+ "0x550c7dc3d5ffb4e2",
2523
+ "0x72be5d74f27b896f",
2524
+ "0x80deb1fe3b1696b1",
2525
+ "0x9bdc06a725c71235",
2526
+ "0xc19bf174cf692694",
2527
+ "0xe49b69c19ef14ad2",
2528
+ "0xefbe4786384f25e3",
2529
+ "0x0fc19dc68b8cd5b5",
2530
+ "0x240ca1cc77ac9c65",
2531
+ "0x2de92c6f592b0275",
2532
+ "0x4a7484aa6ea6e483",
2533
+ "0x5cb0a9dcbd41fbd4",
2534
+ "0x76f988da831153b5",
2535
+ "0x983e5152ee66dfab",
2536
+ "0xa831c66d2db43210",
2537
+ "0xb00327c898fb213f",
2538
+ "0xbf597fc7beef0ee4",
2539
+ "0xc6e00bf33da88fc2",
2540
+ "0xd5a79147930aa725",
2541
+ "0x06ca6351e003826f",
2542
+ "0x142929670a0e6e70",
2543
+ "0x27b70a8546d22ffc",
2544
+ "0x2e1b21385c26c926",
2545
+ "0x4d2c6dfc5ac42aed",
2546
+ "0x53380d139d95b3df",
2547
+ "0x650a73548baf63de",
2548
+ "0x766a0abb3c77b2a8",
2549
+ "0x81c2c92e47edaee6",
2550
+ "0x92722c851482353b",
2551
+ "0xa2bfe8a14cf10364",
2552
+ "0xa81a664bbc423001",
2553
+ "0xc24b8b70d0f89791",
2554
+ "0xc76c51a30654be30",
2555
+ "0xd192e819d6ef5218",
2556
+ "0xd69906245565a910",
2557
+ "0xf40e35855771202a",
2558
+ "0x106aa07032bbd1b8",
2559
+ "0x19a4c116b8d2d0c8",
2560
+ "0x1e376c085141ab53",
2561
+ "0x2748774cdf8eeb99",
2562
+ "0x34b0bcb5e19b48a8",
2563
+ "0x391c0cb3c5c95a63",
2564
+ "0x4ed8aa4ae3418acb",
2565
+ "0x5b9cca4f7763e373",
2566
+ "0x682e6ff3d6b2b8a3",
2567
+ "0x748f82ee5defb2fc",
2568
+ "0x78a5636f43172f60",
2569
+ "0x84c87814a1f0ab72",
2570
+ "0x8cc702081a6439ec",
2571
+ "0x90befffa23631e28",
2572
+ "0xa4506cebde82bde9",
2573
+ "0xbef9a3f7b2c67915",
2574
+ "0xc67178f2e372532b",
2575
+ "0xca273eceea26619c",
2576
+ "0xd186b8c721c0c207",
2577
+ "0xeada7dd6cde0eb1e",
2578
+ "0xf57d4f7fee6ed178",
2579
+ "0x06f067aa72176fba",
2580
+ "0x0a637dc5a2c898a6",
2581
+ "0x113f9804bef90dae",
2582
+ "0x1b710b35131c471b",
2583
+ "0x28db77f523047d84",
2584
+ "0x32caab7b40c72493",
2585
+ "0x3c9ebe0a15c9bebc",
2586
+ "0x431d67c49c100d4c",
2587
+ "0x4cc5d4becb3e42b6",
2588
+ "0x597f299cfc657e2a",
2589
+ "0x5fcb6fab3ad6faec",
2590
+ "0x6c44198c4a475817"
2591
+ ].map((n) => BigInt(n)));
2592
+ const SHA512_Kh = K512[0];
2593
+ const SHA512_Kl = K512[1];
2594
+ const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);
2595
+ const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);
2596
+ var SHA512 = class extends _md_ts_1.HashMD {
2597
+ constructor(outputLen = 64) {
2598
+ super(128, outputLen, 16, false);
2599
+ this.Ah = _md_ts_1.SHA512_IV[0] | 0;
2600
+ this.Al = _md_ts_1.SHA512_IV[1] | 0;
2601
+ this.Bh = _md_ts_1.SHA512_IV[2] | 0;
2602
+ this.Bl = _md_ts_1.SHA512_IV[3] | 0;
2603
+ this.Ch = _md_ts_1.SHA512_IV[4] | 0;
2604
+ this.Cl = _md_ts_1.SHA512_IV[5] | 0;
2605
+ this.Dh = _md_ts_1.SHA512_IV[6] | 0;
2606
+ this.Dl = _md_ts_1.SHA512_IV[7] | 0;
2607
+ this.Eh = _md_ts_1.SHA512_IV[8] | 0;
2608
+ this.El = _md_ts_1.SHA512_IV[9] | 0;
2609
+ this.Fh = _md_ts_1.SHA512_IV[10] | 0;
2610
+ this.Fl = _md_ts_1.SHA512_IV[11] | 0;
2611
+ this.Gh = _md_ts_1.SHA512_IV[12] | 0;
2612
+ this.Gl = _md_ts_1.SHA512_IV[13] | 0;
2613
+ this.Hh = _md_ts_1.SHA512_IV[14] | 0;
2614
+ this.Hl = _md_ts_1.SHA512_IV[15] | 0;
2615
+ }
2616
+ get() {
2617
+ const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
2618
+ return [
2619
+ Ah,
2620
+ Al,
2621
+ Bh,
2622
+ Bl,
2623
+ Ch,
2624
+ Cl,
2625
+ Dh,
2626
+ Dl,
2627
+ Eh,
2628
+ El,
2629
+ Fh,
2630
+ Fl,
2631
+ Gh,
2632
+ Gl,
2633
+ Hh,
2634
+ Hl
2635
+ ];
2636
+ }
2637
+ set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {
2638
+ this.Ah = Ah | 0;
2639
+ this.Al = Al | 0;
2640
+ this.Bh = Bh | 0;
2641
+ this.Bl = Bl | 0;
2642
+ this.Ch = Ch | 0;
2643
+ this.Cl = Cl | 0;
2644
+ this.Dh = Dh | 0;
2645
+ this.Dl = Dl | 0;
2646
+ this.Eh = Eh | 0;
2647
+ this.El = El | 0;
2648
+ this.Fh = Fh | 0;
2649
+ this.Fl = Fl | 0;
2650
+ this.Gh = Gh | 0;
2651
+ this.Gl = Gl | 0;
2652
+ this.Hh = Hh | 0;
2653
+ this.Hl = Hl | 0;
2654
+ }
2655
+ process(view, offset) {
2656
+ for (let i = 0; i < 16; i++, offset += 4) {
2657
+ SHA512_W_H[i] = view.getUint32(offset);
2658
+ SHA512_W_L[i] = view.getUint32(offset += 4);
2659
+ }
2660
+ for (let i = 16; i < 80; i++) {
2661
+ const W15h = SHA512_W_H[i - 15] | 0;
2662
+ const W15l = SHA512_W_L[i - 15] | 0;
2663
+ const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);
2664
+ const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);
2665
+ const W2h = SHA512_W_H[i - 2] | 0;
2666
+ const W2l = SHA512_W_L[i - 2] | 0;
2667
+ const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);
2668
+ const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);
2669
+ const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);
2670
+ SHA512_W_H[i] = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]) | 0;
2671
+ SHA512_W_L[i] = SUMl | 0;
2672
+ }
2673
+ let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
2674
+ for (let i = 0; i < 80; i++) {
2675
+ const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);
2676
+ const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);
2677
+ const CHIh = Eh & Fh ^ ~Eh & Gh;
2678
+ const CHIl = El & Fl ^ ~El & Gl;
2679
+ const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);
2680
+ const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);
2681
+ const T1l = T1ll | 0;
2682
+ const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);
2683
+ const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);
2684
+ const MAJh = Ah & Bh ^ Ah & Ch ^ Bh & Ch;
2685
+ const MAJl = Al & Bl ^ Al & Cl ^ Bl & Cl;
2686
+ Hh = Gh | 0;
2687
+ Hl = Gl | 0;
2688
+ Gh = Fh | 0;
2689
+ Gl = Fl | 0;
2690
+ Fh = Eh | 0;
2691
+ Fl = El | 0;
2692
+ ({h: Eh, l: El} = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
2693
+ Dh = Ch | 0;
2694
+ Dl = Cl | 0;
2695
+ Ch = Bh | 0;
2696
+ Cl = Bl | 0;
2697
+ Bh = Ah | 0;
2698
+ Bl = Al | 0;
2699
+ const All = u64.add3L(T1l, sigma0l, MAJl);
2700
+ Ah = u64.add3H(All, T1h, sigma0h, MAJh);
2701
+ Al = All | 0;
2702
+ }
2703
+ ({h: Ah, l: Al} = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
2704
+ ({h: Bh, l: Bl} = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
2705
+ ({h: Ch, l: Cl} = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));
2706
+ ({h: Dh, l: Dl} = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
2707
+ ({h: Eh, l: El} = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
2708
+ ({h: Fh, l: Fl} = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
2709
+ ({h: Gh, l: Gl} = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
2710
+ ({h: Hh, l: Hl} = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
2711
+ this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
2712
+ }
2713
+ roundClean() {
2714
+ (0, utils_ts_1.clean)(SHA512_W_H, SHA512_W_L);
2715
+ }
2716
+ destroy() {
2717
+ (0, utils_ts_1.clean)(this.buffer);
2718
+ this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
2719
+ }
2720
+ };
2721
+ exports.SHA512 = SHA512;
2722
+ var SHA384 = class extends SHA512 {
2723
+ constructor() {
2724
+ super(48);
2725
+ this.Ah = _md_ts_1.SHA384_IV[0] | 0;
2726
+ this.Al = _md_ts_1.SHA384_IV[1] | 0;
2727
+ this.Bh = _md_ts_1.SHA384_IV[2] | 0;
2728
+ this.Bl = _md_ts_1.SHA384_IV[3] | 0;
2729
+ this.Ch = _md_ts_1.SHA384_IV[4] | 0;
2730
+ this.Cl = _md_ts_1.SHA384_IV[5] | 0;
2731
+ this.Dh = _md_ts_1.SHA384_IV[6] | 0;
2732
+ this.Dl = _md_ts_1.SHA384_IV[7] | 0;
2733
+ this.Eh = _md_ts_1.SHA384_IV[8] | 0;
2734
+ this.El = _md_ts_1.SHA384_IV[9] | 0;
2735
+ this.Fh = _md_ts_1.SHA384_IV[10] | 0;
2736
+ this.Fl = _md_ts_1.SHA384_IV[11] | 0;
2737
+ this.Gh = _md_ts_1.SHA384_IV[12] | 0;
2738
+ this.Gl = _md_ts_1.SHA384_IV[13] | 0;
2739
+ this.Hh = _md_ts_1.SHA384_IV[14] | 0;
2740
+ this.Hl = _md_ts_1.SHA384_IV[15] | 0;
2741
+ }
2742
+ };
2743
+ exports.SHA384 = SHA384;
2744
+ /**
2745
+ * Truncated SHA512/256 and SHA512/224.
2746
+ * SHA512_IV is XORed with 0xa5a5a5a5a5a5a5a5, then used as "intermediary" IV of SHA512/t.
2747
+ * Then t hashes string to produce result IV.
2748
+ * See `test/misc/sha2-gen-iv.js`.
2749
+ */
2750
+ /** SHA512/224 IV */
2751
+ const T224_IV = /* @__PURE__ */ Uint32Array.from([
2752
+ 2352822216,
2753
+ 424955298,
2754
+ 1944164710,
2755
+ 2312950998,
2756
+ 502970286,
2757
+ 855612546,
2758
+ 1738396948,
2759
+ 1479516111,
2760
+ 258812777,
2761
+ 2077511080,
2762
+ 2011393907,
2763
+ 79989058,
2764
+ 1067287976,
2765
+ 1780299464,
2766
+ 286451373,
2767
+ 2446758561
2768
+ ]);
2769
+ /** SHA512/256 IV */
2770
+ const T256_IV = /* @__PURE__ */ Uint32Array.from([
2771
+ 573645204,
2772
+ 4230739756,
2773
+ 2673172387,
2774
+ 3360449730,
2775
+ 596883563,
2776
+ 1867755857,
2777
+ 2520282905,
2778
+ 1497426621,
2779
+ 2519219938,
2780
+ 2827943907,
2781
+ 3193839141,
2782
+ 1401305490,
2783
+ 721525244,
2784
+ 746961066,
2785
+ 246885852,
2786
+ 2177182882
2787
+ ]);
2788
+ var SHA512_224 = class extends SHA512 {
2789
+ constructor() {
2790
+ super(28);
2791
+ this.Ah = T224_IV[0] | 0;
2792
+ this.Al = T224_IV[1] | 0;
2793
+ this.Bh = T224_IV[2] | 0;
2794
+ this.Bl = T224_IV[3] | 0;
2795
+ this.Ch = T224_IV[4] | 0;
2796
+ this.Cl = T224_IV[5] | 0;
2797
+ this.Dh = T224_IV[6] | 0;
2798
+ this.Dl = T224_IV[7] | 0;
2799
+ this.Eh = T224_IV[8] | 0;
2800
+ this.El = T224_IV[9] | 0;
2801
+ this.Fh = T224_IV[10] | 0;
2802
+ this.Fl = T224_IV[11] | 0;
2803
+ this.Gh = T224_IV[12] | 0;
2804
+ this.Gl = T224_IV[13] | 0;
2805
+ this.Hh = T224_IV[14] | 0;
2806
+ this.Hl = T224_IV[15] | 0;
2807
+ }
2808
+ };
2809
+ exports.SHA512_224 = SHA512_224;
2810
+ var SHA512_256 = class extends SHA512 {
2811
+ constructor() {
2812
+ super(32);
2813
+ this.Ah = T256_IV[0] | 0;
2814
+ this.Al = T256_IV[1] | 0;
2815
+ this.Bh = T256_IV[2] | 0;
2816
+ this.Bl = T256_IV[3] | 0;
2817
+ this.Ch = T256_IV[4] | 0;
2818
+ this.Cl = T256_IV[5] | 0;
2819
+ this.Dh = T256_IV[6] | 0;
2820
+ this.Dl = T256_IV[7] | 0;
2821
+ this.Eh = T256_IV[8] | 0;
2822
+ this.El = T256_IV[9] | 0;
2823
+ this.Fh = T256_IV[10] | 0;
2824
+ this.Fl = T256_IV[11] | 0;
2825
+ this.Gh = T256_IV[12] | 0;
2826
+ this.Gl = T256_IV[13] | 0;
2827
+ this.Hh = T256_IV[14] | 0;
2828
+ this.Hl = T256_IV[15] | 0;
2829
+ }
2830
+ };
2831
+ exports.SHA512_256 = SHA512_256;
2832
+ /**
2833
+ * SHA2-256 hash function from RFC 4634.
2834
+ *
2835
+ * It is the fastest JS hash, even faster than Blake3.
2836
+ * To break sha256 using birthday attack, attackers need to try 2^128 hashes.
2837
+ * BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
2838
+ */
2839
+ exports.sha256 = (0, utils_ts_1.createHasher)(() => new SHA256());
2840
+ /** SHA2-224 hash function from RFC 4634 */
2841
+ exports.sha224 = (0, utils_ts_1.createHasher)(() => new SHA224());
2842
+ /** SHA2-512 hash function from RFC 4634. */
2843
+ exports.sha512 = (0, utils_ts_1.createHasher)(() => new SHA512());
2844
+ /** SHA2-384 hash function from RFC 4634. */
2845
+ exports.sha384 = (0, utils_ts_1.createHasher)(() => new SHA384());
2846
+ /**
2847
+ * SHA2-512/256 "truncated" hash function, with improved resistance to length extension attacks.
2848
+ * See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf).
2849
+ */
2850
+ exports.sha512_256 = (0, utils_ts_1.createHasher)(() => new SHA512_256());
2851
+ /**
2852
+ * SHA2-512/224 "truncated" hash function, with improved resistance to length extension attacks.
2853
+ * See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf).
2854
+ */
2855
+ exports.sha512_224 = (0, utils_ts_1.createHasher)(() => new SHA512_224());
2856
+ }));
2857
+ //#endregion
2858
+ //#region ../../node_modules/@noble/hashes/sha256.js
2859
+ var require_sha256 = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
2860
+ Object.defineProperty(exports, "__esModule", { value: true });
2861
+ exports.sha224 = exports.SHA224 = exports.sha256 = exports.SHA256 = void 0;
2862
+ /**
2863
+ * SHA2-256 a.k.a. sha256. In JS, it is the fastest hash, even faster than Blake3.
2864
+ *
2865
+ * To break sha256 using birthday attack, attackers need to try 2^128 hashes.
2866
+ * BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
2867
+ *
2868
+ * Check out [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
2869
+ * @module
2870
+ * @deprecated
2871
+ */
2872
+ const sha2_ts_1 = require_sha2();
2873
+ /** @deprecated Use import from `noble/hashes/sha2` module */
2874
+ exports.SHA256 = sha2_ts_1.SHA256;
2875
+ /** @deprecated Use import from `noble/hashes/sha2` module */
2876
+ exports.sha256 = sha2_ts_1.sha256;
2877
+ /** @deprecated Use import from `noble/hashes/sha2` module */
2878
+ exports.SHA224 = sha2_ts_1.SHA224;
2879
+ /** @deprecated Use import from `noble/hashes/sha2` module */
2880
+ exports.sha224 = sha2_ts_1.sha224;
2881
+ }));
2882
+ //#endregion
2883
+ //#region ../../node_modules/bs58/node_modules/base-x/src/index.js
2884
+ var require_src = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
2885
+ function base(ALPHABET) {
2886
+ if (ALPHABET.length >= 255) throw new TypeError("Alphabet too long");
2887
+ var BASE_MAP = new Uint8Array(256);
2888
+ for (var j = 0; j < BASE_MAP.length; j++) BASE_MAP[j] = 255;
2889
+ for (var i = 0; i < ALPHABET.length; i++) {
2890
+ var x = ALPHABET.charAt(i);
2891
+ var xc = x.charCodeAt(0);
2892
+ if (BASE_MAP[xc] !== 255) throw new TypeError(x + " is ambiguous");
2893
+ BASE_MAP[xc] = i;
2894
+ }
2895
+ var BASE = ALPHABET.length;
2896
+ var LEADER = ALPHABET.charAt(0);
2897
+ var FACTOR = Math.log(BASE) / Math.log(256);
2898
+ var iFACTOR = Math.log(256) / Math.log(BASE);
2899
+ function encode(source) {
2900
+ if (source instanceof Uint8Array) {} else if (ArrayBuffer.isView(source)) source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
2901
+ else if (Array.isArray(source)) source = Uint8Array.from(source);
2902
+ if (!(source instanceof Uint8Array)) throw new TypeError("Expected Uint8Array");
2903
+ if (source.length === 0) return "";
2904
+ var zeroes = 0;
2905
+ var length = 0;
2906
+ var pbegin = 0;
2907
+ var pend = source.length;
2908
+ while (pbegin !== pend && source[pbegin] === 0) {
2909
+ pbegin++;
2910
+ zeroes++;
2911
+ }
2912
+ var size = (pend - pbegin) * iFACTOR + 1 >>> 0;
2913
+ var b58 = new Uint8Array(size);
2914
+ while (pbegin !== pend) {
2915
+ var carry = source[pbegin];
2916
+ var i = 0;
2917
+ for (var it1 = size - 1; (carry !== 0 || i < length) && it1 !== -1; it1--, i++) {
2918
+ carry += 256 * b58[it1] >>> 0;
2919
+ b58[it1] = carry % BASE >>> 0;
2920
+ carry = carry / BASE >>> 0;
2921
+ }
2922
+ if (carry !== 0) throw new Error("Non-zero carry");
2923
+ length = i;
2924
+ pbegin++;
2925
+ }
2926
+ var it2 = size - length;
2927
+ while (it2 !== size && b58[it2] === 0) it2++;
2928
+ var str = LEADER.repeat(zeroes);
2929
+ for (; it2 < size; ++it2) str += ALPHABET.charAt(b58[it2]);
2930
+ return str;
2931
+ }
2932
+ function decodeUnsafe(source) {
2933
+ if (typeof source !== "string") throw new TypeError("Expected String");
2934
+ if (source.length === 0) return new Uint8Array();
2935
+ var psz = 0;
2936
+ var zeroes = 0;
2937
+ var length = 0;
2938
+ while (source[psz] === LEADER) {
2939
+ zeroes++;
2940
+ psz++;
2941
+ }
2942
+ var size = (source.length - psz) * FACTOR + 1 >>> 0;
2943
+ var b256 = new Uint8Array(size);
2944
+ while (source[psz]) {
2945
+ var charCode = source.charCodeAt(psz);
2946
+ if (charCode > 255) return;
2947
+ var carry = BASE_MAP[charCode];
2948
+ if (carry === 255) return;
2949
+ var i = 0;
2950
+ for (var it3 = size - 1; (carry !== 0 || i < length) && it3 !== -1; it3--, i++) {
2951
+ carry += BASE * b256[it3] >>> 0;
2952
+ b256[it3] = carry % 256 >>> 0;
2953
+ carry = carry / 256 >>> 0;
2954
+ }
2955
+ if (carry !== 0) throw new Error("Non-zero carry");
2956
+ length = i;
2957
+ psz++;
2958
+ }
2959
+ var it4 = size - length;
2960
+ while (it4 !== size && b256[it4] === 0) it4++;
2961
+ var vch = new Uint8Array(zeroes + (size - it4));
2962
+ var j = zeroes;
2963
+ while (it4 !== size) vch[j++] = b256[it4++];
2964
+ return vch;
2965
+ }
2966
+ function decode(string) {
2967
+ var buffer = decodeUnsafe(string);
2968
+ if (buffer) return buffer;
2969
+ throw new Error("Non-base" + BASE + " character");
2970
+ }
2971
+ return {
2972
+ encode,
2973
+ decodeUnsafe,
2974
+ decode
2975
+ };
2976
+ }
2977
+ module.exports = base;
2978
+ }));
2979
+ //#endregion
2980
+ //#region ../../node_modules/bs58/index.js
2981
+ var require_bs58 = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
2982
+ module.exports = require_src()("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
2983
+ }));
2984
+ //#endregion
2985
+ //#region ../../node_modules/bech32/dist/index.js
2986
+ var require_dist = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
2987
+ Object.defineProperty(exports, "__esModule", { value: true });
2988
+ exports.bech32m = exports.bech32 = void 0;
2989
+ const ALPHABET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
2990
+ const ALPHABET_MAP = {};
2991
+ for (let z = 0; z < 32; z++) {
2992
+ const x = ALPHABET.charAt(z);
2993
+ ALPHABET_MAP[x] = z;
2994
+ }
2995
+ function polymodStep(pre) {
2996
+ const b = pre >> 25;
2997
+ return (pre & 33554431) << 5 ^ -(b >> 0 & 1) & 996825010 ^ -(b >> 1 & 1) & 642813549 ^ -(b >> 2 & 1) & 513874426 ^ -(b >> 3 & 1) & 1027748829 ^ -(b >> 4 & 1) & 705979059;
2998
+ }
2999
+ function prefixChk(prefix) {
3000
+ let chk = 1;
3001
+ for (let i = 0; i < prefix.length; ++i) {
3002
+ const c = prefix.charCodeAt(i);
3003
+ if (c < 33 || c > 126) return "Invalid prefix (" + prefix + ")";
3004
+ chk = polymodStep(chk) ^ c >> 5;
3005
+ }
3006
+ chk = polymodStep(chk);
3007
+ for (let i = 0; i < prefix.length; ++i) {
3008
+ const v = prefix.charCodeAt(i);
3009
+ chk = polymodStep(chk) ^ v & 31;
3010
+ }
3011
+ return chk;
3012
+ }
3013
+ function convert(data, inBits, outBits, pad) {
3014
+ let value = 0;
3015
+ let bits = 0;
3016
+ const maxV = (1 << outBits) - 1;
3017
+ const result = [];
3018
+ for (let i = 0; i < data.length; ++i) {
3019
+ value = value << inBits | data[i];
3020
+ bits += inBits;
3021
+ while (bits >= outBits) {
3022
+ bits -= outBits;
3023
+ result.push(value >> bits & maxV);
3024
+ }
3025
+ }
3026
+ if (pad) {
3027
+ if (bits > 0) result.push(value << outBits - bits & maxV);
3028
+ } else {
3029
+ if (bits >= inBits) return "Excess padding";
3030
+ if (value << outBits - bits & maxV) return "Non-zero padding";
3031
+ }
3032
+ return result;
3033
+ }
3034
+ function toWords(bytes) {
3035
+ return convert(bytes, 8, 5, true);
3036
+ }
3037
+ function fromWordsUnsafe(words) {
3038
+ const res = convert(words, 5, 8, false);
3039
+ if (Array.isArray(res)) return res;
3040
+ }
3041
+ function fromWords(words) {
3042
+ const res = convert(words, 5, 8, false);
3043
+ if (Array.isArray(res)) return res;
3044
+ throw new Error(res);
3045
+ }
3046
+ function getLibraryFromEncoding(encoding) {
3047
+ let ENCODING_CONST;
3048
+ if (encoding === "bech32") ENCODING_CONST = 1;
3049
+ else ENCODING_CONST = 734539939;
3050
+ function encode(prefix, words, LIMIT) {
3051
+ LIMIT = LIMIT || 90;
3052
+ if (prefix.length + 7 + words.length > LIMIT) throw new TypeError("Exceeds length limit");
3053
+ prefix = prefix.toLowerCase();
3054
+ let chk = prefixChk(prefix);
3055
+ if (typeof chk === "string") throw new Error(chk);
3056
+ let result = prefix + "1";
3057
+ for (let i = 0; i < words.length; ++i) {
3058
+ const x = words[i];
3059
+ if (x >> 5 !== 0) throw new Error("Non 5-bit word");
3060
+ chk = polymodStep(chk) ^ x;
3061
+ result += ALPHABET.charAt(x);
3062
+ }
3063
+ for (let i = 0; i < 6; ++i) chk = polymodStep(chk);
3064
+ chk ^= ENCODING_CONST;
3065
+ for (let i = 0; i < 6; ++i) {
3066
+ const v = chk >> (5 - i) * 5 & 31;
3067
+ result += ALPHABET.charAt(v);
3068
+ }
3069
+ return result;
3070
+ }
3071
+ function __decode(str, LIMIT) {
3072
+ LIMIT = LIMIT || 90;
3073
+ if (str.length < 8) return str + " too short";
3074
+ if (str.length > LIMIT) return "Exceeds length limit";
3075
+ const lowered = str.toLowerCase();
3076
+ const uppered = str.toUpperCase();
3077
+ if (str !== lowered && str !== uppered) return "Mixed-case string " + str;
3078
+ str = lowered;
3079
+ const split = str.lastIndexOf("1");
3080
+ if (split === -1) return "No separator character for " + str;
3081
+ if (split === 0) return "Missing prefix for " + str;
3082
+ const prefix = str.slice(0, split);
3083
+ const wordChars = str.slice(split + 1);
3084
+ if (wordChars.length < 6) return "Data too short";
3085
+ let chk = prefixChk(prefix);
3086
+ if (typeof chk === "string") return chk;
3087
+ const words = [];
3088
+ for (let i = 0; i < wordChars.length; ++i) {
3089
+ const c = wordChars.charAt(i);
3090
+ const v = ALPHABET_MAP[c];
3091
+ if (v === void 0) return "Unknown character " + c;
3092
+ chk = polymodStep(chk) ^ v;
3093
+ if (i + 6 >= wordChars.length) continue;
3094
+ words.push(v);
3095
+ }
3096
+ if (chk !== ENCODING_CONST) return "Invalid checksum for " + str;
3097
+ return {
3098
+ prefix,
3099
+ words
3100
+ };
3101
+ }
3102
+ function decodeUnsafe(str, LIMIT) {
3103
+ const res = __decode(str, LIMIT);
3104
+ if (typeof res === "object") return res;
3105
+ }
3106
+ function decode(str, LIMIT) {
3107
+ const res = __decode(str, LIMIT);
3108
+ if (typeof res === "object") return res;
3109
+ throw new Error(res);
3110
+ }
3111
+ return {
3112
+ decodeUnsafe,
3113
+ decode,
3114
+ encode,
3115
+ toWords,
3116
+ fromWordsUnsafe,
3117
+ fromWords
3118
+ };
3119
+ }
3120
+ exports.bech32 = getLibraryFromEncoding("bech32");
3121
+ exports.bech32m = getLibraryFromEncoding("bech32m");
3122
+ }));
3123
+ //#endregion
3124
+ //#region ../../node_modules/@noble/hashes/hmac.js
3125
+ var require_hmac = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
3126
+ Object.defineProperty(exports, "__esModule", { value: true });
3127
+ exports.hmac = exports.HMAC = void 0;
3128
+ /**
3129
+ * HMAC: RFC2104 message authentication code.
3130
+ * @module
3131
+ */
3132
+ const utils_ts_1 = require_utils();
3133
+ var HMAC = class extends utils_ts_1.Hash {
3134
+ constructor(hash, _key) {
3135
+ super();
3136
+ this.finished = false;
3137
+ this.destroyed = false;
3138
+ (0, utils_ts_1.ahash)(hash);
3139
+ const key = (0, utils_ts_1.toBytes)(_key);
3140
+ this.iHash = hash.create();
3141
+ if (typeof this.iHash.update !== "function") throw new Error("Expected instance of class which extends utils.Hash");
3142
+ this.blockLen = this.iHash.blockLen;
3143
+ this.outputLen = this.iHash.outputLen;
3144
+ const blockLen = this.blockLen;
3145
+ const pad = new Uint8Array(blockLen);
3146
+ pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
3147
+ for (let i = 0; i < pad.length; i++) pad[i] ^= 54;
3148
+ this.iHash.update(pad);
3149
+ this.oHash = hash.create();
3150
+ for (let i = 0; i < pad.length; i++) pad[i] ^= 106;
3151
+ this.oHash.update(pad);
3152
+ (0, utils_ts_1.clean)(pad);
3153
+ }
3154
+ update(buf) {
3155
+ (0, utils_ts_1.aexists)(this);
3156
+ this.iHash.update(buf);
3157
+ return this;
3158
+ }
3159
+ digestInto(out) {
3160
+ (0, utils_ts_1.aexists)(this);
3161
+ (0, utils_ts_1.abytes)(out, this.outputLen);
3162
+ this.finished = true;
3163
+ this.iHash.digestInto(out);
3164
+ this.oHash.update(out);
3165
+ this.oHash.digestInto(out);
3166
+ this.destroy();
3167
+ }
3168
+ digest() {
3169
+ const out = new Uint8Array(this.oHash.outputLen);
3170
+ this.digestInto(out);
3171
+ return out;
3172
+ }
3173
+ _cloneInto(to) {
3174
+ to || (to = Object.create(Object.getPrototypeOf(this), {}));
3175
+ const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
3176
+ to = to;
3177
+ to.finished = finished;
3178
+ to.destroyed = destroyed;
3179
+ to.blockLen = blockLen;
3180
+ to.outputLen = outputLen;
3181
+ to.oHash = oHash._cloneInto(to.oHash);
3182
+ to.iHash = iHash._cloneInto(to.iHash);
3183
+ return to;
3184
+ }
3185
+ clone() {
3186
+ return this._cloneInto();
3187
+ }
3188
+ destroy() {
3189
+ this.destroyed = true;
3190
+ this.oHash.destroy();
3191
+ this.iHash.destroy();
3192
+ }
3193
+ };
3194
+ exports.HMAC = HMAC;
3195
+ /**
3196
+ * HMAC: RFC2104 message authentication code.
3197
+ * @param hash - function that would be used e.g. sha256
3198
+ * @param key - message key
3199
+ * @param message - message data
3200
+ * @example
3201
+ * import { hmac } from '@noble/hashes/hmac';
3202
+ * import { sha256 } from '@noble/hashes/sha2';
3203
+ * const mac1 = hmac(sha256, 'key', 'message');
3204
+ */
3205
+ const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();
3206
+ exports.hmac = hmac;
3207
+ exports.hmac.create = (hash, key) => new HMAC(hash, key);
3208
+ }));
3209
+ //#endregion
3210
+ //#region ../../node_modules/@noble/hashes/esm/hmac.js
3211
+ /**
3212
+ * HMAC: RFC2104 message authentication code.
3213
+ * @module
3214
+ */
3215
+ var HMAC = class extends Hash {
3216
+ constructor(hash, _key) {
3217
+ super();
3218
+ this.finished = false;
3219
+ this.destroyed = false;
3220
+ ahash(hash);
3221
+ const key = toBytes(_key);
3222
+ this.iHash = hash.create();
3223
+ if (typeof this.iHash.update !== "function") throw new Error("Expected instance of class which extends utils.Hash");
3224
+ this.blockLen = this.iHash.blockLen;
3225
+ this.outputLen = this.iHash.outputLen;
3226
+ const blockLen = this.blockLen;
3227
+ const pad = new Uint8Array(blockLen);
3228
+ pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
3229
+ for (let i = 0; i < pad.length; i++) pad[i] ^= 54;
3230
+ this.iHash.update(pad);
3231
+ this.oHash = hash.create();
3232
+ for (let i = 0; i < pad.length; i++) pad[i] ^= 106;
3233
+ this.oHash.update(pad);
3234
+ clean(pad);
3235
+ }
3236
+ update(buf) {
3237
+ aexists(this);
3238
+ this.iHash.update(buf);
3239
+ return this;
3240
+ }
3241
+ digestInto(out) {
3242
+ aexists(this);
3243
+ abytes(out, this.outputLen);
3244
+ this.finished = true;
3245
+ this.iHash.digestInto(out);
3246
+ this.oHash.update(out);
3247
+ this.oHash.digestInto(out);
3248
+ this.destroy();
3249
+ }
3250
+ digest() {
3251
+ const out = new Uint8Array(this.oHash.outputLen);
3252
+ this.digestInto(out);
3253
+ return out;
3254
+ }
3255
+ _cloneInto(to) {
3256
+ to || (to = Object.create(Object.getPrototypeOf(this), {}));
3257
+ const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
3258
+ to = to;
3259
+ to.finished = finished;
3260
+ to.destroyed = destroyed;
3261
+ to.blockLen = blockLen;
3262
+ to.outputLen = outputLen;
3263
+ to.oHash = oHash._cloneInto(to.oHash);
3264
+ to.iHash = iHash._cloneInto(to.iHash);
3265
+ return to;
3266
+ }
3267
+ clone() {
3268
+ return this._cloneInto();
3269
+ }
3270
+ destroy() {
3271
+ this.destroyed = true;
3272
+ this.oHash.destroy();
3273
+ this.iHash.destroy();
3274
+ }
3275
+ };
3276
+ /**
3277
+ * HMAC: RFC2104 message authentication code.
3278
+ * @param hash - function that would be used e.g. sha256
3279
+ * @param key - message key
3280
+ * @param message - message data
3281
+ * @example
3282
+ * import { hmac } from '@noble/hashes/hmac';
3283
+ * import { sha256 } from '@noble/hashes/sha2';
3284
+ * const mac1 = hmac(sha256, 'key', 'message');
3285
+ */
3286
+ const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();
3287
+ hmac.create = (hash, key) => new HMAC(hash, key);
3288
+ //#endregion
3289
+ //#region ../../node_modules/@noble/hashes/esm/hkdf.js
3290
+ /**
3291
+ * HKDF (RFC 5869): extract + expand in one step.
3292
+ * See https://soatok.blog/2021/11/17/understanding-hkdf/.
3293
+ * @module
3294
+ */
3295
+ /**
3296
+ * HKDF-extract from spec. Less important part. `HKDF-Extract(IKM, salt) -> PRK`
3297
+ * Arguments position differs from spec (IKM is first one, since it is not optional)
3298
+ * @param hash - hash function that would be used (e.g. sha256)
3299
+ * @param ikm - input keying material, the initial key
3300
+ * @param salt - optional salt value (a non-secret random value)
3301
+ */
3302
+ function extract(hash, ikm, salt) {
3303
+ ahash(hash);
3304
+ if (salt === void 0) salt = new Uint8Array(hash.outputLen);
3305
+ return hmac(hash, toBytes(salt), toBytes(ikm));
3306
+ }
3307
+ const HKDF_COUNTER = /* @__PURE__ */ Uint8Array.from([0]);
3308
+ const EMPTY_BUFFER = /* @__PURE__ */ Uint8Array.of();
3309
+ /**
3310
+ * HKDF-expand from the spec. The most important part. `HKDF-Expand(PRK, info, L) -> OKM`
3311
+ * @param hash - hash function that would be used (e.g. sha256)
3312
+ * @param prk - a pseudorandom key of at least HashLen octets (usually, the output from the extract step)
3313
+ * @param info - optional context and application specific information (can be a zero-length string)
3314
+ * @param length - length of output keying material in bytes
3315
+ */
3316
+ function expand(hash, prk, info, length = 32) {
3317
+ ahash(hash);
3318
+ anumber(length);
3319
+ const olen = hash.outputLen;
3320
+ if (length > 255 * olen) throw new Error("Length should be <= 255*HashLen");
3321
+ const blocks = Math.ceil(length / olen);
3322
+ if (info === void 0) info = EMPTY_BUFFER;
3323
+ const okm = new Uint8Array(blocks * olen);
3324
+ const HMAC = hmac.create(hash, prk);
3325
+ const HMACTmp = HMAC._cloneInto();
3326
+ const T = new Uint8Array(HMAC.outputLen);
3327
+ for (let counter = 0; counter < blocks; counter++) {
3328
+ HKDF_COUNTER[0] = counter + 1;
3329
+ HMACTmp.update(counter === 0 ? EMPTY_BUFFER : T).update(info).update(HKDF_COUNTER).digestInto(T);
3330
+ okm.set(T, olen * counter);
3331
+ HMAC._cloneInto(HMACTmp);
3332
+ }
3333
+ HMAC.destroy();
3334
+ HMACTmp.destroy();
3335
+ clean(T, HKDF_COUNTER);
3336
+ return okm.slice(0, length);
3337
+ }
3338
+ /**
3339
+ * HKDF (RFC 5869): derive keys from an initial input.
3340
+ * Combines hkdf_extract + hkdf_expand in one step
3341
+ * @param hash - hash function that would be used (e.g. sha256)
3342
+ * @param ikm - input keying material, the initial key
3343
+ * @param salt - optional salt value (a non-secret random value)
3344
+ * @param info - optional context and application specific information (can be a zero-length string)
3345
+ * @param length - length of output keying material in bytes
3346
+ * @example
3347
+ * import { hkdf } from '@noble/hashes/hkdf';
3348
+ * import { sha256 } from '@noble/hashes/sha2';
3349
+ * import { randomBytes } from '@noble/hashes/utils';
3350
+ * const inputKey = randomBytes(32);
3351
+ * const salt = randomBytes(32);
3352
+ * const info = 'application-key';
3353
+ * const hk1 = hkdf(sha256, inputKey, salt, info, 32);
3354
+ */
3355
+ const hkdf = (hash, ikm, salt, info, length) => expand(hash, extract(hash, ikm, salt), info, length);
3356
+ //#endregion
3357
+ //#region ../../node_modules/@noble/hashes/esm/sha2.js
3358
+ /**
3359
+ * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.
3360
+ * SHA256 is the fastest hash implementable in JS, even faster than Blake3.
3361
+ * Check out [RFC 4634](https://datatracker.ietf.org/doc/html/rfc4634) and
3362
+ * [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
3363
+ * @module
3364
+ */
3365
+ /**
3366
+ * Round constants:
3367
+ * First 32 bits of fractional parts of the cube roots of the first 64 primes 2..311)
3368
+ */
3369
+ const SHA256_K = /* @__PURE__ */ Uint32Array.from([
3370
+ 1116352408,
3371
+ 1899447441,
3372
+ 3049323471,
3373
+ 3921009573,
3374
+ 961987163,
3375
+ 1508970993,
3376
+ 2453635748,
3377
+ 2870763221,
3378
+ 3624381080,
3379
+ 310598401,
3380
+ 607225278,
3381
+ 1426881987,
3382
+ 1925078388,
3383
+ 2162078206,
3384
+ 2614888103,
3385
+ 3248222580,
3386
+ 3835390401,
3387
+ 4022224774,
3388
+ 264347078,
3389
+ 604807628,
3390
+ 770255983,
3391
+ 1249150122,
3392
+ 1555081692,
3393
+ 1996064986,
3394
+ 2554220882,
3395
+ 2821834349,
3396
+ 2952996808,
3397
+ 3210313671,
3398
+ 3336571891,
3399
+ 3584528711,
3400
+ 113926993,
3401
+ 338241895,
3402
+ 666307205,
3403
+ 773529912,
3404
+ 1294757372,
3405
+ 1396182291,
3406
+ 1695183700,
3407
+ 1986661051,
3408
+ 2177026350,
3409
+ 2456956037,
3410
+ 2730485921,
3411
+ 2820302411,
3412
+ 3259730800,
3413
+ 3345764771,
3414
+ 3516065817,
3415
+ 3600352804,
3416
+ 4094571909,
3417
+ 275423344,
3418
+ 430227734,
3419
+ 506948616,
3420
+ 659060556,
3421
+ 883997877,
3422
+ 958139571,
3423
+ 1322822218,
3424
+ 1537002063,
3425
+ 1747873779,
3426
+ 1955562222,
3427
+ 2024104815,
3428
+ 2227730452,
3429
+ 2361852424,
3430
+ 2428436474,
3431
+ 2756734187,
3432
+ 3204031479,
3433
+ 3329325298
3434
+ ]);
3435
+ /** Reusable temporary buffer. "W" comes straight from spec. */
3436
+ const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
3437
+ var SHA256 = class extends HashMD {
3438
+ constructor(outputLen = 32) {
3439
+ super(64, outputLen, 8, false);
3440
+ this.A = SHA256_IV[0] | 0;
3441
+ this.B = SHA256_IV[1] | 0;
3442
+ this.C = SHA256_IV[2] | 0;
3443
+ this.D = SHA256_IV[3] | 0;
3444
+ this.E = SHA256_IV[4] | 0;
3445
+ this.F = SHA256_IV[5] | 0;
3446
+ this.G = SHA256_IV[6] | 0;
3447
+ this.H = SHA256_IV[7] | 0;
3448
+ }
3449
+ get() {
3450
+ const { A, B, C, D, E, F, G, H } = this;
3451
+ return [
3452
+ A,
3453
+ B,
3454
+ C,
3455
+ D,
3456
+ E,
3457
+ F,
3458
+ G,
3459
+ H
3460
+ ];
3461
+ }
3462
+ set(A, B, C, D, E, F, G, H) {
3463
+ this.A = A | 0;
3464
+ this.B = B | 0;
3465
+ this.C = C | 0;
3466
+ this.D = D | 0;
3467
+ this.E = E | 0;
3468
+ this.F = F | 0;
3469
+ this.G = G | 0;
3470
+ this.H = H | 0;
3471
+ }
3472
+ process(view, offset) {
3473
+ for (let i = 0; i < 16; i++, offset += 4) SHA256_W[i] = view.getUint32(offset, false);
3474
+ for (let i = 16; i < 64; i++) {
3475
+ const W15 = SHA256_W[i - 15];
3476
+ const W2 = SHA256_W[i - 2];
3477
+ const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3;
3478
+ SHA256_W[i] = (rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10) + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
3479
+ }
3480
+ let { A, B, C, D, E, F, G, H } = this;
3481
+ for (let i = 0; i < 64; i++) {
3482
+ const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
3483
+ const T1 = H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
3484
+ const T2 = (rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22)) + Maj(A, B, C) | 0;
3485
+ H = G;
3486
+ G = F;
3487
+ F = E;
3488
+ E = D + T1 | 0;
3489
+ D = C;
3490
+ C = B;
3491
+ B = A;
3492
+ A = T1 + T2 | 0;
3493
+ }
3494
+ A = A + this.A | 0;
3495
+ B = B + this.B | 0;
3496
+ C = C + this.C | 0;
3497
+ D = D + this.D | 0;
3498
+ E = E + this.E | 0;
3499
+ F = F + this.F | 0;
3500
+ G = G + this.G | 0;
3501
+ H = H + this.H | 0;
3502
+ this.set(A, B, C, D, E, F, G, H);
3503
+ }
3504
+ roundClean() {
3505
+ clean(SHA256_W);
3506
+ }
3507
+ destroy() {
3508
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
3509
+ clean(this.buffer);
3510
+ }
3511
+ };
3512
+ const K512 = split([
3513
+ "0x428a2f98d728ae22",
3514
+ "0x7137449123ef65cd",
3515
+ "0xb5c0fbcfec4d3b2f",
3516
+ "0xe9b5dba58189dbbc",
3517
+ "0x3956c25bf348b538",
3518
+ "0x59f111f1b605d019",
3519
+ "0x923f82a4af194f9b",
3520
+ "0xab1c5ed5da6d8118",
3521
+ "0xd807aa98a3030242",
3522
+ "0x12835b0145706fbe",
3523
+ "0x243185be4ee4b28c",
3524
+ "0x550c7dc3d5ffb4e2",
3525
+ "0x72be5d74f27b896f",
3526
+ "0x80deb1fe3b1696b1",
3527
+ "0x9bdc06a725c71235",
3528
+ "0xc19bf174cf692694",
3529
+ "0xe49b69c19ef14ad2",
3530
+ "0xefbe4786384f25e3",
3531
+ "0x0fc19dc68b8cd5b5",
3532
+ "0x240ca1cc77ac9c65",
3533
+ "0x2de92c6f592b0275",
3534
+ "0x4a7484aa6ea6e483",
3535
+ "0x5cb0a9dcbd41fbd4",
3536
+ "0x76f988da831153b5",
3537
+ "0x983e5152ee66dfab",
3538
+ "0xa831c66d2db43210",
3539
+ "0xb00327c898fb213f",
3540
+ "0xbf597fc7beef0ee4",
3541
+ "0xc6e00bf33da88fc2",
3542
+ "0xd5a79147930aa725",
3543
+ "0x06ca6351e003826f",
3544
+ "0x142929670a0e6e70",
3545
+ "0x27b70a8546d22ffc",
3546
+ "0x2e1b21385c26c926",
3547
+ "0x4d2c6dfc5ac42aed",
3548
+ "0x53380d139d95b3df",
3549
+ "0x650a73548baf63de",
3550
+ "0x766a0abb3c77b2a8",
3551
+ "0x81c2c92e47edaee6",
3552
+ "0x92722c851482353b",
3553
+ "0xa2bfe8a14cf10364",
3554
+ "0xa81a664bbc423001",
3555
+ "0xc24b8b70d0f89791",
3556
+ "0xc76c51a30654be30",
3557
+ "0xd192e819d6ef5218",
3558
+ "0xd69906245565a910",
3559
+ "0xf40e35855771202a",
3560
+ "0x106aa07032bbd1b8",
3561
+ "0x19a4c116b8d2d0c8",
3562
+ "0x1e376c085141ab53",
3563
+ "0x2748774cdf8eeb99",
3564
+ "0x34b0bcb5e19b48a8",
3565
+ "0x391c0cb3c5c95a63",
3566
+ "0x4ed8aa4ae3418acb",
3567
+ "0x5b9cca4f7763e373",
3568
+ "0x682e6ff3d6b2b8a3",
3569
+ "0x748f82ee5defb2fc",
3570
+ "0x78a5636f43172f60",
3571
+ "0x84c87814a1f0ab72",
3572
+ "0x8cc702081a6439ec",
3573
+ "0x90befffa23631e28",
3574
+ "0xa4506cebde82bde9",
3575
+ "0xbef9a3f7b2c67915",
3576
+ "0xc67178f2e372532b",
3577
+ "0xca273eceea26619c",
3578
+ "0xd186b8c721c0c207",
3579
+ "0xeada7dd6cde0eb1e",
3580
+ "0xf57d4f7fee6ed178",
3581
+ "0x06f067aa72176fba",
3582
+ "0x0a637dc5a2c898a6",
3583
+ "0x113f9804bef90dae",
3584
+ "0x1b710b35131c471b",
3585
+ "0x28db77f523047d84",
3586
+ "0x32caab7b40c72493",
3587
+ "0x3c9ebe0a15c9bebc",
3588
+ "0x431d67c49c100d4c",
3589
+ "0x4cc5d4becb3e42b6",
3590
+ "0x597f299cfc657e2a",
3591
+ "0x5fcb6fab3ad6faec",
3592
+ "0x6c44198c4a475817"
3593
+ ].map((n) => BigInt(n)));
3594
+ const SHA512_Kh = K512[0];
3595
+ const SHA512_Kl = K512[1];
3596
+ const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);
3597
+ const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);
3598
+ var SHA512 = class extends HashMD {
3599
+ constructor(outputLen = 64) {
3600
+ super(128, outputLen, 16, false);
3601
+ this.Ah = SHA512_IV[0] | 0;
3602
+ this.Al = SHA512_IV[1] | 0;
3603
+ this.Bh = SHA512_IV[2] | 0;
3604
+ this.Bl = SHA512_IV[3] | 0;
3605
+ this.Ch = SHA512_IV[4] | 0;
3606
+ this.Cl = SHA512_IV[5] | 0;
3607
+ this.Dh = SHA512_IV[6] | 0;
3608
+ this.Dl = SHA512_IV[7] | 0;
3609
+ this.Eh = SHA512_IV[8] | 0;
3610
+ this.El = SHA512_IV[9] | 0;
3611
+ this.Fh = SHA512_IV[10] | 0;
3612
+ this.Fl = SHA512_IV[11] | 0;
3613
+ this.Gh = SHA512_IV[12] | 0;
3614
+ this.Gl = SHA512_IV[13] | 0;
3615
+ this.Hh = SHA512_IV[14] | 0;
3616
+ this.Hl = SHA512_IV[15] | 0;
3617
+ }
3618
+ get() {
3619
+ const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
3620
+ return [
3621
+ Ah,
3622
+ Al,
3623
+ Bh,
3624
+ Bl,
3625
+ Ch,
3626
+ Cl,
3627
+ Dh,
3628
+ Dl,
3629
+ Eh,
3630
+ El,
3631
+ Fh,
3632
+ Fl,
3633
+ Gh,
3634
+ Gl,
3635
+ Hh,
3636
+ Hl
3637
+ ];
3638
+ }
3639
+ set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {
3640
+ this.Ah = Ah | 0;
3641
+ this.Al = Al | 0;
3642
+ this.Bh = Bh | 0;
3643
+ this.Bl = Bl | 0;
3644
+ this.Ch = Ch | 0;
3645
+ this.Cl = Cl | 0;
3646
+ this.Dh = Dh | 0;
3647
+ this.Dl = Dl | 0;
3648
+ this.Eh = Eh | 0;
3649
+ this.El = El | 0;
3650
+ this.Fh = Fh | 0;
3651
+ this.Fl = Fl | 0;
3652
+ this.Gh = Gh | 0;
3653
+ this.Gl = Gl | 0;
3654
+ this.Hh = Hh | 0;
3655
+ this.Hl = Hl | 0;
3656
+ }
3657
+ process(view, offset) {
3658
+ for (let i = 0; i < 16; i++, offset += 4) {
3659
+ SHA512_W_H[i] = view.getUint32(offset);
3660
+ SHA512_W_L[i] = view.getUint32(offset += 4);
3661
+ }
3662
+ for (let i = 16; i < 80; i++) {
3663
+ const W15h = SHA512_W_H[i - 15] | 0;
3664
+ const W15l = SHA512_W_L[i - 15] | 0;
3665
+ const s0h = rotrSH(W15h, W15l, 1) ^ rotrSH(W15h, W15l, 8) ^ shrSH(W15h, W15l, 7);
3666
+ const s0l = rotrSL(W15h, W15l, 1) ^ rotrSL(W15h, W15l, 8) ^ shrSL(W15h, W15l, 7);
3667
+ const W2h = SHA512_W_H[i - 2] | 0;
3668
+ const W2l = SHA512_W_L[i - 2] | 0;
3669
+ const s1h = rotrSH(W2h, W2l, 19) ^ rotrBH(W2h, W2l, 61) ^ shrSH(W2h, W2l, 6);
3670
+ const SUMl = add4L(s0l, rotrSL(W2h, W2l, 19) ^ rotrBL(W2h, W2l, 61) ^ shrSL(W2h, W2l, 6), SHA512_W_L[i - 7], SHA512_W_L[i - 16]);
3671
+ SHA512_W_H[i] = add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]) | 0;
3672
+ SHA512_W_L[i] = SUMl | 0;
3673
+ }
3674
+ let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
3675
+ for (let i = 0; i < 80; i++) {
3676
+ const sigma1h = rotrSH(Eh, El, 14) ^ rotrSH(Eh, El, 18) ^ rotrBH(Eh, El, 41);
3677
+ const sigma1l = rotrSL(Eh, El, 14) ^ rotrSL(Eh, El, 18) ^ rotrBL(Eh, El, 41);
3678
+ const CHIh = Eh & Fh ^ ~Eh & Gh;
3679
+ const CHIl = El & Fl ^ ~El & Gl;
3680
+ const T1ll = add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);
3681
+ const T1h = add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);
3682
+ const T1l = T1ll | 0;
3683
+ const sigma0h = rotrSH(Ah, Al, 28) ^ rotrBH(Ah, Al, 34) ^ rotrBH(Ah, Al, 39);
3684
+ const sigma0l = rotrSL(Ah, Al, 28) ^ rotrBL(Ah, Al, 34) ^ rotrBL(Ah, Al, 39);
3685
+ const MAJh = Ah & Bh ^ Ah & Ch ^ Bh & Ch;
3686
+ const MAJl = Al & Bl ^ Al & Cl ^ Bl & Cl;
3687
+ Hh = Gh | 0;
3688
+ Hl = Gl | 0;
3689
+ Gh = Fh | 0;
3690
+ Gl = Fl | 0;
3691
+ Fh = Eh | 0;
3692
+ Fl = El | 0;
3693
+ ({h: Eh, l: El} = add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
3694
+ Dh = Ch | 0;
3695
+ Dl = Cl | 0;
3696
+ Ch = Bh | 0;
3697
+ Cl = Bl | 0;
3698
+ Bh = Ah | 0;
3699
+ Bl = Al | 0;
3700
+ const All = add3L(T1l, sigma0l, MAJl);
3701
+ Ah = add3H(All, T1h, sigma0h, MAJh);
3702
+ Al = All | 0;
3703
+ }
3704
+ ({h: Ah, l: Al} = add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
3705
+ ({h: Bh, l: Bl} = add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
3706
+ ({h: Ch, l: Cl} = add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));
3707
+ ({h: Dh, l: Dl} = add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
3708
+ ({h: Eh, l: El} = add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
3709
+ ({h: Fh, l: Fl} = add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
3710
+ ({h: Gh, l: Gl} = add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
3711
+ ({h: Hh, l: Hl} = add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
3712
+ this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
3713
+ }
3714
+ roundClean() {
3715
+ clean(SHA512_W_H, SHA512_W_L);
3716
+ }
3717
+ destroy() {
3718
+ clean(this.buffer);
3719
+ this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
3720
+ }
3721
+ };
3722
+ /**
3723
+ * SHA2-256 hash function from RFC 4634.
3724
+ *
3725
+ * It is the fastest JS hash, even faster than Blake3.
3726
+ * To break sha256 using birthday attack, attackers need to try 2^128 hashes.
3727
+ * BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
3728
+ */
3729
+ const sha256 = /* @__PURE__ */ createHasher(() => new SHA256());
3730
+ /** SHA2-512 hash function from RFC 4634. */
3731
+ const sha512 = /* @__PURE__ */ createHasher(() => new SHA512());
3732
+ //#endregion
3733
+ //#region ../../node_modules/@noble/hashes/esm/pbkdf2.js
3734
+ /**
3735
+ * PBKDF (RFC 2898). Can be used to create a key from password and salt.
3736
+ * @module
3737
+ */
3738
+ function pbkdf2Init(hash, _password, _salt, _opts) {
3739
+ ahash(hash);
3740
+ const { c, dkLen, asyncTick } = checkOpts({
3741
+ dkLen: 32,
3742
+ asyncTick: 10
3743
+ }, _opts);
3744
+ anumber(c);
3745
+ anumber(dkLen);
3746
+ anumber(asyncTick);
3747
+ if (c < 1) throw new Error("iterations (c) should be >= 1");
3748
+ const password = kdfInputToBytes(_password);
3749
+ const salt = kdfInputToBytes(_salt);
3750
+ const DK = new Uint8Array(dkLen);
3751
+ const PRF = hmac.create(hash, password);
3752
+ return {
3753
+ c,
3754
+ dkLen,
3755
+ asyncTick,
3756
+ DK,
3757
+ PRF,
3758
+ PRFSalt: PRF._cloneInto().update(salt)
3759
+ };
3760
+ }
3761
+ function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) {
3762
+ PRF.destroy();
3763
+ PRFSalt.destroy();
3764
+ if (prfW) prfW.destroy();
3765
+ clean(u);
3766
+ return DK;
3767
+ }
3768
+ /**
3769
+ * PBKDF2-HMAC: RFC 2898 key derivation function
3770
+ * @param hash - hash function that would be used e.g. sha256
3771
+ * @param password - password from which a derived key is generated
3772
+ * @param salt - cryptographic salt
3773
+ * @param opts - {c, dkLen} where c is work factor and dkLen is output message size
3774
+ * @example
3775
+ * const key = pbkdf2(sha256, 'password', 'salt', { dkLen: 32, c: Math.pow(2, 18) });
3776
+ */
3777
+ function pbkdf2(hash, password, salt, opts) {
3778
+ const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);
3779
+ let prfW;
3780
+ const arr = new Uint8Array(4);
3781
+ const view = createView(arr);
3782
+ const u = new Uint8Array(PRF.outputLen);
3783
+ for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {
3784
+ const Ti = DK.subarray(pos, pos + PRF.outputLen);
3785
+ view.setInt32(0, ti, false);
3786
+ (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);
3787
+ Ti.set(u.subarray(0, Ti.length));
3788
+ for (let ui = 1; ui < c; ui++) {
3789
+ PRF._cloneInto(prfW).update(u).digestInto(u);
3790
+ for (let i = 0; i < Ti.length; i++) Ti[i] ^= u[i];
3791
+ }
3792
+ }
3793
+ return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);
3794
+ }
3795
+ //#endregion
3796
+ //#region ../../node_modules/@noble/hashes/sha512.js
3797
+ var require_sha512 = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
3798
+ Object.defineProperty(exports, "__esModule", { value: true });
3799
+ exports.sha512_256 = exports.SHA512_256 = exports.sha512_224 = exports.SHA512_224 = exports.sha384 = exports.SHA384 = exports.sha512 = exports.SHA512 = void 0;
3800
+ /**
3801
+ * SHA2-512 a.k.a. sha512 and sha384. It is slower than sha256 in js because u64 operations are slow.
3802
+ *
3803
+ * Check out [RFC 4634](https://datatracker.ietf.org/doc/html/rfc4634) and
3804
+ * [the paper on truncated SHA512/256](https://eprint.iacr.org/2010/548.pdf).
3805
+ * @module
3806
+ * @deprecated
3807
+ */
3808
+ const sha2_ts_1 = require_sha2();
3809
+ /** @deprecated Use import from `noble/hashes/sha2` module */
3810
+ exports.SHA512 = sha2_ts_1.SHA512;
3811
+ /** @deprecated Use import from `noble/hashes/sha2` module */
3812
+ exports.sha512 = sha2_ts_1.sha512;
3813
+ /** @deprecated Use import from `noble/hashes/sha2` module */
3814
+ exports.SHA384 = sha2_ts_1.SHA384;
3815
+ /** @deprecated Use import from `noble/hashes/sha2` module */
3816
+ exports.sha384 = sha2_ts_1.sha384;
3817
+ /** @deprecated Use import from `noble/hashes/sha2` module */
3818
+ exports.SHA512_224 = sha2_ts_1.SHA512_224;
3819
+ /** @deprecated Use import from `noble/hashes/sha2` module */
3820
+ exports.sha512_224 = sha2_ts_1.sha512_224;
3821
+ /** @deprecated Use import from `noble/hashes/sha2` module */
3822
+ exports.SHA512_256 = sha2_ts_1.SHA512_256;
3823
+ /** @deprecated Use import from `noble/hashes/sha2` module */
3824
+ exports.sha512_256 = sha2_ts_1.sha512_256;
3825
+ }));
3826
+ //#endregion
3827
+ //#region ../../node_modules/@noble/hashes/pbkdf2.js
3828
+ var require_pbkdf2 = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
3829
+ Object.defineProperty(exports, "__esModule", { value: true });
3830
+ exports.pbkdf2 = pbkdf2;
3831
+ exports.pbkdf2Async = pbkdf2Async;
3832
+ /**
3833
+ * PBKDF (RFC 2898). Can be used to create a key from password and salt.
3834
+ * @module
3835
+ */
3836
+ const hmac_ts_1 = require_hmac();
3837
+ const utils_ts_1 = require_utils();
3838
+ function pbkdf2Init(hash, _password, _salt, _opts) {
3839
+ (0, utils_ts_1.ahash)(hash);
3840
+ const { c, dkLen, asyncTick } = (0, utils_ts_1.checkOpts)({
3841
+ dkLen: 32,
3842
+ asyncTick: 10
3843
+ }, _opts);
3844
+ (0, utils_ts_1.anumber)(c);
3845
+ (0, utils_ts_1.anumber)(dkLen);
3846
+ (0, utils_ts_1.anumber)(asyncTick);
3847
+ if (c < 1) throw new Error("iterations (c) should be >= 1");
3848
+ const password = (0, utils_ts_1.kdfInputToBytes)(_password);
3849
+ const salt = (0, utils_ts_1.kdfInputToBytes)(_salt);
3850
+ const DK = new Uint8Array(dkLen);
3851
+ const PRF = hmac_ts_1.hmac.create(hash, password);
3852
+ return {
3853
+ c,
3854
+ dkLen,
3855
+ asyncTick,
3856
+ DK,
3857
+ PRF,
3858
+ PRFSalt: PRF._cloneInto().update(salt)
3859
+ };
3860
+ }
3861
+ function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) {
3862
+ PRF.destroy();
3863
+ PRFSalt.destroy();
3864
+ if (prfW) prfW.destroy();
3865
+ (0, utils_ts_1.clean)(u);
3866
+ return DK;
3867
+ }
3868
+ /**
3869
+ * PBKDF2-HMAC: RFC 2898 key derivation function
3870
+ * @param hash - hash function that would be used e.g. sha256
3871
+ * @param password - password from which a derived key is generated
3872
+ * @param salt - cryptographic salt
3873
+ * @param opts - {c, dkLen} where c is work factor and dkLen is output message size
3874
+ * @example
3875
+ * const key = pbkdf2(sha256, 'password', 'salt', { dkLen: 32, c: Math.pow(2, 18) });
3876
+ */
3877
+ function pbkdf2(hash, password, salt, opts) {
3878
+ const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);
3879
+ let prfW;
3880
+ const arr = new Uint8Array(4);
3881
+ const view = (0, utils_ts_1.createView)(arr);
3882
+ const u = new Uint8Array(PRF.outputLen);
3883
+ for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {
3884
+ const Ti = DK.subarray(pos, pos + PRF.outputLen);
3885
+ view.setInt32(0, ti, false);
3886
+ (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);
3887
+ Ti.set(u.subarray(0, Ti.length));
3888
+ for (let ui = 1; ui < c; ui++) {
3889
+ PRF._cloneInto(prfW).update(u).digestInto(u);
3890
+ for (let i = 0; i < Ti.length; i++) Ti[i] ^= u[i];
3891
+ }
3892
+ }
3893
+ return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);
3894
+ }
3895
+ /**
3896
+ * PBKDF2-HMAC: RFC 2898 key derivation function. Async version.
3897
+ * @example
3898
+ * await pbkdf2Async(sha256, 'password', 'salt', { dkLen: 32, c: 500_000 });
3899
+ */
3900
+ async function pbkdf2Async(hash, password, salt, opts) {
3901
+ const { c, dkLen, asyncTick, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);
3902
+ let prfW;
3903
+ const arr = new Uint8Array(4);
3904
+ const view = (0, utils_ts_1.createView)(arr);
3905
+ const u = new Uint8Array(PRF.outputLen);
3906
+ for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {
3907
+ const Ti = DK.subarray(pos, pos + PRF.outputLen);
3908
+ view.setInt32(0, ti, false);
3909
+ (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);
3910
+ Ti.set(u.subarray(0, Ti.length));
3911
+ await (0, utils_ts_1.asyncLoop)(c - 1, asyncTick, () => {
3912
+ PRF._cloneInto(prfW).update(u).digestInto(u);
3913
+ for (let i = 0; i < Ti.length; i++) Ti[i] ^= u[i];
3914
+ });
3915
+ }
3916
+ return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);
3917
+ }
3918
+ }));
3919
+ //#endregion
3920
+ Object.defineProperty(exports, "abytes", {
3921
+ enumerable: true,
3922
+ get: function() {
3923
+ return abytes;
3924
+ }
3925
+ });
3926
+ Object.defineProperty(exports, "argon2idAsync", {
3927
+ enumerable: true,
3928
+ get: function() {
3929
+ return argon2idAsync;
3930
+ }
3931
+ });
3932
+ Object.defineProperty(exports, "bytesToHex", {
3933
+ enumerable: true,
3934
+ get: function() {
3935
+ return bytesToHex;
3936
+ }
3937
+ });
3938
+ Object.defineProperty(exports, "concatBytes", {
3939
+ enumerable: true,
3940
+ get: function() {
3941
+ return concatBytes;
3942
+ }
3943
+ });
3944
+ Object.defineProperty(exports, "hexToBytes", {
3945
+ enumerable: true,
3946
+ get: function() {
3947
+ return hexToBytes;
3948
+ }
3949
+ });
3950
+ Object.defineProperty(exports, "hkdf", {
3951
+ enumerable: true,
3952
+ get: function() {
3953
+ return hkdf;
3954
+ }
3955
+ });
3956
+ Object.defineProperty(exports, "hmac", {
3957
+ enumerable: true,
3958
+ get: function() {
3959
+ return hmac;
3960
+ }
3961
+ });
3962
+ Object.defineProperty(exports, "pbkdf2", {
3963
+ enumerable: true,
3964
+ get: function() {
3965
+ return pbkdf2;
3966
+ }
3967
+ });
3968
+ Object.defineProperty(exports, "randomBytes", {
3969
+ enumerable: true,
3970
+ get: function() {
3971
+ return randomBytes;
3972
+ }
3973
+ });
3974
+ Object.defineProperty(exports, "require_bs58", {
3975
+ enumerable: true,
3976
+ get: function() {
3977
+ return require_bs58;
3978
+ }
3979
+ });
3980
+ Object.defineProperty(exports, "require_dist", {
3981
+ enumerable: true,
3982
+ get: function() {
3983
+ return require_dist;
3984
+ }
3985
+ });
3986
+ Object.defineProperty(exports, "require_hmac", {
3987
+ enumerable: true,
3988
+ get: function() {
3989
+ return require_hmac;
3990
+ }
3991
+ });
3992
+ Object.defineProperty(exports, "require_pbkdf2", {
3993
+ enumerable: true,
3994
+ get: function() {
3995
+ return require_pbkdf2;
3996
+ }
3997
+ });
3998
+ Object.defineProperty(exports, "require_ripemd160", {
3999
+ enumerable: true,
4000
+ get: function() {
4001
+ return require_ripemd160;
4002
+ }
4003
+ });
4004
+ Object.defineProperty(exports, "require_sha1", {
4005
+ enumerable: true,
4006
+ get: function() {
4007
+ return require_sha1;
4008
+ }
4009
+ });
4010
+ Object.defineProperty(exports, "require_sha2", {
4011
+ enumerable: true,
4012
+ get: function() {
4013
+ return require_sha2;
4014
+ }
4015
+ });
4016
+ Object.defineProperty(exports, "require_sha256", {
4017
+ enumerable: true,
4018
+ get: function() {
4019
+ return require_sha256;
4020
+ }
4021
+ });
4022
+ Object.defineProperty(exports, "require_sha512", {
4023
+ enumerable: true,
4024
+ get: function() {
4025
+ return require_sha512;
4026
+ }
4027
+ });
4028
+ Object.defineProperty(exports, "require_utils", {
4029
+ enumerable: true,
4030
+ get: function() {
4031
+ return require_utils;
4032
+ }
4033
+ });
4034
+ Object.defineProperty(exports, "sha256", {
4035
+ enumerable: true,
4036
+ get: function() {
4037
+ return sha256;
4038
+ }
4039
+ });
4040
+ Object.defineProperty(exports, "sha512", {
4041
+ enumerable: true,
4042
+ get: function() {
4043
+ return sha512;
4044
+ }
4045
+ });
4046
+ Object.defineProperty(exports, "utf8ToBytes", {
4047
+ enumerable: true,
4048
+ get: function() {
4049
+ return utf8ToBytes;
4050
+ }
4051
+ });