solve-engine 1.2.0 → 2.1.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 (385) hide show
  1. package/README.md +12 -17
  2. package/dist/{BytecodeBuilder-Bp9xeTmX.d.cts → BytecodeBuilder-DGGeByAP.d.cts} +18 -0
  3. package/dist/{BytecodeBuilder-Bp9xeTmX.d.ts → BytecodeBuilder-DGGeByAP.d.ts} +18 -0
  4. package/dist/{Configuration-C9W8tJv_.d.cts → Configuration-B6W0-T67.d.cts} +17 -4
  5. package/dist/{Configuration-C9W8tJv_.d.ts → Configuration-B6W0-T67.d.ts} +17 -4
  6. package/dist/{EngineError-CNA_rHY-.d.cts → EngineError-Ce1lPkjZ.d.cts} +2 -0
  7. package/dist/{EngineError-CNA_rHY-.d.ts → EngineError-Ce1lPkjZ.d.ts} +2 -0
  8. package/dist/{PackageCompatibility-B6NX9IaN.d.cts → PackageCompatibility-Bn5jnBtA.d.cts} +2 -2
  9. package/dist/{PackageCompatibility-Ceg5XdAp.d.ts → PackageCompatibility-CIvq2MP5.d.ts} +2 -2
  10. package/dist/{PackageRegistry-DrCPQNyy.d.ts → PackageRegistry-DzeiWcv4.d.ts} +93 -172
  11. package/dist/{PackageRegistry-DnJYVw9G.d.cts → PackageRegistry-dpdurBVO.d.cts} +93 -172
  12. package/dist/{Parselet-Bhf7d0_W.d.ts → Parselet-B-zoPrTa.d.ts} +8 -5
  13. package/dist/{Parselet-Cv7S7KRt.d.cts → Parselet-C4Wu055_.d.cts} +8 -5
  14. package/dist/{ScopeManager-Bzq87GfA.d.ts → ScopeManager-C2LDOrDx.d.ts} +7 -16
  15. package/dist/{ScopeManager-DRDBVfan.d.cts → ScopeManager-D7uMXbhS.d.cts} +7 -16
  16. package/dist/{VMCheckpoints-C6c17Hbo.d.ts → VMCheckpoints-CGyFhivM.d.ts} +3 -3
  17. package/dist/{VMCheckpoints-dZxSMGHG.d.cts → VMCheckpoints-I9jg3jWR.d.cts} +3 -3
  18. package/dist/{Value-DZNQ_PU7.d.cts → Value-CCi_Eecs.d.cts} +40 -0
  19. package/dist/{Value-DZNQ_PU7.d.ts → Value-CCi_Eecs.d.ts} +40 -0
  20. package/dist/{WorkerError-Djd7GGGa.d.cts → WorkerError-B4p6PNfx.d.cts} +1 -1
  21. package/dist/{WorkerError-B7t7R2-m.d.ts → WorkerError-Dhj9BQ_A.d.ts} +1 -1
  22. package/dist/chunk-2JMFUQZH.js +2 -0
  23. package/dist/chunk-2JMFUQZH.js.map +1 -0
  24. package/dist/chunk-2LFLR3VZ.cjs +2 -0
  25. package/dist/chunk-2LFLR3VZ.cjs.map +1 -0
  26. package/dist/chunk-2RWAXT6O.js +0 -1
  27. package/dist/chunk-32GC2FHC.cjs +2 -0
  28. package/dist/chunk-32GC2FHC.cjs.map +1 -0
  29. package/dist/chunk-4BZIYU7S.cjs +3 -0
  30. package/dist/chunk-4BZIYU7S.cjs.map +1 -0
  31. package/dist/chunk-4E4YVQKK.js +5 -0
  32. package/dist/chunk-4E4YVQKK.js.map +1 -0
  33. package/dist/chunk-4QVBSG6B.cjs +2 -0
  34. package/dist/chunk-4QVBSG6B.cjs.map +1 -0
  35. package/dist/chunk-5FO4PDIG.js +2 -0
  36. package/dist/chunk-5FO4PDIG.js.map +1 -0
  37. package/dist/chunk-5IJD5L3O.cjs +2 -0
  38. package/dist/chunk-5IJD5L3O.cjs.map +1 -0
  39. package/dist/chunk-62LMTO4F.js +2 -0
  40. package/dist/chunk-62LMTO4F.js.map +1 -0
  41. package/dist/chunk-6G3PMEPA.js +2 -0
  42. package/dist/chunk-6G3PMEPA.js.map +1 -0
  43. package/dist/chunk-6INX773F.cjs +2 -0
  44. package/dist/chunk-6INX773F.cjs.map +1 -0
  45. package/dist/chunk-76F3LCIL.js +4 -0
  46. package/dist/chunk-76F3LCIL.js.map +1 -0
  47. package/dist/chunk-7BXPCWKM.cjs +2 -0
  48. package/dist/chunk-7BXPCWKM.cjs.map +1 -0
  49. package/dist/chunk-7GK3XEZF.js +2 -0
  50. package/dist/chunk-7GK3XEZF.js.map +1 -0
  51. package/dist/chunk-AXMQG5TS.cjs +2 -0
  52. package/dist/chunk-AXMQG5TS.cjs.map +1 -0
  53. package/dist/chunk-CIQOK7Q4.cjs +2 -0
  54. package/dist/chunk-CIQOK7Q4.cjs.map +1 -0
  55. package/dist/chunk-E2Q3PQ2G.js +3 -0
  56. package/dist/chunk-E2Q3PQ2G.js.map +1 -0
  57. package/dist/chunk-E6Z4NQAS.js +2 -0
  58. package/dist/chunk-E6Z4NQAS.js.map +1 -0
  59. package/dist/chunk-EFJCC6FJ.cjs +2 -0
  60. package/dist/chunk-EFJCC6FJ.cjs.map +1 -0
  61. package/dist/chunk-ESUN2THE.cjs +2 -0
  62. package/dist/chunk-ESUN2THE.cjs.map +1 -0
  63. package/dist/chunk-EVAOPEO4.js +2 -0
  64. package/dist/chunk-EVAOPEO4.js.map +1 -0
  65. package/dist/chunk-EVI6OHQH.cjs +2 -0
  66. package/dist/chunk-EVI6OHQH.cjs.map +1 -0
  67. package/dist/chunk-FDE5HWDI.cjs +2 -0
  68. package/dist/chunk-FDE5HWDI.cjs.map +1 -0
  69. package/dist/chunk-FWW3M36J.cjs +2 -0
  70. package/dist/chunk-FWW3M36J.cjs.map +1 -0
  71. package/dist/chunk-G7TBEQRQ.js +2 -0
  72. package/dist/chunk-G7TBEQRQ.js.map +1 -0
  73. package/dist/chunk-GK2OHWRF.cjs +5 -0
  74. package/dist/chunk-GK2OHWRF.cjs.map +1 -0
  75. package/dist/chunk-HFKDWQUL.js +2 -0
  76. package/dist/chunk-HFKDWQUL.js.map +1 -0
  77. package/dist/chunk-HLBYHXQD.cjs +3 -0
  78. package/dist/chunk-HLBYHXQD.cjs.map +1 -0
  79. package/dist/chunk-I52MYCVI.js +3 -0
  80. package/dist/chunk-I52MYCVI.js.map +1 -0
  81. package/dist/chunk-IANAMBJQ.cjs +2 -0
  82. package/dist/chunk-IANAMBJQ.cjs.map +1 -0
  83. package/dist/chunk-IJMNVBIS.js +2 -0
  84. package/dist/chunk-IJMNVBIS.js.map +1 -0
  85. package/dist/chunk-J4LZD4ZY.js +3 -0
  86. package/dist/chunk-J4LZD4ZY.js.map +1 -0
  87. package/dist/chunk-JAK3RAFA.cjs +2 -0
  88. package/dist/chunk-JAK3RAFA.cjs.map +1 -0
  89. package/dist/chunk-JFAJN3C2.cjs +2 -0
  90. package/dist/chunk-JFAJN3C2.cjs.map +1 -0
  91. package/dist/chunk-JPFCXLJV.js +2 -0
  92. package/dist/chunk-JPFCXLJV.js.map +1 -0
  93. package/dist/chunk-JUIJ6NRD.cjs +3 -0
  94. package/dist/chunk-JUIJ6NRD.cjs.map +1 -0
  95. package/dist/chunk-MIQBJGGR.js +2 -0
  96. package/dist/chunk-MIQBJGGR.js.map +1 -0
  97. package/dist/chunk-MPB7KUN5.js +3 -0
  98. package/dist/chunk-MPB7KUN5.js.map +1 -0
  99. package/dist/chunk-MSYX32PF.cjs +2 -0
  100. package/dist/chunk-MSYX32PF.cjs.map +1 -0
  101. package/dist/chunk-MVZUTETT.js +2 -0
  102. package/dist/chunk-MVZUTETT.js.map +1 -0
  103. package/dist/chunk-N7N7MPMK.cjs +2 -0
  104. package/dist/chunk-N7N7MPMK.cjs.map +1 -0
  105. package/dist/chunk-NGBBNL4K.cjs +1 -3
  106. package/dist/chunk-OVKDDTXO.cjs +3 -0
  107. package/dist/chunk-OVKDDTXO.cjs.map +1 -0
  108. package/dist/chunk-P6WPEUAJ.cjs +2 -0
  109. package/dist/chunk-P6WPEUAJ.cjs.map +1 -0
  110. package/dist/chunk-PS272DZJ.cjs +2 -0
  111. package/dist/chunk-PS272DZJ.cjs.map +1 -0
  112. package/dist/chunk-R2ENWQ76.js +2 -0
  113. package/dist/chunk-R2ENWQ76.js.map +1 -0
  114. package/dist/chunk-R2SZFJTT.cjs +2 -0
  115. package/dist/chunk-R2SZFJTT.cjs.map +1 -0
  116. package/dist/chunk-RAF57WYO.js +2 -0
  117. package/dist/chunk-RAF57WYO.js.map +1 -0
  118. package/dist/chunk-RSF25YSJ.js +2 -0
  119. package/dist/chunk-RSF25YSJ.js.map +1 -0
  120. package/dist/chunk-SOMGSIO4.cjs +3 -0
  121. package/dist/chunk-SOMGSIO4.cjs.map +1 -0
  122. package/dist/chunk-SYYE3QAX.cjs +2 -0
  123. package/dist/chunk-SYYE3QAX.cjs.map +1 -0
  124. package/dist/chunk-TCZSPH4A.js +2 -0
  125. package/dist/chunk-TCZSPH4A.js.map +1 -0
  126. package/dist/chunk-TLG7VZRX.cjs +2 -0
  127. package/dist/chunk-TLG7VZRX.cjs.map +1 -0
  128. package/dist/chunk-TN5E6JU6.js +2 -0
  129. package/dist/chunk-TN5E6JU6.js.map +1 -0
  130. package/dist/chunk-TRBXW6HW.js +2 -0
  131. package/dist/{chunk-AQNHHJMJ.cjs.map → chunk-TRBXW6HW.js.map} +1 -1
  132. package/dist/chunk-TTFO4YDP.cjs +2 -0
  133. package/dist/chunk-TTFO4YDP.cjs.map +1 -0
  134. package/dist/chunk-TWC7K3ZX.js +2 -0
  135. package/dist/chunk-TWC7K3ZX.js.map +1 -0
  136. package/dist/chunk-U4AEVL5Z.js +2 -0
  137. package/dist/chunk-U4AEVL5Z.js.map +1 -0
  138. package/dist/chunk-UURM7P3P.cjs +4 -0
  139. package/dist/chunk-UURM7P3P.cjs.map +1 -0
  140. package/dist/chunk-VAGS5JS7.cjs +2 -0
  141. package/dist/chunk-VAGS5JS7.cjs.map +1 -0
  142. package/dist/chunk-W2JAR233.js +2 -0
  143. package/dist/chunk-W2JAR233.js.map +1 -0
  144. package/dist/chunk-WGZ3FNHI.js +2 -0
  145. package/dist/chunk-WGZ3FNHI.js.map +1 -0
  146. package/dist/chunk-XEIDV5JP.js +2 -0
  147. package/dist/chunk-XEIDV5JP.js.map +1 -0
  148. package/dist/chunk-XNIWQHXY.js +2 -0
  149. package/dist/chunk-XNIWQHXY.js.map +1 -0
  150. package/dist/chunk-Y7O4D3BJ.cjs +2 -0
  151. package/dist/chunk-Y7O4D3BJ.cjs.map +1 -0
  152. package/dist/chunk-YAHGSBMC.js +2 -0
  153. package/dist/chunk-YAHGSBMC.js.map +1 -0
  154. package/dist/chunk-YAYBVVG2.js +3 -0
  155. package/dist/chunk-YAYBVVG2.js.map +1 -0
  156. package/dist/chunk-YJ2OPULK.js +2 -0
  157. package/dist/chunk-YJ2OPULK.js.map +1 -0
  158. package/dist/chunk-YVKHEAFT.js +2 -0
  159. package/dist/chunk-YVKHEAFT.js.map +1 -0
  160. package/dist/chunk-ZCNBT44X.cjs +2 -0
  161. package/dist/chunk-ZCNBT44X.cjs.map +1 -0
  162. package/dist/chunk-ZLRJ7TDP.cjs +2 -0
  163. package/dist/chunk-ZLRJ7TDP.cjs.map +1 -0
  164. package/dist/constants.cjs +1 -21
  165. package/dist/constants.d.cts +1 -1
  166. package/dist/constants.d.ts +1 -1
  167. package/dist/constants.js +1 -4
  168. package/dist/engine.cjs +1 -94
  169. package/dist/engine.d.cts +10 -11
  170. package/dist/engine.d.ts +10 -11
  171. package/dist/engine.js +1 -37
  172. package/dist/errors.cjs +1 -105
  173. package/dist/errors.d.cts +3 -3
  174. package/dist/errors.d.ts +3 -3
  175. package/dist/errors.js +1 -4
  176. package/dist/format.cjs +1 -26
  177. package/dist/format.d.cts +2 -2
  178. package/dist/format.d.ts +2 -2
  179. package/dist/format.js +1 -9
  180. package/dist/index.cjs +1 -314
  181. package/dist/index.cjs.map +1 -1
  182. package/dist/index.d.cts +52 -20
  183. package/dist/index.d.ts +52 -20
  184. package/dist/index.js +1 -278
  185. package/dist/index.js.map +1 -1
  186. package/dist/language.cjs +1 -369
  187. package/dist/language.cjs.map +1 -1
  188. package/dist/language.d.cts +9 -10
  189. package/dist/language.d.ts +9 -10
  190. package/dist/language.js +1 -348
  191. package/dist/language.js.map +1 -1
  192. package/dist/lexer.cjs +1 -63
  193. package/dist/lexer.js +1 -10
  194. package/dist/normalizer.cjs +1 -39
  195. package/dist/normalizer.js +1 -10
  196. package/dist/packages.cjs +1 -132
  197. package/dist/packages.d.cts +8 -9
  198. package/dist/packages.d.ts +8 -9
  199. package/dist/packages.js +1 -23
  200. package/dist/parser.cjs +1 -54
  201. package/dist/parser.d.cts +8 -8
  202. package/dist/parser.d.ts +8 -8
  203. package/dist/parser.js +1 -9
  204. package/dist/{pipeline-D-PS9gVw.d.ts → pipeline-72QmQlGx.d.ts} +1 -1
  205. package/dist/{pipeline-DtSBJ8TS.d.cts → pipeline-DCQicwWX.d.cts} +1 -1
  206. package/dist/resolvers.cjs +1 -12
  207. package/dist/resolvers.d.cts +2 -2
  208. package/dist/resolvers.d.ts +2 -2
  209. package/dist/resolvers.js +1 -3
  210. package/dist/services.cjs +1 -20
  211. package/dist/services.js +1 -3
  212. package/dist/testing.cjs +3 -477
  213. package/dist/testing.cjs.map +1 -1
  214. package/dist/testing.d.cts +9 -10
  215. package/dist/testing.d.ts +9 -10
  216. package/dist/testing.js +3 -469
  217. package/dist/testing.js.map +1 -1
  218. package/dist/uom.cjs +1 -55
  219. package/dist/uom.d.cts +2 -2
  220. package/dist/uom.d.ts +2 -2
  221. package/dist/uom.js +1 -10
  222. package/dist/utilities.cjs +1 -36
  223. package/dist/utilities.js +1 -7
  224. package/dist/vm.cjs +1 -295
  225. package/dist/vm.cjs.map +1 -1
  226. package/dist/vm.d.cts +22 -10
  227. package/dist/vm.d.ts +22 -10
  228. package/dist/vm.js +1 -193
  229. package/dist/vm.js.map +1 -1
  230. package/dist/worker.cjs +2 -492
  231. package/dist/worker.cjs.map +1 -1
  232. package/dist/worker.d.cts +16 -17
  233. package/dist/worker.d.ts +16 -17
  234. package/dist/worker.js +2 -483
  235. package/dist/worker.js.map +1 -1
  236. package/package.json +1 -13
  237. package/dist/chunk-3BOK2LDK.js +0 -17
  238. package/dist/chunk-3BOK2LDK.js.map +0 -1
  239. package/dist/chunk-3VGDNEE3.js +0 -84
  240. package/dist/chunk-3VGDNEE3.js.map +0 -1
  241. package/dist/chunk-4K5W7EH2.cjs +0 -112
  242. package/dist/chunk-4K5W7EH2.cjs.map +0 -1
  243. package/dist/chunk-5EFKSKMA.js +0 -413
  244. package/dist/chunk-5EFKSKMA.js.map +0 -1
  245. package/dist/chunk-5HRB36DK.js +0 -405
  246. package/dist/chunk-5HRB36DK.js.map +0 -1
  247. package/dist/chunk-5ON7PUAZ.js +0 -12
  248. package/dist/chunk-5ON7PUAZ.js.map +0 -1
  249. package/dist/chunk-7AXJNQMF.cjs +0 -297
  250. package/dist/chunk-7AXJNQMF.cjs.map +0 -1
  251. package/dist/chunk-7JM3F4KL.js +0 -1795
  252. package/dist/chunk-7JM3F4KL.js.map +0 -1
  253. package/dist/chunk-7USV76HV.cjs +0 -341
  254. package/dist/chunk-7USV76HV.cjs.map +0 -1
  255. package/dist/chunk-A2DZ5BEJ.cjs +0 -1930
  256. package/dist/chunk-A2DZ5BEJ.cjs.map +0 -1
  257. package/dist/chunk-ADBA3XBE.cjs +0 -20
  258. package/dist/chunk-ADBA3XBE.cjs.map +0 -1
  259. package/dist/chunk-AKNGX4TZ.cjs +0 -236
  260. package/dist/chunk-AKNGX4TZ.cjs.map +0 -1
  261. package/dist/chunk-ALYRJ72W.cjs +0 -434
  262. package/dist/chunk-ALYRJ72W.cjs.map +0 -1
  263. package/dist/chunk-AMOJYLG2.cjs +0 -1692
  264. package/dist/chunk-AMOJYLG2.cjs.map +0 -1
  265. package/dist/chunk-AOH6UR2L.js +0 -825
  266. package/dist/chunk-AOH6UR2L.js.map +0 -1
  267. package/dist/chunk-AQNHHJMJ.cjs +0 -261
  268. package/dist/chunk-B7LXJ6LC.cjs +0 -36
  269. package/dist/chunk-B7LXJ6LC.cjs.map +0 -1
  270. package/dist/chunk-BESTLPRK.cjs +0 -6919
  271. package/dist/chunk-BESTLPRK.cjs.map +0 -1
  272. package/dist/chunk-BLI4NIQY.js +0 -98
  273. package/dist/chunk-BLI4NIQY.js.map +0 -1
  274. package/dist/chunk-BSPXMGIS.js +0 -455
  275. package/dist/chunk-BSPXMGIS.js.map +0 -1
  276. package/dist/chunk-C2OMO3WN.cjs +0 -2806
  277. package/dist/chunk-C2OMO3WN.cjs.map +0 -1
  278. package/dist/chunk-CSDQMDU2.js +0 -204
  279. package/dist/chunk-CSDQMDU2.js.map +0 -1
  280. package/dist/chunk-EJ3ILXX6.cjs +0 -223
  281. package/dist/chunk-EJ3ILXX6.cjs.map +0 -1
  282. package/dist/chunk-ENRIK36Q.cjs +0 -94
  283. package/dist/chunk-ENRIK36Q.cjs.map +0 -1
  284. package/dist/chunk-F4UB4XIL.js +0 -109
  285. package/dist/chunk-F4UB4XIL.js.map +0 -1
  286. package/dist/chunk-FD5ZZHEU.js +0 -92
  287. package/dist/chunk-FD5ZZHEU.js.map +0 -1
  288. package/dist/chunk-FE4RC37D.js +0 -2801
  289. package/dist/chunk-FE4RC37D.js.map +0 -1
  290. package/dist/chunk-FEAIOR7N.cjs +0 -91
  291. package/dist/chunk-FEAIOR7N.cjs.map +0 -1
  292. package/dist/chunk-FR7RNOPT.cjs +0 -3303
  293. package/dist/chunk-FR7RNOPT.cjs.map +0 -1
  294. package/dist/chunk-G2YPPLGX.cjs +0 -484
  295. package/dist/chunk-G2YPPLGX.cjs.map +0 -1
  296. package/dist/chunk-GCM5JHMX.js +0 -88
  297. package/dist/chunk-GCM5JHMX.js.map +0 -1
  298. package/dist/chunk-GDEU72RG.cjs +0 -829
  299. package/dist/chunk-GDEU72RG.cjs.map +0 -1
  300. package/dist/chunk-HKTQCQ4Z.cjs +0 -8383
  301. package/dist/chunk-HKTQCQ4Z.cjs.map +0 -1
  302. package/dist/chunk-HWHU642X.cjs +0 -316
  303. package/dist/chunk-HWHU642X.cjs.map +0 -1
  304. package/dist/chunk-ICEKS6YC.cjs +0 -507
  305. package/dist/chunk-ICEKS6YC.cjs.map +0 -1
  306. package/dist/chunk-IJGOFP2J.js +0 -6904
  307. package/dist/chunk-IJGOFP2J.js.map +0 -1
  308. package/dist/chunk-IQJGDZOP.js +0 -333
  309. package/dist/chunk-IQJGDZOP.js.map +0 -1
  310. package/dist/chunk-IT74O4BE.cjs +0 -456
  311. package/dist/chunk-IT74O4BE.cjs.map +0 -1
  312. package/dist/chunk-KXDQKVNX.cjs +0 -459
  313. package/dist/chunk-KXDQKVNX.cjs.map +0 -1
  314. package/dist/chunk-L2TE7PMO.cjs +0 -14
  315. package/dist/chunk-L2TE7PMO.cjs.map +0 -1
  316. package/dist/chunk-L5YHV6BQ.js +0 -499
  317. package/dist/chunk-L5YHV6BQ.js.map +0 -1
  318. package/dist/chunk-LO7HU5WB.cjs +0 -209
  319. package/dist/chunk-LO7HU5WB.cjs.map +0 -1
  320. package/dist/chunk-LSALB3IN.js +0 -292
  321. package/dist/chunk-LSALB3IN.js.map +0 -1
  322. package/dist/chunk-MI7OTUHL.cjs +0 -339
  323. package/dist/chunk-MI7OTUHL.cjs.map +0 -1
  324. package/dist/chunk-MIGXCBXT.cjs +0 -381
  325. package/dist/chunk-MIGXCBXT.cjs.map +0 -1
  326. package/dist/chunk-MVTOCRV2.js +0 -213
  327. package/dist/chunk-MVTOCRV2.js.map +0 -1
  328. package/dist/chunk-N7FNVFXW.cjs +0 -32
  329. package/dist/chunk-N7FNVFXW.cjs.map +0 -1
  330. package/dist/chunk-N7OA4WPJ.js +0 -362
  331. package/dist/chunk-N7OA4WPJ.js.map +0 -1
  332. package/dist/chunk-NAWZATKT.js +0 -478
  333. package/dist/chunk-NAWZATKT.js.map +0 -1
  334. package/dist/chunk-NLNDMWZC.js +0 -31
  335. package/dist/chunk-NLNDMWZC.js.map +0 -1
  336. package/dist/chunk-ORM7CHYZ.js +0 -1531
  337. package/dist/chunk-ORM7CHYZ.js.map +0 -1
  338. package/dist/chunk-OUHT5Z36.cjs +0 -393
  339. package/dist/chunk-OUHT5Z36.cjs.map +0 -1
  340. package/dist/chunk-PCZVMMWU.cjs +0 -74
  341. package/dist/chunk-PCZVMMWU.cjs.map +0 -1
  342. package/dist/chunk-RNKDIXDV.js +0 -336
  343. package/dist/chunk-RNKDIXDV.js.map +0 -1
  344. package/dist/chunk-SBUFNJVE.js +0 -258
  345. package/dist/chunk-SBUFNJVE.js.map +0 -1
  346. package/dist/chunk-TC6BTUSU.cjs +0 -1799
  347. package/dist/chunk-TC6BTUSU.cjs.map +0 -1
  348. package/dist/chunk-TPOK3UNI.js +0 -8355
  349. package/dist/chunk-TPOK3UNI.js.map +0 -1
  350. package/dist/chunk-UF6JG5SG.js +0 -312
  351. package/dist/chunk-UF6JG5SG.js.map +0 -1
  352. package/dist/chunk-UKQHXPGW.js +0 -30
  353. package/dist/chunk-UKQHXPGW.js.map +0 -1
  354. package/dist/chunk-V4XG5QF6.js +0 -1685
  355. package/dist/chunk-V4XG5QF6.js.map +0 -1
  356. package/dist/chunk-VEKIWQ3F.cjs +0 -39
  357. package/dist/chunk-VEKIWQ3F.cjs.map +0 -1
  358. package/dist/chunk-WMQRJTAO.js +0 -3266
  359. package/dist/chunk-WMQRJTAO.js.map +0 -1
  360. package/dist/chunk-X6K3HUOY.cjs +0 -86
  361. package/dist/chunk-X6K3HUOY.cjs.map +0 -1
  362. package/dist/chunk-XBTEO4OB.js +0 -391
  363. package/dist/chunk-XBTEO4OB.js.map +0 -1
  364. package/dist/chunk-XIYYHA65.cjs +0 -101
  365. package/dist/chunk-XIYYHA65.cjs.map +0 -1
  366. package/dist/chunk-YJHY7CMN.cjs +0 -1534
  367. package/dist/chunk-YJHY7CMN.cjs.map +0 -1
  368. package/dist/chunk-YLJ4XMA6.js +0 -33
  369. package/dist/chunk-YLJ4XMA6.js.map +0 -1
  370. package/dist/chunk-YNIWOYW6.js +0 -232
  371. package/dist/chunk-YNIWOYW6.js.map +0 -1
  372. package/dist/chunk-Z2XP767T.cjs +0 -35
  373. package/dist/chunk-Z2XP767T.cjs.map +0 -1
  374. package/dist/chunk-Z4X2RWOF.js +0 -37
  375. package/dist/chunk-Z4X2RWOF.js.map +0 -1
  376. package/dist/chunk-ZN6YYPIW.js +0 -67
  377. package/dist/chunk-ZN6YYPIW.js.map +0 -1
  378. package/dist/chunk-ZNFFTYWH.js +0 -1854
  379. package/dist/chunk-ZNFFTYWH.js.map +0 -1
  380. package/dist/variables.cjs +0 -17
  381. package/dist/variables.cjs.map +0 -1
  382. package/dist/variables.d.cts +0 -87
  383. package/dist/variables.d.ts +0 -87
  384. package/dist/variables.js +0 -4
  385. package/dist/variables.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/vm/DependencyGraph.ts","../src/vm/ScopeManager.ts","../src/vm/BusinessDays.ts","../src/vm/VMBuiltinArity.ts","../src/vm/VM.ts"],"names":["ErrorFactory","defaultEngineContext","numberValue","getOpCodeName","ValueType","symbolicValue","varNode","UNIT_TABLE","CURRENCY_DISPLAY","uomValue","scaleMoneyByPercent","percentageValue","numberValueUncertain","sharedCurrencyExchange","scaleMoneyExact","getMeasure","convertUnit","addBusinessDays","MS_PER_DAY","isWorkdayUnit","timecodeFps","isTimecodeUnit","errorValue","describeConversionMismatch","toBigIntOperand","bigIntValue","splitRateUnit","isArenaActive","beginEvaluation","DiagnosticEventType","persistentValue","decimalFromLiteral","numberValueExact","decimalToNumber","hexValue","stringValue","boolValue","faultedOperand","uncertainOp","exactRationalOp","datetimeValue","binaryOp","checkAllocation","matrixMultiply","isRateUnit","unifyUom","rateValue","bigIntDivisionByZero","power","matrixPower","symbolicPow","uomValueExact","decimalNegate","symbolicNeg","numberValueRational","rationalNeg","compareRationalOperands","compareBigIntOperands","compareUom","matrixCompare","incomparableUnitsError","faultedIn","builtinFunctions","SYMBOLIC_NATIVE_BUILTINS","symbolicBuiltin","chargeFunctionCall","sharedGlobalVariableStore","colourValue","asConverterRegistry","moneyExactMagnitude","convertRate","getConvertiblePossibilities","getBestUnit","CoreErrorCodes","checkedArray","matrixValue","rowMajorToColumnMajor","matIndex","matrixEntryToValue","inBounds","matAt","rangeValue","collectionToValues","chargeAllocation","normalizeUnknownError","endEvaluation"],"mappings":";;;;;;;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E,YAAA,KAAA,CAAM,KAAK,WAAW,CAAA;AAAG,YAAA;AAAA,UAAO;AAEnD,UAAA,KAAA,CAAM,KAAK,GAAG,CAAA;AACd,UAAA;AAAA,QACF;AAAA;AAAA;AAAA;AAAA,QAKA,KAAA,GAAA,qBAA0B;AACxB,UAAA,MAAM,GAAA,GAAM,WAAA,CAAY,OAAA,EAAS,EAAA,EAAA,EAAM,IAAI,gBAAgB,CAAA;AAC3D,UAAA,MAAM,GAAA,GAAM,kBAAkB,GAAG,CAAA;AACjC,UAAA,IAAI,CAAC,GAAA,EAAK;AACR,YAAA,MAAMrC,8BAAA,CAAa,QAAA;AAAA,cACjB,iCAAA;AAAA,cACA,wEAAwE,GAAG,CAAA,CAAA;AAAA,cAC3E,EAAE,GAAA;AAAI,aACR;AAAA,UACF;AAQA,UAAA,KAAA,CAAM,IAAA,CAAK,sBAAA,CAAuB,GAAA,CAAI,MAAA,CAAO,CAAC,CAAA,EAAG,GAAA,CAAI,OAAA,EAAS,EAAA,EAAI,UAAU,UAAA,EAAY,OAAA,EAAS,CAAC,CAAC,gBAAgB,CAAC,CAAA;AACpH,UAAA;AAAA,QACF;AAAA;AAEF,IACF;AAGA,IAAA,MAAM,QAAA,GAAW,QAAQ,KAAK,CAAA;AAC9B,IAAA,OAAO,EAAE,MAAM,OAAA,EAAS,KAAA,EAAO,WAAW8B,iCAAA,CAAgB,QAAQ,IAAI,QAAA,EAAS;AAAA,EAC/E,SAAS,CAAA,EAAG;AACR,IAAA,OAAO,EAAE,IAAA,EAAM,OAAA,EAAS,KAAA,EAAOsD,uCAAA,CAAsB,CAAC,CAAA,EAAE;AAAA,EAC5D,CAAA,SAAE;AACE,IAAAC,+BAAA,EAAc;AAAA,EAClB;AACJ","file":"chunk-C2OMO3WN.cjs","sourcesContent":["/** Serialized snapshot of the dependency graph for diagnostic rendering. */\nexport interface DagSnapshot {\n consumers: Record<string, number[]>;\n writes: Record<number, string[]>;\n reads: Record<number, string[]>;\n dataSourceDeps: Record<number, string[]>;\n dataSourceConsumers: Record<string, number[]>;\n}\n\n/**\n * Dependency graph for variable and data-source tracking across document lines.\n *\n * Tracks which lines read/write which variables, and propagates changes through\n * the graph when a variable is modified. Supports:\n * - Variable dependency tracking (registerLine, getAffectedLines)\n * - Data-source dependency tracking (registerLineDataSourceDependency)\n * - Topological ordering of affected lines (getAffectedLinesInOrder)\n * - Efficient removal of deleted lines (removeLine)\n */\nexport class DependencyGraph {\n private consumers: Map<string, Set<number>> = new Map();\n private dependencies: Map<number, Set<string>> = new Map();\n private writes: Map<number, Set<string>> = new Map();\n private lineReads: Map<number, Set<string>> = new Map();\n\n // Data source dependencies: line number -> Set of query keys\n private dataSourceDependencies: Map<number, Set<string>> = new Map();\n // Reverse map: query key -> Set of line numbers\n private dataSourceConsumers: Map<string, Set<number>> = new Map();\n\n /**\n * Register a line's variable reads and writes in the dependency graph.\n *\n * If re-registering the same line (e.g., after editing), old consumer\n * references are cleaned up first. Write-variables are removed from\n * the consumer set so that redefinition breaks the old dependency chain.\n *\n * @param lineNumber - 1-based line number in the document\n * @param reads - Variable names this line reads\n * @param writes - Variable names this line writes (assigns to)\n */\n registerLine(lineNumber: number, reads: string[], writes: string[]): void {\n // Clean up old consumer references if re-registering this line\n const oldReads = this.lineReads.get(lineNumber);\n if (oldReads) {\n for (const oldRead of oldReads) {\n const consumers = this.consumers.get(oldRead);\n if (consumers) consumers.delete(lineNumber);\n }\n }\n\n // Track what this line reads\n this.lineReads.set(lineNumber, new Set(reads));\n\n // Add new consumer references\n for (const dep of reads) {\n if (!this.consumers.has(dep)) this.consumers.set(dep, new Set());\n this.consumers.get(dep)!.add(lineNumber);\n }\n if (writes.length > 0) {\n this.dependencies.set(lineNumber, new Set(reads));\n this.writes.set(lineNumber, new Set(writes));\n for (const write of writes) {\n const prevConsumer = this.consumers.get(write);\n if (prevConsumer) prevConsumer.delete(lineNumber);\n }\n }\n }\n\n /**\n * Register a line's dependency on an external data source (e.g., currency rate, OSRS GE price).\n *\n * When the data source updates, {@link getAffectedLinesByDataSource} returns all lines\n * that depend on this data, enabling targeted re-evaluation.\n *\n * @param lineNumber - 1-based line number in the document\n * @param dataSourceId - Unique identifier for the data source (e.g., \"currency\", \"osrs-ge\")\n * @param queryKey - Query key array identifying the specific data (e.g., [\"USD\", \"EUR\"])\n */\n registerLineDataSourceDependency(lineNumber: number, dataSourceId: string, queryKey: string[]): void {\n const queryKeyStr = JSON.stringify(queryKey);\n const key = `${dataSourceId}:${queryKeyStr}`;\n \n if (!this.dataSourceDependencies.has(lineNumber)) {\n this.dataSourceDependencies.set(lineNumber, new Set());\n }\n this.dataSourceDependencies.get(lineNumber)!.add(key);\n \n if (!this.dataSourceConsumers.has(key)) {\n this.dataSourceConsumers.set(key, new Set());\n }\n this.dataSourceConsumers.get(key)!.add(lineNumber);\n }\n\n /**\n * Find all lines affected by a changed variable via BFS through the consumer graph.\n *\n * When a variable is modified (e.g., `:x = 5` changes to `:x = 10`), this returns\n * all lines that transitively depend on it, lines that read `x`, lines that read\n * variables written by those lines, and so on.\n *\n * @param changedVariable - The variable name that changed\n * @returns Set of line numbers that need re-evaluation\n */\n getAffectedLines(changedVariable: string): Set<number> {\n const visited = new Set<number>();\n const queue = [changedVariable];\n while (queue.length > 0) {\n const varName = queue.pop()!;\n const consumers = this.consumers.get(varName);\n if (!consumers) continue;\n for (const line of consumers) {\n if (visited.has(line)) continue;\n visited.add(line);\n const lineWrites = this.writes.get(line);\n if (lineWrites) {\n for (const writtenVar of lineWrites) {\n queue.push(writtenVar);\n }\n }\n }\n }\n return visited;\n }\n\n /**\n * Phase 1.4 DAG-walk optimization: return affected lines in dependency-safe\n * topological order. Uses Kahn's algorithm (BFS-based) to ensure every line\n * is evaluated AFTER all lines it depends on have been processed.\n *\n * This is more correct than ascending line-number sort, which fails when\n * variable definitions and their consumers are not in document order.\n *\n * @returns Line numbers in topological order (producers before consumers).\n */\n getAffectedLinesInOrder(startVariable: string): number[] {\n const affected = this.getAffectedLines(startVariable);\n if (affected.size === 0) return [];\n\n // Build a local subgraph: for each affected line, compute in-degree\n // (how many other affected lines produce variables it reads).\n const inDegree = new Map<number, number>();\n const adjacency = new Map<number, number[]>(); // line → downstream lines\n\n for (const line of affected) {\n if (!inDegree.has(line)) inDegree.set(line, 0);\n if (!adjacency.has(line)) adjacency.set(line, []);\n }\n\n // Build a variable→producer map in one pass, then do O(1) lookups\n // per read variable instead of O(n) scanning otherAffected lines.\n const producerOf = new Map<string, number>();\n for (const line of affected) {\n const lineWrites = this.writes.get(line);\n if (lineWrites) {\n for (const w of lineWrites) producerOf.set(w, line);\n }\n }\n\n // For each affected line, check if any reads are produced by another\n // affected line. If so, add an edge from producer → consumer.\n for (const line of affected) {\n const reads = this.lineReads.get(line);\n if (!reads) continue;\n\n for (const readVar of reads) {\n const producer = producerOf.get(readVar);\n if (producer !== undefined && producer !== line) {\n // producer writes readVar, which this line reads\n // Edge: producer → line (producer → consumer)\n adjacency.get(producer)!.push(line);\n inDegree.set(line, (inDegree.get(line) ?? 0) + 1);\n }\n }\n }\n\n // Kahn's algorithm: start with zero-indegree lines (no dependencies within\n // the affected set), then iteratively remove them, adding newly-freed lines.\n const queue: number[] = [];\n for (const [line, degree] of inDegree) {\n if (degree === 0) queue.push(line);\n }\n\n // If every affected line has at least one dependency (cycle or external),\n // start with the lowest line number as a fallback.\n if (queue.length === 0 && affected.size > 0) {\n const sorted = Array.from(affected).sort((a, b) => a - b);\n queue.push(sorted[0]);\n }\n\n const ordered: number[] = [];\n while (queue.length > 0) {\n const current = queue.shift()!;\n ordered.push(current);\n\n for (const downstream of adjacency.get(current) ?? []) {\n const newDegree = (inDegree.get(downstream) ?? 1) - 1;\n inDegree.set(downstream, newDegree);\n if (newDegree === 0) queue.push(downstream);\n }\n }\n\n // Append any remaining lines that couldn't be topologically sorted\n // (cycles or external-only dependencies) in ascending order.\n if (ordered.length < affected.size) {\n const orderedSet = new Set(ordered);\n const remaining = Array.from(affected)\n .filter((l) => !orderedSet.has(l))\n .sort((a, b) => a - b);\n ordered.push(...remaining);\n }\n\n return ordered;\n }\n\n /**\n * Find all lines affected by a data source update.\n *\n * When an async data source resolves (e.g., currency rate fetch completes),\n * this returns all lines that depend on that specific data query.\n *\n * @param dataSourceId - The data source identifier\n * @param queryKey - The query key that was updated\n * @returns Set of line numbers that need re-evaluation\n */\n getAffectedLinesByDataSource(dataSourceId: string, queryKey: string[]): Set<number> {\n const queryKeyStr = JSON.stringify(queryKey);\n const key = `${dataSourceId}:${queryKeyStr}`;\n return this.dataSourceConsumers.get(key) ?? new Set();\n }\n\n /**\n * Remove a line from the dependency graph (e.g., when a line is deleted from the document).\n *\n * Cleans up all consumer references, write registrations, and data source dependencies\n * for the removed line. O(k) where k is the number of variables the line reads.\n *\n * @param lineNumber - The line number being removed\n */\n removeLine(lineNumber: number): void {\n // Remove from consumers of variables this line read, O(k) not O(V)\n const reads = this.lineReads.get(lineNumber);\n if (reads) {\n for (const readVar of reads) {\n const consumers = this.consumers.get(readVar);\n if (consumers) consumers.delete(lineNumber);\n }\n this.lineReads.delete(lineNumber);\n }\n\n this.dependencies.delete(lineNumber);\n this.writes.delete(lineNumber);\n\n // Remove from consumers of the data-source keys THIS line depends on\n // O(k) via the line's own dependency set, not O(total unique keys in\n // the document). Must read dataSourceDependencies before deleting it.\n const dataSourceKeys = this.dataSourceDependencies.get(lineNumber);\n if (dataSourceKeys) {\n for (const key of dataSourceKeys) {\n this.dataSourceConsumers.get(key)?.delete(lineNumber);\n }\n this.dataSourceDependencies.delete(lineNumber);\n }\n }\n\n /**\n * Get all line numbers that consume (read) a given variable.\n *\n * @param variable - The variable name\n * @returns Set of line numbers that read this variable, or empty set if none\n */\n getConsumers(variable: string): Set<number> {\n return this.consumers.get(variable) ?? new Set();\n }\n\n /**\n * Get all variables that a line depends on (reads).\n *\n * @param lineNumber - The line number to query\n * @returns Set of variable names this line reads, or empty set if none\n */\n getDependencies(lineNumber: number): Set<string> {\n return this.dependencies.get(lineNumber) ?? new Set();\n }\n\n /**\n * Get all variables that a line writes (assigns to).\n *\n * @param lineNumber - The line number to query\n * @returns Set of variable names this line writes, or empty set if none\n */\n getWrites(lineNumber: number): Set<string> {\n return this.writes.get(lineNumber) ?? new Set();\n }\n\n /**\n * Get a serializable snapshot of the entire dependency graph for diagnostics.\n *\n * Returns plain objects (not Maps/Sets) so consumers don't need to reach\n * into private fields. Used by playground diagnostic tabs for DAG visualization.\n */\n getSnapshot(): DagSnapshot {\n const consumers: Record<string, number[]> = {};\n for (const [variable, lines] of this.consumers) {\n consumers[variable] = Array.from(lines);\n }\n\n const writes: Record<number, string[]> = {};\n for (const [line, vars] of this.writes) {\n writes[line] = Array.from(vars);\n }\n\n const reads: Record<number, string[]> = {};\n for (const [line, vars] of this.lineReads) {\n reads[line] = Array.from(vars);\n }\n\n const dataSourceDeps: Record<number, string[]> = {};\n for (const [line, keys] of this.dataSourceDependencies) {\n dataSourceDeps[line] = Array.from(keys);\n }\n\n const dataSourceConsumers: Record<string, number[]> = {};\n for (const [key, lines] of this.dataSourceConsumers) {\n dataSourceConsumers[key] = Array.from(lines);\n }\n\n return { consumers, writes, reads, dataSourceDeps, dataSourceConsumers };\n }\n\n /** Clear all dependency graph state. Called on document switch or engine reset. */\n clear(): void {\n this.consumers.clear();\n this.dependencies.clear();\n this.writes.clear();\n this.lineReads.clear();\n this.dataSourceDependencies.clear();\n this.dataSourceConsumers.clear();\n }\n}\n","import { Value } from \"@solve-js/vm/Value\";\n\n/**\n * Record of a compiled expression in the scope.\n * Tracks the expression text, compiled bytecode, last evaluation result,\n * and the variable reads/writes for dependency tracking.\n */\nexport interface ExpressionRecord {\n lineNumber: number;\n expression: string;\n bytecode: { opcodes: Uint8Array; numbers: Float64Array; strings: string[] };\n lastResult: Value;\n readVariables: string[];\n writeVariable: string | null;\n}\n\n/**\n * Scoped variable manager for expression evaluation.\n *\n * Tracks variable definitions across line numbers with write-on-read semantics.\n * When a value is read, the most recent definition at or before the reading line\n * is returned. Invalidation trims downstream definitions when a variable is redefined.\n */\nexport class ScopeManager {\n private definitions: Map<string, { line: number; expr: ExpressionRecord }[]> = new Map();\n\n /**\n * Record a variable definition at `lineNumber`. A variable may have\n * multiple definitions across different lines (e.g. redefined further\n * down a document), each call adds one, keeping the internal stack\n * sorted by line so {@link read} can binary-scan for \"most recent\n * definition at or before\" a given line.\n */\n write(variable: string, lineNumber: number, expr: ExpressionRecord): void {\n if (!this.definitions.has(variable)) {\n this.definitions.set(variable, []);\n }\n const stack = this.definitions.get(variable)!;\n stack.push({ line: lineNumber, expr });\n stack.sort((a, b) => a.line - b.line);\n }\n\n /**\n * Look up a variable's value as seen from `readLine`: returns the result\n * of the closest definition at or before `readLine`, not simply the most\n * recently-written one, so a read on line 5 of a variable redefined on\n * lines 2 and 10 sees line 2's value, not line 10's. Returns `undefined`\n * if the variable has no definition at or before `readLine`.\n */\n read(variable: string, readLine: number): Value | undefined {\n const stack = this.definitions.get(variable);\n if (!stack) return undefined;\n for (let i = stack.length - 1; i >= 0; i--) {\n if (stack[i].line <= readLine) return stack[i].expr.lastResult;\n }\n return undefined;\n }\n\n /**\n * Drop every definition of `variable` that comes strictly after\n * `definitionLine`. Call this when a line is re-evaluated with a new\n * definition, so stale later-line definitions from a previous edit don't\n * linger and get returned by {@link read}.\n */\n invalidateDownstream(variable: string, definitionLine: number): void {\n const stack = this.definitions.get(variable);\n if (!stack) return;\n const idx = stack.findIndex(s => s.line === definitionLine);\n if (idx === -1) return;\n stack.splice(idx + 1);\n }\n\n /** Remove every tracked variable definition, used when an engine/document is reset. */\n clear(): void {\n this.definitions.clear();\n }\n}\n","/**\n * Pure business-day arithmetic: the calendar walk behind workday offsets and\n * the working-day count.\n *\n * Weekends (Saturday and Sunday) are decidable from the date alone, so they\n * are always skipped. Public holidays are not decidable from the date, so they\n * arrive as an optional `isHoliday` predicate the host supplies (see\n * `vm/HolidayCalendar.ts` and `constants/Configuration.ts`'s `date.holidays`).\n * With no predicate the walk is weekends-only, which is the honest default:\n * the engine skips exactly the days it can prove are non-working, and nothing\n * more.\n *\n * These functions are deliberately free of engine types and of `Value`, so the\n * skipping logic can be unit-tested directly (see\n * `__tests__/vm/BusinessDays.spec.ts`) rather than only through a whole\n * expression. `vm/VM.ts` is the one caller that wires in the host predicate and\n * the configured offset limits, and turns a `null` (limit reached) into the\n * engine's structured error.\n *\n * Every walk steps the `Date` day field (`setDate`) rather than adding a fixed\n * number of milliseconds, matching `vm/VM.ts`'s `addCalendarDays()`: a day that\n * contains a daylight-saving transition is 23 or 25 hours long, and being an\n * hour out is enough to land on the day before or after the one asked for.\n */\n\n/** A host-supplied test for whether an instant falls on a public holiday. */\nexport type HolidayPredicate = (epochMs: number) => boolean;\n\n/** Milliseconds in a day with no daylight-saving transition. Used only to size\n * a span into whole days, never to move a date, so the DST caveat above does\n * not apply (the caller rounds, and the walk itself steps the day field). */\nconst MS_PER_DAY = 86_400_000;\n\n/** True for Saturday or Sunday, in the local time zone the rest of the engine's\n * date arithmetic already works in. */\nexport function isWeekend(epochMs: number): boolean {\n\tconst day = new Date(epochMs).getDay(); // 0 = Sunday .. 6 = Saturday\n\treturn day === 0 || day === 6;\n}\n\n/**\n * True for a working day: a weekday that the host's calendar, if any, does not\n * mark as a holiday. With no calendar this is just \"not a weekend\".\n */\nexport function isBusinessDay(epochMs: number, isHoliday?: HolidayPredicate): boolean {\n\tif (isWeekend(epochMs)) return false;\n\treturn isHoliday ? !isHoliday(epochMs) : true;\n}\n\n/** Local midnight of the calendar date `epochMs` falls on, so a time-of-day\n * cannot tip a count onto the wrong day. */\nfunction startOfLocalDay(epochMs: number): number {\n\tconst d = new Date(epochMs);\n\treturn new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();\n}\n\n/**\n * Advance (or, for negative `n`, retreat) `startMs` by `n` business days,\n * landing on a business day: `Friday + 1 working day` is the following Monday,\n * and if a Monday is a configured holiday it is the Tuesday.\n *\n * `maxCalendarSteps` caps the walk. A caller passes the number of calendar days\n * its configured offset limit allows, which also makes a pathological calendar\n * (one that marks every day a holiday, so no step ever counts) terminate rather\n * than loop forever. Returns `null` when the cap is reached, which the caller\n * reports as a limit error, distinct from a real landing date.\n */\nexport function addBusinessDays(\n\tstartMs: number,\n\tn: number,\n\tisHoliday: HolidayPredicate | undefined,\n\tmaxCalendarSteps: number,\n): number | null {\n\t// Truncated to whole business days, mirroring the milliseconds path: a\n\t// fractional count of working days names no calendar date of its own.\n\tlet remaining = Math.trunc(Math.abs(n));\n\tconst direction = n >= 0 ? 1 : -1;\n\tconst date = new Date(startMs);\n\tlet steps = 0;\n\twhile (remaining > 0) {\n\t\tdate.setDate(date.getDate() + direction);\n\t\tsteps++;\n\t\tif (steps > maxCalendarSteps) return null;\n\t\tif (isBusinessDay(date.getTime(), isHoliday)) remaining--;\n\t}\n\treturn date.getTime();\n}\n\n/**\n * Count the business days between two dates, INCLUSIVE of both endpoints and\n * independent of the order the two are written in (there is no direction to\n * \"between\" in English, so `A and B` counts the same as `B and A`).\n *\n * Counted on calendar-date granularity: the time of day on either endpoint is\n * dropped first, so `working days between 1 Jan and 31 Jan` is every working\n * day in that window, both ends included. Inclusive is the reading a deadline\n * question wants (\"how many working days do I have from today through Friday\").\n *\n * `maxCalendarSteps` bounds the span the same way {@link addBusinessDays} bounds\n * its walk; returns `null` when the two dates are further apart than that, which\n * the caller reports as a range error.\n */\nexport function countBusinessDaysBetween(\n\taMs: number,\n\tbMs: number,\n\tisHoliday: HolidayPredicate | undefined,\n\tmaxCalendarSteps: number,\n): number | null {\n\tconst startDay = startOfLocalDay(Math.min(aMs, bMs));\n\tconst endDay = startOfLocalDay(Math.max(aMs, bMs));\n\t// Rounded because a span crossing a daylight-saving change is a whole\n\t// number of days plus or minus an hour, and both endpoints are already\n\t// local midnights.\n\tconst spanDays = Math.round((endDay - startDay) / MS_PER_DAY);\n\tif (spanDays > maxCalendarSteps) return null;\n\tlet count = 0;\n\tconst date = new Date(startDay);\n\tfor (let i = 0; i <= spanDays; i++) {\n\t\tif (isBusinessDay(date.getTime(), isHoliday)) count++;\n\t\tdate.setDate(date.getDate() + 1);\n\t}\n\treturn count;\n}\n","import { ErrorFactory } from \"@solve-js/errors/EngineError\";\nimport type { EngineError } from \"@solve-js/errors/EngineError\";\n\n/**\n * How many arguments each builtin actually takes.\n *\n * Every implementation in `VMBuiltins.ts` indexes `args` positionally and none\n * of them checks the length first, so `sqrt()` reached `args[0].toNumber()`\n * with an empty array and threw a raw `TypeError`. That TypeError was caught by\n * `normalizeUnknownError()` and re-labelled `UNEXPECTED_ERROR` in category\n * INTERNAL, which told the host that a user's typo was an engine bug, in V8's\n * words, and named no function at all.\n *\n * The check belongs here rather than in each of the ~90 implementations because\n * the `CALL_BUILTIN` dispatch is the one place that knows both the index and\n * the argument count, and because a table can be read and audited against the\n * implementations in one sitting.\n *\n * `max` is `Infinity` for the genuinely variadic builtins (`min`, `max`,\n * `hypot`, the aggregates, `jacobian`). Everything else is strict in both\n * directions: an extra argument was silently discarded before, so `sqrt(1,2,3)`\n * answered 1 and the reader never learned that two thirds of what they typed\n * was thrown away.\n *\n * The name is the canonical one for the index. Several indices are reachable\n * under more than one spelling (`arcsin` and `asin` are both index 11, `fact`\n * and `factorial` are both 62) and several are reachable only through a phrase\n * parselet rather than by name at all, so this is the name the message uses\n * rather than whatever the reader typed, which the VM does not receive.\n */\ninterface BuiltinArity {\n readonly name: string;\n readonly min: number;\n readonly max: number;\n}\n\n/** One entry per index in `builtinFunctions`. Kept in the same order as that table. */\nconst BUILTIN_ARITY: Record<number, BuiltinArity> = {\n 0: { name: \"sqrt\", min: 1, max: 1 },\n 1: { name: \"abs\", min: 1, max: 1 },\n 2: { name: \"sin\", min: 1, max: 1 },\n 3: { name: \"cos\", min: 1, max: 1 },\n 4: { name: \"tan\", min: 1, max: 1 },\n 5: { name: \"log\", min: 1, max: 1 },\n 6: { name: \"ceil\", min: 1, max: 1 },\n 7: { name: \"floor\", min: 1, max: 1 },\n 8: { name: \"round\", min: 1, max: 2 },\n // min/max compare as many operands as they are given.\n 9: { name: \"min\", min: 1, max: Infinity },\n 10: { name: \"max\", min: 1, max: Infinity },\n 11: { name: \"asin\", min: 1, max: 1 },\n 12: { name: \"acos\", min: 1, max: 1 },\n 13: { name: \"atan\", min: 1, max: 1 },\n 14: { name: \"atan2\", min: 2, max: 2 },\n 15: { name: \"sinh\", min: 1, max: 1 },\n 16: { name: \"cosh\", min: 1, max: 1 },\n 17: { name: \"tanh\", min: 1, max: 1 },\n 18: { name: \"asinh\", min: 1, max: 1 },\n 19: { name: \"acosh\", min: 1, max: 1 },\n 20: { name: \"atanh\", min: 1, max: 1 },\n 21: { name: \"cbrt\", min: 1, max: 1 },\n 22: { name: \"clz32\", min: 1, max: 1 },\n 23: { name: \"expm1\", min: 1, max: 1 },\n 24: { name: \"exp\", min: 1, max: 1 },\n 25: { name: \"fround\", min: 1, max: 1 },\n // hypot is the length of a vector with as many components as it is given.\n 26: { name: \"hypot\", min: 1, max: Infinity },\n 27: { name: \"imul\", min: 2, max: 2 },\n 28: { name: \"log10\", min: 1, max: 1 },\n 29: { name: \"log1p\", min: 1, max: 1 },\n 30: { name: \"log2\", min: 1, max: 1 },\n 31: { name: \"pow\", min: 2, max: 2 },\n 32: { name: \"random\", min: 0, max: 0 },\n 33: { name: \"sign\", min: 1, max: 1 },\n 34: { name: \"trunc\", min: 1, max: 1 },\n 35: { name: \"degtorad\", min: 1, max: 1 },\n 36: { name: \"radtodeg\", min: 1, max: 1 },\n 37: { name: \"roll\", min: 2, max: 2 },\n 38: { name: \"gcd\", min: 2, max: 2 },\n 39: { name: \"lcm\", min: 2, max: 2 },\n 40: { name: \"permutation\", min: 2, max: 2 },\n 41: { name: \"combination\", min: 2, max: 2 },\n // The aggregates back \"average of X, Y, Z\" and friends, so they take a\n // list. Their implementations already answer for an empty list rather\n // than indexing into it, and the phrase parselets can emit an empty one,\n // so the minimum stays 0 here instead of being tightened on the way past.\n 42: { name: \"average\", min: 0, max: Infinity },\n 43: { name: \"median\", min: 0, max: Infinity },\n 44: { name: \"total\", min: 0, max: Infinity },\n 45: { name: \"count\", min: 0, max: Infinity },\n 46: { name: \"proportion\", min: 3, max: 3 },\n 47: { name: \"clamp\", min: 3, max: 3 },\n 48: { name: \"hex\", min: 1, max: 1 },\n 49: { name: \"bin\", min: 1, max: 1 },\n 50: { name: \"int\", min: 1, max: 1 },\n 51: { name: \"compoundInterest\", min: 3, max: 3 },\n 52: { name: \"interestEarned\", min: 3, max: 3 },\n 53: { name: \"compoundInterestRate\", min: 3, max: 3 },\n 54: { name: \"compoundInterestYears\", min: 3, max: 3 },\n 55: { name: \"loanRepayment\", min: 4, max: 4 },\n 56: { name: \"loanInterest\", min: 4, max: 4 },\n 57: { name: \"monthlyPayment\", min: 3, max: 3 },\n 58: { name: \"taxAdd\", min: 2, max: 2 },\n 59: { name: \"taxRemove\", min: 2, max: 2 },\n 60: { name: \"inflationAdjust\", min: 3, max: 3 },\n 61: { name: \"root\", min: 2, max: 2 },\n 62: { name: \"fact\", min: 1, max: 1 },\n 63: { name: \"transpose\", min: 1, max: 1 },\n 64: { name: \"det\", min: 1, max: 1 },\n 65: { name: \"inv\", min: 1, max: 1 },\n 66: { name: \"dot\", min: 2, max: 2 },\n 67: { name: \"expand\", min: 1, max: 1 },\n 68: { name: \"factor\", min: 1, max: 1 },\n // solve pushes the two sides of the equation and then the unknown's name.\n 69: { name: \"solve\", min: 3, max: 3 },\n // der's order of differentiation is optional and defaults to 1.\n 70: { name: \"der\", min: 2, max: 3 },\n 71: { name: \"integral\", min: 2, max: 2 },\n 72: { name: \"taylor\", min: 4, max: 4 },\n // jacobian differentiates however many functions it is handed.\n 73: { name: \"jacobian\", min: 1, max: Infinity },\n 74: { name: \"imaginary\", min: 1, max: 1 },\n 75: { name: \"conj\", min: 1, max: 1 },\n 76: { name: \"re\", min: 1, max: 1 },\n 77: { name: \"im\", min: 1, max: 1 },\n 78: { name: \"cancel\", min: 1, max: 1 },\n 79: { name: \"apart\", min: 1, max: 1 },\n 80: { name: \"compoundInterestEvery\", min: 4, max: 4 },\n 81: { name: \"compoundInterestEarnedEvery\", min: 4, max: 4 },\n 82: { name: \"presentValue\", min: 3, max: 3 },\n 83: { name: \"roi\", min: 2, max: 2 },\n 84: { name: \"annualisedReturn\", min: 3, max: 3 },\n 85: { name: \"taxIn\", min: 2, max: 2 },\n 86: { name: \"taxOn\", min: 2, max: 2 },\n 87: { name: \"sind\", min: 1, max: 1 },\n 88: { name: \"cosd\", min: 1, max: 1 },\n 89: { name: \"tand\", min: 1, max: 1 },\n 90: { name: \"asind\", min: 1, max: 1 },\n 91: { name: \"acosd\", min: 1, max: 1 },\n 92: { name: \"atand\", min: 1, max: 1 },\n 93: { name: \"daysCount\", min: 1, max: 1 },\n 94: { name: \"asTwoUnits\", min: 3, max: 3 },\n 95: { name: \"makeRate\", min: 2, max: 2 },\n 96: { name: \"atRate\", min: 2, max: 2 },\n // Not reachable by name, only through `<value> to <n> dp`; see\n // converters/parselets/RoundingParselets.ts.\n 97: { name: \"roundToPlaces\", min: 2, max: 2 },\n 98: { name: \"splitEach\", min: 2, max: 2 },\n 99: { name: \"savingsGoalPayment\", min: 3, max: 3 },\n 100: { name: \"savingsGoalPeriods\", min: 5, max: 5 },\n};\n\n/** \"1 argument\" / \"2 arguments\", so the message reads as English either way. */\nfunction plural(count: number): string {\n return count === 1 ? \"1 argument\" : `${count} arguments`;\n}\n\n/** How the expected count reads: exact, \"at least\", or a range. */\nfunction expectation(arity: BuiltinArity): string {\n if (arity.max === Infinity) return `at least ${plural(arity.min)}`;\n if (arity.min === arity.max) return plural(arity.min);\n return `${arity.min} to ${plural(arity.max)}`;\n}\n\n/**\n * Checks a builtin call's argument count before the implementation runs.\n *\n * @param index - The builtin index, the first operand of `OpCode.CALL_BUILTIN`.\n * @param argCount - The number of arguments the bytecode says were pushed.\n * @returns An `EngineError` to throw when the count is wrong, or `undefined`\n * when the call is well formed. Returned rather than thrown so the caller keeps\n * the throw at its own site, where the VM's own containment can see it.\n *\n * An index with no entry passes, which keeps a package that registers its own\n * builtin index working rather than making this table a gate on extensibility.\n */\nexport function builtinArityError(index: number, argCount: number): EngineError | undefined {\n const arity = BUILTIN_ARITY[index];\n if (arity === undefined) return undefined;\n if (argCount >= arity.min && argCount <= arity.max) return undefined;\n\n return ErrorFactory.execution(\n \"BUILTIN_ARITY_MISMATCH\",\n `${arity.name}() takes ${expectation(arity)}, but was given ${argCount === 0 ? \"none\" : plural(argCount)}`,\n { functionName: arity.name, expectedMin: arity.min, expectedMax: arity.max, actual: argCount },\n );\n}\n","import { OpCode } from \"@solve-js/parser/OpCode\";\nimport { Value, ValueType, numberValue, numberValueExact, numberValueRational, numberValueUncertain, stringValue, bigIntValue, hexValue, uomValue, uomValueExact, matrixValue, boolValue, datetimeValue, percentageValue, persistentValue, isArenaActive, errorValue, rateValue, isRateUnit, splitRateUnit, isTimecodeUnit, timecodeFps, rangeValue, symbolicValue, colourValue, faultedOperand, faultedIn, type MatrixEntry, type MatrixData, type RangeData, type ColourData } from \"@solve-js/vm/Value\";\nimport { decimalFromLiteral, decimalNegate, decimalToNumber } from \"@solve-js/decimal\";\nimport { moneyExactMagnitude, scaleMoneyByPercent, scaleMoneyExact } from \"@solve-js/vm/MoneyExact\";\nimport { varNode as varSymbolicNode, type SymbolicNode as SymbolicNodeType, type Rational, rationalNeg } from \"@solve-js/symbolic\";\nimport { symbolicPow, symbolicNeg, symbolicBuiltin, SYMBOLIC_NATIVE_BUILTINS } from \"@solve-js/vm/SymbolicOps\";\nimport { rowMajorToColumnMajor, matrixMultiply, matrixPower, matrixCompare, matIndex, matAt, inBounds, collectionToValues, matrixEntryToValue } from \"@solve-js/vm/MatrixOps\";\nimport type { VM, OpRegistry, EquationDef, ScalarEquationDef } from \"@solve-js/vm/OpRegistry\";\nimport { convertUnit, convertRate, getMeasure, getBestUnit, getConvertiblePossibilities, isWorkdayUnit } from \"@solve-js/uom/UomConverter\";\nimport { sharedCurrencyExchange } from \"@solve-js/uom/CurrencyExchange\";\nimport { ErrorFactory, normalizeUnknownError, type EngineError } from \"@solve-js/errors/UnifiedErrorFramework\";\nimport { CoreErrorCodes } from \"@solve-js/errors/ErrorCode\";\nimport { addBusinessDays as walkBusinessDays, countBusinessDaysBetween } from \"@solve-js/vm/BusinessDays\";\nimport { DiagnosticPipeline, DiagnosticEventType } from \"@solve-js/diagnostics\";\nimport { builtinFunctions, asConverterRegistry } from \"@solve-js/vm/VMBuiltins\";\nimport { builtinArityError } from \"@solve-js/vm/VMBuiltinArity\";\nimport { defaultEngineContext } from \"@solve-js/engine/EngineContext\";\nimport type { EngineContext } from \"@solve-js/engine/EngineContext\";\nimport { getOpCodeName } from \"@solve-js/parser/OpCode\";\nimport { unifyUom, binaryOp, compareUom, incomparableUnitsError, describeConversionMismatch, toBigIntOperand, compareBigIntOperands, bigIntDivisionByZero, power, exactRationalOp, compareRationalOperands, uncertainOp } from \"@solve-js/vm/VMConversion\";\nimport { CURRENCY_DISPLAY } from \"@solve-js/uom/CurrencyAliases\";\nimport { UNIT_TABLE } from \"@solve-js/uom/generated/UnitTable.generated\";\nimport { sharedGlobalVariableStore } from \"@solve-js/vm/GlobalVariableStore\";\nimport { beginEvaluation, chargeAllocation, chargeFunctionCall, checkAllocation, checkedArray, endEvaluation } from \"@solve-js/vm/AllocationBudget\";\nimport type { BytecodeProgram, UserFunctionDef, AnonymousBodyDef } from \"@solve-js/parser/BytecodeBuilder\";\n\n/**\n * Create a new VM instance with the given opcode registry and configurable limits.\n *\n * The VM is a stack machine that executes compiled bytecode. It manages:\n * - A value stack (bounded by `maxStackDepth`)\n * - A variable store (Map of name → Value)\n * - An instruction counter (bounded by `maxInstructions`)\n * - An AbortSignal for async cancellation\n *\n * @param registry - Opcode handler registry for plugin-extensible opcodes\n * @param maxStackDepth - Maximum stack slots (default 200)\n * @param maxInstructions - Maximum opcodes per expression (default 50000)\n * @param maxFunctionRecursionDepth - Maximum nested user-defined-function\n * calls (default 50). See the VM interface's `pushCallFrame` doc for why\n * this exists as its own dedicated guard, separate from `maxInstructions`.\n * @param maxCollectionSize - Maximum elements a Range or Matrix may be\n * expanded to by `map`/`reduce` (default 100000). Neither of the two\n * counters above can see that expansion, since it happens inside one\n * opcode and never touches the value stack.\n * @param maxAllocatedElements - Maximum elements one evaluation may\n * materialise in TOTAL (default 2000000). The parameter above bounds one\n * collection; per-site bounds do not compose, and an operation whose result\n * is the product of two legal operands (a matrix multiply) is bounded by\n * neither. See `vm/AllocationBudget.ts`.\n * @param maxFunctionCalls - Maximum user-defined-function calls one\n * evaluation may make in total (default 10000). `maxFunctionRecursionDepth`\n * above bounds how deep they nest and cannot see how many there are: a\n * doubling chain reaches two million calls at a depth of twenty-two.\n * @param maxDateOffsetYears - How far forward `<date> + N workdays` may\n * reach, in years (default 100). The one date offset that walks rather than\n * computing, so the one that needs a ceiling. See `addBusinessDays()`.\n * @param minDateOffsetYears - The same bound backwards, negative (default\n * -100).\n * @param context - Registries belonging to the engine that created this VM.\n */\nexport function createVM(\n registry: OpRegistry,\n maxStackDepth = 200,\n maxInstructions = 50000,\n maxFunctionRecursionDepth = 50,\n maxCollectionSize = 100000,\n maxAllocatedElements = 2000000,\n maxFunctionCalls = 10000,\n maxDateOffsetYears = 100,\n minDateOffsetYears = -100,\n // Defaults to the shared context so the many call sites that predate\n // per-engine contexts keep working unchanged. An ExpressionEngine always\n // passes its own.\n context: EngineContext = defaultEngineContext,\n // The host's resolved holiday predicate for working-day arithmetic, or\n // undefined for weekends-only. Last, and optional, so every existing\n // createVM() call site keeps the honest default without changing. An\n // ExpressionEngine passes what `resolveHolidayPredicate(date.holidays)`\n // returns. See constants/Configuration.ts's `date.holidays`.\n holidayPredicate?: (epochMs: number) => boolean,\n): VM {\n const stack: Value[] = [];\n const variables = new Map<string, Value>();\n let instructionCount = 0;\n\n let activeSignal: AbortSignal | undefined;\n let abortCurrent: (() => void) | undefined;\n\n // User-defined-function call frames, a real stack of name-keyed Maps\n // not a flat map, so nested/recursive calls (double(double(5))) each\n // get their own bound-argument scope instead of clobbering a shared\n // one. `getVar` below only ever consults the INNERMOST frame (no\n // lexical capture across nested calls). See OpRegistry.ts's VM\n // interface doc for the full reasoning.\n const callFrames: Map<string, Value>[] = [];\n // VM-INSTANCE-scoped (not module-global), an intentional improvement\n // over a shared-across-engines registry: two ExpressionEngine\n // instances with different documents no longer risk one's `f(x)`\n // clobbering the other's same-named function, which a module-level\n // Map would allow (the same class of gap ARCHITECTURE.md §10's L1\n // cross-instance-isolation item already tracks for pluginFunctionRegistry\n // et al.. This VM-scoped design simply doesn't inherit it).\n const userFunctions = new Map<string, UserFunctionDef>();\n // Bare (colon-less) equations (`a*x = rhs`), keyed by their free\n // variable. See OpRegistry.ts's EquationDef doc comment. Same\n // VM-instance scoping reasoning as userFunctions above.\n const equations = new Map<string, EquationDef>();\n // Bare scalar equations (`x^2-4 = 0`), kept in their own map rather than\n // sharing the one above, since the two are solved by entirely different\n // machinery. See OpRegistry.ts's ScalarEquationDef doc comment.\n const scalarEquations = new Map<string, ScalarEquationDef>();\n\n return {\n push(v: Value) {\n if (stack.length < maxStackDepth) {\n stack.push(v);\n }\n },\n getMaxStackDepth() { return maxStackDepth; },\n getMaxCollectionSize() { return maxCollectionSize; },\n getMaxAllocatedElements() { return maxAllocatedElements; },\n getMaxFunctionCalls() { return maxFunctionCalls; },\n getMaxDateOffsetYears() { return maxDateOffsetYears; },\n getMinDateOffsetYears() { return minDateOffsetYears; },\n // False whenever no calendar was configured, which is what makes\n // unconfigured working-day arithmetic weekends-only. See\n // vm/BusinessDays.ts, the only reader.\n isHoliday(epochMs: number) { return holidayPredicate ? holidayPredicate(epochMs) : false; },\n pop() {\n if (stack.length === 0) {\n return numberValue(0);\n }\n return stack.pop()!;\n },\n /**\n * Popped through `safePop()` for the same reason as `popString()` below.\n * Only the underflow half applies here: `toNumber()` is a real method on\n * every Value, so there was no cast to make a non-number look like one,\n * and the `!` was the whole bug.\n */\n popNumber() { return safePop(stack).toNumber(); },\n /**\n * Popped through the same two guards the dispatch loop below uses, and\n * for the same reason: a package's opcode handler can disagree with its\n * own bytecode exactly as this engine's compiler can disagree with\n * hand-assembled input.\n *\n * This was `stack.pop()!.value as string`, which had neither guard. The\n * `!` is compile-time only, so an empty stack reached `.value` and threw\n * a raw TypeError; so is the cast, so any Value the stack happened to be\n * holding was handed back as a \"string\" and threw in the handler's own\n * code some lines later. Nothing in this repo calls this method, which is\n * the only reason the fuzz corpus never found either.\n */\n popString() { return stringOperand(safePop(stack), \"VM.popString()\"); },\n peek() { return stack[stack.length - 1]; },\n getStack() { return stack; },\n registry,\n getVar(key: string) {\n if (callFrames.length > 0) {\n const frameValue = callFrames[callFrames.length - 1].get(key);\n if (frameValue !== undefined) return frameValue;\n }\n return variables.get(key);\n },\n setVar(key: string, val: Value) { variables.set(key, val); },\n deleteVar(key: string) { variables.delete(key); },\n pushCallFrame(frame: Map<string, Value>) {\n if (callFrames.length >= maxFunctionRecursionDepth) {\n throw ErrorFactory.execution(\n \"FUNCTION_RECURSION_LIMIT_EXCEEDED\",\n `Function call nesting exceeded maximum depth of ${maxFunctionRecursionDepth} (possible infinite recursion, e.g. f(x) = f(x))`,\n { maxFunctionRecursionDepth },\n );\n }\n callFrames.push(frame);\n },\n popCallFrame() { callFrames.pop(); },\n getCallFrame() { return callFrames.length > 0 ? callFrames[callFrames.length - 1] : undefined; },\n defineUserFunction(name: string, params: string[], program: BytecodeProgram) {\n userFunctions.set(name, { name, params, program });\n },\n getUserFunction(name: string) { return userFunctions.get(name); },\n hasUserFunction(name: string) { return userFunctions.has(name); },\n getVariableEntries() { return Array.from(variables.entries()); },\n getUserFunctionDefs() { return Array.from(userFunctions.values()); },\n defineEquation(variable: string, factorNames: string[], rhsProgram: BytecodeProgram) {\n equations.set(variable, { variable, factorNames, rhsProgram });\n },\n getEquation(variable: string) { return equations.get(variable); },\n hasEquation(variable: string) { return equations.has(variable); },\n defineScalarEquation(variable: string, lhsProgram: BytecodeProgram, rhsProgram: BytecodeProgram) {\n scalarEquations.set(variable, { variable, lhsProgram, rhsProgram });\n },\n getScalarEquation(variable: string) { return scalarEquations.get(variable); },\n hasScalarEquation(variable: string) { return scalarEquations.has(variable); },\n reset() {\n stack.length = 0;\n variables.clear();\n callFrames.length = 0;\n userFunctions.clear();\n equations.clear();\n scalarEquations.clear();\n instructionCount = 0;\n // The allocation tally deliberately isn't touched here. It belongs to\n // an evaluation rather than to a VM, and the outermost\n // `beginEvaluation()` zeroes it on the way in, so a reset would be\n // redundant work on a method the benchmark suite calls in its inner\n // loop.\n // Abort any in-flight async work for the previous expression\n if (abortCurrent) { abortCurrent(); abortCurrent = undefined; }\n activeSignal = undefined;\n },\n get activeSignal() { return activeSignal; },\n set activeSignal(s: AbortSignal | undefined) { activeSignal = s; },\n get abortCurrent() { return abortCurrent; },\n set abortCurrent(f: (() => void) | undefined) { abortCurrent = f; },\n context,\n getMaxInstructions() { return maxInstructions; },\n getInstructionCount() { return instructionCount; },\n incrementInstructions(n: number) {\n instructionCount += n;\n if (instructionCount > maxInstructions) {\n throw ErrorFactory.execution(\"INSTRUCTION_LIMIT_EXCEEDED\", `Execution exceeded maximum of ${maxInstructions} instructions`);\n }\n },\n };\n}\n\n/**\n * Compiled bytecode ready for VM execution.\n *\n * Uses packed TypedArrays for cache-friendly memory layout:\n * - `opcodes`: Uint8Array of OpCode values\n * - `numbers`: Float64Array of numeric literals (indexed by opcode operands)\n * - `strings`: String table for identifiers, UoM units, and BigInt literals\n */\nexport interface Bytecode {\n opcodes: Uint8Array;\n numbers: Float64Array;\n strings: string[];\n /** User-defined-function bodies compiled alongside this program. See `parser/BytecodeBuilder.ts`'s `BytecodeProgram.userFunctionBodies`. */\n userFunctionBodies?: UserFunctionDef[];\n /** map/reduce anonymous transform bodies. See `parser/BytecodeBuilder.ts`'s `BytecodeProgram.anonymousBodies`. */\n anonymousBodies?: AnonymousBodyDef[];\n}\n\n/**\n * Per-line execution context, threaded optionally through\n * {@link executeBytecode} down to `CALL_PLUGIN`'s plugin-function handlers\n * (see `vm/VMBuiltins.ts`'s `pluginFunctionRegistry`).\n *\n * Exists so a package can implement cross-line features (`prev`, `line<N>`,\n * range/above aggregation. See `packages/lines/`) without every other\n * plugin function having to care: it's optional, and every existing\n * handler ignores it unchanged. Before this, a plugin function's only\n * input was its own call-site arguments, no line number, no access to\n * any other line's cached result. `getLineResult`/`isLineBoundary` are\n * both `undefined` when there's no real document (e.g.\n * `ExpressionEngine.evaluateExpression()`'s single-expression path, which\n * uses `lineIndex = -1` as its existing \"no document\" sentinel), a\n * plugin function needing document access must check for that itself\n * and return a clear error, never silently treat it as line 0.\n */\nexport interface LineExecutionContext {\n /** 1-based current line number, or -1 when there is no real document (see class doc above). */\n lineIndex: number;\n /** Look up another line's cached result by 1-based line number. `undefined` = not evaluated yet (or out of range), distinct from a line that evaluated to an actual `undefined`-like Value, which can't happen (every Value type has a concrete representation). */\n getLineResult?: (lineNumber: number) => Value | undefined;\n /** Whether line `lineNumber` is a blank line or a `#` heading, the stopping condition for \"total above\"/\"sum above\"/\"average above\" aggregation. */\n isLineBoundary?: (lineNumber: number) => boolean;\n /**\n * The variables another line's expression reads, by 1-based line number, or\n * `undefined` when the line has no evaluated expression (forward reference,\n * out of range, or markdown). Goal seek (`packages/goalseek/`) uses it to\n * refuse up front when the variable it was asked to vary is one the target\n * line never reads, rather than searching a relationship that cannot move.\n */\n getLineReads?: (lineNumber: number) => string[] | undefined;\n /**\n * Re-evaluate another line's already-compiled expression with `variable`\n * bound to `bound` for that one evaluation, without disturbing the\n * document's own value for it. This is the primitive goal seek\n * (`packages/goalseek/`) drives: binding a numeric candidate probes the\n * relationship, binding a symbolic placeholder (with `symbolicTolerant`)\n * reads it back in closed form. Returns an error Value when there is no\n * document, the line is not a plain expression ready to run, or its\n * re-evaluation itself faults. The binding is a call frame, so it shadows\n * the document's value exactly the way a function parameter does and is\n * gone the moment the probe returns.\n */\n evaluateLineWithBinding?: (\n lineNumber: number,\n variable: string,\n bound: Value,\n symbolicTolerant: boolean,\n ) => Value;\n /**\n * The hard ceiling on goal seek's bisection steps, from\n * `config.vm.maxGoalSeekIterations`. Carried on the context so the search,\n * which runs as a plugin function with no other view of engine config, is\n * bounded by the host's configured limit rather than a hardcoded one.\n */\n goalSeekMaxIterations?: number;\n /**\n * The RAW markdown text of line `lineNumber` (1-based), or `undefined`\n * when there is no real document or the line is out of range. Distinct\n * from `getLineResult`, which returns a line's evaluated Value: a\n * markdown table's rows are skipped by the evaluator and hold no result,\n * so reading a column as data has to go back to the source text. Backs\n * the tables package (`packages/tables/`), which walks upward from the\n * current line to find the nearest table and read one of its columns.\n */\n getLineText?: (lineNumber: number) => string | undefined;\n}\n\n/**\n * Discriminated union returned by {@link executeBytecode}.\n *\n * Two variants:\n * - `value`: execution completed synchronously with a concrete Value\n * - `pending`: an async plugin call was encountered, the orchestrator\n * must await the resolver Promise, then re-execute\n *\n * Replaces the old throw-AsyncSuspenseError pattern, eliminating the need\n * for try/catch in the engine.\n */\nexport type EvalResult =\n | { type: 'value'; value: Value }\n | { type: 'pending'; queryKey: string; resolver: Promise<Value>; packageId: string; signal: AbortSignal }\n /**\n * NEW third arm, an internal invariant violation (stack underflow via\n * `safePop()`, an unresolved global variable bypassing preflight, a\n * safety limit exceeded) surfaced as a controlled, structured\n * `EngineError` instead of letting a raw exception escape\n * `executeBytecode()` uncaught. See `executeBytecode()`'s own doc\n * comment on the try/catch this arm makes possible.\n */\n | { type: 'error'; error: EngineError };\n\n/**\n * Extract the Value from an EvalResult. Throws if the result is\n * `'pending'` (should not happen at call sites that have already resolved\n * async dependencies) or `'error'` (re-throws the original `EngineError`\n * as-is, preserving its structure. This used to be a raw `new Error(...)`).\n */\nexport function unwrapEvalResult(result: EvalResult): Value {\n if (result.type === 'value') return result.value;\n if (result.type === 'error') throw result.error;\n throw ErrorFactory.internal(\"UNEXPECTED_PENDING_RESULT\", `Expected value result but got pending: ${result.queryKey}`);\n}\n\n// ── Shared helpers ─────────────────────────────────────────────────────\n// Kept as module-level functions so V8 can inline them at the switch case\n// call sites. Cost: zero when inlined by TurboFan.\n\n/**\n * How many cells `matrixMultiply(l, r)` will materialise, computed from the\n * shapes alone so the answer is available before the multiply runs.\n *\n * Mirrors that function's own three cases. A dimension mismatch returns 0\n * rather than a product: the multiply refuses that pair without allocating, and\n * charging for an allocation that never happens would refuse a later, legal one.\n *\n * @param l - Left operand's shape and data.\n * @param r - Right operand's shape and data.\n * @returns Cell count of the result, or 0 when the shapes cannot be multiplied.\n */\nfunction matrixProductCells(l: MatrixData, r: MatrixData): number {\n // A 1x1 operand broadcasts over the other rather than contracting with it,\n // so the result is the size of the other operand.\n if (l.rows === 1 && l.cols === 1) return r.data.length;\n if (r.rows === 1 && r.cols === 1) return l.data.length;\n if (l.cols !== r.rows) return 0;\n return l.rows * r.cols;\n}\n\n/**\n * How many cells {@link matrixPower} will materialise across its whole run.\n *\n * It squares repeatedly rather than multiplying one factor at a time, so the\n * count is per squaring step and not just the size of the answer: `a^1000000`\n * is twenty multiplications of a full-size matrix, each one a fresh allocation.\n *\n * @param m - The base, which must be square for the power to be attempted.\n * @param exponent - The power.\n * @returns Total cells the repeated squaring will allocate.\n */\nfunction matrixPowerCells(m: MatrixData, exponent: number): number {\n if (!Number.isInteger(exponent) || exponent < 0) return 0;\n const cells = m.rows * m.cols;\n // The identity, then up to two products per bit of the exponent (one\n // squaring, one accumulation).\n return cells * (1 + (exponent < 2 ? 1 : 2 * Math.floor(Math.log2(exponent))));\n}\n\n/**\n * Fatal-bug fix: pop the stack, throwing a controlled `EngineError` instead\n * of silently returning `undefined` on an empty stack. Every one of this\n * dispatch loop's ~90 opcode cases used to call the raw `stack.pop()!`\n * the `!` is compile-time-only, so if bytecode's push/pop counts ever\n * didn't match what an opcode expected (corrupted bytecode, a buggy\n * third-party package's parselet, an internal compiler bug), `pop()`\n * silently returned `undefined` and the NEXT property access on it threw\n * a raw, uncontrolled `TypeError`. This file's own comments already\n * flagged the general risk class (see `maxStackDepth`'s doc comment above)\n * but only ever built a backstop against stack GROWTH; underflow had none.\n * Caught for free by `executeBytecode()`'s new outer try/catch.\n */\nfunction safePop(stack: Value[]): Value {\n if (stack.length === 0) {\n throw ErrorFactory.internal({\n code: \"STACK_UNDERFLOW\",\n message: \"Stack underflow: an opcode expected a value on the stack but it was empty\",\n expected: \"at least one value on the VM stack\",\n found: \"an empty stack\",\n suggestion: \"this indicates corrupted bytecode or a bug in a package's parselet (mismatched push/pop counts), not a user-input error\",\n });\n }\n return stack.pop()!;\n}\n\n/**\n * What to tell a caller who handed `executeBytecode()` a program it cannot run.\n *\n * `executeBytecode` is a public export, so a bytecode program is CALLER INPUT in\n * exactly the way an expression string is. It was not being treated that way:\n * every operand was read on trust, so a truncated stream or an out-of-range\n * pool index reached `BigInt(undefined)`, `code.toUpperCase()` on a boolean, or\n * a reentrant call with no program at all. Each of those arrived as a raw\n * TypeError, was normalised to UNEXPECTED_ERROR/INTERNAL, and told the caller\n * the engine had a bug when what actually happened was that they passed\n * eleven bytes of nonsense.\n *\n * VALIDATION rather than INTERNAL, and recoverable, because that is what it is.\n */\nconst MALFORMED_BYTECODE_SUGGESTION =\n \"bytecode is caller input on this entry point: rebuild the program with the engine's compiler, or fix the hand-assembled stream\";\n\n/**\n * Whatever was running when a malformation was found, for the message to name.\n *\n * The dispatch loop always has an OpCode. The `VM` interface's `popString()`\n * does not: it is called from a package's own opcode handler, which knows its\n * opcode perfectly well but has no way to pass it to a method whose signature\n * is fixed SDK surface. The method name is the next-best locator, and it is the\n * one that author is looking at anyway, so a site is either of the two.\n */\ntype BytecodeSite = OpCode | string;\n\n/** A site's name for the message: an opcode's mnemonic, or a method name as given. */\nfunction siteName(site: BytecodeSite): string {\n return typeof site === \"number\" ? getOpCodeName(site) : site;\n}\n\n/**\n * Builds the refusal, naming the site and what it was reaching for.\n *\n * @param code - Which class of malformation this is.\n * @param site - The opcode being executed when the problem was found, or the\n * VM-interface method that found it. See {@link BytecodeSite}.\n * @param problem - Completes \"Malformed bytecode: <SITE> ...\".\n * @param expected - What a well-formed program would have had here.\n * @param found - What was there instead.\n * @param context - Anything else worth carrying, e.g. the offending index.\n * @returns The error to throw.\n */\nfunction malformedBytecode(\n code: string,\n site: BytecodeSite,\n problem: string,\n expected: string,\n found: string,\n context: Record<string, unknown> = {},\n): EngineError {\n const name = siteName(site);\n return ErrorFactory.validation({\n code,\n message: `Malformed bytecode: ${name} ${problem}`,\n expected,\n found,\n suggestion: MALFORMED_BYTECODE_SUGGESTION,\n // A named site reports under `site` rather than borrowing `opcodeName`,\n // so a host reading `opcode`/`opcodeName` never gets a method name\n // where it expects an opcode, and never has to tell a missing opcode\n // apart from opcode 0.\n context: typeof site === \"number\"\n ? { opcode: site, opcodeName: name, ...context }\n : { site: name, ...context },\n });\n}\n\n/**\n * Reads one operand byte, refusing a stream that ends mid-instruction.\n *\n * `opcodes[at]` on a `Uint8Array` past its end is `undefined` rather than a\n * throw, so an operand read off the end propagates silently into whatever the\n * handler does next. A one-byte `[PUSH_BIGINT]` program used to reach\n * `BigInt(undefined)` this way.\n *\n * @param opcodes - The instruction stream.\n * @param at - Offset of the operand byte, i.e. the caller passes `ip++`.\n * @param op - The opcode being executed, for the message.\n * @param role - What the operand is, e.g. \"constant-pool index\".\n * @returns The operand byte.\n */\nfunction operandByte(opcodes: Uint8Array, at: number, op: OpCode, role: string): number {\n if (at >= opcodes.length) {\n throw malformedBytecode(\n \"MALFORMED_BYTECODE_TRUNCATED\",\n op,\n `is missing its ${role}: the program ends mid-instruction`,\n `an operand byte at offset ${at}`,\n `a program only ${opcodes.length} byte(s) long`,\n { offset: at, length: opcodes.length, role },\n );\n }\n return opcodes[at];\n}\n\n/**\n * Reads one operand byte and checks it actually indexes the pool it names.\n *\n * @param opcodes - The instruction stream.\n * @param at - Offset of the operand byte.\n * @param op - The opcode being executed.\n * @param role - What the operand is, for the truncation message.\n * @param poolSize - How many entries the pool holds.\n * @param poolName - The pool's name, for the message.\n * @returns An index known to be within the pool.\n */\nfunction poolIndex(\n opcodes: Uint8Array,\n at: number,\n op: OpCode,\n role: string,\n poolSize: number,\n poolName: string,\n): number {\n const index = operandByte(opcodes, at, op, role);\n if (index >= poolSize) {\n throw malformedBytecode(\n \"MALFORMED_BYTECODE_CONSTANT_INDEX\",\n op,\n `reads ${poolName} entry ${index}, which does not exist`,\n `an index below ${poolSize}`,\n `${index}`,\n { index, poolSize, pool: poolName },\n );\n }\n return index;\n}\n\n/**\n * Reads a string-pool entry through the bounds check above.\n *\n * The extra type check is not redundant with the bounds check: `strings` is an\n * ordinary array on a caller-supplied program, so it can be sparse or hold\n * something that is not a string at all.\n *\n * @param opcodes - The instruction stream.\n * @param at - Offset of the operand byte.\n * @param strings - The program's string pool.\n * @param op - The opcode being executed.\n * @param role - What the operand is, for the message.\n * @returns The pooled string.\n */\nfunction poolString(opcodes: Uint8Array, at: number, strings: string[], op: OpCode, role: string): string {\n return pooledString(strings, operandByte(opcodes, at, op, role), op);\n}\n\n/**\n * The same check for an index that has already been read.\n *\n * `map(f, ...)` and `reduce(f, ...)` name their function through the `ref`\n * operand they had to read first in order to know which arm to take.\n *\n * @param strings - The program's string pool.\n * @param index - The pool index.\n * @param op - The opcode being executed.\n * @returns The pooled string.\n */\nfunction pooledString(strings: string[], index: number, op: OpCode): string {\n const text = strings[index];\n if (typeof text !== \"string\") {\n throw malformedBytecode(\n \"MALFORMED_BYTECODE_CONSTANT_INDEX\",\n op,\n `reads string-pool entry ${index}, which is ${index >= strings.length ? \"past the end of the pool\" : \"not a string\"}`,\n `an index below ${strings.length}, holding a string`,\n index >= strings.length ? `${index}` : typeof text,\n { index, poolSize: strings.length, pool: \"string-pool\" },\n );\n }\n return text;\n}\n\n/**\n * A unit or converter name taken off the value stack.\n *\n * Every one of these sites used to be a bare `safePop(stack).value as string`.\n * The cast is compile-time only, so any Value the stack happened to be holding\n * went straight through, and the next `.toLowerCase()`/`.indexOf()` threw. This\n * also stops a Uom being built around a non-string unit, which is what let a\n * malformed stream carry the problem forward into unrelated handlers and\n * builtins that all reasonably assume a unit is text.\n *\n * @param value - The popped operand.\n * @param site - The opcode being executed, or the VM-interface method doing\n * the popping. See {@link BytecodeSite}.\n * @param role - What the string is, e.g. \"target unit name\". Left out by a\n * caller that has nothing more specific to say than \"a string\", which is all\n * `popString()` knows: its handler is the only thing that knows the role.\n * @returns The string.\n */\nfunction stringOperand(value: Value, site: BytecodeSite, role?: string): string {\n if (typeof value.value !== \"string\") {\n throw malformedBytecode(\n \"MALFORMED_BYTECODE_OPERAND_TYPE\",\n site,\n `expected a ${role ?? \"string\"} on the stack`,\n role ? `a string value holding the ${role}` : \"a string value\",\n `a ${ValueType[value.type] ?? \"unknown\"} value`,\n role ? { role, valueType: value.type } : { valueType: value.type },\n );\n }\n return value.value;\n}\n\n/**\n * Refuses a `map`/`reduce` body kind the dispatch has no arm for.\n *\n * The three arms are 0 (an inline anonymous body), 1 (a builtin) and 2 (a\n * user-defined function). Anything else used to fall past all of them with\n * `program` still undefined and then recurse into `executeBytecode(undefined)`,\n * whose destructure threw before its own try/catch could see it.\n *\n * @param kind - The operand as read.\n * @param ref - The body reference beside it, for the message.\n * @param op - MAP_INVOKE or REDUCE_INVOKE.\n */\nfunction requireKnownBodyKind(kind: number, ref: number, op: OpCode): void {\n if (kind !== 0 && kind !== 1 && kind !== 2) {\n throw malformedBytecode(\n \"MALFORMED_BYTECODE_BODY_KIND\",\n op,\n `has body kind ${kind}, which is not one this VM knows`,\n \"0 (inline body), 1 (builtin function) or 2 (user-defined function)\",\n `${kind}`,\n { kind, ref },\n );\n }\n}\n\n/**\n * Turns a pooled string into a BigInt without letting V8's SyntaxError out.\n *\n * `BigInt(\"1.000\")` throws a raw `SyntaxError`, which arrived at the host as\n * UNEXPECTED_ERROR/INTERNAL. From the `./vm` surface the string is caller\n * input; from ordinary source it means the lexer put something in the pool that\n * is not an integer, which is a real defect but still not something to report\n * as an unexplained internal fault on the user's line.\n *\n * @param text - The pooled literal text.\n * @param op - The opcode being executed.\n * @returns The parsed BigInt.\n */\nfunction parseBigIntLiteral(text: string, op: OpCode): bigint {\n try {\n return BigInt(text);\n } catch {\n throw malformedBytecode(\n \"MALFORMED_BYTECODE_BIGINT_LITERAL\",\n op,\n `cannot read \"${text}\" as a whole number`,\n \"a string holding an integer, with no decimal point or separators\",\n `\"${text}\"`,\n { literal: text },\n );\n }\n}\n\n/**\n * Whether a program is runnable at all, checked before anything reads it.\n *\n * The destructure at the top of `executeBytecode()` sits outside its try/catch,\n * so `executeBytecode(undefined)` threw a raw TypeError at whoever called it.\n * That is reachable from inside the engine too: a `map`/`reduce` body whose\n * side-table entry is missing recurses with `program` undefined.\n *\n * Duck-typed rather than an `instanceof` check, because callers and tests\n * legitimately build programs with plain arrays rather than typed ones.\n *\n * @param bytecode - Whatever was passed in.\n * @returns A description of what is wrong, or `null` when it is runnable.\n */\nfunction unrunnableProgram(bytecode: unknown): string | null {\n if (bytecode === null || typeof bytecode !== \"object\") {\n return `expected a bytecode program, got ${bytecode === null ? \"null\" : typeof bytecode}`;\n }\n const candidate = bytecode as { opcodes?: unknown; numbers?: unknown; strings?: unknown };\n if (typeof (candidate.opcodes as { length?: unknown } | undefined)?.length !== \"number\") {\n return \"the program has no `opcodes` array\";\n }\n if (typeof (candidate.numbers as { length?: unknown } | undefined)?.length !== \"number\") {\n return \"the program has no `numbers` pool\";\n }\n if (typeof (candidate.strings as { length?: unknown } | undefined)?.length !== \"number\") {\n return \"the program has no `strings` pool\";\n }\n return null;\n}\n\n/**\n * Reentrantly executes a `map`/`reduce` transform body, either an\n * anonymous inline expression (`10*x` in `map(10*x, [...])`) or a real\n * user-defined function's own body (`map(f, ...)`), with a fresh call\n * frame binding `params[i] -> args[i]`. Mirrors `CALL_USER_FUNCTION`'s own\n * reentrant-`executeBytecode()` pattern exactly (see its case below for\n * the full reasoning on why this is safe); factored out here so\n * `MAP_INVOKE`/`REDUCE_INVOKE` don't each duplicate it twice (once per\n * transform kind that needs a call frame, the builtin-function kind\n * needs no frame at all, so it's handled inline at each call site\n * instead).\n *\n * `symbolicTolerant` (H.3) is threaded straight through from the\n * ENCLOSING `executeBytecode()` call's own flag (see MAP_INVOKE/\n * REDUCE_INVOKE below), not hardcoded true, so a map/reduce transform\n * body only tolerates an undefined variable (e.g. the free `b` in\n * `reduce(acc+x+b,[1,2,3])=>2b+6`) when the OUTER expression is itself\n * running in a `=>` solve/simplify context; ordinary (non-`=>`)\n * map/reduce usage keeps today's exact behavior, a genuinely undefined\n * variable inside the transform body still hard-throws.\n */\nfunction invokeFrameBody(\n params: string[],\n program: BytecodeProgram,\n args: Value[],\n vm: VM,\n pipeline: DiagnosticPipeline | undefined,\n expression: string | undefined,\n context: LineExecutionContext | undefined,\n symbolicTolerant: boolean,\n): Value {\n const frame = new Map<string, Value>();\n for (let i = 0; i < params.length; i++) frame.set(params[i], args[i]);\n vm.pushCallFrame(frame);\n let bodyResult: EvalResult;\n try {\n bodyResult = executeBytecode(program, vm, pipeline, expression, context, symbolicTolerant);\n } finally {\n vm.popCallFrame();\n }\n if (bodyResult.type === \"pending\") {\n // Same v1 scope decision as CALL_USER_FUNCTION's own async body\n // rejection, propagating a 'pending' result up through a\n // reentrant executeBytecode() call would need the OUTER\n // expression's own bytecode position/stack state to also be\n // resumable later, which isn't implemented.\n throw ErrorFactory.execution(\n \"MAP_REDUCE_ASYNC_UNSUPPORTED\",\n `map/reduce transform bodies calling an async operation (weather, stocks, currency, ...) aren't supported`,\n );\n }\n if (bodyResult.type === \"error\") {\n throw bodyResult.error;\n }\n return bodyResult.value;\n}\n\n/**\n * Executes an algebra verb's expression argument with the verb's own named\n * unknown bound to itself, for `OpCode.BIND_UNKNOWN`.\n *\n * `der(x^2, x)` names x as the unknown it differentiates by, which declares\n * x bound for that expression: it has to read as the unknown even on a page\n * that also says `:x = 5`. This is the same shadowing a function's parameter\n * already gets (`getVar` reads the innermost call frame before the variable\n * store), reached the same way, with a frame. Without it the expression was\n * evaluated against the document's value first, so the verb was handed 25 and\n * `der(x^2, x)` answered 0, `solve(x^2-4=0, x)` reported no solution, and\n * `integral(x^2, x)` gave `25x`.\n *\n * The frame is copied from the enclosing one rather than started empty, so a\n * verb written inside a function or a map body still sees that body's own\n * parameters; only the named unknown is replaced.\n *\n * @param name - The unknown the verb named.\n * @param program - The expression argument, compiled on its own.\n * @returns The expression's value, with `name` free inside it.\n */\nfunction invokeWithBoundUnknown(\n name: string,\n program: BytecodeProgram,\n vm: VM,\n pipeline: DiagnosticPipeline | undefined,\n expression: string | undefined,\n context: LineExecutionContext | undefined,\n symbolicTolerant: boolean,\n): Value {\n const frame = new Map<string, Value>(vm.getCallFrame());\n frame.set(name, symbolicValue(varSymbolicNode(name)));\n vm.pushCallFrame(frame);\n let bodyResult: EvalResult;\n try {\n bodyResult = executeBytecode(program, vm, pipeline, expression, context, symbolicTolerant);\n } finally {\n vm.popCallFrame();\n }\n if (bodyResult.type === \"pending\") {\n // Unreachable through the shipped grammar (the parselets refuse an\n // async expression argument at parse time, see\n // SYMBOLIC_ARGUMENT_MUST_BE_SYNCHRONOUS), and stated as its own error\n // rather than left to fall through as an accidental value.\n throw ErrorFactory.execution(\n \"SYMBOLIC_ASYNC_UNSUPPORTED\",\n `an algebra verb's expression cannot call an async operation (weather, stocks, currency, ...)`,\n );\n }\n if (bodyResult.type === \"error\") {\n throw bodyResult.error;\n }\n return bodyResult.value;\n}\n\n/**\n * `$20/day + $300/week`, two rates over different periods.\n *\n * Adding them reported incompatible units, because USD/day and USD/week are\n * literally different unit strings. They are the same kind of thing measured\n * per different periods, though, so one converts into the other and the sum is\n * meaningful. The right operand's period wins, which is the one the reader\n * just wrote and so the one they are thinking in.\n *\n * @returns The converted left magnitude, or null when these are not two rates\n * sharing a numerator.\n */\nfunction unifyRatePeriods(l: Value, r: Value): number | null {\n if (l.type !== ValueType.Uom || r.type !== ValueType.Uom) return null;\n const leftUnit = l.unit;\n const rightUnit = r.unit;\n if (leftUnit === undefined || rightUnit === undefined) return null;\n\n const leftSlash = leftUnit.indexOf(\"/\");\n const rightSlash = rightUnit.indexOf(\"/\");\n if (leftSlash < 0 || rightSlash < 0) return null;\n // Same thing being measured, or there is nothing to reconcile.\n if (leftUnit.slice(0, leftSlash) !== rightUnit.slice(0, rightSlash)) return null;\n\n const leftPeriod = UNIT_TABLE[leftUnit.slice(leftSlash + 1).toLowerCase()] as readonly [number, number] | undefined;\n const rightPeriod = UNIT_TABLE[rightUnit.slice(rightSlash + 1).toLowerCase()] as readonly [number, number] | undefined;\n if (leftPeriod === undefined || rightPeriod === undefined) return null;\n if (leftPeriod[0] !== rightPeriod[0]) return null;\n\n // Per a longer period is a larger number: $20/day is $140/week.\n return l.toNumber() * (rightPeriod[1] / leftPeriod[1]);\n}\n\n/**\n * `$30 × 4 days`, money multiplied by a count of something.\n *\n * The unit system refused this outright, because there is no such unit as a\n * dollar-day and combining the two is genuinely undefined in general. But it\n * is not undefined in the one case where exactly one side is money: the other\n * side is then a count, and the answer is that much money.\n *\n * Restricted to money on purpose. `3 kg × 4 days` really has no meaning worth\n * guessing at, and it still says so.\n *\n * @returns The product, or null when this is not the money case.\n */\nfunction moneyTimesQuantity(l: Value, r: Value): Value | null {\n if (l.type !== ValueType.Uom || r.type !== ValueType.Uom) return null;\n // Captured before the rate guard, which narrows the property away.\n const leftUnit = l.unit;\n const rightUnit = r.unit;\n if (leftUnit === undefined || rightUnit === undefined) return null;\n // Checked directly rather than through isRateUnit(), whose `unit is\n // string` signature narrows both locals to never on the negative branch.\n if (leftUnit.includes(\"/\") || rightUnit.includes(\"/\")) return null;\n\n const leftIsMoney = CURRENCY_DISPLAY[leftUnit.toUpperCase()] !== undefined;\n const rightIsMoney = CURRENCY_DISPLAY[rightUnit.toUpperCase()] !== undefined;\n // Exactly one side. Money times money is not a thing either.\n if (leftIsMoney === rightIsMoney) return null;\n\n return uomValue(l.toNumber() * r.toNumber(), leftIsMoney ? leftUnit : rightUnit);\n}\n\n/**\n * `X + 10%` and `X - 10%`, where the percentage is relative to X.\n *\n * A percentage on its own means nothing; it is a proportion *of* something.\n * Which of the two readings applies depends on what it is being combined with,\n * so the decision is made here where both operands are known, the same way\n * Datetime and Rate are handled in these opcodes:\n *\n * 200 + 10% 220 a percentage of a quantity is relative to it\n * $300 + 15% $345.00 and that includes money and other units\n * 10% + 20% 30% two percentages are just proportions, they add\n * 30% + 0.4 70% as does a percentage and a bare fraction\n * 100% + 2 300% which is why this is 300% and not 3\n *\n * Returns `null` when neither operand is a Percentage, leaving the caller's\n * existing paths untouched.\n *\n * @param sign - `1` for addition, `-1` for subtraction.\n */\nfunction combinePercentage(l: Value, r: Value, sign: 1 | -1): Value | null {\n if (l.type === ValueType.Percentage) {\n // A measured quantity on the other side is the thing the proportion is\n // OF, so the answer is that quantity scaled, exactly as it would be\n // with the operands the other way round: \"10% + $5\" is $5.50, the same\n // as \"$5 + 10%\". It used to fall through to the ordinary path, which\n // added the bare fraction as though it were money and answered $5.10.\n // Subtraction reads the same way round (\"10% - $5\" is $5 less a tenth,\n // $4.50), which keeps the rule one rule rather than two.\n if (r.type === ValueType.Uom && r.unit !== undefined) {\n return scaleMoneyByPercent(r, r.unit, l.toNumber(), sign);\n }\n // Otherwise a percentage on the left keeps the result a percentage,\n // because the thing being described is still a proportion. Only\n // Number/Percentage make sense here; anything else (a date, a matrix)\n // falls through to the ordinary error path.\n if (r.type !== ValueType.Percentage && r.type !== ValueType.Number) return null;\n return percentageValue(l.toNumber() + sign * r.toNumber());\n }\n if (r.type !== ValueType.Percentage) return null;\n\n // A percentage on the right of something concrete scales it. Uom covers\n // money and every other unit, and the unit has to survive: \"$300 + 15%\"\n // is $345.00, not a bare 345.\n const factor = 1 + sign * r.toNumber();\n if (l.type === ValueType.Number) {\n // A scalar multiply scales a carried tolerance by the same factor, so a\n // measurement keeps its uncertainty: \"(100 +/- 5) + 10%\" is \"110 +/- 5.5\",\n // exactly what \"(100 +/- 5) * 1.1\" gives. Without this the tolerance was\n // silently dropped.\n const scaled = l.toNumber() * factor;\n if (l.uncertainty !== undefined) return numberValueUncertain(scaled, Math.abs(l.uncertainty * factor));\n return numberValue(scaled);\n }\n // A Uom with no unit string is not something this can scale meaningfully,\n // so it falls through to the ordinary path rather than inventing one. Money\n // stays exact via the base-ten scaling factor.\n if (l.type === ValueType.Uom && l.unit !== undefined) return scaleMoneyByPercent(l, l.unit, r.toNumber(), sign);\n return null;\n}\n\n/**\n * `X * p%` and `p% of X` are a scalar multiply, so a tolerance on `X` scales by\n * the factor: `(100 +/- 5) * 10%` and `10% of (100 +/- 5)` are `10 ± 0.5`. Only\n * fires when one operand is a Percentage and the other is an uncertain Number, so\n * every plain `100 * 10%` and every non-percentage multiply keeps its own path.\n * (`of` compiles to `MUL`, so this covers both spellings.) Returns null\n * otherwise, exactly as {@link combinePercentage} does for `+`/`-`.\n */\nfunction multiplyPercentWithUncertainty(l: Value, r: Value): Value | null {\n const pct = l.type === ValueType.Percentage ? l : r.type === ValueType.Percentage ? r : null;\n if (pct === null) return null;\n const other = pct === l ? r : l;\n if (other.type !== ValueType.Number || other.uncertainty === undefined) return null;\n const factor = pct.toNumber();\n return numberValueUncertain(other.toNumber() * factor, Math.abs(other.uncertainty * factor));\n}\n\n/**\n * Money times a scalar is a scalar multiply, so like `$X + p%` it must stay exact\n * to the cent: `15% of $0.10` and `$0.10 * 15%` are `$0.015 -> $0.02`, not the\n * `$0.01` a bare double rounds down to, and the same for a computed factor with\n * no exact sidecar of its own, e.g. `50% of 1% of $3` (the inner `50% of 1%`\n * reduces to a bare `0.005`). Fires when one operand is a currency Uom and the\n * other a plain Number or a Percentage, routing through the same base-ten scaling\n * the `+`/`-` path uses, which recovers the factor from its shortest decimal (see\n * MoneyExact.ts). A rational scalar (`$3 * 2/7`) is left alone so the exact\n * fraction is kept rather than flattened to a decimal, and a non-currency Uom\n * (`10% of 5 kg`) and every other multiply keep their existing path. (`of`\n * compiles to `MUL`, so this covers the `of` spellings too.)\n */\nfunction multiplyMoneyByScalarExact(l: Value, r: Value): Value | null {\n const money = l.type === ValueType.Uom ? l : r;\n const scalar = l.type === ValueType.Uom ? r : l;\n if (money.type !== ValueType.Uom || money.unit === undefined || !sharedCurrencyExchange.isCurrency(money.unit)) return null;\n if (scalar.type !== ValueType.Number && scalar.type !== ValueType.Percentage) return null;\n if (scalar.rational !== undefined) return null;\n return scaleMoneyExact(money, scalar.toNumber(), money.unit);\n}\n\n/**\n * A division involving a Percentage and an uncertain Number carries the tolerance\n * that {@link uncertainOp} drops for a Percentage operand, in both arrangements:\n *\n * (100 +/- 5) / 10% 1000 ± 50 X / p% = X/factor, spread scales by 1/factor\n * 10% / (2 +/- 0.1) 0.05 ± 0.0025 p% / (b ± e) = a/b, spread |a·e / b²|\n *\n * A zero divisor returns null so the general path surfaces the divide-by-zero,\n * and every other division keeps its own path.\n */\nfunction dividePercentWithUncertainty(l: Value, r: Value): Value | null {\n // Uncertain Number over a Percentage divisor: a scalar divide by `factor`.\n if (r.type === ValueType.Percentage && l.type === ValueType.Number && l.uncertainty !== undefined) {\n const factor = r.toNumber();\n if (factor === 0) return null;\n return numberValueUncertain(l.toNumber() / factor, Math.abs(l.uncertainty / factor));\n }\n // Percentage over an uncertain Number divisor: the divisor's relative spread\n // carries through the quotient (the dividend is exact, so only `b` varies).\n if (l.type === ValueType.Percentage && r.type === ValueType.Number && r.uncertainty !== undefined) {\n const b = r.toNumber();\n if (b === 0) return null;\n return numberValueUncertain(l.toNumber() / b, Math.abs((l.toNumber() * r.uncertainty) / (b * b)));\n }\n return null;\n}\n\n/** Extract milliseconds from a duration Value (UoM time unit or plain number).\n * The linear half of {@link shiftDatetime}, and the whole of it for any unit\n * shorter than a day. */\nfunction extractDurationMs(value: Value): number {\n if (value.type === ValueType.Uom) {\n const unit = value.unit;\n // Only a time-measure unit can be a duration. Checking the measure\n // BEFORE converting, rather than relying on convertUnit() to throw for\n // everything else, is deliberate: it makes `<date> + 5 kg` contribute\n // zero because kilograms are not a duration, not because a conversion\n // happened to fail. The two are the same today, but a single lenient\n // conversion is all it takes for them to diverge, and when they do the\n // symptom is a silently wrong date rather than an error. That is\n // exactly how `today + 5 m` came to mean five minutes.\n if (unit && getMeasure(unit) === \"time\") {\n try { return convertUnit(value.toNumber(), unit, \"ms\"); } catch { /* Ignore */ }\n }\n return 0;\n }\n return value.toNumber();\n}\n\n/**\n * Workdays in a year: 52.1775 weeks of five, rounded down.\n *\n * Only ever used to turn a limit configured in years into a number of steps\n * {@link addBusinessDays} may take, so being a day or two out across a century\n * is immaterial and no date is ever computed from it. Deliberately not the\n * unit table's workday<->day ratio, which exists for Rate arithmetic.\n */\nconst WORKDAYS_PER_YEAR = 260;\n\n/**\n * Advance (or, for negative `n`, retreat) a Datetime by `n` business days,\n * skipping Saturdays/Sundays, e.g. Friday + 1 workday lands on Monday, not\n * Saturday. Backs the datetime package's `<date> + N workdays` / `<date> -\n * N workdays` arithmetic and the `N working days after/before/from <date>`\n * form (see this function's call sites below and `DATE_WORKDAY_OFFSET`).\n *\n * Skips public holidays too when the host has configured a calendar: the walk\n * asks `vm.isHoliday()` about each candidate day and lands only on a working\n * one. With no calendar `vm.isHoliday()` is always false, so this is weekends-\n * only, the honest default (see `constants/Configuration.ts`'s `date.holidays`\n * and `vm/BusinessDays.ts`). Same predicate every working-day form consults, so\n * `<date> + N workdays` and `N working days after <date>` can never disagree.\n *\n * Walks one calendar day at a time (matching this file's existing\n * DATE_NEXT_WEEKDAY/DATE_LAST_WEEKDAY local-time convention below) rather\n * than a closed-form calculation, the exact skip pattern depends on which\n * day of the week the anchor date falls on (and which days the host excludes),\n * so there's no fixed ratio like uom/UomConverter.ts's workday<->day RATE\n * conversion (that's a linear approximation acceptable for Rate math; actual\n * date arithmetic needs the real, exact answer).\n *\n * That walk is why this is the one date offset with a ceiling on it. Every\n * other one moves a Date field once and lets Date recompute (see\n * addCalendarDays() below), so `today + 100000 days` costs what one day\n * costs; here the cost IS the offset. The loop runs entirely inside a single\n * ADD opcode, so `vm.maxInstructions` is never consulted while it runs:\n * `today + 100000000 workdays` froze for 13.2 seconds and then answered\n * \"Invalid Date\", and `today + 1000000000000 workdays` never answered at all.\n * `date.maxOffsetYears`/`date.minOffsetYears` bound it, which is also the\n * first thing in the engine ever to read those two fields. The same bound,\n * expanded to calendar days, is handed to the walk as its step cap, so a\n * calendar that marks every day a holiday (nothing ever counts) is refused\n * rather than looping forever.\n *\n * @throws `DATE_OFFSET_LIMIT_EXCEEDED` for an offset outside the configured\n * range. Recoverable: it is a statement about this line, not about the\n * engine.\n */\nfunction addBusinessDays(epochMs: number, n: number, vm: VM): number {\n const remaining = Math.trunc(Math.abs(n));\n const direction = n >= 0 ? 1 : -1;\n // Checked before the first step rather than counted during it, so a\n // hopeless offset costs nothing at all. Working in workdays rather than\n // converting the bound to days keeps the comparison exact for the number\n // the user actually typed, and the ratio only has to be right to name a\n // limit, not to compute a date.\n const limitYears = direction > 0 ? vm.getMaxDateOffsetYears() : -vm.getMinDateOffsetYears();\n const limitWorkdays = Math.floor(limitYears * WORKDAYS_PER_YEAR);\n if (remaining > limitWorkdays) {\n throw ErrorFactory.execution(\n \"DATE_OFFSET_LIMIT_EXCEEDED\",\n `A date offset of ${remaining.toLocaleString(\"en-US\")} workdays is about ${Math.round(remaining / WORKDAYS_PER_YEAR).toLocaleString(\"en-US\")} years, past the limit of ${limitYears} years for a workday offset`,\n { requestedWorkdays: remaining, limitYears, limitWorkdays },\n );\n }\n // Seven calendar days per workday is the floor of a week with only one\n // working day in it, which no real calendar reaches, so a legitimate\n // in-limit offset never trips this. A pathological all-holiday calendar\n // does, and is reported as the same limit error rather than hanging.\n const maxCalendarSteps = limitWorkdays * 7 + 7;\n const landed = walkBusinessDays(epochMs, n, (ms) => vm.isHoliday(ms), maxCalendarSteps);\n if (landed === null) {\n throw ErrorFactory.execution(\n \"DATE_OFFSET_LIMIT_EXCEEDED\",\n `A working-day offset of ${remaining.toLocaleString(\"en-US\")} could not be reached within the ${limitYears}-year limit; the configured holiday calendar leaves too few working days`,\n { requestedWorkdays: remaining, limitYears, maxCalendarSteps },\n );\n }\n return landed;\n}\n\n/** Milliseconds in a day that contains no daylight-saving transition. */\nconst MS_PER_DAY = 86_400_000;\n\n/**\n * How many calendar months one of these units spans.\n *\n * The unit table gives a month and a year fixed lengths (2,592,000 and\n * 31,536,000 seconds, i.e. exactly 30 and 365 days). Those ratios are correct\n * for pure duration arithmetic, which is why they are left alone: `2 years in\n * days` genuinely is 730 days, and other code depends on that. They are not\n * correct for landing on a calendar date, because a real month is 28 to 31\n * days and a real year is 365 or 366, so no single ratio can put \"a year after\n * January 1 2024\" on January 1 2025 (linearly it lands on December 31 2024,\n * a day early, and drifts further with every year added).\n *\n * Every unit named here is therefore shifted with `setMonth()` instead, by\n * this many months. Everything not named here keeps whatever the table says.\n */\nconst CALENDAR_MONTHS_PER_UNIT: Record<string, number> = {\n month: 1, months: 1, mo: 1,\n year: 12, years: 12, yr: 12, y: 12, a: 12,\n decade: 120, decades: 120, dec: 120,\n century: 1200, centuries: 1200,\n millennium: 12000, millennia: 12000,\n};\n\n/** Days in calendar month `monthIndex` (0-11) of `year`. Day zero of the\n * following month is the last day of this one, which is also how the leap\n * year rule gets applied without restating it. */\nfunction daysInMonth(year: number, monthIndex: number): number {\n return new Date(year, monthIndex + 1, 0).getDate();\n}\n\n/**\n * Move `epochMs` by `days` calendar days, holding the local wall-clock time.\n *\n * Stepping the day field is the whole point, the same reason\n * addBusinessDays() above does it. A day is only 86,400,000 ms when no\n * daylight-saving transition falls inside it: the day a zone springs forward\n * is 23 hours long and the day it falls back is 25. Adding a flat 86,400,000\n * across either one lands an hour off, and an hour off a local midnight is a\n * different calendar day, so `2024-11-03 + 1 day` answered November 3 again\n * in Los Angeles and `26/10/2024 + 2 days` answered October 27 in London.\n * `setDate()` moves the field and lets Date recompute the offset, so the\n * answer is the day the user named in every zone.\n */\nfunction addCalendarDays(epochMs: number, days: number): number {\n const whole = Math.trunc(days);\n const date = new Date(epochMs);\n date.setDate(date.getDate() + whole);\n const shifted = date.getTime();\n // A shift far enough out to leave the range a Date can represent gives an\n // Invalid Date. Falling back to the linear arithmetic hands back the same\n // out-of-range number as before rather than turning it into a NaN here.\n if (Number.isNaN(shifted)) return epochMs + days * MS_PER_DAY;\n // A fractional part is elapsed time, not a calendar step (\"1.5 days\" is a\n // day and then twelve hours), so it is added as milliseconds.\n return shifted + (days - whole) * MS_PER_DAY;\n}\n\n/**\n * Move `epochMs` by `months` calendar months, clamping to the end of the month\n * it lands in: January 31 plus a month is February 28, or February 29 in a leap\n * year, and never March.\n *\n * The clamp is why the day is parked on the 1st before the month field moves.\n * `setMonth()` on its own keeps the day number, so the 31st of a month whose\n * target has 30 days overflows into the month after it, which is how\n * `2024-01-31 + 1 month` answered March 1 and `2024-03-31 - 1 month` answered\n * March 1 as well. Clamping is what every calendar application does with this\n * case, and it is the only choice that keeps the month the user asked for.\n */\nfunction addCalendarMonths(epochMs: number, months: number): number {\n const whole = Math.trunc(months);\n const date = new Date(epochMs);\n const dayOfMonth = date.getDate();\n date.setDate(1);\n date.setMonth(date.getMonth() + whole);\n date.setDate(Math.min(dayOfMonth, daysInMonth(date.getFullYear(), date.getMonth())));\n const shifted = date.getTime();\n // A leftover fraction of a month names no calendar date of its own, so it\n // falls back to the table's fixed-length month. Same overflow reasoning as\n // addCalendarDays() above for the NaN case.\n const monthMs = convertUnit(1, \"month\", \"ms\");\n if (Number.isNaN(shifted)) return epochMs + months * monthMs;\n return shifted + (months - whole) * monthMs;\n}\n\n/**\n * Move a Datetime by a duration: the operation behind `<date> + <duration>`\n * and `<date> - <duration>`, with `sign` +1 for ADD and -1 for SUB.\n *\n * Three kinds of duration, because they are three different questions:\n * - Workdays skip weekends, so they are neither a fixed span of milliseconds\n * nor a plain calendar-day step (see addBusinessDays() above).\n * - Months and years are calendar fields, not lengths (see\n * CALENDAR_MONTHS_PER_UNIT above).\n * - Days, weeks and fortnights are whole calendar days, so they step the day\n * field and keep the wall-clock time (see addCalendarDays() above).\n *\n * Everything shorter than a day stays linear, and deliberately so: a duration\n * in hours is elapsed time. \"36 hours from now\" means 36 hours of clock\n * ticking, across a daylight-saving transition included, which is exactly what\n * adding milliseconds does.\n */\nfunction shiftDatetime(epochMs: number, duration: Value, sign: 1 | -1, vm: VM): number {\n if (duration.type === ValueType.Uom && duration.unit !== undefined) {\n const unit = duration.unit;\n const amount = sign * duration.toNumber();\n\n // `vm` is threaded in for this one branch: the workday walk is the\n // only date offset whose cost grows with the offset, so it is the only\n // one that needs a configured ceiling. See addBusinessDays().\n if (isWorkdayUnit(unit)) return addBusinessDays(epochMs, amount, vm);\n\n const monthsPerUnit = CALENDAR_MONTHS_PER_UNIT[unit];\n if (monthsPerUnit !== undefined) return addCalendarMonths(epochMs, amount * monthsPerUnit);\n\n // Measure first, for the reason extractDurationMs() gives below: a\n // unit that is not a duration at all has to contribute nothing rather\n // than be rescued by a lenient conversion.\n if (getMeasure(unit) === \"time\") {\n // Whether a unit is a whole number of days is read out of the unit\n // table rather than listed here, so weeks and fortnights are\n // covered by the same rule as days with nothing to keep in step by\n // hand. Sub-day units fail the test and fall through to the linear\n // path below, which is what they want.\n let daysPerUnit = 0;\n try { daysPerUnit = convertUnit(1, unit, \"day\"); } catch { /* Ignore */ }\n if (Number.isInteger(daysPerUnit) && daysPerUnit >= 1) {\n return addCalendarDays(epochMs, amount * daysPerUnit);\n }\n }\n }\n return epochMs + sign * extractDurationMs(duration);\n}\n\n/**\n * Combine a video-timecode Value (`Uom(totalFrames, \"timecode@fps\")`. See\n * `vm/Value.ts`'s timecode section) with a right-hand operand for ADD/SUB.\n * `sign` is +1 for ADD, -1 for SUB.\n *\n * Handles three right-hand shapes:\n * - Another timecode at the SAME fps -> combine frame counts directly.\n * ADD (\"timecode + timecode\") keeps the timecode tag (SoulverCore treats\n * a timecode primarily as a duration-since-zero, so summing two is\n * meaningful, concatenating clip lengths, unlike summing two absolute\n * Datetimes, which this file already rejects above). SUB (\"timecode -\n * timecode\") produces a plain `Uom(diff, \"frames\")` instead, mirroring\n * this file's Datetime-Datetime SUB convention just above (an absolute-\n * ish quantity minus another yields a plain duration/count, not another\n * absolute-ish value).\n * - A plain `Uom(\"frames\")` (see FrameCountParselet) -> add/subtract the\n * frame count directly, no fps conversion needed.\n * - Any other Time-measure Uom (minutes, seconds, ...) -> convert to\n * seconds via convertUnit() and multiply by the timecode's own fps to\n * get a frame count.\n * - A bare Number -> treated as a raw frame count, for convenience.\n *\n * Deliberately NOT commutative (only handles `left` being the timecode)\n * the task grammar this backs always writes the timecode first\n * (\"timecode + N frames\", not \"N frames + timecode\"); see this file's\n * ADD/SUB call sites for where that asymmetry is accepted.\n */\nfunction combineTimecode(tc: Value, r: Value, sign: 1 | -1): Value {\n const fps = timecodeFps(tc.unit!);\n\n if (r.type === ValueType.Uom && isTimecodeUnit(r.unit)) {\n const rFps = timecodeFps(r.unit!);\n if (rFps !== fps) {\n return errorValue(\n \"TIMECODE_FPS_MISMATCH\",\n `Cannot combine timecodes at different frame rates (${fps} fps vs ${rFps} fps)`\n );\n }\n return sign === 1\n ? uomValue(tc.toNumber() + r.toNumber(), tc.unit!)\n : uomValue(tc.toNumber() - r.toNumber(), \"frames\");\n }\n\n if (r.type === ValueType.Uom && r.unit === \"frames\") {\n return uomValue(tc.toNumber() + sign * r.toNumber(), tc.unit!);\n }\n\n if (r.type === ValueType.Uom && r.unit && getMeasure(r.unit) === \"time\") {\n const seconds = convertUnit(r.toNumber(), r.unit, \"s\");\n return uomValue(tc.toNumber() + sign * seconds * fps, tc.unit!);\n }\n\n // Bare Number (or any other Uom), treated as a raw frame count.\n return uomValue(tc.toNumber() + sign * r.toNumber(), tc.unit!);\n}\n\n/**\n * Truthiness for a conditional/logical operand. `Boolean` values use\n * their own value directly; anything else falls back to a JS-like\n * \"nonzero is truthy\" reading of `toNumber()`, lets a plain numeric\n * expression work as a condition (`if x then ...`) without requiring an\n * explicit comparison, without adding a whole coercion framework.\n */\nfunction isTruthy(value: Value): boolean {\n if (value.type === ValueType.Boolean) return value.value as boolean;\n return value.toNumber() !== 0;\n}\n\n/**\n * The answer a conversion gives when the two units measure different things.\n *\n * `UOM_CONVERT_TO` and `UOM_CONVERT_IN` used to push the input back unchanged\n * here, so \"5 kg in m\" displayed as \"5.00 kg\" and \"$100 in ZZZ\" as \"$100.00\":\n * not an error, not a conversion, the question repeated back as though it had\n * been answered at a rate of one. That is the failure mode this codebase\n * already refuses in `binaryOp` (vm/VMConversion.ts), where \"10 m + 5 kg\"\n * gives INCOMPATIBLE_UNITS rather than a bare 15, and the two paths now agree.\n *\n * Reached for a genuinely crossed pair (\"1 m3 in m2\"), for a currency against\n * a physical unit (\"$100 in kg\"), and for a code the lexer accepts that the\n * exchange does not consider money (\"$100 in HRK\"). All three are questions\n * with no answer, so all three say so.\n */\nfunction incompatibleConversionError(fromUnit: string, toUnit: string): Value {\n // Name the two dimensions when both are known (\"a duration cannot be\n // converted to a length\"). A compound rate or an unrecognised currency code\n // has no single dimension to name, so it keeps the unit-naming fallback.\n const named = describeConversionMismatch(fromUnit, toUnit);\n return errorValue(\n \"INCOMPATIBLE_UNITS\",\n named ?? `Cannot convert ${fromUnit} to ${toUnit}: they do not measure the same thing`,\n );\n}\n\n/**\n * How large an exact `^` on a BigInt base is allowed to grow, in bits.\n *\n * Not a precision limit, a safety one. Exponentiation is the one operator\n * where a short line of input asks for an unbounded amount of work: `2n ^\n * 1000000000` is a single instruction that would spend minutes building a\n * ~125MB integer, and this engine runs inside an editor, where that takes the\n * host down with it. The instruction budget (`getMaxInstructions()`) cannot\n * help, because this is one instruction.\n *\n * 65536 bits is a little under twenty thousand decimal digits, far past any\n * result a person reads and far short of anything that stalls.\n *\n * DECIDED (1.0.0, differential run 20260811): past the ceiling the operation is\n * REFUSED, where it used to fall through to the ordinary double path and answer\n * Infinity. Infinity is not the answer to `2n ^ 100000`; the answer is a\n * 30,103-digit integer this engine has chosen not to build, and those are\n * different facts. Reporting the second as the first discards the exactness the\n * `n` type exists for AND the fact that a limit was reached, which is the\n * failure mode (\"a confident magnitude that is not the real one\") that the rest\n * of this release removes everywhere else.\n *\n * It is also the line this codebase already draws between its two numeric\n * types, one operator over: `1 / 0` is Infinity and `1n / 0n` is refused,\n * because exact integer arithmetic does not hand back approximations (see\n * `bigIntDivisionByZero()` in vm/VMConversion.ts). The double spelling is\n * untouched, so `2 ^ 100000` is still Infinity, exactly as IEEE 754 says.\n */\nconst MAX_EXACT_POW_BITS = 65536;\n\n/**\n * How many bits `base ^ exponent` would occupy as an exact bigint, or `null`\n * when it has no exact bigint answer at all.\n *\n * Only a whole, non-negative exponent has one (there is no fractional bigint\n * and no reciprocal one); those cases return null and their caller keeps the\n * ordinary double path, which is the correct answer for them rather than a\n * fallback. The size is estimated from the base's magnitude as a double, which\n * is enough for a limit whose job is to reject the absurd: a base too large for\n * a double to hold is already past the limit.\n *\n * A magnitude of one or less is a special case for the same reason\n * {@link bigIntShift} special-cases zero: 0, 1 and -1 raised to anything at all\n * stay one bit wide, so `1n ^ 1000000` is exact, instant, and must not be\n * refused by an estimate that only looks at the exponent.\n */\nfunction exactPowBits(base: Value, exponent: number): number | null {\n if (!Number.isInteger(exponent) || exponent < 0) return null;\n if (exponent === 0) return 1;\n const magnitude = Math.abs(base.toNumber());\n if (magnitude <= 1) return 1;\n const baseBits = magnitude <= 2 ? 1 : Math.log2(magnitude);\n return baseBits * exponent;\n}\n\n/**\n * `base ** exponent` for bigints, by repeated squaring.\n *\n * Written out rather than using the `**` operator on purpose. TypeScript\n * downlevels `**` to `Math.pow()` for any target below ES2016, and the test\n * config compiles at ES6, so the operator form threw \"Cannot convert a BigInt\n * value to a number\" under the test runner while working in the shipped build:\n * a difference between what is tested and what ships, which is worse than the\n * loop. `symbolic/Complex.ts`'s `complexPow` does the same thing for the same\n * shape of reason.\n *\n * `exponent` must be non-negative; {@link exactPowBits} is the guard.\n */\nfunction bigIntPow(base: bigint, exponent: bigint): bigint {\n let result = 1n;\n let factor = base;\n let remaining = exponent;\n while (remaining > 0n) {\n if (remaining % 2n === 1n) result *= factor;\n remaining /= 2n;\n // Skipped on the last pass, where squaring would only build a number\n // twice the size of the answer and throw it away.\n if (remaining > 0n) factor *= factor;\n }\n return result;\n}\n\n/**\n * How large an exact bigint SHIFT is allowed to grow, in bits.\n *\n * Deliberately the same number as {@link MAX_EXACT_POW_BITS}, and named\n * separately only so each operator's ceiling can be read where it is used.\n * `1n << k` and `2n ^ k` are the same number written two ways, so a ceiling on\n * one and none on the other is not a difference of opinion between operators,\n * it is a hole: `2n ^ 100000` was refused while `1n << 100000` built the exact\n * 30,103-digit integer it asks for, and `1n << 100000000` built a 12.5MB one\n * and then spent 8.5 seconds inside `formatValue()` rendering thirty million\n * characters of it.\n */\nconst MAX_EXACT_SHIFT_BITS = MAX_EXACT_POW_BITS;\n\n/**\n * How many bits a bigint occupies.\n *\n * The double path answers for anything a double can hold, where the exponent\n * IS the bit length. Past that `Number()` saturates to Infinity, so the length\n * comes off the hexadecimal form, which is linear in the size of the value.\n * (The decimal form is not, and turning a large bigint into decimal digits is\n * the exact cost this ceiling exists to prevent.)\n */\nfunction bigIntBitLength(value: bigint): number {\n const magnitude = value < 0n ? -value : value;\n if (magnitude === 0n) return 0;\n const asDouble = Number(magnitude);\n if (Number.isFinite(asDouble)) return Math.floor(Math.log2(asDouble)) + 1;\n return magnitude.toString(16).length * 4;\n}\n\n/**\n * `l << r` (`direction` +1) or `l >> r` (-1) with a bigint operand, bounded by\n * {@link MAX_EXACT_SHIFT_BITS}.\n *\n * The right shift is guarded as well as the left, and not out of symmetry: a\n * bigint `>>` with a NEGATIVE count shifts the other way, so `1n >> -100000`\n * is the same unbounded growth spelled differently.\n *\n * Past the ceiling the shift is REFUSED, whichever operand made it a bigint\n * operation.\n *\n * DECIDED (1.0.0, differential run 20260811). The two spellings used to part\n * company here: a bigint on the LEFT fell through to `x * 2^n` as a double,\n * which for a number this size is Infinity, while a plain number on the left\n * (`1 << 100000n`, which reaches here because the bigint branch triggers on\n * EITHER operand) was refused by name, since JavaScript's 32-bit `<<` wraps its\n * count modulo 32 and would answer 1.\n *\n * `1n << 66000` is the case that settles it. It is a perfectly ordinary\n * 19,870-digit integer, and answering `Infinity` says two false things about\n * it: that it is beyond counting, and that nothing went wrong. The engine's own\n * reason for having an `n` type is that a double's approximation of a large\n * integer is not the integer, so approximating one as Infinity is that same\n * mistake at the largest possible scale. `^` now refuses at its ceiling for the\n * same reason (see {@link MAX_EXACT_POW_BITS}), which keeps `1n << k` and\n * `2n ^ k`, the same number written two ways, answering the same way at every\n * size.\n *\n * @throws `BIGINT_SHIFT_LIMIT_EXCEEDED` past the ceiling. Recoverable.\n */\nfunction bigIntShift(l: Value, r: Value, direction: 1 | -1): Value {\n const value = toBigIntOperand(l);\n const shift = toBigIntOperand(r);\n // Zero shifted by anything is zero, and it costs nothing to say so, so it\n // is answered rather than refused however absurd the count is.\n if (value === 0n) return bigIntValue(0n);\n // How many bits the result gains. Negative means it shrinks, which no\n // ceiling has to care about. `Number()` on an absurd shift count saturates\n // to Infinity, which fails the comparison below, which is the right answer.\n const grownBits = direction * Number(shift);\n if (grownBits <= 0 || bigIntBitLength(value) + grownBits <= MAX_EXACT_SHIFT_BITS) {\n return bigIntValue(direction === 1 ? value << shift : value >> shift);\n }\n throw ErrorFactory.execution(\n \"BIGINT_SHIFT_LIMIT_EXCEEDED\",\n `Shifting by ${shift} would build an exact integer of about ${(bigIntBitLength(value) + grownBits).toLocaleString(\"en-US\")} bits, past the limit of ${MAX_EXACT_SHIFT_BITS.toLocaleString(\"en-US\")} bits`,\n { shift: String(shift), limitBits: MAX_EXACT_SHIFT_BITS },\n );\n}\n\n/**\n * Rate × Uom (matching the rate's denominator measure) -> plain\n * Uom/Number, the denominator cancelling out. E.g. \"$50/week\" ×\n * \"12 weeks\" -> \"$600\"; \"30 fps\" × \"3 minutes\" -> \"5,400 frames\".\n * Shared by `OpCode.RATE_MUL` (explicit) and `OpCode.MUL`'s automatic\n * rate detection (so plain \"*\"/\"×\" syntax works without a package having\n * to route through RATE_MUL specially).\n */\nfunction multiplyRateByMatchingUom(rate: Value, multiplier: Value): Value {\n const { numerator, denominator } = splitRateUnit(rate.unit!);\n const rateMeasure = getMeasure(denominator);\n const multiplierMeasure = getMeasure(multiplier.unit!);\n if (!rateMeasure || rateMeasure !== multiplierMeasure) {\n return errorValue(\n \"RATE_MUL_MEASURE_MISMATCH\",\n `Cannot multiply a \"${denominator}\"-denominated rate by \"${multiplier.unit}\" — different measures`\n );\n }\n const multiplierInDenominatorUnit = convertUnit(multiplier.toNumber(), multiplier.unit!, denominator);\n const total = rate.toNumber() * multiplierInDenominatorUnit;\n return numerator ? uomValue(total, numerator) : numberValue(total);\n}\n\n// ── Converters (`as <type>`) formatting helpers ───────────────────────────\n// Kept separate from FormatEngine.ts (display-only formatting of a Value\n// for the editor gutter): these PRODUCE a new Value (typically a String)\n// that becomes the expression's actual result, not just its rendering.\n\n/**\n * Simplify a decimal to the smallest fraction that reproduces it within a\n * tight tolerance, via continued-fraction expansion, so a float like\n * 0.3333333333333333 (not exactly 1/3) still resolves to \"1/3\" instead of\n * an unreadably large denominator.\n */\nfunction toFractionString(n: number): string {\n if (Number.isNaN(n)) return \"NaN\";\n if (!isFinite(n)) return n > 0 ? \"Infinity\" : \"-Infinity\";\n const negative = n < 0;\n const abs = Math.abs(n);\n const whole = Math.floor(abs);\n const frac = abs - whole;\n if (frac < 1e-9) return `${negative ? \"-\" : \"\"}${whole}`;\n\n let h0 = 0, h1 = 1, k0 = 1, k1 = 0;\n let b = frac;\n const maxDenominator = 1_000_000;\n for (let i = 0; i < 30; i++) {\n const a = Math.floor(b + 1e-9);\n const h2 = a * h1 + h0, k2 = a * k1 + k0;\n if (k2 > maxDenominator) break;\n h0 = h1; h1 = h2; k0 = k1; k1 = k2;\n if (Math.abs(frac - h1 / k1) < 1e-9) break;\n const rem = b - a;\n if (rem < 1e-9) break;\n b = 1 / rem;\n }\n const numerator = whole * k1 + h1;\n return `${negative ? \"-\" : \"\"}${numerator}/${k1}`;\n}\n\n/**\n * Render an exact rational as a fraction: \"1/3\", \"5/2\", or a whole number as\n * itself (\"4\").\n *\n * The exact counterpart of {@link toFractionString}'s continued-fraction guess,\n * used when a value carries the rational it evaluates to. It is what makes\n * \"(1/1000003) as fraction\" read \"1/1000003\" rather than the \"0/1\" the float\n * approximation collapses to once the denominator passes its own ceiling.\n */\nfunction rationalToFractionString(r: Rational): string {\n return r.d === 1n ? String(r.n) : `${r.n}/${r.d}`;\n}\n\n/**\n * A value rendered as a multiple, \"4x\".\n *\n * What counts as the multiple depends on what is being converted, which is why\n * this takes the Value rather than a number:\n *\n * - A **percentage** is a change, so it grows: 50% more is 1.5x, and\n * `20 to 40 as x` (a 100% change) is 2x.\n * - **Anything else** is already the ratio: `20/5 as multiplier` is 4x.\n *\n * It used to add 1 unconditionally, so `20/5 as multiplier` answered 5x.\n * Telling the two apart only became possible when `%` started producing a\n * Percentage-typed value instead of a bare fraction (see PercentParselet.ts).\n */\nfunction toMultiplierString(value: Value): string {\n const n = value.toNumber();\n const multiple = value.type === ValueType.Percentage ? 1 + n : n;\n return `${Math.round(multiple * 1e6) / 1e6}x`;\n}\n\n/** Scientific notation with trailing mantissa zeros trimmed (\"1.50e+6\" -> \"1.5e+6\"). */\nfunction toScientificString(n: number): string {\n // An infinity or a NaN has no mantissa and no exponent, so splitting on\n // \"e\" gave back one piece and the second was undefined: \"0/0 as sci\"\n // rendered the string \"NaNeundefined\".\n if (!Number.isFinite(n)) return String(n);\n if (n === 0) return \"0e+0\";\n const [mantissa, exponent] = n.toExponential().split(\"e\");\n const trimmed = mantissa.includes(\".\") ? mantissa.replace(/0+$/, \"\").replace(/\\.$/, \"\") : mantissa;\n return `${trimmed}e${exponent}`;\n}\n\n/**\n * Execute bytecode with optional diagnostic pipeline integration.\n *\n * Performance notes:\n * - Uses a `switch(op)` statement for dispatch. V8 compiles dense integer\n * switches (OpCode values 0–200) into a jump table with O(1) dispatch.\n * All handler code is inlined directly in the switch cases, allowing\n * TurboFan to optimize across opcode boundaries.\n * - ADD/SUB/MUL have an inlined numeric fast path that skips the `binaryOp()`\n * function call + closure allocation when both operands are plain numbers\n * (>90% of arithmetic ops).\n * - Tracing uses a boolean guard (`shouldTrace`) that the JIT eliminates\n * entirely when diagnostics are disabled. No function call overhead.\n * - `Value.toNumber()` caches its result, computed once, read thereafter.\n */\nexport function executeBytecode(\n bytecode: Bytecode,\n vm: VM,\n pipeline?: DiagnosticPipeline | undefined,\n expression?: string,\n context?: LineExecutionContext,\n // Symbolic-tolerant mode (default false, every existing evaluation\n // path is completely unchanged): when true, LOAD_VAR pushes a\n // Symbolic placeholder (symbolic/SymbolicNode.ts) for an undefined variable\n // instead of throwing UNDEFINED_VARIABLE. Set only by the `=>`\n // solve/simplify path (H.2) and map/reduce's own reentrant calls when\n // folding a symbolic accumulator (H.3), never by top-level\n // evaluation, so the hard UNDEFINED_VARIABLE throw stays exactly as-is\n // for ordinary expressions.\n symbolicTolerant?: boolean\n): EvalResult {\n // Before the destructure, which is the point: `executeBytecode(undefined)`\n // used to throw a raw TypeError from the destructure itself, outside the\n // try/catch below, so a host calling this public export got an exception\n // rather than the error arm this function documents. The internal caller\n // that reaches here with nothing is a map/reduce body whose side-table\n // entry is missing.\n const unrunnable = unrunnableProgram(bytecode);\n if (unrunnable) {\n return {\n type: 'error',\n error: ErrorFactory.validation({\n code: \"MALFORMED_BYTECODE_PROGRAM\",\n message: `Malformed bytecode: ${unrunnable}`,\n expected: \"a BytecodeProgram with opcodes, numbers and strings\",\n found: unrunnable,\n suggestion: MALFORMED_BYTECODE_SUGGESTION,\n }),\n };\n }\n\n const { opcodes, numbers, strings, userFunctionBodies, anonymousBodies } = bytecode;\n let ip = 0;\n let localInstructionCount = 0;\n const maxInstructions = vm.getMaxInstructions();\n const maxStackDepth = vm.getMaxStackDepth();\n\n // Direct stack array reference. Bypasses VM.push/pop's own bounds check\n // (vm.push() silently no-ops past maxStackDepth, fine for the rare\n // direct caller, wrong for the hot loop, which instead gets a single\n // cheap depth check per instruction below, same cost class as the\n // instruction-count check). Built-in packages' bytecode naturally stays\n // well under maxStackDepth (nesting depth is already bounded by\n // maxNestingDepth), but a third-party package's buggy parselet, or a\n // host that raises maxComplexity/maxNestingDepth, has no other\n // backstop against unbounded stack growth without this check.\n const stack = vm.getStack();\n\n // Boolean guard: JIT will eliminate the entire branch when false.\n // No function call, no argument evaluation, zero overhead.\n const shouldTrace = pipeline?.hasCollectors ?? false;\n\n // Hoist arena check to a local constant, avoids a function call at\n // every HALT/STORE_VAR/fallback-return in the dispatch loop.\n // The arena is only active during scroll execution (ThreeTierEvaluator\n // Tier 2); in all other paths this is always false and the JIT can\n // eliminate the unreachable persistentValue() branch entirely.\n const hasArena = isArenaActive();\n\n if (opcodes.length === 0) return { type: 'value', value: numberValue(0) };\n\n // Makes this VM's allocation allowance current for the duration of this\n // program, so that anything materialised beneath here charges it without\n // the intervening frames having to pass it down. Only the OUTERMOST entry\n // clears the tally: a reentrant call (a user-defined function, a map or\n // reduce body) keeps spending the same allowance, which is what stops\n // recursion from refreshing its own budget the way it can refresh\n // `localInstructionCount`. Paired with `endEvaluation()` in the `finally`\n // below, which is why a throw cannot leave a budget current.\n beginEvaluation(vm);\n\n // Fatal-bug fix: this whole dispatch loop used to have NO surrounding\n // try/catch at all, a safety-limit throw (INSTRUCTION_LIMIT_EXCEEDED/\n // STACK_LIMIT_EXCEEDED, both just below), an UNDEFINED_VARIABLE throw,\n // or a raw TypeError from a stack-underflow bug (see safePop() below)\n // escaped this function entirely and was only ever caught because every\n // production call site happened to sit inside SOMEONE ELSE's generic\n // catch, confirmed NOT true for AsyncResolutionBatcher.reExecuteMainThread()\n // which had none (now fixed separately, see that file). EvalResult's\n // new {type:'error'} arm makes this function's contract match what it\n // always should have been: three possible outcomes, all returned, none\n // silently relying on an external catch. Deliberately NOT re-indented\n // (a ~900-line body) to keep this diff reviewable, a future full pass\n // could re-indent, this fix does not depend on it.\n try {\n while (ip < opcodes.length) {\n // Tighten instruction limit check: combined increment + guard.\n // V8 optimises `++localInstructionCount > maxInstructions` into a\n // single fused add-and-compare on the hot path. The default limit\n // (50k) is never reached in benchmarks, so this branch is statically\n // predicted not-taken by the CPU.\n if (++localInstructionCount > maxInstructions) {\n throw ErrorFactory.execution(\"INSTRUCTION_LIMIT_EXCEEDED\", `Execution exceeded maximum of ${maxInstructions} instructions`);\n }\n // Same cost class as the check above, one comparison, statically\n // predicted not-taken. Catches stack growth left over from the\n // previous instruction's push(es); a bounded one-instruction delay\n // is fine for a safety limit (see the comment on `stack` above).\n if (stack.length > maxStackDepth) {\n throw ErrorFactory.execution(\"STACK_LIMIT_EXCEEDED\", `Execution exceeded maximum stack depth of ${maxStackDepth}`);\n }\n const op = opcodes[ip++] as OpCode;\n\n if (shouldTrace) {\n const stackSnapshot = stack.map(v => ({\n type: v.type,\n value: v.value,\n unit: v.unit,\n }));\n pipeline!.fireVmStep({\n type: DiagnosticEventType.VmStep,\n elapsedNs: 0,\n expression: expression ?? \"\",\n opcode: op,\n opcodeName: getOpCodeName(op),\n ip: ip - 1,\n stackDepth: stack.length,\n instructionNumber: localInstructionCount,\n stack: stackSnapshot,\n });\n }\n\n // ── switch dispatch: V8 compiles dense integer switches (OpCode 0–200)\n // into a jump table with O(1) dispatch. Sections mirror the OpCode\n // enum ordering for discoverability.\n switch (op) {\n // ═══════════════════════════════════════════════════════════════\n // §1 Stack operations (OpCode 0–3)\n // ═══════════════════════════════════════════════════════════════\n case OpCode.NOP:\n break;\n case OpCode.HALT: {\n const result = safePop(stack);\n return { type: 'value', value: hasArena ? persistentValue(result) : result };\n }\n case OpCode.DUP: {\n // Read through safePop rather than `stack[stack.length - 1]`, which\n // pushes `undefined` on an empty stack. A following HALT then popped\n // that undefined and returned `{ type: 'value', value: undefined }`,\n // a shape EvalResult declares impossible and every caller reads\n // without checking. Found by the bytecode fuzzer on the two-opcode\n // program `[DUP, HALT]`; the same underflow through any other opcode\n // was already controlled, since they all pop through safePop.\n const top = safePop(stack);\n stack.push(top);\n stack.push(top);\n break;\n }\n case OpCode.SWAP: {\n const a = safePop(stack), b = safePop(stack);\n stack.push(a);\n stack.push(b);\n break;\n }\n\n // ═══════════════════════════════════════════════════════════════\n // §2 Push literals (OpCode 10–15)\n // ═══════════════════════════════════════════════════════════════\n // Every operand below goes through a checked read. An index past the\n // end of a pool used to yield `undefined` and be pushed as a Value,\n // which then failed somewhere else entirely: PUSH_BIGINT reached\n // `BigInt(undefined)`, and an undefined string sat on the stack until\n // a unit or converter name was read off it.\n case OpCode.PUSH_NUMBER:\n stack.push(numberValue(numbers[poolIndex(opcodes, ip++, op, \"constant-pool index\", numbers.length, \"number-pool\")]));\n break;\n case OpCode.PUSH_BIGINT:\n stack.push(bigIntValue(parseBigIntLiteral(poolString(opcodes, ip++, strings, op, \"constant-pool index\"), op)));\n break;\n case OpCode.PUSH_DECIMAL: {\n // A decimal-point literal: the exact base-ten value rides in the\n // `exact` sidecar, the nearest double stays in `value`, so this reads\n // as an ordinary Number everywhere except where it meets money.\n const dec = decimalFromLiteral(poolString(opcodes, ip++, strings, op, \"constant-pool index\"));\n stack.push(numberValueExact(decimalToNumber(dec), dec));\n break;\n }\n case OpCode.PUSH_HEX:\n stack.push(hexValue(numbers[poolIndex(opcodes, ip++, op, \"constant-pool index\", numbers.length, \"number-pool\")]));\n break;\n case OpCode.PUSH_STRING:\n stack.push(stringValue(poolString(opcodes, ip++, strings, op, \"constant-pool index\")));\n break;\n case OpCode.PUSH_BOOLEAN:\n stack.push(boolValue(operandByte(opcodes, ip++, op, \"boolean operand\") === 1));\n break;\n\n // ═══════════════════════════════════════════════════════════════\n // §3 Arithmetic (OpCode 20–27)\n // Binary ops (ADD/SUB/MUL/DIV/MOD/EXP) have inlined numeric\n // fast paths; unary ops (NEG/POS) handle BigInt and UoM.\n // ═══════════════════════════════════════════════════════════════\n case OpCode.ADD: {\n const r = safePop(stack), l = safePop(stack);\n // binaryOp() at the bottom of this chain propagates a faulted\n // operand, but only the branches that reach it do. The Datetime and\n // timecode branches above it do not: they read the other operand as\n // a duration, and a duration read off an Error is zero, so `today +\n // (5 kg to m)` answered today. See faultedOperand().\n const addFault = faultedOperand(l, r);\n if (addFault) { stack.push(addFault); break; }\n // A carried uncertainty propagates in quadrature before anything else,\n // so \"(10 +/- 1) + (20 +/- 2)\" is \"30 ± 2.24\". Gated on a sidecar\n // being present, and checked ahead of the rational branch below so an\n // uncertain operand is never folded into an exact fraction that would\n // silently drop its tolerance. See uncertainOp().\n if (l.uncertainty !== undefined || r.uncertainty !== undefined) {\n const uncAdd = uncertainOp(l, r, \"add\");\n if (uncAdd) { stack.push(uncAdd); break; }\n }\n // Fraction arithmetic stays exact when a rational already rides on an\n // operand: \"1/3 + 1/3 + 1/3\" is exactly 1. The sidecar check gates it\n // so this only ever PRESERVES a fraction, a plain integer sum never\n // grows one and \"1e16 + 1 - 1e16\" stays the double it must be.\n if (l.rational !== undefined || r.rational !== undefined) {\n const ratAdd = exactRationalOp(l, r, \"add\");\n if (ratAdd) { stack.push(ratAdd); break; }\n }\n const pctAdd = combinePercentage(l, r, 1);\n const ratePeriodAdd = pctAdd === null ? unifyRatePeriods(l, r) : null;\n if (pctAdd !== null) {\n stack.push(pctAdd);\n } else if (ratePeriodAdd !== null) {\n // Two rates over different periods, reconciled onto the right\n // operand's period before adding.\n stack.push(uomValue(ratePeriodAdd + r.toNumber(), r.unit!));\n } else if (l.type === ValueType.Number && r.type === ValueType.Number) {\n stack.push(numberValue((l.value as number) + (r.value as number)));\n } else if (l.type === ValueType.Boolean && r.type === ValueType.Boolean) {\n // The word \"and\" is a synonym for arithmetic \"+\" (\"5 and 3\" = 8)\n // and also the boolean conjunction (\"true and false\"). It has its\n // own token type now (AND_CONJ, see Token.ts) rather than mapping\n // onto PLUS, but it still compiles to this opcode, because which\n // of the two meanings applies is a property of the operands rather\n // than of the word. So the dispatch stays here, where the operand\n // types are known, mirroring the Datetime/Rate special-casing\n // already done in this opcode for the same reason.\n stack.push(boolValue((l.value as boolean) && (r.value as boolean)));\n } else if (l.type === ValueType.Datetime) {\n if (r.type === ValueType.Datetime) {\n // Adding two absolute timestamps has no standard meaning\n // (unlike subtracting them, which yields a duration).\n stack.push(errorValue(\"INVALID_DATETIME_OP\", \"Cannot add two datetimes together\"));\n } else {\n // Workdays, calendar months/years and whole calendar days each\n // move a date differently. See shiftDatetime()'s doc comment.\n stack.push(datetimeValue(shiftDatetime(l.toNumber(), r, 1, vm)));\n }\n } else if (l.type === ValueType.Uom && isTimecodeUnit(l.unit)) {\n // \"timecode + N frames\" / \"timecode + duration\" / \"timecode +\n // timecode\". See combineTimecode()'s doc comment above.\n stack.push(combineTimecode(l, r, 1));\n } else if (r.type === ValueType.Datetime) {\n // Addition commutes, so a date on the RIGHT is the same sum as a\n // date on the left. Without this it fell through to binaryOp(),\n // which reads both operands as bare numbers: \"1 day + 12-25-2023\"\n // answered \"1,703,491,200,001 days\" and \"100 + 12-25-2023\"\n // answered 1,703,491,200,100. Both are the date's epoch\n // milliseconds wearing the wrong type, which is a confident wrong\n // answer rather than a visible failure.\n stack.push(datetimeValue(shiftDatetime(r.toNumber(), l, 1, vm)));\n } else {\n stack.push(binaryOp(l, r, (a, b) => a + b, (a, b) => a + b, \"add\"));\n }\n break;\n }\n case OpCode.SUB: {\n const r = safePop(stack), l = safePop(stack);\n // Same reason as ADD above.\n const subFault = faultedOperand(l, r);\n if (subFault) { stack.push(subFault); break; }\n // Uncertainty propagates before the fraction path, same reasoning as\n // ADD: \"(10 +/- 1) - (20 +/- 2)\" is \"-10 ± 2.24\" (the spread of a\n // difference combines in quadrature exactly as a sum's does).\n if (l.uncertainty !== undefined || r.uncertainty !== undefined) {\n const uncSub = uncertainOp(l, r, \"sub\");\n if (uncSub) { stack.push(uncSub); break; }\n }\n // Preserve exact fractions, as ADD does above: \"5/6 - 1/6 - 1/6 - 1/6\n // - 1/6 - 1/6\" is exactly 0, not the 1.6e-16 the doubles drift to.\n if (l.rational !== undefined || r.rational !== undefined) {\n const ratSub = exactRationalOp(l, r, \"sub\");\n if (ratSub) { stack.push(ratSub); break; }\n }\n const pctSub = combinePercentage(l, r, -1);\n const ratePeriodSub = pctSub === null ? unifyRatePeriods(l, r) : null;\n if (pctSub !== null) {\n stack.push(pctSub);\n } else if (ratePeriodSub !== null) {\n stack.push(uomValue(ratePeriodSub - r.toNumber(), r.unit!));\n } else if (l.type === ValueType.Number && r.type === ValueType.Number) {\n stack.push(numberValue((l.value as number) - (r.value as number)));\n } else if (l.type === ValueType.Datetime) {\n if (r.type === ValueType.Datetime) {\n // \"now - now\" used to unconditionally re-wrap the result as\n // ANOTHER Datetime, e.g. subtracting two timestamps close\n // together produced a near-Unix-epoch date (\"01/01/1970,\n // 01:00:00\") instead of the near-zero duration a user would\n // expect. Two datetimes subtract to a duration, not a point\n // in time, represented as a Uom in milliseconds, consistent\n // with how extractDurationMs() reads durations elsewhere.\n stack.push(uomValue(l.toNumber() - r.toNumber(), \"ms\"));\n } else {\n // See the matching ADD case above, and shiftDatetime()'s own\n // doc comment for why a day is not a fixed number of ms.\n stack.push(datetimeValue(shiftDatetime(l.toNumber(), r, -1, vm)));\n }\n } else if (l.type === ValueType.Uom && isTimecodeUnit(l.unit)) {\n // \"timecode - timecode\" (difference) / \"timecode - duration\"\n // see combineTimecode()'s doc comment above.\n stack.push(combineTimecode(l, r, -1));\n } else if (r.type === ValueType.Datetime) {\n // Subtraction does not commute, so unlike ADD there is nothing to\n // salvage here: taking a point in time away from a quantity that\n // is not one has no meaning. ADD already refuses \"<date> +\n // <date>\"; this is the same guard for the reversed operands, which\n // had none, so \"100 - 12-25-2023\" answered -1,703,462,399,900,\n // the date's epoch milliseconds leaking out as an ordinary number.\n stack.push(errorValue(\n \"INVALID_DATETIME_OP\",\n \"Cannot subtract a datetime from a value that is not a datetime\",\n ));\n } else {\n stack.push(binaryOp(l, r, (a, b) => a - b, (a, b) => a - b, \"sub\"));\n }\n break;\n }\n case OpCode.MUL: {\n const r = safePop(stack), l = safePop(stack);\n // A percentage scaling an uncertain number carries the tolerance, so\n // \"(100 +/- 5) * 10%\" and \"10% of (100 +/- 5)\" are \"10 ± 0.5\". This sits\n // ahead of uncertainOp, which declines for a Percentage operand.\n const pctUnc = multiplyPercentWithUncertainty(l, r);\n if (pctUnc) { stack.push(pctUnc); break; }\n // Uncertainty first, so \"(12.3 +/- 0.5) * 4\" is \"49.2 ± 2.0\": a scalar\n // multiply scales the spread by |k|, which the general quadrature rule\n // gives when the plain operand is read as uncertainty 0. uncertainOp\n // declines for a faulted or non-Number operand, so those keep their\n // own paths below. See uncertainOp().\n if (l.uncertainty !== undefined || r.uncertainty !== undefined) {\n const uncMul = uncertainOp(l, r, \"mul\");\n if (uncMul) { stack.push(uncMul); break; }\n }\n // Preserve exact fractions before the double fast path: \"2/7 * 14\" is\n // exactly 4 and \"1/49 * 49\" exactly 1. Gated on a rational already\n // being present, so a plain \"2 * 3\" pays only the two sidecar checks.\n if (l.rational !== undefined || r.rational !== undefined) {\n const ratMul = exactRationalOp(l, r, \"mul\");\n if (ratMul) { stack.push(ratMul); break; }\n }\n // Money times a scalar (a percentage, or a plain/computed number) stays\n // exact to the cent, the same base-ten path as \"$X + p%\". After the\n // rational check so \"$3 * 2/7\" keeps its exact fraction; ahead of\n // binaryOp, which would read both as bare doubles and drop the sidecar,\n // so \"50% of 1% of $3\" (a computed 0.005 factor) rounds like a till.\n const moneyScalar = multiplyMoneyByScalarExact(l, r);\n if (moneyScalar) { stack.push(moneyScalar); break; }\n if (l.type === ValueType.Number && r.type === ValueType.Number) {\n stack.push(numberValue((l.value as number) * (r.value as number)));\n } else if (l.type === ValueType.Matrix && r.type === ValueType.Matrix) {\n // Genuinely different from +/-/comparisons (which stay\n // element-wise, via binaryOp() below), scalar broadcast vs.\n // real matrix product, disambiguated by shape. Must run BEFORE\n // binaryOp(), which only ever does element-wise Matrix math.\n //\n // Refused from the shapes BEFORE the multiply runs, because this is\n // the one arithmetic result whose size is the PRODUCT of two\n // separately legal operands: a 20,001x1 times a 1x20,001 is four\n // hundred million cells from two matrices of twenty thousand, and\n // that allocation aborted the process before any counter watching\n // the result could have seen it. A check rather than a charge,\n // since the result is charged once when `matrixValue()` builds it.\n checkAllocation(matrixProductCells(l.value as MatrixData, r.value as MatrixData), \"matrix cells\");\n stack.push(matrixMultiply(l.value as MatrixData, r.value as MatrixData));\n } else if (l.type === ValueType.Uom && isRateUnit(l.unit) && r.type === ValueType.Uom && r.unit) {\n // \"30 fps × 3 minutes\" -> \"5,400 frames\" via plain \"×\"/\"*\"\n // no package needs to route through RATE_MUL explicitly.\n stack.push(multiplyRateByMatchingUom(l, r));\n } else if (r.type === ValueType.Uom && isRateUnit(r.unit) && l.type === ValueType.Uom && l.unit) {\n // Commutative: \"3 minutes × 30 fps\" too.\n stack.push(multiplyRateByMatchingUom(r, l));\n } else if (moneyTimesQuantity(l, r) !== null) {\n // \"$30 × 4 days\" is $120: an amount of money multiplied by a\n // count of something. Without this the unit system refused it\n // outright (\"Cannot combine incompatible units: USD and days\"),\n // because there is no such unit as a dollar-day.\n stack.push(moneyTimesQuantity(l, r)!);\n } else {\n stack.push(binaryOp(l, r, (a, b) => a * b, (a, b) => a * b, \"mul\"));\n }\n break;\n }\n case OpCode.DIV: {\n const r = safePop(stack), l = safePop(stack);\n // Dividing an uncertain number BY a percentage is a scalar divide, so\n // it carries the tolerance: \"(100 +/- 5) / 10%\" is \"1000 ± 50\". This\n // sits ahead of uncertainOp, which declines for a Percentage divisor.\n const pctDivUnc = dividePercentWithUncertainty(l, r);\n if (pctDivUnc) { stack.push(pctDivUnc); break; }\n // Uncertainty first, ahead of both the Uom ratio and the exact-fraction\n // paths below, so a carried tolerance is never dropped by either.\n // uncertainOp declines unless both operands are plain Numbers, so\n // \"$10 / 2\" and \"1/3\" are untouched. See uncertainOp().\n if (l.uncertainty !== undefined || r.uncertainty !== undefined) {\n const uncDiv = uncertainOp(l, r, \"div\");\n if (uncDiv) { stack.push(uncDiv); break; }\n }\n if (l.type === ValueType.Uom && r.type === ValueType.Uom) {\n const { lv, rv, sameMeasure } = unifyUom(l, r);\n if (sameMeasure) {\n stack.push(numberValue(lv / rv));\n } else if (sharedCurrencyExchange.isCurrency(l.unit!) && sharedCurrencyExchange.isCurrency(r.unit!)) {\n // Both currencies, but unifyUom couldn't reconcile them (no\n // live rate cached yet), an honest failure, not a rate:\n // \"$X per €Y\" isn't a meaningful derived unit the way\n // \"km/day\" is, so this stays INCOMPATIBLE_UNITS rather than\n // silently becoming a nonsensical currency-pair rate.\n stack.push(errorValue(\"INCOMPATIBLE_UNITS\", `Cannot combine incompatible units: ${l.unit} and ${r.unit}`));\n } else {\n // Genuinely different measures (e.g. \"90 km / 3 day\")\n // construct a Rate rather than erroring, now that this\n // codebase has a compound/derived-unit representation (see\n // vm/Value.ts's rateValue()), matches RATE_DIV's explicit\n // construction opcode, but reachable via plain \"/\" too.\n stack.push(rateValue(lv / rv, l.unit!, r.unit!));\n }\n } else {\n // Integer division is the producer of exact fractions: \"1/3\" seeds\n // the rational 1/3 that the rest of the system carries, so \"1/3 + 1/3\n // + 1/3\" is exactly 1 and \"1/3 as fraction\" is exact. exactRationalOp\n // declines for a non-integer operand, a bigint, or a zero divisor, so\n // \"1.5 / 0.25\" and \"1/0\" keep the doubles binaryOp gives and \"100n /\n // 3n\" stays exact integer division. The reduced result's nearest\n // double equals the plain \"a / b\" quotient, so \"10 / 4\" is 2.5 and\n // every existing division result is unchanged.\n const ratDiv = exactRationalOp(l, r, \"div\");\n if (ratDiv) { stack.push(ratDiv); break; }\n // The bigint arm refuses a zero divisor rather than letting V8's\n // own RangeError out. See bigIntDivisionByZero() for why this is\n // an error while `1 / 0` is Infinity.\n stack.push(binaryOp(l, r, (a, b) => a / b, (a, b) => { if (b === 0n) throw bigIntDivisionByZero(); return a / b; }, \"div\"));\n }\n break;\n }\n case OpCode.MOD: {\n const r = safePop(stack), l = safePop(stack);\n // Same zero case as DIV above, and refused the same way: a\n // remainder is defined in terms of the quotient, so where one has\n // no answer neither does the other.\n stack.push(binaryOp(l, r, (a, b) => a % b, (a, b) => { if (b === 0n) throw bigIntDivisionByZero(); return a % b; }));\n break;\n }\n case OpCode.EXP: {\n const r = safePop(stack), l = safePop(stack);\n // Unlike ADD/SUB/MUL/DIV/MOD, EXP never routed through\n // binaryOp() (VMConversion.ts), it called Math.pow() on raw\n // toNumber() output unconditionally, so it needs its own\n // Error/Pending short-circuit for the same reason binaryOp()\n // now has one: toNumber() returns 0 for both, so\n // `errorValue ^ 2` used to silently become `0`.\n if (l.type === ValueType.Error) { stack.push(l); break; }\n if (r.type === ValueType.Error) { stack.push(r); break; }\n if (l.type === ValueType.Pending) { stack.push(l); break; }\n if (r.type === ValueType.Pending) { stack.push(r); break; }\n // Plain numbers first, so the overwhelmingly common case pays for no\n // extra type test beyond the ones already above it.\n if (l.type === ValueType.Number && r.type === ValueType.Number) {\n stack.push(numberValue(power(l.value as number, r.value as number)));\n break;\n }\n // A Matrix operand means matrix exponentiation, which is repeated\n // matrix multiplication and not the element-wise Math.pow the rest\n // of this case does. Falling through was the same silent-zero shape\n // the symbolic branch below documents: MatrixData.toNumber() is 0,\n // so `[1,2;3,4]^2` answered 0 and `2^[1,2;3,4]` answered 1. `^T` and\n // `^-1` never reach here, PrecedenceParser's caret-suffix rules take\n // both at parse time, so every remaining shape that is not \"square\n // matrix to a whole non-negative power\" is refused by name.\n if (l.type === ValueType.Matrix || r.type === ValueType.Matrix) {\n if (l.type !== ValueType.Matrix || r.type !== ValueType.Number) {\n stack.push(errorValue(\n \"MATRIX_POWER_UNSUPPORTED\",\n `^: a matrix may only be the base, raised to a whole number (as in \"[1,2;3,4]^2\"); \"${ValueType[l.type]} ^ ${ValueType[r.type]}\" has no matrix reading.`,\n ));\n break;\n }\n // Checked against the whole repeated-squaring run rather than the\n // answer alone, so a hopeless exponent is refused before the first\n // multiplication instead of at whichever step happens to cross the\n // line. See {@link matrixPowerCells}. Each intermediate matrix is\n // still charged as `matrixValue()` builds it.\n checkAllocation(matrixPowerCells(l.value as MatrixData, r.value as number), \"matrix cells\");\n stack.push(matrixPower(l.value as MatrixData, r.value as number));\n break;\n }\n // A symbolic operand has to build a `pow` node. Falling through to\n // Math.pow() here is what made `x^2` evaluate to 0, silently, since\n // Value.toNumber() reports 0 for a symbolic value.\n if (l.type === ValueType.Symbolic || r.type === ValueType.Symbolic) {\n stack.push(symbolicPow(l, r));\n break;\n }\n // A bigint operand raised to a whole power has an exact answer, and\n // Math.pow does not give it: `2n ^ 100` came back as\n // 1.2676506002282294e+30, a double's approximation of the very\n // integer this type exists to hold. See exactPowBits() for when an\n // exact answer exists at all, and for why there is a size limit.\n if (l.type === ValueType.BigInt || r.type === ValueType.BigInt) {\n const powBits = exactPowBits(l, r.toNumber());\n if (powBits !== null) {\n // Past the ceiling this refuses rather than handing the sum back\n // to the double path, which would report a 30,103-digit integer\n // as Infinity. See MAX_EXACT_POW_BITS for the decision.\n if (powBits > MAX_EXACT_POW_BITS) {\n throw ErrorFactory.execution(\n \"BIGINT_POW_LIMIT_EXCEEDED\",\n `That power would build an exact integer of about ${Math.round(powBits).toLocaleString(\"en-US\")} bits, past the limit of ${MAX_EXACT_POW_BITS.toLocaleString(\"en-US\")} bits`,\n { limitBits: MAX_EXACT_POW_BITS },\n );\n }\n stack.push(bigIntValue(bigIntPow(toBigIntOperand(l), toBigIntOperand(r))));\n break;\n }\n // A fractional or negative exponent has no bigint answer at all\n // (`4n ^ 0.5` is 2 and `2n ^ -1` is 0.5), so those keep the double\n // path below, which is their right answer rather than a fallback.\n }\n stack.push(numberValue(power(l.toNumber(), r.toNumber())));\n break;\n }\n case OpCode.NEG: {\n const v = safePop(stack);\n // A negated fault is still a fault, and `-0` looks like an answer.\n const negFault = faultedOperand(v);\n if (negFault) { stack.push(negFault); break; }\n if (v.type === ValueType.BigInt) stack.push(bigIntValue(-(v.value as bigint)));\n // Negating money keeps it exact: \"-$0.10\" is exactly \"-$0.10\".\n else if (v.type === ValueType.Uom && v.exact !== undefined) stack.push(uomValueExact(-v.toNumber(), v.unit!, decimalNegate(v.exact)));\n else if (v.type === ValueType.Uom) stack.push(uomValue(-v.toNumber(), v.unit!));\n // A negated percentage is still a percentage, for the same reason a\n // negated Uom is still measured in the same unit. Without this\n // branch `-10%` became the bare number -0.1, and every rule that\n // reads a Percentage operand stopped seeing one: `200 + -10%`\n // answered 199.9 (200 plus a tenth) instead of 180, `$300 + -15%`\n // answered $299.85 instead of $255, and `-10%` displayed as \"-0.10\".\n else if (v.type === ValueType.Percentage) stack.push(percentageValue(-v.toNumber()));\n // Without this branch, unary minus on a free variable produced `-0`,\n // for the same toNumber() reason as EXP above.\n else if (v.type === ValueType.Symbolic) stack.push(symbolicNeg(v));\n // Negating a fraction keeps it exact: \"-(1/3)\" carries the rational\n // -1/3, so it still reads back exactly through \"as fraction\".\n else if (v.type === ValueType.Number && v.rational !== undefined) stack.push(numberValueRational(-v.toNumber(), rationalNeg(v.rational)));\n // Negating a decimal literal keeps its exact decimal, the same way\n // money above does, so \"-1.005 to 2 dp\" rounds the exact -1.005 half\n // away from zero to -1.01 rather than dropping to the drifted double\n // (-1.00499...) the float path rounds toward zero.\n else if (v.type === ValueType.Number && v.exact !== undefined) stack.push(numberValueExact(-v.toNumber(), decimalNegate(v.exact)));\n else stack.push(numberValue(-v.toNumber()));\n break;\n }\n case OpCode.POS: {\n const v = safePop(stack);\n const posFault = faultedOperand(v);\n if (posFault) { stack.push(posFault); break; }\n // Unary plus is a no-op, so money keeps its exact decimal too.\n if (v.type === ValueType.Uom && v.exact !== undefined) stack.push(uomValueExact(v.toNumber(), v.unit!, v.exact));\n else if (v.type === ValueType.Uom) stack.push(uomValue(v.toNumber(), v.unit!));\n // Unary plus is a no-op, so it has to leave the type alone too.\n else if (v.type === ValueType.Percentage) stack.push(percentageValue(v.toNumber()));\n // A no-op keeps a fraction's exact rational, the same way it keeps\n // money's exact decimal above.\n else if (v.type === ValueType.Number && v.rational !== undefined) stack.push(numberValueRational(v.toNumber(), v.rational));\n // And it keeps a decimal literal's exact decimal, so \"+1.005\" is still\n // exactly 1.005 for a later \"to 2 dp\".\n else if (v.type === ValueType.Number && v.exact !== undefined) stack.push(numberValueExact(v.toNumber(), v.exact));\n else stack.push(numberValue(v.toNumber()));\n break;\n }\n case OpCode.MAKE_UNCERTAIN: {\n // `center ± spread`: the parselet pushed the center first, then the\n // spread, so the spread pops first. A faulted operand propagates\n // rather than being read as a zero center or spread.\n const spread = safePop(stack), center = safePop(stack);\n const uncFault = faultedOperand(center, spread);\n if (uncFault) { stack.push(uncFault); break; }\n // The center is the measured value, the spread its one-sigma tolerance.\n // The spread is taken as a magnitude, so \"5 +/- -2\" reads the same as\n // \"5 +/- 2\". Only a plain-number center carries an uncertainty (a unit\n // or other typed center falls back to its bare magnitude, units with\n // uncertainty are out of scope for this slice).\n stack.push(numberValueUncertain(center.toNumber(), Math.abs(spread.toNumber())));\n break;\n }\n\n // ═══════════════════════════════════════════════════════════════\n // §4 Bitwise (OpCode 30–36)\n // None of these routes through binaryOp(), so each one carries\n // its own faulted-operand check for the reason that function\n // documents: a bit pattern read off an Error or a Pending is the\n // bit pattern of zero, and `(5 kg to m) & 1` answered 0 with\n // nothing to say it had not been asked a real question.\n // ═══════════════════════════════════════════════════════════════\n case OpCode.LSHIFT: {\n const r = safePop(stack), l = safePop(stack);\n const shiftFault = faultedOperand(l, r);\n if (shiftFault) { stack.push(shiftFault); break; }\n if (l.type === ValueType.BigInt || r.type === ValueType.BigInt) {\n // Bounded, unlike the plain-number path below, which cannot grow:\n // a 32-bit shift is 32 bits whatever it is asked for. See\n // bigIntShift().\n stack.push(bigIntShift(l, r, 1));\n } else {\n stack.push(numberValue(l.toNumber() << r.toNumber()));\n }\n break;\n }\n case OpCode.RSHIFT: {\n const r = safePop(stack), l = safePop(stack);\n const rshiftFault = faultedOperand(l, r);\n if (rshiftFault) { stack.push(rshiftFault); break; }\n if (l.type === ValueType.BigInt || r.type === ValueType.BigInt) {\n stack.push(bigIntShift(l, r, -1));\n } else {\n stack.push(numberValue(l.toNumber() >> r.toNumber()));\n }\n break;\n }\n case OpCode.URSHIFT: {\n const r = safePop(stack), l = safePop(stack);\n // No BigInt branch, unlike its siblings above. `>>>` is defined on a\n // 32-bit unsigned word and JavaScript refuses it on a BigInt, so\n // there is nothing to widen to: BigInt(-8) >>> 1n is a TypeError, not\n // a large number. Both operands go through the 32-bit path.\n const urshiftFault = faultedOperand(l, r);\n if (urshiftFault) { stack.push(urshiftFault); break; }\n stack.push(numberValue(l.toNumber() >>> r.toNumber()));\n break;\n }\n case OpCode.BIT_AND: {\n const r = safePop(stack), l = safePop(stack);\n const andFault = faultedOperand(l, r);\n if (andFault) { stack.push(andFault); break; }\n if (l.type === ValueType.BigInt || r.type === ValueType.BigInt) {\n stack.push(bigIntValue(toBigIntOperand(l) & toBigIntOperand(r)));\n } else {\n stack.push(numberValue(l.toNumber() & r.toNumber()));\n }\n break;\n }\n case OpCode.BIT_OR: {\n const r = safePop(stack), l = safePop(stack);\n const orFault = faultedOperand(l, r);\n if (orFault) { stack.push(orFault); break; }\n if (l.type === ValueType.BigInt || r.type === ValueType.BigInt) {\n stack.push(bigIntValue(toBigIntOperand(l) | toBigIntOperand(r)));\n } else {\n stack.push(numberValue(l.toNumber() | r.toNumber()));\n }\n break;\n }\n case OpCode.BIT_XOR: {\n const r = safePop(stack), l = safePop(stack);\n const xorFault = faultedOperand(l, r);\n if (xorFault) { stack.push(xorFault); break; }\n if (l.type === ValueType.BigInt || r.type === ValueType.BigInt) {\n stack.push(bigIntValue(toBigIntOperand(l) ^ toBigIntOperand(r)));\n } else {\n stack.push(numberValue(l.toNumber() ^ r.toNumber()));\n }\n break;\n }\n case OpCode.BIT_NOT: {\n const v = safePop(stack);\n const notFault = faultedOperand(v);\n if (notFault) { stack.push(notFault); break; }\n if (v.type === ValueType.BigInt) stack.push(bigIntValue(~(v.value as bigint)));\n else stack.push(numberValue(~v.toNumber()));\n break;\n }\n\n // ═══════════════════════════════════════════════════════════════\n // §4b Comparison (OpCode 40–45)\n // Numeric fast path when both operands are Number;\n // all six unify UoM operands before comparing them.\n //\n // The four ordering opcodes used to skip that unification and\n // compare the bare magnitudes, so `1 km > 500 m` answered false\n // and `30 min < 1 hour` answered false as well. They now go\n // through compareUom() like EQ/NEQ, which also means they agree\n // with EQ about where the boundary between \"less\" and \"equal\"\n // falls: `equal` there is a tolerance rather than `===`, so a\n // pair EQ calls equal is one GT and LT both call false.\n //\n // Two units that share no measure cannot be ordered at all, so\n // the four ordering opcodes answer with an error rather than a\n // boolean. EQ and NEQ still answer with a boolean, because\n // \"a kilogram is not a metre\" is a true statement about a pair\n // that cannot be converted, whereas \"a kilogram is less than a\n // metre\" is not a statement at all.\n //\n // A faulted operand is the second case even for EQ and NEQ, and\n // all six propagate it. A kilogram is a quantity that is not a\n // metre; an Error is not a quantity, so there is nothing for it\n // to be equal to. Reading its number gave zero, which made\n // `(5 kg to m) == 0` answer true.\n // ═══════════════════════════════════════════════════════════════\n case OpCode.EQ: {\n const r = safePop(stack), l = safePop(stack);\n const eqFault = faultedOperand(l, r);\n if (eqFault) { stack.push(eqFault); break; }\n // Equal fractions are equal on the value, not on whichever doubles\n // they rounded to: \"1/49 * 49 == 1\" is true. Gated on a rational being\n // present, so \"1 == 1\" keeps its double compare below.\n if (l.rational !== undefined || r.rational !== undefined) {\n const cmp = compareRationalOperands(l, r);\n if (cmp !== null) { stack.push(boolValue(cmp === 0)); break; }\n }\n if (l.type === ValueType.Number && r.type === ValueType.Number) {\n stack.push(boolValue((l.value as number) === (r.value as number)));\n } else if (l.type === ValueType.BigInt || r.type === ValueType.BigInt) {\n // Comparing through toNumber() rounds a bigint to the nearest\n // double first, so two giants a single digit apart landed on the\n // same double and this answered true. See compareBigIntOperands().\n const cmp = compareBigIntOperands(l, r);\n stack.push(boolValue(cmp === null ? l.toNumber() === r.toNumber() : cmp === 0));\n } else if (l.type === ValueType.String && r.type === ValueType.String) {\n // Two strings compare as strings. Through toNumber() every\n // non-numeric string reads as 0, so `\"a\" == \"b\"` answered true.\n stack.push(boolValue((l.value as string) === (r.value as string)));\n } else if (l.type === ValueType.Uom && r.type === ValueType.Uom) {\n const { equal, sameMeasure } = compareUom(l, r);\n stack.push(boolValue(sameMeasure && equal));\n } else if (l.type === ValueType.Matrix && r.type === ValueType.Matrix) {\n stack.push(matrixCompare(l.value as MatrixData, r.value as MatrixData, (a, b) => a === b));\n } else if (l.type === ValueType.Colour || r.type === ValueType.Colour) {\n // A colour equals only another colour with the same canonical\n // channels, so `#ff0000 == rgb(255,0,0)` is true regardless of\n // format. A colour and a non-colour are never equal: NOT via\n // toNumber() (0 for a colour), which would make `#000000 == 0` true,\n // exactly the coercion fault this repo guards against.\n if (l.type === ValueType.Colour && r.type === ValueType.Colour) {\n const a = l.value as ColourData, b = r.value as ColourData;\n stack.push(boolValue(a.r === b.r && a.g === b.g && a.b === b.b && a.a === b.a));\n } else {\n stack.push(boolValue(false));\n }\n } else {\n stack.push(boolValue(l.toNumber() === r.toNumber()));\n }\n break;\n }\n case OpCode.NEQ: {\n const r = safePop(stack), l = safePop(stack);\n const neqFault = faultedOperand(l, r);\n if (neqFault) { stack.push(neqFault); break; }\n // The negation of EQ's rational branch, fraction for fraction.\n if (l.rational !== undefined || r.rational !== undefined) {\n const cmp = compareRationalOperands(l, r);\n if (cmp !== null) { stack.push(boolValue(cmp !== 0)); break; }\n }\n if (l.type === ValueType.Number && r.type === ValueType.Number) {\n stack.push(boolValue((l.value as number) !== (r.value as number)));\n } else if (l.type === ValueType.BigInt || r.type === ValueType.BigInt) {\n // The negation of EQ's bigint branch above, digit for digit.\n const cmp = compareBigIntOperands(l, r);\n stack.push(boolValue(cmp === null ? l.toNumber() !== r.toNumber() : cmp !== 0));\n } else if (l.type === ValueType.String && r.type === ValueType.String) {\n stack.push(boolValue((l.value as string) !== (r.value as string)));\n } else if (l.type === ValueType.Uom && r.type === ValueType.Uom) {\n const { equal, sameMeasure } = compareUom(l, r);\n stack.push(boolValue(!sameMeasure || !equal));\n } else if (l.type === ValueType.Matrix && r.type === ValueType.Matrix) {\n stack.push(matrixCompare(l.value as MatrixData, r.value as MatrixData, (a, b) => a !== b));\n } else if (l.type === ValueType.Colour || r.type === ValueType.Colour) {\n // The negation of EQ's colour branch: two colours differ by channel,\n // and a colour and a non-colour are always unequal.\n if (l.type === ValueType.Colour && r.type === ValueType.Colour) {\n const a = l.value as ColourData, b = r.value as ColourData;\n stack.push(boolValue(!(a.r === b.r && a.g === b.g && a.b === b.b && a.a === b.a)));\n } else {\n stack.push(boolValue(true));\n }\n } else {\n stack.push(boolValue(l.toNumber() !== r.toNumber()));\n }\n break;\n }\n case OpCode.LT: {\n const r = safePop(stack), l = safePop(stack);\n const ltFault = faultedOperand(l, r);\n if (ltFault) { stack.push(ltFault); break; }\n if (l.rational !== undefined || r.rational !== undefined) {\n const cmp = compareRationalOperands(l, r);\n if (cmp !== null) { stack.push(boolValue(cmp < 0)); break; }\n }\n if (l.type === ValueType.Number && r.type === ValueType.Number) {\n stack.push(boolValue((l.value as number) < (r.value as number)));\n } else if (l.type === ValueType.BigInt || r.type === ValueType.BigInt) {\n // Digit-exact, for the reason given on EQ's matching branch.\n const cmp = compareBigIntOperands(l, r);\n stack.push(boolValue(cmp === null ? l.toNumber() < r.toNumber() : cmp < 0));\n } else if (l.type === ValueType.Uom && r.type === ValueType.Uom) {\n const { lv, rv, equal, sameMeasure } = compareUom(l, r);\n stack.push(sameMeasure ? boolValue(!equal && lv < rv) : incomparableUnitsError(l, r));\n } else if (l.type === ValueType.Matrix && r.type === ValueType.Matrix) {\n stack.push(matrixCompare(l.value as MatrixData, r.value as MatrixData, (a, b) => a < b));\n } else {\n stack.push(boolValue(l.toNumber() < r.toNumber()));\n }\n break;\n }\n case OpCode.LTE: {\n const r = safePop(stack), l = safePop(stack);\n const lteFault = faultedOperand(l, r);\n if (lteFault) { stack.push(lteFault); break; }\n if (l.rational !== undefined || r.rational !== undefined) {\n const cmp = compareRationalOperands(l, r);\n if (cmp !== null) { stack.push(boolValue(cmp <= 0)); break; }\n }\n if (l.type === ValueType.Number && r.type === ValueType.Number) {\n stack.push(boolValue((l.value as number) <= (r.value as number)));\n } else if (l.type === ValueType.BigInt || r.type === ValueType.BigInt) {\n const cmp = compareBigIntOperands(l, r);\n stack.push(boolValue(cmp === null ? l.toNumber() <= r.toNumber() : cmp <= 0));\n } else if (l.type === ValueType.Uom && r.type === ValueType.Uom) {\n const { lv, rv, equal, sameMeasure } = compareUom(l, r);\n stack.push(sameMeasure ? boolValue(equal || lv <= rv) : incomparableUnitsError(l, r));\n } else if (l.type === ValueType.Matrix && r.type === ValueType.Matrix) {\n stack.push(matrixCompare(l.value as MatrixData, r.value as MatrixData, (a, b) => a <= b));\n } else {\n stack.push(boolValue(l.toNumber() <= r.toNumber()));\n }\n break;\n }\n case OpCode.GT: {\n const r = safePop(stack), l = safePop(stack);\n const gtFault = faultedOperand(l, r);\n if (gtFault) { stack.push(gtFault); break; }\n if (l.rational !== undefined || r.rational !== undefined) {\n const cmp = compareRationalOperands(l, r);\n if (cmp !== null) { stack.push(boolValue(cmp > 0)); break; }\n }\n if (l.type === ValueType.Number && r.type === ValueType.Number) {\n stack.push(boolValue((l.value as number) > (r.value as number)));\n } else if (l.type === ValueType.BigInt || r.type === ValueType.BigInt) {\n const cmp = compareBigIntOperands(l, r);\n stack.push(boolValue(cmp === null ? l.toNumber() > r.toNumber() : cmp > 0));\n } else if (l.type === ValueType.Uom && r.type === ValueType.Uom) {\n const { lv, rv, equal, sameMeasure } = compareUom(l, r);\n stack.push(sameMeasure ? boolValue(!equal && lv > rv) : incomparableUnitsError(l, r));\n } else if (l.type === ValueType.Matrix && r.type === ValueType.Matrix) {\n stack.push(matrixCompare(l.value as MatrixData, r.value as MatrixData, (a, b) => a > b));\n } else {\n stack.push(boolValue(l.toNumber() > r.toNumber()));\n }\n break;\n }\n case OpCode.GTE: {\n const r = safePop(stack), l = safePop(stack);\n const gteFault = faultedOperand(l, r);\n if (gteFault) { stack.push(gteFault); break; }\n if (l.rational !== undefined || r.rational !== undefined) {\n const cmp = compareRationalOperands(l, r);\n if (cmp !== null) { stack.push(boolValue(cmp >= 0)); break; }\n }\n if (l.type === ValueType.Number && r.type === ValueType.Number) {\n stack.push(boolValue((l.value as number) >= (r.value as number)));\n } else if (l.type === ValueType.BigInt || r.type === ValueType.BigInt) {\n const cmp = compareBigIntOperands(l, r);\n stack.push(boolValue(cmp === null ? l.toNumber() >= r.toNumber() : cmp >= 0));\n } else if (l.type === ValueType.Uom && r.type === ValueType.Uom) {\n const { lv, rv, equal, sameMeasure } = compareUom(l, r);\n stack.push(sameMeasure ? boolValue(equal || lv >= rv) : incomparableUnitsError(l, r));\n } else if (l.type === ValueType.Matrix && r.type === ValueType.Matrix) {\n stack.push(matrixCompare(l.value as MatrixData, r.value as MatrixData, (a, b) => a >= b));\n } else {\n stack.push(boolValue(l.toNumber() >= r.toNumber()));\n }\n break;\n }\n\n // ═══════════════════════════════════════════════════════════════\n // §4c Logical / conditional select (OpCode 130–132)\n //\n // Truthiness is read through isTruthy(), which reads a number,\n // which is zero for a fault, so a failed operand used to be\n // quietly false. Both operands are already evaluated by the time\n // either opcode runs (this VM has no branch opcodes), so there is\n // no short-circuit to preserve by ignoring the right-hand one.\n // ═══════════════════════════════════════════════════════════════\n case OpCode.LOGICAL_AND: {\n const r = safePop(stack), l = safePop(stack);\n const andLogicFault = faultedOperand(l, r);\n if (andLogicFault) { stack.push(andLogicFault); break; }\n stack.push(boolValue(isTruthy(l) && isTruthy(r)));\n break;\n }\n case OpCode.LOGICAL_OR: {\n const r = safePop(stack), l = safePop(stack);\n const orLogicFault = faultedOperand(l, r);\n if (orLogicFault) { stack.push(orLogicFault); break; }\n stack.push(boolValue(isTruthy(l) || isTruthy(r)));\n break;\n }\n case OpCode.SELECT: {\n // Eager ternary: both branches are ALREADY evaluated and on the\n // stack by the time this opcode runs (this VM has no jump/branch\n // opcodes. See OpCode.ts's comment on SELECT for why that's an\n // intentional simplification, not an oversight). Stack order\n // (bottom to top) matches the natural parse order of \"if\n // condition then thenVal else elseVal\": [condition, thenVal, elseVal].\n const elseVal = safePop(stack);\n const thenVal = safePop(stack);\n const condition = safePop(stack);\n // Only the CONDITION is checked for a fault, unlike every other\n // opcode here. Both arms are already evaluated, and the arm that is\n // not chosen is not part of the answer: refusing `if 1 then 2 else\n // (5 kg to m)` would report a failure the reader's own line never\n // asked about. A faulted condition selects nothing, so it stands.\n const conditionFault = faultedOperand(condition);\n if (conditionFault) { stack.push(conditionFault); break; }\n stack.push(isTruthy(condition) ? thenVal : elseVal);\n break;\n }\n\n // ═══════════════════════════════════════════════════════════════\n // §5 Functions (OpCode 50–52)\n // ═══════════════════════════════════════════════════════════════\n case OpCode.CALL_PLUGIN: {\n const fnIdx = operandByte(opcodes, ip++, op, \"plugin-function index\");\n const argCount = operandByte(opcodes, ip++, op, \"argument count\");\n const args: Value[] = [];\n for (let i = 0; i < argCount; i++) args.push(safePop(stack));\n args.reverse();\n const fn = vm.context.pluginFunctions[fnIdx];\n // A plugin handler reads its arguments the same way a builtin does,\n // and none of them can do anything useful with an argument that\n // failed or has not arrived: the call would be made with a zero, or\n // with a query built from one. Checked here rather than in each\n // handler, for the same reason the arity check below lives at the\n // dispatch point.\n const pluginArgFault = faultedIn(args);\n if (pluginArgFault) {\n stack.push(pluginArgFault);\n } else if (!fn) {\n stack.push(numberValue(0));\n } else {\n const result = fn(args, context);\n if (result instanceof Promise) {\n // Return pending result, no throw. The orchestrator checks\n // result.type and handles async resolution outside the VM.\n // The pluginId + domain are embedded in the cache key format:\n // {pluginId}:{domain}:{fnIdx}:{hash(args)}\n // We use a deterministic key from fnIdx + args for now;\n // the engine scopes it by pluginId before storing.\n const cacheKey = `plugin:${fnIdx}:${args.map(a => String(a.value ?? '')).join('|')}`;\n // activeSignal must be set by the engine before calling executeBytecode.\n // If it's not (bug), we use a new signal that will never abort\n // this is a safety net, not the expected path.\n const signal = vm.activeSignal!;\n // The owning package, so a failed or slow async call can be attributed.\n // Falls back to the empty string only for a handler installed\n // directly into a context rather than through registerPackage.\n const packageId = vm.context.pluginFunctionOwners[fnIdx] ?? '';\n return { type: 'pending', queryKey: cacheKey, resolver: result, packageId, signal };\n }\n stack.push(result);\n }\n break;\n }\n case OpCode.CALL_BUILTIN: {\n const fnIdx = operandByte(opcodes, ip++, op, \"builtin-function index\");\n const argCount = operandByte(opcodes, ip++, op, \"argument count\");\n // Argument count first, before anything is popped. Every builtin\n // indexes its args positionally with no length check of its own, so\n // `sqrt()` used to reach `args[0].toNumber()` on an empty array and\n // throw a raw TypeError that arrived at the host as an INTERNAL\n // engine bug naming no function. This is the only place that knows\n // both the index and the count; see vm/VMBuiltinArity.ts.\n const arityError = builtinArityError(fnIdx, argCount);\n if (arityError) throw arityError;\n const args: Value[] = [];\n // The symbolic flag is tracked while popping rather than by a second\n // pass, so the ordinary numeric call pays one type comparison per\n // argument and nothing else.\n let sawSymbolic = false;\n for (let i = 0; i < argCount; i++) {\n const arg = safePop(stack);\n if (arg.type === ValueType.Symbolic) sawSymbolic = true;\n args.push(arg);\n }\n // The same argument as the symbolic routing below, for the operand\n // type that has no reading at all rather than a non-numeric one:\n // every implementation reads args[n].toNumber(), which is 0 for an\n // Error and for a Pending, so `abs(5 kg to m)` answered 0 and\n // `round(<a price still loading>)` answered 0 as well. One check\n // here covers all ~90 of them; see faultedOperand() in vm/Value.ts.\n const builtinArgFault = faultedIn(args);\n if (builtinArgFault) { stack.push(builtinArgFault); break; }\n const fn = builtinFunctions[fnIdx];\n if (fn) {\n const ordered = args.reverse();\n // One dispatch point covers all ~60 builtins. Each of their\n // implementations reads args[n].toNumber(), which reports 0 for a\n // symbolic operand, so routing here is what stops `sqrt(x)` from\n // quietly returning 0. An index with no symbolic reading comes back\n // as an error rather than a number computed from that placeholder.\n // The algebra verbs are the exception: they exist to take an\n // expression containing unknowns, so they run their own handler.\n const routeSymbolically = sawSymbolic && !SYMBOLIC_NATIVE_BUILTINS.has(fnIdx);\n stack.push(routeSymbolically ? symbolicBuiltin(fnIdx, ordered) : fn(ordered));\n }\n break;\n }\n case OpCode.DEFINE_USER_FUNCTION: {\n // Registration happens HERE, at execution time, not at parse\n // time, so a diagnostic/lookahead parse of a definition line\n // that never actually executes (syntax highlighting, autocomplete\n // preview, ...) has no side effect on vm.userFunctions. See\n // BytecodeBuilder.ts's UserFunctionDef doc comment.\n const bodyIdx = operandByte(opcodes, ip++, op, \"function-body index\");\n const def = userFunctionBodies?.[bodyIdx];\n if (!def) {\n // A compiler/VM invariant violation, not user-input, a\n // mismatched bodyIdx means the bytecode compiler and this\n // dispatch loop disagree about userFunctionBodies' contents,\n // never something reachable by writing a normal `f(x) = ...`\n // expression correctly. See ErrorCode.ts's own catalog comment.\n throw ErrorFactory.internal(\n \"INTERNAL_MISSING_FUNCTION_BODY\",\n `Internal error: DEFINE_USER_FUNCTION referenced missing body index ${bodyIdx}`,\n { bodyIdx },\n );\n }\n vm.defineUserFunction(def.name, def.params, def.program);\n break;\n }\n case OpCode.CALL_USER_FUNCTION: {\n // User-defined, parameterized, reusable functions. `name`'s body\n // was compiled to its OWN independent BytecodeProgram at\n // definition time, parameter references inside it are ORDINARY\n // LOAD_VAR opcodes (see BytecodeBuilder.ts's UserFunctionDef doc\n // comment for why), resolved dynamically via the call frame\n // pushed below. Re-executing the body here is a genuinely\n // reentrant executeBytecode() call sharing this same `vm`/stack\n // safe because any valid bytecode program, run to completion,\n // leaves exactly one net value on the stack, the same invariant\n // every other expression already relies on.\n const name = poolString(opcodes, ip++, strings, op, \"function-name index\");\n const argCount = operandByte(opcodes, ip++, op, \"argument count\");\n const args: Value[] = [];\n for (let i = 0; i < argCount; i++) args.push(safePop(stack));\n args.reverse();\n const fn = vm.getUserFunction(name);\n if (!fn) {\n throw ErrorFactory.execution(\"UNDEFINED_FUNCTION\", `Undefined function: ${name}`, { name });\n }\n if (argCount !== fn.params.length) {\n throw ErrorFactory.execution(\n \"FUNCTION_ARITY_MISMATCH\",\n `${name} expects ${fn.params.length} argument(s) but got ${argCount}`,\n { name, expected: fn.params.length, actual: argCount },\n );\n }\n const frame = new Map<string, Value>();\n for (let i = 0; i < fn.params.length; i++) frame.set(fn.params[i], args[i]);\n // Two guards, because they bound two different numbers and each is\n // blind to the other's case.\n //\n // pushCallFrame() throws FUNCTION_RECURSION_LIMIT_EXCEEDED before\n // ever reaching the reentrant executeBytecode() call below if\n // this would exceed maxFunctionRecursionDepth, the backstop for\n // f(x) = f(x), which would otherwise recurse via nested\n // executeBytecode() calls (each with its OWN fresh\n // localInstructionCount, so maxInstructions cannot catch this)\n // until the native V8 stack overflows uncatchably.\n //\n // chargeFunctionCall() bounds how MANY calls this evaluation makes\n // rather than how deeply they nest, which the depth guard cannot\n // see: `f(n)(v) = f(n-1)(v) + f(n-1)(v)` over twenty-two lines nests\n // twenty-two deep and calls two million times, and killed the\n // process. It is charged here rather than counted in the VM because\n // the tally has to survive the reentrant call below, exactly like\n // the allocation tally and unlike localInstructionCount.\n chargeFunctionCall();\n vm.pushCallFrame(frame);\n let bodyResult: EvalResult;\n try {\n bodyResult = executeBytecode(fn.program, vm, pipeline, expression, context);\n } finally {\n // Always pop, even if the body throws, an uncaught error inside\n // one call must not leave a stale frame poisoning whatever\n // (unrelated) expression runs next.\n vm.popCallFrame();\n }\n if (bodyResult.type === \"pending\") {\n // v1 scope decision: a user function's body calling an async\n // plugin function (weather, stocks, ...) isn't supported yet\n // propagating a 'pending' result up through a reentrant\n // executeBytecode() call would need the OUTER expression's own\n // bytecode position/stack state to also be resumable later,\n // which this first pass doesn't implement. Also rejected at\n // DEFINITION time (see PrecedenceParser.ts's\n // parseUserFunctionDefinition). This is a defense-in-depth\n // backstop, not the primary guard.\n throw ErrorFactory.execution(\n \"USER_FUNCTION_ASYNC_UNSUPPORTED\",\n `${name}: user-defined functions with async bodies (weather, stocks, currency, ...) aren't supported`,\n { name },\n );\n }\n if (bodyResult.type === \"error\") {\n // A controlled internal-invariant error inside the body, surface\n // it as-is rather than swallowing/rewrapping (same convention as\n // unwrapEvalResult()).\n throw bodyResult.error;\n }\n stack.push(bodyResult.value);\n break;\n }\n\n // ═══════════════════════════════════════════════════════════════\n // §6 Variables (OpCode 60–63)\n // ═══════════════════════════════════════════════════════════════\n case OpCode.LOAD_VAR: {\n const varName = poolString(opcodes, ip++, strings, op, \"variable-name index\");\n const val = vm.getVar(varName);\n if (val !== undefined) {\n stack.push(val);\n } else if (symbolicTolerant) {\n stack.push(symbolicValue(varSymbolicNode(varName)));\n } else {\n throw ErrorFactory.execution(\n \"UNDEFINED_VARIABLE\",\n `Undefined variable: ${varName}`,\n { varName },\n );\n }\n break;\n }\n case OpCode.STORE_VAR: {\n const val = safePop(stack);\n const varName = poolString(opcodes, ip++, strings, op, \"variable-name index\");\n vm.setVar(varName, hasArena ? persistentValue(val) : val);\n stack.push(val);\n break;\n }\n case OpCode.LOAD_GLOBAL_VAR: {\n // GlobalVariableAsyncResolver's preflight() runs BEFORE the VM ever\n // reaches this opcode and is SUPPOSED to intercept the \"not yet\n // declared by any loaded document\" case (returning a Pending value\n // up front, mirroring how currency conversion's preflight\n // intercepts before UOM_CONVERT_TO runs), but that invariant is\n // confirmed violable: ThreeTierEvaluator's Tier 2 (executeCached())\n // can mark a line \"clean\" and skip straight to VM execution without\n // ever running preflightAll() (see ARCHITECTURE.md §7's P0 item\n // still open, gated on the larger L1 migration). This used to be a\n // bare `!` non-null assertion, a raw, uncontrolled TypeError the\n // instant that invariant was violated, rather than a controlled\n // error. Explicit check instead: the read is still expected to\n // always succeed in the common case, but \"expected to always\n // succeed\" was exactly the wrong assumption that produced the\n // Tier-2 bypass bug in the first place.\n const varName = poolString(opcodes, ip++, strings, op, \"variable-name index\");\n const globalValue = sharedGlobalVariableStore.get(varName);\n if (globalValue === undefined) {\n // .internal(), not .execution(): this is the Tier-2/preflight-\n // bypass invariant violation described above, not something an\n // ordinary user expression can trigger by itself, the\n // precondition (\"preflight already ran\") is the CALLER's\n // (ThreeTierEvaluator's) responsibility, not the user's.\n throw ErrorFactory.internal({\n code: \"GLOBAL_VARIABLE_NOT_RESOLVED\",\n message: `Global variable \"${varName}\" was read before it resolved`,\n expected: `global variable \"${varName}\" to already be resolved (async preflight should guarantee this)`,\n found: \"no value in the global variable store\",\n context: { varName },\n });\n }\n stack.push(globalValue);\n break;\n }\n case OpCode.STORE_GLOBAL_VAR: {\n const val = safePop(stack);\n const varName = poolString(opcodes, ip++, strings, op, \"variable-name index\");\n // Persisting here matters even more than for STORE_VAR: a global\n // outlives not just this call's own VM but every OTHER document's\n // arena-reset cycles too. An un-persisted arena Value stored here\n // would get silently corrupted by a later, unrelated arena\n // allocation in ANY document, not just this one.\n sharedGlobalVariableStore.set(varName, hasArena ? persistentValue(val) : val);\n stack.push(val);\n break;\n }\n\n // ═══════════════════════════════════════════════════════════════\n // §7 Type conversions (OpCode 70–74, 140–145)\n // Every one of these restates a number in another notation, so a\n // faulted operand has nothing to restate and each propagates it\n // rather than converting the zero toNumber() reports. Without it\n // \"(5 kg to m) as hex\" answered 0x0 and \"as binary\" answered 0b0.\n // ═══════════════════════════════════════════════════════════════\n case OpCode.TO_NUMBER: {\n const v = safePop(stack);\n const toNumberFault = faultedOperand(v);\n if (toNumberFault) { stack.push(toNumberFault); break; }\n stack.push(numberValue(v.toNumber()));\n break;\n }\n case OpCode.TO_HEX: {\n const v = safePop(stack);\n const toHexFault = faultedOperand(v);\n if (toHexFault) { stack.push(toHexFault); break; }\n // A colour already has a hex reading, so `#3366cc as rgb as hex` should\n // round-trip rather than collapse through toNumber() (which is 0 for a\n // colour). Re-tag its display format to hex, leaving channels intact.\n if (v.type === ValueType.Colour) {\n const c = v.value as ColourData;\n stack.push(colourValue({ r: c.r, g: c.g, b: c.b, a: c.a, format: \"hex\" }));\n break;\n }\n // A bigint keeps its bigint, exactly as ADD/SUB/MUL/DIV do:\n // `12345678901234567890n as hex` rendered 0xAB54A98CEB1F0800 while\n // the value ends 0AD2, because toNumber() rounded it first.\n stack.push(hexValue(v.type === ValueType.BigInt ? (v.value as bigint) : v.toNumber()));\n break;\n }\n case OpCode.TO_PERCENTAGE: {\n const v = safePop(stack);\n const toPercentageFault = faultedOperand(v);\n if (toPercentageFault) { stack.push(toPercentageFault); break; }\n stack.push(percentageValue(v.toNumber()));\n break;\n }\n case OpCode.TO_FRACTION: {\n const v = safePop(stack);\n const toFractionFault = faultedOperand(v);\n if (toFractionFault) { stack.push(toFractionFault); break; }\n // A value carrying its exact rational renders that fraction exactly;\n // everything else keeps the continued-fraction guess from the double,\n // so \"0.75 as fraction\" is still \"3/4\".\n stack.push(stringValue(v.rational !== undefined ? rationalToFractionString(v.rational) : toFractionString(v.toNumber())));\n break;\n }\n case OpCode.TO_MULTIPLIER: {\n const v = safePop(stack);\n const toMultiplierFault = faultedOperand(v);\n if (toMultiplierFault) { stack.push(toMultiplierFault); break; }\n stack.push(stringValue(toMultiplierString(v)));\n break;\n }\n case OpCode.TO_SCI: {\n const v = safePop(stack);\n const toSciFault = faultedOperand(v);\n if (toSciFault) { stack.push(toSciFault); break; }\n stack.push(stringValue(toScientificString(v.toNumber())));\n break;\n }\n // Numeric, like TO_HEX above. A base is a way of writing a number, so\n // `(255 as binary) + 1` has to be 256; as a string it was 1.\n case OpCode.TO_BINARY: {\n const v = safePop(stack);\n const toBinaryFault = faultedOperand(v);\n if (toBinaryFault) { stack.push(toBinaryFault); break; }\n stack.push(hexValue(v.type === ValueType.BigInt ? (v.value as bigint) : v.toNumber(), \"bin\"));\n break;\n }\n case OpCode.TO_OCTAL: {\n const v = safePop(stack);\n const toOctalFault = faultedOperand(v);\n if (toOctalFault) { stack.push(toOctalFault); break; }\n stack.push(hexValue(v.type === ValueType.BigInt ? (v.value as bigint) : v.toNumber(), \"oct\"));\n break;\n }\n case OpCode.CALL_AS_CONVERTER: {\n const name = stringOperand(safePop(stack), op, \"converter name\").toLowerCase();\n const value = safePop(stack);\n // A registered converter is arbitrary host code reading the Value\n // it is handed, so the fault is stopped before it gets there rather\n // than inside each converter.\n const converterFault = faultedOperand(value);\n if (converterFault) { stack.push(converterFault); break; }\n const converter = asConverterRegistry.get(name);\n if (!converter) {\n stack.push(errorValue(\"UNKNOWN_AS_CONVERTER\", `Unknown converter \"as ${name}\"`));\n } else {\n stack.push(converter(value));\n }\n break;\n }\n\n // ═══════════════════════════════════════════════════════════════\n // §8 UoM (OpCode 80–84)\n // ═══════════════════════════════════════════════════════════════\n case OpCode.UOM_CONVERT: {\n const unit = stringOperand(safePop(stack), op, \"unit name\");\n const operand = safePop(stack);\n const faulted = faultedOperand(operand);\n if (faulted) { stack.push(faulted); break; }\n // Money keeps its exact decimal from here on. The amount either\n // arrived as a decimal literal (exact sidecar already set) or is a\n // whole number, either of which has an exact decimal; a fractional\n // double amount (\"$sqrt(2)\") has none and stays an ordinary float\n // Uom. Only currencies carry the sidecar, so every other unit (km,\n // kg, ...) is unchanged.\n const money = moneyExactMagnitude(operand, unit);\n if (money) stack.push(uomValueExact(operand.toNumber(), unit, money));\n else stack.push(uomValue(operand.toNumber(), unit));\n break;\n }\n case OpCode.UOM_CONVERT_TO: {\n const toUnit = stringOperand(safePop(stack), op, \"target unit name\");\n const fromUnit = stringOperand(safePop(stack), op, \"source unit name\");\n const operand = safePop(stack);\n // The quantity being converted may already have failed, and a\n // conversion is the one operator that made that invisible: it reads\n // the operand's number, gets the zero Error and Pending report, and\n // pushes it back wearing the unit the reader asked for. `5 kg to m\n // to s` answered `0.00 s` and `60 km/h in m/s` answered `0.00 /s`,\n // a plausible number in a unit with no numerator, with the failed\n // first conversion nowhere on screen. `binaryOp` has refused this\n // for `+` and `*` since it was written, which is why the same value\n // carried its fault everywhere except through here.\n const faulted = faultedOperand(operand);\n if (faulted) { stack.push(faulted); break; }\n const val = operand.toNumber();\n const measure = getMeasure(fromUnit);\n const isCurrency = sharedCurrencyExchange.isCurrency(fromUnit) && sharedCurrencyExchange.isCurrency(toUnit);\n if (measure && getMeasure(toUnit) === measure) {\n stack.push(uomValue(convertUnit(val, fromUnit, toUnit), toUnit));\n } else if (isCurrency) {\n const converted = sharedCurrencyExchange.convertSync(val, fromUnit, toUnit);\n if (converted !== null) {\n stack.push(uomValue(converted, toUnit));\n } else {\n // No live rate cached yet (or the fetch failed). Pushing the\n // unconverted value under its original unit would silently\n // masquerade as a correct conversion, e.g. \"450 EUR to USD\"\n // displaying as \"450.00 EUR\", which reads as a successful\n // no-op rather than the missing-data case it actually is.\n // An Error value makes the failure visible instead.\n stack.push(errorValue(\"CURRENCY_RATE_UNAVAILABLE\", `No exchange rate available for ${fromUnit} to ${toUnit}`));\n }\n } else {\n // A rate or speed spelling (\"km/h\", \"m/s\", \"mph\") has no single\n // measure, so the checks above cannot see it. \"100 km/h in mph\"\n // and \"10 m/s in km/h\" reach conversion here, not through\n // convertUnit(). A null means the pair really is incompatible.\n const rate = convertRate(val, fromUnit, toUnit);\n if (rate !== null) {\n stack.push(uomValue(rate, toUnit));\n } else {\n stack.push(incompatibleConversionError(fromUnit, toUnit));\n }\n }\n break;\n }\n case OpCode.UOM_POSSIBILITIES: {\n // \"sourceUnit to ?\", pops the source unit name string, pushes a\n // human-readable list of every other unit in the same measure.\n const unit = stringOperand(safePop(stack), op, \"unit name\");\n const possibilities = getConvertiblePossibilities(unit);\n stack.push(stringValue(possibilities.length > 0 ? possibilities.join(\", \") : `No known units for \"${unit}\"`));\n break;\n }\n case OpCode.UOM_BEST: {\n const unit = stringOperand(safePop(stack), op, \"unit name\");\n const operand = safePop(stack);\n const faulted = faultedOperand(operand);\n if (faulted) { stack.push(faulted); break; }\n const { value, unit: bestUnit } = getBestUnit(operand.toNumber(), unit);\n stack.push(uomValue(value, bestUnit));\n break;\n }\n case OpCode.UOM_CONVERT_IN: {\n const toUnit = stringOperand(safePop(stack), op, \"target unit name\");\n const left = safePop(stack);\n // See UOM_CONVERT_TO above. This is the spelling `5 kg to m to s`\n // actually reaches, since the second conversion's source is an\n // expression rather than a literal: an Error is not a Uom, so it\n // fell into the else branch at the bottom and came back out as\n // `uomValue(0, \"s\")`.\n const faulted = faultedOperand(left);\n if (faulted) { stack.push(faulted); break; }\n if (left.type === ValueType.Uom) {\n const fromUnit = left.unit!;\n const val = left.toNumber();\n const measure = getMeasure(fromUnit);\n const isCurrency = sharedCurrencyExchange.isCurrency(fromUnit) && sharedCurrencyExchange.isCurrency(toUnit);\n if (measure && getMeasure(toUnit) === measure) {\n stack.push(uomValue(convertUnit(val, fromUnit, toUnit), toUnit));\n } else if (isCurrency) {\n const converted = sharedCurrencyExchange.convertSync(val, fromUnit, toUnit);\n if (converted !== null) {\n stack.push(uomValue(converted, toUnit));\n } else {\n // See the matching comment in UOM_CONVERT_TO, pushing the\n // original value here would silently pass off a missing\n // exchange rate as a successful (non-)conversion.\n stack.push(errorValue(\"CURRENCY_RATE_UNAVAILABLE\", `No exchange rate available for ${fromUnit} to ${toUnit}`));\n }\n } else {\n // Rate or speed conversion, \"(120 km / 2 hours) in kph\". See the\n // matching branch in UOM_CONVERT_TO above.\n const rate = convertRate(val, fromUnit, toUnit);\n if (rate !== null) {\n stack.push(uomValue(rate, toUnit));\n } else {\n stack.push(incompatibleConversionError(fromUnit, toUnit));\n }\n }\n } else {\n stack.push(uomValue(left.toNumber(), toUnit));\n }\n break;\n }\n case OpCode.UOM_GET_VALUE: {\n const v = safePop(stack);\n const getValueFault = faultedOperand(v);\n if (getValueFault) { stack.push(getValueFault); break; }\n stack.push(numberValue(v.toNumber()));\n break;\n }\n\n // ═══════════════════════════════════════════════════════════════\n // §8.5 Rate, \"quantity per unit of something\" (OpCode 110–112)\n // See vm/Value.ts's rateValue()/isRateUnit()/splitRateUnit().\n // ═══════════════════════════════════════════════════════════════\n case OpCode.RATE_DIV: {\n // Construction: Uom ÷ Uom (different measures) -> Rate.\n // \"90 km / 3 day\" -> \"30 km/day\": magnitude divides, units join.\n const denominatorVal = safePop(stack);\n const numeratorVal = safePop(stack);\n // \"60 km/h in m/s\" reaches here with a failed conversion as its\n // numerator, and a rate built from one is the same silent zero the\n // conversion opcodes had, wearing an even stranger unit: the\n // numerator label comes off the operand's type, so an Error\n // contributed no label at all and the answer displayed as\n // \"0.00 /s\", a rate of nothing per second.\n const rateDivFault = faultedOperand(numeratorVal, denominatorVal);\n if (rateDivFault) { stack.push(rateDivFault); break; }\n if (denominatorVal.type !== ValueType.Uom || !denominatorVal.unit) {\n stack.push(errorValue(\"RATE_MISSING_DENOMINATOR_UNIT\", \"Cannot build a rate: the right-hand side of \\\"/\\\" has no unit\"));\n break;\n }\n const numeratorUnit = numeratorVal.type === ValueType.Uom ? (numeratorVal.unit ?? \"\") : \"\";\n stack.push(rateValue(numeratorVal.toNumber() / denominatorVal.toNumber(), numeratorUnit, denominatorVal.unit));\n break;\n }\n case OpCode.RATE_MUL: {\n // Explicit form of the same rate-multiplication OpCode.MUL now\n // applies automatically to any Uom×Uom pair where one side is\n // rate-shaped. See multiplyRateByMatchingUom(). Kept as its own\n // opcode for packages that want to emit it deliberately rather\n // than relying on operand-type auto-detection.\n const multiplier = safePop(stack);\n const rate = safePop(stack);\n const rateMulFault = faultedOperand(rate, multiplier);\n if (rateMulFault) { stack.push(rateMulFault); break; }\n if (rate.type !== ValueType.Uom || !isRateUnit(rate.unit)) {\n stack.push(errorValue(\"RATE_MUL_LEFT_NOT_A_RATE\", \"Left-hand side of a rate multiplication must be a rate (e.g. \\\"$50/week\\\")\"));\n break;\n }\n if (multiplier.type !== ValueType.Uom || !multiplier.unit) {\n stack.push(errorValue(\"RATE_MUL_RIGHT_MISSING_UNIT\", \"Right-hand side of a rate multiplication must have a unit matching the rate's denominator\"));\n break;\n }\n stack.push(multiplyRateByMatchingUom(rate, multiplier));\n break;\n }\n case OpCode.RATE_CONVERT: {\n // Rescale a rate's denominator to a new unit, preserving the\n // real-world rate. \"30/week as /month\" -> \"~130/month\".\n const newDenominatorUnit = stringOperand(safePop(stack), op, \"denominator unit name\");\n const rate = safePop(stack);\n const rateConvertFault = faultedOperand(rate);\n if (rateConvertFault) { stack.push(rateConvertFault); break; }\n if (rate.type !== ValueType.Uom || !isRateUnit(rate.unit)) {\n stack.push(errorValue(\"RATE_CONVERT_NOT_A_RATE\", \"Cannot convert a non-rate value's denominator\"));\n break;\n }\n const { numerator, denominator } = splitRateUnit(rate.unit);\n const rateMeasure = getMeasure(denominator);\n const targetMeasure = getMeasure(newDenominatorUnit);\n if (!rateMeasure || rateMeasure !== targetMeasure) {\n stack.push(errorValue(\n \"RATE_CONVERT_MEASURE_MISMATCH\",\n `Cannot convert a \"${denominator}\"-denominated rate to \"${newDenominatorUnit}\" — different measures`\n ));\n break;\n }\n // How many `denominator` units are in one `newDenominatorUnit`\n // (e.g. how many weeks in 1 month), the rate scales by that factor.\n const factor = convertUnit(1, newDenominatorUnit, denominator);\n stack.push(rateValue(rate.toNumber() * factor, numerator, newDenominatorUnit));\n break;\n }\n\n // ═══════════════════════════════════════════════════════════════\n // §8.7 Time, clock-time-of-day (OpCode 120)\n // ═══════════════════════════════════════════════════════════════\n case OpCode.CLOCK_TIME_TODAY: {\n // \"9:00am\"/\"16:00\", anchored to TODAY's calendar date, not a\n // relative offset from `now` (so it stays correct regardless of\n // what time it currently is, \"9:00am\" always means 9am today).\n const minutesValue = safePop(stack);\n const clockFault = faultedOperand(minutesValue);\n if (clockFault) { stack.push(clockFault); break; }\n const totalMinutes = minutesValue.toNumber();\n const now = new Date();\n const anchored = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0, 0);\n anchored.setMinutes(totalMinutes);\n stack.push(datetimeValue(anchored.getTime()));\n break;\n }\n\n // ═══════════════════════════════════════════════════════════════\n // §9 Datetime (OpCode 90–93)\n // ═══════════════════════════════════════════════════════════════\n case OpCode.DATE_NOW:\n stack.push(datetimeValue(Date.now()));\n break;\n case OpCode.DATE_LITERAL:\n stack.push(datetimeValue(numbers[poolIndex(opcodes, ip++, op, \"constant-pool index\", numbers.length, \"number-pool\")]));\n break;\n case OpCode.DATE_ADD: {\n const durValue = safePop(stack), dtValue = safePop(stack);\n // A duration read off a fault is zero, so the date came back\n // unmoved: an answer that looks exactly like a correct one. Same\n // reasoning as OpCode.ADD's own check.\n const dateAddFault = faultedOperand(dtValue, durValue);\n if (dateAddFault) { stack.push(dateAddFault); break; }\n stack.push(datetimeValue(shiftDatetime(dtValue.toNumber(), durValue, 1, vm)));\n break;\n }\n case OpCode.DATE_SUB: {\n const durValue = safePop(stack), dtValue = safePop(stack);\n const dateSubFault = faultedOperand(dtValue, durValue);\n if (dateSubFault) { stack.push(dateSubFault); break; }\n stack.push(datetimeValue(shiftDatetime(dtValue.toNumber(), durValue, -1, vm)));\n break;\n }\n case OpCode.DATE_WORKDAY_OFFSET: {\n // \"N working days after/before/from <date>\". One operand byte gives\n // the direction: 0 forward (after/from), 1 backward (before). The\n // anchor date is on top (WorkdayOffsetParselet compiles it last); the\n // count is the left operand beneath it. Routed through the same\n // addBusinessDays() as `<date> + N workdays`, so the two forms and\n // the holiday calendar stay in lockstep.\n const workdayDirection = operandByte(opcodes, ip++, op, \"workday offset direction\") === 1 ? -1 : 1;\n const anchorValue = safePop(stack), countValue = safePop(stack);\n const offsetFault = faultedOperand(countValue, anchorValue);\n if (offsetFault) { stack.push(offsetFault); break; }\n if (anchorValue.type !== ValueType.Datetime) {\n stack.push(errorValue(\n CoreErrorCodes.WORKDAY_OFFSET_EXPECTED_DATE,\n `\"working days after/before/from\" expects a date to count from, got ${ValueType[anchorValue.type] ?? \"an unsupported value\"}`,\n ));\n break;\n }\n stack.push(datetimeValue(addBusinessDays(anchorValue.toNumber(), workdayDirection * countValue.toNumber(), vm)));\n break;\n }\n case OpCode.DATE_WORKDAYS_BETWEEN: {\n // \"working days between <date> and <date>\": the count of working days\n // in the inclusive span, order-independent. Stack: [start, end], end\n // on top (WorkdaysBetweenParselet compiles the second endpoint last).\n const endValue = safePop(stack), startValue = safePop(stack);\n const betweenFault = faultedOperand(startValue, endValue);\n if (betweenFault) { stack.push(betweenFault); break; }\n if (startValue.type !== ValueType.Datetime || endValue.type !== ValueType.Datetime) {\n stack.push(errorValue(\n CoreErrorCodes.WORKDAYS_BETWEEN_EXPECTED_DATES,\n `\"working days between\" expects two dates, got ${ValueType[startValue.type] ?? \"an unsupported value\"} and ${ValueType[endValue.type] ?? \"an unsupported value\"}`,\n ));\n break;\n }\n // Bounded by the full configured offset range in calendar days, so a\n // span of millennia is refused rather than walked a day at a time.\n const spanLimitDays = Math.ceil((vm.getMaxDateOffsetYears() - vm.getMinDateOffsetYears()) * 366);\n const workdayCount = countBusinessDaysBetween(startValue.toNumber(), endValue.toNumber(), (ms) => vm.isHoliday(ms), spanLimitDays);\n if (workdayCount === null) {\n stack.push(errorValue(\n CoreErrorCodes.WORKDAYS_BETWEEN_RANGE_TOO_LARGE,\n `The two dates are more than ${vm.getMaxDateOffsetYears() - vm.getMinDateOffsetYears()} years apart, past the working-day count's limit`,\n ));\n break;\n }\n stack.push(numberValue(workdayCount));\n break;\n }\n case OpCode.DATE_NEXT_WEEKDAY:\n case OpCode.DATE_LAST_WEEKDAY: {\n // Stack: [now, targetDayIndex], targetDayIndex on top (0=Sunday..6=Saturday).\n // Computes the actual next/previous occurrence of that weekday,\n // NOT a blind ±7-day offset, \"next Monday\" from a Monday lands\n // 7 days ahead (next week's Monday), not today; \"last Monday\"\n // from a Monday lands 7 days back, not today. Time-of-day is\n // preserved from `now` (matches \"today\"/\"now\" both resolving to\n // the current instant elsewhere in this file, not midnight).\n const targetDayValue = safePop(stack);\n const nowValue = safePop(stack);\n const weekdayFault = faultedOperand(nowValue, targetDayValue);\n if (weekdayFault) { stack.push(weekdayFault); break; }\n const targetDay = targetDayValue.toNumber();\n const now = nowValue.toNumber();\n const currentDay = new Date(now).getDay();\n let diffDays = op === OpCode.DATE_NEXT_WEEKDAY\n ? (targetDay - currentDay + 7) % 7\n : (currentDay - targetDay + 7) % 7;\n if (diffDays === 0) diffDays = 7;\n // Stepped as calendar days rather than added as milliseconds: a\n // week that contains a daylight-saving transition is not 7 x\n // 86,400,000 ms long, and being an hour out is enough to land on the\n // day before or after the weekday that was asked for. See\n // addCalendarDays() above.\n stack.push(datetimeValue(addCalendarDays(now, op === OpCode.DATE_NEXT_WEEKDAY ? diffDays : -diffDays)));\n break;\n }\n\n // ═══════════════════════════════════════════════════════════════\n // §10 Matrix (OpCode 152+, see parser/OpCode.ts's Matrix band)\n // Replaces the old ARR_* vector-only opcodes (100-107), which\n // were never emitted by any registered parselet in production\n // confirmed dead code, deleted outright rather than repurposed.\n // See vm/Value.ts's MatrixData and vm/MatrixOps.ts's shared\n // column-major storage helpers.\n // ═══════════════════════════════════════════════════════════════\n case OpCode.MAT_NEW: {\n const rows = operandByte(opcodes, ip++, op, \"row count\");\n const cols = operandByte(opcodes, ip++, op, \"column count\");\n const count = rows * cols;\n // Cells were pushed in ROW-MAJOR reading order (matching how a\n // literal like `[1,2;3,4]` is textually written), pop in\n // reverse to restore that order, then transpose once into the\n // column-major storage MatrixData actually uses.\n const rowMajor = checkedArray<MatrixEntry>(count, \"matrix cells\");\n // A MatrixEntry is a number, a boolean or a symbolic node, so a\n // faulted cell has nowhere to live inside the matrix and became a\n // zero cell nothing could tell apart from a real one. The whole\n // literal fails instead, the way one bad cell fails a map() (see\n // MAP_INVOKE's own check).\n let cellFault: Value | null = null;\n for (let i = count - 1; i >= 0; i--) {\n const cellVal = safePop(stack);\n if (cellFault === null) cellFault = faultedOperand(cellVal);\n rowMajor[i] = cellVal.type === ValueType.Boolean ? (cellVal.value as boolean)\n : cellVal.type === ValueType.Symbolic ? (cellVal.value as SymbolicNodeType)\n : cellVal.toNumber();\n }\n if (cellFault) { stack.push(cellFault); break; }\n stack.push(matrixValue(rows, cols, rowMajorToColumnMajor(rows, cols, rowMajor)));\n break;\n }\n\n case OpCode.MAT_INDEX1: {\n const indexVal = safePop(stack), matrixVal = safePop(stack);\n // Pending as well as Error, here and in the three cases below: a\n // value that has not arrived yet indexes no better than one that\n // failed, and toNumber() reports zero for both. These checked only\n // Error, so an index still loading read as cell 0.\n const index1Fault = faultedOperand(matrixVal, indexVal);\n if (index1Fault) { stack.push(index1Fault); break; }\n if (matrixVal.type !== ValueType.Matrix) {\n stack.push(errorValue(\"MATRIX_INDEX_NOT_A_MATRIX\", `Cannot index a non-matrix value with \"[...]\".`));\n break;\n }\n const m = matrixVal.value as MatrixData;\n const index = Math.trunc(indexVal.toNumber());\n if (index < 0 || index >= m.data.length) {\n stack.push(errorValue(\n \"MATRIX_INDEX_OUT_OF_BOUNDS\",\n `Index ${index} is out of bounds for a ${m.rows}x${m.cols} matrix (valid range: 0-${m.data.length - 1}).`,\n ));\n break;\n }\n const cell = matIndex(m, index);\n stack.push(matrixEntryToValue(cell));\n break;\n }\n\n case OpCode.MAT_INDEX2: {\n const colVal = safePop(stack), rowVal = safePop(stack), matrixVal = safePop(stack);\n const index2Fault = faultedOperand(matrixVal, rowVal, colVal);\n if (index2Fault) { stack.push(index2Fault); break; }\n if (matrixVal.type !== ValueType.Matrix) {\n stack.push(errorValue(\"MATRIX_INDEX_NOT_A_MATRIX\", `Cannot index a non-matrix value with \"[...]\".`));\n break;\n }\n const m = matrixVal.value as MatrixData;\n const row = Math.trunc(rowVal.toNumber());\n const col = Math.trunc(colVal.toNumber());\n if (!inBounds(m, row, col)) {\n stack.push(errorValue(\n \"MATRIX_INDEX_OUT_OF_BOUNDS\",\n `[${row}, ${col}] is out of bounds for a ${m.rows}x${m.cols} matrix.`,\n ));\n break;\n }\n const cell = matAt(m, row, col);\n stack.push(matrixEntryToValue(cell));\n break;\n }\n\n case OpCode.RANGE_NEW: {\n const maxVal = safePop(stack), minVal = safePop(stack);\n const rangeFault = faultedOperand(minVal, maxVal);\n if (rangeFault) { stack.push(rangeFault); break; }\n if (minVal.type !== ValueType.Number || maxVal.type !== ValueType.Number) {\n stack.push(errorValue(\"INVALID_RANGE_BOUND\", `A range's bounds must be plain numbers (e.g. \"0:3\").`));\n break;\n }\n const min = minVal.value as number;\n const max = maxVal.value as number;\n if (!Number.isInteger(min) || !Number.isInteger(max)) {\n stack.push(errorValue(\"NON_INTEGER_RANGE_BOUND\", `A range's bounds must be whole numbers, got \"${min}:${max}\".`));\n break;\n }\n if (min > max) {\n stack.push(errorValue(\n \"DESCENDING_RANGE\",\n `A range's min (${min}) cannot be greater than its max (${max}) — did you mean \"${max}:${min}\"?`,\n ));\n break;\n }\n stack.push(rangeValue(min, max));\n break;\n }\n\n case OpCode.MAT_SLICE: {\n const colRangeVal = safePop(stack), rowRangeVal = safePop(stack), matrixVal = safePop(stack);\n const sliceFault = faultedOperand(matrixVal, rowRangeVal, colRangeVal);\n if (sliceFault) { stack.push(sliceFault); break; }\n if (matrixVal.type !== ValueType.Matrix) {\n stack.push(errorValue(\"MATRIX_INDEX_NOT_A_MATRIX\", `Cannot slice a non-matrix value with \"[...]\".`));\n break;\n }\n if (rowRangeVal.type !== ValueType.Range || colRangeVal.type !== ValueType.Range) {\n stack.push(errorValue(\"INVALID_MATRIX_SLICE_BOUND\", `Matrix slicing needs range bounds (e.g. \"a[0:1, 1:2]\").`));\n break;\n }\n const m = matrixVal.value as MatrixData;\n const rowRange = rowRangeVal.value as RangeData;\n const colRange = colRangeVal.value as RangeData;\n if (rowRange.min < 0 || rowRange.max >= m.rows || colRange.min < 0 || colRange.max >= m.cols) {\n stack.push(errorValue(\n \"MATRIX_INDEX_OUT_OF_BOUNDS\",\n `Slice [${rowRange.min}:${rowRange.max}, ${colRange.min}:${colRange.max}] is out of bounds for a ${m.rows}x${m.cols} matrix.`,\n ));\n break;\n }\n const newRows = rowRange.max - rowRange.min + 1;\n const newCols = colRange.max - colRange.min + 1;\n const data = checkedArray<MatrixEntry>(newRows * newCols, \"matrix cells\");\n for (let r = 0; r < newRows; r++) {\n for (let c = 0; c < newCols; c++) {\n data[r + c * newRows] = matAt(m, rowRange.min + r, colRange.min + c);\n }\n }\n stack.push(matrixValue(newRows, newCols, data));\n break;\n }\n\n // ═══════════════════════════════════════════════════════════════\n // §11 map/reduce (OpCode 157-158, see parser/OpCode.ts's Matrix\n // band). See packages/mapreduce/ for the parselets that decide\n // `kind` (0=inline anonymous body, 1=builtin function,\n // 2=user-defined function) at parse time, and\n // `BytecodeBuilder.ts`'s AnonymousBodyDef doc comment for why\n // kind-0 bodies are a SEPARATE side-table from userFunctionBodies.\n // ═══════════════════════════════════════════════════════════════\n case OpCode.MAP_INVOKE: {\n const kind = operandByte(opcodes, ip++, op, \"body kind\");\n const ref = operandByte(opcodes, ip++, op, \"body reference\");\n const collectionCount = operandByte(opcodes, ip++, op, \"collection count\");\n requireKnownBodyKind(kind, ref, op);\n\n // Collections were pushed in declared param order, pop in\n // reverse to restore that order (same convention as MAT_NEW's\n // row-major restore).\n const rawCollections: Value[] = new Array(collectionCount);\n for (let i = collectionCount - 1; i >= 0; i--) rawCollections[i] = safePop(stack);\n\n let paramNames: string[] = [];\n let program: BytecodeProgram | undefined;\n if (kind === 0) {\n const def = anonymousBodies?.[ref];\n if (!def) {\n throw ErrorFactory.internal(\n \"INTERNAL_MISSING_ANONYMOUS_BODY\",\n `Internal error: MAP_INVOKE referenced missing anonymous body index ${ref}`,\n { ref },\n );\n }\n paramNames = def.params;\n program = def.program;\n } else if (kind === 2) {\n const name = pooledString(strings, ref, op);\n const fn = vm.getUserFunction(name);\n if (!fn) {\n stack.push(errorValue(\"UNDEFINED_FUNCTION\", `map: undefined function \"${name}\"`));\n break;\n }\n if (fn.params.length !== collectionCount) {\n stack.push(errorValue(\n \"FUNCTION_ARITY_MISMATCH\",\n `map: \"${name}\" expects ${fn.params.length} argument(s) but ${collectionCount} collection(s) were given`,\n ));\n break;\n }\n paramNames = fn.params;\n program = fn.program;\n }\n\n // Resolve every collection into a flat array of per-cell Values\n // (a Matrix's own cells, or a materialized Range), all must\n // agree on length (this is a ZIP, not a cartesian product).\n let collectionLength = -1;\n const cellArrays: Value[][] = new Array(collectionCount);\n let mapEarlyError: Value | undefined;\n for (let i = 0; i < collectionCount; i++) {\n const resolved = collectionToValues(rawCollections[i], vm.getMaxCollectionSize());\n if (!Array.isArray(resolved)) { mapEarlyError = resolved; break; }\n // Charged after the fact, which is safe only because\n // `maxCollectionSize` has already bounded this one expansion to\n // something survivable. The tally is what stops the SECOND and\n // third: individually legal collections are legal together, and\n // nothing else counts them. Delete this line if\n // `collectionToValues()` ever charges before expanding, which is\n // the better place for it (it knows the length before it allocates)\n // and would make this a double charge.\n chargeAllocation(resolved.length, \"collection elements\");\n if (collectionLength === -1) {\n collectionLength = resolved.length;\n } else if (resolved.length !== collectionLength) {\n mapEarlyError = errorValue(\n \"MAP_COLLECTION_LENGTH_MISMATCH\",\n `map: all collections must have the same length (got ${collectionLength} and ${resolved.length}).`,\n );\n break;\n }\n cellArrays[i] = resolved;\n }\n if (mapEarlyError) { stack.push(mapEarlyError); break; }\n\n const resultData: MatrixEntry[] = checkedArray<MatrixEntry>(collectionLength, \"matrix cells\");\n let mapError: Value | undefined;\n for (let i = 0; i < collectionLength; i++) {\n const args: Value[] = new Array(collectionCount);\n for (let j = 0; j < collectionCount; j++) args[j] = cellArrays[j][i];\n\n const resultVal = kind === 1\n ? (builtinFunctions[ref]?.(args) ?? errorValue(\"UNKNOWN_BUILTIN_FUNCTION\", `map: unknown builtin function index ${ref}`))\n : invokeFrameBody(paramNames, program!, args, vm, pipeline, expression, context, !!symbolicTolerant);\n\n const resultFault = faultedOperand(resultVal);\n if (resultFault) { mapError = resultFault; break; }\n resultData[i] = resultVal.type === ValueType.Boolean ? (resultVal.value as boolean)\n : resultVal.type === ValueType.Symbolic ? (resultVal.value as SymbolicNodeType)\n : resultVal.toNumber();\n }\n if (mapError) { stack.push(mapError); break; }\n\n // A mapped matrix keeps the shape it was given. `resultData` is\n // filled in the same order `collectionToValues()` read the cells\n // out, which for a Matrix is its own column-major storage order,\n // so handing that array straight back with the source dimensions\n // puts every result in the cell its input came from. Without this\n // `map(x*2, [1,2;3,4])` answered a 1x4 row reading [2,6,4,8]: not\n // just the wrong shape but the storage order leaking into what the\n // user sees, since 6 is the image of 3, the cell BELOW 1. A Range\n // (and a 1xN literal) is a row either way.\n const firstCollection = rawCollections[0];\n const sourceShape = firstCollection?.type === ValueType.Matrix ? (firstCollection.value as MatrixData) : undefined;\n if (sourceShape && sourceShape.rows * sourceShape.cols === collectionLength) {\n stack.push(matrixValue(sourceShape.rows, sourceShape.cols, resultData));\n } else {\n stack.push(matrixValue(1, collectionLength, resultData));\n }\n break;\n }\n\n case OpCode.REDUCE_INVOKE: {\n const kind = operandByte(opcodes, ip++, op, \"body kind\");\n const ref = operandByte(opcodes, ip++, op, \"body reference\");\n const hasInitial = operandByte(opcodes, ip++, op, \"initial-value flag\");\n requireKnownBodyKind(kind, ref, op);\n\n // Pushed in textual order (collection, then optional initial)\n // pop in reverse.\n const initialVal = hasInitial ? safePop(stack) : undefined;\n const collectionVal = safePop(stack);\n\n let paramNames: string[] = [];\n let program: BytecodeProgram | undefined;\n if (kind === 0) {\n const def = anonymousBodies?.[ref];\n if (!def) {\n throw ErrorFactory.internal(\n \"INTERNAL_MISSING_ANONYMOUS_BODY\",\n `Internal error: REDUCE_INVOKE referenced missing anonymous body index ${ref}`,\n { ref },\n );\n }\n paramNames = def.params;\n program = def.program;\n } else if (kind === 2) {\n const name = pooledString(strings, ref, op);\n const fn = vm.getUserFunction(name);\n if (!fn) {\n stack.push(errorValue(\"UNDEFINED_FUNCTION\", `reduce: undefined function \"${name}\"`));\n break;\n }\n if (fn.params.length !== 2) {\n stack.push(errorValue(\n \"FUNCTION_ARITY_MISMATCH\",\n `reduce: \"${name}\" must take exactly 2 arguments (accumulator, element), got ${fn.params.length}`,\n ));\n break;\n }\n paramNames = fn.params;\n program = fn.program;\n }\n\n const cells = collectionToValues(collectionVal, vm.getMaxCollectionSize());\n if (!Array.isArray(cells)) { stack.push(cells); break; }\n // Same post-charge, and the same note, as MAP_INVOKE above.\n chargeAllocation(cells.length, \"collection elements\");\n\n let acc: Value;\n let startIdx: number;\n if (initialVal !== undefined) {\n const initialFault = faultedOperand(initialVal);\n if (initialFault) { stack.push(initialFault); break; }\n acc = initialVal;\n startIdx = 0;\n } else {\n if (cells.length === 0) {\n stack.push(errorValue(\"REDUCE_EMPTY_COLLECTION\", `reduce: cannot reduce an empty collection without an initial value.`));\n break;\n }\n acc = cells[0];\n startIdx = 1;\n }\n\n let reduceError: Value | undefined;\n for (let i = startIdx; i < cells.length; i++) {\n const args = [acc, cells[i]];\n const resultVal = kind === 1\n ? (builtinFunctions[ref]?.(args) ?? errorValue(\"UNKNOWN_BUILTIN_FUNCTION\", `reduce: unknown builtin function index ${ref}`))\n : invokeFrameBody(paramNames, program!, args, vm, pipeline, expression, context, !!symbolicTolerant);\n\n const stepFault = faultedOperand(resultVal);\n if (stepFault) { reduceError = stepFault; break; }\n acc = resultVal;\n }\n if (reduceError) { stack.push(reduceError); break; }\n\n stack.push(acc);\n break;\n }\n\n // ═══════════════════════════════════════════════════════════════\n // §12 Algebra verbs' bound unknown (OpCode 159)\n // ═══════════════════════════════════════════════════════════════\n case OpCode.BIND_UNKNOWN: {\n const ref = operandByte(opcodes, ip++, op, \"body reference\");\n const def = anonymousBodies?.[ref];\n if (!def) {\n throw ErrorFactory.internal(\n \"INTERNAL_MISSING_ANONYMOUS_BODY\",\n `Internal error: BIND_UNKNOWN referenced missing anonymous body index ${ref}`,\n { ref },\n );\n }\n // `der(x^2, x)` names x as the unknown, so inside that expression x\n // IS the unknown, whatever the document says elsewhere. Evaluated in\n // a call frame binding the name to itself, the same mechanism that\n // already makes a function's parameter shadow a document variable\n // (see `getVar`, which reads the innermost frame first). Without it\n // an earlier `:x = 5` turned `der(x^2, x)` into `der(25, x)`, and\n // the answer 0 looked exactly like a correct one.\n stack.push(invokeWithBoundUnknown(def.params[0], def.program, vm, pipeline, expression, context, !!symbolicTolerant));\n break;\n }\n\n }\n }\n\n // Fallback return (reached if while loop exits without HALT, shouldn't happen on valid bytecode)\n const fallback = safePop(stack);\n return { type: 'value', value: hasArena ? persistentValue(fallback) : fallback };\n } catch (e) {\n return { type: 'error', error: normalizeUnknownError(e) };\n } finally {\n endEvaluation();\n }\n}"]}