solve-engine 2.32.0 → 2.33.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 (226) hide show
  1. package/dist/{EngineError-CqGtaT_v.d.cts → EngineError-Bm4OYmw8.d.cts} +6 -0
  2. package/dist/{EngineError-CqGtaT_v.d.ts → EngineError-Bm4OYmw8.d.ts} +6 -0
  3. package/dist/{Lexer-CqFjYoRA.d.ts → Lexer-DPn5dfCH.d.ts} +1 -13
  4. package/dist/{Lexer-sCI05tqO.d.cts → Lexer-DaWkCu84.d.cts} +1 -13
  5. package/dist/{PackageCompatibility-phvSFP4f.d.ts → PackageCompatibility-CkzZfoJ3.d.ts} +1 -1
  6. package/dist/{PackageCompatibility-Bn-T_xKW.d.cts → PackageCompatibility-E_5GtcQW.d.cts} +1 -1
  7. package/dist/{PackageRegistry-C78jVkI9.d.ts → PackageRegistry-DSqic8kz.d.ts} +132 -23
  8. package/dist/{PackageRegistry-B-C1duZw.d.cts → PackageRegistry-js47hr28.d.cts} +132 -23
  9. package/dist/{Parselet-Dgymjxzd.d.ts → Parselet-CQjcHOKw.d.ts} +13 -6
  10. package/dist/{Parselet-DF3864la.d.cts → Parselet-s1sRRn8H.d.cts} +13 -6
  11. package/dist/{TokenNormalizer-Pe3_390t.d.cts → TokenNormalizer-D382VSYh.d.cts} +4 -1
  12. package/dist/{TokenNormalizer-IF7nPRMp.d.ts → TokenNormalizer-DAzPp-j1.d.ts} +4 -1
  13. package/dist/{VMBuiltins-BkKzhj6C.d.cts → VMBuiltins-JCavlQUj.d.cts} +53 -18
  14. package/dist/{VMBuiltins-Du9y8sEo.d.ts → VMBuiltins-qgzA6qGi.d.ts} +53 -18
  15. package/dist/{VMCheckpoints-WdUQrdc9.d.cts → VMCheckpoints-BxPzmdu0.d.cts} +2 -2
  16. package/dist/{VMCheckpoints-gvy_yxYh.d.ts → VMCheckpoints-DjjE92mf.d.ts} +2 -2
  17. package/dist/{Value-BYHw-x7q.d.cts → Value-2TIKi-YL.d.cts} +19 -0
  18. package/dist/{Value-BYHw-x7q.d.ts → Value-2TIKi-YL.d.ts} +19 -0
  19. package/dist/{WorkerError-DTrl3Jag.d.ts → WorkerError-BaN8_eok.d.ts} +1 -1
  20. package/dist/{WorkerError-CRoM8Ju1.d.cts → WorkerError-CexHHmbb.d.cts} +1 -1
  21. package/dist/{chunk-AGCNMEP2.cjs → chunk-3MG7VIPL.cjs} +2 -2
  22. package/dist/{chunk-AGCNMEP2.cjs.map → chunk-3MG7VIPL.cjs.map} +1 -1
  23. package/dist/chunk-4ASM522I.js +2 -0
  24. package/dist/chunk-4ASM522I.js.map +1 -0
  25. package/dist/chunk-4M3FZRGL.cjs +5 -0
  26. package/dist/chunk-4M3FZRGL.cjs.map +1 -0
  27. package/dist/{chunk-KH4QXKLT.js → chunk-4MD5L23F.js} +2 -2
  28. package/dist/{chunk-KH4QXKLT.js.map → chunk-4MD5L23F.js.map} +1 -1
  29. package/dist/{chunk-IQVSCL2R.js → chunk-4XWZXP6I.js} +3 -3
  30. package/dist/{chunk-IQVSCL2R.js.map → chunk-4XWZXP6I.js.map} +1 -1
  31. package/dist/{chunk-AXTYQFIV.cjs → chunk-6DCSGINN.cjs} +3 -3
  32. package/dist/{chunk-AXTYQFIV.cjs.map → chunk-6DCSGINN.cjs.map} +1 -1
  33. package/dist/{chunk-RELMEWY6.js → chunk-6G2NES2I.js} +2 -2
  34. package/dist/chunk-6G2NES2I.js.map +1 -0
  35. package/dist/{chunk-CDE2ZUGG.js → chunk-6NL7RBAG.js} +2 -2
  36. package/dist/{chunk-CDE2ZUGG.js.map → chunk-6NL7RBAG.js.map} +1 -1
  37. package/dist/{chunk-SUAGBRQ7.cjs → chunk-6SYU4MH7.cjs} +2 -2
  38. package/dist/chunk-6SYU4MH7.cjs.map +1 -0
  39. package/dist/chunk-72J5V7SN.cjs +2 -0
  40. package/dist/chunk-72J5V7SN.cjs.map +1 -0
  41. package/dist/chunk-7CRVRPV7.cjs +3 -0
  42. package/dist/chunk-7CRVRPV7.cjs.map +1 -0
  43. package/dist/chunk-ADK7LGYN.js +5 -0
  44. package/dist/chunk-ADK7LGYN.js.map +1 -0
  45. package/dist/chunk-APYRNAU2.js +2 -0
  46. package/dist/chunk-APYRNAU2.js.map +1 -0
  47. package/dist/{chunk-IJE4AEDX.js → chunk-D55NMAGM.js} +3 -3
  48. package/dist/{chunk-IJE4AEDX.js.map → chunk-D55NMAGM.js.map} +1 -1
  49. package/dist/chunk-DB5ISONG.js +2 -0
  50. package/dist/chunk-DB5ISONG.js.map +1 -0
  51. package/dist/chunk-EOKHRS2T.js +2 -0
  52. package/dist/chunk-EOKHRS2T.js.map +1 -0
  53. package/dist/{chunk-NQFCXLEF.js → chunk-EOO6M65F.js} +2 -2
  54. package/dist/{chunk-NQFCXLEF.js.map → chunk-EOO6M65F.js.map} +1 -1
  55. package/dist/{chunk-A764BY7L.cjs → chunk-EQNKDTMX.cjs} +2 -2
  56. package/dist/{chunk-A764BY7L.cjs.map → chunk-EQNKDTMX.cjs.map} +1 -1
  57. package/dist/chunk-FESR6PZI.cjs +2 -0
  58. package/dist/chunk-FESR6PZI.cjs.map +1 -0
  59. package/dist/chunk-G5TZ6TDA.js +2 -0
  60. package/dist/chunk-G5TZ6TDA.js.map +1 -0
  61. package/dist/chunk-GDLYXRMA.cjs +2 -0
  62. package/dist/chunk-GDLYXRMA.cjs.map +1 -0
  63. package/dist/chunk-HOU7QTE7.js +3 -0
  64. package/dist/chunk-HOU7QTE7.js.map +1 -0
  65. package/dist/{chunk-CAJTDZ5B.cjs → chunk-HPV4CKCC.cjs} +2 -2
  66. package/dist/{chunk-CAJTDZ5B.cjs.map → chunk-HPV4CKCC.cjs.map} +1 -1
  67. package/dist/{chunk-7DJYS5PO.cjs → chunk-HSTGWWU2.cjs} +2 -2
  68. package/dist/{chunk-7DJYS5PO.cjs.map → chunk-HSTGWWU2.cjs.map} +1 -1
  69. package/dist/{chunk-OE2DBN4K.js → chunk-INMJ7ZXL.js} +2 -2
  70. package/dist/chunk-INMJ7ZXL.js.map +1 -0
  71. package/dist/{chunk-TSJ4RQLZ.js → chunk-J3YC3IQD.js} +2 -2
  72. package/dist/{chunk-TSJ4RQLZ.js.map → chunk-J3YC3IQD.js.map} +1 -1
  73. package/dist/{chunk-5AKT36UK.cjs → chunk-K3PZ66XR.cjs} +2 -2
  74. package/dist/{chunk-5AKT36UK.cjs.map → chunk-K3PZ66XR.cjs.map} +1 -1
  75. package/dist/chunk-LI6LYJDA.cjs +2 -0
  76. package/dist/chunk-LI6LYJDA.cjs.map +1 -0
  77. package/dist/{chunk-WQGHJAW2.cjs → chunk-M4UC2PB6.cjs} +2 -2
  78. package/dist/{chunk-WQGHJAW2.cjs.map → chunk-M4UC2PB6.cjs.map} +1 -1
  79. package/dist/chunk-O7HF345B.js +2 -0
  80. package/dist/chunk-O7HF345B.js.map +1 -0
  81. package/dist/{chunk-CM2WM5CM.cjs → chunk-OBZJKZ2F.cjs} +2 -2
  82. package/dist/{chunk-CM2WM5CM.cjs.map → chunk-OBZJKZ2F.cjs.map} +1 -1
  83. package/dist/{chunk-Q7TBBV62.cjs → chunk-P5YWBIIU.cjs} +2 -2
  84. package/dist/chunk-P5YWBIIU.cjs.map +1 -0
  85. package/dist/chunk-PICFFFJV.js +3 -0
  86. package/dist/chunk-PICFFFJV.js.map +1 -0
  87. package/dist/{chunk-P43SV4NJ.cjs → chunk-QOOTRUY7.cjs} +3 -3
  88. package/dist/{chunk-P43SV4NJ.cjs.map → chunk-QOOTRUY7.cjs.map} +1 -1
  89. package/dist/chunk-R3W53ZMP.cjs +2 -0
  90. package/dist/chunk-R3W53ZMP.cjs.map +1 -0
  91. package/dist/chunk-RMDCGYZM.js +2 -0
  92. package/dist/chunk-RMDCGYZM.js.map +1 -0
  93. package/dist/{chunk-CB3EXUM2.js → chunk-RU3KGJRA.js} +2 -2
  94. package/dist/chunk-RU3KGJRA.js.map +1 -0
  95. package/dist/chunk-S3SPDK6N.cjs +2 -0
  96. package/dist/chunk-S3SPDK6N.cjs.map +1 -0
  97. package/dist/chunk-SF5QVUEI.cjs +3 -0
  98. package/dist/chunk-SF5QVUEI.cjs.map +1 -0
  99. package/dist/{chunk-FXB5GCBT.js → chunk-TJKN466F.js} +2 -2
  100. package/dist/{chunk-FXB5GCBT.js.map → chunk-TJKN466F.js.map} +1 -1
  101. package/dist/{chunk-VLX7ZVK4.js → chunk-U5MESNRT.js} +2 -2
  102. package/dist/{chunk-VLX7ZVK4.js.map → chunk-U5MESNRT.js.map} +1 -1
  103. package/dist/{chunk-YWF6C2IO.cjs → chunk-WFT3XUSH.cjs} +2 -2
  104. package/dist/{chunk-YWF6C2IO.cjs.map → chunk-WFT3XUSH.cjs.map} +1 -1
  105. package/dist/{chunk-3ZGFAE3Q.js → chunk-X2GQAKL2.js} +2 -2
  106. package/dist/{chunk-3ZGFAE3Q.js.map → chunk-X2GQAKL2.js.map} +1 -1
  107. package/dist/{chunk-G3POUURF.js → chunk-YID47OPR.js} +2 -2
  108. package/dist/{chunk-G3POUURF.js.map → chunk-YID47OPR.js.map} +1 -1
  109. package/dist/chunk-YV4GDW5A.cjs +2 -0
  110. package/dist/chunk-YV4GDW5A.cjs.map +1 -0
  111. package/dist/chunk-ZSXQP7PD.cjs +2 -0
  112. package/dist/chunk-ZSXQP7PD.cjs.map +1 -0
  113. package/dist/constants.cjs +1 -1
  114. package/dist/constants.js +1 -1
  115. package/dist/engine.cjs +1 -1
  116. package/dist/engine.d.cts +10 -10
  117. package/dist/engine.d.ts +10 -10
  118. package/dist/engine.js +1 -1
  119. package/dist/engine.worker.cjs +1 -1
  120. package/dist/engine.worker.cjs.map +1 -1
  121. package/dist/engine.worker.js +1 -1
  122. package/dist/engine.worker.js.map +1 -1
  123. package/dist/errors.cjs +1 -1
  124. package/dist/errors.d.cts +3 -3
  125. package/dist/errors.d.ts +3 -3
  126. package/dist/errors.js +1 -1
  127. package/dist/format.cjs +1 -1
  128. package/dist/format.d.cts +1 -1
  129. package/dist/format.d.ts +1 -1
  130. package/dist/format.js +1 -1
  131. package/dist/index.cjs +1 -1
  132. package/dist/index.cjs.map +1 -1
  133. package/dist/index.d.cts +10 -10
  134. package/dist/index.d.ts +10 -10
  135. package/dist/index.js +1 -1
  136. package/dist/index.js.map +1 -1
  137. package/dist/language.d.cts +9 -9
  138. package/dist/language.d.ts +9 -9
  139. package/dist/lexer.cjs +1 -1
  140. package/dist/lexer.d.cts +3 -3
  141. package/dist/lexer.d.ts +3 -3
  142. package/dist/lexer.js +1 -1
  143. package/dist/normalizer.cjs +1 -1
  144. package/dist/normalizer.d.cts +2 -2
  145. package/dist/normalizer.d.ts +2 -2
  146. package/dist/normalizer.js +1 -1
  147. package/dist/packages.cjs +1 -1
  148. package/dist/packages.d.cts +8 -8
  149. package/dist/packages.d.ts +8 -8
  150. package/dist/packages.js +1 -1
  151. package/dist/parser.cjs +1 -1
  152. package/dist/parser.d.cts +3 -3
  153. package/dist/parser.d.ts +3 -3
  154. package/dist/parser.js +1 -1
  155. package/dist/{pipeline-BYkKNpql.d.cts → pipeline-Bum6y1B9.d.cts} +1 -1
  156. package/dist/{pipeline-Cl7KW8CB.d.ts → pipeline-DOo3KHaq.d.ts} +1 -1
  157. package/dist/resolvers.cjs +1 -1
  158. package/dist/resolvers.d.cts +69 -3
  159. package/dist/resolvers.d.ts +69 -3
  160. package/dist/resolvers.js +1 -1
  161. package/dist/temporal.cjs +1 -1
  162. package/dist/temporal.js +1 -1
  163. package/dist/testing.cjs +2 -2
  164. package/dist/testing.cjs.map +1 -1
  165. package/dist/testing.d.cts +9 -9
  166. package/dist/testing.d.ts +9 -9
  167. package/dist/testing.js +1 -1
  168. package/dist/testing.js.map +1 -1
  169. package/dist/uom.cjs +1 -1
  170. package/dist/uom.d.cts +35 -2
  171. package/dist/uom.d.ts +35 -2
  172. package/dist/uom.js +1 -1
  173. package/dist/vm.cjs +1 -1
  174. package/dist/vm.d.cts +6 -6
  175. package/dist/vm.d.ts +6 -6
  176. package/dist/vm.js +1 -1
  177. package/dist/worker.cjs +2 -2
  178. package/dist/worker.cjs.map +1 -1
  179. package/dist/worker.d.cts +9 -9
  180. package/dist/worker.d.ts +9 -9
  181. package/dist/worker.js +1 -1
  182. package/dist/worker.js.map +1 -1
  183. package/package.json +1 -1
  184. package/dist/chunk-4DR5RBHQ.cjs +0 -2
  185. package/dist/chunk-4DR5RBHQ.cjs.map +0 -1
  186. package/dist/chunk-4IC5OARK.js +0 -3
  187. package/dist/chunk-4IC5OARK.js.map +0 -1
  188. package/dist/chunk-7ODHPWQC.js +0 -5
  189. package/dist/chunk-7ODHPWQC.js.map +0 -1
  190. package/dist/chunk-A755LVPT.cjs +0 -2
  191. package/dist/chunk-A755LVPT.cjs.map +0 -1
  192. package/dist/chunk-AF6NDOIE.js +0 -2
  193. package/dist/chunk-AF6NDOIE.js.map +0 -1
  194. package/dist/chunk-B2NL65FI.js +0 -2
  195. package/dist/chunk-B2NL65FI.js.map +0 -1
  196. package/dist/chunk-CB3EXUM2.js.map +0 -1
  197. package/dist/chunk-DUFEONVN.cjs +0 -3
  198. package/dist/chunk-DUFEONVN.cjs.map +0 -1
  199. package/dist/chunk-IJHL3LMH.js +0 -2
  200. package/dist/chunk-IJHL3LMH.js.map +0 -1
  201. package/dist/chunk-LCYQQFUH.cjs +0 -2
  202. package/dist/chunk-LCYQQFUH.cjs.map +0 -1
  203. package/dist/chunk-LP3JYC3A.js +0 -2
  204. package/dist/chunk-LP3JYC3A.js.map +0 -1
  205. package/dist/chunk-OE2DBN4K.js.map +0 -1
  206. package/dist/chunk-OKKGPINQ.cjs +0 -5
  207. package/dist/chunk-OKKGPINQ.cjs.map +0 -1
  208. package/dist/chunk-OM7NOHJF.cjs +0 -2
  209. package/dist/chunk-OM7NOHJF.cjs.map +0 -1
  210. package/dist/chunk-PTXUWGRR.js +0 -3
  211. package/dist/chunk-PTXUWGRR.js.map +0 -1
  212. package/dist/chunk-Q7TBBV62.cjs.map +0 -1
  213. package/dist/chunk-RELMEWY6.js.map +0 -1
  214. package/dist/chunk-SFM4XFGJ.js +0 -2
  215. package/dist/chunk-SFM4XFGJ.js.map +0 -1
  216. package/dist/chunk-SRAU3BLV.cjs +0 -3
  217. package/dist/chunk-SRAU3BLV.cjs.map +0 -1
  218. package/dist/chunk-SUAGBRQ7.cjs.map +0 -1
  219. package/dist/chunk-UNKZ5XRC.cjs +0 -2
  220. package/dist/chunk-UNKZ5XRC.cjs.map +0 -1
  221. package/dist/chunk-WU7SBKVU.cjs +0 -2
  222. package/dist/chunk-WU7SBKVU.cjs.map +0 -1
  223. package/dist/chunk-X5K72MBV.js +0 -2
  224. package/dist/chunk-X5K72MBV.js.map +0 -1
  225. package/dist/chunk-ZVPZQ66D.cjs +0 -2
  226. package/dist/chunk-ZVPZQ66D.cjs.map +0 -1
package/dist/constants.js CHANGED
@@ -1,2 +1,2 @@
1
- export{d as ConfigManager,b as DEFAULT_CONFIG,a as ENGINE_VERSION}from'./chunk-TSJ4RQLZ.js';import'./chunk-RELMEWY6.js';//# sourceMappingURL=constants.js.map
1
+ export{d as ConfigManager,b as DEFAULT_CONFIG,a as ENGINE_VERSION}from'./chunk-J3YC3IQD.js';import'./chunk-6G2NES2I.js';//# sourceMappingURL=constants.js.map
2
2
  //# sourceMappingURL=constants.js.map
