@holoscript/core 7.0.0 → 8.0.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 (345) hide show
  1. package/README.md +2 -2
  2. package/bin/holoscript.cjs +3 -0
  3. package/dist/GLTFPipeline-276GE64O.js +16 -0
  4. package/dist/GLTFPipeline-M7WSSJED.cjs +37 -0
  5. package/dist/HoloScriptPlusParser-7FBIFUFC.js +693 -0
  6. package/dist/HoloScriptPlusParser-A2W7OCN2.cjs +698 -0
  7. package/dist/HoloScriptPlusParser-F2Z56FJR.js +10 -0
  8. package/dist/HoloScriptPlusParser-WKHRIH6T.cjs +27 -0
  9. package/dist/HoloScriptRuntime-3URVTKPJ.js +10 -0
  10. package/dist/HoloScriptRuntime-SXEAEU2N.cjs +19 -0
  11. package/dist/USDZExporter-3FWJ25JI.cjs +1037 -0
  12. package/dist/USDZExporter-D2HQLQYK.js +1035 -0
  13. package/dist/agents/index.cjs +19 -0
  14. package/dist/agents/index.d.ts +100 -0
  15. package/dist/agents/index.js +17 -0
  16. package/dist/chunk-23J755AR.js +1046 -0
  17. package/dist/chunk-253GBQZY.cjs +627 -0
  18. package/dist/chunk-25IQCHTO.cjs +781 -0
  19. package/dist/chunk-2BSMSUCE.js +1941 -0
  20. package/dist/chunk-2M2DPHKB.js +762 -0
  21. package/dist/chunk-2YSNA2F2.cjs +1274 -0
  22. package/dist/chunk-3AO425MZ.cjs +886 -0
  23. package/dist/chunk-3FOKASKO.cjs +348 -0
  24. package/dist/chunk-3HYYMEXI.cjs +56578 -0
  25. package/dist/chunk-3NFFOWGG.js +4287 -0
  26. package/dist/chunk-3WZEJHUQ.cjs +116 -0
  27. package/dist/chunk-4C57PR42.js +468 -0
  28. package/dist/chunk-4N4SXXWF.js +769 -0
  29. package/dist/chunk-4PDEPEQW.cjs +41 -0
  30. package/dist/chunk-4R6SBXDB.js +45 -0
  31. package/dist/chunk-4V2E7U7Q.cjs +2015 -0
  32. package/dist/chunk-5FSKKMR7.cjs +2092 -0
  33. package/dist/chunk-5GLCTO44.js +161 -0
  34. package/dist/chunk-5JEU52DW.js +382 -0
  35. package/dist/chunk-5S7RKFGR.cjs +446 -0
  36. package/dist/chunk-5WUNN6ZN.cjs +428 -0
  37. package/dist/chunk-62FBK3B7.js +70 -0
  38. package/dist/chunk-6CTRH7HT.cjs +1985 -0
  39. package/dist/chunk-6DPSFNJB.cjs +847 -0
  40. package/dist/chunk-6EX3I5P4.cjs +130 -0
  41. package/dist/chunk-73FELZVJ.cjs +611 -0
  42. package/dist/chunk-7CUEMLDZ.cjs +6445 -0
  43. package/dist/chunk-7HIASF7S.cjs +814 -0
  44. package/dist/chunk-A6KINLZJ.js +236 -0
  45. package/dist/chunk-AIA52I7T.cjs +543 -0
  46. package/dist/chunk-ANXZFVY2.js +113 -0
  47. package/dist/chunk-AYBXB26F.js +2176 -0
  48. package/dist/chunk-B4TFTDG4.js +449 -0
  49. package/dist/chunk-BE4UJCQT.js +623 -0
  50. package/dist/chunk-BRQJKJGT.cjs +20 -0
  51. package/dist/chunk-C2A5DUMF.cjs +689 -0
  52. package/dist/chunk-C37BHB7N.cjs +636 -0
  53. package/dist/chunk-CBJY23VL.js +126 -0
  54. package/dist/chunk-CIWWXYHZ.cjs +50 -0
  55. package/dist/chunk-CXFDRBQU.cjs +672 -0
  56. package/dist/chunk-D54CNIAJ.cjs +413 -0
  57. package/dist/chunk-DAJXW4KX.js +725 -0
  58. package/dist/chunk-DTGBOSEM.cjs +319 -0
  59. package/dist/chunk-E7JP3BS3.cjs +61 -0
  60. package/dist/chunk-EKBKLK7P.js +1169 -0
  61. package/dist/chunk-EKYL4PE3.cjs +404 -0
  62. package/dist/chunk-EUDQTK7N.cjs +4310 -0
  63. package/dist/chunk-EXKSFGSX.cjs +274 -0
  64. package/dist/chunk-EXUP2BUM.cjs +1173 -0
  65. package/dist/chunk-F43YAA34.js +623 -0
  66. package/dist/chunk-FDSGHPAK.js +130 -0
  67. package/dist/chunk-FEWUHQNM.cjs +144 -0
  68. package/dist/chunk-FGGJQRLZ.js +270 -0
  69. package/dist/chunk-FHP6LXJS.js +415 -0
  70. package/dist/chunk-FJPADH77.cjs +666 -0
  71. package/dist/chunk-FYSPZT4V.cjs +169 -0
  72. package/dist/chunk-GIOYPNTH.js +5575 -0
  73. package/dist/chunk-GJNCFRJU.cjs +125 -0
  74. package/dist/chunk-GMP623FG.cjs +1508 -0
  75. package/dist/chunk-GQHQOPXZ.cjs +5580 -0
  76. package/dist/chunk-GQT4TYKY.cjs +4381 -0
  77. package/dist/chunk-GTU2Z2WW.cjs +262 -0
  78. package/dist/chunk-GYZE55MO.js +2007 -0
  79. package/dist/chunk-GZG4KA4E.js +529 -0
  80. package/dist/chunk-H652NHX5.js +600 -0
  81. package/dist/chunk-HCCQLAA4.cjs +74 -0
  82. package/dist/chunk-HINXWAOD.cjs +1049 -0
  83. package/dist/chunk-HYNTS5CP.js +422 -0
  84. package/dist/chunk-HZSPDCXV.cjs +457 -0
  85. package/dist/chunk-HZTDET3N.js +1399 -0
  86. package/dist/chunk-I6XZ5DZF.cjs +488 -0
  87. package/dist/chunk-ILRBGFVD.cjs +72 -0
  88. package/dist/chunk-IPWSXCCN.js +1183 -0
  89. package/dist/chunk-IUTY5WQ2.cjs +424 -0
  90. package/dist/chunk-IVSZDECV.js +882 -0
  91. package/dist/chunk-IVY74O6C.js +247 -0
  92. package/dist/chunk-IZM5VQZD.js +714 -0
  93. package/dist/chunk-J32ZJZJH.js +554 -0
  94. package/dist/chunk-J6M4FPK5.js +421 -0
  95. package/dist/chunk-JC5YBPSF.cjs +984 -0
  96. package/dist/chunk-JCLBKPMX.js +3813 -0
  97. package/dist/chunk-JD7CIZ33.js +1949 -0
  98. package/dist/chunk-JIYN45TV.cjs +2525 -0
  99. package/dist/chunk-JJBE3TIH.cjs +1189 -0
  100. package/dist/chunk-JX7YL6ZE.js +2252 -0
  101. package/dist/chunk-K4VVR7CN.cjs +2433 -0
  102. package/dist/chunk-KEFNV2WM.cjs +2257 -0
  103. package/dist/chunk-KH4CNH66.cjs +424 -0
  104. package/dist/chunk-KJLB4OPV.js +5731 -0
  105. package/dist/chunk-KKFZ3B6J.cjs +557 -0
  106. package/dist/chunk-KKP7JKN4.cjs +6002 -0
  107. package/dist/chunk-KPJL34Y7.cjs +186 -0
  108. package/dist/chunk-KQCN6AKJ.cjs +3042 -0
  109. package/dist/chunk-KVRSTFNH.cjs +72 -0
  110. package/dist/chunk-LICPB5HZ.cjs +1409 -0
  111. package/dist/chunk-LM2VU56C.cjs +37 -0
  112. package/dist/chunk-M56JSP4A.js +400 -0
  113. package/dist/chunk-MBOOR7X4.js +18 -0
  114. package/dist/chunk-MGE5Z4GS.js +608 -0
  115. package/dist/chunk-MXFUTKCO.js +56 -0
  116. package/dist/chunk-MYY4PMWX.cjs +264 -0
  117. package/dist/chunk-N75IH2HY.js +258 -0
  118. package/dist/chunk-NBMHU6SW.js +669 -0
  119. package/dist/chunk-NG77ATEW.cjs +778 -0
  120. package/dist/chunk-NGKREZ36.js +6384 -0
  121. package/dist/chunk-NHWSN2SD.cjs +718 -0
  122. package/dist/chunk-NV4VMVXU.js +421 -0
  123. package/dist/chunk-NW5G5FBQ.js +215 -0
  124. package/dist/chunk-NXZFOPVD.cjs +5737 -0
  125. package/dist/chunk-OBIYPYYS.cjs +1993 -0
  126. package/dist/chunk-OIQYIIO3.cjs +473 -0
  127. package/dist/chunk-OL46QLBJ.js +61 -0
  128. package/dist/chunk-OMXII44L.js +5386 -0
  129. package/dist/chunk-OR4Q2BGL.cjs +759 -0
  130. package/dist/chunk-OSYNRVOV.cjs +243 -0
  131. package/dist/chunk-PGANYCAG.cjs +220 -0
  132. package/dist/chunk-PHENW4MQ.js +65 -0
  133. package/dist/chunk-PHVRG4I2.js +844 -0
  134. package/dist/chunk-Q56TT7IL.js +483 -0
  135. package/dist/chunk-QPOQ7VPI.js +1491 -0
  136. package/dist/chunk-QPSKHBJP.js +5963 -0
  137. package/dist/chunk-QXH7QDSZ.js +1989 -0
  138. package/dist/chunk-R75BSDH7.cjs +50 -0
  139. package/dist/chunk-RARB3MBR.js +207 -0
  140. package/dist/chunk-RVBHAXFG.js +56160 -0
  141. package/dist/chunk-S3MDHNKB.cjs +490 -0
  142. package/dist/chunk-S4W6Z2MN.js +2426 -0
  143. package/dist/chunk-S6YWHCKV.cjs +410 -0
  144. package/dist/chunk-SIEXCILW.js +229 -0
  145. package/dist/chunk-SJBGLS25.cjs +2196 -0
  146. package/dist/chunk-SLU6UPJI.cjs +410 -0
  147. package/dist/chunk-SMIWS6DE.cjs +212 -0
  148. package/dist/chunk-T2QCTZMO.js +811 -0
  149. package/dist/chunk-T5J7ZKP3.cjs +4885 -0
  150. package/dist/chunk-TDCNJHWO.js +341 -0
  151. package/dist/chunk-TG7O4WBC.js +406 -0
  152. package/dist/chunk-THCK6ECW.js +2085 -0
  153. package/dist/chunk-TJHVSBP2.js +439 -0
  154. package/dist/chunk-TVHSPJ4N.cjs +606 -0
  155. package/dist/chunk-U44IKGG7.cjs +5390 -0
  156. package/dist/chunk-UJXISJBN.js +487 -0
  157. package/dist/chunk-UM6C3CGK.js +4375 -0
  158. package/dist/chunk-UMABK6SI.js +686 -0
  159. package/dist/chunk-UOIGFQXC.cjs +9750 -0
  160. package/dist/chunk-URG2SJLK.js +2521 -0
  161. package/dist/chunk-V6MKC2FZ.js +979 -0
  162. package/dist/chunk-VECQYRXL.js +474 -0
  163. package/dist/chunk-VJ3L7CHT.cjs +169 -0
  164. package/dist/chunk-VMLKSV26.js +1216 -0
  165. package/dist/chunk-VVKVQZI6.js +55 -0
  166. package/dist/chunk-W6RW64BB.cjs +1219 -0
  167. package/dist/chunk-W7VDOASB.cjs +639 -0
  168. package/dist/chunk-WDT3JTGM.cjs +483 -0
  169. package/dist/chunk-WJIHFLMJ.js +404 -0
  170. package/dist/chunk-WKX5AMOY.js +309 -0
  171. package/dist/chunk-WNNE3PO3.js +34 -0
  172. package/dist/chunk-WRKUDAZJ.js +3038 -0
  173. package/dist/chunk-WRLUBRKS.cjs +1943 -0
  174. package/dist/chunk-WRNEH5MO.js +3169 -0
  175. package/dist/chunk-WRWEX5ZF.js +658 -0
  176. package/dist/chunk-X3GJPRVK.cjs +3246 -0
  177. package/dist/chunk-XHIV6326.cjs +793 -0
  178. package/dist/chunk-XIVIE43A.cjs +729 -0
  179. package/dist/chunk-XJAN7CZG.cjs +432 -0
  180. package/dist/chunk-XKTPFXGA.js +164 -0
  181. package/dist/chunk-XL6INWKT.js +121 -0
  182. package/dist/chunk-XSFNHP2E.js +632 -0
  183. package/dist/chunk-XT6JY5W5.js +9684 -0
  184. package/dist/chunk-XUILI4KB.cjs +430 -0
  185. package/dist/chunk-XUUVDHIF.cjs +3962 -0
  186. package/dist/chunk-YF2I3MV3.js +46 -0
  187. package/dist/chunk-YIMN575O.js +4847 -0
  188. package/dist/chunk-YIVFJNYV.js +176 -0
  189. package/dist/chunk-YKGPCZEE.cjs +237 -0
  190. package/dist/chunk-YN6V7R3L.cjs +327 -0
  191. package/dist/chunk-YQELFNJV.js +39 -0
  192. package/dist/chunk-YYXH45E2.js +426 -0
  193. package/dist/chunk-ZBQXLH2L.js +756 -0
  194. package/dist/chunk-ZDSYWBIE.cjs +69 -0
  195. package/dist/chunk-ZU7NIRT6.js +325 -0
  196. package/dist/chunk-ZZ7RO2UQ.js +1243 -0
  197. package/dist/chunk-ZZEI7MV4.js +778 -0
  198. package/dist/cli/holoscript-runner.cjs +2255 -0
  199. package/dist/cli/holoscript-runner.js +2230 -0
  200. package/dist/codebase/index.cjs +336 -0
  201. package/dist/codebase/index.js +331 -0
  202. package/dist/compiler/agent-inference.cjs +31 -0
  203. package/dist/compiler/agent-inference.js +8 -0
  204. package/dist/compiler/android-xr.cjs +24 -0
  205. package/dist/compiler/android-xr.js +14 -0
  206. package/dist/compiler/android.cjs +24 -0
  207. package/dist/compiler/android.js +14 -0
  208. package/dist/compiler/ar.cjs +23 -0
  209. package/dist/compiler/ar.js +11 -0
  210. package/dist/compiler/babylon.cjs +21 -0
  211. package/dist/compiler/babylon.js +15 -0
  212. package/dist/compiler/business-quest.cjs +43 -0
  213. package/dist/compiler/business-quest.js +4 -0
  214. package/dist/compiler/coco.cjs +27 -0
  215. package/dist/compiler/coco.js +4 -0
  216. package/dist/compiler/context.cjs +25 -0
  217. package/dist/compiler/context.d.ts +28 -0
  218. package/dist/compiler/context.js +8 -0
  219. package/dist/compiler/domain-block-utils.cjs +605 -0
  220. package/dist/compiler/domain-block-utils.js +11 -0
  221. package/dist/compiler/dtdl.cjs +27 -0
  222. package/dist/compiler/dtdl.js +11 -0
  223. package/dist/compiler/gltf-pipeline.cjs +39 -0
  224. package/dist/compiler/gltf-pipeline.js +4 -0
  225. package/dist/compiler/godot.cjs +18 -0
  226. package/dist/compiler/godot.js +12 -0
  227. package/dist/compiler/incremental.cjs +34 -0
  228. package/dist/compiler/incremental.js +9 -0
  229. package/dist/compiler/index.cjs +5860 -0
  230. package/dist/compiler/index.d.ts +322 -21
  231. package/dist/compiler/index.js +5525 -0
  232. package/dist/compiler/ios.cjs +23 -0
  233. package/dist/compiler/ios.js +13 -0
  234. package/dist/compiler/llm-provider-capabilities.cjs +25 -0
  235. package/dist/compiler/llm-provider-capabilities.d.ts +43 -0
  236. package/dist/compiler/llm-provider-capabilities.js +8 -0
  237. package/dist/compiler/multi-layer.cjs +24 -0
  238. package/dist/compiler/multi-layer.js +15 -0
  239. package/dist/compiler/nodetoy.cjs +23 -0
  240. package/dist/compiler/nodetoy.js +4 -0
  241. package/dist/compiler/openxr.cjs +19 -0
  242. package/dist/compiler/openxr.js +13 -0
  243. package/dist/compiler/playcanvas.cjs +19 -0
  244. package/dist/compiler/playcanvas.js +13 -0
  245. package/dist/compiler/r3f.cjs +38 -0
  246. package/dist/compiler/r3f.d.ts +22 -0
  247. package/dist/compiler/r3f.js +16 -0
  248. package/dist/compiler/remotion.cjs +23 -0
  249. package/dist/compiler/remotion.js +4 -0
  250. package/dist/compiler/reproducibility.cjs +39 -0
  251. package/dist/compiler/reproducibility.js +4 -0
  252. package/dist/compiler/sdf.cjs +24 -0
  253. package/dist/compiler/sdf.js +12 -0
  254. package/dist/compiler/semantic-scene.cjs +31 -0
  255. package/dist/compiler/semantic-scene.js +4 -0
  256. package/dist/compiler/state.cjs +21 -0
  257. package/dist/compiler/state.js +11 -0
  258. package/dist/compiler/trait-composition.cjs +30 -0
  259. package/dist/compiler/trait-composition.js +9 -0
  260. package/dist/compiler/unity.cjs +19 -0
  261. package/dist/compiler/unity.js +13 -0
  262. package/dist/compiler/unreal.cjs +23 -0
  263. package/dist/compiler/unreal.js +13 -0
  264. package/dist/compiler/urdf.cjs +52 -0
  265. package/dist/compiler/urdf.js +12 -0
  266. package/dist/compiler/usd-physics.cjs +26 -0
  267. package/dist/compiler/usd-physics.js +9 -0
  268. package/dist/compiler/visionos.cjs +19 -0
  269. package/dist/compiler/visionos.js +13 -0
  270. package/dist/compiler/vrchat.cjs +22 -0
  271. package/dist/compiler/vrchat.js +12 -0
  272. package/dist/compiler/vrr.cjs +24 -0
  273. package/dist/compiler/vrr.js +12 -0
  274. package/dist/compiler/wasm.cjs +36 -0
  275. package/dist/compiler/wasm.js +12 -0
  276. package/dist/compiler/webgpu.cjs +18 -0
  277. package/dist/compiler/webgpu.js +12 -0
  278. package/dist/coordinators/index.cjs +1266 -0
  279. package/dist/coordinators/index.d.ts +72 -1
  280. package/dist/coordinators/index.js +1259 -0
  281. package/dist/debugger.cjs +24 -0
  282. package/dist/debugger.js +11 -0
  283. package/dist/entries/interop.cjs +64 -0
  284. package/dist/entries/interop.js +7 -0
  285. package/dist/entries/scripting.cjs +55 -0
  286. package/dist/entries/scripting.js +10 -0
  287. package/dist/hololand/index.cjs +146 -0
  288. package/dist/hololand/index.d.ts +70 -0
  289. package/dist/hololand/index.js +5 -0
  290. package/dist/index.cjs +43233 -0
  291. package/dist/index.d.ts +976 -21
  292. package/dist/index.js +39995 -0
  293. package/dist/math/tropical-spmv.cjs +45 -0
  294. package/dist/math/tropical-spmv.js +4 -0
  295. package/dist/math/vec3.cjs +57 -0
  296. package/dist/math/vec3.js +4 -0
  297. package/dist/ml-dsa-FSKBTE3W.cjs +1265 -0
  298. package/dist/ml-dsa-Z7JDKW4L.js +1265 -0
  299. package/dist/paper-0c-spike/index.cjs +150 -0
  300. package/dist/paper-0c-spike/index.js +141 -0
  301. package/dist/parser.cjs +61 -0
  302. package/dist/parser.d.ts +11 -0
  303. package/dist/parser.js +12 -0
  304. package/dist/playwright-3AT3AKTV.cjs +98673 -0
  305. package/dist/playwright-VZPDVUEQ.js +98660 -0
  306. package/dist/reconstruction/index.cjs +153 -0
  307. package/dist/reconstruction/index.d.ts +29 -2
  308. package/dist/reconstruction/index.js +8 -0
  309. package/dist/runtime.cjs +316 -0
  310. package/dist/runtime.d.ts +61 -0
  311. package/dist/runtime.js +31 -0
  312. package/dist/self-improvement/index.cjs +563 -0
  313. package/dist/self-improvement/index.js +545 -0
  314. package/dist/storage/index.cjs +38 -0
  315. package/dist/storage/index.js +5 -0
  316. package/dist/testing.cjs +25 -0
  317. package/dist/testing.d.ts +70 -0
  318. package/dist/testing.js +4 -0
  319. package/dist/traitDocs/traitDocs.cjs +33 -0
  320. package/dist/traitDocs/traitDocs.js +7 -0
  321. package/dist/traits/botanical-lotus.cjs +41 -0
  322. package/dist/traits/botanical-lotus.d.ts +172 -0
  323. package/dist/traits/botanical-lotus.js +4 -0
  324. package/dist/traits/engines/index.cjs +520 -0
  325. package/dist/traits/engines/index.js +380 -0
  326. package/dist/traits/index.cjs +24409 -0
  327. package/dist/traits/index.d.ts +171 -35
  328. package/dist/traits/index.js +21634 -0
  329. package/dist/traits/simulation-solver-factory.cjs +13 -0
  330. package/dist/traits/simulation-solver-factory.d.ts +23 -0
  331. package/dist/traits/simulation-solver-factory.js +4 -0
  332. package/dist/traits/webcam-gaze.cjs +35 -0
  333. package/dist/traits/webcam-gaze.d.ts +17 -0
  334. package/dist/traits/webcam-gaze.js +4 -0
  335. package/dist/type-checker.cjs +19 -0
  336. package/dist/type-checker.js +6 -0
  337. package/dist/world/index.cjs +947 -0
  338. package/dist/world/index.d.ts +147 -0
  339. package/dist/world/index.js +939 -0
  340. package/dist/world-model/index.cjs +1446 -0
  341. package/dist/world-model/index.d.ts +119 -0
  342. package/dist/world-model/index.js +1414 -0
  343. package/dist/wot/index.cjs +29 -0
  344. package/dist/wot/index.js +4 -0
  345. package/package.json +93 -49
