solve-engine 2.14.0 → 2.15.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 (203) hide show
  1. package/dist/{BytecodeBuilder-BGq9ZiO3.d.cts → BytecodeBuilder-CRYfrFfq.d.cts} +2 -1
  2. package/dist/{BytecodeBuilder-BGq9ZiO3.d.ts → BytecodeBuilder-CRYfrFfq.d.ts} +2 -1
  3. package/dist/{EngineError-Ce1lPkjZ.d.cts → EngineError-Cv5q4Rbv.d.cts} +3 -1
  4. package/dist/{EngineError-Ce1lPkjZ.d.ts → EngineError-Cv5q4Rbv.d.ts} +3 -1
  5. package/dist/{Lexer-B4C1qHXu.d.cts → Lexer-CCHFDcgP.d.cts} +1 -1
  6. package/dist/{Lexer-DKMlj7Sy.d.ts → Lexer-CqagTewQ.d.ts} +1 -1
  7. package/dist/{PackageCompatibility-BG0iur4I.d.cts → PackageCompatibility-C2IQZ_w3.d.cts} +1 -1
  8. package/dist/{PackageCompatibility-BlIcQg5v.d.ts → PackageCompatibility-Cl7GF_Iu.d.ts} +1 -1
  9. package/dist/{PackageRegistry-BJ0QQd3k.d.ts → PackageRegistry-CK_JoX50.d.ts} +14 -7
  10. package/dist/{PackageRegistry-DeGDZkNt.d.cts → PackageRegistry-CZO1IbS-.d.cts} +14 -7
  11. package/dist/{Parselet-Blq8B0Gj.d.ts → Parselet-CK0bNO1l.d.ts} +2 -2
  12. package/dist/{Parselet-BSndkWEY.d.cts → Parselet-DOGmj6N6.d.cts} +2 -2
  13. package/dist/{ScopeManager-D8nLv--u.d.cts → ScopeManager-BtqiTVjG.d.cts} +3 -3
  14. package/dist/{ScopeManager-CF3cZUqW.d.ts → ScopeManager-C6c1WmJD.d.ts} +3 -3
  15. package/dist/{TokenNormalizer-DnlL7_8c.d.cts → TokenNormalizer-BfTHg1qt.d.cts} +35 -0
  16. package/dist/{TokenNormalizer-DCWdZjGz.d.ts → TokenNormalizer-d7F1KQFs.d.ts} +35 -0
  17. package/dist/{VMCheckpoints-Dy39SVHa.d.cts → VMCheckpoints-BFDlaGse.d.cts} +2 -2
  18. package/dist/{VMCheckpoints-BsR5_auF.d.ts → VMCheckpoints-DJdvpliw.d.ts} +2 -2
  19. package/dist/{WorkerError-B4p6PNfx.d.cts → WorkerError-FH7KXX4_.d.cts} +1 -1
  20. package/dist/{WorkerError-Dhj9BQ_A.d.ts → WorkerError-J3v3ix_z.d.ts} +1 -1
  21. package/dist/{chunk-75XDS65A.cjs → chunk-2XZCLDHJ.cjs} +2 -2
  22. package/dist/chunk-2XZCLDHJ.cjs.map +1 -0
  23. package/dist/{chunk-BW6FR7DA.js → chunk-3PDDKWTJ.js} +3 -3
  24. package/dist/{chunk-BW6FR7DA.js.map → chunk-3PDDKWTJ.js.map} +1 -1
  25. package/dist/{chunk-3MBENI4Q.cjs → chunk-3Y56PSQD.cjs} +3 -3
  26. package/dist/{chunk-3MBENI4Q.cjs.map → chunk-3Y56PSQD.cjs.map} +1 -1
  27. package/dist/{chunk-YOHM2WQT.js → chunk-4IIFFJTJ.js} +4 -4
  28. package/dist/chunk-4IIFFJTJ.js.map +1 -0
  29. package/dist/chunk-5SDSIRPL.js +2 -0
  30. package/dist/chunk-5SDSIRPL.js.map +1 -0
  31. package/dist/{chunk-PNDQRCRQ.cjs → chunk-6U66HQKQ.cjs} +2 -2
  32. package/dist/chunk-6U66HQKQ.cjs.map +1 -0
  33. package/dist/{chunk-VBSMA7WJ.cjs → chunk-ABVDKMNF.cjs} +2 -2
  34. package/dist/chunk-ABVDKMNF.cjs.map +1 -0
  35. package/dist/chunk-AYTEPHRO.js +3 -0
  36. package/dist/chunk-AYTEPHRO.js.map +1 -0
  37. package/dist/chunk-C5MP74ER.js +2 -0
  38. package/dist/chunk-C5MP74ER.js.map +1 -0
  39. package/dist/{chunk-JQBG3LX4.js → chunk-CUDPOWXA.js} +2 -2
  40. package/dist/{chunk-JQBG3LX4.js.map → chunk-CUDPOWXA.js.map} +1 -1
  41. package/dist/{chunk-LUMVKVFQ.cjs → chunk-EEUA3OJ6.cjs} +2 -2
  42. package/dist/{chunk-LUMVKVFQ.cjs.map → chunk-EEUA3OJ6.cjs.map} +1 -1
  43. package/dist/chunk-EEVUKZ5B.cjs +2 -0
  44. package/dist/{chunk-EURCQMZK.cjs.map → chunk-EEVUKZ5B.cjs.map} +1 -1
  45. package/dist/{chunk-3HYO3QYW.cjs → chunk-EXCFCHAT.cjs} +2 -2
  46. package/dist/{chunk-3HYO3QYW.cjs.map → chunk-EXCFCHAT.cjs.map} +1 -1
  47. package/dist/chunk-FAGFPVYK.cjs +2 -0
  48. package/dist/chunk-FAGFPVYK.cjs.map +1 -0
  49. package/dist/chunk-FPGYRFJY.cjs +5 -0
  50. package/dist/chunk-FPGYRFJY.cjs.map +1 -0
  51. package/dist/chunk-FVQWN5HZ.cjs +2 -0
  52. package/dist/chunk-FVQWN5HZ.cjs.map +1 -0
  53. package/dist/{chunk-4BZIYU7S.cjs → chunk-GWCBPITD.cjs} +3 -3
  54. package/dist/{chunk-4BZIYU7S.cjs.map → chunk-GWCBPITD.cjs.map} +1 -1
  55. package/dist/{chunk-YAYBVVG2.js → chunk-GWJJRH32.js} +3 -3
  56. package/dist/{chunk-YAYBVVG2.js.map → chunk-GWJJRH32.js.map} +1 -1
  57. package/dist/chunk-HDGARCI2.cjs +2 -0
  58. package/dist/chunk-HDGARCI2.cjs.map +1 -0
  59. package/dist/{chunk-MVP2YD4X.cjs → chunk-HG4NPDN5.cjs} +2 -2
  60. package/dist/{chunk-MVP2YD4X.cjs.map → chunk-HG4NPDN5.cjs.map} +1 -1
  61. package/dist/{chunk-FNNIAJNY.cjs → chunk-IMXSVHQK.cjs} +2 -2
  62. package/dist/{chunk-FNNIAJNY.cjs.map → chunk-IMXSVHQK.cjs.map} +1 -1
  63. package/dist/{chunk-LH7URJZT.js → chunk-IPOU3JTA.js} +3 -3
  64. package/dist/{chunk-LH7URJZT.js.map → chunk-IPOU3JTA.js.map} +1 -1
  65. package/dist/{chunk-WTEXBPBR.js → chunk-JOIQFDZQ.js} +2 -2
  66. package/dist/chunk-JOIQFDZQ.js.map +1 -0
  67. package/dist/{chunk-KHCNMNZZ.js → chunk-JP4JMQOG.js} +2 -2
  68. package/dist/{chunk-KHCNMNZZ.js.map → chunk-JP4JMQOG.js.map} +1 -1
  69. package/dist/chunk-KKMLFYVW.cjs +3 -0
  70. package/dist/chunk-KKMLFYVW.cjs.map +1 -0
  71. package/dist/{chunk-62LMTO4F.js → chunk-LHLW7JLS.js} +2 -2
  72. package/dist/{chunk-62LMTO4F.js.map → chunk-LHLW7JLS.js.map} +1 -1
  73. package/dist/{chunk-SOMGSIO4.cjs → chunk-NAZ6PGLS.cjs} +2 -2
  74. package/dist/chunk-NAZ6PGLS.cjs.map +1 -0
  75. package/dist/{chunk-A33K7NY4.js → chunk-O3ALJLYC.js} +2 -2
  76. package/dist/chunk-O3ALJLYC.js.map +1 -0
  77. package/dist/chunk-P4ETODMP.js +2 -0
  78. package/dist/chunk-P4ETODMP.js.map +1 -0
  79. package/dist/{chunk-P6WPEUAJ.cjs → chunk-PREIL3IB.cjs} +2 -2
  80. package/dist/{chunk-P6WPEUAJ.cjs.map → chunk-PREIL3IB.cjs.map} +1 -1
  81. package/dist/chunk-Q3PSTNSY.js +2 -0
  82. package/dist/chunk-Q3PSTNSY.js.map +1 -0
  83. package/dist/{chunk-NQSWT3UO.js → chunk-Q7HPPLMG.js} +2 -2
  84. package/dist/{chunk-NQSWT3UO.js.map → chunk-Q7HPPLMG.js.map} +1 -1
  85. package/dist/chunk-RC4M6HBX.cjs +2 -0
  86. package/dist/chunk-RC4M6HBX.cjs.map +1 -0
  87. package/dist/{chunk-MSYX32PF.cjs → chunk-S3DFU33X.cjs} +2 -2
  88. package/dist/{chunk-MSYX32PF.cjs.map → chunk-S3DFU33X.cjs.map} +1 -1
  89. package/dist/chunk-TVE2DNPU.js +2 -0
  90. package/dist/chunk-TVE2DNPU.js.map +1 -0
  91. package/dist/{chunk-YNMMRH44.js → chunk-TZYMXNIB.js} +2 -2
  92. package/dist/chunk-TZYMXNIB.js.map +1 -0
  93. package/dist/{chunk-6TPXH6Y5.cjs → chunk-UUAFDZK6.cjs} +3 -3
  94. package/dist/{chunk-6TPXH6Y5.cjs.map → chunk-UUAFDZK6.cjs.map} +1 -1
  95. package/dist/{chunk-QYO7IEPR.js → chunk-UZSPBFZN.js} +2 -2
  96. package/dist/{chunk-QYO7IEPR.js.map → chunk-UZSPBFZN.js.map} +1 -1
  97. package/dist/chunk-VJP4GGCW.cjs +2 -0
  98. package/dist/chunk-VJP4GGCW.cjs.map +1 -0
  99. package/dist/chunk-W5ELYJ4Z.cjs +2 -0
  100. package/dist/chunk-W5ELYJ4Z.cjs.map +1 -0
  101. package/dist/{chunk-YTCTUBR2.js → chunk-WOIJPV7Z.js} +2 -2
  102. package/dist/{chunk-YTCTUBR2.js.map → chunk-WOIJPV7Z.js.map} +1 -1
  103. package/dist/{chunk-MVZUTETT.js → chunk-XK23K3EJ.js} +2 -2
  104. package/dist/{chunk-MVZUTETT.js.map → chunk-XK23K3EJ.js.map} +1 -1
  105. package/dist/{chunk-MPB7KUN5.js → chunk-YAZ4DUJJ.js} +2 -2
  106. package/dist/chunk-YAZ4DUJJ.js.map +1 -0
  107. package/dist/chunk-YFX53MZF.js +2 -0
  108. package/dist/chunk-YFX53MZF.js.map +1 -0
  109. package/dist/constants.cjs +1 -1
  110. package/dist/constants.js +1 -1
  111. package/dist/engine.cjs +1 -1
  112. package/dist/engine.d.cts +10 -10
  113. package/dist/engine.d.ts +10 -10
  114. package/dist/engine.js +1 -1
  115. package/dist/errors.cjs +1 -1
  116. package/dist/errors.d.cts +3 -3
  117. package/dist/errors.d.ts +3 -3
  118. package/dist/errors.js +1 -1
  119. package/dist/format.cjs +1 -1
  120. package/dist/format.js +1 -1
  121. package/dist/index.cjs +1 -1
  122. package/dist/index.d.cts +10 -10
  123. package/dist/index.d.ts +10 -10
  124. package/dist/index.js +1 -1
  125. package/dist/language.d.cts +9 -9
  126. package/dist/language.d.ts +9 -9
  127. package/dist/lexer.cjs +1 -1
  128. package/dist/lexer.d.cts +2 -2
  129. package/dist/lexer.d.ts +2 -2
  130. package/dist/lexer.js +1 -1
  131. package/dist/normalizer.cjs +1 -1
  132. package/dist/normalizer.d.cts +2 -2
  133. package/dist/normalizer.d.ts +2 -2
  134. package/dist/normalizer.js +1 -1
  135. package/dist/packages.cjs +1 -1
  136. package/dist/packages.d.cts +8 -8
  137. package/dist/packages.d.ts +8 -8
  138. package/dist/packages.js +1 -1
  139. package/dist/parser.cjs +1 -1
  140. package/dist/parser.d.cts +3 -3
  141. package/dist/parser.d.ts +3 -3
  142. package/dist/parser.js +1 -1
  143. package/dist/{pipeline-BM8xc0CZ.d.cts → pipeline-B4wf3M1h.d.cts} +5 -24
  144. package/dist/{pipeline-J2ehIm7t.d.ts → pipeline-QIT4iD8f.d.ts} +5 -24
  145. package/dist/resolvers.d.cts +1 -1
  146. package/dist/resolvers.d.ts +1 -1
  147. package/dist/testing.cjs +2 -2
  148. package/dist/testing.d.cts +9 -9
  149. package/dist/testing.d.ts +9 -9
  150. package/dist/testing.js +1 -1
  151. package/dist/uom.cjs +1 -1
  152. package/dist/uom.d.cts +1 -1
  153. package/dist/uom.d.ts +1 -1
  154. package/dist/uom.js +1 -1
  155. package/dist/vm.cjs +1 -1
  156. package/dist/vm.d.cts +8 -7
  157. package/dist/vm.d.ts +8 -7
  158. package/dist/vm.js +1 -1
  159. package/dist/worker.cjs +2 -2
  160. package/dist/worker.d.cts +9 -9
  161. package/dist/worker.d.ts +9 -9
  162. package/dist/worker.js +1 -1
  163. package/package.json +1 -1
  164. package/dist/chunk-2VK3NH5S.cjs +0 -3
  165. package/dist/chunk-2VK3NH5S.cjs.map +0 -1
  166. package/dist/chunk-3GAWAMT4.js +0 -2
  167. package/dist/chunk-3GAWAMT4.js.map +0 -1
  168. package/dist/chunk-4FCHZYAH.js +0 -3
  169. package/dist/chunk-4FCHZYAH.js.map +0 -1
  170. package/dist/chunk-4QVBSG6B.cjs +0 -2
  171. package/dist/chunk-4QVBSG6B.cjs.map +0 -1
  172. package/dist/chunk-556Q7VZC.cjs +0 -2
  173. package/dist/chunk-556Q7VZC.cjs.map +0 -1
  174. package/dist/chunk-75XDS65A.cjs.map +0 -1
  175. package/dist/chunk-A33K7NY4.js.map +0 -1
  176. package/dist/chunk-C65UDMWH.cjs +0 -2
  177. package/dist/chunk-C65UDMWH.cjs.map +0 -1
  178. package/dist/chunk-EURCQMZK.cjs +0 -2
  179. package/dist/chunk-FUDVKPB7.cjs +0 -2
  180. package/dist/chunk-FUDVKPB7.cjs.map +0 -1
  181. package/dist/chunk-GMSBBLUQ.js +0 -2
  182. package/dist/chunk-GMSBBLUQ.js.map +0 -1
  183. package/dist/chunk-JEFMG6CV.js +0 -2
  184. package/dist/chunk-JEFMG6CV.js.map +0 -1
  185. package/dist/chunk-K4MME6ZT.js +0 -2
  186. package/dist/chunk-K4MME6ZT.js.map +0 -1
  187. package/dist/chunk-MPB7KUN5.js.map +0 -1
  188. package/dist/chunk-PL7AH5EU.cjs +0 -5
  189. package/dist/chunk-PL7AH5EU.cjs.map +0 -1
  190. package/dist/chunk-PNDQRCRQ.cjs.map +0 -1
  191. package/dist/chunk-SNVPM27Q.cjs +0 -2
  192. package/dist/chunk-SNVPM27Q.cjs.map +0 -1
  193. package/dist/chunk-SOMGSIO4.cjs.map +0 -1
  194. package/dist/chunk-T3FBAFRR.js +0 -2
  195. package/dist/chunk-T3FBAFRR.js.map +0 -1
  196. package/dist/chunk-VBSMA7WJ.cjs.map +0 -1
  197. package/dist/chunk-WTEXBPBR.js.map +0 -1
  198. package/dist/chunk-WYIOXAFW.cjs +0 -2
  199. package/dist/chunk-WYIOXAFW.cjs.map +0 -1
  200. package/dist/chunk-YNMMRH44.js.map +0 -1
  201. package/dist/chunk-YOHM2WQT.js.map +0 -1
  202. package/dist/chunk-YVKHEAFT.js +0 -2
  203. package/dist/chunk-YVKHEAFT.js.map +0 -1