package/dist/engine.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkAXTYQFIV_cjs=require('./chunk-AXTYQFIV.cjs');require('./chunk-EFJCC6FJ.cjs');var chunkOKKGPINQ_cjs=require('./chunk-OKKGPINQ.cjs');require('./chunk-Q7TBBV62.cjs'),require('./chunk-NGBBNL4K.cjs'),require('./chunk-ZVPZQ66D.cjs'),require('./chunk-TTFO4YDP.cjs'),require('./chunk-UNKZ5XRC.cjs'),require('./chunk-HG4NPDN5.cjs'),require('./chunk-P43SV4NJ.cjs'),require('./chunk-R2SZFJTT.cjs'),require('./chunk-WQGHJAW2.cjs'),require('./chunk-5AKT36UK.cjs'),require('./chunk-4DR5RBHQ.cjs'),require('./chunk-UURM7P3P.cjs'),require('./chunk-ZLRJ7TDP.cjs'),require('./chunk-LCYQQFUH.cjs'),require('./chunk-CM2WM5CM.cjs'),require('./chunk-DUFEONVN.cjs'),require('./chunk-ABVDKMNF.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-5TVI2UPZ.cjs'),require('./chunk-YWF6C2IO.cjs');var chunkA764BY7L_cjs=require('./chunk-A764BY7L.cjs');require('./chunk-E4HAKNBQ.cjs'),require('./chunk-OM7NOHJF.cjs'),require('./chunk-PHWIO4P3.cjs'),require('./chunk-CAJTDZ5B.cjs'),require('./chunk-AGCNMEP2.cjs'),require('./chunk-Y7O4D3BJ.cjs'),require('./chunk-WU7SBKVU.cjs'),require('./chunk-YBQOQTVL.cjs'),require('./chunk-S3DFU33X.cjs'),require('./chunk-J4LSAHCY.cjs'),require('./chunk-EZKR44MA.cjs'),require('./chunk-SUAGBRQ7.cjs');Object.defineProperty(exports,"DocumentModel",{enumerable:true,get:function(){return chunkAXTYQFIV_cjs.a}});Object.defineProperty(exports,"EvalTier",{enumerable:true,get:function(){return chunkAXTYQFIV_cjs.b}});Object.defineProperty(exports,"ThreeTierEvaluator",{enumerable:true,get:function(){return chunkAXTYQFIV_cjs.c}});Object.defineProperty(exports,"evaluateDocument",{enumerable:true,get:function(){return chunkAXTYQFIV_cjs.d}});Object.defineProperty(exports,"AsyncResolutionBatcher",{enumerable:true,get:function(){return chunkOKKGPINQ_cjs.i}});Object.defineProperty(exports,"ExpressionEngine",{enumerable:true,get:function(){return chunkOKKGPINQ_cjs.o}});Object.defineProperty(exports,"SNAPSHOT_FORMAT",{enumerable:true,get:function(){return chunkOKKGPINQ_cjs.d}});Object.defineProperty(exports,"SNAPSHOT_VERSION",{enumerable:true,get:function(){return chunkOKKGPINQ_cjs.e}});Object.defineProperty(exports,"SnapshotErrorCodes",{enumerable:true,get:function(){return chunkOKKGPINQ_cjs.f}});Object.defineProperty(exports,"checkExpressionComplexity",{enumerable:true,get:function(){return chunkOKKGPINQ_cjs.k}});Object.defineProperty(exports,"checkExpressionLength",{enumerable:true,get:function(){return chunkOKKGPINQ_cjs.j}});Object.defineProperty(exports,"extractReadsAndWrites",{enumerable:true,get:function(){return chunkOKKGPINQ_cjs.l}});Object.defineProperty(exports,"findInlineSolvesInLine",{enumerable:true,get:function(){return chunkOKKGPINQ_cjs.n}});Object.defineProperty(exports,"isEmptyLine",{enumerable:true,get:function(){return chunkOKKGPINQ_cjs.m}});Object.defineProperty(exports,"setEngineWorkerFactory",{enumerable:true,get:function(){return chunkOKKGPINQ_cjs.g}});Object.defineProperty(exports,"DATE_CALENDAR",{enumerable:true,get:function(){return chunkA764BY7L_cjs.b}});Object.defineProperty(exports,"DateCalendar",{enumerable:true,get:function(){return chunkA764BY7L_cjs.a}});Object.defineProperty(exports,"calendarOf",{enumerable:true,get:function(){return chunkA764BY7L_cjs.c}});Object.defineProperty(exports,"dateCalendarInZone",{enumerable:true,get:function(){return chunkA764BY7L_cjs.d}});//# sourceMappingURL=engine.cjs.map
1
+ 'use strict';var chunk6DCSGINN_cjs=require('./chunk-6DCSGINN.cjs');require('./chunk-EFJCC6FJ.cjs');var chunk4M3FZRGL_cjs=require('./chunk-4M3FZRGL.cjs');require('./chunk-P5YWBIIU.cjs'),require('./chunk-NGBBNL4K.cjs'),require('./chunk-R3W53ZMP.cjs'),require('./chunk-TTFO4YDP.cjs'),require('./chunk-LI6LYJDA.cjs'),require('./chunk-HG4NPDN5.cjs'),require('./chunk-QOOTRUY7.cjs'),require('./chunk-R2SZFJTT.cjs'),require('./chunk-M4UC2PB6.cjs'),require('./chunk-K3PZ66XR.cjs'),require('./chunk-YV4GDW5A.cjs'),require('./chunk-UURM7P3P.cjs'),require('./chunk-GDLYXRMA.cjs'),require('./chunk-ZLRJ7TDP.cjs'),require('./chunk-FESR6PZI.cjs'),require('./chunk-OBZJKZ2F.cjs'),require('./chunk-SF5QVUEI.cjs'),require('./chunk-ABVDKMNF.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-5TVI2UPZ.cjs'),require('./chunk-WFT3XUSH.cjs');var chunkEQNKDTMX_cjs=require('./chunk-EQNKDTMX.cjs');require('./chunk-E4HAKNBQ.cjs'),require('./chunk-S3SPDK6N.cjs'),require('./chunk-PHWIO4P3.cjs'),require('./chunk-HPV4CKCC.cjs'),require('./chunk-3MG7VIPL.cjs'),require('./chunk-Y7O4D3BJ.cjs'),require('./chunk-72J5V7SN.cjs'),require('./chunk-YBQOQTVL.cjs'),require('./chunk-S3DFU33X.cjs'),require('./chunk-J4LSAHCY.cjs'),require('./chunk-EZKR44MA.cjs'),require('./chunk-6SYU4MH7.cjs');Object.defineProperty(exports,"DocumentModel",{enumerable:true,get:function(){return chunk6DCSGINN_cjs.a}});Object.defineProperty(exports,"EvalTier",{enumerable:true,get:function(){return chunk6DCSGINN_cjs.b}});Object.defineProperty(exports,"ThreeTierEvaluator",{enumerable:true,get:function(){return chunk6DCSGINN_cjs.c}});Object.defineProperty(exports,"evaluateDocument",{enumerable:true,get:function(){return chunk6DCSGINN_cjs.d}});Object.defineProperty(exports,"AsyncResolutionBatcher",{enumerable:true,get:function(){return chunk4M3FZRGL_cjs.i}});Object.defineProperty(exports,"ExpressionEngine",{enumerable:true,get:function(){return chunk4M3FZRGL_cjs.o}});Object.defineProperty(exports,"SNAPSHOT_FORMAT",{enumerable:true,get:function(){return chunk4M3FZRGL_cjs.d}});Object.defineProperty(exports,"SNAPSHOT_VERSION",{enumerable:true,get:function(){return chunk4M3FZRGL_cjs.e}});Object.defineProperty(exports,"SnapshotErrorCodes",{enumerable:true,get:function(){return chunk4M3FZRGL_cjs.f}});Object.defineProperty(exports,"checkExpressionComplexity",{enumerable:true,get:function(){return chunk4M3FZRGL_cjs.k}});Object.defineProperty(exports,"checkExpressionLength",{enumerable:true,get:function(){return chunk4M3FZRGL_cjs.j}});Object.defineProperty(exports,"extractReadsAndWrites",{enumerable:true,get:function(){return chunk4M3FZRGL_cjs.l}});Object.defineProperty(exports,"findInlineSolvesInLine",{enumerable:true,get:function(){return chunk4M3FZRGL_cjs.n}});Object.defineProperty(exports,"isEmptyLine",{enumerable:true,get:function(){return chunk4M3FZRGL_cjs.m}});Object.defineProperty(exports,"setEngineWorkerFactory",{enumerable:true,get:function(){return chunk4M3FZRGL_cjs.g}});Object.defineProperty(exports,"DATE_CALENDAR",{enumerable:true,get:function(){return chunkEQNKDTMX_cjs.b}});Object.defineProperty(exports,"DateCalendar",{enumerable:true,get:function(){return chunkEQNKDTMX_cjs.a}});Object.defineProperty(exports,"calendarOf",{enumerable:true,get:function(){return chunkEQNKDTMX_cjs.c}});Object.defineProperty(exports,"dateCalendarInZone",{enumerable:true,get:function(){return chunkEQNKDTMX_cjs.d}});//# sourceMappingURL=engine.cjs.map
2
2
  //# sourceMappingURL=engine.cjs.map
package/dist/engine.d.cts CHANGED
@@ -1,19 +1,19 @@
1
- import { t as DocumentModel, E as ExpressionEngine, V as ViewportRange, u as LineChange, U as UnifiedParsingOptions, P as ParsingResult, v as InlineSolvePosition } from './PackageRegistry-B-C1duZw.cjs';
2
- export { A as ApplyChangesResult, w as AsyncCachePackageInfo, x as AsyncErrorEvent, y as AsyncResolutionBatcher, z as AsyncResolutionEvent, B as BatcherMetrics, F as BytecodeCacheEntry, G as CacheSnapshot, H as CheckpointSnapshot, D as DateOrderSource, b as DateReading, c as DateReadingPolicy, a as EngineOptions, d as EngineRestoreOptions, e as EngineSnapshot, f as Explanation, g as ExplanationStep, J as LineCacheEntryInfo, K as LineState, M as LinesUpdatedEvent, N as ParsedLine, R as ResolvedDateOrder, S as SNAPSHOT_FORMAT, h as SNAPSHOT_VERSION, i as SerializedAnonymousBody, j as SerializedBytecode, k as SerializedDecimal, l as SerializedLineCacheEntry, m as SerializedNumber, n as SerializedRational, o as SerializedUserFunction, p as SerializedValue, q as SnapshotErrorCodes } from './PackageRegistry-B-C1duZw.cjs';
1
+ import { t as DocumentModel, E as ExpressionEngine, V as ViewportRange, u as LineChange, U as UnifiedParsingOptions, P as ParsingResult, v as InlineSolvePosition } from './PackageRegistry-js47hr28.cjs';
2
+ export { A as ApplyChangesResult, w as AsyncCachePackageInfo, x as AsyncErrorEvent, y as AsyncResolutionBatcher, z as AsyncResolutionEvent, B as BatcherMetrics, F as BytecodeCacheEntry, G as CacheSnapshot, H as CheckpointSnapshot, D as DateOrderSource, b as DateReading, c as DateReadingPolicy, a as EngineOptions, d as EngineRestoreOptions, e as EngineSnapshot, f as Explanation, g as ExplanationStep, J as LineCacheEntryInfo, K as LineState, M as LinesUpdatedEvent, N as ParsedLine, R as ResolvedDateOrder, S as SNAPSHOT_FORMAT, h as SNAPSHOT_VERSION, i as SerializedAnonymousBody, j as SerializedBytecode, k as SerializedDecimal, l as SerializedLineCacheEntry, m as SerializedNumber, n as SerializedRational, o as SerializedUserFunction, p as SerializedValue, q as SnapshotErrorCodes } from './PackageRegistry-js47hr28.cjs';
3
3
  export { C as CalendarBackend, a as CalendarFields, Z as ZonedFields } from './CalendarBackend-MdS3Bb4P.cjs';
4
4
  export { D as DATE_CALENDAR, a as DateCalendar, E as EngineWorkerFactory, c as calendarOf, d as dateCalendarInZone, s as setEngineWorkerFactory } from './DateCalendar-GFQDX1ng.cjs';
5
- import { V as Value } from './Value-BYHw-x7q.cjs';
6
- import { a as VMCheckpointer } from './VMCheckpoints-WdUQrdc9.cjs';
5
+ import { V as Value } from './Value-2TIKi-YL.cjs';
6
+ import { a as VMCheckpointer } from './VMCheckpoints-BxPzmdu0.cjs';
7
7
  import { T as Token } from './Token-D8f7yaz1.cjs';
8
- import { E as EngineError } from './EngineError-CqGtaT_v.cjs';
8
+ import { E as EngineError } from './EngineError-Bm4OYmw8.cjs';
9
9
  import { a as BytecodeProgram } from './BytecodeBuilder-DSWKZi4f.cjs';
10
- export { f as DagSnapshot } from './VMBuiltins-BkKzhj6C.cjs';
11
- import './Parselet-DF3864la.cjs';
12
- import './pipeline-BYkKNpql.cjs';
13
- import './Lexer-sCI05tqO.cjs';
10
+ export { f as DagSnapshot } from './VMBuiltins-JCavlQUj.cjs';
11
+ import './Parselet-s1sRRn8H.cjs';
12
+ import './pipeline-Bum6y1B9.cjs';
13
+ import './Lexer-DaWkCu84.cjs';
14
14
  import './resolvers.cjs';
15
15
  import '@tanstack/query-core';
16
- import './TokenNormalizer-Pe3_390t.cjs';
16
+ import './TokenNormalizer-D382VSYh.cjs';
17
17
  import './Configuration-BxriK9Kw.cjs';
18
18
 