@@ -0,0 +1,1265 @@
1
+ 'use strict';
2
+
3
+ var chunkHCCQLAA4_cjs = require('./chunk-HCCQLAA4.cjs');
4
+
5
+ // ../../node_modules/.pnpm/@noble+hashes@2.2.0/node_modules/@noble/hashes/utils.js
6
+ function isBytes(a) {
7
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array" && "BYTES_PER_ELEMENT" in a && a.BYTES_PER_ELEMENT === 1;
8
+ }
9
+ function anumber(n, title = "") {
10
+ if (typeof n !== "number") {
11
+ const prefix = title && `"${title}" `;
12
+ throw new TypeError(`${prefix}expected number, got ${typeof n}`);
13
+ }
14
+ if (!Number.isSafeInteger(n) || n < 0) {
15
+ const prefix = title && `"${title}" `;
16
+ throw new RangeError(`${prefix}expected integer >= 0, got ${n}`);
17
+ }
18
+ }
19
+ function abytes(value, length, title = "") {
20
+ const bytes = isBytes(value);
21
+ const len = value?.length;
22
+ const needsLen = length !== void 0;
23
+ if (!bytes || needsLen && len !== length) {
24
+ const prefix = title && `"${title}" `;
25
+ const ofLen = needsLen ? ` of length ${length}` : "";
26
+ const got = bytes ? `length=${len}` : `type=${typeof value}`;
27
+ const message = prefix + "expected Uint8Array" + ofLen + ", got " + got;
28
+ if (!bytes)
29
+ throw new TypeError(message);
30
+ throw new RangeError(message);
31
+ }
32
+ return value;
33
+ }
34
+ function aexists(instance, checkFinished = true) {
35
+ if (instance.destroyed)
36
+ throw new Error("Hash instance has been destroyed");
37
+ if (checkFinished && instance.finished)
38
+ throw new Error("Hash#digest() has already been called");
39
+ }
40
+ function aoutput(out, instance) {
41
+ abytes(out, void 0, "digestInto() output");
42
+ const min = instance.outputLen;
43
+ if (out.length < min) {
44
+ throw new RangeError('"digestInto() output" expected to be of length >=' + min);
45
+ }
46
+ }
47
+ function u32(arr) {
48
+ return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
49
+ }
50
+ function clean(...arrays) {
51
+ for (let i = 0; i < arrays.length; i++) {
52
+ arrays[i].fill(0);
53
+ }
54
+ }
55
+ function byteSwap(word) {
56
+ return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
57
+ }
58
+ function byteSwap32(arr) {
59
+ for (let i = 0; i < arr.length; i++) {
60
+ arr[i] = byteSwap(arr[i]);
61
+ }
62
+ return arr;
63
+ }
64
+ function concatBytes(...arrays) {
65
+ let sum = 0;
66
+ for (let i = 0; i < arrays.length; i++) {
67
+ const a = arrays[i];
68
+ abytes(a);
69
+ sum += a.length;
70
+ }
71
+ const res = new Uint8Array(sum);
72
+ for (let i = 0, pad = 0; i < arrays.length; i++) {
73
+ const a = arrays[i];
74
+ res.set(a, pad);
75
+ pad += a.length;
76
+ }
77
+ return res;
78
+ }
79
+ function createHasher(hashCons, info = {}) {
80
+ const hashC = (msg, opts) => hashCons(opts).update(msg).digest();
81
+ const tmp = hashCons(void 0);
82
+ hashC.outputLen = tmp.outputLen;
83
+ hashC.blockLen = tmp.blockLen;
84
+ hashC.canXOF = tmp.canXOF;
85
+ hashC.create = (opts) => hashCons(opts);
86
+ Object.assign(hashC, info);
87
+ return Object.freeze(hashC);
88
+ }
89
+ function randomBytes(bytesLength = 32) {
90
+ anumber(bytesLength, "bytesLength");
91
+ const cr = typeof globalThis === "object" ? globalThis.crypto : null;
92
+ if (typeof cr?.getRandomValues !== "function")
93
+ throw new Error("crypto.getRandomValues must be defined");
94
+ if (bytesLength > 65536)
95
+ throw new RangeError(`"bytesLength" expected <= 65536, got ${bytesLength}`);
96
+ return cr.getRandomValues(new Uint8Array(bytesLength));
97
+ }
98
+ var isLE, swap32IfBE, oidNist;
99
+ var init_utils = chunkHCCQLAA4_cjs.__esm({
100
+ "../../node_modules/.pnpm/@noble+hashes@2.2.0/node_modules/@noble/hashes/utils.js"() {
101
+ isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
102
+ swap32IfBE = isLE ? (u) => u : byteSwap32;
103
+ oidNist = (suffix) => ({
104
+ // Current NIST hashAlgs suffixes used here fit in one DER subidentifier octet.
105
+ // Larger suffix values would need base-128 OID encoding and a different length byte.
106
+ oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, suffix])
107
+ });
108
+ }
109
+ });
110
+
111
+ // ../../node_modules/.pnpm/@noble+curves@2.2.0/node_modules/@noble/curves/utils.js
112
+ function abool(value, title = "") {
113
+ if (typeof value !== "boolean") {
114
+ const prefix = title && `"${title}" `;
115
+ throw new TypeError(prefix + "expected boolean, got type=" + typeof value);
116
+ }
117
+ return value;
118
+ }
119
+ var init_utils2 = chunkHCCQLAA4_cjs.__esm({
120
+ "../../node_modules/.pnpm/@noble+curves@2.2.0/node_modules/@noble/curves/utils.js"() {
121
+ }
122
+ });
123
+
124
+ // ../../node_modules/.pnpm/@noble+hashes@2.2.0/node_modules/@noble/hashes/_u64.js
125
+ function fromBig(n, le = false) {
126
+ if (le)
127
+ return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
128
+ return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
129
+ }
130
+ function split(lst, le = false) {
131
+ const len = lst.length;
132
+ let Ah = new Uint32Array(len);
133
+ let Al = new Uint32Array(len);
134
+ for (let i = 0; i < len; i++) {
135
+ const { h, l } = fromBig(lst[i], le);
136
+ [Ah[i], Al[i]] = [h, l];
137
+ }
138
+ return [Ah, Al];
139
+ }
140
+ var U32_MASK64, _32n, rotlSH, rotlSL, rotlBH, rotlBL;
141
+ var init_u64 = chunkHCCQLAA4_cjs.__esm({
142
+ "../../node_modules/.pnpm/@noble+hashes@2.2.0/node_modules/@noble/hashes/_u64.js"() {
143
+ U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
144
+ _32n = /* @__PURE__ */ BigInt(32);
145
+ rotlSH = (h, l, s) => h << s | l >>> 32 - s;
146
+ rotlSL = (h, l, s) => l << s | h >>> 32 - s;
147
+ rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
148
+ rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
149
+ }
150
+ });
151
+
152
+ // ../../node_modules/.pnpm/@noble+hashes@2.2.0/node_modules/@noble/hashes/sha3.js
153
+ function keccakP(s, rounds = 24) {
154
+ anumber(rounds, "rounds");
155
+ if (rounds < 1 || rounds > 24)
156
+ throw new Error('"rounds" expected integer 1..24');
157
+ const B = new Uint32Array(5 * 2);
158
+ for (let round = 24 - rounds; round < 24; round++) {
159
+ for (let x = 0; x < 10; x++)
160
+ B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
161
+ for (let x = 0; x < 10; x += 2) {
162
+ const idx1 = (x + 8) % 10;
163
+ const idx0 = (x + 2) % 10;
164
+ const B0 = B[idx0];
165
+ const B1 = B[idx0 + 1];
166
+ const Th = rotlH(B0, B1, 1) ^ B[idx1];
167
+ const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
168
+ for (let y = 0; y < 50; y += 10) {
169
+ s[x + y] ^= Th;
170
+ s[x + y + 1] ^= Tl;
171
+ }
172
+ }
173
+ let curH = s[2];
174
+ let curL = s[3];
175
+ for (let t = 0; t < 24; t++) {
176
+ const shift = SHA3_ROTL[t];
177
+ const Th = rotlH(curH, curL, shift);
178
+ const Tl = rotlL(curH, curL, shift);
179
+ const PI = SHA3_PI[t];
180
+ curH = s[PI];
181
+ curL = s[PI + 1];
182
+ s[PI] = Th;
183
+ s[PI + 1] = Tl;
184
+ }
185
+ for (let y = 0; y < 50; y += 10) {
186
+ const b0 = s[y], b1 = s[y + 1], b2 = s[y + 2], b3 = s[y + 3];
187
+ s[y] ^= ~s[y + 2] & s[y + 4];
188
+ s[y + 1] ^= ~s[y + 3] & s[y + 5];
189
+ s[y + 2] ^= ~s[y + 4] & s[y + 6];
190
+ s[y + 3] ^= ~s[y + 5] & s[y + 7];
191
+ s[y + 4] ^= ~s[y + 6] & s[y + 8];
192
+ s[y + 5] ^= ~s[y + 7] & s[y + 9];
193
+ s[y + 6] ^= ~s[y + 8] & b0;
194
+ s[y + 7] ^= ~s[y + 9] & b1;
195
+ s[y + 8] ^= ~b0 & b2;
196
+ s[y + 9] ^= ~b1 & b3;
197
+ }
198
+ s[0] ^= SHA3_IOTA_H[round];
199
+ s[1] ^= SHA3_IOTA_L[round];
200
+ }
201
+ clean(B);
202
+ }
203
+ var _0n, _1n, _2n, _7n, _256n, _0x71n, SHA3_PI, SHA3_ROTL, _SHA3_IOTA, IOTAS, SHA3_IOTA_H, SHA3_IOTA_L, rotlH, rotlL, Keccak, genShake, shake128, shake256;
204
+ var init_sha3 = chunkHCCQLAA4_cjs.__esm({
205
+ "../../node_modules/.pnpm/@noble+hashes@2.2.0/node_modules/@noble/hashes/sha3.js"() {
206
+ init_u64();
207
+ init_utils();
208
+ _0n = BigInt(0);
209
+ _1n = BigInt(1);
210
+ _2n = BigInt(2);
211
+ _7n = BigInt(7);
212
+ _256n = BigInt(256);
213
+ _0x71n = BigInt(113);
214
+ SHA3_PI = [];
215
+ SHA3_ROTL = [];
216
+ _SHA3_IOTA = [];
217
+ for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
218
+ [x, y] = [y, (2 * x + 3 * y) % 5];
219
+ SHA3_PI.push(2 * (5 * y + x));
220
+ SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
221
+ let t = _0n;
222
+ for (let j = 0; j < 7; j++) {
223
+ R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
224
+ if (R & _2n)
225
+ t ^= _1n << (_1n << BigInt(j)) - _1n;
226
+ }
227
+ _SHA3_IOTA.push(t);
228
+ }
229
+ IOTAS = split(_SHA3_IOTA, true);
230
+ SHA3_IOTA_H = IOTAS[0];
231
+ SHA3_IOTA_L = IOTAS[1];
232
+ rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s);
233
+ rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s);
234
+ Keccak = class _Keccak {
235
+ // NOTE: we accept arguments in bytes instead of bits here.
236
+ constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
237
+ chunkHCCQLAA4_cjs.__publicField(this, "state");
238
+ chunkHCCQLAA4_cjs.__publicField(this, "pos", 0);
239
+ chunkHCCQLAA4_cjs.__publicField(this, "posOut", 0);
240
+ chunkHCCQLAA4_cjs.__publicField(this, "finished", false);
241
+ chunkHCCQLAA4_cjs.__publicField(this, "state32");
242
+ chunkHCCQLAA4_cjs.__publicField(this, "destroyed", false);
243
+ chunkHCCQLAA4_cjs.__publicField(this, "blockLen");
244
+ chunkHCCQLAA4_cjs.__publicField(this, "suffix");
245
+ chunkHCCQLAA4_cjs.__publicField(this, "outputLen");
246
+ chunkHCCQLAA4_cjs.__publicField(this, "canXOF");
247
+ chunkHCCQLAA4_cjs.__publicField(this, "enableXOF", false);
248
+ chunkHCCQLAA4_cjs.__publicField(this, "rounds");
249
+ this.blockLen = blockLen;
250
+ this.suffix = suffix;
251
+ this.outputLen = outputLen;
252
+ this.enableXOF = enableXOF;
253
+ this.canXOF = enableXOF;
254
+ this.rounds = rounds;
255
+ anumber(outputLen, "outputLen");
256
+ if (!(0 < blockLen && blockLen < 200))
257
+ throw new Error("only keccak-f1600 function is supported");
258
+ this.state = new Uint8Array(200);
259
+ this.state32 = u32(this.state);
260
+ }
261
+ clone() {
262
+ return this._cloneInto();
263
+ }
264
+ keccak() {
265
+ swap32IfBE(this.state32);
266
+ keccakP(this.state32, this.rounds);
267
+ swap32IfBE(this.state32);
268
+ this.posOut = 0;
269
+ this.pos = 0;
270
+ }
271
+ update(data) {
272
+ aexists(this);
273
+ abytes(data);
274
+ const { blockLen, state } = this;
275
+ const len = data.length;
276
+ for (let pos = 0; pos < len; ) {
277
+ const take = Math.min(blockLen - this.pos, len - pos);
278
+ for (let i = 0; i < take; i++)
279
+ state[this.pos++] ^= data[pos++];
280
+ if (this.pos === blockLen)
281
+ this.keccak();
282
+ }
283
+ return this;
284
+ }
285
+ finish() {
286
+ if (this.finished)
287
+ return;
288
+ this.finished = true;
289
+ const { state, suffix, pos, blockLen } = this;
290
+ state[pos] ^= suffix;
291
+ if ((suffix & 128) !== 0 && pos === blockLen - 1)
292
+ this.keccak();
293
+ state[blockLen - 1] ^= 128;
294
+ this.keccak();
295
+ }
296
+ writeInto(out) {
297
+ aexists(this, false);
298
+ abytes(out);
299
+ this.finish();
300
+ const bufferOut = this.state;
301
+ const { blockLen } = this;
302
+ for (let pos = 0, len = out.length; pos < len; ) {
303
+ if (this.posOut >= blockLen)
304
+ this.keccak();
305
+ const take = Math.min(blockLen - this.posOut, len - pos);
306
+ out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
307
+ this.posOut += take;
308
+ pos += take;
309
+ }
310
+ return out;
311
+ }
312
+ xofInto(out) {
313
+ if (!this.enableXOF)
314
+ throw new Error("XOF is not possible for this instance");
315
+ return this.writeInto(out);
316
+ }
317
+ xof(bytes) {
318
+ anumber(bytes);
319
+ return this.xofInto(new Uint8Array(bytes));
320
+ }
321
+ digestInto(out) {
322
+ aoutput(out, this);
323
+ if (this.finished)
324
+ throw new Error("digest() was already called");
325
+ this.writeInto(out.subarray(0, this.outputLen));
326
+ this.destroy();
327
+ }
328
+ digest() {
329
+ const out = new Uint8Array(this.outputLen);
330
+ this.digestInto(out);
331
+ return out;
332
+ }
333
+ destroy() {
334
+ this.destroyed = true;
335
+ clean(this.state);
336
+ }
337
+ _cloneInto(to) {
338
+ const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
339
+ to || (to = new _Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
340
+ to.blockLen = blockLen;
341
+ to.state32.set(this.state32);
342
+ to.pos = this.pos;
343
+ to.posOut = this.posOut;
344
+ to.finished = this.finished;
345
+ to.rounds = rounds;
346
+ to.suffix = suffix;
347
+ to.outputLen = outputLen;
348
+ to.enableXOF = enableXOF;
349
+ to.canXOF = this.canXOF;
350
+ to.destroyed = this.destroyed;
351
+ return to;
352
+ }
353
+ };
354
+ genShake = (suffix, blockLen, outputLen, info = {}) => createHasher((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === void 0 ? outputLen : opts.dkLen, true), info);
355
+ shake128 = /* @__PURE__ */ genShake(31, 168, 16, /* @__PURE__ */ oidNist(11));
356
+ shake256 = /* @__PURE__ */ genShake(31, 136, 32, /* @__PURE__ */ oidNist(12));
357
+ }
358
+ });
359
+
360
+ // ../../node_modules/.pnpm/@noble+curves@2.2.0/node_modules/@noble/curves/abstract/fft.js
361
+ function checkU32(n) {
362
+ if (!Number.isSafeInteger(n) || n < 0 || n > 4294967295)
363
+ throw new Error("wrong u32 integer:" + n);
364
+ return n;
365
+ }
366
+ function isPowerOfTwo(x) {
367
+ checkU32(x);
368
+ return (x & x - 1) === 0 && x !== 0;
369
+ }
370
+ function reverseBits(n, bits) {
371
+ checkU32(n);
372
+ if (!Number.isSafeInteger(bits) || bits < 0 || bits > 32)
373
+ throw new Error(`expected integer 0 <= bits <= 32, got ${bits}`);
374
+ let reversed = 0;
375
+ for (let i = 0; i < bits; i++, n >>>= 1)
376
+ reversed = reversed << 1 | n & 1;
377
+ return reversed >>> 0;
378
+ }
379
+ function log2(n) {
380
+ checkU32(n);
381
+ return 31 - Math.clz32(n);
382
+ }
383
+ function bitReversalInplace(values) {
384
+ const n = values.length;
385
+ if (!isPowerOfTwo(n))
386
+ throw new Error("expected positive power-of-two length, got " + n);
387
+ const bits = log2(n);
388
+ for (let i = 0; i < n; i++) {
389
+ const j = reverseBits(i, bits);
390
+ if (i < j) {
391
+ const tmp = values[i];
392
+ values[i] = values[j];
393
+ values[j] = tmp;
394
+ }
395
+ }
396
+ return values;
397
+ }
398
+ var FFTCore;
399
+ var init_fft = chunkHCCQLAA4_cjs.__esm({
400
+ "../../node_modules/.pnpm/@noble+curves@2.2.0/node_modules/@noble/curves/abstract/fft.js"() {
401
+ FFTCore = (F2, coreOpts) => {
402
+ const { N: N2, roots, dit, invertButterflies = false, skipStages = 0, brp = true } = coreOpts;
403
+ const bits = log2(N2);
404
+ if (!isPowerOfTwo(N2))
405
+ throw new Error("FFT: Polynomial size should be power of two");
406
+ if (roots.length !== N2)
407
+ throw new Error(`FFT: wrong roots length: expected ${N2}, got ${roots.length}`);
408
+ const isDit = dit !== invertButterflies;
409
+ return (values) => {
410
+ if (values.length !== N2)
411
+ throw new Error("FFT: wrong Polynomial length");
412
+ if (dit && brp)
413
+ bitReversalInplace(values);
414
+ for (let i = 0, g = 1; i < bits - skipStages; i++) {
415
+ const s = dit ? i + 1 + skipStages : bits - i;
416
+ const m = 1 << s;
417
+ const m2 = m >> 1;
418
+ const stride = N2 >> s;
419
+ for (let k = 0; k < N2; k += m) {
420
+ for (let j = 0, grp = g++; j < m2; j++) {
421
+ const rootPos = invertButterflies ? dit ? N2 - grp : grp : j * stride;
422
+ const i0 = k + j;
423
+ const i1 = k + j + m2;
424
+ const omega = roots[rootPos];
425
+ const b = values[i1];
426
+ const a = values[i0];
427
+ if (isDit) {
428
+ const t = F2.mul(b, omega);
429
+ values[i0] = F2.add(a, t);
430
+ values[i1] = F2.sub(a, t);
431
+ } else if (invertButterflies) {
432
+ values[i0] = F2.add(b, a);
433
+ values[i1] = F2.mul(F2.sub(b, a), omega);
434
+ } else {
435
+ values[i0] = F2.add(a, b);
436
+ values[i1] = F2.mul(F2.sub(a, b), omega);
437
+ }
438
+ }
439
+ }
440
+ }
441
+ if (!dit && brp)
442
+ bitReversalInplace(values);
443
+ return values;
444
+ };
445
+ };
446
+ }
447
+ });
448
+
449
+ // ../../node_modules/.pnpm/@noble+post-quantum@0.6.1/node_modules/@noble/post-quantum/utils.js
450
+ function equalBytes(a, b) {
451
+ if (a.length !== b.length)
452
+ return false;
453
+ let diff = 0;
454
+ for (let i = 0; i < a.length; i++)
455
+ diff |= a[i] ^ b[i];
456
+ return diff === 0;
457
+ }
458
+ function validateOpts(opts) {
459
+ if (Object.prototype.toString.call(opts) !== "[object Object]")
460
+ throw new TypeError("expected valid options object");
461
+ }
462
+ function validateVerOpts(opts) {
463
+ validateOpts(opts);
464
+ if (opts.context !== void 0)
465
+ abytes(opts.context, void 0, "opts.context");
466
+ }
467
+ function validateSigOpts(opts) {
468
+ validateVerOpts(opts);
469
+ if (opts.extraEntropy !== false && opts.extraEntropy !== void 0)
470
+ abytes(opts.extraEntropy, void 0, "opts.extraEntropy");
471
+ }
472
+ function splitCoder(label, ...lengths) {
473
+ const getLength = (c) => typeof c === "number" ? c : c.bytesLen;
474
+ const bytesLen = lengths.reduce((sum, a) => sum + getLength(a), 0);
475
+ return {
476
+ bytesLen,
477
+ encode: (bufs) => {
478
+ const res = new Uint8Array(bytesLen);
479
+ for (let i = 0, pos = 0; i < lengths.length; i++) {
480
+ const c = lengths[i];
481
+ const l = getLength(c);
482
+ const b = typeof c === "number" ? bufs[i] : c.encode(bufs[i]);
483
+ abytes(b, l, label);
484
+ res.set(b, pos);
485
+ if (typeof c !== "number")
486
+ b.fill(0);
487
+ pos += l;
488
+ }
489
+ return res;
490
+ },
491
+ decode: (buf) => {
492
+ abytes(buf, bytesLen, label);
493
+ const res = [];
494
+ for (const c of lengths) {
495
+ const l = getLength(c);
496
+ const b = buf.subarray(0, l);
497
+ res.push(typeof c === "number" ? b : c.decode(b));
498
+ buf = buf.subarray(l);
499
+ }
500
+ return res;
501
+ }
502
+ };
503
+ }
504
+ function vecCoder(c, vecLen) {
505
+ const coder = c;
506
+ const bytesLen = vecLen * coder.bytesLen;
507
+ return {
508
+ bytesLen,
509
+ encode: (u) => {
510
+ if (u.length !== vecLen)
511
+ throw new RangeError(`vecCoder.encode: wrong length=${u.length}. Expected: ${vecLen}`);
512
+ const res = new Uint8Array(bytesLen);
513
+ for (let i = 0, pos = 0; i < u.length; i++) {
514
+ const b = coder.encode(u[i]);
515
+ res.set(b, pos);
516
+ b.fill(0);
517
+ pos += b.length;
518
+ }
519
+ return res;
520
+ },
521
+ decode: (a) => {
522
+ abytes(a, bytesLen);
523
+ const r = [];
524
+ for (let i = 0; i < a.length; i += coder.bytesLen)
525
+ r.push(coder.decode(a.subarray(i, i + coder.bytesLen)));
526
+ return r;
527
+ }
528
+ };
529
+ }
530
+ function cleanBytes(...list) {
531
+ for (const t of list) {
532
+ if (Array.isArray(t))
533
+ for (const b of t)
534
+ b.fill(0);
535
+ else
536
+ t.fill(0);
537
+ }
538
+ }
539
+ function getMask(bits) {
540
+ if (!Number.isSafeInteger(bits) || bits < 0 || bits > 32)
541
+ throw new RangeError(`expected bits in [0..32], got ${bits}`);
542
+ return bits === 32 ? 4294967295 : ~(-1 << bits) >>> 0;
543
+ }
544
+ function getMessage(msg, ctx = EMPTY) {
545
+ abytes(msg);
546
+ abytes(ctx);
547
+ if (ctx.length > 255)
548
+ throw new RangeError("context should be 255 bytes or less");
549
+ return concatBytes(new Uint8Array([0, ctx.length]), ctx, msg);
550
+ }
551
+ function checkHash(hash, requiredStrength = 0) {
552
+ if (!hash.oid || !equalBytes(hash.oid.subarray(0, 10), oidNistP))
553
+ throw new Error("hash.oid is invalid: expected NIST hash");
554
+ const collisionResistance = hash.outputLen * 8 / 2;
555
+ if (requiredStrength > collisionResistance) {
556
+ throw new Error("Pre-hash security strength too low: " + collisionResistance + ", required: " + requiredStrength);
557
+ }
558
+ }
559
+ function getMessagePrehash(hash, msg, ctx = EMPTY) {
560
+ abytes(msg);
561
+ abytes(ctx);
562
+ if (ctx.length > 255)
563
+ throw new RangeError("context should be 255 bytes or less");
564
+ const hashed = hash(msg);
565
+ return concatBytes(new Uint8Array([1, ctx.length]), ctx, hash.oid, hashed);
566
+ }
567
+ var abytesDoc, randomBytes2, EMPTY, oidNistP;
568
+ var init_utils3 = chunkHCCQLAA4_cjs.__esm({
569
+ "../../node_modules/.pnpm/@noble+post-quantum@0.6.1/node_modules/@noble/post-quantum/utils.js"() {
570
+ init_utils();
571
+ abytesDoc = abytes;
572
+ randomBytes2 = randomBytes;
573
+ EMPTY = /* @__PURE__ */ Uint8Array.of();
574
+ oidNistP = /* @__PURE__ */ Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2]);
575
+ }
576
+ });
577
+
578
+ // ../../node_modules/.pnpm/@noble+post-quantum@0.6.1/node_modules/@noble/post-quantum/_crystals.js
579
+ var genCrystals, createXofShake, XOF128, XOF256;
580
+ var init_crystals = chunkHCCQLAA4_cjs.__esm({
581
+ "../../node_modules/.pnpm/@noble+post-quantum@0.6.1/node_modules/@noble/post-quantum/_crystals.js"() {
582
+ init_fft();
583
+ init_sha3();
584
+ init_utils3();
585
+ genCrystals = (opts) => {
586
+ const { newPoly: newPoly2, N: N2, Q: Q2, F: F2, ROOT_OF_UNITY: ROOT_OF_UNITY2, brvBits, isKyber } = opts;
587
+ const mod = (a, modulo = Q2) => {
588
+ const result = a % modulo | 0;
589
+ return (result >= 0 ? result | 0 : modulo + result | 0) | 0;
590
+ };
591
+ const smod = (a, modulo = Q2) => {
592
+ const r = mod(a, modulo) | 0;
593
+ return (r > modulo >> 1 ? r - modulo | 0 : r) | 0;
594
+ };
595
+ function getZettas() {
596
+ const out = newPoly2(N2);
597
+ for (let i = 0; i < N2; i++) {
598
+ const b = reverseBits(i, brvBits);
599
+ const p = BigInt(ROOT_OF_UNITY2) ** BigInt(b) % BigInt(Q2);
600
+ out[i] = Number(p) | 0;
601
+ }
602
+ return out;
603
+ }
604
+ const nttZetas = getZettas();
605
+ const field = {
606
+ add: (a, b) => mod((a | 0) + (b | 0)) | 0,
607
+ sub: (a, b) => mod((a | 0) - (b | 0)) | 0,
608
+ mul: (a, b) => mod((a | 0) * (b | 0)) | 0,
609
+ inv: (_a) => {
610
+ throw new Error("not implemented");
611
+ }
612
+ };
613
+ const nttOpts = {
614
+ N: N2,
615
+ roots: nttZetas,
616
+ invertButterflies: true,
617
+ skipStages: isKyber ? 1 : 0,
618
+ brp: false
619
+ };
620
+ const dif = FFTCore(field, { dit: false, ...nttOpts });
621
+ const dit = FFTCore(field, { dit: true, ...nttOpts });
622
+ const NTT = {
623
+ encode: (r) => {
624
+ return dif(r);
625
+ },
626
+ decode: (r) => {
627
+ dit(r);
628
+ for (let i = 0; i < r.length; i++)
629
+ r[i] = mod(F2 * r[i]);
630
+ return r;
631
+ }
632
+ };
633
+ const bitsCoder = (d, c) => {
634
+ const mask = getMask(d);
635
+ const bytesLen = d * (N2 / 8);
636
+ return {
637
+ bytesLen,
638
+ encode: (poly_) => {
639
+ const poly = poly_;
640
+ const r = new Uint8Array(bytesLen);
641
+ for (let i = 0, buf = 0, bufLen = 0, pos = 0; i < poly.length; i++) {
642
+ buf |= (c.encode(poly[i]) & mask) << bufLen;
643
+ bufLen += d;
644
+ for (; bufLen >= 8; bufLen -= 8, buf >>= 8)
645
+ r[pos++] = buf & getMask(bufLen);
646
+ }
647
+ return r;
648
+ },
649
+ decode: (bytes) => {
650
+ const r = newPoly2(N2);
651
+ for (let i = 0, buf = 0, bufLen = 0, pos = 0; i < bytes.length; i++) {
652
+ buf |= bytes[i] << bufLen;
653
+ bufLen += 8;
654
+ for (; bufLen >= d; bufLen -= d, buf >>= d)
655
+ r[pos++] = c.decode(buf & mask);
656
+ }
657
+ return r;
658
+ }
659
+ };
660
+ };
661
+ return {
662
+ mod,
663
+ smod,
664
+ nttZetas,
665
+ NTT: {
666
+ encode: (r) => NTT.encode(r),
667
+ decode: (r) => NTT.decode(r)
668
+ },
669
+ bitsCoder
670
+ };
671
+ };
672
+ createXofShake = (shake) => (seed, blockLen) => {
673
+ if (!blockLen)
674
+ blockLen = shake.blockLen;
675
+ const _seed = new Uint8Array(seed.length + 2);
676
+ _seed.set(seed);
677
+ const seedLen = seed.length;
678
+ const buf = new Uint8Array(blockLen);
679
+ let h = shake.create({});
680
+ let calls = 0;
681
+ let xofs = 0;
682
+ return {
683
+ stats: () => ({ calls, xofs }),
684
+ get: (x, y) => {
685
+ _seed[seedLen + 0] = x;
686
+ _seed[seedLen + 1] = y;
687
+ h.destroy();
688
+ h = shake.create({}).update(_seed);
689
+ calls++;
690
+ return () => {
691
+ xofs++;
692
+ return h.xofInto(buf);
693
+ };
694
+ },
695
+ clean: () => {
696
+ h.destroy();
697
+ cleanBytes(buf, _seed);
698
+ }
699
+ };
700
+ };
701
+ XOF128 = /* @__PURE__ */ createXofShake(shake128);
702
+ XOF256 = /* @__PURE__ */ createXofShake(shake256);
703
+ }
704
+ });
705
+
706
+ // ../../node_modules/.pnpm/@noble+post-quantum@0.6.1/node_modules/@noble/post-quantum/ml-dsa.js
707
+ function validateInternalOpts(opts) {
708
+ validateOpts(opts);
709
+ if (opts.externalMu !== void 0)
710
+ abool(opts.externalMu, "opts.externalMu");
711
+ }
712
+ function RejNTTPoly(xof_) {
713
+ const xof = xof_;
714
+ const r = newPoly(N);
715
+ for (let j = 0; j < N; ) {
716
+ const b = xof();
717
+ if (b.length % 3)
718
+ throw new Error("RejNTTPoly: unaligned block");
719
+ for (let i = 0; j < N && i <= b.length - 3; i += 3) {
720
+ const t = (b[i + 0] | b[i + 1] << 8 | b[i + 2] << 16) & 8388607;
721
+ if (t < Q)
722
+ r[j++] = t;
723
+ }
724
+ }
725
+ return r;
726
+ }
727
+ function getDilithium(opts_) {
728
+ const opts = opts_;
729
+ const { K, L, GAMMA1, GAMMA2, TAU, ETA, OMEGA } = opts;
730
+ const { CRH_BYTES, TR_BYTES, C_TILDE_BYTES, XOF128: XOF1282, XOF256: XOF2562, securityLevel } = opts;
731
+ if (![2, 4].includes(ETA))
732
+ throw new Error("Wrong ETA");
733
+ if (![1 << 17, 1 << 19].includes(GAMMA1))
734
+ throw new Error("Wrong GAMMA1");
735
+ if (![GAMMA2_1, GAMMA2_2].includes(GAMMA2))
736
+ throw new Error("Wrong GAMMA2");
737
+ const BETA = TAU * ETA;
738
+ const decompose = (r) => {
739
+ const rPlus = crystals.mod(r);
740
+ const r0 = crystals.smod(rPlus, 2 * GAMMA2) | 0;
741
+ if (rPlus - r0 === Q - 1)
742
+ return { r1: 0 | 0, r0: r0 - 1 | 0 };
743
+ const r1 = Math.floor((rPlus - r0) / (2 * GAMMA2)) | 0;
744
+ return { r1, r0 };
745
+ };
746
+ const HighBits = (r) => decompose(r).r1;
747
+ const LowBits = (r) => decompose(r).r0;
748
+ const MakeHint = (z, r) => {
749
+ const res0 = z <= GAMMA2 || z > Q - GAMMA2 || z === Q - GAMMA2 && r === 0 ? 0 : 1;
750
+ return res0;
751
+ };
752
+ const UseHint = (h, r) => {
753
+ const m = Math.floor((Q - 1) / (2 * GAMMA2));
754
+ const { r1, r0 } = decompose(r);
755
+ if (h === 1)
756
+ return r0 > 0 ? crystals.mod(r1 + 1, m) | 0 : crystals.mod(r1 - 1, m) | 0;
757
+ return r1 | 0;
758
+ };
759
+ const Power2Round = (r) => {
760
+ const rPlus = crystals.mod(r);
761
+ const r0 = crystals.smod(rPlus, 2 ** D) | 0;
762
+ return { r1: Math.floor((rPlus - r0) / 2 ** D) | 0, r0 };
763
+ };
764
+ const hintCoder = {
765
+ bytesLen: OMEGA + K,
766
+ encode: (h_) => {
767
+ const h = h_;
768
+ if (h === false)
769
+ throw new Error("hint.encode: hint is false");
770
+ const res = new Uint8Array(OMEGA + K);
771
+ for (let i = 0, k = 0; i < K; i++) {
772
+ for (let j = 0; j < N; j++)
773
+ if (h[i][j] !== 0)
774
+ res[k++] = j;
775
+ res[OMEGA + i] = k;
776
+ }
777
+ return res;
778
+ },
779
+ decode: (buf) => {
780
+ const h = [];
781
+ let k = 0;
782
+ for (let i = 0; i < K; i++) {
783
+ const hi = newPoly(N);
784
+ if (buf[OMEGA + i] < k || buf[OMEGA + i] > OMEGA)
785
+ return false;
786
+ for (let j = k; j < buf[OMEGA + i]; j++) {
787
+ if (j > k && buf[j] <= buf[j - 1])
788
+ return false;
789
+ hi[buf[j]] = 1;
790
+ }
791
+ k = buf[OMEGA + i];
792
+ h.push(hi);
793
+ }
794
+ for (let j = k; j < OMEGA; j++)
795
+ if (buf[j] !== 0)
796
+ return false;
797
+ return h;
798
+ }
799
+ };
800
+ const ETACoder = polyCoder(ETA === 2 ? 3 : 4, (i) => ETA - i, (i) => {
801
+ if (!(-ETA <= i && i <= ETA))
802
+ throw new Error(`malformed key s1/s3 ${i} outside of ETA range [${-ETA}, ${ETA}]`);
803
+ return i;
804
+ });
805
+ const T0Coder = polyCoder(13, (i) => (1 << D - 1) - i);
806
+ const T1Coder = polyCoder(10);
807
+ const ZCoder = polyCoder(GAMMA1 === 1 << 17 ? 18 : 20, (i) => crystals.smod(GAMMA1 - i));
808
+ const W1Coder = polyCoder(GAMMA2 === GAMMA2_1 ? 6 : 4);
809
+ const W1Vec = vecCoder(W1Coder, K);
810
+ const publicCoder = splitCoder("publicKey", 32, vecCoder(T1Coder, K));
811
+ const secretCoder = splitCoder("secretKey", 32, 32, TR_BYTES, vecCoder(ETACoder, L), vecCoder(ETACoder, K), vecCoder(T0Coder, K));
812
+ const sigCoder = splitCoder("signature", C_TILDE_BYTES, vecCoder(ZCoder, L), hintCoder);
813
+ const CoefFromHalfByte = ETA === 2 ? (n) => n < 15 ? 2 - n % 5 : false : (n) => n < 9 ? 4 - n : false;
814
+ function RejBoundedPoly(xof_) {
815
+ const xof = xof_;
816
+ const r = newPoly(N);
817
+ for (let j = 0; j < N; ) {
818
+ const b = xof();
819
+ for (let i = 0; j < N && i < b.length; i += 1) {
820
+ const d1 = CoefFromHalfByte(b[i] & 15);
821
+ const d2 = CoefFromHalfByte(b[i] >> 4 & 15);
822
+ if (d1 !== false)
823
+ r[j++] = d1;
824
+ if (j < N && d2 !== false)
825
+ r[j++] = d2;
826
+ }
827
+ }
828
+ return r;
829
+ }
830
+ const SampleInBall = (seed) => {
831
+ const pre = newPoly(N);
832
+ const s = shake256.create({}).update(seed);
833
+ const buf = new Uint8Array(shake256.blockLen);
834
+ s.xofInto(buf);
835
+ const masks = buf.slice(0, 8);
836
+ for (let i = N - TAU, pos = 8, maskPos = 0, maskBit = 0; i < N; i++) {
837
+ let b = i + 1;
838
+ for (; b > i; ) {
839
+ b = buf[pos++];
840
+ if (pos < shake256.blockLen)
841
+ continue;
842
+ s.xofInto(buf);
843
+ pos = 0;
844
+ }
845
+ pre[i] = pre[b];
846
+ pre[b] = 1 - ((masks[maskPos] >> maskBit++ & 1) << 1);
847
+ if (maskBit >= 8) {
848
+ maskPos++;
849
+ maskBit = 0;
850
+ }
851
+ }
852
+ return pre;
853
+ };
854
+ const polyPowerRound = (p_) => {
855
+ const p = p_;
856
+ const res0 = newPoly(N);
857
+ const res1 = newPoly(N);
858
+ for (let i = 0; i < p.length; i++) {
859
+ const { r0, r1 } = Power2Round(p[i]);
860
+ res0[i] = r0;
861
+ res1[i] = r1;
862
+ }
863
+ return { r0: res0, r1: res1 };
864
+ };
865
+ const polyUseHint = (u_, h_) => {
866
+ const u = u_;
867
+ const h = h_;
868
+ for (let i = 0; i < N; i++)
869
+ u[i] = UseHint(h[i], u[i]);
870
+ return u;
871
+ };
872
+ const polyMakeHint = (a_, b_) => {
873
+ const a = a_;
874
+ const b = b_;
875
+ const v = newPoly(N);
876
+ let cnt = 0;
877
+ for (let i = 0; i < N; i++) {
878
+ const h = MakeHint(a[i], b[i]);
879
+ v[i] = h;
880
+ cnt += h;
881
+ }
882
+ return { v, cnt };
883
+ };
884
+ const signRandBytes = 32;
885
+ const seedCoder = splitCoder("seed", 32, 64, 32);
886
+ const internal = Object.freeze({
887
+ info: Object.freeze({ type: "internal-ml-dsa" }),
888
+ lengths: Object.freeze({
889
+ secretKey: secretCoder.bytesLen,
890
+ publicKey: publicCoder.bytesLen,
891
+ seed: 32,
892
+ signature: sigCoder.bytesLen,
893
+ signRand: signRandBytes
894
+ }),
895
+ keygen: (seed) => {
896
+ const seedDst = new Uint8Array(32 + 2);
897
+ const randSeed = seed === void 0;
898
+ if (randSeed)
899
+ seed = randomBytes2(32);
900
+ abytesDoc(seed, 32, "seed");
901
+ seedDst.set(seed);
902
+ if (randSeed)
903
+ cleanBytes(seed);
904
+ seedDst[32] = K;
905
+ seedDst[33] = L;
906
+ const [rho, rhoPrime, K_] = seedCoder.decode(shake256(seedDst, { dkLen: seedCoder.bytesLen }));
907
+ const xofPrime = XOF2562(rhoPrime);
908
+ const s1 = [];
909
+ for (let i = 0; i < L; i++)
910
+ s1.push(RejBoundedPoly(xofPrime.get(i & 255, i >> 8 & 255)));
911
+ const s2 = [];
912
+ for (let i = L; i < L + K; i++)
913
+ s2.push(RejBoundedPoly(xofPrime.get(i & 255, i >> 8 & 255)));
914
+ const s1Hat = s1.map((i) => crystals.NTT.encode(i.slice()));
915
+ const t0 = [];
916
+ const t1 = [];
917
+ const xof = XOF1282(rho);
918
+ const t = newPoly(N);
919
+ for (let i = 0; i < K; i++) {
920
+ cleanBytes(t);
921
+ for (let j = 0; j < L; j++) {
922
+ const aij = RejNTTPoly(xof.get(j, i));
923
+ polyAdd(t, MultiplyNTTs(aij, s1Hat[j]));
924
+ }
925
+ crystals.NTT.decode(t);
926
+ const { r0, r1 } = polyPowerRound(polyAdd(t, s2[i]));
927
+ t0.push(r0);
928
+ t1.push(r1);
929
+ }
930
+ const publicKey = publicCoder.encode([rho, t1]);
931
+ const tr = shake256(publicKey, { dkLen: TR_BYTES });
932
+ const secretKey = secretCoder.encode([rho, K_, tr, s1, s2, t0]);
933
+ xof.clean();
934
+ xofPrime.clean();
935
+ cleanBytes(rho, rhoPrime, K_, s1, s2, s1Hat, t, t0, t1, tr, seedDst);
936
+ return {
937
+ publicKey,
938
+ secretKey
939
+ };
940
+ },
941
+ getPublicKey: (secretKey) => {
942
+ const [rho, _K, _tr, s1, s2, _t0] = secretCoder.decode(secretKey);
943
+ const xof = XOF1282(rho);
944
+ const s1Hat = s1.map((p) => crystals.NTT.encode(p.slice()));
945
+ const t1 = [];
946
+ const tmp = newPoly(N);
947
+ for (let i = 0; i < K; i++) {
948
+ tmp.fill(0);
949
+ for (let j = 0; j < L; j++) {
950
+ const aij = RejNTTPoly(xof.get(j, i));
951
+ polyAdd(tmp, MultiplyNTTs(aij, s1Hat[j]));
952
+ }
953
+ crystals.NTT.decode(tmp);
954
+ polyAdd(tmp, s2[i]);
955
+ const { r1 } = polyPowerRound(tmp);
956
+ t1.push(r1);
957
+ }
958
+ xof.clean();
959
+ cleanBytes(tmp, s1Hat, _t0, s1, s2);
960
+ return publicCoder.encode([rho, t1]);
961
+ },
962
+ // NOTE: random is optional.
963
+ sign: (msg, secretKey, opts2 = {}) => {
964
+ validateSigOpts(opts2);
965
+ validateInternalOpts(opts2);
966
+ let { extraEntropy: random, externalMu = false } = opts2;
967
+ const [rho, _K, tr, s1, s2, t0] = secretCoder.decode(secretKey);
968
+ const A = [];
969
+ const xof = XOF1282(rho);
970
+ for (let i = 0; i < K; i++) {
971
+ const pv = [];
972
+ for (let j = 0; j < L; j++)
973
+ pv.push(RejNTTPoly(xof.get(j, i)));
974
+ A.push(pv);
975
+ }
976
+ xof.clean();
977
+ for (let i = 0; i < L; i++)
978
+ crystals.NTT.encode(s1[i]);
979
+ for (let i = 0; i < K; i++) {
980
+ crystals.NTT.encode(s2[i]);
981
+ crystals.NTT.encode(t0[i]);
982
+ }
983
+ const mu = externalMu ? msg : (
984
+ // 6: µ ← H(tr||M, 512)
985
+ // ▷ Compute message representative µ
986
+ shake256.create({ dkLen: CRH_BYTES }).update(tr).update(msg).digest()
987
+ );
988
+ const rnd = random === false ? new Uint8Array(32) : random === void 0 ? randomBytes2(signRandBytes) : random;
989
+ abytesDoc(rnd, 32, "extraEntropy");
990
+ const rhoprime = shake256.create({ dkLen: CRH_BYTES }).update(_K).update(rnd).update(mu).digest();
991
+ abytesDoc(rhoprime, CRH_BYTES);
992
+ const x256 = XOF2562(rhoprime, ZCoder.bytesLen);
993
+ main_loop: for (let kappa = 0; ; ) {
994
+ const y = [];
995
+ for (let i = 0; i < L; i++, kappa++)
996
+ y.push(ZCoder.decode(x256.get(kappa & 255, kappa >> 8)()));
997
+ const z = y.map((i) => crystals.NTT.encode(i.slice()));
998
+ const w = [];
999
+ for (let i = 0; i < K; i++) {
1000
+ const wi = newPoly(N);
1001
+ for (let j = 0; j < L; j++)
1002
+ polyAdd(wi, MultiplyNTTs(A[i][j], z[j]));
1003
+ crystals.NTT.decode(wi);
1004
+ w.push(wi);
1005
+ }
1006
+ const w1 = w.map((j) => j.map(HighBits));
1007
+ const cTilde = shake256.create({ dkLen: C_TILDE_BYTES }).update(mu).update(W1Vec.encode(w1)).digest();
1008
+ const cHat = crystals.NTT.encode(SampleInBall(cTilde));
1009
+ const cs1 = s1.map((i) => MultiplyNTTs(i, cHat));
1010
+ for (let i = 0; i < L; i++) {
1011
+ polyAdd(crystals.NTT.decode(cs1[i]), y[i]);
1012
+ if (polyChknorm(cs1[i], GAMMA1 - BETA))
1013
+ continue main_loop;
1014
+ }
1015
+ let cnt = 0;
1016
+ const h = [];
1017
+ for (let i = 0; i < K; i++) {
1018
+ const cs2 = crystals.NTT.decode(MultiplyNTTs(s2[i], cHat));
1019
+ const r0 = polySub(w[i], cs2).map(LowBits);
1020
+ if (polyChknorm(r0, GAMMA2 - BETA))
1021
+ continue main_loop;
1022
+ const ct0 = crystals.NTT.decode(MultiplyNTTs(t0[i], cHat));
1023
+ if (polyChknorm(ct0, GAMMA2))
1024
+ continue main_loop;
1025
+ polyAdd(r0, ct0);
1026
+ const hint = polyMakeHint(r0, w1[i]);
1027
+ h.push(hint.v);
1028
+ cnt += hint.cnt;
1029
+ }
1030
+ if (cnt > OMEGA)
1031
+ continue;
1032
+ x256.clean();
1033
+ const res = sigCoder.encode([cTilde, cs1, h]);
1034
+ cleanBytes(cTilde, cs1, h, cHat, w1, w, z, y, rhoprime, s1, s2, t0, ...A);
1035
+ if (!externalMu)
1036
+ cleanBytes(mu);
1037
+ return res;
1038
+ }
1039
+ throw new Error("Unreachable code path reached, report this error");
1040
+ },
1041
+ verify: (sig, msg, publicKey, opts2 = {}) => {
1042
+ validateInternalOpts(opts2);
1043
+ const { externalMu = false } = opts2;
1044
+ const [rho, t1] = publicCoder.decode(publicKey);
1045
+ const tr = shake256(publicKey, { dkLen: TR_BYTES });
1046
+ if (sig.length !== sigCoder.bytesLen)
1047
+ return false;
1048
+ const [cTilde, z, h] = sigCoder.decode(sig);
1049
+ if (h === false)
1050
+ return false;
1051
+ for (let i = 0; i < L; i++)
1052
+ if (polyChknorm(z[i], GAMMA1 - BETA))
1053
+ return false;
1054
+ const mu = externalMu ? msg : (
1055
+ // 7: µ ← H(tr||M, 512)
1056
+ shake256.create({ dkLen: CRH_BYTES }).update(tr).update(msg).digest()
1057
+ );
1058
+ const c = crystals.NTT.encode(SampleInBall(cTilde));
1059
+ const zNtt = z.map((i) => i.slice());
1060
+ for (let i = 0; i < L; i++)
1061
+ crystals.NTT.encode(zNtt[i]);
1062
+ const wTick1 = [];
1063
+ const xof = XOF1282(rho);
1064
+ for (let i = 0; i < K; i++) {
1065
+ const ct12d = MultiplyNTTs(crystals.NTT.encode(polyShiftl(t1[i])), c);
1066
+ const Az = newPoly(N);
1067
+ for (let j = 0; j < L; j++) {
1068
+ const aij = RejNTTPoly(xof.get(j, i));
1069
+ polyAdd(Az, MultiplyNTTs(aij, zNtt[j]));
1070
+ }
1071
+ const wApprox = crystals.NTT.decode(polySub(Az, ct12d));
1072
+ wTick1.push(polyUseHint(wApprox, h[i]));
1073
+ }
1074
+ xof.clean();
1075
+ const c2 = shake256.create({ dkLen: C_TILDE_BYTES }).update(mu).update(W1Vec.encode(wTick1)).digest();
1076
+ for (const t of h) {
1077
+ const sum = t.reduce((acc, i) => acc + i, 0);
1078
+ if (!(sum <= OMEGA))
1079
+ return false;
1080
+ }
1081
+ for (const t of z)
1082
+ if (polyChknorm(t, GAMMA1 - BETA))
1083
+ return false;
1084
+ return equalBytes(cTilde, c2);
1085
+ }
1086
+ });
1087
+ return Object.freeze({
1088
+ info: Object.freeze({ type: "ml-dsa" }),
1089
+ internal,
1090
+ securityLevel,
1091
+ keygen: internal.keygen,
1092
+ lengths: internal.lengths,
1093
+ getPublicKey: internal.getPublicKey,
1094
+ sign: (msg, secretKey, opts2 = {}) => {
1095
+ validateSigOpts(opts2);
1096
+ const M = getMessage(msg, opts2.context);
1097
+ const res = internal.sign(M, secretKey, opts2);
1098
+ cleanBytes(M);
1099
+ return res;
1100
+ },
1101
+ verify: (sig, msg, publicKey, opts2 = {}) => {
1102
+ validateVerOpts(opts2);
1103
+ return internal.verify(sig, getMessage(msg, opts2.context), publicKey);
1104
+ },
1105
+ prehash: (hash) => {
1106
+ checkHash(hash, securityLevel);
1107
+ return Object.freeze({
1108
+ info: Object.freeze({ type: "hashml-dsa" }),
1109
+ securityLevel,
1110
+ lengths: internal.lengths,
1111
+ keygen: internal.keygen,
1112
+ getPublicKey: internal.getPublicKey,
1113
+ sign: (msg, secretKey, opts2 = {}) => {
1114
+ validateSigOpts(opts2);
1115
+ const M = getMessagePrehash(hash, msg, opts2.context);
1116
+ const res = internal.sign(M, secretKey, opts2);
1117
+ cleanBytes(M);
1118
+ return res;
1119
+ },
1120
+ verify: (sig, msg, publicKey, opts2 = {}) => {
1121
+ validateVerOpts(opts2);
1122
+ return internal.verify(sig, getMessagePrehash(hash, msg, opts2.context), publicKey);
1123
+ }
1124
+ });
1125
+ }
1126
+ });
1127
+ }
1128
+ var N, Q, ROOT_OF_UNITY, F, D, GAMMA2_1, GAMMA2_2; exports.PARAMS = void 0; var newPoly, crystals, id, polyCoder, polyAdd, polySub, polyShiftl, polyChknorm, MultiplyNTTs; exports.ml_dsa44 = void 0; exports.ml_dsa65 = void 0; exports.ml_dsa87 = void 0;
1129
+ var init_ml_dsa = chunkHCCQLAA4_cjs.__esm({
1130
+ "../../node_modules/.pnpm/@noble+post-quantum@0.6.1/node_modules/@noble/post-quantum/ml-dsa.js"() {
1131
+ init_utils2();
1132
+ init_sha3();
1133
+ init_crystals();
1134
+ init_utils3();
1135
+ N = 256;
1136
+ Q = 8380417;
1137
+ ROOT_OF_UNITY = 1753;
1138
+ F = 8347681;
1139
+ D = 13;
1140
+ GAMMA2_1 = Math.floor((Q - 1) / 88) | 0;
1141
+ GAMMA2_2 = Math.floor((Q - 1) / 32) | 0;
1142
+ exports.PARAMS = /* @__PURE__ */ (() => Object.freeze({
1143
+ 2: Object.freeze({
1144
+ K: 4,
1145
+ L: 4,
1146
+ D,
1147
+ GAMMA1: 2 ** 17,
1148
+ GAMMA2: GAMMA2_1,
1149
+ TAU: 39,
1150
+ ETA: 2,
1151
+ OMEGA: 80
1152
+ }),
1153
+ 3: Object.freeze({
1154
+ K: 6,
1155
+ L: 5,
1156
+ D,
1157
+ GAMMA1: 2 ** 19,
1158
+ GAMMA2: GAMMA2_2,
1159
+ TAU: 49,
1160
+ ETA: 4,
1161
+ OMEGA: 55
1162
+ }),
1163
+ 5: Object.freeze({
1164
+ K: 8,
1165
+ L: 7,
1166
+ D,
1167
+ GAMMA1: 2 ** 19,
1168
+ GAMMA2: GAMMA2_2,
1169
+ TAU: 60,
1170
+ ETA: 2,
1171
+ OMEGA: 75
1172
+ })
1173
+ }))();
1174
+ newPoly = (n) => new Int32Array(n);
1175
+ crystals = /* @__PURE__ */ genCrystals({
1176
+ N,
1177
+ Q,
1178
+ F,
1179
+ ROOT_OF_UNITY,
1180
+ newPoly,
1181
+ isKyber: false,
1182
+ brvBits: 8
1183
+ });
1184
+ id = (n) => n;
1185
+ polyCoder = (d, compress = id, verify = id) => crystals.bitsCoder(d, {
1186
+ encode: (i) => compress(verify(i)),
1187
+ decode: (i) => verify(compress(i))
1188
+ });
1189
+ polyAdd = (a_, b_) => {
1190
+ const a = a_;
1191
+ const b = b_;
1192
+ for (let i = 0; i < a.length; i++)
1193
+ a[i] = crystals.mod(a[i] + b[i]);
1194
+ return a;
1195
+ };
1196
+ polySub = (a_, b_) => {
1197
+ const a = a_;
1198
+ const b = b_;
1199
+ for (let i = 0; i < a.length; i++)
1200
+ a[i] = crystals.mod(a[i] - b[i]);
1201
+ return a;
1202
+ };
1203
+ polyShiftl = (p_) => {
1204
+ const p = p_;
1205
+ for (let i = 0; i < N; i++)
1206
+ p[i] <<= D;
1207
+ return p;
1208
+ };
1209
+ polyChknorm = (p_, B) => {
1210
+ const p = p_;
1211
+ for (let i = 0; i < N; i++)
1212
+ if (Math.abs(crystals.smod(p[i])) >= B)
1213
+ return true;
1214
+ return false;
1215
+ };
1216
+ MultiplyNTTs = (a_, b_) => {
1217
+ const a = a_;
1218
+ const b = b_;
1219
+ const c = newPoly(N);
1220
+ for (let i = 0; i < a.length; i++)
1221
+ c[i] = crystals.mod(a[i] * b[i]);
1222
+ return c;
1223
+ };
1224
+ exports.ml_dsa44 = /* @__PURE__ */ (() => getDilithium({
1225
+ ...exports.PARAMS[2],
1226
+ CRH_BYTES: 64,
1227
+ TR_BYTES: 64,
1228
+ C_TILDE_BYTES: 32,
1229
+ XOF128,
1230
+ XOF256,
1231
+ securityLevel: 128
1232
+ }))();
1233
+ exports.ml_dsa65 = /* @__PURE__ */ (() => getDilithium({
1234
+ ...exports.PARAMS[3],
1235
+ CRH_BYTES: 64,
1236
+ TR_BYTES: 64,
1237
+ C_TILDE_BYTES: 48,
1238
+ XOF128,
1239
+ XOF256,
1240
+ securityLevel: 192
1241
+ }))();
1242
+ exports.ml_dsa87 = /* @__PURE__ */ (() => getDilithium({
1243
+ ...exports.PARAMS[5],
1244
+ CRH_BYTES: 64,
1245
+ TR_BYTES: 64,
1246
+ C_TILDE_BYTES: 64,
1247
+ XOF128,
1248
+ XOF256,
1249
+ securityLevel: 256
1250
+ }))();
1251
+ }
1252
+ });
1253
+ init_ml_dsa();
1254
+ /*! Bundled license information:
1255
+
1256
+ @noble/curves/utils.js:
1257
+ (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
1258
+
1259
+ @noble/post-quantum/utils.js:
1260
+ @noble/post-quantum/_crystals.js:
1261
+ @noble/post-quantum/ml-dsa.js:
1262
+ (*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) *)
1263
+ */
1264
+ //# sourceMappingURL=ml-dsa-FSKBTE3W.cjs.map
1265
+ //# sourceMappingURL=ml-dsa-FSKBTE3W.cjs.map