@@ -1,2 +1,2 @@
1
- var e={code:"en",label:"English",keywordMap:{pi:"PI",e:"E",plus:"PLUS",add:"PLUS",and:"AND_CONJ",with:"PLUS",minus:"MINUS",subtract:"MINUS",remove:"MINUS",take:"MINUS",without:"MINUS",times:"STAR",multiply:"STAR",mul:"STAR",divide:"SLASH",modulo:"MOD",mod:"MOD",exponent:"CARET",prime:"CARET",xor:"BIT_XOR",of:"OF",now:"NOW",today:"TODAY",tomorrow:"TOMORROW",yesterday:"YESTERDAY",roll:"ROLL",sqrt:"FUNC",abs:"FUNC",sin:"FUNC",cos:"FUNC",tan:"FUNC",log:"FUNC",ceil:"FUNC",floor:"FUNC",round:"FUNC",min:"FUNC",max:"FUNC",asin:"FUNC",acos:"FUNC",atan:"FUNC",atan2:"FUNC",arcsin:"FUNC",arccos:"FUNC",arctan:"FUNC",sinh:"FUNC",cosh:"FUNC",tanh:"FUNC",asinh:"FUNC",acosh:"FUNC",atanh:"FUNC",cbrt:"FUNC",clz32:"FUNC",expm1:"FUNC",exp:"FUNC",root:"FUNC",fact:"FUNC",factorial:"FUNC",fround:"FUNC",hypot:"FUNC",imul:"FUNC",sind:"FUNC",cosd:"FUNC",tand:"FUNC",asind:"FUNC",acosd:"FUNC",atand:"FUNC",log10:"FUNC",log1p:"FUNC",log2:"FUNC",pow:"FUNC",random:"FUNC",sign:"FUNC",trunc:"FUNC",degtorad:"FUNC",radtodeg:"FUNC",gcd:"FUNC",lcm:"FUNC",permutation:"FUNC",combination:"FUNC",hex:"FUNC",bin:"FUNC",int:"FUNC",compoundinterest:"FUNC",interestearned:"FUNC",compoundinterestrate:"FUNC",compoundinterestyears:"FUNC",loanrepayment:"FUNC",loaninterest:"FUNC",monthlypayment:"FUNC",taxadd:"FUNC",taxremove:"FUNC",inflationadjust:"FUNC",transpose:"FUNC",det:"FUNC",inv:"FUNC",dot:"FUNC",clamp:"CLAMP",convert:"CONVERT",to:"TO",best:"BEST",in:"IN",into:"IN",next:"NEXT",last:"LAST",until:"UNTIL",since:"SINCE",sunday:"SUNDAY",monday:"MONDAY",tuesday:"TUESDAY",wednesday:"WEDNESDAY",thursday:"THURSDAY",friday:"FRIDAY",saturday:"SATURDAY",between:"BETWEEN",from:"FROM",increase:"INCREASE",decrease:"DECREASE",over:"OVER",at:"RATE_AT",rounded:"ROUNDED",is:"IS",after:"AFTER",for:"FOR_DURATION",compounding:"COMPOUNDING",invested:"INVESTED",returned:"RETURNED",by:"BY",vec2:"VEC2",vec3:"VEC3",vec4:"VEC4",float:"FLOAT",global:"GLOBAL",or:"OR",true:"TRUE",false:"FALSE",if:"IF",then:"THEN",else:"ELSE",as:"AS",percent:"CONVERTER_NAME",percentage:"CONVERTER_NAME",decimal:"CONVERTER_NAME",dec:"CONVERTER_NAME",number:"CONVERTER_NAME",fraction:"CONVERTER_NAME",multiplier:"CONVERTER_NAME",sci:"CONVERTER_NAME",scientific:"CONVERTER_NAME",binary:"CONVERTER_NAME",octal:"CONVERTER_NAME",oct:"CONVERTER_NAME"},display:{resultPrefix:"= ",dateFormat:"default",decimalSeparator:".",thousandsSeparator:",",vectorFormat:"[{values}]",percentageSuffix:"%"}};var a={code:"de",label:"Deutsch",keywordMap:{pi:"PI",e:"E",plus:"PLUS",add:"PLUS",und:"AND_CONJ",minus:"MINUS",subtract:"MINUS",entfernen:"MINUS",nehmen:"MINUS",mal:"STAR",multiplizieren:"STAR",teilen:"SLASH",modulo:"MOD",mod:"MOD",exponent:"CARET",potenz:"CARET",von:"OF",jetzt:"NOW",heute:"TODAY",morgen:"TOMORROW",gestern:"YESTERDAY",rollen:"ROLL",wurzel:"FUNC",abs:"FUNC",sin:"FUNC",cos:"FUNC",tan:"FUNC",log:"FUNC",aufrunden:"FUNC",abrunden:"FUNC",runden:"FUNC",min:"FUNC",max:"FUNC",asin:"FUNC",acos:"FUNC",atan:"FUNC",atan2:"FUNC",sinh:"FUNC",cosh:"FUNC",tanh:"FUNC",asinh:"FUNC",acosh:"FUNC",atanh:"FUNC",kubikwurzel:"FUNC",clz32:"FUNC",expm1:"FUNC",exp:"FUNC",fround:"FUNC",hypot:"FUNC",imul:"FUNC",log10:"FUNC",log1p:"FUNC",log2:"FUNC",pow:"FUNC",zufall:"FUNC",zeichen:"FUNC",ganzzahl:"FUNC",degtorad:"FUNC",radtodeg:"FUNC",konvertieren:"CONVERT",in:"TO",amBesten:"BEST",naechste:"NEXT",letzte:"LAST",bis:"UNTIL",seit:"SINCE",sonntag:"SUNDAY",montag:"MONDAY",dienstag:"TUESDAY",mittwoch:"WEDNESDAY",donnerstag:"THURSDAY",freitag:"FRIDAY",samstag:"SATURDAY",zwischen:"BETWEEN",von_ab:"FROM",erhoehen:"INCREASE",verringern:"DECREASE",vec2:"VEC2",vec3:"VEC3",vec4:"VEC4"},display:{resultPrefix:"= ",dateFormat:"default",decimalSeparator:",",thousandsSeparator:".",vectorFormat:"[{values}]",percentageSuffix:"%"}};var t={code:"fr",label:"Fran\xE7ais",keywordMap:{pi:"PI",e:"E",plus:"PLUS",ajouter:"PLUS",et:"AND_CONJ",moins:"MINUS",soustraire:"MINUS",enlever:"MINUS",fois:"STAR",multiplier:"STAR",diviser:"SLASH",modulo:"MOD",mod:"MOD",exposant:"CARET",puissance:"CARET",xor:"BIT_XOR",maintenant:"NOW",aujourdhui:"TODAY",demain:"TOMORROW",hier:"YESTERDAY",lancer:"ROLL",abs:"FUNC",sin:"FUNC",cos:"FUNC",tan:"FUNC",log:"FUNC",min:"FUNC",max:"FUNC",convertir:"CONVERT",prochain:"NEXT",dernier:"LAST",dimanche:"SUNDAY",lundi:"MONDAY",mardi:"TUESDAY",mercredi:"WEDNESDAY",jeudi:"THURSDAY",vendredi:"FRIDAY",samedi:"SATURDAY",entre:"BETWEEN",augmenter:"INCREASE",diminuer:"DECREASE",vec2:"VEC2",vec3:"VEC3",vec4:"VEC4",vrai:"TRUE",faux:"FALSE",si:"IF",alors:"THEN",sinon:"ELSE"},display:{resultPrefix:"= ",dateFormat:"default",decimalSeparator:",",thousandsSeparator:" ",vectorFormat:"[{values}]",percentageSuffix:"%"}};var o={en:e,de:a,fr:t};function s(N){return o[N]||e}export{s as a};//# sourceMappingURL=chunk-62LMTO4F.js.map
2
- //# sourceMappingURL=chunk-62LMTO4F.js.map
1
+ var e={code:"en",label:"English",keywordMap:{pi:"PI",e:"E",plus:"PLUS",add:"PLUS",and:"AND_CONJ",with:"PLUS",minus:"MINUS",subtract:"MINUS",remove:"MINUS",take:"MINUS",without:"MINUS",times:"STAR",multiply:"STAR",mul:"STAR",divide:"SLASH",modulo:"MOD",mod:"MOD",exponent:"CARET",prime:"CARET",xor:"BIT_XOR",of:"OF",now:"NOW",today:"TODAY",tomorrow:"TOMORROW",yesterday:"YESTERDAY",roll:"ROLL",sqrt:"FUNC",abs:"FUNC",sin:"FUNC",cos:"FUNC",tan:"FUNC",log:"FUNC",ceil:"FUNC",floor:"FUNC",round:"FUNC",min:"FUNC",max:"FUNC",asin:"FUNC",acos:"FUNC",atan:"FUNC",atan2:"FUNC",arcsin:"FUNC",arccos:"FUNC",arctan:"FUNC",sinh:"FUNC",cosh:"FUNC",tanh:"FUNC",asinh:"FUNC",acosh:"FUNC",atanh:"FUNC",cbrt:"FUNC",clz32:"FUNC",expm1:"FUNC",exp:"FUNC",root:"FUNC",fact:"FUNC",factorial:"FUNC",fround:"FUNC",hypot:"FUNC",imul:"FUNC",sind:"FUNC",cosd:"FUNC",tand:"FUNC",asind:"FUNC",acosd:"FUNC",atand:"FUNC",log10:"FUNC",log1p:"FUNC",log2:"FUNC",pow:"FUNC",random:"FUNC",sign:"FUNC",trunc:"FUNC",degtorad:"FUNC",radtodeg:"FUNC",gcd:"FUNC",lcm:"FUNC",permutation:"FUNC",combination:"FUNC",hex:"FUNC",bin:"FUNC",int:"FUNC",compoundinterest:"FUNC",interestearned:"FUNC",compoundinterestrate:"FUNC",compoundinterestyears:"FUNC",loanrepayment:"FUNC",loaninterest:"FUNC",monthlypayment:"FUNC",taxadd:"FUNC",taxremove:"FUNC",inflationadjust:"FUNC",transpose:"FUNC",det:"FUNC",inv:"FUNC",dot:"FUNC",clamp:"CLAMP",convert:"CONVERT",to:"TO",best:"BEST",in:"IN",into:"IN",next:"NEXT",last:"LAST",until:"UNTIL",since:"SINCE",sunday:"SUNDAY",monday:"MONDAY",tuesday:"TUESDAY",wednesday:"WEDNESDAY",thursday:"THURSDAY",friday:"FRIDAY",saturday:"SATURDAY",between:"BETWEEN",from:"FROM",increase:"INCREASE",decrease:"DECREASE",over:"OVER",at:"RATE_AT",rounded:"ROUNDED",is:"IS",after:"AFTER",for:"FOR_DURATION",compounding:"COMPOUNDING",invested:"INVESTED",returned:"RETURNED",by:"BY",vec2:"VEC2",vec3:"VEC3",vec4:"VEC4",float:"FLOAT",global:"GLOBAL",or:"OR",true:"TRUE",false:"FALSE",if:"IF",then:"THEN",else:"ELSE",as:"AS",percent:"CONVERTER_NAME",percentage:"CONVERTER_NAME",decimal:"CONVERTER_NAME",dec:"CONVERTER_NAME",number:"CONVERTER_NAME",fraction:"CONVERTER_NAME",multiplier:"CONVERTER_NAME",sci:"CONVERTER_NAME",scientific:"CONVERTER_NAME",binary:"CONVERTER_NAME",octal:"CONVERTER_NAME",oct:"CONVERTER_NAME"},display:{resultPrefix:"= ",dateFormat:"default",decimalSeparator:".",thousandsSeparator:",",vectorFormat:"[{values}]",percentageSuffix:"%"}};var a={code:"de",label:"Deutsch",keywordMap:{pi:"PI",e:"E",plus:"PLUS",add:"PLUS",und:"AND_CONJ",minus:"MINUS",subtract:"MINUS",entfernen:"MINUS",nehmen:"MINUS",mal:"STAR",multiplizieren:"STAR",teilen:"SLASH",modulo:"MOD",mod:"MOD",exponent:"CARET",potenz:"CARET",von:"OF",jetzt:"NOW",heute:"TODAY",morgen:"TOMORROW",gestern:"YESTERDAY",rollen:"ROLL",wurzel:"FUNC",abs:"FUNC",sin:"FUNC",cos:"FUNC",tan:"FUNC",log:"FUNC",aufrunden:"FUNC",abrunden:"FUNC",runden:"FUNC",min:"FUNC",max:"FUNC",asin:"FUNC",acos:"FUNC",atan:"FUNC",atan2:"FUNC",sinh:"FUNC",cosh:"FUNC",tanh:"FUNC",asinh:"FUNC",acosh:"FUNC",atanh:"FUNC",kubikwurzel:"FUNC",clz32:"FUNC",expm1:"FUNC",exp:"FUNC",fround:"FUNC",hypot:"FUNC",imul:"FUNC",log10:"FUNC",log1p:"FUNC",log2:"FUNC",pow:"FUNC",zufall:"FUNC",zeichen:"FUNC",ganzzahl:"FUNC",degtorad:"FUNC",radtodeg:"FUNC",konvertieren:"CONVERT",in:"TO",amBesten:"BEST",naechste:"NEXT",letzte:"LAST",bis:"UNTIL",seit:"SINCE",sonntag:"SUNDAY",montag:"MONDAY",dienstag:"TUESDAY",mittwoch:"WEDNESDAY",donnerstag:"THURSDAY",freitag:"FRIDAY",samstag:"SATURDAY",zwischen:"BETWEEN",von_ab:"FROM",erhoehen:"INCREASE",verringern:"DECREASE",vec2:"VEC2",vec3:"VEC3",vec4:"VEC4"},display:{resultPrefix:"= ",dateFormat:"default",decimalSeparator:",",thousandsSeparator:".",vectorFormat:"[{values}]",percentageSuffix:"%"}};var t={code:"fr",label:"Fran\xE7ais",keywordMap:{pi:"PI",e:"E",plus:"PLUS",ajouter:"PLUS",et:"AND_CONJ",moins:"MINUS",soustraire:"MINUS",enlever:"MINUS",fois:"STAR",multiplier:"STAR",diviser:"SLASH",modulo:"MOD",mod:"MOD",exposant:"CARET",puissance:"CARET",xor:"BIT_XOR",maintenant:"NOW",aujourdhui:"TODAY",demain:"TOMORROW",hier:"YESTERDAY",lancer:"ROLL",abs:"FUNC",sin:"FUNC",cos:"FUNC",tan:"FUNC",log:"FUNC",min:"FUNC",max:"FUNC",convertir:"CONVERT",prochain:"NEXT",dernier:"LAST",dimanche:"SUNDAY",lundi:"MONDAY",mardi:"TUESDAY",mercredi:"WEDNESDAY",jeudi:"THURSDAY",vendredi:"FRIDAY",samedi:"SATURDAY",entre:"BETWEEN",augmenter:"INCREASE",diminuer:"DECREASE",vec2:"VEC2",vec3:"VEC3",vec4:"VEC4",vrai:"TRUE",faux:"FALSE",si:"IF",alors:"THEN",sinon:"ELSE"},display:{resultPrefix:"= ",dateFormat:"default",decimalSeparator:",",thousandsSeparator:" ",vectorFormat:"[{values}]",percentageSuffix:"%"}};var o={en:e,de:a,fr:t};function s(N){return o[N]||e}export{s as a};//# sourceMappingURL=chunk-LHLW7JLS.js.map
2
+ //# sourceMappingURL=chunk-LHLW7JLS.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/constants/locales/en.ts","../src/constants/locales/de.ts","../src/constants/locales/fr.ts","../src/constants/locales/index.ts"],"names":["enLocale","deLocale","frLocale","locales","getLocale","code"],"mappings":"AAgBO,IAAMA,EAAoB,CAC/B,IAAA,CAAM,IAAA,CACN,KAAA,CAAO,UACP,UAAA,CAAY,CACV,EAAA,CAAI,IAAA,CAAM,EAAG,GAAA,CACb,IAAA,CAAM,MAAA,CAAQ,GAAA,CAAK,OAAQ,GAAA,CAAK,UAAA,CAAY,IAAA,CAAM,MAAA,CAClD,MAAO,OAAA,CAAS,QAAA,CAAU,OAAA,CAAS,MAAA,CAAQ,QAAS,IAAA,CAAM,OAAA,CAC1D,OAAA,CAAS,OAAA,CACT,MAAO,MAAA,CAAQ,QAAA,CAAU,OAAQ,GAAA,CAAK,MAAA,CACtC,OAAQ,OAAA,CACR,MAAA,CAAQ,KAAA,CAAO,GAAA,CAAK,MACpB,QAAA,CAAU,OAAA,CAAS,KAAA,CAAO,OAAA,CAC1B,IAAK,SAAA,CACL,EAAA,CAAI,IAAA,CACJ,GAAA,CAAK,MAAO,KAAA,CAAO,OAAA,CAAS,QAAA,CAAU,UAAA,CAAY,UAAW,WAAA,CAC7D,IAAA,CAAM,MAAA,CACN,IAAA,CAAM,OAAQ,GAAA,CAAK,MAAA,CAAQ,GAAA,CAAK,MAAA,CAAQ,IAAK,MAAA,CAAQ,GAAA,CAAK,MAAA,CAC1D,GAAA,CAAK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F,CAAA,CC7DA,IAAMC,EAAmC,CACvC,EAAA,CAAIH,CAAAA,CACJ,EAAA,CAAIC,EACJ,EAAA,CAAIC,CACN,CAAA,CAUO,SAASE,EAAUC,CAAAA,CAAuB,CAC/C,OAAOF,CAAAA,CAAQE,CAAI,GAAKL,CAC1B","file":"chunk-62LMTO4F.js","sourcesContent":["/** What a locale supplies: keywords, units, and number formatting conventions. */\nexport interface ILocale {\n code: string;\n label: string;\n keywordMap: Record<string, string>;\n display: {\n resultPrefix: string;\n dateFormat: string;\n decimalSeparator: string;\n thousandsSeparator: string;\n vectorFormat: string;\n percentageSuffix: string;\n };\n}\n\n/** English keywords, units and number formatting. The default and the fallback. */\nexport const enLocale: ILocale = {\n code: \"en\",\n label: \"English\",\n keywordMap: {\n pi: \"PI\", e: \"E\",\n plus: \"PLUS\", add: \"PLUS\", and: \"AND_CONJ\", with: \"PLUS\",\n minus: \"MINUS\", subtract: \"MINUS\", remove: \"MINUS\", take: \"MINUS\",\n without: \"MINUS\",\n times: \"STAR\", multiply: \"STAR\", mul: \"STAR\",\n divide: \"SLASH\",\n modulo: \"MOD\", mod: \"MOD\",\n exponent: \"CARET\", prime: \"CARET\",\n xor: \"BIT_XOR\",\n of: \"OF\",\n now: \"NOW\", today: \"TODAY\", tomorrow: \"TOMORROW\", yesterday: \"YESTERDAY\",\n roll: \"ROLL\",\n sqrt: \"FUNC\", abs: \"FUNC\", sin: \"FUNC\", cos: \"FUNC\", tan: \"FUNC\",\n log: \"FUNC\", ceil: \"FUNC\", floor: \"FUNC\", round: \"FUNC\", min: \"FUNC\", max: \"FUNC\",\n asin: \"FUNC\", acos: \"FUNC\", atan: \"FUNC\", atan2: \"FUNC\",\n // Long-form aliases for asin/acos/atan (Numi/older-calculator naming\n // convention). Same FunctionCallParselet indices, not new behavior.\n arcsin: \"FUNC\", arccos: \"FUNC\", arctan: \"FUNC\",\n sinh: \"FUNC\", cosh: \"FUNC\", tanh: \"FUNC\",\n asinh: \"FUNC\", acosh: \"FUNC\", atanh: \"FUNC\",\n cbrt: \"FUNC\", clz32: \"FUNC\", expm1: \"FUNC\", exp: \"FUNC\",\n // root(n, x) -- n-th root; fact/factorial(n) -- factorial. Bare FUNC\n // keywords, matching gcd/lcm/cbrt's precedent above (technical,\n // call-syntax-only names, not plausible :variableName choices).\n root: \"FUNC\", fact: \"FUNC\", factorial: \"FUNC\",\n fround: \"FUNC\", hypot: \"FUNC\", imul: \"FUNC\",\n sind: \"FUNC\", cosd: \"FUNC\", tand: \"FUNC\",\n asind: \"FUNC\", acosd: \"FUNC\", atand: \"FUNC\",\n log10: \"FUNC\", log1p: \"FUNC\", log2: \"FUNC\",\n pow: \"FUNC\", random: \"FUNC\", sign: \"FUNC\", trunc: \"FUNC\",\n degtorad: \"FUNC\", radtodeg: \"FUNC\",\n gcd: \"FUNC\", lcm: \"FUNC\", permutation: \"FUNC\", combination: \"FUNC\",\n // hex/bin double as CONVERTER_NAME below (\"255 as hex\") AND as FUNC\n // call-syntax (\"hex(255)\"), a word can only have one lexer token\n // type, so these win FUNC (removed from the CONVERTER_NAME list\n // below) and AsConverterParselet.ts's \"as <name>\" check was widened\n // to also accept a FUNC-typed token, preserving \"as hex\"/\"as bin\"\n // unchanged. See AsConverterParselet.ts's class doc for the full\n // reasoning.\n hex: \"FUNC\", bin: \"FUNC\", int: \"FUNC\",\n // Finance (packages/finance/) function-call forms. Bare keywords, not\n // phrase-fused, these are camelCase call-only names (e.g.\n // \"compoundInterest(...)\"), not natural-language words a user would\n // plausibly choose as a variable name, so the bare-keyword collision\n // risk that blocks \"interest\"/\"tax\"/\"principal\" etc. doesn't apply here\n // (matches \"gcd\"/\"lcm\"/... above, not \"clamp\" below).\n compoundinterest: \"FUNC\", interestearned: \"FUNC\",\n compoundinterestrate: \"FUNC\", compoundinterestyears: \"FUNC\",\n loanrepayment: \"FUNC\", loaninterest: \"FUNC\", monthlypayment: \"FUNC\",\n taxadd: \"FUNC\", taxremove: \"FUNC\",\n // Inflation-adjusted value function-call form (packages/finance/).\n inflationadjust: \"FUNC\",\n // Matrix (packages/matrix/) function-call forms -- also reachable via\n // `^T`/`^-1` operator syntax and `|a|` (see FunctionCallParselet.ts's\n // builtinNameToIndex comment for indices 63-66).\n transpose: \"FUNC\", det: \"FUNC\", inv: \"FUNC\", dot: \"FUNC\",\n // map/reduce/sum/prod (packages/mapreduce/) are NOT bare keywordMap\n // entries. See packages/mapreduce/normalizer/MapReduceCallNormalizerRule.ts\n // which fuses them ONLY when immediately followed by \"(\" (same\n // \"conditional-on-LPAREN\" pattern as packages/lines/'s own\n // sum(/total(/average( fusion), so `:map = [...]`/`:sum = 100`/etc.\n // keep working as ordinary variable names.\n clamp: \"CLAMP\",\n // `into` is a third spelling of the conversion operator, alongside `to` and\n // `in`. It reads better before a unit than either (\"300 cm into m\"), and\n // costs nothing: it is not a plausible variable name and has no other\n // meaning in the grammar.\n convert: \"CONVERT\", to: \"TO\", best: \"BEST\", in: \"IN\", into: \"IN\",\n next: \"NEXT\", last: \"LAST\", until: \"UNTIL\", since: \"SINCE\",\n sunday: \"SUNDAY\", monday: \"MONDAY\", tuesday: \"TUESDAY\", wednesday: \"WEDNESDAY\",\n thursday: \"THURSDAY\", friday: \"FRIDAY\", saturday: \"SATURDAY\",\n between: \"BETWEEN\", from: \"FROM\",\n increase: \"INCREASE\", decrease: \"DECREASE\",\n // Finance (packages/finance/) phrase-grammar connectors. Bare\n // prepositions, same accepted-risk category as \"between\"/\"from\" above\n // see Token.ts's OVER/RATE_AT doc comment.\n over: \"OVER\", at: \"RATE_AT\",\n // Only \"rounded\". Bare \"round\" is already the round(x) function above.\n rounded: \"ROUNDED\",\n is: \"IS\",\n // The investment grammar (packages/finance/). See Token.ts.\n after: \"AFTER\", for: \"FOR_DURATION\", compounding: \"COMPOUNDING\",\n invested: \"INVESTED\", returned: \"RETURNED\",\n by: \"BY\",\n vec2: \"VEC2\", vec3: \"VEC3\", vec4: \"VEC4\",\n float: \"FLOAT\",\n global: \"GLOBAL\",\n or: \"OR\",\n true: \"TRUE\", false: \"FALSE\",\n if: \"IF\", then: \"THEN\", else: \"ELSE\",\n as: \"AS\",\n percent: \"CONVERTER_NAME\", percentage: \"CONVERTER_NAME\",\n decimal: \"CONVERTER_NAME\", dec: \"CONVERTER_NAME\", number: \"CONVERTER_NAME\",\n fraction: \"CONVERTER_NAME\",\n multiplier: \"CONVERTER_NAME\",\n sci: \"CONVERTER_NAME\", scientific: \"CONVERTER_NAME\",\n // hex/bin are FUNC (see above), not CONVERTER_NAME, \"as hex\"/\"as bin\"\n // still work via AsConverterParselet.ts's widened token-type check.\n binary: \"CONVERTER_NAME\",\n octal: \"CONVERTER_NAME\", oct: \"CONVERTER_NAME\",\n },\n display: {\n resultPrefix: \"= \",\n dateFormat: \"default\",\n decimalSeparator: \".\",\n thousandsSeparator: \",\",\n vectorFormat: \"[{values}]\",\n percentageSuffix: \"%\",\n },\n};\n","import { ILocale } from \"./en\";\n\n/** German keywords, units and number formatting. */\nexport const deLocale: ILocale = {\n code: \"de\",\n label: \"Deutsch\",\n keywordMap: {\n pi: \"PI\", e: \"E\",\n plus: \"PLUS\", add: \"PLUS\", und: \"AND_CONJ\",\n minus: \"MINUS\", subtract: \"MINUS\", entfernen: \"MINUS\", nehmen: \"MINUS\",\n mal: \"STAR\", multiplizieren: \"STAR\",\n teilen: \"SLASH\",\n modulo: \"MOD\", mod: \"MOD\",\n exponent: \"CARET\", potenz: \"CARET\",\n von: \"OF\",\n jetzt: \"NOW\", heute: \"TODAY\", morgen: \"TOMORROW\", gestern: \"YESTERDAY\",\n rollen: \"ROLL\",\n wurzel: \"FUNC\", abs: \"FUNC\", sin: \"FUNC\", cos: \"FUNC\", tan: \"FUNC\",\n log: \"FUNC\", aufrunden: \"FUNC\", abrunden: \"FUNC\", runden: \"FUNC\", min: \"FUNC\", max: \"FUNC\",\n asin: \"FUNC\", acos: \"FUNC\", atan: \"FUNC\", atan2: \"FUNC\",\n sinh: \"FUNC\", cosh: \"FUNC\", tanh: \"FUNC\",\n asinh: \"FUNC\", acosh: \"FUNC\", atanh: \"FUNC\",\n kubikwurzel: \"FUNC\", clz32: \"FUNC\", expm1: \"FUNC\", exp: \"FUNC\",\n fround: \"FUNC\", hypot: \"FUNC\", imul: \"FUNC\",\n log10: \"FUNC\", log1p: \"FUNC\", log2: \"FUNC\",\n pow: \"FUNC\", zufall: \"FUNC\", zeichen: \"FUNC\", ganzzahl: \"FUNC\",\n degtorad: \"FUNC\", radtodeg: \"FUNC\",\n konvertieren: \"CONVERT\", in: \"TO\", amBesten: \"BEST\",\n naechste: \"NEXT\", letzte: \"LAST\", bis: \"UNTIL\", seit: \"SINCE\",\n sonntag: \"SUNDAY\", montag: \"MONDAY\", dienstag: \"TUESDAY\", mittwoch: \"WEDNESDAY\",\n donnerstag: \"THURSDAY\", freitag: \"FRIDAY\", samstag: \"SATURDAY\",\n zwischen: \"BETWEEN\",\n von_ab: \"FROM\",\n erhoehen: \"INCREASE\", verringern: \"DECREASE\",\n vec2: \"VEC2\", vec3: \"VEC3\", vec4: \"VEC4\",\n },\n display: {\n resultPrefix: \"= \",\n dateFormat: \"default\",\n decimalSeparator: \",\",\n thousandsSeparator: \".\",\n vectorFormat: \"[{values}]\",\n percentageSuffix: \"%\",\n },\n};","import { ILocale } from \"./en\";\n\n/**\n * French locale. See GitHub issue #77 (\"Please allow for localized day\n * of the week\"). Matches `de.ts`'s scope, not `en.ts`'s full coverage: a\n * confident, reviewed core set (arithmetic words, date keywords, weekday\n * names, a handful of common functions), not a guess at every FUNC/phrase\n * keyword across every package. Widening this is a good first issue for\n * a native French speaker, PRs welcome, same as this project's existing\n * convention for locale gaps.\n *\n * \"aujourd'hui\" (today) is deliberately spelled without its apostrophe\n * here (`aujourdhui`), `ExpressionLexer`'s identifier reader only\n * accepts `[a-zA-Z_][a-zA-Z0-9_]*` plus Unicode, so the standard spelling\n * can't lex as a single IDENT token at all. This is a real, disclosed\n * limitation, not a translation choice, anyone typing the standard\n * apostrophed spelling won't get a match today.\n */\nexport const frLocale: ILocale = {\n code: \"fr\",\n label: \"Français\",\n keywordMap: {\n pi: \"PI\", e: \"E\",\n plus: \"PLUS\", ajouter: \"PLUS\", et: \"AND_CONJ\",\n moins: \"MINUS\", soustraire: \"MINUS\", enlever: \"MINUS\",\n fois: \"STAR\", multiplier: \"STAR\",\n diviser: \"SLASH\",\n modulo: \"MOD\", mod: \"MOD\",\n exposant: \"CARET\", puissance: \"CARET\",\n xor: \"BIT_XOR\",\n maintenant: \"NOW\",\n // \"aujourd'hui\". See this file's own doc comment for why the\n // apostrophe is dropped here.\n aujourdhui: \"TODAY\",\n demain: \"TOMORROW\", hier: \"YESTERDAY\",\n lancer: \"ROLL\",\n // Same spellings as English on purpose, not a translation gap: the\n // FUNC token's NAME is looked up in a separate, locale-independent\n // dispatch table (FunctionCallParselet.ts's builtinNameToIndex) that\n // only knows English names, \"racine\" (root) would lex fine as a\n // FUNC token via this keywordMap but then fail at call time with\n // \"Unknown function\", so it's deliberately left out rather than\n // shipped half-working. Widening that dispatch table to be\n // locale-aware is a separate, larger change (it would need the same\n // fix for German too, \"wurzel\" has this identical problem today).\n abs: \"FUNC\", sin: \"FUNC\", cos: \"FUNC\", tan: \"FUNC\",\n log: \"FUNC\", min: \"FUNC\", max: \"FUNC\",\n convertir: \"CONVERT\",\n prochain: \"NEXT\", dernier: \"LAST\",\n dimanche: \"SUNDAY\", lundi: \"MONDAY\", mardi: \"TUESDAY\", mercredi: \"WEDNESDAY\",\n jeudi: \"THURSDAY\", vendredi: \"FRIDAY\", samedi: \"SATURDAY\",\n entre: \"BETWEEN\",\n augmenter: \"INCREASE\", diminuer: \"DECREASE\",\n vec2: \"VEC2\", vec3: \"VEC3\", vec4: \"VEC4\",\n vrai: \"TRUE\", faux: \"FALSE\",\n si: \"IF\", alors: \"THEN\", sinon: \"ELSE\",\n },\n display: {\n resultPrefix: \"= \",\n dateFormat: \"default\",\n decimalSeparator: \",\",\n thousandsSeparator: \" \",\n vectorFormat: \"[{values}]\",\n percentageSuffix: \"%\",\n },\n};\n","import { enLocale, type ILocale } from \"./en\";\nimport { deLocale } from \"./de\";\nimport { frLocale } from \"./fr\";\n\nconst locales: Record<string, ILocale> = {\n en: enLocale,\n de: deLocale,\n fr: frLocale,\n};\n\n/**\n * Look up a locale by code.\n *\n * @param code - Locale code, for example `\"en\"` or `\"de\"`.\n * @returns The locale, or English when the code is unknown. Falling back\n * rather than throwing means an unrecognised code degrades to a working engine\n * instead of a dead one.\n */\nexport function getLocale(code: string): ILocale {\n return locales[code] || enLocale;\n}\n\n/**\n * Add a locale, or replace one already registered under the same code.\n *\n * @param code - Locale code to register under.\n * @param locale - Keywords, units and formatting for that locale.\n */\nexport function registerLocale(code: string, locale: ILocale): void {\n locales[code] = locale;\n}\n\nexport { enLocale, deLocale, frLocale, type ILocale };"]}
1
+ {"version":3,"sources":["../src/constants/locales/en.ts","../src/constants/locales/de.ts","../src/constants/locales/fr.ts","../src/constants/locales/index.ts"],"names":["enLocale","deLocale","frLocale","locales","getLocale","code"],"mappings":"AAgBO,IAAMA,EAAoB,CAC/B,IAAA,CAAM,IAAA,CACN,KAAA,CAAO,UACP,UAAA,CAAY,CACV,EAAA,CAAI,IAAA,CAAM,EAAG,GAAA,CACb,IAAA,CAAM,MAAA,CAAQ,GAAA,CAAK,OAAQ,GAAA,CAAK,UAAA,CAAY,IAAA,CAAM,MAAA,CAClD,MAAO,OAAA,CAAS,QAAA,CAAU,OAAA,CAAS,MAAA,CAAQ,QAAS,IAAA,CAAM,OAAA,CAC1D,OAAA,CAAS,OAAA,CACT,MAAO,MAAA,CAAQ,QAAA,CAAU,OAAQ,GAAA,CAAK,MAAA,CACtC,OAAQ,OAAA,CACR,MAAA,CAAQ,KAAA,CAAO,GAAA,CAAK,MACpB,QAAA,CAAU,OAAA,CAAS,KAAA,CAAO,OAAA,CAC1B,IAAK,SAAA,CACL,EAAA,CAAI,IAAA,CACJ,GAAA,CAAK,MAAO,KAAA,CAAO,OAAA,CAA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,KAAA,CAAO,OAAQ,KAAA,CAAO,MAClC,CAAA,CACA,OAAA,CAAS,CACP,YAAA,CAAc,IAAA,CACd,UAAA,CAAY,SAAA,CACZ,iBAAkB,GAAA,CAClB,kBAAA,CAAoB,IACpB,YAAA,CAAc,YAAA,CACd,iBAAkB,GACpB,CACF,CAAA,CC7DA,IAAMC,EAAmC,CACvC,EAAA,CAAIH,CAAAA,CACJ,EAAA,CAAIC,EACJ,EAAA,CAAIC,CACN,CAAA,CAUO,SAASE,EAAUC,CAAAA,CAAuB,CAC/C,OAAOF,CAAAA,CAAQE,CAAI,GAAKL,CAC1B","file":"chunk-LHLW7JLS.js","sourcesContent":["/** What a locale supplies: keywords, units, and number formatting conventions. */\nexport interface ILocale {\n code: string;\n label: string;\n keywordMap: Record<string, string>;\n display: {\n resultPrefix: string;\n dateFormat: string;\n decimalSeparator: string;\n thousandsSeparator: string;\n vectorFormat: string;\n percentageSuffix: string;\n };\n}\n\n/** English keywords, units and number formatting. The default and the fallback. */\nexport const enLocale: ILocale = {\n code: \"en\",\n label: \"English\",\n keywordMap: {\n pi: \"PI\", e: \"E\",\n plus: \"PLUS\", add: \"PLUS\", and: \"AND_CONJ\", with: \"PLUS\",\n minus: \"MINUS\", subtract: \"MINUS\", remove: \"MINUS\", take: \"MINUS\",\n without: \"MINUS\",\n times: \"STAR\", multiply: \"STAR\", mul: \"STAR\",\n divide: \"SLASH\",\n modulo: \"MOD\", mod: \"MOD\",\n exponent: \"CARET\", prime: \"CARET\",\n xor: \"BIT_XOR\",\n of: \"OF\",\n now: \"NOW\", today: \"TODAY\", tomorrow: \"TOMORROW\", yesterday: \"YESTERDAY\",\n roll: \"ROLL\",\n sqrt: \"FUNC\", abs: \"FUNC\", sin: \"FUNC\", cos: \"FUNC\", tan: \"FUNC\",\n log: \"FUNC\", ceil: \"FUNC\", floor: \"FUNC\", round: \"FUNC\", min: \"FUNC\", max: \"FUNC\",\n asin: \"FUNC\", acos: \"FUNC\", atan: \"FUNC\", atan2: \"FUNC\",\n // Long-form aliases for asin/acos/atan (Numi/older-calculator naming\n // convention). Same FunctionCallParselet indices, not new behavior.\n arcsin: \"FUNC\", arccos: \"FUNC\", arctan: \"FUNC\",\n sinh: \"FUNC\", cosh: \"FUNC\", tanh: \"FUNC\",\n asinh: \"FUNC\", acosh: \"FUNC\", atanh: \"FUNC\",\n cbrt: \"FUNC\", clz32: \"FUNC\", expm1: \"FUNC\", exp: \"FUNC\",\n // root(n, x) -- n-th root; fact/factorial(n) -- factorial. Bare FUNC\n // keywords, matching gcd/lcm/cbrt's precedent above (technical,\n // call-syntax-only names, not plausible :variableName choices).\n root: \"FUNC\", fact: \"FUNC\", factorial: \"FUNC\",\n fround: \"FUNC\", hypot: \"FUNC\", imul: \"FUNC\",\n sind: \"FUNC\", cosd: \"FUNC\", tand: \"FUNC\",\n asind: \"FUNC\", acosd: \"FUNC\", atand: \"FUNC\",\n log10: \"FUNC\", log1p: \"FUNC\", log2: \"FUNC\",\n pow: \"FUNC\", random: \"FUNC\", sign: \"FUNC\", trunc: \"FUNC\",\n degtorad: \"FUNC\", radtodeg: \"FUNC\",\n gcd: \"FUNC\", lcm: \"FUNC\", permutation: \"FUNC\", combination: \"FUNC\",\n // hex/bin double as CONVERTER_NAME below (\"255 as hex\") AND as FUNC\n // call-syntax (\"hex(255)\"), a word can only have one lexer token\n // type, so these win FUNC (removed from the CONVERTER_NAME list\n // below) and AsConverterParselet.ts's \"as <name>\" check was widened\n // to also accept a FUNC-typed token, preserving \"as hex\"/\"as bin\"\n // unchanged. See AsConverterParselet.ts's class doc for the full\n // reasoning.\n hex: \"FUNC\", bin: \"FUNC\", int: \"FUNC\",\n // Finance (packages/finance/) function-call forms. Bare keywords, not\n // phrase-fused, these are camelCase call-only names (e.g.\n // \"compoundInterest(...)\"), not natural-language words a user would\n // plausibly choose as a variable name, so the bare-keyword collision\n // risk that blocks \"interest\"/\"tax\"/\"principal\" etc. doesn't apply here\n // (matches \"gcd\"/\"lcm\"/... above, not \"clamp\" below).\n compoundinterest: \"FUNC\", interestearned: \"FUNC\",\n compoundinterestrate: \"FUNC\", compoundinterestyears: \"FUNC\",\n loanrepayment: \"FUNC\", loaninterest: \"FUNC\", monthlypayment: \"FUNC\",\n taxadd: \"FUNC\", taxremove: \"FUNC\",\n // Inflation-adjusted value function-call form (packages/finance/).\n inflationadjust: \"FUNC\",\n // Matrix (packages/matrix/) function-call forms -- also reachable via\n // `^T`/`^-1` operator syntax and `|a|` (see FunctionCallParselet.ts's\n // builtinNameToIndex comment for indices 63-66).\n transpose: \"FUNC\", det: \"FUNC\", inv: \"FUNC\", dot: \"FUNC\",\n // map/reduce/sum/prod (packages/mapreduce/) are NOT bare keywordMap\n // entries. See packages/mapreduce/normalizer/MapReduceCallNormalizerRule.ts\n // which fuses them ONLY when immediately followed by \"(\" (same\n // \"conditional-on-LPAREN\" pattern as packages/lines/'s own\n // sum(/total(/average( fusion), so `:map = [...]`/`:sum = 100`/etc.\n // keep working as ordinary variable names.\n clamp: \"CLAMP\",\n // `into` is a third spelling of the conversion operator, alongside `to` and\n // `in`. It reads better before a unit than either (\"300 cm into m\"), and\n // costs nothing: it is not a plausible variable name and has no other\n // meaning in the grammar.\n convert: \"CONVERT\", to: \"TO\", best: \"BEST\", in: \"IN\", into: \"IN\",\n next: \"NEXT\", last: \"LAST\", until: \"UNTIL\", since: \"SINCE\",\n sunday: \"SUNDAY\", monday: \"MONDAY\", tuesday: \"TUESDAY\", wednesday: \"WEDNESDAY\",\n thursday: \"THURSDAY\", friday: \"FRIDAY\", saturday: \"SATURDAY\",\n between: \"BETWEEN\", from: \"FROM\",\n increase: \"INCREASE\", decrease: \"DECREASE\",\n // Finance (packages/finance/) phrase-grammar connectors. Bare\n // prepositions, same accepted-risk category as \"between\"/\"from\" above\n // see Token.ts's OVER/RATE_AT doc comment.\n over: \"OVER\", at: \"RATE_AT\",\n // Only \"rounded\". Bare \"round\" is already the round(x) function above.\n rounded: \"ROUNDED\",\n is: \"IS\",\n // The investment grammar (packages/finance/). See Token.ts.\n after: \"AFTER\", for: \"FOR_DURATION\", compounding: \"COMPOUNDING\",\n invested: \"INVESTED\", returned: \"RETURNED\",\n by: \"BY\",\n vec2: \"VEC2\", vec3: \"VEC3\", vec4: \"VEC4\",\n float: \"FLOAT\",\n global: \"GLOBAL\",\n or: \"OR\",\n true: \"TRUE\", false: \"FALSE\",\n if: \"IF\", then: \"THEN\", else: \"ELSE\",\n as: \"AS\",\n percent: \"CONVERTER_NAME\", percentage: \"CONVERTER_NAME\",\n decimal: \"CONVERTER_NAME\", dec: \"CONVERTER_NAME\", number: \"CONVERTER_NAME\",\n fraction: \"CONVERTER_NAME\",\n multiplier: \"CONVERTER_NAME\",\n sci: \"CONVERTER_NAME\", scientific: \"CONVERTER_NAME\",\n // hex/bin are FUNC (see above), not CONVERTER_NAME, \"as hex\"/\"as bin\"\n // still work via AsConverterParselet.ts's widened token-type check.\n binary: \"CONVERTER_NAME\",\n octal: \"CONVERTER_NAME\", oct: \"CONVERTER_NAME\",\n },\n display: {\n resultPrefix: \"= \",\n dateFormat: \"default\",\n decimalSeparator: \".\",\n thousandsSeparator: \",\",\n vectorFormat: \"[{values}]\",\n percentageSuffix: \"%\",\n },\n};\n","import { ILocale } from \"./en\";\n\n/** German keywords, units and number formatting. */\nexport const deLocale: ILocale = {\n code: \"de\",\n label: \"Deutsch\",\n keywordMap: {\n pi: \"PI\", e: \"E\",\n plus: \"PLUS\", add: \"PLUS\", und: \"AND_CONJ\",\n minus: \"MINUS\", subtract: \"MINUS\", entfernen: \"MINUS\", nehmen: \"MINUS\",\n mal: \"STAR\", multiplizieren: \"STAR\",\n teilen: \"SLASH\",\n modulo: \"MOD\", mod: \"MOD\",\n exponent: \"CARET\", potenz: \"CARET\",\n von: \"OF\",\n jetzt: \"NOW\", heute: \"TODAY\", morgen: \"TOMORROW\", gestern: \"YESTERDAY\",\n rollen: \"ROLL\",\n wurzel: \"FUNC\", abs: \"FUNC\", sin: \"FUNC\", cos: \"FUNC\", tan: \"FUNC\",\n log: \"FUNC\", aufrunden: \"FUNC\", abrunden: \"FUNC\", runden: \"FUNC\", min: \"FUNC\", max: \"FUNC\",\n asin: \"FUNC\", acos: \"FUNC\", atan: \"FUNC\", atan2: \"FUNC\",\n sinh: \"FUNC\", cosh: \"FUNC\", tanh: \"FUNC\",\n asinh: \"FUNC\", acosh: \"FUNC\", atanh: \"FUNC\",\n kubikwurzel: \"FUNC\", clz32: \"FUNC\", expm1: \"FUNC\", exp: \"FUNC\",\n fround: \"FUNC\", hypot: \"FUNC\", imul: \"FUNC\",\n log10: \"FUNC\", log1p: \"FUNC\", log2: \"FUNC\",\n pow: \"FUNC\", zufall: \"FUNC\", zeichen: \"FUNC\", ganzzahl: \"FUNC\",\n degtorad: \"FUNC\", radtodeg: \"FUNC\",\n konvertieren: \"CONVERT\", in: \"TO\", amBesten: \"BEST\",\n naechste: \"NEXT\", letzte: \"LAST\", bis: \"UNTIL\", seit: \"SINCE\",\n sonntag: \"SUNDAY\", montag: \"MONDAY\", dienstag: \"TUESDAY\", mittwoch: \"WEDNESDAY\",\n donnerstag: \"THURSDAY\", freitag: \"FRIDAY\", samstag: \"SATURDAY\",\n zwischen: \"BETWEEN\",\n von_ab: \"FROM\",\n erhoehen: \"INCREASE\", verringern: \"DECREASE\",\n vec2: \"VEC2\", vec3: \"VEC3\", vec4: \"VEC4\",\n },\n display: {\n resultPrefix: \"= \",\n dateFormat: \"default\",\n decimalSeparator: \",\",\n thousandsSeparator: \".\",\n vectorFormat: \"[{values}]\",\n percentageSuffix: \"%\",\n },\n};","import { ILocale } from \"./en\";\n\n/**\n * French locale. See GitHub issue #77 (\"Please allow for localized day\n * of the week\"). Matches `de.ts`'s scope, not `en.ts`'s full coverage: a\n * confident, reviewed core set (arithmetic words, date keywords, weekday\n * names, a handful of common functions), not a guess at every FUNC/phrase\n * keyword across every package. Widening this is a good first issue for\n * a native French speaker, PRs welcome, same as this project's existing\n * convention for locale gaps.\n *\n * \"aujourd'hui\" (today) is deliberately spelled without its apostrophe\n * here (`aujourdhui`), `ExpressionLexer`'s identifier reader only\n * accepts `[a-zA-Z_][a-zA-Z0-9_]*` plus Unicode, so the standard spelling\n * can't lex as a single IDENT token at all. This is a real, disclosed\n * limitation, not a translation choice, anyone typing the standard\n * apostrophed spelling won't get a match today.\n */\nexport const frLocale: ILocale = {\n code: \"fr\",\n label: \"Français\",\n keywordMap: {\n pi: \"PI\", e: \"E\",\n plus: \"PLUS\", ajouter: \"PLUS\", et: \"AND_CONJ\",\n moins: \"MINUS\", soustraire: \"MINUS\", enlever: \"MINUS\",\n fois: \"STAR\", multiplier: \"STAR\",\n diviser: \"SLASH\",\n modulo: \"MOD\", mod: \"MOD\",\n exposant: \"CARET\", puissance: \"CARET\",\n xor: \"BIT_XOR\",\n maintenant: \"NOW\",\n // \"aujourd'hui\". See this file's own doc comment for why the\n // apostrophe is dropped here.\n aujourdhui: \"TODAY\",\n demain: \"TOMORROW\", hier: \"YESTERDAY\",\n lancer: \"ROLL\",\n // Same spellings as English on purpose, not a translation gap: the\n // FUNC token's NAME is looked up in a separate, locale-independent\n // dispatch table (FunctionCallParselet.ts's builtinNameToIndex) that\n // only knows English names, \"racine\" (root) would lex fine as a\n // FUNC token via this keywordMap but then fail at call time with\n // \"Unknown function\", so it's deliberately left out rather than\n // shipped half-working. Widening that dispatch table to be\n // locale-aware is a separate, larger change (it would need the same\n // fix for German too, \"wurzel\" has this identical problem today).\n abs: \"FUNC\", sin: \"FUNC\", cos: \"FUNC\", tan: \"FUNC\",\n log: \"FUNC\", min: \"FUNC\", max: \"FUNC\",\n convertir: \"CONVERT\",\n prochain: \"NEXT\", dernier: \"LAST\",\n dimanche: \"SUNDAY\", lundi: \"MONDAY\", mardi: \"TUESDAY\", mercredi: \"WEDNESDAY\",\n jeudi: \"THURSDAY\", vendredi: \"FRIDAY\", samedi: \"SATURDAY\",\n entre: \"BETWEEN\",\n augmenter: \"INCREASE\", diminuer: \"DECREASE\",\n vec2: \"VEC2\", vec3: \"VEC3\", vec4: \"VEC4\",\n vrai: \"TRUE\", faux: \"FALSE\",\n si: \"IF\", alors: \"THEN\", sinon: \"ELSE\",\n },\n display: {\n resultPrefix: \"= \",\n dateFormat: \"default\",\n decimalSeparator: \",\",\n thousandsSeparator: \" \",\n vectorFormat: \"[{values}]\",\n percentageSuffix: \"%\",\n },\n};\n","import { enLocale, type ILocale } from \"./en\";\nimport { deLocale } from \"./de\";\nimport { frLocale } from \"./fr\";\n\nconst locales: Record<string, ILocale> = {\n en: enLocale,\n de: deLocale,\n fr: frLocale,\n};\n\n/**\n * Look up a locale by code.\n *\n * @param code - Locale code, for example `\"en\"` or `\"de\"`.\n * @returns The locale, or English when the code is unknown. Falling back\n * rather than throwing means an unrecognised code degrades to a working engine\n * instead of a dead one.\n */\nexport function getLocale(code: string): ILocale {\n return locales[code] || enLocale;\n}\n\nexport { enLocale, deLocale, frLocale, type ILocale };"]}
@@ -1,3 +1,3 @@
1
1
  'use strict';var o=(e=>(e.PARSING="PARSING",e.EXECUTION="EXECUTION",e.VALIDATION="VALIDATION",e.EXTERNAL="EXTERNAL",e.INTERNAL="INTERNAL",e.CONFIG="CONFIG",e))(o||{}),N=class E extends Error{constructor(r,_){super(_.message),this.name="EngineError",this.category=r,this.code=_.code,this.expected=_.expected,this.found=_.found,this.suggestion=_.suggestion,this.recoverable=_.recoverable??true,this.span=_.span,this.context=_.context,this.cause=_.cause,this.timestamp=new Date,Error.captureStackTrace&&Error.captureStackTrace(this,E);}isFatal(){return !this.recoverable}causeChain(){let r=[this],_=this.cause;for(;_!=null;)r.push(_),_=_ instanceof Error?_.cause:void 0;return r}format(){let r=[`error[${this.code}]: ${this.message}`];return this.expected&&r.push(` expected: ${this.expected}`),this.found&&r.push(` found: ${this.found}`),this.suggestion&&r.push(` suggestion: ${this.suggestion}`),r.join(`
2
- `)}toJSON(){return {name:this.name,category:this.category,code:this.code,message:this.message,expected:this.expected,found:this.found,suggestion:this.suggestion,recoverable:this.recoverable,span:this.span,context:this.context,timestamp:this.timestamp.toISOString()}}},I=class E{static build(r,_,n,R,A){let e=typeof n=="string"?{code:n,message:R,context:A}:n;return new N(r,{recoverable:_,...e})}static validation(r,_,n){return E.build("VALIDATION",true,r,_,n)}static parsing(r,_,n){return E.build("PARSING",true,r,_,n)}static execution(r,_,n){return E.build("EXECUTION",true,r,_,n)}static external(r,_,n){return E.build("EXTERNAL",true,r,_,n)}static internal(r,_,n){return E.build("INTERNAL",true,r,_,n)}static config(r,_,n){return E.build("CONFIG",false,r,_,n)}};function t(E){return E instanceof N?E:E instanceof Error?I.internal({code:"UNEXPECTED_ERROR",message:E.message,context:{originalErrorName:E.name},cause:E,recoverable:true}):I.internal({code:"UNKNOWN_ERROR",message:"An unknown error occurred",context:{error:String(E)},recoverable:true})}function O(E){return {ok:true,value:E}}function T(E){return {ok:false,error:E}}function i(E){return E.ok}function s(E){return !E.ok}function S(E,r){return E.ok?O(r(E.value)):E}function C(E,r){return E.ok?E:T(r(E.error))}function D(E,r){return E.ok?r(E.value):E}function L(E,r){return E.ok?E.value:r}function U(E,r){return E.ok?r.ok(E.value):r.err(E.error)}function u(E){let r=[];for(let _ of E){if(!_.ok)return _;r.push(_.value);}return O(r)}function a(E){if(E.ok)return E.value;throw E.error}function c(E,r=t){try{return O(E())}catch(_){return T(r(_))}}async function M(E,r=t){try{return O(await E())}catch(_){return T(r(_))}}var P={INVALID_NUMBER_LITERAL:"INVALID_NUMBER_LITERAL",UNTERMINATED_STRING:"UNTERMINATED_STRING",NO_PREFIX_PARSELET:"NO_PREFIX_PARSELET",UNEXPECTED_END_OF_INPUT:"UNEXPECTED_END_OF_INPUT",UNEXPECTED_TOKEN_TYPE:"UNEXPECTED_TOKEN_TYPE",NESTING_DEPTH_EXCEEDED:"NESTING_DEPTH_EXCEEDED",UNEXPECTED_END:"UNEXPECTED_END",UNEXPECTED_TRAILING_TOKEN:"UNEXPECTED_TRAILING_TOKEN",PARSE_ERROR:"PARSE_ERROR",TOO_MANY_NUMERIC_CONSTANTS:"TOO_MANY_NUMERIC_CONSTANTS",TOO_MANY_STRING_CONSTANTS:"TOO_MANY_STRING_CONSTANTS",NO_MATCHING_PHRASE_ALTERNATIVE:"NO_MATCHING_PHRASE_ALTERNATIVE",INVALID_PHRASE_PATTERN:"INVALID_PHRASE_PATTERN",PHRASE_KEYWORD_MISMATCH:"PHRASE_KEYWORD_MISMATCH",USER_FUNCTION_INVALID_PARAM_NAME:"USER_FUNCTION_INVALID_PARAM_NAME",USER_FUNCTION_NO_PARAMS:"USER_FUNCTION_NO_PARAMS",FUNCTION_BODY_MUST_BE_SYNCHRONOUS:"FUNCTION_BODY_MUST_BE_SYNCHRONOUS",TOO_MANY_FUNCTION_DEFINITIONS:"TOO_MANY_FUNCTION_DEFINITIONS",TOO_MANY_ANONYMOUS_BODIES:"TOO_MANY_ANONYMOUS_BODIES",UNKNOWN_PLUGIN_FUNCTION:"UNKNOWN_PLUGIN_FUNCTION",EVALUATION_ERROR:"EVALUATION_ERROR",INSTRUCTION_LIMIT_EXCEEDED:"INSTRUCTION_LIMIT_EXCEEDED",STACK_LIMIT_EXCEEDED:"STACK_LIMIT_EXCEEDED",ALLOCATION_LIMIT_EXCEEDED:"ALLOCATION_LIMIT_EXCEEDED",STACK_UNDERFLOW:"STACK_UNDERFLOW",UNDEFINED_VARIABLE:"UNDEFINED_VARIABLE",GLOBAL_VARIABLE_NOT_RESOLVED:"GLOBAL_VARIABLE_NOT_RESOLVED",UNKNOWN_FUNCTION:"UNKNOWN_FUNCTION",UNEXPECTED_PENDING_RESULT:"UNEXPECTED_PENDING_RESULT",UNDEFINED_FUNCTION:"UNDEFINED_FUNCTION",FUNCTION_ARITY_MISMATCH:"FUNCTION_ARITY_MISMATCH",BUILTIN_ARITY_MISMATCH:"BUILTIN_ARITY_MISMATCH",USER_FUNCTION_ASYNC_UNSUPPORTED:"USER_FUNCTION_ASYNC_UNSUPPORTED",MAP_REDUCE_ASYNC_UNSUPPORTED:"MAP_REDUCE_ASYNC_UNSUPPORTED",SYMBOLIC_ASYNC_UNSUPPORTED:"SYMBOLIC_ASYNC_UNSUPPORTED",EXPLAIN_ASYNC_UNSUPPORTED:"EXPLAIN_ASYNC_UNSUPPORTED",FUNCTION_RECURSION_LIMIT_EXCEEDED:"FUNCTION_RECURSION_LIMIT_EXCEEDED",FUNCTION_CALL_LIMIT_EXCEEDED:"FUNCTION_CALL_LIMIT_EXCEEDED",DATE_OFFSET_LIMIT_EXCEEDED:"DATE_OFFSET_LIMIT_EXCEEDED",WORKDAY_OFFSET_EXPECTED_DATE:"WORKDAY_OFFSET_EXPECTED_DATE",WORKDAYS_BETWEEN_EXPECTED_DATES:"WORKDAYS_BETWEEN_EXPECTED_DATES",WORKDAYS_BETWEEN_RANGE_TOO_LARGE:"WORKDAYS_BETWEEN_RANGE_TOO_LARGE",BIGINT_SHIFT_LIMIT_EXCEEDED:"BIGINT_SHIFT_LIMIT_EXCEEDED",BIGINT_POW_LIMIT_EXCEEDED:"BIGINT_POW_LIMIT_EXCEEDED",BIGINT_INEXACT_OPERAND:"BIGINT_INEXACT_OPERAND",BIGINT_DIVISION_BY_ZERO:"BIGINT_DIVISION_BY_ZERO",INTERNAL_MISSING_FUNCTION_BODY:"INTERNAL_MISSING_FUNCTION_BODY",INTERNAL_MISSING_ANONYMOUS_BODY:"INTERNAL_MISSING_ANONYMOUS_BODY",MALFORMED_BYTECODE_TRUNCATED:"MALFORMED_BYTECODE_TRUNCATED",MALFORMED_BYTECODE_CONSTANT_INDEX:"MALFORMED_BYTECODE_CONSTANT_INDEX",MALFORMED_BYTECODE_OPERAND_TYPE:"MALFORMED_BYTECODE_OPERAND_TYPE",MALFORMED_BYTECODE_BODY_KIND:"MALFORMED_BYTECODE_BODY_KIND",MALFORMED_BYTECODE_BIGINT_LITERAL:"MALFORMED_BYTECODE_BIGINT_LITERAL",MALFORMED_BYTECODE_PROGRAM:"MALFORMED_BYTECODE_PROGRAM",SYMBOLIC_RATIONAL_OVERFLOW:"SYMBOLIC_RATIONAL_OVERFLOW",SYMBOLIC_NONFINITE_OPERAND:"SYMBOLIC_NONFINITE_OPERAND",SYMBOLIC_DIVISION_BY_ZERO:"SYMBOLIC_DIVISION_BY_ZERO",SYMBOLIC_NODE_LIMIT_EXCEEDED:"SYMBOLIC_NODE_LIMIT_EXCEEDED",SYMBOLIC_UNSUPPORTED_FUNCTION:"SYMBOLIC_UNSUPPORTED_FUNCTION",SYMBOLIC_FACTOR_LIMIT_EXCEEDED:"SYMBOLIC_FACTOR_LIMIT_EXCEEDED",SYMBOLIC_SOLVE_UNSUPPORTED:"SYMBOLIC_SOLVE_UNSUPPORTED",SYMBOLIC_SOLVE_INCOMPLETE:"SYMBOLIC_SOLVE_INCOMPLETE",SOLVE_REQUIRES_VARIABLE_NAME:"SOLVE_REQUIRES_VARIABLE_NAME",SYMBOLIC_DERIVATIVE_ORDER_LIMIT:"SYMBOLIC_DERIVATIVE_ORDER_LIMIT",SYMBOLIC_INTEGRAL_UNSUPPORTED:"SYMBOLIC_INTEGRAL_UNSUPPORTED",SYMBOLIC_TAYLOR_DEGREE_LIMIT:"SYMBOLIC_TAYLOR_DEGREE_LIMIT",SYMBOLIC_TAYLOR_INEXACT:"SYMBOLIC_TAYLOR_INEXACT",SYMBOLIC_REQUIRES_VARIABLE_NAME:"SYMBOLIC_REQUIRES_VARIABLE_NAME",SYMBOLIC_JACOBIAN_NO_VARIABLES:"SYMBOLIC_JACOBIAN_NO_VARIABLES",INTERNAL_RATIONAL_PARSE:"INTERNAL_RATIONAL_PARSE",EXPRESSION_TOO_LONG:"EXPRESSION_TOO_LONG",EXPRESSION_TOO_COMPLEX:"EXPRESSION_TOO_COMPLEX",DOCUMENT_TOO_LARGE:"DOCUMENT_TOO_LARGE",NORMALIZED_TOKEN_LIMIT_EXCEEDED:"NORMALIZED_TOKEN_LIMIT_EXCEEDED",THEREFORE_REQUIRES_EXPRESSION:"THEREFORE_REQUIRES_EXPRESSION",THEREFORE_ASYNC_UNSUPPORTED:"THEREFORE_ASYNC_UNSUPPORTED",COMPOUND_ASSIGN_REQUIRES_EXPRESSION:"COMPOUND_ASSIGN_REQUIRES_EXPRESSION",COMPOUND_ASSIGN_ASYNC_UNSUPPORTED:"COMPOUND_ASSIGN_ASYNC_UNSUPPORTED",UNKNOWN_SAVINGS_PERIOD:"UNKNOWN_SAVINGS_PERIOD",INVALID_TIME_LITERAL:"INVALID_TIME_LITERAL",SNAPSHOT_VERSION_MISMATCH:"SNAPSHOT_VERSION_MISMATCH",SNAPSHOT_MALFORMED:"SNAPSHOT_MALFORMED",SNAPSHOT_UNSUPPORTED_VALUE:"SNAPSHOT_UNSUPPORTED_VALUE",CONFIG_PATH_NOT_FOUND:"CONFIG_PATH_NOT_FOUND",INVALID_CONFIG_PATH:"INVALID_CONFIG_PATH",CONFIG_SECTION_NOT_FOUND:"CONFIG_SECTION_NOT_FOUND",CONFIG_PROPERTY_NOT_FOUND:"CONFIG_PROPERTY_NOT_FOUND",PLUGIN_OPERATOR_COLLISION:"PLUGIN_OPERATOR_COLLISION",PLUGIN_KEYWORD_COLLISION:"PLUGIN_KEYWORD_COLLISION",PLUGIN_UNIT_COLLISION:"PLUGIN_UNIT_COLLISION",PACKAGE_ENGINE_VERSION_MISMATCH:"PACKAGE_ENGINE_VERSION_MISMATCH",PACKAGE_ENGINE_VERSION_INVALID_RANGE:"PACKAGE_ENGINE_VERSION_INVALID_RANGE",OPCODE_POOL_EXHAUSTED:"OPCODE_POOL_EXHAUSTED",PLUGIN_FUNCTION_INDEX_POOL_EXHAUSTED:"PLUGIN_FUNCTION_INDEX_POOL_EXHAUSTED",INVALID_RATE_UNIT:"INVALID_RATE_UNIT",INVALID_TIMECODE_UNIT:"INVALID_TIMECODE_UNIT",UNEXPECTED_ERROR:"UNEXPECTED_ERROR",UNKNOWN_ERROR:"UNKNOWN_ERROR"};exports.a=o;exports.b=N;exports.c=I;exports.d=t;exports.e=O;exports.f=T;exports.g=i;exports.h=s;exports.i=S;exports.j=C;exports.k=D;exports.l=L;exports.m=U;exports.n=u;exports.o=a;exports.p=c;exports.q=M;exports.r=P;//# sourceMappingURL=chunk-SOMGSIO4.cjs.map
3
- //# sourceMappingURL=chunk-SOMGSIO4.cjs.map
2
+ `)}toJSON(){return {name:this.name,category:this.category,code:this.code,message:this.message,expected:this.expected,found:this.found,suggestion:this.suggestion,recoverable:this.recoverable,span:this.span,context:this.context,timestamp:this.timestamp.toISOString()}}},I=class E{static build(r,_,n,R,A){let e=typeof n=="string"?{code:n,message:R,context:A}:n;return new N(r,{recoverable:_,...e})}static validation(r,_,n){return E.build("VALIDATION",true,r,_,n)}static parsing(r,_,n){return E.build("PARSING",true,r,_,n)}static execution(r,_,n){return E.build("EXECUTION",true,r,_,n)}static external(r,_,n){return E.build("EXTERNAL",true,r,_,n)}static internal(r,_,n){return E.build("INTERNAL",true,r,_,n)}static config(r,_,n){return E.build("CONFIG",false,r,_,n)}};function t(E){return E instanceof N?E:E instanceof Error?I.internal({code:"UNEXPECTED_ERROR",message:E.message,context:{originalErrorName:E.name},cause:E,recoverable:true}):I.internal({code:"UNKNOWN_ERROR",message:"An unknown error occurred",context:{error:String(E)},recoverable:true})}function O(E){return {ok:true,value:E}}function T(E){return {ok:false,error:E}}function i(E){return E.ok}function s(E){return !E.ok}function S(E,r){return E.ok?O(r(E.value)):E}function C(E,r){return E.ok?E:T(r(E.error))}function D(E,r){return E.ok?r(E.value):E}function L(E,r){return E.ok?E.value:r}function U(E,r){return E.ok?r.ok(E.value):r.err(E.error)}function u(E){let r=[];for(let _ of E){if(!_.ok)return _;r.push(_.value);}return O(r)}function a(E){if(E.ok)return E.value;throw E.error}function P(E,r=t){try{return O(E())}catch(_){return T(r(_))}}async function c(E,r=t){try{return O(await E())}catch(_){return T(r(_))}}var M={INVALID_NUMBER_LITERAL:"INVALID_NUMBER_LITERAL",UNTERMINATED_STRING:"UNTERMINATED_STRING",NO_PREFIX_PARSELET:"NO_PREFIX_PARSELET",UNEXPECTED_END_OF_INPUT:"UNEXPECTED_END_OF_INPUT",UNEXPECTED_TOKEN_TYPE:"UNEXPECTED_TOKEN_TYPE",NESTING_DEPTH_EXCEEDED:"NESTING_DEPTH_EXCEEDED",UNEXPECTED_END:"UNEXPECTED_END",UNEXPECTED_TRAILING_TOKEN:"UNEXPECTED_TRAILING_TOKEN",PARSE_ERROR:"PARSE_ERROR",TOO_MANY_NUMERIC_CONSTANTS:"TOO_MANY_NUMERIC_CONSTANTS",TOO_MANY_STRING_CONSTANTS:"TOO_MANY_STRING_CONSTANTS",NO_MATCHING_PHRASE_ALTERNATIVE:"NO_MATCHING_PHRASE_ALTERNATIVE",INVALID_PHRASE_PATTERN:"INVALID_PHRASE_PATTERN",PHRASE_KEYWORD_MISMATCH:"PHRASE_KEYWORD_MISMATCH",USER_FUNCTION_INVALID_PARAM_NAME:"USER_FUNCTION_INVALID_PARAM_NAME",USER_FUNCTION_NO_PARAMS:"USER_FUNCTION_NO_PARAMS",FUNCTION_BODY_MUST_BE_SYNCHRONOUS:"FUNCTION_BODY_MUST_BE_SYNCHRONOUS",TOO_MANY_FUNCTION_DEFINITIONS:"TOO_MANY_FUNCTION_DEFINITIONS",TOO_MANY_ANONYMOUS_BODIES:"TOO_MANY_ANONYMOUS_BODIES",UNKNOWN_PLUGIN_FUNCTION:"UNKNOWN_PLUGIN_FUNCTION",EVALUATION_ERROR:"EVALUATION_ERROR",INSTRUCTION_LIMIT_EXCEEDED:"INSTRUCTION_LIMIT_EXCEEDED",STACK_LIMIT_EXCEEDED:"STACK_LIMIT_EXCEEDED",ALLOCATION_LIMIT_EXCEEDED:"ALLOCATION_LIMIT_EXCEEDED",STACK_UNDERFLOW:"STACK_UNDERFLOW",UNDEFINED_VARIABLE:"UNDEFINED_VARIABLE",GLOBAL_VARIABLE_NOT_RESOLVED:"GLOBAL_VARIABLE_NOT_RESOLVED",UNKNOWN_FUNCTION:"UNKNOWN_FUNCTION",UNEXPECTED_PENDING_RESULT:"UNEXPECTED_PENDING_RESULT",UNDEFINED_FUNCTION:"UNDEFINED_FUNCTION",FUNCTION_ARITY_MISMATCH:"FUNCTION_ARITY_MISMATCH",BUILTIN_ARITY_MISMATCH:"BUILTIN_ARITY_MISMATCH",USER_FUNCTION_ASYNC_UNSUPPORTED:"USER_FUNCTION_ASYNC_UNSUPPORTED",MAP_REDUCE_ASYNC_UNSUPPORTED:"MAP_REDUCE_ASYNC_UNSUPPORTED",SYMBOLIC_ASYNC_UNSUPPORTED:"SYMBOLIC_ASYNC_UNSUPPORTED",EXPLAIN_ASYNC_UNSUPPORTED:"EXPLAIN_ASYNC_UNSUPPORTED",FUNCTION_RECURSION_LIMIT_EXCEEDED:"FUNCTION_RECURSION_LIMIT_EXCEEDED",FUNCTION_CALL_LIMIT_EXCEEDED:"FUNCTION_CALL_LIMIT_EXCEEDED",DATE_OFFSET_LIMIT_EXCEEDED:"DATE_OFFSET_LIMIT_EXCEEDED",WORKDAY_OFFSET_EXPECTED_DATE:"WORKDAY_OFFSET_EXPECTED_DATE",WORKDAYS_BETWEEN_EXPECTED_DATES:"WORKDAYS_BETWEEN_EXPECTED_DATES",WORKDAYS_BETWEEN_RANGE_TOO_LARGE:"WORKDAYS_BETWEEN_RANGE_TOO_LARGE",BIGINT_SHIFT_LIMIT_EXCEEDED:"BIGINT_SHIFT_LIMIT_EXCEEDED",BIGINT_POW_LIMIT_EXCEEDED:"BIGINT_POW_LIMIT_EXCEEDED",BIGINT_INEXACT_OPERAND:"BIGINT_INEXACT_OPERAND",BIGINT_DIVISION_BY_ZERO:"BIGINT_DIVISION_BY_ZERO",INTERNAL_MISSING_FUNCTION_BODY:"INTERNAL_MISSING_FUNCTION_BODY",INTERNAL_MISSING_ANONYMOUS_BODY:"INTERNAL_MISSING_ANONYMOUS_BODY",MALFORMED_BYTECODE_TRUNCATED:"MALFORMED_BYTECODE_TRUNCATED",MALFORMED_BYTECODE_CONSTANT_INDEX:"MALFORMED_BYTECODE_CONSTANT_INDEX",MALFORMED_BYTECODE_OPERAND_TYPE:"MALFORMED_BYTECODE_OPERAND_TYPE",MALFORMED_BYTECODE_BODY_KIND:"MALFORMED_BYTECODE_BODY_KIND",MALFORMED_BYTECODE_BIGINT_LITERAL:"MALFORMED_BYTECODE_BIGINT_LITERAL",MALFORMED_BYTECODE_PROGRAM:"MALFORMED_BYTECODE_PROGRAM",SYMBOLIC_RATIONAL_OVERFLOW:"SYMBOLIC_RATIONAL_OVERFLOW",SYMBOLIC_NONFINITE_OPERAND:"SYMBOLIC_NONFINITE_OPERAND",SYMBOLIC_DIVISION_BY_ZERO:"SYMBOLIC_DIVISION_BY_ZERO",SYMBOLIC_NODE_LIMIT_EXCEEDED:"SYMBOLIC_NODE_LIMIT_EXCEEDED",SYMBOLIC_UNSUPPORTED_FUNCTION:"SYMBOLIC_UNSUPPORTED_FUNCTION",SYMBOLIC_FACTOR_LIMIT_EXCEEDED:"SYMBOLIC_FACTOR_LIMIT_EXCEEDED",SYMBOLIC_SOLVE_UNSUPPORTED:"SYMBOLIC_SOLVE_UNSUPPORTED",SYMBOLIC_SOLVE_INCOMPLETE:"SYMBOLIC_SOLVE_INCOMPLETE",SOLVE_REQUIRES_VARIABLE_NAME:"SOLVE_REQUIRES_VARIABLE_NAME",SYMBOLIC_DERIVATIVE_ORDER_LIMIT:"SYMBOLIC_DERIVATIVE_ORDER_LIMIT",SYMBOLIC_INTEGRAL_UNSUPPORTED:"SYMBOLIC_INTEGRAL_UNSUPPORTED",SYMBOLIC_TAYLOR_DEGREE_LIMIT:"SYMBOLIC_TAYLOR_DEGREE_LIMIT",SYMBOLIC_TAYLOR_INEXACT:"SYMBOLIC_TAYLOR_INEXACT",SYMBOLIC_REQUIRES_VARIABLE_NAME:"SYMBOLIC_REQUIRES_VARIABLE_NAME",SYMBOLIC_JACOBIAN_NO_VARIABLES:"SYMBOLIC_JACOBIAN_NO_VARIABLES",INTERNAL_RATIONAL_PARSE:"INTERNAL_RATIONAL_PARSE",EXPRESSION_TOO_LONG:"EXPRESSION_TOO_LONG",EXPRESSION_TOO_COMPLEX:"EXPRESSION_TOO_COMPLEX",DOCUMENT_TOO_LARGE:"DOCUMENT_TOO_LARGE",NORMALIZED_TOKEN_LIMIT_EXCEEDED:"NORMALIZED_TOKEN_LIMIT_EXCEEDED",THEREFORE_REQUIRES_EXPRESSION:"THEREFORE_REQUIRES_EXPRESSION",THEREFORE_ASYNC_UNSUPPORTED:"THEREFORE_ASYNC_UNSUPPORTED",COMPOUND_ASSIGN_REQUIRES_EXPRESSION:"COMPOUND_ASSIGN_REQUIRES_EXPRESSION",COMPOUND_ASSIGN_ASYNC_UNSUPPORTED:"COMPOUND_ASSIGN_ASYNC_UNSUPPORTED",UNKNOWN_SAVINGS_PERIOD:"UNKNOWN_SAVINGS_PERIOD",INVALID_TIME_LITERAL:"INVALID_TIME_LITERAL",SNAPSHOT_VERSION_MISMATCH:"SNAPSHOT_VERSION_MISMATCH",SNAPSHOT_MALFORMED:"SNAPSHOT_MALFORMED",SNAPSHOT_UNSUPPORTED_VALUE:"SNAPSHOT_UNSUPPORTED_VALUE",CONFIG_PATH_NOT_FOUND:"CONFIG_PATH_NOT_FOUND",INVALID_CONFIG_PATH:"INVALID_CONFIG_PATH",CONFIG_SECTION_NOT_FOUND:"CONFIG_SECTION_NOT_FOUND",CONFIG_PROPERTY_NOT_FOUND:"CONFIG_PROPERTY_NOT_FOUND",PLUGIN_OPERATOR_COLLISION:"PLUGIN_OPERATOR_COLLISION",PLUGIN_KEYWORD_COLLISION:"PLUGIN_KEYWORD_COLLISION",PLUGIN_UNIT_COLLISION:"PLUGIN_UNIT_COLLISION",PACKAGE_ENGINE_VERSION_MISMATCH:"PACKAGE_ENGINE_VERSION_MISMATCH",PACKAGE_ENGINE_VERSION_INVALID_RANGE:"PACKAGE_ENGINE_VERSION_INVALID_RANGE",OPCODE_POOL_EXHAUSTED:"OPCODE_POOL_EXHAUSTED",PLUGIN_FUNCTION_INDEX_POOL_EXHAUSTED:"PLUGIN_FUNCTION_INDEX_POOL_EXHAUSTED",PLUGIN_FUNCTION_INDEX_TOO_LARGE:"PLUGIN_FUNCTION_INDEX_TOO_LARGE",INVALID_RATE_UNIT:"INVALID_RATE_UNIT",INVALID_TIMECODE_UNIT:"INVALID_TIMECODE_UNIT",UNEXPECTED_ERROR:"UNEXPECTED_ERROR",UNKNOWN_ERROR:"UNKNOWN_ERROR"};exports.a=o;exports.b=N;exports.c=I;exports.d=t;exports.e=O;exports.f=T;exports.g=i;exports.h=s;exports.i=S;exports.j=C;exports.k=D;exports.l=L;exports.m=U;exports.n=u;exports.o=a;exports.p=P;exports.q=c;exports.r=M;//# sourceMappingURL=chunk-NAZ6PGLS.cjs.map
3
+ //# sourceMappingURL=chunk-NAZ6PGLS.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/errors/EngineError.ts","../src/errors/Result.ts","../src/errors/ErrorCode.ts"],"names":["ErrorCategory","EngineError","_EngineError","category","init","chain","current","lines","ErrorFactory","_ErrorFactory","defaultRecoverable","codeOrInit","message","context","normalizeUnknownError","error","ok","value","err","isOk","r","isErr","map","fn","mapErr","andThen","unwrapOr","fallback","match","arms","combine","results","values","throwIfErr","tryCatch","normalize","e","tryCatchAsync","CoreErrorCodes"],"mappings":"aA6BO,IAAKA,OAEVA,CAAAA,CAAA,OAAA,CAAU,SAAA,CAEVA,CAAAA,CAAA,UAAY,WAAA,CAEZA,CAAAA,CAAA,UAAA,CAAa,YAAA,CAEbA,EAAA,QAAA,CAAW,UAAA,CAEXA,CAAAA,CAAA,QAAA,CAAW,WAEXA,CAAAA,CAAA,MAAA,CAAS,QAAA,CAZCA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,IAmECC,CAAAA,CAAN,MAAMC,CAAAA,SAAoB,KAAM,CAsBrC,WAAA,CAAYC,CAAAA,CAAyBC,CAAAA,CAAuB,CAC1D,MAAMA,CAAAA,CAAK,OAAO,EAClB,IAAA,CAAK,IAAA,CAAO,cACZ,IAAA,CAAK,QAAA,CAA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AA,CAEjC,6BAAA,CAA+B,+BAAA,CAE/B,4BAA6B,6BAAA,CAE7B,mCAAA,CAAqC,qCAAA,CAErC,iCAAA,CAAmC,oCAEnC,sBAAA,CAAwB,wBAAA,CAExB,oBAAA,CAAsB,sBAAA,CAItB,0BAA2B,2BAAA,CAE3B,kBAAA,CAAoB,oBAAA,CAEpB,0BAAA,CAA4B,6BAG5B,qBAAA,CAAuB,uBAAA,CACvB,mBAAA,CAAqB,qBAAA,CACrB,yBAA0B,0BAAA,CAC1B,yBAAA,CAA2B,2BAAA,CAG3B,yBAAA,CAA2B,4BAC3B,wBAAA,CAA0B,0BAAA,CAC1B,qBAAA,CAAuB,uBAAA,CAEvB,gCAAiC,iCAAA,CAEjC,oCAAA,CAAsC,sCAAA,CAEtC,qBAAA,CAAuB,wBAEvB,oCAAA,CAAsC,sCAAA,CAEtC,+BAAA,CAAiC,iCAAA,CAGjC,kBAAmB,mBAAA,CACnB,qBAAA,CAAuB,wBAGvB,gBAAA,CAAkB,kBAAA,CAClB,cAAe,eACjB","file":"chunk-NAZ6PGLS.cjs","sourcesContent":["/**\n * The engine's structured error type, the \"Rust/Go-style, verbose, easy to\n * tell the issue\" half of the error-handling redesign (the other half is\n * `Result.ts`).\n *\n * Historical note: an earlier version of this class (`UnifiedErrorFramework.ts`,\n * still the import path most of the codebase uses. See that file, now a\n * pure re-export barrel) had a much larger field set (`severity`,\n * `recovery`, a 5-value enum, `ErrorRecoveryManager`) that was almost\n * entirely dead: nothing downstream ever read `.severity`/`.recovery`,\n * only `.message` reliably survived to a caller. This version is smaller\n * and deliberately keeps only fields something actually consumes.\n */\n\nimport type { ErrorCode } from \"@solve-js/errors/ErrorCode\";\n\n/** A character-offset (and optional line/col) span into the original expression text, for a future \"underline the offending token\" UI, not yet wired to one. */\nexport interface SourceSpan {\n start: number;\n end: number;\n line?: number;\n col?: number;\n}\n\n/**\n * Error classification, kept from the original framework, now actually\n * consulted: it's the `format()` header and lets host code group errors\n * by pipeline stage without string-matching `.code`.\n */\nexport enum ErrorCategory {\n /** Errors during expression parsing. */\n PARSING = \"PARSING\",\n /** Errors during bytecode execution. */\n EXECUTION = \"EXECUTION\",\n /** Errors from input validation (safety limits, config). */\n VALIDATION = \"VALIDATION\",\n /** Errors from external services/APIs (currency rates, weather, stocks). */\n EXTERNAL = \"EXTERNAL\",\n /** Internal engine invariant violations. See `recoverable`'s doc comment. */\n INTERNAL = \"INTERNAL\",\n /** Configuration errors. */\n CONFIG = \"CONFIG\",\n}\n\n/** Fields accepted when constructing an {@link EngineError}. */\nexport interface EngineErrorInit {\n /** Catalog code. See `errors/ErrorCode.ts`. Not a free string: every code used by a BUILT-IN package should be registered there so `ErrorCodeCatalog.spec.ts` can catch collisions/typos. Third-party packages may still use any string here, `EngineError.code`'s runtime type is `string`. */\n code: ErrorCode | (string & {});\n /** Short, single-line, `Error.message`-compatible. Existing `.toThrow(/pattern/)`/`.message` assertions keep working against this field, richer detail goes in `expected`/`found`/`suggestion`, not crammed into this string. */\n message: string;\n /** What the parser/validator/VM expected to see, in plain words, e.g. \"a city name\", \"a 4-digit year\", \"end of expression\". */\n expected?: string;\n /** What was actually found instead, e.g. \"end of expression\", `NUMBER \"5\"`, the offending token's literal text. */\n found?: string;\n /** An actionable, worked-example fix, e.g. `e.g. \"weather in London\"`. Mirrors this codebase's best existing messages (`WEATHER_EXPECTED_CITY`, `AS_CONVERTER_EXPECTED_NAME`). */\n suggestion?: string;\n /**\n * Whether this engine instance is still usable. `true` for everything that\n * went wrong on ONE line, whether the line's fault (bad syntax, an unknown\n * variable, a safety limit exceeded), the environment's (an external API\n * down), or the engine's own (corrupted bytecode, a stack underflow from a\n * buggy plugin). `false` is for the far rarer case where there is no working\n * engine to go on with: a configuration or package-registration failure,\n * which is what `ErrorFactory.config()` is for and the only factory method\n * that still defaults to it.\n *\n * The category answers a different question, and the two used to be answered\n * as one. Category INTERNAL says whose fault this is, the engine's, worth\n * reporting as a bug. `recoverable` says whether the host may carry on, and\n * after an internal slip on one line it may:\n * `__tests__/hardening/RobustnessEngineLifecycle.spec.ts` alternates a\n * throwing line with a good one five hundred times and every answer stays\n * correct. Reporting that as `isFatal()` told a host the opposite, and a host\n * that honours the name would tear a document down over one bad line.\n *\n * This has never gated \"does evaluation of the rest of the document\n * continue\"; with this engine's per-line containment it always does, even for\n * a `recoverable: false` error (see `ARCHITECTURE.md`'s async-batcher/Tier-2\n * hardening notes). It gates what a host is TOLD. See\n * {@link EngineError.isFatal}.\n */\n recoverable?: boolean;\n /** Character-offset span into the source expression, when available. Not yet threaded through every call site, populate opportunistically, don't block on retrofitting every existing throw site. */\n span?: SourceSpan;\n /** Free-form structured context. The one field the pre-existing framework's real consumer (`ThreeTierEvaluator.ts`'s DAG-preservation-on-compile-error path) actually reads, kept name- and shape-compatible on purpose. */\n context?: Record<string, unknown>;\n /** The underlying error this one wraps, if any, passed straight through to native `Error.cause` (ES2022), so Node's default printer, most loggers, and `instanceof Error` tooling understand the chain for free. */\n cause?: unknown;\n}\n\n/**\n * The engine's structured error type. Still a real `Error` subclass (so\n * `throw`/`catch`/`instanceof Error` all keep working exactly as before),\n * but now every field except the removed `severity`/`recovery` pair is\n * something real code reads.\n */\nexport class EngineError extends Error {\n readonly category: ErrorCategory;\n readonly code: string;\n readonly expected?: string;\n readonly found?: string;\n readonly suggestion?: string;\n readonly recoverable: boolean;\n readonly span?: SourceSpan;\n readonly context?: Record<string, unknown>;\n readonly timestamp: Date;\n /**\n * Set explicitly (not via `super(message, {cause})`). This repo's\n * `tsconfig.json` targets ES6/ES5-ES7 lib, which predates TypeScript's\n * ES2022 `Error` constructor `cause`-option overload. `Error.prototype.cause`\n * is still a real runtime feature in every target this engine actually\n * runs in (Node 16.9+, all evergreen browsers, Electron/Obsidian's\n * bundled Chromium) regardless of the TS lib target used to type-check\n * against it, assigning it directly gets the same Node-printer/logger\n * interop with no build-config change needed.\n */\n readonly cause?: unknown;\n\n constructor(category: ErrorCategory, init: EngineErrorInit) {\n super(init.message);\n this.name = \"EngineError\";\n this.category = category;\n this.code = init.code;\n this.expected = init.expected;\n this.found = init.found;\n this.suggestion = init.suggestion;\n this.recoverable = init.recoverable ?? true;\n this.span = init.span;\n this.context = init.context;\n this.cause = init.cause;\n this.timestamp = new Date();\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, EngineError);\n }\n }\n\n /** `!recoverable`. See `EngineErrorInit.recoverable`'s doc comment for what this actually gates (message framing/telemetry, not whether evaluation continues). */\n isFatal(): boolean {\n return !this.recoverable;\n }\n\n /** Walk `.cause` repeatedly, collecting the full chain (this error first). */\n causeChain(): unknown[] {\n const chain: unknown[] = [this];\n let current: unknown = this.cause;\n while (current !== undefined && current !== null) {\n chain.push(current);\n current = current instanceof Error ? (current as Error & { cause?: unknown }).cause : undefined;\n }\n return chain;\n }\n\n /**\n * Rust/Go-style multi-line renderer, the NEW thing a host/CLI/test\n * reaches for when it wants the full, verbose picture, as distinct from\n * `.message` (kept short and stable for existing assertions). Example:\n *\n * ```\n * error[WEATHER_EXPECTED_CITY]: Expected a city name after \"weather in\"\n * expected: a city name\n * found: end of expression\n * suggestion: e.g. \"weather in London\"\n * ```\n */\n format(): string {\n const lines = [`error[${this.code}]: ${this.message}`];\n if (this.expected) lines.push(` expected: ${this.expected}`);\n if (this.found) lines.push(` found: ${this.found}`);\n if (this.suggestion) lines.push(` suggestion: ${this.suggestion}`);\n return lines.join(\"\\n\");\n }\n\n toJSON(): Record<string, unknown> {\n return {\n name: this.name,\n category: this.category,\n code: this.code,\n message: this.message,\n expected: this.expected,\n found: this.found,\n suggestion: this.suggestion,\n recoverable: this.recoverable,\n span: this.span,\n context: this.context,\n timestamp: this.timestamp.toISOString(),\n };\n }\n}\n\n/**\n * Factory for creating classified `EngineError`s. Every method accepts\n * EITHER the original, minimal 3-arg shape (`code, message, context?`\n * every existing call site across the codebase keeps compiling unchanged)\n * OR the richer `EngineErrorInit` object (for `expected`/`found`/\n * `suggestion`/`recoverable`/`span`/`cause`), upgrade a call site to the\n * richer form only when you're already touching it, no separate churn\n * pass required.\n */\nexport class ErrorFactory {\n private static build(\n category: ErrorCategory,\n defaultRecoverable: boolean,\n codeOrInit: string | EngineErrorInit,\n message?: string,\n context?: Record<string, unknown>,\n ): EngineError {\n const init: EngineErrorInit =\n typeof codeOrInit === \"string\"\n ? { code: codeOrInit, message: message!, context }\n : codeOrInit;\n return new EngineError(category, { recoverable: defaultRecoverable, ...init });\n }\n\n static validation(code: string, message: string, context?: Record<string, unknown>): EngineError;\n static validation(init: EngineErrorInit): EngineError;\n static validation(codeOrInit: string | EngineErrorInit, message?: string, context?: Record<string, unknown>): EngineError {\n return ErrorFactory.build(ErrorCategory.VALIDATION, true, codeOrInit, message, context);\n }\n\n static parsing(code: string, message: string, context?: Record<string, unknown>): EngineError;\n static parsing(init: EngineErrorInit): EngineError;\n static parsing(codeOrInit: string | EngineErrorInit, message?: string, context?: Record<string, unknown>): EngineError {\n return ErrorFactory.build(ErrorCategory.PARSING, true, codeOrInit, message, context);\n }\n\n static execution(code: string, message: string, context?: Record<string, unknown>): EngineError;\n static execution(init: EngineErrorInit): EngineError;\n static execution(codeOrInit: string | EngineErrorInit, message?: string, context?: Record<string, unknown>): EngineError {\n return ErrorFactory.build(ErrorCategory.EXECUTION, true, codeOrInit, message, context);\n }\n\n static external(code: string, message: string, context?: Record<string, unknown>): EngineError;\n static external(init: EngineErrorInit): EngineError;\n static external(codeOrInit: string | EngineErrorInit, message?: string, context?: Record<string, unknown>): EngineError {\n return ErrorFactory.build(ErrorCategory.EXTERNAL, true, codeOrInit, message, context);\n }\n\n /**\n * Reserve for genuine engine-internal invariant violations (corrupted\n * bytecode, a stack underflow from a buggy plugin, an \"impossible\" state),\n * not for user-input errors: the category is a bug report.\n *\n * Defaults `recoverable: true` all the same, because every one of these sites\n * is an invariant that failed on ONE line and none of them leaves the engine\n * unusable. This used to default to `false`, which conflated \"the engine's\n * fault\" with \"the engine is finished\" and told a host to tear a document\n * down over a line it could simply have shown an error against. A site that\n * has looked at its own case and concluded the instance really is gone can\n * still pass `recoverable: false` explicitly. See {@link\n * EngineErrorInit.recoverable}.\n */\n static internal(code: string, message: string, context?: Record<string, unknown>): EngineError;\n static internal(init: EngineErrorInit): EngineError;\n static internal(codeOrInit: string | EngineErrorInit, message?: string, context?: Record<string, unknown>): EngineError {\n return ErrorFactory.build(ErrorCategory.INTERNAL, true, codeOrInit, message, context);\n }\n\n /** Defaults `recoverable: false`, and is now the only method that does: a configuration or package-registration failure is the one class that leaves no working engine to carry on with, rather than one bad line in a document. */\n static config(code: string, message: string, context?: Record<string, unknown>): EngineError;\n static config(init: EngineErrorInit): EngineError;\n static config(codeOrInit: string | EngineErrorInit, message?: string, context?: Record<string, unknown>): EngineError {\n return ErrorFactory.build(ErrorCategory.CONFIG, false, codeOrInit, message, context);\n }\n}\n\n/**\n * Normalize any thrown value into an `EngineError`, an `EngineError`\n * passes through as-is; a plain `Error` gets wrapped (message preserved,\n * original attached via `cause`); anything else becomes a generic\n * \"unknown error\" wrapping the stringified value. Used at every\n * throw-space/Result-space boundary (`Result.tryCatch`'s default\n * `normalize`, the VM's outer execution try/catch, `AsyncResolutionBatcher`'s\n * per-line containment) so a raw `TypeError` from a genuine engine bug\n * still surfaces as a structured, catalogued error instead of an opaque\n * uncaught exception.\n *\n * Both branches state RECOVERABLE explicitly, while keeping the INTERNAL\n * category. The two fields answer different questions and were previously\n * answering the same one:\n *\n * category INTERNAL whose fault is this? The engine's. Worth reporting.\n * recoverable is this engine instance still usable? Yes.\n *\n * Everything reaching here is by definition something the engine did not\n * anticipate on ONE line, and per-line containment means the next line\n * evaluates normally, which `__tests__/hardening/RobustnessEngineLifecycle`\n * demonstrates over hundreds of alternating failure/success pairs. Reporting\n * that as `isFatal()` told a host the opposite, and a host that honours the\n * name would tear a document down over a single bad line. The \"this is an\n * engine bug rather than your syntax\" signal a caller wants for telemetry is\n * the CATEGORY, which is unchanged.\n *\n * The flag is written out here rather than inherited from\n * `ErrorFactory.internal()`, which now defaults the same way, so that this\n * function's contract survives a future change to that default.\n */\nexport function normalizeUnknownError(error: unknown): EngineError {\n if (error instanceof EngineError) return error;\n if (error instanceof Error) {\n return ErrorFactory.internal({\n code: \"UNEXPECTED_ERROR\",\n message: error.message,\n context: { originalErrorName: error.name },\n cause: error,\n recoverable: true,\n });\n }\n return ErrorFactory.internal({\n code: \"UNKNOWN_ERROR\",\n message: \"An unknown error occurred\",\n context: { error: String(error) },\n recoverable: true,\n });\n}\n","import { type EngineError, normalizeUnknownError } from \"@solve-js/errors/EngineError\";\n\n/**\n * A Rust-style `Result<T, E>`, the value half of this engine's error-handling\n * redesign. `E` defaults to `EngineError` (this engine's structured error\n * type) but every combinator here is generic over `E`, so `Result` works\n * equally well for a domain that isn't `EngineError`-shaped.\n *\n * This exact shape used to live in `errors/UnifiedErrorFramework.ts` (kept\n * there as a barrel re-export for backward compatibility), moved here as\n * its own module because it's genuinely generic (no dependency on\n * `EngineError` beyond the default type parameter) and because the engine\n * is migrating callers to it incrementally: parsing/VM/package code that\n * expects \"a failure is a possibility, not an exception\" returns\n * `Result<T, EngineError>` instead of throwing; two explicit adapters\n * {@link throwIfErr} and {@link tryCatch}, are the sanctioned way to cross\n * the boundary between Result-based code and still-throw-based code during\n * the migration (and permanently, at the public API boundary. See\n * `ExpressionEngine.evaluateExpression()`'s documented throw contract).\n */\nexport type Result<T, E = EngineError> =\n | { ok: true; value: T }\n | { ok: false; error: E };\n\n/** Wrap a successful value. */\nexport function ok<T>(value: T): Result<T, never> {\n return { ok: true, value };\n}\n\n/** Wrap a failure. */\nexport function err<E>(error: E): Result<never, E> {\n return { ok: false, error };\n}\n\n/**\n * Narrow a {@link Result} to its success arm.\n *\n * @param r - The result to test.\n * @returns True when it succeeded, narrowing `r` so `r.value` is reachable.\n */\nexport function isOk<T, E>(r: Result<T, E>): r is { ok: true; value: T } {\n return r.ok;\n}\n\n/**\n * Narrow a {@link Result} to its failure arm.\n *\n * @param r - The result to test.\n * @returns True when it failed, narrowing `r` so `r.error` is reachable.\n */\nexport function isErr<T, E>(r: Result<T, E>): r is { ok: false; error: E } {\n return !r.ok;\n}\n\n/** Transform the success value; a failure passes through untouched. */\nexport function map<T, U, E>(r: Result<T, E>, fn: (value: T) => U): Result<U, E> {\n return r.ok ? ok(fn(r.value)) : r;\n}\n\n/** Transform the error; a success passes through untouched. */\nexport function mapErr<T, E, F>(r: Result<T, E>, fn: (error: E) => F): Result<T, F> {\n return r.ok ? r : err(fn(r.error));\n}\n\n/** Chain a Result-returning operation onto a success (a.k.a. flatMap/bind). */\nexport function andThen<T, U, E>(r: Result<T, E>, fn: (value: T) => Result<U, E>): Result<U, E> {\n return r.ok ? fn(r.value) : r;\n}\n\n/** Unwrap a success, or return `fallback` for a failure. Never throws. */\nexport function unwrapOr<T, E>(r: Result<T, E>, fallback: T): T {\n return r.ok ? r.value : fallback;\n}\n\n/** Exhaustive pattern-match, the `match`/`switch` a Rust enum gets for free. */\nexport function match<T, E, R>(r: Result<T, E>, arms: { ok: (value: T) => R; err: (error: E) => R }): R {\n return r.ok ? arms.ok(r.value) : arms.err(r.error);\n}\n\n/**\n * Combine several Results into one, succeeds with a tuple of all values\n * iff every input succeeded; otherwise fails with the FIRST error\n * encountered (left-to-right), matching this codebase's existing\n * fail-fast convention elsewhere (e.g. `BytecodeBuilder`'s constant-pool\n * limit checks).\n */\nexport function combine<T extends readonly unknown[], E>(\n results: { [K in keyof T]: Result<T[K], E> },\n): Result<T, E> {\n const values: unknown[] = [];\n for (const r of results as readonly Result<unknown, E>[]) {\n if (!r.ok) return r;\n values.push(r.value);\n }\n return ok(values as unknown as T);\n}\n\n/**\n * Cross from Result-space back to throw-space, the sanctioned boundary\n * adapter for callers (public API surface, older not-yet-migrated code,\n * tests) that still want exception-based control flow. Throws `r.error`\n * as-is (an `EngineError` is already a real `Error` subclass, so this\n * needs no wrapping).\n */\nexport function throwIfErr<T, E>(r: Result<T, E>): T {\n if (r.ok) return r.value;\n throw r.error;\n}\n\n/**\n * Cross from throw-space into Result-space, runs `fn`, converting any\n * thrown value into a Result via `normalize` (defaults to\n * {@link normalizeUnknownError}). The inverse of {@link throwIfErr}; the\n * pairing that lets Result-based and throw-based code interoperate during\n * an incremental migration instead of requiring a single flag-day rewrite.\n */\nexport function tryCatch<T>(\n fn: () => T,\n normalize: (e: unknown) => EngineError = normalizeUnknownError,\n): Result<T, EngineError> {\n try {\n return ok(fn());\n } catch (e) {\n return err(normalize(e));\n }\n}\n\n/** Async sibling of {@link tryCatch}. */\nexport async function tryCatchAsync<T>(\n fn: () => Promise<T>,\n normalize: (e: unknown) => EngineError = normalizeUnknownError,\n): Promise<Result<T, EngineError>> {\n try {\n return ok(await fn());\n } catch (e) {\n return err(normalize(e));\n }\n}\n","/**\n * The built-in error-code catalog, one typed const object per domain\n * unioned together here for autocomplete/exhaustiveness in core engine\n * code. Deliberately NOT one central enum: `IEnginePackage` is documented\n * public SDK surface for third-party packages (see `api/PackageRegistry.ts`),\n * and a closed enum would block an external package author from defining\n * their own codes without editing this file. `EngineError.code`'s runtime\n * type stays `string` for exactly that reason. This catalog is for the\n * codes THIS repo owns and wants collision/typo checking on (see\n * `__tests__/errors/ErrorCodeCatalog.spec.ts`), not a hard runtime\n * whitelist.\n *\n * As each package migrates to `Result<void, EngineError>` (see this\n * session's error-handling-refactor plan, Phase 5), it should export its\n * own small `XxxErrorCodes` const object co-located with its parselets\n * exactly like `CoreErrorCodes` below, just scoped to one domain, and get\n * unioned into `ErrorCode` here. Until a package migrates, its existing\n * free-string codes keep working (ErrorFactory accepts any string); they\n * just aren't caught by the catalog's uniqueness/orphan checks yet.\n */\n\n/**\n * Codes used directly by the parser/VM/engine/errors layers themselves\n * confirmed against the current source, not aspirational. Grouped by\n * pipeline stage via the comments, not a naming prefix (these predate any\n * naming convention and renaming them is out of scope for introducing the\n * catalog, only NEW codes need to follow a scoped/prefixed style, see\n * `STACK_UNDERFLOW` etc. below).\n */\nexport const CoreErrorCodes = {\n // ── Parser (parser/PrecedenceParser.ts, parser/BytecodeBuilder.ts, parser/PhrasePattern.ts) ──\n INVALID_NUMBER_LITERAL: \"INVALID_NUMBER_LITERAL\",\n /** A `\"` that never meets its closing partner (`lexer/ExpressionLexer.ts`'s `tokenizeString()`). Previously the tokenizer ran off the end of the input and returned what it had, so `\"abc` lexed to an ordinary String and an unterminated literal was indistinguishable from a terminated one. */\n UNTERMINATED_STRING: \"UNTERMINATED_STRING\",\n NO_PREFIX_PARSELET: \"NO_PREFIX_PARSELET\",\n UNEXPECTED_END_OF_INPUT: \"UNEXPECTED_END_OF_INPUT\",\n UNEXPECTED_TOKEN_TYPE: \"UNEXPECTED_TOKEN_TYPE\",\n NESTING_DEPTH_EXCEEDED: \"NESTING_DEPTH_EXCEEDED\",\n UNEXPECTED_END: \"UNEXPECTED_END\",\n UNEXPECTED_TRAILING_TOKEN: \"UNEXPECTED_TRAILING_TOKEN\",\n PARSE_ERROR: \"PARSE_ERROR\",\n TOO_MANY_NUMERIC_CONSTANTS: \"TOO_MANY_NUMERIC_CONSTANTS\",\n TOO_MANY_STRING_CONSTANTS: \"TOO_MANY_STRING_CONSTANTS\",\n NO_MATCHING_PHRASE_ALTERNATIVE: \"NO_MATCHING_PHRASE_ALTERNATIVE\",\n INVALID_PHRASE_PATTERN: \"INVALID_PHRASE_PATTERN\",\n PHRASE_KEYWORD_MISMATCH: \"PHRASE_KEYWORD_MISMATCH\",\n /** User-defined-function definition parsing (`f(x, y) = ...`), an invalid token where a parameter name was expected. */\n USER_FUNCTION_INVALID_PARAM_NAME: \"USER_FUNCTION_INVALID_PARAM_NAME\",\n /** `f() = ...` with zero parameters, indistinguishable from a plain no-arg function call, so rejected at definition time. */\n USER_FUNCTION_NO_PARAMS: \"USER_FUNCTION_NO_PARAMS\",\n /** A user-defined function body calling an async plugin (weather/stocks/currency/...), rejected at definition time; v1 scope excludes async function bodies. */\n FUNCTION_BODY_MUST_BE_SYNCHRONOUS: \"FUNCTION_BODY_MUST_BE_SYNCHRONOUS\",\n /** `BytecodeBuilder`'s `userFunctionBodies` side-table exceeding its capacity. Same class as `TOO_MANY_NUMERIC_CONSTANTS`/`TOO_MANY_STRING_CONSTANTS` below. */\n TOO_MANY_FUNCTION_DEFINITIONS: \"TOO_MANY_FUNCTION_DEFINITIONS\",\n /** `BytecodeBuilder`'s `anonymousBodies` side-table (map/reduce inline transform bodies) exceeding its capacity. Same class as `TOO_MANY_FUNCTION_DEFINITIONS` above. */\n TOO_MANY_ANONYMOUS_BODIES: \"TOO_MANY_ANONYMOUS_BODIES\",\n /** New with the 2.0 descriptor redesign: a parselet emits a plugin call by NAME (`BytecodeBuilder.emitPluginCall(name, argCount)`) and the engine resolves that name to the index it assigned at registration. This fires when the name is absent from the builder's name->index map: the package used a `pluginFunctions` name it never declared, or the expression was parsed before that package registered. Not a user-input error; a package-authoring/registration fault. See `parser/BytecodeBuilder.ts`'s `emitPluginCall()`. */\n UNKNOWN_PLUGIN_FUNCTION: \"UNKNOWN_PLUGIN_FUNCTION\",\n\n // ── VM (vm/VM.ts, vm/OpRegistry.ts, vm/VMBuiltins.ts) ──\n EVALUATION_ERROR: \"EVALUATION_ERROR\",\n INSTRUCTION_LIMIT_EXCEEDED: \"INSTRUCTION_LIMIT_EXCEEDED\",\n STACK_LIMIT_EXCEEDED: \"STACK_LIMIT_EXCEEDED\",\n /** One evaluation asking for more elements (collection Values, matrix cells) than `vm.maxAllocatedElements` allows. The counter the two limits above cannot be: both are checked between opcodes, so neither can see what a single opcode allocates inside a loop of its own. See `vm/AllocationBudget.ts`. Recoverable, since it describes this expression rather than the engine. */\n ALLOCATION_LIMIT_EXCEEDED: \"ALLOCATION_LIMIT_EXCEEDED\",\n /** New this phase. See `VM.ts`'s `safePop()`: a stack-underflow (corrupted bytecode, a buggy plugin) is now a controlled EngineError instead of a raw TypeError. Category INTERNAL, since it is an engine or plugin fault rather than a typed line, but recoverable: it happened on one line and the engine is still usable. */\n STACK_UNDERFLOW: \"STACK_UNDERFLOW\",\n UNDEFINED_VARIABLE: \"UNDEFINED_VARIABLE\",\n /** New this phase, the Tier-2/`LOAD_GLOBAL_VAR` hardening: a global variable read before its async preflight resolved, surfaced as a controlled error instead of pushing `undefined`. */\n GLOBAL_VARIABLE_NOT_RESOLVED: \"GLOBAL_VARIABLE_NOT_RESOLVED\",\n UNKNOWN_FUNCTION: \"UNKNOWN_FUNCTION\",\n /** `unwrapEvalResult()`'s pending-when-expecting-value case, a caller-contract violation, not user-input. */\n UNEXPECTED_PENDING_RESULT: \"UNEXPECTED_PENDING_RESULT\",\n /** User-defined-function call/definition errors (`CALL_USER_FUNCTION`/`DEFINE_USER_FUNCTION` opcodes), calling a name with no matching definition, calling with the wrong argument count, and the deliberate v1 restriction that a function body can't itself contain async work. */\n UNDEFINED_FUNCTION: \"UNDEFINED_FUNCTION\",\n FUNCTION_ARITY_MISMATCH: \"FUNCTION_ARITY_MISMATCH\",\n /** The same mistake against a BUILT-IN rather than a user-defined function (`sqrt()`, `atan2(1)`, `sqrt(1,2,3)`). Separate from `FUNCTION_ARITY_MISMATCH` above because the two are raised by different opcodes and a host may want to word them differently. Checked at the `CALL_BUILTIN` dispatch against `vm/VMBuiltinArity.ts`; recoverable, since it is a typo in the line, not an engine fault. */\n BUILTIN_ARITY_MISMATCH: \"BUILTIN_ARITY_MISMATCH\",\n USER_FUNCTION_ASYNC_UNSUPPORTED: \"USER_FUNCTION_ASYNC_UNSUPPORTED\",\n /** A map/reduce transform body (inline expression or user-defined function) calling an async plugin. Same v1 scope restriction as `USER_FUNCTION_ASYNC_UNSUPPORTED` above, enforced both at parse time (`MAP_REDUCE_TRANSFORM_MUST_BE_SYNCHRONOUS`, packages/mapreduce/) and as a defense-in-depth runtime backstop here. */\n MAP_REDUCE_ASYNC_UNSUPPORTED: \"MAP_REDUCE_ASYNC_UNSUPPORTED\",\n /** An algebra verb's expression argument (`BIND_UNKNOWN`'s body) calling an async plugin. Same v1 scope restriction as the two above, and likewise refused at parse time first (`SYMBOLIC_ARGUMENT_MUST_BE_SYNCHRONOUS`, packages/symbolic/). */\n SYMBOLIC_ASYNC_UNSUPPORTED: \"SYMBOLIC_ASYNC_UNSUPPORTED\",\n /** `explainLine()` asked to derive a line that resolves data asynchronously (a live-data or async-plugin line). A derivation is a sequence of settled intermediate values, which a pending result has none of, so the line is refused rather than explained with a hole in it. */\n EXPLAIN_ASYNC_UNSUPPORTED: \"EXPLAIN_ASYNC_UNSUPPORTED\",\n /** `pushCallFrame()`'s recursion guard, a nested `CALL_USER_FUNCTION` re-enters `executeBytecode()`, so `maxInstructions` alone can't catch e.g. `f(x) = f(x)`; this is the dedicated backstop. `recoverable: true` (the default for `.execution()`), ordinary user-written infinite recursion, not an engine bug; the guard exists precisely so it surfaces as a clear error instead of overflowing the native call stack uncatchably. */\n FUNCTION_RECURSION_LIMIT_EXCEEDED: \"FUNCTION_RECURSION_LIMIT_EXCEEDED\",\n /** The companion to the code above, and the half it could never see: how MANY user-defined-function calls one evaluation makes, rather than how deeply they nest. A twenty-two-line doubling chain nests twenty-two deep (legal) and makes two million calls (a fatal heap abort). Counted in `vm/AllocationBudget.ts`, because the tally has to survive `executeBytecode()` re-entering itself. Recoverable. */\n FUNCTION_CALL_LIMIT_EXCEEDED: \"FUNCTION_CALL_LIMIT_EXCEEDED\",\n /** A `<date> + N workdays` offset outside `date.maxOffsetYears`/`minOffsetYears`. Workdays are the one date offset that walks the calendar a day at a time, so the one whose cost is the offset; every other one moves a Date field once. Recoverable. */\n DATE_OFFSET_LIMIT_EXCEEDED: \"DATE_OFFSET_LIMIT_EXCEEDED\",\n /** The anchor of `N working days after/before/from <expr>` was not a date (e.g. `5 working days after 3`). The grammar guarantees the count is a number, so this only fires on the anchor. Emitted as a recoverable Error value, not thrown, matching the datetime package's other type guards. See `vm/VM.ts`'s `DATE_WORKDAY_OFFSET` case. */\n WORKDAY_OFFSET_EXPECTED_DATE: \"WORKDAY_OFFSET_EXPECTED_DATE\",\n /** An endpoint of `working days between <expr> and <expr>` was not a date. Recoverable Error value. See `vm/VM.ts`'s `DATE_WORKDAYS_BETWEEN` case. */\n WORKDAYS_BETWEEN_EXPECTED_DATES: \"WORKDAYS_BETWEEN_EXPECTED_DATES\",\n /** The two endpoints of `working days between <expr> and <expr>` are further apart than `date.maxOffsetYears`/`minOffsetYears` allow the count's calendar walk to run. Recoverable Error value, the between-count's equivalent of `DATE_OFFSET_LIMIT_EXCEEDED`. See `vm/VM.ts`'s `DATE_WORKDAYS_BETWEEN` case. */\n WORKDAYS_BETWEEN_RANGE_TOO_LARGE: \"WORKDAYS_BETWEEN_RANGE_TOO_LARGE\",\n /** A `<<`/`>>` with a bigint operand whose exact result would pass `MAX_EXACT_SHIFT_BITS`, whichever operand is the bigint. Both spellings refuse as of 1.0.0: a bigint on the left used to fall through to `x * 2^n` in doubles and report a 19,870-digit integer as Infinity. See `vm/VM.ts`'s `bigIntShift()`. Recoverable. */\n BIGINT_SHIFT_LIMIT_EXCEEDED: \"BIGINT_SHIFT_LIMIT_EXCEEDED\",\n /** The same ceiling for `^`, the operator it was written for: `2n ^ 100000` asks for the same 100,001-bit integer `1n << 100000` does, so the two spellings answer the same way. Also new in 1.0.0, and for the same reason: this used to fall through to the double path and answer Infinity. A fractional or negative exponent (`4n ^ 0.5`, `2n ^ -1`) has no exact answer to bound and still uses the double path. See `vm/VM.ts`'s `MAX_EXACT_POW_BITS`. Recoverable. */\n BIGINT_POW_LIMIT_EXCEEDED: \"BIGINT_POW_LIMIT_EXCEEDED\",\n /** An operand with no whole-number form (a fraction, an infinity, a NaN) meeting a bigint: `1n + 0.5`, `1n & 1.5`, `5n/pi`. `BigInt()` answers those with a raw RangeError, which the VM relabelled UNEXPECTED_ERROR, so a typo in the line was reported as an engine fault. Recoverable; see `vm/VMConversion.ts`'s `toBigIntOperand()`. */\n BIGINT_INEXACT_OPERAND: \"BIGINT_INEXACT_OPERAND\",\n /** `10n / 0n` and `10n mod 0n`. Deliberately NOT what `1 / 0` does, which is Infinity: a bigint division is exact integer division (`7n / 2n` is 3n), and integer division by zero has no answer, exactly as it has none in C, Java, Python or JavaScript's own BigInt. Previously V8's own RangeError, relabelled UNEXPECTED_ERROR. Recoverable; see `vm/VMConversion.ts`'s `bigIntDivisionByZero()`. */\n BIGINT_DIVISION_BY_ZERO: \"BIGINT_DIVISION_BY_ZERO\",\n /** `DEFINE_USER_FUNCTION`'s body-index lookup failing, a compiler/VM invariant violation (the opcode stream referenced a `userFunctionBodies` slot that doesn't exist), never a user-input error. */\n INTERNAL_MISSING_FUNCTION_BODY: \"INTERNAL_MISSING_FUNCTION_BODY\",\n /** `MAP_INVOKE`/`REDUCE_INVOKE`'s anonymous-body-index lookup failing. Same class as `INTERNAL_MISSING_FUNCTION_BODY` above, for the `anonymousBodies` side-table instead of `userFunctionBodies`. */\n INTERNAL_MISSING_ANONYMOUS_BODY: \"INTERNAL_MISSING_ANONYMOUS_BODY\",\n\n // ── Malformed bytecode on the public `./vm` surface (vm/VM.ts) ──\n //\n // `executeBytecode` is exported, so a bytecode program is caller input in\n // the same sense an expression string is, and these five say so. They are\n // VALIDATION rather than INTERNAL for exactly that reason: before they\n // existed, every one of these cases reached a raw TypeError (`BigInt(undefined)`,\n // `code.toUpperCase()` on a boolean, destructuring a program that was not\n // there), which normalised to UNEXPECTED_ERROR and told the caller the\n // engine was broken when their eleven bytes were. Reachable from ordinary\n // source only through a compiler bug, which is why the messages name the\n // opcode and the operand rather than the user's line.\n /** An operand byte read past the end of the stream: the program ends in the middle of an instruction. */\n MALFORMED_BYTECODE_TRUNCATED: \"MALFORMED_BYTECODE_TRUNCATED\",\n /** A constant-pool operand indexing a `numbers`/`strings` entry that does not exist, or that is not of the pool's type. */\n MALFORMED_BYTECODE_CONSTANT_INDEX: \"MALFORMED_BYTECODE_CONSTANT_INDEX\",\n /** A unit or converter name read off the value stack that is not a string. Distinct from the pool case above: the operand is a Value another opcode pushed, not a pool entry. */\n MALFORMED_BYTECODE_OPERAND_TYPE: \"MALFORMED_BYTECODE_OPERAND_TYPE\",\n /** `MAP_INVOKE`/`REDUCE_INVOKE` carrying a body kind other than 0/1/2. Used to fall through every arm with no body and recurse into `executeBytecode(undefined)`. */\n MALFORMED_BYTECODE_BODY_KIND: \"MALFORMED_BYTECODE_BODY_KIND\",\n /** A `PUSH_BIGINT` pool entry that is not a whole number, e.g. `\"1.000\"`. `BigInt()` answers that with a raw SyntaxError. */\n MALFORMED_BYTECODE_BIGINT_LITERAL: \"MALFORMED_BYTECODE_BIGINT_LITERAL\",\n /** `executeBytecode()` called with something that is not a runnable program at all. Checked before the destructure that used to throw outside the function's own try/catch. */\n MALFORMED_BYTECODE_PROGRAM: \"MALFORMED_BYTECODE_PROGRAM\",\n\n // ── Symbolic algebra (symbolic/, vm/SymbolicOps.ts) ──\n /** A coefficient grew past `RATIONAL_MAX_BITS`, e.g. repeated exact elimination multiplying denominators together. */\n SYMBOLIC_RATIONAL_OVERFLOW: \"SYMBOLIC_RATIONAL_OVERFLOW\",\n /** `NaN` or `±Infinity` reaching a symbolic expression, neither of which has an exact rational value. */\n SYMBOLIC_NONFINITE_OPERAND: \"SYMBOLIC_NONFINITE_OPERAND\",\n /** Division by an exactly-zero rational. Exact, unlike the double comparison it replaced, which could not distinguish a true zero from `5.551e-17`. */\n SYMBOLIC_DIVISION_BY_ZERO: \"SYMBOLIC_DIVISION_BY_ZERO\",\n /** A tree exceeding `SYMBOLIC_MAX_NODES` entering the simplifier. */\n SYMBOLIC_NODE_LIMIT_EXCEEDED: \"SYMBOLIC_NODE_LIMIT_EXCEEDED\",\n /** A builtin with no symbolic reading (`min`, `random`, the finance block, ...) applied to an expression still containing an unknown. Returned rather than computing against `toNumber()`'s placeholder zero. */\n SYMBOLIC_UNSUPPORTED_FUNCTION: \"SYMBOLIC_UNSUPPORTED_FUNCTION\",\n /** The rational-root search exceeding `FACTOR_MAX_ROOT_CANDIDATES`. The candidate set is the product of two divisor sets, so a highly-composite coefficient escapes quickly. */\n SYMBOLIC_FACTOR_LIMIT_EXCEEDED: \"SYMBOLIC_FACTOR_LIMIT_EXCEEDED\",\n /** An equation outside what the solver attempts: not a polynomial, above the degree ceiling, or non-linear in the unknown while another unknown is present. */\n SYMBOLIC_SOLVE_UNSUPPORTED: \"SYMBOLIC_SOLVE_UNSUPPORTED\",\n /** Some but not all of an equation's roots were found. Reported rather than returned, because a partial list of roots looks exactly like a complete one. */\n SYMBOLIC_SOLVE_INCOMPLETE: \"SYMBOLIC_SOLVE_INCOMPLETE\",\n /** `solve`'s second argument not being a bare name. */\n SOLVE_REQUIRES_VARIABLE_NAME: \"SOLVE_REQUIRES_VARIABLE_NAME\",\n /** A derivative order outside 0..`DERIVATIVE_MAX_ORDER`. */\n SYMBOLIC_DERIVATIVE_ORDER_LIMIT: \"SYMBOLIC_DERIVATIVE_ORDER_LIMIT\",\n /** An expression with no known elementary antiderivative. Reported rather than approximated, since a wrong integral is indistinguishable from a right one at the point of use. */\n SYMBOLIC_INTEGRAL_UNSUPPORTED: \"SYMBOLIC_INTEGRAL_UNSUPPORTED\",\n /** A Taylor degree outside 0..`TAYLOR_MAX_DEGREE`. */\n SYMBOLIC_TAYLOR_DEGREE_LIMIT: \"SYMBOLIC_TAYLOR_DEGREE_LIMIT\",\n /** A Taylor coefficient that does not reduce to an exact number at the expansion point. */\n SYMBOLIC_TAYLOR_INEXACT: \"SYMBOLIC_TAYLOR_INEXACT\",\n /** An algebra verb's variable-name argument not being a bare name. */\n SYMBOLIC_REQUIRES_VARIABLE_NAME: \"SYMBOLIC_REQUIRES_VARIABLE_NAME\",\n /** `jacobian` called with expressions containing no unknown to differentiate against. */\n SYMBOLIC_JACOBIAN_NO_VARIABLES: \"SYMBOLIC_JACOBIAN_NO_VARIABLES\",\n /** A finite number whose decimal form could not be read back, which the regex covering every `Number.prototype.toString` output should make unreachable. */\n INTERNAL_RATIONAL_PARSE: \"INTERNAL_RATIONAL_PARSE\",\n\n // ── Engine (engine/ExpressionEngine.ts, engine/ExpressionEngineSafety.ts, engine/AsyncResolutionBatcher.ts) ──\n EXPRESSION_TOO_LONG: \"EXPRESSION_TOO_LONG\",\n EXPRESSION_TOO_COMPLEX: \"EXPRESSION_TOO_COMPLEX\",\n /** A document with more lines than `performance.maxDocumentLines`. The per-line limits above bound what one line may ask for and say nothing about how many lines there are; two hundred thousand of `1 + 1` exhausted the heap on the line records alone. Recoverable. */\n DOCUMENT_TOO_LARGE: \"DOCUMENT_TOO_LARGE\",\n NORMALIZED_TOKEN_LIMIT_EXCEEDED: \"NORMALIZED_TOKEN_LIMIT_EXCEEDED\",\n /** `\"=>\"` with nothing before it, needs an expression or variable name to solve/simplify. */\n THEREFORE_REQUIRES_EXPRESSION: \"THEREFORE_REQUIRES_EXPRESSION\",\n /** A `\"=>\"`-triggered expression called an async plugin (weather/stocks/currency). Same v1 scope restriction as user-function/map-reduce bodies. */\n THEREFORE_ASYNC_UNSUPPORTED: \"THEREFORE_ASYNC_UNSUPPORTED\",\n /** A compound assignment (`name += expr` / `name -= expr`) with nothing on the right, a line half-typed on the way to `total += 5`. */\n COMPOUND_ASSIGN_REQUIRES_EXPRESSION: \"COMPOUND_ASSIGN_REQUIRES_EXPRESSION\",\n /** A running total (`+= / -=`) whose right-hand side calls an async plugin (weather/stocks/currency). The same v1 scope restriction as the `\"=>\"` and user-function bodies. */\n COMPOUND_ASSIGN_ASYNC_UNSUPPORTED: \"COMPOUND_ASSIGN_ASYNC_UNSUPPORTED\",\n /** A savings-goal contribution period that is not one of daily/weekly/monthly/yearly (`how long to save $X at $Y <period>`). Names the accepted set. */\n UNKNOWN_SAVINGS_PERIOD: \"UNKNOWN_SAVINGS_PERIOD\",\n /** Colon-separated numbers that are not a time any clock can show (\"24:00\", \"9:60\", \"100:5\"). Raised by the labeled-line fallback, which used to answer them with whatever stood after the colon. */\n INVALID_TIME_LITERAL: \"INVALID_TIME_LITERAL\",\n\n // ── Snapshot / restore (engine/EngineSnapshot.ts, engine/ExpressionEngine.ts) ──\n /** `fromJSON()` handed an object that is not a snapshot at all, or whose serialised-shape version does not match this engine's reader. The versioning gate that refuses an incompatible snapshot clearly rather than restoring it wrongly. See `engine/EngineSnapshot.ts`'s `assertRestorable()`. */\n SNAPSHOT_VERSION_MISMATCH: \"SNAPSHOT_VERSION_MISMATCH\",\n /** A snapshot with the right envelope but internally inconsistent contents (an unrecognised number sentinel, an unknown value tag). Distinct from a version mismatch: the format is right, the payload is not. */\n SNAPSHOT_MALFORMED: \"SNAPSHOT_MALFORMED\",\n /** A value the v1 snapshot format cannot yet represent (a symbolic/algebra value, a symbolic matrix cell). Deferred to a follow-up; refused by name rather than dropped silently. */\n SNAPSHOT_UNSUPPORTED_VALUE: \"SNAPSHOT_UNSUPPORTED_VALUE\",\n\n // ── Config (constants/Configuration.ts) ──\n CONFIG_PATH_NOT_FOUND: \"CONFIG_PATH_NOT_FOUND\",\n INVALID_CONFIG_PATH: \"INVALID_CONFIG_PATH\",\n CONFIG_SECTION_NOT_FOUND: \"CONFIG_SECTION_NOT_FOUND\",\n CONFIG_PROPERTY_NOT_FOUND: \"CONFIG_PROPERTY_NOT_FOUND\",\n\n // ── Package/lexer registration-time collisions (lexer/ExpressionLexer.ts) ──\n PLUGIN_OPERATOR_COLLISION: \"PLUGIN_OPERATOR_COLLISION\",\n PLUGIN_KEYWORD_COLLISION: \"PLUGIN_KEYWORD_COLLISION\",\n PLUGIN_UNIT_COLLISION: \"PLUGIN_UNIT_COLLISION\",\n /** A package's declared `IEnginePackage.engineVersion` semver range doesn't satisfy the running engine's ENGINE_VERSION. See api/EngineVersionCompatibility.ts. */\n PACKAGE_ENGINE_VERSION_MISMATCH: \"PACKAGE_ENGINE_VERSION_MISMATCH\",\n /** A package's declared `IEnginePackage.engineVersion` isn't a parseable semver range at all (a typo in the package's own descriptor). */\n PACKAGE_ENGINE_VERSION_INVALID_RANGE: \"PACKAGE_ENGINE_VERSION_INVALID_RANGE\",\n /** `OpRegistry.allocateOpcode()`'s dynamic opcode pool (started at 201) exhausted, too many packages calling it. */\n OPCODE_POOL_EXHAUSTED: \"OPCODE_POOL_EXHAUSTED\",\n /** `VMBuiltins.allocatePluginFunctionIndex()`'s index pool (up to 65536, two opcode-stream bytes) exhausted. */\n PLUGIN_FUNCTION_INDEX_POOL_EXHAUSTED: \"PLUGIN_FUNCTION_INDEX_POOL_EXHAUSTED\",\n /** A plugin-function index exceeds the two-byte (65535) `CALL_PLUGIN_WIDE` bytecode operand. */\n PLUGIN_FUNCTION_INDEX_TOO_LARGE: \"PLUGIN_FUNCTION_INDEX_TOO_LARGE\",\n\n // ── vm/Value.ts caller-contract violations (check isRateUnit()/isTimecodeUnit() first) ──\n INVALID_RATE_UNIT: \"INVALID_RATE_UNIT\",\n INVALID_TIMECODE_UNIT: \"INVALID_TIMECODE_UNIT\",\n\n // ── errors/EngineError.ts's own fallback normalization ──\n UNEXPECTED_ERROR: \"UNEXPECTED_ERROR\",\n UNKNOWN_ERROR: \"UNKNOWN_ERROR\",\n} as const;\n\n/** Every error code the engine's own layers can produce, from {@link CoreErrorCodes}. */\nexport type CoreErrorCode = (typeof CoreErrorCodes)[keyof typeof CoreErrorCodes];\n\n/**\n * The aggregated catalog type. Currently just `CoreErrorCode`, union in\n * each package's own code-object type here as Phase 5 converts it, e.g.\n * `CoreErrorCode | WeatherErrorCode | StocksErrorCode | ...`.\n */\nexport type ErrorCode = CoreErrorCode;\n"]}
@@ -1,2 +1,2 @@
1
- import {c as c$1}from'./chunk-MPB7KUN5.js';var m=0,l=0,c=Number.POSITIVE_INFINITY,h=0,y=Number.POSITIVE_INFINITY;function b(e,t,r){return c$1.execution({code:"ALLOCATION_LIMIT_EXCEEDED",message:`Evaluating this expression would materialise ${e.toLocaleString("en-US")} ${t}, past the limit of ${c.toLocaleString("en-US")} elements for one evaluation`,expected:`at most ${c.toLocaleString("en-US")} elements materialised while evaluating one expression`,found:`a request for ${e.toLocaleString("en-US")} more ${t}, on top of ${r.toLocaleString("en-US")} already materialised`,suggestion:"use a smaller collection or matrix, or raise the engine's vm.maxAllocatedElements setting",context:{requested:e,what:t,used:r,limit:c}})}function M(e){m++===0&&(l=0,c=e.getMaxAllocatedElements(),h=0,y=e.getMaxFunctionCalls());}function _(){m>0&&m--;}function T(e,t){if(m!==0){if(!(e>=0))throw b(e,t,l);if(l+=e,l>c)throw b(e,t,l-e)}}function S(e,t){if(m!==0&&(!(e>=0)||l+e>c))throw b(e,t,l)}function R(e,t){return S(e,t),new Array(e)}function P(){if(m!==0&&++h>y)throw c$1.execution({code:"FUNCTION_CALL_LIMIT_EXCEEDED",message:`Evaluating this expression would make more than ${y.toLocaleString("en-US")} user-defined-function calls, which is the limit for one evaluation`,expected:`at most ${y.toLocaleString("en-US")} function calls while evaluating one expression`,found:"a call past that limit, from a chain of functions that each call others more than once",suggestion:"check for a function that calls itself (or a chain of them) more times than intended, or raise the engine's vm.maxFunctionCalls setting",context:{calls:h,callLimit:y}})}var N=(n=>(n[n.Number=0]="Number",n[n.Hex=1]="Hex",n[n.BigInt=2]="BigInt",n[n.String=3]="String",n[n.Datetime=4]="Datetime",n[n.Percentage=5]="Percentage",n[n.Uom=6]="Uom",n[n.Matrix=7]="Matrix",n[n.Range=8]="Range",n[n.Symbolic=9]="Symbolic",n[n.Boolean=10]="Boolean",n[n.Unit=11]="Unit",n[n.Pending=12]="Pending",n[n.Error=13]="Error",n[n.Colour=14]="Colour",n[n.Split=15]="Split",n[n.Chart=16]="Chart",n[n.IpCidr=17]="IpCidr",n))(N||{}),f=class f{constructor(t=512){this.arena=[];this.index=0;this.initialSize=t;for(let r=0;r<t;r++)this.arena.push(new a(0,0));}acquire(t,r,o){if(this.index<this.arena.length){let s=this.arena[this.index++];return s.recycle(t,r,o),s}let d=new a(t,r,o);return this.arena.push(d),this.index++,d}reset(){let t=this.index;this.index=0,!(this.arena.length<=this.initialSize)&&(this.arena.length<=t*f.SHRINK_WHEN_HOLDING_TIMES||(this.arena.length=Math.max(this.initialSize,t*f.KEEP_TIMES)));}get usage(){return this.index}get capacity(){return this.arena.length}};f.SHRINK_WHEN_HOLDING_TIMES=4,f.KEEP_TIMES=2;var g=f,i=null,u=false;function A(e){return i||(i=new g(e)),i.reset(),u=true,i}function O(){u=false;}function C(){return u}function $(e){let t=new a(e.type,e.value,e.unit);return e.exact!==void 0&&(t.exact=e.exact),e.rational!==void 0&&(t.rational=e.rational),e.uncertainty!==void 0&&(t.uncertainty=e.uncertainty),t}var E=process.env.NODE_ENV==="development";function q(e){return E&&!C()&&(e.toNumber(),Object.freeze(e)),e}var a=class{constructor(t,r,o){this.type=t,this.value=r,this.unit=o,typeof r=="number"&&(this._cachedNumber=r);}recycle(t,r,o){this.type=t,this.value=r,this.unit=o,this._cachedNumber=typeof r=="number"?r:void 0,this.timedOut=void 0,this.exact=void 0,this.rational=void 0,this.uncertainty=void 0,this.decimalPlaces=void 0;}isNumber(){return this.type===0}isHex(){return this.type===1}isBigInt(){return this.type===2}isString(){return this.type===3}isMatrix(){return this.type===7}isVectorShape(){if(this.type!==7)return false;let t=this.value;return t.rows===1||t.cols===1}isRange(){return this.type===8}isColour(){return this.type===14}isChart(){return this.type===16}isIpCidr(){return this.type===17}isSymbolic(){return this.type===9}isError(){return this.type===13}isPending(){return this.type===12}isFault(){return this.type===13||this.type===12}get errorCode(){return this.type===13?this.value:void 0}get errorMessage(){return this.type===13?this.unit:void 0}toNumber(){if(this.type===12||this.type===13)return 0;if(this.type===7){let r=this.value;return r.rows===1&&r.cols===1&&typeof r.data[0]=="number"?r.data[0]:0}if(this.type===8||this.type===14||this.type===16)return 0;if(this.type===17)return this.value.addr??0;if(this.type===15)return this.value.shares[0].value;if(this.type===9)return 0;if(this.type===10)return this.value===true?1:0;if(this._cachedNumber!==void 0)return this._cachedNumber;if(typeof this.value=="bigint")return this._cachedNumber=Number(this.value),this._cachedNumber;let t=parseFloat(this.value);return this._cachedNumber=isNaN(t)?0:t,this._cachedNumber}isNaN(){if(this.type===12||this.type===13)return false;if(this.type===7){let t=this.value;return t.rows===1&&t.cols===1&&typeof t.data[0]=="number"?isNaN(t.data[0]):false}return this.type===8||this.type===14||this.type===15||this.type===16||this.type===17||this.type===9||this.type===10?false:typeof this.value=="number"?isNaN(this.value):typeof this.value=="bigint"?false:isNaN(parseFloat(this.value))}};function x(e){return u&&i?i.acquire(0,e):new a(0,e)}function B(e,t){let r=x(e);return r.exact=t,r}function H(e,t){let r=x(e);return r.rational=t,r}function k(e,t){let r=x(e);return r.uncertainty=t,r}function j(e,t="hex"){let r=t==="hex"?void 0:t;return u&&i?i.acquire(1,e,r):new a(1,e,r)}function K(e){return u&&i?i.acquire(2,e):new a(2,e)}function z(e){return u&&i?i.acquire(3,e):new a(3,e)}function D(e,t){return u&&i?i.acquire(6,e,t):new a(6,e,t)}function Y(e,t,r){let o=D(e,t);return o.exact=r,o}function W(e,t,r){return D(e,`${t}/${r}`)}function X(e){return typeof e=="string"&&e.includes("/")}function G(e){let t=e.indexOf("/");if(t<0)throw c$1.internal("INVALID_RATE_UNIT",`splitRateUnit: "${e}" is not a rate unit (expected "numerator/denominator")`,{unit:e});return {numerator:e.slice(0,t),denominator:e.slice(t+1)}}var V="timecode@";function J(e){return `${V}${e}`}function v(e){return typeof e=="string"&&e.startsWith(V)}function Q(e){if(!v(e))throw c$1.internal("INVALID_TIMECODE_UNIT",`timecodeFps: "${e}" is not a timecode unit (expected "timecode@<fps>")`,{unit:e});return parseFloat(e.slice(V.length))}function I(e,t,r){T(r.length,"matrix cells");let o=r.some(s=>typeof s=="object"&&s!==null&&"kind"in s),d={rows:e,cols:t,data:r,hasSymbolic:o};return u&&i?i.acquire(7,d):new a(7,d)}function Z(e){return I(1,e.length,e)}function ee(e){return I(e.length,1,e)}function te(e,t){let r={min:e,max:t};return u&&i?i.acquire(8,r):new a(8,r)}function re(e){return u&&i?i.acquire(14,e):new a(14,e)}function ne(e){return u&&i?i.acquire(15,e):new a(15,e)}function ie(e){return u&&i?i.acquire(16,e):new a(16,e)}function ae(e){return u&&i?i.acquire(17,e):new a(17,e)}function ue(e){return u&&i?i.acquire(9,e):new a(9,e)}function oe(e){return u&&i?i.acquire(10,e):new a(10,e)}function le(e){return u&&i?i.acquire(4,e):new a(4,e)}function se(e){return u&&i?i.acquire(5,e):new a(5,e)}function pe(e){return new a(12,e)}function ce(e,t){return new a(13,e,t)}function me(e,t,r){return e.type===13||e.type===12?e:t!==void 0&&(t.type===13||t.type===12)?t:r!==void 0&&(r.type===13||r.type===12)?r:null}function fe(e){for(let t=0;t<e.length;t++){let r=e[t];if(r.type===13||r.type===12)return r}return null}export{v as A,Q as B,I as C,Z as D,ee as E,te as F,re as G,ne as H,ie as I,ae as J,ue as K,oe as L,le as M,se as N,pe as O,ce as P,me as Q,fe as R,M as a,_ as b,T as c,S as d,R as e,P as f,N as g,A as h,O as i,C as j,$ as k,q as l,a as m,x as n,B as o,H as p,k as q,j as r,K as s,z as t,D as u,Y as v,W as w,X as x,G as y,J as z};//# sourceMappingURL=chunk-A33K7NY4.js.map
2
- //# sourceMappingURL=chunk-A33K7NY4.js.map
1
+ import {c as c$1}from'./chunk-YAZ4DUJJ.js';var m=0,l=0,c=Number.POSITIVE_INFINITY,h=0,y=Number.POSITIVE_INFINITY;function b(e,t,r){return c$1.execution({code:"ALLOCATION_LIMIT_EXCEEDED",message:`Evaluating this expression would materialise ${e.toLocaleString("en-US")} ${t}, past the limit of ${c.toLocaleString("en-US")} elements for one evaluation`,expected:`at most ${c.toLocaleString("en-US")} elements materialised while evaluating one expression`,found:`a request for ${e.toLocaleString("en-US")} more ${t}, on top of ${r.toLocaleString("en-US")} already materialised`,suggestion:"use a smaller collection or matrix, or raise the engine's vm.maxAllocatedElements setting",context:{requested:e,what:t,used:r,limit:c}})}function M(e){m++===0&&(l=0,c=e.getMaxAllocatedElements(),h=0,y=e.getMaxFunctionCalls());}function _(){m>0&&m--;}function T(e,t){if(m!==0){if(!(e>=0))throw b(e,t,l);if(l+=e,l>c)throw b(e,t,l-e)}}function S(e,t){if(m!==0&&(!(e>=0)||l+e>c))throw b(e,t,l)}function R(e,t){return S(e,t),new Array(e)}function P(){if(m!==0&&++h>y)throw c$1.execution({code:"FUNCTION_CALL_LIMIT_EXCEEDED",message:`Evaluating this expression would make more than ${y.toLocaleString("en-US")} user-defined-function calls, which is the limit for one evaluation`,expected:`at most ${y.toLocaleString("en-US")} function calls while evaluating one expression`,found:"a call past that limit, from a chain of functions that each call others more than once",suggestion:"check for a function that calls itself (or a chain of them) more times than intended, or raise the engine's vm.maxFunctionCalls setting",context:{calls:h,callLimit:y}})}var N=(n=>(n[n.Number=0]="Number",n[n.Hex=1]="Hex",n[n.BigInt=2]="BigInt",n[n.String=3]="String",n[n.Datetime=4]="Datetime",n[n.Percentage=5]="Percentage",n[n.Uom=6]="Uom",n[n.Matrix=7]="Matrix",n[n.Range=8]="Range",n[n.Symbolic=9]="Symbolic",n[n.Boolean=10]="Boolean",n[n.Unit=11]="Unit",n[n.Pending=12]="Pending",n[n.Error=13]="Error",n[n.Colour=14]="Colour",n[n.Split=15]="Split",n[n.Chart=16]="Chart",n[n.IpCidr=17]="IpCidr",n))(N||{}),d=class d{constructor(t=512){this.arena=[];this.index=0;this.initialSize=t;for(let r=0;r<t;r++)this.arena.push(new a(0,0));}acquire(t,r,o){if(this.index<this.arena.length){let s=this.arena[this.index++];return s.recycle(t,r,o),s}let f=new a(t,r,o);return this.arena.push(f),this.index++,f}reset(){let t=this.index;this.index=0,!(this.arena.length<=this.initialSize)&&(this.arena.length<=t*d.SHRINK_WHEN_HOLDING_TIMES||(this.arena.length=Math.max(this.initialSize,t*d.KEEP_TIMES)));}get usage(){return this.index}get capacity(){return this.arena.length}};d.SHRINK_WHEN_HOLDING_TIMES=4,d.KEEP_TIMES=2;var g=d,i=null,u=false;function A(e){return i||(i=new g(e)),i.reset(),u=true,i}function O(){u=false;}function C(){return u}function $(e){let t=new a(e.type,e.value,e.unit);return e.exact!==void 0&&(t.exact=e.exact),e.rational!==void 0&&(t.rational=e.rational),e.uncertainty!==void 0&&(t.uncertainty=e.uncertainty),t}var E=process.env.NODE_ENV==="development";function q(e){return E&&!C()&&(e.toNumber(),Object.freeze(e)),e}var a=class{constructor(t,r,o){this.type=t,this.value=r,this.unit=o,typeof r=="number"&&(this._cachedNumber=r);}recycle(t,r,o){this.type=t,this.value=r,this.unit=o,this._cachedNumber=typeof r=="number"?r:void 0,this.timedOut=void 0,this.exact=void 0,this.rational=void 0,this.uncertainty=void 0,this.decimalPlaces=void 0;}isNumber(){return this.type===0}isHex(){return this.type===1}isBigInt(){return this.type===2}isString(){return this.type===3}isMatrix(){return this.type===7}isVectorShape(){if(this.type!==7)return false;let t=this.value;return t.rows===1||t.cols===1}isRange(){return this.type===8}isColour(){return this.type===14}isChart(){return this.type===16}isIpCidr(){return this.type===17}isSymbolic(){return this.type===9}isError(){return this.type===13}isPending(){return this.type===12}isFault(){return this.type===13||this.type===12}get errorCode(){return this.type===13?this.value:void 0}get errorMessage(){return this.type===13?this.unit:void 0}toNumber(){if(this.type===12||this.type===13)return 0;if(this.type===7){let r=this.value;return r.rows===1&&r.cols===1&&typeof r.data[0]=="number"?r.data[0]:0}if(this.type===8||this.type===14||this.type===16)return 0;if(this.type===17)return this.value.addr??0;if(this.type===15)return this.value.shares[0].value;if(this.type===9)return 0;if(this.type===10)return this.value===true?1:0;if(this._cachedNumber!==void 0)return this._cachedNumber;if(typeof this.value=="bigint")return this._cachedNumber=Number(this.value),this._cachedNumber;let t=parseFloat(this.value);return this._cachedNumber=isNaN(t)?0:t,this._cachedNumber}isNaN(){if(this.type===12||this.type===13)return false;if(this.type===7){let t=this.value;return t.rows===1&&t.cols===1&&typeof t.data[0]=="number"?isNaN(t.data[0]):false}return this.type===8||this.type===14||this.type===15||this.type===16||this.type===17||this.type===9||this.type===10?false:typeof this.value=="number"?isNaN(this.value):typeof this.value=="bigint"?false:isNaN(parseFloat(this.value))}};function x(e){return u&&i?i.acquire(0,e):new a(0,e)}function B(e,t){let r=x(e);return r.exact=t,r}function H(e,t){let r=x(e);return r.rational=t,r}function k(e,t){let r=x(e);return r.uncertainty=t,r}function j(e,t="hex"){let r=t==="hex"?void 0:t;return u&&i?i.acquire(1,e,r):new a(1,e,r)}function K(e){return u&&i?i.acquire(2,e):new a(2,e)}function z(e){return u&&i?i.acquire(3,e):new a(3,e)}function D(e,t){return u&&i?i.acquire(6,e,t):new a(6,e,t)}function Y(e,t,r){let o=D(e,t);return o.exact=r,o}function W(e,t,r){return D(e,`${t}/${r}`)}function X(e){return typeof e=="string"&&e.includes("/")}function G(e){let t=e.indexOf("/");if(t<0)throw c$1.internal("INVALID_RATE_UNIT",`splitRateUnit: "${e}" is not a rate unit (expected "numerator/denominator")`,{unit:e});return {numerator:e.slice(0,t),denominator:e.slice(t+1)}}var V="timecode@";function J(e){return `${V}${e}`}function v(e){return typeof e=="string"&&e.startsWith(V)}function Q(e){if(!v(e))throw c$1.internal("INVALID_TIMECODE_UNIT",`timecodeFps: "${e}" is not a timecode unit (expected "timecode@<fps>")`,{unit:e});return parseFloat(e.slice(V.length))}function I(e,t,r){T(r.length,"matrix cells");let o=r.some(s=>typeof s=="object"&&s!==null&&"kind"in s),f={rows:e,cols:t,data:r,hasSymbolic:o};return u&&i?i.acquire(7,f):new a(7,f)}function Z(e){return I(1,e.length,e)}function ee(e){return I(e.length,1,e)}function te(e,t){let r={min:e,max:t};return u&&i?i.acquire(8,r):new a(8,r)}function re(e){return u&&i?i.acquire(14,e):new a(14,e)}function ne(e){return u&&i?i.acquire(15,e):new a(15,e)}function ie(e){return u&&i?i.acquire(16,e):new a(16,e)}function ae(e){return u&&i?i.acquire(17,e):new a(17,e)}function ue(e){return u&&i?i.acquire(9,e):new a(9,e)}function oe(e){return u&&i?i.acquire(10,e):new a(10,e)}function le(e){return u&&i?i.acquire(4,e):new a(4,e)}function se(e){return u&&i?i.acquire(5,e):new a(5,e)}function pe(e){return new a(12,e)}function ce(e,t){return new a(13,e,t)}function me(e,t,r){return e.type===13||e.type===12?e:t!==void 0&&(t.type===13||t.type===12)?t:r!==void 0&&(r.type===13||r.type===12)?r:null}function de(e){for(let t=0;t<e.length;t++){let r=e[t];if(r.type===13||r.type===12)return r}return null}export{v as A,Q as B,I as C,Z as D,ee as E,te as F,re as G,ne as H,ie as I,ae as J,ue as K,oe as L,le as M,se as N,pe as O,ce as P,me as Q,de as R,M as a,_ as b,T as c,S as d,R as e,P as f,N as g,A as h,O as i,C as j,$ as k,q as l,a as m,x as n,B as o,H as p,k as q,j as r,K as s,z as t,D as u,Y as v,W as w,X as x,G as y,J as z};//# sourceMappingURL=chunk-O3ALJLYC.js.map
2
+ //# sourceMappingURL=chunk-O3ALJLYC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/vm/AllocationBudget.ts","../src/vm/Value.ts"],"names":["depth","used","limit","calls","callLimit","exceeded","requested","what","alreadyUsed","ErrorFactory","beginEvaluation","vm","endEvaluation","chargeAllocation","count","checkAllocation","checkedArray","chargeFunctionCall","ValueType","_ValueArena","initialSize","i","Value","type","value","unit","v","usedLastCycle","ValueArena","_arena","_arenaActive","enableValueArena","size","disableValueArena","isArenaActive","persistentValue","p","isDevelopmentBuild","freezeIfDev","m","result","numberValue","n","numberValueExact","exact","numberValueRational","rational","numberValueUncertain","uncertainty","hexValue","base","tag","bigIntValue","stringValue","s","uomValue","uomValueExact","rateValue","magnitude","numeratorUnit","denominatorUnit","isRateUnit","splitRateUnit","idx","TIMECODE_UNIT_PREFIX","timecodeUnit","fps","isTimecodeUnit","timecodeFps","matrixValue","rows","cols","data","hasSymbolic","cell","rowVectorValue","colVectorValue","rangeValue","min","max","colourValue","c","splitValue","chartValue","ipCidrValue","symbolicValue","node","boolValue","b","datetimeValue","percentageValue","pendingValue","queryKey","errorValue","code","message","faultedOperand","a","faultedIn","values"],"mappings":"2CAwDA,IAAIA,CAAAA,CAAQ,EAGRC,CAAAA,CAAO,CAAA,CAGPC,EAAQ,MAAA,CAAO,iBAAA,CAGfC,EAAQ,CAAA,CAGRC,CAAAA,CAAY,OAAO,iBAAA,CAMvB,SAASC,EAASC,CAAAA,CAAmBC,CAAAA,C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AAmBA,CAAAA,CAAE,IAAA,GAAS,IAA2BA,CAAAA,CACrF,IACR,CAQO,SAASiB,EAAAA,CAAUC,EAAwC,CACjE,IAAA,IAAS9E,EAAI,CAAA,CAAGA,CAAAA,CAAI8E,EAAO,MAAA,CAAQ9E,CAAAA,EAAAA,CAAK,CACvC,IAAMK,CAAAA,CAAIyE,EAAO9E,CAAC,CAAA,CAClB,GAAIK,CAAAA,CAAE,IAAA,GAAS,IAAmBA,CAAAA,CAAE,IAAA,GAAS,GAAmB,OAAOA,CACxE,CACA,OAAO,IACR","file":"chunk-O3ALJLYC.js","sourcesContent":["/**\n * The ceiling on how much memory one evaluation is allowed to ask for.\n *\n * The VM's other two counters bound how many opcodes run and how deep the value\n * stack gets, and both are checked BETWEEN opcodes. That leaves a hole the size\n * of a single opcode: whatever one opcode allocates in a loop of its own is\n * invisible to both, so twenty-four characters of input (`map(10*x,\n * 0:2000000000)`) could allocate until V8 aborted the process, which no\n * `try`/`catch` in the host can contain. Per-site caps close one hole each and\n * do not compose: two collections that are individually legal are legal\n * together, and an operation whose result is the PRODUCT of two legal inputs (a\n * matrix multiply) is bounded by neither of them.\n *\n * This is the counter that composes. Everything an evaluation materialises is\n * charged against one running tally, so the bound is on the total rather than\n * on any single step, and a new opcode inherits it by allocating through\n * {@link chargedArray} or by building a Value through a constructor that\n * already charges ({@link matrixValue}).\n *\n * The tally is module state rather than something threaded through every\n * signature. `executeBytecode()` opens an evaluation and every charge inside\n * that window lands on it, which is what lets a helper five call levels down\n * (`vm/MatrixOps.ts`'s `collectionToValues()`) charge without the four frames\n * in between passing a parameter along, and what keeps a charge down to an add\n * and a compare. This mirrors the value arena in `vm/Value.ts`, which is\n * ambient for the same reason and rests on the same fact: `executeBytecode()`\n * is synchronous, so exactly one evaluation is ever in flight in a realm.\n *\n * An \"element\" is one thing a user's input caused to exist: a `Value` in an\n * expanded collection, a cell in a matrix. They are counted rather than\n * measured in bytes, because a count is the quantity every call site already\n * has in hand before it allocates, and asking V8 how big something is costs\n * more than the allocation being guarded.\n *\n * A second tally lives here for the same structural reason and not because it\n * counts the same thing: {@link chargeFunctionCall} bounds how many\n * user-defined-function calls one evaluation may make in total. Surviving\n * reentry is the whole property both need, and this module is where reentry is\n * already tracked.\n *\n * @module AllocationBudget\n */\n\nimport { ErrorFactory } from \"@solve-js/errors/UnifiedErrorFramework\";\nimport type { VM } from \"@solve-js/vm/OpRegistry\";\n\n/**\n * How deep the evaluation is: 0 outside one, higher inside a reentrant call.\n *\n * `executeBytecode()` re-enters itself for a user-defined function call, a map\n * or reduce transform body, and an algebra verb's bound-unknown body. Only the\n * outermost entry clears the tally, so a runaway recursion cannot refresh its\n * own allowance the way it can refresh `maxInstructions` (each reentrant call\n * gets a fresh local instruction count, which is why function recursion needed\n * a separate guard of its own).\n */\nlet depth = 0;\n\n/** Elements charged so far in the evaluation currently in flight. */\nlet used = 0;\n\n/** The in-flight evaluation's ceiling, read from its VM when the evaluation opened. */\nlet limit = Number.POSITIVE_INFINITY;\n\n/** User-defined-function calls made so far in the evaluation currently in flight. */\nlet calls = 0;\n\n/** The in-flight evaluation's call ceiling, read from its VM when the evaluation opened. */\nlet callLimit = Number.POSITIVE_INFINITY;\n\n/**\n * The refusal itself, built in one place so the wording of the engine's most\n * likely \"this is too big\" message is not reinvented per site.\n */\nfunction exceeded(requested: number, what: string, alreadyUsed: number): Error {\n\treturn ErrorFactory.execution({\n\t\tcode: \"ALLOCATION_LIMIT_EXCEEDED\",\n\t\tmessage:\n\t\t\t`Evaluating this expression would materialise ${requested.toLocaleString(\"en-US\")} ${what}, ` +\n\t\t\t`past the limit of ${limit.toLocaleString(\"en-US\")} elements for one evaluation`,\n\t\texpected: `at most ${limit.toLocaleString(\"en-US\")} elements materialised while evaluating one expression`,\n\t\tfound: `a request for ${requested.toLocaleString(\"en-US\")} more ${what}, on top of ${alreadyUsed.toLocaleString(\"en-US\")} already materialised`,\n\t\tsuggestion: \"use a smaller collection or matrix, or raise the engine's vm.maxAllocatedElements setting\",\n\t\tcontext: { requested, what, used: alreadyUsed, limit },\n\t});\n}\n\n/**\n * Open an evaluation, taking its ceiling from the VM about to run it.\n *\n * @param vm - The VM running this program. Only consulted on the outermost\n * entry, so a reentrant call costs one increment.\n */\nexport function beginEvaluation(vm: VM): void {\n\tif (depth++ === 0) {\n\t\tused = 0;\n\t\tlimit = vm.getMaxAllocatedElements();\n\t\tcalls = 0;\n\t\tcallLimit = vm.getMaxFunctionCalls();\n\t}\n}\n\n/** Close the innermost evaluation. Always call from a `finally`, so a throw cannot leave one open. */\nexport function endEvaluation(): void {\n\tif (depth > 0) depth--;\n}\n\n/**\n * Record elements materialised by the evaluation in flight.\n *\n * Each thing is charged exactly once, where it comes into existence: a matrix\n * in `matrixValue()`, an expanded collection where it is expanded. A site that\n * knows a size in advance and whose result will be charged on birth uses\n * {@link checkAllocation} instead, so that refusing early does not mean\n * counting twice.\n *\n * Outside an evaluation this is a plain no-op rather than an error:\n * `matrixValue()` and the `vm/MatrixOps.ts` helpers are exported and get called\n * by tests, by the formatter and by hosts with no evaluation in flight, and\n * none of those is user input being executed.\n *\n * @param count - How many elements now exist.\n * @param what - What they are, in the plural and in a user's words (\"matrix\n * cells\", \"collection elements\"). Quoted verbatim in the error, so it should\n * name the thing rather than the code that makes it.\n * @throws `ALLOCATION_LIMIT_EXCEEDED` when this evaluation has had enough.\n * Recoverable: it describes this expression, not the engine.\n */\nexport function chargeAllocation(count: number, what: string): void {\n\tif (depth === 0) return;\n\t// Written as a negated `>=` so that NaN takes this branch. A NaN count would\n\t// otherwise be added to the tally and make every later `used > limit`\n\t// comparison false, silently switching the guard off for the rest of the\n\t// evaluation, which is the one failure mode a safety limit must not have.\n\tif (!(count >= 0)) throw exceeded(count, what, used);\n\tused += count;\n\tif (used > limit) throw exceeded(count, what, used - count);\n}\n\n/**\n * Refuse an allocation this evaluation cannot afford, without recording it.\n *\n * For the sites that know how big a result will be BEFORE building it and whose\n * result is charged later, when it is born. A matrix product is the case that\n * matters: its size is the product of two operands that are each affordable, so\n * it has to be refused from the shapes alone, before `matrixMultiply()` takes\n * the memory. Charging here as well as at birth would bill every matrix twice\n * and halve the ceiling the host asked for.\n *\n * @param count - How many elements the result would have.\n * @param what - What they are, in the plural. See {@link chargeAllocation}.\n * @throws `ALLOCATION_LIMIT_EXCEEDED` when the evaluation could not afford them.\n */\nexport function checkAllocation(count: number, what: string): void {\n\tif (depth === 0) return;\n\tif (!(count >= 0) || used + count > limit) throw exceeded(count, what, used);\n}\n\n/**\n * Check that an array is affordable, then allocate it.\n *\n * The intended way to build any user-sized array inside the VM whose contents\n * end up inside a Value that charges on birth, so that \"ask before you take\" is\n * a property of the allocator rather than something each new opcode has to be\n * told.\n *\n * @param count - Element count, checked before a single element exists.\n * @param what - What the elements are, in the plural. See {@link chargeAllocation}.\n * @returns An empty array of that length.\n * @throws `ALLOCATION_LIMIT_EXCEEDED` before allocating anything, when the\n * evaluation cannot afford it.\n */\nexport function checkedArray<T>(count: number, what: string): T[] {\n\tcheckAllocation(count, what);\n\treturn new Array<T>(count);\n}\n\n/**\n * Record one user-defined-function call, and refuse the one past the ceiling.\n *\n * Lives in this module rather than in the VM for the single reason the element\n * tally does: it has to survive `executeBytecode()` re-entering itself. A call\n * count kept per invocation would be reset by the very calls it is counting,\n * which is exactly what happens to `maxInstructions` and exactly why counting\n * instructions could never bound this.\n *\n * The thing being bounded is BREADTH, which no existing guard could see.\n * `maxFunctionRecursionDepth` bounds nesting, and a doubling chain\n * (`f22(v) = f21(v) + f21(v)`, twenty-two lines of it) nests only twenty-two\n * deep while making 2,097,152 calls, which was a fatal heap abort in under a\n * second. Depth 22 against a limit of 50 is comfortably legal, and it was.\n *\n * @throws `FUNCTION_CALL_LIMIT_EXCEEDED` when this evaluation has made\n * enough. Recoverable: the engine is fine, this line is not.\n */\nexport function chargeFunctionCall(): void {\n\tif (depth === 0) return;\n\tif (++calls > callLimit) {\n\t\tthrow ErrorFactory.execution({\n\t\t\tcode: \"FUNCTION_CALL_LIMIT_EXCEEDED\",\n\t\t\tmessage:\n\t\t\t\t`Evaluating this expression would make more than ${callLimit.toLocaleString(\"en-US\")} ` +\n\t\t\t\t`user-defined-function calls, which is the limit for one evaluation`,\n\t\t\texpected: `at most ${callLimit.toLocaleString(\"en-US\")} function calls while evaluating one expression`,\n\t\t\tfound: \"a call past that limit, from a chain of functions that each call others more than once\",\n\t\t\tsuggestion: \"check for a function that calls itself (or a chain of them) more times than intended, or raise the engine's vm.maxFunctionCalls setting\",\n\t\t\tcontext: { calls, callLimit },\n\t\t});\n\t}\n}\n\n/**\n * Elements charged so far in the evaluation in flight, or in the one that just\n * finished. For tests and for a host reporting on a refusal.\n *\n * @returns The running tally.\n */\nexport function allocationUsed(): number {\n\treturn used;\n}\n\n/**\n * Drop all in-flight evaluation state.\n *\n * For tests that need a known starting point, and as a repair for a host that\n * somehow lost an `endEvaluation()`. Ordinary execution never needs it:\n * `executeBytecode()` pairs its own begin and end in a `finally`, and the\n * outermost begin clears the tally regardless of what came before.\n */\nexport function resetAllocationTracking(): void {\n\tdepth = 0;\n\tused = 0;\n\tlimit = Number.POSITIVE_INFINITY;\n\tcalls = 0;\n\tcallLimit = Number.POSITIVE_INFINITY;\n}\n","import { ErrorFactory } from \"@solve-js/errors/UnifiedErrorFramework\";\nimport { chargeAllocation } from \"@solve-js/vm/AllocationBudget\";\nimport type { SymbolicNode, Rational } from \"@solve-js/symbolic\";\nimport type { DecimalData } from \"@solve-js/decimal\";\n\n/**\n * A single matrix cell. `boolean` covers element-wise comparison results\n * (`[1,6;3,8] < [5,2;7,4]` produces a Matrix of booleans, not numbers). A\n * `SymbolicNode` cell is a free-variable algebraic entry, e.g. `s =\n * [sx,0,0;0,sy,0;0,0,1]` where `sx`/`sy` are never assigned, so those\n * cells store a real `SymbolicNode` (a bare `var` node initially) rather\n * than degrading to `0`. See `MatrixOps.ts`'s `entryToSymbolic()`/\n * `symbolicToEntry()` for the two-way conversion every symbolic-aware\n * matrix op (multiply, inverse, determinant) uses.\n */\nexport type MatrixEntry = number | boolean | SymbolicNode;\n\n/**\n * A general rows×cols matrix, a vector is just a 1×N (row) or N×1 (column)\n * matrix. `data` is COLUMN-MAJOR (`data[row + col*rows]`), matching the\n * spec's own `a[index]` column-major indexing semantics directly (no\n * translation needed for single-index reads). `hasSymbolic` lets every\n * numeric matrix op fast-path the all-numeric case with one boolean check,\n * mirroring `binaryOp()`'s existing Number+Number fast path, computed by\n * `matrixValue()` itself (true the moment any cell is a `SymbolicNode`\n * object rather than a plain number/boolean), not something callers set\n * by hand.\n */\nexport interface MatrixData {\n\treadonly rows: number;\n\treadonly cols: number;\n\treadonly data: readonly MatrixEntry[];\n\treadonly hasSymbolic: boolean;\n}\n\n/** A first-class integer range `min:max`, both bounds inclusive. */\nexport interface RangeData {\n\treadonly min: number;\n\treadonly max: number;\n}\n\n/**\n * How a colour was authored, and therefore how it should display. It never\n * changes the channels: a colour is always stored as canonical sRGB (`r`,`g`,`b`\n * integers 0-255, `a` in 0-1), and `format` only decides whether `formatValue`\n * renders it as `#rrggbb`, `rgb(...)`, `hsl(...)` or a named keyword.\n */\nexport type ColourFormat = \"hex\" | \"rgb\" | \"rgba\" | \"hsl\" | \"hsla\" | \"named\";\n\n/**\n * A colour value. Canonical channels are sRGB (`r`,`g`,`b` are integers 0-255,\n * `a` is 0-1); HSL is never stored, it is derived on demand for display and for\n * hue/saturation/lightness operations, then re-quantised back to RGBA. A\n * `lighten` followed by an equal `darken` returns to within one rounding step of\n * the original (integer channels re-quantise each way), and does not drift on\n * repetition, rather than storing both HSL and RGB and letting them disagree.\n * `format`\n * records the authored/display form; `name` carries the CSS keyword only when\n * `format === \"named\"` (e.g. `\"rebeccapurple\"`). Lives in a {@link Value}'s\n * `value` slot exactly as {@link MatrixData}/{@link RangeData} do.\n */\nexport interface ColourData {\n\treadonly r: number;\n\treadonly g: number;\n\treadonly b: number;\n\treadonly a: number;\n\treadonly format: ColourFormat;\n\treadonly name?: string;\n}\n\n/**\n * One tier of a bill split: an amount and how many people pay it. An even\n * split is a single share; the odd-penny case is two shares (the base amount\n * most people pay, then the base plus a cent that the remaining `count` pay),\n * so the shares always add back to the exact total. `exact` carries the\n * base-ten cents of a currency share so display rounds from the decimal rather\n * than a drifted double, exactly as money does everywhere else.\n */\nexport interface SplitShare {\n\treadonly value: number;\n\treadonly exact?: DecimalData;\n\treadonly count: number;\n}\n\n/**\n * The result of a per-person bill split (`split $180 between 4`). `unit` is the\n * currency code when the amount was money, undefined for a bare number.\n * `shares` is ordered base-first: `shares[0]` is the \"each\" amount, and a\n * second share, when present, is the slightly larger amount the odd penny falls\n * on. Lives in a {@link Value}'s `value` slot exactly as {@link ColourData} and\n * {@link RangeData} do, a display-only payload the formatter renders.\n */\nexport interface SplitData {\n\treadonly unit?: string;\n\treadonly shares: readonly SplitShare[];\n}\n\n/**\n * What a {@link ChartData} draws, and therefore how a host renders it: a\n * `sparkline` is a tiny inline line with no axes, a `plot` a framed curve over a\n * domain. New kinds (a bar chart, a scatter) are added here, and every host that\n * switches on `kind` keeps working for the ones it already knows.\n */\nexport type ChartKind = \"sparkline\" | \"plot\";\n\n/**\n * A chart specification: the DATA to draw, never pixels. One shape holds every\n * visual the engine produces, `[1,2,3] as sparkline` and `plot sin(x) from 0 to\n * 2pi` alike, so a host reads `kind` to choose a renderer and draws `points`\n * scaled to `domain` × `range`. The engine brings the numbers; the developer\n * brings the charting library. `label` is the plain-text answer a reader without\n * a canvas still gets. A sparkline's points are `(index, value)`; a plot's are\n * `(x, y)`. Lives in a {@link Value}'s `value` slot exactly as\n * {@link MatrixData}/{@link ColourData} do (issues #186, #187).\n */\nexport interface ChartData {\n\treadonly kind: ChartKind;\n\t/** The points to draw, `(x, y)`. A sparkline indexes x from 0. */\n\treadonly points: readonly (readonly [number, number])[];\n\t/** The plain-text answer, e.g. `sin(x) over [0, 6.28]` or the series itself. */\n\treadonly label: string;\n\t/** The x-axis extent `[min, max]`. */\n\treadonly domain: readonly [number, number];\n\t/** The y-axis extent `[min, max]`, for scaling the drawn height. */\n\treadonly range: readonly [number, number];\n\t/** The source expression, for a plot; absent for a sparkline. */\n\treadonly expr?: string;\n}\n\n/**\n * An IPv4 address and/or subnet prefix (issue #189). `addr` is the 32-bit\n * address (`192.168.1.10` held as one number); `prefix` is the CIDR prefix\n * length in `/24`. A bare address has no `prefix`, a bare `/24` has no `addr`,\n * and a full block (`192.168.1.0/24`) has both. Lives in a {@link Value}'s\n * `value` slot as the other struct payloads do; the formatter renders it as the\n * dotted quad (plus `/prefix` when present).\n */\nexport interface IpCidrData {\n\treadonly addr?: number;\n\treadonly prefix?: number;\n}\n\n/**\n * Discriminated union tag for {@link Value} objects.\n *\n * Determines the runtime type of a Value and how its `value` field should\n * be interpreted. Used by the VM for type-aware dispatch in arithmetic,\n * comparison, and conversion operations.\n */\nexport enum ValueType {\n\t/** Plain 64-bit floating point number (IEEE 754 double) */\n\tNumber = 0,\n\tHex = 1,\n\tBigInt = 2,\n\tString = 3,\n\tDatetime = 4,\n\tPercentage = 5,\n\tUom = 6,\n\t/** General rows×cols matrix (a vector is a 1×N or N×1 matrix). Value is {@link MatrixData}. */\n\tMatrix = 7,\n\t/** A first-class integer range `min:max`, both inclusive. Value is {@link RangeData}. */\n\tRange = 8,\n\t/** A symbolic/algebraic expression tree (free-variable formula, not a concrete number). Value is a `SymbolicNode` (`@solve-js/symbolic`). */\n\tSymbolic = 9,\n\t/** Boolean true/false. Value is `boolean`. */\n\tBoolean = 10,\n\t/** Unit of measurement token (lexer only, not a runtime value). */\n\tUnit = 11,\n\t/** Async result pending resolution. Value stores the queryKey string. */\n\tPending = 12,\n\t/** Plugin-raised error propagated through the DAG. Value stores error code, unit stores message. */\n\tError = 13,\n\t/** A colour (hex/rgb/hsl/named). Value is {@link ColourData}. */\n\tColour = 14,\n\t/** A per-person bill split (`split $180 between 4`). Value is {@link SplitData}. */\n\tSplit = 15,\n\t/** A chart to draw (`[1,2,3] as sparkline`, `plot sin(x) from 0 to 2pi`). Value is {@link ChartData}. */\n\tChart = 16,\n\t/** An IPv4 address or subnet (`192.168.1.0/24`). Value is {@link IpCidrData}. */\n\tIpCidr = 17,\n}\n\n// ── ValueArena ────────────────────────────────────────────────────────────\n// Phase 5.3: Bump-allocator arena for zero-allocation Value reuse during scroll.\n// Instead of allocating new Value objects per instruction, we pre-allocate a\n// block and bump an index. A single arena.reset() per scroll frame recycles all\n// Values, no per-value release overhead, no GC pressure during 60fps scrolling.\n\n/**\n * Bump-allocator arena for zero-allocation Value reuse during scroll.\n *\n * Instead of allocating new Value objects per instruction, pre-allocates a\n * block and bumps an index. `arena.reset()` per scroll frame recycles all\n * Values, no per-value release overhead, no GC pressure during 60fps scrolling.\n *\n * Only active during Tier 2 scroll execution (ThreeTierEvaluator).\n */\nexport class ValueArena {\n\tprivate arena: Value[] = [];\n\tprivate index: number = 0;\n\t/** The block size to come back down to. Kept so {@link reset} can. */\n\tprivate readonly initialSize: number;\n\n\t/**\n\t * How much more than the last cycle needed the arena may go on holding\n\t * before it gives the difference back, and how much of it it keeps when it\n\t * does.\n\t *\n\t * A bump allocator that grows to serve one expensive line is working as\n\t * intended; one that never comes down is a leak wearing a cache's clothes.\n\t * `map(x*1, 1:100000)` is an ordinary line by every limit the engine has,\n\t * and it took the arena from 512 Values to 300,004, about 24MB that stayed\n\t * live through two forced full collections and through every later `1 + 1`,\n\t * because `acquire()` handles overflow with `push()` and `reset()` only\n\t * zeroed the bump index. The instance is module-level and survives\n\t * `disableValueArena()` on purpose, so that high-water mark was for the\n\t * life of the process.\n\t *\n\t * Keeping twice what the last cycle used, and only shrinking once holding\n\t * four times that, is what stops the release from becoming a different\n\t * performance bug: a steady scroll uses about the same number of Values\n\t * every frame, so it never meets the condition at all, and an alternating\n\t * heavy/light document degrades at worst to allocating the Values it would\n\t * have allocated with no arena in the first place.\n\t */\n\tprivate static readonly SHRINK_WHEN_HOLDING_TIMES = 4;\n\tprivate static readonly KEEP_TIMES = 2;\n\n\t/** Pre-allocate initial block. 512 Values covers ~30-line viewport comfortably. */\n\tconstructor(initialSize: number = 512) {\n\t\tthis.initialSize = initialSize;\n\t\tfor (let i = 0; i < initialSize; i++) {\n\t\t\tthis.arena.push(new Value(ValueType.Number, 0));\n\t\t}\n\t}\n\n\t/** Bump-allocate a recycled Value. Falls back to allocation only for overflow. */\n\tacquire(type: ValueType, value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SplitData | ChartData | IpCidrData | SymbolicNode, unit?: string): Value {\n\t\tif (this.index < this.arena.length) {\n\t\t\tconst v = this.arena[this.index++];\n\t\t\tv.recycle(type, value, unit);\n\t\t\treturn v;\n\t\t}\n\t\t// Arena overflow, allocate fresh (rare, only for very complex expressions)\n\t\tconst v = new Value(type, value, unit);\n\t\tthis.arena.push(v);\n\t\tthis.index++;\n\t\treturn v;\n\t}\n\n\t/**\n\t * Reset for the next scroll frame, releasing a block the last frame turned\n\t * out not to need.\n\t *\n\t * Still O(1) in the ordinary case: one comparison against what the cycle\n\t * that just ended used, and the truncation only on the frame after an\n\t * unusually expensive one. Reading the usage here rather than at\n\t * `disableValueArena()` is what makes the policy \"the first cycle that does\n\t * not need the block gives it back\", which is the first thing a host does\n\t * after the line that grew it.\n\t */\n\treset(): void {\n\t\tconst usedLastCycle = this.index;\n\t\tthis.index = 0;\n\t\tif (this.arena.length <= this.initialSize) return;\n\t\tif (this.arena.length <= usedLastCycle * ValueArena.SHRINK_WHEN_HOLDING_TIMES) return;\n\t\t// Never below the initial block, and never above what is already held,\n\t\t// so this only ever truncates.\n\t\tthis.arena.length = Math.max(this.initialSize, usedLastCycle * ValueArena.KEEP_TIMES);\n\t}\n\n\t/** Current arena utilization (for diagnostics). */\n\tget usage(): number { return this.index; }\n\tget capacity(): number { return this.arena.length; }\n}\n\n// Module-level arena toggle. Single-threaded JS, so global state is safe.\n// The arena is ONLY active during Tier 2 scroll execution, the ThreeTierEvaluator\n// enables it before evaluating visible lines and disables it after.\n//\n// The arena INSTANCE survives disable(): constructing a ValueArena allocates\n// its whole initial block (512 Values), so dropping it on every disable would\n// pay that allocation cost again on the next enable, more garbage than the\n// arena saves. Instead, an `_arenaActive` flag gates use of the long-lived\n// instance; enable() just resets the bump index.\nlet _arena: ValueArena | null = null;\nlet _arenaActive = false;\n\n/** Enable the Value arena for zero-allocation scroll execution. */\nexport function enableValueArena(size?: number): ValueArena {\n\tif (!_arena) _arena = new ValueArena(size);\n\t_arena.reset();\n\t_arenaActive = true;\n\treturn _arena;\n}\n\n/** Disable the arena (returns to normal GC-collected allocation). */\nexport function disableValueArena(): void {\n\t_arenaActive = false;\n}\n\n/** Check if arena is active (used by STORE_VAR / HALT to decide cloning). */\nexport function isArenaActive(): boolean {\n\treturn _arenaActive;\n}\n\n/**\n * Allocate a Value that persists beyond the current arena cycle.\n * Used for values stored in variables (STORE_VAR) and final expression results\n * (HALT return), these must survive arena.reset() in the next scroll frame.\n */\nexport function persistentValue(v: Value): Value {\n\tconst p = new Value(v.type, v.value, v.unit);\n\t// The exact sidecar has to survive being stored in a variable, or a\n\t// referenced money value would silently drop back to the double: \"a = $0.10,\n\t// b = $0.20, a + b\" must still be exact across the STORE_VAR round trip.\n\tif (v.exact !== undefined) p.exact = v.exact;\n\t// The rational sidecar survives the same round trip, so \"a = 1/3, a + a + a\"\n\t// is exactly 1 rather than the drifted double a stored fraction would carry.\n\tif (v.rational !== undefined) p.rational = v.rational;\n\t// The uncertainty sidecar survives too, so \"a = 12.3 +/- 0.5, a * 4\" still\n\t// propagates the tolerance across the STORE_VAR round trip.\n\tif (v.uncertainty !== undefined) p.uncertainty = v.uncertainty;\n\treturn p;\n}\n\n// ── Dev-mode immutability guard (Part II, L5, Value model hardening) ──\n//\n// Value is documented immutable by convention, not enforcement: the arena\n// mutates objects in place via recycle() (by design, for Tier-2 scroll\n// performance), so Value can never be unconditionally frozen. This guard\n// freezes a Value ONLY when it is safe to do so, i.e. NOT while the arena\n// is active, since an arena-active Value may still be recycled later in\n// the same scroll frame. It is a no-op outside development builds (matches\n// the existing `process.env.NODE_ENV === \"development\"` convention used by\n// the app-layer logger) so there is zero runtime cost in production.\nconst isDevelopmentBuild = process.env.NODE_ENV === \"development\";\n\n/**\n * Freeze a Value in development builds, catching accidental external\n * mutation of \"immutable\" results early. Safe to call unconditionally\n * it is a no-op in production and a no-op whenever the arena is active\n * (an arena-active Value may still be recycle()'d before this scroll\n * frame ends, and freezing it would make recycle() throw).\n *\n * Intended for values leaving a public evaluation boundary\n * (ExpressionEngine.evaluateLine* / evaluateExpression), not for values\n * still moving through internal VM/arena machinery.\n */\nexport function freezeIfDev<T extends Value>(value: T): T {\n\tif (isDevelopmentBuild && !isArenaActive()) {\n\t\t// toNumber() lazily memoizes _cachedNumber for bigint/string values\n\t\t// (Number/Hex are already eagerly cached by the constructor), warm\n\t\t// it now so a later toNumber() call on the frozen object doesn't\n\t\t// try to write to a frozen field.\n\t\tvalue.toNumber();\n\t\tObject.freeze(value);\n\t}\n\treturn value;\n}\n\n/**\n * Universal runtime value for the solve-js VM.\n *\n * Carries a {@link ValueType} discriminant, a polymorphic `value` payload,\n * and an optional `unit` string (for UoM values). Treated as immutable after\n * construction, the arena reuses objects internally via `recycle()`, but\n * external code should never mutate Value fields.\n *\n * A cached `_cachedNumber` avoids repeated `toNumber()` computation on\n * hot paths (ADD/SUB/MUL in the VM dispatch loop).\n */\nexport class Value {\n\t// Cached numeric representation, computed once on first toNumber() call.\n\t// Cleared on recycle() when the arena reuses this Value for a new value.\n\tprivate _cachedNumber: number | undefined;\n\n\t// Fields are NOT readonly, the arena reuses Value objects by calling\n\t// recycle() which overwrites all fields. External code should treat Values\n\t// as immutable after construction (arena handles mutation internally).\n\tpublic type: ValueType;\n\tpublic value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SplitData | ChartData | IpCidrData | SymbolicNode;\n\tpublic unit?: string;\n\t/** Set by async resolvers when a fetch timed out, the result is a fallback (typically 0). */\n\tpublic timedOut?: boolean;\n\t/**\n\t * The exact base-ten value this Value stands for, when it has one.\n\t *\n\t * A sidecar rather than a replacement for `value`: money and decimal-point\n\t * literals set it to a {@link DecimalData} so that same-currency arithmetic\n\t * and display can be exact (\"$0.10 + $0.20\" is \"$0.30\", not\n\t * \"$0.30000000000000004\"), while `value` stays the nearest double so every\n\t * existing consumer that reads `.value` or `toNumber()` is unchanged. The\n\t * plain Number-times-Number fast paths deliberately ignore it, which is why\n\t * a bare \"0.1 + 0.2\" still answers the double it always did: exactness is\n\t * carried only where a unit-bearing operand asks for it. Cleared by\n\t * {@link recycle} so a reused arena Value never inherits a stale exact.\n\t */\n\tpublic exact?: DecimalData;\n\t/**\n\t * The exact rational value this Value stands for, when it has one.\n\t *\n\t * The second sidecar, the same shape as {@link exact} and for the same\n\t * reason: a fraction has no exact base-ten form (`1/3` is not any decimal),\n\t * so exact fraction arithmetic needs a numerator/denominator pair rather\n\t * than a coefficient and a scale. Integer division seeds it (\"1/3\" carries\n\t * the {@link Rational} 1/3), and `+`, `-`, `*`, `/` between rational-bearing\n\t * numbers keep it reduced, so \"1/49 * 49\" is exactly 1 and \"5/6 - 1/6 - 1/6\n\t * - 1/6 - 1/6 - 1/6\" is exactly 0 rather than the 1.6e-16 the doubles drift\n\t * to. `value` still holds the nearest double, recomputed from the exact\n\t * rational so accumulation error never creeps in, which is why the default\n\t * display and every `.value`/`toNumber()` reader are unchanged. Only a\n\t * fraction written with \"/\" carries it, so a decimal literal (\"0.1\") and a\n\t * transcendental result (\"sqrt(2)\") stay the plain doubles they were.\n\t * Cleared by {@link recycle} alongside {@link exact}.\n\t */\n\tpublic rational?: Rational;\n\t/**\n\t * The one-sigma uncertainty (standard error) this value carries, when it\n\t * has one.\n\t *\n\t * The third sidecar, the same shape as {@link exact} and {@link rational}\n\t * and for the same reason: a measurement written `12.3 ± 0.5` is still the\n\t * number 12.3 everywhere it is read as one, so the type stays\n\t * {@link ValueType.Number} and `value` stays the center, while this non\n\t * negative field carries the tolerance. The `±` (or ASCII `+/-`) operator\n\t * seeds it, and `+`, `-`, `*`, `/` propagate it in quadrature for\n\t * independent errors (see `vm/VMConversion.ts`'s `uncertainOp`). Everything\n\t * else (a comparison, a transcendental function, a unit conversion) reads\n\t * the center through `toNumber()` and drops the tolerance, which is why a\n\t * value with no uncertainty behaves exactly as a plain number always did.\n\t * Cleared by {@link recycle} alongside the other two sidecars.\n\t */\n\tpublic uncertainty?: number;\n\t/**\n\t * The number of decimal places this value should DISPLAY at, when it has been\n\t * given an explicit precision.\n\t *\n\t * A display sidecar, not a value one: `value` is unchanged, so every\n\t * `.value`/`toNumber()` reader and all arithmetic behave exactly as before,\n\t * and a value with no `decimalPlaces` formats the way it always did (the\n\t * global two-place default with trailing zeros trimmed). It is set only by an\n\t * explicit precision request, `<x> to N dp` and `round(x, N)`, so that\n\t * `3.14159 to 4 dp` shows `3.1416` and `1.5 to 2 dp` shows `1.50` rather than\n\t * the value being rounded but then displayed at the default two places. It is\n\t * NOT propagated through arithmetic (a later `+ 1` re-decides precision),\n\t * which is why nothing that did not ask for a precision is affected. Cleared\n\t * by {@link recycle} alongside the other sidecars.\n\t */\n\tpublic decimalPlaces?: number;\n\n\tconstructor(\n\t\ttype: ValueType,\n\t\tvalue: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SplitData | ChartData | IpCidrData | SymbolicNode,\n\t\tunit?: string\n\t) {\n\t\tthis.type = type;\n\t\tthis.value = value;\n\t\tthis.unit = unit;\n\t\t// Eagerly cache for Number and Hex types (the most common case).\n\t\t// This avoids a method call + type-check on first toNumber().\n\t\tif (typeof value === 'number') {\n\t\t\tthis._cachedNumber = value;\n\t\t}\n\t}\n\n\t/**\n\t * Phase 5.3: Reset all fields for arena reuse.\n\t * Called by ValueArena.acquire(), zero allocation, just field assignment.\n\t */\n\trecycle(type: ValueType, value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SplitData | ChartData | IpCidrData | SymbolicNode, unit?: string): void {\n\t\tthis.type = type;\n\t\tthis.value = value;\n\t\tthis.unit = unit;\n\t\t// Clear cache, value changed, cached number is stale.\n\t\t// Re-eager-cache for Number type (most common).\n\t\tthis._cachedNumber = typeof value === 'number' ? value : undefined;\n\t\t// Clear timeout flag, recycled Values shouldn't inherit stale metadata.\n\t\tthis.timedOut = undefined;\n\t\t// Clear the exact sidecar for the same reason: a reused Value that once\n\t\t// held money must not carry that money's decimal into a plain number.\n\t\tthis.exact = undefined;\n\t\t// The rational sidecar clears with it: a reused Value that once held a\n\t\t// fraction must not carry that fraction into a plain number.\n\t\tthis.rational = undefined;\n\t\t// The uncertainty sidecar clears the same way: a reused Value that once\n\t\t// carried a tolerance must not lend it to a plain number.\n\t\tthis.uncertainty = undefined;\n\t\t// The display-precision sidecar clears too: a reused Value that once had\n\t\t// an explicit `to N dp` must not display a plain number at that precision.\n\t\tthis.decimalPlaces = undefined;\n\t}\n\n\tisNumber(): this is Value & { value: number } {\n\t\treturn this.type === ValueType.Number;\n\t}\n\n\tisHex(): this is Value & { value: number } {\n\t\treturn this.type === ValueType.Hex;\n\t}\n\n\tisBigInt(): this is Value & { value: bigint } {\n\t\treturn this.type === ValueType.BigInt;\n\t}\n\n\tisString(): this is Value & { value: string } {\n\t\treturn this.type === ValueType.String;\n\t}\n\n\tisMatrix(): this is Value & { value: MatrixData } {\n\t\treturn this.type === ValueType.Matrix;\n\t}\n\n\t/** A Matrix shaped like a vector, 1×N (row) or N×1 (column). */\n\tisVectorShape(): boolean {\n\t\tif (this.type !== ValueType.Matrix) return false;\n\t\tconst m = this.value as MatrixData;\n\t\treturn m.rows === 1 || m.cols === 1;\n\t}\n\n\tisRange(): this is Value & { value: RangeData } {\n\t\treturn this.type === ValueType.Range;\n\t}\n\n\tisColour(): this is Value & { value: ColourData } {\n\t\treturn this.type === ValueType.Colour;\n\t}\n\n\tisChart(): this is Value & { value: ChartData } {\n\t\treturn this.type === ValueType.Chart;\n\t}\n\n\tisIpCidr(): this is Value & { value: IpCidrData } {\n\t\treturn this.type === ValueType.IpCidr;\n\t}\n\n\tisSymbolic(): this is Value & { value: SymbolicNode } {\n\t\treturn this.type === ValueType.Symbolic;\n\t}\n\n\t/**\n\t * An Error value: a fault carrying a code and message, propagated through the\n\t * DAG when a plugin or opcode cannot produce a quantity.\n\t *\n\t * An Error reads as the number 0 through {@link toNumber}, so a numeric\n\t * consumer that does not check this first cannot tell the fault apart from a\n\t * real zero: exactly the silently-wrong result the engine guards against\n\t * internally with {@link faultedOperand}. A host reading a live {@link Value}\n\t * off a result should branch on this (or {@link isFault}) before trusting the\n\t * number, and read {@link errorCode}/{@link errorMessage} for the detail.\n\t */\n\tisError(): boolean {\n\t\treturn this.type === ValueType.Error;\n\t}\n\n\t/**\n\t * A Pending value: an async result that has not yet resolved, holding the\n\t * query key it is waiting on. Reads as 0 through {@link toNumber}, the same\n\t * caveat as {@link isError}: a settled value arrives on a later evaluation.\n\t */\n\tisPending(): boolean {\n\t\treturn this.type === ValueType.Pending;\n\t}\n\n\t/**\n\t * Either fault, an Error or a Pending: the single predicate to check before\n\t * trusting {@link toNumber}. It mirrors the internal {@link faultedOperand}\n\t * rule that every opcode applies to its operands, so a host reading a result\n\t * makes the same distinction the engine does rather than computing with a\n\t * zero it cannot tell from a real one.\n\t */\n\tisFault(): boolean {\n\t\treturn this.type === ValueType.Error || this.type === ValueType.Pending;\n\t}\n\n\t/**\n\t * The stable {@link ErrorFactory} code of an Error value, else `undefined`.\n\t *\n\t * The code is the machine-branchable identifier (the message is the\n\t * human-facing text, {@link errorMessage}). It reads from the same slot\n\t * {@link errorValue} writes, so it is defined for exactly the values\n\t * {@link isError} accepts and `undefined` for every other type.\n\t */\n\tget errorCode(): string | undefined {\n\t\treturn this.type === ValueType.Error ? (this.value as string) : undefined;\n\t}\n\n\t/**\n\t * The human-facing message of an Error value, else `undefined`. Paired with\n\t * {@link errorCode}, which carries the branchable identifier.\n\t */\n\tget errorMessage(): string | undefined {\n\t\treturn this.type === ValueType.Error ? this.unit : undefined;\n\t}\n\n\ttoNumber(): number {\n\t\t// Pending/Error have no numeric representation at all, 0 (established\n\t\t// convention). A genuinely multi-cell Matrix has no single numeric\n\t\t// representation either (real callers branch on `.isMatrix()` BEFORE\n\t\t// reaching this fallback. See e.g. VM.ts's MUL/comparison dispatch)\n\t\t// but a 1x1 Matrix, the shape `float(x)`'s legacy sugar produces, see\n\t\t// packages/vector/parselets/FloatParselet.ts, IS a scalar in every\n\t\t// meaningful sense, so it degrades to that single cell's numeric value\n\t\t// rather than 0 (this exact case used to work \"by accident\" pre-Matrix,\n\t\t// since `parseFloat([2].toString())` happened to yield `2`).\n\t\tif (this.type === ValueType.Pending) return 0;\n\t\tif (this.type === ValueType.Error) return 0;\n\t\tif (this.type === ValueType.Matrix) {\n\t\t\tconst m = this.value as MatrixData;\n\t\t\tif (m.rows === 1 && m.cols === 1 && typeof m.data[0] === \"number\") return m.data[0];\n\t\t\treturn 0;\n\t\t}\n\t\tif (this.type === ValueType.Range) return 0;\n\t\t// A colour is a struct of channels, not a scalar; like Matrix/Range it has\n\t\t// no single numeric reading. Callers branch on `.isColour()` first.\n\t\tif (this.type === ValueType.Colour) return 0;\n\t\t// A chart is a set of points, not a scalar; callers branch on `.isChart()`.\n\t\tif (this.type === ValueType.Chart) return 0;\n\t\t// An IP/CIDR reads as its 32-bit address where a number is wanted (`as int`).\n\t\tif (this.type === ValueType.IpCidr) return (this.value as IpCidrData).addr ?? 0;\n\t\t// A split is a structured multi-share result; its scalar reading is the\n\t\t// \"each\" (base) share, so a numeric consumer or the worker DTO's number\n\t\t// field still gets a sensible value where a caller does not branch first.\n\t\tif (this.type === ValueType.Split) return (this.value as SplitData).shares[0].value;\n\t\t// A symbolic expression has no single concrete numeric value by\n\t\t// definition (it's a free-variable formula), 0, matching the\n\t\t// Pending/Error/Range convention. Real callers branch on\n\t\t// `.isSymbolic()` BEFORE reaching this fallback (see\n\t\t// `VMConversion.ts`'s `binaryOp()`).\n\t\tif (this.type === ValueType.Symbolic) return 0;\n\t\t// A boolean has an obvious numeric reading and no branch used to give it\n\t\t// one, so it fell through to `parseFloat(true)` -> NaN -> 0, and BOTH\n\t\t// booleans read as zero: `true == false` answered true, and every\n\t\t// arithmetic path that mixes a boolean with a number (\"true and 5\")\n\t\t// contributed nothing. 1/0 is the reading every language with a numeric\n\t\t// boolean coercion uses, and the one `if 1 then` already implies.\n\t\tif (this.type === ValueType.Boolean) return this.value === true ? 1 : 0;\n\n\t\tif (this._cachedNumber !== undefined) return this._cachedNumber;\n\n\t\tif (typeof this.value === 'bigint') {\n\t\t\tthis._cachedNumber = Number(this.value);\n\t\t\treturn this._cachedNumber;\n\t\t}\n\t\t// Prevent silent NaN propagation from non-numeric strings\n\t\tconst result = parseFloat(this.value as string);\n\t\tthis._cachedNumber = isNaN(result) ? 0 : result;\n\t\treturn this._cachedNumber;\n\t}\n\n\tisNaN(): boolean {\n\t\tif (this.type === ValueType.Pending) return false;\n\t\tif (this.type === ValueType.Error) return false;\n\t\tif (this.type === ValueType.Matrix) {\n\t\t\tconst m = this.value as MatrixData;\n\t\t\tif (m.rows === 1 && m.cols === 1 && typeof m.data[0] === \"number\") return isNaN(m.data[0]);\n\t\t\treturn false;\n\t\t}\n\t\tif (this.type === ValueType.Range) return false;\n\t\tif (this.type === ValueType.Colour) return false;\n\t\tif (this.type === ValueType.Split) return false;\n\t\tif (this.type === ValueType.Chart) return false;\n\t\tif (this.type === ValueType.IpCidr) return false;\n\t\tif (this.type === ValueType.Symbolic) return false;\n\t\t// Matches toNumber()'s boolean reading above. Without this a Boolean\n\t\t// reached the string branch at the bottom and `parseFloat(true)` made\n\t\t// every boolean report itself as NaN.\n\t\tif (this.type === ValueType.Boolean) return false;\n\t\tif (typeof this.value === 'number') return isNaN(this.value);\n\t\tif (typeof this.value === 'bigint') return false;\n\t\treturn isNaN(parseFloat(this.value as string));\n\t}\n}\n\n/**\n * Create a Number-typed Value. Uses the arena when active for zero-allocation.\n * This is the most common factory, over 90% of all Value creations.\n */\nexport function numberValue(n: number): Value {\n\tif (_arenaActive && _arena) return _arena.acquire(ValueType.Number, n);\n\treturn new Value(ValueType.Number, n);\n}\n\n/**\n * A Number that also carries the exact decimal it was written as.\n *\n * The type stays {@link ValueType.Number} and `value` stays the nearest double,\n * so this Value behaves exactly like any other number everywhere it is read as\n * one. The `exact` sidecar only matters when it later meets a currency: that is\n * what lets \"$0.70 * 1.10\" be exact while \"0.1 + 0.2\" stays the double it was.\n * Decimal-point literals are compiled to this (see the PUSH_DECIMAL opcode).\n */\nexport function numberValueExact(n: number, exact: DecimalData): Value {\n\tconst v = numberValue(n);\n\tv.exact = exact;\n\treturn v;\n}\n\n/**\n * A Number that also carries the exact rational it evaluates to.\n *\n * The rational counterpart of {@link numberValueExact}: the type stays\n * {@link ValueType.Number} and `value` stays the nearest double (recomputed\n * from the rational, so a chain of fraction operations never accumulates\n * float error), so this reads as an ordinary number everywhere. The `rational`\n * sidecar is what keeps the next fraction operation and any `as fraction`\n * exact. Integer division produces this (see the DIV opcode).\n */\nexport function numberValueRational(n: number, rational: Rational): Value {\n\tconst v = numberValue(n);\n\tv.rational = rational;\n\treturn v;\n}\n\n/**\n * A Number that also carries a one-sigma uncertainty (standard error).\n *\n * The uncertainty counterpart of {@link numberValueExact}: the type stays\n * {@link ValueType.Number} and `value` stays the center, so this reads as an\n * ordinary number everywhere. The `uncertainty` sidecar is what lets `+`, `-`,\n * `*`, `/` propagate the tolerance in quadrature. The `±` operator produces\n * this (see the MAKE_UNCERTAIN opcode), as does any of those four ops when an\n * operand already carries one. The magnitude is stored as given, callers pass a\n * non-negative value (`Math.abs` at the seam, quadrature results are already\n * non-negative).\n */\nexport function numberValueUncertain(n: number, uncertainty: number): Value {\n\tconst v = numberValue(n);\n\tv.uncertainty = uncertainty;\n\treturn v;\n}\n\n/** Which base a {@link ValueType.Hex} value is displayed in. */\nexport type DisplayBase = \"hex\" | \"bin\" | \"oct\";\n\n/**\n * Create a Hex-typed Value: a **number** that displays in another base.\n *\n * The type is numeric on purpose, and that is the whole point of it. A base is\n * a way of writing a quantity, not a different kind of quantity, so `0xFF + 1`\n * has to be 256. Returning a string instead makes it 1, because a string reads\n * as zero in arithmetic, and nothing about that failure is visible at the point\n * of use.\n *\n * @param n - The number itself, in full precision. A `bigint` is accepted for\n * the same reason the type is numeric at all: `12345678901234567890n as hex`\n * has an exact answer, and forcing it through a double first rendered\n * 0xAB54A98CEB1F0800 for a value ending 0AD2.\n * @param base - How to display it, defaulting to hexadecimal. Carried in the\n * `unit` slot, which is free for this type.\n */\nexport function hexValue(n: number | bigint, base: DisplayBase = \"hex\"): Value {\n\tconst tag = base === \"hex\" ? undefined : base;\n\tif (_arenaActive && _arena) return _arena.acquire(ValueType.Hex, n, tag);\n\treturn new Value(ValueType.Hex, n, tag);\n}\n\n/** Create a BigInt-typed Value (arbitrary-precision integer). */\nexport function bigIntValue(n: bigint): Value {\n\tif (_arenaActive && _arena) return _arena.acquire(ValueType.BigInt, n);\n\treturn new Value(ValueType.BigInt, n);\n}\n\n/** Create a String-typed Value. */\nexport function stringValue(s: string): Value {\n\tif (_arenaActive && _arena) return _arena.acquire(ValueType.String, s);\n\treturn new Value(ValueType.String, s);\n}\n\n/** Create a Unit-of-Measurement Value (typed number with unit annotation). */\nexport function uomValue(n: number, unit: string): Value {\n\tif (_arenaActive && _arena) return _arena.acquire(ValueType.Uom, n, unit);\n\treturn new Value(ValueType.Uom, n, unit);\n}\n\n/**\n * A unit-of-measurement Value that also carries an exact decimal magnitude.\n *\n * This is how money keeps its precision: `value` is the nearest double (so\n * `toNumber()` and every existing Uom path are unchanged), and `exact` is the\n * decimal the amount really is. Same-currency arithmetic reads `exact` to stay\n * exact, and the formatter reads it to round a half-cent the way a ledger does\n * rather than the way `toFixed` does on a double.\n */\nexport function uomValueExact(n: number, unit: string, exact: DecimalData): Value {\n\tconst v = uomValue(n, unit);\n\tv.exact = exact;\n\treturn v;\n}\n\n// ── Rate, \"quantity per unit of something\" (SoulverCore: `$99/week`\n// `3 hours/day`, `30 fps`). Represented as a `ValueType.Uom` (no new\n// ValueType, a rate IS a unit-of-measurement, just a compound one) whose\n// `unit` string is `\"<numerator>/<denominator>\"`. The numerator is an\n// opaque label (may be a real convertible unit like \"USD\"/\"km\", or a bare\n// tag like \"frames\" that the `convert` package doesn't know about, rate\n// arithmetic never needs to convert the numerator, only compare it for\n// equality when combining two rates). The denominator MUST be a unit\n// `convertUnit()`/`getMeasure()` (uom/UomConverter.ts) recognizes, since\n// that's the part rate arithmetic actually rescales. See `vm/VM.ts`'s\n// `RATE_CONVERT`/`RATE_MUL`/`RATE_DIV` opcodes for the operations built on\n// this representation.\n\n/** Create a Rate value: `magnitude` of `numeratorUnit` per one `denominatorUnit`. */\nexport function rateValue(magnitude: number, numeratorUnit: string, denominatorUnit: string): Value {\n\treturn uomValue(magnitude, `${numeratorUnit}/${denominatorUnit}`);\n}\n\n/** Whether `unit` is a compound rate unit (`\"X/Y\"`) rather than a plain unit. */\nexport function isRateUnit(unit: string | undefined): unit is string {\n\treturn typeof unit === \"string\" && unit.includes(\"/\");\n}\n\n/**\n * Split a rate unit string into its numerator/denominator halves.\n * @throws if `unit` isn't a rate unit, check with {@link isRateUnit} first.\n */\nexport function splitRateUnit(unit: string): { numerator: string; denominator: string } {\n\tconst idx = unit.indexOf(\"/\");\n\tif (idx < 0) {\n\t\tthrow ErrorFactory.internal(\n\t\t\t\"INVALID_RATE_UNIT\",\n\t\t\t`splitRateUnit: \"${unit}\" is not a rate unit (expected \"numerator/denominator\")`,\n\t\t\t{ unit },\n\t\t);\n\t}\n\treturn { numerator: unit.slice(0, idx), denominator: unit.slice(idx + 1) };\n}\n\n/** Join a numerator/denominator pair back into a rate unit string. */\nexport function joinRateUnit(numeratorUnit: string, denominatorUnit: string): string {\n\treturn `${numeratorUnit}/${denominatorUnit}`;\n}\n\n// ── Video timecode, \"HH:MM:SS:FF at a given fps\" (SoulverCore: video\n// editing timecode literals, e.g. `01:02:03:04 at 30fps`). Represented the\n// same way Rate is above: NOT a new ValueType, just a `ValueType.Uom` whose\n// `unit` string is `\"timecode@<fps>\"` and whose numeric `value` is the\n// TOTAL FRAME COUNT since 00:00:00:00 at that fps, e.g. \"00:00:01:00 at\n// 30fps\" is `Uom(30, \"timecode@30\")`.\n//\n// Storing the total frame count (rather than four separate H/M/S/F fields)\n// means ordinary integer addition/subtraction on the numeric value is\n// ALREADY correct carry/borrow-aware arithmetic with zero extra logic\n// e.g. \"frame 29 + 2 frames\" at 30fps is just `29 + 2 = 31`, and 31 total\n// frames at 30fps IS frame 1 of the next second, with no explicit carry\n// step required. Carry/borrow only needs to be reconstructed when\n// converting a total frame count back into HH:MM:SS:FF display notation\n// see `packages/time/timecode/TimecodeMath.ts`'s `framesToTimecodeString()`.\n// See `vm/VM.ts`'s ADD/SUB dispatch for the arithmetic built on this\n// representation (timecode + frames, + duration, + timecode, - timecode).\n\nconst TIMECODE_UNIT_PREFIX = \"timecode@\";\n\n/** Build a timecode Uom unit string embedding its frame rate, e.g. `timecodeUnit(30)` -> `\"timecode@30\"`. */\nexport function timecodeUnit(fps: number): string {\n\treturn `${TIMECODE_UNIT_PREFIX}${fps}`;\n}\n\n/** Whether `unit` is a compound video-timecode unit (`\"timecode@<fps>\"`). */\nexport function isTimecodeUnit(unit: string | undefined): unit is string {\n\treturn typeof unit === \"string\" && unit.startsWith(TIMECODE_UNIT_PREFIX);\n}\n\n/**\n * Extract the fps from a timecode unit string.\n * @throws if `unit` isn't a timecode unit, check with {@link isTimecodeUnit} first.\n */\nexport function timecodeFps(unit: string): number {\n\tif (!isTimecodeUnit(unit)) {\n\t\tthrow ErrorFactory.internal(\n\t\t\t\"INVALID_TIMECODE_UNIT\",\n\t\t\t`timecodeFps: \"${unit}\" is not a timecode unit (expected \"timecode@<fps>\")`,\n\t\t\t{ unit },\n\t\t);\n\t}\n\treturn parseFloat(unit.slice(TIMECODE_UNIT_PREFIX.length));\n}\n\n/**\n * Create a Matrix value from an explicit shape + column-major data array.\n * `data.length` must equal `rows*cols`, callers building a matrix from\n * row-major source syntax (e.g. the `[1,2;3,4]` literal) must transpose\n * into column-major order before calling this; see `MatrixOps.ts`'s\n * `rowMajorToColumnMajor()`.\n */\nexport function matrixValue(rows: number, cols: number, data: readonly MatrixEntry[]): Value {\n\t// Every matrix in the engine is born here, which makes this the one place\n\t// that can charge for one without each producer having to remember to. The\n\t// charge lands after `data` exists, so it is a backstop rather than a\n\t// refusal: it cannot stop a single allocation that is already fatal (the\n\t// sites whose size is knowable in advance charge before allocating, see\n\t// `vm/VM.ts`'s matrix cases), but it does stop the second one, and it means\n\t// an opcode added later inherits the bound without being told about it.\n\t// Free in relative terms: the hasSymbolic scan just below is already O(n)\n\t// over the same cells.\n\tchargeAllocation(data.length, \"matrix cells\");\n\t// A SymbolicNode cell is the only object-typed MatrixEntry variant\n\t// (number/boolean are primitives), a cheap, always-correct way to\n\t// derive hasSymbolic without asking every caller to track it by hand.\n\t// The `\"kind\" in cell` half is a tripwire, not redundancy. MatrixEntry is\n\t// `number | boolean | SymbolicNode`, so an object cell should always be a\n\t// node; requiring the discriminant means a Rational that escaped\n\t// MatrixOps.ts's symbolicToEntry() shows up as a wrong result rather than as\n\t// a matrix that silently believes it is symbolic.\n\tconst hasSymbolic = data.some(cell => typeof cell === \"object\" && cell !== null && \"kind\" in cell);\n\tconst m: MatrixData = { rows, cols, data, hasSymbolic };\n\tif (_arenaActive && _arena) return _arena.acquire(ValueType.Matrix, m);\n\treturn new Value(ValueType.Matrix, m);\n}\n\n/** A 1×N row-vector Matrix, row-major and column-major storage are identical for a single row. */\nexport function rowVectorValue(data: readonly number[]): Value {\n\treturn matrixValue(1, data.length, data);\n}\n\n/** An N×1 column-vector Matrix, row-major and column-major storage are identical for a single column. */\nexport function colVectorValue(data: readonly number[]): Value {\n\treturn matrixValue(data.length, 1, data);\n}\n\n/** Create a Range value, a first-class integer range `min:max`, both bounds inclusive. */\nexport function rangeValue(min: number, max: number): Value {\n\tconst r: RangeData = { min, max };\n\tif (_arenaActive && _arena) return _arena.acquire(ValueType.Range, r);\n\treturn new Value(ValueType.Range, r);\n}\n\n/**\n * Create a Colour value from canonical sRGB channels plus a display format.\n * Arena-backed like the other synchronous factories; the `ColourData` struct in\n * the `value` slot is immutable, so arena recycle is safe with no extra clearing\n * (matching {@link matrixValue}/{@link rangeValue}).\n */\nexport function colourValue(c: ColourData): Value {\n\tif (_arenaActive && _arena) return _arena.acquire(ValueType.Colour, c);\n\treturn new Value(ValueType.Colour, c);\n}\n\n/**\n * Create a Split value from its structured per-share payload. Arena-backed like\n * the other synchronous factories; the {@link SplitData} struct in the `value`\n * slot is immutable, so arena recycle is safe with no extra clearing (matching\n * {@link colourValue}/{@link rangeValue}).\n */\nexport function splitValue(data: SplitData): Value {\n\tif (_arenaActive && _arena) return _arena.acquire(ValueType.Split, data);\n\treturn new Value(ValueType.Split, data);\n}\n\n/** Create a Chart value from its specification. Arena-backed like the other\n * struct factories; the {@link ChartData} in the `value` slot is immutable, so\n * arena recycle is safe with no extra clearing. */\nexport function chartValue(data: ChartData): Value {\n\tif (_arenaActive && _arena) return _arena.acquire(ValueType.Chart, data);\n\treturn new Value(ValueType.Chart, data);\n}\n\n/** Create an IPv4 address/subnet Value. Arena-backed; the {@link IpCidrData} is immutable. */\nexport function ipCidrValue(data: IpCidrData): Value {\n\tif (_arenaActive && _arena) return _arena.acquire(ValueType.IpCidr, data);\n\treturn new Value(ValueType.IpCidr, data);\n}\n\n/** Create a Symbolic value, a free-variable algebraic expression tree (`symbolic/SymbolicNode.ts`'s `SymbolicNode`), not a concrete number. */\nexport function symbolicValue(node: SymbolicNode): Value {\n\tif (_arenaActive && _arena) return _arena.acquire(ValueType.Symbolic, node);\n\treturn new Value(ValueType.Symbolic, node);\n}\n\n\n\n/** Create a Boolean-typed Value. */\nexport function boolValue(b: boolean): Value {\n\tif (_arenaActive && _arena) return _arena.acquire(ValueType.Boolean, b);\n\treturn new Value(ValueType.Boolean, b);\n}\n\n/** Create a Datetime-typed Value (Unix timestamp in milliseconds). */\nexport function datetimeValue(n: number): Value {\n\tif (_arenaActive && _arena) return _arena.acquire(ValueType.Datetime, n);\n\treturn new Value(ValueType.Datetime, n);\n}\n\n/** Create a Percentage-typed Value (stored as fraction, e.g. 0.5 for 50%). */\nexport function percentageValue(n: number): Value {\n\tif (_arenaActive && _arena) return _arena.acquire(ValueType.Percentage, n);\n\treturn new Value(ValueType.Percentage, n);\n}\n\n/**\n * Create a Pending value, signals that an async result is not yet resolved.\n * The value field stores the queryKey string for deduplication and diagnostics.\n * Pending values should NEVER be stored in the arena (they persist across\n * scroll frames until resolution completes).\n */\nexport function pendingValue(queryKey: string): Value {\n\treturn new Value(ValueType.Pending, queryKey);\n}\n\n/**\n * Create an Error value, propagated through the DAG when a plugin raises an error.\n * The value field stores the EngineError code, unit stores the message.\n * Downstream consumers (lines that depend on errored data) bubble this up.\n * Should NEVER be stored in the arena.\n */\nexport function errorValue(code: string, message: string): Value {\n\treturn new Value(ValueType.Error, code, message);\n}\n\n/**\n * The first operand carrying a fault rather than a quantity, if any does.\n *\n * `Error` and `Pending` both read as the number 0 through {@link Value.toNumber},\n * by a convention that only holds up as long as nothing asks. Every opcode and\n * builtin that reaches for an operand's number without asking its type first\n * therefore computes with a zero it cannot tell apart from a real one, and\n * hands back an answer dressed in whatever type it was going to produce\n * anyway. That is how `(5 kg to m) to s` came to answer `0.00 s`: the failed\n * conversion is an Error, the second conversion read it as zero, and the unit\n * the reader asked for made the result look like a conversion that worked.\n *\n * Operands are checked left to right, matching evaluation order, and the\n * faulted Value is returned AS IT IS rather than replaced with a fresh one, so\n * the original code and message (or the pending query key) reach the caller\n * unchanged. `binaryOp` (vm/VMConversion.ts) and `OpCode.EXP` already did this\n * inline; this is the same rule for every other site, in one place so a site\n * added later can adopt it in a line.\n *\n * Three operands cover every call site in the VM (`MAT_INDEX2` and `MAT_SLICE`\n * are the widest). A variadic signature would allocate an arguments array on\n * paths that run per instruction; see {@link faultedIn} for the list case.\n *\n * @returns The faulted operand, or `null` when all of them carry a value.\n */\nexport function faultedOperand(a: Value, b?: Value, c?: Value): Value | null {\n\tif (a.type === ValueType.Error || a.type === ValueType.Pending) return a;\n\tif (b !== undefined && (b.type === ValueType.Error || b.type === ValueType.Pending)) return b;\n\tif (c !== undefined && (c.type === ValueType.Error || c.type === ValueType.Pending)) return c;\n\treturn null;\n}\n\n/**\n * {@link faultedOperand} over an already-built list, for the call sites that\n * have one (a builtin's arguments, a plugin function's).\n *\n * @returns The first faulted element, or `null` when every element carries a value.\n */\nexport function faultedIn(values: readonly Value[]): Value | null {\n\tfor (let i = 0; i < values.length; i++) {\n\t\tconst v = values[i];\n\t\tif (v.type === ValueType.Error || v.type === ValueType.Pending) return v;\n\t}\n\treturn null;\n}\n"]}