19
19
  /**
package/dist/engine.d.ts CHANGED
@@ -1,19 +1,19 @@
1
- import { t as DocumentModel, E as ExpressionEngine, V as ViewportRange, u as LineChange, U as UnifiedParsingOptions, P as ParsingResult, v as InlineSolvePosition } from './PackageRegistry-C78jVkI9.js';
2
- export { A as ApplyChangesResult, w as AsyncCachePackageInfo, x as AsyncErrorEvent, y as AsyncResolutionBatcher, z as AsyncResolutionEvent, B as BatcherMetrics, F as BytecodeCacheEntry, G as CacheSnapshot, H as CheckpointSnapshot, D as DateOrderSource, b as DateReading, c as DateReadingPolicy, a as EngineOptions, d as EngineRestoreOptions, e as EngineSnapshot, f as Explanation, g as ExplanationStep, J as LineCacheEntryInfo, K as LineState, M as LinesUpdatedEvent, N as ParsedLine, R as ResolvedDateOrder, S as SNAPSHOT_FORMAT, h as SNAPSHOT_VERSION, i as SerializedAnonymousBody, j as SerializedBytecode, k as SerializedDecimal, l as SerializedLineCacheEntry, m as SerializedNumber, n as SerializedRational, o as SerializedUserFunction, p as SerializedValue, q as SnapshotErrorCodes } from './PackageRegistry-C78jVkI9.js';
1
+ import { t as DocumentModel, E as ExpressionEngine, V as ViewportRange, u as LineChange, U as UnifiedParsingOptions, P as ParsingResult, v as InlineSolvePosition } from './PackageRegistry-DSqic8kz.js';
2
+ export { A as ApplyChangesResult, w as AsyncCachePackageInfo, x as AsyncErrorEvent, y as AsyncResolutionBatcher, z as AsyncResolutionEvent, B as BatcherMetrics, F as BytecodeCacheEntry, G as CacheSnapshot, H as CheckpointSnapshot, D as DateOrderSource, b as DateReading, c as DateReadingPolicy, a as EngineOptions, d as EngineRestoreOptions, e as EngineSnapshot, f as Explanation, g as ExplanationStep, J as LineCacheEntryInfo, K as LineState, M as LinesUpdatedEvent, N as ParsedLine, R as ResolvedDateOrder, S as SNAPSHOT_FORMAT, h as SNAPSHOT_VERSION, i as SerializedAnonymousBody, j as SerializedBytecode, k as SerializedDecimal, l as SerializedLineCacheEntry, m as SerializedNumber, n as SerializedRational, o as SerializedUserFunction, p as SerializedValue, q as SnapshotErrorCodes } from './PackageRegistry-DSqic8kz.js';
3
3
  export { C as CalendarBackend, a as CalendarFields, Z as ZonedFields } from './CalendarBackend-MdS3Bb4P.js';
4
4
  export { D as DATE_CALENDAR, a as DateCalendar, E as EngineWorkerFactory, c as calendarOf, d as dateCalendarInZone, s as setEngineWorkerFactory } from './DateCalendar-CTz538dw.js';
5
- import { V as Value } from './Value-BYHw-x7q.js';
6
- import { a as VMCheckpointer } from './VMCheckpoints-gvy_yxYh.js';
5
+ import { V as Value } from './Value-2TIKi-YL.js';
6
+ import { a as VMCheckpointer } from './VMCheckpoints-DjjE92mf.js';
7
7
  import { T as Token } from './Token-D8f7yaz1.js';
8
- import { E as EngineError } from './EngineError-CqGtaT_v.js';
8
+ import { E as EngineError } from './EngineError-Bm4OYmw8.js';
9
9
  import { a as BytecodeProgram } from './BytecodeBuilder-DSWKZi4f.js';
10
- export { f as DagSnapshot } from './VMBuiltins-Du9y8sEo.js';
11
- import './Parselet-Dgymjxzd.js';
12
- import './pipeline-Cl7KW8CB.js';
13
- import './Lexer-CqFjYoRA.js';
10
+ export { f as DagSnapshot } from './VMBuiltins-qgzA6qGi.js';
11
+ import './Parselet-CQjcHOKw.js';
12
+ import './pipeline-DOo3KHaq.js';
13
+ import './Lexer-DPn5dfCH.js';
14
14
  import './resolvers.js';
15
15
  import '@tanstack/query-core';
16
- import './TokenNormalizer-IF7nPRMp.js';
16
+ import './TokenNormalizer-DAzPp-j1.js';
17
17
  import './Configuration-BxriK9Kw.js';
18
18
 
19
19
  /**
package/dist/engine.js CHANGED
@@ -1,2 +1,2 @@
1
- export{a as DocumentModel,b as EvalTier,c as ThreeTierEvaluator,d as evaluateDocument}from'./chunk-IJE4AEDX.js';import'./chunk-RAF57WYO.js';export{i as AsyncResolutionBatcher,o as ExpressionEngine,d as SNAPSHOT_FORMAT,e as SNAPSHOT_VERSION,f as SnapshotErrorCodes,k as checkExpressionComplexity,j as checkExpressionLength,l as extractReadsAndWrites,n as findInlineSolvesInLine,m as isEmptyLine,g as setEngineWorkerFactory}from'./chunk-7ODHPWQC.js';import'./chunk-CB3EXUM2.js';import'./chunk-2RWAXT6O.js';import'./chunk-IJHL3LMH.js';import'./chunk-MIQBJGGR.js';import'./chunk-AF6NDOIE.js';import'./chunk-JP4JMQOG.js';import'./chunk-IQVSCL2R.js';import'./chunk-XEIDV5JP.js';import'./chunk-FXB5GCBT.js';import'./chunk-VLX7ZVK4.js';import'./chunk-B2NL65FI.js';import'./chunk-76F3LCIL.js';import'./chunk-TCZSPH4A.js';import'./chunk-OE2DBN4K.js';import'./chunk-3ZGFAE3Q.js';import'./chunk-PTXUWGRR.js';import'./chunk-TZYMXNIB.js';import'./chunk-HFKDWQUL.js';import'./chunk-5TCSFTZD.js';import'./chunk-KH4QXKLT.js';export{b as DATE_CALENDAR,a as DateCalendar,c as calendarOf,d as dateCalendarInZone}from'./chunk-NQFCXLEF.js';import'./chunk-J4K72CQN.js';import'./chunk-X5K72MBV.js';import'./chunk-BWTVJD5L.js';import'./chunk-TSJ4RQLZ.js';import'./chunk-CDE2ZUGG.js';import'./chunk-JPFCXLJV.js';import'./chunk-LP3JYC3A.js';import'./chunk-FAO6DQ74.js';import'./chunk-LHLW7JLS.js';import'./chunk-CHVGFTO3.js';import'./chunk-PRSXXDTA.js';import'./chunk-RELMEWY6.js';//# sourceMappingURL=engine.js.map
1
+ export{a as DocumentModel,b as EvalTier,c as ThreeTierEvaluator,d as evaluateDocument}from'./chunk-D55NMAGM.js';import'./chunk-RAF57WYO.js';export{i as AsyncResolutionBatcher,o as ExpressionEngine,d as SNAPSHOT_FORMAT,e as SNAPSHOT_VERSION,f as SnapshotErrorCodes,k as checkExpressionComplexity,j as checkExpressionLength,l as extractReadsAndWrites,n as findInlineSolvesInLine,m as isEmptyLine,g as setEngineWorkerFactory}from'./chunk-ADK7LGYN.js';import'./chunk-RU3KGJRA.js';import'./chunk-2RWAXT6O.js';import'./chunk-RMDCGYZM.js';import'./chunk-MIQBJGGR.js';import'./chunk-4ASM522I.js';import'./chunk-JP4JMQOG.js';import'./chunk-4XWZXP6I.js';import'./chunk-XEIDV5JP.js';import'./chunk-TJKN466F.js';import'./chunk-U5MESNRT.js';import'./chunk-DB5ISONG.js';import'./chunk-76F3LCIL.js';import'./chunk-EOKHRS2T.js';import'./chunk-TCZSPH4A.js';import'./chunk-INMJ7ZXL.js';import'./chunk-X2GQAKL2.js';import'./chunk-PICFFFJV.js';import'./chunk-TZYMXNIB.js';import'./chunk-HFKDWQUL.js';import'./chunk-5TCSFTZD.js';import'./chunk-4MD5L23F.js';export{b as DATE_CALENDAR,a as DateCalendar,c as calendarOf,d as dateCalendarInZone}from'./chunk-EOO6M65F.js';import'./chunk-J4K72CQN.js';import'./chunk-O7HF345B.js';import'./chunk-BWTVJD5L.js';import'./chunk-J3YC3IQD.js';import'./chunk-6NL7RBAG.js';import'./chunk-JPFCXLJV.js';import'./chunk-APYRNAU2.js';import'./chunk-FAO6DQ74.js';import'./chunk-LHLW7JLS.js';import'./chunk-CHVGFTO3.js';import'./chunk-PRSXXDTA.js';import'./chunk-6G2NES2I.js';//# sourceMappingURL=engine.js.map
2
2
  //# sourceMappingURL=engine.js.map
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkOKKGPINQ_cjs=require('./chunk-OKKGPINQ.cjs');require('./chunk-Q7TBBV62.cjs'),require('./chunk-NGBBNL4K.cjs'),require('./chunk-ZVPZQ66D.cjs'),require('./chunk-TTFO4YDP.cjs');var chunkUNKZ5XRC_cjs=require('./chunk-UNKZ5XRC.cjs');require('./chunk-HG4NPDN5.cjs'),require('./chunk-P43SV4NJ.cjs'),require('./chunk-R2SZFJTT.cjs');var chunkSRAU3BLV_cjs=require('./chunk-SRAU3BLV.cjs');require('./chunk-A755LVPT.cjs'),require('./chunk-WQGHJAW2.cjs'),require('./chunk-5AKT36UK.cjs'),require('./chunk-4DR5RBHQ.cjs'),require('./chunk-UURM7P3P.cjs'),require('./chunk-ZLRJ7TDP.cjs');var chunkLCYQQFUH_cjs=require('./chunk-LCYQQFUH.cjs');require('./chunk-CM2WM5CM.cjs'),require('./chunk-DUFEONVN.cjs'),require('./chunk-ABVDKMNF.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-5TVI2UPZ.cjs'),require('./chunk-YWF6C2IO.cjs'),require('./chunk-A764BY7L.cjs'),require('./chunk-E4HAKNBQ.cjs'),require('./chunk-OM7NOHJF.cjs'),require('./chunk-PHWIO4P3.cjs'),require('./chunk-CAJTDZ5B.cjs'),require('./chunk-AGCNMEP2.cjs'),require('./chunk-Y7O4D3BJ.cjs'),require('./chunk-WU7SBKVU.cjs'),require('./chunk-YBQOQTVL.cjs'),require('./chunk-S3DFU33X.cjs'),require('./chunk-J4LSAHCY.cjs'),require('./chunk-EZKR44MA.cjs'),require('./chunk-SUAGBRQ7.cjs');var i=null;function E(){return i||(i=new chunkOKKGPINQ_cjs.o({packages:chunkSRAU3BLV_cjs.z})),i}var f=null;function h(){return f||(f=chunkUNKZ5XRC_cjs.c(chunkLCYQQFUH_cjs.w,200,5e4)),f}function B(e){let r={lineId:e.lineId,expression:e.expression,compiledAgainstHash:e.textHash,strings:[],reads:[],writes:[],isVariableDef:false,error:null};try{let n=E(),{program:u,reads:s,writes:t}=n.compileExpression(e.expression),o=t.length>0,a=u.opcodes,l=u.numbers,y=a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength),d=l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength);return {...r,opcodesBuffer:y,numbersBuffer:d,opcodesLength:a.length,numbersLength:l.length,strings:[...u.strings],reads:s,writes:t,isVariableDef:o}}catch(n){return {...r,opcodesBuffer:new ArrayBuffer(0),numbersBuffer:new ArrayBuffer(0),opcodesLength:0,numbersLength:0,error:n instanceof Error?n.message:String(n)}}}function L(e){let r=[],n=[];for(let u of e.items){let s=B(u);r.push(s),s.opcodesBuffer.byteLength>0&&n.push(s.opcodesBuffer),s.numbersBuffer.byteLength>0&&n.push(s.numbersBuffer);}self.postMessage({id:e.id,type:"COMPILE_RESULT",results:r},n);}function M(e){let r=h();r.reset();let n=new Uint8Array(e.opcodesBuffer,0,e.opcodesLength),u=new Float64Array(e.numbersBuffer,0,e.numbersLength),s={opcodes:n,numbers:u,strings:e.strings};try{let t=chunkUNKZ5XRC_cjs.d(s,r);if(t.type==="pending")return {lineNumber:e.lineNumber,valueType:12,value:0,isPending:!0,queryKey:t.queryKey};if(t.type==="error")return {lineNumber:e.lineNumber,valueType:13,value:0,isPending:!1,unit:t.error.message};let o=t.value;return {lineNumber:e.lineNumber,valueType:o.type,value:typeof o.value=="number"?o.value:typeof o.value=="bigint"?Number(o.value):0,unit:o.unit,isPending:!1}}catch{return {lineNumber:e.lineNumber,valueType:13,value:0,isPending:false,unit:"Worker execution failed"}}}function T(e){let r=[];for(let n of e.items)r.push(M(n));self.postMessage({id:e.id,type:"EXECUTE_RESULT",results:r});}var x=typeof self<"u"&&typeof window>"u",C=e=>{if(e.origin&&self.location&&e.origin!==self.location.origin)return;let r=e.data;switch(r.type){case "COMPILE_BATCH":L(r);break;case "EXECUTE_BATCH":T(r);break;case "TERMINATE":{i&&(i.clear(),i=null),f&&(f.reset(),f=null),self.postMessage({id:r.id,type:"COMPILE_RESULT",results:[]});break}default:self.postMessage({id:-1,type:"COMPILE_RESULT",results:[],error:`Unknown message type: ${r.type}`});}};x&&(self.onmessage=C);//# sourceMappingURL=engine.worker.cjs.map
1
+ 'use strict';var chunk4M3FZRGL_cjs=require('./chunk-4M3FZRGL.cjs');require('./chunk-P5YWBIIU.cjs'),require('./chunk-NGBBNL4K.cjs'),require('./chunk-R3W53ZMP.cjs'),require('./chunk-TTFO4YDP.cjs');var chunkLI6LYJDA_cjs=require('./chunk-LI6LYJDA.cjs');require('./chunk-HG4NPDN5.cjs'),require('./chunk-QOOTRUY7.cjs'),require('./chunk-R2SZFJTT.cjs');var chunk7CRVRPV7_cjs=require('./chunk-7CRVRPV7.cjs');require('./chunk-ZSXQP7PD.cjs'),require('./chunk-M4UC2PB6.cjs'),require('./chunk-K3PZ66XR.cjs'),require('./chunk-YV4GDW5A.cjs'),require('./chunk-UURM7P3P.cjs'),require('./chunk-GDLYXRMA.cjs'),require('./chunk-ZLRJ7TDP.cjs');var chunkFESR6PZI_cjs=require('./chunk-FESR6PZI.cjs');require('./chunk-OBZJKZ2F.cjs'),require('./chunk-SF5QVUEI.cjs'),require('./chunk-ABVDKMNF.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-5TVI2UPZ.cjs'),require('./chunk-WFT3XUSH.cjs'),require('./chunk-EQNKDTMX.cjs'),require('./chunk-E4HAKNBQ.cjs'),require('./chunk-S3SPDK6N.cjs'),require('./chunk-PHWIO4P3.cjs'),require('./chunk-HPV4CKCC.cjs'),require('./chunk-3MG7VIPL.cjs'),require('./chunk-Y7O4D3BJ.cjs'),require('./chunk-72J5V7SN.cjs'),require('./chunk-YBQOQTVL.cjs'),require('./chunk-S3DFU33X.cjs'),require('./chunk-J4LSAHCY.cjs'),require('./chunk-EZKR44MA.cjs'),require('./chunk-6SYU4MH7.cjs');var i=null;function E(){return i||(i=new chunk4M3FZRGL_cjs.o({packages:chunk7CRVRPV7_cjs.z})),i}var f=null;function h(){return f||(f=chunkLI6LYJDA_cjs.c(chunkFESR6PZI_cjs.w,200,5e4)),f}function B(e){let r={lineId:e.lineId,expression:e.expression,compiledAgainstHash:e.textHash,strings:[],reads:[],writes:[],isVariableDef:false,error:null};try{let n=E(),{program:u,reads:s,writes:t}=n.compileExpression(e.expression),o=t.length>0,a=u.opcodes,l=u.numbers,y=a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength),d=l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength);return {...r,opcodesBuffer:y,numbersBuffer:d,opcodesLength:a.length,numbersLength:l.length,strings:[...u.strings],reads:s,writes:t,isVariableDef:o}}catch(n){return {...r,opcodesBuffer:new ArrayBuffer(0),numbersBuffer:new ArrayBuffer(0),opcodesLength:0,numbersLength:0,error:n instanceof Error?n.message:String(n)}}}function L(e){let r=[],n=[];for(let u of e.items){let s=B(u);r.push(s),s.opcodesBuffer.byteLength>0&&n.push(s.opcodesBuffer),s.numbersBuffer.byteLength>0&&n.push(s.numbersBuffer);}self.postMessage({id:e.id,type:"COMPILE_RESULT",results:r},n);}function M(e){let r=h();r.reset();let n=new Uint8Array(e.opcodesBuffer,0,e.opcodesLength),u=new Float64Array(e.numbersBuffer,0,e.numbersLength),s={opcodes:n,numbers:u,strings:e.strings};try{let t=chunkLI6LYJDA_cjs.d(s,r);if(t.type==="pending")return {lineNumber:e.lineNumber,valueType:12,value:0,isPending:!0,queryKey:t.queryKey};if(t.type==="error")return {lineNumber:e.lineNumber,valueType:13,value:0,isPending:!1,unit:t.error.message};let o=t.value;return {lineNumber:e.lineNumber,valueType:o.type,value:typeof o.value=="number"?o.value:typeof o.value=="bigint"?Number(o.value):0,unit:o.unit,isPending:!1}}catch{return {lineNumber:e.lineNumber,valueType:13,value:0,isPending:false,unit:"Worker execution failed"}}}function T(e){let r=[];for(let n of e.items)r.push(M(n));self.postMessage({id:e.id,type:"EXECUTE_RESULT",results:r});}var x=typeof self<"u"&&typeof window>"u",C=e=>{if(e.origin&&self.location&&e.origin!==self.location.origin)return;let r=e.data;switch(r.type){case "COMPILE_BATCH":L(r);break;case "EXECUTE_BATCH":T(r);break;case "TERMINATE":{i&&(i.clear(),i=null),f&&(f.reset(),f=null),self.postMessage({id:r.id,type:"COMPILE_RESULT",results:[]});break}default:self.postMessage({id:-1,type:"COMPILE_RESULT",results:[],error:`Unknown message type: ${r.type}`});}};x&&(self.onmessage=C);//# sourceMappingURL=engine.worker.cjs.map
2
2
  //# sourceMappingURL=engine.worker.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/workers/engine.worker.ts"],"names":["compileEngine","getCompileEngine","ExpressionEngine","BUILTIN_PACKAGES","executeVm","getExecuteVm","createVM","sharedOpRegistry","compileOne","item","base","eng","program","reads","writes","isVariableDef","opcodes","numbers","opcodesBuffer","numbersBuffer","e","handleCompileBatch","msg","results","transferList","result","executeOne","vmm","bytecode","executeBytecode","val","handleExecuteBatch","inWorkerScope","handleMessage","event"],"mappings":"quCA0GA,IAAIA,CAAAA,CAAyC,IAAA,CAC7C,SAASC,CAAAA,EAAqC,CAC7C,OAAKD,CAAAA,GAOJA,CAAAA,CAAgB,IAAIE,mBAAAA,CAAiB,CAAE,QAAA,CAAUC,mBAAiB,CAAC,CAAA,CAAA,CAE7DH,CACR,CAEA,IAAII,CAAAA,CAAgD,IAAA,CACpD,SAASC,CAAAA,EAA4C,CACpD,OAAKD,CAAAA,GACJA,CAAAA,CAAYE,mBAAAA,CAASC,mBAAAA,CAAkB,GAAA,CAAK,GAAK,CAAA,CAAA,CAE3CH,CACR,CAUA,SAASI,CAAAA,CAAWC,CAAAA,CAAkC,CACrD,IAAMC,CAAAA,CAAmG,CACxG,MAAA,CAAQD,CAAAA,CAAK,MAAA,CACb,UAAA,CAAYA,CAAAA,CAAK,UAAA,CACjB,mBAAA,CAAqBA,CAAAA,CAAK,QAAA,CAC1B,OAAA,CAAS,EAAC,CACV,KAAA,CAAO,EAAC,CACR,MAAA,CAAQ,EAAC,CACT,aAAA,CAAe,KAAA,CACf,MAAO,IACR,CAAA,CAEA,GAAI,CACH,IAAME,CAAAA,CAAMV,CAAAA,EAAiB,CACvB,CAAE,OAAA,CAAAW,CAAAA,CAAS,KAAA,CAAAC,CAAAA,CAAO,MAAA,CAAAC,CAAO,CAAA,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AAA,EAAU,IAAA,CAAK,QAAA,EAAYA,CAAAA,CAAM,MAAA,GAAW,IAAA,CAAK,QAAA,CAAS,MAAA,CAAQ,OAE5E,IAAMZ,CAAAA,CAAMY,CAAAA,CAAM,IAAA,CAElB,OAAQZ,CAAAA,CAAI,IAAA,EACX,KAAK,eAAA,CACJD,CAAAA,CAAmBC,CAAG,EACtB,MAED,KAAK,eAAA,CACJS,CAAAA,CAAmBT,CAAG,CAAA,CACtB,MAED,KAAK,WAAA,CAAa,CAKbtB,CAAAA,GACHA,CAAAA,CAAc,KAAA,EAAM,CACpBA,CAAAA,CAAgB,IAAA,CAAA,CAEbI,CAAAA,GACHA,CAAAA,CAAU,KAAA,EAAM,CAChBA,CAAAA,CAAY,IAAA,CAAA,CAEZ,IAAA,CAA2B,WAAA,CAAY,CACvC,EAAA,CAAIkB,CAAAA,CAAI,EAAA,CACR,IAAA,CAAM,gBAAA,CACN,QAAS,EACV,CAAC,CAAA,CACD,KACD,CAEA,QACE,IAAA,CAA2B,WAAA,CAAY,CACvC,EAAA,CAAI,EAAA,CACJ,IAAA,CAAM,gBAAA,CACN,OAAA,CAAS,EAAC,CACV,KAAA,CAAO,CAAA,sBAAA,EAA0BA,CAAAA,CAA0B,IAAI,CAAA,CAChE,CAAC,EAEH,CACD,CAAA,CAKIU,CAAAA,GACH,IAAA,CAAK,SAAA,CAAYC,CAAAA,CAAAA","file":"engine.worker.cjs","sourcesContent":["/**\n * Engine worker, offloads both compilation and VM execution to a\n * background thread (plan L6: worker consolidation).\n *\n * Previously two separate worker files (compilation.worker.ts,\n * execution.worker.ts) duplicated the Transferable ArrayBuffer protocol,\n * postMessage/onmessage boilerplate, and lazy-init pattern. This file\n * merges them behind a single `self.onmessage` dispatching on `msg.type`\n * the message shapes are UNCHANGED from the two original files, so\n * CompilationWorkerManager and ExecutionPool (the main-thread consumers)\n * reach a worker started from this file through the factory a host registers\n * with `setEngineWorkerFactory`, and never import this module themselves.\n *\n * Each Worker instance created from this file is used exclusively by ONE\n * consumer (a CompilationWorkerManager sends only COMPILE_BATCH; an\n * ExecutionPool sends only EXECUTE_BATCH), the module-level `engine` and\n * `vm` singletons below are independent lazy state, so there is no\n * cross-contamination between the two roles even though they share code.\n *\n * Message protocol:\n * Main → Worker:\n * { type: \"COMPILE_BATCH\", id, items: CompileItem[] }\n * { type: \"EXECUTE_BATCH\", id, items: ExecuteItem[] }\n * { type: \"TERMINATE\", id }\n *\n * Worker → Main:\n * { id, type: \"COMPILE_RESULT\", results: CompileResult[] }\n * { id, type: \"EXECUTE_RESULT\", results: ExecuteResult[] }\n *\n * Transferable objects: bytecode opcodes/numbers buffers are transferred\n * (zero-copy) in both directions, same pattern as the original files.\n */\n\nimport { ExpressionEngine } from \"../engine/ExpressionEngine\";\nimport { BUILTIN_PACKAGES } from \"../packages/builtins\";\nimport type { Bytecode } from \"../vm/VM\";\nimport { createVM, executeBytecode } from \"../vm/VM\";\nimport { sharedOpRegistry } from \"../vm/OpRegistry\";\nimport { ValueType } from \"../vm/Value\";\n\n// ── Compile message types ──────────────────────────────────────────────\n\ninterface CompileItem {\n\tlineId: number;\n\texpression: string;\n\ttextHash: number;\n}\n\ninterface CompileBatchMsg {\n\ttype: \"COMPILE_BATCH\";\n\tid: number;\n\titems: CompileItem[];\n}\n\ninterface CompileResult {\n\tlineId: number;\n\texpression: string;\n\tcompiledAgainstHash: number;\n\topcodesBuffer: ArrayBuffer;\n\tnumbersBuffer: ArrayBuffer;\n\topcodesLength: number;\n\tnumbersLength: number;\n\tstrings: string[];\n\treads: string[];\n\twrites: string[];\n\tisVariableDef: boolean;\n\terror: string | null;\n}\n\n// ── Execute message types ──────────────────────────────────────────────\n\ninterface ExecuteItem {\n\tlineNumber: number;\n\topcodesBuffer: ArrayBuffer;\n\tnumbersBuffer: ArrayBuffer;\n\topcodesLength: number;\n\tnumbersLength: number;\n\tstrings: string[];\n}\n\ninterface ExecuteBatchMsg {\n\ttype: \"EXECUTE_BATCH\";\n\tid: number;\n\titems: ExecuteItem[];\n}\n\ninterface ExecuteResult {\n\tlineNumber: number;\n\tvalueType: ValueType;\n\tvalue: number;\n\tunit?: string;\n\tisPending: boolean;\n\tqueryKey?: string;\n}\n\ninterface TerminateMsg {\n\ttype: \"TERMINATE\";\n\tid: number;\n}\n\ntype EngineWorkerMessage = CompileBatchMsg | ExecuteBatchMsg | TerminateMsg;\n\n// ── Worker body ───────────────────────────────────────────────────────\n\n// ── Lazy per-role state, independent, only the used one is created ────\n\nlet compileEngine: ExpressionEngine | null = null;\nfunction getCompileEngine(): ExpressionEngine {\n\tif (!compileEngine) {\n\t\t// The full vocabulary, which is the point of this file being its own\n\t\t// bundle: a compile engine with no packages would refuse every line a\n\t\t// package gives meaning to, and the manager would fall back to the main\n\t\t// thread for nearly all of them. Nothing but a host that registers a\n\t\t// factory (see `WorkerFactory.ts`) reaches this module, so a consumer's\n\t\t// main bundle carries neither the packages nor this file.\n\t\tcompileEngine = new ExpressionEngine({ packages: BUILTIN_PACKAGES });\n\t}\n\treturn compileEngine;\n}\n\nlet executeVm: ReturnType<typeof createVM> | null = null;\nfunction getExecuteVm(): ReturnType<typeof createVM> {\n\tif (!executeVm) {\n\t\texecuteVm = createVM(sharedOpRegistry, 200, 50000);\n\t}\n\treturn executeVm;\n}\n\n// ── Compile ──────────────────────────────────────────────────────────\n\n/**\n * Compile a single expression and produce a transfer-ready CompileResult.\n * Extracts ArrayBuffers from the compiled TypedArrays so they can be\n * transferred via postMessage, after this call, the original TypedArrays\n * are detached on the worker side.\n */\nfunction compileOne(item: CompileItem): CompileResult {\n\tconst base: Omit<CompileResult, \"opcodesBuffer\" | \"numbersBuffer\" | \"opcodesLength\" | \"numbersLength\"> = {\n\t\tlineId: item.lineId,\n\t\texpression: item.expression,\n\t\tcompiledAgainstHash: item.textHash,\n\t\tstrings: [],\n\t\treads: [],\n\t\twrites: [],\n\t\tisVariableDef: false,\n\t\terror: null,\n\t};\n\n\ttry {\n\t\tconst eng = getCompileEngine();\n\t\tconst { program, reads, writes } = eng.compileExpression(item.expression);\n\t\tconst isVariableDef = writes.length > 0;\n\n\t\tconst opcodes = program.opcodes;\n\t\tconst numbers = program.numbers;\n\n\t\t// Transfer only the exact used slice of the ArrayBuffer. The engine's\n\t\t// buffer pool is write-only, so detaching the source view is fine.\n\t\t//\n\t\t// The casts narrow ArrayBufferLike to ArrayBuffer. A TypedArray's\n\t\t// `buffer` is typed as the union including SharedArrayBuffer, which\n\t\t// TypeScript 6 enforces where 5.1 did not, and the postMessage\n\t\t// transfer list below accepts only ArrayBuffer. The narrowing is\n\t\t// sound here because these buffers come from the engine's own pool,\n\t\t// which allocates plain ArrayBuffers; a SharedArrayBuffer could not\n\t\t// reach this point, and would not be transferable if it did.\n\t\tconst opcodesBuffer = (opcodes.buffer as ArrayBuffer).slice(\n\t\t\topcodes.byteOffset,\n\t\t\topcodes.byteOffset + opcodes.byteLength\n\t\t);\n\t\tconst numbersBuffer = (numbers.buffer as ArrayBuffer).slice(\n\t\t\tnumbers.byteOffset,\n\t\t\tnumbers.byteOffset + numbers.byteLength\n\t\t);\n\n\t\treturn {\n\t\t\t...base,\n\t\t\topcodesBuffer,\n\t\t\tnumbersBuffer,\n\t\t\topcodesLength: opcodes.length,\n\t\t\tnumbersLength: numbers.length,\n\t\t\tstrings: [...program.strings],\n\t\t\treads,\n\t\t\twrites,\n\t\t\tisVariableDef,\n\t\t};\n\t} catch (e) {\n\t\treturn {\n\t\t\t...base,\n\t\t\topcodesBuffer: new ArrayBuffer(0),\n\t\t\tnumbersBuffer: new ArrayBuffer(0),\n\t\t\topcodesLength: 0,\n\t\t\tnumbersLength: 0,\n\t\t\terror: e instanceof Error ? e.message : String(e),\n\t\t};\n\t}\n}\n\nfunction handleCompileBatch(msg: CompileBatchMsg): void {\n\tconst results: CompileResult[] = [];\n\tconst transferList: ArrayBuffer[] = [];\n\n\tfor (const item of msg.items) {\n\t\tconst result = compileOne(item);\n\t\tresults.push(result);\n\t\tif (result.opcodesBuffer.byteLength > 0) transferList.push(result.opcodesBuffer);\n\t\tif (result.numbersBuffer.byteLength > 0) transferList.push(result.numbersBuffer);\n\t}\n\n\t(self as unknown as Worker).postMessage(\n\t\t{ id: msg.id, type: \"COMPILE_RESULT\", results },\n\t\ttransferList\n\t);\n}\n\n// ── Execute ──────────────────────────────────────────────────────────\n\n/**\n * Execute a single bytecode program and produce a serialized ExecuteResult.\n * Reconstructs TypedArrays from the transferred ArrayBuffers (zero-copy).\n * Resets the worker VM before each execution, no state carries over\n * between lines in a batch.\n */\nfunction executeOne(item: ExecuteItem): ExecuteResult {\n\tconst vmm = getExecuteVm();\n\tvmm.reset();\n\n\tconst opcodes = new Uint8Array(item.opcodesBuffer, 0, item.opcodesLength);\n\tconst numbers = new Float64Array(item.numbersBuffer, 0, item.numbersLength);\n\tconst bytecode: Bytecode = { opcodes, numbers, strings: item.strings };\n\n\ttry {\n\t\tconst result = executeBytecode(bytecode, vmm);\n\n\t\tif (result.type === \"pending\") {\n\t\t\treturn {\n\t\t\t\tlineNumber: item.lineNumber,\n\t\t\t\tvalueType: ValueType.Pending,\n\t\t\t\tvalue: 0,\n\t\t\t\tisPending: true,\n\t\t\t\tqueryKey: result.queryKey,\n\t\t\t};\n\t\t}\n\n\t\tif (result.type === \"error\") {\n\t\t\treturn {\n\t\t\t\tlineNumber: item.lineNumber,\n\t\t\t\tvalueType: ValueType.Error,\n\t\t\t\tvalue: 0,\n\t\t\t\tisPending: false,\n\t\t\t\tunit: result.error.message,\n\t\t\t};\n\t\t}\n\n\t\tconst val = result.value;\n\t\treturn {\n\t\t\tlineNumber: item.lineNumber,\n\t\t\tvalueType: val.type,\n\t\t\tvalue: typeof val.value === \"number\"\n\t\t\t\t? val.value\n\t\t\t\t: typeof val.value === \"bigint\"\n\t\t\t\t\t? Number(val.value)\n\t\t\t\t\t: 0,\n\t\t\tunit: val.unit,\n\t\t\tisPending: false,\n\t\t};\n\t} catch {\n\t\t// Execution error, return error-type value so main thread can\n\t\t// propagate through DAG as errorValue.\n\t\treturn {\n\t\t\tlineNumber: item.lineNumber,\n\t\t\tvalueType: ValueType.Error,\n\t\t\tvalue: 0,\n\t\t\tisPending: false,\n\t\t\tunit: \"Worker execution failed\",\n\t\t};\n\t}\n}\n\nfunction handleExecuteBatch(msg: ExecuteBatchMsg): void {\n\tconst results: ExecuteResult[] = [];\n\tfor (const item of msg.items) {\n\t\tresults.push(executeOne(item));\n\t}\n\t// No transferables needed for the response, results are plain\n\t// objects with numbers and strings (structured-cloned).\n\t(self as unknown as Worker).postMessage({\n\t\tid: msg.id,\n\t\ttype: \"EXECUTE_RESULT\",\n\t\tresults,\n\t});\n}\n\n// ── Message handler ───────────────────────────────────────────────────\n\n/**\n * Whether this module is executing inside a real worker global scope.\n *\n * This file is a bundle entry of its own (`solve-engine/engine-worker`), so a\n * host that starts a worker from it runs the handler below in a worker. It is\n * still an ordinary module to anything that merely imports it, a test harness\n * or a Node script included, and there the handler must not bind.\n *\n * Without this guard, importing it from Node throws `self is not defined`\n * before a single expression can be evaluated. The check distinguishes the\n * three environments: Node defines neither `self` nor `window`, a browser main\n * thread defines both, and a worker defines only `self`.\n */\nconst inWorkerScope = typeof self !== \"undefined\" && typeof window === \"undefined\";\n\nconst handleMessage = (event: MessageEvent) => {\n\t// A real postMessage always carries a browser-populated origin the\n\t// sender cannot spoof, so this only ever rejects a genuine mismatch. It\n\t// is skipped, not enforced, when either side is unset, which covers the\n\t// test harness driving this handler directly with a plain object and\n\t// no location global (see WorkerIntegration.spec.ts), without opening\n\t// anything a real message could exploit.\n\tif (event.origin && self.location && event.origin !== self.location.origin) return;\n\n\tconst msg = event.data as EngineWorkerMessage;\n\n\tswitch (msg.type) {\n\t\tcase \"COMPILE_BATCH\":\n\t\t\thandleCompileBatch(msg);\n\t\t\tbreak;\n\n\t\tcase \"EXECUTE_BATCH\":\n\t\t\thandleExecuteBatch(msg);\n\t\t\tbreak;\n\n\t\tcase \"TERMINATE\": {\n\t\t\t// Not sent by either production manager today, both call the\n\t\t\t// native Worker.terminate() directly instead. Kept for protocol\n\t\t\t// completeness and future consumers. Clears whichever per-role\n\t\t\t// state this instance happened to create.\n\t\t\tif (compileEngine) {\n\t\t\t\tcompileEngine.clear();\n\t\t\t\tcompileEngine = null;\n\t\t\t}\n\t\t\tif (executeVm) {\n\t\t\t\texecuteVm.reset();\n\t\t\t\texecuteVm = null;\n\t\t\t}\n\t\t\t(self as unknown as Worker).postMessage({\n\t\t\t\tid: msg.id,\n\t\t\t\ttype: \"COMPILE_RESULT\",\n\t\t\t\tresults: [],\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault: {\n\t\t\t(self as unknown as Worker).postMessage({\n\t\t\t\tid: -1,\n\t\t\t\ttype: \"COMPILE_RESULT\",\n\t\t\t\tresults: [],\n\t\t\t\terror: `Unknown message type: ${(msg as { type?: string }).type}`,\n\t\t\t});\n\t\t}\n\t}\n};\n\n// Installed only when genuinely running as a worker. Everywhere else this\n// module has been inlined into a host bundle, where binding a handler would at\n// best be inert and at worst intercept the host's own messages.\nif (inWorkerScope) {\n\tself.onmessage = handleMessage;\n}\n"]}
1
+ {"version":3,"sources":["../src/workers/engine.worker.ts"],"names":["compileEngine","getCompileEngine","ExpressionEngine","BUILTIN_PACKAGES","executeVm","getExecuteVm","createVM","sharedOpRegistry","compileOne","item","base","eng","program","reads","writes","isVariableDef","opcodes","numbers","opcodesBuffer","numbersBuffer","e","handleCompileBatch","msg","results","transferList","result","executeOne","vmm","bytecode","executeBytecode","val","handleExecuteBatch","inWorkerScope","handleMessage","event"],"mappings":"qwCA0GA,IAAIA,CAAAA,CAAyC,IAAA,CAC7C,SAASC,CAAAA,EAAqC,CAC7C,OAAKD,CAAAA,GAOJA,CAAAA,CAAgB,IAAIE,mBAAAA,CAAiB,CAAE,QAAA,CAAUC,mBAAiB,CAAC,CAAA,CAAA,CAE7DH,CACR,CAEA,IAAII,CAAAA,CAAgD,IAAA,CACpD,SAASC,CAAAA,EAA4C,CACpD,OAAKD,CAAA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N,OAAA,CAAS,EAAC,CACV,KAAA,CAAO,CAAA,sBAAA,EAA0BA,CAAAA,CAA0B,IAAI,CAAA,CAChE,CAAC,EAEH,CACD,CAAA,CAKIU,CAAAA,GACH,IAAA,CAAK,SAAA,CAAYC,CAAAA,CAAAA","file":"engine.worker.cjs","sourcesContent":["/**\n * Engine worker, offloads both compilation and VM execution to a\n * background thread (plan L6: worker consolidation).\n *\n * Previously two separate worker files (compilation.worker.ts,\n * execution.worker.ts) duplicated the Transferable ArrayBuffer protocol,\n * postMessage/onmessage boilerplate, and lazy-init pattern. This file\n * merges them behind a single `self.onmessage` dispatching on `msg.type`\n * the message shapes are UNCHANGED from the two original files, so\n * CompilationWorkerManager and ExecutionPool (the main-thread consumers)\n * reach a worker started from this file through the factory a host registers\n * with `setEngineWorkerFactory`, and never import this module themselves.\n *\n * Each Worker instance created from this file is used exclusively by ONE\n * consumer (a CompilationWorkerManager sends only COMPILE_BATCH; an\n * ExecutionPool sends only EXECUTE_BATCH), the module-level `engine` and\n * `vm` singletons below are independent lazy state, so there is no\n * cross-contamination between the two roles even though they share code.\n *\n * Message protocol:\n * Main → Worker:\n * { type: \"COMPILE_BATCH\", id, items: CompileItem[] }\n * { type: \"EXECUTE_BATCH\", id, items: ExecuteItem[] }\n * { type: \"TERMINATE\", id }\n *\n * Worker → Main:\n * { id, type: \"COMPILE_RESULT\", results: CompileResult[] }\n * { id, type: \"EXECUTE_RESULT\", results: ExecuteResult[] }\n *\n * Transferable objects: bytecode opcodes/numbers buffers are transferred\n * (zero-copy) in both directions, same pattern as the original files.\n */\n\nimport { ExpressionEngine } from \"../engine/ExpressionEngine\";\nimport { BUILTIN_PACKAGES } from \"../packages/builtins\";\nimport type { Bytecode } from \"../vm/VM\";\nimport { createVM, executeBytecode } from \"../vm/VM\";\nimport { sharedOpRegistry } from \"../vm/OpRegistry\";\nimport { ValueType } from \"../vm/Value\";\n\n// ── Compile message types ──────────────────────────────────────────────\n\ninterface CompileItem {\n\tlineId: number;\n\texpression: string;\n\ttextHash: number;\n}\n\ninterface CompileBatchMsg {\n\ttype: \"COMPILE_BATCH\";\n\tid: number;\n\titems: CompileItem[];\n}\n\ninterface CompileResult {\n\tlineId: number;\n\texpression: string;\n\tcompiledAgainstHash: number;\n\topcodesBuffer: ArrayBuffer;\n\tnumbersBuffer: ArrayBuffer;\n\topcodesLength: number;\n\tnumbersLength: number;\n\tstrings: string[];\n\treads: string[];\n\twrites: string[];\n\tisVariableDef: boolean;\n\terror: string | null;\n}\n\n// ── Execute message types ──────────────────────────────────────────────\n\ninterface ExecuteItem {\n\tlineNumber: number;\n\topcodesBuffer: ArrayBuffer;\n\tnumbersBuffer: ArrayBuffer;\n\topcodesLength: number;\n\tnumbersLength: number;\n\tstrings: string[];\n}\n\ninterface ExecuteBatchMsg {\n\ttype: \"EXECUTE_BATCH\";\n\tid: number;\n\titems: ExecuteItem[];\n}\n\ninterface ExecuteResult {\n\tlineNumber: number;\n\tvalueType: ValueType;\n\tvalue: number;\n\tunit?: string;\n\tisPending: boolean;\n\tqueryKey?: string;\n}\n\ninterface TerminateMsg {\n\ttype: \"TERMINATE\";\n\tid: number;\n}\n\ntype EngineWorkerMessage = CompileBatchMsg | ExecuteBatchMsg | TerminateMsg;\n\n// ── Worker body ───────────────────────────────────────────────────────\n\n// ── Lazy per-role state, independent, only the used one is created ────\n\nlet compileEngine: ExpressionEngine | null = null;\nfunction getCompileEngine(): ExpressionEngine {\n\tif (!compileEngine) {\n\t\t// The full vocabulary, which is the point of this file being its own\n\t\t// bundle: a compile engine with no packages would refuse every line a\n\t\t// package gives meaning to, and the manager would fall back to the main\n\t\t// thread for nearly all of them. Nothing but a host that registers a\n\t\t// factory (see `WorkerFactory.ts`) reaches this module, so a consumer's\n\t\t// main bundle carries neither the packages nor this file.\n\t\tcompileEngine = new ExpressionEngine({ packages: BUILTIN_PACKAGES });\n\t}\n\treturn compileEngine;\n}\n\nlet executeVm: ReturnType<typeof createVM> | null = null;\nfunction getExecuteVm(): ReturnType<typeof createVM> {\n\tif (!executeVm) {\n\t\texecuteVm = createVM(sharedOpRegistry, 200, 50000);\n\t}\n\treturn executeVm;\n}\n\n// ── Compile ──────────────────────────────────────────────────────────\n\n/**\n * Compile a single expression and produce a transfer-ready CompileResult.\n * Extracts ArrayBuffers from the compiled TypedArrays so they can be\n * transferred via postMessage, after this call, the original TypedArrays\n * are detached on the worker side.\n */\nfunction compileOne(item: CompileItem): CompileResult {\n\tconst base: Omit<CompileResult, \"opcodesBuffer\" | \"numbersBuffer\" | \"opcodesLength\" | \"numbersLength\"> = {\n\t\tlineId: item.lineId,\n\t\texpression: item.expression,\n\t\tcompiledAgainstHash: item.textHash,\n\t\tstrings: [],\n\t\treads: [],\n\t\twrites: [],\n\t\tisVariableDef: false,\n\t\terror: null,\n\t};\n\n\ttry {\n\t\tconst eng = getCompileEngine();\n\t\tconst { program, reads, writes } = eng.compileExpression(item.expression);\n\t\tconst isVariableDef = writes.length > 0;\n\n\t\tconst opcodes = program.opcodes;\n\t\tconst numbers = program.numbers;\n\n\t\t// Transfer only the exact used slice of the ArrayBuffer. The engine's\n\t\t// buffer pool is write-only, so detaching the source view is fine.\n\t\t//\n\t\t// The casts narrow ArrayBufferLike to ArrayBuffer. A TypedArray's\n\t\t// `buffer` is typed as the union including SharedArrayBuffer, which\n\t\t// TypeScript 6 enforces where 5.1 did not, and the postMessage\n\t\t// transfer list below accepts only ArrayBuffer. The narrowing is\n\t\t// sound here because these buffers come from the engine's own pool,\n\t\t// which allocates plain ArrayBuffers; a SharedArrayBuffer could not\n\t\t// reach this point, and would not be transferable if it did.\n\t\tconst opcodesBuffer = (opcodes.buffer as ArrayBuffer).slice(\n\t\t\topcodes.byteOffset,\n\t\t\topcodes.byteOffset + opcodes.byteLength\n\t\t);\n\t\tconst numbersBuffer = (numbers.buffer as ArrayBuffer).slice(\n\t\t\tnumbers.byteOffset,\n\t\t\tnumbers.byteOffset + numbers.byteLength\n\t\t);\n\n\t\treturn {\n\t\t\t...base,\n\t\t\topcodesBuffer,\n\t\t\tnumbersBuffer,\n\t\t\topcodesLength: opcodes.length,\n\t\t\tnumbersLength: numbers.length,\n\t\t\tstrings: [...program.strings],\n\t\t\treads,\n\t\t\twrites,\n\t\t\tisVariableDef,\n\t\t};\n\t} catch (e) {\n\t\treturn {\n\t\t\t...base,\n\t\t\topcodesBuffer: new ArrayBuffer(0),\n\t\t\tnumbersBuffer: new ArrayBuffer(0),\n\t\t\topcodesLength: 0,\n\t\t\tnumbersLength: 0,\n\t\t\terror: e instanceof Error ? e.message : String(e),\n\t\t};\n\t}\n}\n\nfunction handleCompileBatch(msg: CompileBatchMsg): void {\n\tconst results: CompileResult[] = [];\n\tconst transferList: ArrayBuffer[] = [];\n\n\tfor (const item of msg.items) {\n\t\tconst result = compileOne(item);\n\t\tresults.push(result);\n\t\tif (result.opcodesBuffer.byteLength > 0) transferList.push(result.opcodesBuffer);\n\t\tif (result.numbersBuffer.byteLength > 0) transferList.push(result.numbersBuffer);\n\t}\n\n\t(self as unknown as Worker).postMessage(\n\t\t{ id: msg.id, type: \"COMPILE_RESULT\", results },\n\t\ttransferList\n\t);\n}\n\n// ── Execute ──────────────────────────────────────────────────────────\n\n/**\n * Execute a single bytecode program and produce a serialized ExecuteResult.\n * Reconstructs TypedArrays from the transferred ArrayBuffers (zero-copy).\n * Resets the worker VM before each execution, no state carries over\n * between lines in a batch.\n */\nfunction executeOne(item: ExecuteItem): ExecuteResult {\n\tconst vmm = getExecuteVm();\n\tvmm.reset();\n\n\tconst opcodes = new Uint8Array(item.opcodesBuffer, 0, item.opcodesLength);\n\tconst numbers = new Float64Array(item.numbersBuffer, 0, item.numbersLength);\n\tconst bytecode: Bytecode = { opcodes, numbers, strings: item.strings };\n\n\ttry {\n\t\tconst result = executeBytecode(bytecode, vmm);\n\n\t\tif (result.type === \"pending\") {\n\t\t\treturn {\n\t\t\t\tlineNumber: item.lineNumber,\n\t\t\t\tvalueType: ValueType.Pending,\n\t\t\t\tvalue: 0,\n\t\t\t\tisPending: true,\n\t\t\t\tqueryKey: result.queryKey,\n\t\t\t};\n\t\t}\n\n\t\tif (result.type === \"error\") {\n\t\t\treturn {\n\t\t\t\tlineNumber: item.lineNumber,\n\t\t\t\tvalueType: ValueType.Error,\n\t\t\t\tvalue: 0,\n\t\t\t\tisPending: false,\n\t\t\t\tunit: result.error.message,\n\t\t\t};\n\t\t}\n\n\t\tconst val = result.value;\n\t\treturn {\n\t\t\tlineNumber: item.lineNumber,\n\t\t\tvalueType: val.type,\n\t\t\tvalue: typeof val.value === \"number\"\n\t\t\t\t? val.value\n\t\t\t\t: typeof val.value === \"bigint\"\n\t\t\t\t\t? Number(val.value)\n\t\t\t\t\t: 0,\n\t\t\tunit: val.unit,\n\t\t\tisPending: false,\n\t\t};\n\t} catch {\n\t\t// Execution error, return error-type value so main thread can\n\t\t// propagate through DAG as errorValue.\n\t\treturn {\n\t\t\tlineNumber: item.lineNumber,\n\t\t\tvalueType: ValueType.Error,\n\t\t\tvalue: 0,\n\t\t\tisPending: false,\n\t\t\tunit: \"Worker execution failed\",\n\t\t};\n\t}\n}\n\nfunction handleExecuteBatch(msg: ExecuteBatchMsg): void {\n\tconst results: ExecuteResult[] = [];\n\tfor (const item of msg.items) {\n\t\tresults.push(executeOne(item));\n\t}\n\t// No transferables needed for the response, results are plain\n\t// objects with numbers and strings (structured-cloned).\n\t(self as unknown as Worker).postMessage({\n\t\tid: msg.id,\n\t\ttype: \"EXECUTE_RESULT\",\n\t\tresults,\n\t});\n}\n\n// ── Message handler ───────────────────────────────────────────────────\n\n/**\n * Whether this module is executing inside a real worker global scope.\n *\n * This file is a bundle entry of its own (`solve-engine/engine-worker`), so a\n * host that starts a worker from it runs the handler below in a worker. It is\n * still an ordinary module to anything that merely imports it, a test harness\n * or a Node script included, and there the handler must not bind.\n *\n * Without this guard, importing it from Node throws `self is not defined`\n * before a single expression can be evaluated. The check distinguishes the\n * three environments: Node defines neither `self` nor `window`, a browser main\n * thread defines both, and a worker defines only `self`.\n */\nconst inWorkerScope = typeof self !== \"undefined\" && typeof window === \"undefined\";\n\nconst handleMessage = (event: MessageEvent) => {\n\t// A real postMessage always carries a browser-populated origin the\n\t// sender cannot spoof, so this only ever rejects a genuine mismatch. It\n\t// is skipped, not enforced, when either side is unset, which covers the\n\t// test harness driving this handler directly with a plain object and\n\t// no location global (see WorkerIntegration.spec.ts), without opening\n\t// anything a real message could exploit.\n\tif (event.origin && self.location && event.origin !== self.location.origin) return;\n\n\tconst msg = event.data as EngineWorkerMessage;\n\n\tswitch (msg.type) {\n\t\tcase \"COMPILE_BATCH\":\n\t\t\thandleCompileBatch(msg);\n\t\t\tbreak;\n\n\t\tcase \"EXECUTE_BATCH\":\n\t\t\thandleExecuteBatch(msg);\n\t\t\tbreak;\n\n\t\tcase \"TERMINATE\": {\n\t\t\t// Not sent by either production manager today, both call the\n\t\t\t// native Worker.terminate() directly instead. Kept for protocol\n\t\t\t// completeness and future consumers. Clears whichever per-role\n\t\t\t// state this instance happened to create.\n\t\t\tif (compileEngine) {\n\t\t\t\tcompileEngine.clear();\n\t\t\t\tcompileEngine = null;\n\t\t\t}\n\t\t\tif (executeVm) {\n\t\t\t\texecuteVm.reset();\n\t\t\t\texecuteVm = null;\n\t\t\t}\n\t\t\t(self as unknown as Worker).postMessage({\n\t\t\t\tid: msg.id,\n\t\t\t\ttype: \"COMPILE_RESULT\",\n\t\t\t\tresults: [],\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault: {\n\t\t\t(self as unknown as Worker).postMessage({\n\t\t\t\tid: -1,\n\t\t\t\ttype: \"COMPILE_RESULT\",\n\t\t\t\tresults: [],\n\t\t\t\terror: `Unknown message type: ${(msg as { type?: string }).type}`,\n\t\t\t});\n\t\t}\n\t}\n};\n\n// Installed only when genuinely running as a worker. Everywhere else this\n// module has been inlined into a host bundle, where binding a handler would at\n// best be inert and at worst intercept the host's own messages.\nif (inWorkerScope) {\n\tself.onmessage = handleMessage;\n}\n"]}
@@ -1,2 +1,2 @@
1
- import {o}from'./chunk-7ODHPWQC.js';import'./chunk-CB3EXUM2.js';import'./chunk-2RWAXT6O.js';import'./chunk-IJHL3LMH.js';import'./chunk-MIQBJGGR.js';import {d,c}from'./chunk-AF6NDOIE.js';import'./chunk-JP4JMQOG.js';import'./chunk-IQVSCL2R.js';import'./chunk-XEIDV5JP.js';import {z}from'./chunk-4IC5OARK.js';import'./chunk-SFM4XFGJ.js';import'./chunk-FXB5GCBT.js';import'./chunk-VLX7ZVK4.js';import'./chunk-B2NL65FI.js';import'./chunk-76F3LCIL.js';import'./chunk-TCZSPH4A.js';import {w}from'./chunk-OE2DBN4K.js';import'./chunk-3ZGFAE3Q.js';import'./chunk-PTXUWGRR.js';import'./chunk-TZYMXNIB.js';import'./chunk-HFKDWQUL.js';import'./chunk-5TCSFTZD.js';import'./chunk-KH4QXKLT.js';import'./chunk-NQFCXLEF.js';import'./chunk-J4K72CQN.js';import'./chunk-X5K72MBV.js';import'./chunk-BWTVJD5L.js';import'./chunk-TSJ4RQLZ.js';import'./chunk-CDE2ZUGG.js';import'./chunk-JPFCXLJV.js';import'./chunk-LP3JYC3A.js';import'./chunk-FAO6DQ74.js';import'./chunk-LHLW7JLS.js';import'./chunk-CHVGFTO3.js';import'./chunk-PRSXXDTA.js';import'./chunk-RELMEWY6.js';var i=null;function E(){return i||(i=new o({packages:z})),i}var f=null;function h(){return f||(f=c(w,200,5e4)),f}function B(e){let r={lineId:e.lineId,expression:e.expression,compiledAgainstHash:e.textHash,strings:[],reads:[],writes:[],isVariableDef:false,error:null};try{let n=E(),{program:u,reads:s,writes:t}=n.compileExpression(e.expression),o=t.length>0,a=u.opcodes,l=u.numbers,y=a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength),d=l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength);return {...r,opcodesBuffer:y,numbersBuffer:d,opcodesLength:a.length,numbersLength:l.length,strings:[...u.strings],reads:s,writes:t,isVariableDef:o}}catch(n){return {...r,opcodesBuffer:new ArrayBuffer(0),numbersBuffer:new ArrayBuffer(0),opcodesLength:0,numbersLength:0,error:n instanceof Error?n.message:String(n)}}}function L(e){let r=[],n=[];for(let u of e.items){let s=B(u);r.push(s),s.opcodesBuffer.byteLength>0&&n.push(s.opcodesBuffer),s.numbersBuffer.byteLength>0&&n.push(s.numbersBuffer);}self.postMessage({id:e.id,type:"COMPILE_RESULT",results:r},n);}function M(e){let r=h();r.reset();let n=new Uint8Array(e.opcodesBuffer,0,e.opcodesLength),u=new Float64Array(e.numbersBuffer,0,e.numbersLength),s={opcodes:n,numbers:u,strings:e.strings};try{let t=d(s,r);if(t.type==="pending")return {lineNumber:e.lineNumber,valueType:12,value:0,isPending:!0,queryKey:t.queryKey};if(t.type==="error")return {lineNumber:e.lineNumber,valueType:13,value:0,isPending:!1,unit:t.error.message};let o=t.value;return {lineNumber:e.lineNumber,valueType:o.type,value:typeof o.value=="number"?o.value:typeof o.value=="bigint"?Number(o.value):0,unit:o.unit,isPending:!1}}catch{return {lineNumber:e.lineNumber,valueType:13,value:0,isPending:false,unit:"Worker execution failed"}}}function T(e){let r=[];for(let n of e.items)r.push(M(n));self.postMessage({id:e.id,type:"EXECUTE_RESULT",results:r});}var x=typeof self<"u"&&typeof window>"u",C=e=>{if(e.origin&&self.location&&e.origin!==self.location.origin)return;let r=e.data;switch(r.type){case "COMPILE_BATCH":L(r);break;case "EXECUTE_BATCH":T(r);break;case "TERMINATE":{i&&(i.clear(),i=null),f&&(f.reset(),f=null),self.postMessage({id:r.id,type:"COMPILE_RESULT",results:[]});break}default:self.postMessage({id:-1,type:"COMPILE_RESULT",results:[],error:`Unknown message type: ${r.type}`});}};x&&(self.onmessage=C);//# sourceMappingURL=engine.worker.js.map
1
+ import {o}from'./chunk-ADK7LGYN.js';import'./chunk-RU3KGJRA.js';import'./chunk-2RWAXT6O.js';import'./chunk-RMDCGYZM.js';import'./chunk-MIQBJGGR.js';import {d,c}from'./chunk-4ASM522I.js';import'./chunk-JP4JMQOG.js';import'./chunk-4XWZXP6I.js';import'./chunk-XEIDV5JP.js';import {z}from'./chunk-HOU7QTE7.js';import'./chunk-G5TZ6TDA.js';import'./chunk-TJKN466F.js';import'./chunk-U5MESNRT.js';import'./chunk-DB5ISONG.js';import'./chunk-76F3LCIL.js';import'./chunk-EOKHRS2T.js';import'./chunk-TCZSPH4A.js';import {w}from'./chunk-INMJ7ZXL.js';import'./chunk-X2GQAKL2.js';import'./chunk-PICFFFJV.js';import'./chunk-TZYMXNIB.js';import'./chunk-HFKDWQUL.js';import'./chunk-5TCSFTZD.js';import'./chunk-4MD5L23F.js';import'./chunk-EOO6M65F.js';import'./chunk-J4K72CQN.js';import'./chunk-O7HF345B.js';import'./chunk-BWTVJD5L.js';import'./chunk-J3YC3IQD.js';import'./chunk-6NL7RBAG.js';import'./chunk-JPFCXLJV.js';import'./chunk-APYRNAU2.js';import'./chunk-FAO6DQ74.js';import'./chunk-LHLW7JLS.js';import'./chunk-CHVGFTO3.js';import'./chunk-PRSXXDTA.js';import'./chunk-6G2NES2I.js';var i=null;function E(){return i||(i=new o({packages:z})),i}var f=null;function h(){return f||(f=c(w,200,5e4)),f}function B(e){let r={lineId:e.lineId,expression:e.expression,compiledAgainstHash:e.textHash,strings:[],reads:[],writes:[],isVariableDef:false,error:null};try{let n=E(),{program:u,reads:s,writes:t}=n.compileExpression(e.expression),o=t.length>0,a=u.opcodes,l=u.numbers,y=a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength),d=l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength);return {...r,opcodesBuffer:y,numbersBuffer:d,opcodesLength:a.length,numbersLength:l.length,strings:[...u.strings],reads:s,writes:t,isVariableDef:o}}catch(n){return {...r,opcodesBuffer:new ArrayBuffer(0),numbersBuffer:new ArrayBuffer(0),opcodesLength:0,numbersLength:0,error:n instanceof Error?n.message:String(n)}}}function L(e){let r=[],n=[];for(let u of e.items){let s=B(u);r.push(s),s.opcodesBuffer.byteLength>0&&n.push(s.opcodesBuffer),s.numbersBuffer.byteLength>0&&n.push(s.numbersBuffer);}self.postMessage({id:e.id,type:"COMPILE_RESULT",results:r},n);}function M(e){let r=h();r.reset();let n=new Uint8Array(e.opcodesBuffer,0,e.opcodesLength),u=new Float64Array(e.numbersBuffer,0,e.numbersLength),s={opcodes:n,numbers:u,strings:e.strings};try{let t=d(s,r);if(t.type==="pending")return {lineNumber:e.lineNumber,valueType:12,value:0,isPending:!0,queryKey:t.queryKey};if(t.type==="error")return {lineNumber:e.lineNumber,valueType:13,value:0,isPending:!1,unit:t.error.message};let o=t.value;return {lineNumber:e.lineNumber,valueType:o.type,value:typeof o.value=="number"?o.value:typeof o.value=="bigint"?Number(o.value):0,unit:o.unit,isPending:!1}}catch{return {lineNumber:e.lineNumber,valueType:13,value:0,isPending:false,unit:"Worker execution failed"}}}function T(e){let r=[];for(let n of e.items)r.push(M(n));self.postMessage({id:e.id,type:"EXECUTE_RESULT",results:r});}var x=typeof self<"u"&&typeof window>"u",C=e=>{if(e.origin&&self.location&&e.origin!==self.location.origin)return;let r=e.data;switch(r.type){case "COMPILE_BATCH":L(r);break;case "EXECUTE_BATCH":T(r);break;case "TERMINATE":{i&&(i.clear(),i=null),f&&(f.reset(),f=null),self.postMessage({id:r.id,type:"COMPILE_RESULT",results:[]});break}default:self.postMessage({id:-1,type:"COMPILE_RESULT",results:[],error:`Unknown message type: ${r.type}`});}};x&&(self.onmessage=C);//# sourceMappingURL=engine.worker.js.map
2
2
  //# sourceMappingURL=engine.worker.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/workers/engine.worker.ts"],"names":["compileEngine","getCompileEngine","ExpressionEngine","BUILTIN_PACKAGES","executeVm","getExecuteVm","createVM","sharedOpRegistry","compileOne","item","base","eng","program","reads","writes","isVariableDef","opcodes","numbers","opcodesBuffer","numbersBuffer","e","handleCompileBatch","msg","results","transferList","result","executeOne","vmm","bytecode","executeBytecode","val","handleExecuteBatch","inWorkerScope","handleMessage","event"],"mappings":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,EAAM,CAChBA,CAAAA,CAAY,IAAA,CAAA,CAEZ,IAAA,CAA2B,WAAA,CAAY,CACvC,EAAA,CAAIkB,CAAAA,CAAI,EAAA,CACR,IAAA,CAAM,gBAAA,CACN,QAAS,EACV,CAAC,CAAA,CACD,KACD,CAEA,QACE,IAAA,CAA2B,WAAA,CAAY,CACvC,EAAA,CAAI,EAAA,CACJ,IAAA,CAAM,gBAAA,CACN,OAAA,CAAS,EAAC,CACV,KAAA,CAAO,CAAA,sBAAA,EAA0BA,CAAAA,CAA0B,IAAI,CAAA,CAChE,CAAC,EAEH,CACD,CAAA,CAKIU,CAAAA,GACH,IAAA,CAAK,SAAA,CAAYC,CAAAA,CAAAA","file":"engine.worker.js","sourcesContent":["/**\n * Engine worker, offloads both compilation and VM execution to a\n * background thread (plan L6: worker consolidation).\n *\n * Previously two separate worker files (compilation.worker.ts,\n * execution.worker.ts) duplicated the Transferable ArrayBuffer protocol,\n * postMessage/onmessage boilerplate, and lazy-init pattern. This file\n * merges them behind a single `self.onmessage` dispatching on `msg.type`\n * the message shapes are UNCHANGED from the two original files, so\n * CompilationWorkerManager and ExecutionPool (the main-thread consumers)\n * reach a worker started from this file through the factory a host registers\n * with `setEngineWorkerFactory`, and never import this module themselves.\n *\n * Each Worker instance created from this file is used exclusively by ONE\n * consumer (a CompilationWorkerManager sends only COMPILE_BATCH; an\n * ExecutionPool sends only EXECUTE_BATCH), the module-level `engine` and\n * `vm` singletons below are independent lazy state, so there is no\n * cross-contamination between the two roles even though they share code.\n *\n * Message protocol:\n * Main → Worker:\n * { type: \"COMPILE_BATCH\", id, items: CompileItem[] }\n * { type: \"EXECUTE_BATCH\", id, items: ExecuteItem[] }\n * { type: \"TERMINATE\", id }\n *\n * Worker → Main:\n * { id, type: \"COMPILE_RESULT\", results: CompileResult[] }\n * { id, type: \"EXECUTE_RESULT\", results: ExecuteResult[] }\n *\n * Transferable objects: bytecode opcodes/numbers buffers are transferred\n * (zero-copy) in both directions, same pattern as the original files.\n */\n\nimport { ExpressionEngine } from \"../engine/ExpressionEngine\";\nimport { BUILTIN_PACKAGES } from \"../packages/builtins\";\nimport type { Bytecode } from \"../vm/VM\";\nimport { createVM, executeBytecode } from \"../vm/VM\";\nimport { sharedOpRegistry } from \"../vm/OpRegistry\";\nimport { ValueType } from \"../vm/Value\";\n\n// ── Compile message types ──────────────────────────────────────────────\n\ninterface CompileItem {\n\tlineId: number;\n\texpression: string;\n\ttextHash: number;\n}\n\ninterface CompileBatchMsg {\n\ttype: \"COMPILE_BATCH\";\n\tid: number;\n\titems: CompileItem[];\n}\n\ninterface CompileResult {\n\tlineId: number;\n\texpression: string;\n\tcompiledAgainstHash: number;\n\topcodesBuffer: ArrayBuffer;\n\tnumbersBuffer: ArrayBuffer;\n\topcodesLength: number;\n\tnumbersLength: number;\n\tstrings: string[];\n\treads: string[];\n\twrites: string[];\n\tisVariableDef: boolean;\n\terror: string | null;\n}\n\n// ── Execute message types ──────────────────────────────────────────────\n\ninterface ExecuteItem {\n\tlineNumber: number;\n\topcodesBuffer: ArrayBuffer;\n\tnumbersBuffer: ArrayBuffer;\n\topcodesLength: number;\n\tnumbersLength: number;\n\tstrings: string[];\n}\n\ninterface ExecuteBatchMsg {\n\ttype: \"EXECUTE_BATCH\";\n\tid: number;\n\titems: ExecuteItem[];\n}\n\ninterface ExecuteResult {\n\tlineNumber: number;\n\tvalueType: ValueType;\n\tvalue: number;\n\tunit?: string;\n\tisPending: boolean;\n\tqueryKey?: string;\n}\n\ninterface TerminateMsg {\n\ttype: \"TERMINATE\";\n\tid: number;\n}\n\ntype EngineWorkerMessage = CompileBatchMsg | ExecuteBatchMsg | TerminateMsg;\n\n// ── Worker body ───────────────────────────────────────────────────────\n\n// ── Lazy per-role state, independent, only the used one is created ────\n\nlet compileEngine: ExpressionEngine | null = null;\nfunction getCompileEngine(): ExpressionEngine {\n\tif (!compileEngine) {\n\t\t// The full vocabulary, which is the point of this file being its own\n\t\t// bundle: a compile engine with no packages would refuse every line a\n\t\t// package gives meaning to, and the manager would fall back to the main\n\t\t// thread for nearly all of them. Nothing but a host that registers a\n\t\t// factory (see `WorkerFactory.ts`) reaches this module, so a consumer's\n\t\t// main bundle carries neither the packages nor this file.\n\t\tcompileEngine = new ExpressionEngine({ packages: BUILTIN_PACKAGES });\n\t}\n\treturn compileEngine;\n}\n\nlet executeVm: ReturnType<typeof createVM> | null = null;\nfunction getExecuteVm(): ReturnType<typeof createVM> {\n\tif (!executeVm) {\n\t\texecuteVm = createVM(sharedOpRegistry, 200, 50000);\n\t}\n\treturn executeVm;\n}\n\n// ── Compile ──────────────────────────────────────────────────────────\n\n/**\n * Compile a single expression and produce a transfer-ready CompileResult.\n * Extracts ArrayBuffers from the compiled TypedArrays so they can be\n * transferred via postMessage, after this call, the original TypedArrays\n * are detached on the worker side.\n */\nfunction compileOne(item: CompileItem): CompileResult {\n\tconst base: Omit<CompileResult, \"opcodesBuffer\" | \"numbersBuffer\" | \"opcodesLength\" | \"numbersLength\"> = {\n\t\tlineId: item.lineId,\n\t\texpression: item.expression,\n\t\tcompiledAgainstHash: item.textHash,\n\t\tstrings: [],\n\t\treads: [],\n\t\twrites: [],\n\t\tisVariableDef: false,\n\t\terror: null,\n\t};\n\n\ttry {\n\t\tconst eng = getCompileEngine();\n\t\tconst { program, reads, writes } = eng.compileExpression(item.expression);\n\t\tconst isVariableDef = writes.length > 0;\n\n\t\tconst opcodes = program.opcodes;\n\t\tconst numbers = program.numbers;\n\n\t\t// Transfer only the exact used slice of the ArrayBuffer. The engine's\n\t\t// buffer pool is write-only, so detaching the source view is fine.\n\t\t//\n\t\t// The casts narrow ArrayBufferLike to ArrayBuffer. A TypedArray's\n\t\t// `buffer` is typed as the union including SharedArrayBuffer, which\n\t\t// TypeScript 6 enforces where 5.1 did not, and the postMessage\n\t\t// transfer list below accepts only ArrayBuffer. The narrowing is\n\t\t// sound here because these buffers come from the engine's own pool,\n\t\t// which allocates plain ArrayBuffers; a SharedArrayBuffer could not\n\t\t// reach this point, and would not be transferable if it did.\n\t\tconst opcodesBuffer = (opcodes.buffer as ArrayBuffer).slice(\n\t\t\topcodes.byteOffset,\n\t\t\topcodes.byteOffset + opcodes.byteLength\n\t\t);\n\t\tconst numbersBuffer = (numbers.buffer as ArrayBuffer).slice(\n\t\t\tnumbers.byteOffset,\n\t\t\tnumbers.byteOffset + numbers.byteLength\n\t\t);\n\n\t\treturn {\n\t\t\t...base,\n\t\t\topcodesBuffer,\n\t\t\tnumbersBuffer,\n\t\t\topcodesLength: opcodes.length,\n\t\t\tnumbersLength: numbers.length,\n\t\t\tstrings: [...program.strings],\n\t\t\treads,\n\t\t\twrites,\n\t\t\tisVariableDef,\n\t\t};\n\t} catch (e) {\n\t\treturn {\n\t\t\t...base,\n\t\t\topcodesBuffer: new ArrayBuffer(0),\n\t\t\tnumbersBuffer: new ArrayBuffer(0),\n\t\t\topcodesLength: 0,\n\t\t\tnumbersLength: 0,\n\t\t\terror: e instanceof Error ? e.message : String(e),\n\t\t};\n\t}\n}\n\nfunction handleCompileBatch(msg: CompileBatchMsg): void {\n\tconst results: CompileResult[] = [];\n\tconst transferList: ArrayBuffer[] = [];\n\n\tfor (const item of msg.items) {\n\t\tconst result = compileOne(item);\n\t\tresults.push(result);\n\t\tif (result.opcodesBuffer.byteLength > 0) transferList.push(result.opcodesBuffer);\n\t\tif (result.numbersBuffer.byteLength > 0) transferList.push(result.numbersBuffer);\n\t}\n\n\t(self as unknown as Worker).postMessage(\n\t\t{ id: msg.id, type: \"COMPILE_RESULT\", results },\n\t\ttransferList\n\t);\n}\n\n// ── Execute ──────────────────────────────────────────────────────────\n\n/**\n * Execute a single bytecode program and produce a serialized ExecuteResult.\n * Reconstructs TypedArrays from the transferred ArrayBuffers (zero-copy).\n * Resets the worker VM before each execution, no state carries over\n * between lines in a batch.\n */\nfunction executeOne(item: ExecuteItem): ExecuteResult {\n\tconst vmm = getExecuteVm();\n\tvmm.reset();\n\n\tconst opcodes = new Uint8Array(item.opcodesBuffer, 0, item.opcodesLength);\n\tconst numbers = new Float64Array(item.numbersBuffer, 0, item.numbersLength);\n\tconst bytecode: Bytecode = { opcodes, numbers, strings: item.strings };\n\n\ttry {\n\t\tconst result = executeBytecode(bytecode, vmm);\n\n\t\tif (result.type === \"pending\") {\n\t\t\treturn {\n\t\t\t\tlineNumber: item.lineNumber,\n\t\t\t\tvalueType: ValueType.Pending,\n\t\t\t\tvalue: 0,\n\t\t\t\tisPending: true,\n\t\t\t\tqueryKey: result.queryKey,\n\t\t\t};\n\t\t}\n\n\t\tif (result.type === \"error\") {\n\t\t\treturn {\n\t\t\t\tlineNumber: item.lineNumber,\n\t\t\t\tvalueType: ValueType.Error,\n\t\t\t\tvalue: 0,\n\t\t\t\tisPending: false,\n\t\t\t\tunit: result.error.message,\n\t\t\t};\n\t\t}\n\n\t\tconst val = result.value;\n\t\treturn {\n\t\t\tlineNumber: item.lineNumber,\n\t\t\tvalueType: val.type,\n\t\t\tvalue: typeof val.value === \"number\"\n\t\t\t\t? val.value\n\t\t\t\t: typeof val.value === \"bigint\"\n\t\t\t\t\t? Number(val.value)\n\t\t\t\t\t: 0,\n\t\t\tunit: val.unit,\n\t\t\tisPending: false,\n\t\t};\n\t} catch {\n\t\t// Execution error, return error-type value so main thread can\n\t\t// propagate through DAG as errorValue.\n\t\treturn {\n\t\t\tlineNumber: item.lineNumber,\n\t\t\tvalueType: ValueType.Error,\n\t\t\tvalue: 0,\n\t\t\tisPending: false,\n\t\t\tunit: \"Worker execution failed\",\n\t\t};\n\t}\n}\n\nfunction handleExecuteBatch(msg: ExecuteBatchMsg): void {\n\tconst results: ExecuteResult[] = [];\n\tfor (const item of msg.items) {\n\t\tresults.push(executeOne(item));\n\t}\n\t// No transferables needed for the response, results are plain\n\t// objects with numbers and strings (structured-cloned).\n\t(self as unknown as Worker).postMessage({\n\t\tid: msg.id,\n\t\ttype: \"EXECUTE_RESULT\",\n\t\tresults,\n\t});\n}\n\n// ── Message handler ───────────────────────────────────────────────────\n\n/**\n * Whether this module is executing inside a real worker global scope.\n *\n * This file is a bundle entry of its own (`solve-engine/engine-worker`), so a\n * host that starts a worker from it runs the handler below in a worker. It is\n * still an ordinary module to anything that merely imports it, a test harness\n * or a Node script included, and there the handler must not bind.\n *\n * Without this guard, importing it from Node throws `self is not defined`\n * before a single expression can be evaluated. The check distinguishes the\n * three environments: Node defines neither `self` nor `window`, a browser main\n * thread defines both, and a worker defines only `self`.\n */\nconst inWorkerScope = typeof self !== \"undefined\" && typeof window === \"undefined\";\n\nconst handleMessage = (event: MessageEvent) => {\n\t// A real postMessage always carries a browser-populated origin the\n\t// sender cannot spoof, so this only ever rejects a genuine mismatch. It\n\t// is skipped, not enforced, when either side is unset, which covers the\n\t// test harness driving this handler directly with a plain object and\n\t// no location global (see WorkerIntegration.spec.ts), without opening\n\t// anything a real message could exploit.\n\tif (event.origin && self.location && event.origin !== self.location.origin) return;\n\n\tconst msg = event.data as EngineWorkerMessage;\n\n\tswitch (msg.type) {\n\t\tcase \"COMPILE_BATCH\":\n\t\t\thandleCompileBatch(msg);\n\t\t\tbreak;\n\n\t\tcase \"EXECUTE_BATCH\":\n\t\t\thandleExecuteBatch(msg);\n\t\t\tbreak;\n\n\t\tcase \"TERMINATE\": {\n\t\t\t// Not sent by either production manager today, both call the\n\t\t\t// native Worker.terminate() directly instead. Kept for protocol\n\t\t\t// completeness and future consumers. Clears whichever per-role\n\t\t\t// state this instance happened to create.\n\t\t\tif (compileEngine) {\n\t\t\t\tcompileEngine.clear();\n\t\t\t\tcompileEngine = null;\n\t\t\t}\n\t\t\tif (executeVm) {\n\t\t\t\texecuteVm.reset();\n\t\t\t\texecuteVm = null;\n\t\t\t}\n\t\t\t(self as unknown as Worker).postMessage({\n\t\t\t\tid: msg.id,\n\t\t\t\ttype: \"COMPILE_RESULT\",\n\t\t\t\tresults: [],\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault: {\n\t\t\t(self as unknown as Worker).postMessage({\n\t\t\t\tid: -1,\n\t\t\t\ttype: \"COMPILE_RESULT\",\n\t\t\t\tresults: [],\n\t\t\t\terror: `Unknown message type: ${(msg as { type?: string }).type}`,\n\t\t\t});\n\t\t}\n\t}\n};\n\n// Installed only when genuinely running as a worker. Everywhere else this\n// module has been inlined into a host bundle, where binding a handler would at\n// best be inert and at worst intercept the host's own messages.\nif (inWorkerScope) {\n\tself.onmessage = handleMessage;\n}\n"]}
1
+ {"version":3,"sources":["../src/workers/engine.worker.ts"],"names":["compileEngine","getCompileEngine","ExpressionEngine","BUILTIN_PACKAGES","executeVm","getExecuteVm","createVM","sharedOpRegistry","compileOne","item","base","eng","program","reads","writes","isVariableDef","opcodes","numbers","opcodesBuffer","numbersBuffer","e","handleCompileBatch","msg","results","transferList","result","executeOne","vmm","bytecode","executeBytecode","val","handleExecuteBatch","inWorkerScope","handleMessage","event"],"mappings":"8iCA0GA,IAAIA,CAAAA,CAAyC,IAAA,CAC7C,SAASC,CAAAA,EAAqC,CAC7C,OAAKD,CAAAA,GAOJA,CAAAA,CAAgB,IAAIE,CAAAA,CAAiB,CAAE,QAAA,CAAUC,CAAiB,CAAC,CAAA,CAAA,CAE7DH,CACR,CAEA,IAAII,CAAAA,CAAgD,IAAA,CACpD,SAASC,CAAAA,EAA4C,CACpD,OAAKD,CAAAA,GACJA,CAAAA,CAAYE,CAAAA,CAASC,CAAAA,CAAkB,GAAA,CAAK,GAAK,CAAA,CAAA,CAE3CH,CACR,CAUA,SAASI,CAAAA,CAAWC,CAAAA,CAAkC,CACrD,IAAMC,CAAAA,CAAmG,CACxG,MAAA,CAAQD,CAAAA,CAAK,MAAA,CACb,UAAA,CAAYA,CAAAA,CAAK,UAAA,CACjB,mBAAA,CAAqBA,CAAAA,CAAK,QAAA,CAC1B,OAAA,CAAS,EAAC,CACV,KAAA,CAAO,EAAC,CACR,MAAA,CAAQ,EAAC,CACT,aAAA,CAAe,KAAA,CACf,MAAO,IACR,CAAA,CAEA,GAAI,CACH,IAAME,CAAAA,CAAMV,CA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AA,EAAe,OAAO,MAAA,CAAW,GAAA,CAEjEC,CAAAA,CAAiBC,CAAAA,EAAwB,CAO9C,GAAIA,CAAAA,CAAM,MAAA,EAAU,IAAA,CAAK,QAAA,EAAYA,CAAAA,CAAM,MAAA,GAAW,IAAA,CAAK,QAAA,CAAS,MAAA,CAAQ,OAE5E,IAAMZ,CAAAA,CAAMY,CAAAA,CAAM,IAAA,CAElB,OAAQZ,CAAAA,CAAI,IAAA,EACX,KAAK,eAAA,CACJD,CAAAA,CAAmBC,CAAG,EACtB,MAED,KAAK,eAAA,CACJS,CAAAA,CAAmBT,CAAG,CAAA,CACtB,MAED,KAAK,WAAA,CAAa,CAKbtB,CAAAA,GACHA,CAAAA,CAAc,KAAA,EAAM,CACpBA,CAAAA,CAAgB,IAAA,CAAA,CAEbI,CAAAA,GACHA,CAAAA,CAAU,KAAA,EAAM,CAChBA,CAAAA,CAAY,IAAA,CAAA,CAEZ,IAAA,CAA2B,WAAA,CAAY,CACvC,EAAA,CAAIkB,CAAAA,CAAI,EAAA,CACR,IAAA,CAAM,gBAAA,CACN,QAAS,EACV,CAAC,CAAA,CACD,KACD,CAEA,QACE,IAAA,CAA2B,WAAA,CAAY,CACvC,EAAA,CAAI,EAAA,CACJ,IAAA,CAAM,gBAAA,CACN,OAAA,CAAS,EAAC,CACV,KAAA,CAAO,CAAA,sBAAA,EAA0BA,CAAAA,CAA0B,IAAI,CAAA,CAChE,CAAC,EAEH,CACD,CAAA,CAKIU,CAAAA,GACH,IAAA,CAAK,SAAA,CAAYC,CAAAA,CAAAA","file":"engine.worker.js","sourcesContent":["/**\n * Engine worker, offloads both compilation and VM execution to a\n * background thread (plan L6: worker consolidation).\n *\n * Previously two separate worker files (compilation.worker.ts,\n * execution.worker.ts) duplicated the Transferable ArrayBuffer protocol,\n * postMessage/onmessage boilerplate, and lazy-init pattern. This file\n * merges them behind a single `self.onmessage` dispatching on `msg.type`\n * the message shapes are UNCHANGED from the two original files, so\n * CompilationWorkerManager and ExecutionPool (the main-thread consumers)\n * reach a worker started from this file through the factory a host registers\n * with `setEngineWorkerFactory`, and never import this module themselves.\n *\n * Each Worker instance created from this file is used exclusively by ONE\n * consumer (a CompilationWorkerManager sends only COMPILE_BATCH; an\n * ExecutionPool sends only EXECUTE_BATCH), the module-level `engine` and\n * `vm` singletons below are independent lazy state, so there is no\n * cross-contamination between the two roles even though they share code.\n *\n * Message protocol:\n * Main → Worker:\n * { type: \"COMPILE_BATCH\", id, items: CompileItem[] }\n * { type: \"EXECUTE_BATCH\", id, items: ExecuteItem[] }\n * { type: \"TERMINATE\", id }\n *\n * Worker → Main:\n * { id, type: \"COMPILE_RESULT\", results: CompileResult[] }\n * { id, type: \"EXECUTE_RESULT\", results: ExecuteResult[] }\n *\n * Transferable objects: bytecode opcodes/numbers buffers are transferred\n * (zero-copy) in both directions, same pattern as the original files.\n */\n\nimport { ExpressionEngine } from \"../engine/ExpressionEngine\";\nimport { BUILTIN_PACKAGES } from \"../packages/builtins\";\nimport type { Bytecode } from \"../vm/VM\";\nimport { createVM, executeBytecode } from \"../vm/VM\";\nimport { sharedOpRegistry } from \"../vm/OpRegistry\";\nimport { ValueType } from \"../vm/Value\";\n\n// ── Compile message types ──────────────────────────────────────────────\n\ninterface CompileItem {\n\tlineId: number;\n\texpression: string;\n\ttextHash: number;\n}\n\ninterface CompileBatchMsg {\n\ttype: \"COMPILE_BATCH\";\n\tid: number;\n\titems: CompileItem[];\n}\n\ninterface CompileResult {\n\tlineId: number;\n\texpression: string;\n\tcompiledAgainstHash: number;\n\topcodesBuffer: ArrayBuffer;\n\tnumbersBuffer: ArrayBuffer;\n\topcodesLength: number;\n\tnumbersLength: number;\n\tstrings: string[];\n\treads: string[];\n\twrites: string[];\n\tisVariableDef: boolean;\n\terror: string | null;\n}\n\n// ── Execute message types ──────────────────────────────────────────────\n\ninterface ExecuteItem {\n\tlineNumber: number;\n\topcodesBuffer: ArrayBuffer;\n\tnumbersBuffer: ArrayBuffer;\n\topcodesLength: number;\n\tnumbersLength: number;\n\tstrings: string[];\n}\n\ninterface ExecuteBatchMsg {\n\ttype: \"EXECUTE_BATCH\";\n\tid: number;\n\titems: ExecuteItem[];\n}\n\ninterface ExecuteResult {\n\tlineNumber: number;\n\tvalueType: ValueType;\n\tvalue: number;\n\tunit?: string;\n\tisPending: boolean;\n\tqueryKey?: string;\n}\n\ninterface TerminateMsg {\n\ttype: \"TERMINATE\";\n\tid: number;\n}\n\ntype EngineWorkerMessage = CompileBatchMsg | ExecuteBatchMsg | TerminateMsg;\n\n// ── Worker body ───────────────────────────────────────────────────────\n\n// ── Lazy per-role state, independent, only the used one is created ────\n\nlet compileEngine: ExpressionEngine | null = null;\nfunction getCompileEngine(): ExpressionEngine {\n\tif (!compileEngine) {\n\t\t// The full vocabulary, which is the point of this file being its own\n\t\t// bundle: a compile engine with no packages would refuse every line a\n\t\t// package gives meaning to, and the manager would fall back to the main\n\t\t// thread for nearly all of them. Nothing but a host that registers a\n\t\t// factory (see `WorkerFactory.ts`) reaches this module, so a consumer's\n\t\t// main bundle carries neither the packages nor this file.\n\t\tcompileEngine = new ExpressionEngine({ packages: BUILTIN_PACKAGES });\n\t}\n\treturn compileEngine;\n}\n\nlet executeVm: ReturnType<typeof createVM> | null = null;\nfunction getExecuteVm(): ReturnType<typeof createVM> {\n\tif (!executeVm) {\n\t\texecuteVm = createVM(sharedOpRegistry, 200, 50000);\n\t}\n\treturn executeVm;\n}\n\n// ── Compile ──────────────────────────────────────────────────────────\n\n/**\n * Compile a single expression and produce a transfer-ready CompileResult.\n * Extracts ArrayBuffers from the compiled TypedArrays so they can be\n * transferred via postMessage, after this call, the original TypedArrays\n * are detached on the worker side.\n */\nfunction compileOne(item: CompileItem): CompileResult {\n\tconst base: Omit<CompileResult, \"opcodesBuffer\" | \"numbersBuffer\" | \"opcodesLength\" | \"numbersLength\"> = {\n\t\tlineId: item.lineId,\n\t\texpression: item.expression,\n\t\tcompiledAgainstHash: item.textHash,\n\t\tstrings: [],\n\t\treads: [],\n\t\twrites: [],\n\t\tisVariableDef: false,\n\t\terror: null,\n\t};\n\n\ttry {\n\t\tconst eng = getCompileEngine();\n\t\tconst { program, reads, writes } = eng.compileExpression(item.expression);\n\t\tconst isVariableDef = writes.length > 0;\n\n\t\tconst opcodes = program.opcodes;\n\t\tconst numbers = program.numbers;\n\n\t\t// Transfer only the exact used slice of the ArrayBuffer. The engine's\n\t\t// buffer pool is write-only, so detaching the source view is fine.\n\t\t//\n\t\t// The casts narrow ArrayBufferLike to ArrayBuffer. A TypedArray's\n\t\t// `buffer` is typed as the union including SharedArrayBuffer, which\n\t\t// TypeScript 6 enforces where 5.1 did not, and the postMessage\n\t\t// transfer list below accepts only ArrayBuffer. The narrowing is\n\t\t// sound here because these buffers come from the engine's own pool,\n\t\t// which allocates plain ArrayBuffers; a SharedArrayBuffer could not\n\t\t// reach this point, and would not be transferable if it did.\n\t\tconst opcodesBuffer = (opcodes.buffer as ArrayBuffer).slice(\n\t\t\topcodes.byteOffset,\n\t\t\topcodes.byteOffset + opcodes.byteLength\n\t\t);\n\t\tconst numbersBuffer = (numbers.buffer as ArrayBuffer).slice(\n\t\t\tnumbers.byteOffset,\n\t\t\tnumbers.byteOffset + numbers.byteLength\n\t\t);\n\n\t\treturn {\n\t\t\t...base,\n\t\t\topcodesBuffer,\n\t\t\tnumbersBuffer,\n\t\t\topcodesLength: opcodes.length,\n\t\t\tnumbersLength: numbers.length,\n\t\t\tstrings: [...program.strings],\n\t\t\treads,\n\t\t\twrites,\n\t\t\tisVariableDef,\n\t\t};\n\t} catch (e) {\n\t\treturn {\n\t\t\t...base,\n\t\t\topcodesBuffer: new ArrayBuffer(0),\n\t\t\tnumbersBuffer: new ArrayBuffer(0),\n\t\t\topcodesLength: 0,\n\t\t\tnumbersLength: 0,\n\t\t\terror: e instanceof Error ? e.message : String(e),\n\t\t};\n\t}\n}\n\nfunction handleCompileBatch(msg: CompileBatchMsg): void {\n\tconst results: CompileResult[] = [];\n\tconst transferList: ArrayBuffer[] = [];\n\n\tfor (const item of msg.items) {\n\t\tconst result = compileOne(item);\n\t\tresults.push(result);\n\t\tif (result.opcodesBuffer.byteLength > 0) transferList.push(result.opcodesBuffer);\n\t\tif (result.numbersBuffer.byteLength > 0) transferList.push(result.numbersBuffer);\n\t}\n\n\t(self as unknown as Worker).postMessage(\n\t\t{ id: msg.id, type: \"COMPILE_RESULT\", results },\n\t\ttransferList\n\t);\n}\n\n// ── Execute ──────────────────────────────────────────────────────────\n\n/**\n * Execute a single bytecode program and produce a serialized ExecuteResult.\n * Reconstructs TypedArrays from the transferred ArrayBuffers (zero-copy).\n * Resets the worker VM before each execution, no state carries over\n * between lines in a batch.\n */\nfunction executeOne(item: ExecuteItem): ExecuteResult {\n\tconst vmm = getExecuteVm();\n\tvmm.reset();\n\n\tconst opcodes = new Uint8Array(item.opcodesBuffer, 0, item.opcodesLength);\n\tconst numbers = new Float64Array(item.numbersBuffer, 0, item.numbersLength);\n\tconst bytecode: Bytecode = { opcodes, numbers, strings: item.strings };\n\n\ttry {\n\t\tconst result = executeBytecode(bytecode, vmm);\n\n\t\tif (result.type === \"pending\") {\n\t\t\treturn {\n\t\t\t\tlineNumber: item.lineNumber,\n\t\t\t\tvalueType: ValueType.Pending,\n\t\t\t\tvalue: 0,\n\t\t\t\tisPending: true,\n\t\t\t\tqueryKey: result.queryKey,\n\t\t\t};\n\t\t}\n\n\t\tif (result.type === \"error\") {\n\t\t\treturn {\n\t\t\t\tlineNumber: item.lineNumber,\n\t\t\t\tvalueType: ValueType.Error,\n\t\t\t\tvalue: 0,\n\t\t\t\tisPending: false,\n\t\t\t\tunit: result.error.message,\n\t\t\t};\n\t\t}\n\n\t\tconst val = result.value;\n\t\treturn {\n\t\t\tlineNumber: item.lineNumber,\n\t\t\tvalueType: val.type,\n\t\t\tvalue: typeof val.value === \"number\"\n\t\t\t\t? val.value\n\t\t\t\t: typeof val.value === \"bigint\"\n\t\t\t\t\t? Number(val.value)\n\t\t\t\t\t: 0,\n\t\t\tunit: val.unit,\n\t\t\tisPending: false,\n\t\t};\n\t} catch {\n\t\t// Execution error, return error-type value so main thread can\n\t\t// propagate through DAG as errorValue.\n\t\treturn {\n\t\t\tlineNumber: item.lineNumber,\n\t\t\tvalueType: ValueType.Error,\n\t\t\tvalue: 0,\n\t\t\tisPending: false,\n\t\t\tunit: \"Worker execution failed\",\n\t\t};\n\t}\n}\n\nfunction handleExecuteBatch(msg: ExecuteBatchMsg): void {\n\tconst results: ExecuteResult[] = [];\n\tfor (const item of msg.items) {\n\t\tresults.push(executeOne(item));\n\t}\n\t// No transferables needed for the response, results are plain\n\t// objects with numbers and strings (structured-cloned).\n\t(self as unknown as Worker).postMessage({\n\t\tid: msg.id,\n\t\ttype: \"EXECUTE_RESULT\",\n\t\tresults,\n\t});\n}\n\n// ── Message handler ───────────────────────────────────────────────────\n\n/**\n * Whether this module is executing inside a real worker global scope.\n *\n * This file is a bundle entry of its own (`solve-engine/engine-worker`), so a\n * host that starts a worker from it runs the handler below in a worker. It is\n * still an ordinary module to anything that merely imports it, a test harness\n * or a Node script included, and there the handler must not bind.\n *\n * Without this guard, importing it from Node throws `self is not defined`\n * before a single expression can be evaluated. The check distinguishes the\n * three environments: Node defines neither `self` nor `window`, a browser main\n * thread defines both, and a worker defines only `self`.\n */\nconst inWorkerScope = typeof self !== \"undefined\" && typeof window === \"undefined\";\n\nconst handleMessage = (event: MessageEvent) => {\n\t// A real postMessage always carries a browser-populated origin the\n\t// sender cannot spoof, so this only ever rejects a genuine mismatch. It\n\t// is skipped, not enforced, when either side is unset, which covers the\n\t// test harness driving this handler directly with a plain object and\n\t// no location global (see WorkerIntegration.spec.ts), without opening\n\t// anything a real message could exploit.\n\tif (event.origin && self.location && event.origin !== self.location.origin) return;\n\n\tconst msg = event.data as EngineWorkerMessage;\n\n\tswitch (msg.type) {\n\t\tcase \"COMPILE_BATCH\":\n\t\t\thandleCompileBatch(msg);\n\t\t\tbreak;\n\n\t\tcase \"EXECUTE_BATCH\":\n\t\t\thandleExecuteBatch(msg);\n\t\t\tbreak;\n\n\t\tcase \"TERMINATE\": {\n\t\t\t// Not sent by either production manager today, both call the\n\t\t\t// native Worker.terminate() directly instead. Kept for protocol\n\t\t\t// completeness and future consumers. Clears whichever per-role\n\t\t\t// state this instance happened to create.\n\t\t\tif (compileEngine) {\n\t\t\t\tcompileEngine.clear();\n\t\t\t\tcompileEngine = null;\n\t\t\t}\n\t\t\tif (executeVm) {\n\t\t\t\texecuteVm.reset();\n\t\t\t\texecuteVm = null;\n\t\t\t}\n\t\t\t(self as unknown as Worker).postMessage({\n\t\t\t\tid: msg.id,\n\t\t\t\ttype: \"COMPILE_RESULT\",\n\t\t\t\tresults: [],\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault: {\n\t\t\t(self as unknown as Worker).postMessage({\n\t\t\t\tid: -1,\n\t\t\t\ttype: \"COMPILE_RESULT\",\n\t\t\t\tresults: [],\n\t\t\t\terror: `Unknown message type: ${(msg as { type?: string }).type}`,\n\t\t\t});\n\t\t}\n\t}\n};\n\n// Installed only when genuinely running as a worker. Everywhere else this\n// module has been inlined into a host bundle, where binding a handler would at\n// best be inert and at worst intercept the host's own messages.\nif (inWorkerScope) {\n\tself.onmessage = handleMessage;\n}\n"]}
package/dist/errors.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var chunk7DJYS5PO_cjs=require('./chunk-7DJYS5PO.cjs'),chunkSUAGBRQ7_cjs=require('./chunk-SUAGBRQ7.cjs');Object.defineProperty(exports,"WorkerErrorCodes",{enumerable:true,get:function(){return chunk7DJYS5PO_cjs.a}});Object.defineProperty(exports,"deserializeEngineError",{enumerable:true,get:function(){return chunk7DJYS5PO_cjs.c}});Object.defineProperty(exports,"serializeEngineError",{enumerable:true,get:function(){return chunk7DJYS5PO_cjs.b}});Object.defineProperty(exports,"workerCancelledError",{enumerable:true,get:function(){return chunk7DJYS5PO_cjs.d}});Object.defineProperty(exports,"workerTerminatedError",{enumerable:true,get:function(){return chunk7DJYS5PO_cjs.e}});Object.defineProperty(exports,"workerTransportError",{enumerable:true,get:function(){return chunk7DJYS5PO_cjs.f}});Object.defineProperty(exports,"CoreErrorCodes",{enumerable:true,get:function(){return chunkSUAGBRQ7_cjs.r}});Object.defineProperty(exports,"EngineError",{enumerable:true,get:function(){return chunkSUAGBRQ7_cjs.b}});Object.defineProperty(exports,"ErrorCategory",{enumerable:true,get:function(){return chunkSUAGBRQ7_cjs.a}});Object.defineProperty(exports,"ErrorFactory",{enumerable:true,get:function(){return chunkSUAGBRQ7_cjs.c}});Object.defineProperty(exports,"andThen",{enumerable:true,get:function(){return chunkSUAGBRQ7_cjs.k}});Object.defineProperty(exports,"combine",{enumerable:true,get:function(){return chunkSUAGBRQ7_cjs.n}});Object.defineProperty(exports,"err",{enumerable:true,get:function(){return chunkSUAGBRQ7_cjs.f}});Object.defineProperty(exports,"isErr",{enumerable:true,get:function(){return chunkSUAGBRQ7_cjs.h}});Object.defineProperty(exports,"isOk",{enumerable:true,get:function(){return chunkSUAGBRQ7_cjs.g}});Object.defineProperty(exports,"map",{enumerable:true,get:function(){return chunkSUAGBRQ7_cjs.i}});Object.defineProperty(exports,"mapErr",{enumerable:true,get:function(){return chunkSUAGBRQ7_cjs.j}});Object.defineProperty(exports,"match",{enumerable:true,get:function(){return chunkSUAGBRQ7_cjs.m}});Object.defineProperty(exports,"normalizeUnknownError",{enumerable:true,get:function(){return chunkSUAGBRQ7_cjs.d}});Object.defineProperty(exports,"ok",{enumerable:true,get:function(){return chunkSUAGBRQ7_cjs.e}});Object.defineProperty(exports,"throwIfErr",{enumerable:true,get:function(){return chunkSUAGBRQ7_cjs.o}});Object.defineProperty(exports,"tryCatch",{enumerable:true,get:function(){return chunkSUAGBRQ7_cjs.p}});Object.defineProperty(exports,"tryCatchAsync",{enumerable:true,get:function(){return chunkSUAGBRQ7_cjs.q}});Object.defineProperty(exports,"unwrapOr",{enumerable:true,get:function(){return chunkSUAGBRQ7_cjs.l}});//# sourceMappingURL=errors.cjs.map
1
+ 'use strict';var chunkHSTGWWU2_cjs=require('./chunk-HSTGWWU2.cjs'),chunk6SYU4MH7_cjs=require('./chunk-6SYU4MH7.cjs');Object.defineProperty(exports,"WorkerErrorCodes",{enumerable:true,get:function(){return chunkHSTGWWU2_cjs.a}});Object.defineProperty(exports,"deserializeEngineError",{enumerable:true,get:function(){return chunkHSTGWWU2_cjs.c}});Object.defineProperty(exports,"serializeEngineError",{enumerable:true,get:function(){return chunkHSTGWWU2_cjs.b}});Object.defineProperty(exports,"workerCancelledError",{enumerable:true,get:function(){return chunkHSTGWWU2_cjs.d}});Object.defineProperty(exports,"workerTerminatedError",{enumerable:true,get:function(){return chunkHSTGWWU2_cjs.e}});Object.defineProperty(exports,"workerTransportError",{enumerable:true,get:function(){return chunkHSTGWWU2_cjs.f}});Object.defineProperty(exports,"CoreErrorCodes",{enumerable:true,get:function(){return chunk6SYU4MH7_cjs.r}});Object.defineProperty(exports,"EngineError",{enumerable:true,get:function(){return chunk6SYU4MH7_cjs.b}});Object.defineProperty(exports,"ErrorCategory",{enumerable:true,get:function(){return chunk6SYU4MH7_cjs.a}});Object.defineProperty(exports,"ErrorFactory",{enumerable:true,get:function(){return chunk6SYU4MH7_cjs.c}});Object.defineProperty(exports,"andThen",{enumerable:true,get:function(){return chunk6SYU4MH7_cjs.k}});Object.defineProperty(exports,"combine",{enumerable:true,get:function(){return chunk6SYU4MH7_cjs.n}});Object.defineProperty(exports,"err",{enumerable:true,get:function(){return chunk6SYU4MH7_cjs.f}});Object.defineProperty(exports,"isErr",{enumerable:true,get:function(){return chunk6SYU4MH7_cjs.h}});Object.defineProperty(exports,"isOk",{enumerable:true,get:function(){return chunk6SYU4MH7_cjs.g}});Object.defineProperty(exports,"map",{enumerable:true,get:function(){return chunk6SYU4MH7_cjs.i}});Object.defineProperty(exports,"mapErr",{enumerable:true,get:function(){return chunk6SYU4MH7_cjs.j}});Object.defineProperty(exports,"match",{enumerable:true,get:function(){return chunk6SYU4MH7_cjs.m}});Object.defineProperty(exports,"normalizeUnknownError",{enumerable:true,get:function(){return chunk6SYU4MH7_cjs.d}});Object.defineProperty(exports,"ok",{enumerable:true,get:function(){return chunk6SYU4MH7_cjs.e}});Object.defineProperty(exports,"throwIfErr",{enumerable:true,get:function(){return chunk6SYU4MH7_cjs.o}});Object.defineProperty(exports,"tryCatch",{enumerable:true,get:function(){return chunk6SYU4MH7_cjs.p}});Object.defineProperty(exports,"tryCatchAsync",{enumerable:true,get:function(){return chunk6SYU4MH7_cjs.q}});Object.defineProperty(exports,"unwrapOr",{enumerable:true,get:function(){return chunk6SYU4MH7_cjs.l}});//# sourceMappingURL=errors.cjs.map
2
2
  //# sourceMappingURL=errors.cjs.map
package/dist/errors.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { E as EngineError } from './EngineError-CqGtaT_v.cjs';
2
- export { C as CoreErrorCode, a as CoreErrorCodes, b as EngineErrorInit, c as ErrorCategory, d as ErrorCode, e as ErrorFactory, S as SourceSpan, n as normalizeUnknownError } from './EngineError-CqGtaT_v.cjs';
3
- export { S as SerializedEngineError, W as WorkerErrorCodes, d as deserializeEngineError, s as serializeEngineError, w as workerCancelledError, a as workerTerminatedError, b as workerTransportError } from './WorkerError-CRoM8Ju1.cjs';
1
+ import { E as EngineError } from './EngineError-Bm4OYmw8.cjs';
2
+ export { C as CoreErrorCode, a as CoreErrorCodes, b as EngineErrorInit, c as ErrorCategory, d as ErrorCode, e as ErrorFactory, S as SourceSpan, n as normalizeUnknownError } from './EngineError-Bm4OYmw8.cjs';
3
+ export { S as SerializedEngineError, W as WorkerErrorCodes, d as deserializeEngineError, s as serializeEngineError, w as workerCancelledError, a as workerTerminatedError, b as workerTransportError } from './WorkerError-CexHHmbb.cjs';
4
4
 
5
5
  /**
6
6
  * A Rust-style `Result<T, E>`, the value half of this engine's error-handling
package/dist/errors.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { E as EngineError } from './EngineError-CqGtaT_v.js';
2
- export { C as CoreErrorCode, a as CoreErrorCodes, b as EngineErrorInit, c as ErrorCategory, d as ErrorCode, e as ErrorFactory, S as SourceSpan, n as normalizeUnknownError } from './EngineError-CqGtaT_v.js';
3
- export { S as SerializedEngineError, W as WorkerErrorCodes, d as deserializeEngineError, s as serializeEngineError, w as workerCancelledError, a as workerTerminatedError, b as workerTransportError } from './WorkerError-DTrl3Jag.js';
1
+ import { E as EngineError } from './EngineError-Bm4OYmw8.js';
2
+ export { C as CoreErrorCode, a as CoreErrorCodes, b as EngineErrorInit, c as ErrorCategory, d as ErrorCode, e as ErrorFactory, S as SourceSpan, n as normalizeUnknownError } from './EngineError-Bm4OYmw8.js';
3
+ export { S as SerializedEngineError, W as WorkerErrorCodes, d as deserializeEngineError, s as serializeEngineError, w as workerCancelledError, a as workerTerminatedError, b as workerTransportError } from './WorkerError-BaN8_eok.js';
4
4
 
5
5
  /**
6
6
  * A Rust-style `Result<T, E>`, the value half of this engine's error-handling
package/dist/errors.js CHANGED
@@ -1,2 +1,2 @@
1
- export{a as WorkerErrorCodes,c as deserializeEngineError,b as serializeEngineError,d as workerCancelledError,e as workerTerminatedError,f as workerTransportError}from'./chunk-G3POUURF.js';export{r as CoreErrorCodes,b as EngineError,a as ErrorCategory,c as ErrorFactory,k as andThen,n as combine,f as err,h as isErr,g as isOk,i as map,j as mapErr,m as match,d as normalizeUnknownError,e as ok,o as throwIfErr,p as tryCatch,q as tryCatchAsync,l as unwrapOr}from'./chunk-RELMEWY6.js';//# sourceMappingURL=errors.js.map
1
+ export{a as WorkerErrorCodes,c as deserializeEngineError,b as serializeEngineError,d as workerCancelledError,e as workerTerminatedError,f as workerTransportError}from'./chunk-YID47OPR.js';export{r as CoreErrorCodes,b as EngineError,a as ErrorCategory,c as ErrorFactory,k as andThen,n as combine,f as err,h as isErr,g as isOk,i as map,j as mapErr,m as match,d as normalizeUnknownError,e as ok,o as throwIfErr,p as tryCatch,q as tryCatchAsync,l as unwrapOr}from'./chunk-6G2NES2I.js';//# sourceMappingURL=errors.js.map
2
2
  //# sourceMappingURL=errors.js.map
package/dist/format.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkP43SV4NJ_cjs=require('./chunk-P43SV4NJ.cjs');require('./chunk-R2SZFJTT.cjs'),require('./chunk-5TVI2UPZ.cjs'),require('./chunk-YWF6C2IO.cjs'),require('./chunk-A764BY7L.cjs'),require('./chunk-E4HAKNBQ.cjs'),require('./chunk-OM7NOHJF.cjs'),require('./chunk-S3DFU33X.cjs'),require('./chunk-SUAGBRQ7.cjs');Object.defineProperty(exports,"DEFAULT_FORMATTING_SETTINGS",{enumerable:true,get:function(){return chunkP43SV4NJ_cjs.a}});Object.defineProperty(exports,"formatMatrixAligned",{enumerable:true,get:function(){return chunkP43SV4NJ_cjs.b}});Object.defineProperty(exports,"formatValue",{enumerable:true,get:function(){return chunkP43SV4NJ_cjs.c}});//# sourceMappingURL=format.cjs.map
1
+ 'use strict';var chunkQOOTRUY7_cjs=require('./chunk-QOOTRUY7.cjs');require('./chunk-R2SZFJTT.cjs'),require('./chunk-5TVI2UPZ.cjs'),require('./chunk-WFT3XUSH.cjs'),require('./chunk-EQNKDTMX.cjs'),require('./chunk-E4HAKNBQ.cjs'),require('./chunk-S3SPDK6N.cjs'),require('./chunk-S3DFU33X.cjs'),require('./chunk-6SYU4MH7.cjs');Object.defineProperty(exports,"DEFAULT_FORMATTING_SETTINGS",{enumerable:true,get:function(){return chunkQOOTRUY7_cjs.a}});Object.defineProperty(exports,"formatMatrixAligned",{enumerable:true,get:function(){return chunkQOOTRUY7_cjs.b}});Object.defineProperty(exports,"formatValue",{enumerable:true,get:function(){return chunkQOOTRUY7_cjs.c}});//# sourceMappingURL=format.cjs.map
2
2
  //# sourceMappingURL=format.cjs.map
package/dist/format.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { V as Value, M as MatrixData } from './Value-BYHw-x7q.cjs';
1
+ import { V as Value, M as MatrixData } from './Value-2TIKi-YL.cjs';
2
2
  import { F as FormattingSettings } from './FormattingSettings-ByO-4wiM.cjs';
3
3
  export { D as DEFAULT_FORMATTING_SETTINGS } from './FormattingSettings-ByO-4wiM.cjs';
4
4
  import './CalendarBackend-MdS3Bb4P.cjs';
package/dist/format.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { V as Value, M as MatrixData } from './Value-BYHw-x7q.js';
1
+ import { V as Value, M as MatrixData } from './Value-2TIKi-YL.js';
2
2
  import { F as FormattingSettings } from './FormattingSettings-CvCzAfsz.js';
3
3
  export { D as DEFAULT_FORMATTING_SETTINGS } from './FormattingSettings-CvCzAfsz.js';
4
4
  import './CalendarBackend-MdS3Bb4P.js';
package/dist/format.js CHANGED
@@ -1,2 +1,2 @@
1
- export{a as DEFAULT_FORMATTING_SETTINGS,b as formatMatrixAligned,c as formatValue}from'./chunk-IQVSCL2R.js';import'./chunk-XEIDV5JP.js';import'./chunk-5TCSFTZD.js';import'./chunk-KH4QXKLT.js';import'./chunk-NQFCXLEF.js';import'./chunk-J4K72CQN.js';import'./chunk-X5K72MBV.js';import'./chunk-LHLW7JLS.js';import'./chunk-RELMEWY6.js';//# sourceMappingURL=format.js.map
1
+ export{a as DEFAULT_FORMATTING_SETTINGS,b as formatMatrixAligned,c as formatValue}from'./chunk-4XWZXP6I.js';import'./chunk-XEIDV5JP.js';import'./chunk-5TCSFTZD.js';import'./chunk-4MD5L23F.js';import'./chunk-EOO6M65F.js';import'./chunk-J4K72CQN.js';import'./chunk-O7HF345B.js';import'./chunk-LHLW7JLS.js';import'./chunk-6G2NES2I.js';//# sourceMappingURL=format.js.map
2
2
  //# sourceMappingURL=format.js.map
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';require('./chunk-AXTYQFIV.cjs'),require('./chunk-EFJCC6FJ.cjs');var chunkOKKGPINQ_cjs=require('./chunk-OKKGPINQ.cjs');require('./chunk-Q7TBBV62.cjs'),require('./chunk-NGBBNL4K.cjs'),require('./chunk-ZVPZQ66D.cjs'),require('./chunk-TTFO4YDP.cjs'),require('./chunk-UNKZ5XRC.cjs'),require('./chunk-HG4NPDN5.cjs');var chunkP43SV4NJ_cjs=require('./chunk-P43SV4NJ.cjs');require('./chunk-R2SZFJTT.cjs');var chunkSRAU3BLV_cjs=require('./chunk-SRAU3BLV.cjs');require('./chunk-A755LVPT.cjs'),require('./chunk-WQGHJAW2.cjs');var chunk5AKT36UK_cjs=require('./chunk-5AKT36UK.cjs');require('./chunk-4DR5RBHQ.cjs'),require('./chunk-UURM7P3P.cjs'),require('./chunk-ZLRJ7TDP.cjs'),require('./chunk-LCYQQFUH.cjs'),require('./chunk-CM2WM5CM.cjs'),require('./chunk-DUFEONVN.cjs'),require('./chunk-ABVDKMNF.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-5TVI2UPZ.cjs'),require('./chunk-YWF6C2IO.cjs');var chunkA764BY7L_cjs=require('./chunk-A764BY7L.cjs');require('./chunk-E4HAKNBQ.cjs');var chunkOM7NOHJF_cjs=require('./chunk-OM7NOHJF.cjs');require('./chunk-PHWIO4P3.cjs');var chunkCAJTDZ5B_cjs=require('./chunk-CAJTDZ5B.cjs');require('./chunk-AGCNMEP2.cjs'),require('./chunk-Y7O4D3BJ.cjs'),require('./chunk-WU7SBKVU.cjs'),require('./chunk-YBQOQTVL.cjs'),require('./chunk-S3DFU33X.cjs'),require('./chunk-J4LSAHCY.cjs'),require('./chunk-EZKR44MA.cjs');var chunkSUAGBRQ7_cjs=require('./chunk-SUAGBRQ7.cjs');var r={DEFINE_FUNCTION_INVALID_NAME:"DEFINE_FUNCTION_INVALID_NAME",DEFINE_FUNCTION_INVALID_SPEC:"DEFINE_FUNCTION_INVALID_SPEC",DEFINE_FUNCTION_ARITY_MISMATCH:"DEFINE_FUNCTION_ARITY_MISMATCH",DEFINE_FUNCTION_ARGUMENT_TYPE:"DEFINE_FUNCTION_ARGUMENT_TYPE",DEFINE_FUNCTION_RETURN_TYPE:"DEFINE_FUNCTION_RETURN_TYPE"},O=/^[a-z_][a-z0-9_]*$/i,N=new Set(["number","string","boolean"]);function u(e){return e===1?"1 argument":`${e} arguments`}function d(e){switch(e.type){case 0:case 1:return "a number";case 3:return "a string";case 10:return "a boolean";case 2:return "a big integer";case 5:return "a percentage";case 6:return "a value with a unit";case 4:return "a date";case 7:return "a matrix";case 8:return "a range";case 9:return "a symbolic expression";default:return "an unsupported value"}}function k(e,n,t){switch(n.type){case "number":if(e.type===0||e.type===1)return e.toNumber();break;case "string":if(e.type===3)return e.value;break;case "boolean":if(e.type===10)return e.value;break}throw chunkSUAGBRQ7_cjs.c.execution({code:r.DEFINE_FUNCTION_ARGUMENT_TYPE,message:`${t}() expects "${n.name}" to be a ${n.type}, but was given ${d(e)}`,expected:`a ${n.type}`,found:d(e),context:{functionName:t,argName:n.name,expectedType:n.type}})}function R(e,n,t){switch(n){case "number":if(typeof e=="number")return chunkOM7NOHJF_cjs.n(e);break;case "string":if(typeof e=="string")return chunkOM7NOHJF_cjs.t(e);break;case "boolean":if(typeof e=="boolean")return chunkOM7NOHJF_cjs.L(e);break}throw chunkSUAGBRQ7_cjs.c.internal({code:r.DEFINE_FUNCTION_RETURN_TYPE,message:`${t}() is declared to return a ${n}, but its implementation returned ${typeof e}`,expected:`a ${n}`,found:typeof e,context:{functionName:t,expectedType:n}})}var p=class{constructor(n){this.fnName=n;this.category="Function";}parse(n,t,a){n.consume("LPAREN");let i=0;if(n.peek()?.type!=="RPAREN")for(n.parseExpression(chunk5AKT36UK_cjs.a.Lowest,a),i++;n.match("COMMA");)n.parseExpression(chunk5AKT36UK_cjs.a.Lowest,a),i++;n.consume("RPAREN"),a.emitPluginCall(this.fnName,i);}};function D(e){let n=e.args.length;return t=>{if(t.length!==n)throw chunkSUAGBRQ7_cjs.c.execution({code:r.DEFINE_FUNCTION_ARITY_MISMATCH,message:`${e.name}() takes ${u(n)}, but was given ${t.length===0?"none":u(t.length)}`,expected:u(n),found:t.length===0?"none":u(t.length),context:{functionName:e.name,expected:n,actual:t.length}});let a=new Array(n);for(let s=0;s<n;s++)a[s]=k(t[s],e.args[s],e.name);let i=e.call(...a);return R(i,e.returns,e.name)}}function h(e){if(typeof e?.name!="string"||!O.test(e.name))throw chunkSUAGBRQ7_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_NAME,message:`defineFunction: name must be a single identifier, got ${JSON.stringify(e?.name)}`,suggestion:'e.g. "vat" or "net_price"',context:{name:e?.name}});if(!Array.isArray(e.args))throw chunkSUAGBRQ7_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" args must be an array`,context:{name:e.name}});for(let n of e.args){if(typeof n?.name!="string"||n.name.length===0)throw chunkSUAGBRQ7_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" has an argument with no name`,context:{name:e.name}});if(!N.has(n.type))throw chunkSUAGBRQ7_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" argument "${n.name}" has unsupported type ${JSON.stringify(n.type)}`,suggestion:"supported argument types are number, string, boolean",context:{name:e.name,argName:n.name,type:n.type}})}if(!N.has(e.returns))throw chunkSUAGBRQ7_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" has unsupported return type ${JSON.stringify(e.returns)}`,suggestion:"supported return types are number, string, boolean",context:{name:e.name,returns:e.returns}});if(typeof e.call!="function")throw chunkSUAGBRQ7_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" is missing a call implementation`,context:{name:e.name}})}function w(e){h(e);let n=e.name,t=`DEFINE_FN_${n.toUpperCase()}`;return {name:`solve-fn-${n}`,lexerVocabulary:{keywords:{[n.toLowerCase()]:t}},prefixParselets:{[t]:new p(n)},pluginFunctions:{[n]:D(e)}}}function U(e={}){let{extraPackages:n=[],...t}=e;return new chunkOKKGPINQ_cjs.o({...t,packages:n.length>0?[...chunkSRAU3BLV_cjs.z,...n]:chunkSRAU3BLV_cjs.z})}Object.defineProperty(exports,"ExpressionEngine",{enumerable:true,get:function(){return chunkOKKGPINQ_cjs.o}});Object.defineProperty(exports,"SNAPSHOT_FORMAT",{enumerable:true,get:function(){return chunkOKKGPINQ_cjs.d}});Object.defineProperty(exports,"SNAPSHOT_VERSION",{enumerable:true,get:function(){return chunkOKKGPINQ_cjs.e}});Object.defineProperty(exports,"SnapshotErrorCodes",{enumerable:true,get:function(){return chunkOKKGPINQ_cjs.f}});Object.defineProperty(exports,"assertEngineVersionCompatible",{enumerable:true,get:function(){return chunkOKKGPINQ_cjs.c}});Object.defineProperty(exports,"checkEngineVersionCompatibility",{enumerable:true,get:function(){return chunkOKKGPINQ_cjs.b}});Object.defineProperty(exports,"checkPackageCompatibility",{enumerable:true,get:function(){return chunkOKKGPINQ_cjs.a}});Object.defineProperty(exports,"setEngineWorkerFactory",{enumerable:true,get:function(){return chunkOKKGPINQ_cjs.g}});Object.defineProperty(exports,"formatValue",{enumerable:true,get:function(){return chunkP43SV4NJ_cjs.c}});Object.defineProperty(exports,"dateCalendarInZone",{enumerable:true,get:function(){return chunkA764BY7L_cjs.d}});Object.defineProperty(exports,"Value",{enumerable:true,get:function(){return chunkOM7NOHJF_cjs.m}});Object.defineProperty(exports,"ValueType",{enumerable:true,get:function(){return chunkOM7NOHJF_cjs.g}});Object.defineProperty(exports,"ENGINE_VERSION",{enumerable:true,get:function(){return chunkCAJTDZ5B_cjs.a}});exports.DefineFunctionErrorCodes=r;exports.createEngine=U;exports.defineFunction=w;//# sourceMappingURL=index.cjs.map
1
+ 'use strict';require('./chunk-6DCSGINN.cjs'),require('./chunk-EFJCC6FJ.cjs');var chunk4M3FZRGL_cjs=require('./chunk-4M3FZRGL.cjs');require('./chunk-P5YWBIIU.cjs'),require('./chunk-NGBBNL4K.cjs'),require('./chunk-R3W53ZMP.cjs'),require('./chunk-TTFO4YDP.cjs'),require('./chunk-LI6LYJDA.cjs'),require('./chunk-HG4NPDN5.cjs');var chunkQOOTRUY7_cjs=require('./chunk-QOOTRUY7.cjs');require('./chunk-R2SZFJTT.cjs');var chunk7CRVRPV7_cjs=require('./chunk-7CRVRPV7.cjs');require('./chunk-ZSXQP7PD.cjs'),require('./chunk-M4UC2PB6.cjs');var chunkK3PZ66XR_cjs=require('./chunk-K3PZ66XR.cjs');require('./chunk-YV4GDW5A.cjs'),require('./chunk-UURM7P3P.cjs'),require('./chunk-GDLYXRMA.cjs'),require('./chunk-ZLRJ7TDP.cjs'),require('./chunk-FESR6PZI.cjs'),require('./chunk-OBZJKZ2F.cjs'),require('./chunk-SF5QVUEI.cjs'),require('./chunk-ABVDKMNF.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-5TVI2UPZ.cjs'),require('./chunk-WFT3XUSH.cjs');var chunkEQNKDTMX_cjs=require('./chunk-EQNKDTMX.cjs');require('./chunk-E4HAKNBQ.cjs');var chunkS3SPDK6N_cjs=require('./chunk-S3SPDK6N.cjs');require('./chunk-PHWIO4P3.cjs');var chunkHPV4CKCC_cjs=require('./chunk-HPV4CKCC.cjs');require('./chunk-3MG7VIPL.cjs'),require('./chunk-Y7O4D3BJ.cjs'),require('./chunk-72J5V7SN.cjs'),require('./chunk-YBQOQTVL.cjs'),require('./chunk-S3DFU33X.cjs'),require('./chunk-J4LSAHCY.cjs'),require('./chunk-EZKR44MA.cjs');var chunk6SYU4MH7_cjs=require('./chunk-6SYU4MH7.cjs');var r={DEFINE_FUNCTION_INVALID_NAME:"DEFINE_FUNCTION_INVALID_NAME",DEFINE_FUNCTION_INVALID_SPEC:"DEFINE_FUNCTION_INVALID_SPEC",DEFINE_FUNCTION_ARITY_MISMATCH:"DEFINE_FUNCTION_ARITY_MISMATCH",DEFINE_FUNCTION_ARGUMENT_TYPE:"DEFINE_FUNCTION_ARGUMENT_TYPE",DEFINE_FUNCTION_RETURN_TYPE:"DEFINE_FUNCTION_RETURN_TYPE"},O=/^[a-z_][a-z0-9_]*$/i,N=new Set(["number","string","boolean"]);function u(e){return e===1?"1 argument":`${e} arguments`}function d(e){switch(e.type){case 0:case 1:return "a number";case 3:return "a string";case 10:return "a boolean";case 2:return "a big integer";case 5:return "a percentage";case 6:return "a value with a unit";case 4:return "a date";case 7:return "a matrix";case 8:return "a range";case 9:return "a symbolic expression";default:return "an unsupported value"}}function k(e,n,t){switch(n.type){case "number":if(e.type===0||e.type===1)return e.toNumber();break;case "string":if(e.type===3)return e.value;break;case "boolean":if(e.type===10)return e.value;break}throw chunk6SYU4MH7_cjs.c.execution({code:r.DEFINE_FUNCTION_ARGUMENT_TYPE,message:`${t}() expects "${n.name}" to be a ${n.type}, but was given ${d(e)}`,expected:`a ${n.type}`,found:d(e),context:{functionName:t,argName:n.name,expectedType:n.type}})}function R(e,n,t){switch(n){case "number":if(typeof e=="number")return chunkS3SPDK6N_cjs.n(e);break;case "string":if(typeof e=="string")return chunkS3SPDK6N_cjs.t(e);break;case "boolean":if(typeof e=="boolean")return chunkS3SPDK6N_cjs.L(e);break}throw chunk6SYU4MH7_cjs.c.internal({code:r.DEFINE_FUNCTION_RETURN_TYPE,message:`${t}() is declared to return a ${n}, but its implementation returned ${typeof e}`,expected:`a ${n}`,found:typeof e,context:{functionName:t,expectedType:n}})}var p=class{constructor(n){this.fnName=n;this.category="Function";}parse(n,t,a){n.consume("LPAREN");let i=0;if(n.peek()?.type!=="RPAREN")for(n.parseExpression(chunkK3PZ66XR_cjs.a.Lowest,a),i++;n.match("COMMA");)n.parseExpression(chunkK3PZ66XR_cjs.a.Lowest,a),i++;n.consume("RPAREN"),a.emitPluginCall(this.fnName,i);}};function D(e){let n=e.args.length;return t=>{if(t.length!==n)throw chunk6SYU4MH7_cjs.c.execution({code:r.DEFINE_FUNCTION_ARITY_MISMATCH,message:`${e.name}() takes ${u(n)}, but was given ${t.length===0?"none":u(t.length)}`,expected:u(n),found:t.length===0?"none":u(t.length),context:{functionName:e.name,expected:n,actual:t.length}});let a=new Array(n);for(let s=0;s<n;s++)a[s]=k(t[s],e.args[s],e.name);let i=e.call(...a);return R(i,e.returns,e.name)}}function h(e){if(typeof e?.name!="string"||!O.test(e.name))throw chunk6SYU4MH7_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_NAME,message:`defineFunction: name must be a single identifier, got ${JSON.stringify(e?.name)}`,suggestion:'e.g. "vat" or "net_price"',context:{name:e?.name}});if(!Array.isArray(e.args))throw chunk6SYU4MH7_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" args must be an array`,context:{name:e.name}});for(let n of e.args){if(typeof n?.name!="string"||n.name.length===0)throw chunk6SYU4MH7_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" has an argument with no name`,context:{name:e.name}});if(!N.has(n.type))throw chunk6SYU4MH7_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" argument "${n.name}" has unsupported type ${JSON.stringify(n.type)}`,suggestion:"supported argument types are number, string, boolean",context:{name:e.name,argName:n.name,type:n.type}})}if(!N.has(e.returns))throw chunk6SYU4MH7_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" has unsupported return type ${JSON.stringify(e.returns)}`,suggestion:"supported return types are number, string, boolean",context:{name:e.name,returns:e.returns}});if(typeof e.call!="function")throw chunk6SYU4MH7_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" is missing a call implementation`,context:{name:e.name}})}function w(e){h(e);let n=e.name,t=`DEFINE_FN_${n.toUpperCase()}`;return {name:`solve-fn-${n}`,lexerVocabulary:{keywords:{[n.toLowerCase()]:t}},prefixParselets:{[t]:new p(n)},pluginFunctions:{[n]:D(e)}}}function U(e={}){let{extraPackages:n=[],...t}=e;return new chunk4M3FZRGL_cjs.o({...t,packages:n.length>0?[...chunk7CRVRPV7_cjs.z,...n]:chunk7CRVRPV7_cjs.z})}Object.defineProperty(exports,"ExpressionEngine",{enumerable:true,get:function(){return chunk4M3FZRGL_cjs.o}});Object.defineProperty(exports,"SNAPSHOT_FORMAT",{enumerable:true,get:function(){return chunk4M3FZRGL_cjs.d}});Object.defineProperty(exports,"SNAPSHOT_VERSION",{enumerable:true,get:function(){return chunk4M3FZRGL_cjs.e}});Object.defineProperty(exports,"SnapshotErrorCodes",{enumerable:true,get:function(){return chunk4M3FZRGL_cjs.f}});Object.defineProperty(exports,"assertEngineVersionCompatible",{enumerable:true,get:function(){return chunk4M3FZRGL_cjs.c}});Object.defineProperty(exports,"checkEngineVersionCompatibility",{enumerable:true,get:function(){return chunk4M3FZRGL_cjs.b}});Object.defineProperty(exports,"checkPackageCompatibility",{enumerable:true,get:function(){return chunk4M3FZRGL_cjs.a}});Object.defineProperty(exports,"setEngineWorkerFactory",{enumerable:true,get:function(){return chunk4M3FZRGL_cjs.g}});Object.defineProperty(exports,"formatValue",{enumerable:true,get:function(){return chunkQOOTRUY7_cjs.c}});Object.defineProperty(exports,"dateCalendarInZone",{enumerable:true,get:function(){return chunkEQNKDTMX_cjs.d}});Object.defineProperty(exports,"Value",{enumerable:true,get:function(){return chunkS3SPDK6N_cjs.m}});Object.defineProperty(exports,"ValueType",{enumerable:true,get:function(){return chunkS3SPDK6N_cjs.g}});Object.defineProperty(exports,"ENGINE_VERSION",{enumerable:true,get:function(){return chunkHPV4CKCC_cjs.a}});exports.DefineFunctionErrorCodes=r;exports.createEngine=U;exports.defineFunction=w;//# sourceMappingURL=index.cjs.map
2
2
  //# sourceMappingURL=index.cjs.map