@divmain/jdm-asm 0.2.0 → 0.2.3

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 (395) hide show
  1. package/dist/index.js +2227 -29
  2. package/dist/index.js.map +1 -1
  3. package/package.json +8 -2
  4. package/.github/workflows/ci.yml +0 -53
  5. package/.oxfmtrc.json +0 -16
  6. package/.oxlintrc.json +0 -183
  7. package/AGENTS.md +0 -81
  8. package/asconfig.json +0 -23
  9. package/benchmarks/fixtures.ts +0 -111
  10. package/benchmarks/input-fixtures.ts +0 -80
  11. package/benchmarks/run.ts +0 -913
  12. package/benchmarks/worker-pool.ts +0 -223
  13. package/benchmarks/worker.ts +0 -374
  14. package/scripts/run-all-tests.ts +0 -220
  15. package/src/compiler/EXPRESSION_SUBSETS.md +0 -228
  16. package/src/compiler/asc-compiler.ts +0 -315
  17. package/src/compiler/ast-types.ts +0 -215
  18. package/src/compiler/build.ts +0 -56
  19. package/src/compiler/cache.ts +0 -414
  20. package/src/compiler/code-generators.ts +0 -211
  21. package/src/compiler/codegen/index.ts +0 -15
  22. package/src/compiler/codegen/js-marshal.ts +0 -999
  23. package/src/compiler/codegen/js-validation.ts +0 -243
  24. package/src/compiler/codegen.ts +0 -19
  25. package/src/compiler/compile-time-validation.ts +0 -507
  26. package/src/compiler/cst-visitor.ts +0 -434
  27. package/src/compiler/errors.ts +0 -227
  28. package/src/compiler/expression-parser.ts +0 -536
  29. package/src/compiler/graph.ts +0 -197
  30. package/src/compiler/index.ts +0 -199
  31. package/src/compiler/input-validation.ts +0 -33
  32. package/src/compiler/marshal-gen.ts +0 -21
  33. package/src/compiler/nodes/context-resolvers.ts +0 -197
  34. package/src/compiler/nodes/decision-table.ts +0 -507
  35. package/src/compiler/nodes/decision.ts +0 -292
  36. package/src/compiler/nodes/expression-compiler.ts +0 -526
  37. package/src/compiler/nodes/expression.ts +0 -425
  38. package/src/compiler/nodes/function.ts +0 -316
  39. package/src/compiler/nodes/input.ts +0 -60
  40. package/src/compiler/nodes/switch.ts +0 -547
  41. package/src/compiler/optimizer.ts +0 -948
  42. package/src/compiler/orchestrator.ts +0 -352
  43. package/src/compiler/parser.ts +0 -115
  44. package/src/compiler/result-selection.ts +0 -161
  45. package/src/compiler/runtime/index.ts +0 -26
  46. package/src/compiler/runtime-codegen.ts +0 -211
  47. package/src/compiler/runtime-validation-codegen.ts +0 -294
  48. package/src/compiler/runtime.ts +0 -452
  49. package/src/compiler/schema.ts +0 -245
  50. package/src/compiler/switch-branch-detection.ts +0 -92
  51. package/src/compiler/types.ts +0 -136
  52. package/src/compiler/unary-ast-transforms.ts +0 -148
  53. package/src/compiler/unary-parser.ts +0 -301
  54. package/src/compiler/unary-transform.ts +0 -161
  55. package/src/compiler/utils.ts +0 -27
  56. package/src/compiler/virtual-fs.ts +0 -90
  57. package/src/compiler/wasm-instantiate.ts +0 -127
  58. package/src/index.ts +0 -1
  59. package/src/runtime/arrays.ts +0 -579
  60. package/src/runtime/context.ts +0 -189
  61. package/src/runtime/expressions.ts +0 -1811
  62. package/src/runtime/index.ts +0 -8
  63. package/src/runtime/memory.ts +0 -607
  64. package/src/runtime/strings.ts +0 -260
  65. package/src/runtime/tables.ts +0 -96
  66. package/src/runtime/tsconfig.json +0 -4
  67. package/src/runtime/values.ts +0 -209
  68. package/test-data/README.md +0 -83
  69. package/test-data/decision-tables/basic/8k.json +0 -87992
  70. package/test-data/decision-tables/basic/affiliate-commission-calculator.json +0 -228
  71. package/test-data/decision-tables/basic/airline-loyalty-points-calculations.json +0 -285
  72. package/test-data/decision-tables/basic/airline-upgrade-eligibility.json +0 -466
  73. package/test-data/decision-tables/basic/auto-insurance-premium-calculator.json +0 -412
  74. package/test-data/decision-tables/basic/booking-personalization-system.json +0 -553
  75. package/test-data/decision-tables/basic/care-team-assignment-system.json +0 -585
  76. package/test-data/decision-tables/basic/claim-validation-system.json +0 -307
  77. package/test-data/decision-tables/basic/clinical-lab-result-interpreter.json +0 -433
  78. package/test-data/decision-tables/basic/clinical-treatment-protocol.json +0 -474
  79. package/test-data/decision-tables/basic/credit-limit-adjustment.json +0 -479
  80. package/test-data/decision-tables/basic/customer-eligibility-engine.json +0 -551
  81. package/test-data/decision-tables/basic/customer-lifetime-value.json +0 -200
  82. package/test-data/decision-tables/basic/customer-onboarding-kyc-verification.json +0 -611
  83. package/test-data/decision-tables/basic/customer-service-escalation.json +0 -191
  84. package/test-data/decision-tables/basic/decision-table-discounts.json +0 -168
  85. package/test-data/decision-tables/basic/decision-table-shipping.json +0 -398
  86. package/test-data/decision-tables/basic/delivery-route-optimizer.json +0 -271
  87. package/test-data/decision-tables/basic/device-compatibility-checker.json +0 -303
  88. package/test-data/decision-tables/basic/disaster-relief-fund-allocation.json +0 -296
  89. package/test-data/decision-tables/basic/dynamic-fx-rate-pricing-system.json +0 -237
  90. package/test-data/decision-tables/basic/dynamic-marketplace-comission-calculator.json +0 -242
  91. package/test-data/decision-tables/basic/dynamic-shipping-cost-calculator.json +0 -378
  92. package/test-data/decision-tables/basic/dynamic-tarrif-engine.json +0 -289
  93. package/test-data/decision-tables/basic/dynamic-ticket-pricing.json +0 -325
  94. package/test-data/decision-tables/basic/empty-column-with-space.json +0 -100
  95. package/test-data/decision-tables/basic/empty-column-without-space.json +0 -100
  96. package/test-data/decision-tables/basic/environment-compliance-assessment.json +0 -386
  97. package/test-data/decision-tables/basic/expression-table-map.json +0 -313
  98. package/test-data/decision-tables/basic/flash-sale-eligibility.json +0 -366
  99. package/test-data/decision-tables/basic/flight-dispatch-decision-system.json +0 -455
  100. package/test-data/decision-tables/basic/flight-rebooking-fee-calculator.json +0 -406
  101. package/test-data/decision-tables/basic/government-assistance.json +0 -299
  102. package/test-data/decision-tables/basic/grant-funding-distribution.json +0 -307
  103. package/test-data/decision-tables/basic/hazardous-materials-management-system.json +0 -414
  104. package/test-data/decision-tables/basic/immigration-eligibility-evaluator.json +0 -765
  105. package/test-data/decision-tables/basic/import-duties-calculator.json +0 -318
  106. package/test-data/decision-tables/basic/insurance-agent-commission.json +0 -228
  107. package/test-data/decision-tables/basic/insurance-coverage-calculator.json +0 -362
  108. package/test-data/decision-tables/basic/insurance-underwriting-risk.json +0 -321
  109. package/test-data/decision-tables/basic/international-roaming-policy-manager.json +0 -199
  110. package/test-data/decision-tables/basic/legacy-plan-management.json +0 -434
  111. package/test-data/decision-tables/basic/marketplace-listing-verification-system.json +0 -334
  112. package/test-data/decision-tables/basic/medication-dosage-calculator.json +0 -318
  113. package/test-data/decision-tables/basic/merch-bags.json +0 -171
  114. package/test-data/decision-tables/basic/municipal-permit-evaluation-system.json +0 -364
  115. package/test-data/decision-tables/basic/mvno-partner-enablement.json +0 -313
  116. package/test-data/decision-tables/basic/partner-revenue-sharing.json +0 -244
  117. package/test-data/decision-tables/basic/payment-routing-and-fee-calculator.json +0 -475
  118. package/test-data/decision-tables/basic/policy-discount-calculator.json +0 -307
  119. package/test-data/decision-tables/basic/policy-eligibility-analyzer.json +0 -299
  120. package/test-data/decision-tables/basic/product-listing-scoring.json +0 -358
  121. package/test-data/decision-tables/basic/realtime-fraud-detection.json +0 -235
  122. package/test-data/decision-tables/basic/regional-compliance-manager.json +0 -278
  123. package/test-data/decision-tables/basic/returns-and-refund-policy.json +0 -366
  124. package/test-data/decision-tables/basic/returns-processing-system.json +0 -448
  125. package/test-data/decision-tables/basic/school-district-resource-allocation.json +0 -282
  126. package/test-data/decision-tables/basic/seat-map-optimization.json +0 -325
  127. package/test-data/decision-tables/basic/seller-fee-calculator.json +0 -307
  128. package/test-data/decision-tables/basic/service-level-agreement-enforcement.json +0 -575
  129. package/test-data/decision-tables/basic/smart-financial-product-matcher.json +0 -249
  130. package/test-data/decision-tables/basic/supply-chain-risk.json +0 -316
  131. package/test-data/decision-tables/basic/table-loop.json +0 -93
  132. package/test-data/decision-tables/basic/table.json +0 -76
  133. package/test-data/decision-tables/basic/traffic-violation-penalty-calculator.json +0 -436
  134. package/test-data/decision-tables/basic/transaction-compliance-classifier.json +0 -525
  135. package/test-data/decision-tables/basic/vehicle-claims-resolution.json +0 -310
  136. package/test-data/decision-tables/basic/warehouse-storage-location.json +0 -345
  137. package/test-data/decision-tables/hit-policy-collect/collect-multiple-matches.json +0 -127
  138. package/test-data/decision-tables/hit-policy-collect/collect-no-match.json +0 -95
  139. package/test-data/decision-tables/hit-policy-first/first-match.json +0 -103
  140. package/test-data/decision-tables/hit-policy-first/no-match.json +0 -95
  141. package/test-data/decision-tables/hit-policy-output-order/output-order-respected.json +0 -94
  142. package/test-data/decision-tables/hit-policy-output-order/string-output-order.json +0 -94
  143. package/test-data/decision-tables/hit-policy-priority/priority-respected.json +0 -86
  144. package/test-data/decision-tables/hit-policy-rule-order/rule-order-respected.json +0 -94
  145. package/test-data/decision-tables/hit-policy-unique/all-match-error.json +0 -89
  146. package/test-data/decision-tables/hit-policy-unique/multiple-match-error.json +0 -89
  147. package/test-data/decision-tables/hit-policy-unique/no-match.json +0 -88
  148. package/test-data/decision-tables/hit-policy-unique/unique-match.json +0 -99
  149. package/test-data/expressions/arithmetic/error-cyclic.json +0 -114
  150. package/test-data/expressions/arithmetic/error-missing-input.json +0 -54
  151. package/test-data/expressions/arithmetic/error-missing-output.json +0 -54
  152. package/test-data/expressions/arithmetic/expression-default.json +0 -93
  153. package/test-data/expressions/arithmetic/expression-fields.json +0 -94
  154. package/test-data/expressions/arithmetic/expression-loop.json +0 -94
  155. package/test-data/expressions/arithmetic/expression-passthrough.json +0 -108
  156. package/test-data/expressions/arithmetic/expression.json +0 -69
  157. package/test-data/expressions/arithmetic/nested-request.json +0 -125
  158. package/test-data/expressions/arithmetic/number-function.json +0 -58
  159. package/test-data/expressions/arithmetic/test-number-functions.json +0 -68
  160. package/test-data/expressions/functions/all.json +0 -149
  161. package/test-data/expressions/functions/avg.json +0 -89
  162. package/test-data/expressions/functions/filter.json +0 -109
  163. package/test-data/expressions/functions/flat.json +0 -167
  164. package/test-data/expressions/functions/map-strings.json +0 -65
  165. package/test-data/expressions/functions/map.json +0 -73
  166. package/test-data/expressions/functions/reduce.json +0 -49
  167. package/test-data/expressions/functions/some.json +0 -175
  168. package/test-data/expressions/functions/sort-strings.json +0 -97
  169. package/test-data/expressions/functions/sort.json +0 -97
  170. package/test-data/expressions/logical/logical-and.json +0 -116
  171. package/test-data/expressions/logical/logical-complex.json +0 -260
  172. package/test-data/expressions/logical/logical-not.json +0 -111
  173. package/test-data/expressions/logical/logical-or.json +0 -123
  174. package/test-data/expressions/string/string-comparison.json +0 -128
  175. package/test-data/expressions/string/string-concat.json +0 -106
  176. package/test-data/expressions/string/string-contains.json +0 -125
  177. package/test-data/expressions/string/string-endsWith.json +0 -113
  178. package/test-data/expressions/string/string-indexOf.json +0 -131
  179. package/test-data/expressions/string/string-join.json +0 -92
  180. package/test-data/expressions/string/string-lower.json +0 -94
  181. package/test-data/expressions/string/string-replace.json +0 -130
  182. package/test-data/expressions/string/string-split.json +0 -101
  183. package/test-data/expressions/string/string-startsWith.json +0 -113
  184. package/test-data/expressions/string/string-substring.json +0 -138
  185. package/test-data/expressions/string/string-trim.json +0 -100
  186. package/test-data/expressions/string/string-upper.json +0 -94
  187. package/test-data/other/custom.json +0 -51
  188. package/test-data/other/customer-input-schema.json +0 -34
  189. package/test-data/other/customer-output-schema.json +0 -34
  190. package/test-data/other/passthrough.json +0 -31
  191. package/test-data/sub-decisions/basic/$nodes-child.json +0 -31
  192. package/test-data/sub-decisions/basic/$nodes-parent.json +0 -49
  193. package/test-data/sub-decisions/basic/recursive-table1.json +0 -49
  194. package/test-data/sub-decisions/basic/recursive-table2.json +0 -49
  195. package/test-data/sub-decisions/complex-multi/approval-decision.json +0 -31
  196. package/test-data/sub-decisions/complex-multi/complex-dag.json +0 -175
  197. package/test-data/sub-decisions/complex-multi/credit-check.json +0 -31
  198. package/test-data/sub-decisions/complex-multi/customer-segmentation.json +0 -31
  199. package/test-data/sub-decisions/complex-multi/discount-eligibility.json +0 -31
  200. package/test-data/sub-decisions/complex-multi/eligibility-check.json +0 -31
  201. package/test-data/sub-decisions/complex-multi/final-offer.json +0 -31
  202. package/test-data/sub-decisions/complex-multi/income-verification.json +0 -31
  203. package/test-data/sub-decisions/complex-multi/linear-chain.json +0 -121
  204. package/test-data/sub-decisions/complex-multi/pricing-calculation.json +0 -31
  205. package/test-data/sub-decisions/complex-multi/product-eligibility.json +0 -31
  206. package/test-data/sub-decisions/complex-multi/risk-assessment.json +0 -31
  207. package/test-data/sub-decisions/complex-multi/shared-validation.json +0 -31
  208. package/test-data/sub-decisions/complex-multi/validation.json +0 -31
  209. package/test-data/sub-decisions/diamond/decision-a.json +0 -31
  210. package/test-data/sub-decisions/diamond/decision-b.json +0 -31
  211. package/test-data/sub-decisions/diamond/decision-c.json +0 -31
  212. package/test-data/sub-decisions/diamond/decision-shared.json +0 -31
  213. package/test-data/sub-decisions/diamond/diamond-pattern.json +0 -109
  214. package/test-data/sub-decisions/error-propagation/parent-calls-error.json +0 -44
  215. package/test-data/sub-decisions/error-propagation/sub-decision-with-error.json +0 -60
  216. package/test-data/switch-nodes/basic/account-dormancy-management.json +0 -245
  217. package/test-data/switch-nodes/basic/application-risk-assessment.json +0 -474
  218. package/test-data/switch-nodes/basic/cellular-data-rollover-system.json +0 -281
  219. package/test-data/switch-nodes/basic/clinical-pathway-selection.json +0 -454
  220. package/test-data/switch-nodes/basic/insurance-prior-authorization.json +0 -467
  221. package/test-data/switch-nodes/basic/last-mile-delivery-assignment.json +0 -373
  222. package/test-data/switch-nodes/basic/loan-approval.json +0 -469
  223. package/test-data/switch-nodes/basic/multi-switch.json +0 -498
  224. package/test-data/switch-nodes/basic/online-checkin-eligibility.json +0 -285
  225. package/test-data/switch-nodes/basic/order-consolidation-system.json +0 -493
  226. package/test-data/switch-nodes/basic/seller-approval-workflow.json +0 -383
  227. package/test-data/switch-nodes/basic/set-fee.json +0 -243
  228. package/test-data/switch-nodes/basic/shipping-carrier-selector.json +0 -379
  229. package/test-data/switch-nodes/basic/switch-node.json +0 -167
  230. package/test-data/switch-nodes/basic/switch-performance-2.json +0 -1307
  231. package/test-data/switch-nodes/basic/switch-performance.json +0 -691
  232. package/test-data/switch-nodes/basic/tax-exemption.json +0 -295
  233. package/test-data/switch-nodes/basic/warehouse-cross-docking.json +0 -313
  234. package/test-data/switch-nodes/default-cases/switch-with-default.json +0 -134
  235. package/test-data/zen-reference/$nodes-child.json +0 -69
  236. package/test-data/zen-reference/$nodes-parent.json +0 -34
  237. package/test-data/zen-reference/8k.json +0 -87992
  238. package/test-data/zen-reference/credit-analysis.json +0 -324
  239. package/test-data/zen-reference/custom.json +0 -51
  240. package/test-data/zen-reference/customer-input-schema.json +0 -34
  241. package/test-data/zen-reference/customer-output-schema.json +0 -34
  242. package/test-data/zen-reference/error-cyclic.json +0 -114
  243. package/test-data/zen-reference/error-missing-input.json +0 -54
  244. package/test-data/zen-reference/error-missing-output.json +0 -54
  245. package/test-data/zen-reference/expression.json +0 -69
  246. package/test-data/zen-reference/function-v2.json +0 -48
  247. package/test-data/zen-reference/function.json +0 -46
  248. package/test-data/zen-reference/graphs/account-dormancy-management.json +0 -245
  249. package/test-data/zen-reference/graphs/affiliate-commission-calculator.json +0 -228
  250. package/test-data/zen-reference/graphs/airline-loyalty-points-calculations.json +0 -285
  251. package/test-data/zen-reference/graphs/airline-upgrade-eligibility.json +0 -466
  252. package/test-data/zen-reference/graphs/aml.json +0 -537
  253. package/test-data/zen-reference/graphs/application-risk-assessment.json +0 -474
  254. package/test-data/zen-reference/graphs/auto-insurance-premium-calculator.json +0 -412
  255. package/test-data/zen-reference/graphs/booking-personalization-system.json +0 -553
  256. package/test-data/zen-reference/graphs/care-team-assignment-system.json +0 -585
  257. package/test-data/zen-reference/graphs/cellular-data-rollover-system.json +0 -281
  258. package/test-data/zen-reference/graphs/claim-validation-system.json +0 -307
  259. package/test-data/zen-reference/graphs/clinical-lab-result-interpreter.json +0 -433
  260. package/test-data/zen-reference/graphs/clinical-pathway-selection.json +0 -454
  261. package/test-data/zen-reference/graphs/clinical-treatment-protocol.json +0 -474
  262. package/test-data/zen-reference/graphs/company-analysis.json +0 -390
  263. package/test-data/zen-reference/graphs/credit-limit-adjustment.json +0 -479
  264. package/test-data/zen-reference/graphs/customer-eligibility-engine.json +0 -551
  265. package/test-data/zen-reference/graphs/customer-lifetime-value.json +0 -200
  266. package/test-data/zen-reference/graphs/customer-onboarding-kyc-verification.json +0 -611
  267. package/test-data/zen-reference/graphs/customer-service-escalation.json +0 -191
  268. package/test-data/zen-reference/graphs/decision-table-discounts.json +0 -168
  269. package/test-data/zen-reference/graphs/decision-table-shipping.json +0 -398
  270. package/test-data/zen-reference/graphs/delivery-route-optimizer.json +0 -271
  271. package/test-data/zen-reference/graphs/device-compatibility-checker.json +0 -303
  272. package/test-data/zen-reference/graphs/disaster-relief-fund-allocation.json +0 -296
  273. package/test-data/zen-reference/graphs/dynamic-fx-rate-pricing-system.json +0 -237
  274. package/test-data/zen-reference/graphs/dynamic-marketplace-comission-calculator.json +0 -242
  275. package/test-data/zen-reference/graphs/dynamic-shipping-cost-calculator.json +0 -378
  276. package/test-data/zen-reference/graphs/dynamic-tarrif-engine.json +0 -289
  277. package/test-data/zen-reference/graphs/dynamic-ticket-pricing.json +0 -325
  278. package/test-data/zen-reference/graphs/empty-column-with-space.json +0 -100
  279. package/test-data/zen-reference/graphs/empty-column-without-space.json +0 -100
  280. package/test-data/zen-reference/graphs/environment-compliance-assessment.json +0 -386
  281. package/test-data/zen-reference/graphs/expression-default.json +0 -93
  282. package/test-data/zen-reference/graphs/expression-fields.json +0 -94
  283. package/test-data/zen-reference/graphs/expression-loop.json +0 -94
  284. package/test-data/zen-reference/graphs/expression-passthrough.json +0 -108
  285. package/test-data/zen-reference/graphs/expression-table-map.json +0 -313
  286. package/test-data/zen-reference/graphs/flash-sale-eligibility.json +0 -366
  287. package/test-data/zen-reference/graphs/flight-dispatch-decision-system.json +0 -455
  288. package/test-data/zen-reference/graphs/flight-rebooking-fee-calculator.json +0 -406
  289. package/test-data/zen-reference/graphs/government-assistance.json +0 -299
  290. package/test-data/zen-reference/graphs/grant-funding-distribution.json +0 -307
  291. package/test-data/zen-reference/graphs/hazardous-materials-management-system.json +0 -414
  292. package/test-data/zen-reference/graphs/immigration-eligibility-evaluator.json +0 -765
  293. package/test-data/zen-reference/graphs/import-duties-calculator.json +0 -318
  294. package/test-data/zen-reference/graphs/insurance-agent-commission.json +0 -228
  295. package/test-data/zen-reference/graphs/insurance-breakdown.json +0 -421
  296. package/test-data/zen-reference/graphs/insurance-coverage-calculator.json +0 -362
  297. package/test-data/zen-reference/graphs/insurance-prior-authorization.json +0 -467
  298. package/test-data/zen-reference/graphs/insurance-underwriting-risk.json +0 -321
  299. package/test-data/zen-reference/graphs/international-roaming-policy-manager.json +0 -199
  300. package/test-data/zen-reference/graphs/last-mile-delivery-assignment.json +0 -373
  301. package/test-data/zen-reference/graphs/legacy-plan-management.json +0 -434
  302. package/test-data/zen-reference/graphs/loan-approval.json +0 -469
  303. package/test-data/zen-reference/graphs/marketplace-listing-verification-system.json +0 -334
  304. package/test-data/zen-reference/graphs/medication-dosage-calculator.json +0 -318
  305. package/test-data/zen-reference/graphs/merch-bags.json +0 -171
  306. package/test-data/zen-reference/graphs/multi-switch.json +0 -498
  307. package/test-data/zen-reference/graphs/municipal-permit-evaluation-system.json +0 -364
  308. package/test-data/zen-reference/graphs/mvno-partner-enablement.json +0 -313
  309. package/test-data/zen-reference/graphs/nested-request.json +0 -125
  310. package/test-data/zen-reference/graphs/online-checkin-eligibility.json +0 -285
  311. package/test-data/zen-reference/graphs/order-consolidation-system.json +0 -493
  312. package/test-data/zen-reference/graphs/partner-revenue-sharing.json +0 -244
  313. package/test-data/zen-reference/graphs/payment-routing-and-fee-calculator.json +0 -475
  314. package/test-data/zen-reference/graphs/policy-discount-calculator.json +0 -307
  315. package/test-data/zen-reference/graphs/policy-eligibility-analyzer.json +0 -299
  316. package/test-data/zen-reference/graphs/product-listing-scoring.json +0 -358
  317. package/test-data/zen-reference/graphs/realtime-fraud-detection.json +0 -235
  318. package/test-data/zen-reference/graphs/regional-compliance-manager.json +0 -278
  319. package/test-data/zen-reference/graphs/returns-and-refund-policy.json +0 -366
  320. package/test-data/zen-reference/graphs/returns-processing-system.json +0 -448
  321. package/test-data/zen-reference/graphs/school-district-resource-allocation.json +0 -282
  322. package/test-data/zen-reference/graphs/seat-map-optimization.json +0 -325
  323. package/test-data/zen-reference/graphs/seller-approval-workflow.json +0 -383
  324. package/test-data/zen-reference/graphs/seller-fee-calculator.json +0 -307
  325. package/test-data/zen-reference/graphs/service-level-agreement-enforcement.json +0 -575
  326. package/test-data/zen-reference/graphs/set-fee.json +0 -243
  327. package/test-data/zen-reference/graphs/shipping-carrier-selector.json +0 -379
  328. package/test-data/zen-reference/graphs/smart-financial-product-matcher.json +0 -249
  329. package/test-data/zen-reference/graphs/supply-chain-risk.json +0 -316
  330. package/test-data/zen-reference/graphs/table-loop.json +0 -93
  331. package/test-data/zen-reference/graphs/tax-exemption.json +0 -295
  332. package/test-data/zen-reference/graphs/traffic-violation-penalty-calculator.json +0 -436
  333. package/test-data/zen-reference/graphs/transaction-compliance-classifier.json +0 -525
  334. package/test-data/zen-reference/graphs/vehicle-claims-resolution.json +0 -310
  335. package/test-data/zen-reference/graphs/warehouse-cross-docking.json +0 -313
  336. package/test-data/zen-reference/graphs/warehouse-storage-location.json +0 -345
  337. package/test-data/zen-reference/http-function.json +0 -34
  338. package/test-data/zen-reference/infinite-function.json +0 -46
  339. package/test-data/zen-reference/js/imports.js +0 -25
  340. package/test-data/zen-reference/passthrough.json +0 -31
  341. package/test-data/zen-reference/recursive-table1.json +0 -49
  342. package/test-data/zen-reference/recursive-table2.json +0 -49
  343. package/test-data/zen-reference/sleep-function.json +0 -34
  344. package/test-data/zen-reference/switch-node.json +0 -167
  345. package/test-data/zen-reference/switch-performance-2.json +0 -1307
  346. package/test-data/zen-reference/switch-performance.json +0 -691
  347. package/test-data/zen-reference/table.json +0 -76
  348. package/tests/helpers/index.ts +0 -73
  349. package/tests/helpers/mock-context.ts +0 -231
  350. package/tests/helpers/round-trip.ts +0 -398
  351. package/tests/helpers/test-harness-comparison.ts +0 -325
  352. package/tests/helpers/test-harness-wasm.ts +0 -710
  353. package/tests/helpers/test-harness.ts +0 -28
  354. package/tests/helpers/wasm-test.ts +0 -659
  355. package/tests/integration/compilation-errors.test.ts +0 -864
  356. package/tests/integration/decision-tables.test.ts +0 -531
  357. package/tests/integration/edge-cases.test.ts +0 -787
  358. package/tests/integration/expressions.test.ts +0 -513
  359. package/tests/integration/function-node-integration.test.ts +0 -182
  360. package/tests/integration/sub-decisions.test.ts +0 -108
  361. package/tests/integration/switch-nodes.test.ts +0 -399
  362. package/tests/integration/unary-or-matching.test.ts +0 -53
  363. package/tests/integration/wasm-data-types.test.ts +0 -398
  364. package/tests/integration/wasm-errors.test.ts +0 -199
  365. package/tests/integration/wasm-execution.test.ts +0 -348
  366. package/tests/integration/wasm-memory.test.ts +0 -228
  367. package/tests/scripts/analyze-coverage.ts +0 -166
  368. package/tests/scripts/categorize-tests.ts +0 -396
  369. package/tests/scripts/coverage-analysis.ts +0 -836
  370. package/tests/unit/compiler/cache.test.ts +0 -238
  371. package/tests/unit/compiler/errors.test.ts +0 -316
  372. package/tests/unit/compiler/graph-scalability.test.ts +0 -510
  373. package/tests/unit/compiler/graph.test.ts +0 -878
  374. package/tests/unit/compiler/input-validation.test.ts +0 -447
  375. package/tests/unit/compiler/logical-and-parser.test.ts +0 -143
  376. package/tests/unit/compiler/logical-not-parser.test.ts +0 -107
  377. package/tests/unit/compiler/logical-or-parser.test.ts +0 -236
  378. package/tests/unit/compiler/marshal-gen/marshal-gen.test.ts +0 -97
  379. package/tests/unit/compiler/nodes/decision-table.test.ts +0 -103
  380. package/tests/unit/compiler/nodes/decision.test.ts +0 -182
  381. package/tests/unit/compiler/nodes/function-compile.test.ts +0 -204
  382. package/tests/unit/compiler/nodes/function.test.ts +0 -176
  383. package/tests/unit/compiler/nodes/input.test.ts +0 -30
  384. package/tests/unit/compiler/nodes/switch.test.ts +0 -127
  385. package/tests/unit/compiler/optimizer-cache.test.ts +0 -327
  386. package/tests/unit/compiler/optimizer-implementation.test.ts +0 -625
  387. package/tests/unit/compiler/parser.test.ts +0 -508
  388. package/tests/unit/compiler/runtime-error-cleanup.test.ts +0 -426
  389. package/tests/unit/compiler/runtime-validation.test.ts +0 -303
  390. package/tests/unit/compiler/runtime.test.ts +0 -221
  391. package/tests/unit/compiler/schema/schema.test.ts +0 -248
  392. package/tests/unit/compiler/unary-ast-transforms.test.ts +0 -245
  393. package/tsconfig.json +0 -27
  394. package/tsup.config.ts +0 -11
  395. package/vitest.config.ts +0 -12
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/compiler/errors.ts","../node_modules/acorn/dist/acorn.mjs","../src/compiler/utils.ts","../src/compiler/nodes/function.ts","../src/compiler/parser.ts","../src/compiler/graph.ts","../src/compiler/nodes/input.ts","../src/compiler/nodes/context-resolvers.ts","../src/compiler/nodes/expression-compiler.ts","../src/compiler/nodes/expression.ts","../src/compiler/unary-transform.ts","../src/compiler/nodes/decision-table.ts","../src/compiler/code-generators.ts","../src/compiler/nodes/switch.ts","../src/compiler/nodes/decision.ts","../src/compiler/compile-time-validation.ts","../src/compiler/switch-branch-detection.ts","../src/compiler/result-selection.ts","../src/compiler/orchestrator.ts","../src/compiler/cache.ts","../src/compiler/runtime/index.ts","../src/compiler/asc-compiler.ts","../src/compiler/virtual-fs.ts","../src/compiler/codegen/js-marshal.ts","../src/compiler/codegen/js-validation.ts","../src/compiler/runtime-codegen.ts","../src/compiler/runtime.ts","../src/compiler/build.ts","../src/compiler/schema.ts","../src/compiler/index.ts","../src/compiler/ast-types.ts","../src/compiler/expression-parser.ts","../src/compiler/cst-visitor.ts","../src/compiler/unary-ast-transforms.ts","../src/compiler/unary-parser.ts","../src/compiler/optimizer.ts","../src/compiler/runtime-validation-codegen.ts"],"sourcesContent":["/**\n * Error handling infrastructure for the JDM compiler.\n *\n * This module provides:\n * - CompilationError: The main error class for all compilation failures\n * - ErrorCode: A comprehensive enumeration of all possible error types\n * - SourceLocation: Detailed location information for error reporting\n * - ErrorCollector: Aggregates non-fatal expression errors for batch reporting\n */\n\n/**\n * Detailed source location for error reporting.\n */\nexport interface SourceLocation {\n /** ID of the node where the error occurred */\n nodeId?: string;\n /** Name of the node where the error occurred */\n nodeName?: string;\n /** Field name within the node */\n field?: string;\n /** Line number in source JDM */\n line?: number;\n /** Column number in source JDM */\n column?: number;\n}\n\n/**\n * Enumeration of all possible compilation error codes.\n *\n * Errors are categorized into three types:\n * - Structural errors: Critical JDM structure issues that fail compilation immediately\n * - Feature errors: Unsupported features that cannot be handled\n * - Expression errors: Issues in expression parsing that can be collected and reported together\n */\nexport enum ErrorCode {\n // Structural errors (fail immediately)\n INVALID_JSON = 'INVALID_JSON',\n INVALID_NODE_STRUCTURE = 'INVALID_NODE_STRUCTURE',\n MISSING_INPUT_NODE = 'MISSING_INPUT_NODE',\n MISSING_OUTPUT_NODE = 'MISSING_OUTPUT_NODE',\n MULTIPLE_INPUT_NODES = 'MULTIPLE_INPUT_NODES',\n CYCLE_DETECTED = 'CYCLE_DETECTED',\n INVALID_EDGE = 'INVALID_EDGE',\n\n // Feature errors (fail immediately)\n UNSUPPORTED_FUNCTION_NODE = 'UNSUPPORTED_FUNCTION_NODE',\n UNSUPPORTED_EXPRESSION = 'UNSUPPORTED_EXPRESSION',\n\n // Expression errors (collected, reported together)\n PARSE_ERROR = 'PARSE_ERROR',\n UNKNOWN_FUNCTION = 'UNKNOWN_FUNCTION',\n TYPE_MISMATCH = 'TYPE_MISMATCH',\n UNKNOWN_FIELD = 'UNKNOWN_FIELD',\n\n // Schema errors\n SCHEMA_MISMATCH = 'SCHEMA_MISMATCH',\n INVALID_SCHEMA = 'INVALID_SCHEMA',\n}\n\n/**\n * Custom error class for compilation failures.\n *\n * Provides structured error information including error code, source location,\n * and additional context for debugging.\n */\nexport class CompilationError extends Error {\n readonly name = 'CompilationError';\n\n constructor(\n message: string,\n public readonly code: ErrorCode,\n public readonly location?: SourceLocation,\n public readonly context?: Record<string, unknown>,\n ) {\n super(message);\n // Exclude the CompilationError constructor frame from the stack trace.\n // Without this, stack traces would include an unhelpful constructor frame,\n // making it harder to identify the actual error source in compiled code.\n // Only available on V8-based engines (Node.js, Chrome, Edge).\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, CompilationError);\n }\n }\n\n /**\n * Get a formatted error message with location information.\n */\n getFormattedMessage(): string {\n const parts: string[] = [];\n\n if (this.location) {\n const locParts: string[] = [];\n if (this.location.nodeName) {\n locParts.push(this.location.nodeName);\n }\n if (this.location.nodeId) {\n locParts.push(`(id: ${this.location.nodeId})`);\n }\n if (this.location.field) {\n locParts.push(`.${this.location.field}`);\n }\n // Combine line and column: @10:5\n if (this.location.line !== undefined && this.location.column !== undefined) {\n locParts.push(`@${this.location.line}:${this.location.column}`);\n } else if (this.location.line !== undefined) {\n locParts.push(`@${this.location.line}`);\n } else if (this.location.column !== undefined) {\n locParts.push(`:${this.location.column}`);\n }\n\n if (locParts.length > 0) {\n parts.push(`[${locParts.join(' ')}]`);\n }\n }\n\n parts.push(`[${this.code}]`);\n parts.push(this.message);\n\n return parts.join(' ');\n }\n}\n\n/**\n * Collector for non-fatal errors during expression parsing.\n *\n * This allows the parser to continue and collect multiple errors rather than\n * failing on the first one, providing a better user experience by reporting\n * all issues at once.\n *\n * @example\n * const collector = new ErrorCollector();\n * collector.add(new CompilationError('Undefined variable', ErrorCode.UNKNOWN_FIELD, { nodeName: 'AgeCheck' }));\n * collector.add(new CompilationError('Type mismatch', ErrorCode.TYPE_MISMATCH, { nodeName: 'AgeCheck' }));\n * collector.throwIfErrors(); // Throws with aggregated message\n */\nexport class ErrorCollector {\n private errors: CompilationError[] = [];\n\n /**\n * Add an error to the collector.\n */\n add(error: CompilationError): void {\n this.errors.push(error);\n }\n\n /**\n * Check if any errors have been collected.\n */\n hasErrors(): boolean {\n return this.errors.length > 0;\n }\n\n /**\n * Throw if there are any collected errors.\n *\n * Single errors throw directly to preserve original context and stack trace. Multiple\n * errors are aggregated into one with numbered list, so developers see all problems at\n * once instead of fixing issues one-by-one through repeated compile attempts.\n */\n throwIfErrors(): void {\n if (this.errors.length === 0) {\n return;\n }\n\n if (this.errors.length === 1) {\n throw this.errors[0];\n }\n\n const message =\n `${this.errors.length} compilation errors:\\n` +\n this.errors\n .map((e, i) => {\n const prefix = ` ${i + 1}. ${e.code}`;\n const formatted = e.getFormattedMessage();\n // getFormattedMessage() includes [CODE] prefix, but we already show the code in\n // our numbered list, so strip it to avoid \"1. CODE: [CODE] message\"\n const rest = formatted.replace(`[${e.code}]`, '').trim();\n return `${prefix}${rest ? ': ' + rest : ''}`;\n })\n .join('\\n');\n\n // Use the location from the first error as the aggregated error's location\n const firstErrorLocation = this.errors[0].location;\n throw new CompilationError(message, ErrorCode.PARSE_ERROR, firstErrorLocation);\n }\n}\n\n/**\n * Type guard to check if an error is a CompilationError.\n */\nexport function isCompilationError(error: unknown): error is CompilationError {\n return error instanceof CompilationError;\n}\n\n/**\n * Type guard to check if an error code is a structural error.\n */\nexport function isStructuralError(code: ErrorCode): boolean {\n return [\n ErrorCode.INVALID_JSON,\n ErrorCode.INVALID_NODE_STRUCTURE,\n ErrorCode.MISSING_INPUT_NODE,\n ErrorCode.MISSING_OUTPUT_NODE,\n ErrorCode.MULTIPLE_INPUT_NODES,\n ErrorCode.CYCLE_DETECTED,\n ErrorCode.INVALID_EDGE,\n ].includes(code);\n}\n\n/**\n * Type guard to check if an error code is a feature error.\n */\nexport function isFeatureError(code: ErrorCode): boolean {\n return [ErrorCode.UNSUPPORTED_FUNCTION_NODE, ErrorCode.UNSUPPORTED_EXPRESSION].includes(code);\n}\n\n/**\n * Type guard to check if an error code is an expression error.\n */\nexport function isExpressionError(code: ErrorCode): boolean {\n return [\n ErrorCode.PARSE_ERROR,\n ErrorCode.UNKNOWN_FUNCTION,\n ErrorCode.TYPE_MISMATCH,\n ErrorCode.UNKNOWN_FIELD,\n ].includes(code);\n}\n","// This file was generated. Do not modify manually!\nvar astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 80, 3, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 343, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 726, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];\n\n// This file was generated. Do not modify manually!\nvar astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 2, 60, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 42, 9, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 496, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 4191];\n\n// This file was generated. Do not modify manually!\nvar nonASCIIidentifierChars = \"\\u200c\\u200d\\xb7\\u0300-\\u036f\\u0387\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u064b-\\u0669\\u0670\\u06d6-\\u06dc\\u06df-\\u06e4\\u06e7\\u06e8\\u06ea-\\u06ed\\u06f0-\\u06f9\\u0711\\u0730-\\u074a\\u07a6-\\u07b0\\u07c0-\\u07c9\\u07eb-\\u07f3\\u07fd\\u0816-\\u0819\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0859-\\u085b\\u0897-\\u089f\\u08ca-\\u08e1\\u08e3-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09cb-\\u09cd\\u09d7\\u09e2\\u09e3\\u09e6-\\u09ef\\u09fe\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2\\u0ae3\\u0ae6-\\u0aef\\u0afa-\\u0aff\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b55-\\u0b57\\u0b62\\u0b63\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c00-\\u0c04\\u0c3c\\u0c3e-\\u0c44\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62\\u0c63\\u0c66-\\u0c6f\\u0c81-\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2\\u0ce3\\u0ce6-\\u0cef\\u0cf3\\u0d00-\\u0d03\\u0d3b\\u0d3c\\u0d3e-\\u0d44\\u0d46-\\u0d48\\u0d4a-\\u0d4d\\u0d57\\u0d62\\u0d63\\u0d66-\\u0d6f\\u0d81-\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0de6-\\u0def\\u0df2\\u0df3\\u0e31\\u0e34-\\u0e3a\\u0e47-\\u0e4e\\u0e50-\\u0e59\\u0eb1\\u0eb4-\\u0ebc\\u0ec8-\\u0ece\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f3e\\u0f3f\\u0f71-\\u0f84\\u0f86\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u102b-\\u103e\\u1040-\\u1049\\u1056-\\u1059\\u105e-\\u1060\\u1062-\\u1064\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u1369-\\u1371\\u1712-\\u1715\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17b4-\\u17d3\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u180f-\\u1819\\u18a9\\u1920-\\u192b\\u1930-\\u193b\\u1946-\\u194f\\u19d0-\\u19da\\u1a17-\\u1a1b\\u1a55-\\u1a5e\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1ab0-\\u1abd\\u1abf-\\u1ace\\u1b00-\\u1b04\\u1b34-\\u1b44\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1b80-\\u1b82\\u1ba1-\\u1bad\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c24-\\u1c37\\u1c40-\\u1c49\\u1c50-\\u1c59\\u1cd0-\\u1cd2\\u1cd4-\\u1ce8\\u1ced\\u1cf4\\u1cf7-\\u1cf9\\u1dc0-\\u1dff\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2cef-\\u2cf1\\u2d7f\\u2de0-\\u2dff\\u302a-\\u302f\\u3099\\u309a\\u30fb\\ua620-\\ua629\\ua66f\\ua674-\\ua67d\\ua69e\\ua69f\\ua6f0\\ua6f1\\ua802\\ua806\\ua80b\\ua823-\\ua827\\ua82c\\ua880\\ua881\\ua8b4-\\ua8c5\\ua8d0-\\ua8d9\\ua8e0-\\ua8f1\\ua8ff-\\ua909\\ua926-\\ua92d\\ua947-\\ua953\\ua980-\\ua983\\ua9b3-\\ua9c0\\ua9d0-\\ua9d9\\ua9e5\\ua9f0-\\ua9f9\\uaa29-\\uaa36\\uaa43\\uaa4c\\uaa4d\\uaa50-\\uaa59\\uaa7b-\\uaa7d\\uaab0\\uaab2-\\uaab4\\uaab7\\uaab8\\uaabe\\uaabf\\uaac1\\uaaeb-\\uaaef\\uaaf5\\uaaf6\\uabe3-\\uabea\\uabec\\uabed\\uabf0-\\uabf9\\ufb1e\\ufe00-\\ufe0f\\ufe20-\\ufe2f\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f\\uff65\";\n\n// This file was generated. Do not modify manually!\nvar nonASCIIidentifierStartChars = \"\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u037f\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u052f\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05d0-\\u05ea\\u05ef-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086a\\u0870-\\u0887\\u0889-\\u088e\\u08a0-\\u08c9\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098c\\u098f\\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82\\u0e84\\u0e86-\\u0e8a\\u0e8c-\\u0ea3\\u0ea5\\u0ea7-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f5\\u13f8-\\u13fd\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f8\\u1700-\\u1711\\u171f-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1878\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191e\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19b0-\\u19c9\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4c\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1c80-\\u1c8a\\u1c90-\\u1cba\\u1cbd-\\u1cbf\\u1ce9-\\u1cec\\u1cee-\\u1cf3\\u1cf5\\u1cf6\\u1cfa\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2118-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309b-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312f\\u3131-\\u318e\\u31a0-\\u31bf\\u31f0-\\u31ff\\u3400-\\u4dbf\\u4e00-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua69d\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua7cd\\ua7d0\\ua7d1\\ua7d3\\ua7d5-\\ua7dc\\ua7f2-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua8fd\\ua8fe\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\ua9e0-\\ua9e4\\ua9e6-\\ua9ef\\ua9fa-\\ua9fe\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa7e-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uab30-\\uab5a\\uab5c-\\uab69\\uab70-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc\";\n\n// These are a run-length and offset encoded representation of the\n// >0xffff code points that are a valid part of identifiers. The\n// offset starts at 0x10000, and each pair of numbers represents an\n// offset to the next range, and then a size of the range.\n\n// Reserved word lists for various dialects of the language\n\nvar reservedWords = {\n 3: \"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile\",\n 5: \"class enum extends super const export import\",\n 6: \"enum\",\n strict: \"implements interface let package private protected public static yield\",\n strictBind: \"eval arguments\"\n};\n\n// And the keywords\n\nvar ecma5AndLessKeywords = \"break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this\";\n\nvar keywords$1 = {\n 5: ecma5AndLessKeywords,\n \"5module\": ecma5AndLessKeywords + \" export import\",\n 6: ecma5AndLessKeywords + \" const class extends export import super\"\n};\n\nvar keywordRelationalOperator = /^in(stanceof)?$/;\n\n// ## Character categories\n\nvar nonASCIIidentifierStart = new RegExp(\"[\" + nonASCIIidentifierStartChars + \"]\");\nvar nonASCIIidentifier = new RegExp(\"[\" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + \"]\");\n\n// This has a complexity linear to the value of the code. The\n// assumption is that looking up astral identifier characters is\n// rare.\nfunction isInAstralSet(code, set) {\n var pos = 0x10000;\n for (var i = 0; i < set.length; i += 2) {\n pos += set[i];\n if (pos > code) { return false }\n pos += set[i + 1];\n if (pos >= code) { return true }\n }\n return false\n}\n\n// Test whether a given character code starts an identifier.\n\nfunction isIdentifierStart(code, astral) {\n if (code < 65) { return code === 36 }\n if (code < 91) { return true }\n if (code < 97) { return code === 95 }\n if (code < 123) { return true }\n if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)) }\n if (astral === false) { return false }\n return isInAstralSet(code, astralIdentifierStartCodes)\n}\n\n// Test whether a given character is part of an identifier.\n\nfunction isIdentifierChar(code, astral) {\n if (code < 48) { return code === 36 }\n if (code < 58) { return true }\n if (code < 65) { return false }\n if (code < 91) { return true }\n if (code < 97) { return code === 95 }\n if (code < 123) { return true }\n if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)) }\n if (astral === false) { return false }\n return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes)\n}\n\n// ## Token types\n\n// The assignment of fine-grained, information-carrying type objects\n// allows the tokenizer to store the information it has about a\n// token in a way that is very cheap for the parser to look up.\n\n// All token type variables start with an underscore, to make them\n// easy to recognize.\n\n// The `beforeExpr` property is used to disambiguate between regular\n// expressions and divisions. It is set on all token types that can\n// be followed by an expression (thus, a slash after them would be a\n// regular expression).\n//\n// The `startsExpr` property is used to check if the token ends a\n// `yield` expression. It is set on all token types that either can\n// directly start an expression (like a quotation mark) or can\n// continue an expression (like the body of a string).\n//\n// `isLoop` marks a keyword as starting a loop, which is important\n// to know when parsing a label, in order to allow or disallow\n// continue jumps to that label.\n\nvar TokenType = function TokenType(label, conf) {\n if ( conf === void 0 ) conf = {};\n\n this.label = label;\n this.keyword = conf.keyword;\n this.beforeExpr = !!conf.beforeExpr;\n this.startsExpr = !!conf.startsExpr;\n this.isLoop = !!conf.isLoop;\n this.isAssign = !!conf.isAssign;\n this.prefix = !!conf.prefix;\n this.postfix = !!conf.postfix;\n this.binop = conf.binop || null;\n this.updateContext = null;\n};\n\nfunction binop(name, prec) {\n return new TokenType(name, {beforeExpr: true, binop: prec})\n}\nvar beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true};\n\n// Map keyword names to token types.\n\nvar keywords = {};\n\n// Succinct definitions of keyword token types\nfunction kw(name, options) {\n if ( options === void 0 ) options = {};\n\n options.keyword = name;\n return keywords[name] = new TokenType(name, options)\n}\n\nvar types$1 = {\n num: new TokenType(\"num\", startsExpr),\n regexp: new TokenType(\"regexp\", startsExpr),\n string: new TokenType(\"string\", startsExpr),\n name: new TokenType(\"name\", startsExpr),\n privateId: new TokenType(\"privateId\", startsExpr),\n eof: new TokenType(\"eof\"),\n\n // Punctuation token types.\n bracketL: new TokenType(\"[\", {beforeExpr: true, startsExpr: true}),\n bracketR: new TokenType(\"]\"),\n braceL: new TokenType(\"{\", {beforeExpr: true, startsExpr: true}),\n braceR: new TokenType(\"}\"),\n parenL: new TokenType(\"(\", {beforeExpr: true, startsExpr: true}),\n parenR: new TokenType(\")\"),\n comma: new TokenType(\",\", beforeExpr),\n semi: new TokenType(\";\", beforeExpr),\n colon: new TokenType(\":\", beforeExpr),\n dot: new TokenType(\".\"),\n question: new TokenType(\"?\", beforeExpr),\n questionDot: new TokenType(\"?.\"),\n arrow: new TokenType(\"=>\", beforeExpr),\n template: new TokenType(\"template\"),\n invalidTemplate: new TokenType(\"invalidTemplate\"),\n ellipsis: new TokenType(\"...\", beforeExpr),\n backQuote: new TokenType(\"`\", startsExpr),\n dollarBraceL: new TokenType(\"${\", {beforeExpr: true, startsExpr: true}),\n\n // Operators. These carry several kinds of properties to help the\n // parser use them properly (the presence of these properties is\n // what categorizes them as operators).\n //\n // `binop`, when present, specifies that this operator is a binary\n // operator, and will refer to its precedence.\n //\n // `prefix` and `postfix` mark the operator as a prefix or postfix\n // unary operator.\n //\n // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as\n // binary operators with a very low precedence, that should result\n // in AssignmentExpression nodes.\n\n eq: new TokenType(\"=\", {beforeExpr: true, isAssign: true}),\n assign: new TokenType(\"_=\", {beforeExpr: true, isAssign: true}),\n incDec: new TokenType(\"++/--\", {prefix: true, postfix: true, startsExpr: true}),\n prefix: new TokenType(\"!/~\", {beforeExpr: true, prefix: true, startsExpr: true}),\n logicalOR: binop(\"||\", 1),\n logicalAND: binop(\"&&\", 2),\n bitwiseOR: binop(\"|\", 3),\n bitwiseXOR: binop(\"^\", 4),\n bitwiseAND: binop(\"&\", 5),\n equality: binop(\"==/!=/===/!==\", 6),\n relational: binop(\"</>/<=/>=\", 7),\n bitShift: binop(\"<</>>/>>>\", 8),\n plusMin: new TokenType(\"+/-\", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}),\n modulo: binop(\"%\", 10),\n star: binop(\"*\", 10),\n slash: binop(\"/\", 10),\n starstar: new TokenType(\"**\", {beforeExpr: true}),\n coalesce: binop(\"??\", 1),\n\n // Keyword token types.\n _break: kw(\"break\"),\n _case: kw(\"case\", beforeExpr),\n _catch: kw(\"catch\"),\n _continue: kw(\"continue\"),\n _debugger: kw(\"debugger\"),\n _default: kw(\"default\", beforeExpr),\n _do: kw(\"do\", {isLoop: true, beforeExpr: true}),\n _else: kw(\"else\", beforeExpr),\n _finally: kw(\"finally\"),\n _for: kw(\"for\", {isLoop: true}),\n _function: kw(\"function\", startsExpr),\n _if: kw(\"if\"),\n _return: kw(\"return\", beforeExpr),\n _switch: kw(\"switch\"),\n _throw: kw(\"throw\", beforeExpr),\n _try: kw(\"try\"),\n _var: kw(\"var\"),\n _const: kw(\"const\"),\n _while: kw(\"while\", {isLoop: true}),\n _with: kw(\"with\"),\n _new: kw(\"new\", {beforeExpr: true, startsExpr: true}),\n _this: kw(\"this\", startsExpr),\n _super: kw(\"super\", startsExpr),\n _class: kw(\"class\", startsExpr),\n _extends: kw(\"extends\", beforeExpr),\n _export: kw(\"export\"),\n _import: kw(\"import\", startsExpr),\n _null: kw(\"null\", startsExpr),\n _true: kw(\"true\", startsExpr),\n _false: kw(\"false\", startsExpr),\n _in: kw(\"in\", {beforeExpr: true, binop: 7}),\n _instanceof: kw(\"instanceof\", {beforeExpr: true, binop: 7}),\n _typeof: kw(\"typeof\", {beforeExpr: true, prefix: true, startsExpr: true}),\n _void: kw(\"void\", {beforeExpr: true, prefix: true, startsExpr: true}),\n _delete: kw(\"delete\", {beforeExpr: true, prefix: true, startsExpr: true})\n};\n\n// Matches a whole line break (where CRLF is considered a single\n// line break). Used to count lines.\n\nvar lineBreak = /\\r\\n?|\\n|\\u2028|\\u2029/;\nvar lineBreakG = new RegExp(lineBreak.source, \"g\");\n\nfunction isNewLine(code) {\n return code === 10 || code === 13 || code === 0x2028 || code === 0x2029\n}\n\nfunction nextLineBreak(code, from, end) {\n if ( end === void 0 ) end = code.length;\n\n for (var i = from; i < end; i++) {\n var next = code.charCodeAt(i);\n if (isNewLine(next))\n { return i < end - 1 && next === 13 && code.charCodeAt(i + 1) === 10 ? i + 2 : i + 1 }\n }\n return -1\n}\n\nvar nonASCIIwhitespace = /[\\u1680\\u2000-\\u200a\\u202f\\u205f\\u3000\\ufeff]/;\n\nvar skipWhiteSpace = /(?:\\s|\\/\\/.*|\\/\\*[^]*?\\*\\/)*/g;\n\nvar ref = Object.prototype;\nvar hasOwnProperty = ref.hasOwnProperty;\nvar toString = ref.toString;\n\nvar hasOwn = Object.hasOwn || (function (obj, propName) { return (\n hasOwnProperty.call(obj, propName)\n); });\n\nvar isArray = Array.isArray || (function (obj) { return (\n toString.call(obj) === \"[object Array]\"\n); });\n\nvar regexpCache = Object.create(null);\n\nfunction wordsRegexp(words) {\n return regexpCache[words] || (regexpCache[words] = new RegExp(\"^(?:\" + words.replace(/ /g, \"|\") + \")$\"))\n}\n\nfunction codePointToString(code) {\n // UTF-16 Decoding\n if (code <= 0xFFFF) { return String.fromCharCode(code) }\n code -= 0x10000;\n return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)\n}\n\nvar loneSurrogate = /(?:[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])/;\n\n// These are used when `options.locations` is on, for the\n// `startLoc` and `endLoc` properties.\n\nvar Position = function Position(line, col) {\n this.line = line;\n this.column = col;\n};\n\nPosition.prototype.offset = function offset (n) {\n return new Position(this.line, this.column + n)\n};\n\nvar SourceLocation = function SourceLocation(p, start, end) {\n this.start = start;\n this.end = end;\n if (p.sourceFile !== null) { this.source = p.sourceFile; }\n};\n\n// The `getLineInfo` function is mostly useful when the\n// `locations` option is off (for performance reasons) and you\n// want to find the line/column position for a given character\n// offset. `input` should be the code string that the offset refers\n// into.\n\nfunction getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n var nextBreak = nextLineBreak(input, cur, offset);\n if (nextBreak < 0) { return new Position(line, offset - cur) }\n ++line;\n cur = nextBreak;\n }\n}\n\n// A second argument must be given to configure the parser process.\n// These options are recognized (only `ecmaVersion` is required):\n\nvar defaultOptions = {\n // `ecmaVersion` indicates the ECMAScript version to parse. Must be\n // either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10\n // (2019), 11 (2020), 12 (2021), 13 (2022), 14 (2023), or `\"latest\"`\n // (the latest version the library supports). This influences\n // support for strict mode, the set of reserved words, and support\n // for new syntax features.\n ecmaVersion: null,\n // `sourceType` indicates the mode the code should be parsed in.\n // Can be either `\"script\"` or `\"module\"`. This influences global\n // strict mode and parsing of `import` and `export` declarations.\n sourceType: \"script\",\n // `onInsertedSemicolon` can be a callback that will be called when\n // a semicolon is automatically inserted. It will be passed the\n // position of the inserted semicolon as an offset, and if\n // `locations` is enabled, it is given the location as a `{line,\n // column}` object as second argument.\n onInsertedSemicolon: null,\n // `onTrailingComma` is similar to `onInsertedSemicolon`, but for\n // trailing commas.\n onTrailingComma: null,\n // By default, reserved words are only enforced if ecmaVersion >= 5.\n // Set `allowReserved` to a boolean value to explicitly turn this on\n // an off. When this option has the value \"never\", reserved words\n // and keywords can also not be used as property names.\n allowReserved: null,\n // When enabled, a return at the top level is not considered an\n // error.\n allowReturnOutsideFunction: false,\n // When enabled, import/export statements are not constrained to\n // appearing at the top of the program, and an import.meta expression\n // in a script isn't considered an error.\n allowImportExportEverywhere: false,\n // By default, await identifiers are allowed to appear at the top-level scope only if ecmaVersion >= 2022.\n // When enabled, await identifiers are allowed to appear at the top-level scope,\n // but they are still not allowed in non-async functions.\n allowAwaitOutsideFunction: null,\n // When enabled, super identifiers are not constrained to\n // appearing in methods and do not raise an error when they appear elsewhere.\n allowSuperOutsideMethod: null,\n // When enabled, hashbang directive in the beginning of file is\n // allowed and treated as a line comment. Enabled by default when\n // `ecmaVersion` >= 2023.\n allowHashBang: false,\n // By default, the parser will verify that private properties are\n // only used in places where they are valid and have been declared.\n // Set this to false to turn such checks off.\n checkPrivateFields: true,\n // When `locations` is on, `loc` properties holding objects with\n // `start` and `end` properties in `{line, column}` form (with\n // line being 1-based and column 0-based) will be attached to the\n // nodes.\n locations: false,\n // A function can be passed as `onToken` option, which will\n // cause Acorn to call that function with object in the same\n // format as tokens returned from `tokenizer().getToken()`. Note\n // that you are not allowed to call the parser from the\n // callback—that will corrupt its internal state.\n onToken: null,\n // A function can be passed as `onComment` option, which will\n // cause Acorn to call that function with `(block, text, start,\n // end)` parameters whenever a comment is skipped. `block` is a\n // boolean indicating whether this is a block (`/* */`) comment,\n // `text` is the content of the comment, and `start` and `end` are\n // character offsets that denote the start and end of the comment.\n // When the `locations` option is on, two more parameters are\n // passed, the full `{line, column}` locations of the start and\n // end of the comments. Note that you are not allowed to call the\n // parser from the callback—that will corrupt its internal state.\n // When this option has an array as value, objects representing the\n // comments are pushed to it.\n onComment: null,\n // Nodes have their start and end characters offsets recorded in\n // `start` and `end` properties (directly on the node, rather than\n // the `loc` object, which holds line/column data. To also add a\n // [semi-standardized][range] `range` property holding a `[start,\n // end]` array with the same numbers, set the `ranges` option to\n // `true`.\n //\n // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678\n ranges: false,\n // It is possible to parse multiple files into a single AST by\n // passing the tree produced by parsing the first file as\n // `program` option in subsequent parses. This will add the\n // toplevel forms of the parsed file to the `Program` (top) node\n // of an existing parse tree.\n program: null,\n // When `locations` is on, you can pass this to record the source\n // file in every node's `loc` object.\n sourceFile: null,\n // This value, if given, is stored in every node, whether\n // `locations` is on or off.\n directSourceFile: null,\n // When enabled, parenthesized expressions are represented by\n // (non-standard) ParenthesizedExpression nodes\n preserveParens: false\n};\n\n// Interpret and default an options object\n\nvar warnedAboutEcmaVersion = false;\n\nfunction getOptions(opts) {\n var options = {};\n\n for (var opt in defaultOptions)\n { options[opt] = opts && hasOwn(opts, opt) ? opts[opt] : defaultOptions[opt]; }\n\n if (options.ecmaVersion === \"latest\") {\n options.ecmaVersion = 1e8;\n } else if (options.ecmaVersion == null) {\n if (!warnedAboutEcmaVersion && typeof console === \"object\" && console.warn) {\n warnedAboutEcmaVersion = true;\n console.warn(\"Since Acorn 8.0.0, options.ecmaVersion is required.\\nDefaulting to 2020, but this will stop working in the future.\");\n }\n options.ecmaVersion = 11;\n } else if (options.ecmaVersion >= 2015) {\n options.ecmaVersion -= 2009;\n }\n\n if (options.allowReserved == null)\n { options.allowReserved = options.ecmaVersion < 5; }\n\n if (!opts || opts.allowHashBang == null)\n { options.allowHashBang = options.ecmaVersion >= 14; }\n\n if (isArray(options.onToken)) {\n var tokens = options.onToken;\n options.onToken = function (token) { return tokens.push(token); };\n }\n if (isArray(options.onComment))\n { options.onComment = pushComment(options, options.onComment); }\n\n return options\n}\n\nfunction pushComment(options, array) {\n return function(block, text, start, end, startLoc, endLoc) {\n var comment = {\n type: block ? \"Block\" : \"Line\",\n value: text,\n start: start,\n end: end\n };\n if (options.locations)\n { comment.loc = new SourceLocation(this, startLoc, endLoc); }\n if (options.ranges)\n { comment.range = [start, end]; }\n array.push(comment);\n }\n}\n\n// Each scope gets a bitset that may contain these flags\nvar\n SCOPE_TOP = 1,\n SCOPE_FUNCTION = 2,\n SCOPE_ASYNC = 4,\n SCOPE_GENERATOR = 8,\n SCOPE_ARROW = 16,\n SCOPE_SIMPLE_CATCH = 32,\n SCOPE_SUPER = 64,\n SCOPE_DIRECT_SUPER = 128,\n SCOPE_CLASS_STATIC_BLOCK = 256,\n SCOPE_CLASS_FIELD_INIT = 512,\n SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;\n\nfunction functionFlags(async, generator) {\n return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0)\n}\n\n// Used in checkLVal* and declareName to determine the type of a binding\nvar\n BIND_NONE = 0, // Not a binding\n BIND_VAR = 1, // Var-style binding\n BIND_LEXICAL = 2, // Let- or const-style binding\n BIND_FUNCTION = 3, // Function declaration\n BIND_SIMPLE_CATCH = 4, // Simple (identifier pattern) catch binding\n BIND_OUTSIDE = 5; // Special case for function names as bound inside the function\n\nvar Parser = function Parser(options, input, startPos) {\n this.options = options = getOptions(options);\n this.sourceFile = options.sourceFile;\n this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === \"module\" ? \"5module\" : 5]);\n var reserved = \"\";\n if (options.allowReserved !== true) {\n reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];\n if (options.sourceType === \"module\") { reserved += \" await\"; }\n }\n this.reservedWords = wordsRegexp(reserved);\n var reservedStrict = (reserved ? reserved + \" \" : \"\") + reservedWords.strict;\n this.reservedWordsStrict = wordsRegexp(reservedStrict);\n this.reservedWordsStrictBind = wordsRegexp(reservedStrict + \" \" + reservedWords.strictBind);\n this.input = String(input);\n\n // Used to signal to callers of `readWord1` whether the word\n // contained any escape sequences. This is needed because words with\n // escape sequences must not be interpreted as keywords.\n this.containsEsc = false;\n\n // Set up token state\n\n // The current position of the tokenizer in the input.\n if (startPos) {\n this.pos = startPos;\n this.lineStart = this.input.lastIndexOf(\"\\n\", startPos - 1) + 1;\n this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;\n } else {\n this.pos = this.lineStart = 0;\n this.curLine = 1;\n }\n\n // Properties of the current token:\n // Its type\n this.type = types$1.eof;\n // For tokens that include more information than their type, the value\n this.value = null;\n // Its start and end offset\n this.start = this.end = this.pos;\n // And, if locations are used, the {line, column} object\n // corresponding to those offsets\n this.startLoc = this.endLoc = this.curPosition();\n\n // Position information for the previous token\n this.lastTokEndLoc = this.lastTokStartLoc = null;\n this.lastTokStart = this.lastTokEnd = this.pos;\n\n // The context stack is used to superficially track syntactic\n // context to predict whether a regular expression is allowed in a\n // given position.\n this.context = this.initialContext();\n this.exprAllowed = true;\n\n // Figure out if it's a module code.\n this.inModule = options.sourceType === \"module\";\n this.strict = this.inModule || this.strictDirective(this.pos);\n\n // Used to signify the start of a potential arrow function\n this.potentialArrowAt = -1;\n this.potentialArrowInForAwait = false;\n\n // Positions to delayed-check that yield/await does not exist in default parameters.\n this.yieldPos = this.awaitPos = this.awaitIdentPos = 0;\n // Labels in scope.\n this.labels = [];\n // Thus-far undefined exports.\n this.undefinedExports = Object.create(null);\n\n // If enabled, skip leading hashbang line.\n if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === \"#!\")\n { this.skipLineComment(2); }\n\n // Scope tracking for duplicate variable names (see scope.js)\n this.scopeStack = [];\n this.enterScope(SCOPE_TOP);\n\n // For RegExp validation\n this.regexpState = null;\n\n // The stack of private names.\n // Each element has two properties: 'declared' and 'used'.\n // When it exited from the outermost class definition, all used private names must be declared.\n this.privateNameStack = [];\n};\n\nvar prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },allowNewDotTarget: { configurable: true },inClassStaticBlock: { configurable: true } };\n\nParser.prototype.parse = function parse () {\n var node = this.options.program || this.startNode();\n this.nextToken();\n return this.parseTopLevel(node)\n};\n\nprototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };\n\nprototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 };\n\nprototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 };\n\nprototypeAccessors.canAwait.get = function () {\n for (var i = this.scopeStack.length - 1; i >= 0; i--) {\n var ref = this.scopeStack[i];\n var flags = ref.flags;\n if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT)) { return false }\n if (flags & SCOPE_FUNCTION) { return (flags & SCOPE_ASYNC) > 0 }\n }\n return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction\n};\n\nprototypeAccessors.allowSuper.get = function () {\n var ref = this.currentThisScope();\n var flags = ref.flags;\n return (flags & SCOPE_SUPER) > 0 || this.options.allowSuperOutsideMethod\n};\n\nprototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };\n\nprototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };\n\nprototypeAccessors.allowNewDotTarget.get = function () {\n for (var i = this.scopeStack.length - 1; i >= 0; i--) {\n var ref = this.scopeStack[i];\n var flags = ref.flags;\n if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT) ||\n ((flags & SCOPE_FUNCTION) && !(flags & SCOPE_ARROW))) { return true }\n }\n return false\n};\n\nprototypeAccessors.inClassStaticBlock.get = function () {\n return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0\n};\n\nParser.extend = function extend () {\n var plugins = [], len = arguments.length;\n while ( len-- ) plugins[ len ] = arguments[ len ];\n\n var cls = this;\n for (var i = 0; i < plugins.length; i++) { cls = plugins[i](cls); }\n return cls\n};\n\nParser.parse = function parse (input, options) {\n return new this(options, input).parse()\n};\n\nParser.parseExpressionAt = function parseExpressionAt (input, pos, options) {\n var parser = new this(options, input, pos);\n parser.nextToken();\n return parser.parseExpression()\n};\n\nParser.tokenizer = function tokenizer (input, options) {\n return new this(options, input)\n};\n\nObject.defineProperties( Parser.prototype, prototypeAccessors );\n\nvar pp$9 = Parser.prototype;\n\n// ## Parser utilities\n\nvar literal = /^(?:'((?:\\\\[^]|[^'\\\\])*?)'|\"((?:\\\\[^]|[^\"\\\\])*?)\")/;\npp$9.strictDirective = function(start) {\n if (this.options.ecmaVersion < 5) { return false }\n for (;;) {\n // Try to find string literal.\n skipWhiteSpace.lastIndex = start;\n start += skipWhiteSpace.exec(this.input)[0].length;\n var match = literal.exec(this.input.slice(start));\n if (!match) { return false }\n if ((match[1] || match[2]) === \"use strict\") {\n skipWhiteSpace.lastIndex = start + match[0].length;\n var spaceAfter = skipWhiteSpace.exec(this.input), end = spaceAfter.index + spaceAfter[0].length;\n var next = this.input.charAt(end);\n return next === \";\" || next === \"}\" ||\n (lineBreak.test(spaceAfter[0]) &&\n !(/[(`.[+\\-/*%<>=,?^&]/.test(next) || next === \"!\" && this.input.charAt(end + 1) === \"=\"))\n }\n start += match[0].length;\n\n // Skip semicolon, if any.\n skipWhiteSpace.lastIndex = start;\n start += skipWhiteSpace.exec(this.input)[0].length;\n if (this.input[start] === \";\")\n { start++; }\n }\n};\n\n// Predicate that tests whether the next token is of the given\n// type, and if yes, consumes it as a side effect.\n\npp$9.eat = function(type) {\n if (this.type === type) {\n this.next();\n return true\n } else {\n return false\n }\n};\n\n// Tests whether parsed token is a contextual keyword.\n\npp$9.isContextual = function(name) {\n return this.type === types$1.name && this.value === name && !this.containsEsc\n};\n\n// Consumes contextual keyword if possible.\n\npp$9.eatContextual = function(name) {\n if (!this.isContextual(name)) { return false }\n this.next();\n return true\n};\n\n// Asserts that following token is given contextual keyword.\n\npp$9.expectContextual = function(name) {\n if (!this.eatContextual(name)) { this.unexpected(); }\n};\n\n// Test whether a semicolon can be inserted at the current position.\n\npp$9.canInsertSemicolon = function() {\n return this.type === types$1.eof ||\n this.type === types$1.braceR ||\n lineBreak.test(this.input.slice(this.lastTokEnd, this.start))\n};\n\npp$9.insertSemicolon = function() {\n if (this.canInsertSemicolon()) {\n if (this.options.onInsertedSemicolon)\n { this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); }\n return true\n }\n};\n\n// Consume a semicolon, or, failing that, see if we are allowed to\n// pretend that there is a semicolon at this position.\n\npp$9.semicolon = function() {\n if (!this.eat(types$1.semi) && !this.insertSemicolon()) { this.unexpected(); }\n};\n\npp$9.afterTrailingComma = function(tokType, notNext) {\n if (this.type === tokType) {\n if (this.options.onTrailingComma)\n { this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); }\n if (!notNext)\n { this.next(); }\n return true\n }\n};\n\n// Expect a token of a given type. If found, consume it, otherwise,\n// raise an unexpected token error.\n\npp$9.expect = function(type) {\n this.eat(type) || this.unexpected();\n};\n\n// Raise an unexpected token error.\n\npp$9.unexpected = function(pos) {\n this.raise(pos != null ? pos : this.start, \"Unexpected token\");\n};\n\nvar DestructuringErrors = function DestructuringErrors() {\n this.shorthandAssign =\n this.trailingComma =\n this.parenthesizedAssign =\n this.parenthesizedBind =\n this.doubleProto =\n -1;\n};\n\npp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {\n if (!refDestructuringErrors) { return }\n if (refDestructuringErrors.trailingComma > -1)\n { this.raiseRecoverable(refDestructuringErrors.trailingComma, \"Comma is not permitted after the rest element\"); }\n var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind;\n if (parens > -1) { this.raiseRecoverable(parens, isAssign ? \"Assigning to rvalue\" : \"Parenthesized pattern\"); }\n};\n\npp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) {\n if (!refDestructuringErrors) { return false }\n var shorthandAssign = refDestructuringErrors.shorthandAssign;\n var doubleProto = refDestructuringErrors.doubleProto;\n if (!andThrow) { return shorthandAssign >= 0 || doubleProto >= 0 }\n if (shorthandAssign >= 0)\n { this.raise(shorthandAssign, \"Shorthand property assignments are valid only in destructuring patterns\"); }\n if (doubleProto >= 0)\n { this.raiseRecoverable(doubleProto, \"Redefinition of __proto__ property\"); }\n};\n\npp$9.checkYieldAwaitInDefaultParams = function() {\n if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))\n { this.raise(this.yieldPos, \"Yield expression cannot be a default value\"); }\n if (this.awaitPos)\n { this.raise(this.awaitPos, \"Await expression cannot be a default value\"); }\n};\n\npp$9.isSimpleAssignTarget = function(expr) {\n if (expr.type === \"ParenthesizedExpression\")\n { return this.isSimpleAssignTarget(expr.expression) }\n return expr.type === \"Identifier\" || expr.type === \"MemberExpression\"\n};\n\nvar pp$8 = Parser.prototype;\n\n// ### Statement parsing\n\n// Parse a program. Initializes the parser, reads any number of\n// statements, and wraps them in a Program node. Optionally takes a\n// `program` argument. If present, the statements will be appended\n// to its body instead of creating a new node.\n\npp$8.parseTopLevel = function(node) {\n var exports = Object.create(null);\n if (!node.body) { node.body = []; }\n while (this.type !== types$1.eof) {\n var stmt = this.parseStatement(null, true, exports);\n node.body.push(stmt);\n }\n if (this.inModule)\n { for (var i = 0, list = Object.keys(this.undefinedExports); i < list.length; i += 1)\n {\n var name = list[i];\n\n this.raiseRecoverable(this.undefinedExports[name].start, (\"Export '\" + name + \"' is not defined\"));\n } }\n this.adaptDirectivePrologue(node.body);\n this.next();\n node.sourceType = this.options.sourceType;\n return this.finishNode(node, \"Program\")\n};\n\nvar loopLabel = {kind: \"loop\"}, switchLabel = {kind: \"switch\"};\n\npp$8.isLet = function(context) {\n if (this.options.ecmaVersion < 6 || !this.isContextual(\"let\")) { return false }\n skipWhiteSpace.lastIndex = this.pos;\n var skip = skipWhiteSpace.exec(this.input);\n var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);\n // For ambiguous cases, determine if a LexicalDeclaration (or only a\n // Statement) is allowed here. If context is not empty then only a Statement\n // is allowed. However, `let [` is an explicit negative lookahead for\n // ExpressionStatement, so special-case it first.\n if (nextCh === 91 || nextCh === 92) { return true } // '[', '\\'\n if (context) { return false }\n\n if (nextCh === 123 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true } // '{', astral\n if (isIdentifierStart(nextCh, true)) {\n var pos = next + 1;\n while (isIdentifierChar(nextCh = this.input.charCodeAt(pos), true)) { ++pos; }\n if (nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true }\n var ident = this.input.slice(next, pos);\n if (!keywordRelationalOperator.test(ident)) { return true }\n }\n return false\n};\n\n// check 'async [no LineTerminator here] function'\n// - 'async /*foo*/ function' is OK.\n// - 'async /*\\n*/ function' is invalid.\npp$8.isAsyncFunction = function() {\n if (this.options.ecmaVersion < 8 || !this.isContextual(\"async\"))\n { return false }\n\n skipWhiteSpace.lastIndex = this.pos;\n var skip = skipWhiteSpace.exec(this.input);\n var next = this.pos + skip[0].length, after;\n return !lineBreak.test(this.input.slice(this.pos, next)) &&\n this.input.slice(next, next + 8) === \"function\" &&\n (next + 8 === this.input.length ||\n !(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 0xd7ff && after < 0xdc00))\n};\n\npp$8.isUsingKeyword = function(isAwaitUsing, isFor) {\n if (this.options.ecmaVersion < 17 || !this.isContextual(isAwaitUsing ? \"await\" : \"using\"))\n { return false }\n\n skipWhiteSpace.lastIndex = this.pos;\n var skip = skipWhiteSpace.exec(this.input);\n var next = this.pos + skip[0].length;\n\n if (lineBreak.test(this.input.slice(this.pos, next))) { return false }\n\n if (isAwaitUsing) {\n var awaitEndPos = next + 5 /* await */, after;\n if (this.input.slice(next, awaitEndPos) !== \"using\" ||\n awaitEndPos === this.input.length ||\n isIdentifierChar(after = this.input.charCodeAt(awaitEndPos)) ||\n (after > 0xd7ff && after < 0xdc00)\n ) { return false }\n\n skipWhiteSpace.lastIndex = awaitEndPos;\n var skipAfterUsing = skipWhiteSpace.exec(this.input);\n if (skipAfterUsing && lineBreak.test(this.input.slice(awaitEndPos, awaitEndPos + skipAfterUsing[0].length))) { return false }\n }\n\n if (isFor) {\n var ofEndPos = next + 2 /* of */, after$1;\n if (this.input.slice(next, ofEndPos) === \"of\") {\n if (ofEndPos === this.input.length ||\n (!isIdentifierChar(after$1 = this.input.charCodeAt(ofEndPos)) && !(after$1 > 0xd7ff && after$1 < 0xdc00))) { return false }\n }\n }\n\n var ch = this.input.charCodeAt(next);\n return isIdentifierStart(ch, true) || ch === 92 // '\\'\n};\n\npp$8.isAwaitUsing = function(isFor) {\n return this.isUsingKeyword(true, isFor)\n};\n\npp$8.isUsing = function(isFor) {\n return this.isUsingKeyword(false, isFor)\n};\n\n// Parse a single statement.\n//\n// If expecting a statement and finding a slash operator, parse a\n// regular expression literal. This is to handle cases like\n// `if (foo) /blah/.exec(foo)`, where looking at the previous token\n// does not help.\n\npp$8.parseStatement = function(context, topLevel, exports) {\n var starttype = this.type, node = this.startNode(), kind;\n\n if (this.isLet(context)) {\n starttype = types$1._var;\n kind = \"let\";\n }\n\n // Most types of statements are recognized by the keyword they\n // start with. Many are trivial to parse, some require a bit of\n // complexity.\n\n switch (starttype) {\n case types$1._break: case types$1._continue: return this.parseBreakContinueStatement(node, starttype.keyword)\n case types$1._debugger: return this.parseDebuggerStatement(node)\n case types$1._do: return this.parseDoStatement(node)\n case types$1._for: return this.parseForStatement(node)\n case types$1._function:\n // Function as sole body of either an if statement or a labeled statement\n // works, but not when it is part of a labeled statement that is the sole\n // body of an if statement.\n if ((context && (this.strict || context !== \"if\" && context !== \"label\")) && this.options.ecmaVersion >= 6) { this.unexpected(); }\n return this.parseFunctionStatement(node, false, !context)\n case types$1._class:\n if (context) { this.unexpected(); }\n return this.parseClass(node, true)\n case types$1._if: return this.parseIfStatement(node)\n case types$1._return: return this.parseReturnStatement(node)\n case types$1._switch: return this.parseSwitchStatement(node)\n case types$1._throw: return this.parseThrowStatement(node)\n case types$1._try: return this.parseTryStatement(node)\n case types$1._const: case types$1._var:\n kind = kind || this.value;\n if (context && kind !== \"var\") { this.unexpected(); }\n return this.parseVarStatement(node, kind)\n case types$1._while: return this.parseWhileStatement(node)\n case types$1._with: return this.parseWithStatement(node)\n case types$1.braceL: return this.parseBlock(true, node)\n case types$1.semi: return this.parseEmptyStatement(node)\n case types$1._export:\n case types$1._import:\n if (this.options.ecmaVersion > 10 && starttype === types$1._import) {\n skipWhiteSpace.lastIndex = this.pos;\n var skip = skipWhiteSpace.exec(this.input);\n var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);\n if (nextCh === 40 || nextCh === 46) // '(' or '.'\n { return this.parseExpressionStatement(node, this.parseExpression()) }\n }\n\n if (!this.options.allowImportExportEverywhere) {\n if (!topLevel)\n { this.raise(this.start, \"'import' and 'export' may only appear at the top level\"); }\n if (!this.inModule)\n { this.raise(this.start, \"'import' and 'export' may appear only with 'sourceType: module'\"); }\n }\n return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)\n\n // If the statement does not start with a statement keyword or a\n // brace, it's an ExpressionStatement or LabeledStatement. We\n // simply start parsing an expression, and afterwards, if the\n // next token is a colon and the expression was a simple\n // Identifier node, we switch to interpreting it as a label.\n default:\n if (this.isAsyncFunction()) {\n if (context) { this.unexpected(); }\n this.next();\n return this.parseFunctionStatement(node, true, !context)\n }\n\n var usingKind = this.isAwaitUsing(false) ? \"await using\" : this.isUsing(false) ? \"using\" : null;\n if (usingKind) {\n if (topLevel && this.options.sourceType === \"script\") {\n this.raise(this.start, \"Using declaration cannot appear in the top level when source type is `script`\");\n }\n if (usingKind === \"await using\") {\n if (!this.canAwait) {\n this.raise(this.start, \"Await using cannot appear outside of async function\");\n }\n this.next();\n }\n this.next();\n this.parseVar(node, false, usingKind);\n this.semicolon();\n return this.finishNode(node, \"VariableDeclaration\")\n }\n\n var maybeName = this.value, expr = this.parseExpression();\n if (starttype === types$1.name && expr.type === \"Identifier\" && this.eat(types$1.colon))\n { return this.parseLabeledStatement(node, maybeName, expr, context) }\n else { return this.parseExpressionStatement(node, expr) }\n }\n};\n\npp$8.parseBreakContinueStatement = function(node, keyword) {\n var isBreak = keyword === \"break\";\n this.next();\n if (this.eat(types$1.semi) || this.insertSemicolon()) { node.label = null; }\n else if (this.type !== types$1.name) { this.unexpected(); }\n else {\n node.label = this.parseIdent();\n this.semicolon();\n }\n\n // Verify that there is an actual destination to break or\n // continue to.\n var i = 0;\n for (; i < this.labels.length; ++i) {\n var lab = this.labels[i];\n if (node.label == null || lab.name === node.label.name) {\n if (lab.kind != null && (isBreak || lab.kind === \"loop\")) { break }\n if (node.label && isBreak) { break }\n }\n }\n if (i === this.labels.length) { this.raise(node.start, \"Unsyntactic \" + keyword); }\n return this.finishNode(node, isBreak ? \"BreakStatement\" : \"ContinueStatement\")\n};\n\npp$8.parseDebuggerStatement = function(node) {\n this.next();\n this.semicolon();\n return this.finishNode(node, \"DebuggerStatement\")\n};\n\npp$8.parseDoStatement = function(node) {\n this.next();\n this.labels.push(loopLabel);\n node.body = this.parseStatement(\"do\");\n this.labels.pop();\n this.expect(types$1._while);\n node.test = this.parseParenExpression();\n if (this.options.ecmaVersion >= 6)\n { this.eat(types$1.semi); }\n else\n { this.semicolon(); }\n return this.finishNode(node, \"DoWhileStatement\")\n};\n\n// Disambiguating between a `for` and a `for`/`in` or `for`/`of`\n// loop is non-trivial. Basically, we have to parse the init `var`\n// statement or expression, disallowing the `in` operator (see\n// the second parameter to `parseExpression`), and then check\n// whether the next token is `in` or `of`. When there is no init\n// part (semicolon immediately after the opening parenthesis), it\n// is a regular `for` loop.\n\npp$8.parseForStatement = function(node) {\n this.next();\n var awaitAt = (this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual(\"await\")) ? this.lastTokStart : -1;\n this.labels.push(loopLabel);\n this.enterScope(0);\n this.expect(types$1.parenL);\n if (this.type === types$1.semi) {\n if (awaitAt > -1) { this.unexpected(awaitAt); }\n return this.parseFor(node, null)\n }\n var isLet = this.isLet();\n if (this.type === types$1._var || this.type === types$1._const || isLet) {\n var init$1 = this.startNode(), kind = isLet ? \"let\" : this.value;\n this.next();\n this.parseVar(init$1, true, kind);\n this.finishNode(init$1, \"VariableDeclaration\");\n return this.parseForAfterInit(node, init$1, awaitAt)\n }\n var startsWithLet = this.isContextual(\"let\"), isForOf = false;\n\n var usingKind = this.isUsing(true) ? \"using\" : this.isAwaitUsing(true) ? \"await using\" : null;\n if (usingKind) {\n var init$2 = this.startNode();\n this.next();\n if (usingKind === \"await using\") { this.next(); }\n this.parseVar(init$2, true, usingKind);\n this.finishNode(init$2, \"VariableDeclaration\");\n return this.parseForAfterInit(node, init$2, awaitAt)\n }\n var containsEsc = this.containsEsc;\n var refDestructuringErrors = new DestructuringErrors;\n var initPos = this.start;\n var init = awaitAt > -1\n ? this.parseExprSubscripts(refDestructuringErrors, \"await\")\n : this.parseExpression(true, refDestructuringErrors);\n if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual(\"of\"))) {\n if (awaitAt > -1) { // implies `ecmaVersion >= 9` (see declaration of awaitAt)\n if (this.type === types$1._in) { this.unexpected(awaitAt); }\n node.await = true;\n } else if (isForOf && this.options.ecmaVersion >= 8) {\n if (init.start === initPos && !containsEsc && init.type === \"Identifier\" && init.name === \"async\") { this.unexpected(); }\n else if (this.options.ecmaVersion >= 9) { node.await = false; }\n }\n if (startsWithLet && isForOf) { this.raise(init.start, \"The left-hand side of a for-of loop may not start with 'let'.\"); }\n this.toAssignable(init, false, refDestructuringErrors);\n this.checkLValPattern(init);\n return this.parseForIn(node, init)\n } else {\n this.checkExpressionErrors(refDestructuringErrors, true);\n }\n if (awaitAt > -1) { this.unexpected(awaitAt); }\n return this.parseFor(node, init)\n};\n\n// Helper method to parse for loop after variable initialization\npp$8.parseForAfterInit = function(node, init, awaitAt) {\n if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual(\"of\"))) && init.declarations.length === 1) {\n if (this.options.ecmaVersion >= 9) {\n if (this.type === types$1._in) {\n if (awaitAt > -1) { this.unexpected(awaitAt); }\n } else { node.await = awaitAt > -1; }\n }\n return this.parseForIn(node, init)\n }\n if (awaitAt > -1) { this.unexpected(awaitAt); }\n return this.parseFor(node, init)\n};\n\npp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) {\n this.next();\n return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync)\n};\n\npp$8.parseIfStatement = function(node) {\n this.next();\n node.test = this.parseParenExpression();\n // allow function declarations in branches, but only in non-strict mode\n node.consequent = this.parseStatement(\"if\");\n node.alternate = this.eat(types$1._else) ? this.parseStatement(\"if\") : null;\n return this.finishNode(node, \"IfStatement\")\n};\n\npp$8.parseReturnStatement = function(node) {\n if (!this.inFunction && !this.options.allowReturnOutsideFunction)\n { this.raise(this.start, \"'return' outside of function\"); }\n this.next();\n\n // In `return` (and `break`/`continue`), the keywords with\n // optional arguments, we eagerly look for a semicolon or the\n // possibility to insert one.\n\n if (this.eat(types$1.semi) || this.insertSemicolon()) { node.argument = null; }\n else { node.argument = this.parseExpression(); this.semicolon(); }\n return this.finishNode(node, \"ReturnStatement\")\n};\n\npp$8.parseSwitchStatement = function(node) {\n this.next();\n node.discriminant = this.parseParenExpression();\n node.cases = [];\n this.expect(types$1.braceL);\n this.labels.push(switchLabel);\n this.enterScope(0);\n\n // Statements under must be grouped (by label) in SwitchCase\n // nodes. `cur` is used to keep the node that we are currently\n // adding statements to.\n\n var cur;\n for (var sawDefault = false; this.type !== types$1.braceR;) {\n if (this.type === types$1._case || this.type === types$1._default) {\n var isCase = this.type === types$1._case;\n if (cur) { this.finishNode(cur, \"SwitchCase\"); }\n node.cases.push(cur = this.startNode());\n cur.consequent = [];\n this.next();\n if (isCase) {\n cur.test = this.parseExpression();\n } else {\n if (sawDefault) { this.raiseRecoverable(this.lastTokStart, \"Multiple default clauses\"); }\n sawDefault = true;\n cur.test = null;\n }\n this.expect(types$1.colon);\n } else {\n if (!cur) { this.unexpected(); }\n cur.consequent.push(this.parseStatement(null));\n }\n }\n this.exitScope();\n if (cur) { this.finishNode(cur, \"SwitchCase\"); }\n this.next(); // Closing brace\n this.labels.pop();\n return this.finishNode(node, \"SwitchStatement\")\n};\n\npp$8.parseThrowStatement = function(node) {\n this.next();\n if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))\n { this.raise(this.lastTokEnd, \"Illegal newline after throw\"); }\n node.argument = this.parseExpression();\n this.semicolon();\n return this.finishNode(node, \"ThrowStatement\")\n};\n\n// Reused empty array added for node fields that are always empty.\n\nvar empty$1 = [];\n\npp$8.parseCatchClauseParam = function() {\n var param = this.parseBindingAtom();\n var simple = param.type === \"Identifier\";\n this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);\n this.checkLValPattern(param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);\n this.expect(types$1.parenR);\n\n return param\n};\n\npp$8.parseTryStatement = function(node) {\n this.next();\n node.block = this.parseBlock();\n node.handler = null;\n if (this.type === types$1._catch) {\n var clause = this.startNode();\n this.next();\n if (this.eat(types$1.parenL)) {\n clause.param = this.parseCatchClauseParam();\n } else {\n if (this.options.ecmaVersion < 10) { this.unexpected(); }\n clause.param = null;\n this.enterScope(0);\n }\n clause.body = this.parseBlock(false);\n this.exitScope();\n node.handler = this.finishNode(clause, \"CatchClause\");\n }\n node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;\n if (!node.handler && !node.finalizer)\n { this.raise(node.start, \"Missing catch or finally clause\"); }\n return this.finishNode(node, \"TryStatement\")\n};\n\npp$8.parseVarStatement = function(node, kind, allowMissingInitializer) {\n this.next();\n this.parseVar(node, false, kind, allowMissingInitializer);\n this.semicolon();\n return this.finishNode(node, \"VariableDeclaration\")\n};\n\npp$8.parseWhileStatement = function(node) {\n this.next();\n node.test = this.parseParenExpression();\n this.labels.push(loopLabel);\n node.body = this.parseStatement(\"while\");\n this.labels.pop();\n return this.finishNode(node, \"WhileStatement\")\n};\n\npp$8.parseWithStatement = function(node) {\n if (this.strict) { this.raise(this.start, \"'with' in strict mode\"); }\n this.next();\n node.object = this.parseParenExpression();\n node.body = this.parseStatement(\"with\");\n return this.finishNode(node, \"WithStatement\")\n};\n\npp$8.parseEmptyStatement = function(node) {\n this.next();\n return this.finishNode(node, \"EmptyStatement\")\n};\n\npp$8.parseLabeledStatement = function(node, maybeName, expr, context) {\n for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1)\n {\n var label = list[i$1];\n\n if (label.name === maybeName)\n { this.raise(expr.start, \"Label '\" + maybeName + \"' is already declared\");\n } }\n var kind = this.type.isLoop ? \"loop\" : this.type === types$1._switch ? \"switch\" : null;\n for (var i = this.labels.length - 1; i >= 0; i--) {\n var label$1 = this.labels[i];\n if (label$1.statementStart === node.start) {\n // Update information about previous labels on this node\n label$1.statementStart = this.start;\n label$1.kind = kind;\n } else { break }\n }\n this.labels.push({name: maybeName, kind: kind, statementStart: this.start});\n node.body = this.parseStatement(context ? context.indexOf(\"label\") === -1 ? context + \"label\" : context : \"label\");\n this.labels.pop();\n node.label = expr;\n return this.finishNode(node, \"LabeledStatement\")\n};\n\npp$8.parseExpressionStatement = function(node, expr) {\n node.expression = expr;\n this.semicolon();\n return this.finishNode(node, \"ExpressionStatement\")\n};\n\n// Parse a semicolon-enclosed block of statements, handling `\"use\n// strict\"` declarations when `allowStrict` is true (used for\n// function bodies).\n\npp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) {\n if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;\n if ( node === void 0 ) node = this.startNode();\n\n node.body = [];\n this.expect(types$1.braceL);\n if (createNewLexicalScope) { this.enterScope(0); }\n while (this.type !== types$1.braceR) {\n var stmt = this.parseStatement(null);\n node.body.push(stmt);\n }\n if (exitStrict) { this.strict = false; }\n this.next();\n if (createNewLexicalScope) { this.exitScope(); }\n return this.finishNode(node, \"BlockStatement\")\n};\n\n// Parse a regular `for` loop. The disambiguation code in\n// `parseStatement` will already have parsed the init statement or\n// expression.\n\npp$8.parseFor = function(node, init) {\n node.init = init;\n this.expect(types$1.semi);\n node.test = this.type === types$1.semi ? null : this.parseExpression();\n this.expect(types$1.semi);\n node.update = this.type === types$1.parenR ? null : this.parseExpression();\n this.expect(types$1.parenR);\n node.body = this.parseStatement(\"for\");\n this.exitScope();\n this.labels.pop();\n return this.finishNode(node, \"ForStatement\")\n};\n\n// Parse a `for`/`in` and `for`/`of` loop, which are almost\n// same from parser's perspective.\n\npp$8.parseForIn = function(node, init) {\n var isForIn = this.type === types$1._in;\n this.next();\n\n if (\n init.type === \"VariableDeclaration\" &&\n init.declarations[0].init != null &&\n (\n !isForIn ||\n this.options.ecmaVersion < 8 ||\n this.strict ||\n init.kind !== \"var\" ||\n init.declarations[0].id.type !== \"Identifier\"\n )\n ) {\n this.raise(\n init.start,\n ((isForIn ? \"for-in\" : \"for-of\") + \" loop variable declaration may not have an initializer\")\n );\n }\n node.left = init;\n node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();\n this.expect(types$1.parenR);\n node.body = this.parseStatement(\"for\");\n this.exitScope();\n this.labels.pop();\n return this.finishNode(node, isForIn ? \"ForInStatement\" : \"ForOfStatement\")\n};\n\n// Parse a list of variable declarations.\n\npp$8.parseVar = function(node, isFor, kind, allowMissingInitializer) {\n node.declarations = [];\n node.kind = kind;\n for (;;) {\n var decl = this.startNode();\n this.parseVarId(decl, kind);\n if (this.eat(types$1.eq)) {\n decl.init = this.parseMaybeAssign(isFor);\n } else if (!allowMissingInitializer && kind === \"const\" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual(\"of\")))) {\n this.unexpected();\n } else if (!allowMissingInitializer && (kind === \"using\" || kind === \"await using\") && this.options.ecmaVersion >= 17 && this.type !== types$1._in && !this.isContextual(\"of\")) {\n this.raise(this.lastTokEnd, (\"Missing initializer in \" + kind + \" declaration\"));\n } else if (!allowMissingInitializer && decl.id.type !== \"Identifier\" && !(isFor && (this.type === types$1._in || this.isContextual(\"of\")))) {\n this.raise(this.lastTokEnd, \"Complex binding patterns require an initialization value\");\n } else {\n decl.init = null;\n }\n node.declarations.push(this.finishNode(decl, \"VariableDeclarator\"));\n if (!this.eat(types$1.comma)) { break }\n }\n return node\n};\n\npp$8.parseVarId = function(decl, kind) {\n decl.id = kind === \"using\" || kind === \"await using\"\n ? this.parseIdent()\n : this.parseBindingAtom();\n\n this.checkLValPattern(decl.id, kind === \"var\" ? BIND_VAR : BIND_LEXICAL, false);\n};\n\nvar FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;\n\n// Parse a function declaration or literal (depending on the\n// `statement & FUNC_STATEMENT`).\n\n// Remove `allowExpressionBody` for 7.0.0, as it is only called with false\npp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {\n this.initFunction(node);\n if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {\n if (this.type === types$1.star && (statement & FUNC_HANGING_STATEMENT))\n { this.unexpected(); }\n node.generator = this.eat(types$1.star);\n }\n if (this.options.ecmaVersion >= 8)\n { node.async = !!isAsync; }\n\n if (statement & FUNC_STATEMENT) {\n node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types$1.name ? null : this.parseIdent();\n if (node.id && !(statement & FUNC_HANGING_STATEMENT))\n // If it is a regular function declaration in sloppy mode, then it is\n // subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding\n // mode depends on properties of the current scope (see\n // treatFunctionsAsVar).\n { this.checkLValSimple(node.id, (this.strict || node.generator || node.async) ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION); }\n }\n\n var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;\n this.yieldPos = 0;\n this.awaitPos = 0;\n this.awaitIdentPos = 0;\n this.enterScope(functionFlags(node.async, node.generator));\n\n if (!(statement & FUNC_STATEMENT))\n { node.id = this.type === types$1.name ? this.parseIdent() : null; }\n\n this.parseFunctionParams(node);\n this.parseFunctionBody(node, allowExpressionBody, false, forInit);\n\n this.yieldPos = oldYieldPos;\n this.awaitPos = oldAwaitPos;\n this.awaitIdentPos = oldAwaitIdentPos;\n return this.finishNode(node, (statement & FUNC_STATEMENT) ? \"FunctionDeclaration\" : \"FunctionExpression\")\n};\n\npp$8.parseFunctionParams = function(node) {\n this.expect(types$1.parenL);\n node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);\n this.checkYieldAwaitInDefaultParams();\n};\n\n// Parse a class declaration or literal (depending on the\n// `isStatement` parameter).\n\npp$8.parseClass = function(node, isStatement) {\n this.next();\n\n // ecma-262 14.6 Class Definitions\n // A class definition is always strict mode code.\n var oldStrict = this.strict;\n this.strict = true;\n\n this.parseClassId(node, isStatement);\n this.parseClassSuper(node);\n var privateNameMap = this.enterClassBody();\n var classBody = this.startNode();\n var hadConstructor = false;\n classBody.body = [];\n this.expect(types$1.braceL);\n while (this.type !== types$1.braceR) {\n var element = this.parseClassElement(node.superClass !== null);\n if (element) {\n classBody.body.push(element);\n if (element.type === \"MethodDefinition\" && element.kind === \"constructor\") {\n if (hadConstructor) { this.raiseRecoverable(element.start, \"Duplicate constructor in the same class\"); }\n hadConstructor = true;\n } else if (element.key && element.key.type === \"PrivateIdentifier\" && isPrivateNameConflicted(privateNameMap, element)) {\n this.raiseRecoverable(element.key.start, (\"Identifier '#\" + (element.key.name) + \"' has already been declared\"));\n }\n }\n }\n this.strict = oldStrict;\n this.next();\n node.body = this.finishNode(classBody, \"ClassBody\");\n this.exitClassBody();\n return this.finishNode(node, isStatement ? \"ClassDeclaration\" : \"ClassExpression\")\n};\n\npp$8.parseClassElement = function(constructorAllowsSuper) {\n if (this.eat(types$1.semi)) { return null }\n\n var ecmaVersion = this.options.ecmaVersion;\n var node = this.startNode();\n var keyName = \"\";\n var isGenerator = false;\n var isAsync = false;\n var kind = \"method\";\n var isStatic = false;\n\n if (this.eatContextual(\"static\")) {\n // Parse static init block\n if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {\n this.parseClassStaticBlock(node);\n return node\n }\n if (this.isClassElementNameStart() || this.type === types$1.star) {\n isStatic = true;\n } else {\n keyName = \"static\";\n }\n }\n node.static = isStatic;\n if (!keyName && ecmaVersion >= 8 && this.eatContextual(\"async\")) {\n if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) {\n isAsync = true;\n } else {\n keyName = \"async\";\n }\n }\n if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) {\n isGenerator = true;\n }\n if (!keyName && !isAsync && !isGenerator) {\n var lastValue = this.value;\n if (this.eatContextual(\"get\") || this.eatContextual(\"set\")) {\n if (this.isClassElementNameStart()) {\n kind = lastValue;\n } else {\n keyName = lastValue;\n }\n }\n }\n\n // Parse element name\n if (keyName) {\n // 'async', 'get', 'set', or 'static' were not a keyword contextually.\n // The last token is any of those. Make it the element name.\n node.computed = false;\n node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc);\n node.key.name = keyName;\n this.finishNode(node.key, \"Identifier\");\n } else {\n this.parseClassElementName(node);\n }\n\n // Parse element value\n if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== \"method\" || isGenerator || isAsync) {\n var isConstructor = !node.static && checkKeyName(node, \"constructor\");\n var allowsDirectSuper = isConstructor && constructorAllowsSuper;\n // Couldn't move this check into the 'parseClassMethod' method for backward compatibility.\n if (isConstructor && kind !== \"method\") { this.raise(node.key.start, \"Constructor can't have get/set modifier\"); }\n node.kind = isConstructor ? \"constructor\" : kind;\n this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper);\n } else {\n this.parseClassField(node);\n }\n\n return node\n};\n\npp$8.isClassElementNameStart = function() {\n return (\n this.type === types$1.name ||\n this.type === types$1.privateId ||\n this.type === types$1.num ||\n this.type === types$1.string ||\n this.type === types$1.bracketL ||\n this.type.keyword\n )\n};\n\npp$8.parseClassElementName = function(element) {\n if (this.type === types$1.privateId) {\n if (this.value === \"constructor\") {\n this.raise(this.start, \"Classes can't have an element named '#constructor'\");\n }\n element.computed = false;\n element.key = this.parsePrivateIdent();\n } else {\n this.parsePropertyName(element);\n }\n};\n\npp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {\n // Check key and flags\n var key = method.key;\n if (method.kind === \"constructor\") {\n if (isGenerator) { this.raise(key.start, \"Constructor can't be a generator\"); }\n if (isAsync) { this.raise(key.start, \"Constructor can't be an async method\"); }\n } else if (method.static && checkKeyName(method, \"prototype\")) {\n this.raise(key.start, \"Classes may not have a static property named prototype\");\n }\n\n // Parse value\n var value = method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper);\n\n // Check value\n if (method.kind === \"get\" && value.params.length !== 0)\n { this.raiseRecoverable(value.start, \"getter should have no params\"); }\n if (method.kind === \"set\" && value.params.length !== 1)\n { this.raiseRecoverable(value.start, \"setter should have exactly one param\"); }\n if (method.kind === \"set\" && value.params[0].type === \"RestElement\")\n { this.raiseRecoverable(value.params[0].start, \"Setter cannot use rest params\"); }\n\n return this.finishNode(method, \"MethodDefinition\")\n};\n\npp$8.parseClassField = function(field) {\n if (checkKeyName(field, \"constructor\")) {\n this.raise(field.key.start, \"Classes can't have a field named 'constructor'\");\n } else if (field.static && checkKeyName(field, \"prototype\")) {\n this.raise(field.key.start, \"Classes can't have a static field named 'prototype'\");\n }\n\n if (this.eat(types$1.eq)) {\n // To raise SyntaxError if 'arguments' exists in the initializer.\n this.enterScope(SCOPE_CLASS_FIELD_INIT | SCOPE_SUPER);\n field.value = this.parseMaybeAssign();\n this.exitScope();\n } else {\n field.value = null;\n }\n this.semicolon();\n\n return this.finishNode(field, \"PropertyDefinition\")\n};\n\npp$8.parseClassStaticBlock = function(node) {\n node.body = [];\n\n var oldLabels = this.labels;\n this.labels = [];\n this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER);\n while (this.type !== types$1.braceR) {\n var stmt = this.parseStatement(null);\n node.body.push(stmt);\n }\n this.next();\n this.exitScope();\n this.labels = oldLabels;\n\n return this.finishNode(node, \"StaticBlock\")\n};\n\npp$8.parseClassId = function(node, isStatement) {\n if (this.type === types$1.name) {\n node.id = this.parseIdent();\n if (isStatement)\n { this.checkLValSimple(node.id, BIND_LEXICAL, false); }\n } else {\n if (isStatement === true)\n { this.unexpected(); }\n node.id = null;\n }\n};\n\npp$8.parseClassSuper = function(node) {\n node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(null, false) : null;\n};\n\npp$8.enterClassBody = function() {\n var element = {declared: Object.create(null), used: []};\n this.privateNameStack.push(element);\n return element.declared\n};\n\npp$8.exitClassBody = function() {\n var ref = this.privateNameStack.pop();\n var declared = ref.declared;\n var used = ref.used;\n if (!this.options.checkPrivateFields) { return }\n var len = this.privateNameStack.length;\n var parent = len === 0 ? null : this.privateNameStack[len - 1];\n for (var i = 0; i < used.length; ++i) {\n var id = used[i];\n if (!hasOwn(declared, id.name)) {\n if (parent) {\n parent.used.push(id);\n } else {\n this.raiseRecoverable(id.start, (\"Private field '#\" + (id.name) + \"' must be declared in an enclosing class\"));\n }\n }\n }\n};\n\nfunction isPrivateNameConflicted(privateNameMap, element) {\n var name = element.key.name;\n var curr = privateNameMap[name];\n\n var next = \"true\";\n if (element.type === \"MethodDefinition\" && (element.kind === \"get\" || element.kind === \"set\")) {\n next = (element.static ? \"s\" : \"i\") + element.kind;\n }\n\n // `class { get #a(){}; static set #a(_){} }` is also conflict.\n if (\n curr === \"iget\" && next === \"iset\" ||\n curr === \"iset\" && next === \"iget\" ||\n curr === \"sget\" && next === \"sset\" ||\n curr === \"sset\" && next === \"sget\"\n ) {\n privateNameMap[name] = \"true\";\n return false\n } else if (!curr) {\n privateNameMap[name] = next;\n return false\n } else {\n return true\n }\n}\n\nfunction checkKeyName(node, name) {\n var computed = node.computed;\n var key = node.key;\n return !computed && (\n key.type === \"Identifier\" && key.name === name ||\n key.type === \"Literal\" && key.value === name\n )\n}\n\n// Parses module export declaration.\n\npp$8.parseExportAllDeclaration = function(node, exports) {\n if (this.options.ecmaVersion >= 11) {\n if (this.eatContextual(\"as\")) {\n node.exported = this.parseModuleExportName();\n this.checkExport(exports, node.exported, this.lastTokStart);\n } else {\n node.exported = null;\n }\n }\n this.expectContextual(\"from\");\n if (this.type !== types$1.string) { this.unexpected(); }\n node.source = this.parseExprAtom();\n if (this.options.ecmaVersion >= 16)\n { node.attributes = this.parseWithClause(); }\n this.semicolon();\n return this.finishNode(node, \"ExportAllDeclaration\")\n};\n\npp$8.parseExport = function(node, exports) {\n this.next();\n // export * from '...'\n if (this.eat(types$1.star)) {\n return this.parseExportAllDeclaration(node, exports)\n }\n if (this.eat(types$1._default)) { // export default ...\n this.checkExport(exports, \"default\", this.lastTokStart);\n node.declaration = this.parseExportDefaultDeclaration();\n return this.finishNode(node, \"ExportDefaultDeclaration\")\n }\n // export var|const|let|function|class ...\n if (this.shouldParseExportStatement()) {\n node.declaration = this.parseExportDeclaration(node);\n if (node.declaration.type === \"VariableDeclaration\")\n { this.checkVariableExport(exports, node.declaration.declarations); }\n else\n { this.checkExport(exports, node.declaration.id, node.declaration.id.start); }\n node.specifiers = [];\n node.source = null;\n if (this.options.ecmaVersion >= 16)\n { node.attributes = []; }\n } else { // export { x, y as z } [from '...']\n node.declaration = null;\n node.specifiers = this.parseExportSpecifiers(exports);\n if (this.eatContextual(\"from\")) {\n if (this.type !== types$1.string) { this.unexpected(); }\n node.source = this.parseExprAtom();\n if (this.options.ecmaVersion >= 16)\n { node.attributes = this.parseWithClause(); }\n } else {\n for (var i = 0, list = node.specifiers; i < list.length; i += 1) {\n // check for keywords used as local names\n var spec = list[i];\n\n this.checkUnreserved(spec.local);\n // check if export is defined\n this.checkLocalExport(spec.local);\n\n if (spec.local.type === \"Literal\") {\n this.raise(spec.local.start, \"A string literal cannot be used as an exported binding without `from`.\");\n }\n }\n\n node.source = null;\n if (this.options.ecmaVersion >= 16)\n { node.attributes = []; }\n }\n this.semicolon();\n }\n return this.finishNode(node, \"ExportNamedDeclaration\")\n};\n\npp$8.parseExportDeclaration = function(node) {\n return this.parseStatement(null)\n};\n\npp$8.parseExportDefaultDeclaration = function() {\n var isAsync;\n if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {\n var fNode = this.startNode();\n this.next();\n if (isAsync) { this.next(); }\n return this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync)\n } else if (this.type === types$1._class) {\n var cNode = this.startNode();\n return this.parseClass(cNode, \"nullableID\")\n } else {\n var declaration = this.parseMaybeAssign();\n this.semicolon();\n return declaration\n }\n};\n\npp$8.checkExport = function(exports, name, pos) {\n if (!exports) { return }\n if (typeof name !== \"string\")\n { name = name.type === \"Identifier\" ? name.name : name.value; }\n if (hasOwn(exports, name))\n { this.raiseRecoverable(pos, \"Duplicate export '\" + name + \"'\"); }\n exports[name] = true;\n};\n\npp$8.checkPatternExport = function(exports, pat) {\n var type = pat.type;\n if (type === \"Identifier\")\n { this.checkExport(exports, pat, pat.start); }\n else if (type === \"ObjectPattern\")\n { for (var i = 0, list = pat.properties; i < list.length; i += 1)\n {\n var prop = list[i];\n\n this.checkPatternExport(exports, prop);\n } }\n else if (type === \"ArrayPattern\")\n { for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {\n var elt = list$1[i$1];\n\n if (elt) { this.checkPatternExport(exports, elt); }\n } }\n else if (type === \"Property\")\n { this.checkPatternExport(exports, pat.value); }\n else if (type === \"AssignmentPattern\")\n { this.checkPatternExport(exports, pat.left); }\n else if (type === \"RestElement\")\n { this.checkPatternExport(exports, pat.argument); }\n};\n\npp$8.checkVariableExport = function(exports, decls) {\n if (!exports) { return }\n for (var i = 0, list = decls; i < list.length; i += 1)\n {\n var decl = list[i];\n\n this.checkPatternExport(exports, decl.id);\n }\n};\n\npp$8.shouldParseExportStatement = function() {\n return this.type.keyword === \"var\" ||\n this.type.keyword === \"const\" ||\n this.type.keyword === \"class\" ||\n this.type.keyword === \"function\" ||\n this.isLet() ||\n this.isAsyncFunction()\n};\n\n// Parses a comma-separated list of module exports.\n\npp$8.parseExportSpecifier = function(exports) {\n var node = this.startNode();\n node.local = this.parseModuleExportName();\n\n node.exported = this.eatContextual(\"as\") ? this.parseModuleExportName() : node.local;\n this.checkExport(\n exports,\n node.exported,\n node.exported.start\n );\n\n return this.finishNode(node, \"ExportSpecifier\")\n};\n\npp$8.parseExportSpecifiers = function(exports) {\n var nodes = [], first = true;\n // export { x, y as z } [from '...']\n this.expect(types$1.braceL);\n while (!this.eat(types$1.braceR)) {\n if (!first) {\n this.expect(types$1.comma);\n if (this.afterTrailingComma(types$1.braceR)) { break }\n } else { first = false; }\n\n nodes.push(this.parseExportSpecifier(exports));\n }\n return nodes\n};\n\n// Parses import declaration.\n\npp$8.parseImport = function(node) {\n this.next();\n\n // import '...'\n if (this.type === types$1.string) {\n node.specifiers = empty$1;\n node.source = this.parseExprAtom();\n } else {\n node.specifiers = this.parseImportSpecifiers();\n this.expectContextual(\"from\");\n node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();\n }\n if (this.options.ecmaVersion >= 16)\n { node.attributes = this.parseWithClause(); }\n this.semicolon();\n return this.finishNode(node, \"ImportDeclaration\")\n};\n\n// Parses a comma-separated list of module imports.\n\npp$8.parseImportSpecifier = function() {\n var node = this.startNode();\n node.imported = this.parseModuleExportName();\n\n if (this.eatContextual(\"as\")) {\n node.local = this.parseIdent();\n } else {\n this.checkUnreserved(node.imported);\n node.local = node.imported;\n }\n this.checkLValSimple(node.local, BIND_LEXICAL);\n\n return this.finishNode(node, \"ImportSpecifier\")\n};\n\npp$8.parseImportDefaultSpecifier = function() {\n // import defaultObj, { x, y as z } from '...'\n var node = this.startNode();\n node.local = this.parseIdent();\n this.checkLValSimple(node.local, BIND_LEXICAL);\n return this.finishNode(node, \"ImportDefaultSpecifier\")\n};\n\npp$8.parseImportNamespaceSpecifier = function() {\n var node = this.startNode();\n this.next();\n this.expectContextual(\"as\");\n node.local = this.parseIdent();\n this.checkLValSimple(node.local, BIND_LEXICAL);\n return this.finishNode(node, \"ImportNamespaceSpecifier\")\n};\n\npp$8.parseImportSpecifiers = function() {\n var nodes = [], first = true;\n if (this.type === types$1.name) {\n nodes.push(this.parseImportDefaultSpecifier());\n if (!this.eat(types$1.comma)) { return nodes }\n }\n if (this.type === types$1.star) {\n nodes.push(this.parseImportNamespaceSpecifier());\n return nodes\n }\n this.expect(types$1.braceL);\n while (!this.eat(types$1.braceR)) {\n if (!first) {\n this.expect(types$1.comma);\n if (this.afterTrailingComma(types$1.braceR)) { break }\n } else { first = false; }\n\n nodes.push(this.parseImportSpecifier());\n }\n return nodes\n};\n\npp$8.parseWithClause = function() {\n var nodes = [];\n if (!this.eat(types$1._with)) {\n return nodes\n }\n this.expect(types$1.braceL);\n var attributeKeys = {};\n var first = true;\n while (!this.eat(types$1.braceR)) {\n if (!first) {\n this.expect(types$1.comma);\n if (this.afterTrailingComma(types$1.braceR)) { break }\n } else { first = false; }\n\n var attr = this.parseImportAttribute();\n var keyName = attr.key.type === \"Identifier\" ? attr.key.name : attr.key.value;\n if (hasOwn(attributeKeys, keyName))\n { this.raiseRecoverable(attr.key.start, \"Duplicate attribute key '\" + keyName + \"'\"); }\n attributeKeys[keyName] = true;\n nodes.push(attr);\n }\n return nodes\n};\n\npp$8.parseImportAttribute = function() {\n var node = this.startNode();\n node.key = this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== \"never\");\n this.expect(types$1.colon);\n if (this.type !== types$1.string) {\n this.unexpected();\n }\n node.value = this.parseExprAtom();\n return this.finishNode(node, \"ImportAttribute\")\n};\n\npp$8.parseModuleExportName = function() {\n if (this.options.ecmaVersion >= 13 && this.type === types$1.string) {\n var stringLiteral = this.parseLiteral(this.value);\n if (loneSurrogate.test(stringLiteral.value)) {\n this.raise(stringLiteral.start, \"An export name cannot include a lone surrogate.\");\n }\n return stringLiteral\n }\n return this.parseIdent(true)\n};\n\n// Set `ExpressionStatement#directive` property for directive prologues.\npp$8.adaptDirectivePrologue = function(statements) {\n for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {\n statements[i].directive = statements[i].expression.raw.slice(1, -1);\n }\n};\npp$8.isDirectiveCandidate = function(statement) {\n return (\n this.options.ecmaVersion >= 5 &&\n statement.type === \"ExpressionStatement\" &&\n statement.expression.type === \"Literal\" &&\n typeof statement.expression.value === \"string\" &&\n // Reject parenthesized strings.\n (this.input[statement.start] === \"\\\"\" || this.input[statement.start] === \"'\")\n )\n};\n\nvar pp$7 = Parser.prototype;\n\n// Convert existing expression atom to assignable pattern\n// if possible.\n\npp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {\n if (this.options.ecmaVersion >= 6 && node) {\n switch (node.type) {\n case \"Identifier\":\n if (this.inAsync && node.name === \"await\")\n { this.raise(node.start, \"Cannot use 'await' as identifier inside an async function\"); }\n break\n\n case \"ObjectPattern\":\n case \"ArrayPattern\":\n case \"AssignmentPattern\":\n case \"RestElement\":\n break\n\n case \"ObjectExpression\":\n node.type = \"ObjectPattern\";\n if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }\n for (var i = 0, list = node.properties; i < list.length; i += 1) {\n var prop = list[i];\n\n this.toAssignable(prop, isBinding);\n // Early error:\n // AssignmentRestProperty[Yield, Await] :\n // `...` DestructuringAssignmentTarget[Yield, Await]\n //\n // It is a Syntax Error if |DestructuringAssignmentTarget| is an |ArrayLiteral| or an |ObjectLiteral|.\n if (\n prop.type === \"RestElement\" &&\n (prop.argument.type === \"ArrayPattern\" || prop.argument.type === \"ObjectPattern\")\n ) {\n this.raise(prop.argument.start, \"Unexpected token\");\n }\n }\n break\n\n case \"Property\":\n // AssignmentProperty has type === \"Property\"\n if (node.kind !== \"init\") { this.raise(node.key.start, \"Object pattern can't contain getter or setter\"); }\n this.toAssignable(node.value, isBinding);\n break\n\n case \"ArrayExpression\":\n node.type = \"ArrayPattern\";\n if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }\n this.toAssignableList(node.elements, isBinding);\n break\n\n case \"SpreadElement\":\n node.type = \"RestElement\";\n this.toAssignable(node.argument, isBinding);\n if (node.argument.type === \"AssignmentPattern\")\n { this.raise(node.argument.start, \"Rest elements cannot have a default value\"); }\n break\n\n case \"AssignmentExpression\":\n if (node.operator !== \"=\") { this.raise(node.left.end, \"Only '=' operator can be used for specifying default value.\"); }\n node.type = \"AssignmentPattern\";\n delete node.operator;\n this.toAssignable(node.left, isBinding);\n break\n\n case \"ParenthesizedExpression\":\n this.toAssignable(node.expression, isBinding, refDestructuringErrors);\n break\n\n case \"ChainExpression\":\n this.raiseRecoverable(node.start, \"Optional chaining cannot appear in left-hand side\");\n break\n\n case \"MemberExpression\":\n if (!isBinding) { break }\n\n default:\n this.raise(node.start, \"Assigning to rvalue\");\n }\n } else if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }\n return node\n};\n\n// Convert list of expression atoms to binding list.\n\npp$7.toAssignableList = function(exprList, isBinding) {\n var end = exprList.length;\n for (var i = 0; i < end; i++) {\n var elt = exprList[i];\n if (elt) { this.toAssignable(elt, isBinding); }\n }\n if (end) {\n var last = exprList[end - 1];\n if (this.options.ecmaVersion === 6 && isBinding && last && last.type === \"RestElement\" && last.argument.type !== \"Identifier\")\n { this.unexpected(last.argument.start); }\n }\n return exprList\n};\n\n// Parses spread element.\n\npp$7.parseSpread = function(refDestructuringErrors) {\n var node = this.startNode();\n this.next();\n node.argument = this.parseMaybeAssign(false, refDestructuringErrors);\n return this.finishNode(node, \"SpreadElement\")\n};\n\npp$7.parseRestBinding = function() {\n var node = this.startNode();\n this.next();\n\n // RestElement inside of a function parameter must be an identifier\n if (this.options.ecmaVersion === 6 && this.type !== types$1.name)\n { this.unexpected(); }\n\n node.argument = this.parseBindingAtom();\n\n return this.finishNode(node, \"RestElement\")\n};\n\n// Parses lvalue (assignable) atom.\n\npp$7.parseBindingAtom = function() {\n if (this.options.ecmaVersion >= 6) {\n switch (this.type) {\n case types$1.bracketL:\n var node = this.startNode();\n this.next();\n node.elements = this.parseBindingList(types$1.bracketR, true, true);\n return this.finishNode(node, \"ArrayPattern\")\n\n case types$1.braceL:\n return this.parseObj(true)\n }\n }\n return this.parseIdent()\n};\n\npp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowModifiers) {\n var elts = [], first = true;\n while (!this.eat(close)) {\n if (first) { first = false; }\n else { this.expect(types$1.comma); }\n if (allowEmpty && this.type === types$1.comma) {\n elts.push(null);\n } else if (allowTrailingComma && this.afterTrailingComma(close)) {\n break\n } else if (this.type === types$1.ellipsis) {\n var rest = this.parseRestBinding();\n this.parseBindingListItem(rest);\n elts.push(rest);\n if (this.type === types$1.comma) { this.raiseRecoverable(this.start, \"Comma is not permitted after the rest element\"); }\n this.expect(close);\n break\n } else {\n elts.push(this.parseAssignableListItem(allowModifiers));\n }\n }\n return elts\n};\n\npp$7.parseAssignableListItem = function(allowModifiers) {\n var elem = this.parseMaybeDefault(this.start, this.startLoc);\n this.parseBindingListItem(elem);\n return elem\n};\n\npp$7.parseBindingListItem = function(param) {\n return param\n};\n\n// Parses assignment pattern around given atom if possible.\n\npp$7.parseMaybeDefault = function(startPos, startLoc, left) {\n left = left || this.parseBindingAtom();\n if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { return left }\n var node = this.startNodeAt(startPos, startLoc);\n node.left = left;\n node.right = this.parseMaybeAssign();\n return this.finishNode(node, \"AssignmentPattern\")\n};\n\n// The following three functions all verify that a node is an lvalue —\n// something that can be bound, or assigned to. In order to do so, they perform\n// a variety of checks:\n//\n// - Check that none of the bound/assigned-to identifiers are reserved words.\n// - Record name declarations for bindings in the appropriate scope.\n// - Check duplicate argument names, if checkClashes is set.\n//\n// If a complex binding pattern is encountered (e.g., object and array\n// destructuring), the entire pattern is recursively checked.\n//\n// There are three versions of checkLVal*() appropriate for different\n// circumstances:\n//\n// - checkLValSimple() shall be used if the syntactic construct supports\n// nothing other than identifiers and member expressions. Parenthesized\n// expressions are also correctly handled. This is generally appropriate for\n// constructs for which the spec says\n//\n// > It is a Syntax Error if AssignmentTargetType of [the production] is not\n// > simple.\n//\n// It is also appropriate for checking if an identifier is valid and not\n// defined elsewhere, like import declarations or function/class identifiers.\n//\n// Examples where this is used include:\n// a += …;\n// import a from '…';\n// where a is the node to be checked.\n//\n// - checkLValPattern() shall be used if the syntactic construct supports\n// anything checkLValSimple() supports, as well as object and array\n// destructuring patterns. This is generally appropriate for constructs for\n// which the spec says\n//\n// > It is a Syntax Error if [the production] is neither an ObjectLiteral nor\n// > an ArrayLiteral and AssignmentTargetType of [the production] is not\n// > simple.\n//\n// Examples where this is used include:\n// (a = …);\n// const a = …;\n// try { … } catch (a) { … }\n// where a is the node to be checked.\n//\n// - checkLValInnerPattern() shall be used if the syntactic construct supports\n// anything checkLValPattern() supports, as well as default assignment\n// patterns, rest elements, and other constructs that may appear within an\n// object or array destructuring pattern.\n//\n// As a special case, function parameters also use checkLValInnerPattern(),\n// as they also support defaults and rest constructs.\n//\n// These functions deliberately support both assignment and binding constructs,\n// as the logic for both is exceedingly similar. If the node is the target of\n// an assignment, then bindingType should be set to BIND_NONE. Otherwise, it\n// should be set to the appropriate BIND_* constant, like BIND_VAR or\n// BIND_LEXICAL.\n//\n// If the function is called with a non-BIND_NONE bindingType, then\n// additionally a checkClashes object may be specified to allow checking for\n// duplicate argument names. checkClashes is ignored if the provided construct\n// is an assignment (i.e., bindingType is BIND_NONE).\n\npp$7.checkLValSimple = function(expr, bindingType, checkClashes) {\n if ( bindingType === void 0 ) bindingType = BIND_NONE;\n\n var isBind = bindingType !== BIND_NONE;\n\n switch (expr.type) {\n case \"Identifier\":\n if (this.strict && this.reservedWordsStrictBind.test(expr.name))\n { this.raiseRecoverable(expr.start, (isBind ? \"Binding \" : \"Assigning to \") + expr.name + \" in strict mode\"); }\n if (isBind) {\n if (bindingType === BIND_LEXICAL && expr.name === \"let\")\n { this.raiseRecoverable(expr.start, \"let is disallowed as a lexically bound name\"); }\n if (checkClashes) {\n if (hasOwn(checkClashes, expr.name))\n { this.raiseRecoverable(expr.start, \"Argument name clash\"); }\n checkClashes[expr.name] = true;\n }\n if (bindingType !== BIND_OUTSIDE) { this.declareName(expr.name, bindingType, expr.start); }\n }\n break\n\n case \"ChainExpression\":\n this.raiseRecoverable(expr.start, \"Optional chaining cannot appear in left-hand side\");\n break\n\n case \"MemberExpression\":\n if (isBind) { this.raiseRecoverable(expr.start, \"Binding member expression\"); }\n break\n\n case \"ParenthesizedExpression\":\n if (isBind) { this.raiseRecoverable(expr.start, \"Binding parenthesized expression\"); }\n return this.checkLValSimple(expr.expression, bindingType, checkClashes)\n\n default:\n this.raise(expr.start, (isBind ? \"Binding\" : \"Assigning to\") + \" rvalue\");\n }\n};\n\npp$7.checkLValPattern = function(expr, bindingType, checkClashes) {\n if ( bindingType === void 0 ) bindingType = BIND_NONE;\n\n switch (expr.type) {\n case \"ObjectPattern\":\n for (var i = 0, list = expr.properties; i < list.length; i += 1) {\n var prop = list[i];\n\n this.checkLValInnerPattern(prop, bindingType, checkClashes);\n }\n break\n\n case \"ArrayPattern\":\n for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) {\n var elem = list$1[i$1];\n\n if (elem) { this.checkLValInnerPattern(elem, bindingType, checkClashes); }\n }\n break\n\n default:\n this.checkLValSimple(expr, bindingType, checkClashes);\n }\n};\n\npp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {\n if ( bindingType === void 0 ) bindingType = BIND_NONE;\n\n switch (expr.type) {\n case \"Property\":\n // AssignmentProperty has type === \"Property\"\n this.checkLValInnerPattern(expr.value, bindingType, checkClashes);\n break\n\n case \"AssignmentPattern\":\n this.checkLValPattern(expr.left, bindingType, checkClashes);\n break\n\n case \"RestElement\":\n this.checkLValPattern(expr.argument, bindingType, checkClashes);\n break\n\n default:\n this.checkLValPattern(expr, bindingType, checkClashes);\n }\n};\n\n// The algorithm used to determine whether a regexp can appear at a\n// given point in the program is loosely based on sweet.js' approach.\n// See https://github.com/mozilla/sweet.js/wiki/design\n\n\nvar TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {\n this.token = token;\n this.isExpr = !!isExpr;\n this.preserveSpace = !!preserveSpace;\n this.override = override;\n this.generator = !!generator;\n};\n\nvar types = {\n b_stat: new TokContext(\"{\", false),\n b_expr: new TokContext(\"{\", true),\n b_tmpl: new TokContext(\"${\", false),\n p_stat: new TokContext(\"(\", false),\n p_expr: new TokContext(\"(\", true),\n q_tmpl: new TokContext(\"`\", true, true, function (p) { return p.tryReadTemplateToken(); }),\n f_stat: new TokContext(\"function\", false),\n f_expr: new TokContext(\"function\", true),\n f_expr_gen: new TokContext(\"function\", true, false, null, true),\n f_gen: new TokContext(\"function\", false, false, null, true)\n};\n\nvar pp$6 = Parser.prototype;\n\npp$6.initialContext = function() {\n return [types.b_stat]\n};\n\npp$6.curContext = function() {\n return this.context[this.context.length - 1]\n};\n\npp$6.braceIsBlock = function(prevType) {\n var parent = this.curContext();\n if (parent === types.f_expr || parent === types.f_stat)\n { return true }\n if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr))\n { return !parent.isExpr }\n\n // The check for `tt.name && exprAllowed` detects whether we are\n // after a `yield` or `of` construct. See the `updateContext` for\n // `tt.name`.\n if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed)\n { return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }\n if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow)\n { return true }\n if (prevType === types$1.braceL)\n { return parent === types.b_stat }\n if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name)\n { return false }\n return !this.exprAllowed\n};\n\npp$6.inGeneratorContext = function() {\n for (var i = this.context.length - 1; i >= 1; i--) {\n var context = this.context[i];\n if (context.token === \"function\")\n { return context.generator }\n }\n return false\n};\n\npp$6.updateContext = function(prevType) {\n var update, type = this.type;\n if (type.keyword && prevType === types$1.dot)\n { this.exprAllowed = false; }\n else if (update = type.updateContext)\n { update.call(this, prevType); }\n else\n { this.exprAllowed = type.beforeExpr; }\n};\n\n// Used to handle edge cases when token context could not be inferred correctly during tokenization phase\n\npp$6.overrideContext = function(tokenCtx) {\n if (this.curContext() !== tokenCtx) {\n this.context[this.context.length - 1] = tokenCtx;\n }\n};\n\n// Token-specific context update code\n\ntypes$1.parenR.updateContext = types$1.braceR.updateContext = function() {\n if (this.context.length === 1) {\n this.exprAllowed = true;\n return\n }\n var out = this.context.pop();\n if (out === types.b_stat && this.curContext().token === \"function\") {\n out = this.context.pop();\n }\n this.exprAllowed = !out.isExpr;\n};\n\ntypes$1.braceL.updateContext = function(prevType) {\n this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr);\n this.exprAllowed = true;\n};\n\ntypes$1.dollarBraceL.updateContext = function() {\n this.context.push(types.b_tmpl);\n this.exprAllowed = true;\n};\n\ntypes$1.parenL.updateContext = function(prevType) {\n var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while;\n this.context.push(statementParens ? types.p_stat : types.p_expr);\n this.exprAllowed = true;\n};\n\ntypes$1.incDec.updateContext = function() {\n // tokExprAllowed stays unchanged\n};\n\ntypes$1._function.updateContext = types$1._class.updateContext = function(prevType) {\n if (prevType.beforeExpr && prevType !== types$1._else &&\n !(prevType === types$1.semi && this.curContext() !== types.p_stat) &&\n !(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&\n !((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat))\n { this.context.push(types.f_expr); }\n else\n { this.context.push(types.f_stat); }\n this.exprAllowed = false;\n};\n\ntypes$1.colon.updateContext = function() {\n if (this.curContext().token === \"function\") { this.context.pop(); }\n this.exprAllowed = true;\n};\n\ntypes$1.backQuote.updateContext = function() {\n if (this.curContext() === types.q_tmpl)\n { this.context.pop(); }\n else\n { this.context.push(types.q_tmpl); }\n this.exprAllowed = false;\n};\n\ntypes$1.star.updateContext = function(prevType) {\n if (prevType === types$1._function) {\n var index = this.context.length - 1;\n if (this.context[index] === types.f_expr)\n { this.context[index] = types.f_expr_gen; }\n else\n { this.context[index] = types.f_gen; }\n }\n this.exprAllowed = true;\n};\n\ntypes$1.name.updateContext = function(prevType) {\n var allowed = false;\n if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) {\n if (this.value === \"of\" && !this.exprAllowed ||\n this.value === \"yield\" && this.inGeneratorContext())\n { allowed = true; }\n }\n this.exprAllowed = allowed;\n};\n\n// A recursive descent parser operates by defining functions for all\n// syntactic elements, and recursively calling those, each function\n// advancing the input stream and returning an AST node. Precedence\n// of constructs (for example, the fact that `!x[1]` means `!(x[1])`\n// instead of `(!x)[1]` is handled by the fact that the parser\n// function that parses unary prefix operators is called first, and\n// in turn calls the function that parses `[]` subscripts — that\n// way, it'll receive the node for `x[1]` already parsed, and wraps\n// *that* in the unary operator node.\n//\n// Acorn uses an [operator precedence parser][opp] to handle binary\n// operator precedence, because it is much more compact than using\n// the technique outlined above, which uses different, nesting\n// functions to specify precedence, for all of the ten binary\n// precedence levels that JavaScript defines.\n//\n// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser\n\n\nvar pp$5 = Parser.prototype;\n\n// Check if property name clashes with already added.\n// Object/class getters and setters are not allowed to clash —\n// either with each other or with an init property — and in\n// strict mode, init properties are also not allowed to be repeated.\n\npp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {\n if (this.options.ecmaVersion >= 9 && prop.type === \"SpreadElement\")\n { return }\n if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))\n { return }\n var key = prop.key;\n var name;\n switch (key.type) {\n case \"Identifier\": name = key.name; break\n case \"Literal\": name = String(key.value); break\n default: return\n }\n var kind = prop.kind;\n if (this.options.ecmaVersion >= 6) {\n if (name === \"__proto__\" && kind === \"init\") {\n if (propHash.proto) {\n if (refDestructuringErrors) {\n if (refDestructuringErrors.doubleProto < 0) {\n refDestructuringErrors.doubleProto = key.start;\n }\n } else {\n this.raiseRecoverable(key.start, \"Redefinition of __proto__ property\");\n }\n }\n propHash.proto = true;\n }\n return\n }\n name = \"$\" + name;\n var other = propHash[name];\n if (other) {\n var redefinition;\n if (kind === \"init\") {\n redefinition = this.strict && other.init || other.get || other.set;\n } else {\n redefinition = other.init || other[kind];\n }\n if (redefinition)\n { this.raiseRecoverable(key.start, \"Redefinition of property\"); }\n } else {\n other = propHash[name] = {\n init: false,\n get: false,\n set: false\n };\n }\n other[kind] = true;\n};\n\n// ### Expression parsing\n\n// These nest, from the most general expression type at the top to\n// 'atomic', nondivisible expression types at the bottom. Most of\n// the functions will simply let the function(s) below them parse,\n// and, *if* the syntactic construct they handle is present, wrap\n// the AST node that the inner parser gave them in another node.\n\n// Parse a full expression. The optional arguments are used to\n// forbid the `in` operator (in for loops initalization expressions)\n// and provide reference for storing '=' operator inside shorthand\n// property assignment in contexts where both object expression\n// and object pattern might appear (so it's possible to raise\n// delayed syntax error at correct position).\n\npp$5.parseExpression = function(forInit, refDestructuringErrors) {\n var startPos = this.start, startLoc = this.startLoc;\n var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);\n if (this.type === types$1.comma) {\n var node = this.startNodeAt(startPos, startLoc);\n node.expressions = [expr];\n while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }\n return this.finishNode(node, \"SequenceExpression\")\n }\n return expr\n};\n\n// Parse an assignment expression. This includes applications of\n// operators like `+=`.\n\npp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {\n if (this.isContextual(\"yield\")) {\n if (this.inGenerator) { return this.parseYield(forInit) }\n // The tokenizer will assume an expression is allowed after\n // `yield`, but this isn't that kind of yield\n else { this.exprAllowed = false; }\n }\n\n var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1;\n if (refDestructuringErrors) {\n oldParenAssign = refDestructuringErrors.parenthesizedAssign;\n oldTrailingComma = refDestructuringErrors.trailingComma;\n oldDoubleProto = refDestructuringErrors.doubleProto;\n refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;\n } else {\n refDestructuringErrors = new DestructuringErrors;\n ownDestructuringErrors = true;\n }\n\n var startPos = this.start, startLoc = this.startLoc;\n if (this.type === types$1.parenL || this.type === types$1.name) {\n this.potentialArrowAt = this.start;\n this.potentialArrowInForAwait = forInit === \"await\";\n }\n var left = this.parseMaybeConditional(forInit, refDestructuringErrors);\n if (afterLeftParse) { left = afterLeftParse.call(this, left, startPos, startLoc); }\n if (this.type.isAssign) {\n var node = this.startNodeAt(startPos, startLoc);\n node.operator = this.value;\n if (this.type === types$1.eq)\n { left = this.toAssignable(left, false, refDestructuringErrors); }\n if (!ownDestructuringErrors) {\n refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;\n }\n if (refDestructuringErrors.shorthandAssign >= left.start)\n { refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly\n if (this.type === types$1.eq)\n { this.checkLValPattern(left); }\n else\n { this.checkLValSimple(left); }\n node.left = left;\n this.next();\n node.right = this.parseMaybeAssign(forInit);\n if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; }\n return this.finishNode(node, \"AssignmentExpression\")\n } else {\n if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }\n }\n if (oldParenAssign > -1) { refDestructuringErrors.parenthesizedAssign = oldParenAssign; }\n if (oldTrailingComma > -1) { refDestructuringErrors.trailingComma = oldTrailingComma; }\n return left\n};\n\n// Parse a ternary conditional (`?:`) operator.\n\npp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {\n var startPos = this.start, startLoc = this.startLoc;\n var expr = this.parseExprOps(forInit, refDestructuringErrors);\n if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }\n if (this.eat(types$1.question)) {\n var node = this.startNodeAt(startPos, startLoc);\n node.test = expr;\n node.consequent = this.parseMaybeAssign();\n this.expect(types$1.colon);\n node.alternate = this.parseMaybeAssign(forInit);\n return this.finishNode(node, \"ConditionalExpression\")\n }\n return expr\n};\n\n// Start the precedence parser.\n\npp$5.parseExprOps = function(forInit, refDestructuringErrors) {\n var startPos = this.start, startLoc = this.startLoc;\n var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit);\n if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }\n return expr.start === startPos && expr.type === \"ArrowFunctionExpression\" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, forInit)\n};\n\n// Parse binary operators with the operator precedence parsing\n// algorithm. `left` is the left-hand side of the operator.\n// `minPrec` provides context that allows the function to stop and\n// defer further parser to one of its callers when it encounters an\n// operator that has a lower precedence than the set it is parsing.\n\npp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {\n var prec = this.type.binop;\n if (prec != null && (!forInit || this.type !== types$1._in)) {\n if (prec > minPrec) {\n var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND;\n var coalesce = this.type === types$1.coalesce;\n if (coalesce) {\n // Handle the precedence of `tt.coalesce` as equal to the range of logical expressions.\n // In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error.\n prec = types$1.logicalAND.binop;\n }\n var op = this.value;\n this.next();\n var startPos = this.start, startLoc = this.startLoc;\n var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit);\n var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);\n if ((logical && this.type === types$1.coalesce) || (coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND))) {\n this.raiseRecoverable(this.start, \"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses\");\n }\n return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit)\n }\n }\n return left\n};\n\npp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) {\n if (right.type === \"PrivateIdentifier\") { this.raise(right.start, \"Private identifier can only be left side of binary expression\"); }\n var node = this.startNodeAt(startPos, startLoc);\n node.left = left;\n node.operator = op;\n node.right = right;\n return this.finishNode(node, logical ? \"LogicalExpression\" : \"BinaryExpression\")\n};\n\n// Parse unary operators, both prefix and postfix.\n\npp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {\n var startPos = this.start, startLoc = this.startLoc, expr;\n if (this.isContextual(\"await\") && this.canAwait) {\n expr = this.parseAwait(forInit);\n sawUnary = true;\n } else if (this.type.prefix) {\n var node = this.startNode(), update = this.type === types$1.incDec;\n node.operator = this.value;\n node.prefix = true;\n this.next();\n node.argument = this.parseMaybeUnary(null, true, update, forInit);\n this.checkExpressionErrors(refDestructuringErrors, true);\n if (update) { this.checkLValSimple(node.argument); }\n else if (this.strict && node.operator === \"delete\" && isLocalVariableAccess(node.argument))\n { this.raiseRecoverable(node.start, \"Deleting local variable in strict mode\"); }\n else if (node.operator === \"delete\" && isPrivateFieldAccess(node.argument))\n { this.raiseRecoverable(node.start, \"Private fields can not be deleted\"); }\n else { sawUnary = true; }\n expr = this.finishNode(node, update ? \"UpdateExpression\" : \"UnaryExpression\");\n } else if (!sawUnary && this.type === types$1.privateId) {\n if ((forInit || this.privateNameStack.length === 0) && this.options.checkPrivateFields) { this.unexpected(); }\n expr = this.parsePrivateIdent();\n // only could be private fields in 'in', such as #x in obj\n if (this.type !== types$1._in) { this.unexpected(); }\n } else {\n expr = this.parseExprSubscripts(refDestructuringErrors, forInit);\n if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }\n while (this.type.postfix && !this.canInsertSemicolon()) {\n var node$1 = this.startNodeAt(startPos, startLoc);\n node$1.operator = this.value;\n node$1.prefix = false;\n node$1.argument = expr;\n this.checkLValSimple(expr);\n this.next();\n expr = this.finishNode(node$1, \"UpdateExpression\");\n }\n }\n\n if (!incDec && this.eat(types$1.starstar)) {\n if (sawUnary)\n { this.unexpected(this.lastTokStart); }\n else\n { return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false, false, forInit), \"**\", false) }\n } else {\n return expr\n }\n};\n\nfunction isLocalVariableAccess(node) {\n return (\n node.type === \"Identifier\" ||\n node.type === \"ParenthesizedExpression\" && isLocalVariableAccess(node.expression)\n )\n}\n\nfunction isPrivateFieldAccess(node) {\n return (\n node.type === \"MemberExpression\" && node.property.type === \"PrivateIdentifier\" ||\n node.type === \"ChainExpression\" && isPrivateFieldAccess(node.expression) ||\n node.type === \"ParenthesizedExpression\" && isPrivateFieldAccess(node.expression)\n )\n}\n\n// Parse call, dot, and `[]`-subscript expressions.\n\npp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {\n var startPos = this.start, startLoc = this.startLoc;\n var expr = this.parseExprAtom(refDestructuringErrors, forInit);\n if (expr.type === \"ArrowFunctionExpression\" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== \")\")\n { return expr }\n var result = this.parseSubscripts(expr, startPos, startLoc, false, forInit);\n if (refDestructuringErrors && result.type === \"MemberExpression\") {\n if (refDestructuringErrors.parenthesizedAssign >= result.start) { refDestructuringErrors.parenthesizedAssign = -1; }\n if (refDestructuringErrors.parenthesizedBind >= result.start) { refDestructuringErrors.parenthesizedBind = -1; }\n if (refDestructuringErrors.trailingComma >= result.start) { refDestructuringErrors.trailingComma = -1; }\n }\n return result\n};\n\npp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {\n var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === \"Identifier\" && base.name === \"async\" &&\n this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 &&\n this.potentialArrowAt === base.start;\n var optionalChained = false;\n\n while (true) {\n var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit);\n\n if (element.optional) { optionalChained = true; }\n if (element === base || element.type === \"ArrowFunctionExpression\") {\n if (optionalChained) {\n var chainNode = this.startNodeAt(startPos, startLoc);\n chainNode.expression = element;\n element = this.finishNode(chainNode, \"ChainExpression\");\n }\n return element\n }\n\n base = element;\n }\n};\n\npp$5.shouldParseAsyncArrow = function() {\n return !this.canInsertSemicolon() && this.eat(types$1.arrow)\n};\n\npp$5.parseSubscriptAsyncArrow = function(startPos, startLoc, exprList, forInit) {\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit)\n};\n\npp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {\n var optionalSupported = this.options.ecmaVersion >= 11;\n var optional = optionalSupported && this.eat(types$1.questionDot);\n if (noCalls && optional) { this.raise(this.lastTokStart, \"Optional chaining cannot appear in the callee of new expressions\"); }\n\n var computed = this.eat(types$1.bracketL);\n if (computed || (optional && this.type !== types$1.parenL && this.type !== types$1.backQuote) || this.eat(types$1.dot)) {\n var node = this.startNodeAt(startPos, startLoc);\n node.object = base;\n if (computed) {\n node.property = this.parseExpression();\n this.expect(types$1.bracketR);\n } else if (this.type === types$1.privateId && base.type !== \"Super\") {\n node.property = this.parsePrivateIdent();\n } else {\n node.property = this.parseIdent(this.options.allowReserved !== \"never\");\n }\n node.computed = !!computed;\n if (optionalSupported) {\n node.optional = optional;\n }\n base = this.finishNode(node, \"MemberExpression\");\n } else if (!noCalls && this.eat(types$1.parenL)) {\n var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;\n this.yieldPos = 0;\n this.awaitPos = 0;\n this.awaitIdentPos = 0;\n var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);\n if (maybeAsyncArrow && !optional && this.shouldParseAsyncArrow()) {\n this.checkPatternErrors(refDestructuringErrors, false);\n this.checkYieldAwaitInDefaultParams();\n if (this.awaitIdentPos > 0)\n { this.raise(this.awaitIdentPos, \"Cannot use 'await' as identifier inside an async function\"); }\n this.yieldPos = oldYieldPos;\n this.awaitPos = oldAwaitPos;\n this.awaitIdentPos = oldAwaitIdentPos;\n return this.parseSubscriptAsyncArrow(startPos, startLoc, exprList, forInit)\n }\n this.checkExpressionErrors(refDestructuringErrors, true);\n this.yieldPos = oldYieldPos || this.yieldPos;\n this.awaitPos = oldAwaitPos || this.awaitPos;\n this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos;\n var node$1 = this.startNodeAt(startPos, startLoc);\n node$1.callee = base;\n node$1.arguments = exprList;\n if (optionalSupported) {\n node$1.optional = optional;\n }\n base = this.finishNode(node$1, \"CallExpression\");\n } else if (this.type === types$1.backQuote) {\n if (optional || optionalChained) {\n this.raise(this.start, \"Optional chaining cannot appear in the tag of tagged template expressions\");\n }\n var node$2 = this.startNodeAt(startPos, startLoc);\n node$2.tag = base;\n node$2.quasi = this.parseTemplate({isTagged: true});\n base = this.finishNode(node$2, \"TaggedTemplateExpression\");\n }\n return base\n};\n\n// Parse an atomic expression — either a single token that is an\n// expression, an expression started by a keyword like `function` or\n// `new`, or an expression wrapped in punctuation like `()`, `[]`,\n// or `{}`.\n\npp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) {\n // If a division operator appears in an expression position, the\n // tokenizer got confused, and we force it to read a regexp instead.\n if (this.type === types$1.slash) { this.readRegexp(); }\n\n var node, canBeArrow = this.potentialArrowAt === this.start;\n switch (this.type) {\n case types$1._super:\n if (!this.allowSuper)\n { this.raise(this.start, \"'super' keyword outside a method\"); }\n node = this.startNode();\n this.next();\n if (this.type === types$1.parenL && !this.allowDirectSuper)\n { this.raise(node.start, \"super() call outside constructor of a subclass\"); }\n // The `super` keyword can appear at below:\n // SuperProperty:\n // super [ Expression ]\n // super . IdentifierName\n // SuperCall:\n // super ( Arguments )\n if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL)\n { this.unexpected(); }\n return this.finishNode(node, \"Super\")\n\n case types$1._this:\n node = this.startNode();\n this.next();\n return this.finishNode(node, \"ThisExpression\")\n\n case types$1.name:\n var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;\n var id = this.parseIdent(false);\n if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === \"async\" && !this.canInsertSemicolon() && this.eat(types$1._function)) {\n this.overrideContext(types.f_expr);\n return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit)\n }\n if (canBeArrow && !this.canInsertSemicolon()) {\n if (this.eat(types$1.arrow))\n { return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit) }\n if (this.options.ecmaVersion >= 8 && id.name === \"async\" && this.type === types$1.name && !containsEsc &&\n (!this.potentialArrowInForAwait || this.value !== \"of\" || this.containsEsc)) {\n id = this.parseIdent(false);\n if (this.canInsertSemicolon() || !this.eat(types$1.arrow))\n { this.unexpected(); }\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit)\n }\n }\n return id\n\n case types$1.regexp:\n var value = this.value;\n node = this.parseLiteral(value.value);\n node.regex = {pattern: value.pattern, flags: value.flags};\n return node\n\n case types$1.num: case types$1.string:\n return this.parseLiteral(this.value)\n\n case types$1._null: case types$1._true: case types$1._false:\n node = this.startNode();\n node.value = this.type === types$1._null ? null : this.type === types$1._true;\n node.raw = this.type.keyword;\n this.next();\n return this.finishNode(node, \"Literal\")\n\n case types$1.parenL:\n var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);\n if (refDestructuringErrors) {\n if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))\n { refDestructuringErrors.parenthesizedAssign = start; }\n if (refDestructuringErrors.parenthesizedBind < 0)\n { refDestructuringErrors.parenthesizedBind = start; }\n }\n return expr\n\n case types$1.bracketL:\n node = this.startNode();\n this.next();\n node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);\n return this.finishNode(node, \"ArrayExpression\")\n\n case types$1.braceL:\n this.overrideContext(types.b_expr);\n return this.parseObj(false, refDestructuringErrors)\n\n case types$1._function:\n node = this.startNode();\n this.next();\n return this.parseFunction(node, 0)\n\n case types$1._class:\n return this.parseClass(this.startNode(), false)\n\n case types$1._new:\n return this.parseNew()\n\n case types$1.backQuote:\n return this.parseTemplate()\n\n case types$1._import:\n if (this.options.ecmaVersion >= 11) {\n return this.parseExprImport(forNew)\n } else {\n return this.unexpected()\n }\n\n default:\n return this.parseExprAtomDefault()\n }\n};\n\npp$5.parseExprAtomDefault = function() {\n this.unexpected();\n};\n\npp$5.parseExprImport = function(forNew) {\n var node = this.startNode();\n\n // Consume `import` as an identifier for `import.meta`.\n // Because `this.parseIdent(true)` doesn't check escape sequences, it needs the check of `this.containsEsc`.\n if (this.containsEsc) { this.raiseRecoverable(this.start, \"Escape sequence in keyword import\"); }\n this.next();\n\n if (this.type === types$1.parenL && !forNew) {\n return this.parseDynamicImport(node)\n } else if (this.type === types$1.dot) {\n var meta = this.startNodeAt(node.start, node.loc && node.loc.start);\n meta.name = \"import\";\n node.meta = this.finishNode(meta, \"Identifier\");\n return this.parseImportMeta(node)\n } else {\n this.unexpected();\n }\n};\n\npp$5.parseDynamicImport = function(node) {\n this.next(); // skip `(`\n\n // Parse node.source.\n node.source = this.parseMaybeAssign();\n\n if (this.options.ecmaVersion >= 16) {\n if (!this.eat(types$1.parenR)) {\n this.expect(types$1.comma);\n if (!this.afterTrailingComma(types$1.parenR)) {\n node.options = this.parseMaybeAssign();\n if (!this.eat(types$1.parenR)) {\n this.expect(types$1.comma);\n if (!this.afterTrailingComma(types$1.parenR)) {\n this.unexpected();\n }\n }\n } else {\n node.options = null;\n }\n } else {\n node.options = null;\n }\n } else {\n // Verify ending.\n if (!this.eat(types$1.parenR)) {\n var errorPos = this.start;\n if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {\n this.raiseRecoverable(errorPos, \"Trailing comma is not allowed in import()\");\n } else {\n this.unexpected(errorPos);\n }\n }\n }\n\n return this.finishNode(node, \"ImportExpression\")\n};\n\npp$5.parseImportMeta = function(node) {\n this.next(); // skip `.`\n\n var containsEsc = this.containsEsc;\n node.property = this.parseIdent(true);\n\n if (node.property.name !== \"meta\")\n { this.raiseRecoverable(node.property.start, \"The only valid meta property for import is 'import.meta'\"); }\n if (containsEsc)\n { this.raiseRecoverable(node.start, \"'import.meta' must not contain escaped characters\"); }\n if (this.options.sourceType !== \"module\" && !this.options.allowImportExportEverywhere)\n { this.raiseRecoverable(node.start, \"Cannot use 'import.meta' outside a module\"); }\n\n return this.finishNode(node, \"MetaProperty\")\n};\n\npp$5.parseLiteral = function(value) {\n var node = this.startNode();\n node.value = value;\n node.raw = this.input.slice(this.start, this.end);\n if (node.raw.charCodeAt(node.raw.length - 1) === 110)\n { node.bigint = node.value != null ? node.value.toString() : node.raw.slice(0, -1).replace(/_/g, \"\"); }\n this.next();\n return this.finishNode(node, \"Literal\")\n};\n\npp$5.parseParenExpression = function() {\n this.expect(types$1.parenL);\n var val = this.parseExpression();\n this.expect(types$1.parenR);\n return val\n};\n\npp$5.shouldParseArrow = function(exprList) {\n return !this.canInsertSemicolon()\n};\n\npp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {\n var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;\n if (this.options.ecmaVersion >= 6) {\n this.next();\n\n var innerStartPos = this.start, innerStartLoc = this.startLoc;\n var exprList = [], first = true, lastIsComma = false;\n var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart;\n this.yieldPos = 0;\n this.awaitPos = 0;\n // Do not save awaitIdentPos to allow checking awaits nested in parameters\n while (this.type !== types$1.parenR) {\n first ? first = false : this.expect(types$1.comma);\n if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) {\n lastIsComma = true;\n break\n } else if (this.type === types$1.ellipsis) {\n spreadStart = this.start;\n exprList.push(this.parseParenItem(this.parseRestBinding()));\n if (this.type === types$1.comma) {\n this.raiseRecoverable(\n this.start,\n \"Comma is not permitted after the rest element\"\n );\n }\n break\n } else {\n exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));\n }\n }\n var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;\n this.expect(types$1.parenR);\n\n if (canBeArrow && this.shouldParseArrow(exprList) && this.eat(types$1.arrow)) {\n this.checkPatternErrors(refDestructuringErrors, false);\n this.checkYieldAwaitInDefaultParams();\n this.yieldPos = oldYieldPos;\n this.awaitPos = oldAwaitPos;\n return this.parseParenArrowList(startPos, startLoc, exprList, forInit)\n }\n\n if (!exprList.length || lastIsComma) { this.unexpected(this.lastTokStart); }\n if (spreadStart) { this.unexpected(spreadStart); }\n this.checkExpressionErrors(refDestructuringErrors, true);\n this.yieldPos = oldYieldPos || this.yieldPos;\n this.awaitPos = oldAwaitPos || this.awaitPos;\n\n if (exprList.length > 1) {\n val = this.startNodeAt(innerStartPos, innerStartLoc);\n val.expressions = exprList;\n this.finishNodeAt(val, \"SequenceExpression\", innerEndPos, innerEndLoc);\n } else {\n val = exprList[0];\n }\n } else {\n val = this.parseParenExpression();\n }\n\n if (this.options.preserveParens) {\n var par = this.startNodeAt(startPos, startLoc);\n par.expression = val;\n return this.finishNode(par, \"ParenthesizedExpression\")\n } else {\n return val\n }\n};\n\npp$5.parseParenItem = function(item) {\n return item\n};\n\npp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit)\n};\n\n// New's precedence is slightly tricky. It must allow its argument to\n// be a `[]` or dot subscript expression, but not a call — at least,\n// not without wrapping it in parentheses. Thus, it uses the noCalls\n// argument to parseSubscripts to prevent it from consuming the\n// argument list.\n\nvar empty = [];\n\npp$5.parseNew = function() {\n if (this.containsEsc) { this.raiseRecoverable(this.start, \"Escape sequence in keyword new\"); }\n var node = this.startNode();\n this.next();\n if (this.options.ecmaVersion >= 6 && this.type === types$1.dot) {\n var meta = this.startNodeAt(node.start, node.loc && node.loc.start);\n meta.name = \"new\";\n node.meta = this.finishNode(meta, \"Identifier\");\n this.next();\n var containsEsc = this.containsEsc;\n node.property = this.parseIdent(true);\n if (node.property.name !== \"target\")\n { this.raiseRecoverable(node.property.start, \"The only valid meta property for new is 'new.target'\"); }\n if (containsEsc)\n { this.raiseRecoverable(node.start, \"'new.target' must not contain escaped characters\"); }\n if (!this.allowNewDotTarget)\n { this.raiseRecoverable(node.start, \"'new.target' can only be used in functions and class static block\"); }\n return this.finishNode(node, \"MetaProperty\")\n }\n var startPos = this.start, startLoc = this.startLoc;\n node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);\n if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }\n else { node.arguments = empty; }\n return this.finishNode(node, \"NewExpression\")\n};\n\n// Parse template expression.\n\npp$5.parseTemplateElement = function(ref) {\n var isTagged = ref.isTagged;\n\n var elem = this.startNode();\n if (this.type === types$1.invalidTemplate) {\n if (!isTagged) {\n this.raiseRecoverable(this.start, \"Bad escape sequence in untagged template literal\");\n }\n elem.value = {\n raw: this.value.replace(/\\r\\n?/g, \"\\n\"),\n cooked: null\n };\n } else {\n elem.value = {\n raw: this.input.slice(this.start, this.end).replace(/\\r\\n?/g, \"\\n\"),\n cooked: this.value\n };\n }\n this.next();\n elem.tail = this.type === types$1.backQuote;\n return this.finishNode(elem, \"TemplateElement\")\n};\n\npp$5.parseTemplate = function(ref) {\n if ( ref === void 0 ) ref = {};\n var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false;\n\n var node = this.startNode();\n this.next();\n node.expressions = [];\n var curElt = this.parseTemplateElement({isTagged: isTagged});\n node.quasis = [curElt];\n while (!curElt.tail) {\n if (this.type === types$1.eof) { this.raise(this.pos, \"Unterminated template literal\"); }\n this.expect(types$1.dollarBraceL);\n node.expressions.push(this.parseExpression());\n this.expect(types$1.braceR);\n node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged}));\n }\n this.next();\n return this.finishNode(node, \"TemplateLiteral\")\n};\n\npp$5.isAsyncProp = function(prop) {\n return !prop.computed && prop.key.type === \"Identifier\" && prop.key.name === \"async\" &&\n (this.type === types$1.name || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types$1.star)) &&\n !lineBreak.test(this.input.slice(this.lastTokEnd, this.start))\n};\n\n// Parse an object literal or binding pattern.\n\npp$5.parseObj = function(isPattern, refDestructuringErrors) {\n var node = this.startNode(), first = true, propHash = {};\n node.properties = [];\n this.next();\n while (!this.eat(types$1.braceR)) {\n if (!first) {\n this.expect(types$1.comma);\n if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { break }\n } else { first = false; }\n\n var prop = this.parseProperty(isPattern, refDestructuringErrors);\n if (!isPattern) { this.checkPropClash(prop, propHash, refDestructuringErrors); }\n node.properties.push(prop);\n }\n return this.finishNode(node, isPattern ? \"ObjectPattern\" : \"ObjectExpression\")\n};\n\npp$5.parseProperty = function(isPattern, refDestructuringErrors) {\n var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;\n if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) {\n if (isPattern) {\n prop.argument = this.parseIdent(false);\n if (this.type === types$1.comma) {\n this.raiseRecoverable(this.start, \"Comma is not permitted after the rest element\");\n }\n return this.finishNode(prop, \"RestElement\")\n }\n // Parse argument.\n prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);\n // To disallow trailing comma via `this.toAssignable()`.\n if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {\n refDestructuringErrors.trailingComma = this.start;\n }\n // Finish\n return this.finishNode(prop, \"SpreadElement\")\n }\n if (this.options.ecmaVersion >= 6) {\n prop.method = false;\n prop.shorthand = false;\n if (isPattern || refDestructuringErrors) {\n startPos = this.start;\n startLoc = this.startLoc;\n }\n if (!isPattern)\n { isGenerator = this.eat(types$1.star); }\n }\n var containsEsc = this.containsEsc;\n this.parsePropertyName(prop);\n if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {\n isAsync = true;\n isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star);\n this.parsePropertyName(prop);\n } else {\n isAsync = false;\n }\n this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc);\n return this.finishNode(prop, \"Property\")\n};\n\npp$5.parseGetterSetter = function(prop) {\n var kind = prop.key.name;\n this.parsePropertyName(prop);\n prop.value = this.parseMethod(false);\n prop.kind = kind;\n var paramCount = prop.kind === \"get\" ? 0 : 1;\n if (prop.value.params.length !== paramCount) {\n var start = prop.value.start;\n if (prop.kind === \"get\")\n { this.raiseRecoverable(start, \"getter should have no params\"); }\n else\n { this.raiseRecoverable(start, \"setter should have exactly one param\"); }\n } else {\n if (prop.kind === \"set\" && prop.value.params[0].type === \"RestElement\")\n { this.raiseRecoverable(prop.value.params[0].start, \"Setter cannot use rest params\"); }\n }\n};\n\npp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {\n if ((isGenerator || isAsync) && this.type === types$1.colon)\n { this.unexpected(); }\n\n if (this.eat(types$1.colon)) {\n prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);\n prop.kind = \"init\";\n } else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) {\n if (isPattern) { this.unexpected(); }\n prop.method = true;\n prop.value = this.parseMethod(isGenerator, isAsync);\n prop.kind = \"init\";\n } else if (!isPattern && !containsEsc &&\n this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === \"Identifier\" &&\n (prop.key.name === \"get\" || prop.key.name === \"set\") &&\n (this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {\n if (isGenerator || isAsync) { this.unexpected(); }\n this.parseGetterSetter(prop);\n } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === \"Identifier\") {\n if (isGenerator || isAsync) { this.unexpected(); }\n this.checkUnreserved(prop.key);\n if (prop.key.name === \"await\" && !this.awaitIdentPos)\n { this.awaitIdentPos = startPos; }\n if (isPattern) {\n prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));\n } else if (this.type === types$1.eq && refDestructuringErrors) {\n if (refDestructuringErrors.shorthandAssign < 0)\n { refDestructuringErrors.shorthandAssign = this.start; }\n prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));\n } else {\n prop.value = this.copyNode(prop.key);\n }\n prop.kind = \"init\";\n prop.shorthand = true;\n } else { this.unexpected(); }\n};\n\npp$5.parsePropertyName = function(prop) {\n if (this.options.ecmaVersion >= 6) {\n if (this.eat(types$1.bracketL)) {\n prop.computed = true;\n prop.key = this.parseMaybeAssign();\n this.expect(types$1.bracketR);\n return prop.key\n } else {\n prop.computed = false;\n }\n }\n return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== \"never\")\n};\n\n// Initialize empty function node.\n\npp$5.initFunction = function(node) {\n node.id = null;\n if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; }\n if (this.options.ecmaVersion >= 8) { node.async = false; }\n};\n\n// Parse object or class method.\n\npp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {\n var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;\n\n this.initFunction(node);\n if (this.options.ecmaVersion >= 6)\n { node.generator = isGenerator; }\n if (this.options.ecmaVersion >= 8)\n { node.async = !!isAsync; }\n\n this.yieldPos = 0;\n this.awaitPos = 0;\n this.awaitIdentPos = 0;\n this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));\n\n this.expect(types$1.parenL);\n node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);\n this.checkYieldAwaitInDefaultParams();\n this.parseFunctionBody(node, false, true, false);\n\n this.yieldPos = oldYieldPos;\n this.awaitPos = oldAwaitPos;\n this.awaitIdentPos = oldAwaitIdentPos;\n return this.finishNode(node, \"FunctionExpression\")\n};\n\n// Parse arrow function expression with given parameters.\n\npp$5.parseArrowExpression = function(node, params, isAsync, forInit) {\n var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;\n\n this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);\n this.initFunction(node);\n if (this.options.ecmaVersion >= 8) { node.async = !!isAsync; }\n\n this.yieldPos = 0;\n this.awaitPos = 0;\n this.awaitIdentPos = 0;\n\n node.params = this.toAssignableList(params, true);\n this.parseFunctionBody(node, true, false, forInit);\n\n this.yieldPos = oldYieldPos;\n this.awaitPos = oldAwaitPos;\n this.awaitIdentPos = oldAwaitIdentPos;\n return this.finishNode(node, \"ArrowFunctionExpression\")\n};\n\n// Parse function body and check parameters.\n\npp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {\n var isExpression = isArrowFunction && this.type !== types$1.braceL;\n var oldStrict = this.strict, useStrict = false;\n\n if (isExpression) {\n node.body = this.parseMaybeAssign(forInit);\n node.expression = true;\n this.checkParams(node, false);\n } else {\n var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params);\n if (!oldStrict || nonSimple) {\n useStrict = this.strictDirective(this.end);\n // If this is a strict mode function, verify that argument names\n // are not repeated, and it does not try to bind the words `eval`\n // or `arguments`.\n if (useStrict && nonSimple)\n { this.raiseRecoverable(node.start, \"Illegal 'use strict' directive in function with non-simple parameter list\"); }\n }\n // Start a new scope with regard to labels and the `inFunction`\n // flag (restore them to their old value afterwards).\n var oldLabels = this.labels;\n this.labels = [];\n if (useStrict) { this.strict = true; }\n\n // Add the params to varDeclaredNames to ensure that an error is thrown\n // if a let/const declaration in the function clashes with one of the params.\n this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params));\n // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval'\n if (this.strict && node.id) { this.checkLValSimple(node.id, BIND_OUTSIDE); }\n node.body = this.parseBlock(false, undefined, useStrict && !oldStrict);\n node.expression = false;\n this.adaptDirectivePrologue(node.body.body);\n this.labels = oldLabels;\n }\n this.exitScope();\n};\n\npp$5.isSimpleParamList = function(params) {\n for (var i = 0, list = params; i < list.length; i += 1)\n {\n var param = list[i];\n\n if (param.type !== \"Identifier\") { return false\n } }\n return true\n};\n\n// Checks function params for various disallowed patterns such as using \"eval\"\n// or \"arguments\" and duplicate parameters.\n\npp$5.checkParams = function(node, allowDuplicates) {\n var nameHash = Object.create(null);\n for (var i = 0, list = node.params; i < list.length; i += 1)\n {\n var param = list[i];\n\n this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash);\n }\n};\n\n// Parses a comma-separated list of expressions, and returns them as\n// an array. `close` is the token type that ends the list, and\n// `allowEmpty` can be turned on to allow subsequent commas with\n// nothing in between them to be parsed as `null` (which is needed\n// for array literals).\n\npp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {\n var elts = [], first = true;\n while (!this.eat(close)) {\n if (!first) {\n this.expect(types$1.comma);\n if (allowTrailingComma && this.afterTrailingComma(close)) { break }\n } else { first = false; }\n\n var elt = (void 0);\n if (allowEmpty && this.type === types$1.comma)\n { elt = null; }\n else if (this.type === types$1.ellipsis) {\n elt = this.parseSpread(refDestructuringErrors);\n if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0)\n { refDestructuringErrors.trailingComma = this.start; }\n } else {\n elt = this.parseMaybeAssign(false, refDestructuringErrors);\n }\n elts.push(elt);\n }\n return elts\n};\n\npp$5.checkUnreserved = function(ref) {\n var start = ref.start;\n var end = ref.end;\n var name = ref.name;\n\n if (this.inGenerator && name === \"yield\")\n { this.raiseRecoverable(start, \"Cannot use 'yield' as identifier inside a generator\"); }\n if (this.inAsync && name === \"await\")\n { this.raiseRecoverable(start, \"Cannot use 'await' as identifier inside an async function\"); }\n if (!(this.currentThisScope().flags & SCOPE_VAR) && name === \"arguments\")\n { this.raiseRecoverable(start, \"Cannot use 'arguments' in class field initializer\"); }\n if (this.inClassStaticBlock && (name === \"arguments\" || name === \"await\"))\n { this.raise(start, (\"Cannot use \" + name + \" in class static initialization block\")); }\n if (this.keywords.test(name))\n { this.raise(start, (\"Unexpected keyword '\" + name + \"'\")); }\n if (this.options.ecmaVersion < 6 &&\n this.input.slice(start, end).indexOf(\"\\\\\") !== -1) { return }\n var re = this.strict ? this.reservedWordsStrict : this.reservedWords;\n if (re.test(name)) {\n if (!this.inAsync && name === \"await\")\n { this.raiseRecoverable(start, \"Cannot use keyword 'await' outside an async function\"); }\n this.raiseRecoverable(start, (\"The keyword '\" + name + \"' is reserved\"));\n }\n};\n\n// Parse the next token as an identifier. If `liberal` is true (used\n// when parsing properties), it will also convert keywords into\n// identifiers.\n\npp$5.parseIdent = function(liberal) {\n var node = this.parseIdentNode();\n this.next(!!liberal);\n this.finishNode(node, \"Identifier\");\n if (!liberal) {\n this.checkUnreserved(node);\n if (node.name === \"await\" && !this.awaitIdentPos)\n { this.awaitIdentPos = node.start; }\n }\n return node\n};\n\npp$5.parseIdentNode = function() {\n var node = this.startNode();\n if (this.type === types$1.name) {\n node.name = this.value;\n } else if (this.type.keyword) {\n node.name = this.type.keyword;\n\n // To fix https://github.com/acornjs/acorn/issues/575\n // `class` and `function` keywords push new context into this.context.\n // But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.\n // If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword\n if ((node.name === \"class\" || node.name === \"function\") &&\n (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {\n this.context.pop();\n }\n this.type = types$1.name;\n } else {\n this.unexpected();\n }\n return node\n};\n\npp$5.parsePrivateIdent = function() {\n var node = this.startNode();\n if (this.type === types$1.privateId) {\n node.name = this.value;\n } else {\n this.unexpected();\n }\n this.next();\n this.finishNode(node, \"PrivateIdentifier\");\n\n // For validating existence\n if (this.options.checkPrivateFields) {\n if (this.privateNameStack.length === 0) {\n this.raise(node.start, (\"Private field '#\" + (node.name) + \"' must be declared in an enclosing class\"));\n } else {\n this.privateNameStack[this.privateNameStack.length - 1].used.push(node);\n }\n }\n\n return node\n};\n\n// Parses yield expression inside generator.\n\npp$5.parseYield = function(forInit) {\n if (!this.yieldPos) { this.yieldPos = this.start; }\n\n var node = this.startNode();\n this.next();\n if (this.type === types$1.semi || this.canInsertSemicolon() || (this.type !== types$1.star && !this.type.startsExpr)) {\n node.delegate = false;\n node.argument = null;\n } else {\n node.delegate = this.eat(types$1.star);\n node.argument = this.parseMaybeAssign(forInit);\n }\n return this.finishNode(node, \"YieldExpression\")\n};\n\npp$5.parseAwait = function(forInit) {\n if (!this.awaitPos) { this.awaitPos = this.start; }\n\n var node = this.startNode();\n this.next();\n node.argument = this.parseMaybeUnary(null, true, false, forInit);\n return this.finishNode(node, \"AwaitExpression\")\n};\n\nvar pp$4 = Parser.prototype;\n\n// This function is used to raise exceptions on parse errors. It\n// takes an offset integer (into the current `input`) to indicate\n// the location of the error, attaches the position to the end\n// of the error message, and then raises a `SyntaxError` with that\n// message.\n\npp$4.raise = function(pos, message) {\n var loc = getLineInfo(this.input, pos);\n message += \" (\" + loc.line + \":\" + loc.column + \")\";\n if (this.sourceFile) {\n message += \" in \" + this.sourceFile;\n }\n var err = new SyntaxError(message);\n err.pos = pos; err.loc = loc; err.raisedAt = this.pos;\n throw err\n};\n\npp$4.raiseRecoverable = pp$4.raise;\n\npp$4.curPosition = function() {\n if (this.options.locations) {\n return new Position(this.curLine, this.pos - this.lineStart)\n }\n};\n\nvar pp$3 = Parser.prototype;\n\nvar Scope = function Scope(flags) {\n this.flags = flags;\n // A list of var-declared names in the current lexical scope\n this.var = [];\n // A list of lexically-declared names in the current lexical scope\n this.lexical = [];\n // A list of lexically-declared FunctionDeclaration names in the current lexical scope\n this.functions = [];\n};\n\n// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.\n\npp$3.enterScope = function(flags) {\n this.scopeStack.push(new Scope(flags));\n};\n\npp$3.exitScope = function() {\n this.scopeStack.pop();\n};\n\n// The spec says:\n// > At the top level of a function, or script, function declarations are\n// > treated like var declarations rather than like lexical declarations.\npp$3.treatFunctionsAsVarInScope = function(scope) {\n return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)\n};\n\npp$3.declareName = function(name, bindingType, pos) {\n var redeclared = false;\n if (bindingType === BIND_LEXICAL) {\n var scope = this.currentScope();\n redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1;\n scope.lexical.push(name);\n if (this.inModule && (scope.flags & SCOPE_TOP))\n { delete this.undefinedExports[name]; }\n } else if (bindingType === BIND_SIMPLE_CATCH) {\n var scope$1 = this.currentScope();\n scope$1.lexical.push(name);\n } else if (bindingType === BIND_FUNCTION) {\n var scope$2 = this.currentScope();\n if (this.treatFunctionsAsVar)\n { redeclared = scope$2.lexical.indexOf(name) > -1; }\n else\n { redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1; }\n scope$2.functions.push(name);\n } else {\n for (var i = this.scopeStack.length - 1; i >= 0; --i) {\n var scope$3 = this.scopeStack[i];\n if (scope$3.lexical.indexOf(name) > -1 && !((scope$3.flags & SCOPE_SIMPLE_CATCH) && scope$3.lexical[0] === name) ||\n !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) {\n redeclared = true;\n break\n }\n scope$3.var.push(name);\n if (this.inModule && (scope$3.flags & SCOPE_TOP))\n { delete this.undefinedExports[name]; }\n if (scope$3.flags & SCOPE_VAR) { break }\n }\n }\n if (redeclared) { this.raiseRecoverable(pos, (\"Identifier '\" + name + \"' has already been declared\")); }\n};\n\npp$3.checkLocalExport = function(id) {\n // scope.functions must be empty as Module code is always strict.\n if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&\n this.scopeStack[0].var.indexOf(id.name) === -1) {\n this.undefinedExports[id.name] = id;\n }\n};\n\npp$3.currentScope = function() {\n return this.scopeStack[this.scopeStack.length - 1]\n};\n\npp$3.currentVarScope = function() {\n for (var i = this.scopeStack.length - 1;; i--) {\n var scope = this.scopeStack[i];\n if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK)) { return scope }\n }\n};\n\n// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.\npp$3.currentThisScope = function() {\n for (var i = this.scopeStack.length - 1;; i--) {\n var scope = this.scopeStack[i];\n if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK) &&\n !(scope.flags & SCOPE_ARROW)) { return scope }\n }\n};\n\nvar Node = function Node(parser, pos, loc) {\n this.type = \"\";\n this.start = pos;\n this.end = 0;\n if (parser.options.locations)\n { this.loc = new SourceLocation(parser, loc); }\n if (parser.options.directSourceFile)\n { this.sourceFile = parser.options.directSourceFile; }\n if (parser.options.ranges)\n { this.range = [pos, 0]; }\n};\n\n// Start an AST node, attaching a start offset.\n\nvar pp$2 = Parser.prototype;\n\npp$2.startNode = function() {\n return new Node(this, this.start, this.startLoc)\n};\n\npp$2.startNodeAt = function(pos, loc) {\n return new Node(this, pos, loc)\n};\n\n// Finish an AST node, adding `type` and `end` properties.\n\nfunction finishNodeAt(node, type, pos, loc) {\n node.type = type;\n node.end = pos;\n if (this.options.locations)\n { node.loc.end = loc; }\n if (this.options.ranges)\n { node.range[1] = pos; }\n return node\n}\n\npp$2.finishNode = function(node, type) {\n return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)\n};\n\n// Finish node at given position\n\npp$2.finishNodeAt = function(node, type, pos, loc) {\n return finishNodeAt.call(this, node, type, pos, loc)\n};\n\npp$2.copyNode = function(node) {\n var newNode = new Node(this, node.start, this.startLoc);\n for (var prop in node) { newNode[prop] = node[prop]; }\n return newNode\n};\n\n// This file was generated by \"bin/generate-unicode-script-values.js\". Do not modify manually!\nvar scriptValuesAddedInUnicode = \"Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz\";\n\n// This file contains Unicode properties extracted from the ECMAScript specification.\n// The lists are extracted like so:\n// $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText)\n\n// #table-binary-unicode-properties\nvar ecma9BinaryProperties = \"ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS\";\nvar ecma10BinaryProperties = ecma9BinaryProperties + \" Extended_Pictographic\";\nvar ecma11BinaryProperties = ecma10BinaryProperties;\nvar ecma12BinaryProperties = ecma11BinaryProperties + \" EBase EComp EMod EPres ExtPict\";\nvar ecma13BinaryProperties = ecma12BinaryProperties;\nvar ecma14BinaryProperties = ecma13BinaryProperties;\n\nvar unicodeBinaryProperties = {\n 9: ecma9BinaryProperties,\n 10: ecma10BinaryProperties,\n 11: ecma11BinaryProperties,\n 12: ecma12BinaryProperties,\n 13: ecma13BinaryProperties,\n 14: ecma14BinaryProperties\n};\n\n// #table-binary-unicode-properties-of-strings\nvar ecma14BinaryPropertiesOfStrings = \"Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji\";\n\nvar unicodeBinaryPropertiesOfStrings = {\n 9: \"\",\n 10: \"\",\n 11: \"\",\n 12: \"\",\n 13: \"\",\n 14: ecma14BinaryPropertiesOfStrings\n};\n\n// #table-unicode-general-category-values\nvar unicodeGeneralCategoryValues = \"Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu\";\n\n// #table-unicode-script-values\nvar ecma9ScriptValues = \"Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb\";\nvar ecma10ScriptValues = ecma9ScriptValues + \" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd\";\nvar ecma11ScriptValues = ecma10ScriptValues + \" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho\";\nvar ecma12ScriptValues = ecma11ScriptValues + \" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi\";\nvar ecma13ScriptValues = ecma12ScriptValues + \" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith\";\nvar ecma14ScriptValues = ecma13ScriptValues + \" \" + scriptValuesAddedInUnicode;\n\nvar unicodeScriptValues = {\n 9: ecma9ScriptValues,\n 10: ecma10ScriptValues,\n 11: ecma11ScriptValues,\n 12: ecma12ScriptValues,\n 13: ecma13ScriptValues,\n 14: ecma14ScriptValues\n};\n\nvar data = {};\nfunction buildUnicodeData(ecmaVersion) {\n var d = data[ecmaVersion] = {\n binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + \" \" + unicodeGeneralCategoryValues),\n binaryOfStrings: wordsRegexp(unicodeBinaryPropertiesOfStrings[ecmaVersion]),\n nonBinary: {\n General_Category: wordsRegexp(unicodeGeneralCategoryValues),\n Script: wordsRegexp(unicodeScriptValues[ecmaVersion])\n }\n };\n d.nonBinary.Script_Extensions = d.nonBinary.Script;\n\n d.nonBinary.gc = d.nonBinary.General_Category;\n d.nonBinary.sc = d.nonBinary.Script;\n d.nonBinary.scx = d.nonBinary.Script_Extensions;\n}\n\nfor (var i = 0, list = [9, 10, 11, 12, 13, 14]; i < list.length; i += 1) {\n var ecmaVersion = list[i];\n\n buildUnicodeData(ecmaVersion);\n}\n\nvar pp$1 = Parser.prototype;\n\n// Track disjunction structure to determine whether a duplicate\n// capture group name is allowed because it is in a separate branch.\nvar BranchID = function BranchID(parent, base) {\n // Parent disjunction branch\n this.parent = parent;\n // Identifies this set of sibling branches\n this.base = base || this;\n};\n\nBranchID.prototype.separatedFrom = function separatedFrom (alt) {\n // A branch is separate from another branch if they or any of\n // their parents are siblings in a given disjunction\n for (var self = this; self; self = self.parent) {\n for (var other = alt; other; other = other.parent) {\n if (self.base === other.base && self !== other) { return true }\n }\n }\n return false\n};\n\nBranchID.prototype.sibling = function sibling () {\n return new BranchID(this.parent, this.base)\n};\n\nvar RegExpValidationState = function RegExpValidationState(parser) {\n this.parser = parser;\n this.validFlags = \"gim\" + (parser.options.ecmaVersion >= 6 ? \"uy\" : \"\") + (parser.options.ecmaVersion >= 9 ? \"s\" : \"\") + (parser.options.ecmaVersion >= 13 ? \"d\" : \"\") + (parser.options.ecmaVersion >= 15 ? \"v\" : \"\");\n this.unicodeProperties = data[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion];\n this.source = \"\";\n this.flags = \"\";\n this.start = 0;\n this.switchU = false;\n this.switchV = false;\n this.switchN = false;\n this.pos = 0;\n this.lastIntValue = 0;\n this.lastStringValue = \"\";\n this.lastAssertionIsQuantifiable = false;\n this.numCapturingParens = 0;\n this.maxBackReference = 0;\n this.groupNames = Object.create(null);\n this.backReferenceNames = [];\n this.branchID = null;\n};\n\nRegExpValidationState.prototype.reset = function reset (start, pattern, flags) {\n var unicodeSets = flags.indexOf(\"v\") !== -1;\n var unicode = flags.indexOf(\"u\") !== -1;\n this.start = start | 0;\n this.source = pattern + \"\";\n this.flags = flags;\n if (unicodeSets && this.parser.options.ecmaVersion >= 15) {\n this.switchU = true;\n this.switchV = true;\n this.switchN = true;\n } else {\n this.switchU = unicode && this.parser.options.ecmaVersion >= 6;\n this.switchV = false;\n this.switchN = unicode && this.parser.options.ecmaVersion >= 9;\n }\n};\n\nRegExpValidationState.prototype.raise = function raise (message) {\n this.parser.raiseRecoverable(this.start, (\"Invalid regular expression: /\" + (this.source) + \"/: \" + message));\n};\n\n// If u flag is given, this returns the code point at the index (it combines a surrogate pair).\n// Otherwise, this returns the code unit of the index (can be a part of a surrogate pair).\nRegExpValidationState.prototype.at = function at (i, forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n var s = this.source;\n var l = s.length;\n if (i >= l) {\n return -1\n }\n var c = s.charCodeAt(i);\n if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {\n return c\n }\n var next = s.charCodeAt(i + 1);\n return next >= 0xDC00 && next <= 0xDFFF ? (c << 10) + next - 0x35FDC00 : c\n};\n\nRegExpValidationState.prototype.nextIndex = function nextIndex (i, forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n var s = this.source;\n var l = s.length;\n if (i >= l) {\n return l\n }\n var c = s.charCodeAt(i), next;\n if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l ||\n (next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) {\n return i + 1\n }\n return i + 2\n};\n\nRegExpValidationState.prototype.current = function current (forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n return this.at(this.pos, forceU)\n};\n\nRegExpValidationState.prototype.lookahead = function lookahead (forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n return this.at(this.nextIndex(this.pos, forceU), forceU)\n};\n\nRegExpValidationState.prototype.advance = function advance (forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n this.pos = this.nextIndex(this.pos, forceU);\n};\n\nRegExpValidationState.prototype.eat = function eat (ch, forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n if (this.current(forceU) === ch) {\n this.advance(forceU);\n return true\n }\n return false\n};\n\nRegExpValidationState.prototype.eatChars = function eatChars (chs, forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n var pos = this.pos;\n for (var i = 0, list = chs; i < list.length; i += 1) {\n var ch = list[i];\n\n var current = this.at(pos, forceU);\n if (current === -1 || current !== ch) {\n return false\n }\n pos = this.nextIndex(pos, forceU);\n }\n this.pos = pos;\n return true\n};\n\n/**\n * Validate the flags part of a given RegExpLiteral.\n *\n * @param {RegExpValidationState} state The state to validate RegExp.\n * @returns {void}\n */\npp$1.validateRegExpFlags = function(state) {\n var validFlags = state.validFlags;\n var flags = state.flags;\n\n var u = false;\n var v = false;\n\n for (var i = 0; i < flags.length; i++) {\n var flag = flags.charAt(i);\n if (validFlags.indexOf(flag) === -1) {\n this.raise(state.start, \"Invalid regular expression flag\");\n }\n if (flags.indexOf(flag, i + 1) > -1) {\n this.raise(state.start, \"Duplicate regular expression flag\");\n }\n if (flag === \"u\") { u = true; }\n if (flag === \"v\") { v = true; }\n }\n if (this.options.ecmaVersion >= 15 && u && v) {\n this.raise(state.start, \"Invalid regular expression flag\");\n }\n};\n\nfunction hasProp(obj) {\n for (var _ in obj) { return true }\n return false\n}\n\n/**\n * Validate the pattern part of a given RegExpLiteral.\n *\n * @param {RegExpValidationState} state The state to validate RegExp.\n * @returns {void}\n */\npp$1.validateRegExpPattern = function(state) {\n this.regexp_pattern(state);\n\n // The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of\n // parsing contains a |GroupName|, reparse with the goal symbol\n // |Pattern[~U, +N]| and use this result instead. Throw a *SyntaxError*\n // exception if _P_ did not conform to the grammar, if any elements of _P_\n // were not matched by the parse, or if any Early Error conditions exist.\n if (!state.switchN && this.options.ecmaVersion >= 9 && hasProp(state.groupNames)) {\n state.switchN = true;\n this.regexp_pattern(state);\n }\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern\npp$1.regexp_pattern = function(state) {\n state.pos = 0;\n state.lastIntValue = 0;\n state.lastStringValue = \"\";\n state.lastAssertionIsQuantifiable = false;\n state.numCapturingParens = 0;\n state.maxBackReference = 0;\n state.groupNames = Object.create(null);\n state.backReferenceNames.length = 0;\n state.branchID = null;\n\n this.regexp_disjunction(state);\n\n if (state.pos !== state.source.length) {\n // Make the same messages as V8.\n if (state.eat(0x29 /* ) */)) {\n state.raise(\"Unmatched ')'\");\n }\n if (state.eat(0x5D /* ] */) || state.eat(0x7D /* } */)) {\n state.raise(\"Lone quantifier brackets\");\n }\n }\n if (state.maxBackReference > state.numCapturingParens) {\n state.raise(\"Invalid escape\");\n }\n for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) {\n var name = list[i];\n\n if (!state.groupNames[name]) {\n state.raise(\"Invalid named capture referenced\");\n }\n }\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction\npp$1.regexp_disjunction = function(state) {\n var trackDisjunction = this.options.ecmaVersion >= 16;\n if (trackDisjunction) { state.branchID = new BranchID(state.branchID, null); }\n this.regexp_alternative(state);\n while (state.eat(0x7C /* | */)) {\n if (trackDisjunction) { state.branchID = state.branchID.sibling(); }\n this.regexp_alternative(state);\n }\n if (trackDisjunction) { state.branchID = state.branchID.parent; }\n\n // Make the same message as V8.\n if (this.regexp_eatQuantifier(state, true)) {\n state.raise(\"Nothing to repeat\");\n }\n if (state.eat(0x7B /* { */)) {\n state.raise(\"Lone quantifier brackets\");\n }\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative\npp$1.regexp_alternative = function(state) {\n while (state.pos < state.source.length && this.regexp_eatTerm(state)) {}\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term\npp$1.regexp_eatTerm = function(state) {\n if (this.regexp_eatAssertion(state)) {\n // Handle `QuantifiableAssertion Quantifier` alternative.\n // `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion\n // is a QuantifiableAssertion.\n if (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state)) {\n // Make the same message as V8.\n if (state.switchU) {\n state.raise(\"Invalid quantifier\");\n }\n }\n return true\n }\n\n if (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) {\n this.regexp_eatQuantifier(state);\n return true\n }\n\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion\npp$1.regexp_eatAssertion = function(state) {\n var start = state.pos;\n state.lastAssertionIsQuantifiable = false;\n\n // ^, $\n if (state.eat(0x5E /* ^ */) || state.eat(0x24 /* $ */)) {\n return true\n }\n\n // \\b \\B\n if (state.eat(0x5C /* \\ */)) {\n if (state.eat(0x42 /* B */) || state.eat(0x62 /* b */)) {\n return true\n }\n state.pos = start;\n }\n\n // Lookahead / Lookbehind\n if (state.eat(0x28 /* ( */) && state.eat(0x3F /* ? */)) {\n var lookbehind = false;\n if (this.options.ecmaVersion >= 9) {\n lookbehind = state.eat(0x3C /* < */);\n }\n if (state.eat(0x3D /* = */) || state.eat(0x21 /* ! */)) {\n this.regexp_disjunction(state);\n if (!state.eat(0x29 /* ) */)) {\n state.raise(\"Unterminated group\");\n }\n state.lastAssertionIsQuantifiable = !lookbehind;\n return true\n }\n }\n\n state.pos = start;\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier\npp$1.regexp_eatQuantifier = function(state, noError) {\n if ( noError === void 0 ) noError = false;\n\n if (this.regexp_eatQuantifierPrefix(state, noError)) {\n state.eat(0x3F /* ? */);\n return true\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix\npp$1.regexp_eatQuantifierPrefix = function(state, noError) {\n return (\n state.eat(0x2A /* * */) ||\n state.eat(0x2B /* + */) ||\n state.eat(0x3F /* ? */) ||\n this.regexp_eatBracedQuantifier(state, noError)\n )\n};\npp$1.regexp_eatBracedQuantifier = function(state, noError) {\n var start = state.pos;\n if (state.eat(0x7B /* { */)) {\n var min = 0, max = -1;\n if (this.regexp_eatDecimalDigits(state)) {\n min = state.lastIntValue;\n if (state.eat(0x2C /* , */) && this.regexp_eatDecimalDigits(state)) {\n max = state.lastIntValue;\n }\n if (state.eat(0x7D /* } */)) {\n // SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-term\n if (max !== -1 && max < min && !noError) {\n state.raise(\"numbers out of order in {} quantifier\");\n }\n return true\n }\n }\n if (state.switchU && !noError) {\n state.raise(\"Incomplete quantifier\");\n }\n state.pos = start;\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Atom\npp$1.regexp_eatAtom = function(state) {\n return (\n this.regexp_eatPatternCharacters(state) ||\n state.eat(0x2E /* . */) ||\n this.regexp_eatReverseSolidusAtomEscape(state) ||\n this.regexp_eatCharacterClass(state) ||\n this.regexp_eatUncapturingGroup(state) ||\n this.regexp_eatCapturingGroup(state)\n )\n};\npp$1.regexp_eatReverseSolidusAtomEscape = function(state) {\n var start = state.pos;\n if (state.eat(0x5C /* \\ */)) {\n if (this.regexp_eatAtomEscape(state)) {\n return true\n }\n state.pos = start;\n }\n return false\n};\npp$1.regexp_eatUncapturingGroup = function(state) {\n var start = state.pos;\n if (state.eat(0x28 /* ( */)) {\n if (state.eat(0x3F /* ? */)) {\n if (this.options.ecmaVersion >= 16) {\n var addModifiers = this.regexp_eatModifiers(state);\n var hasHyphen = state.eat(0x2D /* - */);\n if (addModifiers || hasHyphen) {\n for (var i = 0; i < addModifiers.length; i++) {\n var modifier = addModifiers.charAt(i);\n if (addModifiers.indexOf(modifier, i + 1) > -1) {\n state.raise(\"Duplicate regular expression modifiers\");\n }\n }\n if (hasHyphen) {\n var removeModifiers = this.regexp_eatModifiers(state);\n if (!addModifiers && !removeModifiers && state.current() === 0x3A /* : */) {\n state.raise(\"Invalid regular expression modifiers\");\n }\n for (var i$1 = 0; i$1 < removeModifiers.length; i$1++) {\n var modifier$1 = removeModifiers.charAt(i$1);\n if (\n removeModifiers.indexOf(modifier$1, i$1 + 1) > -1 ||\n addModifiers.indexOf(modifier$1) > -1\n ) {\n state.raise(\"Duplicate regular expression modifiers\");\n }\n }\n }\n }\n }\n if (state.eat(0x3A /* : */)) {\n this.regexp_disjunction(state);\n if (state.eat(0x29 /* ) */)) {\n return true\n }\n state.raise(\"Unterminated group\");\n }\n }\n state.pos = start;\n }\n return false\n};\npp$1.regexp_eatCapturingGroup = function(state) {\n if (state.eat(0x28 /* ( */)) {\n if (this.options.ecmaVersion >= 9) {\n this.regexp_groupSpecifier(state);\n } else if (state.current() === 0x3F /* ? */) {\n state.raise(\"Invalid group\");\n }\n this.regexp_disjunction(state);\n if (state.eat(0x29 /* ) */)) {\n state.numCapturingParens += 1;\n return true\n }\n state.raise(\"Unterminated group\");\n }\n return false\n};\n// RegularExpressionModifiers ::\n// [empty]\n// RegularExpressionModifiers RegularExpressionModifier\npp$1.regexp_eatModifiers = function(state) {\n var modifiers = \"\";\n var ch = 0;\n while ((ch = state.current()) !== -1 && isRegularExpressionModifier(ch)) {\n modifiers += codePointToString(ch);\n state.advance();\n }\n return modifiers\n};\n// RegularExpressionModifier :: one of\n// `i` `m` `s`\nfunction isRegularExpressionModifier(ch) {\n return ch === 0x69 /* i */ || ch === 0x6d /* m */ || ch === 0x73 /* s */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom\npp$1.regexp_eatExtendedAtom = function(state) {\n return (\n state.eat(0x2E /* . */) ||\n this.regexp_eatReverseSolidusAtomEscape(state) ||\n this.regexp_eatCharacterClass(state) ||\n this.regexp_eatUncapturingGroup(state) ||\n this.regexp_eatCapturingGroup(state) ||\n this.regexp_eatInvalidBracedQuantifier(state) ||\n this.regexp_eatExtendedPatternCharacter(state)\n )\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier\npp$1.regexp_eatInvalidBracedQuantifier = function(state) {\n if (this.regexp_eatBracedQuantifier(state, true)) {\n state.raise(\"Nothing to repeat\");\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter\npp$1.regexp_eatSyntaxCharacter = function(state) {\n var ch = state.current();\n if (isSyntaxCharacter(ch)) {\n state.lastIntValue = ch;\n state.advance();\n return true\n }\n return false\n};\nfunction isSyntaxCharacter(ch) {\n return (\n ch === 0x24 /* $ */ ||\n ch >= 0x28 /* ( */ && ch <= 0x2B /* + */ ||\n ch === 0x2E /* . */ ||\n ch === 0x3F /* ? */ ||\n ch >= 0x5B /* [ */ && ch <= 0x5E /* ^ */ ||\n ch >= 0x7B /* { */ && ch <= 0x7D /* } */\n )\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter\n// But eat eager.\npp$1.regexp_eatPatternCharacters = function(state) {\n var start = state.pos;\n var ch = 0;\n while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {\n state.advance();\n }\n return state.pos !== start\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter\npp$1.regexp_eatExtendedPatternCharacter = function(state) {\n var ch = state.current();\n if (\n ch !== -1 &&\n ch !== 0x24 /* $ */ &&\n !(ch >= 0x28 /* ( */ && ch <= 0x2B /* + */) &&\n ch !== 0x2E /* . */ &&\n ch !== 0x3F /* ? */ &&\n ch !== 0x5B /* [ */ &&\n ch !== 0x5E /* ^ */ &&\n ch !== 0x7C /* | */\n ) {\n state.advance();\n return true\n }\n return false\n};\n\n// GroupSpecifier ::\n// [empty]\n// `?` GroupName\npp$1.regexp_groupSpecifier = function(state) {\n if (state.eat(0x3F /* ? */)) {\n if (!this.regexp_eatGroupName(state)) { state.raise(\"Invalid group\"); }\n var trackDisjunction = this.options.ecmaVersion >= 16;\n var known = state.groupNames[state.lastStringValue];\n if (known) {\n if (trackDisjunction) {\n for (var i = 0, list = known; i < list.length; i += 1) {\n var altID = list[i];\n\n if (!altID.separatedFrom(state.branchID))\n { state.raise(\"Duplicate capture group name\"); }\n }\n } else {\n state.raise(\"Duplicate capture group name\");\n }\n }\n if (trackDisjunction) {\n (known || (state.groupNames[state.lastStringValue] = [])).push(state.branchID);\n } else {\n state.groupNames[state.lastStringValue] = true;\n }\n }\n};\n\n// GroupName ::\n// `<` RegExpIdentifierName `>`\n// Note: this updates `state.lastStringValue` property with the eaten name.\npp$1.regexp_eatGroupName = function(state) {\n state.lastStringValue = \"\";\n if (state.eat(0x3C /* < */)) {\n if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {\n return true\n }\n state.raise(\"Invalid capture group name\");\n }\n return false\n};\n\n// RegExpIdentifierName ::\n// RegExpIdentifierStart\n// RegExpIdentifierName RegExpIdentifierPart\n// Note: this updates `state.lastStringValue` property with the eaten name.\npp$1.regexp_eatRegExpIdentifierName = function(state) {\n state.lastStringValue = \"\";\n if (this.regexp_eatRegExpIdentifierStart(state)) {\n state.lastStringValue += codePointToString(state.lastIntValue);\n while (this.regexp_eatRegExpIdentifierPart(state)) {\n state.lastStringValue += codePointToString(state.lastIntValue);\n }\n return true\n }\n return false\n};\n\n// RegExpIdentifierStart ::\n// UnicodeIDStart\n// `$`\n// `_`\n// `\\` RegExpUnicodeEscapeSequence[+U]\npp$1.regexp_eatRegExpIdentifierStart = function(state) {\n var start = state.pos;\n var forceU = this.options.ecmaVersion >= 11;\n var ch = state.current(forceU);\n state.advance(forceU);\n\n if (ch === 0x5C /* \\ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {\n ch = state.lastIntValue;\n }\n if (isRegExpIdentifierStart(ch)) {\n state.lastIntValue = ch;\n return true\n }\n\n state.pos = start;\n return false\n};\nfunction isRegExpIdentifierStart(ch) {\n return isIdentifierStart(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */\n}\n\n// RegExpIdentifierPart ::\n// UnicodeIDContinue\n// `$`\n// `_`\n// `\\` RegExpUnicodeEscapeSequence[+U]\n// <ZWNJ>\n// <ZWJ>\npp$1.regexp_eatRegExpIdentifierPart = function(state) {\n var start = state.pos;\n var forceU = this.options.ecmaVersion >= 11;\n var ch = state.current(forceU);\n state.advance(forceU);\n\n if (ch === 0x5C /* \\ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {\n ch = state.lastIntValue;\n }\n if (isRegExpIdentifierPart(ch)) {\n state.lastIntValue = ch;\n return true\n }\n\n state.pos = start;\n return false\n};\nfunction isRegExpIdentifierPart(ch) {\n return isIdentifierChar(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */ || ch === 0x200C /* <ZWNJ> */ || ch === 0x200D /* <ZWJ> */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape\npp$1.regexp_eatAtomEscape = function(state) {\n if (\n this.regexp_eatBackReference(state) ||\n this.regexp_eatCharacterClassEscape(state) ||\n this.regexp_eatCharacterEscape(state) ||\n (state.switchN && this.regexp_eatKGroupName(state))\n ) {\n return true\n }\n if (state.switchU) {\n // Make the same message as V8.\n if (state.current() === 0x63 /* c */) {\n state.raise(\"Invalid unicode escape\");\n }\n state.raise(\"Invalid escape\");\n }\n return false\n};\npp$1.regexp_eatBackReference = function(state) {\n var start = state.pos;\n if (this.regexp_eatDecimalEscape(state)) {\n var n = state.lastIntValue;\n if (state.switchU) {\n // For SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-atomescape\n if (n > state.maxBackReference) {\n state.maxBackReference = n;\n }\n return true\n }\n if (n <= state.numCapturingParens) {\n return true\n }\n state.pos = start;\n }\n return false\n};\npp$1.regexp_eatKGroupName = function(state) {\n if (state.eat(0x6B /* k */)) {\n if (this.regexp_eatGroupName(state)) {\n state.backReferenceNames.push(state.lastStringValue);\n return true\n }\n state.raise(\"Invalid named reference\");\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape\npp$1.regexp_eatCharacterEscape = function(state) {\n return (\n this.regexp_eatControlEscape(state) ||\n this.regexp_eatCControlLetter(state) ||\n this.regexp_eatZero(state) ||\n this.regexp_eatHexEscapeSequence(state) ||\n this.regexp_eatRegExpUnicodeEscapeSequence(state, false) ||\n (!state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state)) ||\n this.regexp_eatIdentityEscape(state)\n )\n};\npp$1.regexp_eatCControlLetter = function(state) {\n var start = state.pos;\n if (state.eat(0x63 /* c */)) {\n if (this.regexp_eatControlLetter(state)) {\n return true\n }\n state.pos = start;\n }\n return false\n};\npp$1.regexp_eatZero = function(state) {\n if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {\n state.lastIntValue = 0;\n state.advance();\n return true\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape\npp$1.regexp_eatControlEscape = function(state) {\n var ch = state.current();\n if (ch === 0x74 /* t */) {\n state.lastIntValue = 0x09; /* \\t */\n state.advance();\n return true\n }\n if (ch === 0x6E /* n */) {\n state.lastIntValue = 0x0A; /* \\n */\n state.advance();\n return true\n }\n if (ch === 0x76 /* v */) {\n state.lastIntValue = 0x0B; /* \\v */\n state.advance();\n return true\n }\n if (ch === 0x66 /* f */) {\n state.lastIntValue = 0x0C; /* \\f */\n state.advance();\n return true\n }\n if (ch === 0x72 /* r */) {\n state.lastIntValue = 0x0D; /* \\r */\n state.advance();\n return true\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter\npp$1.regexp_eatControlLetter = function(state) {\n var ch = state.current();\n if (isControlLetter(ch)) {\n state.lastIntValue = ch % 0x20;\n state.advance();\n return true\n }\n return false\n};\nfunction isControlLetter(ch) {\n return (\n (ch >= 0x41 /* A */ && ch <= 0x5A /* Z */) ||\n (ch >= 0x61 /* a */ && ch <= 0x7A /* z */)\n )\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence\npp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n var start = state.pos;\n var switchU = forceU || state.switchU;\n\n if (state.eat(0x75 /* u */)) {\n if (this.regexp_eatFixedHexDigits(state, 4)) {\n var lead = state.lastIntValue;\n if (switchU && lead >= 0xD800 && lead <= 0xDBFF) {\n var leadSurrogateEnd = state.pos;\n if (state.eat(0x5C /* \\ */) && state.eat(0x75 /* u */) && this.regexp_eatFixedHexDigits(state, 4)) {\n var trail = state.lastIntValue;\n if (trail >= 0xDC00 && trail <= 0xDFFF) {\n state.lastIntValue = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;\n return true\n }\n }\n state.pos = leadSurrogateEnd;\n state.lastIntValue = lead;\n }\n return true\n }\n if (\n switchU &&\n state.eat(0x7B /* { */) &&\n this.regexp_eatHexDigits(state) &&\n state.eat(0x7D /* } */) &&\n isValidUnicode(state.lastIntValue)\n ) {\n return true\n }\n if (switchU) {\n state.raise(\"Invalid unicode escape\");\n }\n state.pos = start;\n }\n\n return false\n};\nfunction isValidUnicode(ch) {\n return ch >= 0 && ch <= 0x10FFFF\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape\npp$1.regexp_eatIdentityEscape = function(state) {\n if (state.switchU) {\n if (this.regexp_eatSyntaxCharacter(state)) {\n return true\n }\n if (state.eat(0x2F /* / */)) {\n state.lastIntValue = 0x2F; /* / */\n return true\n }\n return false\n }\n\n var ch = state.current();\n if (ch !== 0x63 /* c */ && (!state.switchN || ch !== 0x6B /* k */)) {\n state.lastIntValue = ch;\n state.advance();\n return true\n }\n\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape\npp$1.regexp_eatDecimalEscape = function(state) {\n state.lastIntValue = 0;\n var ch = state.current();\n if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {\n do {\n state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);\n state.advance();\n } while ((ch = state.current()) >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */)\n return true\n }\n return false\n};\n\n// Return values used by character set parsing methods, needed to\n// forbid negation of sets that can match strings.\nvar CharSetNone = 0; // Nothing parsed\nvar CharSetOk = 1; // Construct parsed, cannot contain strings\nvar CharSetString = 2; // Construct parsed, can contain strings\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape\npp$1.regexp_eatCharacterClassEscape = function(state) {\n var ch = state.current();\n\n if (isCharacterClassEscape(ch)) {\n state.lastIntValue = -1;\n state.advance();\n return CharSetOk\n }\n\n var negate = false;\n if (\n state.switchU &&\n this.options.ecmaVersion >= 9 &&\n ((negate = ch === 0x50 /* P */) || ch === 0x70 /* p */)\n ) {\n state.lastIntValue = -1;\n state.advance();\n var result;\n if (\n state.eat(0x7B /* { */) &&\n (result = this.regexp_eatUnicodePropertyValueExpression(state)) &&\n state.eat(0x7D /* } */)\n ) {\n if (negate && result === CharSetString) { state.raise(\"Invalid property name\"); }\n return result\n }\n state.raise(\"Invalid property name\");\n }\n\n return CharSetNone\n};\n\nfunction isCharacterClassEscape(ch) {\n return (\n ch === 0x64 /* d */ ||\n ch === 0x44 /* D */ ||\n ch === 0x73 /* s */ ||\n ch === 0x53 /* S */ ||\n ch === 0x77 /* w */ ||\n ch === 0x57 /* W */\n )\n}\n\n// UnicodePropertyValueExpression ::\n// UnicodePropertyName `=` UnicodePropertyValue\n// LoneUnicodePropertyNameOrValue\npp$1.regexp_eatUnicodePropertyValueExpression = function(state) {\n var start = state.pos;\n\n // UnicodePropertyName `=` UnicodePropertyValue\n if (this.regexp_eatUnicodePropertyName(state) && state.eat(0x3D /* = */)) {\n var name = state.lastStringValue;\n if (this.regexp_eatUnicodePropertyValue(state)) {\n var value = state.lastStringValue;\n this.regexp_validateUnicodePropertyNameAndValue(state, name, value);\n return CharSetOk\n }\n }\n state.pos = start;\n\n // LoneUnicodePropertyNameOrValue\n if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {\n var nameOrValue = state.lastStringValue;\n return this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue)\n }\n return CharSetNone\n};\n\npp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {\n if (!hasOwn(state.unicodeProperties.nonBinary, name))\n { state.raise(\"Invalid property name\"); }\n if (!state.unicodeProperties.nonBinary[name].test(value))\n { state.raise(\"Invalid property value\"); }\n};\n\npp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {\n if (state.unicodeProperties.binary.test(nameOrValue)) { return CharSetOk }\n if (state.switchV && state.unicodeProperties.binaryOfStrings.test(nameOrValue)) { return CharSetString }\n state.raise(\"Invalid property name\");\n};\n\n// UnicodePropertyName ::\n// UnicodePropertyNameCharacters\npp$1.regexp_eatUnicodePropertyName = function(state) {\n var ch = 0;\n state.lastStringValue = \"\";\n while (isUnicodePropertyNameCharacter(ch = state.current())) {\n state.lastStringValue += codePointToString(ch);\n state.advance();\n }\n return state.lastStringValue !== \"\"\n};\n\nfunction isUnicodePropertyNameCharacter(ch) {\n return isControlLetter(ch) || ch === 0x5F /* _ */\n}\n\n// UnicodePropertyValue ::\n// UnicodePropertyValueCharacters\npp$1.regexp_eatUnicodePropertyValue = function(state) {\n var ch = 0;\n state.lastStringValue = \"\";\n while (isUnicodePropertyValueCharacter(ch = state.current())) {\n state.lastStringValue += codePointToString(ch);\n state.advance();\n }\n return state.lastStringValue !== \"\"\n};\nfunction isUnicodePropertyValueCharacter(ch) {\n return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch)\n}\n\n// LoneUnicodePropertyNameOrValue ::\n// UnicodePropertyValueCharacters\npp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {\n return this.regexp_eatUnicodePropertyValue(state)\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass\npp$1.regexp_eatCharacterClass = function(state) {\n if (state.eat(0x5B /* [ */)) {\n var negate = state.eat(0x5E /* ^ */);\n var result = this.regexp_classContents(state);\n if (!state.eat(0x5D /* ] */))\n { state.raise(\"Unterminated character class\"); }\n if (negate && result === CharSetString)\n { state.raise(\"Negated character class may contain strings\"); }\n return true\n }\n return false\n};\n\n// https://tc39.es/ecma262/#prod-ClassContents\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges\npp$1.regexp_classContents = function(state) {\n if (state.current() === 0x5D /* ] */) { return CharSetOk }\n if (state.switchV) { return this.regexp_classSetExpression(state) }\n this.regexp_nonEmptyClassRanges(state);\n return CharSetOk\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges\n// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash\npp$1.regexp_nonEmptyClassRanges = function(state) {\n while (this.regexp_eatClassAtom(state)) {\n var left = state.lastIntValue;\n if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {\n var right = state.lastIntValue;\n if (state.switchU && (left === -1 || right === -1)) {\n state.raise(\"Invalid character class\");\n }\n if (left !== -1 && right !== -1 && left > right) {\n state.raise(\"Range out of order in character class\");\n }\n }\n }\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash\npp$1.regexp_eatClassAtom = function(state) {\n var start = state.pos;\n\n if (state.eat(0x5C /* \\ */)) {\n if (this.regexp_eatClassEscape(state)) {\n return true\n }\n if (state.switchU) {\n // Make the same message as V8.\n var ch$1 = state.current();\n if (ch$1 === 0x63 /* c */ || isOctalDigit(ch$1)) {\n state.raise(\"Invalid class escape\");\n }\n state.raise(\"Invalid escape\");\n }\n state.pos = start;\n }\n\n var ch = state.current();\n if (ch !== 0x5D /* ] */) {\n state.lastIntValue = ch;\n state.advance();\n return true\n }\n\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape\npp$1.regexp_eatClassEscape = function(state) {\n var start = state.pos;\n\n if (state.eat(0x62 /* b */)) {\n state.lastIntValue = 0x08; /* <BS> */\n return true\n }\n\n if (state.switchU && state.eat(0x2D /* - */)) {\n state.lastIntValue = 0x2D; /* - */\n return true\n }\n\n if (!state.switchU && state.eat(0x63 /* c */)) {\n if (this.regexp_eatClassControlLetter(state)) {\n return true\n }\n state.pos = start;\n }\n\n return (\n this.regexp_eatCharacterClassEscape(state) ||\n this.regexp_eatCharacterEscape(state)\n )\n};\n\n// https://tc39.es/ecma262/#prod-ClassSetExpression\n// https://tc39.es/ecma262/#prod-ClassUnion\n// https://tc39.es/ecma262/#prod-ClassIntersection\n// https://tc39.es/ecma262/#prod-ClassSubtraction\npp$1.regexp_classSetExpression = function(state) {\n var result = CharSetOk, subResult;\n if (this.regexp_eatClassSetRange(state)) ; else if (subResult = this.regexp_eatClassSetOperand(state)) {\n if (subResult === CharSetString) { result = CharSetString; }\n // https://tc39.es/ecma262/#prod-ClassIntersection\n var start = state.pos;\n while (state.eatChars([0x26, 0x26] /* && */)) {\n if (\n state.current() !== 0x26 /* & */ &&\n (subResult = this.regexp_eatClassSetOperand(state))\n ) {\n if (subResult !== CharSetString) { result = CharSetOk; }\n continue\n }\n state.raise(\"Invalid character in character class\");\n }\n if (start !== state.pos) { return result }\n // https://tc39.es/ecma262/#prod-ClassSubtraction\n while (state.eatChars([0x2D, 0x2D] /* -- */)) {\n if (this.regexp_eatClassSetOperand(state)) { continue }\n state.raise(\"Invalid character in character class\");\n }\n if (start !== state.pos) { return result }\n } else {\n state.raise(\"Invalid character in character class\");\n }\n // https://tc39.es/ecma262/#prod-ClassUnion\n for (;;) {\n if (this.regexp_eatClassSetRange(state)) { continue }\n subResult = this.regexp_eatClassSetOperand(state);\n if (!subResult) { return result }\n if (subResult === CharSetString) { result = CharSetString; }\n }\n};\n\n// https://tc39.es/ecma262/#prod-ClassSetRange\npp$1.regexp_eatClassSetRange = function(state) {\n var start = state.pos;\n if (this.regexp_eatClassSetCharacter(state)) {\n var left = state.lastIntValue;\n if (state.eat(0x2D /* - */) && this.regexp_eatClassSetCharacter(state)) {\n var right = state.lastIntValue;\n if (left !== -1 && right !== -1 && left > right) {\n state.raise(\"Range out of order in character class\");\n }\n return true\n }\n state.pos = start;\n }\n return false\n};\n\n// https://tc39.es/ecma262/#prod-ClassSetOperand\npp$1.regexp_eatClassSetOperand = function(state) {\n if (this.regexp_eatClassSetCharacter(state)) { return CharSetOk }\n return this.regexp_eatClassStringDisjunction(state) || this.regexp_eatNestedClass(state)\n};\n\n// https://tc39.es/ecma262/#prod-NestedClass\npp$1.regexp_eatNestedClass = function(state) {\n var start = state.pos;\n if (state.eat(0x5B /* [ */)) {\n var negate = state.eat(0x5E /* ^ */);\n var result = this.regexp_classContents(state);\n if (state.eat(0x5D /* ] */)) {\n if (negate && result === CharSetString) {\n state.raise(\"Negated character class may contain strings\");\n }\n return result\n }\n state.pos = start;\n }\n if (state.eat(0x5C /* \\ */)) {\n var result$1 = this.regexp_eatCharacterClassEscape(state);\n if (result$1) {\n return result$1\n }\n state.pos = start;\n }\n return null\n};\n\n// https://tc39.es/ecma262/#prod-ClassStringDisjunction\npp$1.regexp_eatClassStringDisjunction = function(state) {\n var start = state.pos;\n if (state.eatChars([0x5C, 0x71] /* \\q */)) {\n if (state.eat(0x7B /* { */)) {\n var result = this.regexp_classStringDisjunctionContents(state);\n if (state.eat(0x7D /* } */)) {\n return result\n }\n } else {\n // Make the same message as V8.\n state.raise(\"Invalid escape\");\n }\n state.pos = start;\n }\n return null\n};\n\n// https://tc39.es/ecma262/#prod-ClassStringDisjunctionContents\npp$1.regexp_classStringDisjunctionContents = function(state) {\n var result = this.regexp_classString(state);\n while (state.eat(0x7C /* | */)) {\n if (this.regexp_classString(state) === CharSetString) { result = CharSetString; }\n }\n return result\n};\n\n// https://tc39.es/ecma262/#prod-ClassString\n// https://tc39.es/ecma262/#prod-NonEmptyClassString\npp$1.regexp_classString = function(state) {\n var count = 0;\n while (this.regexp_eatClassSetCharacter(state)) { count++; }\n return count === 1 ? CharSetOk : CharSetString\n};\n\n// https://tc39.es/ecma262/#prod-ClassSetCharacter\npp$1.regexp_eatClassSetCharacter = function(state) {\n var start = state.pos;\n if (state.eat(0x5C /* \\ */)) {\n if (\n this.regexp_eatCharacterEscape(state) ||\n this.regexp_eatClassSetReservedPunctuator(state)\n ) {\n return true\n }\n if (state.eat(0x62 /* b */)) {\n state.lastIntValue = 0x08; /* <BS> */\n return true\n }\n state.pos = start;\n return false\n }\n var ch = state.current();\n if (ch < 0 || ch === state.lookahead() && isClassSetReservedDoublePunctuatorCharacter(ch)) { return false }\n if (isClassSetSyntaxCharacter(ch)) { return false }\n state.advance();\n state.lastIntValue = ch;\n return true\n};\n\n// https://tc39.es/ecma262/#prod-ClassSetReservedDoublePunctuator\nfunction isClassSetReservedDoublePunctuatorCharacter(ch) {\n return (\n ch === 0x21 /* ! */ ||\n ch >= 0x23 /* # */ && ch <= 0x26 /* & */ ||\n ch >= 0x2A /* * */ && ch <= 0x2C /* , */ ||\n ch === 0x2E /* . */ ||\n ch >= 0x3A /* : */ && ch <= 0x40 /* @ */ ||\n ch === 0x5E /* ^ */ ||\n ch === 0x60 /* ` */ ||\n ch === 0x7E /* ~ */\n )\n}\n\n// https://tc39.es/ecma262/#prod-ClassSetSyntaxCharacter\nfunction isClassSetSyntaxCharacter(ch) {\n return (\n ch === 0x28 /* ( */ ||\n ch === 0x29 /* ) */ ||\n ch === 0x2D /* - */ ||\n ch === 0x2F /* / */ ||\n ch >= 0x5B /* [ */ && ch <= 0x5D /* ] */ ||\n ch >= 0x7B /* { */ && ch <= 0x7D /* } */\n )\n}\n\n// https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator\npp$1.regexp_eatClassSetReservedPunctuator = function(state) {\n var ch = state.current();\n if (isClassSetReservedPunctuator(ch)) {\n state.lastIntValue = ch;\n state.advance();\n return true\n }\n return false\n};\n\n// https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator\nfunction isClassSetReservedPunctuator(ch) {\n return (\n ch === 0x21 /* ! */ ||\n ch === 0x23 /* # */ ||\n ch === 0x25 /* % */ ||\n ch === 0x26 /* & */ ||\n ch === 0x2C /* , */ ||\n ch === 0x2D /* - */ ||\n ch >= 0x3A /* : */ && ch <= 0x3E /* > */ ||\n ch === 0x40 /* @ */ ||\n ch === 0x60 /* ` */ ||\n ch === 0x7E /* ~ */\n )\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter\npp$1.regexp_eatClassControlLetter = function(state) {\n var ch = state.current();\n if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {\n state.lastIntValue = ch % 0x20;\n state.advance();\n return true\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence\npp$1.regexp_eatHexEscapeSequence = function(state) {\n var start = state.pos;\n if (state.eat(0x78 /* x */)) {\n if (this.regexp_eatFixedHexDigits(state, 2)) {\n return true\n }\n if (state.switchU) {\n state.raise(\"Invalid escape\");\n }\n state.pos = start;\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits\npp$1.regexp_eatDecimalDigits = function(state) {\n var start = state.pos;\n var ch = 0;\n state.lastIntValue = 0;\n while (isDecimalDigit(ch = state.current())) {\n state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);\n state.advance();\n }\n return state.pos !== start\n};\nfunction isDecimalDigit(ch) {\n return ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits\npp$1.regexp_eatHexDigits = function(state) {\n var start = state.pos;\n var ch = 0;\n state.lastIntValue = 0;\n while (isHexDigit(ch = state.current())) {\n state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);\n state.advance();\n }\n return state.pos !== start\n};\nfunction isHexDigit(ch) {\n return (\n (ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */) ||\n (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) ||\n (ch >= 0x61 /* a */ && ch <= 0x66 /* f */)\n )\n}\nfunction hexToInt(ch) {\n if (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) {\n return 10 + (ch - 0x41 /* A */)\n }\n if (ch >= 0x61 /* a */ && ch <= 0x66 /* f */) {\n return 10 + (ch - 0x61 /* a */)\n }\n return ch - 0x30 /* 0 */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence\n// Allows only 0-377(octal) i.e. 0-255(decimal).\npp$1.regexp_eatLegacyOctalEscapeSequence = function(state) {\n if (this.regexp_eatOctalDigit(state)) {\n var n1 = state.lastIntValue;\n if (this.regexp_eatOctalDigit(state)) {\n var n2 = state.lastIntValue;\n if (n1 <= 3 && this.regexp_eatOctalDigit(state)) {\n state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue;\n } else {\n state.lastIntValue = n1 * 8 + n2;\n }\n } else {\n state.lastIntValue = n1;\n }\n return true\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit\npp$1.regexp_eatOctalDigit = function(state) {\n var ch = state.current();\n if (isOctalDigit(ch)) {\n state.lastIntValue = ch - 0x30; /* 0 */\n state.advance();\n return true\n }\n state.lastIntValue = 0;\n return false\n};\nfunction isOctalDigit(ch) {\n return ch >= 0x30 /* 0 */ && ch <= 0x37 /* 7 */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits\n// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit\n// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence\npp$1.regexp_eatFixedHexDigits = function(state, length) {\n var start = state.pos;\n state.lastIntValue = 0;\n for (var i = 0; i < length; ++i) {\n var ch = state.current();\n if (!isHexDigit(ch)) {\n state.pos = start;\n return false\n }\n state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);\n state.advance();\n }\n return true\n};\n\n// Object type used to represent tokens. Note that normally, tokens\n// simply exist as properties on the parser object. This is only\n// used for the onToken callback and the external tokenizer.\n\nvar Token = function Token(p) {\n this.type = p.type;\n this.value = p.value;\n this.start = p.start;\n this.end = p.end;\n if (p.options.locations)\n { this.loc = new SourceLocation(p, p.startLoc, p.endLoc); }\n if (p.options.ranges)\n { this.range = [p.start, p.end]; }\n};\n\n// ## Tokenizer\n\nvar pp = Parser.prototype;\n\n// Move to the next token\n\npp.next = function(ignoreEscapeSequenceInKeyword) {\n if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc)\n { this.raiseRecoverable(this.start, \"Escape sequence in keyword \" + this.type.keyword); }\n if (this.options.onToken)\n { this.options.onToken(new Token(this)); }\n\n this.lastTokEnd = this.end;\n this.lastTokStart = this.start;\n this.lastTokEndLoc = this.endLoc;\n this.lastTokStartLoc = this.startLoc;\n this.nextToken();\n};\n\npp.getToken = function() {\n this.next();\n return new Token(this)\n};\n\n// If we're in an ES6 environment, make parsers iterable\nif (typeof Symbol !== \"undefined\")\n { pp[Symbol.iterator] = function() {\n var this$1$1 = this;\n\n return {\n next: function () {\n var token = this$1$1.getToken();\n return {\n done: token.type === types$1.eof,\n value: token\n }\n }\n }\n }; }\n\n// Toggle strict mode. Re-reads the next number or string to please\n// pedantic tests (`\"use strict\"; 010;` should fail).\n\n// Read a single token, updating the parser object's token-related\n// properties.\n\npp.nextToken = function() {\n var curContext = this.curContext();\n if (!curContext || !curContext.preserveSpace) { this.skipSpace(); }\n\n this.start = this.pos;\n if (this.options.locations) { this.startLoc = this.curPosition(); }\n if (this.pos >= this.input.length) { return this.finishToken(types$1.eof) }\n\n if (curContext.override) { return curContext.override(this) }\n else { this.readToken(this.fullCharCodeAtPos()); }\n};\n\npp.readToken = function(code) {\n // Identifier or keyword. '\\uXXXX' sequences are allowed in\n // identifiers, so '\\' also dispatches to that.\n if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\\' */)\n { return this.readWord() }\n\n return this.getTokenFromCode(code)\n};\n\npp.fullCharCodeAtPos = function() {\n var code = this.input.charCodeAt(this.pos);\n if (code <= 0xd7ff || code >= 0xdc00) { return code }\n var next = this.input.charCodeAt(this.pos + 1);\n return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00\n};\n\npp.skipBlockComment = function() {\n var startLoc = this.options.onComment && this.curPosition();\n var start = this.pos, end = this.input.indexOf(\"*/\", this.pos += 2);\n if (end === -1) { this.raise(this.pos - 2, \"Unterminated comment\"); }\n this.pos = end + 2;\n if (this.options.locations) {\n for (var nextBreak = (void 0), pos = start; (nextBreak = nextLineBreak(this.input, pos, this.pos)) > -1;) {\n ++this.curLine;\n pos = this.lineStart = nextBreak;\n }\n }\n if (this.options.onComment)\n { this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos,\n startLoc, this.curPosition()); }\n};\n\npp.skipLineComment = function(startSkip) {\n var start = this.pos;\n var startLoc = this.options.onComment && this.curPosition();\n var ch = this.input.charCodeAt(this.pos += startSkip);\n while (this.pos < this.input.length && !isNewLine(ch)) {\n ch = this.input.charCodeAt(++this.pos);\n }\n if (this.options.onComment)\n { this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos,\n startLoc, this.curPosition()); }\n};\n\n// Called at the start of the parse and after every token. Skips\n// whitespace and comments, and.\n\npp.skipSpace = function() {\n loop: while (this.pos < this.input.length) {\n var ch = this.input.charCodeAt(this.pos);\n switch (ch) {\n case 32: case 160: // ' '\n ++this.pos;\n break\n case 13:\n if (this.input.charCodeAt(this.pos + 1) === 10) {\n ++this.pos;\n }\n case 10: case 8232: case 8233:\n ++this.pos;\n if (this.options.locations) {\n ++this.curLine;\n this.lineStart = this.pos;\n }\n break\n case 47: // '/'\n switch (this.input.charCodeAt(this.pos + 1)) {\n case 42: // '*'\n this.skipBlockComment();\n break\n case 47:\n this.skipLineComment(2);\n break\n default:\n break loop\n }\n break\n default:\n if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {\n ++this.pos;\n } else {\n break loop\n }\n }\n }\n};\n\n// Called at the end of every token. Sets `end`, `val`, and\n// maintains `context` and `exprAllowed`, and skips the space after\n// the token, so that the next one's `start` will point at the\n// right position.\n\npp.finishToken = function(type, val) {\n this.end = this.pos;\n if (this.options.locations) { this.endLoc = this.curPosition(); }\n var prevType = this.type;\n this.type = type;\n this.value = val;\n\n this.updateContext(prevType);\n};\n\n// ### Token reading\n\n// This is the function that is called to fetch the next token. It\n// is somewhat obscure, because it works in character codes rather\n// than characters, and because operator parsing has been inlined\n// into it.\n//\n// All in the name of speed.\n//\npp.readToken_dot = function() {\n var next = this.input.charCodeAt(this.pos + 1);\n if (next >= 48 && next <= 57) { return this.readNumber(true) }\n var next2 = this.input.charCodeAt(this.pos + 2);\n if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'\n this.pos += 3;\n return this.finishToken(types$1.ellipsis)\n } else {\n ++this.pos;\n return this.finishToken(types$1.dot)\n }\n};\n\npp.readToken_slash = function() { // '/'\n var next = this.input.charCodeAt(this.pos + 1);\n if (this.exprAllowed) { ++this.pos; return this.readRegexp() }\n if (next === 61) { return this.finishOp(types$1.assign, 2) }\n return this.finishOp(types$1.slash, 1)\n};\n\npp.readToken_mult_modulo_exp = function(code) { // '%*'\n var next = this.input.charCodeAt(this.pos + 1);\n var size = 1;\n var tokentype = code === 42 ? types$1.star : types$1.modulo;\n\n // exponentiation operator ** and **=\n if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {\n ++size;\n tokentype = types$1.starstar;\n next = this.input.charCodeAt(this.pos + 2);\n }\n\n if (next === 61) { return this.finishOp(types$1.assign, size + 1) }\n return this.finishOp(tokentype, size)\n};\n\npp.readToken_pipe_amp = function(code) { // '|&'\n var next = this.input.charCodeAt(this.pos + 1);\n if (next === code) {\n if (this.options.ecmaVersion >= 12) {\n var next2 = this.input.charCodeAt(this.pos + 2);\n if (next2 === 61) { return this.finishOp(types$1.assign, 3) }\n }\n return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2)\n }\n if (next === 61) { return this.finishOp(types$1.assign, 2) }\n return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1)\n};\n\npp.readToken_caret = function() { // '^'\n var next = this.input.charCodeAt(this.pos + 1);\n if (next === 61) { return this.finishOp(types$1.assign, 2) }\n return this.finishOp(types$1.bitwiseXOR, 1)\n};\n\npp.readToken_plus_min = function(code) { // '+-'\n var next = this.input.charCodeAt(this.pos + 1);\n if (next === code) {\n if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&\n (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) {\n // A `-->` line comment\n this.skipLineComment(3);\n this.skipSpace();\n return this.nextToken()\n }\n return this.finishOp(types$1.incDec, 2)\n }\n if (next === 61) { return this.finishOp(types$1.assign, 2) }\n return this.finishOp(types$1.plusMin, 1)\n};\n\npp.readToken_lt_gt = function(code) { // '<>'\n var next = this.input.charCodeAt(this.pos + 1);\n var size = 1;\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;\n if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types$1.assign, size + 1) }\n return this.finishOp(types$1.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // `<!--`, an XML-style comment that should be interpreted as a line comment\n this.skipLineComment(4);\n this.skipSpace();\n return this.nextToken()\n }\n if (next === 61) { size = 2; }\n return this.finishOp(types$1.relational, size)\n};\n\npp.readToken_eq_excl = function(code) { // '=!'\n var next = this.input.charCodeAt(this.pos + 1);\n if (next === 61) { return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }\n if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'\n this.pos += 2;\n return this.finishToken(types$1.arrow)\n }\n return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1)\n};\n\npp.readToken_question = function() { // '?'\n var ecmaVersion = this.options.ecmaVersion;\n if (ecmaVersion >= 11) {\n var next = this.input.charCodeAt(this.pos + 1);\n if (next === 46) {\n var next2 = this.input.charCodeAt(this.pos + 2);\n if (next2 < 48 || next2 > 57) { return this.finishOp(types$1.questionDot, 2) }\n }\n if (next === 63) {\n if (ecmaVersion >= 12) {\n var next2$1 = this.input.charCodeAt(this.pos + 2);\n if (next2$1 === 61) { return this.finishOp(types$1.assign, 3) }\n }\n return this.finishOp(types$1.coalesce, 2)\n }\n }\n return this.finishOp(types$1.question, 1)\n};\n\npp.readToken_numberSign = function() { // '#'\n var ecmaVersion = this.options.ecmaVersion;\n var code = 35; // '#'\n if (ecmaVersion >= 13) {\n ++this.pos;\n code = this.fullCharCodeAtPos();\n if (isIdentifierStart(code, true) || code === 92 /* '\\' */) {\n return this.finishToken(types$1.privateId, this.readWord1())\n }\n }\n\n this.raise(this.pos, \"Unexpected character '\" + codePointToString(code) + \"'\");\n};\n\npp.getTokenFromCode = function(code) {\n switch (code) {\n // The interpretation of a dot depends on whether it is followed\n // by a digit or another two dots.\n case 46: // '.'\n return this.readToken_dot()\n\n // Punctuation tokens.\n case 40: ++this.pos; return this.finishToken(types$1.parenL)\n case 41: ++this.pos; return this.finishToken(types$1.parenR)\n case 59: ++this.pos; return this.finishToken(types$1.semi)\n case 44: ++this.pos; return this.finishToken(types$1.comma)\n case 91: ++this.pos; return this.finishToken(types$1.bracketL)\n case 93: ++this.pos; return this.finishToken(types$1.bracketR)\n case 123: ++this.pos; return this.finishToken(types$1.braceL)\n case 125: ++this.pos; return this.finishToken(types$1.braceR)\n case 58: ++this.pos; return this.finishToken(types$1.colon)\n\n case 96: // '`'\n if (this.options.ecmaVersion < 6) { break }\n ++this.pos;\n return this.finishToken(types$1.backQuote)\n\n case 48: // '0'\n var next = this.input.charCodeAt(this.pos + 1);\n if (next === 120 || next === 88) { return this.readRadixNumber(16) } // '0x', '0X' - hex number\n if (this.options.ecmaVersion >= 6) {\n if (next === 111 || next === 79) { return this.readRadixNumber(8) } // '0o', '0O' - octal number\n if (next === 98 || next === 66) { return this.readRadixNumber(2) } // '0b', '0B' - binary number\n }\n\n // Anything else beginning with a digit is an integer, octal\n // number, or float.\n case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: // 1-9\n return this.readNumber(false)\n\n // Quotes produce strings.\n case 34: case 39: // '\"', \"'\"\n return this.readString(code)\n\n // Operators are parsed inline in tiny state machines. '=' (61) is\n // often referred to. `finishOp` simply skips the amount of\n // characters it is given as second argument, and returns a token\n // of the type given by its first argument.\n case 47: // '/'\n return this.readToken_slash()\n\n case 37: case 42: // '%*'\n return this.readToken_mult_modulo_exp(code)\n\n case 124: case 38: // '|&'\n return this.readToken_pipe_amp(code)\n\n case 94: // '^'\n return this.readToken_caret()\n\n case 43: case 45: // '+-'\n return this.readToken_plus_min(code)\n\n case 60: case 62: // '<>'\n return this.readToken_lt_gt(code)\n\n case 61: case 33: // '=!'\n return this.readToken_eq_excl(code)\n\n case 63: // '?'\n return this.readToken_question()\n\n case 126: // '~'\n return this.finishOp(types$1.prefix, 1)\n\n case 35: // '#'\n return this.readToken_numberSign()\n }\n\n this.raise(this.pos, \"Unexpected character '\" + codePointToString(code) + \"'\");\n};\n\npp.finishOp = function(type, size) {\n var str = this.input.slice(this.pos, this.pos + size);\n this.pos += size;\n return this.finishToken(type, str)\n};\n\npp.readRegexp = function() {\n var escaped, inClass, start = this.pos;\n for (;;) {\n if (this.pos >= this.input.length) { this.raise(start, \"Unterminated regular expression\"); }\n var ch = this.input.charAt(this.pos);\n if (lineBreak.test(ch)) { this.raise(start, \"Unterminated regular expression\"); }\n if (!escaped) {\n if (ch === \"[\") { inClass = true; }\n else if (ch === \"]\" && inClass) { inClass = false; }\n else if (ch === \"/\" && !inClass) { break }\n escaped = ch === \"\\\\\";\n } else { escaped = false; }\n ++this.pos;\n }\n var pattern = this.input.slice(start, this.pos);\n ++this.pos;\n var flagsStart = this.pos;\n var flags = this.readWord1();\n if (this.containsEsc) { this.unexpected(flagsStart); }\n\n // Validate pattern\n var state = this.regexpState || (this.regexpState = new RegExpValidationState(this));\n state.reset(start, pattern, flags);\n this.validateRegExpFlags(state);\n this.validateRegExpPattern(state);\n\n // Create Literal#value property value.\n var value = null;\n try {\n value = new RegExp(pattern, flags);\n } catch (e) {\n // ESTree requires null if it failed to instantiate RegExp object.\n // https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral\n }\n\n return this.finishToken(types$1.regexp, {pattern: pattern, flags: flags, value: value})\n};\n\n// Read an integer in the given radix. Return null if zero digits\n// were read, the integer value otherwise. When `len` is given, this\n// will return `null` unless the integer has exactly `len` digits.\n\npp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {\n // `len` is used for character escape sequences. In that case, disallow separators.\n var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined;\n\n // `maybeLegacyOctalNumericLiteral` is true if it doesn't have prefix (0x,0o,0b)\n // and isn't fraction part nor exponent part. In that case, if the first digit\n // is zero then disallow separators.\n var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48;\n\n var start = this.pos, total = 0, lastCode = 0;\n for (var i = 0, e = len == null ? Infinity : len; i < e; ++i, ++this.pos) {\n var code = this.input.charCodeAt(this.pos), val = (void 0);\n\n if (allowSeparators && code === 95) {\n if (isLegacyOctalNumericLiteral) { this.raiseRecoverable(this.pos, \"Numeric separator is not allowed in legacy octal numeric literals\"); }\n if (lastCode === 95) { this.raiseRecoverable(this.pos, \"Numeric separator must be exactly one underscore\"); }\n if (i === 0) { this.raiseRecoverable(this.pos, \"Numeric separator is not allowed at the first of digits\"); }\n lastCode = code;\n continue\n }\n\n if (code >= 97) { val = code - 97 + 10; } // a\n else if (code >= 65) { val = code - 65 + 10; } // A\n else if (code >= 48 && code <= 57) { val = code - 48; } // 0-9\n else { val = Infinity; }\n if (val >= radix) { break }\n lastCode = code;\n total = total * radix + val;\n }\n\n if (allowSeparators && lastCode === 95) { this.raiseRecoverable(this.pos - 1, \"Numeric separator is not allowed at the last of digits\"); }\n if (this.pos === start || len != null && this.pos - start !== len) { return null }\n\n return total\n};\n\nfunction stringToNumber(str, isLegacyOctalNumericLiteral) {\n if (isLegacyOctalNumericLiteral) {\n return parseInt(str, 8)\n }\n\n // `parseFloat(value)` stops parsing at the first numeric separator then returns a wrong value.\n return parseFloat(str.replace(/_/g, \"\"))\n}\n\nfunction stringToBigInt(str) {\n if (typeof BigInt !== \"function\") {\n return null\n }\n\n // `BigInt(value)` throws syntax error if the string contains numeric separators.\n return BigInt(str.replace(/_/g, \"\"))\n}\n\npp.readRadixNumber = function(radix) {\n var start = this.pos;\n this.pos += 2; // 0x\n var val = this.readInt(radix);\n if (val == null) { this.raise(this.start + 2, \"Expected number in radix \" + radix); }\n if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) {\n val = stringToBigInt(this.input.slice(start, this.pos));\n ++this.pos;\n } else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, \"Identifier directly after number\"); }\n return this.finishToken(types$1.num, val)\n};\n\n// Read an integer, octal integer, or floating-point number.\n\npp.readNumber = function(startsWithDot) {\n var start = this.pos;\n if (!startsWithDot && this.readInt(10, undefined, true) === null) { this.raise(start, \"Invalid number\"); }\n var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;\n if (octal && this.strict) { this.raise(start, \"Invalid number\"); }\n var next = this.input.charCodeAt(this.pos);\n if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) {\n var val$1 = stringToBigInt(this.input.slice(start, this.pos));\n ++this.pos;\n if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, \"Identifier directly after number\"); }\n return this.finishToken(types$1.num, val$1)\n }\n if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; }\n if (next === 46 && !octal) { // '.'\n ++this.pos;\n this.readInt(10);\n next = this.input.charCodeAt(this.pos);\n }\n if ((next === 69 || next === 101) && !octal) { // 'eE'\n next = this.input.charCodeAt(++this.pos);\n if (next === 43 || next === 45) { ++this.pos; } // '+-'\n if (this.readInt(10) === null) { this.raise(start, \"Invalid number\"); }\n }\n if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, \"Identifier directly after number\"); }\n\n var val = stringToNumber(this.input.slice(start, this.pos), octal);\n return this.finishToken(types$1.num, val)\n};\n\n// Read a string value, interpreting backslash-escapes.\n\npp.readCodePoint = function() {\n var ch = this.input.charCodeAt(this.pos), code;\n\n if (ch === 123) { // '{'\n if (this.options.ecmaVersion < 6) { this.unexpected(); }\n var codePos = ++this.pos;\n code = this.readHexChar(this.input.indexOf(\"}\", this.pos) - this.pos);\n ++this.pos;\n if (code > 0x10FFFF) { this.invalidStringToken(codePos, \"Code point out of bounds\"); }\n } else {\n code = this.readHexChar(4);\n }\n return code\n};\n\npp.readString = function(quote) {\n var out = \"\", chunkStart = ++this.pos;\n for (;;) {\n if (this.pos >= this.input.length) { this.raise(this.start, \"Unterminated string constant\"); }\n var ch = this.input.charCodeAt(this.pos);\n if (ch === quote) { break }\n if (ch === 92) { // '\\'\n out += this.input.slice(chunkStart, this.pos);\n out += this.readEscapedChar(false);\n chunkStart = this.pos;\n } else if (ch === 0x2028 || ch === 0x2029) {\n if (this.options.ecmaVersion < 10) { this.raise(this.start, \"Unterminated string constant\"); }\n ++this.pos;\n if (this.options.locations) {\n this.curLine++;\n this.lineStart = this.pos;\n }\n } else {\n if (isNewLine(ch)) { this.raise(this.start, \"Unterminated string constant\"); }\n ++this.pos;\n }\n }\n out += this.input.slice(chunkStart, this.pos++);\n return this.finishToken(types$1.string, out)\n};\n\n// Reads template string tokens.\n\nvar INVALID_TEMPLATE_ESCAPE_ERROR = {};\n\npp.tryReadTemplateToken = function() {\n this.inTemplateElement = true;\n try {\n this.readTmplToken();\n } catch (err) {\n if (err === INVALID_TEMPLATE_ESCAPE_ERROR) {\n this.readInvalidTemplateToken();\n } else {\n throw err\n }\n }\n\n this.inTemplateElement = false;\n};\n\npp.invalidStringToken = function(position, message) {\n if (this.inTemplateElement && this.options.ecmaVersion >= 9) {\n throw INVALID_TEMPLATE_ESCAPE_ERROR\n } else {\n this.raise(position, message);\n }\n};\n\npp.readTmplToken = function() {\n var out = \"\", chunkStart = this.pos;\n for (;;) {\n if (this.pos >= this.input.length) { this.raise(this.start, \"Unterminated template\"); }\n var ch = this.input.charCodeAt(this.pos);\n if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { // '`', '${'\n if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) {\n if (ch === 36) {\n this.pos += 2;\n return this.finishToken(types$1.dollarBraceL)\n } else {\n ++this.pos;\n return this.finishToken(types$1.backQuote)\n }\n }\n out += this.input.slice(chunkStart, this.pos);\n return this.finishToken(types$1.template, out)\n }\n if (ch === 92) { // '\\'\n out += this.input.slice(chunkStart, this.pos);\n out += this.readEscapedChar(true);\n chunkStart = this.pos;\n } else if (isNewLine(ch)) {\n out += this.input.slice(chunkStart, this.pos);\n ++this.pos;\n switch (ch) {\n case 13:\n if (this.input.charCodeAt(this.pos) === 10) { ++this.pos; }\n case 10:\n out += \"\\n\";\n break\n default:\n out += String.fromCharCode(ch);\n break\n }\n if (this.options.locations) {\n ++this.curLine;\n this.lineStart = this.pos;\n }\n chunkStart = this.pos;\n } else {\n ++this.pos;\n }\n }\n};\n\n// Reads a template token to search for the end, without validating any escape sequences\npp.readInvalidTemplateToken = function() {\n for (; this.pos < this.input.length; this.pos++) {\n switch (this.input[this.pos]) {\n case \"\\\\\":\n ++this.pos;\n break\n\n case \"$\":\n if (this.input[this.pos + 1] !== \"{\") { break }\n // fall through\n case \"`\":\n return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos))\n\n case \"\\r\":\n if (this.input[this.pos + 1] === \"\\n\") { ++this.pos; }\n // fall through\n case \"\\n\": case \"\\u2028\": case \"\\u2029\":\n ++this.curLine;\n this.lineStart = this.pos + 1;\n break\n }\n }\n this.raise(this.start, \"Unterminated template\");\n};\n\n// Used to read escaped characters\n\npp.readEscapedChar = function(inTemplate) {\n var ch = this.input.charCodeAt(++this.pos);\n ++this.pos;\n switch (ch) {\n case 110: return \"\\n\" // 'n' -> '\\n'\n case 114: return \"\\r\" // 'r' -> '\\r'\n case 120: return String.fromCharCode(this.readHexChar(2)) // 'x'\n case 117: return codePointToString(this.readCodePoint()) // 'u'\n case 116: return \"\\t\" // 't' -> '\\t'\n case 98: return \"\\b\" // 'b' -> '\\b'\n case 118: return \"\\u000b\" // 'v' -> '\\u000b'\n case 102: return \"\\f\" // 'f' -> '\\f'\n case 13: if (this.input.charCodeAt(this.pos) === 10) { ++this.pos; } // '\\r\\n'\n case 10: // ' \\n'\n if (this.options.locations) { this.lineStart = this.pos; ++this.curLine; }\n return \"\"\n case 56:\n case 57:\n if (this.strict) {\n this.invalidStringToken(\n this.pos - 1,\n \"Invalid escape sequence\"\n );\n }\n if (inTemplate) {\n var codePos = this.pos - 1;\n\n this.invalidStringToken(\n codePos,\n \"Invalid escape sequence in template string\"\n );\n }\n default:\n if (ch >= 48 && ch <= 55) {\n var octalStr = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0];\n var octal = parseInt(octalStr, 8);\n if (octal > 255) {\n octalStr = octalStr.slice(0, -1);\n octal = parseInt(octalStr, 8);\n }\n this.pos += octalStr.length - 1;\n ch = this.input.charCodeAt(this.pos);\n if ((octalStr !== \"0\" || ch === 56 || ch === 57) && (this.strict || inTemplate)) {\n this.invalidStringToken(\n this.pos - 1 - octalStr.length,\n inTemplate\n ? \"Octal literal in template string\"\n : \"Octal literal in strict mode\"\n );\n }\n return String.fromCharCode(octal)\n }\n if (isNewLine(ch)) {\n // Unicode new line characters after \\ get removed from output in both\n // template literals and strings\n if (this.options.locations) { this.lineStart = this.pos; ++this.curLine; }\n return \"\"\n }\n return String.fromCharCode(ch)\n }\n};\n\n// Used to read character escape sequences ('\\x', '\\u', '\\U').\n\npp.readHexChar = function(len) {\n var codePos = this.pos;\n var n = this.readInt(16, len);\n if (n === null) { this.invalidStringToken(codePos, \"Bad character escape sequence\"); }\n return n\n};\n\n// Read an identifier, and return it as a string. Sets `this.containsEsc`\n// to whether the word contained a '\\u' escape.\n//\n// Incrementally adds only escaped chars, adding other chunks as-is\n// as a micro-optimization.\n\npp.readWord1 = function() {\n this.containsEsc = false;\n var word = \"\", first = true, chunkStart = this.pos;\n var astral = this.options.ecmaVersion >= 6;\n while (this.pos < this.input.length) {\n var ch = this.fullCharCodeAtPos();\n if (isIdentifierChar(ch, astral)) {\n this.pos += ch <= 0xffff ? 1 : 2;\n } else if (ch === 92) { // \"\\\"\n this.containsEsc = true;\n word += this.input.slice(chunkStart, this.pos);\n var escStart = this.pos;\n if (this.input.charCodeAt(++this.pos) !== 117) // \"u\"\n { this.invalidStringToken(this.pos, \"Expecting Unicode escape sequence \\\\uXXXX\"); }\n ++this.pos;\n var esc = this.readCodePoint();\n if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))\n { this.invalidStringToken(escStart, \"Invalid Unicode escape\"); }\n word += codePointToString(esc);\n chunkStart = this.pos;\n } else {\n break\n }\n first = false;\n }\n return word + this.input.slice(chunkStart, this.pos)\n};\n\n// Read an identifier or keyword token. Will check for reserved\n// words when necessary.\n\npp.readWord = function() {\n var word = this.readWord1();\n var type = types$1.name;\n if (this.keywords.test(word)) {\n type = keywords[word];\n }\n return this.finishToken(type, word)\n};\n\n// Acorn is a tiny, fast JavaScript parser written in JavaScript.\n//\n// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and\n// various contributors and released under an MIT license.\n//\n// Git repositories for Acorn are available at\n//\n// http://marijnhaverbeke.nl/git/acorn\n// https://github.com/acornjs/acorn.git\n//\n// Please use the [github bug tracker][ghbt] to report issues.\n//\n// [ghbt]: https://github.com/acornjs/acorn/issues\n\n\nvar version = \"8.15.0\";\n\nParser.acorn = {\n Parser: Parser,\n version: version,\n defaultOptions: defaultOptions,\n Position: Position,\n SourceLocation: SourceLocation,\n getLineInfo: getLineInfo,\n Node: Node,\n TokenType: TokenType,\n tokTypes: types$1,\n keywordTypes: keywords,\n TokContext: TokContext,\n tokContexts: types,\n isIdentifierChar: isIdentifierChar,\n isIdentifierStart: isIdentifierStart,\n Token: Token,\n isNewLine: isNewLine,\n lineBreak: lineBreak,\n lineBreakG: lineBreakG,\n nonASCIIwhitespace: nonASCIIwhitespace\n};\n\n// The main exported interface (under `self.acorn` when in the\n// browser) is a `parse` function that takes a code string and returns\n// an abstract syntax tree as specified by the [ESTree spec][estree].\n//\n// [estree]: https://github.com/estree/estree\n\nfunction parse(input, options) {\n return Parser.parse(input, options)\n}\n\n// This function tries to parse a single expression at a given\n// offset in a string. Useful for parsing mixed-language formats\n// that embed JavaScript expressions.\n\nfunction parseExpressionAt(input, pos, options) {\n return Parser.parseExpressionAt(input, pos, options)\n}\n\n// Acorn is organized as a tokenizer and a recursive-descent parser.\n// The `tokenizer` export provides an interface to the tokenizer.\n\nfunction tokenizer(input, options) {\n return Parser.tokenizer(input, options)\n}\n\nexport { Node, Parser, Position, SourceLocation, TokContext, Token, TokenType, defaultOptions, getLineInfo, isIdentifierChar, isIdentifierStart, isNewLine, keywords as keywordTypes, lineBreak, lineBreakG, nonASCIIwhitespace, parse, parseExpressionAt, types as tokContexts, types$1 as tokTypes, tokenizer, version };\n","/**\n * Sanitize an ID for use as an AssemblyScript identifier.\n * Replaces hyphens and other special characters with underscores.\n *\n * @param id - The ID to sanitize\n * @returns A valid AssemblyScript identifier\n */\nexport function sanitizeId(id: string): string {\n // Replace hyphens and other non-alphanumeric characters (except underscores) with underscores\n return id.replace(/[^a-zA-Z0-9_]/g, '_');\n}\n\n/**\n * Convert a node name to a camelCase key.\n * Used for wrapping decision table outputs with the node name.\n * Example: \"RiskFactors\" -> \"riskFactors\", \"DiscountRules\" -> \"discountRules\"\n *\n * @param name - The node name to convert\n * @returns A camelCase key\n */\nexport function nodeNameToKey(name: string): string {\n if (!name || name.length === 0) {\n return name;\n }\n // Lowercase the first character\n return name.charAt(0).toLowerCase() + name.slice(1);\n}\n","import type { CompilationContext } from '../types';\nimport { CompilationError, ErrorCode, type SourceLocation } from '../errors';\nimport { parse as parseAcorn } from 'acorn';\nimport { sanitizeId } from '../utils';\n\n/**\n * Function node content interface\n */\nexport interface FunctionNodeContent {\n /** The JavaScript source code for the function */\n source: string;\n /** Parsed AST of the function body */\n ast?: any;\n /** Extracted function parameters */\n parameters: string[];\n}\n\n/**\n * Extract the source code from a function node content field.\n *\n * Handles both legacy format (plain string) and v2 format (object with source property).\n * TODO: Verify if legacy format still exists in fixtures, update comment accordingly\n *\n * @param content - The content field from a function node\n * @param location - Optional source location for error reporting\n * @returns The JavaScript source code string\n */\nexport function extractFunctionSource(content: any, location?: SourceLocation): string {\n if (content === null || content === undefined) {\n throw new CompilationError(\n 'Function node content is missing',\n ErrorCode.INVALID_NODE_STRUCTURE,\n location,\n );\n }\n\n if (typeof content === 'object' && content.source !== undefined) {\n if (typeof content.source !== 'string') {\n throw new CompilationError(\n 'Function node content.source must be a string',\n ErrorCode.INVALID_NODE_STRUCTURE,\n { ...location, field: 'content.source' },\n );\n }\n return content.source;\n }\n\n if (typeof content === 'string') {\n return content;\n }\n\n throw new CompilationError(\n 'Function node content must be either a string or an object with a source property',\n ErrorCode.INVALID_NODE_STRUCTURE,\n { ...location, field: 'content' },\n );\n}\n\n/**\n * Parse JavaScript function code to extract parameters and body.\n *\n * @param source - The JavaScript source code string\n * @param location - Optional source location for error reporting\n * @returns A FunctionNodeContent with extracted information\n */\nexport function parseFunctionCode(source: string, location?: SourceLocation): FunctionNodeContent {\n const content: FunctionNodeContent = {\n source,\n parameters: [],\n };\n\n try {\n // Parse the source code using Acorn.\n const ast = parseAcorn(source, {\n ecmaVersion: 'latest',\n sourceType: 'module',\n allowAwaitOutsideFunction: true,\n });\n\n content.ast = ast;\n\n const functionNode = findExportedFunction(ast);\n\n if (functionNode) {\n content.parameters = extractParameters(functionNode);\n }\n } catch (error) {\n // Parse errors in function code should fail compilation immediately with clear error\n // messages, rather than deferring to runtime where the error context would be lost.\n if (error instanceof Error) {\n throw new CompilationError(\n `Failed to parse function code: ${error.message}`,\n ErrorCode.PARSE_ERROR,\n { ...location, field: 'content.source' },\n );\n }\n throw error;\n }\n\n return content;\n}\n\n/**\n * Validate a function node's content structure.\n *\n * @param node - The JDM function node to validate\n * @returns Extracted and validated function node content\n */\nexport function validateFunctionNode(node: {\n id: string;\n name: string;\n content?: any;\n}): FunctionNodeContent {\n const location: SourceLocation = { nodeId: node.id, nodeName: node.name };\n\n if (!node.content) {\n throw new CompilationError(\n `Function node \"${node.name}\" (${node.id}) is missing required content field`,\n ErrorCode.INVALID_NODE_STRUCTURE,\n { ...location, field: 'content' },\n );\n }\n\n const source = extractFunctionSource(node.content, location);\n\n const parsedContent = parseFunctionCode(source, location);\n\n return {\n ...parsedContent,\n source,\n };\n}\n\n/**\n * Find an exported function in the AST.\n *\n * Looks for patterns like:\n * - `export const handler = (input) => { ... }`\n * - `export function handler(input) { ... }`\n *\n * @param ast - The parsed AST\n * @returns The function declaration or expression, or null if not found\n */\nfunction findExportedFunction(ast: any): any {\n if (!ast.body) {\n return null;\n }\n\n for (const node of ast.body) {\n // Pattern: export function name(...) { ... }\n if (node.type === 'ExportNamedDeclaration' && node.declaration) {\n if (node.declaration.type === 'FunctionDeclaration') {\n return node.declaration;\n }\n }\n\n // Pattern: export const/let/var name = (input) => { ... }\n if (node.type === 'ExportNamedDeclaration' && node.declaration) {\n if (node.declaration.type === 'VariableDeclaration') {\n const declarator = node.declaration.declarations[0];\n if (declarator && declarator.init) {\n // Arrow function: (input) => { ... }\n if (declarator.init.type === 'ArrowFunctionExpression') {\n return declarator.init;\n }\n // Regular function: function(input) { ... }\n if (declarator.init.type === 'FunctionExpression') {\n return declarator.init;\n }\n }\n }\n }\n\n // Pattern: export default ...) => { ... }\n if (node.type === 'ExportDefaultDeclaration') {\n if (node.declaration.type === 'FunctionDeclaration') {\n return node.declaration;\n }\n if (node.declaration.type === 'ArrowFunctionExpression') {\n return node.declaration;\n }\n if (node.declaration.type === 'FunctionExpression') {\n return node.declaration;\n }\n }\n }\n\n return null;\n}\n\n/**\n * Extract parameter names from a function AST node.\n *\n * @param functionNode - The function AST node\n * @returns Array of parameter names\n */\nfunction extractParameters(functionNode: any): string[] {\n if (!functionNode.params || !Array.isArray(functionNode.params)) {\n return [];\n }\n\n return functionNode.params\n .map((param: any) => {\n // Simple identifier: input\n if (param.type === 'Identifier') {\n return param.name;\n }\n\n // Destructuring: { input, context } or [input, context]\n if (param.type === 'ObjectPattern') {\n return param.properties\n .map((prop: any) => prop.key?.name || prop.value?.name)\n .filter(Boolean);\n }\n\n if (param.type === 'ArrayPattern') {\n return param.elements.map((elem: any) => elem?.name).filter(Boolean);\n }\n\n return null;\n })\n .flat()\n .filter(Boolean) as string[];\n}\n\n/**\n * Compile a function node to AssemblyScript code.\n *\n * This function generates AssemblyScript code that:\n * 1. Reads input parameters from the context\n * 2. Calls the JavaScript bridge function to execute the user's function\n * 3. Converts the return value to the Value type\n *\n * @param node - The JDM function node\n * @param context - The compilation context\n * @returns Generated AssemblyScript code for evaluating the function node\n */\nexport function compileFunctionNode(\n node: {\n id: string;\n name: string;\n content?: any;\n parsedContent?: FunctionNodeContent;\n },\n context: CompilationContext,\n): string {\n const sanitizedId = sanitizeId(node.id);\n\n if (!node.parsedContent) {\n throw new CompilationError(\n `Function node \"${node.name}\" (${node.id}) has not been parsed`,\n ErrorCode.INVALID_NODE_STRUCTURE,\n { nodeId: node.id, nodeName: node.name, field: 'parsedContent' },\n );\n }\n\n const { source, parameters } = node.parsedContent;\n\n // Store the function source in the compilation context for later retrieval.\n // Function sources must be kept separate from runtime context data to avoid naming conflicts\n // and ensure proper scoping. The prefix prevents collisions with user-defined fields.\n if (!context.functionSources) {\n context.functionSources = new Map();\n }\n context.functionSources.set(sanitizedId, source);\n\n // Generate parameter reading and marshaling code\n // Parameters need to be collected into an array for the bridge call\n const paramReads =\n parameters.length > 0\n ? parameters\n .map((param) => {\n return ` let ${param} = ctx.get(\"${param}\");`;\n })\n .join('\\n')\n : '';\n\n const paramArray =\n parameters.length > 0\n ? `\n // Create parameter array for JavaScript bridge\n let params = new Array<Value>(0);\n${parameters.map((param) => ` params.push(${param});`).join('\\n')}\n`\n : `\n // No parameters\n let params = new Array<Value>(0);\n`;\n\n // Generate the main evaluateNode function\n // TODO: Mock execution returns a placeholder result for testing purposes.\n // This allows the compiler to generate valid code and tests to run while the JavaScript\n // function execution bridge is not yet implemented. This will be replaced with actual\n // JavaScript bridge functionality in a future phase\n return `\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n // Function node: ${node.name}\n // This node would execute JavaScript code and return the result\n // For now, we return a mock result to allow compilation and testing\n\n${paramReads}\n${paramArray}\n // Mock result: return an object indicating function execution\n // This is a placeholder - actual JavaScript execution will be implemented\n // via a JavaScript bridge in the runtime\n let mockResult = new Map<string, Value>();\n mockResult.set(\"_isFunctionNode\", Value.Bool(true));\n mockResult.set(\"_nodeName\", Value.String(\"${node.name}\"));\n${parameters.length > 0 ? parameters.map((param) => ` mockResult.set(\"_${param}\", ${param});`).join('\\n') : ''}\n mockResult.set(\"_output\", Value.String(\"Function execution not yet implemented\"));\n \n let result = Value.Object(mockResult);\n\n return result;\n}`;\n}\n","import { CompilationError, ErrorCode } from './errors';\nimport { validateFunctionNode } from './nodes/function';\n\nexport enum NodeType {\n INPUT = 'inputNode',\n OUTPUT = 'outputNode',\n DECISION_TABLE = 'decisionTableNode',\n SWITCH = 'switchNode',\n EXPRESSION = 'expressionNode',\n DECISION = 'decisionNode',\n FUNCTION = 'functionNode',\n}\n\nexport interface JDMNode {\n id: string;\n type: NodeType;\n name: string;\n position: { x: number; y: number };\n content?: any;\n parsedContent?: any;\n}\n\nexport interface JDMEdge {\n id: string;\n type: string;\n sourceId: string;\n targetId: string;\n /** Optional source handle for nodes with multiple outputs (e.g., switch statements) */\n sourceHandle?: string;\n}\n\nexport interface JDMDecision {\n nodes: JDMNode[];\n edges: JDMEdge[];\n metadata?: any;\n}\n\n/**\n * Validate that a node has all required fields.\n *\n * All JDM nodes must have: id, name, and type.\n * Validating early provides clear error messages before processing.\n *\n * @param node - The node to validate\n * @param index - The index of the node in the nodes array (for error reporting)\n * @throws CompilationError if required fields are missing\n */\nexport function validateNodeStructure(node: any, index: number): void {\n const missingFields: string[] = [];\n\n if (typeof node.id !== 'string' || node.id.trim() === '') {\n missingFields.push('id');\n }\n\n if (typeof node.name !== 'string') {\n missingFields.push('name');\n }\n\n if (typeof node.type !== 'string' || node.type.trim() === '') {\n missingFields.push('type');\n }\n\n if (missingFields.length > 0) {\n const nodeIdentifier = node.id || node.name || `at index ${index}`;\n throw new CompilationError(\n `Node \"${nodeIdentifier}\" is missing required field(s): ${missingFields.join(', ')}`,\n ErrorCode.INVALID_NODE_STRUCTURE,\n { nodeId: node.id, nodeName: node.name },\n );\n }\n}\n\n/**\n * Parse and validate JDM JSON.\n * Function nodes have complex internal structure that needs schema validation and transformation.\n * Validating early provides better error messages and catches issues before expensive compilation steps.\n */\nexport function parseJDM(jdm: string | JDMDecision | any): JDMDecision {\n const parsed: JDMDecision = typeof jdm === 'string' ? JSON.parse(jdm) : jdm;\n\n // Validate basic structure before processing\n if (!parsed.nodes || !Array.isArray(parsed.nodes)) {\n throw new CompilationError(\n \"Invalid JDM: missing or invalid 'nodes' array\",\n ErrorCode.INVALID_JSON,\n { field: 'nodes' },\n );\n }\n\n // Validate each node has required fields before any processing\n parsed.nodes.forEach((node: any, index: number) => {\n validateNodeStructure(node, index);\n });\n\n // Function nodes have rich content structure (parameters, return type, expressions) requiring special\n // parsing. Other node types have simpler content handled during codegen.\n parsed.nodes.forEach((node: any) => {\n if (node.type === NodeType.FUNCTION) {\n try {\n node.parsedContent = validateFunctionNode(node);\n } catch (error) {\n if (error instanceof CompilationError) {\n throw error;\n }\n throw new CompilationError(\n `Failed to parse function node \"${node.name}\": ${error instanceof Error ? error.message : String(error)}`,\n ErrorCode.INVALID_NODE_STRUCTURE,\n { nodeId: node.id, nodeName: node.name },\n );\n }\n }\n });\n\n return parsed;\n}\n","import { DirectedGraph } from 'graphology';\nimport { topologicalSort } from 'graphology-dag';\nimport { type JDMNode, type JDMEdge, type JDMDecision, NodeType } from './parser';\nimport { CompilationError, ErrorCode, type SourceLocation } from './errors';\n\nexport type JDMGraph = DirectedGraph<JDMNode, JDMEdge>;\n\nexport function buildGraph(jdm: JDMDecision): JDMGraph {\n const graph = new DirectedGraph<JDMNode, JDMEdge>();\n\n // Map provides O(1) lookups for edge validation and node existence checks\n const nodeMap = new Map<string, JDMNode>();\n for (const node of jdm.nodes) {\n graph.addNode(node.id, node);\n nodeMap.set(node.id, node);\n }\n\n // Switch nodes can have multiple edges to same target (different cases/handles pointing to\n // same node), but topological sort only needs one edge per source→target pair to establish\n // ordering dependencies.\n const addedEdges = new Set<string>();\n\n // Add edges and check for self-references\n for (const edge of jdm.edges) {\n if (!nodeMap.has(edge.sourceId) || !nodeMap.has(edge.targetId)) {\n const sourceNode = nodeMap.get(edge.sourceId);\n const targetNode = nodeMap.get(edge.targetId);\n throw new CompilationError(\n `Invalid edge \"${edge.id}\": references non-existent node`,\n ErrorCode.INVALID_EDGE,\n {\n nodeId: edge.sourceId,\n nodeName: sourceNode?.name ?? targetNode?.name,\n field: !nodeMap.has(edge.sourceId) ? 'sourceId' : 'targetId',\n },\n );\n }\n\n // Check for self-references (edge where source equals target)\n if (edge.sourceId === edge.targetId) {\n const node = graph.getNodeAttributes(edge.sourceId);\n const location: SourceLocation = { nodeId: edge.sourceId, nodeName: node.name };\n throw new CompilationError(\n `Self-reference detected: node \"${node.name || edge.sourceId}\" references itself through edge \"${edge.id}\"`,\n ErrorCode.CYCLE_DETECTED,\n location,\n );\n }\n\n // For topological ordering, we only need one edge between any two nodes.\n // Switch nodes may have multiple edges to the same target (via different handles).\n // We track the edge pair to avoid duplicates while preserving all edges in jdm.edges\n // for the switch node compilation to use.\n const edgePairKey = `${edge.sourceId}->${edge.targetId}`;\n if (!addedEdges.has(edgePairKey)) {\n graph.addEdgeWithKey(edge.id, edge.sourceId, edge.targetId, edge);\n addedEdges.add(edgePairKey);\n }\n }\n\n return graph;\n}\n\n/**\n * Find a cycle path in the graph using DFS. Graphology's cycle detection only returns a boolean,\n * but we need the actual cycle path to provide better error messages showing the problematic node\n * sequence to users.\n *\n * @param graph - The graph to search\n * @returns Array of node IDs representing the cycle, or null if no cycle\n */\nfunction findCyclePath(graph: JDMGraph): string[] | null {\n const visited = new Set<string>();\n const recursionStack = new Set<string>();\n const parentMap = new Map<string, string | null>();\n\n function dfs(nodeId: string, path: string[]): string[] | null {\n visited.add(nodeId);\n recursionStack.add(nodeId);\n path.push(nodeId);\n\n const neighbors = graph.outNeighbors(nodeId);\n for (const neighborId of neighbors) {\n if (!visited.has(neighborId)) {\n parentMap.set(neighborId, nodeId);\n const cycle = dfs(neighborId, path);\n if (cycle) {\n return cycle;\n }\n } else if (recursionStack.has(neighborId)) {\n // Found a back edge - reconstruct the cycle path\n // Path contains full traversal, but cycle only starts where we revisit a node.\n // Slicing gives just the cycle portion (e.g., A→B→C→B extracts B→C→B).\n const startIndex = path.indexOf(neighborId);\n const cycle = [...path.slice(startIndex), neighborId];\n return cycle;\n }\n }\n\n recursionStack.delete(nodeId);\n path.pop();\n return null;\n }\n\n // Start DFS from each unvisited node\n for (const nodeId of graph.nodes()) {\n if (!visited.has(nodeId)) {\n const cycle = dfs(nodeId, []);\n if (cycle) {\n return cycle;\n }\n }\n }\n\n return null;\n}\n\n/**\n * Format a cycle path as a readable string.\n *\n * @param cycle - Array of node IDs representing a cycle\n * @param graph - The graph to get node names from\n * @returns Formatted string like \"Node1 -> Node2 -> Node3 -> Node1\"\n */\nfunction formatCyclePath(cycle: string[], graph: JDMGraph): string {\n return cycle\n .map((nodeId) => {\n const node = graph.getNodeAttributes(nodeId);\n return node.name || nodeId;\n })\n .join(' -> ');\n}\n\nexport function validateGraph(graph: JDMGraph): void {\n // Check for cycles using DFS to find the actual cycle path\n const cyclePath = findCyclePath(graph);\n if (cyclePath) {\n const formattedPath = formatCyclePath(cyclePath, graph);\n throw new CompilationError(\n `Circular dependency detected: ${formattedPath}`,\n ErrorCode.CYCLE_DETECTED,\n { nodeId: cyclePath[0], nodeName: graph.getNodeAttributes(cyclePath[0]).name },\n );\n }\n\n // Check for single input node\n const inputNodes: string[] = [];\n const outputNodes: string[] = [];\n\n graph.forEachNode((nodeId, attrs) => {\n if (attrs.type === NodeType.INPUT) {\n inputNodes.push(nodeId);\n }\n if (attrs.type === NodeType.OUTPUT) {\n outputNodes.push(nodeId);\n }\n });\n\n if (inputNodes.length !== 1) {\n // If there are multiple input nodes, include the first one in the location\n const firstInputNode = inputNodes.length > 0 ? graph.getNodeAttributes(inputNodes[0]) : null;\n throw new CompilationError(\n `Expected exactly 1 input node, found ${inputNodes.length}`,\n ErrorCode.MULTIPLE_INPUT_NODES,\n firstInputNode ? { nodeId: firstInputNode.id, nodeName: firstInputNode.name } : undefined,\n );\n }\n if (outputNodes.length === 0) {\n throw new CompilationError(\n 'Expected at least 1 output node, found 0',\n ErrorCode.MISSING_OUTPUT_NODE,\n { field: 'outputNode' },\n );\n }\n}\n\n/**\n * Get nodes in topological order for evaluation.\n * This ensures dependencies are evaluated before dependents.\n */\nexport function getEvaluationOrder(graph: JDMGraph): string[] {\n return topologicalSort(graph);\n}\n\n/**\n * Get all nodes that feed into a given node.\n */\nexport function getInputNodes(graph: JDMGraph, nodeId: string): JDMNode[] {\n return graph.inNeighbors(nodeId).map((id) => graph.getNodeAttributes(id));\n}\n\n/**\n * Get all nodes that a given node feeds into.\n */\nexport function getOutputNodes(graph: JDMGraph, nodeId: string): JDMNode[] {\n return graph.outNeighbors(nodeId).map((id) => graph.getNodeAttributes(id));\n}\n","import type { JDMNode } from '../parser';\nimport type { CompilationContext, AssemblyScriptCode } from '../types';\nimport { sanitizeId } from '../utils';\n\n/**\n * Compile an input node.\n *\n * Input nodes serve as entry points for the decision model and simply\n * pass through the context data.\n *\n * @param node - The JDM input node\n * @param context - The compilation context\n * @returns Generated AssemblyScript code\n */\nexport function compileInputNode(node: JDMNode, _context: CompilationContext): AssemblyScriptCode {\n const sanitizedId = sanitizeId(node.id);\n return `\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n // Input nodes are markers - they trigger evaluation but don't produce output.\n // Null is used as a semantic marker meaning \"input processed, no output to add\".\n // This distinguishes from actual output values while avoiding undefined/error states.\n return Value.Null();\n}\n`;\n}\n\n/**\n * Compile an output node.\n *\n * Output nodes mark the end of the decision model and return the final result.\n * They return the accumulated context data from passThrough nodes.\n *\n * @param node - The JDM output node\n * @param context - The compilation context\n * @returns Generated AssemblyScript code\n */\nexport function compileOutputNode(node: JDMNode, _context: CompilationContext): AssemblyScriptCode {\n const sanitizedId = sanitizeId(node.id);\n return `\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n // Output nodes return the accumulated context data (passThrough values)\n // Build result from all non-internal context entries\n let __finalResult = new Map<string, Value>();\n const __ctxKeys = ctx.data.keys();\n for (let __i = 0; __i < __ctxKeys.length; __i++) {\n const __key = __ctxKeys[__i];\n // $-prefixed keys are internal namespaces ($nodes, $)\n // # is iteration variable\n // acc is reduce accumulator\n // None should appear in final output - only actual output fields.\n if (!__key.startsWith(\"$\") && __key !== \"#\" && __key !== \"acc\") {\n // AssemblyScript has no Map.filter(), so we must iterate and conditionally add keys.\n // This is more verbose but necessary given AS limitations.\n __finalResult.set(__key, ctx.data.get(__key));\n }\n }\n return Value.Object(__finalResult);\n}\n`;\n}\n","// ============================================================================\n// Context Resolver Strategy Pattern\n// ============================================================================\n//\n// The ContextResolver interface provides a strategy for resolving identifiers\n// and dollar references in different compilation contexts. This replaces three\n// separate compilation functions with a single unified function plus small\n// strategy implementations.\n//\n// Three modes:\n// 1. Standard: $ -> ctx.get(\"$\"), identifiers -> ctx.get(\"name\")\n// 2. LocalDollar: $ -> Value.Object(dollarVar), identifiers -> ctx.get(\"name\")\n// 3. Scoped: $ -> Value.Object(resultVar), identifiers -> scopedCtx.get(\"name\")\n\n/**\n * Strategy interface for resolving context references during expression compilation.\n *\n * Different compilation contexts require different resolutions:\n * - In standard expressions, $ refers to the global context\n * - In expression nodes, $ refers to the local result object being built\n * - In scoped expressions (inputField), identifiers resolve from a scoped context\n */\nexport interface ContextResolver {\n /** Resolve an identifier reference (e.g., \"firstName\") */\n resolveIdentifier(name: string): string;\n\n /** Resolve a $ reference */\n resolveDollarRef(): string;\n\n /** Resolve a # reference (current element in higher-order functions) */\n resolveHashRef(): string;\n\n /** Resolve a member access path rooted at $ (e.g., \"$.foo.bar\" returns \"foo.bar\") */\n resolveDollarPath(path: string): string;\n\n /** Resolve a $nodes.X.Y path */\n resolveNodesPath(path: string): string;\n\n /** Get the context variable name for use in helper functions */\n getContextVar(): string;\n\n /** Create a child resolver for use inside helper functions (e.g., object literals) */\n createChildResolver(): ContextResolver;\n\n /** Get extra parameters for generated helper function signatures */\n getHelperParams(): string;\n\n /** Get extra arguments for calls to generated helper functions */\n getHelperArgs(): string;\n}\n\n/**\n * Standard context resolver: $ and identifiers resolve from the global context.\n * Used in switch conditions, decision tables, and other standard expressions.\n */\nexport class StandardContextResolver implements ContextResolver {\n resolveIdentifier(name: string): string {\n return `ctx.get(\"${name}\")`;\n }\n\n resolveDollarRef(): string {\n return `ctx.get(\"$\")`;\n }\n\n resolveHashRef(): string {\n return `ctx.get(\"#\")`;\n }\n\n resolveDollarPath(path: string): string {\n // In standard mode, $.foo.bar -> getProperty(ctx.get(\"$\"), \"foo\", \"bar\")\n // Actually use nested getProperty calls for each segment\n const segments = path.split('.');\n let result = `ctx.get(\"$\")`;\n for (const segment of segments) {\n result = `getProperty(${result}, \"${segment}\")`;\n }\n return result;\n }\n\n resolveNodesPath(path: string): string {\n return `ctx.get(\"${path}\")`;\n }\n\n getContextVar(): string {\n return 'ctx';\n }\n\n createChildResolver(): ContextResolver {\n // Child is same as parent in standard mode\n return this;\n }\n\n getHelperParams(): string {\n return '';\n }\n\n getHelperArgs(): string {\n return '';\n }\n}\n\n/**\n * Local dollar resolver: $ refers to a local Map variable (e.g., \"result\").\n * Used in expression nodes where $ references the output being built.\n */\nexport class LocalDollarContextResolver implements ContextResolver {\n constructor(private dollarVar: string = 'result') {}\n\n resolveIdentifier(name: string): string {\n return `ctx.get(\"${name}\")`;\n }\n\n resolveDollarRef(): string {\n return `Value.Object(${this.dollarVar})`;\n }\n\n resolveHashRef(): string {\n return `ctx.get(\"#\")`;\n }\n\n resolveDollarPath(path: string): string {\n // $.foo.bar looks up \"foo.bar\" as a flat key in the local result map\n // Expression nodes store keys like \"eligibility.specialOffers\" as flat strings\n return `(${this.dollarVar}.has(\"${path}\") ? ${this.dollarVar}.get(\"${path}\") : Value.Null())`;\n }\n\n resolveNodesPath(path: string): string {\n return `ctx.get(\"${path}\")`;\n }\n\n getContextVar(): string {\n return 'ctx';\n }\n\n createChildResolver(): ContextResolver {\n // Child resolver references 'parentResult' to maintain access to outer scope\n // Example: {a: 5, nested: {b: $.a}} - nested object's $.a refers to outer result\n return new LocalDollarContextResolver('parentResult');\n }\n\n getHelperParams(): string {\n return ', parentResult: Map<string, Value>';\n }\n\n getHelperArgs(): string {\n return `, ${this.dollarVar}`;\n }\n}\n\n/**\n * Scoped context resolver: identifiers resolve from a scoped context variable.\n * Used for inputField scoping and loop mode where a subset of the context is available.\n */\nexport class ScopedContextResolver implements ContextResolver {\n constructor(\n private ctxVar: string = 'scopedCtx',\n private resultVar: string = 'itemResult',\n ) {}\n\n resolveIdentifier(name: string): string {\n return `${this.ctxVar}.get(\"${name}\")`;\n }\n\n resolveDollarRef(): string {\n return `Value.Object(${this.resultVar})`;\n }\n\n resolveHashRef(): string {\n return `${this.ctxVar}.get(\"#\")`;\n }\n\n resolveDollarPath(path: string): string {\n // $.foo looks up \"foo\" in the local result variable\n return `(${this.resultVar}.has(\"${path}\") ? ${this.resultVar}.get(\"${path}\") : Value.Null())`;\n }\n\n resolveNodesPath(path: string): string {\n return `${this.ctxVar}.get(\"${path}\")`;\n }\n\n getContextVar(): string {\n return this.ctxVar;\n }\n\n createChildResolver(): ContextResolver {\n // In scoped context, child keeps the same context var and result var\n return this;\n }\n\n getHelperParams(): string {\n return `, ${this.ctxVar}: Context, ${this.resultVar}: Map<string, Value>`;\n }\n\n getHelperArgs(): string {\n return `, ${this.ctxVar}, ${this.resultVar}`;\n }\n}\n","// ============================================================================\n// Expression AST Compiler\n// ============================================================================\n//\n// This module provides the core expression compilation functionality for\n// transforming expression ASTs into AssemblyScript code. It uses the\n// ContextResolver strategy pattern to handle different compilation contexts.\n\nimport type {\n ExpressionAST,\n BinaryOp,\n UnaryOp,\n NumberLiteral,\n StringLiteral,\n BooleanLiteral,\n Identifier,\n TernaryOp,\n MemberAccess,\n IndexAccess,\n FunctionCall,\n Interval,\n TemplateLiteral,\n ArrayLiteral,\n ObjectLiteral,\n} from '../ast-types';\nimport type { CompilationContext } from '../types';\nimport type { ContextResolver } from './context-resolvers';\nimport { StandardContextResolver } from './context-resolvers';\n\n// ============================================================================\n// Unified Expression Compiler\n// ============================================================================\n\n/**\n * Compile an expression AST using the provided context resolver strategy.\n *\n * This is the single unified implementation that handles all expression compilation.\n * The resolver parameter determines how identifiers, $, and # are resolved.\n *\n * @param ast - The AST node to compile\n * @param context - The compilation context\n * @param resolver - The context resolution strategy\n * @returns AssemblyScript code string that produces a Value\n */\nexport function compileExpressionUnified(\n ast: ExpressionAST,\n context: CompilationContext,\n resolver: ContextResolver,\n): string {\n switch (ast.type) {\n case 'NumberLiteral':\n return `Value.Float(${(ast as NumberLiteral).value})`;\n\n case 'StringLiteral':\n return `Value.String(\"${escapeString((ast as StringLiteral).value)}\")`;\n\n case 'BooleanLiteral':\n return `Value.Bool(${(ast as BooleanLiteral).value})`;\n\n case 'NullLiteral':\n return `Value.Null()`;\n\n case 'Identifier':\n return resolver.resolveIdentifier((ast as Identifier).name);\n\n case 'DollarRef':\n return resolver.resolveDollarRef();\n\n case 'HashRef':\n return resolver.resolveHashRef();\n\n case 'BinaryOp': {\n const bop = ast as BinaryOp;\n const left = compileExpressionUnified(bop.left, context, resolver);\n const right = compileExpressionUnified(bop.right, context, resolver);\n return compileBinaryOpWithValues(bop.op, left, right);\n }\n\n case 'UnaryOp': {\n const uop = ast as UnaryOp;\n const operand = compileExpressionUnified(uop.operand, context, resolver);\n switch (uop.op) {\n case 'not':\n return `Value.Bool(!(${operand}).asBool())`;\n case '-':\n return `negateValue(${operand})`;\n default:\n throw new Error(`Unknown unary operator: ${uop.op}`);\n }\n }\n\n case 'TernaryOp': {\n const top = ast as TernaryOp;\n const cond = compileExpressionUnified(top.condition, context, resolver);\n const cons = compileExpressionUnified(top.consequent, context, resolver);\n const alt = compileExpressionUnified(top.alternate, context, resolver);\n return `(${cond}.asBool() ? ${cons} : ${alt})`;\n }\n\n case 'MemberAccess': {\n const ma = ast as MemberAccess;\n // Handle $.property.subproperty - look up in appropriate context\n const dollarPath = buildDollarPath(ma);\n if (dollarPath) {\n return resolver.resolveDollarPath(dollarPath);\n }\n // Check if this is a $nodes reference\n if (checkIsNodesReference(ma)) {\n const nodesPath = buildNodesPath(ma);\n return resolver.resolveNodesPath(nodesPath);\n }\n // For other member access, use getProperty helper\n const obj = compileExpressionUnified(ma.object, context, resolver);\n return `getProperty(${obj}, \"${ma.property}\")`;\n }\n\n case 'IndexAccess': {\n const ia = ast as IndexAccess;\n const arr = compileExpressionUnified(ia.object, context, resolver);\n const idx = compileExpressionUnified(ia.index, context, resolver);\n return `getIndex(${arr}, ${idx})`;\n }\n\n case 'FunctionCall': {\n const fc = ast as FunctionCall;\n if (fc.callee.type === 'Identifier') {\n const name = (fc.callee as Identifier).name;\n\n // Higher-order functions need special handling\n if (name === 'filter') {\n return compileHigherOrderCall(fc, context, resolver, 'filter');\n }\n if (name === 'map') {\n return compileHigherOrderCall(fc, context, resolver, 'map');\n }\n if (name === 'reduce') {\n return compileHigherOrderCall(fc, context, resolver, 'reduce');\n }\n if (name === 'all') {\n return compileHigherOrderCall(fc, context, resolver, 'all');\n }\n if (name === 'some') {\n return compileHigherOrderCall(fc, context, resolver, 'some');\n }\n\n // Regular function call\n const args = fc.args.map((arg) => compileExpressionUnified(arg, context, resolver));\n const numArgs = args.length;\n\n // AssemblyScript requires typed array constructors\n if (numArgs === 1) {\n return `evaluateFunction(\"${name}\", makeArgs1(${args[0]}))`;\n } else if (numArgs === 2) {\n return `evaluateFunction(\"${name}\", makeArgs2(${args[0]}, ${args[1]}))`;\n } else if (numArgs === 3) {\n return `evaluateFunction(\"${name}\", makeArgs3(${args[0]}, ${args[1]}, ${args[2]}))`;\n } else {\n return `evaluateFunction(\"${name}\", [${args.join(', ')}])`;\n }\n }\n throw new Error('Only direct function calls are supported');\n }\n\n case 'Interval': {\n const intv = ast as Interval;\n const start = compileExpressionUnified(intv.start, context, resolver);\n const end = compileExpressionUnified(intv.end, context, resolver);\n return `createInterval(${start}, ${end}, ${intv.startInclusive}, ${intv.endInclusive})`;\n }\n\n case 'ArrayLiteral': {\n const al = ast as ArrayLiteral;\n if (al.elements.length === 0) {\n return 'Value.Array(new Array<Value>(0))';\n }\n const elements = al.elements.map((e) => compileExpressionUnified(e, context, resolver));\n return `Value.Array([${elements.join(', ')}])`;\n }\n\n case 'ObjectLiteral': {\n const ol = ast as ObjectLiteral;\n if (ol.properties.length === 0) {\n return 'Value.Object(new Map<string, Value>())';\n }\n // Generate a helper function for object construction\n const childResolver = resolver.createChildResolver();\n const helperId = context.getUniqueId('object');\n const props = ol.properties.map((p) => {\n const value = compileExpressionUnified(p.value, context, childResolver);\n return ` objResult.set(\"${p.key}\", ${value});`;\n });\n\n const helperCode = `\nfunction objectHelper_${helperId}(ctx: Context${resolver.getHelperParams()}): Value {\n const objResult = new Map<string, Value>();\n${props.join('\\n')}\n return Value.Object(objResult);\n}`;\n context.helperFunctions.set(`objectHelper_${helperId}`, helperCode);\n return `objectHelper_${helperId}(ctx${resolver.getHelperArgs()})`;\n }\n\n case 'TemplateLiteral': {\n const tl = ast as TemplateLiteral;\n const parts = tl.parts.map((part) => {\n if ('text' in part) {\n return `\"${escapeString(part.text)}\"`;\n } else {\n return `(${compileExpressionUnified(part.expr, context, resolver)}).asString()`;\n }\n });\n if (parts.length === 0) {\n return 'Value.String(\"\")';\n }\n if (parts.length === 1) {\n return `Value.String(${parts[0]})`;\n }\n return `Value.String(${parts.join(' + ')})`;\n }\n\n default:\n throw new Error(`Unsupported expression type: ${(ast as any).type}`);\n }\n}\n\n// ============================================================================\n// Higher-Order Function Compilation\n// ============================================================================\n\n/**\n * Compile a higher-order function call (filter, map, reduce, all, some).\n *\n * These functions iterate over arrays and need helper functions that set # for each element.\n * The resolver's child resolver is used inside the helper to maintain proper scoping.\n */\nfunction compileHigherOrderCall(\n ast: FunctionCall,\n context: CompilationContext,\n resolver: ContextResolver,\n fnName: 'filter' | 'map' | 'reduce' | 'all' | 'some',\n): string {\n const expectedArgs = fnName === 'reduce' ? 3 : 2;\n if (ast.args.length !== expectedArgs) {\n throw new Error(\n `${fnName}() requires exactly ${expectedArgs} arguments, got ${ast.args.length}`,\n );\n }\n\n const arrayExpr = ast.args[0];\n const lambdaExpr = ast.args[1];\n\n // Compile array expression with current resolver\n const arrayCode = compileExpressionUnified(arrayExpr, context, resolver);\n\n // Use child resolver for lambda (maintains access to outer scope)\n const childResolver = resolver.createChildResolver();\n const lambdaCode = compileExpressionUnified(lambdaExpr, context, childResolver);\n\n const helperId = context.getUniqueId(fnName);\n const extraParams = resolver.getHelperParams();\n const extraArgs = resolver.getHelperArgs();\n\n let helperCode: string;\n\n switch (fnName) {\n case 'filter':\n helperCode = `\nfunction filterHelper_${helperId}(ctx: Context, arr: Value${extraParams}): Value {\n if (!arr.isArray()) {\n return Value.Array(new Array<Value>(0));\n }\n\n const inputArr = arr.asArray();\n const filterResult = new Array<Value>(0);\n\n for (let i = 0; i < inputArr.length; i++) {\n const element = inputArr[i];\n ctx.set(\"#\", element);\n if (${lambdaCode}.asBool()) {\n filterResult.push(element);\n }\n }\n\n return Value.Array(filterResult);\n}`;\n break;\n\n case 'map':\n helperCode = `\nfunction mapHelper_${helperId}(ctx: Context, arr: Value${extraParams}): Value {\n if (!arr.isArray()) {\n return Value.Array(new Array<Value>(0));\n }\n\n const inputArr = arr.asArray();\n const mapResult = new Array<Value>(0);\n\n for (let i = 0; i < inputArr.length; i++) {\n const element = inputArr[i];\n ctx.set(\"#\", element);\n mapResult.push(${lambdaCode});\n }\n\n return Value.Array(mapResult);\n}`;\n break;\n\n case 'reduce': {\n const initialExpr = ast.args[2];\n const initialCode = compileExpressionUnified(initialExpr, context, resolver);\n helperCode = `\nfunction reduceHelper_${helperId}(ctx: Context, arr: Value, initAcc: Value${extraParams}): Value {\n if (!arr.isArray()) {\n return initAcc;\n }\n\n const inputArr = arr.asArray();\n let reduceAcc = initAcc;\n\n for (let i = 0; i < inputArr.length; i++) {\n const element = inputArr[i];\n ctx.set(\"#\", element);\n ctx.set(\"acc\", reduceAcc);\n reduceAcc = ${lambdaCode};\n }\n\n return reduceAcc;\n}`;\n context.helperFunctions.set(`reduceHelper_${helperId}`, helperCode);\n return `reduceHelper_${helperId}(ctx, ${arrayCode}, ${initialCode}${extraArgs})`;\n }\n\n case 'all':\n helperCode = `\nfunction allHelper_${helperId}(ctx: Context, arr: Value${extraParams}): Value {\n if (!arr.isArray()) {\n return Value.Bool(false);\n }\n\n const inputArr = arr.asArray();\n\n for (let i = 0; i < inputArr.length; i++) {\n const element = inputArr[i];\n ctx.set(\"#\", element);\n if (!${lambdaCode}.asBool()) {\n return Value.Bool(false);\n }\n }\n\n return Value.Bool(true);\n}`;\n break;\n\n case 'some':\n helperCode = `\nfunction someHelper_${helperId}(ctx: Context, arr: Value${extraParams}): Value {\n if (!arr.isArray()) {\n return Value.Bool(false);\n }\n\n const inputArr = arr.asArray();\n\n for (let i = 0; i < inputArr.length; i++) {\n const element = inputArr[i];\n ctx.set(\"#\", element);\n if (${lambdaCode}.asBool()) {\n return Value.Bool(true);\n }\n }\n\n return Value.Bool(false);\n}`;\n break;\n }\n\n context.helperFunctions.set(`${fnName}Helper_${helperId}`, helperCode);\n return `${fnName}Helper_${helperId}(ctx, ${arrayCode}${extraArgs})`;\n}\n\n// ============================================================================\n// Binary Operator Compilation\n// ============================================================================\n\n/**\n * Helper to compile binary operations with pre-compiled left and right values.\n * This is the single source of truth for all binary operator code generation.\n *\n * @param op - The operator string (e.g., \"+\", \"-\", \"==\", \"and\", etc.)\n * @param left - Pre-compiled code string for the left operand\n * @param right - Pre-compiled code string for the right operand\n * @returns AssemblyScript code string for the binary operation\n */\nexport function compileBinaryOpWithValues(op: string, left: string, right: string): string {\n switch (op) {\n // Arithmetic\n case '+':\n return `addValues(${left}, ${right})`;\n case '-':\n return `subtractValues(${left}, ${right})`;\n case '*':\n return `multiplyValues(${left}, ${right})`;\n case '/':\n return `divideValues(${left}, ${right})`;\n case '%':\n return `moduloValues(${left}, ${right})`;\n case '^':\n return `powerValues(${left}, ${right})`;\n\n // Comparison\n case '==':\n return `Value.Bool(valuesEqual(${left}, ${right}))`;\n case '!=':\n return `Value.Bool(!valuesEqual(${left}, ${right}))`;\n case '<':\n return `Value.Bool(compareValues(${left}, ${right}) < 0)`;\n case '>':\n return `Value.Bool(compareValues(${left}, ${right}) > 0)`;\n case '<=':\n return `Value.Bool(compareValues(${left}, ${right}) <= 0)`;\n case '>=':\n return `Value.Bool(compareValues(${left}, ${right}) >= 0)`;\n\n // Logical\n case 'and':\n return `((${left}).asBool() ? (${right}) : (${left}))`;\n case 'or':\n return `((${left}).asBool() ? (${left}) : (${right}))`;\n\n // Null coalescing\n case '??':\n return `(${left}.isNull() ? ${right} : ${left})`;\n\n // Membership\n case 'in':\n return `valueIn(${left}, ${right})`;\n case 'not in':\n return `Value.Bool(!valueIn(${left}, ${right}).asBool())`;\n\n default:\n throw new Error(`Unknown binary operator: ${op}`);\n }\n}\n\n// ============================================================================\n// Utility Functions\n// ============================================================================\n\n/**\n * Escape a string for use in AssemblyScript string literals.\n */\nexport function escapeString(s: string): string {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\"/g, '\\\\\"')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/\\t/g, '\\\\t');\n}\n\n/**\n * Build the full dotted path for a $-rooted member access chain.\n * Returns null if the path is not rooted at $.\n *\n * Example: $.eligibility.specialOffers -> \"eligibility.specialOffers\"\n */\nexport function buildDollarPath(ast: MemberAccess): string | null {\n if (ast.object.type === 'DollarRef') {\n return ast.property;\n }\n if (ast.object.type === 'MemberAccess') {\n const parentPath = buildDollarPath(ast.object as MemberAccess);\n if (parentPath !== null) {\n return `${parentPath}.${ast.property}`;\n }\n }\n return null;\n}\n\n/**\n * Check if a member access chain is rooted at the '$nodes' identifier.\n */\nexport function checkIsNodesReference(ast: MemberAccess): boolean {\n if (ast.object.type === 'Identifier') {\n return (ast.object as Identifier).name === '$nodes';\n } else if (ast.object.type === 'MemberAccess') {\n return checkIsNodesReference(ast.object as MemberAccess);\n }\n return false;\n}\n\n/**\n * Build the full dotted path for a $nodes-rooted member access chain.\n */\nexport function buildNodesPath(ast: MemberAccess): string {\n if (ast.object.type === 'Identifier') {\n return `${(ast.object as Identifier).name}.${ast.property}`;\n } else if (ast.object.type === 'MemberAccess') {\n return `${buildNodesPath(ast.object as MemberAccess)}.${ast.property}`;\n }\n throw new Error('Invalid object type for $nodes reference');\n}\n\n// ============================================================================\n// Convenience Functions\n// ============================================================================\n\n// Singleton instance for standard context compilation\nconst standardResolver = new StandardContextResolver();\n\n/**\n * Compile an AST node to AssemblyScript code using standard context resolution.\n *\n * This is a convenience function that uses StandardContextResolver, where:\n * - $ references resolve to ctx.get(\"$\")\n * - Identifiers resolve to ctx.get(\"name\")\n *\n * For specialized compilation contexts (expression nodes with local $, scoped contexts),\n * use compileExpressionUnified directly with the appropriate resolver.\n *\n * @param ast - The AST node to compile\n * @param context - The compilation context\n * @returns AssemblyScript code string that produces a Value\n */\nexport function compileExpression(ast: ExpressionAST, context: CompilationContext): string {\n return compileExpressionUnified(ast, context, standardResolver);\n}\n","// ============================================================================\n// Expression Node Compilation\n// ============================================================================\n//\n// This module provides compilation functionality for JDM expression nodes.\n// Expression nodes contain key-value pairs where values are expression strings.\n//\n// For the core expression AST compilation, see expression-compiler.ts.\n// For context resolution strategies, see context-resolvers.ts.\n\nimport type { CompilationContext, AssemblyScriptCode } from '../types';\nimport type { JDMNode } from '../parser';\nimport { sanitizeId } from '../utils';\nimport { LocalDollarContextResolver, ScopedContextResolver } from './context-resolvers';\nimport { compileExpressionUnified } from './expression-compiler';\n\n// Re-export commonly used items for backwards compatibility\nexport type { ContextResolver } from './context-resolvers';\nexport {\n StandardContextResolver,\n LocalDollarContextResolver,\n ScopedContextResolver,\n} from './context-resolvers';\n\nexport {\n compileExpressionUnified,\n compileBinaryOpWithValues,\n compileExpression,\n escapeString,\n buildDollarPath,\n checkIsNodesReference,\n buildNodesPath,\n} from './expression-compiler';\n\n/**\n * Compile an expression node.\n *\n * Expression nodes can contain one or more key-value pairs where\n * each value is an expression string that needs to be compiled.\n *\n * In expression nodes, the $ symbol refers to the local result object\n * being built, allowing later expressions to reference earlier ones.\n * For example: { \"a\": \"5\", \"b\": \"$.a + 10\" } - $.a references the 'a' computed above.\n *\n * Additional features:\n * - inputField: Specifies a sub-object path to use as the evaluation scope\n * - outputPath: Specifies the context path where the results will be stored\n * - executionMode: \"loop\" - Iterates over an array at inputField path\n *\n * @param node - The JDM expression node\n * @param context - The compilation context\n * @returns Generated AssemblyScript code\n */\nexport function compileExpressionNode(\n node: JDMNode,\n context: CompilationContext,\n): AssemblyScriptCode {\n const expressions = node.content.expressions as Array<{ key: string; value: string }>;\n const passThrough = node.content.passThrough === true;\n const inputField = node.content.inputField as string | undefined;\n const outputPath = node.content.outputPath as string | undefined;\n const executionMode = node.content.executionMode as string | undefined;\n const sanitizedId = sanitizeId(node.id);\n\n // Loop mode: iterates over array at inputField, evaluating expressions for each element\n // Used when executionMode === \"loop\" to transform array items in place\n if (executionMode === 'loop') {\n return compileLoopExpressionNode(\n node,\n context,\n expressions,\n passThrough,\n inputField,\n outputPath,\n sanitizedId,\n );\n }\n\n // If inputField is specified, generate scoped evaluation code\n if (inputField) {\n return compileScopedExpressionNode(\n node,\n context,\n expressions,\n passThrough,\n inputField,\n outputPath,\n sanitizedId,\n );\n }\n\n // Standard mode: evaluates expressions in global context without inputField scoping\n // Used when no inputField is specified - expressions resolve variables from root context\n const resolver = new LocalDollarContextResolver('result');\n const expressionAssignments = expressions\n .map((expr) => {\n try {\n const ast = context.parseExpression(expr.value);\n // Compile with $ resolved to local result variable using unified compiler\n const compiled = compileExpressionUnified(ast, context, resolver);\n return ` result.set(\"${expr.key}\", ${compiled});`;\n } catch (e) {\n throw new Error(`Failed to compile expression \"${expr.value}\" for key \"${expr.key}\": ${e}`);\n }\n })\n .join('\\n');\n\n if (passThrough) {\n return `\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n let result = new Map<string, Value>();\n\n // Copy all context values to preserve workflow state and allow referencing prior node results\n // passThrough=true ensures downstream nodes can access both input data and intermediate results\n const keys = ctx.data.keys();\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const value = ctx.data.get(key);\n result.set(key, value);\n }\n\n${expressionAssignments}\n\n return Value.Object(result);\n}\n`;\n }\n\n return `\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n let result = new Map<string, Value>();\n \n${expressionAssignments}\n \n return Value.Object(result);\n}\n`;\n}\n\n/**\n * Compile an expression node with inputField scoping.\n *\n * When inputField is specified (e.g., \"customer\"), expressions are evaluated\n * with the sub-object as the scope. So `firstName` resolves to `customer.firstName`.\n *\n * @param node - The JDM expression node\n * @param context - The compilation context\n * @param expressions - Array of key-value expression pairs\n * @param passThrough - Whether to pass through context values\n * @param inputField - The path to the input field (e.g., \"customer\")\n * @param outputPath - The path to store the output (e.g., \"customer\")\n * @param sanitizedId - Sanitized node ID\n * @returns Generated AssemblyScript code\n */\nfunction compileScopedExpressionNode(\n node: JDMNode,\n context: CompilationContext,\n expressions: Array<{ key: string; value: string }>,\n passThrough: boolean,\n inputField: string,\n outputPath: string | undefined,\n sanitizedId: string,\n): AssemblyScriptCode {\n // Generate unique helper to avoid name collisions in multi-node compilation\n const helperId = context.getUniqueId('scopedExpr');\n\n // Scoped evaluation: creates a temporary context where inputField object properties become top-level identifiers\n // Enables expressions like \"firstName\" to resolve to \"customer.firstName\" when inputField=\"customer\"\n const resolver = new ScopedContextResolver('scopedCtx', 'itemResult');\n const expressionAssignments = expressions\n .map((expr) => {\n try {\n const ast = context.parseExpression(expr.value);\n // Use unified compiler with scoped context resolver\n const compiled = compileExpressionUnified(ast, context, resolver);\n return ` itemResult.set(\"${expr.key}\", ${compiled});`;\n } catch (e) {\n throw new Error(`Failed to compile expression \"${expr.value}\" for key \"${expr.key}\": ${e}`);\n }\n })\n .join('\\n');\n\n // Generate the helper function for scoped evaluation\n // Can't use Context constructor directly - AssemblyScript Context requires specific initialization\n // that's tied to the WASM module's memory management, so we use ScopedContext wrapper instead\n const helperCode = `\nfunction scopedExprHelper_${helperId}(ctx: Context, inputObj: Value): Value {\n // Build result starting with input object fields (for passThrough behavior)\n const itemResult = new Map<string, Value>();\n if (inputObj.isObject()) {\n const inputMap = inputObj.asObject();\n const inputKeys = inputMap.keys();\n for (let i = 0; i < inputKeys.length; i++) {\n const key = inputKeys[i];\n itemResult.set(key, inputMap.get(key));\n }\n }\n \n // Two-layer context enables variable shadowing: inputField properties take precedence over parent context\n // Allows \"status\" in inputField to shadow global \"status\" while preserving access to non-shadowed globals\n const scopedData = new Map<string, Value>();\n \n // Copy parent context data first\n const parentKeys = ctx.data.keys();\n for (let i = 0; i < parentKeys.length; i++) {\n const key = parentKeys[i];\n scopedData.set(key, ctx.data.get(key));\n }\n \n // Override with fields from the input object (inputField scope)\n if (inputObj.isObject()) {\n const inputMap = inputObj.asObject();\n const inputKeys = inputMap.keys();\n for (let i = 0; i < inputKeys.length; i++) {\n const key = inputKeys[i];\n scopedData.set(key, inputMap.get(key));\n }\n }\n \n // Create a scoped context wrapper for expression evaluation\n const scopedCtx = new ScopedContext(scopedData);\n \n // Evaluate expressions in the scoped context\n${expressionAssignments}\n \n return Value.Object(itemResult);\n}`;\n\n context.helperFunctions.set(`scopedExprHelper_${helperId}`, helperCode);\n\n // Generate the main function that extracts inputField and calls the helper\n if (passThrough) {\n return `\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n let result = new Map<string, Value>();\n\n // Pass through all context values (input + intermediate results)\n const keys = ctx.data.keys();\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const value = ctx.data.get(key);\n result.set(key, value);\n }\n\n // Get input object from inputField path: ${inputField}\n const inputObj = ctx.get(\"${inputField}\");\n \n // Evaluate expressions in scoped context and store at outputPath: ${outputPath || inputField}\n const scopedResult = scopedExprHelper_${helperId}(ctx, inputObj);\n result.set(\"${outputPath || inputField}\", scopedResult);\n\n return Value.Object(result);\n}\n`;\n }\n\n return `\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n let result = new Map<string, Value>();\n\n // Get input object from inputField path: ${inputField}\n const inputObj = ctx.get(\"${inputField}\");\n \n // Evaluate expressions in scoped context and store at outputPath: ${outputPath || inputField}\n const scopedResult = scopedExprHelper_${helperId}(ctx, inputObj);\n result.set(\"${outputPath || inputField}\", scopedResult);\n\n return Value.Object(result);\n}\n`;\n}\n\n/**\n * Compile an expression node with executionMode: \"loop\".\n *\n * When executionMode is \"loop\", expressions are evaluated for each item\n * in the array at inputField path. Each item gets the computed fields added.\n *\n * @param node - The JDM expression node\n * @param context - The compilation context\n * @param expressions - Array of key-value expression pairs\n * @param passThrough - Whether to pass through context values\n * @param inputField - The path to the input array (e.g., \"cart.items\")\n * @param outputPath - The path to store the output array (e.g., \"cart.items\")\n * @param sanitizedId - Sanitized node ID\n * @returns Generated AssemblyScript code\n */\nfunction compileLoopExpressionNode(\n node: JDMNode,\n context: CompilationContext,\n expressions: Array<{ key: string; value: string }>,\n passThrough: boolean,\n inputField: string | undefined,\n outputPath: string | undefined,\n sanitizedId: string,\n): AssemblyScriptCode {\n if (!inputField) {\n throw new Error(`executionMode: \"loop\" requires inputField to be specified`);\n }\n\n // Generate a unique helper function for loop evaluation\n const helperId = context.getUniqueId('loopExpr');\n\n // Each iteration gets its own scoped context to isolate variables and prevent data leakage between iterations\n // Ensures expressions like \"price * quantity\" use current item's values, not previous iteration's\n const resolver = new ScopedContextResolver('itemCtx', 'itemResult');\n const expressionAssignments = expressions\n .map((expr) => {\n try {\n const ast = context.parseExpression(expr.value);\n // Use unified compiler with scoped context resolver for array item\n const compiled = compileExpressionUnified(ast, context, resolver);\n return ` itemResult.set(\"${expr.key}\", ${compiled});`;\n } catch (e) {\n throw new Error(`Failed to compile expression \"${expr.value}\" for key \"${expr.key}\": ${e}`);\n }\n })\n .join('\\n');\n\n // Generate the helper function for loop evaluation\n const helperCode = `\nfunction loopExprHelper_${helperId}(ctx: Context, inputArr: Value): Value {\n if (!inputArr.isArray()) {\n return Value.Array(new Array<Value>(0));\n }\n \n const items = inputArr.asArray();\n const resultItems = new Array<Value>(0);\n \n for (let i = 0; i < items.length; i++) {\n const item = items[i];\n \n // Build result item starting with existing fields\n const itemResult = new Map<string, Value>();\n if (item.isObject()) {\n const itemMap = item.asObject();\n const itemKeys = itemMap.keys();\n for (let j = 0; j < itemKeys.length; j++) {\n const key = itemKeys[j];\n itemResult.set(key, itemMap.get(key));\n }\n }\n \n // Create a scoped data map that combines parent context with item fields\n const scopedData = new Map<string, Value>();\n \n // Copy parent context data first\n const parentKeys = ctx.data.keys();\n for (let j = 0; j < parentKeys.length; j++) {\n const key = parentKeys[j];\n scopedData.set(key, ctx.data.get(key));\n }\n \n // Override with fields from the current item\n if (item.isObject()) {\n const itemMap = item.asObject();\n const itemKeys = itemMap.keys();\n for (let j = 0; j < itemKeys.length; j++) {\n const key = itemKeys[j];\n scopedData.set(key, itemMap.get(key));\n }\n }\n \n // Create a scoped context for expression evaluation\n const itemCtx = new ScopedContext(scopedData);\n \n // Evaluate expressions for this item\n${expressionAssignments}\n \n resultItems.push(Value.Object(itemResult));\n }\n \n return Value.Array(resultItems);\n}`;\n\n context.helperFunctions.set(`loopExprHelper_${helperId}`, helperCode);\n\n // Determine output path - use outputPath if specified, otherwise inputField\n const effectiveOutputPath = outputPath || inputField;\n\n // Generate the main function that extracts inputField array and calls the helper\n if (passThrough) {\n return `\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n let result = new Map<string, Value>();\n\n // Pass through all context values (input + intermediate results)\n const keys = ctx.data.keys();\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const value = ctx.data.get(key);\n result.set(key, value);\n }\n\n // Get input array from inputField path: ${inputField}\n const inputArr = ctx.get(\"${inputField}\");\n \n // Evaluate expressions for each item in the array\n const loopResult = loopExprHelper_${helperId}(ctx, inputArr);\n \n // Store result at outputPath: ${effectiveOutputPath}\n result.set(\"${effectiveOutputPath}\", loopResult);\n\n return Value.Object(result);\n}\n`;\n }\n\n return `\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n let result = new Map<string, Value>();\n\n // Get input array from inputField path: ${inputField}\n const inputArr = ctx.get(\"${inputField}\");\n \n // Evaluate expressions for each item in the array\n const loopResult = loopExprHelper_${helperId}(ctx, inputArr);\n \n // Store result at outputPath: ${effectiveOutputPath}\n result.set(\"${effectiveOutputPath}\", loopResult);\n\n return Value.Object(result);\n}\n`;\n}\n","/**\n * Unary expression transformation utilities for decision table compilation.\n *\n * In decision tables, expressions are evaluated in a \"unary\" context where\n * the $ symbol is automatically bound to the input field's value. Since\n * AssemblyScript doesn't support closures, we transform the AST to replace\n * DollarRef nodes with pre-compiled code.\n *\n * This module provides:\n * - InlineCode: A marker type for pre-compiled code in ASTs\n * - replaceDollarRefWithCode: AST transformer for dollar reference substitution\n * - compileExpressionWithInlineCode: Compiler that handles InlineCode nodes\n */\n\nimport type { CompilationContext } from './types';\nimport { compileExpression, compileBinaryOpWithValues } from './nodes/expression';\n\n/**\n * Special marker type for inline code that should be inserted directly.\n *\n * Used when AST transformation requires embedding already-compiled code.\n * For example, when compiling \"$ > 100\" where $ refers to a field value,\n * we replace the DollarRef node with an InlineCode node containing the\n * pre-compiled field access code.\n */\nexport interface InlineCode {\n type: 'InlineCode';\n code: string;\n}\n\n/**\n * Recursively replace DollarRef nodes in an AST with InlineCode nodes\n * containing the pre-compiled field expression.\n *\n * This transformation enables unary expression compilation in AssemblyScript\n * by substituting $ references with actual field access code at compile time.\n *\n * @param ast - The AST node to transform\n * @param compiledField - The pre-compiled code for the field value\n * @returns The transformed AST with InlineCode nodes instead of DollarRef\n *\n * @example\n * // Original AST for \"$ > 100\":\n * // { type: \"BinaryOp\", op: \">\", left: { type: \"DollarRef\" }, right: { type: \"NumberLiteral\", value: 100 } }\n * //\n * // After transformation with compiledField = 'ctx.get(\"creditScore\")':\n * // { type: \"BinaryOp\", op: \">\", left: { type: \"InlineCode\", code: 'ctx.get(\"creditScore\")' }, right: { type: \"NumberLiteral\", value: 100 } }\n */\nexport function replaceDollarRefWithCode(ast: any, compiledField: string): any {\n if (!ast || typeof ast !== 'object') {\n return ast;\n }\n\n // If this is a DollarRef, replace it with InlineCode containing the compiled field\n if (ast.type === 'DollarRef') {\n return { type: 'InlineCode', code: compiledField } as InlineCode;\n }\n\n // Recursively transform child nodes\n const result: any = { type: ast.type };\n\n for (const key of Object.keys(ast)) {\n if (key === 'type') {\n continue;\n }\n\n const value = ast[key];\n if (Array.isArray(value)) {\n result[key] = value.map((item) => replaceDollarRefWithCode(item, compiledField));\n } else if (value && typeof value === 'object') {\n result[key] = replaceDollarRefWithCode(value, compiledField);\n } else {\n result[key] = value;\n }\n }\n\n return result;\n}\n\n/**\n * Compile an AST that may contain InlineCode nodes.\n *\n * This compiler extends the standard expression compiler to handle InlineCode\n * nodes, which contain pre-compiled code that should be inserted directly.\n * It's used after replaceDollarRefWithCode to compile the transformed AST.\n *\n * @param ast - The AST node to compile (may contain InlineCode nodes)\n * @param context - The compilation context\n * @returns Compiled AssemblyScript code string\n */\nexport function compileExpressionWithInlineCode(ast: any, context: CompilationContext): string {\n // Handle InlineCode nodes specially - just return the pre-compiled code\n if (ast.type === 'InlineCode') {\n return (ast as InlineCode).code;\n }\n\n // For nodes with binary operations\n if (ast.type === 'BinaryOp') {\n const left = compileExpressionWithInlineCode(ast.left, context);\n const right = compileExpressionWithInlineCode(ast.right, context);\n return compileBinaryOpWithValues(ast.op, left, right);\n }\n\n // For unary operations\n if (ast.type === 'UnaryOp') {\n const operand = compileExpressionWithInlineCode(ast.operand, context);\n switch (ast.op) {\n case 'not':\n return `Value.Bool(!(${operand}).asBool())`;\n case '-':\n return `negateValue(${operand})`;\n default:\n throw new Error(`Unknown unary operator: ${ast.op}`);\n }\n }\n\n // For function calls, compile args recursively to handle InlineCode\n if (ast.type === 'FunctionCall') {\n const callee = ast.callee;\n if (callee.type === 'Identifier') {\n const args = ast.args.map((arg: any) => compileExpressionWithInlineCode(arg, context));\n const numArgs = args.length;\n\n // Use helper functions to create argument arrays\n if (numArgs === 1) {\n return `evaluateFunction(\"${callee.name}\", makeArgs1(${args[0]}))`;\n } else if (numArgs === 2) {\n return `evaluateFunction(\"${callee.name}\", makeArgs2(${args[0]}, ${args[1]}))`;\n } else if (numArgs === 3) {\n return `evaluateFunction(\"${callee.name}\", makeArgs3(${args[0]}, ${args[1]}, ${args[2]}))`;\n } else {\n return `evaluateFunction(\"${callee.name}\", [${args.join(', ')}])`;\n }\n }\n throw new Error('Only direct function calls are supported');\n }\n\n // For member access\n if (ast.type === 'MemberAccess') {\n const obj = compileExpressionWithInlineCode(ast.object, context);\n return `getProperty(${obj}, \"${ast.property}\")`;\n }\n\n // For index access\n if (ast.type === 'IndexAccess') {\n const obj = compileExpressionWithInlineCode(ast.object, context);\n const idx = compileExpressionWithInlineCode(ast.index, context);\n return `getIndex(${obj}, ${idx})`;\n }\n\n // For ternary operations\n if (ast.type === 'TernaryOp') {\n const cond = compileExpressionWithInlineCode(ast.condition, context);\n const cons = compileExpressionWithInlineCode(ast.consequent, context);\n const alt = compileExpressionWithInlineCode(ast.alternate, context);\n return `(${cond}.asBool() ? ${cons} : ${alt})`;\n }\n\n // For other node types, delegate to standard compileExpression\n return compileExpression(ast, context);\n}\n","import type { JDMNode } from '../parser';\nimport type { CompilationContext, AssemblyScriptCode, NoMatchBehavior } from '../types';\nimport { sanitizeId } from '../utils';\nimport { compileExpression } from './expression';\nimport { replaceDollarRefWithCode, compileExpressionWithInlineCode } from '../unary-transform';\n\n/**\n * Decision table content structure.\n */\ninterface DecisionTableContent {\n rules: any[];\n inputs: any[];\n outputs: any[];\n hitPolicy: 'first' | 'collect' | 'unique' | 'ruleOrder' | 'outputOrder' | 'priority';\n /** Override the global no-match behavior for this table */\n noMatchBehavior?: NoMatchBehavior;\n /** Whether to pass through input values to output */\n passThrough?: boolean;\n}\n\n/**\n * Compile a comparison expression for a decision table condition.\n *\n * In decision tables, expressions are evaluated in a \"unary\" context where\n * the $ symbol is automatically bound to the input field's value.\n *\n * For example:\n * - \"> 100\" becomes \"$ > 100\" with $ bound to the input field\n * - \"admin\" becomes \"$ == admin\" (equality check)\n * - \"[1..10]\" becomes \"$ in [1..10]\" (range check)\n *\n * The field parameter can be either:\n * - A simple field name like \"creditScore\" → ctx.get(\"creditScore\")\n * - An expression like \"date(order.createdAt)\" → needs to be parsed and evaluated\n *\n * Since AssemblyScript doesn't support closures, we transform the AST\n * to replace DollarRef nodes with the compiled field expression.\n *\n * @param expr - The raw expression string\n * @param inputType - The type of the input field\n * @param field - The field expression to compare against\n * @param context - The compilation context\n * @returns Compiled AssemblyScript code for the comparison\n */\nfunction compileComparison(\n expr: string,\n inputType: string,\n field: string | undefined,\n context: CompilationContext,\n): string {\n // Handle empty expressions or unset values. Empty cells mean \"any value matches\" for\n // that column. This is flexible (allows partial rule specification) but can be dangerous\n // (typos become wildcards). Following DMN/JDM convention where blank = don't care.\n if (!expr || expr === '' || expr === '-') {\n return 'true';\n }\n\n try {\n // When input field is \"$\", the cell contains a full boolean expression rather than a\n // unary comparison:\n // e.g., \"age > 18 and tier == 'gold'\"\n // This allows complex conditions that span multiple input values in a single cell, useful\n // for cross-column logic.\n if (!field || field === '$') {\n // Parse and compile the expression directly as a standard expression\n const ast = context.parseExpression(expr);\n const compiledExpr = compileExpression(ast, context);\n return `${compiledExpr}.asBool()`;\n }\n\n // Parse the expression using unary parser for decision table cells\n // This transforms expressions like \"> 100\" into AST representing \"$ > 100\"\n const ast = context.parseUnaryExpression(expr);\n\n // Compile the field expression to get the value to compare against\n // The field can be a simple name like \"creditScore\" or an expression like \"date(order.createdAt)\"\n const fieldAst = context.parseExpression(field);\n const compiledField = compileExpression(fieldAst, context);\n\n // Transform the AST to replace DollarRef nodes with the compiled field expression\n // AssemblyScript doesn't support closures, so we can't create a function context\n // where $ refers to the field value. Instead, we do direct AST substitution.\n const transformedAst = replaceDollarRefWithCode(ast, compiledField);\n\n // Compile the transformed AST to AssemblyScript code\n const compiledExpr = compileExpressionWithInlineCode(transformedAst, context);\n\n // Return the compiled expression wrapped in .asBool() for the condition\n return `${compiledExpr}.asBool()`;\n } catch (e) {\n // If parsing fails, log the error and return false (no match)\n // This prevents compilation failures from breaking the entire decision\n throw new Error(\n `Failed to compile decision table condition \"${expr}\" for field \"${field}\": ${e}`,\n );\n }\n}\n\n/**\n * Compile an output value for a decision table result.\n *\n * @param value - The raw value string\n * @param outputType - The type of the output field\n * @param field - The field name being set\n * @param context - The compilation context\n * @returns Compiled AssemblyScript code for the value\n */\nfunction compileOutputValue(\n value: string,\n outputType: string,\n field: string,\n context: CompilationContext,\n): string {\n // Handle empty/unset values: in multi-output tables, rules may set some outputs but not others.\n // Empty cells mean \"this rule doesn't provide a value for this output field\", allowing sparse tables.\n if (!value || value === '-' || value === '') {\n return '';\n }\n\n const normalizedType = (outputType || '').toLowerCase();\n\n // Check if value is a quoted string literal ('value' or \"value\")\n // In JDM format, string literals are often wrapped in single quotes\n const isQuotedString =\n (value.startsWith(\"'\") && value.endsWith(\"'\")) ||\n (value.startsWith('\"') && value.endsWith('\"'));\n\n // Strip outer quotes if present for string literal values\n const unquotedValue = isQuotedString ? value.slice(1, -1) : value;\n\n switch (normalizedType) {\n case 'expression': {\n // For expression type, parse and compile the value as an expression\n // This allows output values to reference context variables or perform calculations\n const ast = context.parseExpression(value);\n return compileExpression(ast, context);\n }\n\n case 'string':\n case 'text':\n // Input values may have quotes that need escaping for the generated AS code. Must escape\n // both backslashes (for escape sequences) and double quotes (for string delimiters).\n const escaped = unquotedValue.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"');\n return 'Value.String(\"' + escaped + '\")';\n\n case 'number':\n case 'integer':\n case 'decimal':\n case 'double':\n return `Value.Float(${parseFloat(value)})`;\n\n case 'boolean':\n case 'bool':\n return `Value.Bool(${value.toLowerCase() === 'true'})`;\n\n default:\n // For untyped values, infer type through a cascade:\n // 1. Quoted strings → string literal\n // 2. \"true\"/\"false\" → boolean\n // 3. Numeric format → number\n // 4. Otherwise → try parsing as expression, fallback to string literal\n if (isQuotedString) {\n // Value is a string literal - use the unquoted value\n const defaultEscaped = unquotedValue.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"');\n return 'Value.String(\"' + defaultEscaped + '\")';\n }\n\n // Check if it's a boolean\n if (value.toLowerCase() === 'true' || value.toLowerCase() === 'false') {\n return `Value.Bool(${value.toLowerCase() === 'true'})`;\n }\n\n // Check if it's a number (use regex to handle trailing zeros like \"0.10\")\n // The regex matches integer, decimal, and scientific notation formats\n if (/^-?(\\d+\\.?\\d*|\\.\\d+)([eE][+-]?\\d+)?$/.test(value)) {\n return `Value.Float(${parseFloat(value)})`;\n }\n\n // For unquoted non-literal values, treat as an expression\n // This handles cases like \"basicEligibility.reason\" or \"totalScore * 1.5\"\n try {\n const ast = context.parseExpression(value);\n return compileExpression(ast, context);\n } catch (e) {\n // Throw error instead of silently falling back to string literal\n // This prevents type errors and typos from being silently converted to strings\n throw new Error(\n `Failed to compile output value \"${value}\" for field \"${field}\": ${e}. ` +\n `If you intended a literal string, wrap it in quotes: '\"${value}\"' or \"'${value}'\"`,\n );\n }\n }\n}\n\n/**\n * Extract string literals from compiled code and generate hoisted constants.\n * This optimization avoids repeated string allocations in large decision tables.\n *\n * Hoisting string literals to module-level constants prevents repeated allocations\n * that can exhaust WASM memory during table evaluation.\n *\n * @param code - The compiled code containing Value.String(...) calls\n * @param nodeId - Unique identifier for this node (used in constant names)\n * @returns Object with hoisted constants code and transformed code\n */\nfunction hoistStringLiterals(code: string, nodeId: string): { constants: string; code: string } {\n // Find all Value.String(\"...\") patterns\n const stringLiteralRegex = /Value\\.String\\(\"([^\"\\\\]|\\\\.)*\"\\)/g;\n const matches = code.match(stringLiteralRegex) || [];\n\n // Count occurrences\n const counts = new Map<string, number>();\n for (const match of matches) {\n counts.set(match, (counts.get(match) || 0) + 1);\n }\n\n // Only hoist strings that appear more than once\n const toHoist = new Map<string, string>();\n let constIndex = 0;\n for (const [literal, count] of counts) {\n if (count > 1) {\n // Extract the string content for naming\n const constName = `__str_${sanitizeId(nodeId)}_${constIndex++}`;\n toHoist.set(literal, constName);\n }\n }\n\n // If nothing to hoist, return original\n if (toHoist.size === 0) {\n return { constants: '', code };\n }\n\n // Generate constant declarations\n const constants = Array.from(toHoist.entries())\n .map(([literal, constName]) => `const ${constName}: Value = ${literal};`)\n .join('\\n');\n\n // Replace literals with constant references\n let transformedCode = code;\n for (const [literal, constName] of toHoist) {\n // Need to escape regex special chars in the literal\n const escapedLiteral = literal.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n transformedCode = transformedCode.replace(new RegExp(escapedLiteral, 'g'), constName);\n }\n\n return { constants, code: transformedCode };\n}\n\n/**\n * Compile a decision table node.\n *\n * Generates if/else chains for decision table evaluation, supporting:\n * - FIRST hit policy: Returns the first matching rule's output\n * - COLLECT hit policy: Aggregates all matching rules' outputs\n * - UNIQUE hit policy: Returns output if exactly one rule matches\n * - RULE ORDER hit policy: Returns all matching rules' outputs in rule order\n * - OUTPUT ORDER hit policy: Returns all matching rules sorted by output priority\n * - PRIORITY hit policy: Returns only the highest-priority matching rule\n *\n * For large decision tables (many rules with repeated string literals),\n * string literals are hoisted to module-level constants to avoid\n * repeated allocations that can exhaust memory.\n *\n * @param node - The JDM decision table node\n * @param context - The compilation context\n * @returns Generated AssemblyScript code\n */\nexport function compileDecisionTableNode(\n node: JDMNode,\n context: CompilationContext,\n): AssemblyScriptCode {\n const {\n rules,\n inputs,\n outputs,\n hitPolicy,\n noMatchBehavior: tableNoMatchBehavior,\n passThrough,\n } = node.content as DecisionTableContent;\n\n // Determine the effective no-match behavior (table-level overrides global)\n const noMatchBehavior = tableNoMatchBehavior ??\n context.options.noMatchBehavior ?? { type: 'returnNull' };\n\n // Unique and priority need to evaluate all rules before making a decision\n const isCollectAll =\n hitPolicy === 'collect' ||\n hitPolicy === 'unique' ||\n hitPolicy === 'ruleOrder' ||\n hitPolicy === 'outputOrder' ||\n hitPolicy === 'priority';\n\n // Generate the result declaration based on hit policy\n let resultDeclaration: string;\n if (isCollectAll) {\n resultDeclaration = 'let results = new Array<Value>();';\n } else {\n resultDeclaration = '';\n }\n\n // Generate the rule evaluation branches\n const ruleBranches = rules\n .map((rule, idx) => {\n // Compile all input conditions for this rule\n const conditions = inputs\n .map((input) => {\n const expr = rule[input.id];\n if (!expr || expr === '' || expr === '-') {\n return 'true';\n }\n return compileComparison(expr, input.type, input.field, context);\n })\n .join(' && ');\n\n // Compile all output values for this rule\n const resultAssignments = outputs\n .map((output) => {\n const value = rule[output.id];\n if (!value || value === '' || value === '-') {\n return '';\n }\n const compiled = compileOutputValue(value, output.type, output.field, context);\n return ` result.set(\"${output.field}\", ${compiled});`;\n })\n .filter(Boolean)\n .join('\\n');\n\n // Generate the conditional expression and action\n if (isCollectAll) {\n // For collect-mode hit policies, evaluate all rules independently\n return `\n if (${conditions || 'true'}) {\n let result = new Map<string, Value>();\n${resultAssignments}\n results.push(Value.Object(result));\n }`;\n } else {\n // For FIRST hit policy, use if/else if chain\n const conditionalExpr =\n idx === 0 ? `if (${conditions || 'true'})` : `else if (${conditions || 'true'})`;\n return `${conditionalExpr} {\n let result = new Map<string, Value>();\n${resultAssignments}\n return Value.Object(result);\n }`;\n }\n })\n .join(isCollectAll ? '\\n' : '\\n');\n\n // Generate the no-match handler based on the effective behavior\n function generateNoMatchHandler(): string {\n const returnNull = 'return Value.Null();';\n\n // We need to signal to the caller that no rules matched but the table has passThrough enabled,\n // so it should return accumulated context. We can't directly access the outer context here, so\n // we return a marker object that the caller detects and handles.\n const returnPassthroughSignal = `let __pt = new Map<string, Value>();\n __pt.set(\"__passthrough\", Value.Bool(true));\n return Value.Object(__pt);`;\n\n if (noMatchBehavior.type === 'throwError') {\n return `SetLastErrorWithMessage(RuntimeErrorCode.EVALUATION_ERROR, \"Decision table \\\\\"${node.name}\\\\\" (id: ${node.id}): No matching rules found\");\\n ${returnNull}`;\n } else if (noMatchBehavior.type === 'returnDefault') {\n const defaultValue = noMatchBehavior.value;\n\n // Generate the default value as a Value based on its JavaScript type\n let defaultValueCode: string;\n switch (typeof defaultValue) {\n case 'string':\n defaultValueCode = `Value.String(\"${String(defaultValue).replace(/\"/g, '\\\\\"')}\")`;\n break;\n case 'number':\n defaultValueCode = `Value.Float(${defaultValue})`;\n break;\n case 'boolean':\n defaultValueCode = `Value.Bool(${defaultValue})`;\n break;\n default:\n defaultValueCode = `Value.String(\"${String(defaultValue)}\")`;\n }\n\n // Assign the default value to each output field\n const defaultAssignments = outputs\n .map((output) => {\n return ` result.set(\"${output.field}\", ${defaultValueCode});`;\n })\n .join('\\n');\n\n const defaultAssignmentSingle =\n outputs.length > 0\n ? ` let result = new Map<string, Value>();\\n${defaultAssignments}\\n return Value.Object(result);`\n : returnNull;\n\n if (isCollectAll) {\n // For collect-mode policies, return array with default result\n return ` let result = new Map<string, Value>();\\n${defaultAssignments}\\n return Value.Array([Value.Object(result)]);`;\n } else {\n return defaultAssignmentSingle;\n }\n } else {\n // Default: returnNull\n // But for FIRST hit policy with passThrough, signal to use accumulated context\n if (passThrough && hitPolicy === 'first') {\n return returnPassthroughSignal;\n }\n return returnNull;\n }\n }\n\n // Generate the final return statement based on hit policy\n // COLLECT-style policies return arrays directly (not wrapped in object)\n // The node name keying is handled by codegen.ts when storing in context\n let finalReturn: string;\n if (hitPolicy === 'collect' || hitPolicy === 'ruleOrder') {\n // For collect policies no-match handling\n if (noMatchBehavior.type === 'throwError') {\n finalReturn = `\n if (results.length == 0) {\n${generateNoMatchHandler()}\n }\n return Value.Array(results);`;\n } else if (noMatchBehavior.type === 'returnDefault') {\n finalReturn = `\n if (results.length == 0) {\n${generateNoMatchHandler()}\n }\n return Value.Array(results);`;\n } else {\n finalReturn = `return Value.Array(results);`;\n }\n } else if (hitPolicy === 'unique') {\n finalReturn = `\n // Validate exactly one match\n if (results.length == 1) {\n return results[0];\n } else if (results.length == 0) {\n ${generateNoMatchHandler()}\n } else {\n // Multiple matches - this violates UNIQUE constraint\n SetLastErrorWithMessage(RuntimeErrorCode.EVALUATION_ERROR, \"Decision table \\\\\"${node.name}\\\\\" (id: ${node.id}): Multiple rules matched but UNIQUE hit policy requires exactly one match\");\n return Value.Null();\n }`;\n } else if (hitPolicy === 'outputOrder' || hitPolicy === 'priority') {\n if (outputs.length === 0) {\n throw new Error(`${hitPolicy.toUpperCase()} hit policy requires at least one output field`);\n }\n\n const primaryOutput = outputs[0];\n finalReturn = `\n // Sort by output value (descending priority), with rule order as tie-breaker\n results.sort((a: Value, b: Value): i32 => {\n let aOutput = a.asObject().get(\"${primaryOutput.field}\");\n let bOutput = b.asObject().get(\"${primaryOutput.field}\");\n\n // Compare the primary output values\n let cmp = compareValues(aOutput, bOutput);\n\n // If outputs are equal, maintain rule order (lower index = higher priority)\n if (cmp == 0) {\n return 1; // already in rule order, so keep it\n }\n\n // Return results in descending order of output priority\n // Higher output values come first\n return cmp < 0 ? 1 : -1;\n });\n\n if (results.length == 0) {\n${generateNoMatchHandler()}\n }\n\n ${\n hitPolicy === 'priority'\n ? '// Return only the highest-priority result\\n return results[0];'\n : 'return Value.Array(results);'\n }`;\n } else {\n // Default case - FIRST hit policy\n finalReturn = `\\n else {\\n ${generateNoMatchHandler()}\\n }`;\n }\n\n const sanitizedId = sanitizeId(node.id);\n\n // Build the raw function body\n const rawFunctionBody = `\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n ${resultDeclaration}\n\n${ruleBranches}\n${finalReturn}\n}\n`;\n\n // For large decision tables, hoist repeated string literals to module-level constants\n // This prevents memory exhaustion from repeated Value.String() allocations\n if (rules.length > 100) {\n const { constants, code: optimizedBody } = hoistStringLiterals(rawFunctionBody, node.id);\n if (constants) {\n return `// Hoisted string constants for decision table \"${node.name}\" (${rules.length} rules)\n${constants}\n\n${optimizedBody}`;\n }\n }\n\n return rawFunctionBody;\n}\n","/**\n * Code generation helpers for shared AssemblyScript code patterns.\n *\n * These helpers generate AssemblyScript code strings that can be used across\n * different compiler modules to avoid duplication.\n */\n\nimport { sanitizeId } from './utils';\n\n/**\n * Generate AssemblyScript code to assign a value to a nested path in the context.\n *\n * This handles dotted paths like \"cart.items.total\" by navigating/creating the\n * necessary object hierarchy in the context. The algorithm:\n * 1. Splits the path by \".\"\n * 2. Gets or creates the root object from context\n * 3. Navigates/creates intermediate objects for each part\n * 4. Sets the final value at the leaf\n *\n * @param path - The dotted path string (e.g., \"cart.items.total\")\n * @param valueExpr - The AssemblyScript expression for the value to assign\n * @param prefix - Optional prefix for generated variable names to avoid collisions (default: \"__np\")\n * @returns AssemblyScript code string that performs the nested assignment\n */\nexport function generateNestedPathAssignment(\n path: string,\n valueExpr: string,\n prefix: string = '__np',\n): string {\n return `// Store value at nested path: ${path}\n{\n const ${prefix}_value = ${valueExpr};\n const ${prefix}_parts = \"${path}\".split(\".\");\n const ${prefix}_rootKey = ${prefix}_parts[0];\n // Get or create the root object\n let ${prefix}_rootObj: Map<string, Value>;\n if (ctx.data.has(${prefix}_rootKey) && ctx.data.get(${prefix}_rootKey).isObject()) {\n ${prefix}_rootObj = ctx.data.get(${prefix}_rootKey).asObject();\n } else {\n ${prefix}_rootObj = new Map<string, Value>();\n ctx.set(${prefix}_rootKey, Value.Object(${prefix}_rootObj));\n }\n // Navigate/create nested objects for intermediate parts\n let ${prefix}_current = ${prefix}_rootObj;\n for (let ${prefix}_j = 1; ${prefix}_j < ${prefix}_parts.length - 1; ${prefix}_j++) {\n const ${prefix}_part = ${prefix}_parts[${prefix}_j];\n if (${prefix}_current.has(${prefix}_part) && ${prefix}_current.get(${prefix}_part).isObject()) {\n ${prefix}_current = ${prefix}_current.get(${prefix}_part).asObject();\n } else {\n const ${prefix}_newObj = new Map<string, Value>();\n ${prefix}_current.set(${prefix}_part, Value.Object(${prefix}_newObj));\n ${prefix}_current = ${prefix}_newObj;\n }\n }\n // Set the final value at the leaf of the path\n ${prefix}_current.set(${prefix}_parts[${prefix}_parts.length - 1], ${prefix}_value);\n}`;\n}\n\n/**\n * Generate AssemblyScript code to build a final result from accumulated context.\n *\n * This extracts all user-facing keys from the context (excluding internal namespaces)\n * and builds a Map suitable for returning as a Value.Object result.\n *\n * The generated code:\n * 1. Creates a new Map for the result\n * 2. Iterates over all keys in ctx.data\n * 3. Filters out internal keys ($*, #, acc)\n * 4. Copies remaining keys to the result map\n *\n * @param resultVarName - The name of the variable to store the result in\n * @param prefix - Optional prefix for loop variables to avoid collisions (default: \"__bfr\")\n * @returns AssemblyScript code string that builds the result map\n */\nexport function generateBuildFinalResultCode(\n resultVarName: string,\n prefix: string = '__bfr',\n): string {\n return `// Build final result from accumulated context\nlet ${resultVarName} = new Map<string, Value>();\nconst ${prefix}_keys = ctx.data.keys();\nfor (let ${prefix}_i = 0; ${prefix}_i < ${prefix}_keys.length; ${prefix}_i++) {\n const ${prefix}_key = ${prefix}_keys[${prefix}_i];\n // $nodes/$ are internal namespaces\n // # is iteration variable,\n // acc is accumulator\n // None should appear in final output, only actual output field names\n if (!${prefix}_key.startsWith(\"$\") && ${prefix}_key !== \"#\" && ${prefix}_key !== \"acc\") {\n ${resultVarName}.set(${prefix}_key, ctx.data.get(${prefix}_key));\n }\n}`;\n}\n\n/**\n * Generate AssemblyScript code to evaluate a single node and handle its outputPath and passThrough settings.\n *\n * This is the standard node evaluation pattern used across the codebase. It:\n * 1. Calls the node's evaluateNode function\n * 2. Stores the result in $nodes.<nodeName>\n * 3. Handles outputPath if specified (storing result at the given path)\n * 4. Handles passThrough merge if the node is configured for it\n *\n * @param nodeId - The raw node ID\n * @param nodeName - The name of the node (for context storage)\n * @param node - The JDM node definition (optional, for outputPath/passThrough handling)\n * @returns AssemblyScript code string that evaluates the node\n */\nexport function generateNodeEvaluationCode(\n nodeId: string,\n nodeName: string,\n node?: {\n type?: string;\n content?: { outputPath?: string; passThrough?: boolean; outputs?: Array<{ field?: string }> };\n },\n): string {\n const sanitizedId = sanitizeId(nodeId);\n const statements: string[] = [];\n\n // Call the node's evaluateNode function and store result\n statements.push(`ctx.set(\"$nodes.${nodeName}\", evaluateNode_${sanitizedId}(ctx));`);\n\n if (!node) {\n return statements.join('\\n ');\n }\n\n const outputPath = node.content?.outputPath;\n if (outputPath) {\n if (!outputPath.includes('.')) {\n statements.push(`ctx.set(\"${outputPath}\", ctx.get(\"$nodes.${nodeName}\"));`);\n } else {\n statements.push(generateNestedPathAssignment(outputPath, `ctx.get(\"$nodes.${nodeName}\")`));\n }\n }\n\n // Determine if we should merge node results into context\n // Expression nodes compute values meant for the output, so their results should flow\n // through to the final result regardless of passThrough setting. Decision tables with\n // dotted output fields (e.g., \"flag.turnover\") similarly need merging to build nested\n // output structures.\n const hasOutputFields =\n node.type === 'decisionTableNode' &&\n node.content?.outputs?.some((o: { field?: string }) => o.field && o.field.includes('.'));\n const shouldMerge =\n node.type === 'expressionNode' || node.content?.passThrough === true || hasOutputFields;\n\n if (shouldMerge) {\n statements.push(generatePassThroughMergeCode(nodeName));\n }\n\n return statements.join('\\n ');\n}\n\n/**\n * Generate AssemblyScript code to merge passThrough node results into the context.\n *\n * This handles both simple keys (e.g., \"status\") and nested paths (e.g., \"evaluation.score\").\n * For nested paths, it navigates/creates the necessary object hierarchy in the context.\n *\n * The generated code:\n * 1. Gets the node result from `$nodes.<nodeName>`\n * 2. Iterates over all keys in the result\n * 3. For simple keys, sets them directly in the context\n * 4. For nested paths, navigates/creates intermediate objects and sets the leaf value\n *\n * @param nodeName - The name of the node whose results should be merged\n * @returns AssemblyScript code string that performs the merge\n */\nexport function generatePassThroughMergeCode(nodeName: string): string {\n // Generate the nested path assignment code for use inside the loop\n // We use a special prefix \"__pt\" to avoid collisions with other generated code\n const nestedPathCode = `const __pt_parts = __key.split(\".\");\n const __pt_rootKey = __pt_parts[0];\n let __pt_rootObj: Map<string, Value>;\n if (ctx.data.has(__pt_rootKey) && ctx.data.get(__pt_rootKey).isObject()) {\n __pt_rootObj = ctx.data.get(__pt_rootKey).asObject();\n } else {\n __pt_rootObj = new Map<string, Value>();\n ctx.set(__pt_rootKey, Value.Object(__pt_rootObj));\n }\n let __pt_current = __pt_rootObj;\n for (let __pt_j = 1; __pt_j < __pt_parts.length - 1; __pt_j++) {\n const __pt_part = __pt_parts[__pt_j];\n if (__pt_current.has(__pt_part) && __pt_current.get(__pt_part).isObject()) {\n __pt_current = __pt_current.get(__pt_part).asObject();\n } else {\n const __pt_newObj = new Map<string, Value>();\n __pt_current.set(__pt_part, Value.Object(__pt_newObj));\n __pt_current = __pt_newObj;\n }\n }\n __pt_current.set(__pt_parts[__pt_parts.length - 1], __value);`;\n\n return `// Merge passThrough results for ${nodeName}\n{\n const __nodeResult = ctx.get(\"$nodes.${nodeName}\");\n if (__nodeResult.isObject()) {\n const __resultMap = __nodeResult.asObject();\n const __keys = __resultMap.keys();\n for (let __i = 0; __i < __keys.length; __i++) {\n const __key = __keys[__i];\n const __value = __resultMap.get(__key);\n if (__key.includes(\".\")) {\n ${nestedPathCode}\n } else {\n ctx.set(__key, __value);\n }\n }\n }\n}`;\n}\n","import type { JDMNode } from '../parser';\nimport type { CompilationContext, AssemblyScriptCode, NoMatchBehavior } from '../types';\nimport { compileExpression } from './expression';\nimport { sanitizeId } from '../utils';\nimport { generateNodeEvaluationCode, generateBuildFinalResultCode } from '../code-generators';\n\n/**\n * Switch statement definition (from JDM format).\n */\ninterface SwitchStatement {\n id: string;\n condition: string; // Empty string means default case\n}\n\n/**\n * Switch node content structure (from JDM format).\n */\ninterface JDMNodeContent {\n statements: SwitchStatement[];\n hitPolicy?: 'first' | 'collect' | 'unique' | 'ruleOrder' | 'outputOrder' | 'priority';\n /** Override the global no-match behavior for this switch */\n noMatchBehavior?: NoMatchBehavior;\n}\n\n/**\n * Internal switch condition definition.\n */\ninterface SwitchCondition {\n id: string;\n expression: string;\n nodes: string[];\n isDefault: boolean;\n}\n\n/**\n * Get all nodes reachable from a starting node via BFS, stopping at switch nodes.\n *\n * Each switch evaluates its own branches independently. If we traversed into nested\n * switches, we'd incorrectly include nodes that should be conditionally evaluated by\n * the nested switch, not unconditionally evaluated by the parent branch.\n */\nfunction getBranchNodes(startNodeId: string, context: CompilationContext): string[] {\n const nodeMap = new Map(context.jdm.nodes.map((n) => [n.id, n]));\n const visited = new Set<string>();\n const result: string[] = [];\n const queue = [startNodeId];\n\n while (queue.length > 0) {\n const currentId = queue.shift()!;\n if (visited.has(currentId)) {\n continue;\n }\n visited.add(currentId);\n result.push(currentId);\n\n // Get the current node\n const currentNode = nodeMap.get(currentId);\n\n // If node not found in context, just include it and stop traversal\n // (this handles test mocks that don't define all nodes)\n if (!currentNode) {\n continue;\n }\n\n // If this is a switch node, don't traverse its outgoing edges\n // The switch will handle its own branches when it's evaluated\n if (currentNode.type === 'switchNode') {\n continue;\n }\n\n // Find outgoing edges from this node\n const outgoingEdges = context.jdm.edges.filter((e) => e.sourceId === currentId);\n for (const edge of outgoingEdges) {\n queue.push(edge.targetId);\n }\n }\n\n return result;\n}\n\n/**\n * Generate inline code to evaluate an entire branch (all nodes in sequence).\n * Returns the statements and a final result expression.\n *\n * Uses shared node evaluation infrastructure (generateNodeEvaluationCode) to ensure\n * consistent handling of outputPath and passThrough across the codebase.\n */\nfunction generateBranchEvaluation(\n branchNodeIds: string[],\n context: CompilationContext,\n): { statements: string; resultExpr: string } {\n const nodeMap = new Map(context.jdm.nodes.map((n) => [n.id, n]));\n\n if (branchNodeIds.length === 0) {\n return { statements: '', resultExpr: 'Value.Null()' };\n }\n\n // Generate evaluation code for each node using shared helper\n const evalStatements = branchNodeIds.map((nodeId) => {\n const node = nodeMap.get(nodeId);\n const nodeName = node?.name || sanitizeId(nodeId);\n return generateNodeEvaluationCode(nodeId, nodeName, node);\n });\n\n // Determine result expression based on the last node's type\n const lastNodeId = branchNodeIds[branchNodeIds.length - 1];\n const lastNode = nodeMap.get(lastNodeId);\n const lastNodeName = lastNode?.name || sanitizeId(lastNodeId);\n\n // For output nodes or nodes with passThrough, build result from accumulated context\n const shouldUseAccumulatedContext =\n lastNode?.type === 'outputNode' || lastNode?.content?.passThrough === true;\n\n if (shouldUseAccumulatedContext) {\n // Use shared helper to build final result from context\n evalStatements.push(generateBuildFinalResultCode('__branchFinalResult', '__branch'));\n return {\n statements: evalStatements.join('\\n '),\n resultExpr: 'Value.Object(__branchFinalResult)',\n };\n }\n\n return {\n statements: evalStatements.join('\\n '),\n resultExpr: `ctx.get(\"$nodes.${lastNodeName}\")`,\n };\n}\n\n/**\n * Compile a switch node.\n *\n * Generates conditional chains (switch-like logic) for evaluating multiple\n * conditions and routing to the appropriate target nodes.\n *\n * Supports:\n * - FIRST hit policy: Returns the first matching condition's result\n * - COLLECT hit policy: Aggregates all matching conditions' results\n * - RULE ORDER hit policy: Returns all matching conditions' results in order\n * - UNIQUE hit policy: Returns result if exactly one condition matches\n * - OUTPUT ORDER hit policy: Returns all matching conditions' results sorted by value\n * - PRIORITY hit policy: Returns only the highest-priority matching condition's result\n *\n * Default Cases:\n * - A statement with an empty condition string acts as the default case\n * - When no conditions match, the default case is evaluated (if provided)\n * - Default case has access to the full input context\n * - If no default case is provided, the configured no-match behavior applies\n *\n * @param node - The JDM switch node\n * @param context - The compilation context\n * @returns Generated AssemblyScript code\n */\nexport function compileSwitchNode(node: JDMNode, context: CompilationContext): AssemblyScriptCode {\n const jdmContent = node.content as JDMNodeContent;\n const {\n statements,\n hitPolicy: jdmHitPolicy,\n noMatchBehavior: switchNoMatchBehavior,\n } = jdmContent;\n\n const hitPolicy = jdmHitPolicy ?? 'first';\n\n // Determine the effective no-match behavior (node-level overrides global)\n const noMatchBehavior = switchNoMatchBehavior ??\n context.options.noMatchBehavior ?? { type: 'returnNull' };\n\n // RULE ORDER, COLLECT, OUTPUT ORDER, and PRIORITY all use array collection mode\n const isCollectMode =\n hitPolicy === 'collect' ||\n hitPolicy === 'ruleOrder' ||\n hitPolicy === 'outputOrder' ||\n hitPolicy === 'priority';\n\n const nodeMap = new Map(context.jdm.nodes.map((n) => [n.id, n]));\n\n // In collect mode, if all branches terminate at output nodes, we can merge their results into\n // a single object instead of returning an array. This allows collect-mode switches to build\n // structured outputs progressively, avoiding unnecessary nesting.\n function checkAllBranchesTerminateAtOutput(): boolean {\n if (!isCollectMode) {\n return false;\n }\n\n for (const statement of statements) {\n if (statement.condition === '' || statement.condition.trim() === '') {\n continue;\n } // Skip default\n\n // Find target edge for this statement\n const edge = context.jdm.edges.find(\n (e) => e.sourceId === node.id && e.sourceHandle === statement.id,\n );\n if (!edge) {\n continue;\n }\n\n // Get the terminal node(s) for this branch\n const branchNodes = getBranchNodes(edge.targetId, context);\n if (branchNodes.length === 0) {\n return false;\n }\n\n const lastNodeId = branchNodes[branchNodes.length - 1];\n const lastNode = nodeMap.get(lastNodeId);\n if (!lastNode || lastNode.type !== 'outputNode') {\n return false;\n }\n }\n\n // Also check default case if exists\n const defaultStatement = statements.find(\n (s) => s.condition === '' || s.condition.trim() === '',\n );\n if (defaultStatement) {\n const edge = context.jdm.edges.find(\n (e) => e.sourceId === node.id && e.sourceHandle === defaultStatement.id,\n );\n if (edge) {\n const branchNodes = getBranchNodes(edge.targetId, context);\n if (branchNodes.length > 0) {\n const lastNodeId = branchNodes[branchNodes.length - 1];\n const lastNode = nodeMap.get(lastNodeId);\n if (!lastNode || lastNode.type !== 'outputNode') {\n return false;\n }\n }\n }\n }\n\n return true;\n }\n\n const shouldMergeCollectResults = checkAllBranchesTerminateAtOutput();\n\n // Transform JDM statements to internal conditions format\n const conditions: SwitchCondition[] = statements.map((statement) => {\n // Find target nodes for this statement by looking for edges with this statement as sourceHandle\n const edges = context.jdm.edges.filter(\n (edge) => edge.sourceId === node.id && edge.sourceHandle === statement.id,\n );\n const targetNodeIds = edges.map((edge) => sanitizeId(edge.targetId));\n\n return {\n id: statement.id,\n expression: statement.condition,\n nodes: targetNodeIds,\n // In collect mode, all matching conditions execute (empty = always match).\n // In first mode, execution stops at first match, so empty condition acts as fallback \"default\" case.\n isDefault:\n !isCollectMode && (statement.condition === '' || statement.condition.trim() === ''),\n };\n });\n\n // Separate regular conditions from default case\n // In collect mode, there are no defaults - empty conditions are just \"always true\"\n const regularConditions = conditions.filter((c) => !c.isDefault);\n const defaultCase = isCollectMode ? undefined : conditions.find((c) => c.isDefault);\n\n // Generate the result declaration based on hit policy\n const resultDeclaration = isCollectMode ? 'let results = new Array<Value>();' : '';\n\n // Generate the no-match handler based on the effective behavior\n function generateNoMatchHandler(): string {\n if (noMatchBehavior.type === 'throwError') {\n return `SetLastErrorWithMessage(RuntimeErrorCode.EVALUATION_ERROR, \"Switch node \\\\\"${node.name}\\\\\" (id: ${node.id}): No matching condition found\");\\n return Value.Null();`;\n } else if (noMatchBehavior.type === 'returnDefault') {\n // Generate the default value as a Value\n const defaultValue = noMatchBehavior.value;\n let defaultValueCode: string;\n switch (typeof defaultValue) {\n case 'string':\n defaultValueCode = `Value.String(\"${String(defaultValue).replace(/\"/g, '\\\\\"')}\")`;\n break;\n case 'number':\n defaultValueCode = `Value.Float(${defaultValue})`;\n break;\n case 'boolean':\n defaultValueCode = `Value.Bool(${defaultValue})`;\n break;\n default:\n defaultValueCode = `Value.String(\"${String(defaultValue)}\")`;\n }\n\n return isCollectMode\n ? `return Value.Array([${defaultValueCode}]);`\n : `return ${defaultValueCode};`;\n } else {\n // Default: returnNull\n return 'return Value.Null();';\n }\n }\n\n // Helper function to generate code that evaluates the default case (entire branch)\n function generateDefaultCaseEvaluation(): string {\n if (!defaultCase) {\n return generateNoMatchHandler();\n }\n\n // Get the first node ID for the default case\n // If no target node is connected to the default case, use no-match behavior\n if (!defaultCase.nodes || defaultCase.nodes.length === 0) {\n // Default case exists but has no target - treat as no-match\n return generateNoMatchHandler();\n }\n\n // Get all nodes in this branch (from target to end)\n const branchStartId = defaultCase.nodes[0]; // Use raw ID, not sanitized\n // Find the raw ID from the edge\n const defaultEdge = context.jdm.edges.find(\n (e) => e.sourceId === node.id && e.sourceHandle === defaultCase.id,\n );\n const rawTargetId = defaultEdge?.targetId || branchStartId;\n const branchNodeIds = getBranchNodes(rawTargetId, context);\n\n // Generate code to evaluate the entire branch\n const { statements, resultExpr } = generateBranchEvaluation(branchNodeIds, context);\n\n if (isCollectMode) {\n return ` ${statements}\\n results.push(${resultExpr});`;\n } else {\n return ` ${statements}\\n return ${resultExpr};`;\n }\n }\n\n // Generate the conditional branches for each condition (excluding default)\n let conditionBranches: string;\n let finalReturn: string;\n\n // Helper to get branch nodes for a condition\n function getBranchNodesForCondition(condition: SwitchCondition): string[] {\n if (!condition.nodes || condition.nodes.length === 0) {\n return [];\n }\n\n // Find the edge for this condition to get the raw target ID\n const edge = context.jdm.edges.find(\n (e) => e.sourceId === node.id && e.sourceHandle === condition.id,\n );\n const rawTargetId = edge?.targetId || condition.nodes[0];\n return getBranchNodes(rawTargetId, context);\n }\n\n // Handle the case where there are no regular conditions but there is a default case\n if (regularConditions.length === 0) {\n conditionBranches = '';\n if (defaultCase && defaultCase.nodes && defaultCase.nodes.length > 0) {\n // Only default case exists with a target - evaluate the entire branch\n const branchNodeIds = getBranchNodesForCondition(defaultCase);\n const { statements, resultExpr } = generateBranchEvaluation(branchNodeIds, context);\n\n if (isCollectMode) {\n finalReturn = `\n ${statements}\n results.push(${resultExpr});\n return Value.Array(results);`;\n } else {\n finalReturn = `\n ${statements}\n return ${resultExpr};`;\n }\n } else {\n // No conditions and no default case (or default with no target) - use no-match behavior\n finalReturn = `\\n ${generateNoMatchHandler()}`;\n }\n } else {\n // Generate the conditional branches for each condition (excluding default)\n conditionBranches = regularConditions\n .map((condition, idx) => {\n // Parse and compile the condition expression\n let compiledExpr: string;\n // Empty condition means \"always true\" (especially in collect mode)\n if (condition.expression === '' || condition.expression.trim() === '') {\n compiledExpr = 'true';\n } else {\n try {\n const ast = context.parseExpression(condition.expression);\n // Get the conditional value (expects a boolean result)\n const exprCode = compileExpression(ast, context);\n compiledExpr = `${exprCode}.asBool()`;\n } catch {\n // If parsing fails, provide a comment indicating the issue\n // Can fail if expression syntax is invalid (checked at compile time)\n compiledExpr = '/* ERROR: Could not parse expression */ false';\n }\n }\n\n // Get all nodes in this branch (from target to end)\n const branchNodeIds = getBranchNodesForCondition(condition);\n const { statements, resultExpr } = generateBranchEvaluation(branchNodeIds, context);\n\n // Generate the conditional branch\n if (isCollectMode) {\n // For collect-mode hit policies, evaluate all conditions independently\n if (shouldMergeCollectResults) {\n // When all branches terminate at output nodes, just evaluate (don't collect)\n // The context accumulates all results which get merged at the end\n const branchCode = `\\n if (${compiledExpr}) {\n ${statements}\n }`;\n return branchCode;\n }\n const branchCode = `\\n if (${compiledExpr}) {\n ${statements}\n results.push(${resultExpr});\n }`;\n return branchCode;\n } else {\n // For FIRST hit policy, use if/else if chain (short-circuit on first match)\n const prefix = idx === 0 ? '\\n if' : '\\n else if';\n const branchCode = `${prefix} (${compiledExpr}) {\n ${statements}\n return ${resultExpr};\n }`;\n return branchCode;\n }\n })\n .join('');\n\n if (isCollectMode) {\n // For OUTPUT ORDER and PRIORITY, sort the results by value (descending)\n if (hitPolicy === 'outputOrder' || hitPolicy === 'priority') {\n if (\n defaultCase ||\n noMatchBehavior.type === 'throwError' ||\n noMatchBehavior.type === 'returnDefault'\n ) {\n finalReturn = `\n // Sort by value (descending priority), with rule order as tie-breaker\n // compareValues returns: -1 if a < b, 0 if equal, 1 if a > b\n // For descending order (higher priority first): return inverted comparison\n // Tie-breaker: when equal, return 1 to maintain original rule order (stable sort)\n results.sort((a: Value, b: Value): i32 => {\n let cmp = compareValues(a, b);\n if (cmp == 0) {\n return 1;\n }\n return cmp < 0 ? 1 : -1;\n });\n\n if (results.length == 0) {\n${generateDefaultCaseEvaluation()}\n }\n\n ${hitPolicy === 'priority' ? 'return results[0];' : 'return Value.Array(results);'}`;\n } else {\n finalReturn = `\n // Sort by value (descending priority), with rule order as tie-breaker\n // compareValues returns: -1 if a < b, 0 if equal, 1 if a > b\n // For descending order (higher priority first): return inverted comparison\n // Tie-breaker: when equal, return 1 to maintain original rule order (stable sort)\n results.sort((a: Value, b: Value): i32 => {\n let cmp = compareValues(a, b);\n if (cmp == 0) {\n return 1;\n }\n return cmp < 0 ? 1 : -1;\n });\n\n ${\n hitPolicy === 'priority'\n ? 'return results.length > 0 ? results[0] : Value.Null();'\n : 'return Value.Array(results);'\n }`;\n }\n } else {\n // Collect or rule order without sorting\n if (shouldMergeCollectResults) {\n // When merging results, return the accumulated context (excluding input keys)\n // First check if any branch was evaluated, if not run default\n if (defaultCase) {\n finalReturn = `\n // Build merged result from accumulated context (excluding input keys)\n // Runtime variables: $=context root, #=current array element, acc=reduce accumulator\n let __mergedResult = new Map<string, Value>();\n const __mergedCtxKeys = ctx.data.keys();\n for (let __mergedI = 0; __mergedI < __mergedCtxKeys.length; __mergedI++) {\n const __mergedKey = __mergedCtxKeys[__mergedI];\n // Skip internal entries, special variables, and input keys\n if (!__mergedKey.startsWith(\"$\") && __mergedKey !== \"#\" && __mergedKey !== \"acc\" && !ctx.inputKeys.has(__mergedKey)) {\n __mergedResult.set(__mergedKey, ctx.data.get(__mergedKey));\n }\n }\n // If no output was produced, run default case\n if (__mergedResult.size == 0) {\n${generateDefaultCaseEvaluation()}\n // Rebuild result after default case\n __mergedResult = new Map<string, Value>();\n const __afterDefaultKeys = ctx.data.keys();\n for (let __afterI = 0; __afterI < __afterDefaultKeys.length; __afterI++) {\n const __afterKey = __afterDefaultKeys[__afterI];\n if (!__afterKey.startsWith(\"$\") && __afterKey !== \"#\" && __afterKey !== \"acc\" && !ctx.inputKeys.has(__afterKey)) {\n __mergedResult.set(__afterKey, ctx.data.get(__afterKey));\n }\n }\n }\n return Value.Object(__mergedResult);`;\n } else {\n finalReturn = `\n // Build merged result from accumulated context (excluding input keys)\n // Runtime variables: $=context root, #=current array element, acc=reduce accumulator\n let __mergedResult = new Map<string, Value>();\n const __mergedCtxKeys = ctx.data.keys();\n for (let __mergedI = 0; __mergedI < __mergedCtxKeys.length; __mergedI++) {\n const __mergedKey = __mergedCtxKeys[__mergedI];\n // Skip internal entries, special variables, and input keys\n if (!__mergedKey.startsWith(\"$\") && __mergedKey !== \"#\" && __mergedKey !== \"acc\" && !ctx.inputKeys.has(__mergedKey)) {\n __mergedResult.set(__mergedKey, ctx.data.get(__mergedKey));\n }\n }\n return Value.Object(__mergedResult);`;\n }\n } else if (\n defaultCase ||\n noMatchBehavior.type === 'throwError' ||\n noMatchBehavior.type === 'returnDefault'\n ) {\n finalReturn = `\n if (results.length == 0) {\n${generateDefaultCaseEvaluation()}\n }\n return Value.Array(results);`;\n } else {\n finalReturn = '\\n return Value.Array(results);';\n }\n }\n } else {\n // Non-collect mode (FIRST, PRIORITY)\n if (defaultCase) {\n // Use else block to evaluate default case\n // Last branch already has closing brace, so just add else block\n finalReturn = `\\n else {\\n // Default case - no conditions matched\\n${generateDefaultCaseEvaluation()}\\n }`;\n } else {\n // Use else block for no-match handling\n finalReturn = `\\n else {\\n ${generateNoMatchHandler()}\\n }`;\n }\n }\n }\n\n const sanitizedId = sanitizeId(node.id);\n return `\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n ${resultDeclaration}\n\n ${conditionBranches}${finalReturn}\n}\n`;\n}\n","import type { JDMNode, JDMDecision } from '../parser';\nimport type { CompilationContext, AssemblyScriptCode } from '../types';\nimport { sanitizeId } from '../utils';\nimport { compileDecisionTableNode } from './decision-table';\nimport { compileSwitchNode } from './switch';\nimport { compileInputNode } from './input';\nimport { compileExpressionNode } from './expression';\nimport { compileFunctionNode } from './function';\nimport { buildGraph, getEvaluationOrder } from '../graph';\n\n/**\n * Generate a unique prefix for sub-decision node IDs to avoid naming conflicts.\n */\nfunction decisionNodePrefix(nodeId: string): string {\n return `sub_${sanitizeId(nodeId)}_`;\n}\n\n/**\n * Generate the sub-decision entry point function that contains the actual evaluation logic.\n */\nfunction generateSubDecisionEntryPoint(\n node: JDMNode,\n context: CompilationContext,\n subDecision: JDMDecision,\n prefix: string,\n): AssemblyScriptCode {\n const sanitizedId = sanitizeId(node.id);\n\n // Build the sub-decision graph and get evaluation order\n const graph = buildGraph(subDecision);\n // Catches circular sub-decision references at compile time for better error messages and\n // fail-fast behavior, rather than discovering cycles at runtime with stack overflow.\n const evaluationOrder = getEvaluationOrder(graph);\n\n // Create a node lookup for quick access\n const nodeMap = new Map(subDecision.nodes.map((n) => [n.id, n]));\n\n // Generate evaluation code for each node in topological order\n // Skip output nodes - they mark graph termination but don't perform computation\n // Skip input nodes (input just passes context through)\n const evaluationCode = evaluationOrder\n .map((nodeId) => {\n const subNode = nodeMap.get(nodeId);\n if (!subNode || subNode.type === 'outputNode' || subNode.type === 'inputNode') {\n return '';\n }\n const prefixedId = prefix + sanitizeId(nodeId);\n // Store node result in context under $nodes.<nodeName>\n return ` ctx.set(\"$nodes.${subNode.name}\", evaluateNode_${prefixedId}(ctx));`;\n })\n .filter(Boolean)\n .join('\\n');\n\n // Find the last non-input, non-output node that was evaluated to return its result\n const evaluatedNodes = evaluationOrder.filter((id) => {\n const subNode = nodeMap.get(id);\n if (!subNode) {\n return false;\n }\n return subNode.type !== 'inputNode' && subNode.type !== 'outputNode';\n });\n\n // Determine what to return:\n // - If there are evaluated nodes, return the last one's result\n // - Otherwise, return an empty object for passthrough graphs\n let resultCode: string;\n if (evaluatedNodes.length > 0) {\n const lastNodeId = evaluatedNodes[evaluatedNodes.length - 1];\n const lastNode = nodeMap.get(lastNodeId)!;\n resultCode = ` let result = ctx.get(\"$nodes.${lastNode.name}\");`;\n } else {\n // For passthrough graphs (input->output with no intermediate nodes),\n // return an empty object to indicate \"no transformation\"\n //\n // Can't return ctx.toValue: Returning ctx as-is would create circular reference when the\n // result is merged back into parent context. Empty object signals \"pass through unchanged\".\n resultCode = ` let result = Value.Object(new Map<string, Value>());`;\n }\n\n return `\n// Sub-decision entry point function for ${node.id}\nexport function evaluateSubDecision_${sanitizedId}(ctx: Context): Value {\n // Evaluate the sub-decision graph\n${evaluationCode}\n\n // Get the final result\n${resultCode}\n\n return result;\n}\n`;\n}\n\n/**\n * Generate a wrapper function that handles caching, recursion detection, and delegates to the sub-decision entry point.\n */\nfunction generateDecisionNodeWrapper(\n node: JDMNode,\n subDecisionFunctionName: string,\n): AssemblyScriptCode {\n const sanitizedId = sanitizeId(node.id);\n const cacheKey = `\"evaluateNode_${sanitizedId}\"`;\n\n return `\n// Wrapper function to evaluate sub-decision ${node.id}\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n // Check cache first to avoid redundant evaluation\n if (ctx.decisionResults.has(${cacheKey})) {\n return ctx.decisionResults.get(${cacheKey});\n }\n\n // Compile-time detection catches static cycles, but runtime detection is needed for dynamic\n // sub-decision loading or conditional recursion based on input data.\n if (ctx.decisionStack.includes(\"${sanitizedId}\")) {\n const recursionPath = ctx.decisionStack.join(' -> ') + ' -> ' + \"${sanitizedId}\";\n SetLastError(RuntimeErrorCode.EVALUATION_ERROR);\n return Value.Null();\n }\n\n // Add to decision stack before evaluation\n ctx.decisionStack.push(\"${sanitizedId}\");\n\n // Evaluate the sub-decision\n let result = ${subDecisionFunctionName}(ctx);\n\n // Check for errors from sub-decision evaluation\n if (hasError()) {\n // Error occurred in sub-decision - propagate it up\n // Remove from decision stack\n const stackIndex = ctx.decisionStack.indexOf(\"${sanitizedId}\");\n if (stackIndex >= 0) {\n ctx.decisionStack.splice(stackIndex, 1);\n }\n return Value.Null();\n }\n\n // Store result in cache\n ctx.decisionResults.set(${cacheKey}, result);\n\n // Remove from decision stack after evaluation\n const stackIndex = ctx.decisionStack.indexOf(\"${sanitizedId}\");\n if (stackIndex >= 0) {\n ctx.decisionStack.splice(stackIndex, 1);\n }\n\n return result;\n}\n`;\n}\n\n/**\n * Compile a sub-decision node.\n *\n * Sub-decision nodes allow a decision to call another decision as part of its\n * evaluation. This function generates code that:\n * 1. Loads the referenced sub-decision JDM\n * 2. Recursively compiles all nodes in the sub-decision\n * 3. Creates a wrapper function to invoke the sub-decision\n * 4. Returns the code for both the wrapper and the sub-decision logic\n *\n * @param node - The JDM sub-decision node\n * @param context - The compilation context\n * @returns Generated AssemblyScript code for the sub-decision\n */\nexport function compileDecisionNode(\n node: JDMNode,\n context: CompilationContext,\n): AssemblyScriptCode {\n // Check for cycles in the decision graph\n if (context.decisionPath.includes(node.id)) {\n throw new Error(\n `Circular dependency detected in decision graph: ${context.decisionPath.join(' -> ')} -> ${node.id}`,\n );\n }\n\n // Extract the sub-decision reference key from the decision node content\n const subDecisionKey = node.content?.key;\n if (!subDecisionKey) {\n throw new Error(\n `Decision node ${node.id} has no content.key - cannot determine which decision to call`,\n );\n }\n\n // Check if this sub-decision JDM has already been loaded (caching the parsed JDM)\n // We don't cache the generated code because each reference needs its own function names\n // But we can cache the parsed JDM to avoid re-parsing\n let subDecision: JDMDecision;\n\n // Add to decision path for cycle detection\n context.decisionPath.push(node.id);\n\n try {\n // Load the sub-decision JDM using the loader\n subDecision = context.loadDecision(subDecisionKey);\n\n // Find the input and output nodes in the sub-decision\n const inputNode = subDecision.nodes.find((n) => n.type === 'inputNode');\n const outputNodes = subDecision.nodes.filter((n) => n.type === 'outputNode');\n\n if (!inputNode) {\n throw new Error(`Sub-decision ${subDecisionKey} has no input node`);\n }\n\n if (outputNodes.length === 0) {\n throw new Error(`Sub-decision ${subDecisionKey} has no output nodes`);\n }\n\n // Check if this sub-decision has already been compiled (for caching)\n const cachedFunctionName = context.compiledSubDecisions.get(subDecisionKey);\n if (cachedFunctionName) {\n // Sub-decision was already compiled, just generate a wrapper that calls the cached entry point\n const wrapperCode = generateDecisionNodeWrapper(node, cachedFunctionName);\n return wrapperCode;\n }\n\n // Add unique prefix to sub-decision node IDs to avoid conflicts\n const prefix = decisionNodePrefix(node.id);\n const sanitizedId = sanitizeId(node.id);\n const subDecisionFunctionName = `evaluateSubDecision_${sanitizedId}`;\n\n // Cache the entry point function name for reuse\n context.compiledSubDecisions.set(subDecisionKey, subDecisionFunctionName);\n\n // Create a modified context for recursive compilation. Sub-decisions need isolated compilation\n // state (separate decision path, separate compiled cache) to avoid conflicts with parent decision\n // while sharing global settings.\n const subContext: CompilationContext = {\n ...context,\n decisionPath: [...context.decisionPath],\n };\n\n // Compile each node in the sub-decision\n let subCompiled = '';\n for (const subNode of subDecision.nodes) {\n const nodeType = subNode.type;\n\n // Skip output nodes - they're just markers\n if (nodeType === 'outputNode') {\n continue;\n }\n\n // Create a prefixed version of the node to avoid ID conflicts\n const prefixedNode = {\n ...subNode,\n id: prefix + subNode.id,\n };\n\n // Compile the node based on its type\n switch (nodeType) {\n case 'inputNode':\n subCompiled += compileInputNode(prefixedNode, context);\n break;\n case 'decisionTableNode':\n subCompiled += compileDecisionTableNode(prefixedNode, context);\n break;\n case 'switchNode':\n subCompiled += compileSwitchNode(prefixedNode, context);\n break;\n case 'expressionNode':\n subCompiled += compileExpressionNode(prefixedNode, context);\n break;\n case 'functionNode':\n subCompiled += compileFunctionNode(prefixedNode, context);\n break;\n case 'decisionNode':\n // Recursive sub-decision\n subCompiled += compileDecisionNode(prefixedNode, subContext);\n break;\n default:\n // Output nodes don't need compilation\n break;\n }\n }\n\n // Generate the sub-decision entry point function\n const entryPointCode = generateSubDecisionEntryPoint(node, context, subDecision, prefix);\n\n // Generate the wrapper function that handles caching, recursion detection, and delegates\n const wrapperCode = generateDecisionNodeWrapper(node, subDecisionFunctionName);\n\n const completeCode = wrapperCode + entryPointCode + subCompiled;\n\n // Return the complete code (wrapper + entry point + sub-decision node functions)\n return completeCode;\n } finally {\n // Remove from decision path (backtracking)\n const pathIndex = context.decisionPath.indexOf(node.id);\n if (pathIndex !== -1) {\n context.decisionPath.splice(pathIndex, 1);\n }\n }\n}\n","/**\n * Compile-time validation for decision models.\n *\n * This module provides functions to perform static analysis of JDM structure\n * and references at compile time. These checks detect missing references,\n * undeclared identifiers, and unassigned outputs before code generation.\n *\n * These functions operate on ASTs and CompilationContext - they do NOT\n * execute at runtime. For runtime data validation, see runtime-validation-codegen.ts.\n */\n\nimport type { ExpressionAST, Identifier } from './ast-types';\nimport { CompilationError, ErrorCode, ErrorCollector, type SourceLocation } from './errors';\nimport type { CompilationContext } from './types';\n\n/**\n * Collect all identifier references from an expression AST.\n *\n * This function walks the AST and collects all variable/field references\n * that need to be resolved from the context. It handles:\n * - Simple identifiers: `age`, `name`\n * - Member access: `customer.age`, `order.items[0].price`\n *\n * @param ast - The expression AST to analyze\n * @returns Set of all identifier names referenced in the expression\n */\nexport function collectIdentifiers(ast: ExpressionAST): Set<string> {\n const identifiers = new Set<string>();\n collectIdentifiersRecursive(ast, identifiers);\n return identifiers;\n}\n\n/**\n * Recursively collect identifiers from an AST node.\n */\nfunction collectIdentifiersRecursive(ast: ExpressionAST, identifiers: Set<string>): void {\n switch (ast.type) {\n case 'Identifier': {\n const ident = ast as Identifier;\n identifiers.add(ident.name);\n break;\n }\n\n case 'MemberAccess':\n // For member access like `customer.age`, we need to track the base object `customer`\n collectIdentifiersRecursive((ast as any).object, identifiers);\n // The property name is a literal, not an identifier\n break;\n\n case 'IndexAccess':\n // For index access like `items[0]`, we need the base object\n collectIdentifiersRecursive((ast as any).object, identifiers);\n // The index is an expression that may contain identifiers\n collectIdentifiersRecursive((ast as any).index, identifiers);\n break;\n\n case 'BinaryOp':\n collectIdentifiersRecursive((ast as any).left, identifiers);\n collectIdentifiersRecursive((ast as any).right, identifiers);\n break;\n\n case 'UnaryOp':\n collectIdentifiersRecursive((ast as any).operand, identifiers);\n break;\n\n case 'TernaryOp':\n collectIdentifiersRecursive((ast as any).condition, identifiers);\n collectIdentifiersRecursive((ast as any).consequent, identifiers);\n collectIdentifiersRecursive((ast as any).alternate, identifiers);\n break;\n\n case 'FunctionCall':\n collectIdentifiersRecursive((ast as any).callee, identifiers);\n for (const arg of (ast as any).args) {\n collectIdentifiersRecursive(arg, identifiers);\n }\n break;\n\n case 'ArrayLiteral':\n for (const element of (ast as any).elements) {\n collectIdentifiersRecursive(element, identifiers);\n }\n break;\n\n case 'ObjectLiteral':\n for (const [_key, value] of Object.entries((ast as any).properties)) {\n collectIdentifiersRecursive(value as ExpressionAST, identifiers);\n }\n break;\n\n case 'TemplateLiteral':\n for (const part of (ast as any).parts) {\n if (typeof part === 'object') {\n // It's an expression\n collectIdentifiersRecursive(part as ExpressionAST, identifiers);\n }\n // String literals are ignored\n }\n break;\n\n case 'Interval':\n collectIdentifiersRecursive((ast as any).start, identifiers);\n collectIdentifiersRecursive((ast as any).end, identifiers);\n break;\n\n // Literals don't reference identifiers\n case 'NumberLiteral':\n case 'StringLiteral':\n case 'BooleanLiteral':\n case 'NullLiteral':\n case 'DollarRef':\n case 'HashRef':\n // No identifiers to collect\n break;\n\n default:\n throw new Error(`Unknown AST node type: ${(ast as any).type}`);\n }\n}\n\n/**\n * Validate that all referenced identifiers exist in the input schema.\n *\n * This function checks that all input references in expressions are declared\n * in the input schema. It builds a set of expected input fields from the\n * flattened layout and compares it against the identifiers used in expressions.\n *\n * @param referencedIdentifiers - Set of identifiers used in expressions\n * @param context - The compilation context containing the input schema\n * @param location - Source location for error reporting\n * @throws CompilationError if any referenced input is not declared\n */\nexport function validateInputReferences(\n referencedIdentifiers: Set<string>,\n context: CompilationContext,\n location?: SourceLocation,\n): void {\n // Build a set of all expected input fields from the flattened layout\n const expectedInputs = new Set<string>();\n\n // Add all top-level fields (e.g., \"age\", \"name\", \"customer\")\n for (const field of context.inputLayout.fields) {\n const parts = field.path.split('.');\n expectedInputs.add(parts[0]); // Add the top-level field name\n\n // Also add the full path for cases like \"customer.age\"\n expectedInputs.add(field.path);\n }\n\n // Check each referenced identifier\n const missingInputs: string[] = [];\n\n for (const identifier of referencedIdentifiers) {\n // $ is the unary context variable in decision table cells, # is the iteration variable\n // in higher-order functions (map, filter, etc.). Both are implicit and don't need schema\n // declaration.\n if (identifier === '$' || identifier === '#') {\n continue;\n }\n\n // Check if this identifier is declared\n let found = false;\n // Check exact match first\n if (expectedInputs.has(identifier)) {\n found = true;\n } else {\n // Check if it's a prefix match (e.g., \"customer\" matches \"customer.age\")\n for (const expected of expectedInputs) {\n if (expected.startsWith(identifier + '.')) {\n found = true;\n break;\n }\n }\n }\n\n if (!found) {\n missingInputs.push(identifier);\n }\n }\n\n // If we found missing inputs, throw an error\n if (missingInputs.length > 0) {\n const missingList = missingInputs\n .sort()\n .map((id) => `\"${id}\"`)\n .join(', ');\n const message =\n missingInputs.length === 1\n ? `Input reference \"${missingInputs[0]}\" is not declared in the input schema`\n : `Input references are not declared in the input schema: ${missingList}`;\n\n throw new CompilationError(\n message,\n ErrorCode.UNKNOWN_FIELD,\n {\n ...location,\n field: 'inputs',\n },\n { missingInputs: missingInputs as any },\n );\n }\n}\n\n/**\n * Collect all output assignments from a decision.\n *\n * This function walks through all nodes in the decision and collects\n * the output paths that are assigned by expression nodes and decision table nodes.\n *\n * @param context - The compilation context\n * @returns Set of all output paths assigned by the decision\n */\nexport function collectOutputAssignments(\n context: CompilationContext,\n errorCollector?: ErrorCollector,\n): Set<string> {\n const assignedOutputs = new Set<string>();\n\n for (const node of context.jdm.nodes) {\n const nodeType = node.type;\n\n try {\n if (nodeType === 'expressionNode') {\n // Collect output assignments from expression nodes\n const expressions = node.content.expressions as Array<{ key: string; value: string }>;\n for (const expr of expressions) {\n assignedOutputs.add(expr.key);\n }\n } else if (nodeType === 'decisionTableNode') {\n // Collect output fields from decision table nodes\n const content = node.content as any;\n if (content.outputs) {\n for (const output of content.outputs) {\n if (output.field) {\n assignedOutputs.add(output.field);\n }\n }\n }\n }\n // Switch nodes and sub-decision nodes delegate to other nodes which will be processed\n // separately, so their outputs will be collected from those target nodes.\n } catch (error) {\n // Collect errors for batch reporting rather than swallowing them silently\n if (errorCollector) {\n const err =\n error instanceof CompilationError\n ? error\n : new CompilationError(\n `Failed to collect output assignments from node \"${node.name || node.id}\": ${error instanceof Error ? error.message : String(error)}`,\n ErrorCode.PARSE_ERROR,\n { nodeId: node.id, nodeName: node.name },\n );\n errorCollector.add(err);\n }\n }\n }\n\n return assignedOutputs;\n}\n\n/**\n * Validate that all expected outputs from the schema are assigned.\n *\n * This function checks that all output fields defined in the output schema\n * are actually assigned by the decision logic. It builds a set of expected\n * output fields from the flattened layout and compares it against the\n * outputs that are assigned by expression nodes and decision table nodes.\n *\n * @param assignedOutputs - Set of output paths assigned by the decision\n * @param context - The compilation context containing the output schema\n * @param location - Source location for error reporting\n * @throws CompilationError if any expected output is not assigned\n */\nexport function validateOutputReferences(\n assignedOutputs: Set<string>,\n context: CompilationContext,\n location?: SourceLocation,\n): void {\n // Build a set of all expected output fields from the flattened layout\n const expectedOutputs = new Set<string>();\n\n // Add all output fields from the layout\n for (const field of context.outputLayout.fields) {\n expectedOutputs.add(field.path);\n }\n\n // Check each expected output\n const missingOutputs: string[] = [];\n\n for (const output of expectedOutputs) {\n // Prefix matching handles nested object assignment - if schema expects \"customer\" but decision\n // assigns \"customer.name\" and \"customer.age\", those partial assignments satisfy the requirement\n let found = false;\n\n // Check exact match\n if (assignedOutputs.has(output)) {\n found = true;\n } else {\n // Check if any assigned output is a nested field of the expected output\n // e.g., if \"customer\" is expected and \"customer.name\" is assigned\n for (const assigned of assignedOutputs) {\n if (assigned.startsWith(output + '.')) {\n found = true;\n break;\n }\n }\n }\n\n if (!found) {\n missingOutputs.push(output);\n }\n }\n\n // If we found missing outputs, throw an error\n if (missingOutputs.length > 0) {\n const missingList = missingOutputs\n .sort()\n .map((field) => `\"${field}\"`)\n .join(', ');\n const message =\n missingOutputs.length === 1\n ? `Output field \"${missingOutputs[0]}\" is declared in the output schema but not assigned by the decision`\n : `Output fields are declared in the output schema but not assigned by the decision: ${missingList}`;\n\n throw new CompilationError(\n message,\n ErrorCode.UNKNOWN_FIELD,\n {\n ...location,\n field: 'outputs',\n },\n { missingOutputs: missingOutputs as any },\n );\n }\n}\n\n/**\n * Validate output assignments for all nodes in a decision.\n *\n * This is a convenience function that validates that all expected outputs\n * from the output schema are actually assigned by the decision logic.\n *\n * @param context - The compilation context\n * @throws CompilationError if any expected output is not assigned or if errors occur during collection\n */\nexport function validateAllOutputReferences(context: CompilationContext): void {\n const errorCollector = new ErrorCollector();\n\n // Collect all output assignments, gathering any errors\n const assignedOutputs = collectOutputAssignments(context, errorCollector);\n\n // Validate that all expected outputs are assigned\n try {\n validateOutputReferences(assignedOutputs, context);\n } catch (error) {\n if (error instanceof CompilationError) {\n errorCollector.add(error);\n } else {\n throw error;\n }\n }\n\n // Throw all collected errors (parse errors + validation errors)\n errorCollector.throwIfErrors();\n}\n\n/**\n * Validate input references for all expression nodes in a decision.\n *\n * This is a convenience function that validates all expressions in the decision\n * at once, collecting all errors before throwing.\n *\n * @param context - The compilation context\n * @throws CompilationError if any expression references an undeclared input or contains parse errors\n */\nexport function validateAllInputReferences(context: CompilationContext): void {\n const errorCollector = new ErrorCollector();\n const inputLayout = context.inputLayout;\n const expectedInputs = new Set<string>();\n\n // Build set of expected inputs\n for (const field of inputLayout.fields) {\n const parts = field.path.split('.');\n expectedInputs.add(parts[0]);\n expectedInputs.add(field.path);\n }\n\n // Collect all references and validate them\n const allIdentifiers = new Set<string>();\n\n // Helper to create a parse error with location context\n const createParseError = (\n nodeId: string,\n nodeName: string | undefined,\n expression: string,\n error: unknown,\n ): CompilationError => {\n if (error instanceof CompilationError) {\n // Preserve original error but add node context if missing\n if (!error.location?.nodeId) {\n return new CompilationError(error.message, error.code, { nodeId, nodeName }, error.context);\n }\n return error;\n }\n return new CompilationError(\n `Failed to parse expression \"${expression}\": ${error instanceof Error ? error.message : String(error)}`,\n ErrorCode.PARSE_ERROR,\n { nodeId, nodeName },\n );\n };\n\n // Process all nodes that contain expressions\n for (const node of context.jdm.nodes) {\n const nodeType = node.type;\n\n try {\n if (nodeType === 'expressionNode') {\n // Collect identifiers from all expressions in the node\n const expressions = node.content.expressions as Array<{ key: string; value: string }>;\n for (const expr of expressions) {\n try {\n const ast = context.parseExpression(expr.value);\n const identifiers = collectIdentifiers(ast);\n for (const id of identifiers) {\n allIdentifiers.add(id);\n }\n } catch (error) {\n errorCollector.add(createParseError(node.id, node.name, expr.value, error));\n }\n }\n } else if (nodeType === 'decisionTableNode') {\n // Collect identifiers from decision table conditions\n const content = node.content as any;\n if (content.rules) {\n for (const rule of content.rules) {\n if (rule.input) {\n for (const [_key, value] of Object.entries(rule.input as Record<string, string>)) {\n if (\n value &&\n typeof value === 'string' &&\n !['true', 'false', 'null'].includes(value.toLowerCase())\n ) {\n try {\n const ast = context.parseExpression(value);\n const identifiers = collectIdentifiers(ast);\n for (const id of identifiers) {\n allIdentifiers.add(id);\n }\n } catch (error) {\n // Collect parse errors for batch reporting\n errorCollector.add(createParseError(node.id, node.name, value, error));\n }\n }\n }\n }\n }\n }\n } else if (nodeType === 'switchNode') {\n // Collect identifiers from switch conditions\n const content = node.content as any;\n if (content.cases) {\n for (const switchCase of content.cases) {\n if (switchCase.condition && switchCase.condition.expression) {\n try {\n const ast = context.parseExpression(switchCase.condition.expression);\n const identifiers = collectIdentifiers(ast);\n for (const id of identifiers) {\n allIdentifiers.add(id);\n }\n } catch (error) {\n // Collect parse errors for batch reporting\n errorCollector.add(\n createParseError(node.id, node.name, switchCase.condition.expression, error),\n );\n }\n }\n }\n }\n }\n } catch (error) {\n // Collect errors from node processing for batch reporting\n const err =\n error instanceof CompilationError\n ? error\n : new CompilationError(\n `Failed to process node \"${node.name || node.id}\": ${error instanceof Error ? error.message : String(error)}`,\n ErrorCode.PARSE_ERROR,\n { nodeId: node.id, nodeName: node.name },\n );\n errorCollector.add(err);\n }\n }\n\n // Validate all collected identifiers\n try {\n validateInputReferences(allIdentifiers, context);\n } catch (error) {\n if (error instanceof CompilationError) {\n errorCollector.add(error);\n } else {\n throw error;\n }\n }\n\n // Throw all collected errors (parse errors + validation errors)\n errorCollector.throwIfErrors();\n}\n","/**\n * Switch branch detection algorithm for JDM decisions.\n *\n * This module identifies nodes that are exclusively reachable through switch node branches.\n * These nodes are marked as \"switchBranchTargets\" and should be skipped during the main\n * evaluation loop because the switch node evaluates them inline when taking a branch.\n *\n * WHY: Prevent double-evaluation - switch nodes evaluate branches inline, so downstream\n * nodes must be skipped in the main evaluation loop to avoid executing them twice.\n *\n * OPTIMIZATION: Uses a single forward traversal through the graph to mark all nodes\n * reachable from switch branches. This is O(n + m) instead of O(s × b × (n + m))\n * where s = switches, b = branches, n = nodes, m = edges.\n */\n\nimport type { JDMDecision, JDMEdge } from './parser';\n\n/**\n * Build an adjacency map for fast edge lookups.\n * Maps each source node ID to an array of target node IDs.\n *\n * @param edges - All edges in the decision graph\n * @returns Map from source node ID to array of target node IDs\n */\nfunction buildAdjacencyMap(edges: JDMEdge[]): Map<string, string[]> {\n const adjacencyMap = new Map<string, string[]>();\n\n for (const edge of edges) {\n const targets = adjacencyMap.get(edge.sourceId);\n if (targets) {\n targets.push(edge.targetId);\n } else {\n adjacencyMap.set(edge.sourceId, [edge.targetId]);\n }\n }\n\n return adjacencyMap;\n}\n\n/**\n * Find all nodes that are exclusively reachable through switch node branches.\n *\n * Optimized algorithm:\n * 1. Build adjacency map once for O(1) edge lookups\n * 2. Identify all direct targets of switch nodes\n * 3. Use BFS with efficient queue operations to traverse from all switch targets\n * 4. Marks all nodes reachable from switch branches in a single traversal\n *\n * Time complexity: O(n + m) where n = nodes, m = edges\n * Space complexity: O(n + m) for adjacency map and visited set\n *\n * @param jdm - The parsed JDM decision\n * @returns Set of node IDs that are switch branch targets\n */\nexport function findSwitchBranchTargets(jdm: JDMDecision): Set<string> {\n // Build adjacency map once for O(1) lookups instead of O(m) filtering\n const adjacencyMap = buildAdjacencyMap(jdm.edges);\n\n // Find all direct targets of switch nodes\n const switchNodes = jdm.nodes.filter((n) => n.type === 'switchNode');\n const switchBranchTargets = new Set<string>();\n\n // Collect all direct switch targets to start BFS from\n const bfsQueue: string[] = [];\n for (const switchNode of switchNodes) {\n const targets = adjacencyMap.get(switchNode.id) || [];\n for (const targetId of targets) {\n if (!switchBranchTargets.has(targetId)) {\n switchBranchTargets.add(targetId);\n bfsQueue.push(targetId);\n }\n }\n }\n\n // Single BFS traversal from all switch targets\n // Use index-based iteration instead of shift() to avoid O(n) array operations\n let queueIndex = 0;\n while (queueIndex < bfsQueue.length) {\n const currentId = bfsQueue[queueIndex++];\n\n // Get all outgoing edges using O(1) map lookup\n const targets = adjacencyMap.get(currentId) || [];\n for (const targetId of targets) {\n if (!switchBranchTargets.has(targetId)) {\n switchBranchTargets.add(targetId);\n bfsQueue.push(targetId);\n }\n }\n }\n\n return switchBranchTargets;\n}\n","/**\n * Result selection logic for JDM decisions.\n *\n * This module determines how to compute the final result from the evaluation order.\n * It handles different scenarios:\n * - Switch nodes that route to different branches\n * - Decision tables with collect-style hit policies\n * - PassThrough nodes that accumulate context\n * - Regular nodes that return their result directly\n */\n\nimport type { JDMNode } from './parser';\n\n/**\n * Check if a decision table node uses a collect-style hit policy.\n * Collect-style policies return arrays and need to be wrapped in an object with the node name as key.\n */\nexport function isCollectStyleHitPolicy(node: JDMNode): boolean {\n if (node.type !== 'decisionTableNode') {\n return false;\n }\n const hitPolicy = node.content?.hitPolicy || 'first';\n return ['collect', 'ruleOrder', 'outputOrder', 'priority'].includes(hitPolicy);\n}\n\n/**\n * Options for result code generation.\n */\nexport interface ResultSelectionOptions {\n /** Map of node IDs to JDMNode objects */\n nodeMap: Map<string, JDMNode>;\n /** Ordered list of node IDs that were actually evaluated (not skipped) */\n evaluatedNodes: string[];\n /** Set of node IDs that are switch branch targets (skipped in main loop) */\n switchBranchTargets: Set<string>;\n}\n\n/**\n * Determine which node's result should be used as the final output.\n *\n * Priority order:\n * 1. If there's a switch node, use its result (it handles routing)\n * 2. Otherwise, use the last non-input, non-output node result\n * 3. Fallback to output node or null\n *\n * @param options - The selection options\n * @returns The node to use for the final result, or null if fallback needed\n */\nexport function selectResultNode(options: ResultSelectionOptions): JDMNode | null {\n const { nodeMap, evaluatedNodes } = options;\n\n // Check if there's a switch node that routes to different branches\n // Only switch nodes truly route - decision tables in a linear flow are NOT routing nodes\n const switchNodes = evaluatedNodes.filter((id) => {\n const node = nodeMap.get(id);\n return node && node.type === 'switchNode';\n });\n\n // When there are switch nodes, use the switch result since it handles branch evaluation\n if (switchNodes.length > 0) {\n // Use the last switch node's result (it handles branch routing to terminal nodes)\n const lastSwitchNodeId = switchNodes[switchNodes.length - 1];\n return nodeMap.get(lastSwitchNodeId) || null;\n }\n\n // Use the last evaluated node\n if (evaluatedNodes.length > 0) {\n const lastNodeId = evaluatedNodes[evaluatedNodes.length - 1];\n return nodeMap.get(lastNodeId) || null;\n }\n\n return null;\n}\n\n/**\n * Generate AssemblyScript code to extract the final result from a node.\n *\n * Handles:\n * - Collect-style hit policies (return array directly)\n * - PassThrough nodes (return accumulated context)\n * - Regular nodes (return node result directly)\n *\n * @param node - The node to generate result code for\n * @returns AssemblyScript code string\n */\nexport function generateResultCode(node: JDMNode): string {\n // COLLECT-style hit policies return arrays directly (not wrapped in an object with the\n // node name as key) to match zen-engine behavior where the array IS the result\n if (isCollectStyleHitPolicy(node)) {\n return ` let result = ctx.get(\"$nodes.${node.name}\");`;\n }\n\n // If the node has passThrough enabled, return the accumulated context\n // This includes all values from previous nodes that were merged via passThrough\n //\n // Both 'no match with passThrough' and 'valid result' return Objects, so we use\n // the __passthrough marker a marker to distinguish these cases while maintaining\n // type safety.\n const hasPassThrough = node.content?.passThrough === true;\n if (hasPassThrough) {\n return ` // Check node result for passThrough handling\n let __nodeResult = ctx.get(\"$nodes.${node.name}\");\n let result: Value;\n \n // Check if this is a \"passthrough signal\" (no match with passThrough enabled)\n if (!__nodeResult.isNull() && __nodeResult.isObject()) {\n let __obj = __nodeResult.asObject();\n if (__obj.has(\"__passthrough\") && __obj.get(\"__passthrough\").asBool()) {\n // Node signaled to use passthrough - return accumulated context\n let __finalResult = new Map<string, Value>();\n const __ctxKeys = ctx.data.keys();\n for (let __i = 0; __i < __ctxKeys.length; __i++) {\n const __key = __ctxKeys[__i];\n if (!__key.startsWith(\"$\") && __key !== \"#\" && __key !== \"acc\") {\n __finalResult.set(__key, ctx.data.get(__key));\n }\n }\n result = Value.Object(__finalResult);\n } else {\n // Valid result - build from accumulated context (passThrough merges input with output)\n let __finalResult = new Map<string, Value>();\n const __ctxKeys = ctx.data.keys();\n for (let __i = 0; __i < __ctxKeys.length; __i++) {\n const __key = __ctxKeys[__i];\n if (!__key.startsWith(\"$\") && __key !== \"#\" && __key !== \"acc\") {\n __finalResult.set(__key, ctx.data.get(__key));\n }\n }\n result = Value.Object(__finalResult);\n }\n } else if (__nodeResult.isNull()) {\n // Node returned null (error case) - return null, don't passthrough\n result = Value.Null();\n } else {\n // Non-object result - return as-is\n result = __nodeResult;\n }`;\n }\n\n return ` let result = ctx.get(\"$nodes.${node.name}\");`;\n}\n\n/**\n * Generate fallback result code when no suitable node is found.\n *\n * @param outputNodeIds - Set of output node IDs\n * @param sanitizeId - Function to sanitize node IDs for code generation\n * @returns AssemblyScript code string\n */\nexport function generateFallbackResultCode(\n outputNodeIds: Set<string>,\n sanitizeId: (id: string) => string,\n): string {\n if (outputNodeIds.size > 0) {\n // Fallback: evaluate output node if no other nodes were evaluated\n const outputNodeId = Array.from(outputNodeIds)[0];\n const sanitizedOutputId = sanitizeId(outputNodeId);\n return ` let result = evaluateNode_${sanitizedOutputId}(ctx);`;\n }\n return ' let result = Value.Null();';\n}\n","/**\n * Main compilation orchestrator for JDM decisions.\n *\n * This module coordinates the compilation pipeline, bringing together:\n * - Graph building and topological ordering\n * - Node compilation\n * - Switch branch detection\n * - Result selection\n * - Memory layout code generation\n *\n * The orchestrator itself does minimal work - it delegates to specialized modules\n * for each concern.\n */\n\nimport type { JDMDecision, JDMNode } from './parser';\nimport type { CompilationContext, AssemblyScriptCode } from './types';\nimport { buildGraph, getEvaluationOrder } from './graph';\nimport { compileInputNode, compileOutputNode } from './nodes/input';\nimport { compileDecisionTableNode } from './nodes/decision-table';\nimport { compileSwitchNode } from './nodes/switch';\nimport { compileDecisionNode } from './nodes/decision';\nimport { compileExpressionNode } from './nodes/expression';\nimport { compileFunctionNode } from './nodes/function';\nimport { sanitizeId } from './utils';\nimport { validateAllInputReferences, validateAllOutputReferences } from './compile-time-validation';\nimport { generatePassThroughMergeCode, generateNestedPathAssignment } from './code-generators';\nimport { findSwitchBranchTargets } from './switch-branch-detection';\nimport {\n selectResultNode,\n generateResultCode,\n generateFallbackResultCode,\n} from './result-selection';\n\n// ============================================================================\n// Memory Layout Constants\n// ============================================================================\n\n/**\n * Custom heap start offset in bytes (512KB).\n *\n * The custom heap starts at 512KB to avoid conflicts with:\n * 1. AssemblyScript's internal runtime heap (~50KB - ~192KB)\n * 2. Host-written input buffer region (192KB - 512KB, up to 320KB)\n *\n * This ensures clear separation of memory regions and prevents\n * the AS runtime from interfering with our custom heap allocator.\n * Host must grow memory to at least 768KB to use this layout.\n */\nconst CUSTOM_HEAP_START_BYTES = 512 * 1024;\n\n/**\n * Compile a JDM decision to AssemblyScript code.\n *\n * This function orchestrates compilation of all nodes in the decision graph\n * and generates the complete AssemblyScript module.\n *\n * @param jdm - The parsed JDM decision\n * @param context - The compilation context\n * @returns Generated AssemblyScript code\n */\nexport function compileDecision(jdm: JDMDecision, context: CompilationContext): AssemblyScriptCode {\n // Build the graph\n const graph = buildGraph(jdm);\n\n // Get nodes in topological order to ensure dependencies are compiled before dependents\n const evaluationOrder = getEvaluationOrder(graph);\n\n // Validate references if enabled\n if (context.options.validate !== false) {\n validateAllInputReferences(context);\n validateAllOutputReferences(context);\n }\n\n // Create a node lookup for quick access\n const nodeMap = new Map(jdm.nodes.map((n) => [n.id, n]));\n\n // Compile each node based on its type\n const compiledCode = compileNodes(evaluationOrder, nodeMap, context);\n\n // Generate helper functions for higher-order operations\n const helperFunctionsCode = Array.from(context.helperFunctions.values()).join('\\n');\n\n // Find nodes that are switch branch targets (should be skipped in main evaluation)\n const switchBranchTargets = findSwitchBranchTargets(jdm);\n\n // Generate evaluation code for each node in topological order\n const evaluationCode = generateEvaluationCode(evaluationOrder, nodeMap, switchBranchTargets);\n\n // Find output nodes (nodes with no outgoing edges)\n const outputNodeIds = findOutputNodeIds(jdm);\n\n // Find evaluated nodes (excluding input, output, and switch branch targets)\n const evaluatedNodes = filterEvaluatedNodes(evaluationOrder, nodeMap, switchBranchTargets);\n\n // Generate result selection code\n const resultCode = generateResultSelectionCode(nodeMap, evaluatedNodes, outputNodeIds);\n\n // Generate the complete AssemblyScript module\n return generateModuleCode(helperFunctionsCode, compiledCode, evaluationCode, resultCode);\n}\n\n/**\n * Compile all nodes in evaluation order.\n */\nfunction compileNodes(\n evaluationOrder: string[],\n nodeMap: Map<string, JDMNode>,\n context: CompilationContext,\n): string {\n let compiledCode = '';\n\n for (const nodeId of evaluationOrder) {\n const node = nodeMap.get(nodeId);\n if (!node) {\n continue;\n }\n\n const nodeType = node.type;\n\n switch (nodeType) {\n case 'inputNode':\n compiledCode += compileInputNode(node, context);\n break;\n case 'decisionTableNode':\n compiledCode += compileDecisionTableNode(node, context);\n break;\n case 'switchNode':\n compiledCode += compileSwitchNode(node, context);\n break;\n case 'decisionNode':\n compiledCode += compileDecisionNode(node, context);\n break;\n case 'outputNode':\n compiledCode += compileOutputNode(node, context);\n break;\n case 'expressionNode':\n compiledCode += compileExpressionNode(node, context);\n break;\n case 'functionNode':\n compiledCode += compileFunctionNode(node, context);\n break;\n default:\n // Unknown node type - skip\n break;\n }\n }\n\n return compiledCode;\n}\n\n/**\n * Generate evaluation code for each node in topological order.\n * Skips output nodes and switch branch targets.\n */\nfunction generateEvaluationCode(\n evaluationOrder: string[],\n nodeMap: Map<string, JDMNode>,\n switchBranchTargets: Set<string>,\n): string {\n return evaluationOrder\n .map((nodeId) => {\n const node = nodeMap.get(nodeId);\n if (!node || node.type === 'outputNode') {\n return '';\n }\n\n // Skip nodes that are switch branch targets - they'll be evaluated by the switch\n if (switchBranchTargets.has(nodeId)) {\n return '';\n }\n\n return generateNodeEvaluationCode(node);\n })\n .filter(Boolean)\n .join('\\n');\n}\n\n/**\n * Generate evaluation code for a single node.\n */\nfunction generateNodeEvaluationCode(node: JDMNode): string {\n const sanitizedId = sanitizeId(node.id);\n\n // Check if this node has passThrough enabled (decision tables and expression nodes)\n const hasPassThrough = node.content?.passThrough === true;\n\n // Store node result in context under $nodes.<nodeName>\n let code = ` ctx.set(\"$nodes.${node.name}\", evaluateNode_${sanitizedId}(ctx));`;\n\n // Handle outputPath - if specified, store the result at the given path\n // This is used for collect-style decision tables to place array results at a nested path\n const outputPath = node.content?.outputPath;\n if (outputPath) {\n // Check if it's a simple (non-nested) path or a nested path\n if (!outputPath.includes('.')) {\n // Simple path - just set directly in context\n code += `\n // Store node output at outputPath: ${outputPath} (simple path)\n ctx.set(\"${outputPath}\", ctx.get(\"$nodes.${node.name}\"));`;\n } else {\n // Nested path - use shared helper to generate nested object structure\n code += `\n ${generateNestedPathAssignment(outputPath, `ctx.get(\"$nodes.${node.name}\")`)}`;\n }\n }\n\n // If passThrough is enabled, merge the node's output properties back into the context\n // This allows subsequent nodes to access the computed values directly\n if (hasPassThrough) {\n code += `\\n ${generatePassThroughMergeCode(node.name)}`;\n }\n\n return code;\n}\n\n/**\n * Find output node IDs (nodes with no outgoing edges).\n */\nfunction findOutputNodeIds(jdm: JDMDecision): Set<string> {\n const outputNodeIds = new Set<string>();\n for (const node of jdm.nodes) {\n const outgoingEdges = jdm.edges.filter((e) => e.sourceId === node.id);\n if (outgoingEdges.length === 0) {\n outputNodeIds.add(node.id);\n }\n }\n return outputNodeIds;\n}\n\n/**\n * Filter evaluation order to get only nodes that were actually evaluated.\n */\nfunction filterEvaluatedNodes(\n evaluationOrder: string[],\n nodeMap: Map<string, JDMNode>,\n switchBranchTargets: Set<string>,\n): string[] {\n return evaluationOrder.filter((id) => {\n const node = nodeMap.get(id);\n if (!node) {\n return false;\n }\n // Exclude input and output nodes\n if (node.type === 'inputNode' || node.type === 'outputNode') {\n return false;\n }\n // Exclude switch branch targets - they're evaluated by the switch\n if (switchBranchTargets.has(id)) {\n return false;\n }\n return true;\n });\n}\n\n/**\n * Generate code to select and extract the final result.\n */\nfunction generateResultSelectionCode(\n nodeMap: Map<string, JDMNode>,\n evaluatedNodes: string[],\n outputNodeIds: Set<string>,\n): string {\n // Use the result-selection module to determine which node's result to use\n const resultNode = selectResultNode({\n nodeMap,\n evaluatedNodes,\n switchBranchTargets: new Set(), // Already filtered out\n });\n\n if (resultNode) {\n return generateResultCode(resultNode);\n }\n\n return generateFallbackResultCode(outputNodeIds, sanitizeId);\n}\n\n/**\n * Generate the complete AssemblyScript module code.\n */\nfunction generateModuleCode(\n helperFunctionsCode: string,\n compiledCode: string,\n evaluationCode: string,\n resultCode: string,\n): string {\n return `\nimport { Value } from './values';\nimport { Context, ScopedContext } from './context';\nimport {\n addValues,\n subtractValues,\n multiplyValues,\n divideValues,\n moduloValues,\n powerValues,\n negateValue,\n valuesEqual,\n compareValues,\n getProperty,\n getIndex,\n valueIn,\n createInterval,\n evaluateFunction,\n makeArgs1,\n makeArgs2,\n makeArgs3\n} from './expressions';\nimport { SetLastError, SetLastErrorWithMessage, hasError, RuntimeErrorCode, initializeMemoryLayout, resetHeap } from './memory';\nimport { readValueMap, writeValue } from './arrays';\n\n${helperFunctionsCode}\n\n${compiledCode}\n\n// Main entry point for the compiled decision\n// Input: pointer to input data in WASM memory (serialized Map<string, Value>)\n// Returns: pointer to output data in WASM memory (serialized Value)\nexport function evaluate(inputPtr: usize): usize {\n // Initialize memory layout for custom heap (used for output marshaling)\n // Memory regions (from 0):\n // +--------------------------+\n // | Static data | 0 - ~50KB (AS's __heap_base)\n // +--------------------------+\n // | AS runtime heap | ~50KB - ~192KB (grows upward during evaluation)\n // +--------------------------+\n // | Input data buffer | 192KB - 512KB (written by host, up to 320KB)\n // +--------------------------+\n // | Custom heap (ours) | 512KB - (used for writeValue/marshaling)\n // +--------------------------+\n // The custom heap starts at 512KB to avoid conflicts with AS's internal heap\n // and the host-written input buffer. Host must grow memory to at least 768KB.\n initializeMemoryLayout(${CUSTOM_HEAP_START_BYTES}, 0);\n\n // Reset heap for fresh evaluation\n resetHeap();\n\n // Read input from memory\n let input = readValueMap(inputPtr);\n\n // Create context with input data\n let ctx = new Context(input);\n\n // Evaluate the decision graph in topological order\n${evaluationCode}\n\n // Get the final result\n${resultCode}\n // Write result to output memory and return pointer\n return writeValue(result);\n}\n`;\n}\n","/**\n * Caches compiled WASM modules keyed by source code + runtime + compiler options.\n * WASM compilation via AssemblyScript is expensive (~250ms per decision), so caching\n * identical compilations significantly improves the speed of iterative development\n * and testing.\n */\n\nimport { createHash } from 'crypto';\nimport {\n existsSync,\n mkdirSync,\n readFileSync,\n writeFileSync,\n readdirSync,\n statSync,\n unlinkSync,\n} from 'fs';\nimport { join, dirname } from 'path';\n\n// Import runtime source strings to include in cache key\nimport {\n RUNTIME_VALUES,\n RUNTIME_CONTEXT,\n RUNTIME_EXPRESSIONS,\n RUNTIME_TABLES,\n RUNTIME_MEMORY,\n RUNTIME_STRINGS,\n RUNTIME_ARRAYS,\n} from './runtime/index';\n\n// Package version - included in cache key to invalidate cache across compiler versions\nlet packageVersion: string = '';\n\nfunction getPackageVersion(): string {\n if (packageVersion === '') {\n try {\n // Try to find package.json from this file's location\n const packagePath = join(dirname(__dirname), '..', 'package.json');\n const pkg = JSON.parse(readFileSync(packagePath, 'utf-8'));\n packageVersion = pkg.version || 'unknown';\n } catch {\n packageVersion = 'unknown';\n }\n }\n return packageVersion;\n}\n\n/**\n * Cache directory location\n */\nfunction getCacheDir(): string {\n // Use node_modules/.cache/jdm-asm for caching\n // This is a common convention and gets cleaned up with node_modules\n const cacheDir = join(process.cwd(), 'node_modules', '.cache', 'jdm-asm');\n return cacheDir;\n}\n\n/**\n * Ensure the cache directory exists\n * @throws Error if directory creation fails\n */\nfunction ensureCacheDir(): string {\n const cacheDir = getCacheDir();\n if (!existsSync(cacheDir)) {\n try {\n mkdirSync(cacheDir, { recursive: true });\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to create cache directory at ${cacheDir}: ${errorMsg}`);\n }\n }\n return cacheDir;\n}\n\n/**\n * Compute a stable hash for cache key.\n */\nexport function computeCacheKey(\n assemblyScriptCode: string,\n options: { optimize?: boolean; debug?: boolean },\n): string {\n const hash = createHash('sha256');\n\n // Include package version\n hash.update(`version:${getPackageVersion()}\\n`);\n\n // Include compiler options\n hash.update(`optimize:${options.optimize ?? true}\\n`);\n hash.update(`debug:${options.debug ?? false}\\n`);\n\n // Include all runtime source files: runtime code changes affect WASM output, so\n // must be part of cache key\n hash.update('---RUNTIME_VALUES---\\n');\n hash.update(RUNTIME_VALUES);\n hash.update('---RUNTIME_CONTEXT---\\n');\n hash.update(RUNTIME_CONTEXT);\n hash.update('---RUNTIME_EXPRESSIONS---\\n');\n hash.update(RUNTIME_EXPRESSIONS);\n hash.update('---RUNTIME_TABLES---\\n');\n hash.update(RUNTIME_TABLES);\n hash.update('---RUNTIME_MEMORY---\\n');\n hash.update(RUNTIME_MEMORY);\n hash.update('---RUNTIME_STRINGS---\\n');\n hash.update(RUNTIME_STRINGS);\n hash.update('---RUNTIME_ARRAYS---\\n');\n hash.update(RUNTIME_ARRAYS);\n\n // Include the generated AssemblyScript code\n hash.update('---ASSEMBLYSCRIPT---\\n');\n hash.update(assemblyScriptCode);\n\n // Return first 32 characters of hex digest (128 bits - sufficient for cache key)\n return hash.digest('hex').slice(0, 32);\n}\n\n/**\n * Cache entry format\n */\ninterface CacheEntry {\n version: string;\n timestamp: number;\n binary: string; // Base64 encoded WASM binary\n wat: string;\n}\n\n/**\n * Read cached WASM compilation result from disk if available\n */\nexport function readCacheFromDisk(cacheKey: string): { binary: Uint8Array; wat: string } | null {\n const cacheDir = getCacheDir();\n const cachePath = join(cacheDir, `${cacheKey}.json`);\n\n if (!existsSync(cachePath)) {\n return null;\n }\n\n try {\n const content = readFileSync(cachePath, 'utf-8');\n const entry: CacheEntry = JSON.parse(content);\n\n // Version changes invalidate cache to prevent incompatible compiled code from being used\n // when the compiler implementation changes between releases\n if (entry.version !== getPackageVersion()) {\n // Version mismatch, invalidate\n unlinkSync(cachePath);\n return null;\n }\n\n // Decode binary from base64\n const binary = new Uint8Array(Buffer.from(entry.binary, 'base64'));\n return { binary, wat: entry.wat };\n } catch (error) {\n // Distinguish between different error types for better diagnostics\n if (error && typeof error === 'object' && 'code' in error) {\n const code = (error as { code: string }).code;\n\n // ENOENT (file not found) is benign - cache miss\n if (code === 'ENOENT') {\n return null;\n }\n\n // EACCES/EPERM (permission denied) should warn the user\n if (code === 'EACCES' || code === 'EPERM') {\n const errorMsg = error instanceof Error ? error.message : String(error);\n console.warn(\n `[jdm-asm] Warning: Cache file exists but cannot be read due to permissions: ${cachePath}\\n${errorMsg}`,\n );\n return null;\n }\n }\n\n // Cache corruption or other errors are benign since we can regenerate the result.\n // Failing fast would hurt UX when cache is just a performance optimization, not critical.\n // Try to clean up corrupted cache file\n try {\n unlinkSync(cachePath);\n } catch (cleanupError) {\n // If we can't delete it, just warn (might be permission issue)\n if (cleanupError && typeof cleanupError === 'object' && 'code' in cleanupError) {\n const code = (cleanupError as { code: string }).code;\n if (code === 'EACCES' || code === 'EPERM') {\n console.warn(\n `[jdm-asm] Warning: Cannot clean up corrupted cache file (permission denied): ${cachePath}`,\n );\n }\n }\n }\n return null;\n }\n}\n\n/**\n * Write compilation result to disk cache\n * Failures are logged as warnings but do not throw since caching is optional\n */\nexport function writeCacheToDisk(\n cacheKey: string,\n result: { binary: Uint8Array; wat: string },\n): void {\n try {\n const cacheDir = ensureCacheDir();\n const cachePath = join(cacheDir, `${cacheKey}.json`);\n\n const entry: CacheEntry = {\n version: getPackageVersion(),\n timestamp: Date.now(),\n binary: Buffer.from(result.binary).toString('base64'),\n wat: result.wat,\n };\n\n writeFileSync(cachePath, JSON.stringify(entry));\n } catch (error) {\n // Cache write failures should not break compilation since caching is a performance\n // optimization, not a requirement. Warn the user so they know cache isn't working.\n const errorMsg = error instanceof Error ? error.message : String(error);\n\n // Provide more specific guidance for common errors\n if (error && typeof error === 'object' && 'code' in error) {\n const code = (error as { code: string }).code;\n\n if (code === 'ENOSPC') {\n console.warn(`[jdm-asm] Warning: Failed to write cache (disk full): ${errorMsg}`);\n } else if (code === 'EACCES' || code === 'EPERM' || code === 'EROFS') {\n console.warn(\n `[jdm-asm] Warning: Failed to write cache (permission denied or read-only filesystem): ${errorMsg}`,\n );\n } else {\n console.warn(`[jdm-asm] Warning: Failed to write cache: ${errorMsg}`);\n }\n } else {\n console.warn(`[jdm-asm] Warning: Failed to write cache: ${errorMsg}`);\n }\n }\n}\n\n/**\n * Get the cache directory path\n * Exposes where compiled WASM modules are stored on disk\n */\nexport function getCacheDirectory(): string {\n return getCacheDir();\n}\n\n/**\n * Get cache health diagnostics\n * Returns information about cache status, any issues, and recent operations\n */\nexport function getCacheHealth(): {\n enabled: boolean;\n directory: string;\n directoryExists: boolean;\n accessible: boolean;\n stats: {\n entries: number;\n totalSize: number;\n oldestEntry: number | null;\n newestEntry: number | null;\n };\n issues: string[];\n} {\n const enabled = isCacheEnabled();\n const directory = getCacheDir();\n const directoryExists = existsSync(directory);\n const issues: string[] = [];\n\n // Check if cache is disabled\n if (!enabled) {\n issues.push('Cache is disabled via JDM_ASM_NO_CACHE environment variable');\n }\n\n // Check if directory exists\n if (enabled && !directoryExists) {\n issues.push('Cache directory does not exist yet (will be created on first write)');\n }\n\n // Check if directory is accessible\n let accessible = false;\n if (directoryExists) {\n try {\n // Try to read the directory to check accessibility\n readdirSync(directory);\n accessible = true;\n } catch (error) {\n accessible = false;\n issues.push(\n `Cache directory exists but is not accessible: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n\n // Get cache stats if accessible\n const stats = accessible\n ? getCacheStats()\n : {\n entries: 0,\n totalSize: 0,\n oldestEntry: null,\n newestEntry: null,\n };\n\n return {\n enabled,\n directory,\n directoryExists,\n accessible,\n stats,\n issues,\n };\n}\n\n/**\n * Clear the entire cache\n */\nexport function clearCache(): void {\n const cacheDir = getCacheDir();\n if (!existsSync(cacheDir)) {\n return;\n }\n\n const files = readdirSync(cacheDir);\n for (const file of files) {\n if (file.endsWith('.json')) {\n try {\n unlinkSync(join(cacheDir, file));\n } catch {}\n }\n }\n}\n\n/**\n * Get cache statistics\n */\nexport function getCacheStats(): {\n entries: number;\n totalSize: number;\n oldestEntry: number | null;\n newestEntry: number | null;\n} {\n const cacheDir = getCacheDir();\n if (!existsSync(cacheDir)) {\n return { entries: 0, totalSize: 0, oldestEntry: null, newestEntry: null };\n }\n\n const files = readdirSync(cacheDir).filter((f) => f.endsWith('.json'));\n let totalSize = 0;\n let oldestEntry: number | null = null;\n let newestEntry: number | null = null;\n\n for (const file of files) {\n const stat = statSync(join(cacheDir, file));\n totalSize += stat.size;\n\n const mtime = stat.mtimeMs;\n if (oldestEntry === null || mtime < oldestEntry) {\n oldestEntry = mtime;\n }\n if (newestEntry === null || mtime > newestEntry) {\n newestEntry = mtime;\n }\n }\n\n return { entries: files.length, totalSize, oldestEntry, newestEntry };\n}\n\n/**\n * Prune old cache entries (keep most recent N entries or entries younger than maxAge)\n */\nexport function pruneCache(\n options: {\n maxEntries?: number;\n maxAgeMs?: number;\n } = {},\n): number {\n const { maxEntries = 100, maxAgeMs = 7 * 24 * 60 * 60 * 1000 } = options; // Default: 100 entries, 7 days\n const cacheDir = getCacheDir();\n\n if (!existsSync(cacheDir)) {\n return 0;\n }\n\n const files = readdirSync(cacheDir)\n .filter((f) => f.endsWith('.json'))\n .map((f) => {\n const stat = statSync(join(cacheDir, f));\n return { name: f, mtime: stat.mtimeMs };\n })\n .sort((a, b) => b.mtime - a.mtime); // Sort by newest first\n\n const now = Date.now();\n let removed = 0;\n\n for (let i = 0; i < files.length; i++) {\n const file = files[i];\n const age = now - file.mtime;\n\n // Remove if exceeds max entries or max age\n if (i >= maxEntries || age > maxAgeMs) {\n try {\n unlinkSync(join(cacheDir, file.name));\n removed++;\n } catch {}\n }\n }\n\n return removed;\n}\n\n/**\n * Check if caching is enabled\n * Can be disabled via JDM_ASM_NO_CACHE=1 environment variable\n */\nexport function isCacheEnabled(): boolean {\n return process.env.JDM_ASM_NO_CACHE !== '1';\n}\n","// src/compiler/runtime/index.ts\nimport { readFileSync } from 'fs';\nimport { resolve, dirname } from 'path';\nimport { fileURLToPath } from 'url';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\n// Must work in both development (src/compiler/runtime) and installed package (dist/compiler/runtime).\n// Relative path from __dirname traverses up to src/runtime.\nfunction getAssemblyRuntimePath(): string {\n // From dist/compiler/runtime -> ../../runtime\n return resolve(__dirname, '..', '..', 'runtime');\n}\n\nfunction loadRuntime(filename: string): string {\n const runtimePath = getAssemblyRuntimePath();\n return readFileSync(resolve(runtimePath, filename), 'utf-8');\n}\n\nexport const RUNTIME_VALUES = loadRuntime('values.ts');\nexport const RUNTIME_CONTEXT = loadRuntime('context.ts');\nexport const RUNTIME_EXPRESSIONS = loadRuntime('expressions.ts');\nexport const RUNTIME_TABLES = loadRuntime('tables.ts');\nexport const RUNTIME_MEMORY = loadRuntime('memory.ts');\nexport const RUNTIME_STRINGS = loadRuntime('strings.ts');\nexport const RUNTIME_ARRAYS = loadRuntime('arrays.ts');\n","/**\n * AssemblyScript compilation to WebAssembly.\n * Handles compiler invocation, optimization levels, and memory configuration.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { CompilerOptions } from './types';\nimport { CompilationError, ErrorCode } from './errors';\nimport { createVirtualFS, createASCFileSystemCallbacks, getCompilationOutput } from './virtual-fs';\n\n// ============================================================================\n// Compilation Thresholds and Memory Constants\n// ============================================================================\n\n/**\n * Threshold for determining if a module is \"large\" (40KB of source code).\n *\n * Empirically determined based on decision table compilation patterns:\n * - Tables with 1000+ rules generate >40KB of code\n * - These create deeply nested if/else chains that stress the optimizer\n * - Larger modules need more initial memory to avoid runtime growth overhead\n *\n * Large modules require:\n * 1. More initial memory pages (16 vs 4) for string allocations\n * 2. Lower optimization level (O2 vs O3) to avoid stack overflow in Binaryen\n * 3. Skipping WAT generation to avoid O(n²) memory complexity\n */\nconst LARGE_MODULE_THRESHOLD_BYTES = 40000;\n\n/**\n * Threshold for \"very large\" modules (1MB of source code).\n * These modules skip optimization entirely to avoid Binaryen crashes.\n */\nconst VERY_LARGE_MODULE_THRESHOLD_BYTES = 1_000_000;\n\n// Normal module memory configuration (for modules < 40KB)\n/** Initial memory pages for normal modules (256KB total) */\nconst NORMAL_MODULE_INITIAL_PAGES = 4;\n/** Maximum memory pages for normal modules (1MB total) */\nconst NORMAL_MODULE_MAX_PAGES = 16;\n\n// Large module memory configuration (for modules >= 40KB)\n/** Initial memory pages for large modules (1MB total) */\nconst LARGE_MODULE_INITIAL_PAGES = 16;\n/** Maximum memory pages for large modules (16MB total) */\nconst LARGE_MODULE_MAX_PAGES = 256;\n\n/**\n * Compilation settings based on code size.\n * Large modules need different optimization and memory settings.\n */\nexport interface CompilationSettings {\n /** Whether the module is considered large (>40KB) */\n isLargeModule: boolean;\n /** Initial WebAssembly memory pages (64KB each) */\n initialMemoryPages: number;\n /** Maximum WebAssembly memory pages */\n maxMemoryPages: number;\n /** Binaryen optimization level (0-3) */\n optimizeLevel: number;\n /** Binaryen shrink level (0-2) */\n shrinkLevel: number;\n /** Whether to generate WAT text format */\n generateWat: boolean;\n}\n\n/**\n * Determine compilation settings based on code size.\n *\n * Memory pages are 64KB each (WASM_PAGE_SIZE_BYTES). Large modules need more\n * initial memory to avoid runtime allocation overhead during string operations\n * and table lookups.\n * - Normal modules: NORMAL_MODULE_INITIAL_PAGES (256KB), max NORMAL_MODULE_MAX_PAGES (1MB)\n * - Large modules: LARGE_MODULE_INITIAL_PAGES (1MB), max LARGE_MODULE_MAX_PAGES (16MB)\n *\n * Large modules (>LARGE_MODULE_THRESHOLD_BYTES) need more memory because:\n * (1) decision tables generate many string allocations during lookup,\n * (2) each string requires heap allocation at runtime, and\n * (3) insufficient initial memory causes frequent growth operations which are slow.\n *\n * Optimization levels scaled by module size because:\n * (1) Binaryen's optimizer recursively traverses deeply nested if/else chains,\n * (2) decision tables with 1000+ rules create nesting depth that exceeds stack limits at O3,\n * (3) O2 uses iterative algorithms that handle deep nesting,\n * (4) very large modules (>1MB) disable optimization entirely to avoid 10+ minute compile times.\n *\n * WAT generation skipped for large modules because Binaryen's text emitter has O(n²)\n * memory complexity and crashes with OOM on modules >LARGE_MODULE_THRESHOLD_BYTES source.\n *\n * @param codeLength - Length of the AssemblyScript source code\n * @returns Compilation settings appropriate for the code size\n */\nexport function getCompilationSettings(codeLength: number): CompilationSettings {\n const isLargeModule = codeLength > LARGE_MODULE_THRESHOLD_BYTES;\n const isVeryLargeModule = codeLength > VERY_LARGE_MODULE_THRESHOLD_BYTES;\n\n let optimizeLevel: number;\n let shrinkLevel: number;\n\n if (isVeryLargeModule) {\n // Very large module (>1MB source) - skip optimization to avoid Binaryen crash\n optimizeLevel = 0;\n shrinkLevel = 0;\n } else if (isLargeModule) {\n // Medium-large module (40KB-1MB) - use moderate optimization\n optimizeLevel = 2;\n shrinkLevel = 1;\n } else {\n // Small module (<40KB) - use full optimization\n optimizeLevel = 3;\n shrinkLevel = 2;\n }\n\n return {\n isLargeModule,\n initialMemoryPages: isLargeModule ? LARGE_MODULE_INITIAL_PAGES : NORMAL_MODULE_INITIAL_PAGES,\n maxMemoryPages: isLargeModule ? LARGE_MODULE_MAX_PAGES : NORMAL_MODULE_MAX_PAGES,\n optimizeLevel,\n shrinkLevel,\n generateWat: !isLargeModule,\n };\n}\n\n/**\n * Create a secure temporary debug file with restricted permissions.\n *\n * Creates a temporary directory with a random name and writes the code to a file\n * with 0o600 permissions (owner read/write only).\n *\n * This function only writes files if a debug output path is provided via options\n * or the JDM_ASM_DEBUG_OUTPUT environment variable.\n *\n * @param code - The code content to write\n * @param basePath - Base directory for debug output (from options or env var)\n * @param suffix - Optional suffix for the filename (e.g., \"-no-binary\")\n * @returns Path to the created debug file, or null if debug output is disabled or write fails\n */\nfunction createSecureDebugFile(\n code: string,\n basePath: string | undefined,\n suffix = '',\n): string | null {\n // Only write debug files if explicitly requested\n if (!basePath) {\n return null;\n }\n\n try {\n // Create a secure temporary directory with random name\n const tmpDir = fs.mkdtempSync(path.join(basePath, 'jdm-asm-debug-'));\n\n // Create debug file path\n const debugFile = path.join(tmpDir, `assembly-debug${suffix}.ts`);\n\n // Write file with restricted permissions (owner read/write only)\n fs.writeFileSync(debugFile, code, { mode: 0o600 });\n\n return debugFile;\n } catch (error) {\n // Debug output is best-effort: warn but don't break compilation\n const errorMsg = error instanceof Error ? error.message : String(error);\n console.warn(`[jdm-asm] Warning: Failed to write debug output to ${basePath}: ${errorMsg}`);\n return null;\n }\n}\n\n/**\n * Build compiler arguments based on options and settings.\n *\n * @param options - User-provided compiler options\n * @param settings - Size-based compilation settings\n * @returns Array of command-line arguments for the ASC compiler\n */\nexport function buildCompilerArgs(\n options: CompilerOptions,\n settings: CompilationSettings,\n): string[] {\n const args = [\n 'src/runtime/index.ts',\n '--outFile',\n 'output.wasm',\n '--runtime',\n 'incremental', // Use incremental GC runtime for memory reuse across evaluations\n '--exportRuntime', // Export __new, __pin, __collect, etc.\n '--initialMemory',\n String(settings.initialMemoryPages),\n '--maximumMemory',\n String(settings.maxMemoryPages),\n ];\n\n // Only generate WAT for smaller modules (large ones crash Binaryen's text emitter)\n if (settings.generateWat) {\n args.push('--textFile', 'output.wat');\n }\n\n // Add optimization flags if requested\n if (options.optimize) {\n if (settings.optimizeLevel > 0) {\n args.push('--optimize');\n }\n args.push('--optimizeLevel', String(settings.optimizeLevel));\n args.push('--shrinkLevel', String(settings.shrinkLevel));\n }\n\n // Add debug flags if requested\n if (options.debug) {\n args.push('--debug', '--sourceMap');\n }\n\n // Disable assertions in production (non-debug) mode\n if (!options.debug) {\n args.push('--noAssert');\n }\n\n return args;\n}\n\n/**\n * Compile AssemblyScript code to WebAssembly.\n *\n * This function uses the AssemblyScript compiler to generate WASM from\n * the generated AssemblyScript source code using a virtual filesystem.\n *\n * **Filesystem Side Effects:**\n * If `options.debugOutputPath` is set or the `JDM_ASM_DEBUG_OUTPUT` environment\n * variable is defined, compilation failures will write the generated AssemblyScript\n * code to disk for debugging. Files are written to secure temporary directories\n * with restricted permissions (0o600) and are NOT automatically cleaned up.\n *\n * Note: This is the internal compilation function without caching.\n * Use compileAssemblyScript() from build.ts for cached compilation.\n *\n * @param code - The AssemblyScript source code to compile\n * @param options - Compiler options (optimize, debug, debugOutputPath, etc.)\n * @returns An object with the compiled binary and WAT text\n */\nexport async function compileAssemblyScriptInternal(\n code: string,\n options: CompilerOptions,\n): Promise<{ binary: Uint8Array; wat: string }> {\n // Import the AssemblyScript compiler\n const ascModule = await import('assemblyscript/asc');\n\n // Determine debug output path: explicit option takes precedence over environment variable\n const debugOutputPath = options.debugOutputPath ?? process.env.JDM_ASM_DEBUG_OUTPUT;\n\n // Save generated code before compilation so it's available for debugging even if\n // compilation crashes the process (Binaryen can segfault on malformed input).\n // Only write if debug output is explicitly enabled.\n const debugFile = createSecureDebugFile(code, debugOutputPath);\n\n // Set up virtual filesystem\n const virtualFS = createVirtualFS(code);\n\n // Get size-based compilation settings\n const settings = getCompilationSettings(code.length);\n\n // Build compiler arguments\n const compilerArgs = buildCompilerArgs(options, settings);\n\n // Get filesystem callbacks for ASC\n const fsCallbacks = createASCFileSystemCallbacks(virtualFS);\n\n // Create an in-memory stderr stream\n let stderrOutput = '';\n const stderrStream = ascModule.createMemoryStream((chunk: Uint8Array | string) => {\n stderrOutput += typeof chunk === 'string' ? chunk : new TextDecoder().decode(chunk);\n });\n\n // Compile using the asc compiler with virtual filesystem\n const { error } = await ascModule.main(compilerArgs, {\n ...fsCallbacks,\n stderr: stderrStream,\n });\n\n // Check for compilation errors\n if (error) {\n const debugFileInfo = debugFile\n ? `\\n\\nGenerated code saved to ${debugFile}`\n : '\\n\\n(Set debugOutputPath option or JDM_ASM_DEBUG_OUTPUT env var to save generated code for debugging)';\n\n throw new CompilationError(\n `AssemblyScript compilation failed:\\n${stderrOutput || error.message}${debugFileInfo}`,\n ErrorCode.PARSE_ERROR,\n { field: 'assemblyScript' },\n { stderrOutput },\n );\n }\n\n // Get output from virtual filesystem\n const output = getCompilationOutput(virtualFS);\n\n if (!output.binary) {\n const noBinaryDebugFile = createSecureDebugFile(code, debugOutputPath, '-no-binary');\n stderrOutput = stderrOutput || '(no stderr output)';\n const files = [...virtualFS.keys()].join(', ');\n\n const debugFileInfo = noBinaryDebugFile\n ? `\\nGenerated code saved to ${noBinaryDebugFile}`\n : '\\n(Set debugOutputPath option or JDM_ASM_DEBUG_OUTPUT env var to save generated code for debugging)';\n\n throw new CompilationError(\n `Compilation produced no WASM binary output.\\nCompiler stderr: ${stderrOutput}\\nFiles in virtualFS: ${files}${debugFileInfo}`,\n ErrorCode.PARSE_ERROR,\n { field: 'assemblyScript' },\n { stderrOutput, virtualFSFiles: files },\n );\n }\n\n return {\n binary: output.binary,\n wat: output.wat ?? '',\n };\n}\n","/**\n * Virtual filesystem for in-memory AssemblyScript compilation.\n * Manages file mappings for the ASC compiler.\n */\n\nimport {\n RUNTIME_VALUES,\n RUNTIME_CONTEXT,\n RUNTIME_EXPRESSIONS,\n RUNTIME_TABLES,\n RUNTIME_MEMORY,\n RUNTIME_STRINGS,\n RUNTIME_ARRAYS,\n} from './runtime/index';\n\n/** VirtualFS stores files as string or Uint8Array content */\nexport type VirtualFS = Map<string, string | Uint8Array>;\n\n/**\n * Create a virtual filesystem with runtime libraries and user code.\n * @param code - User's AssemblyScript code to compile\n * @returns Configured virtual filesystem\n */\nexport function createVirtualFS(code: string): VirtualFS {\n const virtualFS: VirtualFS = new Map();\n virtualFS.set('src/runtime/index.ts', code);\n virtualFS.set('src/runtime/values.ts', RUNTIME_VALUES);\n virtualFS.set('src/runtime/context.ts', RUNTIME_CONTEXT);\n virtualFS.set('src/runtime/expressions.ts', RUNTIME_EXPRESSIONS);\n virtualFS.set('src/runtime/tables.ts', RUNTIME_TABLES);\n virtualFS.set('src/runtime/memory.ts', RUNTIME_MEMORY);\n virtualFS.set('src/runtime/strings.ts', RUNTIME_STRINGS);\n virtualFS.set('src/runtime/arrays.ts', RUNTIME_ARRAYS);\n return virtualFS;\n}\n\n/**\n * Create ASC-compatible file system callbacks.\n * @param virtualFS - The virtual filesystem to use\n * @returns Object with readFile, writeFile, listFiles functions for ASC compiler\n */\nexport function createASCFileSystemCallbacks(virtualFS: VirtualFS) {\n return {\n readFile(name: string, baseDir: string): string | null {\n // Try multiple path variations to find the file\n const possibleKeys = [\n // 'src/runtime/index.ts'\n name,\n // './src/runtime/index.ts' or 'src/runtime/index.ts'\n baseDir ? `${baseDir}/${name}` : name,\n // Remove leading ./\n name.startsWith('./') ? name.slice(2) : name,\n ];\n\n for (const key of possibleKeys) {\n const content = virtualFS.get(key);\n if (typeof content === 'string') {\n return content;\n }\n }\n return null;\n },\n writeFile(name: string, data: Uint8Array | string, baseDir: string): void {\n const key = baseDir ? `${baseDir}/${name}` : name;\n virtualFS.set(key, data);\n },\n listFiles(dirname: string, baseDir: string): string[] | null {\n const prefix = baseDir ? `${baseDir}/${dirname}` : dirname;\n return [...virtualFS.keys()].filter((f) => f.startsWith(prefix));\n },\n };\n}\n\n/**\n * Get output files from virtual filesystem after compilation.\n * @param virtualFS - The virtual filesystem\n * @returns Object with binary and wat files (may be undefined if not present)\n */\nexport function getCompilationOutput(virtualFS: VirtualFS): {\n binary: Uint8Array | undefined;\n wat: string | undefined;\n} {\n // The compiler writes to ./output.wasm (with ./ prefix)\n const binary = virtualFS.get('output.wasm') || virtualFS.get('./output.wasm');\n const wat = virtualFS.get('output.wat') || virtualFS.get('./output.wat');\n return {\n binary: binary instanceof Uint8Array ? binary : undefined,\n wat: typeof wat === 'string' ? wat : undefined,\n };\n}\n","/**\n * JavaScript Marshaling Code Generation\n *\n * This module generates JavaScript code for serializing JavaScript objects to\n * WebAssembly memory and deserializing results back. The generated code handles:\n *\n * - Input marshaling: Converting JS objects to WASM memory format\n * - Output unmarshaling: Converting WASM memory back to JS objects\n * - Size calculation: Computing memory requirements for marshaling\n * - Type-tagged value encoding: Writing values with type tags for dynamic typing\n *\n * The generated code operates on DataView for cross-endian compatibility and\n * handles both fixed-size types (numbers, booleans) and variable-length types\n * (strings, arrays, objects).\n */\n\nimport type { FlattenedLayout } from '../types';\n\n/**\n * Generate JavaScript marshaling code.\n *\n * This function generates the JavaScript code that will serialize\n * JavaScript objects to WebAssembly memory and deserialize results back.\n *\n * @param inputLayout - The flattened input schema layout\n * @param outputLayout - The flattened output schema layout\n * @param schemaHash - The schema hash for runtime validation\n * @returns Generated JavaScript marshaling code as a string\n */\nexport function generateMarshalCode(\n inputLayout: FlattenedLayout,\n outputLayout: FlattenedLayout,\n schemaHash: bigint,\n): string {\n const schemaHashHex = `0x${schemaHash.toString(16).padStart(16, '0')}`;\n\n // Calculate fixed sizes (sum of all fixed-size fields)\n const inputFixedSize = inputLayout.fields\n .filter((f) => f.size !== -1)\n .reduce((sum, f) => sum + f.size, 0);\n const outputFixedSize = outputLayout.fields\n .filter((f) => f.size !== -1)\n .reduce((sum, f) => sum + f.size, 0);\n\n return `\n// Generated marshaling code for schema hash ${schemaHashHex}\n// Input fixed size: ${inputFixedSize} bytes\n// Output fixed size: ${outputFixedSize} bytes\n\n// Type tags for marshaling (must match AssemblyScript runtime/Values.ts)\n// All type tags are stored as 4-byte u32\nconst TAG_NULL = 0;\nconst TAG_BOOLEAN = 1;\nconst TAG_INT = 2;\nconst TAG_FLOAT = 3;\nconst TAG_STRING = 4;\nconst TAG_ARRAY = 5;\nconst TAG_OBJECT = 6;\n\n// Size of type tag in bytes (must match VALUE_TYPE_SIZE in AssemblyScript)\nconst TAG_SIZE = 4;\n\nconst SCHEMA_HASH = ${schemaHashHex}n;\nconst INPUT_FIXED_SIZE = ${inputFixedSize};\nconst OUTPUT_FIXED_SIZE = ${outputFixedSize};\n\n/**\n * Marshal JavaScript input object to WebAssembly memory as a ValueMap.\n *\n * The WASM runtime expects input as a ValueMap: [length: u32][keyPtr1: u32][valuePtr1: u32]...\n * where keys are raw UTF-16 strings and values are tagged Value structures.\n *\n * @param data - The input JavaScript object\n * @param memory - WebAssembly Memory instance\n * @param allocate - Function to allocate memory: (size: number) => number\n * @returns Pointer to marshaled ValueMap in WASM memory\n */\nexport function marshalInput(data, memory, allocate) {\n const view = new DataView(memory.buffer);\n const entries = Object.entries(data);\n const length = entries.length;\n\n // Calculate total size needed for ValueMap\n // Format: [length: u32][keyPtr1: u32][valuePtr1: u32]...[key data...][value data...]\n let totalSize = 4 + length * 8; // map header + key/value pointer pairs\n\n // Calculate size for keys (raw strings) and values (tagged)\n for (let i = 0; i < length; i++) {\n const [key, value] = entries[i];\n // Key: raw UTF-16 string [length: u32][utf16 chars...]\n totalSize += 4 + key.length * 2;\n // Value: tagged value\n totalSize += calculateValueSize(value);\n }\n\n // Allocate memory\n const ptr = allocate(totalSize);\n\n // Write map length\n view.setUint32(ptr, length, true);\n\n // Current offset for variable data (after map structure)\n let currentOffset = ptr + 4 + length * 8;\n\n // Write each key/value pair\n let ptrOffset = ptr + 4;\n for (let i = 0; i < length; i++) {\n const [key, value] = entries[i];\n\n // Write key as raw string (not tagged): [length: u32][utf16 chars...]\n const keyPtr = currentOffset;\n view.setUint32(keyPtr, key.length, true);\n for (let j = 0; j < key.length; j++) {\n view.setUint16(keyPtr + 4 + j * 2, key.charCodeAt(j), true);\n }\n currentOffset += 4 + key.length * 2;\n\n // Write value (tagged)\n const valuePtr = currentOffset;\n currentOffset += writeValue(value, view, valuePtr);\n\n // Write pointers to map structure\n view.setUint32(ptrOffset, keyPtr, true);\n view.setUint32(ptrOffset + 4, valuePtr, true);\n ptrOffset += 8;\n }\n\n return ptr;\n}\n\n/**\n * Unmarshal WebAssembly memory to JavaScript output object.\n * @param ptr - Pointer to output data in WASM memory\n * @param memory - WebAssembly Memory instance\n * @returns The output JavaScript object\n */\nexport function unmarshalOutput(ptr, memory) {\n const view = new DataView(memory.buffer);\n\n // Output is written using writeValue() which writes a tagged Value\n // Use readValue() to read it back generically\n const output = readValue(view, ptr);\n \n // Convert flat dotted keys to nested objects.\n // Decision tables with passThrough emit flat keys like 'features.prioritySupport'\n // which must be restructured into nested objects for JavaScript consumption.\n // e.g., {\"features.prioritySupport\": true} -> {\"features\": {\"prioritySupport\": true}}\n return unflattenObject(output);\n}\n\n/**\n * Convert flat dotted keys to nested objects.\n * Recursively processes objects and arrays.\n * \n * @param value - The value to unflatten\n * @returns The unflattened value\n */\nfunction unflattenObject(value) {\n if (value === null || value === undefined) {\n return value;\n }\n \n if (Array.isArray(value)) {\n return value.map(item => unflattenObject(item));\n }\n \n if (typeof value !== 'object') {\n return value;\n }\n \n const result = {};\n \n for (const [key, val] of Object.entries(value)) {\n // Recursively unflatten the value first\n const unflattenedVal = unflattenObject(val);\n \n if (key.includes('.')) {\n // Split the key and create nested structure\n const parts = key.split('.');\n let current = result;\n \n for (let i = 0; i < parts.length - 1; i++) {\n const part = parts[i];\n if (!(part in current)) {\n current[part] = {};\n } else if (typeof current[part] !== 'object' || current[part] === null) {\n // Conflicts where both 'a' and 'a.b' exist can occur from multiple decision\n // table rules. Nested structure takes precedence to preserve data hierarchy.\n current[part] = {};\n }\n current = current[part];\n }\n \n current[parts[parts.length - 1]] = unflattenedVal;\n } else {\n // No dot in key - check if we already have a nested object from a dotted key\n if (key in result && typeof result[key] === 'object' && result[key] !== null && typeof unflattenedVal === 'object' && unflattenedVal !== null) {\n // Merge the objects\n Object.assign(result[key], unflattenedVal);\n } else {\n result[key] = unflattenedVal;\n }\n }\n }\n \n return result;\n}\n\n/**\n * Calculate the total memory size needed for marshaling the input as a ValueMap.\n *\n * Format: [length: u32][keyPtr1: u32][valuePtr1: u32]...[key data...][value data...]\n */\nfunction calculateInputSize(data) {\n const entries = Object.entries(data);\n const length = entries.length;\n\n // Map header + key/value pointer pairs\n let size = 4 + length * 8;\n\n // Add size for keys (raw strings) and values (tagged)\n for (let i = 0; i < length; i++) {\n const [key, value] = entries[i];\n // Key: raw UTF-16 string [length: u32][utf16 chars...]\n size += 4 + key.length * 2;\n // Value: tagged value\n size += calculateValueSize(value);\n }\n\n return size;\n}\n\n/**\n * Write null value with type tag.\n *\n * Format: [tag: u32]\n *\n * @param view - DataView for writing\n * @param offset - Offset to write at\n * @returns Total bytes written (4 bytes for tag)\n */\nfunction writeNull(view, offset) {\n // Write tag\n view.setUint32(offset, TAG_NULL, true);\n return TAG_SIZE; // tag only\n}\n\n/**\n * Write boolean value with type tag.\n *\n * Format: [tag: u32][value: u8]\n *\n * @param value - The boolean value to write\n * @param view - DataView for writing\n * @param offset - Offset to write at\n * @returns Total bytes written (5 bytes: tag + value)\n */\nfunction writeBoolean(value, view, offset) {\n // Write tag\n view.setUint32(offset, TAG_BOOLEAN, true);\n // Write boolean value as 1 byte (0 or 1)\n view.setUint8(offset + TAG_SIZE, value ? 1 : 0);\n return TAG_SIZE + 1; // tag + value\n}\n\n/**\n * Write float (number) value with type tag.\n *\n * Format: [tag: u32][value: f64]\n *\n * Handles all JavaScript number types including:\n * - Regular numbers (0, -0, integers, floats)\n * - Special values (NaN, Infinity, -Infinity)\n *\n * @param value - The number value to write\n * @param view - DataView for writing\n * @param offset - Offset to write at\n * @returns Total bytes written (12 bytes: 4-byte tag + 8-byte f64)\n */\nfunction writeFloat(value, view, offset) {\n // Write tag\n view.setUint32(offset, TAG_FLOAT, true);\n // Write number as f64 (little-endian)\n view.setFloat64(offset + TAG_SIZE, value, true);\n return TAG_SIZE + 8; // tag + f64\n}\n\n/**\n * Read a float value from memory.\n *\n * Format: [tag: u32][value: f64]\n *\n * @param view - DataView for reading\n * @param offset - Offset to read from\n * @returns The decoded number value (as integer if it's a whole number)\n * @throws {Error} If type tag is not TAG_FLOAT\n */\nfunction readFloat(view, offset) {\n // Read and verify tag\n const tag = view.getUint32(offset, true);\n if (tag !== TAG_FLOAT) {\n throw new Error(\\`Expected float tag (\\${TAG_FLOAT}), got \\${tag}\\`);\n }\n // Read number as f64 (little-endian)\n const value = view.getFloat64(offset + TAG_SIZE, true);\n // Return as integer if it's a whole number (for cleaner JSON output)\n if (Number.isInteger(value)) {\n return value;\n }\n return value;\n}\n\n/**\n * Write a UTF-16 string to memory with type tag.\n *\n * Format: [tag: u32][pointer: u32] - pointer points to string data\n * String data format: [length: u32][utf16 code units...]\n *\n * The pointer in the Value structure points immediately after the Value structure\n * itself (at offset + 8), where the string data begins.\n *\n * Uses UTF-16 encoding to match AssemblyScript's native string format.\n *\n * @param str - The string to write\n * @param view - DataView for writing\n * @param offset - Offset to write at\n * @returns Total bytes written (tag + pointer + string data)\n */\nfunction writeString(str, view, offset) {\n const len = str.length;\n // Write tag\n view.setUint32(offset, TAG_STRING, true);\n // String data starts right after the Value structure (tag + pointer = 8 bytes)\n const stringDataPtr = offset + TAG_SIZE + 4;\n // Write pointer to string data\n view.setUint32(offset + TAG_SIZE, stringDataPtr, true);\n // Write string data: [length: u32][utf16 code units...]\n view.setUint32(stringDataPtr, len, true);\n for (let i = 0; i < len; i++) {\n view.setUint16(stringDataPtr + 4 + i * 2, str.charCodeAt(i), true);\n }\n // Total: tag (4) + pointer (4) + length (4) + utf16 data (len * 2)\n return 8 + 4 + len * 2;\n}\n\n/**\n * Read null value with type tag.\n *\n * Format: [tag: u32]\n *\n * @param view - DataView for reading\n * @param offset - Offset to read from\n * @returns null value\n * @throws {Error} If type tag is not TAG_NULL\n */\nfunction readNull(view, offset) {\n // Read and verify tag\n const tag = view.getUint32(offset, true);\n if (tag !== TAG_NULL) {\n throw new Error(\\`Expected null tag (\\${TAG_NULL}), got \\${tag}\\`);\n }\n return null;\n}\n\n/**\n * Read boolean value with type tag.\n *\n * Format: [tag: u32][value: u8]\n *\n * @param view - DataView for reading\n * @param offset - Offset to read from\n * @returns The decoded boolean value\n * @throws {Error} If type tag is not TAG_BOOLEAN\n */\nfunction readBoolean(view, offset) {\n // Read and verify tag\n const tag = view.getUint32(offset, true);\n if (tag !== TAG_BOOLEAN) {\n throw new Error(\\`Expected boolean tag (\\${TAG_BOOLEAN}), got \\${tag}\\`);\n }\n // Read boolean value and convert to boolean\n const value = view.getUint8(offset + TAG_SIZE);\n return value !== 0;\n}\n\n/**\n * Read an integer value from memory with type tag.\n *\n * Format: [tag: u32][value: i64]\n *\n * @param view - DataView for reading\n * @param offset - Offset to read from\n * @returns The decoded integer value\n * @throws {Error} If type tag is not TAG_INT\n */\nfunction readInt(view, offset) {\n // Read and verify tag\n const tag = view.getUint32(offset, true);\n if (tag !== TAG_INT) {\n throw new Error(\\`Expected int tag (\\${TAG_INT}), got \\${tag}\\`);\n }\n // Read i64 value (little-endian)\n // JavaScript DataView doesn't have getBigInt64 in older versions, so use two 32-bit reads\n const low = view.getUint32(offset + TAG_SIZE, true);\n const high = view.getInt32(offset + TAG_SIZE + 4, true);\n // Combine to form a 64-bit signed integer\n // For values that fit in Number, this works fine\n const value = low + high * 0x100000000;\n return value;\n}\n\n/**\n * Read a UTF-16 string from memory with type tag.\n *\n * WASM Format: [tag: u32=4][stringPtr: u32]\n * String data at stringPtr: [length: u32][utf16 chars...]\n *\n * FORMAT DIFFERENCE: This reads the canonical WASM representation using pointers\n * and UTF-16 encoding (AssemblyScript's native string format), while writeString()\n * uses an inlined UTF-8 format for simplicity. Both are valid Value representations.\n *\n * @param view - DataView for reading\n * @param offset - Offset to read from\n * @returns The decoded string\n * @throws {Error} If type tag is not TAG_STRING\n */\nfunction readString(view, offset) {\n // Read and verify tag\n const tag = view.getUint32(offset, true);\n if (tag !== TAG_STRING) {\n throw new Error(\\`Expected string tag (\\${TAG_STRING}), got \\${tag}\\`);\n }\n // Read pointer to string data\n const stringPtr = view.getUint32(offset + TAG_SIZE, true);\n \n // Read string data from the pointer\n if (stringPtr === 0) return '';\n \n const length = view.getUint32(stringPtr, true);\n if (length === 0) return '';\n \n // Read UTF-16 code units and convert to string\n let result = '';\n for (let i = 0; i < length; i++) {\n const codeUnit = view.getUint16(stringPtr + 4 + i * 2, true);\n result += String.fromCharCode(codeUnit);\n }\n \n return result;\n}\n\n/**\n * Marshal a primitive value to memory with automatic type detection.\n *\n * Supports null, boolean, number, and string types.\n *\n * @param value - The value to write (null, boolean, number, or string)\n * @param view - DataView for writing\n * @param offset - Offset to write at\n * @returns Total bytes written\n * @throws {Error} If value type is not supported\n */\nfunction writePrimitive(value, view, offset) {\n if (value === null) {\n return writeNull(view, offset);\n } else if (typeof value === 'boolean') {\n return writeBoolean(value, view, offset);\n } else if (typeof value === 'number') {\n return writeFloat(value, view, offset);\n } else if (typeof value === 'string') {\n return writeString(value, view, offset);\n } else {\n throw new Error('Unsupported type for marshaling: ' + typeof value);\n }\n}\n\n/**\n * Read a primitive value from memory with type detection.\n *\n * Reads the type tag and dispatches to the appropriate read function.\n *\n * @param view - DataView for reading\n * @param offset - Offset to read from\n * @returns The decoded value (null, boolean, number, or string)\n * @throws {Error} If type tag is not recognized\n */\nfunction readPrimitive(view, offset) {\n const tag = view.getUint32(offset, true);\n switch (tag) {\n case TAG_NULL:\n return readNull(view, offset);\n case TAG_BOOLEAN:\n return readBoolean(view, offset);\n case TAG_INT:\n return readInt(view, offset);\n case TAG_FLOAT:\n return readFloat(view, offset);\n case TAG_STRING:\n return readString(view, offset);\n default:\n throw new Error('Unexpected type tag: ' + tag);\n }\n}\n\n/**\n * Marshal an object to memory.\n * Returns the total bytes written for the object.\n *\n * Format: [tag: u32][propertyCount: u32][key1: tagged string][value1: tagged][key2: tagged string][value2: tagged]...\n *\n * Keys are written as tagged strings, followed by tagged values.\n * Property order is preserved for deterministic serialization using Object.entries.\n *\n * @param obj - The object to marshal\n * @param view - DataView for writing\n * @param writeOffset - Offset to write the object at\n * @returns Total bytes written\n */\nfunction writeObject(obj, view, writeOffset) {\n const startOffset = writeOffset;\n let offset = writeOffset;\n\n // Write tag\n view.setUint32(offset, TAG_OBJECT, true);\n offset += TAG_SIZE;\n\n // Get properties in order\n const entries = Object.entries(obj);\n const propCount = entries.length;\n\n // Write property count\n view.setUint32(offset, propCount, true);\n offset += 4;\n\n // Write each (key, value) pair\n for (let i = 0; i < propCount; i++) {\n const [key, value] = entries[i];\n\n // Write key as tagged string (keys are tagged with TAG_STRING)\n offset += writeString(key, view, offset);\n\n // Write value (tagged)\n offset += writeValue(value, view, offset);\n }\n\n return offset - startOffset;\n}\n\n/**\n * Marshal a value to memory with automatic type detection.\n *\n * Supports null, boolean, number, string, array, and object types.\n * This is the top-level value marshaling function that dispatches to\n * the appropriate type-specific function.\n *\n * @param value - The value to write\n * @param view - DataView for writing\n * @param offset - Offset to write at\n * @returns Total bytes written\n * @throws {Error} If value type is not supported\n */\nfunction writeValue(value, view, offset) {\n if (value === null || value === undefined) {\n return writeNull(view, offset);\n } else if (typeof value === 'boolean') {\n return writeBoolean(value, view, offset);\n } else if (typeof value === 'number') {\n return writeFloat(value, view, offset);\n } else if (typeof value === 'string') {\n return writeString(value, view, offset);\n } else if (Array.isArray(value)) {\n return writeArray(value, view, 0, offset);\n } else if (typeof value === 'object') {\n return writeObject(value, view, offset);\n } else {\n throw new Error('Unsupported type for marshaling: ' + typeof value);\n }\n}\n\n/**\n * Read an object from memory.\n *\n * WASM Format: Value.Object has: [type: u32=6][objectPtr: u32]\n * objectPtr points to Map structure: [propCount: u32][keyPtr1: u32][valuePtr1: u32][keyPtr2: u32][valuePtr2: u32]...\n * Key pointers point to UTF-16 string data\n * Value pointers point to heap-allocated tagged values.\n *\n * @param view - DataView for reading\n * @param offset - Offset to the Value.Object structure (NOT objectPtr)\n * @returns The unmarshaled object\n */\nfunction readObject(view, offset) {\n // Two cases:\n // 1. If offset has TAG_OBJECT (6), it's a Value.Object structure: [type: u32][objectPtr: u32]\n // 2. Otherwise, offset might already point to the Map structure directly\n\n const tag = view.getUint32(offset, true);\n let objectPtr;\n\n if (tag === TAG_OBJECT) {\n // Case 1: Value.Object structure, read pointer to Map\n objectPtr = view.getUint32(offset + 4, true);\n } else {\n // Case 2: offset point directly to Map structure\n objectPtr = offset;\n }\n\n const result = {};\n if (objectPtr !== 0) {\n // Read property count from map structure\n const propCount = view.getUint32(objectPtr, true);\n let mapOffset = objectPtr + 4;\n\n for (let i = 0; i < propCount; i++) {\n // Read key pointer and value pointer\n const keyPtr = view.getUint32(mapOffset, true);\n const valuePtr = view.getUint32(mapOffset + 4, true);\n mapOffset += 8;\n\n // Read key (raw UTF-16 string data at keyPtr: [length: u32][utf16 chars...])\n const keyLen = view.getUint32(keyPtr, true);\n let key = '';\n for (let j = 0; j < keyLen; j++) {\n const codeUnit = view.getUint16(keyPtr + 4 + j * 2, true);\n key += String.fromCharCode(codeUnit);\n }\n\n // Read value (tagged value at valuePtr)\n const value = readValue(view, valuePtr);\n\n result[key] = value;\n }\n }\n\n return result;\n}\n\n/**\n * Calculate the size in bytes of a tagged value at the given offset.\n *\n * @param view - DataView for reading\n * @param offset - Offset to calculate size from\n * @returns Total bytes the value occupies\n * @throws {Error} If type tag is not recognized\n */\nfunction getValueSize(view, offset) {\n const tag = view.getUint32(offset, true);\n\n switch (tag) {\n case TAG_NULL:\n return TAG_SIZE;\n case TAG_BOOLEAN:\n return TAG_SIZE + 1;\n case TAG_INT:\n return TAG_SIZE + 8;\n case TAG_FLOAT:\n return TAG_SIZE + 8;\n case TAG_STRING: {\n const strLen = view.getUint32(offset + TAG_SIZE, true);\n return TAG_SIZE + 4 + strLen;\n }\n case TAG_ARRAY: {\n const arrLen = view.getUint32(offset + TAG_SIZE, true);\n let size = TAG_SIZE + 4; // tag + length\n let elemOffset = offset + TAG_SIZE + 4;\n for (let i = 0; i < arrLen; i++) {\n const elemSize = getValueSize(view, elemOffset);\n size += elemSize;\n elemOffset += elemSize;\n }\n return size;\n }\n case TAG_OBJECT: {\n const propCount = view.getUint32(offset + TAG_SIZE, true);\n let size = TAG_SIZE + 4; // tag + property count\n let propOffset = offset + TAG_SIZE + 4;\n for (let i = 0; i < propCount; i++) {\n // Skip key (tagged string)\n const keySize = getValueSize(view, propOffset);\n size += keySize;\n propOffset += keySize;\n\n // Skip value (tagged value)\n const valSize = getValueSize(view, propOffset);\n size += valSize;\n propOffset += valSize;\n }\n return size;\n }\n default:\n throw new Error('Unexpected type tag: ' + tag);\n }\n}\n\n/**\n * Read a value from memory with type detection.\n *\n * Reads the type tag and dispatches to the appropriate read function.\n *\n * @param view - DataView for reading\n * @param offset - Offset to read from\n * @returns The decoded value\n * @throws {Error} If type tag is not recognized\n */\nfunction readValue(view, offset) {\n const tag = view.getUint32(offset, true);\n switch (tag) {\n case TAG_NULL:\n return readNull(view, offset);\n case TAG_BOOLEAN:\n return readBoolean(view, offset);\n case TAG_INT:\n return readInt(view, offset);\n case TAG_FLOAT:\n return readFloat(view, offset);\n case TAG_STRING:\n return readString(view, offset);\n case TAG_ARRAY:\n return readArray(view, offset);\n case TAG_OBJECT:\n return readObject(view, offset);\n default:\n throw new Error('Unexpected type tag: ' + tag);\n }\n}\n\n/**\n * Marshal an array to memory.\n * Returns the total bytes written for the array.\n *\n * Format: [tag: u32][length: u32][tagged elements...]\n *\n * @param arr - The array to marshal\n * @param view - DataView for writing\n * @param ptr - Base pointer (unused, kept for API compatibility)\n * @param writeOffset - Offset to write the array at\n * @returns Total bytes written\n */\nfunction writeArray(arr, view, ptr, writeOffset) {\n const startOffset = writeOffset;\n let offset = writeOffset;\n\n // Write tag\n view.setUint32(offset, TAG_ARRAY, true);\n offset += TAG_SIZE;\n\n // Write length\n view.setUint32(offset, arr.length, true);\n offset += 4;\n\n // Write elements recursively\n for (let i = 0; i < arr.length; i++) {\n const value = arr[i];\n offset += writeValue(value, view, offset);\n }\n\n return offset - startOffset;\n}\n\n/**\n * Calculate the size needed to marshal an object.\n *\n * Format: [tag: byte][propertyCount: u32][key1: tagged string][value1: tagged][key2: tagged string][value2: tagged]...\n *\n * @param obj - The object to calculate size for\n * @returns Total bytes needed for the object\n */\nfunction calculateObjectSize(obj) {\n let size = 5; // tag (1 byte) + property count (4 bytes)\n\n const entries = Object.entries(obj);\n for (let i = 0; i < entries.length; i++) {\n const [key, value] = entries[i];\n // Key: tagged string (tag: 4 + pointer: 4 + length: 4 + UTF-16 data: 2 bytes per code unit)\n size += 8 + 4 + key.length * 2;\n // Value: calculate size of tagged value\n size += calculateValueSize(value);\n }\n\n return size;\n}\n\n/**\n * Calculate the size needed to marshal a value.\n *\n * @param value - The value to calculate size for\n * @returns Total bytes needed for the value\n */\nfunction calculateValueSize(value) {\n if (value === null || value === undefined) {\n return 1;\n } else if (typeof value === 'boolean') {\n return 2;\n } else if (typeof value === 'number') {\n return 9;\n } else if (typeof value === 'string') {\n // tag (4) + pointer (4) + length (4) + UTF-16 data (2 bytes per code unit)\n return 8 + 4 + value.length * 2;\n } else if (Array.isArray(value)) {\n let size = 5;\n for (let i = 0; i < value.length; i++) {\n size += calculateValueSize(value[i]);\n }\n return size;\n } else if (typeof value === 'object') {\n return calculateObjectSize(value);\n } else {\n throw new Error('Unsupported type for marshaling: ' + typeof value);\n }\n}\n\n/**\n * Read an array from memory.\n *\n * WASM Format: Value.Array has: [type: u32=5][arrayPtr: u32]\n * arrayPtr points to array structure: [length: u32][elementPtr1: u32][elementPtr2: u32]...\n * Each elementPtr points to a tagged Value structure\n *\n * @param view - DataView for reading\n * @param offset - Offset to the Value.Array structure (NOT arrayPtr)\n * @returns The unmarshaled array\n */\nfunction readArray(view, offset) {\n // Two cases:\n // 1. If offset has TAG_ARRAY (5), it's a Value.Array structure: [type: u32][arrayPtr: u32]\n // 2. Otherwise, offset might already point to the array structure directly\n\n const tag = view.getUint32(offset, true);\n let arrayPtr;\n\n if (tag === TAG_ARRAY) {\n // Case 1: Value.Array structure, read pointer to array data\n arrayPtr = view.getUint32(offset + 4, true);\n } else {\n // Case 2: offset points directly to array structure\n arrayPtr = offset;\n }\n\n // Validate arrayPtr is within bounds\n if (arrayPtr === 0 || arrayPtr >= view.byteLength) {\n return [];\n }\n\n // Read length field (may have high bit set for flat format)\n const lengthField = view.getUint32(arrayPtr, true);\n const FLAT_ARRAY_MARKER = 0x80000000;\n\n // Check if this is a flat numeric array (high bit set)\n if ((lengthField & FLAT_ARRAY_MARKER) !== 0) {\n // Flat numeric format: [length | marker: u32][f64 elements...]\n const length = lengthField & ~FLAT_ARRAY_MARKER;\n const result = [];\n for (let i = 0; i < length; i++) {\n const value = view.getFloat64(arrayPtr + 4 + i * 8, true);\n result.push(value);\n }\n return result;\n }\n\n // Generic format: [length: u32][Value pointers...]\n const length = lengthField;\n\n // Read element pointers and dereference them\n const result = [];\n for (let i = 0; i < length; i++) {\n const elemPtr = view.getUint32(arrayPtr + 4 + i * 4, true);\n // Skip invalid pointers\n if (elemPtr === 0 || elemPtr >= view.byteLength) {\n result.push(null);\n continue;\n }\n const value = readValue(view, elemPtr);\n result.push(value);\n }\n\n return result;\n}\n`;\n}\n\n/**\n * Generate the unmarshal function body.\n *\n * This function is currently unused but kept for potential future use with alternative\n * marshaling strategies. It generates code to read fixed-layout structs directly,\n * which could be more efficient than the current generic Value-based approach.\n *\n * @param layout - The flattened schema layout\n * @param _prefix - Unused parameter (reserved for potential future use with prefixed field names)\n * @returns Generated JavaScript code for unmarshaling\n */\nexport function _generateUnmarshalBody(layout: FlattenedLayout, _prefix: string): string {\n const lines: string[] = [];\n\n lines.push(' const output = {};');\n lines.push('');\n\n // Build nested object structure\n const paths = buildNestedPaths(layout.fields);\n lines.push(...paths);\n\n lines.push('');\n\n // Read fixed fields\n for (const field of layout.fields) {\n if (field.type === 'string' || field.type === 'array') {\n // Skip - handled in variable section\n continue;\n } else if (field.type === 'bool') {\n lines.push(' // ' + field.path);\n lines.push(\n ` output${field.path\n .split('.')\n .map((p) => `['${p}']`)\n .join('')} = view.getUint32(readOffset + ${field.offset}, true) !== 0;`,\n );\n } else if (field.type === 'i64') {\n lines.push(' // ' + field.path);\n lines.push(\n ` output${field.path\n .split('.')\n .map((p) => `['${p}']`)\n .join('')} = Number(view.getBigInt64(readOffset + ${field.offset}, true));`,\n );\n } else {\n lines.push(' // ' + field.path);\n const valueGetter = field.type === 'f64' ? 'getFloat64' : 'getInt32';\n lines.push(\n ` output${field.path\n .split('.')\n .map((p) => `['${p}']`)\n .join('')} = view.${valueGetter}(readOffset + ${field.offset}, true);`,\n );\n }\n }\n\n // Read variable-length data\n for (const field of layout.fields) {\n if (field.type === 'string') {\n lines.push('');\n lines.push(' // ' + field.path);\n lines.push(\n ` const ${field.flatName}_ptr = view.getUint32(readOffset + ${field.offset}, true);`,\n );\n lines.push(\n ` const ${field.flatName}_len = view.getUint32(readOffset + ${field.offset} + 4, true);`,\n );\n lines.push(\n ` output${field.path\n .split('.')\n .map((p) => `['${p}']`)\n .join('')} = ${field.flatName}_len > 0 ? readString(view, ${field.flatName}_ptr) : '';`,\n );\n } else if (field.type === 'array') {\n lines.push('');\n lines.push(' // ' + field.path);\n lines.push(\n ` const ${field.flatName}_ptr = view.getUint32(readOffset + ${field.offset}, true);`,\n );\n lines.push(\n ` const ${field.flatName}_len = view.getUint32(readOffset + ${field.offset} + 4, true);`,\n );\n lines.push(\n ` output${field.path\n .split('.')\n .map((p) => `['${p}']`)\n .join('')} = readArray(view, ${field.flatName}_ptr);`,\n );\n }\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Build nested object initialization code\n */\nfunction buildNestedPaths(fields: Array<{ path: string }>): string[] {\n const paths: string[] = [];\n const nestedObjects = new Set<string>();\n\n for (const field of fields) {\n const parts = field.path.split('.');\n for (let i = 0; i < parts.length - 1; i++) {\n const prefix = parts.slice(0, i + 1).join('.');\n if (!nestedObjects.has(prefix)) {\n nestedObjects.add(prefix);\n const code = ` output${prefix\n .split('.')\n .map((p) => `['${p}']`)\n .join('')} = {};`;\n paths.push(code);\n }\n }\n }\n\n // Deduplicate and sort\n return Array.from(new Set(paths));\n}\n","/**\n * JavaScript Validation Code Generation\n *\n * This module generates JavaScript code for validating input data against\n * TypeBox schemas before marshaling. The generated code performs:\n *\n * - Type checking for primitives (string, number, boolean)\n * - Required field validation\n * - Nested object validation\n * - Array element validation\n * - Union type validation\n * - Literal value validation\n *\n * The generated validators are standalone JavaScript code that doesn't\n * require runtime schema compilation, making validation fast and predictable.\n */\n\nimport { type TSchema, Kind } from '@sinclair/typebox';\n\n/**\n * Generate JavaScript validation code.\n *\n * This function generates JavaScript code that validates input data\n * against the TypeBox schema before marshaling.\n *\n * Generates custom validation code that checks types and required fields\n * without requiring runtime schema compilation.\n *\n * @param schema - The TypeBox schema to validate against\n * @returns Generated validation code as a string\n */\nexport function generateValidationCode(schema: TSchema): string {\n const validatorCode = generateSchemaValidator(schema, 'data');\n\n return `// Generated validation code for TypeBox schema\n\n/**\n * Validate input data against the schema.\n * Throws an error if validation fails.\n *\n * @param data - The input data to validate\n * @throws {ValidationError} If validation fails\n */\nexport function validateInput(data) {\n const errors = ${validatorCode};\n if (errors.length > 0) {\n throw new ValidationError('Invalid input data', errors);\n }\n}\n\n/**\n * Custom error class for validation errors\n */\nexport class ValidationError extends Error {\n constructor(message, errors) {\n const errorList = errors\n .map((e, i) => '[' + (i + 1) + '] ' + e.path + ': ' + e.message)\n .join('\\\\n ');\n super(message + ':\\\\n ' + errorList);\n this.name = 'ValidationError';\n this.errors = errors;\n }\n}\n\n/**\n * Safely validate input without throwing.\n *\n * @param data - The input data to validate\n * @returns true if valid, false otherwise\n */\nexport function checkInput(data) {\n try {\n validateInput(data);\n return true;\n } catch {\n return false;\n }\n}\n`;\n}\n\n/**\n * Generate validation code for a given schema.\n *\n * @param schema - The TypeBox schema to generate validation for\n * @param dataPath - JavaScript expression for accessing the data at this level\n * @returns JavaScript code that returns an array of error objects\n */\nfunction generateSchemaValidator(schema: TSchema, dataPath: string): string {\n const kind = (schema as any)[Kind];\n\n switch (kind) {\n case 'Object': {\n return validateObject(schema, dataPath);\n }\n\n case 'String': {\n return validatePrimitive(dataPath, 'string', 'Expected string');\n }\n\n case 'Number': {\n return validatePrimitive(dataPath, 'number', 'Expected number');\n }\n\n case 'Integer': {\n return `${validatePrimitive(dataPath, 'number', 'Expected integer')}.concat(\n ${dataPath} !== undefined && ${dataPath} !== null && !Number.isInteger(${dataPath})\n ? [{ path: '${dataPath}', message: 'Expected integer', value: ${dataPath} }]\n : []\n )`;\n }\n\n case 'Boolean': {\n return validatePrimitive(dataPath, 'boolean', 'Expected boolean');\n }\n\n case 'Array': {\n return validateArray(schema, dataPath);\n }\n\n case 'Union': {\n return validateUnion(schema, dataPath);\n }\n\n case 'Literal': {\n const literalValue = (schema as any).const;\n const literalStr =\n typeof literalValue === 'string' ? `'${literalValue}'` : String(literalValue);\n const message2 = 'Expected literal value ' + String(literalStr);\n return `${validatePrimitive(dataPath, typeof literalValue, '${message2}')}.concat(\n ${dataPath} !== undefined && ${dataPath} !== null && ${dataPath} !== ${literalStr}\n ? [{ path: '${dataPath}', message: '${message2}', value: ${dataPath} }]\n : []\n )`;\n }\n\n default:\n // Unknown type - accept anything\n return '[]';\n }\n}\n\n/**\n * Generate validation for object schema.\n */\nfunction validateObject(schema: TSchema, dataPath: string): string {\n const properties = (schema as any).properties || {};\n const required = new Set((schema as any).required || []);\n\n let code = `[]`;\n\n // Check if data is an object\n code = `(${dataPath} === null || ${dataPath} === undefined || typeof ${dataPath} !== 'object' || Array.isArray(${dataPath})) ? [{ path: '${dataPath}', message: 'Expected object', value: ${dataPath} }] : []`;\n\n // Check each property\n for (const [key, propSchema] of Object.entries(properties)) {\n const propPath = `${dataPath}.${key}`;\n const isRequired = required.has(key);\n\n // Check if required field is present\n if (isRequired) {\n code += `.concat(\n ${propPath} === undefined || ${propPath} === null\n ? [{ path: '${propPath}', message: 'Required field is missing', value: undefined }]\n : []\n )`;\n } else {\n // Skip validation if optional field is missing\n code += `.concat(\n ${propPath} === undefined || ${propPath} === null\n ? []\n : ${generateSchemaValidator(propSchema as TSchema, propPath)}\n )`;\n }\n\n // Validate the field if present\n if (isRequired) {\n code += `.concat(\n ${propPath} !== undefined && ${propPath} !== null\n ? ${generateSchemaValidator(propSchema as TSchema, propPath)}\n : []\n )`;\n }\n }\n\n return code;\n}\n\n/**\n * Generate validation for array schema.\n */\nfunction validateArray(schema: TSchema, dataPath: string): string {\n const itemsSchema = (schema as any).items;\n\n // Check if data is an array\n const arrayCheck = `Array.isArray(${dataPath})`;\n\n // Validate array elements\n if (itemsSchema) {\n const elementValidation = `\n ${dataPath}.reduce((errs, item, idx) => {\n const itemPath = '${dataPath}[' + idx + ']';\n const elementErrors = ${generateSchemaValidator(itemsSchema as TSchema, 'item')};\n return errs.concat(elementErrors.map(e => ({\n ...e,\n path: itemPath\n })));\n }, [])\n `;\n\n return `(${arrayCheck} ? ${elementValidation} : [{ path: '${dataPath}', message: 'Expected array', value: ${dataPath} }])`;\n }\n\n return `${arrayCheck} ? [] : [{ path: '${dataPath}', message: 'Expected array', value: ${dataPath} }]`;\n}\n\n/**\n * Generate validation for union schema.\n */\nfunction validateUnion(schema: TSchema, dataPath: string): string {\n const anyOf = (schema as any).anyOf || [];\n if (anyOf.length === 0) {\n return '[]';\n }\n\n // Generate validators for each option\n const validators = anyOf.map((option: TSchema) => generateSchemaValidator(option, dataPath));\n\n // Check if at least one option passes\n return `(${dataPath} === undefined || ${dataPath} === null) ? []\n : ${validators.join('.length === 0 || ')}.length === 0\n ? []\n : [{ path: '${dataPath}', message: 'Value does not match any allowed type', value: ${dataPath} }]`;\n}\n\n/**\n * Generate validation for primitive types.\n */\nfunction validatePrimitive(dataPath: string, expectedType: string, message: string): string {\n return `(${dataPath} === undefined || ${dataPath} === null || typeof ${dataPath} !== '${expectedType}')\n ? [{ path: '${dataPath}', message: '${message}', value: ${dataPath} }]\n : []`;\n}\n","// src/compiler/runtime-codegen.ts\n// Compile-time code generation utilities for loading generated marshaling and validation code\n\nimport { CompilationError, ErrorCode } from './errors';\n\n/**\n * Type definitions for marshal and unmarshal functions.\n */\nexport type MarshalFn = (data: Record<string, unknown>, memory: WebAssembly.Memory) => number;\n\nexport type UnmarshalFn = (ptr: number, memory: WebAssembly.Memory) => Record<string, unknown>;\n\nexport type ValidateFn = (data: unknown) => void;\n\n/**\n * Load generated marshaling code as executable functions.\n *\n * @internal This function uses Function constructor to execute generated code.\n * The code is generated by the compiler and is trusted, but users should be\n * aware that this executes arbitrary JavaScript in the current context.\n *\n * @param code - The generated marshaling code\n * @returns Object with marshal and unmarshal functions\n */\nexport function loadGeneratedMarshaling(code: string): {\n marshal: MarshalFn;\n unmarshal: UnmarshalFn;\n} {\n // Create a function from the generated code\n\n // We use string replacement instead of ES module loading because: (1) generated code\n // uses ES6 exports which Function() doesn't support, (2) avoiding eval() for security,\n // (3) provides isolated scope for generated code. Convert export syntax to regular functions.\n const cleanedCode = code\n .replace(/^export function marshalInput/gm, 'function marshalInputHelper')\n .replace(/^export function unmarshalOutput/gm, 'function unmarshalOutputHelper')\n .replace(/^export const SCHEMA_HASH/gm, 'const SCHEMA_HASH')\n .replace(/^export const INPUT_FIXED_SIZE/gm, 'const INPUT_FIXED_SIZE')\n .replace(/^export const OUTPUT_FIXED_SIZE/gm, 'const OUTPUT_FIXED_SIZE')\n .replace(/^export function writeString/gm, 'function writeStringHelper')\n .replace(/^export function readString/gm, 'function readStringHelper')\n .replace(/^export function writeArray/gm, 'function writeArrayHelper')\n .replace(/^export function readArray/gm, 'function readArrayHelper')\n .replace(/^export function calculateInputSize/gm, 'function calculateInputSizeHelper');\n\n // Helper function to extract nested values\n const helperCode = `\n function getNestedValue(obj, path) {\n const parts = path.split('.');\n let current = obj;\n for (const part of parts) {\n if (current == null) return undefined;\n if (typeof current !== 'object') return undefined;\n current = current[part];\n }\n return current;\n }\n `;\n\n // Type for the raw 3-argument marshal function\n type RawMarshalFn = (\n data: Record<string, unknown>,\n memory: WebAssembly.Memory,\n allocate: (size: number) => number,\n ) => number;\n\n const module: { marshalInput?: RawMarshalFn; unmarshalOutput?: UnmarshalFn } = {};\n\n const setupFn = new Function(\n 'module',\n helperCode +\n cleanedCode +\n `\n module.marshalInput = marshalInputHelper;\n module.unmarshalOutput = unmarshalOutputHelper;\n `,\n );\n\n setupFn(module);\n\n if (!module.marshalInput || !module.unmarshalOutput) {\n throw new CompilationError(\n 'Generated marshaling code did not export required functions',\n ErrorCode.INVALID_NODE_STRUCTURE,\n { field: 'marshalCode' },\n );\n }\n\n // Create a 2-argument wrapper that provides an internal allocator\n // The allocator starts at 192KB to avoid collision with:\n // - AssemblyScript static data (0 - ~50KB)\n // - AssemblyScript runtime heap (~50KB - ~192KB, grows during evaluation)\n // This matches the memory layout expected by the WASM module.\n const rawMarshal = module.marshalInput;\n const INPUT_BUFFER_START = 192 * 1024; // 192KB\n const REQUIRED_MEMORY = 768 * 1024; // 768KB minimum to fit input + output buffers\n\n const wrappedMarshal: MarshalFn = (data, memory) => {\n // Ensure memory is large enough for the expected layout\n if (memory.buffer.byteLength < REQUIRED_MEMORY) {\n const pagesNeeded = Math.ceil((REQUIRED_MEMORY - memory.buffer.byteLength) / 65536);\n memory.grow(pagesNeeded);\n }\n\n // Simple bump allocator starting at 192KB (after AS runtime heap region)\n let heapOffset = INPUT_BUFFER_START;\n const allocate = (size: number): number => {\n const ptr = heapOffset;\n heapOffset += size;\n // Grow memory if needed\n if (heapOffset > memory.buffer.byteLength) {\n const pagesNeeded = Math.ceil((heapOffset - memory.buffer.byteLength) / 65536);\n memory.grow(pagesNeeded);\n }\n return ptr;\n };\n return rawMarshal(data, memory, allocate);\n };\n\n return {\n marshal: wrappedMarshal,\n unmarshal: module.unmarshalOutput,\n };\n}\n\n// Cache TypeCompiler to avoid repeated dynamic imports\nlet cachedTypeCompiler: unknown = null;\n\n/**\n * Load generated validation code as executable function.\n *\n * @param code - The generated validation code\n * @returns Validation function\n */\nexport async function loadGeneratedValidation(code: string): Promise<ValidateFn> {\n // The generated validation code uses ES6 import/export syntax and TypeScript syntax\n // We need to:\n // 1. Strip import statements\n // 2. Strip TypeScript type annotations\n // 3. Convert exports to regular function/class definitions\n // 4. Pass TypeCompiler as a dependency\n // 5. Return the validateInput function\n\n let cleanedCode = code;\n\n // Remove import statements\n const importRegex = /^import\\s+.*from\\s+['\"].*['\"];?\\s*$/gm;\n cleanedCode = cleanedCode.replace(importRegex, '');\n\n // Strip TypeScript parameter type annotations\n // Matches: function foo(param: Type, other: Type)\n cleanedCode = cleanedCode.replace(/(\\w+)\\s*:\\s*\\w+(?:<[^>]+>)?(?=[,)])/g, '$1');\n\n // Strip TypeScript \"asserts\" return type annotations\n // Matches: ): asserts data is Type {\n cleanedCode = cleanedCode.replace(/\\):\\s+asserts\\s+\\w+\\s+is\\s+\\w+\\s*(<[^>]+>)?\\s*\\{/g, ') {');\n\n // Strip TypeScript class property modifiers\n // Matches: public readonly errors: Type {\n cleanedCode = cleanedCode.replace(/public\\s+readonly\\s+/g, '');\n cleanedCode = cleanedCode.replace(/public\\s+/g, '');\n\n // Strip generic type annotations from Array\n // Matches: Array<{...}> and Array<Type>\n cleanedCode = cleanedCode.replace(/Array<([^>]+)>/g, 'Array');\n\n // Strip TSchema type reference (from @sinclair/typebox)\n cleanedCode = cleanedCode.replace(/:\\s*TSchema/g, '');\n\n // Convert exports to regular definitions\n cleanedCode = cleanedCode\n .replace(/^export function validateInput/gm, 'function validateInput')\n .replace(/^export class ValidationError/gm, 'class ValidationError')\n .replace(/^export function checkInput/gm, 'function checkInput');\n\n // Import TypeCompiler dynamically (cached for performance)\n if (!cachedTypeCompiler) {\n const module = await import('@sinclair/typebox/compiler');\n cachedTypeCompiler = module.TypeCompiler;\n }\n const TypeCompiler = cachedTypeCompiler;\n\n // Create a module object to hold the validator (no type annotation for Function context)\n const module: any = {};\n\n const setupFn = new Function(\n 'TypeCompiler',\n 'module',\n `\n ${cleanedCode}\n module.validateInput = validateInput;\n `,\n );\n\n setupFn(TypeCompiler, module);\n\n if (!module.validateInput) {\n throw new CompilationError(\n 'Generated validation code did not export validateInput function',\n ErrorCode.INVALID_NODE_STRUCTURE,\n { field: 'validationCode' },\n );\n }\n\n return module.validateInput;\n}\n\n/**\n * Re-export validation code generation functions from marshal-gen\n */\nexport { generateValidationCode } from './marshal-gen';\n","// src/compiler/runtime.ts\n// Runtime execution support for evaluating compiled JDM decisions\n\nimport type { CompilationResult } from './types';\nimport {\n loadGeneratedMarshaling,\n loadGeneratedValidation,\n type MarshalFn,\n type UnmarshalFn,\n type ValidateFn,\n} from './runtime-codegen';\n\n// ============================================================================\n// Memory Constants\n// ============================================================================\n\n/**\n * WebAssembly page size in bytes (64KB).\n * This is a fixed constant defined by the WebAssembly specification.\n * Used to calculate memory requirements and convert between pages and bytes.\n */\nconst WASM_PAGE_SIZE_BYTES = 65536;\n\n/**\n * Default maximum memory pages for compiled decisions (256 pages = 16MB).\n *\n * This limit balances:\n * 1. Allowing large decision tables with many rules\n * 2. Preventing unbounded memory growth\n * 3. Browser compatibility (most browsers support at least 32MB per WASM instance)\n *\n * Can be overridden via CompiledDecisionOptions.maximumMemoryPages.\n */\nconst DEFAULT_MAX_MEMORY_PAGES = 256;\n\n/**\n * Input buffer start offset in bytes (after null pointer trap).\n *\n * Must match INPUT_BUFFER_START in src/runtime/memory.ts (which equals\n * NULL_POINTER_TRAP_SIZE = 4 bytes). This ensures correct memory layout\n * coordination between JavaScript marshaling and WASM memory access.\n *\n * The first 4 bytes are reserved as a null pointer trap zone - accessing\n * address 0 will read/write this trap zone, helping catch null pointer bugs.\n */\nconst INPUT_BUFFER_START_OFFSET = 4;\n\n/**\n * Error type for runtime evaluation errors.\n */\nexport class RuntimeError extends Error {\n constructor(\n message: string,\n public readonly code: number = -1,\n public readonly context?: Record<string, unknown>,\n ) {\n super(message);\n this.name = 'RuntimeError';\n }\n}\n\n/**\n * Ensure WASM memory is large enough for the required size.\n *\n * This function checks if the current memory buffer is large enough\n * and grows it by 64KB pages if needed.\n *\n * @param memory - The WebAssembly.Memory instance\n * @param required - The required memory size in bytes\n * @throws {RuntimeError} If memory cannot be grown (e.g., exceeds maximum)\n *\n * @example\n * ```typescript\n * ensureMemory(memory, 131072); // Ensure at least 128KB is available\n * ```\n */\nexport function ensureMemory(memory: WebAssembly.Memory, required: number): void {\n const current = memory.buffer.byteLength;\n if (required <= current) {\n return; // Already have enough memory\n }\n\n // Calculate how many pages to grow\n const pagesNeeded = Math.ceil((required - current) / WASM_PAGE_SIZE_BYTES);\n\n // Attempt to grow memory\n try {\n const oldPages = memory.grow(pagesNeeded);\n if (oldPages < 0) {\n throw new RuntimeError(`Failed to grow memory by ${pagesNeeded} pages`, 5); // OUT_OF_MEMORY\n }\n } catch (error) {\n // Re-throw RuntimeError as-is\n if (error instanceof RuntimeError) {\n throw error;\n }\n throw new RuntimeError(\n `Cannot grow WASM memory: required ${required} bytes, ` +\n `current ${current} bytes, need ${pagesNeeded} more pages. ` +\n (error instanceof Error ? error.message : String(error)),\n 5, // OUT_OF_MEMORY\n );\n }\n}\n\n// Re-export type definitions from runtime-codegen for backward compatibility\nexport type { MarshalFn, UnmarshalFn, ValidateFn } from './runtime-codegen';\n\n/**\n * Options for creating a CompiledDecision instance.\n */\nexport interface CompiledDecisionOptions {\n /** The compiled WASM binary */\n wasm: Uint8Array;\n /** Schema hash for validation */\n schemaHash: bigint;\n /** Function to marshal input to WASM memory */\n marshal: MarshalFn;\n /** Function to unmarshal output from WASM memory */\n unmarshal: UnmarshalFn;\n /** Function to validate input against schema */\n validate?: ValidateFn;\n /** Initial memory size in pages (default: 1 page = 64KB) */\n initialMemoryPages?: number;\n /** Maximum memory pages (default: DEFAULT_MAX_MEMORY_PAGES = 256 pages = 16MB) */\n maximumMemoryPages?: number;\n}\n\n/**\n * A compiled JDM decision ready for evaluation.\n *\n * This class manages the lifecycle of evaluating a compiled decision:\n * 1. Validates input against schema (fail fast with good error)\n * 2. Marshals input to WASM memory\n * 3. Resets heap for fresh evaluation\n * 4. Runs evaluation\n * 5. Checks for runtime errors (schema mismatch, etc.)\n * 6. Unmarshals output from WASM memory\n *\n * @example\n * ```typescript\n * const decision = new CompiledDecision({\n * wasm: compilationResult.wasm,\n * schemaHash: compilationResult.schemaHash,\n * marshal: marshalInput,\n * unmarshal: unmarshalOutput,\n * validate: validateInput,\n * });\n *\n * const output = await decision.evaluate({ age: 25, name: 'Alice' });\n * ```\n */\nexport class CompiledDecision {\n private instance: WebAssembly.Instance | null = null;\n private memory: WebAssembly.Memory | null = null;\n private module: WebAssembly.Module;\n private marshal: MarshalFn;\n private unmarshal: UnmarshalFn;\n private validate?: ValidateFn;\n\n constructor(private options: CompiledDecisionOptions) {\n // WebAssembly.Module requires an ArrayBuffer starting at offset 0, but Uint8Array may\n // be a view into a larger buffer at a non-zero offset, which would cause Module\n // construction to fail. Create a proper Uint8Array view that the Module constructor\n // can safely access, ensuring we only pass the exact bytes of the WASM binary.\n const buffer = new Uint8Array(\n options.wasm.buffer,\n options.wasm.byteOffset,\n options.wasm.byteLength,\n );\n this.module = new WebAssembly.Module(buffer as unknown as ArrayBuffer);\n\n this.marshal = options.marshal;\n this.unmarshal = options.unmarshal;\n this.validate = options.validate;\n }\n\n /**\n * Initialize the WebAssembly instance.\n * This is done lazily on first evaluation, or can be called explicitly.\n */\n private async initialize(): Promise<void> {\n if (this.instance !== null) {\n return;\n }\n\n // Don't provide memory via import - let the WASM module use its own exported memory.\n // AssemblyScript's incremental GC runtime requires specific memory initialization\n // that only works correctly with the module's own memory.\n this.instance = await WebAssembly.instantiate(this.module, {\n env: {\n abort: () => {\n throw new RuntimeError('WASM abort called');\n },\n seed: () => {\n return Date.now();\n },\n 'Date.now': () => Date.now(),\n },\n // Empty index module provided for AssemblyScript compatibility\n index: {},\n });\n\n // Get memory from the WASM module's exports\n this.memory = this.instance.exports.memory as WebAssembly.Memory;\n }\n\n /**\n * Evaluate the decision with the given input.\n *\n * @param input - The input data to evaluate\n * @returns The output of the decision evaluation\n * @throws {RuntimeError} If evaluation fails\n * @throws {ValidationError} If input validation fails (if validate is provided)\n */\n async evaluate<I = Record<string, unknown>, O = Record<string, unknown>>(input: I): Promise<O> {\n await this.initialize();\n\n if (!this.instance || !this.memory) {\n throw new RuntimeError('WASM instance not initialized');\n }\n\n // Local references to avoid null checks in the hot path\n const memory = this.memory;\n const instance = this.instance;\n\n // 1. Validate input against schema (fail fast with good error)\n if (this.validate) {\n try {\n this.validate(input);\n } catch (error) {\n if (error instanceof Error) {\n throw new RuntimeError(`Input validation failed: ${error.message}`, 1, { input });\n }\n throw error;\n }\n }\n\n // Clear any stale error state from previous evaluations before starting new evaluation.\n // This ensures each evaluation starts with a clean slate.\n const clearLastErrorFn = instance.exports.clearLastError as () => void;\n if (clearLastErrorFn) {\n clearLastErrorFn();\n }\n\n try {\n // 2. Marshal input to WASM memory\n const inputPtr: number = this.marshal(input as Record<string, unknown>, memory);\n\n // Verify input pointer is valid\n if (inputPtr < INPUT_BUFFER_START_OFFSET) {\n throw new RuntimeError(\n `Invalid input pointer: ${inputPtr} (must be >= ${INPUT_BUFFER_START_OFFSET})`,\n );\n }\n\n // 3. Reset heap for fresh evaluation\n const resetHeapFn = instance.exports.resetHeap as () => void;\n if (resetHeapFn) {\n resetHeapFn();\n }\n\n // 4. Run evaluation\n const evaluateFn = instance.exports.evaluate as (ptr: number) => number;\n if (!evaluateFn) {\n throw new RuntimeError('evaluate function not exported from WASM module');\n }\n\n const outputPtr: number = evaluateFn(inputPtr);\n\n // 5. Check for runtime errors (schema mismatch, etc.)\n const getLastErrorFn = instance.exports.getLastError as () => number;\n if (getLastErrorFn) {\n const errorCode = getLastErrorFn();\n if (errorCode !== 0) {\n throw new RuntimeError(this.getErrorMessage(errorCode), errorCode, { input, outputPtr });\n }\n }\n\n // Verify output pointer is valid\n // Output pointer validity is verified during unmarshal - we only check it's within\n // addressable memory here to avoid segfault.\n if (outputPtr < memory.buffer.byteLength) {\n // Output pointer should be within a reasonable range\n // We'll verify the unmarshal works properly\n }\n\n // 6. Unmarshal output from WASM memory\n const output = this.unmarshal(outputPtr, memory);\n\n return output as O;\n } finally {\n // Always clear error state after evaluation, even if an error was thrown.\n // This prevents stale error state from affecting subsequent evaluations.\n if (clearLastErrorFn) {\n clearLastErrorFn();\n }\n }\n }\n\n /**\n * Get a human-readable error message for a given error code.\n *\n * @param errorCode - The error code from getLastError()\n * @returns A human-readable error message\n */\n private getErrorMessage(errorCode: number): string {\n // Error codes duplicated from assembly/runtime/errors.ts because WASM cannot export\n // enum metadata - these must stay synchronized.\n // NONE = 0, SCHEMA_MISMATCH = 1, NULL_POINTER = 2, INVALID_ACCESS = 3, EVALUATION_ERROR = 4, OUT_OF_MEMORY = 5\n const errorMessages: Record<number, string> = {\n 0: 'No error',\n 1: 'Schema mismatch: input data does not match expected schema',\n 2: 'Null pointer dereference',\n 3: 'Invalid memory access',\n 4: 'Evaluation error',\n 5: 'Out of memory',\n };\n\n return errorMessages[errorCode] ?? `Unknown error code: ${errorCode}`;\n }\n\n /**\n * Get the current WebAssembly memory instance.\n * This can be useful for debugging or direct memory inspection.\n *\n * @returns The WebAssembly.Memory instance (null if not initialized)\n */\n getMemory(): WebAssembly.Memory | null {\n return this.memory;\n }\n\n /**\n * Get the current WebAssembly instance.\n *\n * @returns The WebAssembly.Instance instance (null if not initialized)\n */\n getInstance(): WebAssembly.Instance | null {\n return this.instance;\n }\n\n /**\n * Dispose of this CompiledDecision instance.\n * This clears the WebAssembly instance and allows garbage collection.\n */\n dispose(): void {\n this.instance = null;\n }\n\n /**\n * Get memory usage statistics.\n *\n * @returns Object with memory usage information\n */\n getMemoryStats(): { current: number; maximum: number; used: number } {\n // Note: 'used' equals 'current' because WebAssembly.Memory doesn't expose actual heap\n // usage - tracking used bytes requires instrumentation in AssemblyScript allocator.\n const currentBytes = this.memory?.buffer.byteLength ?? 0;\n return {\n current: currentBytes,\n maximum: (this.options.maximumMemoryPages ?? DEFAULT_MAX_MEMORY_PAGES) * WASM_PAGE_SIZE_BYTES,\n used: currentBytes,\n };\n }\n\n /**\n * Get the input buffer pointer, ensuring sufficient memory is available.\n *\n * This method doesn't allocate new buffers on each call - it always returns the\n * same INPUT_BUFFER_START_OFFSET constant after ensuring the memory can accommodate the\n * required size. Single-allocation design chosen because: (1) heap is reset between\n * evaluations so fragmentation isn't an issue, (2) simpler than maintaining a free\n * list, (3) marshal code controls actual layout in WASM memory. All input data is\n * marshaled into a single buffer starting at INPUT_BUFFER_START_OFFSET.\n *\n * @param required - The required memory size in bytes\n * @returns The base pointer of the input buffer (always INPUT_BUFFER_START_OFFSET)\n * @throws {RuntimeError} If memory cannot be grown to accommodate the required size\n *\n * @example\n * ```typescript\n * const ptr = decision.getInputBuffer(1024); // Ensure 1KB available\n * ```\n */\n getInputBuffer(required: number): number {\n if (!this.memory) {\n throw new RuntimeError('Memory not initialized - call evaluate() first', 5);\n }\n\n // Ensure enough memory\n try {\n ensureMemory(this.memory, required);\n } catch (error) {\n throw new RuntimeError(\n `Memory allocation failed: ${error instanceof Error ? error.message : String(error)}`,\n 5, // OUT_OF_MEMORY error code\n );\n }\n\n // Single-allocation design: return the INPUT_BUFFER_START_OFFSET\n return INPUT_BUFFER_START_OFFSET;\n }\n}\n\n/**\n * Create a CompiledDecision instance from a CompilationResult.\n *\n * This is a convenience function that creates the necessary marshal,\n * unmarshal, and validation functions from the generated code.\n *\n * @param result - The compilation result\n * @param validate - Optional validation function (defaults to generated validation code)\n * @returns A CompiledDecision instance ready for evaluation\n *\n * @example\n * ```typescript\n * const result = await compile({\n * jdm: myJdm,\n * inputSchema: MyInputSchema,\n * outputSchema: MyOutputSchema,\n * });\n *\n * const decision = createCompiledDecision(result);\n * const output = await decision.evaluate({ age: 25 });\n * ```\n */\nexport async function createCompiledDecision(\n result: CompilationResult,\n validate?: ValidateFn,\n): Promise<CompiledDecision> {\n // Load the marshal and unmarshal functions from the generated code\n const { marshal, unmarshal } = loadGeneratedMarshaling(result.marshalCode);\n\n // Load or use provided validation function\n const validator = validate ?? (await loadGeneratedValidation(result.validationCode));\n\n return new CompiledDecision({\n wasm: result.wasm,\n schemaHash: result.schemaHash,\n marshal,\n unmarshal,\n validate: validator,\n });\n}\n\n// Re-export compile-time code generation functions for backward compatibility\nexport { loadGeneratedMarshaling, loadGeneratedValidation } from './runtime-codegen';\n\n/**\n * Re-export types from dependencies\n */\nexport type { TSchema } from '@sinclair/typebox';\n","/**\n * Compile AssemblyScript code to WebAssembly.\n *\n * This module provides the main entry point for WASM compilation with caching.\n * Implementation details are delegated to specialized modules:\n * - virtual-fs.ts: Virtual filesystem for in-memory ASC compilation\n * - asc-compiler.ts: AssemblyScript compiler invocation and configuration\n * - wasm-instantiate.ts: WASM module instantiation and host environment\n */\n\nimport type { CompilerOptions } from './types';\nimport { computeCacheKey, readCacheFromDisk, writeCacheToDisk, isCacheEnabled } from './cache';\nimport { compileAssemblyScriptInternal } from './asc-compiler';\n\n// Re-export for backward compatibility\nexport { instantiateWasm } from './wasm-instantiate';\n\n/**\n * Compile AssemblyScript code to WebAssembly.\n *\n * This function uses the AssemblyScript compiler to generate WASM from\n * the generated AssemblyScript source code using a virtual filesystem.\n *\n * Supports disk-based caching to avoid redundant compilations.\n * Cache is keyed on: AssemblyScript code + runtime libraries + compiler options.\n *\n * **Filesystem Side Effects:**\n * - Compilation may read/write cache files (unless disabled via JDM_ASM_NO_CACHE=1)\n * - If `options.debugOutputPath` is set or `JDM_ASM_DEBUG_OUTPUT` env var is defined,\n * compilation failures will write debug files to disk (see CompilerOptions.debugOutputPath)\n *\n * @param code - The AssemblyScript source code to compile\n * @param options - Compiler options (optimize, debug, debugOutputPath, etc.)\n * @returns An object with the compiled binary and WAT text\n */\nexport async function compileAssemblyScript(\n code: string,\n options: CompilerOptions,\n): Promise<{ binary: Uint8Array; wat: string }> {\n // Check cache first (unless disabled)\n if (isCacheEnabled()) {\n const cacheKey = computeCacheKey(code, options);\n const cached = readCacheFromDisk(cacheKey);\n if (cached) {\n return cached;\n }\n\n // Compile and cache the result\n const result = await compileAssemblyScriptInternal(code, options);\n writeCacheToDisk(cacheKey, result);\n return result;\n }\n\n // Cache disabled, compile directly\n return compileAssemblyScriptInternal(code, options);\n}\n","import { type TSchema, Kind } from '@sinclair/typebox';\nimport type { FlattenedLayout } from './types';\nimport { createHash } from 'crypto';\n\n/**\n * Schema field information for memory layout\n */\ninterface SchemaField {\n schema: TSchema;\n path: string;\n flatName: string;\n}\n\n/**\n * Flattens a TypeBox schema to a memory layout.\n *\n * This function processes a schema and produces a flattened representation\n * that can be used for direct memory access in WebAssembly.\n *\n * Memory structure:\n * ┌─────────────────────────────────────────────────────────────┐\n * │ Fixed Fields (numbers, bools, enum indices) │\n * │ customer_age: f64 (8 bytes) │\n * │ customer_tier: i32 (4 bytes) - enum index │\n * ├─────────────────────────────────────────────────────────────┤\n * │ String/Array Pointers (offset, length pairs) │\n * │ order_items_ptr: i32, order_items_len: i32 │\n * ├─────────────────────────────────────────────────────────────┤\n * │ Variable-length data (UTF-16 strings, array contents) │\n * └─────────────────────────────────────────────────────────────┘\n *\n * @param schema - The TypeBox schema to flatten\n * @param _prefix - Internal parameter for recursive flattening with dotted paths\n * @returns The flattened memory layout\n */\nexport function flattenSchema(schema: TSchema): FlattenedLayout {\n const layout: FlattenedLayout = {\n fields: [],\n };\n\n // Collect all fields from the schema\n const fields: SchemaField[] = collectFields(schema, '');\n\n // Track current offset for field layout\n let currentOffset = 0;\n\n // Process fields: first pass - fixed types\n for (const field of fields) {\n const typeInfo = getFieldType(field.schema);\n if (typeInfo.isFixed) {\n layout.fields.push({\n path: field.path,\n flatName: field.flatName,\n type: typeInfo.asType,\n offset: currentOffset,\n size: typeInfo.size,\n });\n currentOffset += typeInfo.size;\n }\n }\n\n // Second pass - variable types (strings, arrays)\n // These get pointers (2 x i32 = 8 bytes each for offset + length)\n for (const field of fields) {\n const typeInfo = getFieldType(field.schema);\n if (!typeInfo.isFixed) {\n layout.fields.push({\n path: field.path,\n flatName: field.flatName,\n type: typeInfo.asType,\n offset: currentOffset,\n size: -1, // Variable length\n });\n currentOffset += 8; // 4 bytes offset + 4 bytes length\n }\n }\n\n return layout;\n}\n\n/**\n * Collect all fields from a schema recursively\n */\nfunction collectFields(schema: TSchema, path: string): SchemaField[] {\n const fields: SchemaField[] = [];\n\n const kind = (schema as any)[Kind];\n\n if (kind === 'Object') {\n const properties = (schema as any).properties || {};\n for (const [name, fieldSchema] of Object.entries(properties)) {\n const fieldPath = path ? `${path}.${name}` : name;\n const flatName = path ? `${path}_${name}` : name;\n\n const nestedFields = collectFields(fieldSchema as TSchema, fieldPath);\n if (nestedFields.length > 0) {\n fields.push(...nestedFields);\n } else {\n fields.push({\n schema: fieldSchema as TSchema,\n path: fieldPath,\n flatName,\n });\n }\n }\n }\n\n // For non-objects, return empty array (handled by parent)\n return fields;\n}\n\n/**\n * Get type information for a schema field\n */\nfunction getFieldType(schema: TSchema): {\n isFixed: boolean;\n asType: 'f64' | 'i32' | 'i64' | 'bool' | 'string' | 'array';\n size: number;\n} {\n const kind = (schema as any)[Kind];\n\n switch (kind) {\n case 'Number':\n return { isFixed: true, asType: 'f64', size: 8 };\n\n case 'Integer':\n return { isFixed: true, asType: 'i32', size: 4 };\n\n case 'Boolean':\n // Booleans stored as i32 (4 bytes) to ensure natural alignment and match AssemblyScript's\n // bool representation\n return { isFixed: true, asType: 'bool', size: 4 };\n\n case 'String':\n return { isFixed: false, asType: 'string', size: -1 };\n\n case 'Array':\n return { isFixed: false, asType: 'array', size: -1 };\n\n case 'Literal':\n // Literals are stored as i32 indices (for boolean-like or enum-like)\n return { isFixed: true, asType: 'i32', size: 4 };\n\n case 'Union':\n // First, handle unions of Literal types (enum-like) as i32 indices for efficiency\n const anyOf = (schema as any).anyOf;\n if (Array.isArray(anyOf) && anyOf.length > 0) {\n const firstKind = (anyOf[0] as any)[Kind];\n if (firstKind === 'Literal') {\n return { isFixed: true, asType: 'i32', size: 4 };\n }\n }\n // Default to string for heterogeneous unions - can represent multiple incompatible types\n // (e.g., string | number | object)\n return { isFixed: false, asType: 'string', size: -1 };\n\n default:\n // Default to string for unknown types\n return { isFixed: false, asType: 'string', size: -1 };\n }\n}\n\n/**\n * Compute a hash of the input and output schemas for runtime validation.\n *\n * This hash is embedded in the compiled WASM module and can be used to\n * verify that the runtime data matches the expected schema.\n *\n * Uses SHA256 to create a canonical hash, then takes the first 8 bytes as u64.\n *\n * @param inputSchema - The input schema\n * @param outputSchema - The output schema\n * @returns A 64-bit hash value\n */\nexport function computeSchemaHash(inputSchema: TSchema, outputSchema: TSchema): bigint {\n // Create canonical representation with sorted keys\n const canonical = JSON.stringify(\n {\n input: canonicalizeSchema(inputSchema),\n output: canonicalizeSchema(outputSchema),\n },\n null,\n 2,\n );\n\n // Compute SHA256 hash\n const hash = createHash('sha256').update(canonical).digest();\n\n // Take first 8 bytes as u64 (little-endian)\n return hash.readBigUInt64LE(0);\n}\n\n/**\n * Convert a schema to a canonical form for hashing by sorting keys and normalizing structure\n */\nfunction canonicalizeSchema(schema: TSchema): unknown {\n const kind = (schema as any)[Kind];\n\n if (kind === 'Object') {\n const properties = (schema as any).properties || {};\n const canonical: Record<string, unknown> = {};\n const keys = Object.keys(properties).sort();\n\n for (const key of keys) {\n canonical[key] = canonicalizeSchema(properties[key]);\n }\n\n return {\n type: 'object',\n properties: canonical,\n required: ((schema as any).required || []).sort(),\n };\n }\n\n if (kind === 'Array') {\n return {\n type: 'array',\n items: canonicalizeSchema((schema as any).items),\n };\n }\n\n if (kind === 'Enum') {\n return {\n type: 'enum',\n values: ((schema as any).anyOf || []).map((val: TSchema) => (val as any).const).sort(),\n };\n }\n\n if (kind === 'Literal') {\n return {\n type: 'literal',\n value: (schema as any).const,\n };\n }\n\n // For primitive types, return a simple representation\n const primitiveTypes: Record<string, string> = {\n Number: 'number',\n Integer: 'integer',\n String: 'string',\n Boolean: 'boolean',\n };\n\n return primitiveTypes[kind] || kind;\n}\n","// src/compiler/index.ts\nimport type { TSchema } from '@sinclair/typebox';\nimport { parseJDM, type JDMDecision } from './parser';\nimport { compileDecision } from './codegen';\nimport { compileAssemblyScript } from './build';\nimport { flattenSchema, computeSchemaHash } from './schema';\nimport { generateMarshalCode, generateValidationCode } from './marshal-gen';\nimport type {\n CompilerOptions,\n CompilationResult,\n CompilationContext,\n NoMatchBehavior,\n} from './types';\nimport { readFileSync } from 'fs';\nimport path from 'path';\n\n/**\n * Type guard for Node.js file system errors.\n */\nfunction isFileNotFoundError(error: unknown): boolean {\n return error !== null && typeof error === 'object' && 'code' in error && error.code === 'ENOENT';\n}\n\n/**\n * Creates a filesystem-based loader for sub-decision JDM files.\n *\n * This loader performs I/O by reading from the filesystem and may throw filesystem errors\n * (e.g., ENOENT for missing files, EACCES for permission denied).\n *\n * Supports both zen-engine compatibility (flat structure in zen-reference/) and organized test\n * structure (nested by feature in sub-decisions/). This dual approach allows us to port\n * zen-engine fixtures without reorganization while providing better organization for our own\n * tests.\n *\n * @param testDataRoot - Optional root directory for test data. Defaults to \"test-data/\" in current working directory.\n * @returns A loader function that reads JDM files from the filesystem\n * @throws Error if file is not found in any search path\n * @throws Error for other filesystem errors (permissions, invalid content, etc.)\n */\nfunction createFilesystemLoader(testDataRoot?: string): (key: string) => JDMDecision {\n const root = testDataRoot || path.join(process.cwd(), 'test-data');\n const possiblePaths = [\n root,\n path.join(root, 'sub-decisions'),\n path.join(root, 'sub-decisions/basic'),\n path.join(root, 'sub-decisions/simple-multi'),\n path.join(root, 'sub-decisions/complex-multi'),\n path.join(root, 'sub-decisions/diamond'),\n path.join(root, 'sub-decisions/error-propagation'),\n path.join(root, 'zen-reference'),\n ];\n\n return (key: string): JDMDecision => {\n for (const basePath of possiblePaths) {\n try {\n const filePath = path.join(basePath, key);\n const content = readFileSync(filePath, 'utf-8');\n return parseJDM(content);\n } catch (error) {\n // Only try next path for file-not-found errors\n // Let other errors (parse errors, permission denied) propagate immediately\n if (isFileNotFoundError(error)) {\n continue;\n }\n throw error;\n }\n }\n throw new Error(\n `Failed to load sub-decision \"${key}\": not found in any search path (${possiblePaths.join(', ')})`,\n );\n };\n}\n\n// Re-export parser, graph, optimizer, runtime, validation, types, and errors\nexport * from './parser';\nexport * from './graph';\nexport * from './types';\nexport * from './errors';\nexport * from './optimizer';\nexport * from './runtime';\nexport * from './runtime-codegen';\n\n// Validation modules - split by concern:\n// - compile-time-validation: Static analysis of JDM structure and references\n// - runtime-validation-codegen: Validation code that executes at runtime\nexport * from './compile-time-validation';\nexport * from './runtime-validation-codegen';\n\n// Backward compatibility: re-export from input-validation (deprecated)\nexport * from './input-validation';\n\n// Export cache utilities for advanced usage\nexport {\n clearCache,\n getCacheStats,\n pruneCache,\n isCacheEnabled,\n getCacheDirectory,\n getCacheHealth,\n} from './cache';\n\n/**\n * Main entry point: Compile JDM to WASM with schema-driven marshaling.\n *\n * @example\n * const result = await compile({\n * inputSchema: InputSchema,\n * outputSchema: OutputSchema,\n * jdm: jdmJson,\n * optimize: true,\n * });\n */\nexport async function compile(options: {\n inputSchema: TSchema;\n outputSchema: TSchema;\n jdm: string | JDMDecision;\n optimize?: boolean;\n debug?: boolean;\n /** How to handle cases where no rules match in decision tables/switches */\n noMatchBehavior?: NoMatchBehavior;\n /** Optional loader function to load sub-decision JDM files */\n loadDecision?: CompilerOptions['loadDecision'];\n /** Optional testDataRoot path for default loader to search */\n testDataRoot?: string;\n}): Promise<CompilationResult> {\n const opts: CompilerOptions = {\n optimize: options.optimize ?? true,\n debug: options.debug ?? false,\n // Validation disabled during compilation for performance (compile-time checks).\n // Schema validation is generated as separate code (generateValidationCode()) that\n // the runtime can call before evaluation.\n validate: false,\n noMatchBehavior: options.noMatchBehavior,\n };\n\n // Phase 1: Parse and validate JDM\n const parsed = parseJDM(options.jdm);\n\n // Phase 2: Flatten schemas to memory layout\n const inputLayout = flattenSchema(options.inputSchema);\n const outputLayout = flattenSchema(options.outputSchema);\n\n // Phase 3: Compute schema hash for runtime validation\n const schemaHash = computeSchemaHash(options.inputSchema, options.outputSchema);\n\n // Phase 4: Build compilation context\n const context: CompilationContext = {\n jdm: parsed,\n inputSchema: options.inputSchema,\n outputSchema: options.outputSchema,\n inputLayout,\n outputLayout,\n schemaHash,\n options: opts,\n parseExpression: (expr) => parseStandardExpression(expr),\n parseUnaryExpression: (expr) => parseUnaryExpressionImpl(expr),\n getUniqueId: createIdGenerator(),\n loadDecision: options.loadDecision ?? createFilesystemLoader(options.testDataRoot),\n // Avoids duplicate compilation when multiple nodes reference same sub-decision\n compiledSubDecisions: new Map(),\n // Detects circular references to prevent infinite loops during compilation\n decisionPath: [],\n helperFunctions: new Map(),\n };\n\n // Phase 5: Generate AssemblyScript code\n const asCode = compileDecision(parsed, context);\n\n // Phase 6: Compile to WASM\n const { binary, wat } = await compileAssemblyScript(asCode, opts);\n\n // Phase 7: Generate JS marshaling code\n const marshalCode = generateMarshalCode(inputLayout, outputLayout, schemaHash);\n const validationCode = generateValidationCode(options.inputSchema);\n\n return {\n wasm: binary,\n schemaHash,\n marshalCode,\n validationCode,\n wat: opts.debug ? wat : undefined,\n assemblyScript: opts.debug ? asCode : undefined,\n };\n}\n\nfunction createIdGenerator(): (prefix: string) => string {\n const counters = new Map<string, number>();\n return (prefix: string) => {\n const count = counters.get(prefix) ?? 0;\n counters.set(prefix, count + 1);\n return `${prefix}_${count}`;\n };\n}\n\n// Import parse functions\nimport {\n parseStandardExpression,\n parseUnaryExpression as parseUnaryExpressionImpl,\n} from './unary-parser';\n","/**\n * Union type of all expression AST nodes.\n */\nexport type ExpressionAST =\n | NumberLiteral\n | StringLiteral\n | BooleanLiteral\n | NullLiteral\n | Identifier\n | DollarRef\n | HashRef\n | BinaryOp\n | UnaryOp\n | TernaryOp\n | MemberAccess\n | IndexAccess\n | FunctionCall\n | Interval\n | TemplateLiteral\n | ArrayLiteral\n | ObjectLiteral;\n\nexport interface NumberLiteral {\n type: 'NumberLiteral';\n value: number;\n}\n\nexport interface StringLiteral {\n type: 'StringLiteral';\n value: string;\n}\n\nexport interface BooleanLiteral {\n type: 'BooleanLiteral';\n value: boolean;\n}\n\nexport interface NullLiteral {\n type: 'NullLiteral';\n}\n\nexport interface Identifier {\n type: 'Identifier';\n name: string;\n}\n\n/**\n * Dollar reference - used in unary mode to refer to the current value.\n * Represents `$` in decision table cell expressions.\n */\nexport interface DollarRef {\n type: 'DollarRef';\n}\n\n/**\n * Hash reference - used in higher-order functions to refer to current element.\n * Represents `#` in expressions like `filter(items, # > 5)`.\n */\nexport interface HashRef {\n type: 'HashRef';\n}\n\nexport interface BinaryOp {\n type: 'BinaryOp';\n op: BinaryOperator;\n left: ExpressionAST;\n right: ExpressionAST;\n}\n\nexport type BinaryOperator =\n // Arithmetic\n | '+'\n | '-'\n | '*'\n | '/'\n | '%'\n | '^'\n // Comparison\n | '=='\n | '!='\n | '<'\n | '>'\n | '<='\n | '>='\n // Logical\n | 'and'\n | 'or'\n | '??'\n // Membership\n | 'in'\n | 'not in';\n\nexport interface UnaryOp {\n type: 'UnaryOp';\n op: UnaryOperator;\n operand: ExpressionAST;\n}\n\nexport type UnaryOperator = 'not' | '-';\n\nexport interface TernaryOp {\n type: 'TernaryOp';\n condition: ExpressionAST;\n consequent: ExpressionAST;\n alternate: ExpressionAST;\n}\n\nexport interface MemberAccess {\n type: 'MemberAccess';\n object: ExpressionAST;\n property: string;\n}\n\nexport interface IndexAccess {\n type: 'IndexAccess';\n object: ExpressionAST;\n index: ExpressionAST;\n}\n\nexport interface FunctionCall {\n type: 'FunctionCall';\n callee: ExpressionAST;\n args: ExpressionAST[];\n}\n\nexport interface Interval {\n type: 'Interval';\n start: ExpressionAST;\n end: ExpressionAST;\n startInclusive: boolean;\n endInclusive: boolean;\n}\n\nexport interface TemplateLiteral {\n type: 'TemplateLiteral';\n parts: Array<{ text: string } | { expr: ExpressionAST }>;\n}\n\nexport interface ArrayLiteral {\n type: 'ArrayLiteral';\n elements: ExpressionAST[];\n}\n\nexport interface ObjectLiteral {\n type: 'ObjectLiteral';\n properties: Array<{ key: string; value: ExpressionAST }>;\n}\n\nexport function isNumberLiteral(node: ExpressionAST): node is NumberLiteral {\n return node.type === 'NumberLiteral';\n}\n\nexport function isStringLiteral(node: ExpressionAST): node is StringLiteral {\n return node.type === 'StringLiteral';\n}\n\nexport function isBooleanLiteral(node: ExpressionAST): node is BooleanLiteral {\n return node.type === 'BooleanLiteral';\n}\n\nexport function isNullLiteral(node: ExpressionAST): node is NullLiteral {\n return node.type === 'NullLiteral';\n}\n\nexport function isIdentifier(node: ExpressionAST): node is Identifier {\n return node.type === 'Identifier';\n}\n\nexport function isDollarRef(node: ExpressionAST): node is DollarRef {\n return node.type === 'DollarRef';\n}\n\nexport function isHashRef(node: ExpressionAST): node is HashRef {\n return node.type === 'HashRef';\n}\n\nexport function isBinaryOp(node: ExpressionAST): node is BinaryOp {\n return node.type === 'BinaryOp';\n}\n\nexport function isUnaryOp(node: ExpressionAST): node is UnaryOp {\n return node.type === 'UnaryOp';\n}\n\nexport function isTernaryOp(node: ExpressionAST): node is TernaryOp {\n return node.type === 'TernaryOp';\n}\n\nexport function isMemberAccess(node: ExpressionAST): node is MemberAccess {\n return node.type === 'MemberAccess';\n}\n\nexport function isIndexAccess(node: ExpressionAST): node is IndexAccess {\n return node.type === 'IndexAccess';\n}\n\nexport function isFunctionCall(node: ExpressionAST): node is FunctionCall {\n return node.type === 'FunctionCall';\n}\n\nexport function isInterval(node: ExpressionAST): node is Interval {\n return node.type === 'Interval';\n}\n\nexport function isTemplateLiteral(node: ExpressionAST): node is TemplateLiteral {\n return node.type === 'TemplateLiteral';\n}\n\nexport function isArrayLiteral(node: ExpressionAST): node is ArrayLiteral {\n return node.type === 'ArrayLiteral';\n}\n\nexport function isObjectLiteral(node: ExpressionAST): node is ObjectLiteral {\n return node.type === 'ObjectLiteral';\n}\n","import { createToken, CstParser, Lexer, type IToken } from 'chevrotain';\nimport { CompilationError, ErrorCode, type SourceLocation } from './errors';\n\n// === TOKENS (order matters - longer matches first) ===\n\nconst WhiteSpace = createToken({\n name: 'WhiteSpace',\n pattern: /\\s+/,\n group: Lexer.SKIPPED,\n});\n\nconst DotDot = createToken({ name: 'DotDot', pattern: /\\.\\./ });\nconst Dot = createToken({ name: 'Dot', pattern: /\\./ });\n\nconst Eq = createToken({ name: 'Eq', pattern: /==/ });\nconst NotEq = createToken({ name: 'NotEq', pattern: /!=/ });\nconst EqEq = createToken({ name: 'EqEq', pattern: /===/ });\nconst NotEqEq = createToken({ name: 'NotEqEq', pattern: /!==/ });\nconst LtEq = createToken({ name: 'LtEq', pattern: /<=/ });\nconst GtEq = createToken({ name: 'GtEq', pattern: />=/ });\nconst Lt = createToken({ name: 'Lt', pattern: /</ });\nconst Gt = createToken({ name: 'Gt', pattern: />/ });\n\nconst AndAnd = createToken({ name: 'AndAnd', pattern: /&&/ });\nconst OrOr = createToken({ name: 'OrOr', pattern: /\\|\\|/ });\nconst NotNot = createToken({ name: 'NotNot', pattern: /!/ });\n\n// Keywords use longer_alt to ensure 'and'/'or' are recognized as operators rather than\n// variable names - Chevrotain tries longer_alt tokens first, preventing 'android' from\n// incorrectly tokenizing as 'and' + 'roid'.\nconst Identifier = createToken({ name: 'Identifier', pattern: /[$a-zA-Z_]\\w*/ });\n\nconst And = createToken({ name: 'And', pattern: /and/, longer_alt: Identifier });\nconst Or = createToken({ name: 'Or', pattern: /or/, longer_alt: Identifier });\nconst Not = createToken({ name: 'Not', pattern: /not/, longer_alt: Identifier });\nconst In = createToken({ name: 'In', pattern: /in/, longer_alt: Identifier });\n\nconst True = createToken({ name: 'True', pattern: /true/, longer_alt: Identifier });\nconst False = createToken({ name: 'False', pattern: /false/, longer_alt: Identifier });\nconst Null = createToken({ name: 'Null', pattern: /null/, longer_alt: Identifier });\n\nconst NumberLiteral = createToken({\n name: 'NumberLiteral',\n pattern: /\\d[\\d_]*(\\.\\d+)?/,\n});\n\nconst StringLiteral = createToken({\n name: 'StringLiteral',\n pattern: /\"([^\"\\\\]|\\\\.)*\"|'([^'\\\\]|\\\\.)*'/,\n});\n\n// Template strings\n// Token order critical: TemplateHead/Middle/Tail must precede TemplateNoSub because Chevrotain matches first token that fits.\n// Without this order, '`foo${x}`' would incorrectly match TemplateNoSub instead of TemplateHead + expr + TemplateTail.\n// TemplateNoSub pattern must explicitly exclude ${ to prevent ambiguity between templates with/without interpolation.\nconst TemplateHead = createToken({\n name: 'TemplateHead',\n pattern: /`(?:[^`\\\\$]|\\\\.|\\$(?!\\{))*?\\$\\{/,\n});\nconst TemplateMiddle = createToken({\n name: 'TemplateMiddle',\n pattern: /\\}(?:[^`\\\\$]|\\\\.|\\$(?!\\{))*?\\$\\{/,\n});\nconst TemplateTail = createToken({\n name: 'TemplateTail',\n pattern: /\\}(?:[^`\\\\$]|\\\\.|\\$(?!\\{))*?`/,\n});\n// TemplateNoSub should NOT match strings that contain ${, so we exclude them explicitly\nconst TemplateNoSub = createToken({\n name: 'TemplateNoSub',\n pattern: /`(?:[^`\\\\$]|\\\\.|\\$(?!\\{))*?`/,\n});\n\nconst Hash = createToken({ name: 'Hash', pattern: /#/ }); // Current element in higher-order functions\n// Dollar ($) represents explicit reference in unary mode. Uses longer_alt: Identifier to ensure $-prefixed identifiers like '$myVar'\n// are tokenized as a single Identifier token rather than separate Dollar + Identifier tokens, since Identifier pattern includes '$' prefix.\nconst Dollar = createToken({ name: 'Dollar', pattern: /\\$/, longer_alt: Identifier });\n\n// Operators and delimiters\nconst Plus = createToken({ name: 'Plus', pattern: /\\+/ });\nconst Minus = createToken({ name: 'Minus', pattern: /-/ });\nconst Mult = createToken({ name: 'Mult', pattern: /\\*/ });\nconst Div = createToken({ name: 'Div', pattern: /\\// });\nconst Mod = createToken({ name: 'Mod', pattern: /%/ });\nconst Power = createToken({ name: 'Power', pattern: /\\^/ });\n\nconst LParen = createToken({ name: 'LParen', pattern: /\\(/ });\nconst RParen = createToken({ name: 'RParen', pattern: /\\)/ });\nconst LBracket = createToken({ name: 'LBracket', pattern: /\\[/ });\nconst RBracket = createToken({ name: 'RBracket', pattern: /\\]/ });\n\nconst LBrace = createToken({ name: 'LBrace', pattern: /\\{/ });\nconst RBrace = createToken({ name: 'RBrace', pattern: /\\}/ });\n\nconst Comma = createToken({ name: 'Comma', pattern: /,/ });\nconst Question = createToken({ name: 'Question', pattern: /\\?/, longer_alt: Identifier });\nconst QuestionQuestion = createToken({ name: 'QuestionQuestion', pattern: /\\?\\?/ });\nconst Colon = createToken({ name: 'Colon', pattern: /:/ });\n\nconst allTokens = [\n WhiteSpace,\n DotDot,\n Dot,\n EqEq,\n NotEqEq,\n Eq,\n NotEq,\n LtEq,\n GtEq,\n Lt,\n Gt,\n AndAnd,\n OrOr,\n NotNot,\n And,\n Or,\n Not,\n In,\n True,\n False,\n Null,\n Plus,\n Minus,\n Mult,\n Div,\n Mod,\n Power,\n LParen,\n RParen,\n LBracket,\n RBracket,\n LBrace,\n // Template tokens must come before RBrace so that TemplateTail/TemplateMiddle can match }\n TemplateHead,\n TemplateMiddle,\n TemplateTail,\n TemplateNoSub,\n RBrace,\n Comma,\n QuestionQuestion,\n Question,\n Colon,\n Hash,\n Dollar,\n NumberLiteral,\n StringLiteral,\n Identifier,\n];\n\n// === PARSER (precedence via rule layering) ===\n// Precedence (lowest to highest):\n// 1. Ternary: ? :\n// 2. Null coalescing: ??\n// 3. Logical OR: or\n// 4. Logical AND: and\n// 5. Comparison: ==, !=, <, >, <=, >=, in, not in\n// 6. Additive: +, -\n// 7. Multiplicative: *, /, %\n// 8. Power: ^ (RIGHT-ASSOCIATIVE)\n// 9. Unary: not, -\n// 10. Postfix: .property, [index], (call)\n// 11. Primary: literals, identifiers, parentheses\n\nclass ZenExpressionParser extends CstParser {\n constructor() {\n super(allTokens);\n this.performSelfAnalysis();\n }\n\n // Entry - ternary (lowest precedence)\n expression = this.RULE('expression', () => {\n this.SUBRULE(this.nullCoalescingExpression, { LABEL: 'condition' });\n this.OPTION(() => {\n this.CONSUME(Question);\n this.SUBRULE2(this.expression, { LABEL: 'consequent' });\n this.CONSUME(Colon);\n this.SUBRULE3(this.expression, { LABEL: 'alternate' });\n });\n });\n\n nullCoalescingExpression = this.RULE('nullCoalescingExpression', () => {\n this.SUBRULE(this.orExpression, { LABEL: 'lhs' });\n this.MANY(() => {\n this.CONSUME(QuestionQuestion);\n this.SUBRULE2(this.orExpression, { LABEL: 'rhs' });\n });\n });\n\n orExpression = this.RULE('orExpression', () => {\n this.SUBRULE(this.andExpression, { LABEL: 'lhs' });\n this.MANY(() => {\n this.OR([{ ALT: () => this.CONSUME(Or) }, { ALT: () => this.CONSUME(OrOr) }]);\n this.SUBRULE2(this.andExpression, { LABEL: 'rhs' });\n });\n });\n\n andExpression = this.RULE('andExpression', () => {\n this.SUBRULE(this.comparisonExpression, { LABEL: 'lhs' });\n this.MANY(() => {\n this.OR([{ ALT: () => this.CONSUME(And) }, { ALT: () => this.CONSUME(AndAnd) }]);\n this.SUBRULE2(this.comparisonExpression, { LABEL: 'rhs' });\n });\n });\n\n comparisonExpression = this.RULE('comparisonExpression', () => {\n this.SUBRULE(this.additiveExpression, { LABEL: 'lhs' });\n this.OPTION(() => {\n this.OR([\n { ALT: () => this.CONSUME(Eq) },\n { ALT: () => this.CONSUME(NotEq) },\n { ALT: () => this.CONSUME(Lt) },\n { ALT: () => this.CONSUME(Gt) },\n { ALT: () => this.CONSUME(LtEq) },\n { ALT: () => this.CONSUME(GtEq) },\n { ALT: () => this.CONSUME(In) },\n {\n ALT: () => {\n this.CONSUME(Not);\n this.CONSUME2(In);\n },\n }, // not in\n ]);\n this.SUBRULE2(this.additiveExpression, { LABEL: 'rhs' });\n });\n });\n\n additiveExpression = this.RULE('additiveExpression', () => {\n this.SUBRULE(this.multiplicativeExpression, { LABEL: 'lhs' });\n this.MANY(() => {\n this.OR([{ ALT: () => this.CONSUME(Plus) }, { ALT: () => this.CONSUME(Minus) }]);\n this.SUBRULE2(this.multiplicativeExpression, { LABEL: 'rhs' });\n });\n });\n\n multiplicativeExpression = this.RULE('multiplicativeExpression', () => {\n this.SUBRULE(this.powerExpression, { LABEL: 'lhs' });\n this.MANY(() => {\n this.OR([\n { ALT: () => this.CONSUME(Mult) },\n { ALT: () => this.CONSUME(Div) },\n { ALT: () => this.CONSUME(Mod) },\n ]);\n this.SUBRULE2(this.powerExpression, { LABEL: 'rhs' });\n });\n });\n\n // Power is RIGHT-ASSOCIATIVE to match mathematical convention:\n // e.g. 2^3^4 = 2^(3^4) = 2^81, not (2^3)^4 = 8^4 = 4096.\n // Use self-recursion instead of MANY for right-associativity\n powerExpression = this.RULE('powerExpression', () => {\n this.SUBRULE(this.unaryExpression, { LABEL: 'base' });\n this.OPTION(() => {\n this.CONSUME(Power);\n this.SUBRULE(this.powerExpression, { LABEL: 'exponent' }); // Self-recursion!\n });\n });\n\n unaryExpression = this.RULE('unaryExpression', () => {\n this.OR([\n {\n ALT: () => {\n this.CONSUME(Not);\n this.SUBRULE(this.unaryExpression, { LABEL: 'operand' });\n },\n },\n {\n ALT: () => {\n this.CONSUME(NotNot);\n this.SUBRULE2(this.unaryExpression, { LABEL: 'operand' });\n },\n },\n {\n ALT: () => {\n this.CONSUME(Minus);\n this.SUBRULE3(this.unaryExpression, { LABEL: 'operand' });\n },\n },\n { ALT: () => this.SUBRULE(this.postfixExpression) },\n ]);\n });\n\n // Postfix: .property, [index], (args)\n postfixExpression = this.RULE('postfixExpression', () => {\n this.SUBRULE(this.primaryExpression);\n this.MANY(() => {\n this.OR([\n {\n ALT: () => {\n this.CONSUME(Dot);\n this.CONSUME(Identifier, { LABEL: 'property' });\n },\n },\n {\n ALT: () => {\n this.CONSUME(LBracket);\n this.SUBRULE(this.expression, { LABEL: 'index' });\n this.CONSUME(RBracket);\n },\n },\n {\n ALT: () => {\n this.CONSUME(LParen);\n this.OPTION(() => this.SUBRULE(this.argumentList));\n this.CONSUME(RParen);\n },\n },\n ]);\n });\n });\n\n primaryExpression = this.RULE('primaryExpression', () => {\n this.OR([\n { ALT: () => this.CONSUME(NumberLiteral) },\n { ALT: () => this.CONSUME(StringLiteral) },\n { ALT: () => this.SUBRULE(this.templateLiteral) },\n { ALT: () => this.CONSUME(True) },\n { ALT: () => this.CONSUME(False) },\n { ALT: () => this.CONSUME(Null) },\n { ALT: () => this.CONSUME(Hash) }, // # for current element in higher-order functions\n { ALT: () => this.CONSUME(Dollar) }, // $ for explicit reference in unary mode\n { ALT: () => this.CONSUME(Identifier) },\n // Array literal: [1, 2, 3]\n {\n GATE: () => this.isArrayLiteralStart(),\n ALT: () => this.SUBRULE(this.arrayLiteralExpression),\n },\n // Object literal: {key: value, ...}\n {\n GATE: () => this.isObjectLiteralStart(),\n ALT: () => this.SUBRULE(this.objectLiteralExpression),\n },\n {\n ALT: () => {\n this.CONSUME(LParen);\n this.SUBRULE(this.expression);\n this.CONSUME(RParen);\n },\n },\n // Interval: use GATE to check for DotDot lookahead\n {\n GATE: () => this.isIntervalStart(),\n ALT: () => this.SUBRULE(this.intervalExpression),\n },\n ]);\n });\n\n // Template string: `Hello ${name}, you have ${count} items`\n templateLiteral = this.RULE('templateLiteral', () => {\n this.OR([\n // Simple template with no interpolation\n { ALT: () => this.CONSUME(TemplateNoSub) },\n // Template with interpolation\n {\n ALT: () => {\n this.CONSUME(TemplateHead);\n this.SUBRULE(this.expression, { LABEL: 'expr' });\n this.MANY(() => {\n this.CONSUME(TemplateMiddle);\n this.SUBRULE2(this.expression, { LABEL: 'expr' });\n });\n this.CONSUME(TemplateTail);\n },\n },\n ]);\n });\n\n // Interval: [a..b] or (a..b) with open/closed variations\n intervalExpression = this.RULE('intervalExpression', () => {\n this.OR([\n { ALT: () => this.CONSUME(LBracket, { LABEL: 'startBracket' }) },\n { ALT: () => this.CONSUME(LParen, { LABEL: 'startBracket' }) },\n ]);\n\n this.SUBRULE(this.expression, { LABEL: 'start' });\n this.CONSUME(DotDot);\n this.SUBRULE2(this.expression, { LABEL: 'end' });\n\n this.OR2([\n { ALT: () => this.CONSUME(RBracket, { LABEL: 'endBracket' }) },\n { ALT: () => this.CONSUME(RParen, { LABEL: 'endBracket' }) },\n ]);\n });\n\n // Array literal: [1, 2, 3] or []\n arrayLiteralExpression = this.RULE('arrayLiteralExpression', () => {\n this.CONSUME(LBracket);\n this.OPTION(() => this.SUBRULE(this.argumentList));\n this.CONSUME(RBracket);\n });\n\n // Object literal: {key: value, ...} or {}\n objectLiteralExpression = this.RULE('objectLiteralExpression', () => {\n this.CONSUME(LBrace);\n this.OPTION(() => this.SUBRULE(this.objectPropertyList));\n this.CONSUME(RBrace);\n });\n\n // Object property list for object literals\n objectPropertyList = this.RULE('objectPropertyList', () => {\n this.SUBRULE(this.objectProperty, { LABEL: 'prop' });\n this.MANY(() => {\n this.CONSUME(Comma);\n this.SUBRULE2(this.objectProperty, { LABEL: 'prop' });\n });\n });\n\n // Single object property: key: value\n objectProperty = this.RULE('objectProperty', () => {\n this.OR([\n { ALT: () => this.CONSUME(StringLiteral, { LABEL: 'key' }) },\n { ALT: () => this.CONSUME(Identifier, { LABEL: 'key' }) },\n ]);\n this.CONSUME(Colon);\n this.SUBRULE(this.expression, { LABEL: 'value' });\n });\n\n argumentList = this.RULE('argumentList', () => {\n this.SUBRULE(this.expression, { LABEL: 'arg' });\n this.MANY(() => {\n this.CONSUME(Comma);\n this.SUBRULE2(this.expression, { LABEL: 'arg' });\n });\n });\n\n // Helper: Check if current position starts an array literal\n // An array literal is [ followed by expressions and commas, then ]\n // We must distinguish [1,2] from [a..b]. An interval ALWAYS contains .. before closing\n private isArrayLiteralStart(): boolean {\n const lookahead = this.LA(1);\n if (!lookahead || lookahead.tokenType !== LBracket) {\n return false;\n }\n\n // Check if we have .. before a closing bracket (interval)\n // If yes, this is not an array literal\n return !this.isIntervalStart();\n }\n\n // Helper: Check if current position starts an object literal\n // An object literal is { followed by key:value pairs and commas, then }\n private isObjectLiteralStart(): boolean {\n const lookahead = this.LA(1);\n if (!lookahead || lookahead.tokenType !== LBrace) {\n return false;\n }\n return true;\n }\n\n // Helper: Check if current position starts an interval (lookahead for ..)\n // An interval is [expr..expr] or (expr..expr)\n //\n // We verify that after the start bracket, we'll eventually see .. before a closing bracket\n // O(n) lookahead required because interval syntax '[1..10]' is ambiguous with array literals\n // '[1,2,3]' - we must scan ahead to find '..' token to disambiguate, potentially examining\n // entire token stream for malformed input.\n private isIntervalStart(): boolean {\n const lookahead = this.LA(1);\n if (!lookahead) {\n return false;\n }\n const tokenType = lookahead.tokenType;\n\n // Only intervals start with [ or ( and must contain .. before closing\n if (tokenType !== LBracket && tokenType !== LParen) {\n return false;\n }\n\n // Look ahead through tokens to see if we find DotDot before a closing bracket\n // Note: Chevrotain's LA() returns EOF token (not null) when past end of input\n let depth = 0;\n let i = 0;\n while (true) {\n const token = this.LA(++i);\n // Check for end of input - LA() returns EOF token, not null\n if (!token || token.tokenType.name === 'EOF') {\n break;\n }\n\n const tt = token.tokenType;\n if (tt === LBracket || tt === LParen || tt === LBrace) {\n depth++;\n } else if (tt === RBracket || tt === RParen || tt === RBrace) {\n if (depth === 0) {\n // Found end before DotDot - not an interval\n return false;\n }\n depth--;\n } else if (tt === DotDot) {\n // Found DotDot before closing - this is an interval!\n return true;\n }\n }\n\n return false;\n }\n}\n\nexport const parser = new ZenExpressionParser();\nexport const lexer = new Lexer(allTokens);\n\n/**\n * Parse an expression string and return the CST.\n *\n * @param input - The expression string to parse\n * @param location - Optional source location for error reporting\n * @returns The Concrete Syntax Tree (CST)\n * @throws Error if the parse fails\n */\nexport function parseExpression(input: string, location?: SourceLocation): any {\n const lexResult = lexer.tokenize(input);\n\n if (lexResult.errors.length > 0) {\n throw new CompilationError(\n `Lexer error: ${lexResult.errors.map((e) => e.message).join(', ')}`,\n ErrorCode.PARSE_ERROR,\n location,\n { expression: input },\n );\n }\n\n parser.input = lexResult.tokens;\n const cst = parser.expression();\n\n if (parser.errors.length > 0) {\n throw new CompilationError(\n `Parse error: ${parser.errors.map((e) => e.message).join(', ')}`,\n ErrorCode.PARSE_ERROR,\n location,\n { expression: input },\n );\n }\n\n return cst;\n}\n\nexport type { IToken };\n","import { parser } from './expression-parser';\nimport {\n type ExpressionAST,\n type StringLiteral,\n type Interval,\n type TemplateLiteral,\n type ArrayLiteral,\n type ObjectLiteral,\n type BinaryOperator,\n} from './ast-types';\nimport type { CstNode } from 'chevrotain';\n\nconst BaseCstVisitor = parser.getBaseCstVisitorConstructor();\n\n/**\n * Converts Chevrotain CST to our AST format.\n */\nclass ExpressionAstBuilder extends BaseCstVisitor {\n constructor() {\n super();\n this.validateVisitor();\n }\n\n expression(ctx: any): ExpressionAST {\n const condition = this.visit(ctx.condition);\n\n if (ctx.Question) {\n return {\n type: 'TernaryOp',\n condition,\n consequent: this.visit(ctx.consequent),\n alternate: this.visit(ctx.alternate),\n };\n }\n\n return condition;\n }\n\n nullCoalescingExpression(ctx: any): ExpressionAST {\n let result = this.visit(ctx.lhs);\n\n if (ctx.rhs) {\n for (const rhsNode of ctx.rhs) {\n result = {\n type: 'BinaryOp',\n op: '??',\n left: result,\n right: this.visit(rhsNode),\n };\n }\n }\n\n return result;\n }\n\n orExpression(ctx: any): ExpressionAST {\n let result = this.visit(ctx.lhs);\n\n if (ctx.rhs) {\n for (const rhsNode of ctx.rhs) {\n result = {\n type: 'BinaryOp',\n op: 'or',\n left: result,\n right: this.visit(rhsNode),\n };\n }\n }\n\n return result;\n }\n\n andExpression(ctx: any): ExpressionAST {\n let result = this.visit(ctx.lhs);\n\n if (ctx.rhs) {\n for (const rhsNode of ctx.rhs) {\n result = {\n type: 'BinaryOp',\n op: 'and',\n left: result,\n right: this.visit(rhsNode),\n };\n }\n }\n\n return result;\n }\n\n comparisonExpression(ctx: any): ExpressionAST {\n const lhs = this.visit(ctx.lhs);\n\n if (!ctx.rhs) {\n return lhs;\n }\n\n // Determine operator\n let op: BinaryOperator;\n if (ctx.Eq) {\n op = '==';\n } else if (ctx.NotEq) {\n op = '!=';\n } else if (ctx.Lt) {\n op = '<';\n } else if (ctx.Gt) {\n op = '>';\n } else if (ctx.LtEq) {\n op = '<=';\n } else if (ctx.GtEq) {\n op = '>=';\n } else if (ctx.In) {\n op = ctx.Not ? 'not in' : 'in';\n } else {\n throw new Error('Unknown comparison operator');\n }\n\n return {\n type: 'BinaryOp',\n op,\n left: lhs,\n right: this.visit(ctx.rhs),\n };\n }\n\n additiveExpression(ctx: any): ExpressionAST {\n return this.buildLeftAssociativeBinaryOp(ctx, ['Plus', 'Minus'], ['+', '-']);\n }\n\n multiplicativeExpression(ctx: any): ExpressionAST {\n return this.buildLeftAssociativeBinaryOp(ctx, ['Mult', 'Div', 'Mod'], ['*', '/', '%']);\n }\n\n // Power is right-associative, handled differently via recursion in grammar\n powerExpression(ctx: any): ExpressionAST {\n const base = this.visit(ctx.base);\n\n if (ctx.exponent) {\n return {\n type: 'BinaryOp',\n op: '^',\n left: base,\n right: this.visit(ctx.exponent),\n };\n }\n\n return base;\n }\n\n unaryExpression(ctx: any): ExpressionAST {\n if (ctx.Not || ctx.NotNot) {\n return { type: 'UnaryOp', op: 'not', operand: this.visit(ctx.operand) };\n }\n if (ctx.Minus) {\n return { type: 'UnaryOp', op: '-', operand: this.visit(ctx.operand) };\n }\n return this.visit(ctx.postfixExpression);\n }\n\n postfixExpression(ctx: any): ExpressionAST {\n let result = this.visit(ctx.primaryExpression);\n\n // Collect all postfix operations with their source positions\n type PostfixOp =\n | { type: 'member'; offset: number; idx: number }\n | { type: 'index'; offset: number; idx: number }\n | { type: 'call'; offset: number; idx: number };\n\n const ops: PostfixOp[] = [];\n\n if (ctx.Dot) {\n for (let i = 0; i < ctx.Dot.length; i++) {\n ops.push({ type: 'member', offset: ctx.Dot[i].startOffset, idx: i });\n }\n }\n\n if (ctx.LBracket) {\n for (let i = 0; i < ctx.LBracket.length; i++) {\n ops.push({ type: 'index', offset: ctx.LBracket[i].startOffset, idx: i });\n }\n }\n\n if (ctx.LParen) {\n for (let i = 0; i < ctx.LParen.length; i++) {\n ops.push({ type: 'call', offset: ctx.LParen[i].startOffset, idx: i });\n }\n }\n\n // Sort by source position to apply in correct order: Chevrotain collects each operator\n // type separately, but the actual evaluation order depends on source position when multiple\n // operator types can appear.\n //\n // We must sort by position to reconstruct left-to-right evaluation order\n ops.sort((a, b) => a.offset - b.offset);\n\n // Apply each operation in order\n for (const op of ops) {\n if (op.type === 'member') {\n const prop = ctx.property[op.idx].image;\n result = { type: 'MemberAccess', object: result, property: prop };\n } else if (op.type === 'index') {\n const indexExpr = ctx.index[op.idx];\n result = { type: 'IndexAccess', object: result, index: this.visit(indexExpr) };\n } else if (op.type === 'call') {\n // Check if there's an argumentList for this call\n const args =\n ctx.argumentList && ctx.argumentList[op.idx] ? this.visit(ctx.argumentList[op.idx]) : [];\n result = { type: 'FunctionCall', callee: result, args };\n }\n }\n\n return result;\n }\n\n primaryExpression(ctx: any): ExpressionAST {\n if (ctx.NumberLiteral) {\n const raw = ctx.NumberLiteral[0].image.replace(/_/g, '');\n return { type: 'NumberLiteral', value: parseFloat(raw) };\n }\n if (ctx.StringLiteral) {\n const raw = ctx.StringLiteral[0].image;\n const value = this.unescapeString(raw.slice(1, -1));\n return { type: 'StringLiteral', value };\n }\n if (ctx.True) {\n return { type: 'BooleanLiteral', value: true };\n }\n if (ctx.False) {\n return { type: 'BooleanLiteral', value: false };\n }\n if (ctx.Null) {\n return { type: 'NullLiteral' };\n }\n if (ctx.Hash) {\n return { type: 'HashRef' };\n }\n if (ctx.Dollar) {\n return { type: 'DollarRef' };\n }\n if (ctx.Identifier) {\n return { type: 'Identifier', name: ctx.Identifier[0].image };\n }\n if (ctx.arrayLiteralExpression) {\n return this.visit(ctx.arrayLiteralExpression);\n }\n if (ctx.objectLiteralExpression) {\n return this.visit(ctx.objectLiteralExpression);\n }\n if (ctx.expression) {\n return this.visit(ctx.expression);\n }\n if (ctx.intervalExpression) {\n return this.visit(ctx.intervalExpression);\n }\n if (ctx.templateLiteral) {\n return this.visit(ctx.templateLiteral);\n }\n\n throw new Error('Unknown primary expression');\n }\n\n intervalExpression(ctx: any): Interval {\n const startBracket = ctx.startBracket[0];\n const endBracket = ctx.endBracket[0];\n\n return {\n type: 'Interval',\n start: this.visit(ctx.start) as ExpressionAST,\n end: this.visit(ctx.end) as ExpressionAST,\n startInclusive: startBracket.tokenType.name === 'LBracket',\n endInclusive: endBracket.tokenType.name === 'RBracket',\n };\n }\n\n arrayLiteralExpression(ctx: any): ArrayLiteral {\n if (!ctx.argumentList) {\n return { type: 'ArrayLiteral', elements: [] };\n }\n const args = this.visit(ctx.argumentList);\n return { type: 'ArrayLiteral', elements: args as ExpressionAST[] };\n }\n\n objectLiteralExpression(ctx: any): ObjectLiteral {\n if (!ctx.objectPropertyList) {\n return { type: 'ObjectLiteral', properties: [] };\n }\n const props = this.visit(ctx.objectPropertyList);\n return {\n type: 'ObjectLiteral',\n properties: props as Array<{ key: string; value: ExpressionAST }>,\n };\n }\n\n objectPropertyList(ctx: any): Array<{ key: string; value: ExpressionAST }> {\n return ctx.prop.map(\n (propNode: CstNode) => this.visit(propNode) as { key: string; value: ExpressionAST },\n );\n }\n\n objectProperty(ctx: any): { key: string; value: ExpressionAST } {\n const keyToken = ctx.key[0];\n const key =\n keyToken.tokenType.name === 'StringLiteral'\n ? this.unescapeString(keyToken.image.slice(1, -1))\n : keyToken.image;\n const value = this.visit(ctx.value) as ExpressionAST;\n return { key, value };\n }\n\n templateLiteral(ctx: any): TemplateLiteral | StringLiteral {\n // Handle simple template with no substitution\n if (ctx.TemplateNoSub) {\n const raw = ctx.TemplateNoSub[0].image;\n return { type: 'StringLiteral', value: this.unescapeString(raw.slice(1, -1)) };\n }\n\n // Handle template with interpolation\n const parts: Array<{ text: string } | { expr: ExpressionAST }> = [];\n\n // Extract text from TemplateHead (remove ` and ${)\n const headRaw = ctx.TemplateHead[0].image;\n const headText = this.unescapeString(headRaw.slice(1, -2));\n if (headText) {\n parts.push({ text: headText });\n }\n\n // Add expressions and middle parts\n for (let i = 0; i < ctx.expr.length; i++) {\n parts.push({ expr: this.visit(ctx.expr[i]) as ExpressionAST });\n\n if (ctx.TemplateMiddle && ctx.TemplateMiddle[i]) {\n const midRaw = ctx.TemplateMiddle[i].image;\n const midText = this.unescapeString(midRaw.slice(1, -2));\n if (midText) {\n parts.push({ text: midText });\n }\n }\n }\n\n // Extract text from TemplateTail (remove } and `)\n const tailRaw = ctx.TemplateTail[0].image;\n const tailText = this.unescapeString(tailRaw.slice(1, -1));\n if (tailText) {\n parts.push({ text: tailText });\n }\n\n // Template literals with no interpolation (just text) can be converted to simple string\n // literals, avoiding runtime template processing overhead.\n if (parts.every((p) => 'text' in p)) {\n const combined = parts.map((p) => (p as { text: string }).text).join('');\n return { type: 'StringLiteral', value: combined };\n }\n\n return { type: 'TemplateLiteral', parts };\n }\n\n argumentList(ctx: any): ExpressionAST[] {\n return ctx.arg.map((argNode: CstNode) => this.visit(argNode) as ExpressionAST);\n }\n\n /**\n * Helper to unescape string literals.\n * Handles basic escape sequences like \\n, \\t, \\\", \\', \\\\, etc.\n */\n private unescapeString(s: string): string {\n return s\n .replace(/\\\\n/g, '\\n')\n .replace(/\\\\t/g, '\\t')\n .replace(/\\\\r/g, '\\r')\n .replace(/\\\\'/g, \"'\")\n .replace(/\"/g, '\"')\n .replace(/\\\\\\\\/g, '\\\\');\n }\n\n /**\n * Helper for left-associative binary operators.\n * Collects all operator tokens, sorts them by position, and pairs them with RHS operands.\n */\n private buildLeftAssociativeBinaryOp(\n ctx: any,\n tokenNames: string[],\n ops: BinaryOperator[],\n ): ExpressionAST {\n let result = this.visit(ctx.lhs) as ExpressionAST;\n\n if (!ctx.rhs) {\n // No right-hand side: return just the left expression\n return result;\n }\n\n // Collect all operator tokens with their corresponding operator symbol\n const operatorTokens: Array<{ op: BinaryOperator; offset: number }> = [];\n for (let j = 0; j < tokenNames.length; j++) {\n const tokens = ctx[tokenNames[j]];\n if (tokens) {\n for (const token of tokens) {\n operatorTokens.push({ op: ops[j], offset: token.startOffset });\n }\n }\n }\n\n // Sort operators by their position in the source\n operatorTokens.sort((a, b) => a.offset - b.offset);\n\n // Build the expression tree left-to-right\n for (let i = 0; i < ctx.rhs.length; i++) {\n const op = operatorTokens[i]?.op;\n if (!op) {\n throw new Error(`Operator not found for ${tokenNames.join(', ')}`);\n }\n\n result = {\n type: 'BinaryOp',\n op,\n left: result,\n right: this.visit(ctx.rhs[i]) as ExpressionAST,\n };\n }\n\n return result;\n }\n}\n\nexport const astBuilder = new ExpressionAstBuilder();\n\n/**\n * Convert a CST (Concrete Syntax Tree) to an AST (Abstract Syntax Tree).\n * CST contains low-level parsing artifacts; AST simplifies structure for compilation\n *\n * @param cst - The CST from the Chevrotain parser\n * @returns The AST node\n */\nexport function cstToAst(cst: CstNode): ExpressionAST {\n return astBuilder.visit(cst);\n}\n","/**\n * Unary AST transformation utilities.\n *\n * This module provides AST-level transformations specific to unary (decision table)\n * context. These transformations are applied AFTER parsing to convert a standard AST\n * into an AST that reflects the semantic meaning in unary context.\n *\n * Key transformations:\n * - Bare identifiers → string literals (for implicit string matching)\n * - Comparison without LHS → $ comparison (e.g., \"> 100\" → \"$ > 100\")\n * - Multiple comma-separated values → OR chain\n *\n * This separates SEMANTIC transformations from SYNTACTIC parsing, keeping\n * the parser focused solely on syntax-to-AST conversion.\n */\n\nimport type { ExpressionAST, BinaryOperator, BinaryOp } from './ast-types';\n\n/**\n * Convert a bare Identifier node to a StringLiteral node.\n *\n * In decision table cells, unquoted words like \"premium\" are semantic values to match against,\n * not variable references. This prevents errors when authors write intuitive cell values without\n * quotes. This is a key DMN/JDM usability feature.\n *\n * This handles the common JDM/DMN convention where cell values like:\n * - premium means match the string \"premium\" (identifier → string)\n * - \"premium\" means match the string \"premium\" (already a string)\n *\n * We only convert top-level Identifiers. More complex expressions (member access,\n * function calls, etc.) are left as-is since they likely involve actual variables.\n *\n * @param ast - The AST node that may be an Identifier\n * @returns The AST node, with Identifier converted to StringLiteral if applicable\n */\nexport function convertIdentifierToStringLiteral(ast: ExpressionAST): ExpressionAST {\n if (ast.type === 'Identifier') {\n return { type: 'StringLiteral', value: (ast as { type: 'Identifier'; name: string }).name };\n }\n return ast;\n}\n\n/**\n * Wrap an AST value in a comparison with DollarRef (the implicit cell input).\n *\n * In unary context, expressions like \"> 100\" implicitly compare against the input value.\n * This function creates the full comparison AST: \"$ <op> <value>\".\n *\n * @param ast - The right-hand side value AST\n * @param op - The comparison operator\n * @returns A BinaryOp AST with DollarRef on the left\n */\nexport function wrapWithDollarComparison(ast: ExpressionAST, op: BinaryOperator): BinaryOp {\n return {\n type: 'BinaryOp',\n op,\n left: { type: 'DollarRef' },\n right: ast,\n };\n}\n\n/**\n * Create an equality comparison with implicit identifier-to-string conversion.\n *\n * This is the default transformation for unary values - they become equality\n * comparisons against the input value ($). For equality/inequality comparisons,\n * bare identifiers are converted to string literals.\n *\n * @param ast - The value to compare against\n * @param op - The equality operator (== or !=)\n * @returns A BinaryOp AST representing the equality comparison\n */\nexport function createEqualityComparison(ast: ExpressionAST, op: '==' | '!='): BinaryOp {\n const value = convertIdentifierToStringLiteral(ast);\n return wrapWithDollarComparison(value, op);\n}\n\n/**\n * Create an interval membership check.\n *\n * In unary context, interval notation like \"[1..10]\" becomes \"$ in [1..10]\".\n *\n * @param intervalAst - The interval AST node\n * @returns A BinaryOp AST representing the membership check\n */\nexport function createIntervalCheck(intervalAst: ExpressionAST): BinaryOp {\n return wrapWithDollarComparison(intervalAst, 'in');\n}\n\n/**\n * Create an array membership check.\n *\n * In unary context, array literals like \"['gold', 'platinum']\" become\n * \"$ in ['gold', 'platinum']\".\n *\n * @param arrayAst - The array literal AST node\n * @returns A BinaryOp AST representing the membership check\n */\nexport function createArrayMembershipCheck(arrayAst: ExpressionAST): BinaryOp {\n return wrapWithDollarComparison(arrayAst, 'in');\n}\n\n/**\n * Combine multiple expression ASTs into an OR chain.\n *\n * In unary context, comma-separated values represent OR semantics.\n * For example, \"a, b, c\" becomes \"$ == 'a' or $ == 'b' or $ == 'c'\".\n *\n * @param exprs - Array of expression ASTs to combine\n * @returns A single AST representing the OR of all expressions\n */\nexport function combineWithOr(exprs: ExpressionAST[]): ExpressionAST {\n if (exprs.length === 0) {\n return { type: 'BooleanLiteral', value: true };\n }\n if (exprs.length === 1) {\n return exprs[0];\n }\n return exprs.reduce((acc, expr) => ({\n type: 'BinaryOp',\n op: 'or',\n left: acc,\n right: expr,\n }));\n}\n\n/**\n * Combine multiple expression ASTs into an AND chain.\n *\n * Used for compound unary expressions like \">= 13 and < 15\".\n *\n * @param exprs - Array of expression ASTs to combine\n * @returns A single AST representing the AND of all expressions\n */\nexport function combineWithAnd(exprs: ExpressionAST[]): ExpressionAST {\n if (exprs.length === 0) {\n return { type: 'BooleanLiteral', value: true };\n }\n if (exprs.length === 1) {\n return exprs[0];\n }\n return exprs.reduce((acc, expr) => ({\n type: 'BinaryOp',\n op: 'and',\n left: acc,\n right: expr,\n }));\n}\n","/**\n * Unary expression parser for decision table cells.\n *\n * This module provides parsing for unary mode expressions, which are used in\n * decision table cells. The parser is responsible for SYNTACTIC analysis only -\n * converting text to AST nodes. Semantic transformations (like converting\n * identifiers to string literals) are handled by the unary-ast-transforms module.\n *\n * Separation of Concerns:\n * - This module: Tokenization, lexing, parsing (text → AST)\n * - unary-ast-transforms: Semantic transformations (AST → transformed AST)\n * - unary-transform: Dollar reference substitution for compilation (AST → compiled AST)\n */\n\nimport { parser, lexer } from './expression-parser';\nimport { type ExpressionAST, type BinaryOperator } from './ast-types';\nimport { cstToAst } from './cst-visitor';\nimport { CompilationError, ErrorCode, type SourceLocation } from './errors';\nimport {\n wrapWithDollarComparison,\n createEqualityComparison,\n createIntervalCheck,\n createArrayMembershipCheck,\n combineWithOr,\n combineWithAnd,\n} from './unary-ast-transforms';\n\n/**\n * Parse an expression in unary mode (for decision table cells).\n *\n * In DMN/JDM convention, decision table cells contain concise expressions that implicitly\n * compare against the input column value ($). This allows table authors to write \"premium\"\n * instead of \"$ == 'premium'\" or \"> 100\" instead of \"$ > 100\", making tables more readable.\n *\n * Unary mode transformations:\n * - \"admin\" -> $ == \"admin\"\n * - > 100 -> $ > 100\n * - [1..10] -> $ in [1..10]\n * - \"a\", \"b\", \"c\" -> $ == \"a\" or $ == \"b\" or $ == \"c\"\n * - $ > 100 -> $ > 100 (explicit $ disables transformations)\n *\n * @param input - The unary expression to parse\n * @returns The AST node\n */\nexport function parseUnaryExpression(input: string): ExpressionAST {\n const trimmed = input.trim();\n\n // Empty cell = always matches\n if (trimmed === '' || trimmed === '-') {\n return { type: 'BooleanLiteral', value: true };\n }\n\n // Check if expression uses explicit $ - if so, parse as standard expression\n if (trimmed.includes('$')) {\n return parseStandardExpression(trimmed);\n }\n\n // Check for comma-separated values (OR semantics)\n // But only if it's not an array literal\n if (trimmed.includes(',') && !isArrayLiteral(trimmed)) {\n const parts = splitByComma(trimmed);\n const comparisons = parts.map((part) => transformUnaryPart(part.trim()));\n return combineWithOr(comparisons);\n }\n\n // Check for compound expressions with 'and' or 'or' that need implicit $ expansion\n // e.g., \">= 13 and < 15\" should become \"$ >= 13 and $ < 15\"\n const compoundResult = parseCompoundUnary(trimmed);\n if (compoundResult) {\n return compoundResult;\n }\n\n return transformUnaryPart(trimmed);\n}\n\n/**\n * Parse a single unary part and apply semantic transformations.\n *\n * This function performs both parsing and transformation in a single step:\n * 1. Parse the input using the standard expression parser\n * 2. Apply unary-context semantic transformations (AST operations)\n *\n * @param input - The unary part to parse\n * @returns The transformed AST node\n */\nfunction transformUnaryPart(input: string): ExpressionAST {\n // Check for comparison operator at start\n const comparisonMatch = input.match(/^(==|!=|<=|>=|<|>)\\s*(.+)$/);\n if (comparisonMatch) {\n const [, op, valueExpr] = comparisonMatch;\n const value = parseStandardExpression(valueExpr);\n // For equality/inequality comparisons, convert bare identifiers to strings\n if (op === '==' || op === '!=') {\n return createEqualityComparison(value, op as '==' | '!=');\n }\n return wrapWithDollarComparison(value, op as BinaryOperator);\n }\n\n // Check for interval notation\n if (input.match(/^[[].+\\.\\..*[\\])]$/)) {\n const intervalAst = parseStandardExpression(input);\n return createIntervalCheck(intervalAst);\n }\n\n // Check for array literal - use 'in' for membership\n // e.g., \"['gold', 'platinum']\" should become \"$ in ['gold', 'platinum']\"\n if (isArrayLiteral(input)) {\n const arrayAst = parseStandardExpression(input);\n return createArrayMembershipCheck(arrayAst);\n }\n\n // Default: equality comparison\n // Convert bare identifiers to string literals for implicit equality\n const value = parseStandardExpression(input);\n return createEqualityComparison(value, '==');\n}\n\n/**\n * Parse compound unary expressions that use 'and' or 'or' with implicit $\n * Examples:\n * - \">= 13 and < 15\" -> \"$ >= 13 and $ < 15\"\n * - \"> 0 or == null\" -> \"$ > 0 or $ == null\"\n *\n * @param input - The expression to parse\n * @returns The AST if compound, null otherwise\n */\nfunction parseCompoundUnary(input: string): ExpressionAST | null {\n // Match patterns like: <op1> <val1> and/or <op2> <val2>\n // We need to split by ' and ' or ' or ' while preserving quotes and brackets\n const andParts = splitByLogicalOp(input, 'and');\n if (andParts.length > 1) {\n const comparisons = andParts.map((part) => transformUnaryPart(part.trim()));\n return combineWithAnd(comparisons);\n }\n\n const orParts = splitByLogicalOp(input, 'or');\n if (orParts.length > 1) {\n const comparisons = orParts.map((part) => transformUnaryPart(part.trim()));\n return combineWithOr(comparisons);\n }\n\n return null;\n}\n\n/**\n * Split input by a logical operator (' and ' or ' or '), respecting quotes and brackets.\n *\n * This is a parsing helper that performs tokenization while respecting nested structures.\n */\nfunction splitByLogicalOp(input: string, op: 'and' | 'or'): string[] {\n const pattern = ` ${op} `;\n const parts: string[] = [];\n let current = '';\n let depth = 0;\n let inString = false;\n let stringChar = '';\n let i = 0;\n\n while (i < input.length) {\n const char = input[i];\n\n if (inString) {\n current += char;\n if (char === stringChar && input[i - 1] !== '\\\\') {\n inString = false;\n }\n i++;\n continue;\n }\n\n if (char === '\"' || char === \"'\") {\n inString = true;\n stringChar = char;\n current += char;\n i++;\n } else if (char === '[' || char === '(' || char === '{') {\n depth++;\n current += char;\n i++;\n } else if (char === ']' || char === ')' || char === '}') {\n depth--;\n current += char;\n i++;\n } else if (depth === 0 && input.substring(i, i + pattern.length).toLowerCase() === pattern) {\n parts.push(current);\n current = '';\n i += pattern.length;\n } else {\n current += char;\n i++;\n }\n }\n\n if (current) {\n parts.push(current);\n }\n return parts;\n}\n\n/**\n * Check if a string represents an array literal (not an interval).\n *\n * Arrays and intervals both use bracket syntax but have different semantics.\n * Arrays check membership ($ in [1,2,3]), intervals check ranges ($ in [1..10]).\n * Must detect .. to parse correctly.\n */\nfunction isArrayLiteral(input: string): boolean {\n return input.startsWith('[') && input.endsWith(']') && !input.includes('..');\n}\n\n/**\n * Smart split by comma that respects brackets and strings.\n *\n * This is a parsing helper for tokenizing comma-separated unary values\n * while respecting nested structures.\n *\n * Examples:\n * - \"a, b, c\" -> [\"a\", \"b\", \"c\"]\n * - \"[1, 2], [3, 4]\" -> [\"[1, 2]\", \"[3, 4]\"]\n * - '\"a, b\", \"c, d\"' -> ['\"a, b\"', '\"c, d\"']\n */\nfunction splitByComma(input: string): string[] {\n const parts: string[] = [];\n let current = '';\n let depth = 0;\n let inString = false;\n let stringChar = '';\n\n for (let i = 0; i < input.length; i++) {\n const char = input[i];\n\n if (inString) {\n current += char;\n // Check if string ends (and handle escaped quotes)\n if (char === stringChar && input[i - 1] !== '\\\\') {\n inString = false;\n }\n continue;\n }\n\n if (char === '\"' || char === \"'\") {\n inString = true;\n stringChar = char;\n current += char;\n } else if (char === '[' || char === '(') {\n depth++;\n current += char;\n } else if (char === ']' || char === ')') {\n depth--;\n current += char;\n } else if (char === ',' && depth === 0) {\n parts.push(current);\n current = '';\n } else {\n current += char;\n }\n }\n\n if (current) {\n parts.push(current);\n }\n return parts;\n}\n\n/**\n * Parse a standard (non-unary) expression.\n *\n * This is the core parsing function that converts an expression string to an AST.\n * It uses the Chevrotain lexer and parser defined in expression-parser.ts,\n * then converts the CST to AST using cst-visitor.ts.\n *\n * @param input - The expression string to parse\n * @param location - Optional source location for error reporting\n * @returns The AST node\n */\nexport function parseStandardExpression(input: string, location?: SourceLocation): ExpressionAST {\n const lexingResult = lexer.tokenize(input);\n\n if (lexingResult.errors.length > 0) {\n throw new CompilationError(\n `Lexer error: ${lexingResult.errors.map((e: any) => e.message).join(', ')}`,\n ErrorCode.PARSE_ERROR,\n location,\n { expression: input },\n );\n }\n\n parser.input = lexingResult.tokens;\n const cst = parser.expression();\n\n if (parser.errors.length > 0) {\n throw new CompilationError(\n `Parse error: ${parser.errors.map((e: any) => e.message).join(', ')}`,\n ErrorCode.PARSE_ERROR,\n location,\n { expression: input },\n );\n }\n\n return cstToAst(cst);\n}\n","/**\n * Optimization Pipeline for JDM to WebAssembly Compilation\n *\n * This module defines the interface for optimization passes and the runner\n * that applies them sequentially to transform the compiled AST into an\n * optimized form before code generation.\n */\n\nimport { type JDMDecision, type JDMNode, NodeType } from './parser';\nimport {\n type ExpressionAST,\n type NumberLiteral,\n type StringLiteral,\n type BooleanLiteral,\n isNumberLiteral,\n isStringLiteral,\n isBooleanLiteral,\n isNullLiteral,\n isBinaryOp,\n isUnaryOp,\n isTernaryOp,\n} from './ast-types';\nimport { parseStandardExpression, parseUnaryExpression } from './unary-parser';\n\n/**\n * Cache for parsed expression ASTs.\n * Maps expression strings to their parsed AST nodes to avoid redundant parsing.\n */\ntype ExpressionCache = Map<string, ExpressionAST>;\n\n/**\n * Compiled AST - the intermediate representation after parsing.\n *\n * JDMDecision structure is simple enough for in-place transformation, avoiding the\n * complexity and memory overhead of building a separate intermediate representation.\n */\nexport type CompiledAST = JDMDecision;\n\n/**\n * Interface for an optimization pass.\n *\n * Each optimization pass receives the compiled AST and returns a\n * potentially modified/optimized AST.\n */\nexport interface OptimizationPass {\n /** Human-readable name of the optimization pass */\n name: string;\n\n /**\n * Run the optimization pass on the given AST.\n *\n * @param ast - The compiled AST to optimize\n * @returns The optimized AST\n */\n run(ast: CompiledAST): CompiledAST;\n}\n\n/**\n * Ordered list of optimization passes.\n *\n * Passes have dependencies - one pass may create opportunities for the next. For example,\n * constant folding might convert \"if (2 > 3)\" to \"if (false)\", then dead code elimination\n * removes the unreachable branch. Running DCE before folding would miss this optimization.\n */\nexport const optimizer: OptimizationPass[] = [\n { name: 'Constant Folding', run: constantFolding },\n { name: 'Dead Code Elimination', run: deadCodeElimination },\n { name: 'Expression Inlining', run: expressionInlining },\n { name: 'Table Indexing', run: tableIndexing },\n];\n\n/**\n * Run all optimization passes sequentially on the given AST.\n *\n * @param ast - The compiled AST to optimize\n * @returns The fully optimized AST\n */\nexport function runOptimizations(ast: CompiledAST): CompiledAST {\n let optimized = ast;\n\n for (const pass of optimizer) {\n optimized = pass.run(optimized);\n }\n\n return optimized;\n}\n\n// ============================================================================\n// Expression Cache Utilities\n// ============================================================================\n\n/**\n * Get the expression cache for a node, creating it if it doesn't exist.\n */\nfunction getExpressionCache(node: JDMNode): ExpressionCache {\n if (!node.parsedContent) {\n node.parsedContent = {};\n }\n if (!node.parsedContent._cachedExprs) {\n node.parsedContent._cachedExprs = new Map<string, ExpressionAST>();\n }\n return node.parsedContent._cachedExprs as ExpressionCache;\n}\n\n/**\n * Parse an expression with caching.\n * Checks the cache first, and only parses if not found.\n */\nfunction cachedParseUnary(node: JDMNode, expr: string): ExpressionAST {\n const cache = getExpressionCache(node);\n const cached = cache.get(expr);\n if (cached) {\n return cached;\n }\n const parsed = parseUnaryExpression(expr);\n cache.set(expr, parsed);\n return parsed;\n}\n\n/**\n * Parse a standard expression with caching.\n * Checks the cache first, and only parses if not found.\n */\nfunction cachedParseStandard(node: JDMNode, expr: string): ExpressionAST {\n const cache = getExpressionCache(node);\n const cached = cache.get(expr);\n if (cached) {\n return cached;\n }\n const parsed = parseStandardExpression(expr);\n cache.set(expr, parsed);\n return parsed;\n}\n\n/**\n * Clear the expression cache for a node.\n * Should be called when the node's expressions are modified.\n */\nfunction clearExpressionCache(node: JDMNode): void {\n if (node.parsedContent && node.parsedContent._cachedExprs) {\n node.parsedContent._cachedExprs.clear();\n }\n}\n\n// Export individual optimization passes for testing\nexport { constantFolding, deadCodeElimination, expressionInlining, tableIndexing };\n\n// Export cache utilities for testing\nexport { getExpressionCache, clearExpressionCache };\n\n// ============================================================================\n// Constant Folding\n// ============================================================================\n\n/**\n * Fold constant expressions at compile time.\n *\n * This pass traverses expression ASTs and evaluates them at compile time\n * when possible. Examples:\n * - Replace (2 + 3) with 5\n * - Replace true and false with false\n * - Replace \"hello\" + \" world\" with \"hello world\"\n *\n * @param ast - The compiled AST to optimize\n * @returns The AST with folded constants\n */\nfunction constantFolding(ast: CompiledAST): CompiledAST {\n // Create a deep copy to avoid mutating the original\n const optimized = JSON.parse(JSON.stringify(ast)) as JDMDecision;\n\n // Apply constant folding to each node's expression content\n optimized.nodes = optimized.nodes.map((node: JDMNode) => foldNodeExpressions(node));\n\n return optimized;\n}\n\n/**\n * Apply constant folding to expressions within a node.\n */\nfunction foldNodeExpressions(node: JDMNode): JDMNode {\n if (!node.content) {\n return node;\n }\n\n const content = node.content;\n\n // Handle decision table nodes\n if (node.type === NodeType.DECISION_TABLE) {\n return foldDecisionTableExpressions(node, content);\n }\n\n // Handle switch nodes\n if (node.type === NodeType.SWITCH) {\n return foldSwitchExpressions(node, content);\n }\n\n // Handle expression nodes\n if (node.type === NodeType.EXPRESSION) {\n return foldExpressionNode(node, content);\n }\n\n return node;\n}\n\n/**\n * Fold expressions in a decision table node.\n */\nfunction foldDecisionTableExpressions(node: JDMNode, content: Record<string, unknown>): JDMNode {\n const { rules, inputs } = content as { rules: any[]; inputs: any[] };\n let modified = false;\n\n // Update each rule's input conditions with folded expressions\n const foldedRules = rules.map((rule: Record<string, unknown>) => {\n const foldedRule = { ...rule };\n\n for (const input of inputs) {\n const expr = rule[input.id] as string | undefined;\n if (!expr || expr === '' || expr === '-') {\n continue;\n }\n\n // Parse the expression in unary mode (using cache)\n try {\n const ast = cachedParseUnary(node, expr);\n const folded = foldExpression(ast);\n\n // If folding succeeded, update the expression string\n if (folded !== null && isLiteral(folded)) {\n const newExpr = literalToExprString(folded);\n if (newExpr !== expr) {\n foldedRule[input.id] = newExpr;\n modified = true;\n }\n }\n } catch {\n // If expression can't be parsed or folded, keep original\n }\n }\n\n return foldedRule;\n });\n\n // Clear cache if expressions were modified\n if (modified) {\n clearExpressionCache(node);\n }\n\n return {\n ...node,\n content: {\n ...content,\n rules: foldedRules,\n },\n };\n}\n\n/**\n * Fold expressions in a switch node.\n */\nfunction foldSwitchExpressions(node: JDMNode, content: any): JDMNode {\n const { conditions } = content;\n let modified = false;\n\n const foldedConditions = conditions.map((condition: any) => {\n const expr = condition.expression;\n if (!expr || expr === '') {\n return condition;\n }\n\n try {\n const ast = cachedParseStandard(node, expr);\n const folded = foldExpression(ast);\n\n if (folded !== null && isLiteral(folded)) {\n const newExpr = literalToExprString(folded);\n if (newExpr !== expr) {\n modified = true;\n return {\n ...condition,\n expression: newExpr,\n };\n }\n }\n } catch {\n // If expression can't be parsed or folded, keep original\n }\n\n return condition;\n });\n\n // Clear cache if expressions were modified\n if (modified) {\n clearExpressionCache(node);\n }\n\n return {\n ...node,\n content: {\n ...content,\n conditions: foldedConditions,\n },\n };\n}\n\n/**\n * Fold expressions in an expression node.\n */\nfunction foldExpressionNode(node: JDMNode, content: any): JDMNode {\n const expr = content.expression;\n if (!expr) {\n return node;\n }\n\n try {\n const ast = cachedParseStandard(node, expr);\n const folded = foldExpression(ast);\n\n if (folded !== null && isLiteral(folded)) {\n const newExpr = literalToExprString(folded);\n if (newExpr !== expr) {\n // Clear cache since we're modifying the expression\n clearExpressionCache(node);\n return {\n ...node,\n content: {\n ...content,\n expression: newExpr,\n },\n };\n }\n }\n } catch {\n // If expression can't be parsed or folded, keep original\n }\n\n return node;\n}\n\n/**\n * Recursively fold an expression AST.\n * Returns the folded AST node, or null if folding is not possible.\n */\nfunction foldExpression(expr: ExpressionAST): ExpressionAST | null {\n if (isLiteralExpr(expr)) {\n return expr;\n }\n\n if (isBinaryOp(expr)) {\n const leftFolded = foldExpression(expr.left);\n const rightFolded = foldExpression(expr.right);\n\n // If both sides are literals, try to evaluate at compilation time\n if (leftFolded && rightFolded && isLiteral(leftFolded) && isLiteral(rightFolded)) {\n const result = evaluateConstantBinaryOp(expr.op, leftFolded, rightFolded);\n if (result !== null) {\n return result;\n }\n }\n\n return {\n ...expr,\n left: leftFolded || expr.left,\n right: rightFolded || expr.right,\n };\n }\n\n if (isUnaryOp(expr)) {\n const operandFolded = foldExpression(expr.operand);\n\n if (operandFolded && isLiteral(operandFolded)) {\n const result = evaluateConstantUnaryOp(expr.op, operandFolded);\n if (result !== null) {\n return result;\n }\n }\n\n return {\n ...expr,\n operand: operandFolded || expr.operand,\n };\n }\n\n if (isTernaryOp(expr)) {\n const conditionFolded = foldExpression(expr.condition);\n const consequentFolded = foldExpression(expr.consequent);\n const alternateFolded = foldExpression(expr.alternate);\n\n if (conditionFolded && isLiteral(conditionFolded) && isBooleanLiteral(conditionFolded)) {\n return conditionFolded.value\n ? consequentFolded || expr.consequent\n : alternateFolded || expr.alternate;\n }\n\n return {\n ...expr,\n condition: conditionFolded || expr.condition,\n consequent: consequentFolded || expr.consequent,\n alternate: alternateFolded || expr.alternate,\n };\n }\n\n // Can't fold other expression types (identifiers, function calls, etc.)\n return null;\n}\n\n/**\n * Check if an expression is a literal value.\n */\nfunction isLiteralExpr(expr: ExpressionAST): boolean {\n return (\n isNumberLiteral(expr) || isStringLiteral(expr) || isBooleanLiteral(expr) || isNullLiteral(expr)\n );\n}\n\n/**\n * Check if a node is a literal.\n */\nfunction isLiteral(\n node: ExpressionAST | null,\n): node is NumberLiteral | StringLiteral | BooleanLiteral {\n return node !== null && isLiteralExpr(node);\n}\n\n/**\n * Evaluate a binary operation with constant operands.\n */\nfunction evaluateConstantBinaryOp(\n op: string,\n left: NumberLiteral | StringLiteral | BooleanLiteral,\n right: NumberLiteral | StringLiteral | BooleanLiteral,\n): ExpressionAST | null {\n // Numeric operations\n if (isNumberLiteral(left) && isNumberLiteral(right)) {\n switch (op) {\n case '+':\n return { type: 'NumberLiteral', value: left.value + right.value };\n case '-':\n return { type: 'NumberLiteral', value: left.value - right.value };\n case '*':\n return { type: 'NumberLiteral', value: left.value * right.value };\n case '/':\n return { type: 'NumberLiteral', value: left.value / right.value };\n case '%':\n return { type: 'NumberLiteral', value: left.value % right.value };\n case '^':\n return { type: 'NumberLiteral', value: Math.pow(left.value, right.value) };\n case '<':\n return { type: 'BooleanLiteral', value: left.value < right.value };\n case '>':\n return { type: 'BooleanLiteral', value: left.value > right.value };\n case '<=':\n return { type: 'BooleanLiteral', value: left.value <= right.value };\n case '>=':\n return { type: 'BooleanLiteral', value: left.value >= right.value };\n case '==':\n return { type: 'BooleanLiteral', value: left.value === right.value };\n case '!=':\n return { type: 'BooleanLiteral', value: left.value !== right.value };\n }\n }\n\n // String operations\n if (isStringLiteral(left) && isStringLiteral(right)) {\n switch (op) {\n case '+':\n return { type: 'StringLiteral', value: left.value + right.value };\n case '==':\n return { type: 'BooleanLiteral', value: left.value === right.value };\n case '!=':\n return { type: 'BooleanLiteral', value: left.value !== right.value };\n }\n }\n\n // Boolean operations\n if (isBooleanLiteral(left) && isBooleanLiteral(right)) {\n switch (op) {\n case 'and':\n return { type: 'BooleanLiteral', value: left.value && right.value };\n case 'or':\n return { type: 'BooleanLiteral', value: left.value || right.value };\n case '==':\n return { type: 'BooleanLiteral', value: left.value === right.value };\n case '!=':\n return { type: 'BooleanLiteral', value: left.value !== right.value };\n }\n }\n\n return null;\n}\n\n/**\n * Evaluate a unary operation with a constant operand.\n */\nfunction evaluateConstantUnaryOp(\n op: string,\n operand: NumberLiteral | StringLiteral | BooleanLiteral,\n): ExpressionAST | null {\n if (op === 'not' && isBooleanLiteral(operand)) {\n return { type: 'BooleanLiteral', value: !operand.value };\n }\n\n if (op === '-' && isNumberLiteral(operand)) {\n return { type: 'NumberLiteral', value: -operand.value };\n }\n\n return null;\n}\n\n/**\n * Convert a literal AST node to its string representation.\n */\nfunction literalToExprString(node: NumberLiteral | StringLiteral | BooleanLiteral): string {\n switch (node.type) {\n case 'NumberLiteral':\n return String(node.value);\n case 'StringLiteral':\n return `\"${node.value}\"`;\n case 'BooleanLiteral':\n return String(node.value);\n }\n}\n\n// ============================================================================\n// Dead Code Elimination\n// ============================================================================\n\n/**\n * Remove unreachable code.\n *\n * This pass identifies and removes branches that can never be reached.\n * Examples:\n * - Remove if branches with constant false conditions\n * - Remove decision table rows with always-false conditions\n * - Remove decision table rows that can never match after previous rows\n *\n * @param ast - The compiled AST to optimize\n * @returns The AST with dead code removed\n */\nfunction deadCodeElimination(ast: CompiledAST): CompiledAST {\n const optimized = JSON.parse(JSON.stringify(ast)) as JDMDecision;\n\n optimized.nodes = optimized.nodes.map((node: JDMNode) => eliminateDeadCodeInNode(node));\n\n return optimized;\n}\n\n/**\n * Apply dead code elimination to a node.\n */\nfunction eliminateDeadCodeInNode(node: JDMNode): JDMNode {\n if (!node.content) {\n return node;\n }\n\n const content = node.content;\n\n if (node.type === NodeType.DECISION_TABLE) {\n return eliminateDeadCodeInDecisionTable(node, content);\n }\n\n if (node.type === NodeType.SWITCH) {\n return eliminateDeadCodeInSwitch(node, content);\n }\n\n return node;\n}\n\n/**\n * Check if a unary expression is always false.\n * In unary mode, \"false\" is equivalent to \"$ == false\".\n */\nfunction isUnaryAlwaysFalse(expr: ExpressionAST): boolean {\n if (isBinaryOp(expr) && expr.op === '==') {\n const leftIsDollar = expr.left.type === 'DollarRef';\n const rightIsFalse = isBooleanLiteral(expr.right) && !expr.right.value;\n return leftIsDollar && rightIsFalse;\n }\n\n if (isBinaryOp(expr) && expr.op === '!=') {\n const leftIsDollar = expr.left.type === 'DollarRef';\n const rightIsTrue = isBooleanLiteral(expr.right) && expr.right.value;\n return leftIsDollar && rightIsTrue;\n }\n\n return false;\n}\n\n/**\n * Eliminate dead code in decision table nodes.\n */\nfunction eliminateDeadCodeInSwitch(node: JDMNode, content: any): JDMNode {\n const { conditions } = content;\n\n // Filter out conditions that are always false\n const liveConditions = conditions.filter((condition: any) => {\n const expr = condition.expression;\n if (!expr || expr === '') {\n return true;\n }\n\n try {\n const parsed = cachedParseStandard(node, expr);\n\n if (isBooleanLiteral(parsed) && !parsed.value) {\n return false;\n }\n } catch {}\n\n return true;\n });\n\n return {\n ...node,\n content: {\n ...content,\n conditions: liveConditions,\n },\n };\n}\n\n/**\n * Eliminate dead code in decision table nodes.\n */\nfunction eliminateDeadCodeInDecisionTable(node: JDMNode, content: any): JDMNode {\n const { rules, inputs } = content;\n\n // Filter out rules that have a non-trivial always-false condition\n const liveRules = rules.filter((rule: any) => {\n for (const input of inputs) {\n const expr = rule[input.id];\n if (!expr || expr === '' || expr === '-') {\n continue;\n }\n\n try {\n const parsed = cachedParseUnary(node, expr);\n\n // Check if this is a boolean literal (not common in unary mode, but possible)\n if (isBooleanLiteral(parsed) && !parsed.value) {\n return false;\n }\n\n // Check if this is a unary expression that's always false\n // e.g., \"false\" in a decision table cell is interpreted as \"$ == false\"\n if (isUnaryAlwaysFalse(parsed)) {\n return false;\n }\n } catch {\n // If we can't parse it, assume the rule is live\n }\n }\n\n return true;\n });\n\n return {\n ...node,\n content: {\n ...content,\n rules: liveRules,\n },\n };\n}\n\n// ============================================================================\n// Expression Inlining\n// ============================================================================\n\n/**\n * Inline small expressions.\n *\n * This pass replaces function calls with evaluated results for pure functions.\n * Examples:\n * - Inline small arithmetic operations in decision table cells\n * - Pre-evaluate expressions that don't depend on runtime values\n *\n * @param ast - The compiled AST to optimize\n * @returns The AST with inlined expressions\n */\nfunction expressionInlining(ast: CompiledAST): CompiledAST {\n // Create a deep copy to avoid mutating the original\n const optimized = JSON.parse(JSON.stringify(ast)) as JDMDecision;\n\n // Only functions without side effects can be safely evaluated at compile time. Arithmetic\n // (sum, max, min, abs, floor, ceil, round) and string functions (upper, lower, len) are\n // pure and deterministic, so their results with constant inputs are predictable.\n optimized.nodes = optimized.nodes.map((node: JDMNode) => inlineExpressionsInNode(node));\n\n return optimized;\n}\n\n/**\n * Apply expression inlining to a node.\n */\nfunction inlineExpressionsInNode(node: JDMNode): JDMNode {\n if (!node.content) {\n return node;\n }\n\n const content = node.content;\n\n // Handle decision table nodes\n if (node.type === NodeType.DECISION_TABLE && content && content.rules && content.inputs) {\n return inlineDecisionTableExpressions(node, content);\n }\n\n return node;\n}\n\n/**\n * Inline expressions in decision table nodes.\n */\nfunction inlineDecisionTableExpressions(node: JDMNode, content: any): JDMNode {\n const { rules, inputs } = content;\n\n const inlinedRules = rules.map((rule: any) => {\n const inlinedRule = { ...rule };\n\n for (const input of inputs) {\n const expr = rule[input.id];\n if (!expr || expr === '' || expr === '-') {\n continue;\n }\n\n const inlined = tryInlineExpression(expr);\n if (inlined !== expr) {\n inlinedRule[input.id] = inlined;\n }\n }\n\n return inlinedRule;\n });\n\n return {\n ...node,\n content: {\n ...content,\n rules: inlinedRules,\n },\n };\n}\n\n/**\n * Try to inline an expression by evaluating simple pure function calls.\n * Returns the inlined expression string, or the original if inlining is not possible.\n */\nfunction tryInlineExpression(expr: string): string {\n const trimmed = expr.trim();\n\n // Inline simple arithmetic operations wrapped in function notation\n // Examples: sum(2, 3) → 5, min(10, 5) → 5, abs(-5) → 5, upper(\"hello\") → \"HELLO\"\n\n // Match sum(a, b, ...) pattern where all arguments are numeric literals\n const sumMatch = trimmed.match(/^sum\\((.+)\\)$/i);\n if (sumMatch) {\n const args = sumMatch[1].split(',').map((s: string) => s.trim());\n if (args.every((arg: string) => /^-?\\d+\\.?\\d*$/.test(arg))) {\n const sum = args.reduce((acc: number, arg: string) => acc + parseFloat(arg), 0);\n return String(sum);\n }\n }\n\n // Match max(a, b) pattern where both arguments are numeric literals\n const maxMatch = trimmed.match(/^max\\((.+),(.+)\\)$/i);\n if (maxMatch) {\n const [_, arg1, arg2] = maxMatch;\n const num1 = parseFloat(arg1.trim());\n const num2 = parseFloat(arg2.trim());\n if (!isNaN(num1) && !isNaN(num2)) {\n return String(Math.max(num1, num2));\n }\n }\n\n // Match min(a, b) pattern where both arguments are numeric literals\n const minMatch = trimmed.match(/^min\\((.+),(.+)\\)$/i);\n if (minMatch) {\n const [_, arg1, arg2] = minMatch;\n const num1 = parseFloat(arg1.trim());\n const num2 = parseFloat(arg2.trim());\n if (!isNaN(num1) && !isNaN(num2)) {\n return String(Math.min(num1, num2));\n }\n }\n\n // Match abs(a) pattern where argument is a numeric literal\n const absMatch = trimmed.match(/^abs\\((.+)\\)$/i);\n if (absMatch) {\n const val = parseFloat(absMatch[1].trim());\n if (!isNaN(val)) {\n return String(Math.abs(val));\n }\n }\n\n // Match floor(a) pattern where argument is a numeric literal\n const floorMatch = trimmed.match(/^floor\\((.+)\\)$/i);\n if (floorMatch) {\n const val = parseFloat(floorMatch[1].trim());\n if (!isNaN(val)) {\n return String(Math.floor(val));\n }\n }\n\n // Match ceil(a) pattern where argument is a numeric literal\n const ceilMatch = trimmed.match(/^ceil\\((.+)\\)$/i);\n if (ceilMatch) {\n const val = parseFloat(ceilMatch[1].trim());\n if (!isNaN(val)) {\n return String(Math.ceil(val));\n }\n }\n\n // Match round(a) pattern where argument is a numeric literal\n const roundMatch = trimmed.match(/^round\\((.+)\\)$/i);\n if (roundMatch) {\n const val = parseFloat(roundMatch[1].trim());\n if (!isNaN(val)) {\n return String(Math.round(val));\n }\n }\n\n // Match upper(\"string\") pattern for constant string literals\n const upperMatch = trimmed.match(/^upper\\(\"(.+)\"\\)$/i);\n if (upperMatch) {\n return `\"${upperMatch[1].toUpperCase()}\"`;\n }\n\n // Match lower(\"string\") pattern for constant string literals\n const lowerMatch = trimmed.match(/^lower\\(\"(.+)\"\\)$/i);\n if (lowerMatch) {\n return `\"${lowerMatch[1].toLowerCase()}\"`;\n }\n\n // Match len(\"string\") pattern for constant string literals\n const lenMatch = trimmed.match(/^len\\(\"(.*)\"\\)$/i);\n if (lenMatch) {\n return String(lenMatch[1].length);\n }\n\n // Match len(123) pattern for numeric literals (counting digits excluding sign)\n const lenNumMatch = trimmed.match(/^len\\(-?\\d+\\.?\\d*\\)$/i);\n if (lenNumMatch) {\n const numStr = trimmed.match(/^len\\((.+)\\)$/i)![1].trim();\n // Count digits ignoring sign and decimal point\n const digitCount = numStr.replace(/^-/, '').replace('.', '').length;\n return String(digitCount);\n }\n\n return expr;\n}\n\n// ============================================================================\n// Table Indexing\n// ============================================================================\n\n/**\n * Build index structures for efficient table lookup.\n *\n * This pass transforms linear search structures into more efficient alternatives.\n * Examples:\n * - Convert decision table rows with equality checks to index-based lookup\n * - Mark tables that are good candidates for switch statement generation\n *\n * Table indexing converts O(n) linear search to O(1) hash lookup when all rules check\n * equality on a single column with unique values - this is common in lookup tables\n * (e.g., pricing tiers by customer type) and can improve evaluation time by 10-100x\n * for large tables.\n *\n * @param ast - The compiled AST to optimize\n * @returns The AST with optimized table lookups\n */\nfunction tableIndexing(ast: CompiledAST): CompiledAST {\n const optimized = JSON.parse(JSON.stringify(ast)) as JDMDecision;\n\n optimized.nodes = optimized.nodes.map((node: JDMNode) => indexTableInNode(node));\n\n return optimized;\n}\n\n/**\n * Apply table indexing to a node.\n */\nfunction indexTableInNode(node: JDMNode): JDMNode {\n if (!node.content) {\n return node;\n }\n\n const content = node.content;\n\n if (node.type === NodeType.DECISION_TABLE) {\n return indexDecisionTable(node, content);\n }\n\n return node;\n}\n\n/**\n * Index decision table for efficient lookup.\n *\n * This pass analyzes the decision table to identify patterns that can be\n * optimized, such as equality checks on a single column that could be\n * converted to a switch statement or hash map.\n */\nfunction indexDecisionTable(node: JDMNode, content: any): JDMNode {\n const { rules, inputs } = content;\n\n // Analyze each input column to find indexing opportunities\n const indexedInputs = inputs.map((input: any) => {\n const inputValues = rules.map((rule: any) => {\n const expr = rule[input.id];\n if (!expr || expr === '' || expr === '-') {\n return null;\n }\n return expr.trim();\n });\n\n // Check if this column is a good candidate for indexing:\n // - All values are string or number literals\n // - No intervals or complex expressions\n // - No duplicate values\n const allLiterals = inputValues.every((val: string | null) => {\n if (!val) {\n return true;\n }\n return /^([\"'])(?:(?=(\\\\?))\\2.)*?\\1$|^-?\\d+\\.?\\d*$/.test(val);\n });\n\n const uniqueValues = new Set(inputValues.filter((v: string | null) => v !== null));\n const hasDuplicates =\n uniqueValues.size < inputValues.filter((v: string | null) => v !== null).length;\n\n return {\n ...input,\n // Hash-based lookup becomes beneficial with ~10+ unique values, but overhead matters\n // for small tables. 50 is a practical limit where indexing provides clear wins without\n // excessive memory for the lookup structure.\n _indexable: allLiterals && !hasDuplicates && uniqueValues.size > 0 && uniqueValues.size < 50,\n _uniqueValues: Array.from(uniqueValues),\n };\n });\n\n return {\n ...node,\n content: {\n ...content,\n inputs: indexedInputs,\n },\n };\n}\n","/**\n * Runtime validation code generation for decision models.\n *\n * This module provides functions that generate or perform validation code\n * that executes at runtime. These functions validate actual data against\n * schemas when the decision is evaluated.\n *\n * For compile-time static analysis (checking references exist, etc.),\n * see compile-time-validation.ts.\n */\n\nimport type { FlattenedLayout } from './types';\n\n/**\n * Validation error containing field path, expected type, and actual value.\n */\nexport interface ValidationError {\n /** The field path (e.g., \"customer.age\") */\n path: string;\n /** Error message describing the issue */\n message: string;\n /** The expected type */\n expected?: string;\n /** The actual value that failed validation */\n actual?: unknown;\n}\n\n/**\n * Result of runtime validation.\n */\nexport interface ValidationResult {\n /** Whether validation passed */\n valid: boolean;\n /** Array of validation errors (empty if valid) */\n errors: ValidationError[];\n}\n\n/**\n * Validate runtime input data against the input schema.\n *\n * This function checks that all required input fields from the schema\n * are present in the provided input data AND that they have correct types.\n * It returns a list of validation errors including missing fields and\n * type mismatches.\n *\n * Security note: This validation prevents malformed input with wrong types\n * (string instead of number, object instead of array) from being marshaled\n * to WASM, which could cause runtime errors or unexpected behavior.\n *\n * @param inputData - Runtime input data as a JavaScript object\n * @param inputLayout - Flattened layout from the input schema\n * @returns Array of missing/invalid input field paths (empty if all valid)\n */\nexport function validateRuntimeInputs(\n inputData: Record<string, any>,\n inputLayout: FlattenedLayout,\n): string[] {\n const result = validateRuntimeInputsDetailed(inputData, inputLayout);\n // Return just the paths for backwards compatibility\n return result.errors.map((e) => e.path);\n}\n\n/**\n * Validate runtime input data with detailed error information.\n *\n * This function performs comprehensive validation including:\n * - Presence checking: All required fields must be present\n * - Type checking: Values must match expected types\n * - Range checking: Numbers must be finite (not NaN/Infinity unless intended)\n *\n * @param inputData - Runtime input data as a JavaScript object\n * @param inputLayout - Flattened layout from the input schema\n * @returns Detailed validation result with errors\n */\nexport function validateRuntimeInputsDetailed(\n inputData: Record<string, any>,\n inputLayout: FlattenedLayout,\n): ValidationResult {\n const errors: ValidationError[] = [];\n\n for (const field of inputLayout.fields) {\n const path = field.path;\n const parts = path.split('.');\n\n let current: any = inputData;\n let exists = true;\n\n // Navigate to the nested value\n for (const part of parts) {\n if (current === null || current === undefined || current[part] === undefined) {\n exists = false;\n break;\n }\n current = current[part];\n }\n\n if (!exists) {\n errors.push({\n path,\n message: 'Required field is missing',\n expected: field.type,\n actual: undefined,\n });\n continue;\n }\n\n // Now check type\n const typeError = validateFieldType(current, field.type, path);\n if (typeError) {\n errors.push(typeError);\n }\n }\n\n return {\n valid: errors.length === 0,\n errors,\n };\n}\n\n/**\n * Validate that a value matches the expected field type.\n *\n * @param value - The actual value to validate\n * @param expectedType - The expected type from the schema\n * @param path - The field path for error reporting\n * @returns ValidationError if type mismatch, null if valid\n */\nfunction validateFieldType(\n value: unknown,\n expectedType: 'f64' | 'i32' | 'i64' | 'bool' | 'string' | 'array',\n path: string,\n): ValidationError | null {\n const actualType = typeof value;\n\n switch (expectedType) {\n case 'f64':\n case 'i32':\n case 'i64': {\n // Check for number type\n if (actualType !== 'number' && actualType !== 'bigint') {\n return {\n path,\n message: `Expected ${expectedType} (number), got ${actualType}`,\n expected: expectedType,\n actual: value,\n };\n }\n\n // For number types, also check for NaN\n if (actualType === 'number' && Number.isNaN(value)) {\n return {\n path,\n message: `Invalid number: NaN is not allowed`,\n expected: expectedType,\n actual: value,\n };\n }\n\n // For integer types, check that the value is actually an integer\n if (expectedType === 'i32' || expectedType === 'i64') {\n if (actualType === 'number' && !Number.isInteger(value)) {\n return {\n path,\n message: `Expected integer, got floating-point number`,\n expected: expectedType,\n actual: value,\n };\n }\n }\n break;\n }\n\n case 'bool': {\n if (actualType !== 'boolean') {\n return {\n path,\n message: `Expected boolean, got ${actualType}`,\n expected: 'boolean',\n actual: value,\n };\n }\n break;\n }\n\n case 'string': {\n if (actualType !== 'string') {\n return {\n path,\n message: `Expected string, got ${actualType}`,\n expected: 'string',\n actual: value,\n };\n }\n break;\n }\n\n case 'array': {\n if (!Array.isArray(value)) {\n return {\n path,\n message: `Expected array, got ${actualType}`,\n expected: 'array',\n actual: value,\n };\n }\n break;\n }\n\n default: {\n // Unknown type - this shouldn't happen with a valid schema\n // but we'll accept any value for forward compatibility\n break;\n }\n }\n\n return null;\n}\n\n/**\n * Validate runtime output data against the output schema.\n *\n * This function checks that all required output fields from the schema\n * are present in the provided output data AND that they have correct types.\n * It returns a list of validation errors including missing fields and\n * type mismatches.\n *\n * @param outputData - Runtime output data as a JavaScript object\n * @param outputLayout - Flattened layout from the output schema\n * @returns Array of missing/invalid output field paths (empty if all valid)\n */\nexport function validateRuntimeOutputs(\n outputData: Record<string, any>,\n outputLayout: FlattenedLayout,\n): string[] {\n const result = validateRuntimeOutputsDetailed(outputData, outputLayout);\n return result.errors.map((e) => e.path);\n}\n\n/**\n * Validate runtime output data with detailed error information.\n *\n * This function performs comprehensive validation including:\n * - Presence checking: All required output fields must be present\n * - Type checking: Values must match expected types\n *\n * @param outputData - Runtime output data as a JavaScript object\n * @param outputLayout - Flattened layout from the output schema\n * @returns Detailed validation result with errors\n */\nexport function validateRuntimeOutputsDetailed(\n outputData: Record<string, any>,\n outputLayout: FlattenedLayout,\n): ValidationResult {\n const errors: ValidationError[] = [];\n\n for (const field of outputLayout.fields) {\n const path = field.path;\n const parts = path.split('.');\n\n // Allows objects to be built incrementally (e.g., output.customer.name and\n // output.customer.age) instead of requiring the entire object at once.\n let current: any = outputData;\n let exists = true;\n\n for (const part of parts) {\n if (current === null || current === undefined || current[part] === undefined) {\n exists = false;\n break;\n }\n current = current[part];\n }\n\n if (!exists) {\n errors.push({\n path,\n message: 'Required output field is missing',\n expected: field.type,\n actual: undefined,\n });\n continue;\n }\n\n // Now check type\n const typeError = validateFieldType(current, field.type, path);\n if (typeError) {\n errors.push(typeError);\n }\n }\n\n return {\n valid: errors.length === 0,\n errors,\n };\n}\n"],"mappings":";AAkCO,IAAK,YAAL,kBAAKA,eAAL;AAEL,EAAAA,WAAA,kBAAe;AACf,EAAAA,WAAA,4BAAyB;AACzB,EAAAA,WAAA,wBAAqB;AACrB,EAAAA,WAAA,yBAAsB;AACtB,EAAAA,WAAA,0BAAuB;AACvB,EAAAA,WAAA,oBAAiB;AACjB,EAAAA,WAAA,kBAAe;AAGf,EAAAA,WAAA,+BAA4B;AAC5B,EAAAA,WAAA,4BAAyB;AAGzB,EAAAA,WAAA,iBAAc;AACd,EAAAA,WAAA,sBAAmB;AACnB,EAAAA,WAAA,mBAAgB;AAChB,EAAAA,WAAA,mBAAgB;AAGhB,EAAAA,WAAA,qBAAkB;AAClB,EAAAA,WAAA,oBAAiB;AAtBP,SAAAA;AAAA,GAAA;AA+BL,IAAM,mBAAN,MAAM,0BAAyB,MAAM;AAAA,EAG1C,YACE,SACgB,MACA,UACA,SAChB;AACA,UAAM,OAAO;AAJG;AACA;AACA;AAOhB,QAAI,MAAM,mBAAmB;AAC3B,YAAM,kBAAkB,MAAM,iBAAgB;AAAA,IAChD;AAAA,EACF;AAAA,EAhBS,OAAO;AAAA;AAAA;AAAA;AAAA,EAqBhB,sBAA8B;AAC5B,UAAM,QAAkB,CAAC;AAEzB,QAAI,KAAK,UAAU;AACjB,YAAM,WAAqB,CAAC;AAC5B,UAAI,KAAK,SAAS,UAAU;AAC1B,iBAAS,KAAK,KAAK,SAAS,QAAQ;AAAA,MACtC;AACA,UAAI,KAAK,SAAS,QAAQ;AACxB,iBAAS,KAAK,QAAQ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AAI;AAGhE,QAAM,cAAc,oBAAoB,aAAa,cAAc,UAAU;AAC7E,QAAM,iBAAiB,uBAAuB,QAAQ,WAAW;AAEjE,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA,KAAK,KAAK,QAAQ,MAAM;AAAA,IACxB,gBAAgB,KAAK,QAAQ,SAAS;AAAA,EACxC;AACF;AAEA,SAAS,oBAAgD;AACvD,QAAM,WAAW,oBAAI,IAAoB;AACzC,SAAO,CAAC,WAAmB;AACzB,UAAM,QAAQ,SAAS,IAAI,MAAM,KAAK;AACtC,aAAS,IAAI,QAAQ,QAAQ,CAAC;AAC9B,WAAO,GAAG,MAAM,IAAI,KAAK;AAAA,EAC3B;AACF;","names":["ErrorCode","TokenType","Position","SourceLocation","offset","Parser","ref","parse","parser","DestructuringErrors","TokContext","Scope","Node","BranchID","RegExpValidationState","current","Token","parse","NodeType","path","path","ast","compiledExpr","literal","path","statements","branchCode","wrapperCode","sanitizeId","generateNodeEvaluationCode","readFileSync","dirname","__dirname","dirname","readFileSync","data","dirname","data","module","current","Kind","createHash","path","readFileSync","path","lookahead","value","current","path","current","path","readFileSync"]}
1
+ {"version":3,"sources":["../src/compiler/errors.ts","../node_modules/acorn/dist/acorn.mjs","../src/compiler/utils.ts","../src/compiler/nodes/function.ts","../src/compiler/parser.ts","../src/compiler/graph.ts","../src/compiler/nodes/input.ts","../src/compiler/nodes/context-resolvers.ts","../src/compiler/nodes/expression-compiler.ts","../src/compiler/nodes/expression.ts","../src/compiler/unary-transform.ts","../src/compiler/nodes/decision-table.ts","../src/compiler/code-generators.ts","../src/compiler/nodes/switch.ts","../src/compiler/nodes/decision.ts","../src/compiler/compile-time-validation.ts","../src/compiler/switch-branch-detection.ts","../src/compiler/result-selection.ts","../src/compiler/orchestrator.ts","../src/compiler/cache.ts","inline-runtime:inline-runtime","../src/compiler/asc-compiler.ts","../src/compiler/virtual-fs.ts","../src/compiler/codegen/js-marshal.ts","../src/compiler/codegen/js-validation.ts","../src/compiler/runtime-codegen.ts","../src/compiler/runtime.ts","../src/compiler/build.ts","../src/compiler/schema.ts","../src/compiler/index.ts","../src/compiler/ast-types.ts","../src/compiler/expression-parser.ts","../src/compiler/cst-visitor.ts","../src/compiler/unary-ast-transforms.ts","../src/compiler/unary-parser.ts","../src/compiler/optimizer.ts","../src/compiler/runtime-validation-codegen.ts"],"sourcesContent":["/**\n * Error handling infrastructure for the JDM compiler.\n *\n * This module provides:\n * - CompilationError: The main error class for all compilation failures\n * - ErrorCode: A comprehensive enumeration of all possible error types\n * - SourceLocation: Detailed location information for error reporting\n * - ErrorCollector: Aggregates non-fatal expression errors for batch reporting\n */\n\n/**\n * Detailed source location for error reporting.\n */\nexport interface SourceLocation {\n /** ID of the node where the error occurred */\n nodeId?: string;\n /** Name of the node where the error occurred */\n nodeName?: string;\n /** Field name within the node */\n field?: string;\n /** Line number in source JDM */\n line?: number;\n /** Column number in source JDM */\n column?: number;\n}\n\n/**\n * Enumeration of all possible compilation error codes.\n *\n * Errors are categorized into three types:\n * - Structural errors: Critical JDM structure issues that fail compilation immediately\n * - Feature errors: Unsupported features that cannot be handled\n * - Expression errors: Issues in expression parsing that can be collected and reported together\n */\nexport enum ErrorCode {\n // Structural errors (fail immediately)\n INVALID_JSON = 'INVALID_JSON',\n INVALID_NODE_STRUCTURE = 'INVALID_NODE_STRUCTURE',\n MISSING_INPUT_NODE = 'MISSING_INPUT_NODE',\n MISSING_OUTPUT_NODE = 'MISSING_OUTPUT_NODE',\n MULTIPLE_INPUT_NODES = 'MULTIPLE_INPUT_NODES',\n CYCLE_DETECTED = 'CYCLE_DETECTED',\n INVALID_EDGE = 'INVALID_EDGE',\n\n // Feature errors (fail immediately)\n UNSUPPORTED_FUNCTION_NODE = 'UNSUPPORTED_FUNCTION_NODE',\n UNSUPPORTED_EXPRESSION = 'UNSUPPORTED_EXPRESSION',\n\n // Expression errors (collected, reported together)\n PARSE_ERROR = 'PARSE_ERROR',\n UNKNOWN_FUNCTION = 'UNKNOWN_FUNCTION',\n TYPE_MISMATCH = 'TYPE_MISMATCH',\n UNKNOWN_FIELD = 'UNKNOWN_FIELD',\n\n // Schema errors\n SCHEMA_MISMATCH = 'SCHEMA_MISMATCH',\n INVALID_SCHEMA = 'INVALID_SCHEMA',\n}\n\n/**\n * Custom error class for compilation failures.\n *\n * Provides structured error information including error code, source location,\n * and additional context for debugging.\n */\nexport class CompilationError extends Error {\n readonly name = 'CompilationError';\n\n constructor(\n message: string,\n public readonly code: ErrorCode,\n public readonly location?: SourceLocation,\n public readonly context?: Record<string, unknown>,\n ) {\n super(message);\n // Exclude the CompilationError constructor frame from the stack trace.\n // Without this, stack traces would include an unhelpful constructor frame,\n // making it harder to identify the actual error source in compiled code.\n // Only available on V8-based engines (Node.js, Chrome, Edge).\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, CompilationError);\n }\n }\n\n /**\n * Get a formatted error message with location information.\n */\n getFormattedMessage(): string {\n const parts: string[] = [];\n\n if (this.location) {\n const locParts: string[] = [];\n if (this.location.nodeName) {\n locParts.push(this.location.nodeName);\n }\n if (this.location.nodeId) {\n locParts.push(`(id: ${this.location.nodeId})`);\n }\n if (this.location.field) {\n locParts.push(`.${this.location.field}`);\n }\n // Combine line and column: @10:5\n if (this.location.line !== undefined && this.location.column !== undefined) {\n locParts.push(`@${this.location.line}:${this.location.column}`);\n } else if (this.location.line !== undefined) {\n locParts.push(`@${this.location.line}`);\n } else if (this.location.column !== undefined) {\n locParts.push(`:${this.location.column}`);\n }\n\n if (locParts.length > 0) {\n parts.push(`[${locParts.join(' ')}]`);\n }\n }\n\n parts.push(`[${this.code}]`);\n parts.push(this.message);\n\n return parts.join(' ');\n }\n}\n\n/**\n * Collector for non-fatal errors during expression parsing.\n *\n * This allows the parser to continue and collect multiple errors rather than\n * failing on the first one, providing a better user experience by reporting\n * all issues at once.\n *\n * @example\n * const collector = new ErrorCollector();\n * collector.add(new CompilationError('Undefined variable', ErrorCode.UNKNOWN_FIELD, { nodeName: 'AgeCheck' }));\n * collector.add(new CompilationError('Type mismatch', ErrorCode.TYPE_MISMATCH, { nodeName: 'AgeCheck' }));\n * collector.throwIfErrors(); // Throws with aggregated message\n */\nexport class ErrorCollector {\n private errors: CompilationError[] = [];\n\n /**\n * Add an error to the collector.\n */\n add(error: CompilationError): void {\n this.errors.push(error);\n }\n\n /**\n * Check if any errors have been collected.\n */\n hasErrors(): boolean {\n return this.errors.length > 0;\n }\n\n /**\n * Throw if there are any collected errors.\n *\n * Single errors throw directly to preserve original context and stack trace. Multiple\n * errors are aggregated into one with numbered list, so developers see all problems at\n * once instead of fixing issues one-by-one through repeated compile attempts.\n */\n throwIfErrors(): void {\n if (this.errors.length === 0) {\n return;\n }\n\n if (this.errors.length === 1) {\n throw this.errors[0];\n }\n\n const message =\n `${this.errors.length} compilation errors:\\n` +\n this.errors\n .map((e, i) => {\n const prefix = ` ${i + 1}. ${e.code}`;\n const formatted = e.getFormattedMessage();\n // getFormattedMessage() includes [CODE] prefix, but we already show the code in\n // our numbered list, so strip it to avoid \"1. CODE: [CODE] message\"\n const rest = formatted.replace(`[${e.code}]`, '').trim();\n return `${prefix}${rest ? ': ' + rest : ''}`;\n })\n .join('\\n');\n\n // Use the location from the first error as the aggregated error's location\n const firstErrorLocation = this.errors[0].location;\n throw new CompilationError(message, ErrorCode.PARSE_ERROR, firstErrorLocation);\n }\n}\n\n/**\n * Type guard to check if an error is a CompilationError.\n */\nexport function isCompilationError(error: unknown): error is CompilationError {\n return error instanceof CompilationError;\n}\n\n/**\n * Type guard to check if an error code is a structural error.\n */\nexport function isStructuralError(code: ErrorCode): boolean {\n return [\n ErrorCode.INVALID_JSON,\n ErrorCode.INVALID_NODE_STRUCTURE,\n ErrorCode.MISSING_INPUT_NODE,\n ErrorCode.MISSING_OUTPUT_NODE,\n ErrorCode.MULTIPLE_INPUT_NODES,\n ErrorCode.CYCLE_DETECTED,\n ErrorCode.INVALID_EDGE,\n ].includes(code);\n}\n\n/**\n * Type guard to check if an error code is a feature error.\n */\nexport function isFeatureError(code: ErrorCode): boolean {\n return [ErrorCode.UNSUPPORTED_FUNCTION_NODE, ErrorCode.UNSUPPORTED_EXPRESSION].includes(code);\n}\n\n/**\n * Type guard to check if an error code is an expression error.\n */\nexport function isExpressionError(code: ErrorCode): boolean {\n return [\n ErrorCode.PARSE_ERROR,\n ErrorCode.UNKNOWN_FUNCTION,\n ErrorCode.TYPE_MISMATCH,\n ErrorCode.UNKNOWN_FIELD,\n ].includes(code);\n}\n","// This file was generated. Do not modify manually!\nvar astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 80, 3, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 343, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 726, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];\n\n// This file was generated. Do not modify manually!\nvar astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 2, 60, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 42, 9, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 496, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 4191];\n\n// This file was generated. Do not modify manually!\nvar nonASCIIidentifierChars = \"\\u200c\\u200d\\xb7\\u0300-\\u036f\\u0387\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u064b-\\u0669\\u0670\\u06d6-\\u06dc\\u06df-\\u06e4\\u06e7\\u06e8\\u06ea-\\u06ed\\u06f0-\\u06f9\\u0711\\u0730-\\u074a\\u07a6-\\u07b0\\u07c0-\\u07c9\\u07eb-\\u07f3\\u07fd\\u0816-\\u0819\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0859-\\u085b\\u0897-\\u089f\\u08ca-\\u08e1\\u08e3-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09cb-\\u09cd\\u09d7\\u09e2\\u09e3\\u09e6-\\u09ef\\u09fe\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2\\u0ae3\\u0ae6-\\u0aef\\u0afa-\\u0aff\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b55-\\u0b57\\u0b62\\u0b63\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c00-\\u0c04\\u0c3c\\u0c3e-\\u0c44\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62\\u0c63\\u0c66-\\u0c6f\\u0c81-\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2\\u0ce3\\u0ce6-\\u0cef\\u0cf3\\u0d00-\\u0d03\\u0d3b\\u0d3c\\u0d3e-\\u0d44\\u0d46-\\u0d48\\u0d4a-\\u0d4d\\u0d57\\u0d62\\u0d63\\u0d66-\\u0d6f\\u0d81-\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0de6-\\u0def\\u0df2\\u0df3\\u0e31\\u0e34-\\u0e3a\\u0e47-\\u0e4e\\u0e50-\\u0e59\\u0eb1\\u0eb4-\\u0ebc\\u0ec8-\\u0ece\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f3e\\u0f3f\\u0f71-\\u0f84\\u0f86\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u102b-\\u103e\\u1040-\\u1049\\u1056-\\u1059\\u105e-\\u1060\\u1062-\\u1064\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u1369-\\u1371\\u1712-\\u1715\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17b4-\\u17d3\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u180f-\\u1819\\u18a9\\u1920-\\u192b\\u1930-\\u193b\\u1946-\\u194f\\u19d0-\\u19da\\u1a17-\\u1a1b\\u1a55-\\u1a5e\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1ab0-\\u1abd\\u1abf-\\u1ace\\u1b00-\\u1b04\\u1b34-\\u1b44\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1b80-\\u1b82\\u1ba1-\\u1bad\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c24-\\u1c37\\u1c40-\\u1c49\\u1c50-\\u1c59\\u1cd0-\\u1cd2\\u1cd4-\\u1ce8\\u1ced\\u1cf4\\u1cf7-\\u1cf9\\u1dc0-\\u1dff\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2cef-\\u2cf1\\u2d7f\\u2de0-\\u2dff\\u302a-\\u302f\\u3099\\u309a\\u30fb\\ua620-\\ua629\\ua66f\\ua674-\\ua67d\\ua69e\\ua69f\\ua6f0\\ua6f1\\ua802\\ua806\\ua80b\\ua823-\\ua827\\ua82c\\ua880\\ua881\\ua8b4-\\ua8c5\\ua8d0-\\ua8d9\\ua8e0-\\ua8f1\\ua8ff-\\ua909\\ua926-\\ua92d\\ua947-\\ua953\\ua980-\\ua983\\ua9b3-\\ua9c0\\ua9d0-\\ua9d9\\ua9e5\\ua9f0-\\ua9f9\\uaa29-\\uaa36\\uaa43\\uaa4c\\uaa4d\\uaa50-\\uaa59\\uaa7b-\\uaa7d\\uaab0\\uaab2-\\uaab4\\uaab7\\uaab8\\uaabe\\uaabf\\uaac1\\uaaeb-\\uaaef\\uaaf5\\uaaf6\\uabe3-\\uabea\\uabec\\uabed\\uabf0-\\uabf9\\ufb1e\\ufe00-\\ufe0f\\ufe20-\\ufe2f\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f\\uff65\";\n\n// This file was generated. Do not modify manually!\nvar nonASCIIidentifierStartChars = \"\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u037f\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u052f\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05d0-\\u05ea\\u05ef-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086a\\u0870-\\u0887\\u0889-\\u088e\\u08a0-\\u08c9\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u09fc\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0af9\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c39\\u0c3d\\u0c58-\\u0c5a\\u0c5d\\u0c60\\u0c61\\u0c80\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cdd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d04-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d54-\\u0d56\\u0d5f-\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e86-\\u0e8a\\u0e8c-\\u0ea3\\u0ea5\\u0ea7-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f5\\u13f8-\\u13fd\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f8\\u1700-\\u1711\\u171f-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1878\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191e\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19b0-\\u19c9\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4c\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1c80-\\u1c8a\\u1c90-\\u1cba\\u1cbd-\\u1cbf\\u1ce9-\\u1cec\\u1cee-\\u1cf3\\u1cf5\\u1cf6\\u1cfa\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2118-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309b-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312f\\u3131-\\u318e\\u31a0-\\u31bf\\u31f0-\\u31ff\\u3400-\\u4dbf\\u4e00-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua69d\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua7cd\\ua7d0\\ua7d1\\ua7d3\\ua7d5-\\ua7dc\\ua7f2-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua8fd\\ua8fe\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\ua9e0-\\ua9e4\\ua9e6-\\ua9ef\\ua9fa-\\ua9fe\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa7e-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uab30-\\uab5a\\uab5c-\\uab69\\uab70-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc\";\n\n// These are a run-length and offset encoded representation of the\n// >0xffff code points that are a valid part of identifiers. The\n// offset starts at 0x10000, and each pair of numbers represents an\n// offset to the next range, and then a size of the range.\n\n// Reserved word lists for various dialects of the language\n\nvar reservedWords = {\n 3: \"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile\",\n 5: \"class enum extends super const export import\",\n 6: \"enum\",\n strict: \"implements interface let package private protected public static yield\",\n strictBind: \"eval arguments\"\n};\n\n// And the keywords\n\nvar ecma5AndLessKeywords = \"break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this\";\n\nvar keywords$1 = {\n 5: ecma5AndLessKeywords,\n \"5module\": ecma5AndLessKeywords + \" export import\",\n 6: ecma5AndLessKeywords + \" const class extends export import super\"\n};\n\nvar keywordRelationalOperator = /^in(stanceof)?$/;\n\n// ## Character categories\n\nvar nonASCIIidentifierStart = new RegExp(\"[\" + nonASCIIidentifierStartChars + \"]\");\nvar nonASCIIidentifier = new RegExp(\"[\" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + \"]\");\n\n// This has a complexity linear to the value of the code. The\n// assumption is that looking up astral identifier characters is\n// rare.\nfunction isInAstralSet(code, set) {\n var pos = 0x10000;\n for (var i = 0; i < set.length; i += 2) {\n pos += set[i];\n if (pos > code) { return false }\n pos += set[i + 1];\n if (pos >= code) { return true }\n }\n return false\n}\n\n// Test whether a given character code starts an identifier.\n\nfunction isIdentifierStart(code, astral) {\n if (code < 65) { return code === 36 }\n if (code < 91) { return true }\n if (code < 97) { return code === 95 }\n if (code < 123) { return true }\n if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)) }\n if (astral === false) { return false }\n return isInAstralSet(code, astralIdentifierStartCodes)\n}\n\n// Test whether a given character is part of an identifier.\n\nfunction isIdentifierChar(code, astral) {\n if (code < 48) { return code === 36 }\n if (code < 58) { return true }\n if (code < 65) { return false }\n if (code < 91) { return true }\n if (code < 97) { return code === 95 }\n if (code < 123) { return true }\n if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)) }\n if (astral === false) { return false }\n return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes)\n}\n\n// ## Token types\n\n// The assignment of fine-grained, information-carrying type objects\n// allows the tokenizer to store the information it has about a\n// token in a way that is very cheap for the parser to look up.\n\n// All token type variables start with an underscore, to make them\n// easy to recognize.\n\n// The `beforeExpr` property is used to disambiguate between regular\n// expressions and divisions. It is set on all token types that can\n// be followed by an expression (thus, a slash after them would be a\n// regular expression).\n//\n// The `startsExpr` property is used to check if the token ends a\n// `yield` expression. It is set on all token types that either can\n// directly start an expression (like a quotation mark) or can\n// continue an expression (like the body of a string).\n//\n// `isLoop` marks a keyword as starting a loop, which is important\n// to know when parsing a label, in order to allow or disallow\n// continue jumps to that label.\n\nvar TokenType = function TokenType(label, conf) {\n if ( conf === void 0 ) conf = {};\n\n this.label = label;\n this.keyword = conf.keyword;\n this.beforeExpr = !!conf.beforeExpr;\n this.startsExpr = !!conf.startsExpr;\n this.isLoop = !!conf.isLoop;\n this.isAssign = !!conf.isAssign;\n this.prefix = !!conf.prefix;\n this.postfix = !!conf.postfix;\n this.binop = conf.binop || null;\n this.updateContext = null;\n};\n\nfunction binop(name, prec) {\n return new TokenType(name, {beforeExpr: true, binop: prec})\n}\nvar beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true};\n\n// Map keyword names to token types.\n\nvar keywords = {};\n\n// Succinct definitions of keyword token types\nfunction kw(name, options) {\n if ( options === void 0 ) options = {};\n\n options.keyword = name;\n return keywords[name] = new TokenType(name, options)\n}\n\nvar types$1 = {\n num: new TokenType(\"num\", startsExpr),\n regexp: new TokenType(\"regexp\", startsExpr),\n string: new TokenType(\"string\", startsExpr),\n name: new TokenType(\"name\", startsExpr),\n privateId: new TokenType(\"privateId\", startsExpr),\n eof: new TokenType(\"eof\"),\n\n // Punctuation token types.\n bracketL: new TokenType(\"[\", {beforeExpr: true, startsExpr: true}),\n bracketR: new TokenType(\"]\"),\n braceL: new TokenType(\"{\", {beforeExpr: true, startsExpr: true}),\n braceR: new TokenType(\"}\"),\n parenL: new TokenType(\"(\", {beforeExpr: true, startsExpr: true}),\n parenR: new TokenType(\")\"),\n comma: new TokenType(\",\", beforeExpr),\n semi: new TokenType(\";\", beforeExpr),\n colon: new TokenType(\":\", beforeExpr),\n dot: new TokenType(\".\"),\n question: new TokenType(\"?\", beforeExpr),\n questionDot: new TokenType(\"?.\"),\n arrow: new TokenType(\"=>\", beforeExpr),\n template: new TokenType(\"template\"),\n invalidTemplate: new TokenType(\"invalidTemplate\"),\n ellipsis: new TokenType(\"...\", beforeExpr),\n backQuote: new TokenType(\"`\", startsExpr),\n dollarBraceL: new TokenType(\"${\", {beforeExpr: true, startsExpr: true}),\n\n // Operators. These carry several kinds of properties to help the\n // parser use them properly (the presence of these properties is\n // what categorizes them as operators).\n //\n // `binop`, when present, specifies that this operator is a binary\n // operator, and will refer to its precedence.\n //\n // `prefix` and `postfix` mark the operator as a prefix or postfix\n // unary operator.\n //\n // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as\n // binary operators with a very low precedence, that should result\n // in AssignmentExpression nodes.\n\n eq: new TokenType(\"=\", {beforeExpr: true, isAssign: true}),\n assign: new TokenType(\"_=\", {beforeExpr: true, isAssign: true}),\n incDec: new TokenType(\"++/--\", {prefix: true, postfix: true, startsExpr: true}),\n prefix: new TokenType(\"!/~\", {beforeExpr: true, prefix: true, startsExpr: true}),\n logicalOR: binop(\"||\", 1),\n logicalAND: binop(\"&&\", 2),\n bitwiseOR: binop(\"|\", 3),\n bitwiseXOR: binop(\"^\", 4),\n bitwiseAND: binop(\"&\", 5),\n equality: binop(\"==/!=/===/!==\", 6),\n relational: binop(\"</>/<=/>=\", 7),\n bitShift: binop(\"<</>>/>>>\", 8),\n plusMin: new TokenType(\"+/-\", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}),\n modulo: binop(\"%\", 10),\n star: binop(\"*\", 10),\n slash: binop(\"/\", 10),\n starstar: new TokenType(\"**\", {beforeExpr: true}),\n coalesce: binop(\"??\", 1),\n\n // Keyword token types.\n _break: kw(\"break\"),\n _case: kw(\"case\", beforeExpr),\n _catch: kw(\"catch\"),\n _continue: kw(\"continue\"),\n _debugger: kw(\"debugger\"),\n _default: kw(\"default\", beforeExpr),\n _do: kw(\"do\", {isLoop: true, beforeExpr: true}),\n _else: kw(\"else\", beforeExpr),\n _finally: kw(\"finally\"),\n _for: kw(\"for\", {isLoop: true}),\n _function: kw(\"function\", startsExpr),\n _if: kw(\"if\"),\n _return: kw(\"return\", beforeExpr),\n _switch: kw(\"switch\"),\n _throw: kw(\"throw\", beforeExpr),\n _try: kw(\"try\"),\n _var: kw(\"var\"),\n _const: kw(\"const\"),\n _while: kw(\"while\", {isLoop: true}),\n _with: kw(\"with\"),\n _new: kw(\"new\", {beforeExpr: true, startsExpr: true}),\n _this: kw(\"this\", startsExpr),\n _super: kw(\"super\", startsExpr),\n _class: kw(\"class\", startsExpr),\n _extends: kw(\"extends\", beforeExpr),\n _export: kw(\"export\"),\n _import: kw(\"import\", startsExpr),\n _null: kw(\"null\", startsExpr),\n _true: kw(\"true\", startsExpr),\n _false: kw(\"false\", startsExpr),\n _in: kw(\"in\", {beforeExpr: true, binop: 7}),\n _instanceof: kw(\"instanceof\", {beforeExpr: true, binop: 7}),\n _typeof: kw(\"typeof\", {beforeExpr: true, prefix: true, startsExpr: true}),\n _void: kw(\"void\", {beforeExpr: true, prefix: true, startsExpr: true}),\n _delete: kw(\"delete\", {beforeExpr: true, prefix: true, startsExpr: true})\n};\n\n// Matches a whole line break (where CRLF is considered a single\n// line break). Used to count lines.\n\nvar lineBreak = /\\r\\n?|\\n|\\u2028|\\u2029/;\nvar lineBreakG = new RegExp(lineBreak.source, \"g\");\n\nfunction isNewLine(code) {\n return code === 10 || code === 13 || code === 0x2028 || code === 0x2029\n}\n\nfunction nextLineBreak(code, from, end) {\n if ( end === void 0 ) end = code.length;\n\n for (var i = from; i < end; i++) {\n var next = code.charCodeAt(i);\n if (isNewLine(next))\n { return i < end - 1 && next === 13 && code.charCodeAt(i + 1) === 10 ? i + 2 : i + 1 }\n }\n return -1\n}\n\nvar nonASCIIwhitespace = /[\\u1680\\u2000-\\u200a\\u202f\\u205f\\u3000\\ufeff]/;\n\nvar skipWhiteSpace = /(?:\\s|\\/\\/.*|\\/\\*[^]*?\\*\\/)*/g;\n\nvar ref = Object.prototype;\nvar hasOwnProperty = ref.hasOwnProperty;\nvar toString = ref.toString;\n\nvar hasOwn = Object.hasOwn || (function (obj, propName) { return (\n hasOwnProperty.call(obj, propName)\n); });\n\nvar isArray = Array.isArray || (function (obj) { return (\n toString.call(obj) === \"[object Array]\"\n); });\n\nvar regexpCache = Object.create(null);\n\nfunction wordsRegexp(words) {\n return regexpCache[words] || (regexpCache[words] = new RegExp(\"^(?:\" + words.replace(/ /g, \"|\") + \")$\"))\n}\n\nfunction codePointToString(code) {\n // UTF-16 Decoding\n if (code <= 0xFFFF) { return String.fromCharCode(code) }\n code -= 0x10000;\n return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00)\n}\n\nvar loneSurrogate = /(?:[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF])/;\n\n// These are used when `options.locations` is on, for the\n// `startLoc` and `endLoc` properties.\n\nvar Position = function Position(line, col) {\n this.line = line;\n this.column = col;\n};\n\nPosition.prototype.offset = function offset (n) {\n return new Position(this.line, this.column + n)\n};\n\nvar SourceLocation = function SourceLocation(p, start, end) {\n this.start = start;\n this.end = end;\n if (p.sourceFile !== null) { this.source = p.sourceFile; }\n};\n\n// The `getLineInfo` function is mostly useful when the\n// `locations` option is off (for performance reasons) and you\n// want to find the line/column position for a given character\n// offset. `input` should be the code string that the offset refers\n// into.\n\nfunction getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n var nextBreak = nextLineBreak(input, cur, offset);\n if (nextBreak < 0) { return new Position(line, offset - cur) }\n ++line;\n cur = nextBreak;\n }\n}\n\n// A second argument must be given to configure the parser process.\n// These options are recognized (only `ecmaVersion` is required):\n\nvar defaultOptions = {\n // `ecmaVersion` indicates the ECMAScript version to parse. Must be\n // either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10\n // (2019), 11 (2020), 12 (2021), 13 (2022), 14 (2023), or `\"latest\"`\n // (the latest version the library supports). This influences\n // support for strict mode, the set of reserved words, and support\n // for new syntax features.\n ecmaVersion: null,\n // `sourceType` indicates the mode the code should be parsed in.\n // Can be either `\"script\"` or `\"module\"`. This influences global\n // strict mode and parsing of `import` and `export` declarations.\n sourceType: \"script\",\n // `onInsertedSemicolon` can be a callback that will be called when\n // a semicolon is automatically inserted. It will be passed the\n // position of the inserted semicolon as an offset, and if\n // `locations` is enabled, it is given the location as a `{line,\n // column}` object as second argument.\n onInsertedSemicolon: null,\n // `onTrailingComma` is similar to `onInsertedSemicolon`, but for\n // trailing commas.\n onTrailingComma: null,\n // By default, reserved words are only enforced if ecmaVersion >= 5.\n // Set `allowReserved` to a boolean value to explicitly turn this on\n // an off. When this option has the value \"never\", reserved words\n // and keywords can also not be used as property names.\n allowReserved: null,\n // When enabled, a return at the top level is not considered an\n // error.\n allowReturnOutsideFunction: false,\n // When enabled, import/export statements are not constrained to\n // appearing at the top of the program, and an import.meta expression\n // in a script isn't considered an error.\n allowImportExportEverywhere: false,\n // By default, await identifiers are allowed to appear at the top-level scope only if ecmaVersion >= 2022.\n // When enabled, await identifiers are allowed to appear at the top-level scope,\n // but they are still not allowed in non-async functions.\n allowAwaitOutsideFunction: null,\n // When enabled, super identifiers are not constrained to\n // appearing in methods and do not raise an error when they appear elsewhere.\n allowSuperOutsideMethod: null,\n // When enabled, hashbang directive in the beginning of file is\n // allowed and treated as a line comment. Enabled by default when\n // `ecmaVersion` >= 2023.\n allowHashBang: false,\n // By default, the parser will verify that private properties are\n // only used in places where they are valid and have been declared.\n // Set this to false to turn such checks off.\n checkPrivateFields: true,\n // When `locations` is on, `loc` properties holding objects with\n // `start` and `end` properties in `{line, column}` form (with\n // line being 1-based and column 0-based) will be attached to the\n // nodes.\n locations: false,\n // A function can be passed as `onToken` option, which will\n // cause Acorn to call that function with object in the same\n // format as tokens returned from `tokenizer().getToken()`. Note\n // that you are not allowed to call the parser from the\n // callback—that will corrupt its internal state.\n onToken: null,\n // A function can be passed as `onComment` option, which will\n // cause Acorn to call that function with `(block, text, start,\n // end)` parameters whenever a comment is skipped. `block` is a\n // boolean indicating whether this is a block (`/* */`) comment,\n // `text` is the content of the comment, and `start` and `end` are\n // character offsets that denote the start and end of the comment.\n // When the `locations` option is on, two more parameters are\n // passed, the full `{line, column}` locations of the start and\n // end of the comments. Note that you are not allowed to call the\n // parser from the callback—that will corrupt its internal state.\n // When this option has an array as value, objects representing the\n // comments are pushed to it.\n onComment: null,\n // Nodes have their start and end characters offsets recorded in\n // `start` and `end` properties (directly on the node, rather than\n // the `loc` object, which holds line/column data. To also add a\n // [semi-standardized][range] `range` property holding a `[start,\n // end]` array with the same numbers, set the `ranges` option to\n // `true`.\n //\n // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678\n ranges: false,\n // It is possible to parse multiple files into a single AST by\n // passing the tree produced by parsing the first file as\n // `program` option in subsequent parses. This will add the\n // toplevel forms of the parsed file to the `Program` (top) node\n // of an existing parse tree.\n program: null,\n // When `locations` is on, you can pass this to record the source\n // file in every node's `loc` object.\n sourceFile: null,\n // This value, if given, is stored in every node, whether\n // `locations` is on or off.\n directSourceFile: null,\n // When enabled, parenthesized expressions are represented by\n // (non-standard) ParenthesizedExpression nodes\n preserveParens: false\n};\n\n// Interpret and default an options object\n\nvar warnedAboutEcmaVersion = false;\n\nfunction getOptions(opts) {\n var options = {};\n\n for (var opt in defaultOptions)\n { options[opt] = opts && hasOwn(opts, opt) ? opts[opt] : defaultOptions[opt]; }\n\n if (options.ecmaVersion === \"latest\") {\n options.ecmaVersion = 1e8;\n } else if (options.ecmaVersion == null) {\n if (!warnedAboutEcmaVersion && typeof console === \"object\" && console.warn) {\n warnedAboutEcmaVersion = true;\n console.warn(\"Since Acorn 8.0.0, options.ecmaVersion is required.\\nDefaulting to 2020, but this will stop working in the future.\");\n }\n options.ecmaVersion = 11;\n } else if (options.ecmaVersion >= 2015) {\n options.ecmaVersion -= 2009;\n }\n\n if (options.allowReserved == null)\n { options.allowReserved = options.ecmaVersion < 5; }\n\n if (!opts || opts.allowHashBang == null)\n { options.allowHashBang = options.ecmaVersion >= 14; }\n\n if (isArray(options.onToken)) {\n var tokens = options.onToken;\n options.onToken = function (token) { return tokens.push(token); };\n }\n if (isArray(options.onComment))\n { options.onComment = pushComment(options, options.onComment); }\n\n return options\n}\n\nfunction pushComment(options, array) {\n return function(block, text, start, end, startLoc, endLoc) {\n var comment = {\n type: block ? \"Block\" : \"Line\",\n value: text,\n start: start,\n end: end\n };\n if (options.locations)\n { comment.loc = new SourceLocation(this, startLoc, endLoc); }\n if (options.ranges)\n { comment.range = [start, end]; }\n array.push(comment);\n }\n}\n\n// Each scope gets a bitset that may contain these flags\nvar\n SCOPE_TOP = 1,\n SCOPE_FUNCTION = 2,\n SCOPE_ASYNC = 4,\n SCOPE_GENERATOR = 8,\n SCOPE_ARROW = 16,\n SCOPE_SIMPLE_CATCH = 32,\n SCOPE_SUPER = 64,\n SCOPE_DIRECT_SUPER = 128,\n SCOPE_CLASS_STATIC_BLOCK = 256,\n SCOPE_CLASS_FIELD_INIT = 512,\n SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;\n\nfunction functionFlags(async, generator) {\n return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0)\n}\n\n// Used in checkLVal* and declareName to determine the type of a binding\nvar\n BIND_NONE = 0, // Not a binding\n BIND_VAR = 1, // Var-style binding\n BIND_LEXICAL = 2, // Let- or const-style binding\n BIND_FUNCTION = 3, // Function declaration\n BIND_SIMPLE_CATCH = 4, // Simple (identifier pattern) catch binding\n BIND_OUTSIDE = 5; // Special case for function names as bound inside the function\n\nvar Parser = function Parser(options, input, startPos) {\n this.options = options = getOptions(options);\n this.sourceFile = options.sourceFile;\n this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === \"module\" ? \"5module\" : 5]);\n var reserved = \"\";\n if (options.allowReserved !== true) {\n reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];\n if (options.sourceType === \"module\") { reserved += \" await\"; }\n }\n this.reservedWords = wordsRegexp(reserved);\n var reservedStrict = (reserved ? reserved + \" \" : \"\") + reservedWords.strict;\n this.reservedWordsStrict = wordsRegexp(reservedStrict);\n this.reservedWordsStrictBind = wordsRegexp(reservedStrict + \" \" + reservedWords.strictBind);\n this.input = String(input);\n\n // Used to signal to callers of `readWord1` whether the word\n // contained any escape sequences. This is needed because words with\n // escape sequences must not be interpreted as keywords.\n this.containsEsc = false;\n\n // Set up token state\n\n // The current position of the tokenizer in the input.\n if (startPos) {\n this.pos = startPos;\n this.lineStart = this.input.lastIndexOf(\"\\n\", startPos - 1) + 1;\n this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;\n } else {\n this.pos = this.lineStart = 0;\n this.curLine = 1;\n }\n\n // Properties of the current token:\n // Its type\n this.type = types$1.eof;\n // For tokens that include more information than their type, the value\n this.value = null;\n // Its start and end offset\n this.start = this.end = this.pos;\n // And, if locations are used, the {line, column} object\n // corresponding to those offsets\n this.startLoc = this.endLoc = this.curPosition();\n\n // Position information for the previous token\n this.lastTokEndLoc = this.lastTokStartLoc = null;\n this.lastTokStart = this.lastTokEnd = this.pos;\n\n // The context stack is used to superficially track syntactic\n // context to predict whether a regular expression is allowed in a\n // given position.\n this.context = this.initialContext();\n this.exprAllowed = true;\n\n // Figure out if it's a module code.\n this.inModule = options.sourceType === \"module\";\n this.strict = this.inModule || this.strictDirective(this.pos);\n\n // Used to signify the start of a potential arrow function\n this.potentialArrowAt = -1;\n this.potentialArrowInForAwait = false;\n\n // Positions to delayed-check that yield/await does not exist in default parameters.\n this.yieldPos = this.awaitPos = this.awaitIdentPos = 0;\n // Labels in scope.\n this.labels = [];\n // Thus-far undefined exports.\n this.undefinedExports = Object.create(null);\n\n // If enabled, skip leading hashbang line.\n if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === \"#!\")\n { this.skipLineComment(2); }\n\n // Scope tracking for duplicate variable names (see scope.js)\n this.scopeStack = [];\n this.enterScope(SCOPE_TOP);\n\n // For RegExp validation\n this.regexpState = null;\n\n // The stack of private names.\n // Each element has two properties: 'declared' and 'used'.\n // When it exited from the outermost class definition, all used private names must be declared.\n this.privateNameStack = [];\n};\n\nvar prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },allowNewDotTarget: { configurable: true },inClassStaticBlock: { configurable: true } };\n\nParser.prototype.parse = function parse () {\n var node = this.options.program || this.startNode();\n this.nextToken();\n return this.parseTopLevel(node)\n};\n\nprototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };\n\nprototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 };\n\nprototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 };\n\nprototypeAccessors.canAwait.get = function () {\n for (var i = this.scopeStack.length - 1; i >= 0; i--) {\n var ref = this.scopeStack[i];\n var flags = ref.flags;\n if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT)) { return false }\n if (flags & SCOPE_FUNCTION) { return (flags & SCOPE_ASYNC) > 0 }\n }\n return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction\n};\n\nprototypeAccessors.allowSuper.get = function () {\n var ref = this.currentThisScope();\n var flags = ref.flags;\n return (flags & SCOPE_SUPER) > 0 || this.options.allowSuperOutsideMethod\n};\n\nprototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };\n\nprototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };\n\nprototypeAccessors.allowNewDotTarget.get = function () {\n for (var i = this.scopeStack.length - 1; i >= 0; i--) {\n var ref = this.scopeStack[i];\n var flags = ref.flags;\n if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT) ||\n ((flags & SCOPE_FUNCTION) && !(flags & SCOPE_ARROW))) { return true }\n }\n return false\n};\n\nprototypeAccessors.inClassStaticBlock.get = function () {\n return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0\n};\n\nParser.extend = function extend () {\n var plugins = [], len = arguments.length;\n while ( len-- ) plugins[ len ] = arguments[ len ];\n\n var cls = this;\n for (var i = 0; i < plugins.length; i++) { cls = plugins[i](cls); }\n return cls\n};\n\nParser.parse = function parse (input, options) {\n return new this(options, input).parse()\n};\n\nParser.parseExpressionAt = function parseExpressionAt (input, pos, options) {\n var parser = new this(options, input, pos);\n parser.nextToken();\n return parser.parseExpression()\n};\n\nParser.tokenizer = function tokenizer (input, options) {\n return new this(options, input)\n};\n\nObject.defineProperties( Parser.prototype, prototypeAccessors );\n\nvar pp$9 = Parser.prototype;\n\n// ## Parser utilities\n\nvar literal = /^(?:'((?:\\\\[^]|[^'\\\\])*?)'|\"((?:\\\\[^]|[^\"\\\\])*?)\")/;\npp$9.strictDirective = function(start) {\n if (this.options.ecmaVersion < 5) { return false }\n for (;;) {\n // Try to find string literal.\n skipWhiteSpace.lastIndex = start;\n start += skipWhiteSpace.exec(this.input)[0].length;\n var match = literal.exec(this.input.slice(start));\n if (!match) { return false }\n if ((match[1] || match[2]) === \"use strict\") {\n skipWhiteSpace.lastIndex = start + match[0].length;\n var spaceAfter = skipWhiteSpace.exec(this.input), end = spaceAfter.index + spaceAfter[0].length;\n var next = this.input.charAt(end);\n return next === \";\" || next === \"}\" ||\n (lineBreak.test(spaceAfter[0]) &&\n !(/[(`.[+\\-/*%<>=,?^&]/.test(next) || next === \"!\" && this.input.charAt(end + 1) === \"=\"))\n }\n start += match[0].length;\n\n // Skip semicolon, if any.\n skipWhiteSpace.lastIndex = start;\n start += skipWhiteSpace.exec(this.input)[0].length;\n if (this.input[start] === \";\")\n { start++; }\n }\n};\n\n// Predicate that tests whether the next token is of the given\n// type, and if yes, consumes it as a side effect.\n\npp$9.eat = function(type) {\n if (this.type === type) {\n this.next();\n return true\n } else {\n return false\n }\n};\n\n// Tests whether parsed token is a contextual keyword.\n\npp$9.isContextual = function(name) {\n return this.type === types$1.name && this.value === name && !this.containsEsc\n};\n\n// Consumes contextual keyword if possible.\n\npp$9.eatContextual = function(name) {\n if (!this.isContextual(name)) { return false }\n this.next();\n return true\n};\n\n// Asserts that following token is given contextual keyword.\n\npp$9.expectContextual = function(name) {\n if (!this.eatContextual(name)) { this.unexpected(); }\n};\n\n// Test whether a semicolon can be inserted at the current position.\n\npp$9.canInsertSemicolon = function() {\n return this.type === types$1.eof ||\n this.type === types$1.braceR ||\n lineBreak.test(this.input.slice(this.lastTokEnd, this.start))\n};\n\npp$9.insertSemicolon = function() {\n if (this.canInsertSemicolon()) {\n if (this.options.onInsertedSemicolon)\n { this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); }\n return true\n }\n};\n\n// Consume a semicolon, or, failing that, see if we are allowed to\n// pretend that there is a semicolon at this position.\n\npp$9.semicolon = function() {\n if (!this.eat(types$1.semi) && !this.insertSemicolon()) { this.unexpected(); }\n};\n\npp$9.afterTrailingComma = function(tokType, notNext) {\n if (this.type === tokType) {\n if (this.options.onTrailingComma)\n { this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); }\n if (!notNext)\n { this.next(); }\n return true\n }\n};\n\n// Expect a token of a given type. If found, consume it, otherwise,\n// raise an unexpected token error.\n\npp$9.expect = function(type) {\n this.eat(type) || this.unexpected();\n};\n\n// Raise an unexpected token error.\n\npp$9.unexpected = function(pos) {\n this.raise(pos != null ? pos : this.start, \"Unexpected token\");\n};\n\nvar DestructuringErrors = function DestructuringErrors() {\n this.shorthandAssign =\n this.trailingComma =\n this.parenthesizedAssign =\n this.parenthesizedBind =\n this.doubleProto =\n -1;\n};\n\npp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {\n if (!refDestructuringErrors) { return }\n if (refDestructuringErrors.trailingComma > -1)\n { this.raiseRecoverable(refDestructuringErrors.trailingComma, \"Comma is not permitted after the rest element\"); }\n var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind;\n if (parens > -1) { this.raiseRecoverable(parens, isAssign ? \"Assigning to rvalue\" : \"Parenthesized pattern\"); }\n};\n\npp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) {\n if (!refDestructuringErrors) { return false }\n var shorthandAssign = refDestructuringErrors.shorthandAssign;\n var doubleProto = refDestructuringErrors.doubleProto;\n if (!andThrow) { return shorthandAssign >= 0 || doubleProto >= 0 }\n if (shorthandAssign >= 0)\n { this.raise(shorthandAssign, \"Shorthand property assignments are valid only in destructuring patterns\"); }\n if (doubleProto >= 0)\n { this.raiseRecoverable(doubleProto, \"Redefinition of __proto__ property\"); }\n};\n\npp$9.checkYieldAwaitInDefaultParams = function() {\n if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))\n { this.raise(this.yieldPos, \"Yield expression cannot be a default value\"); }\n if (this.awaitPos)\n { this.raise(this.awaitPos, \"Await expression cannot be a default value\"); }\n};\n\npp$9.isSimpleAssignTarget = function(expr) {\n if (expr.type === \"ParenthesizedExpression\")\n { return this.isSimpleAssignTarget(expr.expression) }\n return expr.type === \"Identifier\" || expr.type === \"MemberExpression\"\n};\n\nvar pp$8 = Parser.prototype;\n\n// ### Statement parsing\n\n// Parse a program. Initializes the parser, reads any number of\n// statements, and wraps them in a Program node. Optionally takes a\n// `program` argument. If present, the statements will be appended\n// to its body instead of creating a new node.\n\npp$8.parseTopLevel = function(node) {\n var exports = Object.create(null);\n if (!node.body) { node.body = []; }\n while (this.type !== types$1.eof) {\n var stmt = this.parseStatement(null, true, exports);\n node.body.push(stmt);\n }\n if (this.inModule)\n { for (var i = 0, list = Object.keys(this.undefinedExports); i < list.length; i += 1)\n {\n var name = list[i];\n\n this.raiseRecoverable(this.undefinedExports[name].start, (\"Export '\" + name + \"' is not defined\"));\n } }\n this.adaptDirectivePrologue(node.body);\n this.next();\n node.sourceType = this.options.sourceType;\n return this.finishNode(node, \"Program\")\n};\n\nvar loopLabel = {kind: \"loop\"}, switchLabel = {kind: \"switch\"};\n\npp$8.isLet = function(context) {\n if (this.options.ecmaVersion < 6 || !this.isContextual(\"let\")) { return false }\n skipWhiteSpace.lastIndex = this.pos;\n var skip = skipWhiteSpace.exec(this.input);\n var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);\n // For ambiguous cases, determine if a LexicalDeclaration (or only a\n // Statement) is allowed here. If context is not empty then only a Statement\n // is allowed. However, `let [` is an explicit negative lookahead for\n // ExpressionStatement, so special-case it first.\n if (nextCh === 91 || nextCh === 92) { return true } // '[', '\\'\n if (context) { return false }\n\n if (nextCh === 123 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true } // '{', astral\n if (isIdentifierStart(nextCh, true)) {\n var pos = next + 1;\n while (isIdentifierChar(nextCh = this.input.charCodeAt(pos), true)) { ++pos; }\n if (nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true }\n var ident = this.input.slice(next, pos);\n if (!keywordRelationalOperator.test(ident)) { return true }\n }\n return false\n};\n\n// check 'async [no LineTerminator here] function'\n// - 'async /*foo*/ function' is OK.\n// - 'async /*\\n*/ function' is invalid.\npp$8.isAsyncFunction = function() {\n if (this.options.ecmaVersion < 8 || !this.isContextual(\"async\"))\n { return false }\n\n skipWhiteSpace.lastIndex = this.pos;\n var skip = skipWhiteSpace.exec(this.input);\n var next = this.pos + skip[0].length, after;\n return !lineBreak.test(this.input.slice(this.pos, next)) &&\n this.input.slice(next, next + 8) === \"function\" &&\n (next + 8 === this.input.length ||\n !(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 0xd7ff && after < 0xdc00))\n};\n\npp$8.isUsingKeyword = function(isAwaitUsing, isFor) {\n if (this.options.ecmaVersion < 17 || !this.isContextual(isAwaitUsing ? \"await\" : \"using\"))\n { return false }\n\n skipWhiteSpace.lastIndex = this.pos;\n var skip = skipWhiteSpace.exec(this.input);\n var next = this.pos + skip[0].length;\n\n if (lineBreak.test(this.input.slice(this.pos, next))) { return false }\n\n if (isAwaitUsing) {\n var awaitEndPos = next + 5 /* await */, after;\n if (this.input.slice(next, awaitEndPos) !== \"using\" ||\n awaitEndPos === this.input.length ||\n isIdentifierChar(after = this.input.charCodeAt(awaitEndPos)) ||\n (after > 0xd7ff && after < 0xdc00)\n ) { return false }\n\n skipWhiteSpace.lastIndex = awaitEndPos;\n var skipAfterUsing = skipWhiteSpace.exec(this.input);\n if (skipAfterUsing && lineBreak.test(this.input.slice(awaitEndPos, awaitEndPos + skipAfterUsing[0].length))) { return false }\n }\n\n if (isFor) {\n var ofEndPos = next + 2 /* of */, after$1;\n if (this.input.slice(next, ofEndPos) === \"of\") {\n if (ofEndPos === this.input.length ||\n (!isIdentifierChar(after$1 = this.input.charCodeAt(ofEndPos)) && !(after$1 > 0xd7ff && after$1 < 0xdc00))) { return false }\n }\n }\n\n var ch = this.input.charCodeAt(next);\n return isIdentifierStart(ch, true) || ch === 92 // '\\'\n};\n\npp$8.isAwaitUsing = function(isFor) {\n return this.isUsingKeyword(true, isFor)\n};\n\npp$8.isUsing = function(isFor) {\n return this.isUsingKeyword(false, isFor)\n};\n\n// Parse a single statement.\n//\n// If expecting a statement and finding a slash operator, parse a\n// regular expression literal. This is to handle cases like\n// `if (foo) /blah/.exec(foo)`, where looking at the previous token\n// does not help.\n\npp$8.parseStatement = function(context, topLevel, exports) {\n var starttype = this.type, node = this.startNode(), kind;\n\n if (this.isLet(context)) {\n starttype = types$1._var;\n kind = \"let\";\n }\n\n // Most types of statements are recognized by the keyword they\n // start with. Many are trivial to parse, some require a bit of\n // complexity.\n\n switch (starttype) {\n case types$1._break: case types$1._continue: return this.parseBreakContinueStatement(node, starttype.keyword)\n case types$1._debugger: return this.parseDebuggerStatement(node)\n case types$1._do: return this.parseDoStatement(node)\n case types$1._for: return this.parseForStatement(node)\n case types$1._function:\n // Function as sole body of either an if statement or a labeled statement\n // works, but not when it is part of a labeled statement that is the sole\n // body of an if statement.\n if ((context && (this.strict || context !== \"if\" && context !== \"label\")) && this.options.ecmaVersion >= 6) { this.unexpected(); }\n return this.parseFunctionStatement(node, false, !context)\n case types$1._class:\n if (context) { this.unexpected(); }\n return this.parseClass(node, true)\n case types$1._if: return this.parseIfStatement(node)\n case types$1._return: return this.parseReturnStatement(node)\n case types$1._switch: return this.parseSwitchStatement(node)\n case types$1._throw: return this.parseThrowStatement(node)\n case types$1._try: return this.parseTryStatement(node)\n case types$1._const: case types$1._var:\n kind = kind || this.value;\n if (context && kind !== \"var\") { this.unexpected(); }\n return this.parseVarStatement(node, kind)\n case types$1._while: return this.parseWhileStatement(node)\n case types$1._with: return this.parseWithStatement(node)\n case types$1.braceL: return this.parseBlock(true, node)\n case types$1.semi: return this.parseEmptyStatement(node)\n case types$1._export:\n case types$1._import:\n if (this.options.ecmaVersion > 10 && starttype === types$1._import) {\n skipWhiteSpace.lastIndex = this.pos;\n var skip = skipWhiteSpace.exec(this.input);\n var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);\n if (nextCh === 40 || nextCh === 46) // '(' or '.'\n { return this.parseExpressionStatement(node, this.parseExpression()) }\n }\n\n if (!this.options.allowImportExportEverywhere) {\n if (!topLevel)\n { this.raise(this.start, \"'import' and 'export' may only appear at the top level\"); }\n if (!this.inModule)\n { this.raise(this.start, \"'import' and 'export' may appear only with 'sourceType: module'\"); }\n }\n return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)\n\n // If the statement does not start with a statement keyword or a\n // brace, it's an ExpressionStatement or LabeledStatement. We\n // simply start parsing an expression, and afterwards, if the\n // next token is a colon and the expression was a simple\n // Identifier node, we switch to interpreting it as a label.\n default:\n if (this.isAsyncFunction()) {\n if (context) { this.unexpected(); }\n this.next();\n return this.parseFunctionStatement(node, true, !context)\n }\n\n var usingKind = this.isAwaitUsing(false) ? \"await using\" : this.isUsing(false) ? \"using\" : null;\n if (usingKind) {\n if (topLevel && this.options.sourceType === \"script\") {\n this.raise(this.start, \"Using declaration cannot appear in the top level when source type is `script`\");\n }\n if (usingKind === \"await using\") {\n if (!this.canAwait) {\n this.raise(this.start, \"Await using cannot appear outside of async function\");\n }\n this.next();\n }\n this.next();\n this.parseVar(node, false, usingKind);\n this.semicolon();\n return this.finishNode(node, \"VariableDeclaration\")\n }\n\n var maybeName = this.value, expr = this.parseExpression();\n if (starttype === types$1.name && expr.type === \"Identifier\" && this.eat(types$1.colon))\n { return this.parseLabeledStatement(node, maybeName, expr, context) }\n else { return this.parseExpressionStatement(node, expr) }\n }\n};\n\npp$8.parseBreakContinueStatement = function(node, keyword) {\n var isBreak = keyword === \"break\";\n this.next();\n if (this.eat(types$1.semi) || this.insertSemicolon()) { node.label = null; }\n else if (this.type !== types$1.name) { this.unexpected(); }\n else {\n node.label = this.parseIdent();\n this.semicolon();\n }\n\n // Verify that there is an actual destination to break or\n // continue to.\n var i = 0;\n for (; i < this.labels.length; ++i) {\n var lab = this.labels[i];\n if (node.label == null || lab.name === node.label.name) {\n if (lab.kind != null && (isBreak || lab.kind === \"loop\")) { break }\n if (node.label && isBreak) { break }\n }\n }\n if (i === this.labels.length) { this.raise(node.start, \"Unsyntactic \" + keyword); }\n return this.finishNode(node, isBreak ? \"BreakStatement\" : \"ContinueStatement\")\n};\n\npp$8.parseDebuggerStatement = function(node) {\n this.next();\n this.semicolon();\n return this.finishNode(node, \"DebuggerStatement\")\n};\n\npp$8.parseDoStatement = function(node) {\n this.next();\n this.labels.push(loopLabel);\n node.body = this.parseStatement(\"do\");\n this.labels.pop();\n this.expect(types$1._while);\n node.test = this.parseParenExpression();\n if (this.options.ecmaVersion >= 6)\n { this.eat(types$1.semi); }\n else\n { this.semicolon(); }\n return this.finishNode(node, \"DoWhileStatement\")\n};\n\n// Disambiguating between a `for` and a `for`/`in` or `for`/`of`\n// loop is non-trivial. Basically, we have to parse the init `var`\n// statement or expression, disallowing the `in` operator (see\n// the second parameter to `parseExpression`), and then check\n// whether the next token is `in` or `of`. When there is no init\n// part (semicolon immediately after the opening parenthesis), it\n// is a regular `for` loop.\n\npp$8.parseForStatement = function(node) {\n this.next();\n var awaitAt = (this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual(\"await\")) ? this.lastTokStart : -1;\n this.labels.push(loopLabel);\n this.enterScope(0);\n this.expect(types$1.parenL);\n if (this.type === types$1.semi) {\n if (awaitAt > -1) { this.unexpected(awaitAt); }\n return this.parseFor(node, null)\n }\n var isLet = this.isLet();\n if (this.type === types$1._var || this.type === types$1._const || isLet) {\n var init$1 = this.startNode(), kind = isLet ? \"let\" : this.value;\n this.next();\n this.parseVar(init$1, true, kind);\n this.finishNode(init$1, \"VariableDeclaration\");\n return this.parseForAfterInit(node, init$1, awaitAt)\n }\n var startsWithLet = this.isContextual(\"let\"), isForOf = false;\n\n var usingKind = this.isUsing(true) ? \"using\" : this.isAwaitUsing(true) ? \"await using\" : null;\n if (usingKind) {\n var init$2 = this.startNode();\n this.next();\n if (usingKind === \"await using\") { this.next(); }\n this.parseVar(init$2, true, usingKind);\n this.finishNode(init$2, \"VariableDeclaration\");\n return this.parseForAfterInit(node, init$2, awaitAt)\n }\n var containsEsc = this.containsEsc;\n var refDestructuringErrors = new DestructuringErrors;\n var initPos = this.start;\n var init = awaitAt > -1\n ? this.parseExprSubscripts(refDestructuringErrors, \"await\")\n : this.parseExpression(true, refDestructuringErrors);\n if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual(\"of\"))) {\n if (awaitAt > -1) { // implies `ecmaVersion >= 9` (see declaration of awaitAt)\n if (this.type === types$1._in) { this.unexpected(awaitAt); }\n node.await = true;\n } else if (isForOf && this.options.ecmaVersion >= 8) {\n if (init.start === initPos && !containsEsc && init.type === \"Identifier\" && init.name === \"async\") { this.unexpected(); }\n else if (this.options.ecmaVersion >= 9) { node.await = false; }\n }\n if (startsWithLet && isForOf) { this.raise(init.start, \"The left-hand side of a for-of loop may not start with 'let'.\"); }\n this.toAssignable(init, false, refDestructuringErrors);\n this.checkLValPattern(init);\n return this.parseForIn(node, init)\n } else {\n this.checkExpressionErrors(refDestructuringErrors, true);\n }\n if (awaitAt > -1) { this.unexpected(awaitAt); }\n return this.parseFor(node, init)\n};\n\n// Helper method to parse for loop after variable initialization\npp$8.parseForAfterInit = function(node, init, awaitAt) {\n if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual(\"of\"))) && init.declarations.length === 1) {\n if (this.options.ecmaVersion >= 9) {\n if (this.type === types$1._in) {\n if (awaitAt > -1) { this.unexpected(awaitAt); }\n } else { node.await = awaitAt > -1; }\n }\n return this.parseForIn(node, init)\n }\n if (awaitAt > -1) { this.unexpected(awaitAt); }\n return this.parseFor(node, init)\n};\n\npp$8.parseFunctionStatement = function(node, isAsync, declarationPosition) {\n this.next();\n return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync)\n};\n\npp$8.parseIfStatement = function(node) {\n this.next();\n node.test = this.parseParenExpression();\n // allow function declarations in branches, but only in non-strict mode\n node.consequent = this.parseStatement(\"if\");\n node.alternate = this.eat(types$1._else) ? this.parseStatement(\"if\") : null;\n return this.finishNode(node, \"IfStatement\")\n};\n\npp$8.parseReturnStatement = function(node) {\n if (!this.inFunction && !this.options.allowReturnOutsideFunction)\n { this.raise(this.start, \"'return' outside of function\"); }\n this.next();\n\n // In `return` (and `break`/`continue`), the keywords with\n // optional arguments, we eagerly look for a semicolon or the\n // possibility to insert one.\n\n if (this.eat(types$1.semi) || this.insertSemicolon()) { node.argument = null; }\n else { node.argument = this.parseExpression(); this.semicolon(); }\n return this.finishNode(node, \"ReturnStatement\")\n};\n\npp$8.parseSwitchStatement = function(node) {\n this.next();\n node.discriminant = this.parseParenExpression();\n node.cases = [];\n this.expect(types$1.braceL);\n this.labels.push(switchLabel);\n this.enterScope(0);\n\n // Statements under must be grouped (by label) in SwitchCase\n // nodes. `cur` is used to keep the node that we are currently\n // adding statements to.\n\n var cur;\n for (var sawDefault = false; this.type !== types$1.braceR;) {\n if (this.type === types$1._case || this.type === types$1._default) {\n var isCase = this.type === types$1._case;\n if (cur) { this.finishNode(cur, \"SwitchCase\"); }\n node.cases.push(cur = this.startNode());\n cur.consequent = [];\n this.next();\n if (isCase) {\n cur.test = this.parseExpression();\n } else {\n if (sawDefault) { this.raiseRecoverable(this.lastTokStart, \"Multiple default clauses\"); }\n sawDefault = true;\n cur.test = null;\n }\n this.expect(types$1.colon);\n } else {\n if (!cur) { this.unexpected(); }\n cur.consequent.push(this.parseStatement(null));\n }\n }\n this.exitScope();\n if (cur) { this.finishNode(cur, \"SwitchCase\"); }\n this.next(); // Closing brace\n this.labels.pop();\n return this.finishNode(node, \"SwitchStatement\")\n};\n\npp$8.parseThrowStatement = function(node) {\n this.next();\n if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))\n { this.raise(this.lastTokEnd, \"Illegal newline after throw\"); }\n node.argument = this.parseExpression();\n this.semicolon();\n return this.finishNode(node, \"ThrowStatement\")\n};\n\n// Reused empty array added for node fields that are always empty.\n\nvar empty$1 = [];\n\npp$8.parseCatchClauseParam = function() {\n var param = this.parseBindingAtom();\n var simple = param.type === \"Identifier\";\n this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);\n this.checkLValPattern(param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);\n this.expect(types$1.parenR);\n\n return param\n};\n\npp$8.parseTryStatement = function(node) {\n this.next();\n node.block = this.parseBlock();\n node.handler = null;\n if (this.type === types$1._catch) {\n var clause = this.startNode();\n this.next();\n if (this.eat(types$1.parenL)) {\n clause.param = this.parseCatchClauseParam();\n } else {\n if (this.options.ecmaVersion < 10) { this.unexpected(); }\n clause.param = null;\n this.enterScope(0);\n }\n clause.body = this.parseBlock(false);\n this.exitScope();\n node.handler = this.finishNode(clause, \"CatchClause\");\n }\n node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;\n if (!node.handler && !node.finalizer)\n { this.raise(node.start, \"Missing catch or finally clause\"); }\n return this.finishNode(node, \"TryStatement\")\n};\n\npp$8.parseVarStatement = function(node, kind, allowMissingInitializer) {\n this.next();\n this.parseVar(node, false, kind, allowMissingInitializer);\n this.semicolon();\n return this.finishNode(node, \"VariableDeclaration\")\n};\n\npp$8.parseWhileStatement = function(node) {\n this.next();\n node.test = this.parseParenExpression();\n this.labels.push(loopLabel);\n node.body = this.parseStatement(\"while\");\n this.labels.pop();\n return this.finishNode(node, \"WhileStatement\")\n};\n\npp$8.parseWithStatement = function(node) {\n if (this.strict) { this.raise(this.start, \"'with' in strict mode\"); }\n this.next();\n node.object = this.parseParenExpression();\n node.body = this.parseStatement(\"with\");\n return this.finishNode(node, \"WithStatement\")\n};\n\npp$8.parseEmptyStatement = function(node) {\n this.next();\n return this.finishNode(node, \"EmptyStatement\")\n};\n\npp$8.parseLabeledStatement = function(node, maybeName, expr, context) {\n for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1)\n {\n var label = list[i$1];\n\n if (label.name === maybeName)\n { this.raise(expr.start, \"Label '\" + maybeName + \"' is already declared\");\n } }\n var kind = this.type.isLoop ? \"loop\" : this.type === types$1._switch ? \"switch\" : null;\n for (var i = this.labels.length - 1; i >= 0; i--) {\n var label$1 = this.labels[i];\n if (label$1.statementStart === node.start) {\n // Update information about previous labels on this node\n label$1.statementStart = this.start;\n label$1.kind = kind;\n } else { break }\n }\n this.labels.push({name: maybeName, kind: kind, statementStart: this.start});\n node.body = this.parseStatement(context ? context.indexOf(\"label\") === -1 ? context + \"label\" : context : \"label\");\n this.labels.pop();\n node.label = expr;\n return this.finishNode(node, \"LabeledStatement\")\n};\n\npp$8.parseExpressionStatement = function(node, expr) {\n node.expression = expr;\n this.semicolon();\n return this.finishNode(node, \"ExpressionStatement\")\n};\n\n// Parse a semicolon-enclosed block of statements, handling `\"use\n// strict\"` declarations when `allowStrict` is true (used for\n// function bodies).\n\npp$8.parseBlock = function(createNewLexicalScope, node, exitStrict) {\n if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;\n if ( node === void 0 ) node = this.startNode();\n\n node.body = [];\n this.expect(types$1.braceL);\n if (createNewLexicalScope) { this.enterScope(0); }\n while (this.type !== types$1.braceR) {\n var stmt = this.parseStatement(null);\n node.body.push(stmt);\n }\n if (exitStrict) { this.strict = false; }\n this.next();\n if (createNewLexicalScope) { this.exitScope(); }\n return this.finishNode(node, \"BlockStatement\")\n};\n\n// Parse a regular `for` loop. The disambiguation code in\n// `parseStatement` will already have parsed the init statement or\n// expression.\n\npp$8.parseFor = function(node, init) {\n node.init = init;\n this.expect(types$1.semi);\n node.test = this.type === types$1.semi ? null : this.parseExpression();\n this.expect(types$1.semi);\n node.update = this.type === types$1.parenR ? null : this.parseExpression();\n this.expect(types$1.parenR);\n node.body = this.parseStatement(\"for\");\n this.exitScope();\n this.labels.pop();\n return this.finishNode(node, \"ForStatement\")\n};\n\n// Parse a `for`/`in` and `for`/`of` loop, which are almost\n// same from parser's perspective.\n\npp$8.parseForIn = function(node, init) {\n var isForIn = this.type === types$1._in;\n this.next();\n\n if (\n init.type === \"VariableDeclaration\" &&\n init.declarations[0].init != null &&\n (\n !isForIn ||\n this.options.ecmaVersion < 8 ||\n this.strict ||\n init.kind !== \"var\" ||\n init.declarations[0].id.type !== \"Identifier\"\n )\n ) {\n this.raise(\n init.start,\n ((isForIn ? \"for-in\" : \"for-of\") + \" loop variable declaration may not have an initializer\")\n );\n }\n node.left = init;\n node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();\n this.expect(types$1.parenR);\n node.body = this.parseStatement(\"for\");\n this.exitScope();\n this.labels.pop();\n return this.finishNode(node, isForIn ? \"ForInStatement\" : \"ForOfStatement\")\n};\n\n// Parse a list of variable declarations.\n\npp$8.parseVar = function(node, isFor, kind, allowMissingInitializer) {\n node.declarations = [];\n node.kind = kind;\n for (;;) {\n var decl = this.startNode();\n this.parseVarId(decl, kind);\n if (this.eat(types$1.eq)) {\n decl.init = this.parseMaybeAssign(isFor);\n } else if (!allowMissingInitializer && kind === \"const\" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual(\"of\")))) {\n this.unexpected();\n } else if (!allowMissingInitializer && (kind === \"using\" || kind === \"await using\") && this.options.ecmaVersion >= 17 && this.type !== types$1._in && !this.isContextual(\"of\")) {\n this.raise(this.lastTokEnd, (\"Missing initializer in \" + kind + \" declaration\"));\n } else if (!allowMissingInitializer && decl.id.type !== \"Identifier\" && !(isFor && (this.type === types$1._in || this.isContextual(\"of\")))) {\n this.raise(this.lastTokEnd, \"Complex binding patterns require an initialization value\");\n } else {\n decl.init = null;\n }\n node.declarations.push(this.finishNode(decl, \"VariableDeclarator\"));\n if (!this.eat(types$1.comma)) { break }\n }\n return node\n};\n\npp$8.parseVarId = function(decl, kind) {\n decl.id = kind === \"using\" || kind === \"await using\"\n ? this.parseIdent()\n : this.parseBindingAtom();\n\n this.checkLValPattern(decl.id, kind === \"var\" ? BIND_VAR : BIND_LEXICAL, false);\n};\n\nvar FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;\n\n// Parse a function declaration or literal (depending on the\n// `statement & FUNC_STATEMENT`).\n\n// Remove `allowExpressionBody` for 7.0.0, as it is only called with false\npp$8.parseFunction = function(node, statement, allowExpressionBody, isAsync, forInit) {\n this.initFunction(node);\n if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {\n if (this.type === types$1.star && (statement & FUNC_HANGING_STATEMENT))\n { this.unexpected(); }\n node.generator = this.eat(types$1.star);\n }\n if (this.options.ecmaVersion >= 8)\n { node.async = !!isAsync; }\n\n if (statement & FUNC_STATEMENT) {\n node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types$1.name ? null : this.parseIdent();\n if (node.id && !(statement & FUNC_HANGING_STATEMENT))\n // If it is a regular function declaration in sloppy mode, then it is\n // subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding\n // mode depends on properties of the current scope (see\n // treatFunctionsAsVar).\n { this.checkLValSimple(node.id, (this.strict || node.generator || node.async) ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION); }\n }\n\n var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;\n this.yieldPos = 0;\n this.awaitPos = 0;\n this.awaitIdentPos = 0;\n this.enterScope(functionFlags(node.async, node.generator));\n\n if (!(statement & FUNC_STATEMENT))\n { node.id = this.type === types$1.name ? this.parseIdent() : null; }\n\n this.parseFunctionParams(node);\n this.parseFunctionBody(node, allowExpressionBody, false, forInit);\n\n this.yieldPos = oldYieldPos;\n this.awaitPos = oldAwaitPos;\n this.awaitIdentPos = oldAwaitIdentPos;\n return this.finishNode(node, (statement & FUNC_STATEMENT) ? \"FunctionDeclaration\" : \"FunctionExpression\")\n};\n\npp$8.parseFunctionParams = function(node) {\n this.expect(types$1.parenL);\n node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);\n this.checkYieldAwaitInDefaultParams();\n};\n\n// Parse a class declaration or literal (depending on the\n// `isStatement` parameter).\n\npp$8.parseClass = function(node, isStatement) {\n this.next();\n\n // ecma-262 14.6 Class Definitions\n // A class definition is always strict mode code.\n var oldStrict = this.strict;\n this.strict = true;\n\n this.parseClassId(node, isStatement);\n this.parseClassSuper(node);\n var privateNameMap = this.enterClassBody();\n var classBody = this.startNode();\n var hadConstructor = false;\n classBody.body = [];\n this.expect(types$1.braceL);\n while (this.type !== types$1.braceR) {\n var element = this.parseClassElement(node.superClass !== null);\n if (element) {\n classBody.body.push(element);\n if (element.type === \"MethodDefinition\" && element.kind === \"constructor\") {\n if (hadConstructor) { this.raiseRecoverable(element.start, \"Duplicate constructor in the same class\"); }\n hadConstructor = true;\n } else if (element.key && element.key.type === \"PrivateIdentifier\" && isPrivateNameConflicted(privateNameMap, element)) {\n this.raiseRecoverable(element.key.start, (\"Identifier '#\" + (element.key.name) + \"' has already been declared\"));\n }\n }\n }\n this.strict = oldStrict;\n this.next();\n node.body = this.finishNode(classBody, \"ClassBody\");\n this.exitClassBody();\n return this.finishNode(node, isStatement ? \"ClassDeclaration\" : \"ClassExpression\")\n};\n\npp$8.parseClassElement = function(constructorAllowsSuper) {\n if (this.eat(types$1.semi)) { return null }\n\n var ecmaVersion = this.options.ecmaVersion;\n var node = this.startNode();\n var keyName = \"\";\n var isGenerator = false;\n var isAsync = false;\n var kind = \"method\";\n var isStatic = false;\n\n if (this.eatContextual(\"static\")) {\n // Parse static init block\n if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {\n this.parseClassStaticBlock(node);\n return node\n }\n if (this.isClassElementNameStart() || this.type === types$1.star) {\n isStatic = true;\n } else {\n keyName = \"static\";\n }\n }\n node.static = isStatic;\n if (!keyName && ecmaVersion >= 8 && this.eatContextual(\"async\")) {\n if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) {\n isAsync = true;\n } else {\n keyName = \"async\";\n }\n }\n if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) {\n isGenerator = true;\n }\n if (!keyName && !isAsync && !isGenerator) {\n var lastValue = this.value;\n if (this.eatContextual(\"get\") || this.eatContextual(\"set\")) {\n if (this.isClassElementNameStart()) {\n kind = lastValue;\n } else {\n keyName = lastValue;\n }\n }\n }\n\n // Parse element name\n if (keyName) {\n // 'async', 'get', 'set', or 'static' were not a keyword contextually.\n // The last token is any of those. Make it the element name.\n node.computed = false;\n node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc);\n node.key.name = keyName;\n this.finishNode(node.key, \"Identifier\");\n } else {\n this.parseClassElementName(node);\n }\n\n // Parse element value\n if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== \"method\" || isGenerator || isAsync) {\n var isConstructor = !node.static && checkKeyName(node, \"constructor\");\n var allowsDirectSuper = isConstructor && constructorAllowsSuper;\n // Couldn't move this check into the 'parseClassMethod' method for backward compatibility.\n if (isConstructor && kind !== \"method\") { this.raise(node.key.start, \"Constructor can't have get/set modifier\"); }\n node.kind = isConstructor ? \"constructor\" : kind;\n this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper);\n } else {\n this.parseClassField(node);\n }\n\n return node\n};\n\npp$8.isClassElementNameStart = function() {\n return (\n this.type === types$1.name ||\n this.type === types$1.privateId ||\n this.type === types$1.num ||\n this.type === types$1.string ||\n this.type === types$1.bracketL ||\n this.type.keyword\n )\n};\n\npp$8.parseClassElementName = function(element) {\n if (this.type === types$1.privateId) {\n if (this.value === \"constructor\") {\n this.raise(this.start, \"Classes can't have an element named '#constructor'\");\n }\n element.computed = false;\n element.key = this.parsePrivateIdent();\n } else {\n this.parsePropertyName(element);\n }\n};\n\npp$8.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {\n // Check key and flags\n var key = method.key;\n if (method.kind === \"constructor\") {\n if (isGenerator) { this.raise(key.start, \"Constructor can't be a generator\"); }\n if (isAsync) { this.raise(key.start, \"Constructor can't be an async method\"); }\n } else if (method.static && checkKeyName(method, \"prototype\")) {\n this.raise(key.start, \"Classes may not have a static property named prototype\");\n }\n\n // Parse value\n var value = method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper);\n\n // Check value\n if (method.kind === \"get\" && value.params.length !== 0)\n { this.raiseRecoverable(value.start, \"getter should have no params\"); }\n if (method.kind === \"set\" && value.params.length !== 1)\n { this.raiseRecoverable(value.start, \"setter should have exactly one param\"); }\n if (method.kind === \"set\" && value.params[0].type === \"RestElement\")\n { this.raiseRecoverable(value.params[0].start, \"Setter cannot use rest params\"); }\n\n return this.finishNode(method, \"MethodDefinition\")\n};\n\npp$8.parseClassField = function(field) {\n if (checkKeyName(field, \"constructor\")) {\n this.raise(field.key.start, \"Classes can't have a field named 'constructor'\");\n } else if (field.static && checkKeyName(field, \"prototype\")) {\n this.raise(field.key.start, \"Classes can't have a static field named 'prototype'\");\n }\n\n if (this.eat(types$1.eq)) {\n // To raise SyntaxError if 'arguments' exists in the initializer.\n this.enterScope(SCOPE_CLASS_FIELD_INIT | SCOPE_SUPER);\n field.value = this.parseMaybeAssign();\n this.exitScope();\n } else {\n field.value = null;\n }\n this.semicolon();\n\n return this.finishNode(field, \"PropertyDefinition\")\n};\n\npp$8.parseClassStaticBlock = function(node) {\n node.body = [];\n\n var oldLabels = this.labels;\n this.labels = [];\n this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER);\n while (this.type !== types$1.braceR) {\n var stmt = this.parseStatement(null);\n node.body.push(stmt);\n }\n this.next();\n this.exitScope();\n this.labels = oldLabels;\n\n return this.finishNode(node, \"StaticBlock\")\n};\n\npp$8.parseClassId = function(node, isStatement) {\n if (this.type === types$1.name) {\n node.id = this.parseIdent();\n if (isStatement)\n { this.checkLValSimple(node.id, BIND_LEXICAL, false); }\n } else {\n if (isStatement === true)\n { this.unexpected(); }\n node.id = null;\n }\n};\n\npp$8.parseClassSuper = function(node) {\n node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(null, false) : null;\n};\n\npp$8.enterClassBody = function() {\n var element = {declared: Object.create(null), used: []};\n this.privateNameStack.push(element);\n return element.declared\n};\n\npp$8.exitClassBody = function() {\n var ref = this.privateNameStack.pop();\n var declared = ref.declared;\n var used = ref.used;\n if (!this.options.checkPrivateFields) { return }\n var len = this.privateNameStack.length;\n var parent = len === 0 ? null : this.privateNameStack[len - 1];\n for (var i = 0; i < used.length; ++i) {\n var id = used[i];\n if (!hasOwn(declared, id.name)) {\n if (parent) {\n parent.used.push(id);\n } else {\n this.raiseRecoverable(id.start, (\"Private field '#\" + (id.name) + \"' must be declared in an enclosing class\"));\n }\n }\n }\n};\n\nfunction isPrivateNameConflicted(privateNameMap, element) {\n var name = element.key.name;\n var curr = privateNameMap[name];\n\n var next = \"true\";\n if (element.type === \"MethodDefinition\" && (element.kind === \"get\" || element.kind === \"set\")) {\n next = (element.static ? \"s\" : \"i\") + element.kind;\n }\n\n // `class { get #a(){}; static set #a(_){} }` is also conflict.\n if (\n curr === \"iget\" && next === \"iset\" ||\n curr === \"iset\" && next === \"iget\" ||\n curr === \"sget\" && next === \"sset\" ||\n curr === \"sset\" && next === \"sget\"\n ) {\n privateNameMap[name] = \"true\";\n return false\n } else if (!curr) {\n privateNameMap[name] = next;\n return false\n } else {\n return true\n }\n}\n\nfunction checkKeyName(node, name) {\n var computed = node.computed;\n var key = node.key;\n return !computed && (\n key.type === \"Identifier\" && key.name === name ||\n key.type === \"Literal\" && key.value === name\n )\n}\n\n// Parses module export declaration.\n\npp$8.parseExportAllDeclaration = function(node, exports) {\n if (this.options.ecmaVersion >= 11) {\n if (this.eatContextual(\"as\")) {\n node.exported = this.parseModuleExportName();\n this.checkExport(exports, node.exported, this.lastTokStart);\n } else {\n node.exported = null;\n }\n }\n this.expectContextual(\"from\");\n if (this.type !== types$1.string) { this.unexpected(); }\n node.source = this.parseExprAtom();\n if (this.options.ecmaVersion >= 16)\n { node.attributes = this.parseWithClause(); }\n this.semicolon();\n return this.finishNode(node, \"ExportAllDeclaration\")\n};\n\npp$8.parseExport = function(node, exports) {\n this.next();\n // export * from '...'\n if (this.eat(types$1.star)) {\n return this.parseExportAllDeclaration(node, exports)\n }\n if (this.eat(types$1._default)) { // export default ...\n this.checkExport(exports, \"default\", this.lastTokStart);\n node.declaration = this.parseExportDefaultDeclaration();\n return this.finishNode(node, \"ExportDefaultDeclaration\")\n }\n // export var|const|let|function|class ...\n if (this.shouldParseExportStatement()) {\n node.declaration = this.parseExportDeclaration(node);\n if (node.declaration.type === \"VariableDeclaration\")\n { this.checkVariableExport(exports, node.declaration.declarations); }\n else\n { this.checkExport(exports, node.declaration.id, node.declaration.id.start); }\n node.specifiers = [];\n node.source = null;\n if (this.options.ecmaVersion >= 16)\n { node.attributes = []; }\n } else { // export { x, y as z } [from '...']\n node.declaration = null;\n node.specifiers = this.parseExportSpecifiers(exports);\n if (this.eatContextual(\"from\")) {\n if (this.type !== types$1.string) { this.unexpected(); }\n node.source = this.parseExprAtom();\n if (this.options.ecmaVersion >= 16)\n { node.attributes = this.parseWithClause(); }\n } else {\n for (var i = 0, list = node.specifiers; i < list.length; i += 1) {\n // check for keywords used as local names\n var spec = list[i];\n\n this.checkUnreserved(spec.local);\n // check if export is defined\n this.checkLocalExport(spec.local);\n\n if (spec.local.type === \"Literal\") {\n this.raise(spec.local.start, \"A string literal cannot be used as an exported binding without `from`.\");\n }\n }\n\n node.source = null;\n if (this.options.ecmaVersion >= 16)\n { node.attributes = []; }\n }\n this.semicolon();\n }\n return this.finishNode(node, \"ExportNamedDeclaration\")\n};\n\npp$8.parseExportDeclaration = function(node) {\n return this.parseStatement(null)\n};\n\npp$8.parseExportDefaultDeclaration = function() {\n var isAsync;\n if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {\n var fNode = this.startNode();\n this.next();\n if (isAsync) { this.next(); }\n return this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync)\n } else if (this.type === types$1._class) {\n var cNode = this.startNode();\n return this.parseClass(cNode, \"nullableID\")\n } else {\n var declaration = this.parseMaybeAssign();\n this.semicolon();\n return declaration\n }\n};\n\npp$8.checkExport = function(exports, name, pos) {\n if (!exports) { return }\n if (typeof name !== \"string\")\n { name = name.type === \"Identifier\" ? name.name : name.value; }\n if (hasOwn(exports, name))\n { this.raiseRecoverable(pos, \"Duplicate export '\" + name + \"'\"); }\n exports[name] = true;\n};\n\npp$8.checkPatternExport = function(exports, pat) {\n var type = pat.type;\n if (type === \"Identifier\")\n { this.checkExport(exports, pat, pat.start); }\n else if (type === \"ObjectPattern\")\n { for (var i = 0, list = pat.properties; i < list.length; i += 1)\n {\n var prop = list[i];\n\n this.checkPatternExport(exports, prop);\n } }\n else if (type === \"ArrayPattern\")\n { for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {\n var elt = list$1[i$1];\n\n if (elt) { this.checkPatternExport(exports, elt); }\n } }\n else if (type === \"Property\")\n { this.checkPatternExport(exports, pat.value); }\n else if (type === \"AssignmentPattern\")\n { this.checkPatternExport(exports, pat.left); }\n else if (type === \"RestElement\")\n { this.checkPatternExport(exports, pat.argument); }\n};\n\npp$8.checkVariableExport = function(exports, decls) {\n if (!exports) { return }\n for (var i = 0, list = decls; i < list.length; i += 1)\n {\n var decl = list[i];\n\n this.checkPatternExport(exports, decl.id);\n }\n};\n\npp$8.shouldParseExportStatement = function() {\n return this.type.keyword === \"var\" ||\n this.type.keyword === \"const\" ||\n this.type.keyword === \"class\" ||\n this.type.keyword === \"function\" ||\n this.isLet() ||\n this.isAsyncFunction()\n};\n\n// Parses a comma-separated list of module exports.\n\npp$8.parseExportSpecifier = function(exports) {\n var node = this.startNode();\n node.local = this.parseModuleExportName();\n\n node.exported = this.eatContextual(\"as\") ? this.parseModuleExportName() : node.local;\n this.checkExport(\n exports,\n node.exported,\n node.exported.start\n );\n\n return this.finishNode(node, \"ExportSpecifier\")\n};\n\npp$8.parseExportSpecifiers = function(exports) {\n var nodes = [], first = true;\n // export { x, y as z } [from '...']\n this.expect(types$1.braceL);\n while (!this.eat(types$1.braceR)) {\n if (!first) {\n this.expect(types$1.comma);\n if (this.afterTrailingComma(types$1.braceR)) { break }\n } else { first = false; }\n\n nodes.push(this.parseExportSpecifier(exports));\n }\n return nodes\n};\n\n// Parses import declaration.\n\npp$8.parseImport = function(node) {\n this.next();\n\n // import '...'\n if (this.type === types$1.string) {\n node.specifiers = empty$1;\n node.source = this.parseExprAtom();\n } else {\n node.specifiers = this.parseImportSpecifiers();\n this.expectContextual(\"from\");\n node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();\n }\n if (this.options.ecmaVersion >= 16)\n { node.attributes = this.parseWithClause(); }\n this.semicolon();\n return this.finishNode(node, \"ImportDeclaration\")\n};\n\n// Parses a comma-separated list of module imports.\n\npp$8.parseImportSpecifier = function() {\n var node = this.startNode();\n node.imported = this.parseModuleExportName();\n\n if (this.eatContextual(\"as\")) {\n node.local = this.parseIdent();\n } else {\n this.checkUnreserved(node.imported);\n node.local = node.imported;\n }\n this.checkLValSimple(node.local, BIND_LEXICAL);\n\n return this.finishNode(node, \"ImportSpecifier\")\n};\n\npp$8.parseImportDefaultSpecifier = function() {\n // import defaultObj, { x, y as z } from '...'\n var node = this.startNode();\n node.local = this.parseIdent();\n this.checkLValSimple(node.local, BIND_LEXICAL);\n return this.finishNode(node, \"ImportDefaultSpecifier\")\n};\n\npp$8.parseImportNamespaceSpecifier = function() {\n var node = this.startNode();\n this.next();\n this.expectContextual(\"as\");\n node.local = this.parseIdent();\n this.checkLValSimple(node.local, BIND_LEXICAL);\n return this.finishNode(node, \"ImportNamespaceSpecifier\")\n};\n\npp$8.parseImportSpecifiers = function() {\n var nodes = [], first = true;\n if (this.type === types$1.name) {\n nodes.push(this.parseImportDefaultSpecifier());\n if (!this.eat(types$1.comma)) { return nodes }\n }\n if (this.type === types$1.star) {\n nodes.push(this.parseImportNamespaceSpecifier());\n return nodes\n }\n this.expect(types$1.braceL);\n while (!this.eat(types$1.braceR)) {\n if (!first) {\n this.expect(types$1.comma);\n if (this.afterTrailingComma(types$1.braceR)) { break }\n } else { first = false; }\n\n nodes.push(this.parseImportSpecifier());\n }\n return nodes\n};\n\npp$8.parseWithClause = function() {\n var nodes = [];\n if (!this.eat(types$1._with)) {\n return nodes\n }\n this.expect(types$1.braceL);\n var attributeKeys = {};\n var first = true;\n while (!this.eat(types$1.braceR)) {\n if (!first) {\n this.expect(types$1.comma);\n if (this.afterTrailingComma(types$1.braceR)) { break }\n } else { first = false; }\n\n var attr = this.parseImportAttribute();\n var keyName = attr.key.type === \"Identifier\" ? attr.key.name : attr.key.value;\n if (hasOwn(attributeKeys, keyName))\n { this.raiseRecoverable(attr.key.start, \"Duplicate attribute key '\" + keyName + \"'\"); }\n attributeKeys[keyName] = true;\n nodes.push(attr);\n }\n return nodes\n};\n\npp$8.parseImportAttribute = function() {\n var node = this.startNode();\n node.key = this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== \"never\");\n this.expect(types$1.colon);\n if (this.type !== types$1.string) {\n this.unexpected();\n }\n node.value = this.parseExprAtom();\n return this.finishNode(node, \"ImportAttribute\")\n};\n\npp$8.parseModuleExportName = function() {\n if (this.options.ecmaVersion >= 13 && this.type === types$1.string) {\n var stringLiteral = this.parseLiteral(this.value);\n if (loneSurrogate.test(stringLiteral.value)) {\n this.raise(stringLiteral.start, \"An export name cannot include a lone surrogate.\");\n }\n return stringLiteral\n }\n return this.parseIdent(true)\n};\n\n// Set `ExpressionStatement#directive` property for directive prologues.\npp$8.adaptDirectivePrologue = function(statements) {\n for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {\n statements[i].directive = statements[i].expression.raw.slice(1, -1);\n }\n};\npp$8.isDirectiveCandidate = function(statement) {\n return (\n this.options.ecmaVersion >= 5 &&\n statement.type === \"ExpressionStatement\" &&\n statement.expression.type === \"Literal\" &&\n typeof statement.expression.value === \"string\" &&\n // Reject parenthesized strings.\n (this.input[statement.start] === \"\\\"\" || this.input[statement.start] === \"'\")\n )\n};\n\nvar pp$7 = Parser.prototype;\n\n// Convert existing expression atom to assignable pattern\n// if possible.\n\npp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {\n if (this.options.ecmaVersion >= 6 && node) {\n switch (node.type) {\n case \"Identifier\":\n if (this.inAsync && node.name === \"await\")\n { this.raise(node.start, \"Cannot use 'await' as identifier inside an async function\"); }\n break\n\n case \"ObjectPattern\":\n case \"ArrayPattern\":\n case \"AssignmentPattern\":\n case \"RestElement\":\n break\n\n case \"ObjectExpression\":\n node.type = \"ObjectPattern\";\n if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }\n for (var i = 0, list = node.properties; i < list.length; i += 1) {\n var prop = list[i];\n\n this.toAssignable(prop, isBinding);\n // Early error:\n // AssignmentRestProperty[Yield, Await] :\n // `...` DestructuringAssignmentTarget[Yield, Await]\n //\n // It is a Syntax Error if |DestructuringAssignmentTarget| is an |ArrayLiteral| or an |ObjectLiteral|.\n if (\n prop.type === \"RestElement\" &&\n (prop.argument.type === \"ArrayPattern\" || prop.argument.type === \"ObjectPattern\")\n ) {\n this.raise(prop.argument.start, \"Unexpected token\");\n }\n }\n break\n\n case \"Property\":\n // AssignmentProperty has type === \"Property\"\n if (node.kind !== \"init\") { this.raise(node.key.start, \"Object pattern can't contain getter or setter\"); }\n this.toAssignable(node.value, isBinding);\n break\n\n case \"ArrayExpression\":\n node.type = \"ArrayPattern\";\n if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }\n this.toAssignableList(node.elements, isBinding);\n break\n\n case \"SpreadElement\":\n node.type = \"RestElement\";\n this.toAssignable(node.argument, isBinding);\n if (node.argument.type === \"AssignmentPattern\")\n { this.raise(node.argument.start, \"Rest elements cannot have a default value\"); }\n break\n\n case \"AssignmentExpression\":\n if (node.operator !== \"=\") { this.raise(node.left.end, \"Only '=' operator can be used for specifying default value.\"); }\n node.type = \"AssignmentPattern\";\n delete node.operator;\n this.toAssignable(node.left, isBinding);\n break\n\n case \"ParenthesizedExpression\":\n this.toAssignable(node.expression, isBinding, refDestructuringErrors);\n break\n\n case \"ChainExpression\":\n this.raiseRecoverable(node.start, \"Optional chaining cannot appear in left-hand side\");\n break\n\n case \"MemberExpression\":\n if (!isBinding) { break }\n\n default:\n this.raise(node.start, \"Assigning to rvalue\");\n }\n } else if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }\n return node\n};\n\n// Convert list of expression atoms to binding list.\n\npp$7.toAssignableList = function(exprList, isBinding) {\n var end = exprList.length;\n for (var i = 0; i < end; i++) {\n var elt = exprList[i];\n if (elt) { this.toAssignable(elt, isBinding); }\n }\n if (end) {\n var last = exprList[end - 1];\n if (this.options.ecmaVersion === 6 && isBinding && last && last.type === \"RestElement\" && last.argument.type !== \"Identifier\")\n { this.unexpected(last.argument.start); }\n }\n return exprList\n};\n\n// Parses spread element.\n\npp$7.parseSpread = function(refDestructuringErrors) {\n var node = this.startNode();\n this.next();\n node.argument = this.parseMaybeAssign(false, refDestructuringErrors);\n return this.finishNode(node, \"SpreadElement\")\n};\n\npp$7.parseRestBinding = function() {\n var node = this.startNode();\n this.next();\n\n // RestElement inside of a function parameter must be an identifier\n if (this.options.ecmaVersion === 6 && this.type !== types$1.name)\n { this.unexpected(); }\n\n node.argument = this.parseBindingAtom();\n\n return this.finishNode(node, \"RestElement\")\n};\n\n// Parses lvalue (assignable) atom.\n\npp$7.parseBindingAtom = function() {\n if (this.options.ecmaVersion >= 6) {\n switch (this.type) {\n case types$1.bracketL:\n var node = this.startNode();\n this.next();\n node.elements = this.parseBindingList(types$1.bracketR, true, true);\n return this.finishNode(node, \"ArrayPattern\")\n\n case types$1.braceL:\n return this.parseObj(true)\n }\n }\n return this.parseIdent()\n};\n\npp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowModifiers) {\n var elts = [], first = true;\n while (!this.eat(close)) {\n if (first) { first = false; }\n else { this.expect(types$1.comma); }\n if (allowEmpty && this.type === types$1.comma) {\n elts.push(null);\n } else if (allowTrailingComma && this.afterTrailingComma(close)) {\n break\n } else if (this.type === types$1.ellipsis) {\n var rest = this.parseRestBinding();\n this.parseBindingListItem(rest);\n elts.push(rest);\n if (this.type === types$1.comma) { this.raiseRecoverable(this.start, \"Comma is not permitted after the rest element\"); }\n this.expect(close);\n break\n } else {\n elts.push(this.parseAssignableListItem(allowModifiers));\n }\n }\n return elts\n};\n\npp$7.parseAssignableListItem = function(allowModifiers) {\n var elem = this.parseMaybeDefault(this.start, this.startLoc);\n this.parseBindingListItem(elem);\n return elem\n};\n\npp$7.parseBindingListItem = function(param) {\n return param\n};\n\n// Parses assignment pattern around given atom if possible.\n\npp$7.parseMaybeDefault = function(startPos, startLoc, left) {\n left = left || this.parseBindingAtom();\n if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { return left }\n var node = this.startNodeAt(startPos, startLoc);\n node.left = left;\n node.right = this.parseMaybeAssign();\n return this.finishNode(node, \"AssignmentPattern\")\n};\n\n// The following three functions all verify that a node is an lvalue —\n// something that can be bound, or assigned to. In order to do so, they perform\n// a variety of checks:\n//\n// - Check that none of the bound/assigned-to identifiers are reserved words.\n// - Record name declarations for bindings in the appropriate scope.\n// - Check duplicate argument names, if checkClashes is set.\n//\n// If a complex binding pattern is encountered (e.g., object and array\n// destructuring), the entire pattern is recursively checked.\n//\n// There are three versions of checkLVal*() appropriate for different\n// circumstances:\n//\n// - checkLValSimple() shall be used if the syntactic construct supports\n// nothing other than identifiers and member expressions. Parenthesized\n// expressions are also correctly handled. This is generally appropriate for\n// constructs for which the spec says\n//\n// > It is a Syntax Error if AssignmentTargetType of [the production] is not\n// > simple.\n//\n// It is also appropriate for checking if an identifier is valid and not\n// defined elsewhere, like import declarations or function/class identifiers.\n//\n// Examples where this is used include:\n// a += …;\n// import a from '…';\n// where a is the node to be checked.\n//\n// - checkLValPattern() shall be used if the syntactic construct supports\n// anything checkLValSimple() supports, as well as object and array\n// destructuring patterns. This is generally appropriate for constructs for\n// which the spec says\n//\n// > It is a Syntax Error if [the production] is neither an ObjectLiteral nor\n// > an ArrayLiteral and AssignmentTargetType of [the production] is not\n// > simple.\n//\n// Examples where this is used include:\n// (a = …);\n// const a = …;\n// try { … } catch (a) { … }\n// where a is the node to be checked.\n//\n// - checkLValInnerPattern() shall be used if the syntactic construct supports\n// anything checkLValPattern() supports, as well as default assignment\n// patterns, rest elements, and other constructs that may appear within an\n// object or array destructuring pattern.\n//\n// As a special case, function parameters also use checkLValInnerPattern(),\n// as they also support defaults and rest constructs.\n//\n// These functions deliberately support both assignment and binding constructs,\n// as the logic for both is exceedingly similar. If the node is the target of\n// an assignment, then bindingType should be set to BIND_NONE. Otherwise, it\n// should be set to the appropriate BIND_* constant, like BIND_VAR or\n// BIND_LEXICAL.\n//\n// If the function is called with a non-BIND_NONE bindingType, then\n// additionally a checkClashes object may be specified to allow checking for\n// duplicate argument names. checkClashes is ignored if the provided construct\n// is an assignment (i.e., bindingType is BIND_NONE).\n\npp$7.checkLValSimple = function(expr, bindingType, checkClashes) {\n if ( bindingType === void 0 ) bindingType = BIND_NONE;\n\n var isBind = bindingType !== BIND_NONE;\n\n switch (expr.type) {\n case \"Identifier\":\n if (this.strict && this.reservedWordsStrictBind.test(expr.name))\n { this.raiseRecoverable(expr.start, (isBind ? \"Binding \" : \"Assigning to \") + expr.name + \" in strict mode\"); }\n if (isBind) {\n if (bindingType === BIND_LEXICAL && expr.name === \"let\")\n { this.raiseRecoverable(expr.start, \"let is disallowed as a lexically bound name\"); }\n if (checkClashes) {\n if (hasOwn(checkClashes, expr.name))\n { this.raiseRecoverable(expr.start, \"Argument name clash\"); }\n checkClashes[expr.name] = true;\n }\n if (bindingType !== BIND_OUTSIDE) { this.declareName(expr.name, bindingType, expr.start); }\n }\n break\n\n case \"ChainExpression\":\n this.raiseRecoverable(expr.start, \"Optional chaining cannot appear in left-hand side\");\n break\n\n case \"MemberExpression\":\n if (isBind) { this.raiseRecoverable(expr.start, \"Binding member expression\"); }\n break\n\n case \"ParenthesizedExpression\":\n if (isBind) { this.raiseRecoverable(expr.start, \"Binding parenthesized expression\"); }\n return this.checkLValSimple(expr.expression, bindingType, checkClashes)\n\n default:\n this.raise(expr.start, (isBind ? \"Binding\" : \"Assigning to\") + \" rvalue\");\n }\n};\n\npp$7.checkLValPattern = function(expr, bindingType, checkClashes) {\n if ( bindingType === void 0 ) bindingType = BIND_NONE;\n\n switch (expr.type) {\n case \"ObjectPattern\":\n for (var i = 0, list = expr.properties; i < list.length; i += 1) {\n var prop = list[i];\n\n this.checkLValInnerPattern(prop, bindingType, checkClashes);\n }\n break\n\n case \"ArrayPattern\":\n for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) {\n var elem = list$1[i$1];\n\n if (elem) { this.checkLValInnerPattern(elem, bindingType, checkClashes); }\n }\n break\n\n default:\n this.checkLValSimple(expr, bindingType, checkClashes);\n }\n};\n\npp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {\n if ( bindingType === void 0 ) bindingType = BIND_NONE;\n\n switch (expr.type) {\n case \"Property\":\n // AssignmentProperty has type === \"Property\"\n this.checkLValInnerPattern(expr.value, bindingType, checkClashes);\n break\n\n case \"AssignmentPattern\":\n this.checkLValPattern(expr.left, bindingType, checkClashes);\n break\n\n case \"RestElement\":\n this.checkLValPattern(expr.argument, bindingType, checkClashes);\n break\n\n default:\n this.checkLValPattern(expr, bindingType, checkClashes);\n }\n};\n\n// The algorithm used to determine whether a regexp can appear at a\n// given point in the program is loosely based on sweet.js' approach.\n// See https://github.com/mozilla/sweet.js/wiki/design\n\n\nvar TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {\n this.token = token;\n this.isExpr = !!isExpr;\n this.preserveSpace = !!preserveSpace;\n this.override = override;\n this.generator = !!generator;\n};\n\nvar types = {\n b_stat: new TokContext(\"{\", false),\n b_expr: new TokContext(\"{\", true),\n b_tmpl: new TokContext(\"${\", false),\n p_stat: new TokContext(\"(\", false),\n p_expr: new TokContext(\"(\", true),\n q_tmpl: new TokContext(\"`\", true, true, function (p) { return p.tryReadTemplateToken(); }),\n f_stat: new TokContext(\"function\", false),\n f_expr: new TokContext(\"function\", true),\n f_expr_gen: new TokContext(\"function\", true, false, null, true),\n f_gen: new TokContext(\"function\", false, false, null, true)\n};\n\nvar pp$6 = Parser.prototype;\n\npp$6.initialContext = function() {\n return [types.b_stat]\n};\n\npp$6.curContext = function() {\n return this.context[this.context.length - 1]\n};\n\npp$6.braceIsBlock = function(prevType) {\n var parent = this.curContext();\n if (parent === types.f_expr || parent === types.f_stat)\n { return true }\n if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr))\n { return !parent.isExpr }\n\n // The check for `tt.name && exprAllowed` detects whether we are\n // after a `yield` or `of` construct. See the `updateContext` for\n // `tt.name`.\n if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed)\n { return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }\n if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow)\n { return true }\n if (prevType === types$1.braceL)\n { return parent === types.b_stat }\n if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name)\n { return false }\n return !this.exprAllowed\n};\n\npp$6.inGeneratorContext = function() {\n for (var i = this.context.length - 1; i >= 1; i--) {\n var context = this.context[i];\n if (context.token === \"function\")\n { return context.generator }\n }\n return false\n};\n\npp$6.updateContext = function(prevType) {\n var update, type = this.type;\n if (type.keyword && prevType === types$1.dot)\n { this.exprAllowed = false; }\n else if (update = type.updateContext)\n { update.call(this, prevType); }\n else\n { this.exprAllowed = type.beforeExpr; }\n};\n\n// Used to handle edge cases when token context could not be inferred correctly during tokenization phase\n\npp$6.overrideContext = function(tokenCtx) {\n if (this.curContext() !== tokenCtx) {\n this.context[this.context.length - 1] = tokenCtx;\n }\n};\n\n// Token-specific context update code\n\ntypes$1.parenR.updateContext = types$1.braceR.updateContext = function() {\n if (this.context.length === 1) {\n this.exprAllowed = true;\n return\n }\n var out = this.context.pop();\n if (out === types.b_stat && this.curContext().token === \"function\") {\n out = this.context.pop();\n }\n this.exprAllowed = !out.isExpr;\n};\n\ntypes$1.braceL.updateContext = function(prevType) {\n this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr);\n this.exprAllowed = true;\n};\n\ntypes$1.dollarBraceL.updateContext = function() {\n this.context.push(types.b_tmpl);\n this.exprAllowed = true;\n};\n\ntypes$1.parenL.updateContext = function(prevType) {\n var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while;\n this.context.push(statementParens ? types.p_stat : types.p_expr);\n this.exprAllowed = true;\n};\n\ntypes$1.incDec.updateContext = function() {\n // tokExprAllowed stays unchanged\n};\n\ntypes$1._function.updateContext = types$1._class.updateContext = function(prevType) {\n if (prevType.beforeExpr && prevType !== types$1._else &&\n !(prevType === types$1.semi && this.curContext() !== types.p_stat) &&\n !(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&\n !((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat))\n { this.context.push(types.f_expr); }\n else\n { this.context.push(types.f_stat); }\n this.exprAllowed = false;\n};\n\ntypes$1.colon.updateContext = function() {\n if (this.curContext().token === \"function\") { this.context.pop(); }\n this.exprAllowed = true;\n};\n\ntypes$1.backQuote.updateContext = function() {\n if (this.curContext() === types.q_tmpl)\n { this.context.pop(); }\n else\n { this.context.push(types.q_tmpl); }\n this.exprAllowed = false;\n};\n\ntypes$1.star.updateContext = function(prevType) {\n if (prevType === types$1._function) {\n var index = this.context.length - 1;\n if (this.context[index] === types.f_expr)\n { this.context[index] = types.f_expr_gen; }\n else\n { this.context[index] = types.f_gen; }\n }\n this.exprAllowed = true;\n};\n\ntypes$1.name.updateContext = function(prevType) {\n var allowed = false;\n if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) {\n if (this.value === \"of\" && !this.exprAllowed ||\n this.value === \"yield\" && this.inGeneratorContext())\n { allowed = true; }\n }\n this.exprAllowed = allowed;\n};\n\n// A recursive descent parser operates by defining functions for all\n// syntactic elements, and recursively calling those, each function\n// advancing the input stream and returning an AST node. Precedence\n// of constructs (for example, the fact that `!x[1]` means `!(x[1])`\n// instead of `(!x)[1]` is handled by the fact that the parser\n// function that parses unary prefix operators is called first, and\n// in turn calls the function that parses `[]` subscripts — that\n// way, it'll receive the node for `x[1]` already parsed, and wraps\n// *that* in the unary operator node.\n//\n// Acorn uses an [operator precedence parser][opp] to handle binary\n// operator precedence, because it is much more compact than using\n// the technique outlined above, which uses different, nesting\n// functions to specify precedence, for all of the ten binary\n// precedence levels that JavaScript defines.\n//\n// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser\n\n\nvar pp$5 = Parser.prototype;\n\n// Check if property name clashes with already added.\n// Object/class getters and setters are not allowed to clash —\n// either with each other or with an init property — and in\n// strict mode, init properties are also not allowed to be repeated.\n\npp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {\n if (this.options.ecmaVersion >= 9 && prop.type === \"SpreadElement\")\n { return }\n if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))\n { return }\n var key = prop.key;\n var name;\n switch (key.type) {\n case \"Identifier\": name = key.name; break\n case \"Literal\": name = String(key.value); break\n default: return\n }\n var kind = prop.kind;\n if (this.options.ecmaVersion >= 6) {\n if (name === \"__proto__\" && kind === \"init\") {\n if (propHash.proto) {\n if (refDestructuringErrors) {\n if (refDestructuringErrors.doubleProto < 0) {\n refDestructuringErrors.doubleProto = key.start;\n }\n } else {\n this.raiseRecoverable(key.start, \"Redefinition of __proto__ property\");\n }\n }\n propHash.proto = true;\n }\n return\n }\n name = \"$\" + name;\n var other = propHash[name];\n if (other) {\n var redefinition;\n if (kind === \"init\") {\n redefinition = this.strict && other.init || other.get || other.set;\n } else {\n redefinition = other.init || other[kind];\n }\n if (redefinition)\n { this.raiseRecoverable(key.start, \"Redefinition of property\"); }\n } else {\n other = propHash[name] = {\n init: false,\n get: false,\n set: false\n };\n }\n other[kind] = true;\n};\n\n// ### Expression parsing\n\n// These nest, from the most general expression type at the top to\n// 'atomic', nondivisible expression types at the bottom. Most of\n// the functions will simply let the function(s) below them parse,\n// and, *if* the syntactic construct they handle is present, wrap\n// the AST node that the inner parser gave them in another node.\n\n// Parse a full expression. The optional arguments are used to\n// forbid the `in` operator (in for loops initalization expressions)\n// and provide reference for storing '=' operator inside shorthand\n// property assignment in contexts where both object expression\n// and object pattern might appear (so it's possible to raise\n// delayed syntax error at correct position).\n\npp$5.parseExpression = function(forInit, refDestructuringErrors) {\n var startPos = this.start, startLoc = this.startLoc;\n var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);\n if (this.type === types$1.comma) {\n var node = this.startNodeAt(startPos, startLoc);\n node.expressions = [expr];\n while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }\n return this.finishNode(node, \"SequenceExpression\")\n }\n return expr\n};\n\n// Parse an assignment expression. This includes applications of\n// operators like `+=`.\n\npp$5.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {\n if (this.isContextual(\"yield\")) {\n if (this.inGenerator) { return this.parseYield(forInit) }\n // The tokenizer will assume an expression is allowed after\n // `yield`, but this isn't that kind of yield\n else { this.exprAllowed = false; }\n }\n\n var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1;\n if (refDestructuringErrors) {\n oldParenAssign = refDestructuringErrors.parenthesizedAssign;\n oldTrailingComma = refDestructuringErrors.trailingComma;\n oldDoubleProto = refDestructuringErrors.doubleProto;\n refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1;\n } else {\n refDestructuringErrors = new DestructuringErrors;\n ownDestructuringErrors = true;\n }\n\n var startPos = this.start, startLoc = this.startLoc;\n if (this.type === types$1.parenL || this.type === types$1.name) {\n this.potentialArrowAt = this.start;\n this.potentialArrowInForAwait = forInit === \"await\";\n }\n var left = this.parseMaybeConditional(forInit, refDestructuringErrors);\n if (afterLeftParse) { left = afterLeftParse.call(this, left, startPos, startLoc); }\n if (this.type.isAssign) {\n var node = this.startNodeAt(startPos, startLoc);\n node.operator = this.value;\n if (this.type === types$1.eq)\n { left = this.toAssignable(left, false, refDestructuringErrors); }\n if (!ownDestructuringErrors) {\n refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;\n }\n if (refDestructuringErrors.shorthandAssign >= left.start)\n { refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly\n if (this.type === types$1.eq)\n { this.checkLValPattern(left); }\n else\n { this.checkLValSimple(left); }\n node.left = left;\n this.next();\n node.right = this.parseMaybeAssign(forInit);\n if (oldDoubleProto > -1) { refDestructuringErrors.doubleProto = oldDoubleProto; }\n return this.finishNode(node, \"AssignmentExpression\")\n } else {\n if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }\n }\n if (oldParenAssign > -1) { refDestructuringErrors.parenthesizedAssign = oldParenAssign; }\n if (oldTrailingComma > -1) { refDestructuringErrors.trailingComma = oldTrailingComma; }\n return left\n};\n\n// Parse a ternary conditional (`?:`) operator.\n\npp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {\n var startPos = this.start, startLoc = this.startLoc;\n var expr = this.parseExprOps(forInit, refDestructuringErrors);\n if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }\n if (this.eat(types$1.question)) {\n var node = this.startNodeAt(startPos, startLoc);\n node.test = expr;\n node.consequent = this.parseMaybeAssign();\n this.expect(types$1.colon);\n node.alternate = this.parseMaybeAssign(forInit);\n return this.finishNode(node, \"ConditionalExpression\")\n }\n return expr\n};\n\n// Start the precedence parser.\n\npp$5.parseExprOps = function(forInit, refDestructuringErrors) {\n var startPos = this.start, startLoc = this.startLoc;\n var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit);\n if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }\n return expr.start === startPos && expr.type === \"ArrowFunctionExpression\" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, forInit)\n};\n\n// Parse binary operators with the operator precedence parsing\n// algorithm. `left` is the left-hand side of the operator.\n// `minPrec` provides context that allows the function to stop and\n// defer further parser to one of its callers when it encounters an\n// operator that has a lower precedence than the set it is parsing.\n\npp$5.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {\n var prec = this.type.binop;\n if (prec != null && (!forInit || this.type !== types$1._in)) {\n if (prec > minPrec) {\n var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND;\n var coalesce = this.type === types$1.coalesce;\n if (coalesce) {\n // Handle the precedence of `tt.coalesce` as equal to the range of logical expressions.\n // In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error.\n prec = types$1.logicalAND.binop;\n }\n var op = this.value;\n this.next();\n var startPos = this.start, startLoc = this.startLoc;\n var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit);\n var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);\n if ((logical && this.type === types$1.coalesce) || (coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND))) {\n this.raiseRecoverable(this.start, \"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses\");\n }\n return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit)\n }\n }\n return left\n};\n\npp$5.buildBinary = function(startPos, startLoc, left, right, op, logical) {\n if (right.type === \"PrivateIdentifier\") { this.raise(right.start, \"Private identifier can only be left side of binary expression\"); }\n var node = this.startNodeAt(startPos, startLoc);\n node.left = left;\n node.operator = op;\n node.right = right;\n return this.finishNode(node, logical ? \"LogicalExpression\" : \"BinaryExpression\")\n};\n\n// Parse unary operators, both prefix and postfix.\n\npp$5.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec, forInit) {\n var startPos = this.start, startLoc = this.startLoc, expr;\n if (this.isContextual(\"await\") && this.canAwait) {\n expr = this.parseAwait(forInit);\n sawUnary = true;\n } else if (this.type.prefix) {\n var node = this.startNode(), update = this.type === types$1.incDec;\n node.operator = this.value;\n node.prefix = true;\n this.next();\n node.argument = this.parseMaybeUnary(null, true, update, forInit);\n this.checkExpressionErrors(refDestructuringErrors, true);\n if (update) { this.checkLValSimple(node.argument); }\n else if (this.strict && node.operator === \"delete\" && isLocalVariableAccess(node.argument))\n { this.raiseRecoverable(node.start, \"Deleting local variable in strict mode\"); }\n else if (node.operator === \"delete\" && isPrivateFieldAccess(node.argument))\n { this.raiseRecoverable(node.start, \"Private fields can not be deleted\"); }\n else { sawUnary = true; }\n expr = this.finishNode(node, update ? \"UpdateExpression\" : \"UnaryExpression\");\n } else if (!sawUnary && this.type === types$1.privateId) {\n if ((forInit || this.privateNameStack.length === 0) && this.options.checkPrivateFields) { this.unexpected(); }\n expr = this.parsePrivateIdent();\n // only could be private fields in 'in', such as #x in obj\n if (this.type !== types$1._in) { this.unexpected(); }\n } else {\n expr = this.parseExprSubscripts(refDestructuringErrors, forInit);\n if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }\n while (this.type.postfix && !this.canInsertSemicolon()) {\n var node$1 = this.startNodeAt(startPos, startLoc);\n node$1.operator = this.value;\n node$1.prefix = false;\n node$1.argument = expr;\n this.checkLValSimple(expr);\n this.next();\n expr = this.finishNode(node$1, \"UpdateExpression\");\n }\n }\n\n if (!incDec && this.eat(types$1.starstar)) {\n if (sawUnary)\n { this.unexpected(this.lastTokStart); }\n else\n { return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false, false, forInit), \"**\", false) }\n } else {\n return expr\n }\n};\n\nfunction isLocalVariableAccess(node) {\n return (\n node.type === \"Identifier\" ||\n node.type === \"ParenthesizedExpression\" && isLocalVariableAccess(node.expression)\n )\n}\n\nfunction isPrivateFieldAccess(node) {\n return (\n node.type === \"MemberExpression\" && node.property.type === \"PrivateIdentifier\" ||\n node.type === \"ChainExpression\" && isPrivateFieldAccess(node.expression) ||\n node.type === \"ParenthesizedExpression\" && isPrivateFieldAccess(node.expression)\n )\n}\n\n// Parse call, dot, and `[]`-subscript expressions.\n\npp$5.parseExprSubscripts = function(refDestructuringErrors, forInit) {\n var startPos = this.start, startLoc = this.startLoc;\n var expr = this.parseExprAtom(refDestructuringErrors, forInit);\n if (expr.type === \"ArrowFunctionExpression\" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== \")\")\n { return expr }\n var result = this.parseSubscripts(expr, startPos, startLoc, false, forInit);\n if (refDestructuringErrors && result.type === \"MemberExpression\") {\n if (refDestructuringErrors.parenthesizedAssign >= result.start) { refDestructuringErrors.parenthesizedAssign = -1; }\n if (refDestructuringErrors.parenthesizedBind >= result.start) { refDestructuringErrors.parenthesizedBind = -1; }\n if (refDestructuringErrors.trailingComma >= result.start) { refDestructuringErrors.trailingComma = -1; }\n }\n return result\n};\n\npp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {\n var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === \"Identifier\" && base.name === \"async\" &&\n this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 &&\n this.potentialArrowAt === base.start;\n var optionalChained = false;\n\n while (true) {\n var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit);\n\n if (element.optional) { optionalChained = true; }\n if (element === base || element.type === \"ArrowFunctionExpression\") {\n if (optionalChained) {\n var chainNode = this.startNodeAt(startPos, startLoc);\n chainNode.expression = element;\n element = this.finishNode(chainNode, \"ChainExpression\");\n }\n return element\n }\n\n base = element;\n }\n};\n\npp$5.shouldParseAsyncArrow = function() {\n return !this.canInsertSemicolon() && this.eat(types$1.arrow)\n};\n\npp$5.parseSubscriptAsyncArrow = function(startPos, startLoc, exprList, forInit) {\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit)\n};\n\npp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {\n var optionalSupported = this.options.ecmaVersion >= 11;\n var optional = optionalSupported && this.eat(types$1.questionDot);\n if (noCalls && optional) { this.raise(this.lastTokStart, \"Optional chaining cannot appear in the callee of new expressions\"); }\n\n var computed = this.eat(types$1.bracketL);\n if (computed || (optional && this.type !== types$1.parenL && this.type !== types$1.backQuote) || this.eat(types$1.dot)) {\n var node = this.startNodeAt(startPos, startLoc);\n node.object = base;\n if (computed) {\n node.property = this.parseExpression();\n this.expect(types$1.bracketR);\n } else if (this.type === types$1.privateId && base.type !== \"Super\") {\n node.property = this.parsePrivateIdent();\n } else {\n node.property = this.parseIdent(this.options.allowReserved !== \"never\");\n }\n node.computed = !!computed;\n if (optionalSupported) {\n node.optional = optional;\n }\n base = this.finishNode(node, \"MemberExpression\");\n } else if (!noCalls && this.eat(types$1.parenL)) {\n var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;\n this.yieldPos = 0;\n this.awaitPos = 0;\n this.awaitIdentPos = 0;\n var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);\n if (maybeAsyncArrow && !optional && this.shouldParseAsyncArrow()) {\n this.checkPatternErrors(refDestructuringErrors, false);\n this.checkYieldAwaitInDefaultParams();\n if (this.awaitIdentPos > 0)\n { this.raise(this.awaitIdentPos, \"Cannot use 'await' as identifier inside an async function\"); }\n this.yieldPos = oldYieldPos;\n this.awaitPos = oldAwaitPos;\n this.awaitIdentPos = oldAwaitIdentPos;\n return this.parseSubscriptAsyncArrow(startPos, startLoc, exprList, forInit)\n }\n this.checkExpressionErrors(refDestructuringErrors, true);\n this.yieldPos = oldYieldPos || this.yieldPos;\n this.awaitPos = oldAwaitPos || this.awaitPos;\n this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos;\n var node$1 = this.startNodeAt(startPos, startLoc);\n node$1.callee = base;\n node$1.arguments = exprList;\n if (optionalSupported) {\n node$1.optional = optional;\n }\n base = this.finishNode(node$1, \"CallExpression\");\n } else if (this.type === types$1.backQuote) {\n if (optional || optionalChained) {\n this.raise(this.start, \"Optional chaining cannot appear in the tag of tagged template expressions\");\n }\n var node$2 = this.startNodeAt(startPos, startLoc);\n node$2.tag = base;\n node$2.quasi = this.parseTemplate({isTagged: true});\n base = this.finishNode(node$2, \"TaggedTemplateExpression\");\n }\n return base\n};\n\n// Parse an atomic expression — either a single token that is an\n// expression, an expression started by a keyword like `function` or\n// `new`, or an expression wrapped in punctuation like `()`, `[]`,\n// or `{}`.\n\npp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) {\n // If a division operator appears in an expression position, the\n // tokenizer got confused, and we force it to read a regexp instead.\n if (this.type === types$1.slash) { this.readRegexp(); }\n\n var node, canBeArrow = this.potentialArrowAt === this.start;\n switch (this.type) {\n case types$1._super:\n if (!this.allowSuper)\n { this.raise(this.start, \"'super' keyword outside a method\"); }\n node = this.startNode();\n this.next();\n if (this.type === types$1.parenL && !this.allowDirectSuper)\n { this.raise(node.start, \"super() call outside constructor of a subclass\"); }\n // The `super` keyword can appear at below:\n // SuperProperty:\n // super [ Expression ]\n // super . IdentifierName\n // SuperCall:\n // super ( Arguments )\n if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL)\n { this.unexpected(); }\n return this.finishNode(node, \"Super\")\n\n case types$1._this:\n node = this.startNode();\n this.next();\n return this.finishNode(node, \"ThisExpression\")\n\n case types$1.name:\n var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;\n var id = this.parseIdent(false);\n if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === \"async\" && !this.canInsertSemicolon() && this.eat(types$1._function)) {\n this.overrideContext(types.f_expr);\n return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit)\n }\n if (canBeArrow && !this.canInsertSemicolon()) {\n if (this.eat(types$1.arrow))\n { return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit) }\n if (this.options.ecmaVersion >= 8 && id.name === \"async\" && this.type === types$1.name && !containsEsc &&\n (!this.potentialArrowInForAwait || this.value !== \"of\" || this.containsEsc)) {\n id = this.parseIdent(false);\n if (this.canInsertSemicolon() || !this.eat(types$1.arrow))\n { this.unexpected(); }\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit)\n }\n }\n return id\n\n case types$1.regexp:\n var value = this.value;\n node = this.parseLiteral(value.value);\n node.regex = {pattern: value.pattern, flags: value.flags};\n return node\n\n case types$1.num: case types$1.string:\n return this.parseLiteral(this.value)\n\n case types$1._null: case types$1._true: case types$1._false:\n node = this.startNode();\n node.value = this.type === types$1._null ? null : this.type === types$1._true;\n node.raw = this.type.keyword;\n this.next();\n return this.finishNode(node, \"Literal\")\n\n case types$1.parenL:\n var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);\n if (refDestructuringErrors) {\n if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))\n { refDestructuringErrors.parenthesizedAssign = start; }\n if (refDestructuringErrors.parenthesizedBind < 0)\n { refDestructuringErrors.parenthesizedBind = start; }\n }\n return expr\n\n case types$1.bracketL:\n node = this.startNode();\n this.next();\n node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);\n return this.finishNode(node, \"ArrayExpression\")\n\n case types$1.braceL:\n this.overrideContext(types.b_expr);\n return this.parseObj(false, refDestructuringErrors)\n\n case types$1._function:\n node = this.startNode();\n this.next();\n return this.parseFunction(node, 0)\n\n case types$1._class:\n return this.parseClass(this.startNode(), false)\n\n case types$1._new:\n return this.parseNew()\n\n case types$1.backQuote:\n return this.parseTemplate()\n\n case types$1._import:\n if (this.options.ecmaVersion >= 11) {\n return this.parseExprImport(forNew)\n } else {\n return this.unexpected()\n }\n\n default:\n return this.parseExprAtomDefault()\n }\n};\n\npp$5.parseExprAtomDefault = function() {\n this.unexpected();\n};\n\npp$5.parseExprImport = function(forNew) {\n var node = this.startNode();\n\n // Consume `import` as an identifier for `import.meta`.\n // Because `this.parseIdent(true)` doesn't check escape sequences, it needs the check of `this.containsEsc`.\n if (this.containsEsc) { this.raiseRecoverable(this.start, \"Escape sequence in keyword import\"); }\n this.next();\n\n if (this.type === types$1.parenL && !forNew) {\n return this.parseDynamicImport(node)\n } else if (this.type === types$1.dot) {\n var meta = this.startNodeAt(node.start, node.loc && node.loc.start);\n meta.name = \"import\";\n node.meta = this.finishNode(meta, \"Identifier\");\n return this.parseImportMeta(node)\n } else {\n this.unexpected();\n }\n};\n\npp$5.parseDynamicImport = function(node) {\n this.next(); // skip `(`\n\n // Parse node.source.\n node.source = this.parseMaybeAssign();\n\n if (this.options.ecmaVersion >= 16) {\n if (!this.eat(types$1.parenR)) {\n this.expect(types$1.comma);\n if (!this.afterTrailingComma(types$1.parenR)) {\n node.options = this.parseMaybeAssign();\n if (!this.eat(types$1.parenR)) {\n this.expect(types$1.comma);\n if (!this.afterTrailingComma(types$1.parenR)) {\n this.unexpected();\n }\n }\n } else {\n node.options = null;\n }\n } else {\n node.options = null;\n }\n } else {\n // Verify ending.\n if (!this.eat(types$1.parenR)) {\n var errorPos = this.start;\n if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {\n this.raiseRecoverable(errorPos, \"Trailing comma is not allowed in import()\");\n } else {\n this.unexpected(errorPos);\n }\n }\n }\n\n return this.finishNode(node, \"ImportExpression\")\n};\n\npp$5.parseImportMeta = function(node) {\n this.next(); // skip `.`\n\n var containsEsc = this.containsEsc;\n node.property = this.parseIdent(true);\n\n if (node.property.name !== \"meta\")\n { this.raiseRecoverable(node.property.start, \"The only valid meta property for import is 'import.meta'\"); }\n if (containsEsc)\n { this.raiseRecoverable(node.start, \"'import.meta' must not contain escaped characters\"); }\n if (this.options.sourceType !== \"module\" && !this.options.allowImportExportEverywhere)\n { this.raiseRecoverable(node.start, \"Cannot use 'import.meta' outside a module\"); }\n\n return this.finishNode(node, \"MetaProperty\")\n};\n\npp$5.parseLiteral = function(value) {\n var node = this.startNode();\n node.value = value;\n node.raw = this.input.slice(this.start, this.end);\n if (node.raw.charCodeAt(node.raw.length - 1) === 110)\n { node.bigint = node.value != null ? node.value.toString() : node.raw.slice(0, -1).replace(/_/g, \"\"); }\n this.next();\n return this.finishNode(node, \"Literal\")\n};\n\npp$5.parseParenExpression = function() {\n this.expect(types$1.parenL);\n var val = this.parseExpression();\n this.expect(types$1.parenR);\n return val\n};\n\npp$5.shouldParseArrow = function(exprList) {\n return !this.canInsertSemicolon()\n};\n\npp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {\n var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;\n if (this.options.ecmaVersion >= 6) {\n this.next();\n\n var innerStartPos = this.start, innerStartLoc = this.startLoc;\n var exprList = [], first = true, lastIsComma = false;\n var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart;\n this.yieldPos = 0;\n this.awaitPos = 0;\n // Do not save awaitIdentPos to allow checking awaits nested in parameters\n while (this.type !== types$1.parenR) {\n first ? first = false : this.expect(types$1.comma);\n if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) {\n lastIsComma = true;\n break\n } else if (this.type === types$1.ellipsis) {\n spreadStart = this.start;\n exprList.push(this.parseParenItem(this.parseRestBinding()));\n if (this.type === types$1.comma) {\n this.raiseRecoverable(\n this.start,\n \"Comma is not permitted after the rest element\"\n );\n }\n break\n } else {\n exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));\n }\n }\n var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;\n this.expect(types$1.parenR);\n\n if (canBeArrow && this.shouldParseArrow(exprList) && this.eat(types$1.arrow)) {\n this.checkPatternErrors(refDestructuringErrors, false);\n this.checkYieldAwaitInDefaultParams();\n this.yieldPos = oldYieldPos;\n this.awaitPos = oldAwaitPos;\n return this.parseParenArrowList(startPos, startLoc, exprList, forInit)\n }\n\n if (!exprList.length || lastIsComma) { this.unexpected(this.lastTokStart); }\n if (spreadStart) { this.unexpected(spreadStart); }\n this.checkExpressionErrors(refDestructuringErrors, true);\n this.yieldPos = oldYieldPos || this.yieldPos;\n this.awaitPos = oldAwaitPos || this.awaitPos;\n\n if (exprList.length > 1) {\n val = this.startNodeAt(innerStartPos, innerStartLoc);\n val.expressions = exprList;\n this.finishNodeAt(val, \"SequenceExpression\", innerEndPos, innerEndLoc);\n } else {\n val = exprList[0];\n }\n } else {\n val = this.parseParenExpression();\n }\n\n if (this.options.preserveParens) {\n var par = this.startNodeAt(startPos, startLoc);\n par.expression = val;\n return this.finishNode(par, \"ParenthesizedExpression\")\n } else {\n return val\n }\n};\n\npp$5.parseParenItem = function(item) {\n return item\n};\n\npp$5.parseParenArrowList = function(startPos, startLoc, exprList, forInit) {\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit)\n};\n\n// New's precedence is slightly tricky. It must allow its argument to\n// be a `[]` or dot subscript expression, but not a call — at least,\n// not without wrapping it in parentheses. Thus, it uses the noCalls\n// argument to parseSubscripts to prevent it from consuming the\n// argument list.\n\nvar empty = [];\n\npp$5.parseNew = function() {\n if (this.containsEsc) { this.raiseRecoverable(this.start, \"Escape sequence in keyword new\"); }\n var node = this.startNode();\n this.next();\n if (this.options.ecmaVersion >= 6 && this.type === types$1.dot) {\n var meta = this.startNodeAt(node.start, node.loc && node.loc.start);\n meta.name = \"new\";\n node.meta = this.finishNode(meta, \"Identifier\");\n this.next();\n var containsEsc = this.containsEsc;\n node.property = this.parseIdent(true);\n if (node.property.name !== \"target\")\n { this.raiseRecoverable(node.property.start, \"The only valid meta property for new is 'new.target'\"); }\n if (containsEsc)\n { this.raiseRecoverable(node.start, \"'new.target' must not contain escaped characters\"); }\n if (!this.allowNewDotTarget)\n { this.raiseRecoverable(node.start, \"'new.target' can only be used in functions and class static block\"); }\n return this.finishNode(node, \"MetaProperty\")\n }\n var startPos = this.start, startLoc = this.startLoc;\n node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);\n if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }\n else { node.arguments = empty; }\n return this.finishNode(node, \"NewExpression\")\n};\n\n// Parse template expression.\n\npp$5.parseTemplateElement = function(ref) {\n var isTagged = ref.isTagged;\n\n var elem = this.startNode();\n if (this.type === types$1.invalidTemplate) {\n if (!isTagged) {\n this.raiseRecoverable(this.start, \"Bad escape sequence in untagged template literal\");\n }\n elem.value = {\n raw: this.value.replace(/\\r\\n?/g, \"\\n\"),\n cooked: null\n };\n } else {\n elem.value = {\n raw: this.input.slice(this.start, this.end).replace(/\\r\\n?/g, \"\\n\"),\n cooked: this.value\n };\n }\n this.next();\n elem.tail = this.type === types$1.backQuote;\n return this.finishNode(elem, \"TemplateElement\")\n};\n\npp$5.parseTemplate = function(ref) {\n if ( ref === void 0 ) ref = {};\n var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false;\n\n var node = this.startNode();\n this.next();\n node.expressions = [];\n var curElt = this.parseTemplateElement({isTagged: isTagged});\n node.quasis = [curElt];\n while (!curElt.tail) {\n if (this.type === types$1.eof) { this.raise(this.pos, \"Unterminated template literal\"); }\n this.expect(types$1.dollarBraceL);\n node.expressions.push(this.parseExpression());\n this.expect(types$1.braceR);\n node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged}));\n }\n this.next();\n return this.finishNode(node, \"TemplateLiteral\")\n};\n\npp$5.isAsyncProp = function(prop) {\n return !prop.computed && prop.key.type === \"Identifier\" && prop.key.name === \"async\" &&\n (this.type === types$1.name || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types$1.star)) &&\n !lineBreak.test(this.input.slice(this.lastTokEnd, this.start))\n};\n\n// Parse an object literal or binding pattern.\n\npp$5.parseObj = function(isPattern, refDestructuringErrors) {\n var node = this.startNode(), first = true, propHash = {};\n node.properties = [];\n this.next();\n while (!this.eat(types$1.braceR)) {\n if (!first) {\n this.expect(types$1.comma);\n if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { break }\n } else { first = false; }\n\n var prop = this.parseProperty(isPattern, refDestructuringErrors);\n if (!isPattern) { this.checkPropClash(prop, propHash, refDestructuringErrors); }\n node.properties.push(prop);\n }\n return this.finishNode(node, isPattern ? \"ObjectPattern\" : \"ObjectExpression\")\n};\n\npp$5.parseProperty = function(isPattern, refDestructuringErrors) {\n var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;\n if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) {\n if (isPattern) {\n prop.argument = this.parseIdent(false);\n if (this.type === types$1.comma) {\n this.raiseRecoverable(this.start, \"Comma is not permitted after the rest element\");\n }\n return this.finishNode(prop, \"RestElement\")\n }\n // Parse argument.\n prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);\n // To disallow trailing comma via `this.toAssignable()`.\n if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {\n refDestructuringErrors.trailingComma = this.start;\n }\n // Finish\n return this.finishNode(prop, \"SpreadElement\")\n }\n if (this.options.ecmaVersion >= 6) {\n prop.method = false;\n prop.shorthand = false;\n if (isPattern || refDestructuringErrors) {\n startPos = this.start;\n startLoc = this.startLoc;\n }\n if (!isPattern)\n { isGenerator = this.eat(types$1.star); }\n }\n var containsEsc = this.containsEsc;\n this.parsePropertyName(prop);\n if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {\n isAsync = true;\n isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star);\n this.parsePropertyName(prop);\n } else {\n isAsync = false;\n }\n this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc);\n return this.finishNode(prop, \"Property\")\n};\n\npp$5.parseGetterSetter = function(prop) {\n var kind = prop.key.name;\n this.parsePropertyName(prop);\n prop.value = this.parseMethod(false);\n prop.kind = kind;\n var paramCount = prop.kind === \"get\" ? 0 : 1;\n if (prop.value.params.length !== paramCount) {\n var start = prop.value.start;\n if (prop.kind === \"get\")\n { this.raiseRecoverable(start, \"getter should have no params\"); }\n else\n { this.raiseRecoverable(start, \"setter should have exactly one param\"); }\n } else {\n if (prop.kind === \"set\" && prop.value.params[0].type === \"RestElement\")\n { this.raiseRecoverable(prop.value.params[0].start, \"Setter cannot use rest params\"); }\n }\n};\n\npp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {\n if ((isGenerator || isAsync) && this.type === types$1.colon)\n { this.unexpected(); }\n\n if (this.eat(types$1.colon)) {\n prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);\n prop.kind = \"init\";\n } else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) {\n if (isPattern) { this.unexpected(); }\n prop.method = true;\n prop.value = this.parseMethod(isGenerator, isAsync);\n prop.kind = \"init\";\n } else if (!isPattern && !containsEsc &&\n this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === \"Identifier\" &&\n (prop.key.name === \"get\" || prop.key.name === \"set\") &&\n (this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {\n if (isGenerator || isAsync) { this.unexpected(); }\n this.parseGetterSetter(prop);\n } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === \"Identifier\") {\n if (isGenerator || isAsync) { this.unexpected(); }\n this.checkUnreserved(prop.key);\n if (prop.key.name === \"await\" && !this.awaitIdentPos)\n { this.awaitIdentPos = startPos; }\n if (isPattern) {\n prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));\n } else if (this.type === types$1.eq && refDestructuringErrors) {\n if (refDestructuringErrors.shorthandAssign < 0)\n { refDestructuringErrors.shorthandAssign = this.start; }\n prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));\n } else {\n prop.value = this.copyNode(prop.key);\n }\n prop.kind = \"init\";\n prop.shorthand = true;\n } else { this.unexpected(); }\n};\n\npp$5.parsePropertyName = function(prop) {\n if (this.options.ecmaVersion >= 6) {\n if (this.eat(types$1.bracketL)) {\n prop.computed = true;\n prop.key = this.parseMaybeAssign();\n this.expect(types$1.bracketR);\n return prop.key\n } else {\n prop.computed = false;\n }\n }\n return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== \"never\")\n};\n\n// Initialize empty function node.\n\npp$5.initFunction = function(node) {\n node.id = null;\n if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; }\n if (this.options.ecmaVersion >= 8) { node.async = false; }\n};\n\n// Parse object or class method.\n\npp$5.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {\n var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;\n\n this.initFunction(node);\n if (this.options.ecmaVersion >= 6)\n { node.generator = isGenerator; }\n if (this.options.ecmaVersion >= 8)\n { node.async = !!isAsync; }\n\n this.yieldPos = 0;\n this.awaitPos = 0;\n this.awaitIdentPos = 0;\n this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));\n\n this.expect(types$1.parenL);\n node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);\n this.checkYieldAwaitInDefaultParams();\n this.parseFunctionBody(node, false, true, false);\n\n this.yieldPos = oldYieldPos;\n this.awaitPos = oldAwaitPos;\n this.awaitIdentPos = oldAwaitIdentPos;\n return this.finishNode(node, \"FunctionExpression\")\n};\n\n// Parse arrow function expression with given parameters.\n\npp$5.parseArrowExpression = function(node, params, isAsync, forInit) {\n var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;\n\n this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);\n this.initFunction(node);\n if (this.options.ecmaVersion >= 8) { node.async = !!isAsync; }\n\n this.yieldPos = 0;\n this.awaitPos = 0;\n this.awaitIdentPos = 0;\n\n node.params = this.toAssignableList(params, true);\n this.parseFunctionBody(node, true, false, forInit);\n\n this.yieldPos = oldYieldPos;\n this.awaitPos = oldAwaitPos;\n this.awaitIdentPos = oldAwaitIdentPos;\n return this.finishNode(node, \"ArrowFunctionExpression\")\n};\n\n// Parse function body and check parameters.\n\npp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {\n var isExpression = isArrowFunction && this.type !== types$1.braceL;\n var oldStrict = this.strict, useStrict = false;\n\n if (isExpression) {\n node.body = this.parseMaybeAssign(forInit);\n node.expression = true;\n this.checkParams(node, false);\n } else {\n var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params);\n if (!oldStrict || nonSimple) {\n useStrict = this.strictDirective(this.end);\n // If this is a strict mode function, verify that argument names\n // are not repeated, and it does not try to bind the words `eval`\n // or `arguments`.\n if (useStrict && nonSimple)\n { this.raiseRecoverable(node.start, \"Illegal 'use strict' directive in function with non-simple parameter list\"); }\n }\n // Start a new scope with regard to labels and the `inFunction`\n // flag (restore them to their old value afterwards).\n var oldLabels = this.labels;\n this.labels = [];\n if (useStrict) { this.strict = true; }\n\n // Add the params to varDeclaredNames to ensure that an error is thrown\n // if a let/const declaration in the function clashes with one of the params.\n this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params));\n // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval'\n if (this.strict && node.id) { this.checkLValSimple(node.id, BIND_OUTSIDE); }\n node.body = this.parseBlock(false, undefined, useStrict && !oldStrict);\n node.expression = false;\n this.adaptDirectivePrologue(node.body.body);\n this.labels = oldLabels;\n }\n this.exitScope();\n};\n\npp$5.isSimpleParamList = function(params) {\n for (var i = 0, list = params; i < list.length; i += 1)\n {\n var param = list[i];\n\n if (param.type !== \"Identifier\") { return false\n } }\n return true\n};\n\n// Checks function params for various disallowed patterns such as using \"eval\"\n// or \"arguments\" and duplicate parameters.\n\npp$5.checkParams = function(node, allowDuplicates) {\n var nameHash = Object.create(null);\n for (var i = 0, list = node.params; i < list.length; i += 1)\n {\n var param = list[i];\n\n this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash);\n }\n};\n\n// Parses a comma-separated list of expressions, and returns them as\n// an array. `close` is the token type that ends the list, and\n// `allowEmpty` can be turned on to allow subsequent commas with\n// nothing in between them to be parsed as `null` (which is needed\n// for array literals).\n\npp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {\n var elts = [], first = true;\n while (!this.eat(close)) {\n if (!first) {\n this.expect(types$1.comma);\n if (allowTrailingComma && this.afterTrailingComma(close)) { break }\n } else { first = false; }\n\n var elt = (void 0);\n if (allowEmpty && this.type === types$1.comma)\n { elt = null; }\n else if (this.type === types$1.ellipsis) {\n elt = this.parseSpread(refDestructuringErrors);\n if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0)\n { refDestructuringErrors.trailingComma = this.start; }\n } else {\n elt = this.parseMaybeAssign(false, refDestructuringErrors);\n }\n elts.push(elt);\n }\n return elts\n};\n\npp$5.checkUnreserved = function(ref) {\n var start = ref.start;\n var end = ref.end;\n var name = ref.name;\n\n if (this.inGenerator && name === \"yield\")\n { this.raiseRecoverable(start, \"Cannot use 'yield' as identifier inside a generator\"); }\n if (this.inAsync && name === \"await\")\n { this.raiseRecoverable(start, \"Cannot use 'await' as identifier inside an async function\"); }\n if (!(this.currentThisScope().flags & SCOPE_VAR) && name === \"arguments\")\n { this.raiseRecoverable(start, \"Cannot use 'arguments' in class field initializer\"); }\n if (this.inClassStaticBlock && (name === \"arguments\" || name === \"await\"))\n { this.raise(start, (\"Cannot use \" + name + \" in class static initialization block\")); }\n if (this.keywords.test(name))\n { this.raise(start, (\"Unexpected keyword '\" + name + \"'\")); }\n if (this.options.ecmaVersion < 6 &&\n this.input.slice(start, end).indexOf(\"\\\\\") !== -1) { return }\n var re = this.strict ? this.reservedWordsStrict : this.reservedWords;\n if (re.test(name)) {\n if (!this.inAsync && name === \"await\")\n { this.raiseRecoverable(start, \"Cannot use keyword 'await' outside an async function\"); }\n this.raiseRecoverable(start, (\"The keyword '\" + name + \"' is reserved\"));\n }\n};\n\n// Parse the next token as an identifier. If `liberal` is true (used\n// when parsing properties), it will also convert keywords into\n// identifiers.\n\npp$5.parseIdent = function(liberal) {\n var node = this.parseIdentNode();\n this.next(!!liberal);\n this.finishNode(node, \"Identifier\");\n if (!liberal) {\n this.checkUnreserved(node);\n if (node.name === \"await\" && !this.awaitIdentPos)\n { this.awaitIdentPos = node.start; }\n }\n return node\n};\n\npp$5.parseIdentNode = function() {\n var node = this.startNode();\n if (this.type === types$1.name) {\n node.name = this.value;\n } else if (this.type.keyword) {\n node.name = this.type.keyword;\n\n // To fix https://github.com/acornjs/acorn/issues/575\n // `class` and `function` keywords push new context into this.context.\n // But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.\n // If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword\n if ((node.name === \"class\" || node.name === \"function\") &&\n (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {\n this.context.pop();\n }\n this.type = types$1.name;\n } else {\n this.unexpected();\n }\n return node\n};\n\npp$5.parsePrivateIdent = function() {\n var node = this.startNode();\n if (this.type === types$1.privateId) {\n node.name = this.value;\n } else {\n this.unexpected();\n }\n this.next();\n this.finishNode(node, \"PrivateIdentifier\");\n\n // For validating existence\n if (this.options.checkPrivateFields) {\n if (this.privateNameStack.length === 0) {\n this.raise(node.start, (\"Private field '#\" + (node.name) + \"' must be declared in an enclosing class\"));\n } else {\n this.privateNameStack[this.privateNameStack.length - 1].used.push(node);\n }\n }\n\n return node\n};\n\n// Parses yield expression inside generator.\n\npp$5.parseYield = function(forInit) {\n if (!this.yieldPos) { this.yieldPos = this.start; }\n\n var node = this.startNode();\n this.next();\n if (this.type === types$1.semi || this.canInsertSemicolon() || (this.type !== types$1.star && !this.type.startsExpr)) {\n node.delegate = false;\n node.argument = null;\n } else {\n node.delegate = this.eat(types$1.star);\n node.argument = this.parseMaybeAssign(forInit);\n }\n return this.finishNode(node, \"YieldExpression\")\n};\n\npp$5.parseAwait = function(forInit) {\n if (!this.awaitPos) { this.awaitPos = this.start; }\n\n var node = this.startNode();\n this.next();\n node.argument = this.parseMaybeUnary(null, true, false, forInit);\n return this.finishNode(node, \"AwaitExpression\")\n};\n\nvar pp$4 = Parser.prototype;\n\n// This function is used to raise exceptions on parse errors. It\n// takes an offset integer (into the current `input`) to indicate\n// the location of the error, attaches the position to the end\n// of the error message, and then raises a `SyntaxError` with that\n// message.\n\npp$4.raise = function(pos, message) {\n var loc = getLineInfo(this.input, pos);\n message += \" (\" + loc.line + \":\" + loc.column + \")\";\n if (this.sourceFile) {\n message += \" in \" + this.sourceFile;\n }\n var err = new SyntaxError(message);\n err.pos = pos; err.loc = loc; err.raisedAt = this.pos;\n throw err\n};\n\npp$4.raiseRecoverable = pp$4.raise;\n\npp$4.curPosition = function() {\n if (this.options.locations) {\n return new Position(this.curLine, this.pos - this.lineStart)\n }\n};\n\nvar pp$3 = Parser.prototype;\n\nvar Scope = function Scope(flags) {\n this.flags = flags;\n // A list of var-declared names in the current lexical scope\n this.var = [];\n // A list of lexically-declared names in the current lexical scope\n this.lexical = [];\n // A list of lexically-declared FunctionDeclaration names in the current lexical scope\n this.functions = [];\n};\n\n// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.\n\npp$3.enterScope = function(flags) {\n this.scopeStack.push(new Scope(flags));\n};\n\npp$3.exitScope = function() {\n this.scopeStack.pop();\n};\n\n// The spec says:\n// > At the top level of a function, or script, function declarations are\n// > treated like var declarations rather than like lexical declarations.\npp$3.treatFunctionsAsVarInScope = function(scope) {\n return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)\n};\n\npp$3.declareName = function(name, bindingType, pos) {\n var redeclared = false;\n if (bindingType === BIND_LEXICAL) {\n var scope = this.currentScope();\n redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1;\n scope.lexical.push(name);\n if (this.inModule && (scope.flags & SCOPE_TOP))\n { delete this.undefinedExports[name]; }\n } else if (bindingType === BIND_SIMPLE_CATCH) {\n var scope$1 = this.currentScope();\n scope$1.lexical.push(name);\n } else if (bindingType === BIND_FUNCTION) {\n var scope$2 = this.currentScope();\n if (this.treatFunctionsAsVar)\n { redeclared = scope$2.lexical.indexOf(name) > -1; }\n else\n { redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1; }\n scope$2.functions.push(name);\n } else {\n for (var i = this.scopeStack.length - 1; i >= 0; --i) {\n var scope$3 = this.scopeStack[i];\n if (scope$3.lexical.indexOf(name) > -1 && !((scope$3.flags & SCOPE_SIMPLE_CATCH) && scope$3.lexical[0] === name) ||\n !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) {\n redeclared = true;\n break\n }\n scope$3.var.push(name);\n if (this.inModule && (scope$3.flags & SCOPE_TOP))\n { delete this.undefinedExports[name]; }\n if (scope$3.flags & SCOPE_VAR) { break }\n }\n }\n if (redeclared) { this.raiseRecoverable(pos, (\"Identifier '\" + name + \"' has already been declared\")); }\n};\n\npp$3.checkLocalExport = function(id) {\n // scope.functions must be empty as Module code is always strict.\n if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&\n this.scopeStack[0].var.indexOf(id.name) === -1) {\n this.undefinedExports[id.name] = id;\n }\n};\n\npp$3.currentScope = function() {\n return this.scopeStack[this.scopeStack.length - 1]\n};\n\npp$3.currentVarScope = function() {\n for (var i = this.scopeStack.length - 1;; i--) {\n var scope = this.scopeStack[i];\n if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK)) { return scope }\n }\n};\n\n// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.\npp$3.currentThisScope = function() {\n for (var i = this.scopeStack.length - 1;; i--) {\n var scope = this.scopeStack[i];\n if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK) &&\n !(scope.flags & SCOPE_ARROW)) { return scope }\n }\n};\n\nvar Node = function Node(parser, pos, loc) {\n this.type = \"\";\n this.start = pos;\n this.end = 0;\n if (parser.options.locations)\n { this.loc = new SourceLocation(parser, loc); }\n if (parser.options.directSourceFile)\n { this.sourceFile = parser.options.directSourceFile; }\n if (parser.options.ranges)\n { this.range = [pos, 0]; }\n};\n\n// Start an AST node, attaching a start offset.\n\nvar pp$2 = Parser.prototype;\n\npp$2.startNode = function() {\n return new Node(this, this.start, this.startLoc)\n};\n\npp$2.startNodeAt = function(pos, loc) {\n return new Node(this, pos, loc)\n};\n\n// Finish an AST node, adding `type` and `end` properties.\n\nfunction finishNodeAt(node, type, pos, loc) {\n node.type = type;\n node.end = pos;\n if (this.options.locations)\n { node.loc.end = loc; }\n if (this.options.ranges)\n { node.range[1] = pos; }\n return node\n}\n\npp$2.finishNode = function(node, type) {\n return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)\n};\n\n// Finish node at given position\n\npp$2.finishNodeAt = function(node, type, pos, loc) {\n return finishNodeAt.call(this, node, type, pos, loc)\n};\n\npp$2.copyNode = function(node) {\n var newNode = new Node(this, node.start, this.startLoc);\n for (var prop in node) { newNode[prop] = node[prop]; }\n return newNode\n};\n\n// This file was generated by \"bin/generate-unicode-script-values.js\". Do not modify manually!\nvar scriptValuesAddedInUnicode = \"Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz\";\n\n// This file contains Unicode properties extracted from the ECMAScript specification.\n// The lists are extracted like so:\n// $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText)\n\n// #table-binary-unicode-properties\nvar ecma9BinaryProperties = \"ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS\";\nvar ecma10BinaryProperties = ecma9BinaryProperties + \" Extended_Pictographic\";\nvar ecma11BinaryProperties = ecma10BinaryProperties;\nvar ecma12BinaryProperties = ecma11BinaryProperties + \" EBase EComp EMod EPres ExtPict\";\nvar ecma13BinaryProperties = ecma12BinaryProperties;\nvar ecma14BinaryProperties = ecma13BinaryProperties;\n\nvar unicodeBinaryProperties = {\n 9: ecma9BinaryProperties,\n 10: ecma10BinaryProperties,\n 11: ecma11BinaryProperties,\n 12: ecma12BinaryProperties,\n 13: ecma13BinaryProperties,\n 14: ecma14BinaryProperties\n};\n\n// #table-binary-unicode-properties-of-strings\nvar ecma14BinaryPropertiesOfStrings = \"Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji\";\n\nvar unicodeBinaryPropertiesOfStrings = {\n 9: \"\",\n 10: \"\",\n 11: \"\",\n 12: \"\",\n 13: \"\",\n 14: ecma14BinaryPropertiesOfStrings\n};\n\n// #table-unicode-general-category-values\nvar unicodeGeneralCategoryValues = \"Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu\";\n\n// #table-unicode-script-values\nvar ecma9ScriptValues = \"Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb\";\nvar ecma10ScriptValues = ecma9ScriptValues + \" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd\";\nvar ecma11ScriptValues = ecma10ScriptValues + \" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho\";\nvar ecma12ScriptValues = ecma11ScriptValues + \" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi\";\nvar ecma13ScriptValues = ecma12ScriptValues + \" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith\";\nvar ecma14ScriptValues = ecma13ScriptValues + \" \" + scriptValuesAddedInUnicode;\n\nvar unicodeScriptValues = {\n 9: ecma9ScriptValues,\n 10: ecma10ScriptValues,\n 11: ecma11ScriptValues,\n 12: ecma12ScriptValues,\n 13: ecma13ScriptValues,\n 14: ecma14ScriptValues\n};\n\nvar data = {};\nfunction buildUnicodeData(ecmaVersion) {\n var d = data[ecmaVersion] = {\n binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + \" \" + unicodeGeneralCategoryValues),\n binaryOfStrings: wordsRegexp(unicodeBinaryPropertiesOfStrings[ecmaVersion]),\n nonBinary: {\n General_Category: wordsRegexp(unicodeGeneralCategoryValues),\n Script: wordsRegexp(unicodeScriptValues[ecmaVersion])\n }\n };\n d.nonBinary.Script_Extensions = d.nonBinary.Script;\n\n d.nonBinary.gc = d.nonBinary.General_Category;\n d.nonBinary.sc = d.nonBinary.Script;\n d.nonBinary.scx = d.nonBinary.Script_Extensions;\n}\n\nfor (var i = 0, list = [9, 10, 11, 12, 13, 14]; i < list.length; i += 1) {\n var ecmaVersion = list[i];\n\n buildUnicodeData(ecmaVersion);\n}\n\nvar pp$1 = Parser.prototype;\n\n// Track disjunction structure to determine whether a duplicate\n// capture group name is allowed because it is in a separate branch.\nvar BranchID = function BranchID(parent, base) {\n // Parent disjunction branch\n this.parent = parent;\n // Identifies this set of sibling branches\n this.base = base || this;\n};\n\nBranchID.prototype.separatedFrom = function separatedFrom (alt) {\n // A branch is separate from another branch if they or any of\n // their parents are siblings in a given disjunction\n for (var self = this; self; self = self.parent) {\n for (var other = alt; other; other = other.parent) {\n if (self.base === other.base && self !== other) { return true }\n }\n }\n return false\n};\n\nBranchID.prototype.sibling = function sibling () {\n return new BranchID(this.parent, this.base)\n};\n\nvar RegExpValidationState = function RegExpValidationState(parser) {\n this.parser = parser;\n this.validFlags = \"gim\" + (parser.options.ecmaVersion >= 6 ? \"uy\" : \"\") + (parser.options.ecmaVersion >= 9 ? \"s\" : \"\") + (parser.options.ecmaVersion >= 13 ? \"d\" : \"\") + (parser.options.ecmaVersion >= 15 ? \"v\" : \"\");\n this.unicodeProperties = data[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion];\n this.source = \"\";\n this.flags = \"\";\n this.start = 0;\n this.switchU = false;\n this.switchV = false;\n this.switchN = false;\n this.pos = 0;\n this.lastIntValue = 0;\n this.lastStringValue = \"\";\n this.lastAssertionIsQuantifiable = false;\n this.numCapturingParens = 0;\n this.maxBackReference = 0;\n this.groupNames = Object.create(null);\n this.backReferenceNames = [];\n this.branchID = null;\n};\n\nRegExpValidationState.prototype.reset = function reset (start, pattern, flags) {\n var unicodeSets = flags.indexOf(\"v\") !== -1;\n var unicode = flags.indexOf(\"u\") !== -1;\n this.start = start | 0;\n this.source = pattern + \"\";\n this.flags = flags;\n if (unicodeSets && this.parser.options.ecmaVersion >= 15) {\n this.switchU = true;\n this.switchV = true;\n this.switchN = true;\n } else {\n this.switchU = unicode && this.parser.options.ecmaVersion >= 6;\n this.switchV = false;\n this.switchN = unicode && this.parser.options.ecmaVersion >= 9;\n }\n};\n\nRegExpValidationState.prototype.raise = function raise (message) {\n this.parser.raiseRecoverable(this.start, (\"Invalid regular expression: /\" + (this.source) + \"/: \" + message));\n};\n\n// If u flag is given, this returns the code point at the index (it combines a surrogate pair).\n// Otherwise, this returns the code unit of the index (can be a part of a surrogate pair).\nRegExpValidationState.prototype.at = function at (i, forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n var s = this.source;\n var l = s.length;\n if (i >= l) {\n return -1\n }\n var c = s.charCodeAt(i);\n if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {\n return c\n }\n var next = s.charCodeAt(i + 1);\n return next >= 0xDC00 && next <= 0xDFFF ? (c << 10) + next - 0x35FDC00 : c\n};\n\nRegExpValidationState.prototype.nextIndex = function nextIndex (i, forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n var s = this.source;\n var l = s.length;\n if (i >= l) {\n return l\n }\n var c = s.charCodeAt(i), next;\n if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l ||\n (next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) {\n return i + 1\n }\n return i + 2\n};\n\nRegExpValidationState.prototype.current = function current (forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n return this.at(this.pos, forceU)\n};\n\nRegExpValidationState.prototype.lookahead = function lookahead (forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n return this.at(this.nextIndex(this.pos, forceU), forceU)\n};\n\nRegExpValidationState.prototype.advance = function advance (forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n this.pos = this.nextIndex(this.pos, forceU);\n};\n\nRegExpValidationState.prototype.eat = function eat (ch, forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n if (this.current(forceU) === ch) {\n this.advance(forceU);\n return true\n }\n return false\n};\n\nRegExpValidationState.prototype.eatChars = function eatChars (chs, forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n var pos = this.pos;\n for (var i = 0, list = chs; i < list.length; i += 1) {\n var ch = list[i];\n\n var current = this.at(pos, forceU);\n if (current === -1 || current !== ch) {\n return false\n }\n pos = this.nextIndex(pos, forceU);\n }\n this.pos = pos;\n return true\n};\n\n/**\n * Validate the flags part of a given RegExpLiteral.\n *\n * @param {RegExpValidationState} state The state to validate RegExp.\n * @returns {void}\n */\npp$1.validateRegExpFlags = function(state) {\n var validFlags = state.validFlags;\n var flags = state.flags;\n\n var u = false;\n var v = false;\n\n for (var i = 0; i < flags.length; i++) {\n var flag = flags.charAt(i);\n if (validFlags.indexOf(flag) === -1) {\n this.raise(state.start, \"Invalid regular expression flag\");\n }\n if (flags.indexOf(flag, i + 1) > -1) {\n this.raise(state.start, \"Duplicate regular expression flag\");\n }\n if (flag === \"u\") { u = true; }\n if (flag === \"v\") { v = true; }\n }\n if (this.options.ecmaVersion >= 15 && u && v) {\n this.raise(state.start, \"Invalid regular expression flag\");\n }\n};\n\nfunction hasProp(obj) {\n for (var _ in obj) { return true }\n return false\n}\n\n/**\n * Validate the pattern part of a given RegExpLiteral.\n *\n * @param {RegExpValidationState} state The state to validate RegExp.\n * @returns {void}\n */\npp$1.validateRegExpPattern = function(state) {\n this.regexp_pattern(state);\n\n // The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of\n // parsing contains a |GroupName|, reparse with the goal symbol\n // |Pattern[~U, +N]| and use this result instead. Throw a *SyntaxError*\n // exception if _P_ did not conform to the grammar, if any elements of _P_\n // were not matched by the parse, or if any Early Error conditions exist.\n if (!state.switchN && this.options.ecmaVersion >= 9 && hasProp(state.groupNames)) {\n state.switchN = true;\n this.regexp_pattern(state);\n }\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern\npp$1.regexp_pattern = function(state) {\n state.pos = 0;\n state.lastIntValue = 0;\n state.lastStringValue = \"\";\n state.lastAssertionIsQuantifiable = false;\n state.numCapturingParens = 0;\n state.maxBackReference = 0;\n state.groupNames = Object.create(null);\n state.backReferenceNames.length = 0;\n state.branchID = null;\n\n this.regexp_disjunction(state);\n\n if (state.pos !== state.source.length) {\n // Make the same messages as V8.\n if (state.eat(0x29 /* ) */)) {\n state.raise(\"Unmatched ')'\");\n }\n if (state.eat(0x5D /* ] */) || state.eat(0x7D /* } */)) {\n state.raise(\"Lone quantifier brackets\");\n }\n }\n if (state.maxBackReference > state.numCapturingParens) {\n state.raise(\"Invalid escape\");\n }\n for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) {\n var name = list[i];\n\n if (!state.groupNames[name]) {\n state.raise(\"Invalid named capture referenced\");\n }\n }\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction\npp$1.regexp_disjunction = function(state) {\n var trackDisjunction = this.options.ecmaVersion >= 16;\n if (trackDisjunction) { state.branchID = new BranchID(state.branchID, null); }\n this.regexp_alternative(state);\n while (state.eat(0x7C /* | */)) {\n if (trackDisjunction) { state.branchID = state.branchID.sibling(); }\n this.regexp_alternative(state);\n }\n if (trackDisjunction) { state.branchID = state.branchID.parent; }\n\n // Make the same message as V8.\n if (this.regexp_eatQuantifier(state, true)) {\n state.raise(\"Nothing to repeat\");\n }\n if (state.eat(0x7B /* { */)) {\n state.raise(\"Lone quantifier brackets\");\n }\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative\npp$1.regexp_alternative = function(state) {\n while (state.pos < state.source.length && this.regexp_eatTerm(state)) {}\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term\npp$1.regexp_eatTerm = function(state) {\n if (this.regexp_eatAssertion(state)) {\n // Handle `QuantifiableAssertion Quantifier` alternative.\n // `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion\n // is a QuantifiableAssertion.\n if (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state)) {\n // Make the same message as V8.\n if (state.switchU) {\n state.raise(\"Invalid quantifier\");\n }\n }\n return true\n }\n\n if (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) {\n this.regexp_eatQuantifier(state);\n return true\n }\n\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion\npp$1.regexp_eatAssertion = function(state) {\n var start = state.pos;\n state.lastAssertionIsQuantifiable = false;\n\n // ^, $\n if (state.eat(0x5E /* ^ */) || state.eat(0x24 /* $ */)) {\n return true\n }\n\n // \\b \\B\n if (state.eat(0x5C /* \\ */)) {\n if (state.eat(0x42 /* B */) || state.eat(0x62 /* b */)) {\n return true\n }\n state.pos = start;\n }\n\n // Lookahead / Lookbehind\n if (state.eat(0x28 /* ( */) && state.eat(0x3F /* ? */)) {\n var lookbehind = false;\n if (this.options.ecmaVersion >= 9) {\n lookbehind = state.eat(0x3C /* < */);\n }\n if (state.eat(0x3D /* = */) || state.eat(0x21 /* ! */)) {\n this.regexp_disjunction(state);\n if (!state.eat(0x29 /* ) */)) {\n state.raise(\"Unterminated group\");\n }\n state.lastAssertionIsQuantifiable = !lookbehind;\n return true\n }\n }\n\n state.pos = start;\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier\npp$1.regexp_eatQuantifier = function(state, noError) {\n if ( noError === void 0 ) noError = false;\n\n if (this.regexp_eatQuantifierPrefix(state, noError)) {\n state.eat(0x3F /* ? */);\n return true\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix\npp$1.regexp_eatQuantifierPrefix = function(state, noError) {\n return (\n state.eat(0x2A /* * */) ||\n state.eat(0x2B /* + */) ||\n state.eat(0x3F /* ? */) ||\n this.regexp_eatBracedQuantifier(state, noError)\n )\n};\npp$1.regexp_eatBracedQuantifier = function(state, noError) {\n var start = state.pos;\n if (state.eat(0x7B /* { */)) {\n var min = 0, max = -1;\n if (this.regexp_eatDecimalDigits(state)) {\n min = state.lastIntValue;\n if (state.eat(0x2C /* , */) && this.regexp_eatDecimalDigits(state)) {\n max = state.lastIntValue;\n }\n if (state.eat(0x7D /* } */)) {\n // SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-term\n if (max !== -1 && max < min && !noError) {\n state.raise(\"numbers out of order in {} quantifier\");\n }\n return true\n }\n }\n if (state.switchU && !noError) {\n state.raise(\"Incomplete quantifier\");\n }\n state.pos = start;\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Atom\npp$1.regexp_eatAtom = function(state) {\n return (\n this.regexp_eatPatternCharacters(state) ||\n state.eat(0x2E /* . */) ||\n this.regexp_eatReverseSolidusAtomEscape(state) ||\n this.regexp_eatCharacterClass(state) ||\n this.regexp_eatUncapturingGroup(state) ||\n this.regexp_eatCapturingGroup(state)\n )\n};\npp$1.regexp_eatReverseSolidusAtomEscape = function(state) {\n var start = state.pos;\n if (state.eat(0x5C /* \\ */)) {\n if (this.regexp_eatAtomEscape(state)) {\n return true\n }\n state.pos = start;\n }\n return false\n};\npp$1.regexp_eatUncapturingGroup = function(state) {\n var start = state.pos;\n if (state.eat(0x28 /* ( */)) {\n if (state.eat(0x3F /* ? */)) {\n if (this.options.ecmaVersion >= 16) {\n var addModifiers = this.regexp_eatModifiers(state);\n var hasHyphen = state.eat(0x2D /* - */);\n if (addModifiers || hasHyphen) {\n for (var i = 0; i < addModifiers.length; i++) {\n var modifier = addModifiers.charAt(i);\n if (addModifiers.indexOf(modifier, i + 1) > -1) {\n state.raise(\"Duplicate regular expression modifiers\");\n }\n }\n if (hasHyphen) {\n var removeModifiers = this.regexp_eatModifiers(state);\n if (!addModifiers && !removeModifiers && state.current() === 0x3A /* : */) {\n state.raise(\"Invalid regular expression modifiers\");\n }\n for (var i$1 = 0; i$1 < removeModifiers.length; i$1++) {\n var modifier$1 = removeModifiers.charAt(i$1);\n if (\n removeModifiers.indexOf(modifier$1, i$1 + 1) > -1 ||\n addModifiers.indexOf(modifier$1) > -1\n ) {\n state.raise(\"Duplicate regular expression modifiers\");\n }\n }\n }\n }\n }\n if (state.eat(0x3A /* : */)) {\n this.regexp_disjunction(state);\n if (state.eat(0x29 /* ) */)) {\n return true\n }\n state.raise(\"Unterminated group\");\n }\n }\n state.pos = start;\n }\n return false\n};\npp$1.regexp_eatCapturingGroup = function(state) {\n if (state.eat(0x28 /* ( */)) {\n if (this.options.ecmaVersion >= 9) {\n this.regexp_groupSpecifier(state);\n } else if (state.current() === 0x3F /* ? */) {\n state.raise(\"Invalid group\");\n }\n this.regexp_disjunction(state);\n if (state.eat(0x29 /* ) */)) {\n state.numCapturingParens += 1;\n return true\n }\n state.raise(\"Unterminated group\");\n }\n return false\n};\n// RegularExpressionModifiers ::\n// [empty]\n// RegularExpressionModifiers RegularExpressionModifier\npp$1.regexp_eatModifiers = function(state) {\n var modifiers = \"\";\n var ch = 0;\n while ((ch = state.current()) !== -1 && isRegularExpressionModifier(ch)) {\n modifiers += codePointToString(ch);\n state.advance();\n }\n return modifiers\n};\n// RegularExpressionModifier :: one of\n// `i` `m` `s`\nfunction isRegularExpressionModifier(ch) {\n return ch === 0x69 /* i */ || ch === 0x6d /* m */ || ch === 0x73 /* s */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom\npp$1.regexp_eatExtendedAtom = function(state) {\n return (\n state.eat(0x2E /* . */) ||\n this.regexp_eatReverseSolidusAtomEscape(state) ||\n this.regexp_eatCharacterClass(state) ||\n this.regexp_eatUncapturingGroup(state) ||\n this.regexp_eatCapturingGroup(state) ||\n this.regexp_eatInvalidBracedQuantifier(state) ||\n this.regexp_eatExtendedPatternCharacter(state)\n )\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier\npp$1.regexp_eatInvalidBracedQuantifier = function(state) {\n if (this.regexp_eatBracedQuantifier(state, true)) {\n state.raise(\"Nothing to repeat\");\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter\npp$1.regexp_eatSyntaxCharacter = function(state) {\n var ch = state.current();\n if (isSyntaxCharacter(ch)) {\n state.lastIntValue = ch;\n state.advance();\n return true\n }\n return false\n};\nfunction isSyntaxCharacter(ch) {\n return (\n ch === 0x24 /* $ */ ||\n ch >= 0x28 /* ( */ && ch <= 0x2B /* + */ ||\n ch === 0x2E /* . */ ||\n ch === 0x3F /* ? */ ||\n ch >= 0x5B /* [ */ && ch <= 0x5E /* ^ */ ||\n ch >= 0x7B /* { */ && ch <= 0x7D /* } */\n )\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter\n// But eat eager.\npp$1.regexp_eatPatternCharacters = function(state) {\n var start = state.pos;\n var ch = 0;\n while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {\n state.advance();\n }\n return state.pos !== start\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter\npp$1.regexp_eatExtendedPatternCharacter = function(state) {\n var ch = state.current();\n if (\n ch !== -1 &&\n ch !== 0x24 /* $ */ &&\n !(ch >= 0x28 /* ( */ && ch <= 0x2B /* + */) &&\n ch !== 0x2E /* . */ &&\n ch !== 0x3F /* ? */ &&\n ch !== 0x5B /* [ */ &&\n ch !== 0x5E /* ^ */ &&\n ch !== 0x7C /* | */\n ) {\n state.advance();\n return true\n }\n return false\n};\n\n// GroupSpecifier ::\n// [empty]\n// `?` GroupName\npp$1.regexp_groupSpecifier = function(state) {\n if (state.eat(0x3F /* ? */)) {\n if (!this.regexp_eatGroupName(state)) { state.raise(\"Invalid group\"); }\n var trackDisjunction = this.options.ecmaVersion >= 16;\n var known = state.groupNames[state.lastStringValue];\n if (known) {\n if (trackDisjunction) {\n for (var i = 0, list = known; i < list.length; i += 1) {\n var altID = list[i];\n\n if (!altID.separatedFrom(state.branchID))\n { state.raise(\"Duplicate capture group name\"); }\n }\n } else {\n state.raise(\"Duplicate capture group name\");\n }\n }\n if (trackDisjunction) {\n (known || (state.groupNames[state.lastStringValue] = [])).push(state.branchID);\n } else {\n state.groupNames[state.lastStringValue] = true;\n }\n }\n};\n\n// GroupName ::\n// `<` RegExpIdentifierName `>`\n// Note: this updates `state.lastStringValue` property with the eaten name.\npp$1.regexp_eatGroupName = function(state) {\n state.lastStringValue = \"\";\n if (state.eat(0x3C /* < */)) {\n if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {\n return true\n }\n state.raise(\"Invalid capture group name\");\n }\n return false\n};\n\n// RegExpIdentifierName ::\n// RegExpIdentifierStart\n// RegExpIdentifierName RegExpIdentifierPart\n// Note: this updates `state.lastStringValue` property with the eaten name.\npp$1.regexp_eatRegExpIdentifierName = function(state) {\n state.lastStringValue = \"\";\n if (this.regexp_eatRegExpIdentifierStart(state)) {\n state.lastStringValue += codePointToString(state.lastIntValue);\n while (this.regexp_eatRegExpIdentifierPart(state)) {\n state.lastStringValue += codePointToString(state.lastIntValue);\n }\n return true\n }\n return false\n};\n\n// RegExpIdentifierStart ::\n// UnicodeIDStart\n// `$`\n// `_`\n// `\\` RegExpUnicodeEscapeSequence[+U]\npp$1.regexp_eatRegExpIdentifierStart = function(state) {\n var start = state.pos;\n var forceU = this.options.ecmaVersion >= 11;\n var ch = state.current(forceU);\n state.advance(forceU);\n\n if (ch === 0x5C /* \\ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {\n ch = state.lastIntValue;\n }\n if (isRegExpIdentifierStart(ch)) {\n state.lastIntValue = ch;\n return true\n }\n\n state.pos = start;\n return false\n};\nfunction isRegExpIdentifierStart(ch) {\n return isIdentifierStart(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */\n}\n\n// RegExpIdentifierPart ::\n// UnicodeIDContinue\n// `$`\n// `_`\n// `\\` RegExpUnicodeEscapeSequence[+U]\n// <ZWNJ>\n// <ZWJ>\npp$1.regexp_eatRegExpIdentifierPart = function(state) {\n var start = state.pos;\n var forceU = this.options.ecmaVersion >= 11;\n var ch = state.current(forceU);\n state.advance(forceU);\n\n if (ch === 0x5C /* \\ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {\n ch = state.lastIntValue;\n }\n if (isRegExpIdentifierPart(ch)) {\n state.lastIntValue = ch;\n return true\n }\n\n state.pos = start;\n return false\n};\nfunction isRegExpIdentifierPart(ch) {\n return isIdentifierChar(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */ || ch === 0x200C /* <ZWNJ> */ || ch === 0x200D /* <ZWJ> */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape\npp$1.regexp_eatAtomEscape = function(state) {\n if (\n this.regexp_eatBackReference(state) ||\n this.regexp_eatCharacterClassEscape(state) ||\n this.regexp_eatCharacterEscape(state) ||\n (state.switchN && this.regexp_eatKGroupName(state))\n ) {\n return true\n }\n if (state.switchU) {\n // Make the same message as V8.\n if (state.current() === 0x63 /* c */) {\n state.raise(\"Invalid unicode escape\");\n }\n state.raise(\"Invalid escape\");\n }\n return false\n};\npp$1.regexp_eatBackReference = function(state) {\n var start = state.pos;\n if (this.regexp_eatDecimalEscape(state)) {\n var n = state.lastIntValue;\n if (state.switchU) {\n // For SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-atomescape\n if (n > state.maxBackReference) {\n state.maxBackReference = n;\n }\n return true\n }\n if (n <= state.numCapturingParens) {\n return true\n }\n state.pos = start;\n }\n return false\n};\npp$1.regexp_eatKGroupName = function(state) {\n if (state.eat(0x6B /* k */)) {\n if (this.regexp_eatGroupName(state)) {\n state.backReferenceNames.push(state.lastStringValue);\n return true\n }\n state.raise(\"Invalid named reference\");\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape\npp$1.regexp_eatCharacterEscape = function(state) {\n return (\n this.regexp_eatControlEscape(state) ||\n this.regexp_eatCControlLetter(state) ||\n this.regexp_eatZero(state) ||\n this.regexp_eatHexEscapeSequence(state) ||\n this.regexp_eatRegExpUnicodeEscapeSequence(state, false) ||\n (!state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state)) ||\n this.regexp_eatIdentityEscape(state)\n )\n};\npp$1.regexp_eatCControlLetter = function(state) {\n var start = state.pos;\n if (state.eat(0x63 /* c */)) {\n if (this.regexp_eatControlLetter(state)) {\n return true\n }\n state.pos = start;\n }\n return false\n};\npp$1.regexp_eatZero = function(state) {\n if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {\n state.lastIntValue = 0;\n state.advance();\n return true\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape\npp$1.regexp_eatControlEscape = function(state) {\n var ch = state.current();\n if (ch === 0x74 /* t */) {\n state.lastIntValue = 0x09; /* \\t */\n state.advance();\n return true\n }\n if (ch === 0x6E /* n */) {\n state.lastIntValue = 0x0A; /* \\n */\n state.advance();\n return true\n }\n if (ch === 0x76 /* v */) {\n state.lastIntValue = 0x0B; /* \\v */\n state.advance();\n return true\n }\n if (ch === 0x66 /* f */) {\n state.lastIntValue = 0x0C; /* \\f */\n state.advance();\n return true\n }\n if (ch === 0x72 /* r */) {\n state.lastIntValue = 0x0D; /* \\r */\n state.advance();\n return true\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter\npp$1.regexp_eatControlLetter = function(state) {\n var ch = state.current();\n if (isControlLetter(ch)) {\n state.lastIntValue = ch % 0x20;\n state.advance();\n return true\n }\n return false\n};\nfunction isControlLetter(ch) {\n return (\n (ch >= 0x41 /* A */ && ch <= 0x5A /* Z */) ||\n (ch >= 0x61 /* a */ && ch <= 0x7A /* z */)\n )\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence\npp$1.regexp_eatRegExpUnicodeEscapeSequence = function(state, forceU) {\n if ( forceU === void 0 ) forceU = false;\n\n var start = state.pos;\n var switchU = forceU || state.switchU;\n\n if (state.eat(0x75 /* u */)) {\n if (this.regexp_eatFixedHexDigits(state, 4)) {\n var lead = state.lastIntValue;\n if (switchU && lead >= 0xD800 && lead <= 0xDBFF) {\n var leadSurrogateEnd = state.pos;\n if (state.eat(0x5C /* \\ */) && state.eat(0x75 /* u */) && this.regexp_eatFixedHexDigits(state, 4)) {\n var trail = state.lastIntValue;\n if (trail >= 0xDC00 && trail <= 0xDFFF) {\n state.lastIntValue = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;\n return true\n }\n }\n state.pos = leadSurrogateEnd;\n state.lastIntValue = lead;\n }\n return true\n }\n if (\n switchU &&\n state.eat(0x7B /* { */) &&\n this.regexp_eatHexDigits(state) &&\n state.eat(0x7D /* } */) &&\n isValidUnicode(state.lastIntValue)\n ) {\n return true\n }\n if (switchU) {\n state.raise(\"Invalid unicode escape\");\n }\n state.pos = start;\n }\n\n return false\n};\nfunction isValidUnicode(ch) {\n return ch >= 0 && ch <= 0x10FFFF\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape\npp$1.regexp_eatIdentityEscape = function(state) {\n if (state.switchU) {\n if (this.regexp_eatSyntaxCharacter(state)) {\n return true\n }\n if (state.eat(0x2F /* / */)) {\n state.lastIntValue = 0x2F; /* / */\n return true\n }\n return false\n }\n\n var ch = state.current();\n if (ch !== 0x63 /* c */ && (!state.switchN || ch !== 0x6B /* k */)) {\n state.lastIntValue = ch;\n state.advance();\n return true\n }\n\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape\npp$1.regexp_eatDecimalEscape = function(state) {\n state.lastIntValue = 0;\n var ch = state.current();\n if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {\n do {\n state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);\n state.advance();\n } while ((ch = state.current()) >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */)\n return true\n }\n return false\n};\n\n// Return values used by character set parsing methods, needed to\n// forbid negation of sets that can match strings.\nvar CharSetNone = 0; // Nothing parsed\nvar CharSetOk = 1; // Construct parsed, cannot contain strings\nvar CharSetString = 2; // Construct parsed, can contain strings\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape\npp$1.regexp_eatCharacterClassEscape = function(state) {\n var ch = state.current();\n\n if (isCharacterClassEscape(ch)) {\n state.lastIntValue = -1;\n state.advance();\n return CharSetOk\n }\n\n var negate = false;\n if (\n state.switchU &&\n this.options.ecmaVersion >= 9 &&\n ((negate = ch === 0x50 /* P */) || ch === 0x70 /* p */)\n ) {\n state.lastIntValue = -1;\n state.advance();\n var result;\n if (\n state.eat(0x7B /* { */) &&\n (result = this.regexp_eatUnicodePropertyValueExpression(state)) &&\n state.eat(0x7D /* } */)\n ) {\n if (negate && result === CharSetString) { state.raise(\"Invalid property name\"); }\n return result\n }\n state.raise(\"Invalid property name\");\n }\n\n return CharSetNone\n};\n\nfunction isCharacterClassEscape(ch) {\n return (\n ch === 0x64 /* d */ ||\n ch === 0x44 /* D */ ||\n ch === 0x73 /* s */ ||\n ch === 0x53 /* S */ ||\n ch === 0x77 /* w */ ||\n ch === 0x57 /* W */\n )\n}\n\n// UnicodePropertyValueExpression ::\n// UnicodePropertyName `=` UnicodePropertyValue\n// LoneUnicodePropertyNameOrValue\npp$1.regexp_eatUnicodePropertyValueExpression = function(state) {\n var start = state.pos;\n\n // UnicodePropertyName `=` UnicodePropertyValue\n if (this.regexp_eatUnicodePropertyName(state) && state.eat(0x3D /* = */)) {\n var name = state.lastStringValue;\n if (this.regexp_eatUnicodePropertyValue(state)) {\n var value = state.lastStringValue;\n this.regexp_validateUnicodePropertyNameAndValue(state, name, value);\n return CharSetOk\n }\n }\n state.pos = start;\n\n // LoneUnicodePropertyNameOrValue\n if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {\n var nameOrValue = state.lastStringValue;\n return this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue)\n }\n return CharSetNone\n};\n\npp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {\n if (!hasOwn(state.unicodeProperties.nonBinary, name))\n { state.raise(\"Invalid property name\"); }\n if (!state.unicodeProperties.nonBinary[name].test(value))\n { state.raise(\"Invalid property value\"); }\n};\n\npp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {\n if (state.unicodeProperties.binary.test(nameOrValue)) { return CharSetOk }\n if (state.switchV && state.unicodeProperties.binaryOfStrings.test(nameOrValue)) { return CharSetString }\n state.raise(\"Invalid property name\");\n};\n\n// UnicodePropertyName ::\n// UnicodePropertyNameCharacters\npp$1.regexp_eatUnicodePropertyName = function(state) {\n var ch = 0;\n state.lastStringValue = \"\";\n while (isUnicodePropertyNameCharacter(ch = state.current())) {\n state.lastStringValue += codePointToString(ch);\n state.advance();\n }\n return state.lastStringValue !== \"\"\n};\n\nfunction isUnicodePropertyNameCharacter(ch) {\n return isControlLetter(ch) || ch === 0x5F /* _ */\n}\n\n// UnicodePropertyValue ::\n// UnicodePropertyValueCharacters\npp$1.regexp_eatUnicodePropertyValue = function(state) {\n var ch = 0;\n state.lastStringValue = \"\";\n while (isUnicodePropertyValueCharacter(ch = state.current())) {\n state.lastStringValue += codePointToString(ch);\n state.advance();\n }\n return state.lastStringValue !== \"\"\n};\nfunction isUnicodePropertyValueCharacter(ch) {\n return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch)\n}\n\n// LoneUnicodePropertyNameOrValue ::\n// UnicodePropertyValueCharacters\npp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {\n return this.regexp_eatUnicodePropertyValue(state)\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass\npp$1.regexp_eatCharacterClass = function(state) {\n if (state.eat(0x5B /* [ */)) {\n var negate = state.eat(0x5E /* ^ */);\n var result = this.regexp_classContents(state);\n if (!state.eat(0x5D /* ] */))\n { state.raise(\"Unterminated character class\"); }\n if (negate && result === CharSetString)\n { state.raise(\"Negated character class may contain strings\"); }\n return true\n }\n return false\n};\n\n// https://tc39.es/ecma262/#prod-ClassContents\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges\npp$1.regexp_classContents = function(state) {\n if (state.current() === 0x5D /* ] */) { return CharSetOk }\n if (state.switchV) { return this.regexp_classSetExpression(state) }\n this.regexp_nonEmptyClassRanges(state);\n return CharSetOk\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges\n// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash\npp$1.regexp_nonEmptyClassRanges = function(state) {\n while (this.regexp_eatClassAtom(state)) {\n var left = state.lastIntValue;\n if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {\n var right = state.lastIntValue;\n if (state.switchU && (left === -1 || right === -1)) {\n state.raise(\"Invalid character class\");\n }\n if (left !== -1 && right !== -1 && left > right) {\n state.raise(\"Range out of order in character class\");\n }\n }\n }\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash\npp$1.regexp_eatClassAtom = function(state) {\n var start = state.pos;\n\n if (state.eat(0x5C /* \\ */)) {\n if (this.regexp_eatClassEscape(state)) {\n return true\n }\n if (state.switchU) {\n // Make the same message as V8.\n var ch$1 = state.current();\n if (ch$1 === 0x63 /* c */ || isOctalDigit(ch$1)) {\n state.raise(\"Invalid class escape\");\n }\n state.raise(\"Invalid escape\");\n }\n state.pos = start;\n }\n\n var ch = state.current();\n if (ch !== 0x5D /* ] */) {\n state.lastIntValue = ch;\n state.advance();\n return true\n }\n\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape\npp$1.regexp_eatClassEscape = function(state) {\n var start = state.pos;\n\n if (state.eat(0x62 /* b */)) {\n state.lastIntValue = 0x08; /* <BS> */\n return true\n }\n\n if (state.switchU && state.eat(0x2D /* - */)) {\n state.lastIntValue = 0x2D; /* - */\n return true\n }\n\n if (!state.switchU && state.eat(0x63 /* c */)) {\n if (this.regexp_eatClassControlLetter(state)) {\n return true\n }\n state.pos = start;\n }\n\n return (\n this.regexp_eatCharacterClassEscape(state) ||\n this.regexp_eatCharacterEscape(state)\n )\n};\n\n// https://tc39.es/ecma262/#prod-ClassSetExpression\n// https://tc39.es/ecma262/#prod-ClassUnion\n// https://tc39.es/ecma262/#prod-ClassIntersection\n// https://tc39.es/ecma262/#prod-ClassSubtraction\npp$1.regexp_classSetExpression = function(state) {\n var result = CharSetOk, subResult;\n if (this.regexp_eatClassSetRange(state)) ; else if (subResult = this.regexp_eatClassSetOperand(state)) {\n if (subResult === CharSetString) { result = CharSetString; }\n // https://tc39.es/ecma262/#prod-ClassIntersection\n var start = state.pos;\n while (state.eatChars([0x26, 0x26] /* && */)) {\n if (\n state.current() !== 0x26 /* & */ &&\n (subResult = this.regexp_eatClassSetOperand(state))\n ) {\n if (subResult !== CharSetString) { result = CharSetOk; }\n continue\n }\n state.raise(\"Invalid character in character class\");\n }\n if (start !== state.pos) { return result }\n // https://tc39.es/ecma262/#prod-ClassSubtraction\n while (state.eatChars([0x2D, 0x2D] /* -- */)) {\n if (this.regexp_eatClassSetOperand(state)) { continue }\n state.raise(\"Invalid character in character class\");\n }\n if (start !== state.pos) { return result }\n } else {\n state.raise(\"Invalid character in character class\");\n }\n // https://tc39.es/ecma262/#prod-ClassUnion\n for (;;) {\n if (this.regexp_eatClassSetRange(state)) { continue }\n subResult = this.regexp_eatClassSetOperand(state);\n if (!subResult) { return result }\n if (subResult === CharSetString) { result = CharSetString; }\n }\n};\n\n// https://tc39.es/ecma262/#prod-ClassSetRange\npp$1.regexp_eatClassSetRange = function(state) {\n var start = state.pos;\n if (this.regexp_eatClassSetCharacter(state)) {\n var left = state.lastIntValue;\n if (state.eat(0x2D /* - */) && this.regexp_eatClassSetCharacter(state)) {\n var right = state.lastIntValue;\n if (left !== -1 && right !== -1 && left > right) {\n state.raise(\"Range out of order in character class\");\n }\n return true\n }\n state.pos = start;\n }\n return false\n};\n\n// https://tc39.es/ecma262/#prod-ClassSetOperand\npp$1.regexp_eatClassSetOperand = function(state) {\n if (this.regexp_eatClassSetCharacter(state)) { return CharSetOk }\n return this.regexp_eatClassStringDisjunction(state) || this.regexp_eatNestedClass(state)\n};\n\n// https://tc39.es/ecma262/#prod-NestedClass\npp$1.regexp_eatNestedClass = function(state) {\n var start = state.pos;\n if (state.eat(0x5B /* [ */)) {\n var negate = state.eat(0x5E /* ^ */);\n var result = this.regexp_classContents(state);\n if (state.eat(0x5D /* ] */)) {\n if (negate && result === CharSetString) {\n state.raise(\"Negated character class may contain strings\");\n }\n return result\n }\n state.pos = start;\n }\n if (state.eat(0x5C /* \\ */)) {\n var result$1 = this.regexp_eatCharacterClassEscape(state);\n if (result$1) {\n return result$1\n }\n state.pos = start;\n }\n return null\n};\n\n// https://tc39.es/ecma262/#prod-ClassStringDisjunction\npp$1.regexp_eatClassStringDisjunction = function(state) {\n var start = state.pos;\n if (state.eatChars([0x5C, 0x71] /* \\q */)) {\n if (state.eat(0x7B /* { */)) {\n var result = this.regexp_classStringDisjunctionContents(state);\n if (state.eat(0x7D /* } */)) {\n return result\n }\n } else {\n // Make the same message as V8.\n state.raise(\"Invalid escape\");\n }\n state.pos = start;\n }\n return null\n};\n\n// https://tc39.es/ecma262/#prod-ClassStringDisjunctionContents\npp$1.regexp_classStringDisjunctionContents = function(state) {\n var result = this.regexp_classString(state);\n while (state.eat(0x7C /* | */)) {\n if (this.regexp_classString(state) === CharSetString) { result = CharSetString; }\n }\n return result\n};\n\n// https://tc39.es/ecma262/#prod-ClassString\n// https://tc39.es/ecma262/#prod-NonEmptyClassString\npp$1.regexp_classString = function(state) {\n var count = 0;\n while (this.regexp_eatClassSetCharacter(state)) { count++; }\n return count === 1 ? CharSetOk : CharSetString\n};\n\n// https://tc39.es/ecma262/#prod-ClassSetCharacter\npp$1.regexp_eatClassSetCharacter = function(state) {\n var start = state.pos;\n if (state.eat(0x5C /* \\ */)) {\n if (\n this.regexp_eatCharacterEscape(state) ||\n this.regexp_eatClassSetReservedPunctuator(state)\n ) {\n return true\n }\n if (state.eat(0x62 /* b */)) {\n state.lastIntValue = 0x08; /* <BS> */\n return true\n }\n state.pos = start;\n return false\n }\n var ch = state.current();\n if (ch < 0 || ch === state.lookahead() && isClassSetReservedDoublePunctuatorCharacter(ch)) { return false }\n if (isClassSetSyntaxCharacter(ch)) { return false }\n state.advance();\n state.lastIntValue = ch;\n return true\n};\n\n// https://tc39.es/ecma262/#prod-ClassSetReservedDoublePunctuator\nfunction isClassSetReservedDoublePunctuatorCharacter(ch) {\n return (\n ch === 0x21 /* ! */ ||\n ch >= 0x23 /* # */ && ch <= 0x26 /* & */ ||\n ch >= 0x2A /* * */ && ch <= 0x2C /* , */ ||\n ch === 0x2E /* . */ ||\n ch >= 0x3A /* : */ && ch <= 0x40 /* @ */ ||\n ch === 0x5E /* ^ */ ||\n ch === 0x60 /* ` */ ||\n ch === 0x7E /* ~ */\n )\n}\n\n// https://tc39.es/ecma262/#prod-ClassSetSyntaxCharacter\nfunction isClassSetSyntaxCharacter(ch) {\n return (\n ch === 0x28 /* ( */ ||\n ch === 0x29 /* ) */ ||\n ch === 0x2D /* - */ ||\n ch === 0x2F /* / */ ||\n ch >= 0x5B /* [ */ && ch <= 0x5D /* ] */ ||\n ch >= 0x7B /* { */ && ch <= 0x7D /* } */\n )\n}\n\n// https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator\npp$1.regexp_eatClassSetReservedPunctuator = function(state) {\n var ch = state.current();\n if (isClassSetReservedPunctuator(ch)) {\n state.lastIntValue = ch;\n state.advance();\n return true\n }\n return false\n};\n\n// https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator\nfunction isClassSetReservedPunctuator(ch) {\n return (\n ch === 0x21 /* ! */ ||\n ch === 0x23 /* # */ ||\n ch === 0x25 /* % */ ||\n ch === 0x26 /* & */ ||\n ch === 0x2C /* , */ ||\n ch === 0x2D /* - */ ||\n ch >= 0x3A /* : */ && ch <= 0x3E /* > */ ||\n ch === 0x40 /* @ */ ||\n ch === 0x60 /* ` */ ||\n ch === 0x7E /* ~ */\n )\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter\npp$1.regexp_eatClassControlLetter = function(state) {\n var ch = state.current();\n if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {\n state.lastIntValue = ch % 0x20;\n state.advance();\n return true\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence\npp$1.regexp_eatHexEscapeSequence = function(state) {\n var start = state.pos;\n if (state.eat(0x78 /* x */)) {\n if (this.regexp_eatFixedHexDigits(state, 2)) {\n return true\n }\n if (state.switchU) {\n state.raise(\"Invalid escape\");\n }\n state.pos = start;\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits\npp$1.regexp_eatDecimalDigits = function(state) {\n var start = state.pos;\n var ch = 0;\n state.lastIntValue = 0;\n while (isDecimalDigit(ch = state.current())) {\n state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);\n state.advance();\n }\n return state.pos !== start\n};\nfunction isDecimalDigit(ch) {\n return ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits\npp$1.regexp_eatHexDigits = function(state) {\n var start = state.pos;\n var ch = 0;\n state.lastIntValue = 0;\n while (isHexDigit(ch = state.current())) {\n state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);\n state.advance();\n }\n return state.pos !== start\n};\nfunction isHexDigit(ch) {\n return (\n (ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */) ||\n (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) ||\n (ch >= 0x61 /* a */ && ch <= 0x66 /* f */)\n )\n}\nfunction hexToInt(ch) {\n if (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) {\n return 10 + (ch - 0x41 /* A */)\n }\n if (ch >= 0x61 /* a */ && ch <= 0x66 /* f */) {\n return 10 + (ch - 0x61 /* a */)\n }\n return ch - 0x30 /* 0 */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence\n// Allows only 0-377(octal) i.e. 0-255(decimal).\npp$1.regexp_eatLegacyOctalEscapeSequence = function(state) {\n if (this.regexp_eatOctalDigit(state)) {\n var n1 = state.lastIntValue;\n if (this.regexp_eatOctalDigit(state)) {\n var n2 = state.lastIntValue;\n if (n1 <= 3 && this.regexp_eatOctalDigit(state)) {\n state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue;\n } else {\n state.lastIntValue = n1 * 8 + n2;\n }\n } else {\n state.lastIntValue = n1;\n }\n return true\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit\npp$1.regexp_eatOctalDigit = function(state) {\n var ch = state.current();\n if (isOctalDigit(ch)) {\n state.lastIntValue = ch - 0x30; /* 0 */\n state.advance();\n return true\n }\n state.lastIntValue = 0;\n return false\n};\nfunction isOctalDigit(ch) {\n return ch >= 0x30 /* 0 */ && ch <= 0x37 /* 7 */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits\n// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit\n// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence\npp$1.regexp_eatFixedHexDigits = function(state, length) {\n var start = state.pos;\n state.lastIntValue = 0;\n for (var i = 0; i < length; ++i) {\n var ch = state.current();\n if (!isHexDigit(ch)) {\n state.pos = start;\n return false\n }\n state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);\n state.advance();\n }\n return true\n};\n\n// Object type used to represent tokens. Note that normally, tokens\n// simply exist as properties on the parser object. This is only\n// used for the onToken callback and the external tokenizer.\n\nvar Token = function Token(p) {\n this.type = p.type;\n this.value = p.value;\n this.start = p.start;\n this.end = p.end;\n if (p.options.locations)\n { this.loc = new SourceLocation(p, p.startLoc, p.endLoc); }\n if (p.options.ranges)\n { this.range = [p.start, p.end]; }\n};\n\n// ## Tokenizer\n\nvar pp = Parser.prototype;\n\n// Move to the next token\n\npp.next = function(ignoreEscapeSequenceInKeyword) {\n if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc)\n { this.raiseRecoverable(this.start, \"Escape sequence in keyword \" + this.type.keyword); }\n if (this.options.onToken)\n { this.options.onToken(new Token(this)); }\n\n this.lastTokEnd = this.end;\n this.lastTokStart = this.start;\n this.lastTokEndLoc = this.endLoc;\n this.lastTokStartLoc = this.startLoc;\n this.nextToken();\n};\n\npp.getToken = function() {\n this.next();\n return new Token(this)\n};\n\n// If we're in an ES6 environment, make parsers iterable\nif (typeof Symbol !== \"undefined\")\n { pp[Symbol.iterator] = function() {\n var this$1$1 = this;\n\n return {\n next: function () {\n var token = this$1$1.getToken();\n return {\n done: token.type === types$1.eof,\n value: token\n }\n }\n }\n }; }\n\n// Toggle strict mode. Re-reads the next number or string to please\n// pedantic tests (`\"use strict\"; 010;` should fail).\n\n// Read a single token, updating the parser object's token-related\n// properties.\n\npp.nextToken = function() {\n var curContext = this.curContext();\n if (!curContext || !curContext.preserveSpace) { this.skipSpace(); }\n\n this.start = this.pos;\n if (this.options.locations) { this.startLoc = this.curPosition(); }\n if (this.pos >= this.input.length) { return this.finishToken(types$1.eof) }\n\n if (curContext.override) { return curContext.override(this) }\n else { this.readToken(this.fullCharCodeAtPos()); }\n};\n\npp.readToken = function(code) {\n // Identifier or keyword. '\\uXXXX' sequences are allowed in\n // identifiers, so '\\' also dispatches to that.\n if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\\' */)\n { return this.readWord() }\n\n return this.getTokenFromCode(code)\n};\n\npp.fullCharCodeAtPos = function() {\n var code = this.input.charCodeAt(this.pos);\n if (code <= 0xd7ff || code >= 0xdc00) { return code }\n var next = this.input.charCodeAt(this.pos + 1);\n return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00\n};\n\npp.skipBlockComment = function() {\n var startLoc = this.options.onComment && this.curPosition();\n var start = this.pos, end = this.input.indexOf(\"*/\", this.pos += 2);\n if (end === -1) { this.raise(this.pos - 2, \"Unterminated comment\"); }\n this.pos = end + 2;\n if (this.options.locations) {\n for (var nextBreak = (void 0), pos = start; (nextBreak = nextLineBreak(this.input, pos, this.pos)) > -1;) {\n ++this.curLine;\n pos = this.lineStart = nextBreak;\n }\n }\n if (this.options.onComment)\n { this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos,\n startLoc, this.curPosition()); }\n};\n\npp.skipLineComment = function(startSkip) {\n var start = this.pos;\n var startLoc = this.options.onComment && this.curPosition();\n var ch = this.input.charCodeAt(this.pos += startSkip);\n while (this.pos < this.input.length && !isNewLine(ch)) {\n ch = this.input.charCodeAt(++this.pos);\n }\n if (this.options.onComment)\n { this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos,\n startLoc, this.curPosition()); }\n};\n\n// Called at the start of the parse and after every token. Skips\n// whitespace and comments, and.\n\npp.skipSpace = function() {\n loop: while (this.pos < this.input.length) {\n var ch = this.input.charCodeAt(this.pos);\n switch (ch) {\n case 32: case 160: // ' '\n ++this.pos;\n break\n case 13:\n if (this.input.charCodeAt(this.pos + 1) === 10) {\n ++this.pos;\n }\n case 10: case 8232: case 8233:\n ++this.pos;\n if (this.options.locations) {\n ++this.curLine;\n this.lineStart = this.pos;\n }\n break\n case 47: // '/'\n switch (this.input.charCodeAt(this.pos + 1)) {\n case 42: // '*'\n this.skipBlockComment();\n break\n case 47:\n this.skipLineComment(2);\n break\n default:\n break loop\n }\n break\n default:\n if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {\n ++this.pos;\n } else {\n break loop\n }\n }\n }\n};\n\n// Called at the end of every token. Sets `end`, `val`, and\n// maintains `context` and `exprAllowed`, and skips the space after\n// the token, so that the next one's `start` will point at the\n// right position.\n\npp.finishToken = function(type, val) {\n this.end = this.pos;\n if (this.options.locations) { this.endLoc = this.curPosition(); }\n var prevType = this.type;\n this.type = type;\n this.value = val;\n\n this.updateContext(prevType);\n};\n\n// ### Token reading\n\n// This is the function that is called to fetch the next token. It\n// is somewhat obscure, because it works in character codes rather\n// than characters, and because operator parsing has been inlined\n// into it.\n//\n// All in the name of speed.\n//\npp.readToken_dot = function() {\n var next = this.input.charCodeAt(this.pos + 1);\n if (next >= 48 && next <= 57) { return this.readNumber(true) }\n var next2 = this.input.charCodeAt(this.pos + 2);\n if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'\n this.pos += 3;\n return this.finishToken(types$1.ellipsis)\n } else {\n ++this.pos;\n return this.finishToken(types$1.dot)\n }\n};\n\npp.readToken_slash = function() { // '/'\n var next = this.input.charCodeAt(this.pos + 1);\n if (this.exprAllowed) { ++this.pos; return this.readRegexp() }\n if (next === 61) { return this.finishOp(types$1.assign, 2) }\n return this.finishOp(types$1.slash, 1)\n};\n\npp.readToken_mult_modulo_exp = function(code) { // '%*'\n var next = this.input.charCodeAt(this.pos + 1);\n var size = 1;\n var tokentype = code === 42 ? types$1.star : types$1.modulo;\n\n // exponentiation operator ** and **=\n if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {\n ++size;\n tokentype = types$1.starstar;\n next = this.input.charCodeAt(this.pos + 2);\n }\n\n if (next === 61) { return this.finishOp(types$1.assign, size + 1) }\n return this.finishOp(tokentype, size)\n};\n\npp.readToken_pipe_amp = function(code) { // '|&'\n var next = this.input.charCodeAt(this.pos + 1);\n if (next === code) {\n if (this.options.ecmaVersion >= 12) {\n var next2 = this.input.charCodeAt(this.pos + 2);\n if (next2 === 61) { return this.finishOp(types$1.assign, 3) }\n }\n return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2)\n }\n if (next === 61) { return this.finishOp(types$1.assign, 2) }\n return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1)\n};\n\npp.readToken_caret = function() { // '^'\n var next = this.input.charCodeAt(this.pos + 1);\n if (next === 61) { return this.finishOp(types$1.assign, 2) }\n return this.finishOp(types$1.bitwiseXOR, 1)\n};\n\npp.readToken_plus_min = function(code) { // '+-'\n var next = this.input.charCodeAt(this.pos + 1);\n if (next === code) {\n if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&\n (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) {\n // A `-->` line comment\n this.skipLineComment(3);\n this.skipSpace();\n return this.nextToken()\n }\n return this.finishOp(types$1.incDec, 2)\n }\n if (next === 61) { return this.finishOp(types$1.assign, 2) }\n return this.finishOp(types$1.plusMin, 1)\n};\n\npp.readToken_lt_gt = function(code) { // '<>'\n var next = this.input.charCodeAt(this.pos + 1);\n var size = 1;\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;\n if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types$1.assign, size + 1) }\n return this.finishOp(types$1.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // `<!--`, an XML-style comment that should be interpreted as a line comment\n this.skipLineComment(4);\n this.skipSpace();\n return this.nextToken()\n }\n if (next === 61) { size = 2; }\n return this.finishOp(types$1.relational, size)\n};\n\npp.readToken_eq_excl = function(code) { // '=!'\n var next = this.input.charCodeAt(this.pos + 1);\n if (next === 61) { return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) }\n if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>'\n this.pos += 2;\n return this.finishToken(types$1.arrow)\n }\n return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1)\n};\n\npp.readToken_question = function() { // '?'\n var ecmaVersion = this.options.ecmaVersion;\n if (ecmaVersion >= 11) {\n var next = this.input.charCodeAt(this.pos + 1);\n if (next === 46) {\n var next2 = this.input.charCodeAt(this.pos + 2);\n if (next2 < 48 || next2 > 57) { return this.finishOp(types$1.questionDot, 2) }\n }\n if (next === 63) {\n if (ecmaVersion >= 12) {\n var next2$1 = this.input.charCodeAt(this.pos + 2);\n if (next2$1 === 61) { return this.finishOp(types$1.assign, 3) }\n }\n return this.finishOp(types$1.coalesce, 2)\n }\n }\n return this.finishOp(types$1.question, 1)\n};\n\npp.readToken_numberSign = function() { // '#'\n var ecmaVersion = this.options.ecmaVersion;\n var code = 35; // '#'\n if (ecmaVersion >= 13) {\n ++this.pos;\n code = this.fullCharCodeAtPos();\n if (isIdentifierStart(code, true) || code === 92 /* '\\' */) {\n return this.finishToken(types$1.privateId, this.readWord1())\n }\n }\n\n this.raise(this.pos, \"Unexpected character '\" + codePointToString(code) + \"'\");\n};\n\npp.getTokenFromCode = function(code) {\n switch (code) {\n // The interpretation of a dot depends on whether it is followed\n // by a digit or another two dots.\n case 46: // '.'\n return this.readToken_dot()\n\n // Punctuation tokens.\n case 40: ++this.pos; return this.finishToken(types$1.parenL)\n case 41: ++this.pos; return this.finishToken(types$1.parenR)\n case 59: ++this.pos; return this.finishToken(types$1.semi)\n case 44: ++this.pos; return this.finishToken(types$1.comma)\n case 91: ++this.pos; return this.finishToken(types$1.bracketL)\n case 93: ++this.pos; return this.finishToken(types$1.bracketR)\n case 123: ++this.pos; return this.finishToken(types$1.braceL)\n case 125: ++this.pos; return this.finishToken(types$1.braceR)\n case 58: ++this.pos; return this.finishToken(types$1.colon)\n\n case 96: // '`'\n if (this.options.ecmaVersion < 6) { break }\n ++this.pos;\n return this.finishToken(types$1.backQuote)\n\n case 48: // '0'\n var next = this.input.charCodeAt(this.pos + 1);\n if (next === 120 || next === 88) { return this.readRadixNumber(16) } // '0x', '0X' - hex number\n if (this.options.ecmaVersion >= 6) {\n if (next === 111 || next === 79) { return this.readRadixNumber(8) } // '0o', '0O' - octal number\n if (next === 98 || next === 66) { return this.readRadixNumber(2) } // '0b', '0B' - binary number\n }\n\n // Anything else beginning with a digit is an integer, octal\n // number, or float.\n case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: // 1-9\n return this.readNumber(false)\n\n // Quotes produce strings.\n case 34: case 39: // '\"', \"'\"\n return this.readString(code)\n\n // Operators are parsed inline in tiny state machines. '=' (61) is\n // often referred to. `finishOp` simply skips the amount of\n // characters it is given as second argument, and returns a token\n // of the type given by its first argument.\n case 47: // '/'\n return this.readToken_slash()\n\n case 37: case 42: // '%*'\n return this.readToken_mult_modulo_exp(code)\n\n case 124: case 38: // '|&'\n return this.readToken_pipe_amp(code)\n\n case 94: // '^'\n return this.readToken_caret()\n\n case 43: case 45: // '+-'\n return this.readToken_plus_min(code)\n\n case 60: case 62: // '<>'\n return this.readToken_lt_gt(code)\n\n case 61: case 33: // '=!'\n return this.readToken_eq_excl(code)\n\n case 63: // '?'\n return this.readToken_question()\n\n case 126: // '~'\n return this.finishOp(types$1.prefix, 1)\n\n case 35: // '#'\n return this.readToken_numberSign()\n }\n\n this.raise(this.pos, \"Unexpected character '\" + codePointToString(code) + \"'\");\n};\n\npp.finishOp = function(type, size) {\n var str = this.input.slice(this.pos, this.pos + size);\n this.pos += size;\n return this.finishToken(type, str)\n};\n\npp.readRegexp = function() {\n var escaped, inClass, start = this.pos;\n for (;;) {\n if (this.pos >= this.input.length) { this.raise(start, \"Unterminated regular expression\"); }\n var ch = this.input.charAt(this.pos);\n if (lineBreak.test(ch)) { this.raise(start, \"Unterminated regular expression\"); }\n if (!escaped) {\n if (ch === \"[\") { inClass = true; }\n else if (ch === \"]\" && inClass) { inClass = false; }\n else if (ch === \"/\" && !inClass) { break }\n escaped = ch === \"\\\\\";\n } else { escaped = false; }\n ++this.pos;\n }\n var pattern = this.input.slice(start, this.pos);\n ++this.pos;\n var flagsStart = this.pos;\n var flags = this.readWord1();\n if (this.containsEsc) { this.unexpected(flagsStart); }\n\n // Validate pattern\n var state = this.regexpState || (this.regexpState = new RegExpValidationState(this));\n state.reset(start, pattern, flags);\n this.validateRegExpFlags(state);\n this.validateRegExpPattern(state);\n\n // Create Literal#value property value.\n var value = null;\n try {\n value = new RegExp(pattern, flags);\n } catch (e) {\n // ESTree requires null if it failed to instantiate RegExp object.\n // https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral\n }\n\n return this.finishToken(types$1.regexp, {pattern: pattern, flags: flags, value: value})\n};\n\n// Read an integer in the given radix. Return null if zero digits\n// were read, the integer value otherwise. When `len` is given, this\n// will return `null` unless the integer has exactly `len` digits.\n\npp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {\n // `len` is used for character escape sequences. In that case, disallow separators.\n var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined;\n\n // `maybeLegacyOctalNumericLiteral` is true if it doesn't have prefix (0x,0o,0b)\n // and isn't fraction part nor exponent part. In that case, if the first digit\n // is zero then disallow separators.\n var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48;\n\n var start = this.pos, total = 0, lastCode = 0;\n for (var i = 0, e = len == null ? Infinity : len; i < e; ++i, ++this.pos) {\n var code = this.input.charCodeAt(this.pos), val = (void 0);\n\n if (allowSeparators && code === 95) {\n if (isLegacyOctalNumericLiteral) { this.raiseRecoverable(this.pos, \"Numeric separator is not allowed in legacy octal numeric literals\"); }\n if (lastCode === 95) { this.raiseRecoverable(this.pos, \"Numeric separator must be exactly one underscore\"); }\n if (i === 0) { this.raiseRecoverable(this.pos, \"Numeric separator is not allowed at the first of digits\"); }\n lastCode = code;\n continue\n }\n\n if (code >= 97) { val = code - 97 + 10; } // a\n else if (code >= 65) { val = code - 65 + 10; } // A\n else if (code >= 48 && code <= 57) { val = code - 48; } // 0-9\n else { val = Infinity; }\n if (val >= radix) { break }\n lastCode = code;\n total = total * radix + val;\n }\n\n if (allowSeparators && lastCode === 95) { this.raiseRecoverable(this.pos - 1, \"Numeric separator is not allowed at the last of digits\"); }\n if (this.pos === start || len != null && this.pos - start !== len) { return null }\n\n return total\n};\n\nfunction stringToNumber(str, isLegacyOctalNumericLiteral) {\n if (isLegacyOctalNumericLiteral) {\n return parseInt(str, 8)\n }\n\n // `parseFloat(value)` stops parsing at the first numeric separator then returns a wrong value.\n return parseFloat(str.replace(/_/g, \"\"))\n}\n\nfunction stringToBigInt(str) {\n if (typeof BigInt !== \"function\") {\n return null\n }\n\n // `BigInt(value)` throws syntax error if the string contains numeric separators.\n return BigInt(str.replace(/_/g, \"\"))\n}\n\npp.readRadixNumber = function(radix) {\n var start = this.pos;\n this.pos += 2; // 0x\n var val = this.readInt(radix);\n if (val == null) { this.raise(this.start + 2, \"Expected number in radix \" + radix); }\n if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) {\n val = stringToBigInt(this.input.slice(start, this.pos));\n ++this.pos;\n } else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, \"Identifier directly after number\"); }\n return this.finishToken(types$1.num, val)\n};\n\n// Read an integer, octal integer, or floating-point number.\n\npp.readNumber = function(startsWithDot) {\n var start = this.pos;\n if (!startsWithDot && this.readInt(10, undefined, true) === null) { this.raise(start, \"Invalid number\"); }\n var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;\n if (octal && this.strict) { this.raise(start, \"Invalid number\"); }\n var next = this.input.charCodeAt(this.pos);\n if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) {\n var val$1 = stringToBigInt(this.input.slice(start, this.pos));\n ++this.pos;\n if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, \"Identifier directly after number\"); }\n return this.finishToken(types$1.num, val$1)\n }\n if (octal && /[89]/.test(this.input.slice(start, this.pos))) { octal = false; }\n if (next === 46 && !octal) { // '.'\n ++this.pos;\n this.readInt(10);\n next = this.input.charCodeAt(this.pos);\n }\n if ((next === 69 || next === 101) && !octal) { // 'eE'\n next = this.input.charCodeAt(++this.pos);\n if (next === 43 || next === 45) { ++this.pos; } // '+-'\n if (this.readInt(10) === null) { this.raise(start, \"Invalid number\"); }\n }\n if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, \"Identifier directly after number\"); }\n\n var val = stringToNumber(this.input.slice(start, this.pos), octal);\n return this.finishToken(types$1.num, val)\n};\n\n// Read a string value, interpreting backslash-escapes.\n\npp.readCodePoint = function() {\n var ch = this.input.charCodeAt(this.pos), code;\n\n if (ch === 123) { // '{'\n if (this.options.ecmaVersion < 6) { this.unexpected(); }\n var codePos = ++this.pos;\n code = this.readHexChar(this.input.indexOf(\"}\", this.pos) - this.pos);\n ++this.pos;\n if (code > 0x10FFFF) { this.invalidStringToken(codePos, \"Code point out of bounds\"); }\n } else {\n code = this.readHexChar(4);\n }\n return code\n};\n\npp.readString = function(quote) {\n var out = \"\", chunkStart = ++this.pos;\n for (;;) {\n if (this.pos >= this.input.length) { this.raise(this.start, \"Unterminated string constant\"); }\n var ch = this.input.charCodeAt(this.pos);\n if (ch === quote) { break }\n if (ch === 92) { // '\\'\n out += this.input.slice(chunkStart, this.pos);\n out += this.readEscapedChar(false);\n chunkStart = this.pos;\n } else if (ch === 0x2028 || ch === 0x2029) {\n if (this.options.ecmaVersion < 10) { this.raise(this.start, \"Unterminated string constant\"); }\n ++this.pos;\n if (this.options.locations) {\n this.curLine++;\n this.lineStart = this.pos;\n }\n } else {\n if (isNewLine(ch)) { this.raise(this.start, \"Unterminated string constant\"); }\n ++this.pos;\n }\n }\n out += this.input.slice(chunkStart, this.pos++);\n return this.finishToken(types$1.string, out)\n};\n\n// Reads template string tokens.\n\nvar INVALID_TEMPLATE_ESCAPE_ERROR = {};\n\npp.tryReadTemplateToken = function() {\n this.inTemplateElement = true;\n try {\n this.readTmplToken();\n } catch (err) {\n if (err === INVALID_TEMPLATE_ESCAPE_ERROR) {\n this.readInvalidTemplateToken();\n } else {\n throw err\n }\n }\n\n this.inTemplateElement = false;\n};\n\npp.invalidStringToken = function(position, message) {\n if (this.inTemplateElement && this.options.ecmaVersion >= 9) {\n throw INVALID_TEMPLATE_ESCAPE_ERROR\n } else {\n this.raise(position, message);\n }\n};\n\npp.readTmplToken = function() {\n var out = \"\", chunkStart = this.pos;\n for (;;) {\n if (this.pos >= this.input.length) { this.raise(this.start, \"Unterminated template\"); }\n var ch = this.input.charCodeAt(this.pos);\n if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { // '`', '${'\n if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) {\n if (ch === 36) {\n this.pos += 2;\n return this.finishToken(types$1.dollarBraceL)\n } else {\n ++this.pos;\n return this.finishToken(types$1.backQuote)\n }\n }\n out += this.input.slice(chunkStart, this.pos);\n return this.finishToken(types$1.template, out)\n }\n if (ch === 92) { // '\\'\n out += this.input.slice(chunkStart, this.pos);\n out += this.readEscapedChar(true);\n chunkStart = this.pos;\n } else if (isNewLine(ch)) {\n out += this.input.slice(chunkStart, this.pos);\n ++this.pos;\n switch (ch) {\n case 13:\n if (this.input.charCodeAt(this.pos) === 10) { ++this.pos; }\n case 10:\n out += \"\\n\";\n break\n default:\n out += String.fromCharCode(ch);\n break\n }\n if (this.options.locations) {\n ++this.curLine;\n this.lineStart = this.pos;\n }\n chunkStart = this.pos;\n } else {\n ++this.pos;\n }\n }\n};\n\n// Reads a template token to search for the end, without validating any escape sequences\npp.readInvalidTemplateToken = function() {\n for (; this.pos < this.input.length; this.pos++) {\n switch (this.input[this.pos]) {\n case \"\\\\\":\n ++this.pos;\n break\n\n case \"$\":\n if (this.input[this.pos + 1] !== \"{\") { break }\n // fall through\n case \"`\":\n return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos))\n\n case \"\\r\":\n if (this.input[this.pos + 1] === \"\\n\") { ++this.pos; }\n // fall through\n case \"\\n\": case \"\\u2028\": case \"\\u2029\":\n ++this.curLine;\n this.lineStart = this.pos + 1;\n break\n }\n }\n this.raise(this.start, \"Unterminated template\");\n};\n\n// Used to read escaped characters\n\npp.readEscapedChar = function(inTemplate) {\n var ch = this.input.charCodeAt(++this.pos);\n ++this.pos;\n switch (ch) {\n case 110: return \"\\n\" // 'n' -> '\\n'\n case 114: return \"\\r\" // 'r' -> '\\r'\n case 120: return String.fromCharCode(this.readHexChar(2)) // 'x'\n case 117: return codePointToString(this.readCodePoint()) // 'u'\n case 116: return \"\\t\" // 't' -> '\\t'\n case 98: return \"\\b\" // 'b' -> '\\b'\n case 118: return \"\\u000b\" // 'v' -> '\\u000b'\n case 102: return \"\\f\" // 'f' -> '\\f'\n case 13: if (this.input.charCodeAt(this.pos) === 10) { ++this.pos; } // '\\r\\n'\n case 10: // ' \\n'\n if (this.options.locations) { this.lineStart = this.pos; ++this.curLine; }\n return \"\"\n case 56:\n case 57:\n if (this.strict) {\n this.invalidStringToken(\n this.pos - 1,\n \"Invalid escape sequence\"\n );\n }\n if (inTemplate) {\n var codePos = this.pos - 1;\n\n this.invalidStringToken(\n codePos,\n \"Invalid escape sequence in template string\"\n );\n }\n default:\n if (ch >= 48 && ch <= 55) {\n var octalStr = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0];\n var octal = parseInt(octalStr, 8);\n if (octal > 255) {\n octalStr = octalStr.slice(0, -1);\n octal = parseInt(octalStr, 8);\n }\n this.pos += octalStr.length - 1;\n ch = this.input.charCodeAt(this.pos);\n if ((octalStr !== \"0\" || ch === 56 || ch === 57) && (this.strict || inTemplate)) {\n this.invalidStringToken(\n this.pos - 1 - octalStr.length,\n inTemplate\n ? \"Octal literal in template string\"\n : \"Octal literal in strict mode\"\n );\n }\n return String.fromCharCode(octal)\n }\n if (isNewLine(ch)) {\n // Unicode new line characters after \\ get removed from output in both\n // template literals and strings\n if (this.options.locations) { this.lineStart = this.pos; ++this.curLine; }\n return \"\"\n }\n return String.fromCharCode(ch)\n }\n};\n\n// Used to read character escape sequences ('\\x', '\\u', '\\U').\n\npp.readHexChar = function(len) {\n var codePos = this.pos;\n var n = this.readInt(16, len);\n if (n === null) { this.invalidStringToken(codePos, \"Bad character escape sequence\"); }\n return n\n};\n\n// Read an identifier, and return it as a string. Sets `this.containsEsc`\n// to whether the word contained a '\\u' escape.\n//\n// Incrementally adds only escaped chars, adding other chunks as-is\n// as a micro-optimization.\n\npp.readWord1 = function() {\n this.containsEsc = false;\n var word = \"\", first = true, chunkStart = this.pos;\n var astral = this.options.ecmaVersion >= 6;\n while (this.pos < this.input.length) {\n var ch = this.fullCharCodeAtPos();\n if (isIdentifierChar(ch, astral)) {\n this.pos += ch <= 0xffff ? 1 : 2;\n } else if (ch === 92) { // \"\\\"\n this.containsEsc = true;\n word += this.input.slice(chunkStart, this.pos);\n var escStart = this.pos;\n if (this.input.charCodeAt(++this.pos) !== 117) // \"u\"\n { this.invalidStringToken(this.pos, \"Expecting Unicode escape sequence \\\\uXXXX\"); }\n ++this.pos;\n var esc = this.readCodePoint();\n if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral))\n { this.invalidStringToken(escStart, \"Invalid Unicode escape\"); }\n word += codePointToString(esc);\n chunkStart = this.pos;\n } else {\n break\n }\n first = false;\n }\n return word + this.input.slice(chunkStart, this.pos)\n};\n\n// Read an identifier or keyword token. Will check for reserved\n// words when necessary.\n\npp.readWord = function() {\n var word = this.readWord1();\n var type = types$1.name;\n if (this.keywords.test(word)) {\n type = keywords[word];\n }\n return this.finishToken(type, word)\n};\n\n// Acorn is a tiny, fast JavaScript parser written in JavaScript.\n//\n// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and\n// various contributors and released under an MIT license.\n//\n// Git repositories for Acorn are available at\n//\n// http://marijnhaverbeke.nl/git/acorn\n// https://github.com/acornjs/acorn.git\n//\n// Please use the [github bug tracker][ghbt] to report issues.\n//\n// [ghbt]: https://github.com/acornjs/acorn/issues\n\n\nvar version = \"8.15.0\";\n\nParser.acorn = {\n Parser: Parser,\n version: version,\n defaultOptions: defaultOptions,\n Position: Position,\n SourceLocation: SourceLocation,\n getLineInfo: getLineInfo,\n Node: Node,\n TokenType: TokenType,\n tokTypes: types$1,\n keywordTypes: keywords,\n TokContext: TokContext,\n tokContexts: types,\n isIdentifierChar: isIdentifierChar,\n isIdentifierStart: isIdentifierStart,\n Token: Token,\n isNewLine: isNewLine,\n lineBreak: lineBreak,\n lineBreakG: lineBreakG,\n nonASCIIwhitespace: nonASCIIwhitespace\n};\n\n// The main exported interface (under `self.acorn` when in the\n// browser) is a `parse` function that takes a code string and returns\n// an abstract syntax tree as specified by the [ESTree spec][estree].\n//\n// [estree]: https://github.com/estree/estree\n\nfunction parse(input, options) {\n return Parser.parse(input, options)\n}\n\n// This function tries to parse a single expression at a given\n// offset in a string. Useful for parsing mixed-language formats\n// that embed JavaScript expressions.\n\nfunction parseExpressionAt(input, pos, options) {\n return Parser.parseExpressionAt(input, pos, options)\n}\n\n// Acorn is organized as a tokenizer and a recursive-descent parser.\n// The `tokenizer` export provides an interface to the tokenizer.\n\nfunction tokenizer(input, options) {\n return Parser.tokenizer(input, options)\n}\n\nexport { Node, Parser, Position, SourceLocation, TokContext, Token, TokenType, defaultOptions, getLineInfo, isIdentifierChar, isIdentifierStart, isNewLine, keywords as keywordTypes, lineBreak, lineBreakG, nonASCIIwhitespace, parse, parseExpressionAt, types as tokContexts, types$1 as tokTypes, tokenizer, version };\n","/**\n * Sanitize an ID for use as an AssemblyScript identifier.\n * Replaces hyphens and other special characters with underscores.\n *\n * @param id - The ID to sanitize\n * @returns A valid AssemblyScript identifier\n */\nexport function sanitizeId(id: string): string {\n // Replace hyphens and other non-alphanumeric characters (except underscores) with underscores\n return id.replace(/[^a-zA-Z0-9_]/g, '_');\n}\n\n/**\n * Convert a node name to a camelCase key.\n * Used for wrapping decision table outputs with the node name.\n * Example: \"RiskFactors\" -> \"riskFactors\", \"DiscountRules\" -> \"discountRules\"\n *\n * @param name - The node name to convert\n * @returns A camelCase key\n */\nexport function nodeNameToKey(name: string): string {\n if (!name || name.length === 0) {\n return name;\n }\n // Lowercase the first character\n return name.charAt(0).toLowerCase() + name.slice(1);\n}\n","import type { CompilationContext } from '../types';\nimport { CompilationError, ErrorCode, type SourceLocation } from '../errors';\nimport { parse as parseAcorn } from 'acorn';\nimport { sanitizeId } from '../utils';\n\n/**\n * Function node content interface\n */\nexport interface FunctionNodeContent {\n /** The JavaScript source code for the function */\n source: string;\n /** Parsed AST of the function body */\n ast?: any;\n /** Extracted function parameters */\n parameters: string[];\n}\n\n/**\n * Extract the source code from a function node content field.\n *\n * Handles both legacy format (plain string) and v2 format (object with source property).\n * TODO: Verify if legacy format still exists in fixtures, update comment accordingly\n *\n * @param content - The content field from a function node\n * @param location - Optional source location for error reporting\n * @returns The JavaScript source code string\n */\nexport function extractFunctionSource(content: any, location?: SourceLocation): string {\n if (content === null || content === undefined) {\n throw new CompilationError(\n 'Function node content is missing',\n ErrorCode.INVALID_NODE_STRUCTURE,\n location,\n );\n }\n\n if (typeof content === 'object' && content.source !== undefined) {\n if (typeof content.source !== 'string') {\n throw new CompilationError(\n 'Function node content.source must be a string',\n ErrorCode.INVALID_NODE_STRUCTURE,\n { ...location, field: 'content.source' },\n );\n }\n return content.source;\n }\n\n if (typeof content === 'string') {\n return content;\n }\n\n throw new CompilationError(\n 'Function node content must be either a string or an object with a source property',\n ErrorCode.INVALID_NODE_STRUCTURE,\n { ...location, field: 'content' },\n );\n}\n\n/**\n * Parse JavaScript function code to extract parameters and body.\n *\n * @param source - The JavaScript source code string\n * @param location - Optional source location for error reporting\n * @returns A FunctionNodeContent with extracted information\n */\nexport function parseFunctionCode(source: string, location?: SourceLocation): FunctionNodeContent {\n const content: FunctionNodeContent = {\n source,\n parameters: [],\n };\n\n try {\n // Parse the source code using Acorn.\n const ast = parseAcorn(source, {\n ecmaVersion: 'latest',\n sourceType: 'module',\n allowAwaitOutsideFunction: true,\n });\n\n content.ast = ast;\n\n const functionNode = findExportedFunction(ast);\n\n if (functionNode) {\n content.parameters = extractParameters(functionNode);\n }\n } catch (error) {\n // Parse errors in function code should fail compilation immediately with clear error\n // messages, rather than deferring to runtime where the error context would be lost.\n if (error instanceof Error) {\n throw new CompilationError(\n `Failed to parse function code: ${error.message}`,\n ErrorCode.PARSE_ERROR,\n { ...location, field: 'content.source' },\n );\n }\n throw error;\n }\n\n return content;\n}\n\n/**\n * Validate a function node's content structure.\n *\n * @param node - The JDM function node to validate\n * @returns Extracted and validated function node content\n */\nexport function validateFunctionNode(node: {\n id: string;\n name: string;\n content?: any;\n}): FunctionNodeContent {\n const location: SourceLocation = { nodeId: node.id, nodeName: node.name };\n\n if (!node.content) {\n throw new CompilationError(\n `Function node \"${node.name}\" (${node.id}) is missing required content field`,\n ErrorCode.INVALID_NODE_STRUCTURE,\n { ...location, field: 'content' },\n );\n }\n\n const source = extractFunctionSource(node.content, location);\n\n const parsedContent = parseFunctionCode(source, location);\n\n return {\n ...parsedContent,\n source,\n };\n}\n\n/**\n * Find an exported function in the AST.\n *\n * Looks for patterns like:\n * - `export const handler = (input) => { ... }`\n * - `export function handler(input) { ... }`\n *\n * @param ast - The parsed AST\n * @returns The function declaration or expression, or null if not found\n */\nfunction findExportedFunction(ast: any): any {\n if (!ast.body) {\n return null;\n }\n\n for (const node of ast.body) {\n // Pattern: export function name(...) { ... }\n if (node.type === 'ExportNamedDeclaration' && node.declaration) {\n if (node.declaration.type === 'FunctionDeclaration') {\n return node.declaration;\n }\n }\n\n // Pattern: export const/let/var name = (input) => { ... }\n if (node.type === 'ExportNamedDeclaration' && node.declaration) {\n if (node.declaration.type === 'VariableDeclaration') {\n const declarator = node.declaration.declarations[0];\n if (declarator && declarator.init) {\n // Arrow function: (input) => { ... }\n if (declarator.init.type === 'ArrowFunctionExpression') {\n return declarator.init;\n }\n // Regular function: function(input) { ... }\n if (declarator.init.type === 'FunctionExpression') {\n return declarator.init;\n }\n }\n }\n }\n\n // Pattern: export default ...) => { ... }\n if (node.type === 'ExportDefaultDeclaration') {\n if (node.declaration.type === 'FunctionDeclaration') {\n return node.declaration;\n }\n if (node.declaration.type === 'ArrowFunctionExpression') {\n return node.declaration;\n }\n if (node.declaration.type === 'FunctionExpression') {\n return node.declaration;\n }\n }\n }\n\n return null;\n}\n\n/**\n * Extract parameter names from a function AST node.\n *\n * @param functionNode - The function AST node\n * @returns Array of parameter names\n */\nfunction extractParameters(functionNode: any): string[] {\n if (!functionNode.params || !Array.isArray(functionNode.params)) {\n return [];\n }\n\n return functionNode.params\n .map((param: any) => {\n // Simple identifier: input\n if (param.type === 'Identifier') {\n return param.name;\n }\n\n // Destructuring: { input, context } or [input, context]\n if (param.type === 'ObjectPattern') {\n return param.properties\n .map((prop: any) => prop.key?.name || prop.value?.name)\n .filter(Boolean);\n }\n\n if (param.type === 'ArrayPattern') {\n return param.elements.map((elem: any) => elem?.name).filter(Boolean);\n }\n\n return null;\n })\n .flat()\n .filter(Boolean) as string[];\n}\n\n/**\n * Compile a function node to AssemblyScript code.\n *\n * This function generates AssemblyScript code that:\n * 1. Reads input parameters from the context\n * 2. Calls the JavaScript bridge function to execute the user's function\n * 3. Converts the return value to the Value type\n *\n * @param node - The JDM function node\n * @param context - The compilation context\n * @returns Generated AssemblyScript code for evaluating the function node\n */\nexport function compileFunctionNode(\n node: {\n id: string;\n name: string;\n content?: any;\n parsedContent?: FunctionNodeContent;\n },\n context: CompilationContext,\n): string {\n const sanitizedId = sanitizeId(node.id);\n\n if (!node.parsedContent) {\n throw new CompilationError(\n `Function node \"${node.name}\" (${node.id}) has not been parsed`,\n ErrorCode.INVALID_NODE_STRUCTURE,\n { nodeId: node.id, nodeName: node.name, field: 'parsedContent' },\n );\n }\n\n const { source, parameters } = node.parsedContent;\n\n // Store the function source in the compilation context for later retrieval.\n // Function sources must be kept separate from runtime context data to avoid naming conflicts\n // and ensure proper scoping. The prefix prevents collisions with user-defined fields.\n if (!context.functionSources) {\n context.functionSources = new Map();\n }\n context.functionSources.set(sanitizedId, source);\n\n // Generate parameter reading and marshaling code\n // Parameters need to be collected into an array for the bridge call\n const paramReads =\n parameters.length > 0\n ? parameters\n .map((param) => {\n return ` let ${param} = ctx.get(\"${param}\");`;\n })\n .join('\\n')\n : '';\n\n const paramArray =\n parameters.length > 0\n ? `\n // Create parameter array for JavaScript bridge\n let params = new Array<Value>(0);\n${parameters.map((param) => ` params.push(${param});`).join('\\n')}\n`\n : `\n // No parameters\n let params = new Array<Value>(0);\n`;\n\n // Generate the main evaluateNode function\n // TODO: Mock execution returns a placeholder result for testing purposes.\n // This allows the compiler to generate valid code and tests to run while the JavaScript\n // function execution bridge is not yet implemented. This will be replaced with actual\n // JavaScript bridge functionality in a future phase\n return `\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n // Function node: ${node.name}\n // This node would execute JavaScript code and return the result\n // For now, we return a mock result to allow compilation and testing\n\n${paramReads}\n${paramArray}\n // Mock result: return an object indicating function execution\n // This is a placeholder - actual JavaScript execution will be implemented\n // via a JavaScript bridge in the runtime\n let mockResult = new Map<string, Value>();\n mockResult.set(\"_isFunctionNode\", Value.Bool(true));\n mockResult.set(\"_nodeName\", Value.String(\"${node.name}\"));\n${parameters.length > 0 ? parameters.map((param) => ` mockResult.set(\"_${param}\", ${param});`).join('\\n') : ''}\n mockResult.set(\"_output\", Value.String(\"Function execution not yet implemented\"));\n \n let result = Value.Object(mockResult);\n\n return result;\n}`;\n}\n","import { CompilationError, ErrorCode } from './errors';\nimport { validateFunctionNode } from './nodes/function';\n\nexport enum NodeType {\n INPUT = 'inputNode',\n OUTPUT = 'outputNode',\n DECISION_TABLE = 'decisionTableNode',\n SWITCH = 'switchNode',\n EXPRESSION = 'expressionNode',\n DECISION = 'decisionNode',\n FUNCTION = 'functionNode',\n}\n\nexport interface JDMNode {\n id: string;\n type: NodeType;\n name: string;\n position: { x: number; y: number };\n content?: any;\n parsedContent?: any;\n}\n\nexport interface JDMEdge {\n id: string;\n type: string;\n sourceId: string;\n targetId: string;\n /** Optional source handle for nodes with multiple outputs (e.g., switch statements) */\n sourceHandle?: string;\n}\n\nexport interface JDMDecision {\n nodes: JDMNode[];\n edges: JDMEdge[];\n metadata?: any;\n}\n\n/**\n * Validate that a node has all required fields.\n *\n * All JDM nodes must have: id, name, and type.\n * Validating early provides clear error messages before processing.\n *\n * @param node - The node to validate\n * @param index - The index of the node in the nodes array (for error reporting)\n * @throws CompilationError if required fields are missing\n */\nexport function validateNodeStructure(node: any, index: number): void {\n const missingFields: string[] = [];\n\n if (typeof node.id !== 'string' || node.id.trim() === '') {\n missingFields.push('id');\n }\n\n if (typeof node.name !== 'string') {\n missingFields.push('name');\n }\n\n if (typeof node.type !== 'string' || node.type.trim() === '') {\n missingFields.push('type');\n }\n\n if (missingFields.length > 0) {\n const nodeIdentifier = node.id || node.name || `at index ${index}`;\n throw new CompilationError(\n `Node \"${nodeIdentifier}\" is missing required field(s): ${missingFields.join(', ')}`,\n ErrorCode.INVALID_NODE_STRUCTURE,\n { nodeId: node.id, nodeName: node.name },\n );\n }\n}\n\n/**\n * Parse and validate JDM JSON.\n * Function nodes have complex internal structure that needs schema validation and transformation.\n * Validating early provides better error messages and catches issues before expensive compilation steps.\n */\nexport function parseJDM(jdm: string | JDMDecision | any): JDMDecision {\n const parsed: JDMDecision = typeof jdm === 'string' ? JSON.parse(jdm) : jdm;\n\n // Validate basic structure before processing\n if (!parsed.nodes || !Array.isArray(parsed.nodes)) {\n throw new CompilationError(\n \"Invalid JDM: missing or invalid 'nodes' array\",\n ErrorCode.INVALID_JSON,\n { field: 'nodes' },\n );\n }\n\n // Validate each node has required fields before any processing\n parsed.nodes.forEach((node: any, index: number) => {\n validateNodeStructure(node, index);\n });\n\n // Function nodes have rich content structure (parameters, return type, expressions) requiring special\n // parsing. Other node types have simpler content handled during codegen.\n parsed.nodes.forEach((node: any) => {\n if (node.type === NodeType.FUNCTION) {\n try {\n node.parsedContent = validateFunctionNode(node);\n } catch (error) {\n if (error instanceof CompilationError) {\n throw error;\n }\n throw new CompilationError(\n `Failed to parse function node \"${node.name}\": ${error instanceof Error ? error.message : String(error)}`,\n ErrorCode.INVALID_NODE_STRUCTURE,\n { nodeId: node.id, nodeName: node.name },\n );\n }\n }\n });\n\n return parsed;\n}\n","import { DirectedGraph } from 'graphology';\nimport { topologicalSort } from 'graphology-dag';\nimport { type JDMNode, type JDMEdge, type JDMDecision, NodeType } from './parser';\nimport { CompilationError, ErrorCode, type SourceLocation } from './errors';\n\nexport type JDMGraph = DirectedGraph<JDMNode, JDMEdge>;\n\nexport function buildGraph(jdm: JDMDecision): JDMGraph {\n const graph = new DirectedGraph<JDMNode, JDMEdge>();\n\n // Map provides O(1) lookups for edge validation and node existence checks\n const nodeMap = new Map<string, JDMNode>();\n for (const node of jdm.nodes) {\n graph.addNode(node.id, node);\n nodeMap.set(node.id, node);\n }\n\n // Switch nodes can have multiple edges to same target (different cases/handles pointing to\n // same node), but topological sort only needs one edge per source→target pair to establish\n // ordering dependencies.\n const addedEdges = new Set<string>();\n\n // Add edges and check for self-references\n for (const edge of jdm.edges) {\n if (!nodeMap.has(edge.sourceId) || !nodeMap.has(edge.targetId)) {\n const sourceNode = nodeMap.get(edge.sourceId);\n const targetNode = nodeMap.get(edge.targetId);\n throw new CompilationError(\n `Invalid edge \"${edge.id}\": references non-existent node`,\n ErrorCode.INVALID_EDGE,\n {\n nodeId: edge.sourceId,\n nodeName: sourceNode?.name ?? targetNode?.name,\n field: !nodeMap.has(edge.sourceId) ? 'sourceId' : 'targetId',\n },\n );\n }\n\n // Check for self-references (edge where source equals target)\n if (edge.sourceId === edge.targetId) {\n const node = graph.getNodeAttributes(edge.sourceId);\n const location: SourceLocation = { nodeId: edge.sourceId, nodeName: node.name };\n throw new CompilationError(\n `Self-reference detected: node \"${node.name || edge.sourceId}\" references itself through edge \"${edge.id}\"`,\n ErrorCode.CYCLE_DETECTED,\n location,\n );\n }\n\n // For topological ordering, we only need one edge between any two nodes.\n // Switch nodes may have multiple edges to the same target (via different handles).\n // We track the edge pair to avoid duplicates while preserving all edges in jdm.edges\n // for the switch node compilation to use.\n const edgePairKey = `${edge.sourceId}->${edge.targetId}`;\n if (!addedEdges.has(edgePairKey)) {\n graph.addEdgeWithKey(edge.id, edge.sourceId, edge.targetId, edge);\n addedEdges.add(edgePairKey);\n }\n }\n\n return graph;\n}\n\n/**\n * Find a cycle path in the graph using DFS. Graphology's cycle detection only returns a boolean,\n * but we need the actual cycle path to provide better error messages showing the problematic node\n * sequence to users.\n *\n * @param graph - The graph to search\n * @returns Array of node IDs representing the cycle, or null if no cycle\n */\nfunction findCyclePath(graph: JDMGraph): string[] | null {\n const visited = new Set<string>();\n const recursionStack = new Set<string>();\n const parentMap = new Map<string, string | null>();\n\n function dfs(nodeId: string, path: string[]): string[] | null {\n visited.add(nodeId);\n recursionStack.add(nodeId);\n path.push(nodeId);\n\n const neighbors = graph.outNeighbors(nodeId);\n for (const neighborId of neighbors) {\n if (!visited.has(neighborId)) {\n parentMap.set(neighborId, nodeId);\n const cycle = dfs(neighborId, path);\n if (cycle) {\n return cycle;\n }\n } else if (recursionStack.has(neighborId)) {\n // Found a back edge - reconstruct the cycle path\n // Path contains full traversal, but cycle only starts where we revisit a node.\n // Slicing gives just the cycle portion (e.g., A→B→C→B extracts B→C→B).\n const startIndex = path.indexOf(neighborId);\n const cycle = [...path.slice(startIndex), neighborId];\n return cycle;\n }\n }\n\n recursionStack.delete(nodeId);\n path.pop();\n return null;\n }\n\n // Start DFS from each unvisited node\n for (const nodeId of graph.nodes()) {\n if (!visited.has(nodeId)) {\n const cycle = dfs(nodeId, []);\n if (cycle) {\n return cycle;\n }\n }\n }\n\n return null;\n}\n\n/**\n * Format a cycle path as a readable string.\n *\n * @param cycle - Array of node IDs representing a cycle\n * @param graph - The graph to get node names from\n * @returns Formatted string like \"Node1 -> Node2 -> Node3 -> Node1\"\n */\nfunction formatCyclePath(cycle: string[], graph: JDMGraph): string {\n return cycle\n .map((nodeId) => {\n const node = graph.getNodeAttributes(nodeId);\n return node.name || nodeId;\n })\n .join(' -> ');\n}\n\nexport function validateGraph(graph: JDMGraph): void {\n // Check for cycles using DFS to find the actual cycle path\n const cyclePath = findCyclePath(graph);\n if (cyclePath) {\n const formattedPath = formatCyclePath(cyclePath, graph);\n throw new CompilationError(\n `Circular dependency detected: ${formattedPath}`,\n ErrorCode.CYCLE_DETECTED,\n { nodeId: cyclePath[0], nodeName: graph.getNodeAttributes(cyclePath[0]).name },\n );\n }\n\n // Check for single input node\n const inputNodes: string[] = [];\n const outputNodes: string[] = [];\n\n graph.forEachNode((nodeId, attrs) => {\n if (attrs.type === NodeType.INPUT) {\n inputNodes.push(nodeId);\n }\n if (attrs.type === NodeType.OUTPUT) {\n outputNodes.push(nodeId);\n }\n });\n\n if (inputNodes.length !== 1) {\n // If there are multiple input nodes, include the first one in the location\n const firstInputNode = inputNodes.length > 0 ? graph.getNodeAttributes(inputNodes[0]) : null;\n throw new CompilationError(\n `Expected exactly 1 input node, found ${inputNodes.length}`,\n ErrorCode.MULTIPLE_INPUT_NODES,\n firstInputNode ? { nodeId: firstInputNode.id, nodeName: firstInputNode.name } : undefined,\n );\n }\n if (outputNodes.length === 0) {\n throw new CompilationError(\n 'Expected at least 1 output node, found 0',\n ErrorCode.MISSING_OUTPUT_NODE,\n { field: 'outputNode' },\n );\n }\n}\n\n/**\n * Get nodes in topological order for evaluation.\n * This ensures dependencies are evaluated before dependents.\n */\nexport function getEvaluationOrder(graph: JDMGraph): string[] {\n return topologicalSort(graph);\n}\n\n/**\n * Get all nodes that feed into a given node.\n */\nexport function getInputNodes(graph: JDMGraph, nodeId: string): JDMNode[] {\n return graph.inNeighbors(nodeId).map((id) => graph.getNodeAttributes(id));\n}\n\n/**\n * Get all nodes that a given node feeds into.\n */\nexport function getOutputNodes(graph: JDMGraph, nodeId: string): JDMNode[] {\n return graph.outNeighbors(nodeId).map((id) => graph.getNodeAttributes(id));\n}\n","import type { JDMNode } from '../parser';\nimport type { CompilationContext, AssemblyScriptCode } from '../types';\nimport { sanitizeId } from '../utils';\n\n/**\n * Compile an input node.\n *\n * Input nodes serve as entry points for the decision model and simply\n * pass through the context data.\n *\n * @param node - The JDM input node\n * @param context - The compilation context\n * @returns Generated AssemblyScript code\n */\nexport function compileInputNode(node: JDMNode, _context: CompilationContext): AssemblyScriptCode {\n const sanitizedId = sanitizeId(node.id);\n return `\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n // Input nodes are markers - they trigger evaluation but don't produce output.\n // Null is used as a semantic marker meaning \"input processed, no output to add\".\n // This distinguishes from actual output values while avoiding undefined/error states.\n return Value.Null();\n}\n`;\n}\n\n/**\n * Compile an output node.\n *\n * Output nodes mark the end of the decision model and return the final result.\n * They return the accumulated context data from passThrough nodes.\n *\n * @param node - The JDM output node\n * @param context - The compilation context\n * @returns Generated AssemblyScript code\n */\nexport function compileOutputNode(node: JDMNode, _context: CompilationContext): AssemblyScriptCode {\n const sanitizedId = sanitizeId(node.id);\n return `\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n // Output nodes return the accumulated context data (passThrough values)\n // Build result from all non-internal context entries\n let __finalResult = new Map<string, Value>();\n const __ctxKeys = ctx.data.keys();\n for (let __i = 0; __i < __ctxKeys.length; __i++) {\n const __key = __ctxKeys[__i];\n // $-prefixed keys are internal namespaces ($nodes, $)\n // # is iteration variable\n // acc is reduce accumulator\n // None should appear in final output - only actual output fields.\n if (!__key.startsWith(\"$\") && __key !== \"#\" && __key !== \"acc\") {\n // AssemblyScript has no Map.filter(), so we must iterate and conditionally add keys.\n // This is more verbose but necessary given AS limitations.\n __finalResult.set(__key, ctx.data.get(__key));\n }\n }\n return Value.Object(__finalResult);\n}\n`;\n}\n","// ============================================================================\n// Context Resolver Strategy Pattern\n// ============================================================================\n//\n// The ContextResolver interface provides a strategy for resolving identifiers\n// and dollar references in different compilation contexts. This replaces three\n// separate compilation functions with a single unified function plus small\n// strategy implementations.\n//\n// Three modes:\n// 1. Standard: $ -> ctx.get(\"$\"), identifiers -> ctx.get(\"name\")\n// 2. LocalDollar: $ -> Value.Object(dollarVar), identifiers -> ctx.get(\"name\")\n// 3. Scoped: $ -> Value.Object(resultVar), identifiers -> scopedCtx.get(\"name\")\n\n/**\n * Strategy interface for resolving context references during expression compilation.\n *\n * Different compilation contexts require different resolutions:\n * - In standard expressions, $ refers to the global context\n * - In expression nodes, $ refers to the local result object being built\n * - In scoped expressions (inputField), identifiers resolve from a scoped context\n */\nexport interface ContextResolver {\n /** Resolve an identifier reference (e.g., \"firstName\") */\n resolveIdentifier(name: string): string;\n\n /** Resolve a $ reference */\n resolveDollarRef(): string;\n\n /** Resolve a # reference (current element in higher-order functions) */\n resolveHashRef(): string;\n\n /** Resolve a member access path rooted at $ (e.g., \"$.foo.bar\" returns \"foo.bar\") */\n resolveDollarPath(path: string): string;\n\n /** Resolve a $nodes.X.Y path */\n resolveNodesPath(path: string): string;\n\n /** Get the context variable name for use in helper functions */\n getContextVar(): string;\n\n /** Create a child resolver for use inside helper functions (e.g., object literals) */\n createChildResolver(): ContextResolver;\n\n /** Get extra parameters for generated helper function signatures */\n getHelperParams(): string;\n\n /** Get extra arguments for calls to generated helper functions */\n getHelperArgs(): string;\n}\n\n/**\n * Standard context resolver: $ and identifiers resolve from the global context.\n * Used in switch conditions, decision tables, and other standard expressions.\n */\nexport class StandardContextResolver implements ContextResolver {\n resolveIdentifier(name: string): string {\n return `ctx.get(\"${name}\")`;\n }\n\n resolveDollarRef(): string {\n return `ctx.get(\"$\")`;\n }\n\n resolveHashRef(): string {\n return `ctx.get(\"#\")`;\n }\n\n resolveDollarPath(path: string): string {\n // In standard mode, $.foo.bar -> getProperty(ctx.get(\"$\"), \"foo\", \"bar\")\n // Actually use nested getProperty calls for each segment\n const segments = path.split('.');\n let result = `ctx.get(\"$\")`;\n for (const segment of segments) {\n result = `getProperty(${result}, \"${segment}\")`;\n }\n return result;\n }\n\n resolveNodesPath(path: string): string {\n return `ctx.get(\"${path}\")`;\n }\n\n getContextVar(): string {\n return 'ctx';\n }\n\n createChildResolver(): ContextResolver {\n // Child is same as parent in standard mode\n return this;\n }\n\n getHelperParams(): string {\n return '';\n }\n\n getHelperArgs(): string {\n return '';\n }\n}\n\n/**\n * Local dollar resolver: $ refers to a local Map variable (e.g., \"result\").\n * Used in expression nodes where $ references the output being built.\n */\nexport class LocalDollarContextResolver implements ContextResolver {\n constructor(private dollarVar: string = 'result') {}\n\n resolveIdentifier(name: string): string {\n return `ctx.get(\"${name}\")`;\n }\n\n resolveDollarRef(): string {\n return `Value.Object(${this.dollarVar})`;\n }\n\n resolveHashRef(): string {\n return `ctx.get(\"#\")`;\n }\n\n resolveDollarPath(path: string): string {\n // $.foo.bar looks up \"foo.bar\" as a flat key in the local result map\n // Expression nodes store keys like \"eligibility.specialOffers\" as flat strings\n return `(${this.dollarVar}.has(\"${path}\") ? ${this.dollarVar}.get(\"${path}\") : Value.Null())`;\n }\n\n resolveNodesPath(path: string): string {\n return `ctx.get(\"${path}\")`;\n }\n\n getContextVar(): string {\n return 'ctx';\n }\n\n createChildResolver(): ContextResolver {\n // Child resolver references 'parentResult' to maintain access to outer scope\n // Example: {a: 5, nested: {b: $.a}} - nested object's $.a refers to outer result\n return new LocalDollarContextResolver('parentResult');\n }\n\n getHelperParams(): string {\n return ', parentResult: Map<string, Value>';\n }\n\n getHelperArgs(): string {\n return `, ${this.dollarVar}`;\n }\n}\n\n/**\n * Scoped context resolver: identifiers resolve from a scoped context variable.\n * Used for inputField scoping and loop mode where a subset of the context is available.\n */\nexport class ScopedContextResolver implements ContextResolver {\n constructor(\n private ctxVar: string = 'scopedCtx',\n private resultVar: string = 'itemResult',\n ) {}\n\n resolveIdentifier(name: string): string {\n return `${this.ctxVar}.get(\"${name}\")`;\n }\n\n resolveDollarRef(): string {\n return `Value.Object(${this.resultVar})`;\n }\n\n resolveHashRef(): string {\n return `${this.ctxVar}.get(\"#\")`;\n }\n\n resolveDollarPath(path: string): string {\n // $.foo looks up \"foo\" in the local result variable\n return `(${this.resultVar}.has(\"${path}\") ? ${this.resultVar}.get(\"${path}\") : Value.Null())`;\n }\n\n resolveNodesPath(path: string): string {\n return `${this.ctxVar}.get(\"${path}\")`;\n }\n\n getContextVar(): string {\n return this.ctxVar;\n }\n\n createChildResolver(): ContextResolver {\n // In scoped context, child keeps the same context var and result var\n return this;\n }\n\n getHelperParams(): string {\n return `, ${this.ctxVar}: Context, ${this.resultVar}: Map<string, Value>`;\n }\n\n getHelperArgs(): string {\n return `, ${this.ctxVar}, ${this.resultVar}`;\n }\n}\n","// ============================================================================\n// Expression AST Compiler\n// ============================================================================\n//\n// This module provides the core expression compilation functionality for\n// transforming expression ASTs into AssemblyScript code. It uses the\n// ContextResolver strategy pattern to handle different compilation contexts.\n\nimport type {\n ExpressionAST,\n BinaryOp,\n UnaryOp,\n NumberLiteral,\n StringLiteral,\n BooleanLiteral,\n Identifier,\n TernaryOp,\n MemberAccess,\n IndexAccess,\n FunctionCall,\n Interval,\n TemplateLiteral,\n ArrayLiteral,\n ObjectLiteral,\n} from '../ast-types';\nimport type { CompilationContext } from '../types';\nimport type { ContextResolver } from './context-resolvers';\nimport { StandardContextResolver } from './context-resolvers';\n\n// ============================================================================\n// Unified Expression Compiler\n// ============================================================================\n\n/**\n * Compile an expression AST using the provided context resolver strategy.\n *\n * This is the single unified implementation that handles all expression compilation.\n * The resolver parameter determines how identifiers, $, and # are resolved.\n *\n * @param ast - The AST node to compile\n * @param context - The compilation context\n * @param resolver - The context resolution strategy\n * @returns AssemblyScript code string that produces a Value\n */\nexport function compileExpressionUnified(\n ast: ExpressionAST,\n context: CompilationContext,\n resolver: ContextResolver,\n): string {\n switch (ast.type) {\n case 'NumberLiteral':\n return `Value.Float(${(ast as NumberLiteral).value})`;\n\n case 'StringLiteral':\n return `Value.String(\"${escapeString((ast as StringLiteral).value)}\")`;\n\n case 'BooleanLiteral':\n return `Value.Bool(${(ast as BooleanLiteral).value})`;\n\n case 'NullLiteral':\n return `Value.Null()`;\n\n case 'Identifier':\n return resolver.resolveIdentifier((ast as Identifier).name);\n\n case 'DollarRef':\n return resolver.resolveDollarRef();\n\n case 'HashRef':\n return resolver.resolveHashRef();\n\n case 'BinaryOp': {\n const bop = ast as BinaryOp;\n const left = compileExpressionUnified(bop.left, context, resolver);\n const right = compileExpressionUnified(bop.right, context, resolver);\n return compileBinaryOpWithValues(bop.op, left, right);\n }\n\n case 'UnaryOp': {\n const uop = ast as UnaryOp;\n const operand = compileExpressionUnified(uop.operand, context, resolver);\n switch (uop.op) {\n case 'not':\n return `Value.Bool(!(${operand}).asBool())`;\n case '-':\n return `negateValue(${operand})`;\n default:\n throw new Error(`Unknown unary operator: ${uop.op}`);\n }\n }\n\n case 'TernaryOp': {\n const top = ast as TernaryOp;\n const cond = compileExpressionUnified(top.condition, context, resolver);\n const cons = compileExpressionUnified(top.consequent, context, resolver);\n const alt = compileExpressionUnified(top.alternate, context, resolver);\n return `(${cond}.asBool() ? ${cons} : ${alt})`;\n }\n\n case 'MemberAccess': {\n const ma = ast as MemberAccess;\n // Handle $.property.subproperty - look up in appropriate context\n const dollarPath = buildDollarPath(ma);\n if (dollarPath) {\n return resolver.resolveDollarPath(dollarPath);\n }\n // Check if this is a $nodes reference\n if (checkIsNodesReference(ma)) {\n const nodesPath = buildNodesPath(ma);\n return resolver.resolveNodesPath(nodesPath);\n }\n // For other member access, use getProperty helper\n const obj = compileExpressionUnified(ma.object, context, resolver);\n return `getProperty(${obj}, \"${ma.property}\")`;\n }\n\n case 'IndexAccess': {\n const ia = ast as IndexAccess;\n const arr = compileExpressionUnified(ia.object, context, resolver);\n const idx = compileExpressionUnified(ia.index, context, resolver);\n return `getIndex(${arr}, ${idx})`;\n }\n\n case 'FunctionCall': {\n const fc = ast as FunctionCall;\n if (fc.callee.type === 'Identifier') {\n const name = (fc.callee as Identifier).name;\n\n // Higher-order functions need special handling\n if (name === 'filter') {\n return compileHigherOrderCall(fc, context, resolver, 'filter');\n }\n if (name === 'map') {\n return compileHigherOrderCall(fc, context, resolver, 'map');\n }\n if (name === 'reduce') {\n return compileHigherOrderCall(fc, context, resolver, 'reduce');\n }\n if (name === 'all') {\n return compileHigherOrderCall(fc, context, resolver, 'all');\n }\n if (name === 'some') {\n return compileHigherOrderCall(fc, context, resolver, 'some');\n }\n\n // Regular function call\n const args = fc.args.map((arg) => compileExpressionUnified(arg, context, resolver));\n const numArgs = args.length;\n\n // AssemblyScript requires typed array constructors\n if (numArgs === 1) {\n return `evaluateFunction(\"${name}\", makeArgs1(${args[0]}))`;\n } else if (numArgs === 2) {\n return `evaluateFunction(\"${name}\", makeArgs2(${args[0]}, ${args[1]}))`;\n } else if (numArgs === 3) {\n return `evaluateFunction(\"${name}\", makeArgs3(${args[0]}, ${args[1]}, ${args[2]}))`;\n } else {\n return `evaluateFunction(\"${name}\", [${args.join(', ')}])`;\n }\n }\n throw new Error('Only direct function calls are supported');\n }\n\n case 'Interval': {\n const intv = ast as Interval;\n const start = compileExpressionUnified(intv.start, context, resolver);\n const end = compileExpressionUnified(intv.end, context, resolver);\n return `createInterval(${start}, ${end}, ${intv.startInclusive}, ${intv.endInclusive})`;\n }\n\n case 'ArrayLiteral': {\n const al = ast as ArrayLiteral;\n if (al.elements.length === 0) {\n return 'Value.Array(new Array<Value>(0))';\n }\n const elements = al.elements.map((e) => compileExpressionUnified(e, context, resolver));\n return `Value.Array([${elements.join(', ')}])`;\n }\n\n case 'ObjectLiteral': {\n const ol = ast as ObjectLiteral;\n if (ol.properties.length === 0) {\n return 'Value.Object(new Map<string, Value>())';\n }\n // Generate a helper function for object construction\n const childResolver = resolver.createChildResolver();\n const helperId = context.getUniqueId('object');\n const props = ol.properties.map((p) => {\n const value = compileExpressionUnified(p.value, context, childResolver);\n return ` objResult.set(\"${p.key}\", ${value});`;\n });\n\n const helperCode = `\nfunction objectHelper_${helperId}(ctx: Context${resolver.getHelperParams()}): Value {\n const objResult = new Map<string, Value>();\n${props.join('\\n')}\n return Value.Object(objResult);\n}`;\n context.helperFunctions.set(`objectHelper_${helperId}`, helperCode);\n return `objectHelper_${helperId}(ctx${resolver.getHelperArgs()})`;\n }\n\n case 'TemplateLiteral': {\n const tl = ast as TemplateLiteral;\n const parts = tl.parts.map((part) => {\n if ('text' in part) {\n return `\"${escapeString(part.text)}\"`;\n } else {\n return `(${compileExpressionUnified(part.expr, context, resolver)}).asString()`;\n }\n });\n if (parts.length === 0) {\n return 'Value.String(\"\")';\n }\n if (parts.length === 1) {\n return `Value.String(${parts[0]})`;\n }\n return `Value.String(${parts.join(' + ')})`;\n }\n\n default:\n throw new Error(`Unsupported expression type: ${(ast as any).type}`);\n }\n}\n\n// ============================================================================\n// Higher-Order Function Compilation\n// ============================================================================\n\n/**\n * Compile a higher-order function call (filter, map, reduce, all, some).\n *\n * These functions iterate over arrays and need helper functions that set # for each element.\n * The resolver's child resolver is used inside the helper to maintain proper scoping.\n */\nfunction compileHigherOrderCall(\n ast: FunctionCall,\n context: CompilationContext,\n resolver: ContextResolver,\n fnName: 'filter' | 'map' | 'reduce' | 'all' | 'some',\n): string {\n const expectedArgs = fnName === 'reduce' ? 3 : 2;\n if (ast.args.length !== expectedArgs) {\n throw new Error(\n `${fnName}() requires exactly ${expectedArgs} arguments, got ${ast.args.length}`,\n );\n }\n\n const arrayExpr = ast.args[0];\n const lambdaExpr = ast.args[1];\n\n // Compile array expression with current resolver\n const arrayCode = compileExpressionUnified(arrayExpr, context, resolver);\n\n // Use child resolver for lambda (maintains access to outer scope)\n const childResolver = resolver.createChildResolver();\n const lambdaCode = compileExpressionUnified(lambdaExpr, context, childResolver);\n\n const helperId = context.getUniqueId(fnName);\n const extraParams = resolver.getHelperParams();\n const extraArgs = resolver.getHelperArgs();\n\n let helperCode: string;\n\n switch (fnName) {\n case 'filter':\n helperCode = `\nfunction filterHelper_${helperId}(ctx: Context, arr: Value${extraParams}): Value {\n if (!arr.isArray()) {\n return Value.Array(new Array<Value>(0));\n }\n\n const inputArr = arr.asArray();\n const filterResult = new Array<Value>(0);\n\n for (let i = 0; i < inputArr.length; i++) {\n const element = inputArr[i];\n ctx.set(\"#\", element);\n if (${lambdaCode}.asBool()) {\n filterResult.push(element);\n }\n }\n\n return Value.Array(filterResult);\n}`;\n break;\n\n case 'map':\n helperCode = `\nfunction mapHelper_${helperId}(ctx: Context, arr: Value${extraParams}): Value {\n if (!arr.isArray()) {\n return Value.Array(new Array<Value>(0));\n }\n\n const inputArr = arr.asArray();\n const mapResult = new Array<Value>(0);\n\n for (let i = 0; i < inputArr.length; i++) {\n const element = inputArr[i];\n ctx.set(\"#\", element);\n mapResult.push(${lambdaCode});\n }\n\n return Value.Array(mapResult);\n}`;\n break;\n\n case 'reduce': {\n const initialExpr = ast.args[2];\n const initialCode = compileExpressionUnified(initialExpr, context, resolver);\n helperCode = `\nfunction reduceHelper_${helperId}(ctx: Context, arr: Value, initAcc: Value${extraParams}): Value {\n if (!arr.isArray()) {\n return initAcc;\n }\n\n const inputArr = arr.asArray();\n let reduceAcc = initAcc;\n\n for (let i = 0; i < inputArr.length; i++) {\n const element = inputArr[i];\n ctx.set(\"#\", element);\n ctx.set(\"acc\", reduceAcc);\n reduceAcc = ${lambdaCode};\n }\n\n return reduceAcc;\n}`;\n context.helperFunctions.set(`reduceHelper_${helperId}`, helperCode);\n return `reduceHelper_${helperId}(ctx, ${arrayCode}, ${initialCode}${extraArgs})`;\n }\n\n case 'all':\n helperCode = `\nfunction allHelper_${helperId}(ctx: Context, arr: Value${extraParams}): Value {\n if (!arr.isArray()) {\n return Value.Bool(false);\n }\n\n const inputArr = arr.asArray();\n\n for (let i = 0; i < inputArr.length; i++) {\n const element = inputArr[i];\n ctx.set(\"#\", element);\n if (!${lambdaCode}.asBool()) {\n return Value.Bool(false);\n }\n }\n\n return Value.Bool(true);\n}`;\n break;\n\n case 'some':\n helperCode = `\nfunction someHelper_${helperId}(ctx: Context, arr: Value${extraParams}): Value {\n if (!arr.isArray()) {\n return Value.Bool(false);\n }\n\n const inputArr = arr.asArray();\n\n for (let i = 0; i < inputArr.length; i++) {\n const element = inputArr[i];\n ctx.set(\"#\", element);\n if (${lambdaCode}.asBool()) {\n return Value.Bool(true);\n }\n }\n\n return Value.Bool(false);\n}`;\n break;\n }\n\n context.helperFunctions.set(`${fnName}Helper_${helperId}`, helperCode);\n return `${fnName}Helper_${helperId}(ctx, ${arrayCode}${extraArgs})`;\n}\n\n// ============================================================================\n// Binary Operator Compilation\n// ============================================================================\n\n/**\n * Helper to compile binary operations with pre-compiled left and right values.\n * This is the single source of truth for all binary operator code generation.\n *\n * @param op - The operator string (e.g., \"+\", \"-\", \"==\", \"and\", etc.)\n * @param left - Pre-compiled code string for the left operand\n * @param right - Pre-compiled code string for the right operand\n * @returns AssemblyScript code string for the binary operation\n */\nexport function compileBinaryOpWithValues(op: string, left: string, right: string): string {\n switch (op) {\n // Arithmetic\n case '+':\n return `addValues(${left}, ${right})`;\n case '-':\n return `subtractValues(${left}, ${right})`;\n case '*':\n return `multiplyValues(${left}, ${right})`;\n case '/':\n return `divideValues(${left}, ${right})`;\n case '%':\n return `moduloValues(${left}, ${right})`;\n case '^':\n return `powerValues(${left}, ${right})`;\n\n // Comparison\n case '==':\n return `Value.Bool(valuesEqual(${left}, ${right}))`;\n case '!=':\n return `Value.Bool(!valuesEqual(${left}, ${right}))`;\n case '<':\n return `Value.Bool(compareValues(${left}, ${right}) < 0)`;\n case '>':\n return `Value.Bool(compareValues(${left}, ${right}) > 0)`;\n case '<=':\n return `Value.Bool(compareValues(${left}, ${right}) <= 0)`;\n case '>=':\n return `Value.Bool(compareValues(${left}, ${right}) >= 0)`;\n\n // Logical\n case 'and':\n return `((${left}).asBool() ? (${right}) : (${left}))`;\n case 'or':\n return `((${left}).asBool() ? (${left}) : (${right}))`;\n\n // Null coalescing\n case '??':\n return `(${left}.isNull() ? ${right} : ${left})`;\n\n // Membership\n case 'in':\n return `valueIn(${left}, ${right})`;\n case 'not in':\n return `Value.Bool(!valueIn(${left}, ${right}).asBool())`;\n\n default:\n throw new Error(`Unknown binary operator: ${op}`);\n }\n}\n\n// ============================================================================\n// Utility Functions\n// ============================================================================\n\n/**\n * Escape a string for use in AssemblyScript string literals.\n */\nexport function escapeString(s: string): string {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\"/g, '\\\\\"')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/\\t/g, '\\\\t');\n}\n\n/**\n * Build the full dotted path for a $-rooted member access chain.\n * Returns null if the path is not rooted at $.\n *\n * Example: $.eligibility.specialOffers -> \"eligibility.specialOffers\"\n */\nexport function buildDollarPath(ast: MemberAccess): string | null {\n if (ast.object.type === 'DollarRef') {\n return ast.property;\n }\n if (ast.object.type === 'MemberAccess') {\n const parentPath = buildDollarPath(ast.object as MemberAccess);\n if (parentPath !== null) {\n return `${parentPath}.${ast.property}`;\n }\n }\n return null;\n}\n\n/**\n * Check if a member access chain is rooted at the '$nodes' identifier.\n */\nexport function checkIsNodesReference(ast: MemberAccess): boolean {\n if (ast.object.type === 'Identifier') {\n return (ast.object as Identifier).name === '$nodes';\n } else if (ast.object.type === 'MemberAccess') {\n return checkIsNodesReference(ast.object as MemberAccess);\n }\n return false;\n}\n\n/**\n * Build the full dotted path for a $nodes-rooted member access chain.\n */\nexport function buildNodesPath(ast: MemberAccess): string {\n if (ast.object.type === 'Identifier') {\n return `${(ast.object as Identifier).name}.${ast.property}`;\n } else if (ast.object.type === 'MemberAccess') {\n return `${buildNodesPath(ast.object as MemberAccess)}.${ast.property}`;\n }\n throw new Error('Invalid object type for $nodes reference');\n}\n\n// ============================================================================\n// Convenience Functions\n// ============================================================================\n\n// Singleton instance for standard context compilation\nconst standardResolver = new StandardContextResolver();\n\n/**\n * Compile an AST node to AssemblyScript code using standard context resolution.\n *\n * This is a convenience function that uses StandardContextResolver, where:\n * - $ references resolve to ctx.get(\"$\")\n * - Identifiers resolve to ctx.get(\"name\")\n *\n * For specialized compilation contexts (expression nodes with local $, scoped contexts),\n * use compileExpressionUnified directly with the appropriate resolver.\n *\n * @param ast - The AST node to compile\n * @param context - The compilation context\n * @returns AssemblyScript code string that produces a Value\n */\nexport function compileExpression(ast: ExpressionAST, context: CompilationContext): string {\n return compileExpressionUnified(ast, context, standardResolver);\n}\n","// ============================================================================\n// Expression Node Compilation\n// ============================================================================\n//\n// This module provides compilation functionality for JDM expression nodes.\n// Expression nodes contain key-value pairs where values are expression strings.\n//\n// For the core expression AST compilation, see expression-compiler.ts.\n// For context resolution strategies, see context-resolvers.ts.\n\nimport type { CompilationContext, AssemblyScriptCode } from '../types';\nimport type { JDMNode } from '../parser';\nimport { sanitizeId } from '../utils';\nimport { LocalDollarContextResolver, ScopedContextResolver } from './context-resolvers';\nimport { compileExpressionUnified } from './expression-compiler';\n\n// Re-export commonly used items for backwards compatibility\nexport type { ContextResolver } from './context-resolvers';\nexport {\n StandardContextResolver,\n LocalDollarContextResolver,\n ScopedContextResolver,\n} from './context-resolvers';\n\nexport {\n compileExpressionUnified,\n compileBinaryOpWithValues,\n compileExpression,\n escapeString,\n buildDollarPath,\n checkIsNodesReference,\n buildNodesPath,\n} from './expression-compiler';\n\n/**\n * Compile an expression node.\n *\n * Expression nodes can contain one or more key-value pairs where\n * each value is an expression string that needs to be compiled.\n *\n * In expression nodes, the $ symbol refers to the local result object\n * being built, allowing later expressions to reference earlier ones.\n * For example: { \"a\": \"5\", \"b\": \"$.a + 10\" } - $.a references the 'a' computed above.\n *\n * Additional features:\n * - inputField: Specifies a sub-object path to use as the evaluation scope\n * - outputPath: Specifies the context path where the results will be stored\n * - executionMode: \"loop\" - Iterates over an array at inputField path\n *\n * @param node - The JDM expression node\n * @param context - The compilation context\n * @returns Generated AssemblyScript code\n */\nexport function compileExpressionNode(\n node: JDMNode,\n context: CompilationContext,\n): AssemblyScriptCode {\n const expressions = node.content.expressions as Array<{ key: string; value: string }>;\n const passThrough = node.content.passThrough === true;\n const inputField = node.content.inputField as string | undefined;\n const outputPath = node.content.outputPath as string | undefined;\n const executionMode = node.content.executionMode as string | undefined;\n const sanitizedId = sanitizeId(node.id);\n\n // Loop mode: iterates over array at inputField, evaluating expressions for each element\n // Used when executionMode === \"loop\" to transform array items in place\n if (executionMode === 'loop') {\n return compileLoopExpressionNode(\n node,\n context,\n expressions,\n passThrough,\n inputField,\n outputPath,\n sanitizedId,\n );\n }\n\n // If inputField is specified, generate scoped evaluation code\n if (inputField) {\n return compileScopedExpressionNode(\n node,\n context,\n expressions,\n passThrough,\n inputField,\n outputPath,\n sanitizedId,\n );\n }\n\n // Standard mode: evaluates expressions in global context without inputField scoping\n // Used when no inputField is specified - expressions resolve variables from root context\n const resolver = new LocalDollarContextResolver('result');\n const expressionAssignments = expressions\n .map((expr) => {\n try {\n const ast = context.parseExpression(expr.value);\n // Compile with $ resolved to local result variable using unified compiler\n const compiled = compileExpressionUnified(ast, context, resolver);\n return ` result.set(\"${expr.key}\", ${compiled});`;\n } catch (e) {\n throw new Error(`Failed to compile expression \"${expr.value}\" for key \"${expr.key}\": ${e}`);\n }\n })\n .join('\\n');\n\n if (passThrough) {\n return `\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n let result = new Map<string, Value>();\n\n // Copy all context values to preserve workflow state and allow referencing prior node results\n // passThrough=true ensures downstream nodes can access both input data and intermediate results\n const keys = ctx.data.keys();\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const value = ctx.data.get(key);\n result.set(key, value);\n }\n\n${expressionAssignments}\n\n return Value.Object(result);\n}\n`;\n }\n\n return `\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n let result = new Map<string, Value>();\n \n${expressionAssignments}\n \n return Value.Object(result);\n}\n`;\n}\n\n/**\n * Compile an expression node with inputField scoping.\n *\n * When inputField is specified (e.g., \"customer\"), expressions are evaluated\n * with the sub-object as the scope. So `firstName` resolves to `customer.firstName`.\n *\n * @param node - The JDM expression node\n * @param context - The compilation context\n * @param expressions - Array of key-value expression pairs\n * @param passThrough - Whether to pass through context values\n * @param inputField - The path to the input field (e.g., \"customer\")\n * @param outputPath - The path to store the output (e.g., \"customer\")\n * @param sanitizedId - Sanitized node ID\n * @returns Generated AssemblyScript code\n */\nfunction compileScopedExpressionNode(\n node: JDMNode,\n context: CompilationContext,\n expressions: Array<{ key: string; value: string }>,\n passThrough: boolean,\n inputField: string,\n outputPath: string | undefined,\n sanitizedId: string,\n): AssemblyScriptCode {\n // Generate unique helper to avoid name collisions in multi-node compilation\n const helperId = context.getUniqueId('scopedExpr');\n\n // Scoped evaluation: creates a temporary context where inputField object properties become top-level identifiers\n // Enables expressions like \"firstName\" to resolve to \"customer.firstName\" when inputField=\"customer\"\n const resolver = new ScopedContextResolver('scopedCtx', 'itemResult');\n const expressionAssignments = expressions\n .map((expr) => {\n try {\n const ast = context.parseExpression(expr.value);\n // Use unified compiler with scoped context resolver\n const compiled = compileExpressionUnified(ast, context, resolver);\n return ` itemResult.set(\"${expr.key}\", ${compiled});`;\n } catch (e) {\n throw new Error(`Failed to compile expression \"${expr.value}\" for key \"${expr.key}\": ${e}`);\n }\n })\n .join('\\n');\n\n // Generate the helper function for scoped evaluation\n // Can't use Context constructor directly - AssemblyScript Context requires specific initialization\n // that's tied to the WASM module's memory management, so we use ScopedContext wrapper instead\n const helperCode = `\nfunction scopedExprHelper_${helperId}(ctx: Context, inputObj: Value): Value {\n // Build result starting with input object fields (for passThrough behavior)\n const itemResult = new Map<string, Value>();\n if (inputObj.isObject()) {\n const inputMap = inputObj.asObject();\n const inputKeys = inputMap.keys();\n for (let i = 0; i < inputKeys.length; i++) {\n const key = inputKeys[i];\n itemResult.set(key, inputMap.get(key));\n }\n }\n \n // Two-layer context enables variable shadowing: inputField properties take precedence over parent context\n // Allows \"status\" in inputField to shadow global \"status\" while preserving access to non-shadowed globals\n const scopedData = new Map<string, Value>();\n \n // Copy parent context data first\n const parentKeys = ctx.data.keys();\n for (let i = 0; i < parentKeys.length; i++) {\n const key = parentKeys[i];\n scopedData.set(key, ctx.data.get(key));\n }\n \n // Override with fields from the input object (inputField scope)\n if (inputObj.isObject()) {\n const inputMap = inputObj.asObject();\n const inputKeys = inputMap.keys();\n for (let i = 0; i < inputKeys.length; i++) {\n const key = inputKeys[i];\n scopedData.set(key, inputMap.get(key));\n }\n }\n \n // Create a scoped context wrapper for expression evaluation\n const scopedCtx = new ScopedContext(scopedData);\n \n // Evaluate expressions in the scoped context\n${expressionAssignments}\n \n return Value.Object(itemResult);\n}`;\n\n context.helperFunctions.set(`scopedExprHelper_${helperId}`, helperCode);\n\n // Generate the main function that extracts inputField and calls the helper\n if (passThrough) {\n return `\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n let result = new Map<string, Value>();\n\n // Pass through all context values (input + intermediate results)\n const keys = ctx.data.keys();\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const value = ctx.data.get(key);\n result.set(key, value);\n }\n\n // Get input object from inputField path: ${inputField}\n const inputObj = ctx.get(\"${inputField}\");\n \n // Evaluate expressions in scoped context and store at outputPath: ${outputPath || inputField}\n const scopedResult = scopedExprHelper_${helperId}(ctx, inputObj);\n result.set(\"${outputPath || inputField}\", scopedResult);\n\n return Value.Object(result);\n}\n`;\n }\n\n return `\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n let result = new Map<string, Value>();\n\n // Get input object from inputField path: ${inputField}\n const inputObj = ctx.get(\"${inputField}\");\n \n // Evaluate expressions in scoped context and store at outputPath: ${outputPath || inputField}\n const scopedResult = scopedExprHelper_${helperId}(ctx, inputObj);\n result.set(\"${outputPath || inputField}\", scopedResult);\n\n return Value.Object(result);\n}\n`;\n}\n\n/**\n * Compile an expression node with executionMode: \"loop\".\n *\n * When executionMode is \"loop\", expressions are evaluated for each item\n * in the array at inputField path. Each item gets the computed fields added.\n *\n * @param node - The JDM expression node\n * @param context - The compilation context\n * @param expressions - Array of key-value expression pairs\n * @param passThrough - Whether to pass through context values\n * @param inputField - The path to the input array (e.g., \"cart.items\")\n * @param outputPath - The path to store the output array (e.g., \"cart.items\")\n * @param sanitizedId - Sanitized node ID\n * @returns Generated AssemblyScript code\n */\nfunction compileLoopExpressionNode(\n node: JDMNode,\n context: CompilationContext,\n expressions: Array<{ key: string; value: string }>,\n passThrough: boolean,\n inputField: string | undefined,\n outputPath: string | undefined,\n sanitizedId: string,\n): AssemblyScriptCode {\n if (!inputField) {\n throw new Error(`executionMode: \"loop\" requires inputField to be specified`);\n }\n\n // Generate a unique helper function for loop evaluation\n const helperId = context.getUniqueId('loopExpr');\n\n // Each iteration gets its own scoped context to isolate variables and prevent data leakage between iterations\n // Ensures expressions like \"price * quantity\" use current item's values, not previous iteration's\n const resolver = new ScopedContextResolver('itemCtx', 'itemResult');\n const expressionAssignments = expressions\n .map((expr) => {\n try {\n const ast = context.parseExpression(expr.value);\n // Use unified compiler with scoped context resolver for array item\n const compiled = compileExpressionUnified(ast, context, resolver);\n return ` itemResult.set(\"${expr.key}\", ${compiled});`;\n } catch (e) {\n throw new Error(`Failed to compile expression \"${expr.value}\" for key \"${expr.key}\": ${e}`);\n }\n })\n .join('\\n');\n\n // Generate the helper function for loop evaluation\n const helperCode = `\nfunction loopExprHelper_${helperId}(ctx: Context, inputArr: Value): Value {\n if (!inputArr.isArray()) {\n return Value.Array(new Array<Value>(0));\n }\n \n const items = inputArr.asArray();\n const resultItems = new Array<Value>(0);\n \n for (let i = 0; i < items.length; i++) {\n const item = items[i];\n \n // Build result item starting with existing fields\n const itemResult = new Map<string, Value>();\n if (item.isObject()) {\n const itemMap = item.asObject();\n const itemKeys = itemMap.keys();\n for (let j = 0; j < itemKeys.length; j++) {\n const key = itemKeys[j];\n itemResult.set(key, itemMap.get(key));\n }\n }\n \n // Create a scoped data map that combines parent context with item fields\n const scopedData = new Map<string, Value>();\n \n // Copy parent context data first\n const parentKeys = ctx.data.keys();\n for (let j = 0; j < parentKeys.length; j++) {\n const key = parentKeys[j];\n scopedData.set(key, ctx.data.get(key));\n }\n \n // Override with fields from the current item\n if (item.isObject()) {\n const itemMap = item.asObject();\n const itemKeys = itemMap.keys();\n for (let j = 0; j < itemKeys.length; j++) {\n const key = itemKeys[j];\n scopedData.set(key, itemMap.get(key));\n }\n }\n \n // Create a scoped context for expression evaluation\n const itemCtx = new ScopedContext(scopedData);\n \n // Evaluate expressions for this item\n${expressionAssignments}\n \n resultItems.push(Value.Object(itemResult));\n }\n \n return Value.Array(resultItems);\n}`;\n\n context.helperFunctions.set(`loopExprHelper_${helperId}`, helperCode);\n\n // Determine output path - use outputPath if specified, otherwise inputField\n const effectiveOutputPath = outputPath || inputField;\n\n // Generate the main function that extracts inputField array and calls the helper\n if (passThrough) {\n return `\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n let result = new Map<string, Value>();\n\n // Pass through all context values (input + intermediate results)\n const keys = ctx.data.keys();\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const value = ctx.data.get(key);\n result.set(key, value);\n }\n\n // Get input array from inputField path: ${inputField}\n const inputArr = ctx.get(\"${inputField}\");\n \n // Evaluate expressions for each item in the array\n const loopResult = loopExprHelper_${helperId}(ctx, inputArr);\n \n // Store result at outputPath: ${effectiveOutputPath}\n result.set(\"${effectiveOutputPath}\", loopResult);\n\n return Value.Object(result);\n}\n`;\n }\n\n return `\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n let result = new Map<string, Value>();\n\n // Get input array from inputField path: ${inputField}\n const inputArr = ctx.get(\"${inputField}\");\n \n // Evaluate expressions for each item in the array\n const loopResult = loopExprHelper_${helperId}(ctx, inputArr);\n \n // Store result at outputPath: ${effectiveOutputPath}\n result.set(\"${effectiveOutputPath}\", loopResult);\n\n return Value.Object(result);\n}\n`;\n}\n","/**\n * Unary expression transformation utilities for decision table compilation.\n *\n * In decision tables, expressions are evaluated in a \"unary\" context where\n * the $ symbol is automatically bound to the input field's value. Since\n * AssemblyScript doesn't support closures, we transform the AST to replace\n * DollarRef nodes with pre-compiled code.\n *\n * This module provides:\n * - InlineCode: A marker type for pre-compiled code in ASTs\n * - replaceDollarRefWithCode: AST transformer for dollar reference substitution\n * - compileExpressionWithInlineCode: Compiler that handles InlineCode nodes\n */\n\nimport type { CompilationContext } from './types';\nimport { compileExpression, compileBinaryOpWithValues } from './nodes/expression';\n\n/**\n * Special marker type for inline code that should be inserted directly.\n *\n * Used when AST transformation requires embedding already-compiled code.\n * For example, when compiling \"$ > 100\" where $ refers to a field value,\n * we replace the DollarRef node with an InlineCode node containing the\n * pre-compiled field access code.\n */\nexport interface InlineCode {\n type: 'InlineCode';\n code: string;\n}\n\n/**\n * Recursively replace DollarRef nodes in an AST with InlineCode nodes\n * containing the pre-compiled field expression.\n *\n * This transformation enables unary expression compilation in AssemblyScript\n * by substituting $ references with actual field access code at compile time.\n *\n * @param ast - The AST node to transform\n * @param compiledField - The pre-compiled code for the field value\n * @returns The transformed AST with InlineCode nodes instead of DollarRef\n *\n * @example\n * // Original AST for \"$ > 100\":\n * // { type: \"BinaryOp\", op: \">\", left: { type: \"DollarRef\" }, right: { type: \"NumberLiteral\", value: 100 } }\n * //\n * // After transformation with compiledField = 'ctx.get(\"creditScore\")':\n * // { type: \"BinaryOp\", op: \">\", left: { type: \"InlineCode\", code: 'ctx.get(\"creditScore\")' }, right: { type: \"NumberLiteral\", value: 100 } }\n */\nexport function replaceDollarRefWithCode(ast: any, compiledField: string): any {\n if (!ast || typeof ast !== 'object') {\n return ast;\n }\n\n // If this is a DollarRef, replace it with InlineCode containing the compiled field\n if (ast.type === 'DollarRef') {\n return { type: 'InlineCode', code: compiledField } as InlineCode;\n }\n\n // Recursively transform child nodes\n const result: any = { type: ast.type };\n\n for (const key of Object.keys(ast)) {\n if (key === 'type') {\n continue;\n }\n\n const value = ast[key];\n if (Array.isArray(value)) {\n result[key] = value.map((item) => replaceDollarRefWithCode(item, compiledField));\n } else if (value && typeof value === 'object') {\n result[key] = replaceDollarRefWithCode(value, compiledField);\n } else {\n result[key] = value;\n }\n }\n\n return result;\n}\n\n/**\n * Compile an AST that may contain InlineCode nodes.\n *\n * This compiler extends the standard expression compiler to handle InlineCode\n * nodes, which contain pre-compiled code that should be inserted directly.\n * It's used after replaceDollarRefWithCode to compile the transformed AST.\n *\n * @param ast - The AST node to compile (may contain InlineCode nodes)\n * @param context - The compilation context\n * @returns Compiled AssemblyScript code string\n */\nexport function compileExpressionWithInlineCode(ast: any, context: CompilationContext): string {\n // Handle InlineCode nodes specially - just return the pre-compiled code\n if (ast.type === 'InlineCode') {\n return (ast as InlineCode).code;\n }\n\n // For nodes with binary operations\n if (ast.type === 'BinaryOp') {\n const left = compileExpressionWithInlineCode(ast.left, context);\n const right = compileExpressionWithInlineCode(ast.right, context);\n return compileBinaryOpWithValues(ast.op, left, right);\n }\n\n // For unary operations\n if (ast.type === 'UnaryOp') {\n const operand = compileExpressionWithInlineCode(ast.operand, context);\n switch (ast.op) {\n case 'not':\n return `Value.Bool(!(${operand}).asBool())`;\n case '-':\n return `negateValue(${operand})`;\n default:\n throw new Error(`Unknown unary operator: ${ast.op}`);\n }\n }\n\n // For function calls, compile args recursively to handle InlineCode\n if (ast.type === 'FunctionCall') {\n const callee = ast.callee;\n if (callee.type === 'Identifier') {\n const args = ast.args.map((arg: any) => compileExpressionWithInlineCode(arg, context));\n const numArgs = args.length;\n\n // Use helper functions to create argument arrays\n if (numArgs === 1) {\n return `evaluateFunction(\"${callee.name}\", makeArgs1(${args[0]}))`;\n } else if (numArgs === 2) {\n return `evaluateFunction(\"${callee.name}\", makeArgs2(${args[0]}, ${args[1]}))`;\n } else if (numArgs === 3) {\n return `evaluateFunction(\"${callee.name}\", makeArgs3(${args[0]}, ${args[1]}, ${args[2]}))`;\n } else {\n return `evaluateFunction(\"${callee.name}\", [${args.join(', ')}])`;\n }\n }\n throw new Error('Only direct function calls are supported');\n }\n\n // For member access\n if (ast.type === 'MemberAccess') {\n const obj = compileExpressionWithInlineCode(ast.object, context);\n return `getProperty(${obj}, \"${ast.property}\")`;\n }\n\n // For index access\n if (ast.type === 'IndexAccess') {\n const obj = compileExpressionWithInlineCode(ast.object, context);\n const idx = compileExpressionWithInlineCode(ast.index, context);\n return `getIndex(${obj}, ${idx})`;\n }\n\n // For ternary operations\n if (ast.type === 'TernaryOp') {\n const cond = compileExpressionWithInlineCode(ast.condition, context);\n const cons = compileExpressionWithInlineCode(ast.consequent, context);\n const alt = compileExpressionWithInlineCode(ast.alternate, context);\n return `(${cond}.asBool() ? ${cons} : ${alt})`;\n }\n\n // For other node types, delegate to standard compileExpression\n return compileExpression(ast, context);\n}\n","import type { JDMNode } from '../parser';\nimport type { CompilationContext, AssemblyScriptCode, NoMatchBehavior } from '../types';\nimport { sanitizeId } from '../utils';\nimport { compileExpression } from './expression';\nimport { replaceDollarRefWithCode, compileExpressionWithInlineCode } from '../unary-transform';\n\n/**\n * Decision table content structure.\n */\ninterface DecisionTableContent {\n rules: any[];\n inputs: any[];\n outputs: any[];\n hitPolicy: 'first' | 'collect' | 'unique' | 'ruleOrder' | 'outputOrder' | 'priority';\n /** Override the global no-match behavior for this table */\n noMatchBehavior?: NoMatchBehavior;\n /** Whether to pass through input values to output */\n passThrough?: boolean;\n}\n\n/**\n * Compile a comparison expression for a decision table condition.\n *\n * In decision tables, expressions are evaluated in a \"unary\" context where\n * the $ symbol is automatically bound to the input field's value.\n *\n * For example:\n * - \"> 100\" becomes \"$ > 100\" with $ bound to the input field\n * - \"admin\" becomes \"$ == admin\" (equality check)\n * - \"[1..10]\" becomes \"$ in [1..10]\" (range check)\n *\n * The field parameter can be either:\n * - A simple field name like \"creditScore\" → ctx.get(\"creditScore\")\n * - An expression like \"date(order.createdAt)\" → needs to be parsed and evaluated\n *\n * Since AssemblyScript doesn't support closures, we transform the AST\n * to replace DollarRef nodes with the compiled field expression.\n *\n * @param expr - The raw expression string\n * @param inputType - The type of the input field\n * @param field - The field expression to compare against\n * @param context - The compilation context\n * @returns Compiled AssemblyScript code for the comparison\n */\nfunction compileComparison(\n expr: string,\n inputType: string,\n field: string | undefined,\n context: CompilationContext,\n): string {\n // Handle empty expressions or unset values. Empty cells mean \"any value matches\" for\n // that column. This is flexible (allows partial rule specification) but can be dangerous\n // (typos become wildcards). Following DMN/JDM convention where blank = don't care.\n if (!expr || expr === '' || expr === '-') {\n return 'true';\n }\n\n try {\n // When input field is \"$\", the cell contains a full boolean expression rather than a\n // unary comparison:\n // e.g., \"age > 18 and tier == 'gold'\"\n // This allows complex conditions that span multiple input values in a single cell, useful\n // for cross-column logic.\n if (!field || field === '$') {\n // Parse and compile the expression directly as a standard expression\n const ast = context.parseExpression(expr);\n const compiledExpr = compileExpression(ast, context);\n return `${compiledExpr}.asBool()`;\n }\n\n // Parse the expression using unary parser for decision table cells\n // This transforms expressions like \"> 100\" into AST representing \"$ > 100\"\n const ast = context.parseUnaryExpression(expr);\n\n // Compile the field expression to get the value to compare against\n // The field can be a simple name like \"creditScore\" or an expression like \"date(order.createdAt)\"\n const fieldAst = context.parseExpression(field);\n const compiledField = compileExpression(fieldAst, context);\n\n // Transform the AST to replace DollarRef nodes with the compiled field expression\n // AssemblyScript doesn't support closures, so we can't create a function context\n // where $ refers to the field value. Instead, we do direct AST substitution.\n const transformedAst = replaceDollarRefWithCode(ast, compiledField);\n\n // Compile the transformed AST to AssemblyScript code\n const compiledExpr = compileExpressionWithInlineCode(transformedAst, context);\n\n // Return the compiled expression wrapped in .asBool() for the condition\n return `${compiledExpr}.asBool()`;\n } catch (e) {\n // If parsing fails, log the error and return false (no match)\n // This prevents compilation failures from breaking the entire decision\n throw new Error(\n `Failed to compile decision table condition \"${expr}\" for field \"${field}\": ${e}`,\n );\n }\n}\n\n/**\n * Compile an output value for a decision table result.\n *\n * @param value - The raw value string\n * @param outputType - The type of the output field\n * @param field - The field name being set\n * @param context - The compilation context\n * @returns Compiled AssemblyScript code for the value\n */\nfunction compileOutputValue(\n value: string,\n outputType: string,\n field: string,\n context: CompilationContext,\n): string {\n // Handle empty/unset values: in multi-output tables, rules may set some outputs but not others.\n // Empty cells mean \"this rule doesn't provide a value for this output field\", allowing sparse tables.\n if (!value || value === '-' || value === '') {\n return '';\n }\n\n const normalizedType = (outputType || '').toLowerCase();\n\n // Check if value is a quoted string literal ('value' or \"value\")\n // In JDM format, string literals are often wrapped in single quotes\n const isQuotedString =\n (value.startsWith(\"'\") && value.endsWith(\"'\")) ||\n (value.startsWith('\"') && value.endsWith('\"'));\n\n // Strip outer quotes if present for string literal values\n const unquotedValue = isQuotedString ? value.slice(1, -1) : value;\n\n switch (normalizedType) {\n case 'expression': {\n // For expression type, parse and compile the value as an expression\n // This allows output values to reference context variables or perform calculations\n const ast = context.parseExpression(value);\n return compileExpression(ast, context);\n }\n\n case 'string':\n case 'text':\n // Input values may have quotes that need escaping for the generated AS code. Must escape\n // both backslashes (for escape sequences) and double quotes (for string delimiters).\n const escaped = unquotedValue.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"');\n return 'Value.String(\"' + escaped + '\")';\n\n case 'number':\n case 'integer':\n case 'decimal':\n case 'double':\n return `Value.Float(${parseFloat(value)})`;\n\n case 'boolean':\n case 'bool':\n return `Value.Bool(${value.toLowerCase() === 'true'})`;\n\n default:\n // For untyped values, infer type through a cascade:\n // 1. Quoted strings → string literal\n // 2. \"true\"/\"false\" → boolean\n // 3. Numeric format → number\n // 4. Otherwise → try parsing as expression, fallback to string literal\n if (isQuotedString) {\n // Value is a string literal - use the unquoted value\n const defaultEscaped = unquotedValue.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"');\n return 'Value.String(\"' + defaultEscaped + '\")';\n }\n\n // Check if it's a boolean\n if (value.toLowerCase() === 'true' || value.toLowerCase() === 'false') {\n return `Value.Bool(${value.toLowerCase() === 'true'})`;\n }\n\n // Check if it's a number (use regex to handle trailing zeros like \"0.10\")\n // The regex matches integer, decimal, and scientific notation formats\n if (/^-?(\\d+\\.?\\d*|\\.\\d+)([eE][+-]?\\d+)?$/.test(value)) {\n return `Value.Float(${parseFloat(value)})`;\n }\n\n // For unquoted non-literal values, treat as an expression\n // This handles cases like \"basicEligibility.reason\" or \"totalScore * 1.5\"\n try {\n const ast = context.parseExpression(value);\n return compileExpression(ast, context);\n } catch (e) {\n // Throw error instead of silently falling back to string literal\n // This prevents type errors and typos from being silently converted to strings\n throw new Error(\n `Failed to compile output value \"${value}\" for field \"${field}\": ${e}. ` +\n `If you intended a literal string, wrap it in quotes: '\"${value}\"' or \"'${value}'\"`,\n );\n }\n }\n}\n\n/**\n * Extract string literals from compiled code and generate hoisted constants.\n * This optimization avoids repeated string allocations in large decision tables.\n *\n * Hoisting string literals to module-level constants prevents repeated allocations\n * that can exhaust WASM memory during table evaluation.\n *\n * @param code - The compiled code containing Value.String(...) calls\n * @param nodeId - Unique identifier for this node (used in constant names)\n * @returns Object with hoisted constants code and transformed code\n */\nfunction hoistStringLiterals(code: string, nodeId: string): { constants: string; code: string } {\n // Find all Value.String(\"...\") patterns\n const stringLiteralRegex = /Value\\.String\\(\"([^\"\\\\]|\\\\.)*\"\\)/g;\n const matches = code.match(stringLiteralRegex) || [];\n\n // Count occurrences\n const counts = new Map<string, number>();\n for (const match of matches) {\n counts.set(match, (counts.get(match) || 0) + 1);\n }\n\n // Only hoist strings that appear more than once\n const toHoist = new Map<string, string>();\n let constIndex = 0;\n for (const [literal, count] of counts) {\n if (count > 1) {\n // Extract the string content for naming\n const constName = `__str_${sanitizeId(nodeId)}_${constIndex++}`;\n toHoist.set(literal, constName);\n }\n }\n\n // If nothing to hoist, return original\n if (toHoist.size === 0) {\n return { constants: '', code };\n }\n\n // Generate constant declarations\n const constants = Array.from(toHoist.entries())\n .map(([literal, constName]) => `const ${constName}: Value = ${literal};`)\n .join('\\n');\n\n // Replace literals with constant references\n let transformedCode = code;\n for (const [literal, constName] of toHoist) {\n // Need to escape regex special chars in the literal\n const escapedLiteral = literal.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n transformedCode = transformedCode.replace(new RegExp(escapedLiteral, 'g'), constName);\n }\n\n return { constants, code: transformedCode };\n}\n\n/**\n * Compile a decision table node.\n *\n * Generates if/else chains for decision table evaluation, supporting:\n * - FIRST hit policy: Returns the first matching rule's output\n * - COLLECT hit policy: Aggregates all matching rules' outputs\n * - UNIQUE hit policy: Returns output if exactly one rule matches\n * - RULE ORDER hit policy: Returns all matching rules' outputs in rule order\n * - OUTPUT ORDER hit policy: Returns all matching rules sorted by output priority\n * - PRIORITY hit policy: Returns only the highest-priority matching rule\n *\n * For large decision tables (many rules with repeated string literals),\n * string literals are hoisted to module-level constants to avoid\n * repeated allocations that can exhaust memory.\n *\n * @param node - The JDM decision table node\n * @param context - The compilation context\n * @returns Generated AssemblyScript code\n */\nexport function compileDecisionTableNode(\n node: JDMNode,\n context: CompilationContext,\n): AssemblyScriptCode {\n const {\n rules,\n inputs,\n outputs,\n hitPolicy,\n noMatchBehavior: tableNoMatchBehavior,\n passThrough,\n } = node.content as DecisionTableContent;\n\n // Determine the effective no-match behavior (table-level overrides global)\n const noMatchBehavior = tableNoMatchBehavior ??\n context.options.noMatchBehavior ?? { type: 'returnNull' };\n\n // Unique and priority need to evaluate all rules before making a decision\n const isCollectAll =\n hitPolicy === 'collect' ||\n hitPolicy === 'unique' ||\n hitPolicy === 'ruleOrder' ||\n hitPolicy === 'outputOrder' ||\n hitPolicy === 'priority';\n\n // Generate the result declaration based on hit policy\n let resultDeclaration: string;\n if (isCollectAll) {\n resultDeclaration = 'let results = new Array<Value>();';\n } else {\n resultDeclaration = '';\n }\n\n // Generate the rule evaluation branches\n const ruleBranches = rules\n .map((rule, idx) => {\n // Compile all input conditions for this rule\n const conditions = inputs\n .map((input) => {\n const expr = rule[input.id];\n if (!expr || expr === '' || expr === '-') {\n return 'true';\n }\n return compileComparison(expr, input.type, input.field, context);\n })\n .join(' && ');\n\n // Compile all output values for this rule\n const resultAssignments = outputs\n .map((output) => {\n const value = rule[output.id];\n if (!value || value === '' || value === '-') {\n return '';\n }\n const compiled = compileOutputValue(value, output.type, output.field, context);\n return ` result.set(\"${output.field}\", ${compiled});`;\n })\n .filter(Boolean)\n .join('\\n');\n\n // Generate the conditional expression and action\n if (isCollectAll) {\n // For collect-mode hit policies, evaluate all rules independently\n return `\n if (${conditions || 'true'}) {\n let result = new Map<string, Value>();\n${resultAssignments}\n results.push(Value.Object(result));\n }`;\n } else {\n // For FIRST hit policy, use if/else if chain\n const conditionalExpr =\n idx === 0 ? `if (${conditions || 'true'})` : `else if (${conditions || 'true'})`;\n return `${conditionalExpr} {\n let result = new Map<string, Value>();\n${resultAssignments}\n return Value.Object(result);\n }`;\n }\n })\n .join(isCollectAll ? '\\n' : '\\n');\n\n // Generate the no-match handler based on the effective behavior\n function generateNoMatchHandler(): string {\n const returnNull = 'return Value.Null();';\n\n // We need to signal to the caller that no rules matched but the table has passThrough enabled,\n // so it should return accumulated context. We can't directly access the outer context here, so\n // we return a marker object that the caller detects and handles.\n const returnPassthroughSignal = `let __pt = new Map<string, Value>();\n __pt.set(\"__passthrough\", Value.Bool(true));\n return Value.Object(__pt);`;\n\n if (noMatchBehavior.type === 'throwError') {\n return `SetLastErrorWithMessage(RuntimeErrorCode.EVALUATION_ERROR, \"Decision table \\\\\"${node.name}\\\\\" (id: ${node.id}): No matching rules found\");\\n ${returnNull}`;\n } else if (noMatchBehavior.type === 'returnDefault') {\n const defaultValue = noMatchBehavior.value;\n\n // Generate the default value as a Value based on its JavaScript type\n let defaultValueCode: string;\n switch (typeof defaultValue) {\n case 'string':\n defaultValueCode = `Value.String(\"${String(defaultValue).replace(/\"/g, '\\\\\"')}\")`;\n break;\n case 'number':\n defaultValueCode = `Value.Float(${defaultValue})`;\n break;\n case 'boolean':\n defaultValueCode = `Value.Bool(${defaultValue})`;\n break;\n default:\n defaultValueCode = `Value.String(\"${String(defaultValue)}\")`;\n }\n\n // Assign the default value to each output field\n const defaultAssignments = outputs\n .map((output) => {\n return ` result.set(\"${output.field}\", ${defaultValueCode});`;\n })\n .join('\\n');\n\n const defaultAssignmentSingle =\n outputs.length > 0\n ? ` let result = new Map<string, Value>();\\n${defaultAssignments}\\n return Value.Object(result);`\n : returnNull;\n\n if (isCollectAll) {\n // For collect-mode policies, return array with default result\n return ` let result = new Map<string, Value>();\\n${defaultAssignments}\\n return Value.Array([Value.Object(result)]);`;\n } else {\n return defaultAssignmentSingle;\n }\n } else {\n // Default: returnNull\n // But for FIRST hit policy with passThrough, signal to use accumulated context\n if (passThrough && hitPolicy === 'first') {\n return returnPassthroughSignal;\n }\n return returnNull;\n }\n }\n\n // Generate the final return statement based on hit policy\n // COLLECT-style policies return arrays directly (not wrapped in object)\n // The node name keying is handled by codegen.ts when storing in context\n let finalReturn: string;\n if (hitPolicy === 'collect' || hitPolicy === 'ruleOrder') {\n // For collect policies no-match handling\n if (noMatchBehavior.type === 'throwError') {\n finalReturn = `\n if (results.length == 0) {\n${generateNoMatchHandler()}\n }\n return Value.Array(results);`;\n } else if (noMatchBehavior.type === 'returnDefault') {\n finalReturn = `\n if (results.length == 0) {\n${generateNoMatchHandler()}\n }\n return Value.Array(results);`;\n } else {\n finalReturn = `return Value.Array(results);`;\n }\n } else if (hitPolicy === 'unique') {\n finalReturn = `\n // Validate exactly one match\n if (results.length == 1) {\n return results[0];\n } else if (results.length == 0) {\n ${generateNoMatchHandler()}\n } else {\n // Multiple matches - this violates UNIQUE constraint\n SetLastErrorWithMessage(RuntimeErrorCode.EVALUATION_ERROR, \"Decision table \\\\\"${node.name}\\\\\" (id: ${node.id}): Multiple rules matched but UNIQUE hit policy requires exactly one match\");\n return Value.Null();\n }`;\n } else if (hitPolicy === 'outputOrder' || hitPolicy === 'priority') {\n if (outputs.length === 0) {\n throw new Error(`${hitPolicy.toUpperCase()} hit policy requires at least one output field`);\n }\n\n const primaryOutput = outputs[0];\n finalReturn = `\n // Sort by output value (descending priority), with rule order as tie-breaker\n results.sort((a: Value, b: Value): i32 => {\n let aOutput = a.asObject().get(\"${primaryOutput.field}\");\n let bOutput = b.asObject().get(\"${primaryOutput.field}\");\n\n // Compare the primary output values\n let cmp = compareValues(aOutput, bOutput);\n\n // If outputs are equal, maintain rule order (lower index = higher priority)\n if (cmp == 0) {\n return 1; // already in rule order, so keep it\n }\n\n // Return results in descending order of output priority\n // Higher output values come first\n return cmp < 0 ? 1 : -1;\n });\n\n if (results.length == 0) {\n${generateNoMatchHandler()}\n }\n\n ${\n hitPolicy === 'priority'\n ? '// Return only the highest-priority result\\n return results[0];'\n : 'return Value.Array(results);'\n }`;\n } else {\n // Default case - FIRST hit policy\n finalReturn = `\\n else {\\n ${generateNoMatchHandler()}\\n }`;\n }\n\n const sanitizedId = sanitizeId(node.id);\n\n // Build the raw function body\n const rawFunctionBody = `\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n ${resultDeclaration}\n\n${ruleBranches}\n${finalReturn}\n}\n`;\n\n // For large decision tables, hoist repeated string literals to module-level constants\n // This prevents memory exhaustion from repeated Value.String() allocations\n if (rules.length > 100) {\n const { constants, code: optimizedBody } = hoistStringLiterals(rawFunctionBody, node.id);\n if (constants) {\n return `// Hoisted string constants for decision table \"${node.name}\" (${rules.length} rules)\n${constants}\n\n${optimizedBody}`;\n }\n }\n\n return rawFunctionBody;\n}\n","/**\n * Code generation helpers for shared AssemblyScript code patterns.\n *\n * These helpers generate AssemblyScript code strings that can be used across\n * different compiler modules to avoid duplication.\n */\n\nimport { sanitizeId } from './utils';\n\n/**\n * Generate AssemblyScript code to assign a value to a nested path in the context.\n *\n * This handles dotted paths like \"cart.items.total\" by navigating/creating the\n * necessary object hierarchy in the context. The algorithm:\n * 1. Splits the path by \".\"\n * 2. Gets or creates the root object from context\n * 3. Navigates/creates intermediate objects for each part\n * 4. Sets the final value at the leaf\n *\n * @param path - The dotted path string (e.g., \"cart.items.total\")\n * @param valueExpr - The AssemblyScript expression for the value to assign\n * @param prefix - Optional prefix for generated variable names to avoid collisions (default: \"__np\")\n * @returns AssemblyScript code string that performs the nested assignment\n */\nexport function generateNestedPathAssignment(\n path: string,\n valueExpr: string,\n prefix: string = '__np',\n): string {\n return `// Store value at nested path: ${path}\n{\n const ${prefix}_value = ${valueExpr};\n const ${prefix}_parts = \"${path}\".split(\".\");\n const ${prefix}_rootKey = ${prefix}_parts[0];\n // Get or create the root object\n let ${prefix}_rootObj: Map<string, Value>;\n if (ctx.data.has(${prefix}_rootKey) && ctx.data.get(${prefix}_rootKey).isObject()) {\n ${prefix}_rootObj = ctx.data.get(${prefix}_rootKey).asObject();\n } else {\n ${prefix}_rootObj = new Map<string, Value>();\n ctx.set(${prefix}_rootKey, Value.Object(${prefix}_rootObj));\n }\n // Navigate/create nested objects for intermediate parts\n let ${prefix}_current = ${prefix}_rootObj;\n for (let ${prefix}_j = 1; ${prefix}_j < ${prefix}_parts.length - 1; ${prefix}_j++) {\n const ${prefix}_part = ${prefix}_parts[${prefix}_j];\n if (${prefix}_current.has(${prefix}_part) && ${prefix}_current.get(${prefix}_part).isObject()) {\n ${prefix}_current = ${prefix}_current.get(${prefix}_part).asObject();\n } else {\n const ${prefix}_newObj = new Map<string, Value>();\n ${prefix}_current.set(${prefix}_part, Value.Object(${prefix}_newObj));\n ${prefix}_current = ${prefix}_newObj;\n }\n }\n // Set the final value at the leaf of the path\n ${prefix}_current.set(${prefix}_parts[${prefix}_parts.length - 1], ${prefix}_value);\n}`;\n}\n\n/**\n * Generate AssemblyScript code to build a final result from accumulated context.\n *\n * This extracts all user-facing keys from the context (excluding internal namespaces)\n * and builds a Map suitable for returning as a Value.Object result.\n *\n * The generated code:\n * 1. Creates a new Map for the result\n * 2. Iterates over all keys in ctx.data\n * 3. Filters out internal keys ($*, #, acc)\n * 4. Copies remaining keys to the result map\n *\n * @param resultVarName - The name of the variable to store the result in\n * @param prefix - Optional prefix for loop variables to avoid collisions (default: \"__bfr\")\n * @returns AssemblyScript code string that builds the result map\n */\nexport function generateBuildFinalResultCode(\n resultVarName: string,\n prefix: string = '__bfr',\n): string {\n return `// Build final result from accumulated context\nlet ${resultVarName} = new Map<string, Value>();\nconst ${prefix}_keys = ctx.data.keys();\nfor (let ${prefix}_i = 0; ${prefix}_i < ${prefix}_keys.length; ${prefix}_i++) {\n const ${prefix}_key = ${prefix}_keys[${prefix}_i];\n // $nodes/$ are internal namespaces\n // # is iteration variable,\n // acc is accumulator\n // None should appear in final output, only actual output field names\n if (!${prefix}_key.startsWith(\"$\") && ${prefix}_key !== \"#\" && ${prefix}_key !== \"acc\") {\n ${resultVarName}.set(${prefix}_key, ctx.data.get(${prefix}_key));\n }\n}`;\n}\n\n/**\n * Generate AssemblyScript code to evaluate a single node and handle its outputPath and passThrough settings.\n *\n * This is the standard node evaluation pattern used across the codebase. It:\n * 1. Calls the node's evaluateNode function\n * 2. Stores the result in $nodes.<nodeName>\n * 3. Handles outputPath if specified (storing result at the given path)\n * 4. Handles passThrough merge if the node is configured for it\n *\n * @param nodeId - The raw node ID\n * @param nodeName - The name of the node (for context storage)\n * @param node - The JDM node definition (optional, for outputPath/passThrough handling)\n * @returns AssemblyScript code string that evaluates the node\n */\nexport function generateNodeEvaluationCode(\n nodeId: string,\n nodeName: string,\n node?: {\n type?: string;\n content?: { outputPath?: string; passThrough?: boolean; outputs?: Array<{ field?: string }> };\n },\n): string {\n const sanitizedId = sanitizeId(nodeId);\n const statements: string[] = [];\n\n // Call the node's evaluateNode function and store result\n statements.push(`ctx.set(\"$nodes.${nodeName}\", evaluateNode_${sanitizedId}(ctx));`);\n\n if (!node) {\n return statements.join('\\n ');\n }\n\n const outputPath = node.content?.outputPath;\n if (outputPath) {\n if (!outputPath.includes('.')) {\n statements.push(`ctx.set(\"${outputPath}\", ctx.get(\"$nodes.${nodeName}\"));`);\n } else {\n statements.push(generateNestedPathAssignment(outputPath, `ctx.get(\"$nodes.${nodeName}\")`));\n }\n }\n\n // Determine if we should merge node results into context\n // Expression nodes compute values meant for the output, so their results should flow\n // through to the final result regardless of passThrough setting. Decision tables with\n // dotted output fields (e.g., \"flag.turnover\") similarly need merging to build nested\n // output structures.\n const hasOutputFields =\n node.type === 'decisionTableNode' &&\n node.content?.outputs?.some((o: { field?: string }) => o.field && o.field.includes('.'));\n const shouldMerge =\n node.type === 'expressionNode' || node.content?.passThrough === true || hasOutputFields;\n\n if (shouldMerge) {\n statements.push(generatePassThroughMergeCode(nodeName));\n }\n\n return statements.join('\\n ');\n}\n\n/**\n * Generate AssemblyScript code to merge passThrough node results into the context.\n *\n * This handles both simple keys (e.g., \"status\") and nested paths (e.g., \"evaluation.score\").\n * For nested paths, it navigates/creates the necessary object hierarchy in the context.\n *\n * The generated code:\n * 1. Gets the node result from `$nodes.<nodeName>`\n * 2. Iterates over all keys in the result\n * 3. For simple keys, sets them directly in the context\n * 4. For nested paths, navigates/creates intermediate objects and sets the leaf value\n *\n * @param nodeName - The name of the node whose results should be merged\n * @returns AssemblyScript code string that performs the merge\n */\nexport function generatePassThroughMergeCode(nodeName: string): string {\n // Generate the nested path assignment code for use inside the loop\n // We use a special prefix \"__pt\" to avoid collisions with other generated code\n const nestedPathCode = `const __pt_parts = __key.split(\".\");\n const __pt_rootKey = __pt_parts[0];\n let __pt_rootObj: Map<string, Value>;\n if (ctx.data.has(__pt_rootKey) && ctx.data.get(__pt_rootKey).isObject()) {\n __pt_rootObj = ctx.data.get(__pt_rootKey).asObject();\n } else {\n __pt_rootObj = new Map<string, Value>();\n ctx.set(__pt_rootKey, Value.Object(__pt_rootObj));\n }\n let __pt_current = __pt_rootObj;\n for (let __pt_j = 1; __pt_j < __pt_parts.length - 1; __pt_j++) {\n const __pt_part = __pt_parts[__pt_j];\n if (__pt_current.has(__pt_part) && __pt_current.get(__pt_part).isObject()) {\n __pt_current = __pt_current.get(__pt_part).asObject();\n } else {\n const __pt_newObj = new Map<string, Value>();\n __pt_current.set(__pt_part, Value.Object(__pt_newObj));\n __pt_current = __pt_newObj;\n }\n }\n __pt_current.set(__pt_parts[__pt_parts.length - 1], __value);`;\n\n return `// Merge passThrough results for ${nodeName}\n{\n const __nodeResult = ctx.get(\"$nodes.${nodeName}\");\n if (__nodeResult.isObject()) {\n const __resultMap = __nodeResult.asObject();\n const __keys = __resultMap.keys();\n for (let __i = 0; __i < __keys.length; __i++) {\n const __key = __keys[__i];\n const __value = __resultMap.get(__key);\n if (__key.includes(\".\")) {\n ${nestedPathCode}\n } else {\n ctx.set(__key, __value);\n }\n }\n }\n}`;\n}\n","import type { JDMNode } from '../parser';\nimport type { CompilationContext, AssemblyScriptCode, NoMatchBehavior } from '../types';\nimport { compileExpression } from './expression';\nimport { sanitizeId } from '../utils';\nimport { generateNodeEvaluationCode, generateBuildFinalResultCode } from '../code-generators';\n\n/**\n * Switch statement definition (from JDM format).\n */\ninterface SwitchStatement {\n id: string;\n condition: string; // Empty string means default case\n}\n\n/**\n * Switch node content structure (from JDM format).\n */\ninterface JDMNodeContent {\n statements: SwitchStatement[];\n hitPolicy?: 'first' | 'collect' | 'unique' | 'ruleOrder' | 'outputOrder' | 'priority';\n /** Override the global no-match behavior for this switch */\n noMatchBehavior?: NoMatchBehavior;\n}\n\n/**\n * Internal switch condition definition.\n */\ninterface SwitchCondition {\n id: string;\n expression: string;\n nodes: string[];\n isDefault: boolean;\n}\n\n/**\n * Get all nodes reachable from a starting node via BFS, stopping at switch nodes.\n *\n * Each switch evaluates its own branches independently. If we traversed into nested\n * switches, we'd incorrectly include nodes that should be conditionally evaluated by\n * the nested switch, not unconditionally evaluated by the parent branch.\n */\nfunction getBranchNodes(startNodeId: string, context: CompilationContext): string[] {\n const nodeMap = new Map(context.jdm.nodes.map((n) => [n.id, n]));\n const visited = new Set<string>();\n const result: string[] = [];\n const queue = [startNodeId];\n\n while (queue.length > 0) {\n const currentId = queue.shift()!;\n if (visited.has(currentId)) {\n continue;\n }\n visited.add(currentId);\n result.push(currentId);\n\n // Get the current node\n const currentNode = nodeMap.get(currentId);\n\n // If node not found in context, just include it and stop traversal\n // (this handles test mocks that don't define all nodes)\n if (!currentNode) {\n continue;\n }\n\n // If this is a switch node, don't traverse its outgoing edges\n // The switch will handle its own branches when it's evaluated\n if (currentNode.type === 'switchNode') {\n continue;\n }\n\n // Find outgoing edges from this node\n const outgoingEdges = context.jdm.edges.filter((e) => e.sourceId === currentId);\n for (const edge of outgoingEdges) {\n queue.push(edge.targetId);\n }\n }\n\n return result;\n}\n\n/**\n * Generate inline code to evaluate an entire branch (all nodes in sequence).\n * Returns the statements and a final result expression.\n *\n * Uses shared node evaluation infrastructure (generateNodeEvaluationCode) to ensure\n * consistent handling of outputPath and passThrough across the codebase.\n */\nfunction generateBranchEvaluation(\n branchNodeIds: string[],\n context: CompilationContext,\n): { statements: string; resultExpr: string } {\n const nodeMap = new Map(context.jdm.nodes.map((n) => [n.id, n]));\n\n if (branchNodeIds.length === 0) {\n return { statements: '', resultExpr: 'Value.Null()' };\n }\n\n // Generate evaluation code for each node using shared helper\n const evalStatements = branchNodeIds.map((nodeId) => {\n const node = nodeMap.get(nodeId);\n const nodeName = node?.name || sanitizeId(nodeId);\n return generateNodeEvaluationCode(nodeId, nodeName, node);\n });\n\n // Determine result expression based on the last node's type\n const lastNodeId = branchNodeIds[branchNodeIds.length - 1];\n const lastNode = nodeMap.get(lastNodeId);\n const lastNodeName = lastNode?.name || sanitizeId(lastNodeId);\n\n // For output nodes or nodes with passThrough, build result from accumulated context\n const shouldUseAccumulatedContext =\n lastNode?.type === 'outputNode' || lastNode?.content?.passThrough === true;\n\n if (shouldUseAccumulatedContext) {\n // Use shared helper to build final result from context\n evalStatements.push(generateBuildFinalResultCode('__branchFinalResult', '__branch'));\n return {\n statements: evalStatements.join('\\n '),\n resultExpr: 'Value.Object(__branchFinalResult)',\n };\n }\n\n return {\n statements: evalStatements.join('\\n '),\n resultExpr: `ctx.get(\"$nodes.${lastNodeName}\")`,\n };\n}\n\n/**\n * Compile a switch node.\n *\n * Generates conditional chains (switch-like logic) for evaluating multiple\n * conditions and routing to the appropriate target nodes.\n *\n * Supports:\n * - FIRST hit policy: Returns the first matching condition's result\n * - COLLECT hit policy: Aggregates all matching conditions' results\n * - RULE ORDER hit policy: Returns all matching conditions' results in order\n * - UNIQUE hit policy: Returns result if exactly one condition matches\n * - OUTPUT ORDER hit policy: Returns all matching conditions' results sorted by value\n * - PRIORITY hit policy: Returns only the highest-priority matching condition's result\n *\n * Default Cases:\n * - A statement with an empty condition string acts as the default case\n * - When no conditions match, the default case is evaluated (if provided)\n * - Default case has access to the full input context\n * - If no default case is provided, the configured no-match behavior applies\n *\n * @param node - The JDM switch node\n * @param context - The compilation context\n * @returns Generated AssemblyScript code\n */\nexport function compileSwitchNode(node: JDMNode, context: CompilationContext): AssemblyScriptCode {\n const jdmContent = node.content as JDMNodeContent;\n const {\n statements,\n hitPolicy: jdmHitPolicy,\n noMatchBehavior: switchNoMatchBehavior,\n } = jdmContent;\n\n const hitPolicy = jdmHitPolicy ?? 'first';\n\n // Determine the effective no-match behavior (node-level overrides global)\n const noMatchBehavior = switchNoMatchBehavior ??\n context.options.noMatchBehavior ?? { type: 'returnNull' };\n\n // RULE ORDER, COLLECT, OUTPUT ORDER, and PRIORITY all use array collection mode\n const isCollectMode =\n hitPolicy === 'collect' ||\n hitPolicy === 'ruleOrder' ||\n hitPolicy === 'outputOrder' ||\n hitPolicy === 'priority';\n\n const nodeMap = new Map(context.jdm.nodes.map((n) => [n.id, n]));\n\n // In collect mode, if all branches terminate at output nodes, we can merge their results into\n // a single object instead of returning an array. This allows collect-mode switches to build\n // structured outputs progressively, avoiding unnecessary nesting.\n function checkAllBranchesTerminateAtOutput(): boolean {\n if (!isCollectMode) {\n return false;\n }\n\n for (const statement of statements) {\n if (statement.condition === '' || statement.condition.trim() === '') {\n continue;\n } // Skip default\n\n // Find target edge for this statement\n const edge = context.jdm.edges.find(\n (e) => e.sourceId === node.id && e.sourceHandle === statement.id,\n );\n if (!edge) {\n continue;\n }\n\n // Get the terminal node(s) for this branch\n const branchNodes = getBranchNodes(edge.targetId, context);\n if (branchNodes.length === 0) {\n return false;\n }\n\n const lastNodeId = branchNodes[branchNodes.length - 1];\n const lastNode = nodeMap.get(lastNodeId);\n if (!lastNode || lastNode.type !== 'outputNode') {\n return false;\n }\n }\n\n // Also check default case if exists\n const defaultStatement = statements.find(\n (s) => s.condition === '' || s.condition.trim() === '',\n );\n if (defaultStatement) {\n const edge = context.jdm.edges.find(\n (e) => e.sourceId === node.id && e.sourceHandle === defaultStatement.id,\n );\n if (edge) {\n const branchNodes = getBranchNodes(edge.targetId, context);\n if (branchNodes.length > 0) {\n const lastNodeId = branchNodes[branchNodes.length - 1];\n const lastNode = nodeMap.get(lastNodeId);\n if (!lastNode || lastNode.type !== 'outputNode') {\n return false;\n }\n }\n }\n }\n\n return true;\n }\n\n const shouldMergeCollectResults = checkAllBranchesTerminateAtOutput();\n\n // Transform JDM statements to internal conditions format\n const conditions: SwitchCondition[] = statements.map((statement) => {\n // Find target nodes for this statement by looking for edges with this statement as sourceHandle\n const edges = context.jdm.edges.filter(\n (edge) => edge.sourceId === node.id && edge.sourceHandle === statement.id,\n );\n const targetNodeIds = edges.map((edge) => sanitizeId(edge.targetId));\n\n return {\n id: statement.id,\n expression: statement.condition,\n nodes: targetNodeIds,\n // In collect mode, all matching conditions execute (empty = always match).\n // In first mode, execution stops at first match, so empty condition acts as fallback \"default\" case.\n isDefault:\n !isCollectMode && (statement.condition === '' || statement.condition.trim() === ''),\n };\n });\n\n // Separate regular conditions from default case\n // In collect mode, there are no defaults - empty conditions are just \"always true\"\n const regularConditions = conditions.filter((c) => !c.isDefault);\n const defaultCase = isCollectMode ? undefined : conditions.find((c) => c.isDefault);\n\n // Generate the result declaration based on hit policy\n const resultDeclaration = isCollectMode ? 'let results = new Array<Value>();' : '';\n\n // Generate the no-match handler based on the effective behavior\n function generateNoMatchHandler(): string {\n if (noMatchBehavior.type === 'throwError') {\n return `SetLastErrorWithMessage(RuntimeErrorCode.EVALUATION_ERROR, \"Switch node \\\\\"${node.name}\\\\\" (id: ${node.id}): No matching condition found\");\\n return Value.Null();`;\n } else if (noMatchBehavior.type === 'returnDefault') {\n // Generate the default value as a Value\n const defaultValue = noMatchBehavior.value;\n let defaultValueCode: string;\n switch (typeof defaultValue) {\n case 'string':\n defaultValueCode = `Value.String(\"${String(defaultValue).replace(/\"/g, '\\\\\"')}\")`;\n break;\n case 'number':\n defaultValueCode = `Value.Float(${defaultValue})`;\n break;\n case 'boolean':\n defaultValueCode = `Value.Bool(${defaultValue})`;\n break;\n default:\n defaultValueCode = `Value.String(\"${String(defaultValue)}\")`;\n }\n\n return isCollectMode\n ? `return Value.Array([${defaultValueCode}]);`\n : `return ${defaultValueCode};`;\n } else {\n // Default: returnNull\n return 'return Value.Null();';\n }\n }\n\n // Helper function to generate code that evaluates the default case (entire branch)\n function generateDefaultCaseEvaluation(): string {\n if (!defaultCase) {\n return generateNoMatchHandler();\n }\n\n // Get the first node ID for the default case\n // If no target node is connected to the default case, use no-match behavior\n if (!defaultCase.nodes || defaultCase.nodes.length === 0) {\n // Default case exists but has no target - treat as no-match\n return generateNoMatchHandler();\n }\n\n // Get all nodes in this branch (from target to end)\n const branchStartId = defaultCase.nodes[0]; // Use raw ID, not sanitized\n // Find the raw ID from the edge\n const defaultEdge = context.jdm.edges.find(\n (e) => e.sourceId === node.id && e.sourceHandle === defaultCase.id,\n );\n const rawTargetId = defaultEdge?.targetId || branchStartId;\n const branchNodeIds = getBranchNodes(rawTargetId, context);\n\n // Generate code to evaluate the entire branch\n const { statements, resultExpr } = generateBranchEvaluation(branchNodeIds, context);\n\n if (isCollectMode) {\n return ` ${statements}\\n results.push(${resultExpr});`;\n } else {\n return ` ${statements}\\n return ${resultExpr};`;\n }\n }\n\n // Generate the conditional branches for each condition (excluding default)\n let conditionBranches: string;\n let finalReturn: string;\n\n // Helper to get branch nodes for a condition\n function getBranchNodesForCondition(condition: SwitchCondition): string[] {\n if (!condition.nodes || condition.nodes.length === 0) {\n return [];\n }\n\n // Find the edge for this condition to get the raw target ID\n const edge = context.jdm.edges.find(\n (e) => e.sourceId === node.id && e.sourceHandle === condition.id,\n );\n const rawTargetId = edge?.targetId || condition.nodes[0];\n return getBranchNodes(rawTargetId, context);\n }\n\n // Handle the case where there are no regular conditions but there is a default case\n if (regularConditions.length === 0) {\n conditionBranches = '';\n if (defaultCase && defaultCase.nodes && defaultCase.nodes.length > 0) {\n // Only default case exists with a target - evaluate the entire branch\n const branchNodeIds = getBranchNodesForCondition(defaultCase);\n const { statements, resultExpr } = generateBranchEvaluation(branchNodeIds, context);\n\n if (isCollectMode) {\n finalReturn = `\n ${statements}\n results.push(${resultExpr});\n return Value.Array(results);`;\n } else {\n finalReturn = `\n ${statements}\n return ${resultExpr};`;\n }\n } else {\n // No conditions and no default case (or default with no target) - use no-match behavior\n finalReturn = `\\n ${generateNoMatchHandler()}`;\n }\n } else {\n // Generate the conditional branches for each condition (excluding default)\n conditionBranches = regularConditions\n .map((condition, idx) => {\n // Parse and compile the condition expression\n let compiledExpr: string;\n // Empty condition means \"always true\" (especially in collect mode)\n if (condition.expression === '' || condition.expression.trim() === '') {\n compiledExpr = 'true';\n } else {\n try {\n const ast = context.parseExpression(condition.expression);\n // Get the conditional value (expects a boolean result)\n const exprCode = compileExpression(ast, context);\n compiledExpr = `${exprCode}.asBool()`;\n } catch {\n // If parsing fails, provide a comment indicating the issue\n // Can fail if expression syntax is invalid (checked at compile time)\n compiledExpr = '/* ERROR: Could not parse expression */ false';\n }\n }\n\n // Get all nodes in this branch (from target to end)\n const branchNodeIds = getBranchNodesForCondition(condition);\n const { statements, resultExpr } = generateBranchEvaluation(branchNodeIds, context);\n\n // Generate the conditional branch\n if (isCollectMode) {\n // For collect-mode hit policies, evaluate all conditions independently\n if (shouldMergeCollectResults) {\n // When all branches terminate at output nodes, just evaluate (don't collect)\n // The context accumulates all results which get merged at the end\n const branchCode = `\\n if (${compiledExpr}) {\n ${statements}\n }`;\n return branchCode;\n }\n const branchCode = `\\n if (${compiledExpr}) {\n ${statements}\n results.push(${resultExpr});\n }`;\n return branchCode;\n } else {\n // For FIRST hit policy, use if/else if chain (short-circuit on first match)\n const prefix = idx === 0 ? '\\n if' : '\\n else if';\n const branchCode = `${prefix} (${compiledExpr}) {\n ${statements}\n return ${resultExpr};\n }`;\n return branchCode;\n }\n })\n .join('');\n\n if (isCollectMode) {\n // For OUTPUT ORDER and PRIORITY, sort the results by value (descending)\n if (hitPolicy === 'outputOrder' || hitPolicy === 'priority') {\n if (\n defaultCase ||\n noMatchBehavior.type === 'throwError' ||\n noMatchBehavior.type === 'returnDefault'\n ) {\n finalReturn = `\n // Sort by value (descending priority), with rule order as tie-breaker\n // compareValues returns: -1 if a < b, 0 if equal, 1 if a > b\n // For descending order (higher priority first): return inverted comparison\n // Tie-breaker: when equal, return 1 to maintain original rule order (stable sort)\n results.sort((a: Value, b: Value): i32 => {\n let cmp = compareValues(a, b);\n if (cmp == 0) {\n return 1;\n }\n return cmp < 0 ? 1 : -1;\n });\n\n if (results.length == 0) {\n${generateDefaultCaseEvaluation()}\n }\n\n ${hitPolicy === 'priority' ? 'return results[0];' : 'return Value.Array(results);'}`;\n } else {\n finalReturn = `\n // Sort by value (descending priority), with rule order as tie-breaker\n // compareValues returns: -1 if a < b, 0 if equal, 1 if a > b\n // For descending order (higher priority first): return inverted comparison\n // Tie-breaker: when equal, return 1 to maintain original rule order (stable sort)\n results.sort((a: Value, b: Value): i32 => {\n let cmp = compareValues(a, b);\n if (cmp == 0) {\n return 1;\n }\n return cmp < 0 ? 1 : -1;\n });\n\n ${\n hitPolicy === 'priority'\n ? 'return results.length > 0 ? results[0] : Value.Null();'\n : 'return Value.Array(results);'\n }`;\n }\n } else {\n // Collect or rule order without sorting\n if (shouldMergeCollectResults) {\n // When merging results, return the accumulated context (excluding input keys)\n // First check if any branch was evaluated, if not run default\n if (defaultCase) {\n finalReturn = `\n // Build merged result from accumulated context (excluding input keys)\n // Runtime variables: $=context root, #=current array element, acc=reduce accumulator\n let __mergedResult = new Map<string, Value>();\n const __mergedCtxKeys = ctx.data.keys();\n for (let __mergedI = 0; __mergedI < __mergedCtxKeys.length; __mergedI++) {\n const __mergedKey = __mergedCtxKeys[__mergedI];\n // Skip internal entries, special variables, and input keys\n if (!__mergedKey.startsWith(\"$\") && __mergedKey !== \"#\" && __mergedKey !== \"acc\" && !ctx.inputKeys.has(__mergedKey)) {\n __mergedResult.set(__mergedKey, ctx.data.get(__mergedKey));\n }\n }\n // If no output was produced, run default case\n if (__mergedResult.size == 0) {\n${generateDefaultCaseEvaluation()}\n // Rebuild result after default case\n __mergedResult = new Map<string, Value>();\n const __afterDefaultKeys = ctx.data.keys();\n for (let __afterI = 0; __afterI < __afterDefaultKeys.length; __afterI++) {\n const __afterKey = __afterDefaultKeys[__afterI];\n if (!__afterKey.startsWith(\"$\") && __afterKey !== \"#\" && __afterKey !== \"acc\" && !ctx.inputKeys.has(__afterKey)) {\n __mergedResult.set(__afterKey, ctx.data.get(__afterKey));\n }\n }\n }\n return Value.Object(__mergedResult);`;\n } else {\n finalReturn = `\n // Build merged result from accumulated context (excluding input keys)\n // Runtime variables: $=context root, #=current array element, acc=reduce accumulator\n let __mergedResult = new Map<string, Value>();\n const __mergedCtxKeys = ctx.data.keys();\n for (let __mergedI = 0; __mergedI < __mergedCtxKeys.length; __mergedI++) {\n const __mergedKey = __mergedCtxKeys[__mergedI];\n // Skip internal entries, special variables, and input keys\n if (!__mergedKey.startsWith(\"$\") && __mergedKey !== \"#\" && __mergedKey !== \"acc\" && !ctx.inputKeys.has(__mergedKey)) {\n __mergedResult.set(__mergedKey, ctx.data.get(__mergedKey));\n }\n }\n return Value.Object(__mergedResult);`;\n }\n } else if (\n defaultCase ||\n noMatchBehavior.type === 'throwError' ||\n noMatchBehavior.type === 'returnDefault'\n ) {\n finalReturn = `\n if (results.length == 0) {\n${generateDefaultCaseEvaluation()}\n }\n return Value.Array(results);`;\n } else {\n finalReturn = '\\n return Value.Array(results);';\n }\n }\n } else {\n // Non-collect mode (FIRST, PRIORITY)\n if (defaultCase) {\n // Use else block to evaluate default case\n // Last branch already has closing brace, so just add else block\n finalReturn = `\\n else {\\n // Default case - no conditions matched\\n${generateDefaultCaseEvaluation()}\\n }`;\n } else {\n // Use else block for no-match handling\n finalReturn = `\\n else {\\n ${generateNoMatchHandler()}\\n }`;\n }\n }\n }\n\n const sanitizedId = sanitizeId(node.id);\n return `\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n ${resultDeclaration}\n\n ${conditionBranches}${finalReturn}\n}\n`;\n}\n","import type { JDMNode, JDMDecision } from '../parser';\nimport type { CompilationContext, AssemblyScriptCode } from '../types';\nimport { sanitizeId } from '../utils';\nimport { compileDecisionTableNode } from './decision-table';\nimport { compileSwitchNode } from './switch';\nimport { compileInputNode } from './input';\nimport { compileExpressionNode } from './expression';\nimport { compileFunctionNode } from './function';\nimport { buildGraph, getEvaluationOrder } from '../graph';\n\n/**\n * Generate a unique prefix for sub-decision node IDs to avoid naming conflicts.\n */\nfunction decisionNodePrefix(nodeId: string): string {\n return `sub_${sanitizeId(nodeId)}_`;\n}\n\n/**\n * Generate the sub-decision entry point function that contains the actual evaluation logic.\n */\nfunction generateSubDecisionEntryPoint(\n node: JDMNode,\n context: CompilationContext,\n subDecision: JDMDecision,\n prefix: string,\n): AssemblyScriptCode {\n const sanitizedId = sanitizeId(node.id);\n\n // Build the sub-decision graph and get evaluation order\n const graph = buildGraph(subDecision);\n // Catches circular sub-decision references at compile time for better error messages and\n // fail-fast behavior, rather than discovering cycles at runtime with stack overflow.\n const evaluationOrder = getEvaluationOrder(graph);\n\n // Create a node lookup for quick access\n const nodeMap = new Map(subDecision.nodes.map((n) => [n.id, n]));\n\n // Generate evaluation code for each node in topological order\n // Skip output nodes - they mark graph termination but don't perform computation\n // Skip input nodes (input just passes context through)\n const evaluationCode = evaluationOrder\n .map((nodeId) => {\n const subNode = nodeMap.get(nodeId);\n if (!subNode || subNode.type === 'outputNode' || subNode.type === 'inputNode') {\n return '';\n }\n const prefixedId = prefix + sanitizeId(nodeId);\n // Store node result in context under $nodes.<nodeName>\n return ` ctx.set(\"$nodes.${subNode.name}\", evaluateNode_${prefixedId}(ctx));`;\n })\n .filter(Boolean)\n .join('\\n');\n\n // Find the last non-input, non-output node that was evaluated to return its result\n const evaluatedNodes = evaluationOrder.filter((id) => {\n const subNode = nodeMap.get(id);\n if (!subNode) {\n return false;\n }\n return subNode.type !== 'inputNode' && subNode.type !== 'outputNode';\n });\n\n // Determine what to return:\n // - If there are evaluated nodes, return the last one's result\n // - Otherwise, return an empty object for passthrough graphs\n let resultCode: string;\n if (evaluatedNodes.length > 0) {\n const lastNodeId = evaluatedNodes[evaluatedNodes.length - 1];\n const lastNode = nodeMap.get(lastNodeId)!;\n resultCode = ` let result = ctx.get(\"$nodes.${lastNode.name}\");`;\n } else {\n // For passthrough graphs (input->output with no intermediate nodes),\n // return an empty object to indicate \"no transformation\"\n //\n // Can't return ctx.toValue: Returning ctx as-is would create circular reference when the\n // result is merged back into parent context. Empty object signals \"pass through unchanged\".\n resultCode = ` let result = Value.Object(new Map<string, Value>());`;\n }\n\n return `\n// Sub-decision entry point function for ${node.id}\nexport function evaluateSubDecision_${sanitizedId}(ctx: Context): Value {\n // Evaluate the sub-decision graph\n${evaluationCode}\n\n // Get the final result\n${resultCode}\n\n return result;\n}\n`;\n}\n\n/**\n * Generate a wrapper function that handles caching, recursion detection, and delegates to the sub-decision entry point.\n */\nfunction generateDecisionNodeWrapper(\n node: JDMNode,\n subDecisionFunctionName: string,\n): AssemblyScriptCode {\n const sanitizedId = sanitizeId(node.id);\n const cacheKey = `\"evaluateNode_${sanitizedId}\"`;\n\n return `\n// Wrapper function to evaluate sub-decision ${node.id}\nexport function evaluateNode_${sanitizedId}(ctx: Context): Value {\n // Check cache first to avoid redundant evaluation\n if (ctx.decisionResults.has(${cacheKey})) {\n return ctx.decisionResults.get(${cacheKey});\n }\n\n // Compile-time detection catches static cycles, but runtime detection is needed for dynamic\n // sub-decision loading or conditional recursion based on input data.\n if (ctx.decisionStack.includes(\"${sanitizedId}\")) {\n const recursionPath = ctx.decisionStack.join(' -> ') + ' -> ' + \"${sanitizedId}\";\n SetLastError(RuntimeErrorCode.EVALUATION_ERROR);\n return Value.Null();\n }\n\n // Add to decision stack before evaluation\n ctx.decisionStack.push(\"${sanitizedId}\");\n\n // Evaluate the sub-decision\n let result = ${subDecisionFunctionName}(ctx);\n\n // Check for errors from sub-decision evaluation\n if (hasError()) {\n // Error occurred in sub-decision - propagate it up\n // Remove from decision stack\n const stackIndex = ctx.decisionStack.indexOf(\"${sanitizedId}\");\n if (stackIndex >= 0) {\n ctx.decisionStack.splice(stackIndex, 1);\n }\n return Value.Null();\n }\n\n // Store result in cache\n ctx.decisionResults.set(${cacheKey}, result);\n\n // Remove from decision stack after evaluation\n const stackIndex = ctx.decisionStack.indexOf(\"${sanitizedId}\");\n if (stackIndex >= 0) {\n ctx.decisionStack.splice(stackIndex, 1);\n }\n\n return result;\n}\n`;\n}\n\n/**\n * Compile a sub-decision node.\n *\n * Sub-decision nodes allow a decision to call another decision as part of its\n * evaluation. This function generates code that:\n * 1. Loads the referenced sub-decision JDM\n * 2. Recursively compiles all nodes in the sub-decision\n * 3. Creates a wrapper function to invoke the sub-decision\n * 4. Returns the code for both the wrapper and the sub-decision logic\n *\n * @param node - The JDM sub-decision node\n * @param context - The compilation context\n * @returns Generated AssemblyScript code for the sub-decision\n */\nexport function compileDecisionNode(\n node: JDMNode,\n context: CompilationContext,\n): AssemblyScriptCode {\n // Check for cycles in the decision graph\n if (context.decisionPath.includes(node.id)) {\n throw new Error(\n `Circular dependency detected in decision graph: ${context.decisionPath.join(' -> ')} -> ${node.id}`,\n );\n }\n\n // Extract the sub-decision reference key from the decision node content\n const subDecisionKey = node.content?.key;\n if (!subDecisionKey) {\n throw new Error(\n `Decision node ${node.id} has no content.key - cannot determine which decision to call`,\n );\n }\n\n // Check if this sub-decision JDM has already been loaded (caching the parsed JDM)\n // We don't cache the generated code because each reference needs its own function names\n // But we can cache the parsed JDM to avoid re-parsing\n let subDecision: JDMDecision;\n\n // Add to decision path for cycle detection\n context.decisionPath.push(node.id);\n\n try {\n // Load the sub-decision JDM using the loader\n subDecision = context.loadDecision(subDecisionKey);\n\n // Find the input and output nodes in the sub-decision\n const inputNode = subDecision.nodes.find((n) => n.type === 'inputNode');\n const outputNodes = subDecision.nodes.filter((n) => n.type === 'outputNode');\n\n if (!inputNode) {\n throw new Error(`Sub-decision ${subDecisionKey} has no input node`);\n }\n\n if (outputNodes.length === 0) {\n throw new Error(`Sub-decision ${subDecisionKey} has no output nodes`);\n }\n\n // Check if this sub-decision has already been compiled (for caching)\n const cachedFunctionName = context.compiledSubDecisions.get(subDecisionKey);\n if (cachedFunctionName) {\n // Sub-decision was already compiled, just generate a wrapper that calls the cached entry point\n const wrapperCode = generateDecisionNodeWrapper(node, cachedFunctionName);\n return wrapperCode;\n }\n\n // Add unique prefix to sub-decision node IDs to avoid conflicts\n const prefix = decisionNodePrefix(node.id);\n const sanitizedId = sanitizeId(node.id);\n const subDecisionFunctionName = `evaluateSubDecision_${sanitizedId}`;\n\n // Cache the entry point function name for reuse\n context.compiledSubDecisions.set(subDecisionKey, subDecisionFunctionName);\n\n // Create a modified context for recursive compilation. Sub-decisions need isolated compilation\n // state (separate decision path, separate compiled cache) to avoid conflicts with parent decision\n // while sharing global settings.\n const subContext: CompilationContext = {\n ...context,\n decisionPath: [...context.decisionPath],\n };\n\n // Compile each node in the sub-decision\n let subCompiled = '';\n for (const subNode of subDecision.nodes) {\n const nodeType = subNode.type;\n\n // Skip output nodes - they're just markers\n if (nodeType === 'outputNode') {\n continue;\n }\n\n // Create a prefixed version of the node to avoid ID conflicts\n const prefixedNode = {\n ...subNode,\n id: prefix + subNode.id,\n };\n\n // Compile the node based on its type\n switch (nodeType) {\n case 'inputNode':\n subCompiled += compileInputNode(prefixedNode, context);\n break;\n case 'decisionTableNode':\n subCompiled += compileDecisionTableNode(prefixedNode, context);\n break;\n case 'switchNode':\n subCompiled += compileSwitchNode(prefixedNode, context);\n break;\n case 'expressionNode':\n subCompiled += compileExpressionNode(prefixedNode, context);\n break;\n case 'functionNode':\n subCompiled += compileFunctionNode(prefixedNode, context);\n break;\n case 'decisionNode':\n // Recursive sub-decision\n subCompiled += compileDecisionNode(prefixedNode, subContext);\n break;\n default:\n // Output nodes don't need compilation\n break;\n }\n }\n\n // Generate the sub-decision entry point function\n const entryPointCode = generateSubDecisionEntryPoint(node, context, subDecision, prefix);\n\n // Generate the wrapper function that handles caching, recursion detection, and delegates\n const wrapperCode = generateDecisionNodeWrapper(node, subDecisionFunctionName);\n\n const completeCode = wrapperCode + entryPointCode + subCompiled;\n\n // Return the complete code (wrapper + entry point + sub-decision node functions)\n return completeCode;\n } finally {\n // Remove from decision path (backtracking)\n const pathIndex = context.decisionPath.indexOf(node.id);\n if (pathIndex !== -1) {\n context.decisionPath.splice(pathIndex, 1);\n }\n }\n}\n","/**\n * Compile-time validation for decision models.\n *\n * This module provides functions to perform static analysis of JDM structure\n * and references at compile time. These checks detect missing references,\n * undeclared identifiers, and unassigned outputs before code generation.\n *\n * These functions operate on ASTs and CompilationContext - they do NOT\n * execute at runtime. For runtime data validation, see runtime-validation-codegen.ts.\n */\n\nimport type { ExpressionAST, Identifier } from './ast-types';\nimport { CompilationError, ErrorCode, ErrorCollector, type SourceLocation } from './errors';\nimport type { CompilationContext } from './types';\n\n/**\n * Collect all identifier references from an expression AST.\n *\n * This function walks the AST and collects all variable/field references\n * that need to be resolved from the context. It handles:\n * - Simple identifiers: `age`, `name`\n * - Member access: `customer.age`, `order.items[0].price`\n *\n * @param ast - The expression AST to analyze\n * @returns Set of all identifier names referenced in the expression\n */\nexport function collectIdentifiers(ast: ExpressionAST): Set<string> {\n const identifiers = new Set<string>();\n collectIdentifiersRecursive(ast, identifiers);\n return identifiers;\n}\n\n/**\n * Recursively collect identifiers from an AST node.\n */\nfunction collectIdentifiersRecursive(ast: ExpressionAST, identifiers: Set<string>): void {\n switch (ast.type) {\n case 'Identifier': {\n const ident = ast as Identifier;\n identifiers.add(ident.name);\n break;\n }\n\n case 'MemberAccess':\n // For member access like `customer.age`, we need to track the base object `customer`\n collectIdentifiersRecursive((ast as any).object, identifiers);\n // The property name is a literal, not an identifier\n break;\n\n case 'IndexAccess':\n // For index access like `items[0]`, we need the base object\n collectIdentifiersRecursive((ast as any).object, identifiers);\n // The index is an expression that may contain identifiers\n collectIdentifiersRecursive((ast as any).index, identifiers);\n break;\n\n case 'BinaryOp':\n collectIdentifiersRecursive((ast as any).left, identifiers);\n collectIdentifiersRecursive((ast as any).right, identifiers);\n break;\n\n case 'UnaryOp':\n collectIdentifiersRecursive((ast as any).operand, identifiers);\n break;\n\n case 'TernaryOp':\n collectIdentifiersRecursive((ast as any).condition, identifiers);\n collectIdentifiersRecursive((ast as any).consequent, identifiers);\n collectIdentifiersRecursive((ast as any).alternate, identifiers);\n break;\n\n case 'FunctionCall':\n collectIdentifiersRecursive((ast as any).callee, identifiers);\n for (const arg of (ast as any).args) {\n collectIdentifiersRecursive(arg, identifiers);\n }\n break;\n\n case 'ArrayLiteral':\n for (const element of (ast as any).elements) {\n collectIdentifiersRecursive(element, identifiers);\n }\n break;\n\n case 'ObjectLiteral':\n for (const [_key, value] of Object.entries((ast as any).properties)) {\n collectIdentifiersRecursive(value as ExpressionAST, identifiers);\n }\n break;\n\n case 'TemplateLiteral':\n for (const part of (ast as any).parts) {\n if (typeof part === 'object') {\n // It's an expression\n collectIdentifiersRecursive(part as ExpressionAST, identifiers);\n }\n // String literals are ignored\n }\n break;\n\n case 'Interval':\n collectIdentifiersRecursive((ast as any).start, identifiers);\n collectIdentifiersRecursive((ast as any).end, identifiers);\n break;\n\n // Literals don't reference identifiers\n case 'NumberLiteral':\n case 'StringLiteral':\n case 'BooleanLiteral':\n case 'NullLiteral':\n case 'DollarRef':\n case 'HashRef':\n // No identifiers to collect\n break;\n\n default:\n throw new Error(`Unknown AST node type: ${(ast as any).type}`);\n }\n}\n\n/**\n * Validate that all referenced identifiers exist in the input schema.\n *\n * This function checks that all input references in expressions are declared\n * in the input schema. It builds a set of expected input fields from the\n * flattened layout and compares it against the identifiers used in expressions.\n *\n * @param referencedIdentifiers - Set of identifiers used in expressions\n * @param context - The compilation context containing the input schema\n * @param location - Source location for error reporting\n * @throws CompilationError if any referenced input is not declared\n */\nexport function validateInputReferences(\n referencedIdentifiers: Set<string>,\n context: CompilationContext,\n location?: SourceLocation,\n): void {\n // Build a set of all expected input fields from the flattened layout\n const expectedInputs = new Set<string>();\n\n // Add all top-level fields (e.g., \"age\", \"name\", \"customer\")\n for (const field of context.inputLayout.fields) {\n const parts = field.path.split('.');\n expectedInputs.add(parts[0]); // Add the top-level field name\n\n // Also add the full path for cases like \"customer.age\"\n expectedInputs.add(field.path);\n }\n\n // Check each referenced identifier\n const missingInputs: string[] = [];\n\n for (const identifier of referencedIdentifiers) {\n // $ is the unary context variable in decision table cells, # is the iteration variable\n // in higher-order functions (map, filter, etc.). Both are implicit and don't need schema\n // declaration.\n if (identifier === '$' || identifier === '#') {\n continue;\n }\n\n // Check if this identifier is declared\n let found = false;\n // Check exact match first\n if (expectedInputs.has(identifier)) {\n found = true;\n } else {\n // Check if it's a prefix match (e.g., \"customer\" matches \"customer.age\")\n for (const expected of expectedInputs) {\n if (expected.startsWith(identifier + '.')) {\n found = true;\n break;\n }\n }\n }\n\n if (!found) {\n missingInputs.push(identifier);\n }\n }\n\n // If we found missing inputs, throw an error\n if (missingInputs.length > 0) {\n const missingList = missingInputs\n .sort()\n .map((id) => `\"${id}\"`)\n .join(', ');\n const message =\n missingInputs.length === 1\n ? `Input reference \"${missingInputs[0]}\" is not declared in the input schema`\n : `Input references are not declared in the input schema: ${missingList}`;\n\n throw new CompilationError(\n message,\n ErrorCode.UNKNOWN_FIELD,\n {\n ...location,\n field: 'inputs',\n },\n { missingInputs: missingInputs as any },\n );\n }\n}\n\n/**\n * Collect all output assignments from a decision.\n *\n * This function walks through all nodes in the decision and collects\n * the output paths that are assigned by expression nodes and decision table nodes.\n *\n * @param context - The compilation context\n * @returns Set of all output paths assigned by the decision\n */\nexport function collectOutputAssignments(\n context: CompilationContext,\n errorCollector?: ErrorCollector,\n): Set<string> {\n const assignedOutputs = new Set<string>();\n\n for (const node of context.jdm.nodes) {\n const nodeType = node.type;\n\n try {\n if (nodeType === 'expressionNode') {\n // Collect output assignments from expression nodes\n const expressions = node.content.expressions as Array<{ key: string; value: string }>;\n for (const expr of expressions) {\n assignedOutputs.add(expr.key);\n }\n } else if (nodeType === 'decisionTableNode') {\n // Collect output fields from decision table nodes\n const content = node.content as any;\n if (content.outputs) {\n for (const output of content.outputs) {\n if (output.field) {\n assignedOutputs.add(output.field);\n }\n }\n }\n }\n // Switch nodes and sub-decision nodes delegate to other nodes which will be processed\n // separately, so their outputs will be collected from those target nodes.\n } catch (error) {\n // Collect errors for batch reporting rather than swallowing them silently\n if (errorCollector) {\n const err =\n error instanceof CompilationError\n ? error\n : new CompilationError(\n `Failed to collect output assignments from node \"${node.name || node.id}\": ${error instanceof Error ? error.message : String(error)}`,\n ErrorCode.PARSE_ERROR,\n { nodeId: node.id, nodeName: node.name },\n );\n errorCollector.add(err);\n }\n }\n }\n\n return assignedOutputs;\n}\n\n/**\n * Validate that all expected outputs from the schema are assigned.\n *\n * This function checks that all output fields defined in the output schema\n * are actually assigned by the decision logic. It builds a set of expected\n * output fields from the flattened layout and compares it against the\n * outputs that are assigned by expression nodes and decision table nodes.\n *\n * @param assignedOutputs - Set of output paths assigned by the decision\n * @param context - The compilation context containing the output schema\n * @param location - Source location for error reporting\n * @throws CompilationError if any expected output is not assigned\n */\nexport function validateOutputReferences(\n assignedOutputs: Set<string>,\n context: CompilationContext,\n location?: SourceLocation,\n): void {\n // Build a set of all expected output fields from the flattened layout\n const expectedOutputs = new Set<string>();\n\n // Add all output fields from the layout\n for (const field of context.outputLayout.fields) {\n expectedOutputs.add(field.path);\n }\n\n // Check each expected output\n const missingOutputs: string[] = [];\n\n for (const output of expectedOutputs) {\n // Prefix matching handles nested object assignment - if schema expects \"customer\" but decision\n // assigns \"customer.name\" and \"customer.age\", those partial assignments satisfy the requirement\n let found = false;\n\n // Check exact match\n if (assignedOutputs.has(output)) {\n found = true;\n } else {\n // Check if any assigned output is a nested field of the expected output\n // e.g., if \"customer\" is expected and \"customer.name\" is assigned\n for (const assigned of assignedOutputs) {\n if (assigned.startsWith(output + '.')) {\n found = true;\n break;\n }\n }\n }\n\n if (!found) {\n missingOutputs.push(output);\n }\n }\n\n // If we found missing outputs, throw an error\n if (missingOutputs.length > 0) {\n const missingList = missingOutputs\n .sort()\n .map((field) => `\"${field}\"`)\n .join(', ');\n const message =\n missingOutputs.length === 1\n ? `Output field \"${missingOutputs[0]}\" is declared in the output schema but not assigned by the decision`\n : `Output fields are declared in the output schema but not assigned by the decision: ${missingList}`;\n\n throw new CompilationError(\n message,\n ErrorCode.UNKNOWN_FIELD,\n {\n ...location,\n field: 'outputs',\n },\n { missingOutputs: missingOutputs as any },\n );\n }\n}\n\n/**\n * Validate output assignments for all nodes in a decision.\n *\n * This is a convenience function that validates that all expected outputs\n * from the output schema are actually assigned by the decision logic.\n *\n * @param context - The compilation context\n * @throws CompilationError if any expected output is not assigned or if errors occur during collection\n */\nexport function validateAllOutputReferences(context: CompilationContext): void {\n const errorCollector = new ErrorCollector();\n\n // Collect all output assignments, gathering any errors\n const assignedOutputs = collectOutputAssignments(context, errorCollector);\n\n // Validate that all expected outputs are assigned\n try {\n validateOutputReferences(assignedOutputs, context);\n } catch (error) {\n if (error instanceof CompilationError) {\n errorCollector.add(error);\n } else {\n throw error;\n }\n }\n\n // Throw all collected errors (parse errors + validation errors)\n errorCollector.throwIfErrors();\n}\n\n/**\n * Validate input references for all expression nodes in a decision.\n *\n * This is a convenience function that validates all expressions in the decision\n * at once, collecting all errors before throwing.\n *\n * @param context - The compilation context\n * @throws CompilationError if any expression references an undeclared input or contains parse errors\n */\nexport function validateAllInputReferences(context: CompilationContext): void {\n const errorCollector = new ErrorCollector();\n const inputLayout = context.inputLayout;\n const expectedInputs = new Set<string>();\n\n // Build set of expected inputs\n for (const field of inputLayout.fields) {\n const parts = field.path.split('.');\n expectedInputs.add(parts[0]);\n expectedInputs.add(field.path);\n }\n\n // Collect all references and validate them\n const allIdentifiers = new Set<string>();\n\n // Helper to create a parse error with location context\n const createParseError = (\n nodeId: string,\n nodeName: string | undefined,\n expression: string,\n error: unknown,\n ): CompilationError => {\n if (error instanceof CompilationError) {\n // Preserve original error but add node context if missing\n if (!error.location?.nodeId) {\n return new CompilationError(error.message, error.code, { nodeId, nodeName }, error.context);\n }\n return error;\n }\n return new CompilationError(\n `Failed to parse expression \"${expression}\": ${error instanceof Error ? error.message : String(error)}`,\n ErrorCode.PARSE_ERROR,\n { nodeId, nodeName },\n );\n };\n\n // Process all nodes that contain expressions\n for (const node of context.jdm.nodes) {\n const nodeType = node.type;\n\n try {\n if (nodeType === 'expressionNode') {\n // Collect identifiers from all expressions in the node\n const expressions = node.content.expressions as Array<{ key: string; value: string }>;\n for (const expr of expressions) {\n try {\n const ast = context.parseExpression(expr.value);\n const identifiers = collectIdentifiers(ast);\n for (const id of identifiers) {\n allIdentifiers.add(id);\n }\n } catch (error) {\n errorCollector.add(createParseError(node.id, node.name, expr.value, error));\n }\n }\n } else if (nodeType === 'decisionTableNode') {\n // Collect identifiers from decision table conditions\n const content = node.content as any;\n if (content.rules) {\n for (const rule of content.rules) {\n if (rule.input) {\n for (const [_key, value] of Object.entries(rule.input as Record<string, string>)) {\n if (\n value &&\n typeof value === 'string' &&\n !['true', 'false', 'null'].includes(value.toLowerCase())\n ) {\n try {\n const ast = context.parseExpression(value);\n const identifiers = collectIdentifiers(ast);\n for (const id of identifiers) {\n allIdentifiers.add(id);\n }\n } catch (error) {\n // Collect parse errors for batch reporting\n errorCollector.add(createParseError(node.id, node.name, value, error));\n }\n }\n }\n }\n }\n }\n } else if (nodeType === 'switchNode') {\n // Collect identifiers from switch conditions\n const content = node.content as any;\n if (content.cases) {\n for (const switchCase of content.cases) {\n if (switchCase.condition && switchCase.condition.expression) {\n try {\n const ast = context.parseExpression(switchCase.condition.expression);\n const identifiers = collectIdentifiers(ast);\n for (const id of identifiers) {\n allIdentifiers.add(id);\n }\n } catch (error) {\n // Collect parse errors for batch reporting\n errorCollector.add(\n createParseError(node.id, node.name, switchCase.condition.expression, error),\n );\n }\n }\n }\n }\n }\n } catch (error) {\n // Collect errors from node processing for batch reporting\n const err =\n error instanceof CompilationError\n ? error\n : new CompilationError(\n `Failed to process node \"${node.name || node.id}\": ${error instanceof Error ? error.message : String(error)}`,\n ErrorCode.PARSE_ERROR,\n { nodeId: node.id, nodeName: node.name },\n );\n errorCollector.add(err);\n }\n }\n\n // Validate all collected identifiers\n try {\n validateInputReferences(allIdentifiers, context);\n } catch (error) {\n if (error instanceof CompilationError) {\n errorCollector.add(error);\n } else {\n throw error;\n }\n }\n\n // Throw all collected errors (parse errors + validation errors)\n errorCollector.throwIfErrors();\n}\n","/**\n * Switch branch detection algorithm for JDM decisions.\n *\n * This module identifies nodes that are exclusively reachable through switch node branches.\n * These nodes are marked as \"switchBranchTargets\" and should be skipped during the main\n * evaluation loop because the switch node evaluates them inline when taking a branch.\n *\n * WHY: Prevent double-evaluation - switch nodes evaluate branches inline, so downstream\n * nodes must be skipped in the main evaluation loop to avoid executing them twice.\n *\n * OPTIMIZATION: Uses a single forward traversal through the graph to mark all nodes\n * reachable from switch branches. This is O(n + m) instead of O(s × b × (n + m))\n * where s = switches, b = branches, n = nodes, m = edges.\n */\n\nimport type { JDMDecision, JDMEdge } from './parser';\n\n/**\n * Build an adjacency map for fast edge lookups.\n * Maps each source node ID to an array of target node IDs.\n *\n * @param edges - All edges in the decision graph\n * @returns Map from source node ID to array of target node IDs\n */\nfunction buildAdjacencyMap(edges: JDMEdge[]): Map<string, string[]> {\n const adjacencyMap = new Map<string, string[]>();\n\n for (const edge of edges) {\n const targets = adjacencyMap.get(edge.sourceId);\n if (targets) {\n targets.push(edge.targetId);\n } else {\n adjacencyMap.set(edge.sourceId, [edge.targetId]);\n }\n }\n\n return adjacencyMap;\n}\n\n/**\n * Find all nodes that are exclusively reachable through switch node branches.\n *\n * Optimized algorithm:\n * 1. Build adjacency map once for O(1) edge lookups\n * 2. Identify all direct targets of switch nodes\n * 3. Use BFS with efficient queue operations to traverse from all switch targets\n * 4. Marks all nodes reachable from switch branches in a single traversal\n *\n * Time complexity: O(n + m) where n = nodes, m = edges\n * Space complexity: O(n + m) for adjacency map and visited set\n *\n * @param jdm - The parsed JDM decision\n * @returns Set of node IDs that are switch branch targets\n */\nexport function findSwitchBranchTargets(jdm: JDMDecision): Set<string> {\n // Build adjacency map once for O(1) lookups instead of O(m) filtering\n const adjacencyMap = buildAdjacencyMap(jdm.edges);\n\n // Find all direct targets of switch nodes\n const switchNodes = jdm.nodes.filter((n) => n.type === 'switchNode');\n const switchBranchTargets = new Set<string>();\n\n // Collect all direct switch targets to start BFS from\n const bfsQueue: string[] = [];\n for (const switchNode of switchNodes) {\n const targets = adjacencyMap.get(switchNode.id) || [];\n for (const targetId of targets) {\n if (!switchBranchTargets.has(targetId)) {\n switchBranchTargets.add(targetId);\n bfsQueue.push(targetId);\n }\n }\n }\n\n // Single BFS traversal from all switch targets\n // Use index-based iteration instead of shift() to avoid O(n) array operations\n let queueIndex = 0;\n while (queueIndex < bfsQueue.length) {\n const currentId = bfsQueue[queueIndex++];\n\n // Get all outgoing edges using O(1) map lookup\n const targets = adjacencyMap.get(currentId) || [];\n for (const targetId of targets) {\n if (!switchBranchTargets.has(targetId)) {\n switchBranchTargets.add(targetId);\n bfsQueue.push(targetId);\n }\n }\n }\n\n return switchBranchTargets;\n}\n","/**\n * Result selection logic for JDM decisions.\n *\n * This module determines how to compute the final result from the evaluation order.\n * It handles different scenarios:\n * - Switch nodes that route to different branches\n * - Decision tables with collect-style hit policies\n * - PassThrough nodes that accumulate context\n * - Regular nodes that return their result directly\n */\n\nimport type { JDMNode } from './parser';\n\n/**\n * Check if a decision table node uses a collect-style hit policy.\n * Collect-style policies return arrays and need to be wrapped in an object with the node name as key.\n */\nexport function isCollectStyleHitPolicy(node: JDMNode): boolean {\n if (node.type !== 'decisionTableNode') {\n return false;\n }\n const hitPolicy = node.content?.hitPolicy || 'first';\n return ['collect', 'ruleOrder', 'outputOrder', 'priority'].includes(hitPolicy);\n}\n\n/**\n * Options for result code generation.\n */\nexport interface ResultSelectionOptions {\n /** Map of node IDs to JDMNode objects */\n nodeMap: Map<string, JDMNode>;\n /** Ordered list of node IDs that were actually evaluated (not skipped) */\n evaluatedNodes: string[];\n /** Set of node IDs that are switch branch targets (skipped in main loop) */\n switchBranchTargets: Set<string>;\n}\n\n/**\n * Determine which node's result should be used as the final output.\n *\n * Priority order:\n * 1. If there's a switch node, use its result (it handles routing)\n * 2. Otherwise, use the last non-input, non-output node result\n * 3. Fallback to output node or null\n *\n * @param options - The selection options\n * @returns The node to use for the final result, or null if fallback needed\n */\nexport function selectResultNode(options: ResultSelectionOptions): JDMNode | null {\n const { nodeMap, evaluatedNodes } = options;\n\n // Check if there's a switch node that routes to different branches\n // Only switch nodes truly route - decision tables in a linear flow are NOT routing nodes\n const switchNodes = evaluatedNodes.filter((id) => {\n const node = nodeMap.get(id);\n return node && node.type === 'switchNode';\n });\n\n // When there are switch nodes, use the switch result since it handles branch evaluation\n if (switchNodes.length > 0) {\n // Use the last switch node's result (it handles branch routing to terminal nodes)\n const lastSwitchNodeId = switchNodes[switchNodes.length - 1];\n return nodeMap.get(lastSwitchNodeId) || null;\n }\n\n // Use the last evaluated node\n if (evaluatedNodes.length > 0) {\n const lastNodeId = evaluatedNodes[evaluatedNodes.length - 1];\n return nodeMap.get(lastNodeId) || null;\n }\n\n return null;\n}\n\n/**\n * Generate AssemblyScript code to extract the final result from a node.\n *\n * Handles:\n * - Collect-style hit policies (return array directly)\n * - PassThrough nodes (return accumulated context)\n * - Regular nodes (return node result directly)\n *\n * @param node - The node to generate result code for\n * @returns AssemblyScript code string\n */\nexport function generateResultCode(node: JDMNode): string {\n // COLLECT-style hit policies return arrays directly (not wrapped in an object with the\n // node name as key) to match zen-engine behavior where the array IS the result\n if (isCollectStyleHitPolicy(node)) {\n return ` let result = ctx.get(\"$nodes.${node.name}\");`;\n }\n\n // If the node has passThrough enabled, return the accumulated context\n // This includes all values from previous nodes that were merged via passThrough\n //\n // Both 'no match with passThrough' and 'valid result' return Objects, so we use\n // the __passthrough marker a marker to distinguish these cases while maintaining\n // type safety.\n const hasPassThrough = node.content?.passThrough === true;\n if (hasPassThrough) {\n return ` // Check node result for passThrough handling\n let __nodeResult = ctx.get(\"$nodes.${node.name}\");\n let result: Value;\n \n // Check if this is a \"passthrough signal\" (no match with passThrough enabled)\n if (!__nodeResult.isNull() && __nodeResult.isObject()) {\n let __obj = __nodeResult.asObject();\n if (__obj.has(\"__passthrough\") && __obj.get(\"__passthrough\").asBool()) {\n // Node signaled to use passthrough - return accumulated context\n let __finalResult = new Map<string, Value>();\n const __ctxKeys = ctx.data.keys();\n for (let __i = 0; __i < __ctxKeys.length; __i++) {\n const __key = __ctxKeys[__i];\n if (!__key.startsWith(\"$\") && __key !== \"#\" && __key !== \"acc\") {\n __finalResult.set(__key, ctx.data.get(__key));\n }\n }\n result = Value.Object(__finalResult);\n } else {\n // Valid result - build from accumulated context (passThrough merges input with output)\n let __finalResult = new Map<string, Value>();\n const __ctxKeys = ctx.data.keys();\n for (let __i = 0; __i < __ctxKeys.length; __i++) {\n const __key = __ctxKeys[__i];\n if (!__key.startsWith(\"$\") && __key !== \"#\" && __key !== \"acc\") {\n __finalResult.set(__key, ctx.data.get(__key));\n }\n }\n result = Value.Object(__finalResult);\n }\n } else if (__nodeResult.isNull()) {\n // Node returned null (error case) - return null, don't passthrough\n result = Value.Null();\n } else {\n // Non-object result - return as-is\n result = __nodeResult;\n }`;\n }\n\n return ` let result = ctx.get(\"$nodes.${node.name}\");`;\n}\n\n/**\n * Generate fallback result code when no suitable node is found.\n *\n * @param outputNodeIds - Set of output node IDs\n * @param sanitizeId - Function to sanitize node IDs for code generation\n * @returns AssemblyScript code string\n */\nexport function generateFallbackResultCode(\n outputNodeIds: Set<string>,\n sanitizeId: (id: string) => string,\n): string {\n if (outputNodeIds.size > 0) {\n // Fallback: evaluate output node if no other nodes were evaluated\n const outputNodeId = Array.from(outputNodeIds)[0];\n const sanitizedOutputId = sanitizeId(outputNodeId);\n return ` let result = evaluateNode_${sanitizedOutputId}(ctx);`;\n }\n return ' let result = Value.Null();';\n}\n","/**\n * Main compilation orchestrator for JDM decisions.\n *\n * This module coordinates the compilation pipeline, bringing together:\n * - Graph building and topological ordering\n * - Node compilation\n * - Switch branch detection\n * - Result selection\n * - Memory layout code generation\n *\n * The orchestrator itself does minimal work - it delegates to specialized modules\n * for each concern.\n */\n\nimport type { JDMDecision, JDMNode } from './parser';\nimport type { CompilationContext, AssemblyScriptCode } from './types';\nimport { buildGraph, getEvaluationOrder } from './graph';\nimport { compileInputNode, compileOutputNode } from './nodes/input';\nimport { compileDecisionTableNode } from './nodes/decision-table';\nimport { compileSwitchNode } from './nodes/switch';\nimport { compileDecisionNode } from './nodes/decision';\nimport { compileExpressionNode } from './nodes/expression';\nimport { compileFunctionNode } from './nodes/function';\nimport { sanitizeId } from './utils';\nimport { validateAllInputReferences, validateAllOutputReferences } from './compile-time-validation';\nimport { generatePassThroughMergeCode, generateNestedPathAssignment } from './code-generators';\nimport { findSwitchBranchTargets } from './switch-branch-detection';\nimport {\n selectResultNode,\n generateResultCode,\n generateFallbackResultCode,\n} from './result-selection';\n\n// ============================================================================\n// Memory Layout Constants\n// ============================================================================\n\n/**\n * Custom heap start offset in bytes (512KB).\n *\n * The custom heap starts at 512KB to avoid conflicts with:\n * 1. AssemblyScript's internal runtime heap (~50KB - ~192KB)\n * 2. Host-written input buffer region (192KB - 512KB, up to 320KB)\n *\n * This ensures clear separation of memory regions and prevents\n * the AS runtime from interfering with our custom heap allocator.\n * Host must grow memory to at least 768KB to use this layout.\n */\nconst CUSTOM_HEAP_START_BYTES = 512 * 1024;\n\n/**\n * Compile a JDM decision to AssemblyScript code.\n *\n * This function orchestrates compilation of all nodes in the decision graph\n * and generates the complete AssemblyScript module.\n *\n * @param jdm - The parsed JDM decision\n * @param context - The compilation context\n * @returns Generated AssemblyScript code\n */\nexport function compileDecision(jdm: JDMDecision, context: CompilationContext): AssemblyScriptCode {\n // Build the graph\n const graph = buildGraph(jdm);\n\n // Get nodes in topological order to ensure dependencies are compiled before dependents\n const evaluationOrder = getEvaluationOrder(graph);\n\n // Validate references if enabled\n if (context.options.validate !== false) {\n validateAllInputReferences(context);\n validateAllOutputReferences(context);\n }\n\n // Create a node lookup for quick access\n const nodeMap = new Map(jdm.nodes.map((n) => [n.id, n]));\n\n // Compile each node based on its type\n const compiledCode = compileNodes(evaluationOrder, nodeMap, context);\n\n // Generate helper functions for higher-order operations\n const helperFunctionsCode = Array.from(context.helperFunctions.values()).join('\\n');\n\n // Find nodes that are switch branch targets (should be skipped in main evaluation)\n const switchBranchTargets = findSwitchBranchTargets(jdm);\n\n // Generate evaluation code for each node in topological order\n const evaluationCode = generateEvaluationCode(evaluationOrder, nodeMap, switchBranchTargets);\n\n // Find output nodes (nodes with no outgoing edges)\n const outputNodeIds = findOutputNodeIds(jdm);\n\n // Find evaluated nodes (excluding input, output, and switch branch targets)\n const evaluatedNodes = filterEvaluatedNodes(evaluationOrder, nodeMap, switchBranchTargets);\n\n // Generate result selection code\n const resultCode = generateResultSelectionCode(nodeMap, evaluatedNodes, outputNodeIds);\n\n // Generate the complete AssemblyScript module\n return generateModuleCode(helperFunctionsCode, compiledCode, evaluationCode, resultCode);\n}\n\n/**\n * Compile all nodes in evaluation order.\n */\nfunction compileNodes(\n evaluationOrder: string[],\n nodeMap: Map<string, JDMNode>,\n context: CompilationContext,\n): string {\n let compiledCode = '';\n\n for (const nodeId of evaluationOrder) {\n const node = nodeMap.get(nodeId);\n if (!node) {\n continue;\n }\n\n const nodeType = node.type;\n\n switch (nodeType) {\n case 'inputNode':\n compiledCode += compileInputNode(node, context);\n break;\n case 'decisionTableNode':\n compiledCode += compileDecisionTableNode(node, context);\n break;\n case 'switchNode':\n compiledCode += compileSwitchNode(node, context);\n break;\n case 'decisionNode':\n compiledCode += compileDecisionNode(node, context);\n break;\n case 'outputNode':\n compiledCode += compileOutputNode(node, context);\n break;\n case 'expressionNode':\n compiledCode += compileExpressionNode(node, context);\n break;\n case 'functionNode':\n compiledCode += compileFunctionNode(node, context);\n break;\n default:\n // Unknown node type - skip\n break;\n }\n }\n\n return compiledCode;\n}\n\n/**\n * Generate evaluation code for each node in topological order.\n * Skips output nodes and switch branch targets.\n */\nfunction generateEvaluationCode(\n evaluationOrder: string[],\n nodeMap: Map<string, JDMNode>,\n switchBranchTargets: Set<string>,\n): string {\n return evaluationOrder\n .map((nodeId) => {\n const node = nodeMap.get(nodeId);\n if (!node || node.type === 'outputNode') {\n return '';\n }\n\n // Skip nodes that are switch branch targets - they'll be evaluated by the switch\n if (switchBranchTargets.has(nodeId)) {\n return '';\n }\n\n return generateNodeEvaluationCode(node);\n })\n .filter(Boolean)\n .join('\\n');\n}\n\n/**\n * Generate evaluation code for a single node.\n */\nfunction generateNodeEvaluationCode(node: JDMNode): string {\n const sanitizedId = sanitizeId(node.id);\n\n // Check if this node has passThrough enabled (decision tables and expression nodes)\n const hasPassThrough = node.content?.passThrough === true;\n\n // Store node result in context under $nodes.<nodeName>\n let code = ` ctx.set(\"$nodes.${node.name}\", evaluateNode_${sanitizedId}(ctx));`;\n\n // Handle outputPath - if specified, store the result at the given path\n // This is used for collect-style decision tables to place array results at a nested path\n const outputPath = node.content?.outputPath;\n if (outputPath) {\n // Check if it's a simple (non-nested) path or a nested path\n if (!outputPath.includes('.')) {\n // Simple path - just set directly in context\n code += `\n // Store node output at outputPath: ${outputPath} (simple path)\n ctx.set(\"${outputPath}\", ctx.get(\"$nodes.${node.name}\"));`;\n } else {\n // Nested path - use shared helper to generate nested object structure\n code += `\n ${generateNestedPathAssignment(outputPath, `ctx.get(\"$nodes.${node.name}\")`)}`;\n }\n }\n\n // If passThrough is enabled, merge the node's output properties back into the context\n // This allows subsequent nodes to access the computed values directly\n if (hasPassThrough) {\n code += `\\n ${generatePassThroughMergeCode(node.name)}`;\n }\n\n return code;\n}\n\n/**\n * Find output node IDs (nodes with no outgoing edges).\n */\nfunction findOutputNodeIds(jdm: JDMDecision): Set<string> {\n const outputNodeIds = new Set<string>();\n for (const node of jdm.nodes) {\n const outgoingEdges = jdm.edges.filter((e) => e.sourceId === node.id);\n if (outgoingEdges.length === 0) {\n outputNodeIds.add(node.id);\n }\n }\n return outputNodeIds;\n}\n\n/**\n * Filter evaluation order to get only nodes that were actually evaluated.\n */\nfunction filterEvaluatedNodes(\n evaluationOrder: string[],\n nodeMap: Map<string, JDMNode>,\n switchBranchTargets: Set<string>,\n): string[] {\n return evaluationOrder.filter((id) => {\n const node = nodeMap.get(id);\n if (!node) {\n return false;\n }\n // Exclude input and output nodes\n if (node.type === 'inputNode' || node.type === 'outputNode') {\n return false;\n }\n // Exclude switch branch targets - they're evaluated by the switch\n if (switchBranchTargets.has(id)) {\n return false;\n }\n return true;\n });\n}\n\n/**\n * Generate code to select and extract the final result.\n */\nfunction generateResultSelectionCode(\n nodeMap: Map<string, JDMNode>,\n evaluatedNodes: string[],\n outputNodeIds: Set<string>,\n): string {\n // Use the result-selection module to determine which node's result to use\n const resultNode = selectResultNode({\n nodeMap,\n evaluatedNodes,\n switchBranchTargets: new Set(), // Already filtered out\n });\n\n if (resultNode) {\n return generateResultCode(resultNode);\n }\n\n return generateFallbackResultCode(outputNodeIds, sanitizeId);\n}\n\n/**\n * Generate the complete AssemblyScript module code.\n */\nfunction generateModuleCode(\n helperFunctionsCode: string,\n compiledCode: string,\n evaluationCode: string,\n resultCode: string,\n): string {\n return `\nimport { Value } from './values';\nimport { Context, ScopedContext } from './context';\nimport {\n addValues,\n subtractValues,\n multiplyValues,\n divideValues,\n moduloValues,\n powerValues,\n negateValue,\n valuesEqual,\n compareValues,\n getProperty,\n getIndex,\n valueIn,\n createInterval,\n evaluateFunction,\n makeArgs1,\n makeArgs2,\n makeArgs3\n} from './expressions';\nimport { SetLastError, SetLastErrorWithMessage, hasError, RuntimeErrorCode, initializeMemoryLayout, resetHeap } from './memory';\nimport { readValueMap, writeValue } from './arrays';\n\n${helperFunctionsCode}\n\n${compiledCode}\n\n// Main entry point for the compiled decision\n// Input: pointer to input data in WASM memory (serialized Map<string, Value>)\n// Returns: pointer to output data in WASM memory (serialized Value)\nexport function evaluate(inputPtr: usize): usize {\n // Initialize memory layout for custom heap (used for output marshaling)\n // Memory regions (from 0):\n // +--------------------------+\n // | Static data | 0 - ~50KB (AS's __heap_base)\n // +--------------------------+\n // | AS runtime heap | ~50KB - ~192KB (grows upward during evaluation)\n // +--------------------------+\n // | Input data buffer | 192KB - 512KB (written by host, up to 320KB)\n // +--------------------------+\n // | Custom heap (ours) | 512KB - (used for writeValue/marshaling)\n // +--------------------------+\n // The custom heap starts at 512KB to avoid conflicts with AS's internal heap\n // and the host-written input buffer. Host must grow memory to at least 768KB.\n initializeMemoryLayout(${CUSTOM_HEAP_START_BYTES}, 0);\n\n // Reset heap for fresh evaluation\n resetHeap();\n\n // Read input from memory\n let input = readValueMap(inputPtr);\n\n // Create context with input data\n let ctx = new Context(input);\n\n // Evaluate the decision graph in topological order\n${evaluationCode}\n\n // Get the final result\n${resultCode}\n // Write result to output memory and return pointer\n return writeValue(result);\n}\n`;\n}\n","/**\n * Caches compiled WASM modules keyed by source code + runtime + compiler options.\n * WASM compilation via AssemblyScript is expensive (~250ms per decision), so caching\n * identical compilations significantly improves the speed of iterative development\n * and testing.\n */\n\nimport { createHash } from 'crypto';\nimport {\n existsSync,\n mkdirSync,\n readFileSync,\n writeFileSync,\n readdirSync,\n statSync,\n unlinkSync,\n} from 'fs';\nimport { join, dirname } from 'path';\n\n// Import runtime source strings to include in cache key\nimport {\n RUNTIME_VALUES,\n RUNTIME_CONTEXT,\n RUNTIME_EXPRESSIONS,\n RUNTIME_TABLES,\n RUNTIME_MEMORY,\n RUNTIME_STRINGS,\n RUNTIME_ARRAYS,\n} from './runtime/index';\n\n// Package version - included in cache key to invalidate cache across compiler versions\nlet packageVersion: string = '';\n\nfunction getPackageVersion(): string {\n if (packageVersion === '') {\n try {\n // Try to find package.json from this file's location\n const packagePath = join(dirname(__dirname), '..', 'package.json');\n const pkg = JSON.parse(readFileSync(packagePath, 'utf-8'));\n packageVersion = pkg.version || 'unknown';\n } catch {\n packageVersion = 'unknown';\n }\n }\n return packageVersion;\n}\n\n/**\n * Cache directory location\n */\nfunction getCacheDir(): string {\n // Use node_modules/.cache/jdm-asm for caching\n // This is a common convention and gets cleaned up with node_modules\n const cacheDir = join(process.cwd(), 'node_modules', '.cache', 'jdm-asm');\n return cacheDir;\n}\n\n/**\n * Ensure the cache directory exists\n * @throws Error if directory creation fails\n */\nfunction ensureCacheDir(): string {\n const cacheDir = getCacheDir();\n if (!existsSync(cacheDir)) {\n try {\n mkdirSync(cacheDir, { recursive: true });\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to create cache directory at ${cacheDir}: ${errorMsg}`);\n }\n }\n return cacheDir;\n}\n\n/**\n * Compute a stable hash for cache key.\n */\nexport function computeCacheKey(\n assemblyScriptCode: string,\n options: { optimize?: boolean; debug?: boolean },\n): string {\n const hash = createHash('sha256');\n\n // Include package version\n hash.update(`version:${getPackageVersion()}\\n`);\n\n // Include compiler options\n hash.update(`optimize:${options.optimize ?? true}\\n`);\n hash.update(`debug:${options.debug ?? false}\\n`);\n\n // Include all runtime source files: runtime code changes affect WASM output, so\n // must be part of cache key\n hash.update('---RUNTIME_VALUES---\\n');\n hash.update(RUNTIME_VALUES);\n hash.update('---RUNTIME_CONTEXT---\\n');\n hash.update(RUNTIME_CONTEXT);\n hash.update('---RUNTIME_EXPRESSIONS---\\n');\n hash.update(RUNTIME_EXPRESSIONS);\n hash.update('---RUNTIME_TABLES---\\n');\n hash.update(RUNTIME_TABLES);\n hash.update('---RUNTIME_MEMORY---\\n');\n hash.update(RUNTIME_MEMORY);\n hash.update('---RUNTIME_STRINGS---\\n');\n hash.update(RUNTIME_STRINGS);\n hash.update('---RUNTIME_ARRAYS---\\n');\n hash.update(RUNTIME_ARRAYS);\n\n // Include the generated AssemblyScript code\n hash.update('---ASSEMBLYSCRIPT---\\n');\n hash.update(assemblyScriptCode);\n\n // Return first 32 characters of hex digest (128 bits - sufficient for cache key)\n return hash.digest('hex').slice(0, 32);\n}\n\n/**\n * Cache entry format\n */\ninterface CacheEntry {\n version: string;\n timestamp: number;\n binary: string; // Base64 encoded WASM binary\n wat: string;\n}\n\n/**\n * Read cached WASM compilation result from disk if available\n */\nexport function readCacheFromDisk(cacheKey: string): { binary: Uint8Array; wat: string } | null {\n const cacheDir = getCacheDir();\n const cachePath = join(cacheDir, `${cacheKey}.json`);\n\n if (!existsSync(cachePath)) {\n return null;\n }\n\n try {\n const content = readFileSync(cachePath, 'utf-8');\n const entry: CacheEntry = JSON.parse(content);\n\n // Version changes invalidate cache to prevent incompatible compiled code from being used\n // when the compiler implementation changes between releases\n if (entry.version !== getPackageVersion()) {\n // Version mismatch, invalidate\n unlinkSync(cachePath);\n return null;\n }\n\n // Decode binary from base64\n const binary = new Uint8Array(Buffer.from(entry.binary, 'base64'));\n return { binary, wat: entry.wat };\n } catch (error) {\n // Distinguish between different error types for better diagnostics\n if (error && typeof error === 'object' && 'code' in error) {\n const code = (error as { code: string }).code;\n\n // ENOENT (file not found) is benign - cache miss\n if (code === 'ENOENT') {\n return null;\n }\n\n // EACCES/EPERM (permission denied) should warn the user\n if (code === 'EACCES' || code === 'EPERM') {\n const errorMsg = error instanceof Error ? error.message : String(error);\n console.warn(\n `[jdm-asm] Warning: Cache file exists but cannot be read due to permissions: ${cachePath}\\n${errorMsg}`,\n );\n return null;\n }\n }\n\n // Cache corruption or other errors are benign since we can regenerate the result.\n // Failing fast would hurt UX when cache is just a performance optimization, not critical.\n // Try to clean up corrupted cache file\n try {\n unlinkSync(cachePath);\n } catch (cleanupError) {\n // If we can't delete it, just warn (might be permission issue)\n if (cleanupError && typeof cleanupError === 'object' && 'code' in cleanupError) {\n const code = (cleanupError as { code: string }).code;\n if (code === 'EACCES' || code === 'EPERM') {\n console.warn(\n `[jdm-asm] Warning: Cannot clean up corrupted cache file (permission denied): ${cachePath}`,\n );\n }\n }\n }\n return null;\n }\n}\n\n/**\n * Write compilation result to disk cache\n * Failures are logged as warnings but do not throw since caching is optional\n */\nexport function writeCacheToDisk(\n cacheKey: string,\n result: { binary: Uint8Array; wat: string },\n): void {\n try {\n const cacheDir = ensureCacheDir();\n const cachePath = join(cacheDir, `${cacheKey}.json`);\n\n const entry: CacheEntry = {\n version: getPackageVersion(),\n timestamp: Date.now(),\n binary: Buffer.from(result.binary).toString('base64'),\n wat: result.wat,\n };\n\n writeFileSync(cachePath, JSON.stringify(entry));\n } catch (error) {\n // Cache write failures should not break compilation since caching is a performance\n // optimization, not a requirement. Warn the user so they know cache isn't working.\n const errorMsg = error instanceof Error ? error.message : String(error);\n\n // Provide more specific guidance for common errors\n if (error && typeof error === 'object' && 'code' in error) {\n const code = (error as { code: string }).code;\n\n if (code === 'ENOSPC') {\n console.warn(`[jdm-asm] Warning: Failed to write cache (disk full): ${errorMsg}`);\n } else if (code === 'EACCES' || code === 'EPERM' || code === 'EROFS') {\n console.warn(\n `[jdm-asm] Warning: Failed to write cache (permission denied or read-only filesystem): ${errorMsg}`,\n );\n } else {\n console.warn(`[jdm-asm] Warning: Failed to write cache: ${errorMsg}`);\n }\n } else {\n console.warn(`[jdm-asm] Warning: Failed to write cache: ${errorMsg}`);\n }\n }\n}\n\n/**\n * Get the cache directory path\n * Exposes where compiled WASM modules are stored on disk\n */\nexport function getCacheDirectory(): string {\n return getCacheDir();\n}\n\n/**\n * Get cache health diagnostics\n * Returns information about cache status, any issues, and recent operations\n */\nexport function getCacheHealth(): {\n enabled: boolean;\n directory: string;\n directoryExists: boolean;\n accessible: boolean;\n stats: {\n entries: number;\n totalSize: number;\n oldestEntry: number | null;\n newestEntry: number | null;\n };\n issues: string[];\n} {\n const enabled = isCacheEnabled();\n const directory = getCacheDir();\n const directoryExists = existsSync(directory);\n const issues: string[] = [];\n\n // Check if cache is disabled\n if (!enabled) {\n issues.push('Cache is disabled via JDM_ASM_NO_CACHE environment variable');\n }\n\n // Check if directory exists\n if (enabled && !directoryExists) {\n issues.push('Cache directory does not exist yet (will be created on first write)');\n }\n\n // Check if directory is accessible\n let accessible = false;\n if (directoryExists) {\n try {\n // Try to read the directory to check accessibility\n readdirSync(directory);\n accessible = true;\n } catch (error) {\n accessible = false;\n issues.push(\n `Cache directory exists but is not accessible: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n\n // Get cache stats if accessible\n const stats = accessible\n ? getCacheStats()\n : {\n entries: 0,\n totalSize: 0,\n oldestEntry: null,\n newestEntry: null,\n };\n\n return {\n enabled,\n directory,\n directoryExists,\n accessible,\n stats,\n issues,\n };\n}\n\n/**\n * Clear the entire cache\n */\nexport function clearCache(): void {\n const cacheDir = getCacheDir();\n if (!existsSync(cacheDir)) {\n return;\n }\n\n const files = readdirSync(cacheDir);\n for (const file of files) {\n if (file.endsWith('.json')) {\n try {\n unlinkSync(join(cacheDir, file));\n } catch {}\n }\n }\n}\n\n/**\n * Get cache statistics\n */\nexport function getCacheStats(): {\n entries: number;\n totalSize: number;\n oldestEntry: number | null;\n newestEntry: number | null;\n} {\n const cacheDir = getCacheDir();\n if (!existsSync(cacheDir)) {\n return { entries: 0, totalSize: 0, oldestEntry: null, newestEntry: null };\n }\n\n const files = readdirSync(cacheDir).filter((f) => f.endsWith('.json'));\n let totalSize = 0;\n let oldestEntry: number | null = null;\n let newestEntry: number | null = null;\n\n for (const file of files) {\n const stat = statSync(join(cacheDir, file));\n totalSize += stat.size;\n\n const mtime = stat.mtimeMs;\n if (oldestEntry === null || mtime < oldestEntry) {\n oldestEntry = mtime;\n }\n if (newestEntry === null || mtime > newestEntry) {\n newestEntry = mtime;\n }\n }\n\n return { entries: files.length, totalSize, oldestEntry, newestEntry };\n}\n\n/**\n * Prune old cache entries (keep most recent N entries or entries younger than maxAge)\n */\nexport function pruneCache(\n options: {\n maxEntries?: number;\n maxAgeMs?: number;\n } = {},\n): number {\n const { maxEntries = 100, maxAgeMs = 7 * 24 * 60 * 60 * 1000 } = options; // Default: 100 entries, 7 days\n const cacheDir = getCacheDir();\n\n if (!existsSync(cacheDir)) {\n return 0;\n }\n\n const files = readdirSync(cacheDir)\n .filter((f) => f.endsWith('.json'))\n .map((f) => {\n const stat = statSync(join(cacheDir, f));\n return { name: f, mtime: stat.mtimeMs };\n })\n .sort((a, b) => b.mtime - a.mtime); // Sort by newest first\n\n const now = Date.now();\n let removed = 0;\n\n for (let i = 0; i < files.length; i++) {\n const file = files[i];\n const age = now - file.mtime;\n\n // Remove if exceeds max entries or max age\n if (i >= maxEntries || age > maxAgeMs) {\n try {\n unlinkSync(join(cacheDir, file.name));\n removed++;\n } catch {}\n }\n }\n\n return removed;\n}\n\n/**\n * Check if caching is enabled\n * Can be disabled via JDM_ASM_NO_CACHE=1 environment variable\n */\nexport function isCacheEnabled(): boolean {\n return process.env.JDM_ASM_NO_CACHE !== '1';\n}\n","export const RUNTIME_VALUES = \"// assembly/runtime/values.ts\\n// Type tags for runtime type checking\\nexport const TYPE_NULL: i32 = 0;\\nexport const TYPE_BOOL: i32 = 1;\\nexport const TYPE_INT: i32 = 2;\\nexport const TYPE_FLOAT: i32 = 3;\\nexport const TYPE_STRING: i32 = 4;\\nexport const TYPE_ARRAY: i32 = 5;\\nexport const TYPE_OBJECT: i32 = 6;\\n\\n// Pre-allocated singleton values for frequently used immutable types.\\n// This avoids allocations in hot paths for null/boolean/small integer/common float values.\\nlet _nullSingleton: Value | null = null;\\nlet _trueSingleton: Value | null = null;\\nlet _falseSingleton: Value | null = null;\\nlet _emptyStringSingleton: Value | null = null;\\nlet _zeroFloatSingleton: Value | null = null;\\nlet _oneFloatSingleton: Value | null = null;\\n\\n// Cache for small integers (-1 to 10) - covers common array indices, loop counters, etc.\\n// Using 12-element array: index 0 = -1, index 1 = 0, ..., index 11 = 10\\nconst SMALL_INT_CACHE_MIN: i64 = -1;\\nconst SMALL_INT_CACHE_MAX: i64 = 10;\\nconst SMALL_INT_CACHE_SIZE: i32 = 12;\\nlet _smallIntCache: StaticArray<Value | null> | null = null;\\n\\n/**\\n * Tagged union for dynamic JSON-like values.\\n * Only one field is valid based on the `type` tag.\\n */\\nexport class Value {\\n type: i32 = TYPE_NULL;\\n boolVal: bool = false;\\n intVal: i64 = 0;\\n floatVal: f64 = 0.0;\\n stringVal: string | null = null;\\n arrayVal: Array<Value> | null = null;\\n objectVal: Map<string, Value> | null = null;\\n\\n static Null(): Value {\\n // Return singleton null value to avoid allocations\\n if (_nullSingleton === null) {\\n const v = new Value();\\n v.type = TYPE_NULL;\\n _nullSingleton = v;\\n }\\n return _nullSingleton!;\\n }\\n\\n static Bool(val: bool): Value {\\n // Return singleton boolean values to avoid allocations\\n if (val) {\\n if (_trueSingleton === null) {\\n const v = new Value();\\n v.type = TYPE_BOOL;\\n v.boolVal = true;\\n _trueSingleton = v;\\n }\\n return _trueSingleton!;\\n } else {\\n if (_falseSingleton === null) {\\n const v = new Value();\\n v.type = TYPE_BOOL;\\n v.boolVal = false;\\n _falseSingleton = v;\\n }\\n return _falseSingleton!;\\n }\\n }\\n\\n static Int(val: i64): Value {\\n // Fast path for common small integers to avoid allocations\\n if (val >= SMALL_INT_CACHE_MIN && val <= SMALL_INT_CACHE_MAX) {\\n if (_smallIntCache === null) {\\n _smallIntCache = new StaticArray<Value | null>(SMALL_INT_CACHE_SIZE);\\n }\\n const idx = <i32>(val - SMALL_INT_CACHE_MIN);\\n if (unchecked(_smallIntCache![idx]) === null) {\\n const v = new Value();\\n v.type = TYPE_INT;\\n v.intVal = val;\\n unchecked((_smallIntCache![idx] = v));\\n }\\n return unchecked(_smallIntCache![idx])!;\\n }\\n const v = new Value();\\n v.type = TYPE_INT;\\n v.intVal = val;\\n return v;\\n }\\n\\n static Float(val: f64): Value {\\n // Fast path for common float values (0.0, 1.0) to avoid allocations\\n if (val == 0.0) {\\n if (_zeroFloatSingleton === null) {\\n const v = new Value();\\n v.type = TYPE_FLOAT;\\n v.floatVal = 0.0;\\n _zeroFloatSingleton = v;\\n }\\n return _zeroFloatSingleton!;\\n }\\n if (val == 1.0) {\\n if (_oneFloatSingleton === null) {\\n const v = new Value();\\n v.type = TYPE_FLOAT;\\n v.floatVal = 1.0;\\n _oneFloatSingleton = v;\\n }\\n return _oneFloatSingleton!;\\n }\\n const v = new Value();\\n v.type = TYPE_FLOAT;\\n v.floatVal = val;\\n return v;\\n }\\n\\n static String(val: string): Value {\\n // Fast path for empty string to avoid allocations\\n if (val.length == 0) {\\n if (_emptyStringSingleton === null) {\\n const v = new Value();\\n v.type = TYPE_STRING;\\n v.stringVal = '';\\n _emptyStringSingleton = v;\\n }\\n return _emptyStringSingleton!;\\n }\\n const v = new Value();\\n v.type = TYPE_STRING;\\n v.stringVal = val;\\n return v;\\n }\\n\\n static Array(val: Array<Value>): Value {\\n const v = new Value();\\n v.type = TYPE_ARRAY;\\n v.arrayVal = val;\\n return v;\\n }\\n\\n static Object(val: Map<string, Value>): Value {\\n const v = new Value();\\n v.type = TYPE_OBJECT;\\n v.objectVal = val;\\n return v;\\n }\\n\\n // Type checking\\n isNull(): bool {\\n return this.type == TYPE_NULL;\\n }\\n isBool(): bool {\\n return this.type == TYPE_BOOL;\\n }\\n isNumber(): bool {\\n return this.type == TYPE_INT || this.type == TYPE_FLOAT;\\n }\\n isString(): bool {\\n return this.type == TYPE_STRING;\\n }\\n isArray(): bool {\\n return this.type == TYPE_ARRAY;\\n }\\n isObject(): bool {\\n return this.type == TYPE_OBJECT;\\n }\\n\\n // Returning defaults (0, false, \\\"\\\") instead of throwing errors provides more\\n // forgiving evaluation semantics matching JavaScript's type coercion behavior.\\n asBool(): bool {\\n return this.type == TYPE_BOOL ? this.boolVal : false;\\n }\\n asInt(): i64 {\\n return this.type == TYPE_INT ? this.intVal : 0;\\n }\\n asFloat(): f64 {\\n if (this.type == TYPE_FLOAT) return this.floatVal;\\n if (this.type == TYPE_INT) return <f64>this.intVal;\\n return 0.0;\\n }\\n asString(): string {\\n // Convert value to string representation\\n if (this.type == TYPE_STRING && this.stringVal != null) return this.stringVal!;\\n if (this.type == TYPE_NULL) return '';\\n if (this.type == TYPE_BOOL) return this.boolVal ? 'true' : 'false';\\n if (this.type == TYPE_INT) return this.intVal.toString();\\n if (this.type == TYPE_FLOAT) {\\n // JavaScript developers expect \\\"3\\\" not \\\"3.0\\\" for integer-valued floats. We check if\\n // the float is exactly representable as i64 (no fractional part, within range) and\\n // format as integer in that case. Otherwise use AS's default float formatting.\\n const f = this.floatVal;\\n // Check if it's an integer\\n if (f == <f64>(<i64>f) && f >= <f64>i64.MIN_VALUE && f <= <f64>i64.MAX_VALUE) {\\n return (<i64>f).toString();\\n }\\n return f.toString();\\n }\\n return '';\\n }\\n asArray(): Array<Value> {\\n return this.arrayVal != null ? this.arrayVal! : new Array<Value>();\\n }\\n asObject(): Map<string, Value> {\\n return this.objectVal != null ? this.objectVal! : new Map<string, Value>();\\n }\\n}\\n\\nexport type Result = Map<string, Value>;\\n\";\nexport const RUNTIME_CONTEXT = \"// assembly/runtime/context.ts (AssemblyScript)\\nimport { Value, TYPE_OBJECT } from './values';\\n\\n/**\\n * Stores cached path resolution metadata to avoid redundant string splitting\\n * and prefix matching on frequently-accessed paths.\\n */\\nclass PathResolutionCache {\\n // Cache entry: stores the matched prefix key, its length, and the split parts for a given path\\n prefixKey: string;\\n prefixLen: i32;\\n parts: string[];\\n\\n constructor(prefixKey: string, prefixLen: i32, parts: string[]) {\\n this.prefixKey = prefixKey;\\n this.prefixLen = prefixLen;\\n this.parts = parts;\\n }\\n}\\n\\n/**\\n * Resolves a potentially dotted path against a data map with caching support.\\n *\\n * Keys like \\\"$nodes.expression2\\\" are stored as literal strings with dots in them,\\n * not as nested objects. This function handles both cases:\\n * 1. Exact key match (e.g., \\\"$nodes.expression2\\\")\\n * 2. Nested path (e.g., \\\"$nodes.expression2.L1\\\" where \\\"$nodes.expression2\\\" is a key\\n * and \\\"L1\\\" is a property inside the object stored at that key)\\n *\\n * The algorithm finds the longest matching prefix in the data map, then navigates\\n * any remaining path segments through nested object properties.\\n *\\n * Performance: Uses an optional cache to avoid redundant path splitting and prefix\\n * matching for frequently-accessed paths within a single evaluation.\\n */\\nexport function resolvePathInData(\\n data: Map<string, Value>,\\n path: string,\\n cache: Map<string, PathResolutionCache> | null = null,\\n): Value {\\n // Check for exact key match first\\n if (data.has(path)) {\\n return data.get(path);\\n }\\n\\n // If no dot, the key doesn't exist\\n if (!path.includes('.')) {\\n return Value.Null();\\n }\\n\\n // Check cache if available\\n let matchedPrefixLen: i32 = 0;\\n let prefixKey: string = '';\\n let parts: string[];\\n\\n if (cache !== null && cache.has(path)) {\\n // Cache hit - use cached resolution metadata AND cached parts array\\n const cached = cache.get(path);\\n prefixKey = cached.prefixKey;\\n matchedPrefixLen = cached.prefixLen;\\n parts = cached.parts;\\n } else {\\n // Cache miss - perform full path resolution\\n parts = path.split('.');\\n\\n // Try progressively longer prefixes to find a matching key\\n // e.g., for \\\"$nodes.expression2.L1\\\", try:\\n // 1. \\\"$nodes\\\" (no match)\\n // 2. \\\"$nodes.expression2\\\" (match! then access .L1 inside)\\n let currentPrefix = '';\\n for (let i = 0; i < parts.length; i++) {\\n if (i > 0) currentPrefix += '.';\\n currentPrefix += parts[i];\\n if (data.has(currentPrefix)) {\\n matchedPrefixLen = i + 1;\\n prefixKey = currentPrefix;\\n }\\n }\\n\\n // Store in cache if available (including the parts array to avoid future splits)\\n if (cache !== null) {\\n cache.set(path, new PathResolutionCache(prefixKey, matchedPrefixLen, parts));\\n }\\n }\\n\\n // If no prefix matched, path doesn't exist\\n if (matchedPrefixLen == 0) {\\n return Value.Null();\\n }\\n\\n // Get the value at the matched prefix\\n let current = data.get(prefixKey);\\n\\n // Navigate remaining parts as object properties\\n for (let i = matchedPrefixLen; i < parts.length; i++) {\\n if (!current.isObject()) return Value.Null();\\n const obj = current.asObject();\\n const key = parts[i];\\n if (!obj.has(key)) return Value.Null();\\n current = obj.get(key);\\n }\\n return current;\\n}\\n\\nexport class Context {\\n data: Map<string, Value>;\\n // Cache for decision node results to avoid redundant evaluation. Caching prevents\\n // exponential evaluation time for DAG structures where multiple nodes reference\\n // the same upstream computation.\\n decisionResults: Map<string, Value>;\\n // Stack to track currently evaluating decisions for recursion detection\\n decisionStack: string[];\\n // When merging results, we need to know which keys are original inputs (should be\\n // preserved) vs computed outputs (may be overwritten). This prevents input shadowing.\\n inputKeys: Set<string>;\\n // Cache for path resolution to avoid redundant string splitting and prefix matching.\\n // For decisions with many field accesses (e.g., 100-rule decision table with 5 inputs\\n // per rule = 500 path lookups), this eliminates most splitting overhead.\\n pathCache: Map<string, PathResolutionCache>;\\n\\n constructor(input: Map<string, Value>) {\\n this.data = input;\\n this.decisionResults = new Map<string, Value>();\\n this.decisionStack = new Array<string>();\\n this.pathCache = new Map<string, PathResolutionCache>();\\n // Store original input keys\\n this.inputKeys = new Set<string>();\\n const keys = input.keys();\\n for (let i = 0; i < keys.length; i++) {\\n this.inputKeys.add(keys[i]);\\n }\\n }\\n\\n // Unlike JS Map which returns undefined for missing keys, AS Map.get() throws.\\n // We must check has() first or handle dots carefully to avoid runtime errors.\\n get(path: string): Value {\\n return resolvePathInData(this.data, path, this.pathCache);\\n }\\n\\n set(path: string, value: Value): void {\\n this.data.set(path, value);\\n }\\n\\n // Merge another result into this context (for passthrough mode)\\n merge(other: Map<string, Value>): void {\\n const keys = other.keys();\\n for (let i = 0; i < keys.length; i++) {\\n const key = keys[i];\\n this.data.set(key, other.get(key));\\n }\\n }\\n\\n // Convert the context data to a Value (for passthrough sub-decisions)\\n toValue(): Value {\\n return Value.Object(this.data);\\n }\\n}\\n\\n/**\\n * ScopedContext is a lightweight context wrapper for scoped expression evaluation.\\n * Scoped evaluation (loops, sub-object navigation) needs simple Map-based get/set\\n * without decision caching/recursion tracking. Separate class avoids polluting\\n * Context with unnecessary state and provides clearer semantics.\\n *\\n * Used for:\\n * - inputField scoping (expressions evaluated within a sub-object scope)\\n * - executionMode: \\\"loop\\\" (expressions evaluated for each array item)\\n *\\n * Performance: Includes path caching for loop-mode expressions where the same paths\\n * are accessed repeatedly across array items.\\n */\\nexport class ScopedContext {\\n data: Map<string, Value>;\\n // Path resolution cache for frequently-accessed paths in loops\\n pathCache: Map<string, PathResolutionCache>;\\n\\n constructor(data: Map<string, Value>) {\\n this.data = data;\\n this.pathCache = new Map<string, PathResolutionCache>();\\n }\\n\\n get(path: string): Value {\\n return resolvePathInData(this.data, path, this.pathCache);\\n }\\n\\n set(path: string, value: Value): void {\\n this.data.set(path, value);\\n }\\n}\\n\";\nexport const RUNTIME_EXPRESSIONS = \"// assembly/runtime/expressions.ts (AssemblyScript)\\nimport { Value, TYPE_ARRAY, TYPE_STRING, TYPE_FLOAT, TYPE_INT, TYPE_BOOL } from './values';\\n\\n/**\\n * Helper function to create an argument array.\\n * AssemblyScript doesn't support true variadic functions or rest parameters, so we provide\\n * fixed-arity helpers (makeArgs1, makeArgs2, makeArgs3) for common function arities.\\n *\\n * These use thread-local reusable arrays to avoid allocations in hot paths.\\n * Since WASM evaluation is single-threaded, reusing arrays is safe.\\n */\\n\\n// Reusable argument arrays - lazily initialized\\nlet _args1: Array<Value> | null = null;\\nlet _args2: Array<Value> | null = null;\\nlet _args3: Array<Value> | null = null;\\n\\nexport function makeArgs(a: Value, b: Value, c: Value = Value.Null()): Array<Value> {\\n if (_args3 === null) {\\n _args3 = new Array<Value>(3);\\n }\\n unchecked((_args3![0] = a));\\n unchecked((_args3![1] = b));\\n unchecked((_args3![2] = c));\\n return _args3!;\\n}\\n\\nexport function makeArgs1(a: Value): Array<Value> {\\n if (_args1 === null) {\\n _args1 = new Array<Value>(1);\\n }\\n unchecked((_args1![0] = a));\\n return _args1!;\\n}\\n\\nexport function makeArgs2(a: Value, b: Value): Array<Value> {\\n if (_args2 === null) {\\n _args2 = new Array<Value>(2);\\n }\\n unchecked((_args2![0] = a));\\n unchecked((_args2![1] = b));\\n return _args2!;\\n}\\n\\nexport function makeArgs3(a: Value, b: Value, c: Value): Array<Value> {\\n if (_args3 === null) {\\n _args3 = new Array<Value>(3);\\n }\\n unchecked((_args3![0] = a));\\n unchecked((_args3![1] = b));\\n unchecked((_args3![2] = c));\\n return _args3!;\\n}\\n\\n// Type alias for function handlers\\ntype FunctionHandler = (args: Array<Value>) => Value;\\n\\n// Global function registry - Map provides O(1) lookup instead of O(n) if-else chain\\nconst functionRegistry = new Map<string, FunctionHandler>();\\n\\n/**\\n * Initialize the function registry with all built-in functions.\\n * This is called once at module initialization.\\n */\\nfunction initializeFunctionRegistry(): void {\\n // Array functions\\n functionRegistry.set('sum', (args: Array<Value>): Value => sumArray(args[0]));\\n functionRegistry.set('avg', (args: Array<Value>): Value => avgArray(args[0]));\\n functionRegistry.set('min', (args: Array<Value>): Value => minArray(args[0]));\\n functionRegistry.set('max', (args: Array<Value>): Value => maxArray(args[0]));\\n functionRegistry.set('sort', (args: Array<Value>): Value => sortArray(args[0]));\\n\\n // Flatten has two aliases\\n const flatHandler = (args: Array<Value>): Value => {\\n const arg1 = args.length >= 2 ? args[1] : Value.Null();\\n return flatArray(args[0], arg1);\\n };\\n functionRegistry.set('flat', flatHandler);\\n functionRegistry.set('flatten', flatHandler);\\n\\n // Count/length has two aliases\\n const lengthHandler = (args: Array<Value>): Value => lengthOf(args[0]);\\n functionRegistry.set('count', lengthHandler);\\n functionRegistry.set('len', lengthHandler);\\n\\n functionRegistry.set('contains', (args: Array<Value>): Value => {\\n const arg1 = args.length >= 2 ? args[1] : Value.Null();\\n return containsValue(args[0], arg1);\\n });\\n\\n // Type conversion functions\\n functionRegistry.set('number', (args: Array<Value>): Value => numberValue(args[0]));\\n functionRegistry.set('string', (args: Array<Value>): Value => stringValue(args[0]));\\n\\n // Math functions\\n functionRegistry.set('abs', (args: Array<Value>): Value => absValue(args[0]));\\n functionRegistry.set('floor', (args: Array<Value>): Value => floorValue(args[0]));\\n functionRegistry.set('ceil', (args: Array<Value>): Value => ceilValue(args[0]));\\n functionRegistry.set('round', (args: Array<Value>): Value => roundValue(args[0]));\\n\\n // String functions\\n functionRegistry.set('upper', (args: Array<Value>): Value => upperString(args[0]));\\n functionRegistry.set('lower', (args: Array<Value>): Value => lowerString(args[0]));\\n functionRegistry.set('trim', (args: Array<Value>): Value => trimString(args[0]));\\n\\n functionRegistry.set('substring', (args: Array<Value>): Value => {\\n const arg1 = args.length >= 2 ? args[1] : Value.Null();\\n const arg2 = args.length >= 3 ? args[2] : Value.Null();\\n return substringString(args[0], arg1, arg2);\\n });\\n\\n functionRegistry.set('indexOf', (args: Array<Value>): Value => {\\n const arg1 = args.length >= 2 ? args[1] : Value.Null();\\n const arg2 = args.length >= 3 ? args[2] : Value.Null();\\n return indexOfString(args[0], arg1, arg2.isNull() ? Value.Int(<i64>0) : arg2);\\n });\\n\\n functionRegistry.set('startsWith', (args: Array<Value>): Value => {\\n const arg1 = args.length >= 2 ? args[1] : Value.Null();\\n return startsWithString(args[0], arg1);\\n });\\n\\n functionRegistry.set('endsWith', (args: Array<Value>): Value => {\\n const arg1 = args.length >= 2 ? args[1] : Value.Null();\\n return endsWithString(args[0], arg1);\\n });\\n\\n functionRegistry.set('split', (args: Array<Value>): Value => {\\n const arg1 = args.length >= 2 ? args[1] : Value.Null();\\n return splitString(args[0], arg1);\\n });\\n\\n functionRegistry.set('join', (args: Array<Value>): Value => {\\n const arg1 = args.length >= 2 ? args[1] : Value.Null();\\n return joinArray(args[0], arg1);\\n });\\n\\n functionRegistry.set('replace', (args: Array<Value>): Value => {\\n const arg1 = args.length >= 2 ? args[1] : Value.Null();\\n const arg2 = args.length >= 3 ? args[2] : Value.Null();\\n return replaceString(args[0], arg1, arg2);\\n });\\n\\n functionRegistry.set('replaceAll', (args: Array<Value>): Value => {\\n const arg1 = args.length >= 2 ? args[1] : Value.Null();\\n const arg2 = args.length >= 3 ? args[2] : Value.Null();\\n return replaceAllString(args[0], arg1, arg2);\\n });\\n\\n // Date/time functions\\n functionRegistry.set('date', (args: Array<Value>): Value => parseDate(args[0]));\\n\\n // now() returns 0 because WASM doesn't have direct access to system time in a sandboxed way.\\n // To get the current timestamp, use date(\\\"now\\\") instead, which uses Date.now().\\n functionRegistry.set('now', (args: Array<Value>): Value => Value.Float(0));\\n\\n functionRegistry.set('time', (args: Array<Value>): Value => parseTime(args[0]));\\n functionRegistry.set('duration', (args: Array<Value>): Value => parseDuration(args[0]));\\n\\n // Object functions\\n functionRegistry.set('values', (args: Array<Value>): Value => objectValues(args[0]));\\n functionRegistry.set('keys', (args: Array<Value>): Value => objectKeys(args[0]));\\n}\\n\\n// Initialize the registry immediately\\ninitializeFunctionRegistry();\\n\\n/**\\n * Evaluate built-in functions.\\n * All inputs and outputs use the Value tagged union.\\n *\\n * Uses a Map-based registry for O(1) function lookup instead of O(n) if-else chain.\\n */\\nexport function evaluateFunction(name: string, args: Array<Value>): Value {\\n // Safety check for args array\\n if (args == null || args.length == 0) return Value.Null();\\n\\n // Look up handler in the registry\\n if (functionRegistry.has(name)) {\\n const handler = functionRegistry.get(name);\\n return handler(args);\\n }\\n\\n // Unknown function - return null\\n return Value.Null();\\n}\\n\\n// === Object Functions ===\\n\\n/**\\n * Get all values from an object as an array.\\n * If the input is not an object, returns an empty array.\\n */\\nexport function objectValues(val: Value): Value {\\n if (!val.isObject()) return Value.Array(new Array<Value>(0));\\n const obj = val.asObject();\\n const keys = obj.keys();\\n const result = new Array<Value>(keys.length);\\n for (let i = 0; i < keys.length; i++) {\\n unchecked((result[i] = obj.get(unchecked(keys[i]))));\\n }\\n return Value.Array(result);\\n}\\n\\n/**\\n * Get all keys from an object as an array of strings.\\n * If the input is not an object, returns an empty array.\\n */\\nexport function objectKeys(val: Value): Value {\\n if (!val.isObject()) return Value.Array(new Array<Value>(0));\\n const obj = val.asObject();\\n const keys = obj.keys();\\n const result = new Array<Value>(keys.length);\\n for (let i = 0; i < keys.length; i++) {\\n unchecked((result[i] = Value.String(unchecked(keys[i]))));\\n }\\n return Value.Array(result);\\n}\\n\\n// === Array Functions ===\\n\\nexport function sumArray(val: Value): Value {\\n if (!val.isArray()) return Value.Float(0.0);\\n const arr = val.asArray();\\n let total: f64 = 0.0;\\n for (let i = 0; i < arr.length; i++) {\\n total += unchecked(arr[i]).asFloat();\\n }\\n return Value.Float(total);\\n}\\n\\nexport function minArray(val: Value): Value {\\n if (!val.isArray()) return Value.Null();\\n const arr = val.asArray();\\n if (arr.length == 0) return Value.Null();\\n let min = arr[0].asFloat();\\n for (let i = 1; i < arr.length; i++) {\\n const v = unchecked(arr[i]).asFloat();\\n if (v < min) min = v;\\n }\\n return Value.Float(min);\\n}\\n\\nexport function maxArray(val: Value): Value {\\n if (!val.isArray()) return Value.Null();\\n const arr = val.asArray();\\n if (arr.length == 0) return Value.Null();\\n let max = arr[0].asFloat();\\n for (let i = 1; i < arr.length; i++) {\\n const v = unchecked(arr[i]).asFloat();\\n if (v > max) max = v;\\n }\\n return Value.Float(max);\\n}\\n\\nexport function avgArray(val: Value): Value {\\n if (!val.isArray()) return Value.Null();\\n const arr = val.asArray();\\n if (arr.length == 0) return Value.Null();\\n let total: f64 = 0.0;\\n for (let i = 0; i < arr.length; i++) {\\n total += unchecked(arr[i]).asFloat();\\n }\\n return Value.Float(total / <f64>arr.length);\\n}\\n\\n/**\\n * Sort an array in ascending order.\\n *\\n * Supports sorting numbers and strings in ascending order.\\n * Creates and returns a new sorted array without modifying the original.\\n *\\n * Parameters:\\n * - val: The array value to sort\\n *\\n * Behavior:\\n * - Numbers: sorted in ascending numeric order\\n * - Strings: sorted in lexicographic (ASCII) order\\n * - Empty arrays: returns a new empty array\\n * - Non-array inputs: returns null\\n *\\n * Examples:\\n * - sortArray([3, 1, 2]) -> [1, 2, 3]\\n * - sortArray([\\\"c\\\", \\\"a\\\", \\\"b\\\"]) -> [\\\"a\\\", \\\"b\\\", \\\"c\\\"]\\n * - sortArray([]) -> []\\n *\\n * @param val - The array value to sort\\n * @returns A new sorted array, or null for invalid input\\n */\\nexport function sortArray(val: Value): Value {\\n if (!val.isArray()) return Value.Null();\\n const arr = val.asArray();\\n\\n // Create a copy of the array to avoid mutating the original\\n const sorted = new Array<Value>(arr.length);\\n for (let i = 0; i < arr.length; i++) {\\n unchecked((sorted[i] = unchecked(arr[i])));\\n }\\n\\n // Sort the copy using the compareValues function\\n sorted.sort((a: Value, b: Value): i32 => compareValues(a, b));\\n\\n return Value.Array(sorted);\\n}\\n\\n/**\\n * Flatten nested arrays into a single-level array.\\n *\\n * Parameters:\\n * - val: The array value to flatten\\n * - depthVal: Optional depth (default: 1). Specifies how many levels deep to flatten.\\n *\\n * Behavior:\\n * - If depth is 0, returns a shallow copy of the array\\n * - Flattens arrays recursively up to the specified depth\\n * - Empty arrays are returned as empty arrays\\n * - Non-array inputs return null\\n *\\n * Examples:\\n * - flatArray([[1, 2], [3, 4]]) -> [1, 2, 3, 4] (depth 1)\\n * - flatArray([1, [2, [3]]]) -> [1, 2, [3]] (depth 1)\\n * - flatArray([1, [2, [3]]], 2) -> [1, 2, 3] (depth 2)\\n * - flatArray([1, 2, 3]) -> [1, 2, 3] (no nesting, shallow copy)\\n * - flatArray([]) -> [] (empty array)\\n * - flatArray([[1], [2]], 0) -> [[1], [2]] (depth 0, no flattening)\\n *\\n * @param val - The array value to flatten\\n * @param depthVal - Optional depth for flattening (default: 1)\\n * @returns A new flattened array, or null for invalid input\\n */\\nexport function flatArray(val: Value, depthVal: Value = Value.Int(<i64>1)): Value {\\n if (!val.isArray()) return Value.Null();\\n const arr = val.asArray();\\n\\n // Parse depth parameter matches JavaScript Array.flat() default behavior, which\\n // flattens one level deep unless specified otherwise. Most common use case.\\n let depth: i32 = 1;\\n if (!depthVal.isNull() && depthVal.isNumber()) {\\n depth = <i32>depthVal.asFloat(); // Use asFloat() since numbers may come as floats\\n // Clamp depth to non-negative values\\n if (depth < 0) depth = 1;\\n }\\n\\n // Use a simple iterative approach that maintains order\\n let result = new Array<Value>();\\n flattenRecursive(arr, depth, result);\\n return Value.Array(result);\\n}\\n\\n// Helper function for flatArray\\nfunction flattenRecursive(arr: Array<Value>, currentDepth: i32, result: Array<Value>): void {\\n for (let i = 0; i < arr.length; i++) {\\n const element = unchecked(arr[i]);\\n if (element.isArray() && currentDepth > 0) {\\n // Recursively flatten nested array\\n flattenRecursive(element.asArray(), currentDepth - 1, result);\\n } else {\\n // Add element to results\\n result.push(element);\\n }\\n }\\n}\\n\\nexport function lengthOf(val: Value): Value {\\n if (val.isArray()) {\\n return Value.Int(<i64>val.asArray().length);\\n }\\n if (val.isString()) {\\n return Value.Int(<i64>val.asString().length);\\n }\\n return Value.Int(0);\\n}\\n\\n/**\\n * Check if a value contains a subvalue.\\n *\\n * For strings: checks if the string contains a given substring.\\n * For arrays: checks if the array contains the given value.\\n *\\n * Parameters:\\n * - container: The string or array to search in\\n * - needle: The substring or value to search for\\n *\\n * Behavior:\\n * - If container is a string, checks if it contains the substring\\n * - If container is an array, checks if any element equals the needle\\n * - For strings, returns null if either argument is not a string\\n * - For arrays, always returns a boolean\\n *\\n * String Examples:\\n * - contains(\\\"hello world\\\", \\\"world\\\") → true\\n * - contains(\\\"hello world\\\", \\\"xyz\\\") → false\\n * - contains(\\\"abc\\\", \\\"abc\\\") → true\\n * - contains(\\\"hello\\\", \\\"\\\") → true (empty string is always contained)\\n * - contains(\\\"\\\", \\\"\\\") → true\\n * - contains(\\\"\\\", \\\"x\\\") → false\\n * - contains(\\\"Hello\\\", \\\"hello\\\") → false (case-sensitive)\\n * - contains(\\\"hello\\\", 123) → null (needle not a string)\\n * - contains(123, \\\"hello\\\") → null (container not a string)\\n *\\n * Array Examples:\\n * - contains([1, 2, 3], 2) → true\\n * - contains([1, 2, 3], 4) → false\\n * - contains([\\\"a\\\"], \\\"a\\\") → true\\n * - contains(123, 1) → false\\n *\\n * @param container - The string or array to search in\\n * @param needle - The substring or value to search for\\n * @returns true if contained, false if not, or null for invalid string arguments\\n */\\nexport function containsValue(container: Value, needle: Value): Value {\\n // Handle string containment\\n if (container.isString()) {\\n if (!needle.isString()) return Value.Null();\\n const str = container.asString();\\n const search = needle.asString();\\n // Use indexOf to check containment (returns -1 if not found)\\n const index = str.indexOf(search);\\n return Value.Bool(index >= 0);\\n }\\n\\n // Handle array containment (original behavior)\\n if (!container.isArray()) return Value.Bool(false);\\n const arr = container.asArray();\\n for (let i = 0; i < arr.length; i++) {\\n if (valuesEqual(unchecked(arr[i]), needle)) return Value.Bool(true);\\n }\\n return Value.Bool(false);\\n}\\n\\n// === Date/Time Functions ===\\n\\n/**\\n * Parse a date string into a numeric timestamp.\\n *\\n * Supports ISO 8601 date format: YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS[Z|+/-HH:MM]\\n * Returns Unix timestamp in seconds since epoch (1970-01-01 00:00:00 UTC).\\n * This matches zen-engine's behavior and allows date arithmetic operations.\\n *\\n * Examples:\\n * - date(\\\"2025-03-20T10:30:00Z\\\") → 1742466600 (seconds since epoch)\\n * - date(\\\"1970-01-01\\\") → 0\\n * - date(\\\"1970-01-01T00:00:00Z\\\") → 0\\n *\\n * @param val - A string value containing a date\\n * @returns A float Value representing seconds since epoch, or Null for invalid input\\n */\\nexport function parseDate(val: Value): Value {\\n if (!val.isString()) return Value.Null();\\n\\n const str = val.asString();\\n\\n // Handle special 'now' keyword - returns Unix timestamp in seconds\\n // Using Date.now() which returns milliseconds, convert to seconds\\n if (str == 'now') {\\n return Value.Float(<f64>Date.now() / 1000.0);\\n }\\n\\n // Fast path for simple YYYY-MM-DD format (10 characters)\\n // This avoids string allocations from split() and substring() for common cases\\n if (str.length == 10) {\\n // Check dash positions at indices 4 and 7\\n const dashPos1 = unchecked(<i32>str.charCodeAt(4));\\n const dashPos2 = unchecked(<i32>str.charCodeAt(7));\\n if (dashPos1 == 45 && dashPos2 == 45) {\\n // Hyphen is ASCII 45, digits start at ASCII 48\\n // Parse year, month, day directly without split()\\n const year =\\n unchecked(<i32>str.charCodeAt(0) - 48) * 1000 +\\n unchecked(<i32>str.charCodeAt(1) - 48) * 100 +\\n unchecked(<i32>str.charCodeAt(2) - 48) * 10 +\\n unchecked(<i32>str.charCodeAt(3) - 48);\\n const month =\\n unchecked(<i32>str.charCodeAt(5) - 48) * 10 + unchecked(<i32>str.charCodeAt(6) - 48);\\n const day =\\n unchecked(<i32>str.charCodeAt(8) - 48) * 10 + unchecked(<i32>str.charCodeAt(9) - 48);\\n\\n // Validate ranges\\n if (year >= 0 && month >= 1 && month <= 12 && day >= 1 && day <= 31) {\\n const daysSinceEpoch = calculateDaysSinceEpoch(year, month, day);\\n return Value.Float(<f64>daysSinceEpoch * 86400.0);\\n }\\n }\\n }\\n\\n // Parse ISO 8601 date format: YYYY-MM-DD\\n // Also handle datetime format: YYYY-MM-DDTHH:MM:SS[Z|+/-HH:MM]\\n let dateStr = str;\\n let timeStr = '';\\n let tzOffsetSeconds: i32 = 0; // Timezone offset in seconds (positive = ahead of UTC)\\n\\n const tIndex = str.indexOf('T');\\n if (tIndex >= 0) {\\n dateStr = str.substring(0, tIndex);\\n let timePart = str.substring(tIndex + 1);\\n\\n // Handle timezone: Z, +HH:MM, -HH:MM\\n const zIndex = timePart.indexOf('Z');\\n if (zIndex >= 0) {\\n timeStr = timePart.substring(0, zIndex);\\n tzOffsetSeconds = 0; // UTC\\n } else {\\n const plusIndex = timePart.indexOf('+');\\n const minusIndex = timePart.indexOf('-');\\n // Find timezone offset (look for +/- after the time part, not in middle of time)\\n let tzStartIndex = -1;\\n if (plusIndex >= 5) {\\n // At least HH:MM before timezone\\n tzStartIndex = plusIndex;\\n } else if (minusIndex >= 5) {\\n tzStartIndex = minusIndex;\\n }\\n\\n if (tzStartIndex >= 0) {\\n timeStr = timePart.substring(0, tzStartIndex);\\n const tzStr = timePart.substring(tzStartIndex);\\n // Parse timezone offset (+/-HH:MM or +/-HH)\\n const isNegative = tzStr.charAt(0) == '-';\\n const tzParts = tzStr.substring(1).split(':');\\n if (tzParts.length >= 1) {\\n const tzHours = parseIntValue(tzParts[0]);\\n const tzMinutes = tzParts.length >= 2 ? parseIntValue(tzParts[1]) : 0;\\n if (tzHours >= 0 && tzMinutes >= 0) {\\n tzOffsetSeconds = tzHours * 3600 + tzMinutes * 60;\\n if (isNegative) tzOffsetSeconds = -tzOffsetSeconds;\\n }\\n }\\n } else {\\n timeStr = timePart;\\n }\\n }\\n }\\n\\n // Split date by dash\\n const parts = dateStr.split('-');\\n if (parts.length < 3) return Value.Null();\\n\\n // Parse year, month, day\\n const year = parseIntValue(parts[0]);\\n const month = parseIntValue(parts[1]);\\n const day = parseIntValue(parts[2]);\\n\\n if (year < 0 || month < 1 || month > 12 || day < 1 || day > 31) {\\n return Value.Null();\\n }\\n\\n // Calculate days since epoch\\n const daysSinceEpoch = calculateDaysSinceEpoch(year, month, day);\\n\\n // Parse time if present (HH:MM:SS or HH:MM)\\n let hours: i32 = 0;\\n let minutes: i32 = 0;\\n let seconds: i32 = 0;\\n\\n if (timeStr.length > 0) {\\n const timeParts = timeStr.split(':');\\n if (timeParts.length >= 2) {\\n hours = parseIntValue(timeParts[0]);\\n minutes = parseIntValue(timeParts[1]);\\n if (timeParts.length >= 3) {\\n // Handle fractional seconds (e.g., \\\"10:30:00.123\\\")\\n const secStr = timeParts[2];\\n const dotIndex = secStr.indexOf('.');\\n if (dotIndex >= 0) {\\n seconds = parseIntValue(secStr.substring(0, dotIndex));\\n } else {\\n seconds = parseIntValue(secStr);\\n }\\n }\\n }\\n if (hours < 0 || hours > 23 || minutes < 0 || minutes > 59 || seconds < 0 || seconds > 59) {\\n // Invalid time - use 0\\n hours = 0;\\n minutes = 0;\\n seconds = 0;\\n }\\n }\\n\\n // Calculate total seconds since epoch\\n // daysSinceEpoch * 86400 + hours * 3600 + minutes * 60 + seconds - tzOffsetSeconds\\n // We subtract tzOffsetSeconds to convert local time to UTC\\n const totalSeconds: f64 =\\n <f64>daysSinceEpoch * 86400.0 +\\n <f64>hours * 3600.0 +\\n <f64>minutes * 60.0 +\\n <f64>seconds -\\n <f64>tzOffsetSeconds;\\n\\n return Value.Float(totalSeconds);\\n}\\n\\n/**\\n * Parse a time string into a numeric value.\\n *\\n * Supports format: HH:MM:SS or HH:MM\\n * Returns the number of seconds since midnight.\\n *\\n * @param val - A string value containing a time\\n * @returns A float Value representing seconds since midnight\\n */\\nexport function parseTime(val: Value): Value {\\n if (!val.isString()) return Value.Null();\\n\\n const str = val.asString();\\n const parts = str.split(':');\\n\\n if (parts.length < 2) return Value.Null();\\n\\n const hours = parseIntValue(parts[0]);\\n const minutes = parseIntValue(parts[1]);\\n const seconds = parts.length >= 3 ? parseIntValue(parts[2]) : 0;\\n\\n if (hours < 0 || hours > 23 || minutes < 0 || minutes > 59 || seconds < 0 || seconds > 59) {\\n return Value.Null();\\n }\\n\\n const totalSeconds = hours * 3600 + minutes * 60 + seconds;\\n return Value.Float(<f64>totalSeconds);\\n}\\n\\n/**\\n * Parse a duration string into a numeric value.\\n *\\n * Supports ISO 8601 duration format: P[n]Y[n]M[n]DT[n]H[n]M[n]S\\n * Also supports simple formats like \\\"30d\\\", \\\"24h\\\", \\\"60m\\\", \\\"3600s\\\"\\n *\\n * @param val - A string value containing a duration\\n * @returns A float Value representing duration in seconds\\n */\\nexport function parseDuration(val: Value): Value {\\n if (!val.isString()) return Value.Null();\\n\\n const str = val.asString();\\n\\n // Handle simple formats: \\\"30d\\\", \\\"24h\\\", \\\"60m\\\", \\\"3600s\\\"\\n if (str.length > 1) {\\n const unit = str.charAt(str.length - 1);\\n const numStr = str.substring(0, str.length - 1);\\n const num = parseFloatValue(numStr);\\n\\n if (num >= 0) {\\n if (unit == 's') return Value.Float(num);\\n if (unit == 'm') return Value.Float(num * 60);\\n if (unit == 'h') return Value.Float(num * 3600);\\n if (unit == 'd') return Value.Float(num * 86400);\\n }\\n }\\n\\n // Full ISO 8601 duration format (P[n]Y[n]M[n]DT[n]H[n]M[n]S) not yet supported\\n return Value.Null();\\n}\\n\\n/**\\n * Parse a string to an integer value.\\n */\\nfunction parseIntValue(str: string): i32 {\\n let result: i32 = 0;\\n let negative = false;\\n let i = 0;\\n\\n // Handle leading whitespace\\n while (i < str.length && str.charCodeAt(i) == 32) {\\n i++;\\n }\\n\\n // Handle negative sign\\n if (i < str.length && str.charCodeAt(i) == 45) {\\n // '-'\\n negative = true;\\n i++;\\n }\\n\\n // Parse digits\\n let hasDigits = false;\\n while (i < str.length) {\\n const c = str.charCodeAt(i);\\n if (c >= 48 && c <= 57) {\\n // '0'-'9'\\n result = result * 10 + (c - 48);\\n hasDigits = true;\\n i++;\\n } else {\\n break;\\n }\\n }\\n\\n // AssemblyScript doesn't have optional types or Result<T,E>, so we use -1 as sentinel\\n // value for parse errors. Callers check for negative values to detect failures.\\n if (!hasDigits) return -1;\\n\\n return negative ? -result : result;\\n}\\n\\n/**\\n * Parse a string to a float value.\\n * Returns NaN for invalid input.\\n */\\nfunction parseFloatValue(str: string): f64 {\\n return parseFloat(str);\\n}\\n\\n/**\\n * Calculate days since Unix epoch (1970-01-01).\\n * Uses a simplified algorithm that handles leap years.\\n */\\nfunction calculateDaysSinceEpoch(year: i32, month: i32, day: i32): i32 {\\n // Days in each month (non-leap year)\\n const daysInMonth: i32[] = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\\n\\n // Calculate days from years\\n let days: i32 = 0;\\n\\n // Calculate years from 1970 to target year\\n if (year >= 1970) {\\n for (let y = 1970; y < year; y++) {\\n days += isLeapYear(y) ? 366 : 365;\\n }\\n } else {\\n for (let y = year; y < 1970; y++) {\\n days -= isLeapYear(y) ? 366 : 365;\\n }\\n }\\n\\n // Add days from months\\n for (let m = 1; m < month; m++) {\\n days += unchecked(daysInMonth[m - 1]);\\n // Add leap day for February in leap years\\n if (m == 2 && isLeapYear(year)) {\\n days += 1;\\n }\\n }\\n\\n // Add days\\n days += day - 1; // day 1 is the first day, so subtract 1\\n\\n return days;\\n}\\n\\n/**\\n * Check if a year is a leap year.\\n */\\nfunction isLeapYear(year: i32): bool {\\n return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0;\\n}\\n\\n// === Math Functions ===\\n\\nexport function absValue(val: Value): Value {\\n if (val.isNumber()) {\\n const n = val.asFloat();\\n return Value.Float(n < 0 ? -n : n);\\n }\\n return Value.Null();\\n}\\n\\nexport function floorValue(val: Value): Value {\\n if (val.isNumber()) {\\n return Value.Float(Math.floor(val.asFloat()));\\n }\\n return Value.Null();\\n}\\n\\nexport function ceilValue(val: Value): Value {\\n if (val.isNumber()) {\\n return Value.Float(Math.ceil(val.asFloat()));\\n }\\n return Value.Null();\\n}\\n\\nexport function roundValue(val: Value): Value {\\n if (val.isNumber()) {\\n return Value.Float(Math.round(val.asFloat()));\\n }\\n return Value.Null();\\n}\\n\\n// === String Functions ===\\n\\n/**\\n * Convert a string to uppercase.\\n *\\n * Non-alphabetic characters (numbers, symbols, spaces) remain unchanged.\\n * If the input is not a string, returns null.\\n *\\n * Examples:\\n * - upper(\\\"hello\\\") → \\\"HELLO\\\"\\n * - upper(\\\"Hello World\\\") → \\\"HELLO WORLD\\\"\\n * - upper(\\\"123abc\\\") → \\\"123ABC\\\"\\n * - upper(\\\"!@#\\\") → \\\"!@#\\\"\\n * - upper(123) → null\\n * - upper(null) → null\\n *\\n * @param val - The value to convert to uppercase\\n * @returns The uppercase string, or null if input is not a string\\n */\\nexport function upperString(val: Value): Value {\\n if (!val.isString()) return Value.Null();\\n const str = val.asString();\\n return Value.String(str.toUpperCase());\\n}\\n\\n/**\\n * Convert a string to lowercase.\\n *\\n * Non-alphabetic characters (numbers, symbols, spaces) remain unchanged.\\n * If the input is not a string, returns null.\\n *\\n * Examples:\\n * - lower(\\\"HELLO\\\") → \\\"hello\\\"\\n * - lower(\\\"Hello World\\\") → \\\"hello world\\\"\\n * - lower(\\\"123ABC\\\") → \\\"123abc\\\"\\n * - lower(\\\"!@#\\\") → \\\"!@#\\\"\\n * - lower(123) → null\\n * - lower(null) → null\\n *\\n * @param val - The value to convert to lowercase\\n * @returns The lowercase string, or null if input is not a string\\n */\\nexport function lowerString(val: Value): Value {\\n if (!val.isString()) return Value.Null();\\n const str = val.asString();\\n return Value.String(str.toLowerCase());\\n}\\n\\n/**\\n * Remove leading and trailing whitespace from a string.\\n *\\n * Whitespace includes spaces, tabs, newlines, and other whitespace characters.\\n * If the input is not a string, returns null.\\n *\\n * Examples:\\n * - trim(\\\" hello \\\") → \\\"hello\\\"\\n * - trim(\\\"\\\\t\\\\nhello\\\\n\\\\t\\\") → \\\"hello\\\"\\n * - trim(\\\"hello\\\") → \\\"hello\\\" (no change)\\n * - trim(\\\" hello world \\\") → \\\"hello world\\\"\\n * - trim(\\\"\\\") → \\\"\\\" (empty string)\\n * - trim(\\\" \\\") → \\\"\\\" (only whitespace)\\n * - trim(123) → null\\n * - trim(null) → null\\n *\\n * @param val - The value to trim whitespace from\\n * @returns The trimmed string, or null if input is not a string\\n */\\nexport function trimString(val: Value): Value {\\n if (!val.isString()) return Value.Null();\\n const str = val.asString();\\n return Value.String(str.trim());\\n}\\n\\n/**\\n * Extract a portion of a string.\\n *\\n * Returns a substring starting at the specified index and optionally\\n * ending at the specified index (or length).\\n *\\n * Parameters:\\n * - str: The input string\\n * - start: The starting index (0-based, inclusive)\\n * - endOrLength: Optional end index (exclusive) or length. If omitted,\\n * extracts from start to the end of the string.\\n *\\n * Behavior:\\n * - If start is negative, it's treated as an offset from the end of the string\\n * - If start < 0, it's clamped to 0 (empty prefix)\\n * - If start >= str.length, returns empty string\\n * - If endOrLength is omitted or null, extracts to end of string\\n * - If endOrLength is negative, it's treated as an offset from the end\\n * - If endOrLength > str.length, it's clamped to str.length\\n * - If endOrLength <= start, returns empty string\\n *\\n * Examples:\\n * - substring(\\\"hello\\\", 0, 2) → \\\"he\\\"\\n * - substring(\\\"hello\\\", 1, 3) → \\\"el\\\"\\n * - substring(\\\"hello\\\", 2) → \\\"llo\\\"\\n * - substring(\\\"hello\\\", 0) → \\\"hello\\\"\\n * - substring(\\\"hello\\\", 0, 5) → \\\"hello\\\"\\n * - substring(\\\"hello\\\", 0, 10) → \\\"hello\\\" (clamped to end)\\n * - substring(\\\"hello\\\", 3, 5) → \\\"lo\\\"\\n * - substring(\\\"hello\\\", -3) → \\\"llo\\\" (from end)\\n * - substring(\\\"hello\\\", 0, -2) → \\\"hel\\\" (from end)\\n * - substring(\\\"hello\\\", 10) → \\\"\\\" (start beyond length)\\n * - substring(\\\"\\\", 0, 5) → \\\"\\\" (empty string)\\n * - substring(123, 0, 2) → null (not a string)\\n * - substring(null, 0, 2) → null (not a string)\\n *\\n * @param strVal - The string value to extract from\\n * @param startVal - The starting index\\n * @param endOrLengthVal - Optional end index (exclusive) or length\\n * @returns The substring, or null if input is not a string\\n */\\nexport function substringString(strVal: Value, startVal: Value, endOrLengthVal: Value): Value {\\n if (!strVal.isString()) return Value.Null();\\n const str = strVal.asString();\\n const len = str.length;\\n\\n if (len == 0) return Value.String('');\\n\\n // Parse start index - use asFloat() to handle both Int and Float types\\n let start: i32 = 0;\\n if (startVal.isNumber()) {\\n start = <i32>startVal.asFloat();\\n }\\n\\n // Handle negative start (offset from end)\\n if (start < 0) {\\n start = len + start;\\n if (start < 0) start = 0; // Clamp to 0\\n }\\n\\n // Handle start beyond length\\n if (start >= len) {\\n return Value.String('');\\n }\\n\\n // Parse end index if provided\\n let hasEnd = !endOrLengthVal.isNull();\\n let end: i32 = len; // Default to end of string\\n\\n if (hasEnd && endOrLengthVal.isNumber()) {\\n end = <i32>endOrLengthVal.asFloat();\\n\\n // Handle negative end (offset from end)\\n if (end < 0) {\\n end = len + end;\\n if (end < 0) end = 0;\\n }\\n\\n // Clamp end to string length\\n if (end > len) end = len;\\n\\n // Ensure end >= start\\n if (end < start) end = start;\\n }\\n\\n // Extract substring\\n return Value.String(str.substring(start, end));\\n}\\n\\n/**\\n * Find the index of the first occurrence of a substring.\\n *\\n * Returns the index of the first occurrence of the search string,\\n * starting from the specified position. Returns -1 if not found.\\n *\\n * Parameters:\\n * - str: The string to search in\\n * - searchVal: The substring to search for\\n * - startVal: Optional starting position (default: 0)\\n *\\n * Behavior:\\n * - If the source string is not a string, returns null\\n * - If the search value is not a string, returns null\\n * - If start is negative or omitted, defaults to 0\\n * - If start > str.length, returns -1 (not found)\\n * - If search string is empty, returns the start position\\n * - Returns -1 if the substring is not found\\n *\\n * Examples:\\n * - indexOf(\\\"hello\\\", \\\"l\\\") → 2\\n * - indexOf(\\\"hello\\\", \\\"x\\\") → -1\\n * - indexOf(\\\"hello\\\", \\\"l\\\", 3) → 3\\n * - indexOf(\\\"hello\\\", \\\"ll\\\") → 2\\n * - indexOf(\\\"hello\\\", \\\"lo\\\", 0) → 3\\n * - indexOf(\\\"hello\\\", \\\"\\\") → 0 (empty search string)\\n * - indexOf(\\\"hello\\\", \\\"o\\\", 5) → -1 (start at end)\\n * - indexOf(\\\"hello\\\", \\\"o\\\", 10) → -1 (start beyond length)\\n * - indexOf(\\\"\\\", \\\"x\\\") → -1 (empty source)\\n * - indexOf(\\\"\\\", \\\"\\\") → 0 (both empty)\\n * - indexOf(123, \\\"1\\\") → null (not a string)\\n *\\n * @param strVal - The string value to search in\\n * @param searchVal - The substring value to search for\\n * @param startVal - Optional starting position\\n * @returns The index of the first occurrence, or -1 if not found, or null if inputs are not strings\\n */\\nexport function indexOfString(strVal: Value, searchVal: Value, startVal: Value): Value {\\n if (!strVal.isString() || !searchVal.isString()) return Value.Null();\\n const str = strVal.asString();\\n const search = searchVal.asString();\\n\\n // Parse start index\\n let start: i32 = 0;\\n if (!startVal.isNull() && startVal.isNumber()) {\\n start = <i32>startVal.asFloat();\\n }\\n\\n // Handle negative start\\n if (start < 0) {\\n start = 0;\\n }\\n\\n // Special case: empty search string (matches JavaScript behavior)\\n // When searching for empty string, return the start position clamped to string length\\n if (search.length == 0) {\\n const len = <i32>str.length;\\n if (start >= len) {\\n return Value.Int(<i64>len);\\n }\\n return Value.Int(<i64>start);\\n }\\n\\n // AssemblyScript's indexOf returns -1 for not found\\n const index = str.indexOf(search, start);\\n return Value.Int(<i64>index);\\n}\\n\\n/**\\n * Check if a string starts with a given prefix.\\n *\\n * Returns true if the string begins with the specified prefix, false otherwise.\\n *\\n * Parameters:\\n * - str: The string to check\\n * - prefix: The prefix to look for\\n *\\n * Behavior:\\n * - If either input is not a string, returns null\\n * - If the prefix is an empty string, returns true\\n * - Case-sensitive comparison\\n *\\n * Examples:\\n * - startsWith(\\\"hello\\\", \\\"he\\\") → true\\n * - startsWith(\\\"hello\\\", \\\"lo\\\") → false\\n * - startsWith(\\\"hello\\\", \\\"hello\\\") → true\\n * - startsWith(\\\"hello\\\", \\\"hello world\\\") → false (prefix longer than string)\\n * - startsWith(\\\"\\\", \\\"\\\") → true (empty strings)\\n * - startsWith(\\\"hello\\\", \\\"\\\") → true (empty prefix)\\n * - startsWith(\\\"\\\", \\\"he\\\") → false (prefix longer than empty string)\\n * - startsWith(\\\"Hello\\\", \\\"he\\\") → false (case-sensitive)\\n * - startsWith(123, \\\"1\\\") → null (not a string)\\n * - startsWith(null, \\\"he\\\") → null (not a string)\\n *\\n * @param strVal - The string value to check\\n * @param prefixVal - The prefix value to look for\\n * @returns true if the string starts with the prefix, false otherwise, or null if inputs are not strings\\n */\\nexport function startsWithString(strVal: Value, prefixVal: Value): Value {\\n if (!strVal.isString() || !prefixVal.isString()) return Value.Null();\\n const str = strVal.asString();\\n const prefix = prefixVal.asString();\\n\\n // AssemblyScript's startsWith returns a bool\\n const result = str.startsWith(prefix);\\n return Value.Bool(result);\\n}\\n\\n/**\\n * Check if a string ends with a given suffix.\\n *\\n * Returns true if the string ends with the specified suffix, false otherwise.\\n *\\n * Parameters:\\n * - str: The string to check\\n * - suffix: The suffix to look for\\n *\\n * Behavior:\\n * - If either input is not a string, returns null\\n * - If the suffix is an empty string, returns true\\n * - Case-sensitive comparison\\n *\\n * Examples:\\n * - endsWith(\\\"hello\\\", \\\"lo\\\") → true\\n * - endsWith(\\\"hello\\\", \\\"he\\\") → false\\n * - endsWith(\\\"hello\\\", \\\"hello\\\") → true\\n * - endsWith(\\\"hello\\\", \\\"hello world\\\") → false (suffix longer than string)\\n * - endsWith(\\\"\\\", \\\"\\\") → true (empty strings)\\n * - endsWith(\\\"hello\\\", \\\"\\\") → true (empty suffix)\\n * - endsWith(\\\"\\\", \\\"lo\\\") → false (suffix longer than empty string)\\n * - endsWith(\\\"Hello\\\", \\\"LO\\\") → false (case-sensitive)\\n * - endsWith(123, \\\"1\\\") → null (not a string)\\n * - endsWith(null, \\\"lo\\\") → null (not a string)\\n *\\n * @param strVal - The string value to check\\n * @param suffixVal - The suffix value to look for\\n * @returns true if the string ends with the suffix, false otherwise, or null if inputs are not strings\\n */\\nexport function endsWithString(strVal: Value, suffixVal: Value): Value {\\n if (!strVal.isString() || !suffixVal.isString()) return Value.Null();\\n const str = strVal.asString();\\n const suffix = suffixVal.asString();\\n\\n // AssemblyScript's endsWith returns a bool\\n const result = str.endsWith(suffix);\\n return Value.Bool(result);\\n}\\n\\n/**\\n * Split a string into an array based on a delimiter.\\n *\\n * Returns an array of substrings by dividing the input string at each\\n * occurrence of the specified delimiter.\\n *\\n * Parameters:\\n * - str: The string to split\\n * - delimiter: The delimiter to split on\\n *\\n * Behavior:\\n * - If the input string is not a string, returns null\\n * - If the delimiter is not a string, returns null\\n * - If the delimiter is an empty string, returns an array of individual characters\\n * - If the string and delimiter are both empty, returns an array with one empty string\\n * - If the delimiter is not found, returns an array with the original string\\n *\\n * Examples:\\n * - split(\\\"a,b,c\\\", \\\",\\\") → [\\\"a\\\", \\\"b\\\", \\\"c\\\"]\\n * - split(\\\"hello\\\", \\\"\\\") → [\\\"h\\\", \\\"e\\\", \\\"l\\\", \\\"l\\\", \\\"o\\\"]\\n * - split(\\\"a-b-c\\\", \\\"-\\\") → [\\\"a\\\", \\\"b\\\", \\\"c\\\"]\\n * - split(\\\"word\\\", \\\"x\\\") → [\\\"word\\\"]\\n * - split(\\\"\\\", \\\",\\\") → [\\\"\\\"]\\n * - split(\\\"\\\", \\\"\\\") → [\\\"\\\"] (special case: empty string splits into array with one empty string)\\n * - split(\\\"a,,b\\\", \\\",\\\") → [\\\"a\\\", \\\"\\\", \\\"b\\\"] (preserves empty segments)\\n * - split(null, \\\",\\\") → null\\n * - split(\\\"hello\\\", null) → null\\n * - split(\\\"hello\\\", 123) → null\\n *\\n * @param strVal - The string value to split\\n * @param delimiterVal - The delimiter value to split on\\n * @returns An array of strings, or null if inputs are invalid\\n */\\nexport function splitString(strVal: Value, delimiterVal: Value): Value {\\n if (!strVal.isString() || !delimiterVal.isString()) return Value.Null();\\n const str = strVal.asString();\\n const delimiter = delimiterVal.asString();\\n\\n const parts = str.split(delimiter);\\n\\n // Convert string array to Value array\\n const result = new Array<Value>(parts.length);\\n for (let i = 0; i < parts.length; i++) {\\n unchecked((result[i] = Value.String(unchecked(parts[i]))));\\n }\\n\\n return Value.Array(result);\\n}\\n\\n/**\\n * Join array elements into a string with a separator.\\n *\\n * Returns a string that concatenates all elements of the array,\\n * separated by the specified delimiter.\\n *\\n * Parameters:\\n * - arr: The array to join\\n * - delimiter: The delimiter to insert between elements\\n *\\n * Behavior:\\n * - If the input is not an array, returns null\\n * - If the delimiter is not a string, returns null\\n * - If the array is empty, returns an empty string\\n * - Each array element is converted to its string representation\\n * - The delimiter is placed between each adjacent element, not at the start or end\\n *\\n * Examples:\\n * - join([\\\"a\\\", \\\"b\\\", \\\"c\\\"], \\\"-\\\") → \\\"a-b-c\\\"\\n * - join([\\\"hello\\\", \\\"world\\\"], \\\" \\\") → \\\"hello world\\\"\\n * - join([\\\"a\\\"], \\\",\\\") → \\\"a\\\"\\n * - join([], \\\",\\\") → \\\"\\\"\\n * - join([1, 2, 3], \\\"-\\\") → \\\"1-2-3\\\" (numbers converted to strings)\\n * - join([true, false], \\\" \\\") → \\\"true false\\\" (booleans converted to strings)\\n * - join([\\\"a\\\", null, \\\"b\\\"], \\\"-\\\") → \\\"a-null-b\\\" (null converted to \\\"null\\\")\\n * - join(null, \\\",\\\") → null\\n * - join([\\\"a\\\"], null) → null\\n * - join([\\\"a\\\"], 123) → null\\n *\\n * @param arrVal - The array value to join\\n * @param delimiterVal - The delimiter to insert between elements\\n * @returns The concatenated string, or null if inputs are invalid\\n */\\nexport function joinArray(arrVal: Value, delimiterVal: Value): Value {\\n if (!arrVal.isArray() || !delimiterVal.isString()) return Value.Null();\\n const arr = arrVal.asArray();\\n const delimiter = delimiterVal.asString();\\n\\n // Handle empty array\\n if (arr.length == 0) {\\n return Value.String('');\\n }\\n\\n // Build the result string\\n let result: string = '';\\n for (let i = 0; i < arr.length; i++) {\\n // Append delimiter if not first element\\n if (i > 0) {\\n result += delimiter;\\n }\\n // Convert value to string and append\\n result += valueToString(unchecked(arr[i]));\\n }\\n\\n return Value.String(result);\\n}\\n\\n/**\\n * Convert a string value to a number.\\n *\\n * Parses a string containing a numeric value and returns it as a float.\\n * Supports decimal numbers and negative numbers.\\n *\\n * Parameters:\\n * - val: The value to convert to a number (must be a string)\\n *\\n * Behavior:\\n * - If input is not a string, returns null\\n * - If string cannot be parsed as a number, returns NaN\\n * - Returns f64 (float) for all numeric values\\n *\\n * Examples:\\n * - number(\\\"123\\\") → 123.0\\n * - number(\\\"3.14\\\") → 3.14\\n * - number(\\\"-42\\\") → -42.0\\n * - number(\\\"0.5\\\") → 0.5\\n * - number(\\\"not a number\\\") → NaN\\n * - number(null) → null\\n * - number(123) → null (not a string)\\n *\\n * @param val - The value to convert to a number\\n * @returns The numeric value as a float, or null if input is not a string\\n */\\nexport function numberValue(val: Value): Value {\\n if (val.isString()) {\\n const str = val.asString();\\n // Parse the string using the same logic as parseIntValue\\n let result: i64 = 0;\\n let negative = false;\\n let i = 0;\\n\\n // Handle leading whitespace\\n while (i < str.length && str.charCodeAt(i) == 32) {\\n i++;\\n }\\n\\n // Handle negative sign\\n if (i < str.length && str.charCodeAt(i) == 45) {\\n // '-'\\n negative = true;\\n i++;\\n }\\n\\n // Parse digits\\n let hasDigits = false;\\n while (i < str.length) {\\n const c = str.charCodeAt(i);\\n if (c >= 48 && c <= 57) {\\n // '0'-'9'\\n result = result * 10 + (c - 48);\\n hasDigits = true;\\n i++;\\n } else {\\n break;\\n }\\n }\\n\\n if (!hasDigits) return Value.Null();\\n\\n const finalResult = negative ? -result : result;\\n return Value.Float(<f64>finalResult);\\n } else if (val.isNumber()) {\\n return val;\\n } else if (val.isBool()) {\\n return val.asBool() ? Value.Float(1.0) : Value.Float(0.0);\\n }\\n return Value.Null();\\n}\\n\\n/**\\n * Convert any value to a string.\\n *\\n * Converts the input value to its string representation.\\n *\\n * Parameters:\\n * - val: Any value to convert to string\\n *\\n * Behavior:\\n * - Boolean: \\\"true\\\" or \\\"false\\\"\\n * - Number: numeric string representation\\n * - String: returned as-is\\n * - Null: null (returns null, not the string \\\"null\\\")\\n * - Array/Object: \\\"[object]\\\"\\n *\\n * Examples:\\n * - string(42) → \\\"42\\\"\\n * - string(3.14) → \\\"3.14\\\"\\n * - string(true) → \\\"true\\\"\\n * - string(false) → \\\"false\\\"\\n * - string(\\\"hello\\\") → \\\"hello\\\"\\n * - string(null) → null\\n *\\n * @param val - The value to convert to a string\\n * @returns The string representation, or null if input is null\\n */\\nexport function stringValue(val: Value): Value {\\n if (val.isNull()) {\\n return Value.Null();\\n }\\n if (val.isBool()) {\\n return Value.String(val.asBool() ? 'true' : 'false');\\n }\\n if (val.isNumber()) {\\n // Converting to string matches JavaScript String() coercion for consistency with JS engines.\\n // Integers print without decimals (3 not 3.0), floats use AS toString() formatting.\\n if (val.type == TYPE_INT) {\\n return Value.String(val.intVal.toString());\\n }\\n const f = val.asFloat();\\n // Check if it's a whole number by testing if remainder is 0\\n if (f % 1.0 == 0.0) {\\n return Value.String(i64(<i64>f).toString());\\n }\\n return Value.String(f.toString());\\n }\\n if (val.isString()) {\\n return val;\\n }\\n // Arrays and objects fall back to a placeholder\\n return Value.String('[object]');\\n}\\n\\n/**\\n * Replace the first occurrence of a substring with another string.\\n *\\n * Returns a new string where the first occurrence of the search string\\n * is replaced by the replacement string.\\n *\\n * Parameters:\\n * - str: The string to modify\\n * - search: The substring to search for\\n * - replacement: The string to replace with\\n *\\n * Behavior:\\n * - If the source string is not a string, returns null\\n * - If the search value is not a string, returns null\\n * - If the replacement value is not a string, returns null\\n * - If the search string is empty, the replacement is inserted at the beginning\\n * - If the search string is not found, returns the original string unchanged\\n * - Only the first occurrence is replaced\\n *\\n * Examples:\\n * - replace(\\\"hello\\\", \\\"l\\\", \\\"L\\\") → \\\"heLlo\\\"\\n * - replace(\\\"hello\\\", \\\"lo\\\", \\\"LO\\\") → \\\"heLLO\\\"\\n * - replace(\\\"hello\\\", \\\"x\\\", \\\"X\\\") → \\\"hello\\\" (not found, unchanged)\\n * - replace(\\\"hello hello\\\", \\\"l\\\", \\\"L\\\") → \\\"heLlo hello\\\" (only first occurrence)\\n * - replace(\\\"hello\\\", \\\"\\\", \\\"X\\\") → \\\"Xhello\\\" (empty search, insert at start)\\n * - replace(\\\"\\\", \\\"x\\\", \\\"X\\\") → \\\"\\\" (empty source, no match)\\n * - replace(null, \\\"l\\\", \\\"L\\\") → null (not a string)\\n * - replace(\\\"hello\\\", null, \\\"L\\\") → null (not a string)\\n * - replace(\\\"hello\\\", \\\"l\\\", null) → null (not a string)\\n *\\n * @param strVal - The string value to modify\\n * @param searchVal - The substring value to search for\\n * @param replacementVal - The replacement string value\\n * @returns The modified string with first occurrence replaced, or null if inputs are invalid\\n */\\nexport function replaceString(strVal: Value, searchVal: Value, replacementVal: Value): Value {\\n if (!strVal.isString() || !searchVal.isString() || !replacementVal.isString())\\n return Value.Null();\\n const str = strVal.asString();\\n const search = searchVal.asString();\\n const replacement = replacementVal.asString();\\n\\n // AssemblyScript's replace() replaces all occurrences by default\\n // We need to replace only the first occurrence, so we use indexOf and string concatenation\\n const index = str.indexOf(search);\\n\\n // Search string not found - return original string\\n if (index < 0) {\\n return Value.String(str);\\n }\\n\\n // Build result: prefix + replacement + suffix\\n const prefix = str.substring(0, index);\\n const suffix = str.substring(index + search.length);\\n return Value.String(prefix + replacement + suffix);\\n}\\n\\n/**\\n * Replace all occurrences of a substring with another string.\\n *\\n * Returns a new string where all occurrences of the search string\\n * are replaced by the replacement string.\\n *\\n * Parameters:\\n * - str: The string to modify\\n * - search: The substring to search for\\n * - replacement: The string to replace with\\n *\\n * Behavior:\\n * - If the source string is not a string, returns null\\n * - If the search value is not a string, returns null\\n * - If the replacement value is not a string, returns null\\n * - If the search string is empty, the replacement is inserted between each character\\n * - If the search string is not found, returns the original string unchanged\\n * - All occurrences are replaced\\n *\\n * Examples:\\n * - replaceAll(\\\"hello\\\", \\\"l\\\", \\\"L\\\") → \\\"heLLo\\\"\\n * - replaceAll(\\\"hello hello\\\", \\\"l\\\", \\\"L\\\") → \\\"heLLo heLLo\\\"\\n * - replaceAll(\\\"hello\\\", \\\"lo\\\", \\\"LO\\\") → \\\"heLLO\\\"\\n * - replaceAll(\\\"hello\\\", \\\"x\\\", \\\"X\\\") → \\\"hello\\\" (not found, unchanged)\\n * - replaceAll(\\\"hello\\\", \\\"\\\", \\\"X\\\") → \\\"XhXeXlXlXoX\\\" (empty search, insert between chars)\\n * - replaceAll(\\\"\\\", \\\"x\\\", \\\"X\\\") → \\\"\\\" (empty source, no match)\\n * - replaceAll(null, \\\"l\\\", \\\"L\\\") → null (not a string)\\n * - replaceAll(\\\"hello\\\", null, \\\"L\\\") → null (not a string)\\n * - replaceAll(\\\"hello\\\", \\\"l\\\", null) → null (not a string)\\n *\\n * @param strVal - The string value to modify\\n * @param searchVal - The substring value to search for\\n * @param replacementVal - The replacement string value\\n * @returns The modified string with all occurrences replaced, or null if inputs are invalid\\n */\\nexport function replaceAllString(strVal: Value, searchVal: Value, replacementVal: Value): Value {\\n if (!strVal.isString() || !searchVal.isString() || !replacementVal.isString())\\n return Value.Null();\\n let str = strVal.asString();\\n const search = searchVal.asString();\\n const replacement = replacementVal.asString();\\n\\n // Handle empty search string - insert replacement between each character\\n if (search.length == 0) {\\n let result = replacement;\\n for (let i = 0; i < str.length; i++) {\\n result += str.charAt(i) + replacement;\\n }\\n return Value.String(result);\\n }\\n\\n // Use split and join for O(n) complexity instead of quadratic substring approach\\n const parts = str.split(search);\\n return Value.String(parts.join(replacement));\\n}\\n\\n// === Value Type Conversion ===\\n\\n/**\\n * Convert a Value to its string representation.\\n *\\n * This follows JavaScript's String() conversion rules:\\n * - Number: converted using JS toString()\\n * - Boolean: \\\"true\\\" or \\\"false\\\"\\n * - String: returned as-is\\n * - Null: \\\"null\\\"\\n *\\n * @param val - The value to convert\\n * @returns The string representation\\n */\\nfunction valueToString(val: Value): string {\\n if (val.isNull()) {\\n return 'null';\\n }\\n if (val.isBool()) {\\n return val.asBool() ? 'true' : 'false';\\n }\\n if (val.isNumber()) {\\n // Converting to string matches JavaScript String() coercion for consistency with JS engines.\\n // Integers print without decimals (3 not 3.0), floats use AS toString() formatting.\\n if (val.type == TYPE_INT) {\\n return val.intVal.toString();\\n }\\n const f = val.asFloat();\\n // Check if it's a whole number by testing if remainder is 0\\n if (f % 1.0 == 0.0) {\\n return i64(<i64>f).toString();\\n }\\n return f.toString();\\n }\\n if (val.isString()) {\\n return val.asString();\\n }\\n // Arrays and objects fall back to a placeholder\\n return '[object]';\\n}\\n\\n// === Comparison Helpers ===\\n\\nexport function valuesEqual(a: Value, b: Value): bool {\\n if (a.type != b.type) {\\n // Allow int/float comparison\\n if (a.isNumber() && b.isNumber()) {\\n return a.asFloat() == b.asFloat();\\n }\\n return false;\\n }\\n if (a.isBool()) return a.boolVal == b.boolVal;\\n if (a.type == TYPE_INT) return a.intVal == b.intVal;\\n if (a.type == TYPE_FLOAT) return a.floatVal == b.floatVal;\\n if (a.isString()) return a.asString() == b.asString();\\n if (a.isNull()) return true; // null == null\\n return false; // Arrays/objects: reference equality not supported\\n}\\n\\n/**\\n * Compare two values for ordering.\\n *\\n * Returns:\\n * - Negative number if a < b\\n * - Zero if a == b\\n * - Positive number if a > b\\n *\\n * Comparison rules:\\n * - Strings: Lexicographic comparison using UTF-16 code units (case-sensitive)\\n * - Numbers: Numeric comparison (int and float are comparable)\\n * - Booleans: false < true\\n * - Null: Treated as less than all other values\\n * - Mixed types: Comparisons between incompatible types return 0 (not recommended)\\n *\\n * Examples:\\n * - compareValues(String(\\\"apple\\\"), String(\\\"banana\\\")) → negative\\n * - compareValues(String(\\\"zebra\\\"), String(\\\"apple\\\")) → positive\\n * - compareValues(String(\\\"abc\\\"), String(\\\"abc\\\")) → 0\\n * - compareValues(Float(3.14), Float(2.71)) → positive\\n * - compareValues(Bool(false), Bool(true)) → negative\\n *\\n * @param a - The left operand to compare\\n * @param b - The right operand to compare\\n * @returns Comparison result (-1, 0, or 1)\\n */\\nexport function compareValues(a: Value, b: Value): i32 {\\n // Handle null - null is less than all other values\\n if (a.isNull()) return b.isNull() ? 0 : -1;\\n if (b.isNull()) return 1;\\n\\n // Allow int/float comparison for numbers\\n if (a.isNumber() && b.isNumber()) {\\n const aNum = a.asFloat();\\n const bNum = b.asFloat();\\n if (aNum < bNum) return -1;\\n if (aNum > bNum) return 1;\\n return 0;\\n }\\n\\n // String comparison - lexicographic, case-sensitive\\n if (a.isString() && b.isString()) {\\n const aStr = a.asString();\\n const bStr = b.asString();\\n if (aStr < bStr) return -1;\\n if (aStr > bStr) return 1;\\n return 0;\\n }\\n\\n // Boolean comparison\\n if (a.isBool() && b.isBool()) {\\n const aBool = a.asBool();\\n const bBool = b.asBool();\\n if (!aBool && bBool) return -1;\\n if (aBool && !bBool) return 1;\\n return 0;\\n }\\n\\n // Mixed types or unsupported types - treat as equal (but probably shouldn't happen)\\n return 0;\\n}\\n\\n// === Arithmetic Operators ===\\n\\n/**\\n * Add two values, supporting both numeric addition and string concatenation.\\n *\\n * Type coercion rules:\\n * - If either operand is a string, both are converted to strings and concatenated\\n * - Otherwise, both operands are treated as numbers and added together\\n *\\n * Examples:\\n * - \\\"hello\\\" + \\\" \\\" + \\\"world\\\" → \\\"hello world\\\"\\n * - \\\"count: \\\" + 5 → \\\"count: 5\\\"\\n * - 1 + 2 → 3\\n * - true + false → 1 (true=1, false=0, numeric addition)\\n * - null + 5 → 5 (null=0, numeric addition)\\n * - \\\"prefix\\\" + null → \\\"prefixnull\\\" (string concatenation)\\n *\\n * @param a - The left operand\\n * @param b - The right operand\\n * @returns The sum or concatenation result\\n */\\nexport function addValues(a: Value, b: Value): Value {\\n // String concatenation takes priority over numeric addition\\n // If either operand is a string, concatenate both as strings\\n if (a.isString() || b.isString()) {\\n const leftStr = a.isString() ? a.asString() : valueToString(a);\\n const rightStr = b.isString() ? b.asString() : valueToString(b);\\n return Value.String(leftStr + rightStr);\\n }\\n\\n // Numeric addition\\n const aNum = a.isNumber() ? a.asFloat() : a.isBool() ? (a.asBool() ? 1.0 : 0.0) : 0.0;\\n const bNum = b.isNumber() ? b.asFloat() : b.isBool() ? (b.asBool() ? 1.0 : 0.0) : 0.0;\\n return Value.Float(aNum + bNum);\\n}\\n\\nexport function subtractValues(a: Value, b: Value): Value {\\n if (!a.isNumber() || !b.isNumber()) return Value.Null();\\n const aVal = a.asFloat();\\n const bVal = b.asFloat();\\n return Value.Float(aVal - bVal);\\n}\\n\\nexport function multiplyValues(a: Value, b: Value): Value {\\n if (!a.isNumber() || !b.isNumber()) return Value.Null();\\n const aVal = a.asFloat();\\n const bVal = b.asFloat();\\n return Value.Float(aVal * bVal);\\n}\\n\\nexport function divideValues(a: Value, b: Value): Value {\\n if (!a.isNumber() || !b.isNumber()) return Value.Null();\\n const aVal = a.asFloat();\\n const bVal = b.asFloat();\\n if (bVal == 0) return Value.Null(); // Division by zero\\n return Value.Float(aVal / bVal);\\n}\\n\\nexport function moduloValues(a: Value, b: Value): Value {\\n if (!a.isNumber() || !b.isNumber()) return Value.Null();\\n const aVal = a.asFloat();\\n const bVal = b.asFloat();\\n if (bVal == 0) return Value.Null(); // Division by zero\\n // Use fmod for floating point modulo\\n const result = aVal - Math.trunc(aVal / bVal) * bVal;\\n return Value.Float(result);\\n}\\n\\nexport function powerValues(a: Value, b: Value): Value {\\n if (!a.isNumber() || !b.isNumber()) return Value.Null();\\n const aVal = a.asFloat();\\n const bVal = b.asFloat();\\n const result = Math.pow(aVal, bVal);\\n return Value.Float(result);\\n}\\n\\nexport function negateValue(a: Value): Value {\\n if (!a.isNumber()) return Value.Null();\\n const n = a.asFloat();\\n return Value.Float(-n);\\n}\\n\\n/**\\n * Get a property from an object Value.\\n *\\n * @param obj - The Value to get the property from (should be an object)\\n * @param property - The property name to get\\n * @returns The Value of the property, or Null if not found or obj is null/not an object\\n */\\nexport function getProperty(obj: Value, property: string): Value {\\n if (obj.isNull()) return Value.Null();\\n if (!obj.isObject()) return Value.Null();\\n\\n const map = obj.asObject();\\n if (map.has(property)) {\\n return map.get(property);\\n }\\n return Value.Null();\\n}\\n\\n/**\\n * Get an element from an array at the specified index.\\n *\\n * @param arr - The Value to get the element from (should be an array)\\n * @param idx - The index to get (must be a number Value)\\n * @returns The Value at the index, or Null if out of bounds or arr is null/not an array\\n */\\nexport function getIndex(arr: Value, idx: Value): Value {\\n if (arr.isNull()) return Value.Null();\\n if (idx.isNull()) return Value.Null();\\n\\n // Handle object access with string keys (e.g., baseCosts[\\\"FastTrack\\\"])\\n if (arr.isObject()) {\\n if (idx.isString()) {\\n const obj = arr.asObject();\\n const key = idx.asString();\\n if (obj.has(key)) {\\n return obj.get(key);\\n }\\n return Value.Null();\\n }\\n // If idx is a number, convert to string for object key lookup\\n // This handles cases like obj[0] where obj is {\\\"0\\\": value}\\n const keyStr = idx.asString();\\n const obj = arr.asObject();\\n if (obj.has(keyStr)) {\\n return obj.get(keyStr);\\n }\\n return Value.Null();\\n }\\n\\n if (!arr.isArray()) return Value.Null();\\n\\n const array = arr.asArray();\\n const index = idx.asFloat();\\n\\n // Handle negative indices (from end of array)\\n let actualIndex = <i32>index;\\n if (actualIndex < 0) {\\n actualIndex = <i32>(array.length + actualIndex);\\n }\\n\\n // Check bounds\\n if (actualIndex < 0 || actualIndex >= array.length) {\\n return Value.Null();\\n }\\n\\n return array[actualIndex];\\n}\\n\\n/**\\n * Create an interval object for range checking.\\n *\\n * @param start - Start value of the interval\\n * @param end - End value of the interval\\n * @param startInclusive - Whether the start is inclusive (true) or exclusive (false)\\n * @param endInclusive - Whether the end is inclusive (true) or exclusive (false)\\n * @returns An object representing the interval\\n */\\nexport function createInterval(\\n start: Value,\\n end: Value,\\n startInclusive: bool,\\n endInclusive: bool,\\n): Value {\\n const intervalMap = new Map<string, Value>();\\n intervalMap.set('__isInterval', Value.Bool(true));\\n intervalMap.set('start', start);\\n intervalMap.set('end', end);\\n intervalMap.set('startInclusive', Value.Bool(startInclusive));\\n intervalMap.set('endInclusive', Value.Bool(endInclusive));\\n return Value.Object(intervalMap);\\n}\\n\\n/**\\n * Check if a value is within an interval.\\n *\\n * @param needle - The value to check\\n * @param interval - The interval object created by createInterval\\n * @returns true if the value is within the interval, false otherwise\\n */\\nfunction valueInInterval(needle: Value, interval: Value): bool {\\n if (!interval.isObject()) return false;\\n\\n const intervalObj = interval.asObject();\\n\\n // Check if this is actually an interval object\\n if (!intervalObj.has('__isInterval')) return false;\\n\\n const start = intervalObj.get('start');\\n const end = intervalObj.get('end');\\n const startInclusive = intervalObj.get('startInclusive').asBool();\\n const endInclusive = intervalObj.get('endInclusive').asBool();\\n\\n const cmpStart = compareValues(needle, start);\\n const cmpEnd = compareValues(needle, end);\\n\\n // Check start boundary\\n let passesStart: bool;\\n if (startInclusive) {\\n passesStart = cmpStart >= 0;\\n } else {\\n passesStart = cmpStart > 0;\\n }\\n\\n // Check end boundary\\n let passesEnd: bool;\\n if (endInclusive) {\\n passesEnd = cmpEnd <= 0;\\n } else {\\n passesEnd = cmpEnd < 0;\\n }\\n\\n return passesStart && passesEnd;\\n}\\n\\n/**\\n * Check if a value is in an array, a substring is in a string, or a value is in an interval.\\n * For arrays: checks if the exact value exists in the array\\n * For strings: checks if the needle string is a substring of the haystack\\n * For intervals: checks if the value is within the range\\n *\\n * @param needle - The Value or string to search for\\n * @param haystack - The Value to search in (should be an array, string, or interval)\\n * @returns true if found, false otherwise\\n */\\nexport function valueIn(needle: Value, haystack: Value): Value {\\n if (needle.isNull() || haystack.isNull()) return Value.Bool(false);\\n\\n // Check if haystack is an interval\\n if (haystack.isObject()) {\\n const obj = haystack.asObject();\\n if (obj.has('__isInterval')) {\\n return Value.Bool(valueInInterval(needle, haystack));\\n }\\n }\\n\\n // Check if haystack is an array\\n if (haystack.isArray()) {\\n const array = haystack.asArray();\\n for (let i = 0; i < array.length; i++) {\\n if (valuesEqual(needle, unchecked(array[i]))) {\\n return Value.Bool(true);\\n }\\n }\\n return Value.Bool(false);\\n }\\n\\n // Check if haystack is a string\\n if (haystack.isString() && needle.isString()) {\\n const hayStr = haystack.asString();\\n const needStr = needle.asString();\\n if (hayStr.indexOf(needStr) >= 0) {\\n return Value.Bool(true);\\n }\\n return Value.Bool(false);\\n }\\n\\n return Value.Bool(false);\\n}\\n\";\nexport const RUNTIME_TABLES = \"// assembly/runtime/tables.ts (AssemblyScript)\\nimport { Value } from './values';\\nimport { Context } from './context';\\nimport { valuesEqual } from './expressions';\\n\\n/**\\n * Condition for decision table row evaluation.\\n * Uses Value tagged union consistently.\\n */\\nexport class Condition {\\n field: string;\\n op: string;\\n value: Value;\\n\\n constructor(field: string, op: string, value: Value) {\\n this.field = field;\\n this.op = op;\\n this.value = value;\\n }\\n\\n evaluate(ctx: Context): bool {\\n const actual = ctx.get(this.field);\\n const expected = this.value;\\n\\n // Handle null cases\\n if (actual.isNull()) {\\n if (this.op == '==' && expected.isNull()) return true;\\n if (this.op == '!=' && !expected.isNull()) return true;\\n return false;\\n }\\n\\n // Numeric comparisons\\n if (actual.isNumber() && expected.isNumber()) {\\n const a = actual.asFloat();\\n const e = expected.asFloat();\\n\\n if (this.op == '==') return a == e;\\n if (this.op == '!=') return a != e;\\n if (this.op == '<') return a < e;\\n if (this.op == '<=') return a <= e;\\n if (this.op == '>') return a > e;\\n if (this.op == '>=') return a >= e;\\n }\\n\\n // String comparisons\\n if (actual.isString() && expected.isString()) {\\n const a = actual.asString();\\n const e = expected.asString();\\n\\n if (this.op == '==') return a == e;\\n if (this.op == '!=') return a != e;\\n // Lexicographic comparison for strings\\n if (this.op == '<') return a < e;\\n if (this.op == '<=') return a <= e;\\n if (this.op == '>') return a > e;\\n if (this.op == '>=') return a >= e;\\n }\\n\\n // Boolean equality\\n if (actual.isBool() && expected.isBool()) {\\n if (this.op == '==') return actual.boolVal == expected.boolVal;\\n if (this.op == '!=') return actual.boolVal != expected.boolVal;\\n }\\n\\n // Generic equality via valuesEqual\\n if (this.op == '==') return valuesEqual(actual, expected);\\n if (this.op == '!=') return !valuesEqual(actual, expected);\\n\\n return false;\\n }\\n}\\n\\n/**\\n * Check if a value is within an interval (range).\\n * Supports open/closed boundaries: [a..b], (a..b), [a..b), (a..b]\\n */\\nexport function inInterval(\\n val: Value,\\n start: Value,\\n end: Value,\\n startInclusive: bool,\\n endInclusive: bool,\\n): bool {\\n if (!val.isNumber() || !start.isNumber() || !end.isNumber()) {\\n return false;\\n }\\n\\n const v = val.asFloat();\\n const s = start.asFloat();\\n const e = end.asFloat();\\n\\n const aboveStart = startInclusive ? v >= s : v > s;\\n const belowEnd = endInclusive ? v <= e : v < e;\\n\\n return aboveStart && belowEnd;\\n}\\n\";\nexport const RUNTIME_MEMORY = \"// assembly/runtime/memory.ts (AssemblyScript)\\n// Memory layout and management utilities for WASM linear memory\\n\\nimport { writeString } from './strings';\\n\\n// ============================================================================\\n// Memory Layout Constants\\n// ============================================================================\\n\\n// Reserved space for null pointer trap (first 4 bytes)\\n// Accessing address 0 should trap, catching null/nullish pointer bugs\\nexport const NULL_POINTER_TRAP_SIZE: usize = 4;\\n\\n// Fixed memory region offsets\\nexport const INPUT_BUFFER_START: usize = NULL_POINTER_TRAP_SIZE; // 0x0004\\n\\n// Schema-specific field layouts require different buffer sizes. Computing sizes at\\n// compile time based on actual schema ensures optimal memory usage per decision.\\nexport let INPUT_BUFFER_SIZE: usize = 0;\\n\\n// Variable-length input data starts after the fixed input buffer\\nexport let INPUT_VAR_START: usize = 0;\\n\\n// Output buffer follows input variable data\\nexport let OUTPUT_START: usize = 0;\\n\\n// Computed at compilation time based on input/output schema field sizes\\nexport let OUTPUT_BUFFER_SIZE: usize = 0;\\n\\n// Variable-length output data starts after the fixed output buffer\\nexport let OUTPUT_VAR_START: usize = 0;\\n\\n// Runtime heap for intermediate values (temporary arrays, string concat buffers, etc.)\\nexport let HEAP_START: usize = 0;\\n\\n// ============================================================================\\n// Header Constants\\n// ============================================================================\\n\\n// Schema hash size in bytes\\nexport const SCHEMA_HASH_SIZE: usize = 8;\\n\\n// String descriptor format: [offset (4 bytes)] [length (4 bytes)]\\nexport const STRING_DESC_SIZE: usize = 8;\\n\\n// Array descriptor format: [offset (4 bytes)] [length (4 bytes)]\\nexport const ARRAY_DESC_SIZE: usize = 8;\\n\\n// ============================================================================\\n// Memory Allocation\\n// ============================================================================\\n\\n// Decision evaluation is single-pass (no GC needed), and most allocations are temporary\\n// (freed after result is marshaled). Linear bump allocator is fast and simple.\\nlet heapPointer: usize = 0;\\n\\n/**\\n * Initialize memory layout.\\n *\\n * This function must be called once at startup with the computed sizes\\n * for the input and output buffers based on the schema.\\n *\\n * @param inputFixedSize - Size of fixed input fields in bytes\\n * @param outputFixedSize - Size of fixed output fields in bytes\\n */\\nexport function initializeMemoryLayout(inputFixedSize: usize, outputFixedSize: usize): void {\\n INPUT_BUFFER_SIZE = inputFixedSize;\\n INPUT_VAR_START = INPUT_BUFFER_START + inputFixedSize;\\n\\n OUTPUT_BUFFER_SIZE = outputFixedSize;\\n OUTPUT_START = INPUT_VAR_START; // Output follows input variable data\\n OUTPUT_VAR_START = OUTPUT_START + outputFixedSize;\\n\\n HEAP_START = OUTPUT_VAR_START; // Heap follows output variable data\\n heapPointer = HEAP_START; // Reset heap pointer\\n}\\n\\n/**\\n * Get the current memory layout info.\\n *\\n * @returns Object with all memory region offsets and sizes\\n */\\nexport function getMemoryLayout(): MemoryLayout {\\n return new MemoryLayout(\\n NULL_POINTER_TRAP_SIZE,\\n INPUT_BUFFER_START,\\n INPUT_BUFFER_SIZE,\\n INPUT_VAR_START,\\n OUTPUT_START,\\n OUTPUT_BUFFER_SIZE,\\n OUTPUT_VAR_START,\\n HEAP_START,\\n );\\n}\\n\\n/**\\n * Memory layout information structure.\\n */\\nexport class MemoryLayout {\\n nullPointerTrapSize: usize;\\n inputBufferStart: usize;\\n inputBufferSize: usize;\\n inputVarStart: usize;\\n outputStart: usize;\\n outputBufferSize: usize;\\n outputVarStart: usize;\\n heapStart: usize;\\n\\n constructor(\\n nullPointerTrapSize: usize,\\n inputBufferStart: usize,\\n inputBufferSize: usize,\\n inputVarStart: usize,\\n outputStart: usize,\\n outputBufferSize: usize,\\n outputVarStart: usize,\\n heapStart: usize,\\n ) {\\n this.nullPointerTrapSize = nullPointerTrapSize;\\n this.inputBufferStart = inputBufferStart;\\n this.inputBufferSize = inputBufferSize;\\n this.inputVarStart = inputVarStart;\\n this.outputStart = outputStart;\\n this.outputBufferSize = outputBufferSize;\\n this.outputVarStart = outputVarStart;\\n this.heapStart = heapStart;\\n }\\n}\\n\\n// ============================================================================\\n// Simple Linear Heap Allocator\\n// ============================================================================\\n\\n/**\\n * Allocate memory from the runtime heap.\\n *\\n * A simple linear allocator - memory is never freed during a single evaluation.\\n * Suitable for short-lived operations like decision table evaluation.\\n *\\n * Memory is never freed during a single evaluation because:\\n * (1) evaluations are short-lived (milliseconds),\\n * (2) heap is reset between evaluations, and\\n * (3) avoiding free list management simplifies allocator and improves performance.\\n *\\n * @param size - Number of bytes to allocate (must be > 0)\\n * @returns Pointer to allocated memory\\n * @throws Calls abort() on OUT_OF_MEMORY - this is a critical error that halts execution\\n */\\nexport function heapAlloc(size: usize): usize {\\n if (size == 0) return 0;\\n\\n // Get current memory size in bytes (1 page = 64KB = 65536 bytes)\\n const memorySize: usize = (<usize>memory.size()) << 16;\\n\\n // Align the heap pointer to 8-byte boundary\\n const alignedPtr = alignPtr(heapPointer, 8);\\n\\n // Check for overflow when computing aligned pointer\\n // If alignedPtr wrapped around (became smaller than heapPointer), we've overflowed\\n if (alignedPtr < heapPointer) {\\n SetLastError(RuntimeErrorCode.OUT_OF_MEMORY);\\n return 0;\\n }\\n\\n // Check for overflow when computing new heap pointer\\n // If newHeapPointer would wrap around, we've overflowed\\n const maxAllowedSize = memorySize - alignedPtr;\\n if (size > maxAllowedSize) {\\n SetLastError(RuntimeErrorCode.OUT_OF_MEMORY);\\n return 0;\\n }\\n\\n const newHeapPointer = alignedPtr + size;\\n\\n // Bounds check: ensure new heap pointer doesn't exceed memory\\n if (newHeapPointer > memorySize) {\\n SetLastError(RuntimeErrorCode.OUT_OF_MEMORY);\\n return 0;\\n }\\n\\n // All checks passed, update heap pointer and return allocation\\n heapPointer = newHeapPointer;\\n return alignedPtr;\\n}\\n\\n/**\\n * Get the current heap pointer (next allocation will start here).\\n *\\n * @returns Current heap pointer address\\n */\\nexport function getHeapPointer(): usize {\\n return heapPointer;\\n}\\n\\n/**\\n * Reset the heap pointer to the start of the heap region.\\n *\\n * This allows reusing heap memory for multiple evaluations.\\n */\\nexport function resetHeap(): void {\\n heapPointer = HEAP_START;\\n}\\n\\n/**\\n * Save the current heap pointer state.\\n *\\n * @returns Current heap pointer address\\n */\\nexport function saveHeapPointer(): usize {\\n return heapPointer;\\n}\\n\\n/**\\n * Restore the heap pointer to a previously saved state.\\n *\\n * @param saved - Saved heap pointer address from saveHeapPointer()\\n */\\nexport function restoreHeapPointer(saved: usize): usize {\\n const old = heapPointer;\\n heapPointer = saved;\\n return old;\\n}\\n\\n// ============================================================================\\n// Pointer Utilities\\n// ============================================================================\\n\\n/**\\n * Align a pointer to the specified alignment boundary.\\n *\\n * @param ptr - Pointer to align\\n * @param alignment - Alignment boundary (must be a power of 2)\\n * @returns Aligned pointer\\n */\\nexport function alignPtr(ptr: usize, alignment: usize): usize {\\n return (ptr + alignment - 1) & ~(alignment - 1);\\n}\\n\\n/**\\n * Check if a pointer is null (0).\\n *\\n * @param ptr - Pointer to check\\n * @returns true if pointer is 0, false otherwise\\n */\\nexport function isNullPtr(ptr: usize): bool {\\n return ptr == 0;\\n}\\n\\n/**\\n * Check if a pointer is valid (non-null and aligned).\\n *\\n * @param ptr - Pointer to check\\n * @param alignment - Required alignment (default: 4 bytes)\\n * @returns true if pointer is valid, false otherwise\\n */\\nexport function isValidPtr(ptr: usize, alignment: usize = 4): bool {\\n if (ptr == 0) return false;\\n return (ptr & (alignment - 1)) == 0;\\n}\\n\\n// ============================================================================\\n// Buffer Access Helpers\\n// ============================================================================\\n\\n/**\\n * Get the pointer to a schema hash field.\\n *\\n * @param basePtr - Base pointer of the buffer\\n * @returns Pointer to the schema hash field\\n */\\nexport function getSchemaHashPtr(basePtr: usize): usize {\\n return basePtr;\\n}\\n\\n/**\\n * Read a schema hash from a buffer.\\n *\\n * @param basePtr - Base pointer of the buffer\\n * @returns Schema hash as u64\\n */\\nexport function readSchemaHash(basePtr: usize): u64 {\\n return load<u64>(basePtr);\\n}\\n\\n/**\\n * Write a schema hash to a buffer.\\n *\\n * @param basePtr - Base pointer of the buffer\\n * @param hash - Schema hash to write\\n */\\nexport function writeSchemaHash(basePtr: usize, hash: u64): void {\\n store<u64>(basePtr, hash);\\n}\\n\\n/**\\n * Get the pointer to a field in a fixed-size buffer.\\n *\\n * @param bufferPtr - Base pointer of the buffer\\n * @param fieldOffset - Offset of the field from the buffer start\\n * @returns Pointer to the field\\n */\\nexport function getFieldPtr(bufferPtr: usize, fieldOffset: usize): usize {\\n return bufferPtr + fieldOffset;\\n}\\n\\n// ============================================================================\\n// String Descriptor Helpers\\n// ============================================================================\\n\\n/**\\n * Get the offset and length components of a string descriptor.\\n *\\n * String descriptor format: [offset (4 bytes)] [length (4 bytes)]\\n *\\n * @param descPtr - Pointer to the string descriptor\\n * @returns Object with offset and length\\n */\\nexport function readStringDesc(descPtr: usize): StringDesc {\\n return new StringDesc(load<u32>(descPtr), load<u32>(descPtr + 4));\\n}\\n\\n/**\\n * Write a string descriptor.\\n *\\n * @param descPtr - Pointer to the string descriptor\\n * @param offset - Offset to the string data\\n * @param length - Length of the string data\\n */\\nexport function writeStringDesc(descPtr: usize, offset: u32, length: u32): void {\\n store<u32>(descPtr, offset);\\n store<u32>(descPtr + 4, length);\\n}\\n\\n/**\\n * String descriptor structure.\\n */\\nexport class StringDesc {\\n offset: u32;\\n length: u32;\\n\\n constructor(offset: u32, length: u32) {\\n this.offset = offset;\\n this.length = length;\\n }\\n\\n isEmpty(): bool {\\n return this.length == 0;\\n }\\n}\\n\\n// ============================================================================\\n// Array Descriptor Helpers\\n// ============================================================================\\n\\n/**\\n * Get the offset and length components of an array descriptor.\\n *\\n * Array descriptor format: [offset (4 bytes)] [length (4 bytes)]\\n *\\n * @param descPtr - Pointer to the array descriptor\\n * @returns Object with offset and length\\n */\\nexport function readArrayDesc(descPtr: usize): ArrayDesc {\\n return new ArrayDesc(load<u32>(descPtr), load<u32>(descPtr + 4));\\n}\\n\\n/**\\n * Write an array descriptor.\\n *\\n * @param descPtr - Pointer to the array descriptor\\n * @param offset - Offset to the array data\\n * @param length - Number of elements in the array\\n */\\nexport function writeArrayDesc(descPtr: usize, offset: u32, length: u32): void {\\n store<u32>(descPtr, offset);\\n store<u32>(descPtr + 4, length);\\n}\\n\\n/**\\n * Array descriptor structure.\\n */\\nexport class ArrayDesc {\\n offset: u32;\\n length: u32;\\n\\n constructor(offset: u32, length: u32) {\\n this.offset = offset;\\n this.length = length;\\n }\\n\\n isEmpty(): bool {\\n return this.length == 0;\\n }\\n}\\n\\n// ============================================================================\\n// Runtime Error Handling\\n// ============================================================================\\n\\n// Error codes for runtime failures\\nexport enum RuntimeErrorCode {\\n NONE = 0,\\n SCHEMA_MISMATCH = 1,\\n NULL_POINTER = 2,\\n INVALID_ACCESS = 3,\\n EVALUATION_ERROR = 4,\\n OUT_OF_MEMORY = 5,\\n}\\n\\n// Last error that occurred during evaluation\\nlet lastErrorCode: RuntimeErrorCode = RuntimeErrorCode.NONE;\\n\\n// Optional error message (allocated on heap for variable-length messages)\\nlet errorMessagePtr: usize = 0;\\n\\n/**\\n * Check if an error code represents a critical error that should abort execution.\\n *\\n * Critical errors are unrecoverable conditions where continuing execution would\\n * likely lead to memory corruption, crashes, or incorrect results. These errors\\n * call abort() to immediately halt the WASM module.\\n *\\n * Critical errors:\\n * - OUT_OF_MEMORY: Memory allocation failed; continuing could corrupt state\\n * - NULL_POINTER: Null pointer dereference; memory safety violation\\n * - INVALID_ACCESS: Invalid memory access; memory safety violation\\n *\\n * Non-critical errors (set flag, caller must check hasError()):\\n * - SCHEMA_MISMATCH: Input doesn't match schema; recoverable\\n * - EVALUATION_ERROR: Logic error in decision evaluation; recoverable\\n *\\n * @param code - The error code to check\\n * @returns true if the error is critical and should abort\\n */\\nexport function isCriticalError(code: RuntimeErrorCode): bool {\\n return (\\n code === RuntimeErrorCode.OUT_OF_MEMORY ||\\n code === RuntimeErrorCode.NULL_POINTER ||\\n code === RuntimeErrorCode.INVALID_ACCESS\\n );\\n}\\n\\n/**\\n * Get the last error code that occurred during evaluation.\\n *\\n * @returns The last error code\\n */\\nexport function getLastError(): RuntimeErrorCode {\\n return lastErrorCode;\\n}\\n\\n/**\\n * Set the last error code and optional message.\\n *\\n * For critical errors (OUT_OF_MEMORY, NULL_POINTER, INVALID_ACCESS), this function\\n * calls abort() to immediately halt execution. Critical errors indicate unrecoverable\\n * conditions where continuing would lead to memory corruption or undefined behavior.\\n *\\n * For non-critical errors (SCHEMA_MISMATCH, EVALUATION_ERROR), callers MUST check\\n * hasError() after operations that can fail and handle the error appropriately.\\n * Failure to check error state may result in incorrect evaluation results.\\n *\\n * @param code - The error code\\n * @param message - Optional error message (allocated on heap)\\n */\\nexport function SetLastError(code: RuntimeErrorCode, message: usize = 0): void {\\n lastErrorCode = code;\\n errorMessagePtr = message;\\n\\n // Critical errors abort immediately to prevent corrupted state propagation\\n if (isCriticalError(code)) {\\n abort();\\n }\\n}\\n\\n/**\\n * Clear the last error (reset to NONE).\\n */\\nexport function clearLastError(): void {\\n lastErrorCode = RuntimeErrorCode.NONE;\\n errorMessagePtr = 0;\\n}\\n\\n/**\\n * Set an error with a string message.\\n *\\n * This is a convenience function that combines SetLastError() with writeString().\\n * The error message is allocated on the heap and will be freed by the next error.\\n *\\n * For critical errors (OUT_OF_MEMORY, NULL_POINTER, INVALID_ACCESS), this function\\n * will call abort() after setting the error, immediately halting execution.\\n *\\n * For non-critical errors (SCHEMA_MISMATCH, EVALUATION_ERROR), callers MUST check\\n * hasError() after operations that can fail.\\n *\\n * @param code - The error code\\n * @param message - The error message string\\n */\\nexport function SetLastErrorWithMessage(code: RuntimeErrorCode, message: string): void {\\n const messagePtr = writeString(message);\\n SetLastError(code, messagePtr);\\n}\\n\\n/**\\n * Get the pointer to the error message.\\n *\\n * @returns Pointer to error message (0 if no message)\\n */\\nexport function getErrorMessagePtr(): usize {\\n return errorMessagePtr;\\n}\\n\\n/**\\n * Check if an error occurred.\\n *\\n * Callers MUST check this function after operations that can set non-critical errors\\n * (SCHEMA_MISMATCH, EVALUATION_ERROR). Critical errors (OUT_OF_MEMORY, NULL_POINTER,\\n * INVALID_ACCESS) abort immediately and never reach this check.\\n *\\n * Example usage:\\n * ```assemblyscript\\n * let result = someOperationThatCanFail();\\n * if (hasError()) {\\n * // Handle error - return early, propagate error, etc.\\n * return Value.Null();\\n * }\\n * // Continue with valid result\\n * ```\\n *\\n * @returns true if a non-critical error occurred, false otherwise\\n */\\nexport function hasError(): bool {\\n return lastErrorCode !== RuntimeErrorCode.NONE;\\n}\\n\\n// ============================================================================\\n// Memory Validation Helpers\\n// ============================================================================\\n\\n/**\\n * Check if a pointer is within the valid memory range.\\n *\\n * This is a basic check that can help catch out-of-bounds accesses.\\n * Note: In production, you may want to disable these checks for performance.\\n *\\n * @param ptr - Pointer to check\\n * @param size - Size of the region to check\\n * @return true if pointer is within valid range, false otherwise\\n */\\nexport function isValidMemoryRange(ptr: usize, size: usize): bool {\\n if (ptr == 0) return false;\\n\\n // Get current memory size (AssemblyScript runtime provides this)\\n const memorySize: usize = memory.size() << 16; // 1 page = 64KB\\n\\n return ptr + size <= memorySize;\\n}\\n\\n/**\\n * Check if a pointer is within the input buffer region.\\n *\\n * @param ptr - Pointer to check\\n * @return true if pointer is within input buffer, false otherwise\\n */\\nexport function isWithinInputBuffer(ptr: usize): bool {\\n return ptr >= INPUT_BUFFER_START && ptr < INPUT_VAR_START;\\n}\\n\\n/**\\n * Check if a pointer is within the input variable data region.\\n *\\n * @param ptr - Pointer to check\\n * @return true if pointer is within input variable data, false otherwise\\n */\\nexport function isWithinInputVar(ptr: usize): bool {\\n return ptr >= INPUT_VAR_START && ptr < OUTPUT_START;\\n}\\n\\n/**\\n * Check if a pointer is within the output buffer region.\\n *\\n * @param ptr - Pointer to check\\n * @return true if pointer is within output buffer, false otherwise\\n */\\nexport function isWithinOutputBuffer(ptr: usize): bool {\\n return ptr >= OUTPUT_START && ptr < OUTPUT_VAR_START;\\n}\\n\\n/**\\n * Check if a pointer is within the output variable data region.\\n *\\n * @param ptr - Pointer to check\\n * @return true if pointer is within output variable data, false otherwise\\n */\\nexport function isWithinOutputVar(ptr: usize): bool {\\n return ptr >= OUTPUT_VAR_START && ptr < HEAP_START;\\n}\\n\\n/**\\n * Check if a pointer is within the heap region.\\n *\\n * @param ptr - Pointer to check\\n * @return true if pointer is within heap, false otherwise\\n */\\nexport function isWithinHeap(ptr: usize): bool {\\n return ptr >= HEAP_START;\\n}\\n\";\nexport const RUNTIME_STRINGS = \"// assembly/runtime/strings.ts (AssemblyScript)\\n// UTF-16 string handling for WASM linear memory\\n\\nimport { heapAlloc } from './memory';\\n\\n// ============================================================================\\n// String Memory Format\\n// ============================================================================\\n\\n/**\\n * String memory layout: [length: u32][utf16 chars...]\\n *\\n * We use a length-prefixed format; this allows O(1) length checks and efficient substring\\n * operations without scanning for null terminators. Also matches AssemblyScript's native\\n * string representation. The first 4 bytes contain the length (number of UTF-16 code units).\\n * Following that are the UTF-16 code units, each 2 bytes.\\n */\\n\\n// ============================================================================\\n// String Constants\\n// ============================================================================\\n\\n/**\\n * Size of the length field header in bytes.\\n */\\nexport const STRING_LENGTH_SIZE: usize = 4;\\n\\n/**\\n * Size of each UTF-16 code unit in bytes.\\n */\\nexport const UTF16_CODE_UNIT_SIZE: usize = 2;\\n\\n/**\\n * Minimum string length to use bulk memory operations.\\n * For strings shorter than this, character-by-character writes are used\\n * as the setup overhead dominates. For longer strings, bulk operations\\n * provide significant performance benefits.\\n */\\nconst MIN_BULK_COPY_STRING_LENGTH: usize = 32;\\n\\n// ============================================================================\\n// String Writing\\n// ============================================================================\\n\\n/**\\n * Write a string to memory and return its pointer.\\n *\\n * Memory is allocated from the runtime heap using heapAlloc().\\n * The memory is aligned to 4 bytes for efficient access.\\n *\\n * @param s - The string to write to memory\\n * @returns Pointer to the allocated string data, or 0 if allocation failed\\n */\\nexport function writeString(s: string): usize {\\n const len: usize = <usize>s.length;\\n\\n // Calculate total size: length field (4 bytes) + UTF-16 characters (2 bytes each)\\n const totalSize = STRING_LENGTH_SIZE + len * UTF16_CODE_UNIT_SIZE;\\n\\n // Four-byte alignment ensures proper alignment for u32 loads/stores, avoiding unaligned access\\n // penalties on some architectures. WASM requires aligned memory access for multi-byte types.\\n // Allocate memory from heap\\n const ptr = heapAlloc(totalSize);\\n\\n // Return 0 if allocation failed\\n if (ptr == 0) {\\n return 0;\\n }\\n\\n // Write length (number of UTF-16 code units)\\n store<u32>(ptr, len);\\n\\n // Handle empty string case (len == 0)\\n if (len == 0) {\\n return ptr;\\n }\\n\\n // For long strings, use bulk memory copy for better performance.\\n // AssemblyScript strings are internally UTF-16, matching our memory format.\\n if (len >= MIN_BULK_COPY_STRING_LENGTH) {\\n // Get pointer to the string's internal UTF-16 data\\n const srcPtr = changetype<usize>(s);\\n // Copy the UTF-16 data directly\\n memory.copy(ptr + STRING_LENGTH_SIZE, srcPtr, len * UTF16_CODE_UNIT_SIZE);\\n } else {\\n // For short strings, character-by-character writes avoid bulk operation overhead\\n for (let i: usize = 0; i < len; i++) {\\n const codeUnit: u16 = unchecked(<u16>s.charCodeAt(<i32>i));\\n store<u16>(ptr + STRING_LENGTH_SIZE + i * UTF16_CODE_UNIT_SIZE, codeUnit);\\n }\\n }\\n\\n return ptr;\\n}\\n\\n// ============================================================================\\n// String Reading\\n// ============================================================================\\n\\n/**\\n * Read a string from memory.\\n *\\n * @param ptr - Pointer to the string data in memory\\n * @returns The read string, or empty string if pointer is null\\n */\\nexport function readString(ptr: usize): string {\\n // Return empty string for null pointer\\n if (ptr == 0) {\\n return '';\\n }\\n\\n // Read length (number of UTF-16 code units)\\n const len: usize = <usize>load<u32>(ptr);\\n\\n // Handle empty string case\\n if (len == 0) {\\n return '';\\n }\\n\\n // Use bulk memory read for O(n) performance instead of O(n²) string concatenation.\\n // String.UTF16.decodeUnsafe reads UTF-16 data directly from memory in a single allocation,\\n // avoiding the repeated string allocations that occur with character-by-character concatenation.\\n return String.UTF16.decodeUnsafe(ptr + STRING_LENGTH_SIZE, len * UTF16_CODE_UNIT_SIZE);\\n}\\n\\n// ============================================================================\\n// String Utility Functions\\n// ============================================================================\\n\\n/**\\n * Calculate the size in bytes needed to store a string in memory.\\n *\\n * @param len - The length of the string (number of UTF-16 code units)\\n * @returns The total size in bytes including the length header\\n */\\nexport function getStringSize(len: usize): usize {\\n return STRING_LENGTH_SIZE + len * UTF16_CODE_UNIT_SIZE;\\n}\\n\\n/**\\n * Calculate the length of a string from its pointer in memory.\\n *\\n * @param ptr - Pointer to the string data in memory\\n * @returns The length of the string (number of UTF-16 code units), or 0 if null\\n */\\nexport function getStringLength(ptr: usize): usize {\\n if (ptr == 0) {\\n return 0;\\n }\\n return load<u32>(ptr);\\n}\\n\\n/**\\n * Check if a string pointer points to an empty string.\\n *\\n * @param ptr - Pointer to the string data in memory\\n * @returns true if the string is empty or pointer is null, false otherwise\\n */\\nexport function isStringEmpty(ptr: usize): bool {\\n if (ptr == 0) {\\n return true;\\n }\\n return load<u32>(ptr) == 0;\\n}\\n\\n/**\\n * Compare two strings in memory.\\n *\\n * @param ptr1 - Pointer to the first string\\n * @param ptr2 - Pointer to the second string\\n * @returns true if the strings are equal, false otherwise\\n */\\nexport function stringsEqual(ptr1: usize, ptr2: usize): bool {\\n // If both are null, they're equal\\n if (ptr1 == 0 && ptr2 == 0) {\\n return true;\\n }\\n\\n // If only one is null, they're not equal\\n if (ptr1 == 0 || ptr2 == 0) {\\n return false;\\n }\\n\\n // Compare lengths\\n const len1 = load<u32>(ptr1);\\n const len2 = load<u32>(ptr2);\\n\\n if (len1 != len2) {\\n return false;\\n }\\n\\n // Compare each UTF-16 code unit\\n for (let i: usize = 0; i < <usize>len1; i++) {\\n const offset = STRING_LENGTH_SIZE + i * UTF16_CODE_UNIT_SIZE;\\n const char1 = load<u16>(ptr1 + offset);\\n const char2 = load<u16>(ptr2 + offset);\\n if (char1 != char2) {\\n return false;\\n }\\n }\\n\\n return true;\\n}\\n\\n/**\\n * Calculate a simple hash of a string in memory.\\n *\\n * This can be used for quick comparisons or deduplication.\\n * Uses a simple polynomial rolling hash algorithm.\\n *\\n * @param ptr - Pointer to the string data in memory\\n * @returns A hash value for the string (0 if null)\\n */\\nexport function hashString(ptr: usize): u32 {\\n if (ptr == 0) {\\n return 0;\\n }\\n\\n const len: usize = <usize>load<u32>(ptr);\\n let hash: u32 = 5381;\\n\\n for (let i: usize = 0; i < len; i++) {\\n const charCode = load<u16>(ptr + STRING_LENGTH_SIZE + i * UTF16_CODE_UNIT_SIZE);\\n hash = unchecked((hash << 5) + hash + unchecked(charCode)); // hash * 33 + charCode\\n }\\n\\n return hash;\\n}\\n\\n/**\\n * Copy a string within memory.\\n *\\n * Creates a new copy of the string at a new location in the heap.\\n *\\n * @param srcPtr - Pointer to the source string\\n * @returns Pointer to the newly allocated copy, or 0 if allocation failed\\n */\\nexport function copyString(srcPtr: usize): usize {\\n if (srcPtr == 0) {\\n return 0;\\n }\\n\\n // Get the length of the source string\\n const len: usize = <usize>load<u32>(srcPtr);\\n\\n // Calculate total size\\n const totalSize = STRING_LENGTH_SIZE + len * UTF16_CODE_UNIT_SIZE;\\n\\n // Allocate new memory\\n const dstPtr = heapAlloc(totalSize);\\n\\n if (dstPtr == 0) {\\n return 0;\\n }\\n\\n // Copy the entire string data (length header + UTF-16 code units)\\n memory.copy(dstPtr, srcPtr, totalSize);\\n\\n return dstPtr;\\n}\\n\";\nexport const RUNTIME_ARRAYS = \"// assembly/runtime/arrays.ts (AssemblyScript)\\n// Array handling for WASM linear memory\\n\\nimport { heapAlloc } from './memory';\\nimport { writeString, readString } from './strings';\\nimport {\\n Value,\\n TYPE_NULL,\\n TYPE_BOOL,\\n TYPE_INT,\\n TYPE_FLOAT,\\n TYPE_STRING,\\n TYPE_ARRAY,\\n TYPE_OBJECT,\\n} from './values';\\n\\n// ============================================================================\\n// Array Constants\\n// ============================================================================\\n\\n/**\\n * Size of the length field header in bytes for arrays.\\n */\\nexport const ARRAY_LENGTH_SIZE: usize = 4;\\n\\n/**\\n * Size of each F64 element in bytes.\\n */\\nexport const F64_ELEMENT_SIZE: usize = 8;\\n\\n/**\\n * Size of each element pointer (usize) in bytes for generic arrays.\\n */\\nexport const ELEMENT_PTR_SIZE: usize = 4;\\n\\n/**\\n * Size of the type tag field in bytes for serialized Values.\\n */\\nexport const VALUE_TYPE_SIZE: usize = 4;\\n\\n/**\\n * Size of the bool field in bytes for serialized Values.\\n */\\nexport const VALUE_BOOL_SIZE: usize = 1;\\n\\n/**\\n * Size of the int field in bytes for serialized Values.\\n */\\nexport const VALUE_INT_SIZE: usize = 8;\\n\\n/**\\n * Size of the float field in bytes for serialized Values.\\n */\\nexport const VALUE_FLOAT_SIZE: usize = 8;\\n\\n/**\\n * Size of the pointer field in bytes for serialized Values (string, array, object).\\n */\\nexport const VALUE_PTR_SIZE: usize = 4;\\n\\n// ============================================================================\\n// F64 Array Handling\\n// ============================================================================\\n\\n/**\\n * Write a numeric array (Array<f64>) to memory.\\n *\\n * The array is stored in the format: [length: u32][f64 elements...]\\n *\\n * Memory is allocated from the runtime heap using heapAlloc().\\n * The memory is aligned to 8 bytes for efficient access.\\n *\\n * @param arr - The array to write to memory\\n * @returns Pointer to the allocated array data, or 0 if allocation failed\\n */\\nexport function writeF64Array(arr: Array<f64>): usize {\\n const len = <u32>arr.length;\\n\\n // Calculate total size: length field (4 bytes) + f64 elements (8 bytes each)\\n const totalSize = ARRAY_LENGTH_SIZE + <usize>len * F64_ELEMENT_SIZE;\\n\\n // Allocate memory from heap\\n const ptr = heapAlloc(totalSize);\\n\\n // Return 0 if allocation failed\\n if (ptr == 0) {\\n return 0;\\n }\\n\\n // Write length\\n store<u32>(ptr, len);\\n\\n // Write each f64 element\\n for (let i: u32 = 0; i < len; i++) {\\n store<f64>(ptr + ARRAY_LENGTH_SIZE + <usize>i * F64_ELEMENT_SIZE, arr[i]);\\n }\\n\\n return ptr;\\n}\\n\\n/**\\n * Read a numeric array (Array<f64>) from memory.\\n *\\n * The array must be stored in the format: [length: u32][f64 elements...]\\n *\\n * @param ptr - Pointer to the array data in memory\\n * @returns The read array, or empty array if pointer is null\\n */\\nexport function readF64Array(ptr: usize): Array<f64> {\\n // Return empty array for null pointer\\n if (ptr == 0) {\\n return new Array<f64>();\\n }\\n\\n // Read length\\n const len = load<u32>(ptr);\\n\\n // Create array and populate it\\n const result = new Array<f64>(len);\\n for (let i: u32 = 0; i < len; i++) {\\n result[i] = load<f64>(ptr + ARRAY_LENGTH_SIZE + <usize>i * F64_ELEMENT_SIZE);\\n }\\n\\n return result;\\n}\\n\\n/**\\n * Calculate the size in bytes needed to store an F64 array in memory.\\n *\\n * @param len - The length of the array\\n * @returns The total size in bytes including the length header\\n */\\nexport function getF64ArraySize(len: usize): usize {\\n return ARRAY_LENGTH_SIZE + len * F64_ELEMENT_SIZE;\\n}\\n\\n// ============================================================================\\n// Value Serialization\\n// ============================================================================\\n\\n/**\\n * Write a Value to memory and return its pointer.\\n *\\n * For complex types (string/array/object), storing the actual data inline would make\\n * Value structs variable-sized and unpredictable. Storing pointers provides fixed-size\\n * Values (predictable offsets) while allowing arbitrary complex data on the heap.\\n *\\n * The Value is stored in the format: [type: u32][value_data...]\\n *\\n * For primitive types (bool, int, float), value_data is the actual value.\\n * For complex types (string, array, object), value_data is a pointer to the data.\\n *\\n * Memory is allocated from the runtime heap using heapAlloc().\\n *\\n * @param v - The Value to write to memory\\n * @returns Pointer to the allocated Value data, or 0 if allocation failed\\n */\\nexport function writeValue(v: Value): usize {\\n const type = v.type;\\n\\n if (type == TYPE_NULL) {\\n // For null, just write the type tag\\n const ptr = heapAlloc(VALUE_TYPE_SIZE);\\n if (ptr == 0) return 0;\\n store<u32>(ptr, type);\\n return ptr;\\n } else if (type == TYPE_BOOL) {\\n // Format: [type: u32][bool: u8]\\n const ptr = heapAlloc(VALUE_TYPE_SIZE + VALUE_BOOL_SIZE);\\n if (ptr == 0) return 0;\\n store<u32>(ptr, type);\\n store<u8>(ptr + VALUE_TYPE_SIZE, v.boolVal ? 1 : 0);\\n return ptr;\\n } else if (type == TYPE_INT) {\\n // Format: [type: u32][int: i64]\\n const ptr = heapAlloc(VALUE_TYPE_SIZE + VALUE_INT_SIZE);\\n if (ptr == 0) return 0;\\n store<u32>(ptr, type);\\n store<i64>(ptr + VALUE_TYPE_SIZE, v.intVal);\\n return ptr;\\n } else if (type == TYPE_FLOAT) {\\n // Format: [type: u32][float: f64]\\n const ptr = heapAlloc(VALUE_TYPE_SIZE + VALUE_FLOAT_SIZE);\\n if (ptr == 0) return 0;\\n store<u32>(ptr, type);\\n store<f64>(ptr + VALUE_TYPE_SIZE, v.floatVal);\\n return ptr;\\n } else if (type == TYPE_STRING) {\\n // Format: [type: u32][stringPtr: u32]\\n const ptr = heapAlloc(VALUE_TYPE_SIZE + VALUE_PTR_SIZE);\\n if (ptr == 0) return 0;\\n store<u32>(ptr, type);\\n const stringVal = v.stringVal != null ? v.stringVal! : '';\\n const stringPtr = writeString(stringVal);\\n store<u32>(ptr + VALUE_TYPE_SIZE, stringPtr);\\n return ptr;\\n } else if (type == TYPE_ARRAY) {\\n // Format: [type: u32][arrayPtr: u32]\\n const ptr = heapAlloc(VALUE_TYPE_SIZE + VALUE_PTR_SIZE);\\n if (ptr == 0) return 0;\\n store<u32>(ptr, type);\\n const arrayVal = v.arrayVal != null ? v.arrayVal! : new Array<Value>();\\n const arrayPtr = writeValueArray(arrayVal);\\n store<u32>(ptr + VALUE_TYPE_SIZE, arrayPtr);\\n return ptr;\\n } else if (type == TYPE_OBJECT) {\\n // Format: [type: u32][objectPtr: u32]\\n const ptr = heapAlloc(VALUE_TYPE_SIZE + VALUE_PTR_SIZE);\\n if (ptr == 0) return 0;\\n store<u32>(ptr, type);\\n const objectVal = v.objectVal != null ? v.objectVal! : new Map<string, Value>();\\n const objectPtr = writeValueMap(objectVal);\\n store<u32>(ptr + VALUE_TYPE_SIZE, objectPtr);\\n return ptr;\\n }\\n\\n return 0; // Unknown type\\n}\\n\\n/**\\n * Read a Value from memory.\\n *\\n * The Value must be stored in the format: [type: u32][value_data...]\\n *\\n * @param ptr - Pointer to the Value data in memory\\n * @returns The read Value, or null if pointer is invalid\\n */\\nexport function readValue(ptr: usize): Value {\\n // Return null for null pointer\\n if (ptr == 0) {\\n return Value.Null();\\n }\\n\\n // Read type\\n const type = load<u32>(ptr);\\n\\n if (type == TYPE_NULL) {\\n return Value.Null();\\n } else if (type == TYPE_BOOL) {\\n const boolVal = load<u8>(ptr + VALUE_TYPE_SIZE) != 0;\\n return Value.Bool(boolVal);\\n } else if (type == TYPE_INT) {\\n const intVal = load<i64>(ptr + VALUE_TYPE_SIZE);\\n return Value.Int(intVal);\\n } else if (type == TYPE_FLOAT) {\\n const floatVal = load<f64>(ptr + VALUE_TYPE_SIZE);\\n return Value.Float(floatVal);\\n } else if (type == TYPE_STRING) {\\n const stringPtr = load<u32>(ptr + VALUE_TYPE_SIZE);\\n const stringVal = readString(stringPtr);\\n return Value.String(stringVal);\\n } else if (type == TYPE_ARRAY) {\\n const arrayPtr = load<u32>(ptr + VALUE_TYPE_SIZE);\\n const arrayVal = readValueArray(arrayPtr);\\n return Value.Array(arrayVal);\\n } else if (type == TYPE_OBJECT) {\\n const objectPtr = load<u32>(ptr + VALUE_TYPE_SIZE);\\n const objectVal = readValueMap(objectPtr);\\n return Value.Object(objectVal);\\n }\\n\\n return Value.Null(); // Unknown type\\n}\\n\\n// ============================================================================\\n// Value Array Handling\\n// ============================================================================\\n\\n// Format marker for flat numeric arrays (high bit set in length field)\\nconst FLAT_ARRAY_MARKER: u32 = 0x80000000;\\n\\n/**\\n * Detect if an array contains only floats/ints (homogeneous numeric array).\\n *\\n * @param arr - The array to check\\n * @returns true if all elements are TYPE_FLOAT or TYPE_INT, false otherwise\\n */\\nfunction isHomogeneousNumericArray(arr: Array<Value>): bool {\\n const len = arr.length;\\n if (len == 0) return false;\\n\\n for (let i = 0; i < len; i++) {\\n const type = arr[i].type;\\n if (type != TYPE_FLOAT && type != TYPE_INT) {\\n return false;\\n }\\n }\\n return true;\\n}\\n\\n/**\\n * Write a homogeneous numeric array in flat format.\\n *\\n * Format: [length | FLAT_ARRAY_MARKER: u32][f64 elements...]\\n *\\n * The high bit of the length field is set to indicate flat format.\\n * This specialized format avoids individual Value allocations and type tags,\\n * reducing memory overhead and fragmentation significantly.\\n *\\n * @param arr - The array to write (must be homogeneous numeric)\\n * @returns Pointer to the allocated array data, or 0 if allocation failed\\n */\\nfunction writeHomogeneousNumericArray(arr: Array<Value>): usize {\\n const len = <u32>arr.length;\\n\\n // Calculate total size: length with marker (4) + f64 elements (8 each)\\n const totalSize = ARRAY_LENGTH_SIZE + <usize>len * F64_ELEMENT_SIZE;\\n\\n // Single allocation for entire array\\n const ptr = heapAlloc(totalSize);\\n if (ptr == 0) return 0;\\n\\n // Write length with high bit set to indicate flat format\\n store<u32>(ptr, len | FLAT_ARRAY_MARKER);\\n\\n // Write all numeric values as f64 directly (no Value wrapping)\\n for (let i: u32 = 0; i < len; i++) {\\n const val = arr[i];\\n const numVal = val.type == TYPE_FLOAT ? val.floatVal : <f64>val.intVal;\\n store<f64>(ptr + ARRAY_LENGTH_SIZE + <usize>i * F64_ELEMENT_SIZE, numVal);\\n }\\n\\n return ptr;\\n}\\n\\n/**\\n * Read a homogeneous numeric array from flat format.\\n *\\n * Format: [length | FLAT_ARRAY_MARKER: u32][f64 elements...]\\n *\\n * @param ptr - Pointer to the array data in memory\\n * @param len - The actual length (without the marker bit)\\n * @returns The read array of Value objects\\n */\\nfunction readHomogeneousNumericArray(ptr: usize, len: u32): Array<Value> {\\n const result = new Array<Value>(len);\\n\\n // Read all f64 values and wrap them as Value.Float\\n for (let i: u32 = 0; i < len; i++) {\\n const numVal = load<f64>(ptr + ARRAY_LENGTH_SIZE + <usize>i * F64_ELEMENT_SIZE);\\n result[i] = Value.Float(numVal);\\n }\\n\\n return result;\\n}\\n\\n/**\\n * Write a Value array to memory.\\n *\\n * The array is stored in one of two formats:\\n *\\n * 1. Flat numeric format (for homogeneous numeric arrays):\\n * [length | FLAT_ARRAY_MARKER: u32][f64 elements...]\\n *\\n * 2. Generic format (for mixed-type arrays):\\n * [length: u32][Value pointers...]\\n *\\n * Homogeneous numeric arrays are detected and serialized using a flat format\\n * that eliminates per-element allocations and type tags, significantly reducing\\n * memory overhead (from ~16+ bytes per element to 8 bytes) and fragmentation.\\n * The flat format is indicated by setting the high bit of the length field.\\n *\\n * Memory is allocated from the runtime heap using heapAlloc().\\n *\\n * @param arr - The array to write to memory\\n * @returns Pointer to the allocated array data, or 0 if allocation failed\\n */\\nexport function writeValueArray(arr: Array<Value>): usize {\\n const len = <u32>arr.length;\\n\\n // Empty array (generic format)\\n if (len == 0) {\\n const ptr = heapAlloc(ARRAY_LENGTH_SIZE);\\n if (ptr == 0) return 0;\\n store<u32>(ptr, 0);\\n return ptr;\\n }\\n\\n // Optimization: detect homogeneous numeric arrays and use flat format\\n if (isHomogeneousNumericArray(arr)) {\\n return writeHomogeneousNumericArray(arr);\\n }\\n\\n // Generic path: mixed-type array\\n // Format: [length: u32][Value pointers...]\\n const totalSize = ARRAY_LENGTH_SIZE + <usize>len * ELEMENT_PTR_SIZE;\\n\\n const ptr = heapAlloc(totalSize);\\n if (ptr == 0) return 0;\\n\\n store<u32>(ptr, len);\\n\\n // Write each Value pointer\\n for (let i: u32 = 0; i < len; i++) {\\n const valuePtr = writeValue(arr[i]);\\n store<u32>(ptr + ARRAY_LENGTH_SIZE + <usize>i * ELEMENT_PTR_SIZE, valuePtr);\\n }\\n\\n return ptr;\\n}\\n\\n/**\\n * Read a Value array from memory.\\n *\\n * Handles both flat numeric format and generic format:\\n *\\n * 1. Flat numeric format: [length | FLAT_ARRAY_MARKER: u32][f64 elements...]\\n * 2. Generic format: [length: u32][Value pointers...]\\n *\\n * The format is detected by checking if the high bit of the length is set.\\n *\\n * @param ptr - Pointer to the array data in memory\\n * @returns The read array, or empty array if pointer is null\\n */\\nexport function readValueArray(ptr: usize): Array<Value> {\\n // Return empty array for null pointer\\n if (ptr == 0) {\\n return new Array<Value>();\\n }\\n\\n // Read length (with potential marker bit)\\n const lengthField = load<u32>(ptr);\\n\\n // Check if this is a flat numeric array (high bit set)\\n if ((lengthField & FLAT_ARRAY_MARKER) != 0) {\\n // Flat numeric format - extract actual length\\n const len = lengthField & ~FLAT_ARRAY_MARKER;\\n return readHomogeneousNumericArray(ptr, len);\\n }\\n\\n // Generic format - length is used as-is\\n const len = lengthField;\\n\\n // Empty array\\n if (len == 0) {\\n return new Array<Value>();\\n }\\n\\n // Read array of Value pointers\\n const result = new Array<Value>(len);\\n for (let i: u32 = 0; i < len; i++) {\\n const valuePtr = load<u32>(ptr + ARRAY_LENGTH_SIZE + <usize>i * ELEMENT_PTR_SIZE);\\n result[i] = readValue(valuePtr);\\n }\\n\\n return result;\\n}\\n\\n/**\\n * Calculate the size in bytes needed to store a Value array in memory.\\n *\\n * Note: This calculates the size for the generic format.\\n * For flat numeric arrays, the actual size may be different.\\n *\\n * @param len - The length of the array\\n * @returns The total size in bytes including the length header (but not the individual Values)\\n */\\nexport function getValueArraySize(len: usize): usize {\\n return ARRAY_LENGTH_SIZE + len * ELEMENT_PTR_SIZE;\\n}\\n\\n// ============================================================================\\n// Value Map (Object) Handling\\n// ============================================================================\\n\\n/**\\n * Write a Value map to memory.\\n *\\n * The map is stored in the format: [length: u32][keyPtr1: u32][valuePtr1: u32][keyPtr2: u32][valuePtr2: u32]...\\n *\\n * Keys are always strings and written to memory separately using writeString().\\n * Values are serialized using writeValue() separately.\\n *\\n * Memory is allocated from the runtime heap using heapAlloc().\\n *\\n * JavaScript object property order is insertion-ordered (ES2015+), so we must preserve\\n * order when serializing to match JS semantics and ensure deterministic output.\\n *\\n * @param map - The map to write to memory\\n * @returns Pointer to the allocated map data, or 0 if allocation failed\\n */\\nexport function writeValueMap(map: Map<string, Value>): usize {\\n const len = <u32>map.size;\\n\\n // Calculate total size: length field (4 bytes) + key/value pairs (8 bytes each)\\n const totalSize = ARRAY_LENGTH_SIZE + <usize>len * 2 * ELEMENT_PTR_SIZE;\\n\\n // Allocate memory from heap\\n const ptr = heapAlloc(totalSize);\\n\\n // Return 0 if allocation failed\\n if (ptr == 0) {\\n return 0;\\n }\\n\\n // Write length\\n store<u32>(ptr, len);\\n\\n // Get keys and write each key/value pair\\n const keys = map.keys();\\n for (let i: u32 = 0; i < <u32>keys.length; i++) {\\n const key = keys[i];\\n const offset = ptr + ARRAY_LENGTH_SIZE + <usize>i * 2 * ELEMENT_PTR_SIZE;\\n\\n // Write key pointer\\n const keyPtr = writeString(key);\\n store<u32>(offset, keyPtr);\\n\\n // Write value pointer\\n const valuePtr = writeValue(map.get(key));\\n store<u32>(offset + ELEMENT_PTR_SIZE, valuePtr);\\n }\\n\\n return ptr;\\n}\\n\\n/**\\n * Read a Value map from memory.\\n *\\n * The map must be stored in the format: [length: u32][keyPtr1: u32][valuePtr1: u32][keyPtr2: u32][valuePtr2: u32]...\\n *\\n * @param ptr - Pointer to the map data in memory\\n * @returns The read map, or empty map if pointer is null\\n */\\nexport function readValueMap(ptr: usize): Map<string, Value> {\\n // Return empty map for null pointer\\n if (ptr == 0) {\\n return new Map<string, Value>();\\n }\\n\\n // Read length\\n const len = load<u32>(ptr);\\n\\n // Create map and populate it\\n const result = new Map<string, Value>();\\n for (let i: u32 = 0; i < len; i++) {\\n const keyPtr = load<u32>(ptr + ARRAY_LENGTH_SIZE + <usize>i * 2 * ELEMENT_PTR_SIZE);\\n const valuePtr = load<u32>(\\n ptr + ARRAY_LENGTH_SIZE + <usize>i * 2 * ELEMENT_PTR_SIZE + ELEMENT_PTR_SIZE,\\n );\\n\\n const key = readString(keyPtr);\\n const value = readValue(valuePtr);\\n\\n result.set(key, value);\\n }\\n\\n return result;\\n}\\n\\n// ============================================================================\\n// Array Utility Functions\\n// ============================================================================\\n\\n/**\\n * Calculate the length of an array from its pointer in memory.\\n *\\n * @param ptr - Pointer to the array data in memory\\n * @returns The length of the array, or 0 if null\\n */\\nexport function getArrayLength(ptr: usize): usize {\\n if (ptr == 0) {\\n return 0;\\n }\\n return load<u32>(ptr);\\n}\\n\\n/**\\n * Check if an array pointer points to an empty array.\\n *\\n * @param ptr - Pointer to the array data in memory\\n * @returns true if the array is empty or pointer is null, false otherwise\\n */\\nexport function isArrayEmpty(ptr: usize): bool {\\n if (ptr == 0) {\\n return true;\\n }\\n return load<u32>(ptr) == 0;\\n}\\n\";","/**\n * AssemblyScript compilation to WebAssembly.\n * Handles compiler invocation, optimization levels, and memory configuration.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { CompilerOptions } from './types';\nimport { CompilationError, ErrorCode } from './errors';\nimport { createVirtualFS, createASCFileSystemCallbacks, getCompilationOutput } from './virtual-fs';\n\n// ============================================================================\n// Compilation Thresholds and Memory Constants\n// ============================================================================\n\n/**\n * Threshold for determining if a module is \"large\" (40KB of source code).\n *\n * Empirically determined based on decision table compilation patterns:\n * - Tables with 1000+ rules generate >40KB of code\n * - These create deeply nested if/else chains that stress the optimizer\n * - Larger modules need more initial memory to avoid runtime growth overhead\n *\n * Large modules require:\n * 1. More initial memory pages (16 vs 4) for string allocations\n * 2. Lower optimization level (O2 vs O3) to avoid stack overflow in Binaryen\n * 3. Skipping WAT generation to avoid O(n²) memory complexity\n */\nconst LARGE_MODULE_THRESHOLD_BYTES = 40000;\n\n/**\n * Threshold for \"very large\" modules (1MB of source code).\n * These modules skip optimization entirely to avoid Binaryen crashes.\n */\nconst VERY_LARGE_MODULE_THRESHOLD_BYTES = 1_000_000;\n\n// Normal module memory configuration (for modules < 40KB)\n/** Initial memory pages for normal modules (256KB total) */\nconst NORMAL_MODULE_INITIAL_PAGES = 4;\n/** Maximum memory pages for normal modules (1MB total) */\nconst NORMAL_MODULE_MAX_PAGES = 16;\n\n// Large module memory configuration (for modules >= 40KB)\n/** Initial memory pages for large modules (1MB total) */\nconst LARGE_MODULE_INITIAL_PAGES = 16;\n/** Maximum memory pages for large modules (16MB total) */\nconst LARGE_MODULE_MAX_PAGES = 256;\n\n/**\n * Compilation settings based on code size.\n * Large modules need different optimization and memory settings.\n */\nexport interface CompilationSettings {\n /** Whether the module is considered large (>40KB) */\n isLargeModule: boolean;\n /** Initial WebAssembly memory pages (64KB each) */\n initialMemoryPages: number;\n /** Maximum WebAssembly memory pages */\n maxMemoryPages: number;\n /** Binaryen optimization level (0-3) */\n optimizeLevel: number;\n /** Binaryen shrink level (0-2) */\n shrinkLevel: number;\n /** Whether to generate WAT text format */\n generateWat: boolean;\n}\n\n/**\n * Determine compilation settings based on code size.\n *\n * Memory pages are 64KB each (WASM_PAGE_SIZE_BYTES). Large modules need more\n * initial memory to avoid runtime allocation overhead during string operations\n * and table lookups.\n * - Normal modules: NORMAL_MODULE_INITIAL_PAGES (256KB), max NORMAL_MODULE_MAX_PAGES (1MB)\n * - Large modules: LARGE_MODULE_INITIAL_PAGES (1MB), max LARGE_MODULE_MAX_PAGES (16MB)\n *\n * Large modules (>LARGE_MODULE_THRESHOLD_BYTES) need more memory because:\n * (1) decision tables generate many string allocations during lookup,\n * (2) each string requires heap allocation at runtime, and\n * (3) insufficient initial memory causes frequent growth operations which are slow.\n *\n * Optimization levels scaled by module size because:\n * (1) Binaryen's optimizer recursively traverses deeply nested if/else chains,\n * (2) decision tables with 1000+ rules create nesting depth that exceeds stack limits at O3,\n * (3) O2 uses iterative algorithms that handle deep nesting,\n * (4) very large modules (>1MB) disable optimization entirely to avoid 10+ minute compile times.\n *\n * WAT generation skipped for large modules because Binaryen's text emitter has O(n²)\n * memory complexity and crashes with OOM on modules >LARGE_MODULE_THRESHOLD_BYTES source.\n *\n * @param codeLength - Length of the AssemblyScript source code\n * @returns Compilation settings appropriate for the code size\n */\nexport function getCompilationSettings(codeLength: number): CompilationSettings {\n const isLargeModule = codeLength > LARGE_MODULE_THRESHOLD_BYTES;\n const isVeryLargeModule = codeLength > VERY_LARGE_MODULE_THRESHOLD_BYTES;\n\n let optimizeLevel: number;\n let shrinkLevel: number;\n\n if (isVeryLargeModule) {\n // Very large module (>1MB source) - skip optimization to avoid Binaryen crash\n optimizeLevel = 0;\n shrinkLevel = 0;\n } else if (isLargeModule) {\n // Medium-large module (40KB-1MB) - use moderate optimization\n optimizeLevel = 2;\n shrinkLevel = 1;\n } else {\n // Small module (<40KB) - use full optimization\n optimizeLevel = 3;\n shrinkLevel = 2;\n }\n\n return {\n isLargeModule,\n initialMemoryPages: isLargeModule ? LARGE_MODULE_INITIAL_PAGES : NORMAL_MODULE_INITIAL_PAGES,\n maxMemoryPages: isLargeModule ? LARGE_MODULE_MAX_PAGES : NORMAL_MODULE_MAX_PAGES,\n optimizeLevel,\n shrinkLevel,\n generateWat: !isLargeModule,\n };\n}\n\n/**\n * Create a secure temporary debug file with restricted permissions.\n *\n * Creates a temporary directory with a random name and writes the code to a file\n * with 0o600 permissions (owner read/write only).\n *\n * This function only writes files if a debug output path is provided via options\n * or the JDM_ASM_DEBUG_OUTPUT environment variable.\n *\n * @param code - The code content to write\n * @param basePath - Base directory for debug output (from options or env var)\n * @param suffix - Optional suffix for the filename (e.g., \"-no-binary\")\n * @returns Path to the created debug file, or null if debug output is disabled or write fails\n */\nfunction createSecureDebugFile(\n code: string,\n basePath: string | undefined,\n suffix = '',\n): string | null {\n // Only write debug files if explicitly requested\n if (!basePath) {\n return null;\n }\n\n try {\n // Create a secure temporary directory with random name\n const tmpDir = fs.mkdtempSync(path.join(basePath, 'jdm-asm-debug-'));\n\n // Create debug file path\n const debugFile = path.join(tmpDir, `assembly-debug${suffix}.ts`);\n\n // Write file with restricted permissions (owner read/write only)\n fs.writeFileSync(debugFile, code, { mode: 0o600 });\n\n return debugFile;\n } catch (error) {\n // Debug output is best-effort: warn but don't break compilation\n const errorMsg = error instanceof Error ? error.message : String(error);\n console.warn(`[jdm-asm] Warning: Failed to write debug output to ${basePath}: ${errorMsg}`);\n return null;\n }\n}\n\n/**\n * Build compiler arguments based on options and settings.\n *\n * @param options - User-provided compiler options\n * @param settings - Size-based compilation settings\n * @returns Array of command-line arguments for the ASC compiler\n */\nexport function buildCompilerArgs(\n options: CompilerOptions,\n settings: CompilationSettings,\n): string[] {\n const args = [\n 'src/runtime/index.ts',\n '--outFile',\n 'output.wasm',\n '--runtime',\n 'incremental', // Use incremental GC runtime for memory reuse across evaluations\n '--exportRuntime', // Export __new, __pin, __collect, etc.\n '--initialMemory',\n String(settings.initialMemoryPages),\n '--maximumMemory',\n String(settings.maxMemoryPages),\n ];\n\n // Only generate WAT for smaller modules (large ones crash Binaryen's text emitter)\n if (settings.generateWat) {\n args.push('--textFile', 'output.wat');\n }\n\n // Add optimization flags if requested\n if (options.optimize) {\n if (settings.optimizeLevel > 0) {\n args.push('--optimize');\n }\n args.push('--optimizeLevel', String(settings.optimizeLevel));\n args.push('--shrinkLevel', String(settings.shrinkLevel));\n }\n\n // Add debug flags if requested\n if (options.debug) {\n args.push('--debug', '--sourceMap');\n }\n\n // Disable assertions in production (non-debug) mode\n if (!options.debug) {\n args.push('--noAssert');\n }\n\n return args;\n}\n\n/**\n * Compile AssemblyScript code to WebAssembly.\n *\n * This function uses the AssemblyScript compiler to generate WASM from\n * the generated AssemblyScript source code using a virtual filesystem.\n *\n * **Filesystem Side Effects:**\n * If `options.debugOutputPath` is set or the `JDM_ASM_DEBUG_OUTPUT` environment\n * variable is defined, compilation failures will write the generated AssemblyScript\n * code to disk for debugging. Files are written to secure temporary directories\n * with restricted permissions (0o600) and are NOT automatically cleaned up.\n *\n * Note: This is the internal compilation function without caching.\n * Use compileAssemblyScript() from build.ts for cached compilation.\n *\n * @param code - The AssemblyScript source code to compile\n * @param options - Compiler options (optimize, debug, debugOutputPath, etc.)\n * @returns An object with the compiled binary and WAT text\n */\nexport async function compileAssemblyScriptInternal(\n code: string,\n options: CompilerOptions,\n): Promise<{ binary: Uint8Array; wat: string }> {\n // Import the AssemblyScript compiler\n const ascModule = await import('assemblyscript/asc');\n\n // Determine debug output path: explicit option takes precedence over environment variable\n const debugOutputPath = options.debugOutputPath ?? process.env.JDM_ASM_DEBUG_OUTPUT;\n\n // Save generated code before compilation so it's available for debugging even if\n // compilation crashes the process (Binaryen can segfault on malformed input).\n // Only write if debug output is explicitly enabled.\n const debugFile = createSecureDebugFile(code, debugOutputPath);\n\n // Set up virtual filesystem\n const virtualFS = createVirtualFS(code);\n\n // Get size-based compilation settings\n const settings = getCompilationSettings(code.length);\n\n // Build compiler arguments\n const compilerArgs = buildCompilerArgs(options, settings);\n\n // Get filesystem callbacks for ASC\n const fsCallbacks = createASCFileSystemCallbacks(virtualFS);\n\n // Create an in-memory stderr stream\n let stderrOutput = '';\n const stderrStream = ascModule.createMemoryStream((chunk: Uint8Array | string) => {\n stderrOutput += typeof chunk === 'string' ? chunk : new TextDecoder().decode(chunk);\n });\n\n // Compile using the asc compiler with virtual filesystem\n const { error } = await ascModule.main(compilerArgs, {\n ...fsCallbacks,\n stderr: stderrStream,\n });\n\n // Check for compilation errors\n if (error) {\n const debugFileInfo = debugFile\n ? `\\n\\nGenerated code saved to ${debugFile}`\n : '\\n\\n(Set debugOutputPath option or JDM_ASM_DEBUG_OUTPUT env var to save generated code for debugging)';\n\n throw new CompilationError(\n `AssemblyScript compilation failed:\\n${stderrOutput || error.message}${debugFileInfo}`,\n ErrorCode.PARSE_ERROR,\n { field: 'assemblyScript' },\n { stderrOutput },\n );\n }\n\n // Get output from virtual filesystem\n const output = getCompilationOutput(virtualFS);\n\n if (!output.binary) {\n const noBinaryDebugFile = createSecureDebugFile(code, debugOutputPath, '-no-binary');\n stderrOutput = stderrOutput || '(no stderr output)';\n const files = [...virtualFS.keys()].join(', ');\n\n const debugFileInfo = noBinaryDebugFile\n ? `\\nGenerated code saved to ${noBinaryDebugFile}`\n : '\\n(Set debugOutputPath option or JDM_ASM_DEBUG_OUTPUT env var to save generated code for debugging)';\n\n throw new CompilationError(\n `Compilation produced no WASM binary output.\\nCompiler stderr: ${stderrOutput}\\nFiles in virtualFS: ${files}${debugFileInfo}`,\n ErrorCode.PARSE_ERROR,\n { field: 'assemblyScript' },\n { stderrOutput, virtualFSFiles: files },\n );\n }\n\n return {\n binary: output.binary,\n wat: output.wat ?? '',\n };\n}\n","/**\n * Virtual filesystem for in-memory AssemblyScript compilation.\n * Manages file mappings for the ASC compiler.\n */\n\nimport {\n RUNTIME_VALUES,\n RUNTIME_CONTEXT,\n RUNTIME_EXPRESSIONS,\n RUNTIME_TABLES,\n RUNTIME_MEMORY,\n RUNTIME_STRINGS,\n RUNTIME_ARRAYS,\n} from './runtime/index';\n\n/** VirtualFS stores files as string or Uint8Array content */\nexport type VirtualFS = Map<string, string | Uint8Array>;\n\n/**\n * Create a virtual filesystem with runtime libraries and user code.\n * @param code - User's AssemblyScript code to compile\n * @returns Configured virtual filesystem\n */\nexport function createVirtualFS(code: string): VirtualFS {\n const virtualFS: VirtualFS = new Map();\n virtualFS.set('src/runtime/index.ts', code);\n virtualFS.set('src/runtime/values.ts', RUNTIME_VALUES);\n virtualFS.set('src/runtime/context.ts', RUNTIME_CONTEXT);\n virtualFS.set('src/runtime/expressions.ts', RUNTIME_EXPRESSIONS);\n virtualFS.set('src/runtime/tables.ts', RUNTIME_TABLES);\n virtualFS.set('src/runtime/memory.ts', RUNTIME_MEMORY);\n virtualFS.set('src/runtime/strings.ts', RUNTIME_STRINGS);\n virtualFS.set('src/runtime/arrays.ts', RUNTIME_ARRAYS);\n return virtualFS;\n}\n\n/**\n * Create ASC-compatible file system callbacks.\n * @param virtualFS - The virtual filesystem to use\n * @returns Object with readFile, writeFile, listFiles functions for ASC compiler\n */\nexport function createASCFileSystemCallbacks(virtualFS: VirtualFS) {\n return {\n readFile(name: string, baseDir: string): string | null {\n // Try multiple path variations to find the file\n const possibleKeys = [\n // 'src/runtime/index.ts'\n name,\n // './src/runtime/index.ts' or 'src/runtime/index.ts'\n baseDir ? `${baseDir}/${name}` : name,\n // Remove leading ./\n name.startsWith('./') ? name.slice(2) : name,\n ];\n\n for (const key of possibleKeys) {\n const content = virtualFS.get(key);\n if (typeof content === 'string') {\n return content;\n }\n }\n return null;\n },\n writeFile(name: string, data: Uint8Array | string, baseDir: string): void {\n const key = baseDir ? `${baseDir}/${name}` : name;\n virtualFS.set(key, data);\n },\n listFiles(dirname: string, baseDir: string): string[] | null {\n const prefix = baseDir ? `${baseDir}/${dirname}` : dirname;\n return [...virtualFS.keys()].filter((f) => f.startsWith(prefix));\n },\n };\n}\n\n/**\n * Get output files from virtual filesystem after compilation.\n * @param virtualFS - The virtual filesystem\n * @returns Object with binary and wat files (may be undefined if not present)\n */\nexport function getCompilationOutput(virtualFS: VirtualFS): {\n binary: Uint8Array | undefined;\n wat: string | undefined;\n} {\n // The compiler writes to ./output.wasm (with ./ prefix)\n const binary = virtualFS.get('output.wasm') || virtualFS.get('./output.wasm');\n const wat = virtualFS.get('output.wat') || virtualFS.get('./output.wat');\n return {\n binary: binary instanceof Uint8Array ? binary : undefined,\n wat: typeof wat === 'string' ? wat : undefined,\n };\n}\n","/**\n * JavaScript Marshaling Code Generation\n *\n * This module generates JavaScript code for serializing JavaScript objects to\n * WebAssembly memory and deserializing results back. The generated code handles:\n *\n * - Input marshaling: Converting JS objects to WASM memory format\n * - Output unmarshaling: Converting WASM memory back to JS objects\n * - Size calculation: Computing memory requirements for marshaling\n * - Type-tagged value encoding: Writing values with type tags for dynamic typing\n *\n * The generated code operates on DataView for cross-endian compatibility and\n * handles both fixed-size types (numbers, booleans) and variable-length types\n * (strings, arrays, objects).\n */\n\nimport type { FlattenedLayout } from '../types';\n\n/**\n * Generate JavaScript marshaling code.\n *\n * This function generates the JavaScript code that will serialize\n * JavaScript objects to WebAssembly memory and deserialize results back.\n *\n * @param inputLayout - The flattened input schema layout\n * @param outputLayout - The flattened output schema layout\n * @param schemaHash - The schema hash for runtime validation\n * @returns Generated JavaScript marshaling code as a string\n */\nexport function generateMarshalCode(\n inputLayout: FlattenedLayout,\n outputLayout: FlattenedLayout,\n schemaHash: bigint,\n): string {\n const schemaHashHex = `0x${schemaHash.toString(16).padStart(16, '0')}`;\n\n // Calculate fixed sizes (sum of all fixed-size fields)\n const inputFixedSize = inputLayout.fields\n .filter((f) => f.size !== -1)\n .reduce((sum, f) => sum + f.size, 0);\n const outputFixedSize = outputLayout.fields\n .filter((f) => f.size !== -1)\n .reduce((sum, f) => sum + f.size, 0);\n\n return `\n// Generated marshaling code for schema hash ${schemaHashHex}\n// Input fixed size: ${inputFixedSize} bytes\n// Output fixed size: ${outputFixedSize} bytes\n\n// Type tags for marshaling (must match AssemblyScript runtime/Values.ts)\n// All type tags are stored as 4-byte u32\nconst TAG_NULL = 0;\nconst TAG_BOOLEAN = 1;\nconst TAG_INT = 2;\nconst TAG_FLOAT = 3;\nconst TAG_STRING = 4;\nconst TAG_ARRAY = 5;\nconst TAG_OBJECT = 6;\n\n// Size of type tag in bytes (must match VALUE_TYPE_SIZE in AssemblyScript)\nconst TAG_SIZE = 4;\n\nconst SCHEMA_HASH = ${schemaHashHex}n;\nconst INPUT_FIXED_SIZE = ${inputFixedSize};\nconst OUTPUT_FIXED_SIZE = ${outputFixedSize};\n\n/**\n * Marshal JavaScript input object to WebAssembly memory as a ValueMap.\n *\n * The WASM runtime expects input as a ValueMap: [length: u32][keyPtr1: u32][valuePtr1: u32]...\n * where keys are raw UTF-16 strings and values are tagged Value structures.\n *\n * @param data - The input JavaScript object\n * @param memory - WebAssembly Memory instance\n * @param allocate - Function to allocate memory: (size: number) => number\n * @returns Pointer to marshaled ValueMap in WASM memory\n */\nexport function marshalInput(data, memory, allocate) {\n const view = new DataView(memory.buffer);\n const entries = Object.entries(data);\n const length = entries.length;\n\n // Calculate total size needed for ValueMap\n // Format: [length: u32][keyPtr1: u32][valuePtr1: u32]...[key data...][value data...]\n let totalSize = 4 + length * 8; // map header + key/value pointer pairs\n\n // Calculate size for keys (raw strings) and values (tagged)\n for (let i = 0; i < length; i++) {\n const [key, value] = entries[i];\n // Key: raw UTF-16 string [length: u32][utf16 chars...]\n totalSize += 4 + key.length * 2;\n // Value: tagged value\n totalSize += calculateValueSize(value);\n }\n\n // Allocate memory\n const ptr = allocate(totalSize);\n\n // Write map length\n view.setUint32(ptr, length, true);\n\n // Current offset for variable data (after map structure)\n let currentOffset = ptr + 4 + length * 8;\n\n // Write each key/value pair\n let ptrOffset = ptr + 4;\n for (let i = 0; i < length; i++) {\n const [key, value] = entries[i];\n\n // Write key as raw string (not tagged): [length: u32][utf16 chars...]\n const keyPtr = currentOffset;\n view.setUint32(keyPtr, key.length, true);\n for (let j = 0; j < key.length; j++) {\n view.setUint16(keyPtr + 4 + j * 2, key.charCodeAt(j), true);\n }\n currentOffset += 4 + key.length * 2;\n\n // Write value (tagged)\n const valuePtr = currentOffset;\n currentOffset += writeValue(value, view, valuePtr);\n\n // Write pointers to map structure\n view.setUint32(ptrOffset, keyPtr, true);\n view.setUint32(ptrOffset + 4, valuePtr, true);\n ptrOffset += 8;\n }\n\n return ptr;\n}\n\n/**\n * Unmarshal WebAssembly memory to JavaScript output object.\n * @param ptr - Pointer to output data in WASM memory\n * @param memory - WebAssembly Memory instance\n * @returns The output JavaScript object\n */\nexport function unmarshalOutput(ptr, memory) {\n const view = new DataView(memory.buffer);\n\n // Output is written using writeValue() which writes a tagged Value\n // Use readValue() to read it back generically\n const output = readValue(view, ptr);\n \n // Convert flat dotted keys to nested objects.\n // Decision tables with passThrough emit flat keys like 'features.prioritySupport'\n // which must be restructured into nested objects for JavaScript consumption.\n // e.g., {\"features.prioritySupport\": true} -> {\"features\": {\"prioritySupport\": true}}\n return unflattenObject(output);\n}\n\n/**\n * Convert flat dotted keys to nested objects.\n * Recursively processes objects and arrays.\n * \n * @param value - The value to unflatten\n * @returns The unflattened value\n */\nfunction unflattenObject(value) {\n if (value === null || value === undefined) {\n return value;\n }\n \n if (Array.isArray(value)) {\n return value.map(item => unflattenObject(item));\n }\n \n if (typeof value !== 'object') {\n return value;\n }\n \n const result = {};\n \n for (const [key, val] of Object.entries(value)) {\n // Recursively unflatten the value first\n const unflattenedVal = unflattenObject(val);\n \n if (key.includes('.')) {\n // Split the key and create nested structure\n const parts = key.split('.');\n let current = result;\n \n for (let i = 0; i < parts.length - 1; i++) {\n const part = parts[i];\n if (!(part in current)) {\n current[part] = {};\n } else if (typeof current[part] !== 'object' || current[part] === null) {\n // Conflicts where both 'a' and 'a.b' exist can occur from multiple decision\n // table rules. Nested structure takes precedence to preserve data hierarchy.\n current[part] = {};\n }\n current = current[part];\n }\n \n current[parts[parts.length - 1]] = unflattenedVal;\n } else {\n // No dot in key - check if we already have a nested object from a dotted key\n if (key in result && typeof result[key] === 'object' && result[key] !== null && typeof unflattenedVal === 'object' && unflattenedVal !== null) {\n // Merge the objects\n Object.assign(result[key], unflattenedVal);\n } else {\n result[key] = unflattenedVal;\n }\n }\n }\n \n return result;\n}\n\n/**\n * Calculate the total memory size needed for marshaling the input as a ValueMap.\n *\n * Format: [length: u32][keyPtr1: u32][valuePtr1: u32]...[key data...][value data...]\n */\nfunction calculateInputSize(data) {\n const entries = Object.entries(data);\n const length = entries.length;\n\n // Map header + key/value pointer pairs\n let size = 4 + length * 8;\n\n // Add size for keys (raw strings) and values (tagged)\n for (let i = 0; i < length; i++) {\n const [key, value] = entries[i];\n // Key: raw UTF-16 string [length: u32][utf16 chars...]\n size += 4 + key.length * 2;\n // Value: tagged value\n size += calculateValueSize(value);\n }\n\n return size;\n}\n\n/**\n * Write null value with type tag.\n *\n * Format: [tag: u32]\n *\n * @param view - DataView for writing\n * @param offset - Offset to write at\n * @returns Total bytes written (4 bytes for tag)\n */\nfunction writeNull(view, offset) {\n // Write tag\n view.setUint32(offset, TAG_NULL, true);\n return TAG_SIZE; // tag only\n}\n\n/**\n * Write boolean value with type tag.\n *\n * Format: [tag: u32][value: u8]\n *\n * @param value - The boolean value to write\n * @param view - DataView for writing\n * @param offset - Offset to write at\n * @returns Total bytes written (5 bytes: tag + value)\n */\nfunction writeBoolean(value, view, offset) {\n // Write tag\n view.setUint32(offset, TAG_BOOLEAN, true);\n // Write boolean value as 1 byte (0 or 1)\n view.setUint8(offset + TAG_SIZE, value ? 1 : 0);\n return TAG_SIZE + 1; // tag + value\n}\n\n/**\n * Write float (number) value with type tag.\n *\n * Format: [tag: u32][value: f64]\n *\n * Handles all JavaScript number types including:\n * - Regular numbers (0, -0, integers, floats)\n * - Special values (NaN, Infinity, -Infinity)\n *\n * @param value - The number value to write\n * @param view - DataView for writing\n * @param offset - Offset to write at\n * @returns Total bytes written (12 bytes: 4-byte tag + 8-byte f64)\n */\nfunction writeFloat(value, view, offset) {\n // Write tag\n view.setUint32(offset, TAG_FLOAT, true);\n // Write number as f64 (little-endian)\n view.setFloat64(offset + TAG_SIZE, value, true);\n return TAG_SIZE + 8; // tag + f64\n}\n\n/**\n * Read a float value from memory.\n *\n * Format: [tag: u32][value: f64]\n *\n * @param view - DataView for reading\n * @param offset - Offset to read from\n * @returns The decoded number value (as integer if it's a whole number)\n * @throws {Error} If type tag is not TAG_FLOAT\n */\nfunction readFloat(view, offset) {\n // Read and verify tag\n const tag = view.getUint32(offset, true);\n if (tag !== TAG_FLOAT) {\n throw new Error(\\`Expected float tag (\\${TAG_FLOAT}), got \\${tag}\\`);\n }\n // Read number as f64 (little-endian)\n const value = view.getFloat64(offset + TAG_SIZE, true);\n // Return as integer if it's a whole number (for cleaner JSON output)\n if (Number.isInteger(value)) {\n return value;\n }\n return value;\n}\n\n/**\n * Write a UTF-16 string to memory with type tag.\n *\n * Format: [tag: u32][pointer: u32] - pointer points to string data\n * String data format: [length: u32][utf16 code units...]\n *\n * The pointer in the Value structure points immediately after the Value structure\n * itself (at offset + 8), where the string data begins.\n *\n * Uses UTF-16 encoding to match AssemblyScript's native string format.\n *\n * @param str - The string to write\n * @param view - DataView for writing\n * @param offset - Offset to write at\n * @returns Total bytes written (tag + pointer + string data)\n */\nfunction writeString(str, view, offset) {\n const len = str.length;\n // Write tag\n view.setUint32(offset, TAG_STRING, true);\n // String data starts right after the Value structure (tag + pointer = 8 bytes)\n const stringDataPtr = offset + TAG_SIZE + 4;\n // Write pointer to string data\n view.setUint32(offset + TAG_SIZE, stringDataPtr, true);\n // Write string data: [length: u32][utf16 code units...]\n view.setUint32(stringDataPtr, len, true);\n for (let i = 0; i < len; i++) {\n view.setUint16(stringDataPtr + 4 + i * 2, str.charCodeAt(i), true);\n }\n // Total: tag (4) + pointer (4) + length (4) + utf16 data (len * 2)\n return 8 + 4 + len * 2;\n}\n\n/**\n * Read null value with type tag.\n *\n * Format: [tag: u32]\n *\n * @param view - DataView for reading\n * @param offset - Offset to read from\n * @returns null value\n * @throws {Error} If type tag is not TAG_NULL\n */\nfunction readNull(view, offset) {\n // Read and verify tag\n const tag = view.getUint32(offset, true);\n if (tag !== TAG_NULL) {\n throw new Error(\\`Expected null tag (\\${TAG_NULL}), got \\${tag}\\`);\n }\n return null;\n}\n\n/**\n * Read boolean value with type tag.\n *\n * Format: [tag: u32][value: u8]\n *\n * @param view - DataView for reading\n * @param offset - Offset to read from\n * @returns The decoded boolean value\n * @throws {Error} If type tag is not TAG_BOOLEAN\n */\nfunction readBoolean(view, offset) {\n // Read and verify tag\n const tag = view.getUint32(offset, true);\n if (tag !== TAG_BOOLEAN) {\n throw new Error(\\`Expected boolean tag (\\${TAG_BOOLEAN}), got \\${tag}\\`);\n }\n // Read boolean value and convert to boolean\n const value = view.getUint8(offset + TAG_SIZE);\n return value !== 0;\n}\n\n/**\n * Read an integer value from memory with type tag.\n *\n * Format: [tag: u32][value: i64]\n *\n * @param view - DataView for reading\n * @param offset - Offset to read from\n * @returns The decoded integer value\n * @throws {Error} If type tag is not TAG_INT\n */\nfunction readInt(view, offset) {\n // Read and verify tag\n const tag = view.getUint32(offset, true);\n if (tag !== TAG_INT) {\n throw new Error(\\`Expected int tag (\\${TAG_INT}), got \\${tag}\\`);\n }\n // Read i64 value (little-endian)\n // JavaScript DataView doesn't have getBigInt64 in older versions, so use two 32-bit reads\n const low = view.getUint32(offset + TAG_SIZE, true);\n const high = view.getInt32(offset + TAG_SIZE + 4, true);\n // Combine to form a 64-bit signed integer\n // For values that fit in Number, this works fine\n const value = low + high * 0x100000000;\n return value;\n}\n\n/**\n * Read a UTF-16 string from memory with type tag.\n *\n * WASM Format: [tag: u32=4][stringPtr: u32]\n * String data at stringPtr: [length: u32][utf16 chars...]\n *\n * FORMAT DIFFERENCE: This reads the canonical WASM representation using pointers\n * and UTF-16 encoding (AssemblyScript's native string format), while writeString()\n * uses an inlined UTF-8 format for simplicity. Both are valid Value representations.\n *\n * @param view - DataView for reading\n * @param offset - Offset to read from\n * @returns The decoded string\n * @throws {Error} If type tag is not TAG_STRING\n */\nfunction readString(view, offset) {\n // Read and verify tag\n const tag = view.getUint32(offset, true);\n if (tag !== TAG_STRING) {\n throw new Error(\\`Expected string tag (\\${TAG_STRING}), got \\${tag}\\`);\n }\n // Read pointer to string data\n const stringPtr = view.getUint32(offset + TAG_SIZE, true);\n \n // Read string data from the pointer\n if (stringPtr === 0) return '';\n \n const length = view.getUint32(stringPtr, true);\n if (length === 0) return '';\n \n // Read UTF-16 code units and convert to string\n let result = '';\n for (let i = 0; i < length; i++) {\n const codeUnit = view.getUint16(stringPtr + 4 + i * 2, true);\n result += String.fromCharCode(codeUnit);\n }\n \n return result;\n}\n\n/**\n * Marshal a primitive value to memory with automatic type detection.\n *\n * Supports null, boolean, number, and string types.\n *\n * @param value - The value to write (null, boolean, number, or string)\n * @param view - DataView for writing\n * @param offset - Offset to write at\n * @returns Total bytes written\n * @throws {Error} If value type is not supported\n */\nfunction writePrimitive(value, view, offset) {\n if (value === null) {\n return writeNull(view, offset);\n } else if (typeof value === 'boolean') {\n return writeBoolean(value, view, offset);\n } else if (typeof value === 'number') {\n return writeFloat(value, view, offset);\n } else if (typeof value === 'string') {\n return writeString(value, view, offset);\n } else {\n throw new Error('Unsupported type for marshaling: ' + typeof value);\n }\n}\n\n/**\n * Read a primitive value from memory with type detection.\n *\n * Reads the type tag and dispatches to the appropriate read function.\n *\n * @param view - DataView for reading\n * @param offset - Offset to read from\n * @returns The decoded value (null, boolean, number, or string)\n * @throws {Error} If type tag is not recognized\n */\nfunction readPrimitive(view, offset) {\n const tag = view.getUint32(offset, true);\n switch (tag) {\n case TAG_NULL:\n return readNull(view, offset);\n case TAG_BOOLEAN:\n return readBoolean(view, offset);\n case TAG_INT:\n return readInt(view, offset);\n case TAG_FLOAT:\n return readFloat(view, offset);\n case TAG_STRING:\n return readString(view, offset);\n default:\n throw new Error('Unexpected type tag: ' + tag);\n }\n}\n\n/**\n * Marshal an object to memory.\n * Returns the total bytes written for the object.\n *\n * Format: [tag: u32][propertyCount: u32][key1: tagged string][value1: tagged][key2: tagged string][value2: tagged]...\n *\n * Keys are written as tagged strings, followed by tagged values.\n * Property order is preserved for deterministic serialization using Object.entries.\n *\n * @param obj - The object to marshal\n * @param view - DataView for writing\n * @param writeOffset - Offset to write the object at\n * @returns Total bytes written\n */\nfunction writeObject(obj, view, writeOffset) {\n const startOffset = writeOffset;\n let offset = writeOffset;\n\n // Write tag\n view.setUint32(offset, TAG_OBJECT, true);\n offset += TAG_SIZE;\n\n // Get properties in order\n const entries = Object.entries(obj);\n const propCount = entries.length;\n\n // Write property count\n view.setUint32(offset, propCount, true);\n offset += 4;\n\n // Write each (key, value) pair\n for (let i = 0; i < propCount; i++) {\n const [key, value] = entries[i];\n\n // Write key as tagged string (keys are tagged with TAG_STRING)\n offset += writeString(key, view, offset);\n\n // Write value (tagged)\n offset += writeValue(value, view, offset);\n }\n\n return offset - startOffset;\n}\n\n/**\n * Marshal a value to memory with automatic type detection.\n *\n * Supports null, boolean, number, string, array, and object types.\n * This is the top-level value marshaling function that dispatches to\n * the appropriate type-specific function.\n *\n * @param value - The value to write\n * @param view - DataView for writing\n * @param offset - Offset to write at\n * @returns Total bytes written\n * @throws {Error} If value type is not supported\n */\nfunction writeValue(value, view, offset) {\n if (value === null || value === undefined) {\n return writeNull(view, offset);\n } else if (typeof value === 'boolean') {\n return writeBoolean(value, view, offset);\n } else if (typeof value === 'number') {\n return writeFloat(value, view, offset);\n } else if (typeof value === 'string') {\n return writeString(value, view, offset);\n } else if (Array.isArray(value)) {\n return writeArray(value, view, 0, offset);\n } else if (typeof value === 'object') {\n return writeObject(value, view, offset);\n } else {\n throw new Error('Unsupported type for marshaling: ' + typeof value);\n }\n}\n\n/**\n * Read an object from memory.\n *\n * WASM Format: Value.Object has: [type: u32=6][objectPtr: u32]\n * objectPtr points to Map structure: [propCount: u32][keyPtr1: u32][valuePtr1: u32][keyPtr2: u32][valuePtr2: u32]...\n * Key pointers point to UTF-16 string data\n * Value pointers point to heap-allocated tagged values.\n *\n * @param view - DataView for reading\n * @param offset - Offset to the Value.Object structure (NOT objectPtr)\n * @returns The unmarshaled object\n */\nfunction readObject(view, offset) {\n // Two cases:\n // 1. If offset has TAG_OBJECT (6), it's a Value.Object structure: [type: u32][objectPtr: u32]\n // 2. Otherwise, offset might already point to the Map structure directly\n\n const tag = view.getUint32(offset, true);\n let objectPtr;\n\n if (tag === TAG_OBJECT) {\n // Case 1: Value.Object structure, read pointer to Map\n objectPtr = view.getUint32(offset + 4, true);\n } else {\n // Case 2: offset point directly to Map structure\n objectPtr = offset;\n }\n\n const result = {};\n if (objectPtr !== 0) {\n // Read property count from map structure\n const propCount = view.getUint32(objectPtr, true);\n let mapOffset = objectPtr + 4;\n\n for (let i = 0; i < propCount; i++) {\n // Read key pointer and value pointer\n const keyPtr = view.getUint32(mapOffset, true);\n const valuePtr = view.getUint32(mapOffset + 4, true);\n mapOffset += 8;\n\n // Read key (raw UTF-16 string data at keyPtr: [length: u32][utf16 chars...])\n const keyLen = view.getUint32(keyPtr, true);\n let key = '';\n for (let j = 0; j < keyLen; j++) {\n const codeUnit = view.getUint16(keyPtr + 4 + j * 2, true);\n key += String.fromCharCode(codeUnit);\n }\n\n // Read value (tagged value at valuePtr)\n const value = readValue(view, valuePtr);\n\n result[key] = value;\n }\n }\n\n return result;\n}\n\n/**\n * Calculate the size in bytes of a tagged value at the given offset.\n *\n * @param view - DataView for reading\n * @param offset - Offset to calculate size from\n * @returns Total bytes the value occupies\n * @throws {Error} If type tag is not recognized\n */\nfunction getValueSize(view, offset) {\n const tag = view.getUint32(offset, true);\n\n switch (tag) {\n case TAG_NULL:\n return TAG_SIZE;\n case TAG_BOOLEAN:\n return TAG_SIZE + 1;\n case TAG_INT:\n return TAG_SIZE + 8;\n case TAG_FLOAT:\n return TAG_SIZE + 8;\n case TAG_STRING: {\n const strLen = view.getUint32(offset + TAG_SIZE, true);\n return TAG_SIZE + 4 + strLen;\n }\n case TAG_ARRAY: {\n const arrLen = view.getUint32(offset + TAG_SIZE, true);\n let size = TAG_SIZE + 4; // tag + length\n let elemOffset = offset + TAG_SIZE + 4;\n for (let i = 0; i < arrLen; i++) {\n const elemSize = getValueSize(view, elemOffset);\n size += elemSize;\n elemOffset += elemSize;\n }\n return size;\n }\n case TAG_OBJECT: {\n const propCount = view.getUint32(offset + TAG_SIZE, true);\n let size = TAG_SIZE + 4; // tag + property count\n let propOffset = offset + TAG_SIZE + 4;\n for (let i = 0; i < propCount; i++) {\n // Skip key (tagged string)\n const keySize = getValueSize(view, propOffset);\n size += keySize;\n propOffset += keySize;\n\n // Skip value (tagged value)\n const valSize = getValueSize(view, propOffset);\n size += valSize;\n propOffset += valSize;\n }\n return size;\n }\n default:\n throw new Error('Unexpected type tag: ' + tag);\n }\n}\n\n/**\n * Read a value from memory with type detection.\n *\n * Reads the type tag and dispatches to the appropriate read function.\n *\n * @param view - DataView for reading\n * @param offset - Offset to read from\n * @returns The decoded value\n * @throws {Error} If type tag is not recognized\n */\nfunction readValue(view, offset) {\n const tag = view.getUint32(offset, true);\n switch (tag) {\n case TAG_NULL:\n return readNull(view, offset);\n case TAG_BOOLEAN:\n return readBoolean(view, offset);\n case TAG_INT:\n return readInt(view, offset);\n case TAG_FLOAT:\n return readFloat(view, offset);\n case TAG_STRING:\n return readString(view, offset);\n case TAG_ARRAY:\n return readArray(view, offset);\n case TAG_OBJECT:\n return readObject(view, offset);\n default:\n throw new Error('Unexpected type tag: ' + tag);\n }\n}\n\n/**\n * Marshal an array to memory.\n * Returns the total bytes written for the array.\n *\n * Format: [tag: u32][length: u32][tagged elements...]\n *\n * @param arr - The array to marshal\n * @param view - DataView for writing\n * @param ptr - Base pointer (unused, kept for API compatibility)\n * @param writeOffset - Offset to write the array at\n * @returns Total bytes written\n */\nfunction writeArray(arr, view, ptr, writeOffset) {\n const startOffset = writeOffset;\n let offset = writeOffset;\n\n // Write tag\n view.setUint32(offset, TAG_ARRAY, true);\n offset += TAG_SIZE;\n\n // Write length\n view.setUint32(offset, arr.length, true);\n offset += 4;\n\n // Write elements recursively\n for (let i = 0; i < arr.length; i++) {\n const value = arr[i];\n offset += writeValue(value, view, offset);\n }\n\n return offset - startOffset;\n}\n\n/**\n * Calculate the size needed to marshal an object.\n *\n * Format: [tag: byte][propertyCount: u32][key1: tagged string][value1: tagged][key2: tagged string][value2: tagged]...\n *\n * @param obj - The object to calculate size for\n * @returns Total bytes needed for the object\n */\nfunction calculateObjectSize(obj) {\n let size = 5; // tag (1 byte) + property count (4 bytes)\n\n const entries = Object.entries(obj);\n for (let i = 0; i < entries.length; i++) {\n const [key, value] = entries[i];\n // Key: tagged string (tag: 4 + pointer: 4 + length: 4 + UTF-16 data: 2 bytes per code unit)\n size += 8 + 4 + key.length * 2;\n // Value: calculate size of tagged value\n size += calculateValueSize(value);\n }\n\n return size;\n}\n\n/**\n * Calculate the size needed to marshal a value.\n *\n * @param value - The value to calculate size for\n * @returns Total bytes needed for the value\n */\nfunction calculateValueSize(value) {\n if (value === null || value === undefined) {\n return 1;\n } else if (typeof value === 'boolean') {\n return 2;\n } else if (typeof value === 'number') {\n return 9;\n } else if (typeof value === 'string') {\n // tag (4) + pointer (4) + length (4) + UTF-16 data (2 bytes per code unit)\n return 8 + 4 + value.length * 2;\n } else if (Array.isArray(value)) {\n let size = 5;\n for (let i = 0; i < value.length; i++) {\n size += calculateValueSize(value[i]);\n }\n return size;\n } else if (typeof value === 'object') {\n return calculateObjectSize(value);\n } else {\n throw new Error('Unsupported type for marshaling: ' + typeof value);\n }\n}\n\n/**\n * Read an array from memory.\n *\n * WASM Format: Value.Array has: [type: u32=5][arrayPtr: u32]\n * arrayPtr points to array structure: [length: u32][elementPtr1: u32][elementPtr2: u32]...\n * Each elementPtr points to a tagged Value structure\n *\n * @param view - DataView for reading\n * @param offset - Offset to the Value.Array structure (NOT arrayPtr)\n * @returns The unmarshaled array\n */\nfunction readArray(view, offset) {\n // Two cases:\n // 1. If offset has TAG_ARRAY (5), it's a Value.Array structure: [type: u32][arrayPtr: u32]\n // 2. Otherwise, offset might already point to the array structure directly\n\n const tag = view.getUint32(offset, true);\n let arrayPtr;\n\n if (tag === TAG_ARRAY) {\n // Case 1: Value.Array structure, read pointer to array data\n arrayPtr = view.getUint32(offset + 4, true);\n } else {\n // Case 2: offset points directly to array structure\n arrayPtr = offset;\n }\n\n // Validate arrayPtr is within bounds\n if (arrayPtr === 0 || arrayPtr >= view.byteLength) {\n return [];\n }\n\n // Read length field (may have high bit set for flat format)\n const lengthField = view.getUint32(arrayPtr, true);\n const FLAT_ARRAY_MARKER = 0x80000000;\n\n // Check if this is a flat numeric array (high bit set)\n if ((lengthField & FLAT_ARRAY_MARKER) !== 0) {\n // Flat numeric format: [length | marker: u32][f64 elements...]\n const length = lengthField & ~FLAT_ARRAY_MARKER;\n const result = [];\n for (let i = 0; i < length; i++) {\n const value = view.getFloat64(arrayPtr + 4 + i * 8, true);\n result.push(value);\n }\n return result;\n }\n\n // Generic format: [length: u32][Value pointers...]\n const length = lengthField;\n\n // Read element pointers and dereference them\n const result = [];\n for (let i = 0; i < length; i++) {\n const elemPtr = view.getUint32(arrayPtr + 4 + i * 4, true);\n // Skip invalid pointers\n if (elemPtr === 0 || elemPtr >= view.byteLength) {\n result.push(null);\n continue;\n }\n const value = readValue(view, elemPtr);\n result.push(value);\n }\n\n return result;\n}\n`;\n}\n\n/**\n * Generate the unmarshal function body.\n *\n * This function is currently unused but kept for potential future use with alternative\n * marshaling strategies. It generates code to read fixed-layout structs directly,\n * which could be more efficient than the current generic Value-based approach.\n *\n * @param layout - The flattened schema layout\n * @param _prefix - Unused parameter (reserved for potential future use with prefixed field names)\n * @returns Generated JavaScript code for unmarshaling\n */\nexport function _generateUnmarshalBody(layout: FlattenedLayout, _prefix: string): string {\n const lines: string[] = [];\n\n lines.push(' const output = {};');\n lines.push('');\n\n // Build nested object structure\n const paths = buildNestedPaths(layout.fields);\n lines.push(...paths);\n\n lines.push('');\n\n // Read fixed fields\n for (const field of layout.fields) {\n if (field.type === 'string' || field.type === 'array') {\n // Skip - handled in variable section\n continue;\n } else if (field.type === 'bool') {\n lines.push(' // ' + field.path);\n lines.push(\n ` output${field.path\n .split('.')\n .map((p) => `['${p}']`)\n .join('')} = view.getUint32(readOffset + ${field.offset}, true) !== 0;`,\n );\n } else if (field.type === 'i64') {\n lines.push(' // ' + field.path);\n lines.push(\n ` output${field.path\n .split('.')\n .map((p) => `['${p}']`)\n .join('')} = Number(view.getBigInt64(readOffset + ${field.offset}, true));`,\n );\n } else {\n lines.push(' // ' + field.path);\n const valueGetter = field.type === 'f64' ? 'getFloat64' : 'getInt32';\n lines.push(\n ` output${field.path\n .split('.')\n .map((p) => `['${p}']`)\n .join('')} = view.${valueGetter}(readOffset + ${field.offset}, true);`,\n );\n }\n }\n\n // Read variable-length data\n for (const field of layout.fields) {\n if (field.type === 'string') {\n lines.push('');\n lines.push(' // ' + field.path);\n lines.push(\n ` const ${field.flatName}_ptr = view.getUint32(readOffset + ${field.offset}, true);`,\n );\n lines.push(\n ` const ${field.flatName}_len = view.getUint32(readOffset + ${field.offset} + 4, true);`,\n );\n lines.push(\n ` output${field.path\n .split('.')\n .map((p) => `['${p}']`)\n .join('')} = ${field.flatName}_len > 0 ? readString(view, ${field.flatName}_ptr) : '';`,\n );\n } else if (field.type === 'array') {\n lines.push('');\n lines.push(' // ' + field.path);\n lines.push(\n ` const ${field.flatName}_ptr = view.getUint32(readOffset + ${field.offset}, true);`,\n );\n lines.push(\n ` const ${field.flatName}_len = view.getUint32(readOffset + ${field.offset} + 4, true);`,\n );\n lines.push(\n ` output${field.path\n .split('.')\n .map((p) => `['${p}']`)\n .join('')} = readArray(view, ${field.flatName}_ptr);`,\n );\n }\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Build nested object initialization code\n */\nfunction buildNestedPaths(fields: Array<{ path: string }>): string[] {\n const paths: string[] = [];\n const nestedObjects = new Set<string>();\n\n for (const field of fields) {\n const parts = field.path.split('.');\n for (let i = 0; i < parts.length - 1; i++) {\n const prefix = parts.slice(0, i + 1).join('.');\n if (!nestedObjects.has(prefix)) {\n nestedObjects.add(prefix);\n const code = ` output${prefix\n .split('.')\n .map((p) => `['${p}']`)\n .join('')} = {};`;\n paths.push(code);\n }\n }\n }\n\n // Deduplicate and sort\n return Array.from(new Set(paths));\n}\n","/**\n * JavaScript Validation Code Generation\n *\n * This module generates JavaScript code for validating input data against\n * TypeBox schemas before marshaling. The generated code performs:\n *\n * - Type checking for primitives (string, number, boolean)\n * - Required field validation\n * - Nested object validation\n * - Array element validation\n * - Union type validation\n * - Literal value validation\n *\n * The generated validators are standalone JavaScript code that doesn't\n * require runtime schema compilation, making validation fast and predictable.\n */\n\nimport { type TSchema, Kind } from '@sinclair/typebox';\n\n/**\n * Generate JavaScript validation code.\n *\n * This function generates JavaScript code that validates input data\n * against the TypeBox schema before marshaling.\n *\n * Generates custom validation code that checks types and required fields\n * without requiring runtime schema compilation.\n *\n * @param schema - The TypeBox schema to validate against\n * @returns Generated validation code as a string\n */\nexport function generateValidationCode(schema: TSchema): string {\n const validatorCode = generateSchemaValidator(schema, 'data');\n\n return `// Generated validation code for TypeBox schema\n\n/**\n * Validate input data against the schema.\n * Throws an error if validation fails.\n *\n * @param data - The input data to validate\n * @throws {ValidationError} If validation fails\n */\nexport function validateInput(data) {\n const errors = ${validatorCode};\n if (errors.length > 0) {\n throw new ValidationError('Invalid input data', errors);\n }\n}\n\n/**\n * Custom error class for validation errors\n */\nexport class ValidationError extends Error {\n constructor(message, errors) {\n const errorList = errors\n .map((e, i) => '[' + (i + 1) + '] ' + e.path + ': ' + e.message)\n .join('\\\\n ');\n super(message + ':\\\\n ' + errorList);\n this.name = 'ValidationError';\n this.errors = errors;\n }\n}\n\n/**\n * Safely validate input without throwing.\n *\n * @param data - The input data to validate\n * @returns true if valid, false otherwise\n */\nexport function checkInput(data) {\n try {\n validateInput(data);\n return true;\n } catch {\n return false;\n }\n}\n`;\n}\n\n/**\n * Generate validation code for a given schema.\n *\n * @param schema - The TypeBox schema to generate validation for\n * @param dataPath - JavaScript expression for accessing the data at this level\n * @returns JavaScript code that returns an array of error objects\n */\nfunction generateSchemaValidator(schema: TSchema, dataPath: string): string {\n const kind = (schema as any)[Kind];\n\n switch (kind) {\n case 'Object': {\n return validateObject(schema, dataPath);\n }\n\n case 'String': {\n return validatePrimitive(dataPath, 'string', 'Expected string');\n }\n\n case 'Number': {\n return validatePrimitive(dataPath, 'number', 'Expected number');\n }\n\n case 'Integer': {\n return `${validatePrimitive(dataPath, 'number', 'Expected integer')}.concat(\n ${dataPath} !== undefined && ${dataPath} !== null && !Number.isInteger(${dataPath})\n ? [{ path: '${dataPath}', message: 'Expected integer', value: ${dataPath} }]\n : []\n )`;\n }\n\n case 'Boolean': {\n return validatePrimitive(dataPath, 'boolean', 'Expected boolean');\n }\n\n case 'Array': {\n return validateArray(schema, dataPath);\n }\n\n case 'Union': {\n return validateUnion(schema, dataPath);\n }\n\n case 'Literal': {\n const literalValue = (schema as any).const;\n const literalStr =\n typeof literalValue === 'string' ? `'${literalValue}'` : String(literalValue);\n const message2 = 'Expected literal value ' + String(literalStr);\n return `${validatePrimitive(dataPath, typeof literalValue, '${message2}')}.concat(\n ${dataPath} !== undefined && ${dataPath} !== null && ${dataPath} !== ${literalStr}\n ? [{ path: '${dataPath}', message: '${message2}', value: ${dataPath} }]\n : []\n )`;\n }\n\n default:\n // Unknown type - accept anything\n return '[]';\n }\n}\n\n/**\n * Generate validation for object schema.\n */\nfunction validateObject(schema: TSchema, dataPath: string): string {\n const properties = (schema as any).properties || {};\n const required = new Set((schema as any).required || []);\n\n let code = `[]`;\n\n // Check if data is an object\n code = `(${dataPath} === null || ${dataPath} === undefined || typeof ${dataPath} !== 'object' || Array.isArray(${dataPath})) ? [{ path: '${dataPath}', message: 'Expected object', value: ${dataPath} }] : []`;\n\n // Check each property\n for (const [key, propSchema] of Object.entries(properties)) {\n const propPath = `${dataPath}.${key}`;\n const isRequired = required.has(key);\n\n // Check if required field is present\n if (isRequired) {\n code += `.concat(\n ${propPath} === undefined || ${propPath} === null\n ? [{ path: '${propPath}', message: 'Required field is missing', value: undefined }]\n : []\n )`;\n } else {\n // Skip validation if optional field is missing\n code += `.concat(\n ${propPath} === undefined || ${propPath} === null\n ? []\n : ${generateSchemaValidator(propSchema as TSchema, propPath)}\n )`;\n }\n\n // Validate the field if present\n if (isRequired) {\n code += `.concat(\n ${propPath} !== undefined && ${propPath} !== null\n ? ${generateSchemaValidator(propSchema as TSchema, propPath)}\n : []\n )`;\n }\n }\n\n return code;\n}\n\n/**\n * Generate validation for array schema.\n */\nfunction validateArray(schema: TSchema, dataPath: string): string {\n const itemsSchema = (schema as any).items;\n\n // Check if data is an array\n const arrayCheck = `Array.isArray(${dataPath})`;\n\n // Validate array elements\n if (itemsSchema) {\n const elementValidation = `\n ${dataPath}.reduce((errs, item, idx) => {\n const itemPath = '${dataPath}[' + idx + ']';\n const elementErrors = ${generateSchemaValidator(itemsSchema as TSchema, 'item')};\n return errs.concat(elementErrors.map(e => ({\n ...e,\n path: itemPath\n })));\n }, [])\n `;\n\n return `(${arrayCheck} ? ${elementValidation} : [{ path: '${dataPath}', message: 'Expected array', value: ${dataPath} }])`;\n }\n\n return `${arrayCheck} ? [] : [{ path: '${dataPath}', message: 'Expected array', value: ${dataPath} }]`;\n}\n\n/**\n * Generate validation for union schema.\n */\nfunction validateUnion(schema: TSchema, dataPath: string): string {\n const anyOf = (schema as any).anyOf || [];\n if (anyOf.length === 0) {\n return '[]';\n }\n\n // Generate validators for each option\n const validators = anyOf.map((option: TSchema) => generateSchemaValidator(option, dataPath));\n\n // Check if at least one option passes\n return `(${dataPath} === undefined || ${dataPath} === null) ? []\n : ${validators.join('.length === 0 || ')}.length === 0\n ? []\n : [{ path: '${dataPath}', message: 'Value does not match any allowed type', value: ${dataPath} }]`;\n}\n\n/**\n * Generate validation for primitive types.\n */\nfunction validatePrimitive(dataPath: string, expectedType: string, message: string): string {\n return `(${dataPath} === undefined || ${dataPath} === null || typeof ${dataPath} !== '${expectedType}')\n ? [{ path: '${dataPath}', message: '${message}', value: ${dataPath} }]\n : []`;\n}\n","// src/compiler/runtime-codegen.ts\n// Compile-time code generation utilities for loading generated marshaling and validation code\n\nimport { CompilationError, ErrorCode } from './errors';\n\n/**\n * Type definitions for marshal and unmarshal functions.\n */\nexport type MarshalFn = (data: Record<string, unknown>, memory: WebAssembly.Memory) => number;\n\nexport type UnmarshalFn = (ptr: number, memory: WebAssembly.Memory) => Record<string, unknown>;\n\nexport type ValidateFn = (data: unknown) => void;\n\n/**\n * Load generated marshaling code as executable functions.\n *\n * @internal This function uses Function constructor to execute generated code.\n * The code is generated by the compiler and is trusted, but users should be\n * aware that this executes arbitrary JavaScript in the current context.\n *\n * @param code - The generated marshaling code\n * @returns Object with marshal and unmarshal functions\n */\nexport function loadGeneratedMarshaling(code: string): {\n marshal: MarshalFn;\n unmarshal: UnmarshalFn;\n} {\n // Create a function from the generated code\n\n // We use string replacement instead of ES module loading because: (1) generated code\n // uses ES6 exports which Function() doesn't support, (2) avoiding eval() for security,\n // (3) provides isolated scope for generated code. Convert export syntax to regular functions.\n const cleanedCode = code\n .replace(/^export function marshalInput/gm, 'function marshalInputHelper')\n .replace(/^export function unmarshalOutput/gm, 'function unmarshalOutputHelper')\n .replace(/^export const SCHEMA_HASH/gm, 'const SCHEMA_HASH')\n .replace(/^export const INPUT_FIXED_SIZE/gm, 'const INPUT_FIXED_SIZE')\n .replace(/^export const OUTPUT_FIXED_SIZE/gm, 'const OUTPUT_FIXED_SIZE')\n .replace(/^export function writeString/gm, 'function writeStringHelper')\n .replace(/^export function readString/gm, 'function readStringHelper')\n .replace(/^export function writeArray/gm, 'function writeArrayHelper')\n .replace(/^export function readArray/gm, 'function readArrayHelper')\n .replace(/^export function calculateInputSize/gm, 'function calculateInputSizeHelper');\n\n // Helper function to extract nested values\n const helperCode = `\n function getNestedValue(obj, path) {\n const parts = path.split('.');\n let current = obj;\n for (const part of parts) {\n if (current == null) return undefined;\n if (typeof current !== 'object') return undefined;\n current = current[part];\n }\n return current;\n }\n `;\n\n // Type for the raw 3-argument marshal function\n type RawMarshalFn = (\n data: Record<string, unknown>,\n memory: WebAssembly.Memory,\n allocate: (size: number) => number,\n ) => number;\n\n const module: { marshalInput?: RawMarshalFn; unmarshalOutput?: UnmarshalFn } = {};\n\n const setupFn = new Function(\n 'module',\n helperCode +\n cleanedCode +\n `\n module.marshalInput = marshalInputHelper;\n module.unmarshalOutput = unmarshalOutputHelper;\n `,\n );\n\n setupFn(module);\n\n if (!module.marshalInput || !module.unmarshalOutput) {\n throw new CompilationError(\n 'Generated marshaling code did not export required functions',\n ErrorCode.INVALID_NODE_STRUCTURE,\n { field: 'marshalCode' },\n );\n }\n\n // Create a 2-argument wrapper that provides an internal allocator\n // The allocator starts at 192KB to avoid collision with:\n // - AssemblyScript static data (0 - ~50KB)\n // - AssemblyScript runtime heap (~50KB - ~192KB, grows during evaluation)\n // This matches the memory layout expected by the WASM module.\n const rawMarshal = module.marshalInput;\n const INPUT_BUFFER_START = 192 * 1024; // 192KB\n const REQUIRED_MEMORY = 768 * 1024; // 768KB minimum to fit input + output buffers\n\n const wrappedMarshal: MarshalFn = (data, memory) => {\n // Ensure memory is large enough for the expected layout\n if (memory.buffer.byteLength < REQUIRED_MEMORY) {\n const pagesNeeded = Math.ceil((REQUIRED_MEMORY - memory.buffer.byteLength) / 65536);\n memory.grow(pagesNeeded);\n }\n\n // Simple bump allocator starting at 192KB (after AS runtime heap region)\n let heapOffset = INPUT_BUFFER_START;\n const allocate = (size: number): number => {\n const ptr = heapOffset;\n heapOffset += size;\n // Grow memory if needed\n if (heapOffset > memory.buffer.byteLength) {\n const pagesNeeded = Math.ceil((heapOffset - memory.buffer.byteLength) / 65536);\n memory.grow(pagesNeeded);\n }\n return ptr;\n };\n return rawMarshal(data, memory, allocate);\n };\n\n return {\n marshal: wrappedMarshal,\n unmarshal: module.unmarshalOutput,\n };\n}\n\n// Cache TypeCompiler to avoid repeated dynamic imports\nlet cachedTypeCompiler: unknown = null;\n\n/**\n * Load generated validation code as executable function.\n *\n * @param code - The generated validation code\n * @returns Validation function\n */\nexport async function loadGeneratedValidation(code: string): Promise<ValidateFn> {\n // The generated validation code uses ES6 import/export syntax and TypeScript syntax\n // We need to:\n // 1. Strip import statements\n // 2. Strip TypeScript type annotations\n // 3. Convert exports to regular function/class definitions\n // 4. Pass TypeCompiler as a dependency\n // 5. Return the validateInput function\n\n let cleanedCode = code;\n\n // Remove import statements\n const importRegex = /^import\\s+.*from\\s+['\"].*['\"];?\\s*$/gm;\n cleanedCode = cleanedCode.replace(importRegex, '');\n\n // Strip TypeScript parameter type annotations\n // Matches: function foo(param: Type, other: Type)\n cleanedCode = cleanedCode.replace(/(\\w+)\\s*:\\s*\\w+(?:<[^>]+>)?(?=[,)])/g, '$1');\n\n // Strip TypeScript \"asserts\" return type annotations\n // Matches: ): asserts data is Type {\n cleanedCode = cleanedCode.replace(/\\):\\s+asserts\\s+\\w+\\s+is\\s+\\w+\\s*(<[^>]+>)?\\s*\\{/g, ') {');\n\n // Strip TypeScript class property modifiers\n // Matches: public readonly errors: Type {\n cleanedCode = cleanedCode.replace(/public\\s+readonly\\s+/g, '');\n cleanedCode = cleanedCode.replace(/public\\s+/g, '');\n\n // Strip generic type annotations from Array\n // Matches: Array<{...}> and Array<Type>\n cleanedCode = cleanedCode.replace(/Array<([^>]+)>/g, 'Array');\n\n // Strip TSchema type reference (from @sinclair/typebox)\n cleanedCode = cleanedCode.replace(/:\\s*TSchema/g, '');\n\n // Convert exports to regular definitions\n cleanedCode = cleanedCode\n .replace(/^export function validateInput/gm, 'function validateInput')\n .replace(/^export class ValidationError/gm, 'class ValidationError')\n .replace(/^export function checkInput/gm, 'function checkInput');\n\n // Import TypeCompiler dynamically (cached for performance)\n if (!cachedTypeCompiler) {\n const module = await import('@sinclair/typebox/compiler');\n cachedTypeCompiler = module.TypeCompiler;\n }\n const TypeCompiler = cachedTypeCompiler;\n\n // Create a module object to hold the validator (no type annotation for Function context)\n const module: any = {};\n\n const setupFn = new Function(\n 'TypeCompiler',\n 'module',\n `\n ${cleanedCode}\n module.validateInput = validateInput;\n `,\n );\n\n setupFn(TypeCompiler, module);\n\n if (!module.validateInput) {\n throw new CompilationError(\n 'Generated validation code did not export validateInput function',\n ErrorCode.INVALID_NODE_STRUCTURE,\n { field: 'validationCode' },\n );\n }\n\n return module.validateInput;\n}\n\n/**\n * Re-export validation code generation functions from marshal-gen\n */\nexport { generateValidationCode } from './marshal-gen';\n","// src/compiler/runtime.ts\n// Runtime execution support for evaluating compiled JDM decisions\n\nimport type { CompilationResult } from './types';\nimport {\n loadGeneratedMarshaling,\n loadGeneratedValidation,\n type MarshalFn,\n type UnmarshalFn,\n type ValidateFn,\n} from './runtime-codegen';\n\n// ============================================================================\n// Memory Constants\n// ============================================================================\n\n/**\n * WebAssembly page size in bytes (64KB).\n * This is a fixed constant defined by the WebAssembly specification.\n * Used to calculate memory requirements and convert between pages and bytes.\n */\nconst WASM_PAGE_SIZE_BYTES = 65536;\n\n/**\n * Default maximum memory pages for compiled decisions (256 pages = 16MB).\n *\n * This limit balances:\n * 1. Allowing large decision tables with many rules\n * 2. Preventing unbounded memory growth\n * 3. Browser compatibility (most browsers support at least 32MB per WASM instance)\n *\n * Can be overridden via CompiledDecisionOptions.maximumMemoryPages.\n */\nconst DEFAULT_MAX_MEMORY_PAGES = 256;\n\n/**\n * Input buffer start offset in bytes (after null pointer trap).\n *\n * Must match INPUT_BUFFER_START in src/runtime/memory.ts (which equals\n * NULL_POINTER_TRAP_SIZE = 4 bytes). This ensures correct memory layout\n * coordination between JavaScript marshaling and WASM memory access.\n *\n * The first 4 bytes are reserved as a null pointer trap zone - accessing\n * address 0 will read/write this trap zone, helping catch null pointer bugs.\n */\nconst INPUT_BUFFER_START_OFFSET = 4;\n\n/**\n * Error type for runtime evaluation errors.\n */\nexport class RuntimeError extends Error {\n constructor(\n message: string,\n public readonly code: number = -1,\n public readonly context?: Record<string, unknown>,\n ) {\n super(message);\n this.name = 'RuntimeError';\n }\n}\n\n/**\n * Ensure WASM memory is large enough for the required size.\n *\n * This function checks if the current memory buffer is large enough\n * and grows it by 64KB pages if needed.\n *\n * @param memory - The WebAssembly.Memory instance\n * @param required - The required memory size in bytes\n * @throws {RuntimeError} If memory cannot be grown (e.g., exceeds maximum)\n *\n * @example\n * ```typescript\n * ensureMemory(memory, 131072); // Ensure at least 128KB is available\n * ```\n */\nexport function ensureMemory(memory: WebAssembly.Memory, required: number): void {\n const current = memory.buffer.byteLength;\n if (required <= current) {\n return; // Already have enough memory\n }\n\n // Calculate how many pages to grow\n const pagesNeeded = Math.ceil((required - current) / WASM_PAGE_SIZE_BYTES);\n\n // Attempt to grow memory\n try {\n const oldPages = memory.grow(pagesNeeded);\n if (oldPages < 0) {\n throw new RuntimeError(`Failed to grow memory by ${pagesNeeded} pages`, 5); // OUT_OF_MEMORY\n }\n } catch (error) {\n // Re-throw RuntimeError as-is\n if (error instanceof RuntimeError) {\n throw error;\n }\n throw new RuntimeError(\n `Cannot grow WASM memory: required ${required} bytes, ` +\n `current ${current} bytes, need ${pagesNeeded} more pages. ` +\n (error instanceof Error ? error.message : String(error)),\n 5, // OUT_OF_MEMORY\n );\n }\n}\n\n// Re-export type definitions from runtime-codegen for backward compatibility\nexport type { MarshalFn, UnmarshalFn, ValidateFn } from './runtime-codegen';\n\n/**\n * Options for creating a CompiledDecision instance.\n */\nexport interface CompiledDecisionOptions {\n /** The compiled WASM binary */\n wasm: Uint8Array;\n /** Schema hash for validation */\n schemaHash: bigint;\n /** Function to marshal input to WASM memory */\n marshal: MarshalFn;\n /** Function to unmarshal output from WASM memory */\n unmarshal: UnmarshalFn;\n /** Function to validate input against schema */\n validate?: ValidateFn;\n /** Initial memory size in pages (default: 1 page = 64KB) */\n initialMemoryPages?: number;\n /** Maximum memory pages (default: DEFAULT_MAX_MEMORY_PAGES = 256 pages = 16MB) */\n maximumMemoryPages?: number;\n}\n\n/**\n * A compiled JDM decision ready for evaluation.\n *\n * This class manages the lifecycle of evaluating a compiled decision:\n * 1. Validates input against schema (fail fast with good error)\n * 2. Marshals input to WASM memory\n * 3. Resets heap for fresh evaluation\n * 4. Runs evaluation\n * 5. Checks for runtime errors (schema mismatch, etc.)\n * 6. Unmarshals output from WASM memory\n *\n * @example\n * ```typescript\n * const decision = new CompiledDecision({\n * wasm: compilationResult.wasm,\n * schemaHash: compilationResult.schemaHash,\n * marshal: marshalInput,\n * unmarshal: unmarshalOutput,\n * validate: validateInput,\n * });\n *\n * const output = await decision.evaluate({ age: 25, name: 'Alice' });\n * ```\n */\nexport class CompiledDecision {\n private instance: WebAssembly.Instance | null = null;\n private memory: WebAssembly.Memory | null = null;\n private module: WebAssembly.Module;\n private marshal: MarshalFn;\n private unmarshal: UnmarshalFn;\n private validate?: ValidateFn;\n\n constructor(private options: CompiledDecisionOptions) {\n // WebAssembly.Module requires an ArrayBuffer starting at offset 0, but Uint8Array may\n // be a view into a larger buffer at a non-zero offset, which would cause Module\n // construction to fail. Create a proper Uint8Array view that the Module constructor\n // can safely access, ensuring we only pass the exact bytes of the WASM binary.\n const buffer = new Uint8Array(\n options.wasm.buffer,\n options.wasm.byteOffset,\n options.wasm.byteLength,\n );\n this.module = new WebAssembly.Module(buffer as unknown as ArrayBuffer);\n\n this.marshal = options.marshal;\n this.unmarshal = options.unmarshal;\n this.validate = options.validate;\n }\n\n /**\n * Initialize the WebAssembly instance.\n * This is done lazily on first evaluation, or can be called explicitly.\n */\n private async initialize(): Promise<void> {\n if (this.instance !== null) {\n return;\n }\n\n // Don't provide memory via import - let the WASM module use its own exported memory.\n // AssemblyScript's incremental GC runtime requires specific memory initialization\n // that only works correctly with the module's own memory.\n this.instance = await WebAssembly.instantiate(this.module, {\n env: {\n abort: () => {\n throw new RuntimeError('WASM abort called');\n },\n seed: () => {\n return Date.now();\n },\n 'Date.now': () => Date.now(),\n },\n // Empty index module provided for AssemblyScript compatibility\n index: {},\n });\n\n // Get memory from the WASM module's exports\n this.memory = this.instance.exports.memory as WebAssembly.Memory;\n }\n\n /**\n * Evaluate the decision with the given input.\n *\n * @param input - The input data to evaluate\n * @returns The output of the decision evaluation\n * @throws {RuntimeError} If evaluation fails\n * @throws {ValidationError} If input validation fails (if validate is provided)\n */\n async evaluate<I = Record<string, unknown>, O = Record<string, unknown>>(input: I): Promise<O> {\n await this.initialize();\n\n if (!this.instance || !this.memory) {\n throw new RuntimeError('WASM instance not initialized');\n }\n\n // Local references to avoid null checks in the hot path\n const memory = this.memory;\n const instance = this.instance;\n\n // 1. Validate input against schema (fail fast with good error)\n if (this.validate) {\n try {\n this.validate(input);\n } catch (error) {\n if (error instanceof Error) {\n throw new RuntimeError(`Input validation failed: ${error.message}`, 1, { input });\n }\n throw error;\n }\n }\n\n // Clear any stale error state from previous evaluations before starting new evaluation.\n // This ensures each evaluation starts with a clean slate.\n const clearLastErrorFn = instance.exports.clearLastError as () => void;\n if (clearLastErrorFn) {\n clearLastErrorFn();\n }\n\n try {\n // 2. Marshal input to WASM memory\n const inputPtr: number = this.marshal(input as Record<string, unknown>, memory);\n\n // Verify input pointer is valid\n if (inputPtr < INPUT_BUFFER_START_OFFSET) {\n throw new RuntimeError(\n `Invalid input pointer: ${inputPtr} (must be >= ${INPUT_BUFFER_START_OFFSET})`,\n );\n }\n\n // 3. Reset heap for fresh evaluation\n const resetHeapFn = instance.exports.resetHeap as () => void;\n if (resetHeapFn) {\n resetHeapFn();\n }\n\n // 4. Run evaluation\n const evaluateFn = instance.exports.evaluate as (ptr: number) => number;\n if (!evaluateFn) {\n throw new RuntimeError('evaluate function not exported from WASM module');\n }\n\n const outputPtr: number = evaluateFn(inputPtr);\n\n // 5. Check for runtime errors (schema mismatch, etc.)\n const getLastErrorFn = instance.exports.getLastError as () => number;\n if (getLastErrorFn) {\n const errorCode = getLastErrorFn();\n if (errorCode !== 0) {\n throw new RuntimeError(this.getErrorMessage(errorCode), errorCode, { input, outputPtr });\n }\n }\n\n // Verify output pointer is valid\n // Output pointer validity is verified during unmarshal - we only check it's within\n // addressable memory here to avoid segfault.\n if (outputPtr < memory.buffer.byteLength) {\n // Output pointer should be within a reasonable range\n // We'll verify the unmarshal works properly\n }\n\n // 6. Unmarshal output from WASM memory\n const output = this.unmarshal(outputPtr, memory);\n\n return output as O;\n } finally {\n // Always clear error state after evaluation, even if an error was thrown.\n // This prevents stale error state from affecting subsequent evaluations.\n if (clearLastErrorFn) {\n clearLastErrorFn();\n }\n }\n }\n\n /**\n * Get a human-readable error message for a given error code.\n *\n * @param errorCode - The error code from getLastError()\n * @returns A human-readable error message\n */\n private getErrorMessage(errorCode: number): string {\n // Error codes duplicated from assembly/runtime/errors.ts because WASM cannot export\n // enum metadata - these must stay synchronized.\n // NONE = 0, SCHEMA_MISMATCH = 1, NULL_POINTER = 2, INVALID_ACCESS = 3, EVALUATION_ERROR = 4, OUT_OF_MEMORY = 5\n const errorMessages: Record<number, string> = {\n 0: 'No error',\n 1: 'Schema mismatch: input data does not match expected schema',\n 2: 'Null pointer dereference',\n 3: 'Invalid memory access',\n 4: 'Evaluation error',\n 5: 'Out of memory',\n };\n\n return errorMessages[errorCode] ?? `Unknown error code: ${errorCode}`;\n }\n\n /**\n * Get the current WebAssembly memory instance.\n * This can be useful for debugging or direct memory inspection.\n *\n * @returns The WebAssembly.Memory instance (null if not initialized)\n */\n getMemory(): WebAssembly.Memory | null {\n return this.memory;\n }\n\n /**\n * Get the current WebAssembly instance.\n *\n * @returns The WebAssembly.Instance instance (null if not initialized)\n */\n getInstance(): WebAssembly.Instance | null {\n return this.instance;\n }\n\n /**\n * Dispose of this CompiledDecision instance.\n * This clears the WebAssembly instance and allows garbage collection.\n */\n dispose(): void {\n this.instance = null;\n }\n\n /**\n * Get memory usage statistics.\n *\n * @returns Object with memory usage information\n */\n getMemoryStats(): { current: number; maximum: number; used: number } {\n // Note: 'used' equals 'current' because WebAssembly.Memory doesn't expose actual heap\n // usage - tracking used bytes requires instrumentation in AssemblyScript allocator.\n const currentBytes = this.memory?.buffer.byteLength ?? 0;\n return {\n current: currentBytes,\n maximum: (this.options.maximumMemoryPages ?? DEFAULT_MAX_MEMORY_PAGES) * WASM_PAGE_SIZE_BYTES,\n used: currentBytes,\n };\n }\n\n /**\n * Get the input buffer pointer, ensuring sufficient memory is available.\n *\n * This method doesn't allocate new buffers on each call - it always returns the\n * same INPUT_BUFFER_START_OFFSET constant after ensuring the memory can accommodate the\n * required size. Single-allocation design chosen because: (1) heap is reset between\n * evaluations so fragmentation isn't an issue, (2) simpler than maintaining a free\n * list, (3) marshal code controls actual layout in WASM memory. All input data is\n * marshaled into a single buffer starting at INPUT_BUFFER_START_OFFSET.\n *\n * @param required - The required memory size in bytes\n * @returns The base pointer of the input buffer (always INPUT_BUFFER_START_OFFSET)\n * @throws {RuntimeError} If memory cannot be grown to accommodate the required size\n *\n * @example\n * ```typescript\n * const ptr = decision.getInputBuffer(1024); // Ensure 1KB available\n * ```\n */\n getInputBuffer(required: number): number {\n if (!this.memory) {\n throw new RuntimeError('Memory not initialized - call evaluate() first', 5);\n }\n\n // Ensure enough memory\n try {\n ensureMemory(this.memory, required);\n } catch (error) {\n throw new RuntimeError(\n `Memory allocation failed: ${error instanceof Error ? error.message : String(error)}`,\n 5, // OUT_OF_MEMORY error code\n );\n }\n\n // Single-allocation design: return the INPUT_BUFFER_START_OFFSET\n return INPUT_BUFFER_START_OFFSET;\n }\n}\n\n/**\n * Create a CompiledDecision instance from a CompilationResult.\n *\n * This is a convenience function that creates the necessary marshal,\n * unmarshal, and validation functions from the generated code.\n *\n * @param result - The compilation result\n * @param validate - Optional validation function (defaults to generated validation code)\n * @returns A CompiledDecision instance ready for evaluation\n *\n * @example\n * ```typescript\n * const result = await compile({\n * jdm: myJdm,\n * inputSchema: MyInputSchema,\n * outputSchema: MyOutputSchema,\n * });\n *\n * const decision = createCompiledDecision(result);\n * const output = await decision.evaluate({ age: 25 });\n * ```\n */\nexport async function createCompiledDecision(\n result: CompilationResult,\n validate?: ValidateFn,\n): Promise<CompiledDecision> {\n // Load the marshal and unmarshal functions from the generated code\n const { marshal, unmarshal } = loadGeneratedMarshaling(result.marshalCode);\n\n // Load or use provided validation function\n const validator = validate ?? (await loadGeneratedValidation(result.validationCode));\n\n return new CompiledDecision({\n wasm: result.wasm,\n schemaHash: result.schemaHash,\n marshal,\n unmarshal,\n validate: validator,\n });\n}\n\n// Re-export compile-time code generation functions for backward compatibility\nexport { loadGeneratedMarshaling, loadGeneratedValidation } from './runtime-codegen';\n\n/**\n * Re-export types from dependencies\n */\nexport type { TSchema } from '@sinclair/typebox';\n","/**\n * Compile AssemblyScript code to WebAssembly.\n *\n * This module provides the main entry point for WASM compilation with caching.\n * Implementation details are delegated to specialized modules:\n * - virtual-fs.ts: Virtual filesystem for in-memory ASC compilation\n * - asc-compiler.ts: AssemblyScript compiler invocation and configuration\n * - wasm-instantiate.ts: WASM module instantiation and host environment\n */\n\nimport type { CompilerOptions } from './types';\nimport { computeCacheKey, readCacheFromDisk, writeCacheToDisk, isCacheEnabled } from './cache';\nimport { compileAssemblyScriptInternal } from './asc-compiler';\n\n// Re-export for backward compatibility\nexport { instantiateWasm } from './wasm-instantiate';\n\n/**\n * Compile AssemblyScript code to WebAssembly.\n *\n * This function uses the AssemblyScript compiler to generate WASM from\n * the generated AssemblyScript source code using a virtual filesystem.\n *\n * Supports disk-based caching to avoid redundant compilations.\n * Cache is keyed on: AssemblyScript code + runtime libraries + compiler options.\n *\n * **Filesystem Side Effects:**\n * - Compilation may read/write cache files (unless disabled via JDM_ASM_NO_CACHE=1)\n * - If `options.debugOutputPath` is set or `JDM_ASM_DEBUG_OUTPUT` env var is defined,\n * compilation failures will write debug files to disk (see CompilerOptions.debugOutputPath)\n *\n * @param code - The AssemblyScript source code to compile\n * @param options - Compiler options (optimize, debug, debugOutputPath, etc.)\n * @returns An object with the compiled binary and WAT text\n */\nexport async function compileAssemblyScript(\n code: string,\n options: CompilerOptions,\n): Promise<{ binary: Uint8Array; wat: string }> {\n // Check cache first (unless disabled)\n if (isCacheEnabled()) {\n const cacheKey = computeCacheKey(code, options);\n const cached = readCacheFromDisk(cacheKey);\n if (cached) {\n return cached;\n }\n\n // Compile and cache the result\n const result = await compileAssemblyScriptInternal(code, options);\n writeCacheToDisk(cacheKey, result);\n return result;\n }\n\n // Cache disabled, compile directly\n return compileAssemblyScriptInternal(code, options);\n}\n","import { type TSchema, Kind } from '@sinclair/typebox';\nimport type { FlattenedLayout } from './types';\nimport { createHash } from 'crypto';\n\n/**\n * Schema field information for memory layout\n */\ninterface SchemaField {\n schema: TSchema;\n path: string;\n flatName: string;\n}\n\n/**\n * Flattens a TypeBox schema to a memory layout.\n *\n * This function processes a schema and produces a flattened representation\n * that can be used for direct memory access in WebAssembly.\n *\n * Memory structure:\n * ┌─────────────────────────────────────────────────────────────┐\n * │ Fixed Fields (numbers, bools, enum indices) │\n * │ customer_age: f64 (8 bytes) │\n * │ customer_tier: i32 (4 bytes) - enum index │\n * ├─────────────────────────────────────────────────────────────┤\n * │ String/Array Pointers (offset, length pairs) │\n * │ order_items_ptr: i32, order_items_len: i32 │\n * ├─────────────────────────────────────────────────────────────┤\n * │ Variable-length data (UTF-16 strings, array contents) │\n * └─────────────────────────────────────────────────────────────┘\n *\n * @param schema - The TypeBox schema to flatten\n * @param _prefix - Internal parameter for recursive flattening with dotted paths\n * @returns The flattened memory layout\n */\nexport function flattenSchema(schema: TSchema): FlattenedLayout {\n const layout: FlattenedLayout = {\n fields: [],\n };\n\n // Collect all fields from the schema\n const fields: SchemaField[] = collectFields(schema, '');\n\n // Track current offset for field layout\n let currentOffset = 0;\n\n // Process fields: first pass - fixed types\n for (const field of fields) {\n const typeInfo = getFieldType(field.schema);\n if (typeInfo.isFixed) {\n layout.fields.push({\n path: field.path,\n flatName: field.flatName,\n type: typeInfo.asType,\n offset: currentOffset,\n size: typeInfo.size,\n });\n currentOffset += typeInfo.size;\n }\n }\n\n // Second pass - variable types (strings, arrays)\n // These get pointers (2 x i32 = 8 bytes each for offset + length)\n for (const field of fields) {\n const typeInfo = getFieldType(field.schema);\n if (!typeInfo.isFixed) {\n layout.fields.push({\n path: field.path,\n flatName: field.flatName,\n type: typeInfo.asType,\n offset: currentOffset,\n size: -1, // Variable length\n });\n currentOffset += 8; // 4 bytes offset + 4 bytes length\n }\n }\n\n return layout;\n}\n\n/**\n * Collect all fields from a schema recursively\n */\nfunction collectFields(schema: TSchema, path: string): SchemaField[] {\n const fields: SchemaField[] = [];\n\n const kind = (schema as any)[Kind];\n\n if (kind === 'Object') {\n const properties = (schema as any).properties || {};\n for (const [name, fieldSchema] of Object.entries(properties)) {\n const fieldPath = path ? `${path}.${name}` : name;\n const flatName = path ? `${path}_${name}` : name;\n\n const nestedFields = collectFields(fieldSchema as TSchema, fieldPath);\n if (nestedFields.length > 0) {\n fields.push(...nestedFields);\n } else {\n fields.push({\n schema: fieldSchema as TSchema,\n path: fieldPath,\n flatName,\n });\n }\n }\n }\n\n // For non-objects, return empty array (handled by parent)\n return fields;\n}\n\n/**\n * Get type information for a schema field\n */\nfunction getFieldType(schema: TSchema): {\n isFixed: boolean;\n asType: 'f64' | 'i32' | 'i64' | 'bool' | 'string' | 'array';\n size: number;\n} {\n const kind = (schema as any)[Kind];\n\n switch (kind) {\n case 'Number':\n return { isFixed: true, asType: 'f64', size: 8 };\n\n case 'Integer':\n return { isFixed: true, asType: 'i32', size: 4 };\n\n case 'Boolean':\n // Booleans stored as i32 (4 bytes) to ensure natural alignment and match AssemblyScript's\n // bool representation\n return { isFixed: true, asType: 'bool', size: 4 };\n\n case 'String':\n return { isFixed: false, asType: 'string', size: -1 };\n\n case 'Array':\n return { isFixed: false, asType: 'array', size: -1 };\n\n case 'Literal':\n // Literals are stored as i32 indices (for boolean-like or enum-like)\n return { isFixed: true, asType: 'i32', size: 4 };\n\n case 'Union':\n // First, handle unions of Literal types (enum-like) as i32 indices for efficiency\n const anyOf = (schema as any).anyOf;\n if (Array.isArray(anyOf) && anyOf.length > 0) {\n const firstKind = (anyOf[0] as any)[Kind];\n if (firstKind === 'Literal') {\n return { isFixed: true, asType: 'i32', size: 4 };\n }\n }\n // Default to string for heterogeneous unions - can represent multiple incompatible types\n // (e.g., string | number | object)\n return { isFixed: false, asType: 'string', size: -1 };\n\n default:\n // Default to string for unknown types\n return { isFixed: false, asType: 'string', size: -1 };\n }\n}\n\n/**\n * Compute a hash of the input and output schemas for runtime validation.\n *\n * This hash is embedded in the compiled WASM module and can be used to\n * verify that the runtime data matches the expected schema.\n *\n * Uses SHA256 to create a canonical hash, then takes the first 8 bytes as u64.\n *\n * @param inputSchema - The input schema\n * @param outputSchema - The output schema\n * @returns A 64-bit hash value\n */\nexport function computeSchemaHash(inputSchema: TSchema, outputSchema: TSchema): bigint {\n // Create canonical representation with sorted keys\n const canonical = JSON.stringify(\n {\n input: canonicalizeSchema(inputSchema),\n output: canonicalizeSchema(outputSchema),\n },\n null,\n 2,\n );\n\n // Compute SHA256 hash\n const hash = createHash('sha256').update(canonical).digest();\n\n // Take first 8 bytes as u64 (little-endian)\n return hash.readBigUInt64LE(0);\n}\n\n/**\n * Convert a schema to a canonical form for hashing by sorting keys and normalizing structure\n */\nfunction canonicalizeSchema(schema: TSchema): unknown {\n const kind = (schema as any)[Kind];\n\n if (kind === 'Object') {\n const properties = (schema as any).properties || {};\n const canonical: Record<string, unknown> = {};\n const keys = Object.keys(properties).sort();\n\n for (const key of keys) {\n canonical[key] = canonicalizeSchema(properties[key]);\n }\n\n return {\n type: 'object',\n properties: canonical,\n required: ((schema as any).required || []).sort(),\n };\n }\n\n if (kind === 'Array') {\n return {\n type: 'array',\n items: canonicalizeSchema((schema as any).items),\n };\n }\n\n if (kind === 'Enum') {\n return {\n type: 'enum',\n values: ((schema as any).anyOf || []).map((val: TSchema) => (val as any).const).sort(),\n };\n }\n\n if (kind === 'Literal') {\n return {\n type: 'literal',\n value: (schema as any).const,\n };\n }\n\n // For primitive types, return a simple representation\n const primitiveTypes: Record<string, string> = {\n Number: 'number',\n Integer: 'integer',\n String: 'string',\n Boolean: 'boolean',\n };\n\n return primitiveTypes[kind] || kind;\n}\n","// src/compiler/index.ts\nimport type { TSchema } from '@sinclair/typebox';\nimport { parseJDM, type JDMDecision } from './parser';\nimport { compileDecision } from './codegen';\nimport { compileAssemblyScript } from './build';\nimport { flattenSchema, computeSchemaHash } from './schema';\nimport { generateMarshalCode, generateValidationCode } from './marshal-gen';\nimport type {\n CompilerOptions,\n CompilationResult,\n CompilationContext,\n NoMatchBehavior,\n} from './types';\nimport { readFileSync } from 'fs';\nimport path from 'path';\n\n/**\n * Type guard for Node.js file system errors.\n */\nfunction isFileNotFoundError(error: unknown): boolean {\n return error !== null && typeof error === 'object' && 'code' in error && error.code === 'ENOENT';\n}\n\n/**\n * Creates a filesystem-based loader for sub-decision JDM files.\n *\n * This loader performs I/O by reading from the filesystem and may throw filesystem errors\n * (e.g., ENOENT for missing files, EACCES for permission denied).\n *\n * Supports both zen-engine compatibility (flat structure in zen-reference/) and organized test\n * structure (nested by feature in sub-decisions/). This dual approach allows us to port\n * zen-engine fixtures without reorganization while providing better organization for our own\n * tests.\n *\n * @param testDataRoot - Optional root directory for test data. Defaults to \"test-data/\" in current working directory.\n * @returns A loader function that reads JDM files from the filesystem\n * @throws Error if file is not found in any search path\n * @throws Error for other filesystem errors (permissions, invalid content, etc.)\n */\nfunction createFilesystemLoader(testDataRoot?: string): (key: string) => JDMDecision {\n const root = testDataRoot || path.join(process.cwd(), 'test-data');\n const possiblePaths = [\n root,\n path.join(root, 'sub-decisions'),\n path.join(root, 'sub-decisions/basic'),\n path.join(root, 'sub-decisions/simple-multi'),\n path.join(root, 'sub-decisions/complex-multi'),\n path.join(root, 'sub-decisions/diamond'),\n path.join(root, 'sub-decisions/error-propagation'),\n path.join(root, 'zen-reference'),\n ];\n\n return (key: string): JDMDecision => {\n for (const basePath of possiblePaths) {\n try {\n const filePath = path.join(basePath, key);\n const content = readFileSync(filePath, 'utf-8');\n return parseJDM(content);\n } catch (error) {\n // Only try next path for file-not-found errors\n // Let other errors (parse errors, permission denied) propagate immediately\n if (isFileNotFoundError(error)) {\n continue;\n }\n throw error;\n }\n }\n throw new Error(\n `Failed to load sub-decision \"${key}\": not found in any search path (${possiblePaths.join(', ')})`,\n );\n };\n}\n\n// Re-export parser, graph, optimizer, runtime, validation, types, and errors\nexport * from './parser';\nexport * from './graph';\nexport * from './types';\nexport * from './errors';\nexport * from './optimizer';\nexport * from './runtime';\nexport * from './runtime-codegen';\n\n// Validation modules - split by concern:\n// - compile-time-validation: Static analysis of JDM structure and references\n// - runtime-validation-codegen: Validation code that executes at runtime\nexport * from './compile-time-validation';\nexport * from './runtime-validation-codegen';\n\n// Backward compatibility: re-export from input-validation (deprecated)\nexport * from './input-validation';\n\n// Export cache utilities for advanced usage\nexport {\n clearCache,\n getCacheStats,\n pruneCache,\n isCacheEnabled,\n getCacheDirectory,\n getCacheHealth,\n} from './cache';\n\n/**\n * Main entry point: Compile JDM to WASM with schema-driven marshaling.\n *\n * @example\n * const result = await compile({\n * inputSchema: InputSchema,\n * outputSchema: OutputSchema,\n * jdm: jdmJson,\n * optimize: true,\n * });\n */\nexport async function compile(options: {\n inputSchema: TSchema;\n outputSchema: TSchema;\n jdm: string | JDMDecision;\n optimize?: boolean;\n debug?: boolean;\n /** How to handle cases where no rules match in decision tables/switches */\n noMatchBehavior?: NoMatchBehavior;\n /** Optional loader function to load sub-decision JDM files */\n loadDecision?: CompilerOptions['loadDecision'];\n /** Optional testDataRoot path for default loader to search */\n testDataRoot?: string;\n}): Promise<CompilationResult> {\n const opts: CompilerOptions = {\n optimize: options.optimize ?? true,\n debug: options.debug ?? false,\n // Validation disabled during compilation for performance (compile-time checks).\n // Schema validation is generated as separate code (generateValidationCode()) that\n // the runtime can call before evaluation.\n validate: false,\n noMatchBehavior: options.noMatchBehavior,\n };\n\n // Phase 1: Parse and validate JDM\n const parsed = parseJDM(options.jdm);\n\n // Phase 2: Flatten schemas to memory layout\n const inputLayout = flattenSchema(options.inputSchema);\n const outputLayout = flattenSchema(options.outputSchema);\n\n // Phase 3: Compute schema hash for runtime validation\n const schemaHash = computeSchemaHash(options.inputSchema, options.outputSchema);\n\n // Phase 4: Build compilation context\n const context: CompilationContext = {\n jdm: parsed,\n inputSchema: options.inputSchema,\n outputSchema: options.outputSchema,\n inputLayout,\n outputLayout,\n schemaHash,\n options: opts,\n parseExpression: (expr) => parseStandardExpression(expr),\n parseUnaryExpression: (expr) => parseUnaryExpressionImpl(expr),\n getUniqueId: createIdGenerator(),\n loadDecision: options.loadDecision ?? createFilesystemLoader(options.testDataRoot),\n // Avoids duplicate compilation when multiple nodes reference same sub-decision\n compiledSubDecisions: new Map(),\n // Detects circular references to prevent infinite loops during compilation\n decisionPath: [],\n helperFunctions: new Map(),\n };\n\n // Phase 5: Generate AssemblyScript code\n const asCode = compileDecision(parsed, context);\n\n // Phase 6: Compile to WASM\n const { binary, wat } = await compileAssemblyScript(asCode, opts);\n\n // Phase 7: Generate JS marshaling code\n const marshalCode = generateMarshalCode(inputLayout, outputLayout, schemaHash);\n const validationCode = generateValidationCode(options.inputSchema);\n\n return {\n wasm: binary,\n schemaHash,\n marshalCode,\n validationCode,\n wat: opts.debug ? wat : undefined,\n assemblyScript: opts.debug ? asCode : undefined,\n };\n}\n\nfunction createIdGenerator(): (prefix: string) => string {\n const counters = new Map<string, number>();\n return (prefix: string) => {\n const count = counters.get(prefix) ?? 0;\n counters.set(prefix, count + 1);\n return `${prefix}_${count}`;\n };\n}\n\n// Import parse functions\nimport {\n parseStandardExpression,\n parseUnaryExpression as parseUnaryExpressionImpl,\n} from './unary-parser';\n","/**\n * Union type of all expression AST nodes.\n */\nexport type ExpressionAST =\n | NumberLiteral\n | StringLiteral\n | BooleanLiteral\n | NullLiteral\n | Identifier\n | DollarRef\n | HashRef\n | BinaryOp\n | UnaryOp\n | TernaryOp\n | MemberAccess\n | IndexAccess\n | FunctionCall\n | Interval\n | TemplateLiteral\n | ArrayLiteral\n | ObjectLiteral;\n\nexport interface NumberLiteral {\n type: 'NumberLiteral';\n value: number;\n}\n\nexport interface StringLiteral {\n type: 'StringLiteral';\n value: string;\n}\n\nexport interface BooleanLiteral {\n type: 'BooleanLiteral';\n value: boolean;\n}\n\nexport interface NullLiteral {\n type: 'NullLiteral';\n}\n\nexport interface Identifier {\n type: 'Identifier';\n name: string;\n}\n\n/**\n * Dollar reference - used in unary mode to refer to the current value.\n * Represents `$` in decision table cell expressions.\n */\nexport interface DollarRef {\n type: 'DollarRef';\n}\n\n/**\n * Hash reference - used in higher-order functions to refer to current element.\n * Represents `#` in expressions like `filter(items, # > 5)`.\n */\nexport interface HashRef {\n type: 'HashRef';\n}\n\nexport interface BinaryOp {\n type: 'BinaryOp';\n op: BinaryOperator;\n left: ExpressionAST;\n right: ExpressionAST;\n}\n\nexport type BinaryOperator =\n // Arithmetic\n | '+'\n | '-'\n | '*'\n | '/'\n | '%'\n | '^'\n // Comparison\n | '=='\n | '!='\n | '<'\n | '>'\n | '<='\n | '>='\n // Logical\n | 'and'\n | 'or'\n | '??'\n // Membership\n | 'in'\n | 'not in';\n\nexport interface UnaryOp {\n type: 'UnaryOp';\n op: UnaryOperator;\n operand: ExpressionAST;\n}\n\nexport type UnaryOperator = 'not' | '-';\n\nexport interface TernaryOp {\n type: 'TernaryOp';\n condition: ExpressionAST;\n consequent: ExpressionAST;\n alternate: ExpressionAST;\n}\n\nexport interface MemberAccess {\n type: 'MemberAccess';\n object: ExpressionAST;\n property: string;\n}\n\nexport interface IndexAccess {\n type: 'IndexAccess';\n object: ExpressionAST;\n index: ExpressionAST;\n}\n\nexport interface FunctionCall {\n type: 'FunctionCall';\n callee: ExpressionAST;\n args: ExpressionAST[];\n}\n\nexport interface Interval {\n type: 'Interval';\n start: ExpressionAST;\n end: ExpressionAST;\n startInclusive: boolean;\n endInclusive: boolean;\n}\n\nexport interface TemplateLiteral {\n type: 'TemplateLiteral';\n parts: Array<{ text: string } | { expr: ExpressionAST }>;\n}\n\nexport interface ArrayLiteral {\n type: 'ArrayLiteral';\n elements: ExpressionAST[];\n}\n\nexport interface ObjectLiteral {\n type: 'ObjectLiteral';\n properties: Array<{ key: string; value: ExpressionAST }>;\n}\n\nexport function isNumberLiteral(node: ExpressionAST): node is NumberLiteral {\n return node.type === 'NumberLiteral';\n}\n\nexport function isStringLiteral(node: ExpressionAST): node is StringLiteral {\n return node.type === 'StringLiteral';\n}\n\nexport function isBooleanLiteral(node: ExpressionAST): node is BooleanLiteral {\n return node.type === 'BooleanLiteral';\n}\n\nexport function isNullLiteral(node: ExpressionAST): node is NullLiteral {\n return node.type === 'NullLiteral';\n}\n\nexport function isIdentifier(node: ExpressionAST): node is Identifier {\n return node.type === 'Identifier';\n}\n\nexport function isDollarRef(node: ExpressionAST): node is DollarRef {\n return node.type === 'DollarRef';\n}\n\nexport function isHashRef(node: ExpressionAST): node is HashRef {\n return node.type === 'HashRef';\n}\n\nexport function isBinaryOp(node: ExpressionAST): node is BinaryOp {\n return node.type === 'BinaryOp';\n}\n\nexport function isUnaryOp(node: ExpressionAST): node is UnaryOp {\n return node.type === 'UnaryOp';\n}\n\nexport function isTernaryOp(node: ExpressionAST): node is TernaryOp {\n return node.type === 'TernaryOp';\n}\n\nexport function isMemberAccess(node: ExpressionAST): node is MemberAccess {\n return node.type === 'MemberAccess';\n}\n\nexport function isIndexAccess(node: ExpressionAST): node is IndexAccess {\n return node.type === 'IndexAccess';\n}\n\nexport function isFunctionCall(node: ExpressionAST): node is FunctionCall {\n return node.type === 'FunctionCall';\n}\n\nexport function isInterval(node: ExpressionAST): node is Interval {\n return node.type === 'Interval';\n}\n\nexport function isTemplateLiteral(node: ExpressionAST): node is TemplateLiteral {\n return node.type === 'TemplateLiteral';\n}\n\nexport function isArrayLiteral(node: ExpressionAST): node is ArrayLiteral {\n return node.type === 'ArrayLiteral';\n}\n\nexport function isObjectLiteral(node: ExpressionAST): node is ObjectLiteral {\n return node.type === 'ObjectLiteral';\n}\n","import { createToken, CstParser, Lexer, type IToken } from 'chevrotain';\nimport { CompilationError, ErrorCode, type SourceLocation } from './errors';\n\n// === TOKENS (order matters - longer matches first) ===\n\nconst WhiteSpace = createToken({\n name: 'WhiteSpace',\n pattern: /\\s+/,\n group: Lexer.SKIPPED,\n});\n\nconst DotDot = createToken({ name: 'DotDot', pattern: /\\.\\./ });\nconst Dot = createToken({ name: 'Dot', pattern: /\\./ });\n\nconst Eq = createToken({ name: 'Eq', pattern: /==/ });\nconst NotEq = createToken({ name: 'NotEq', pattern: /!=/ });\nconst EqEq = createToken({ name: 'EqEq', pattern: /===/ });\nconst NotEqEq = createToken({ name: 'NotEqEq', pattern: /!==/ });\nconst LtEq = createToken({ name: 'LtEq', pattern: /<=/ });\nconst GtEq = createToken({ name: 'GtEq', pattern: />=/ });\nconst Lt = createToken({ name: 'Lt', pattern: /</ });\nconst Gt = createToken({ name: 'Gt', pattern: />/ });\n\nconst AndAnd = createToken({ name: 'AndAnd', pattern: /&&/ });\nconst OrOr = createToken({ name: 'OrOr', pattern: /\\|\\|/ });\nconst NotNot = createToken({ name: 'NotNot', pattern: /!/ });\n\n// Keywords use longer_alt to ensure 'and'/'or' are recognized as operators rather than\n// variable names - Chevrotain tries longer_alt tokens first, preventing 'android' from\n// incorrectly tokenizing as 'and' + 'roid'.\nconst Identifier = createToken({ name: 'Identifier', pattern: /[$a-zA-Z_]\\w*/ });\n\nconst And = createToken({ name: 'And', pattern: /and/, longer_alt: Identifier });\nconst Or = createToken({ name: 'Or', pattern: /or/, longer_alt: Identifier });\nconst Not = createToken({ name: 'Not', pattern: /not/, longer_alt: Identifier });\nconst In = createToken({ name: 'In', pattern: /in/, longer_alt: Identifier });\n\nconst True = createToken({ name: 'True', pattern: /true/, longer_alt: Identifier });\nconst False = createToken({ name: 'False', pattern: /false/, longer_alt: Identifier });\nconst Null = createToken({ name: 'Null', pattern: /null/, longer_alt: Identifier });\n\nconst NumberLiteral = createToken({\n name: 'NumberLiteral',\n pattern: /\\d[\\d_]*(\\.\\d+)?/,\n});\n\nconst StringLiteral = createToken({\n name: 'StringLiteral',\n pattern: /\"([^\"\\\\]|\\\\.)*\"|'([^'\\\\]|\\\\.)*'/,\n});\n\n// Template strings\n// Token order critical: TemplateHead/Middle/Tail must precede TemplateNoSub because Chevrotain matches first token that fits.\n// Without this order, '`foo${x}`' would incorrectly match TemplateNoSub instead of TemplateHead + expr + TemplateTail.\n// TemplateNoSub pattern must explicitly exclude ${ to prevent ambiguity between templates with/without interpolation.\nconst TemplateHead = createToken({\n name: 'TemplateHead',\n pattern: /`(?:[^`\\\\$]|\\\\.|\\$(?!\\{))*?\\$\\{/,\n});\nconst TemplateMiddle = createToken({\n name: 'TemplateMiddle',\n pattern: /\\}(?:[^`\\\\$]|\\\\.|\\$(?!\\{))*?\\$\\{/,\n});\nconst TemplateTail = createToken({\n name: 'TemplateTail',\n pattern: /\\}(?:[^`\\\\$]|\\\\.|\\$(?!\\{))*?`/,\n});\n// TemplateNoSub should NOT match strings that contain ${, so we exclude them explicitly\nconst TemplateNoSub = createToken({\n name: 'TemplateNoSub',\n pattern: /`(?:[^`\\\\$]|\\\\.|\\$(?!\\{))*?`/,\n});\n\nconst Hash = createToken({ name: 'Hash', pattern: /#/ }); // Current element in higher-order functions\n// Dollar ($) represents explicit reference in unary mode. Uses longer_alt: Identifier to ensure $-prefixed identifiers like '$myVar'\n// are tokenized as a single Identifier token rather than separate Dollar + Identifier tokens, since Identifier pattern includes '$' prefix.\nconst Dollar = createToken({ name: 'Dollar', pattern: /\\$/, longer_alt: Identifier });\n\n// Operators and delimiters\nconst Plus = createToken({ name: 'Plus', pattern: /\\+/ });\nconst Minus = createToken({ name: 'Minus', pattern: /-/ });\nconst Mult = createToken({ name: 'Mult', pattern: /\\*/ });\nconst Div = createToken({ name: 'Div', pattern: /\\// });\nconst Mod = createToken({ name: 'Mod', pattern: /%/ });\nconst Power = createToken({ name: 'Power', pattern: /\\^/ });\n\nconst LParen = createToken({ name: 'LParen', pattern: /\\(/ });\nconst RParen = createToken({ name: 'RParen', pattern: /\\)/ });\nconst LBracket = createToken({ name: 'LBracket', pattern: /\\[/ });\nconst RBracket = createToken({ name: 'RBracket', pattern: /\\]/ });\n\nconst LBrace = createToken({ name: 'LBrace', pattern: /\\{/ });\nconst RBrace = createToken({ name: 'RBrace', pattern: /\\}/ });\n\nconst Comma = createToken({ name: 'Comma', pattern: /,/ });\nconst Question = createToken({ name: 'Question', pattern: /\\?/, longer_alt: Identifier });\nconst QuestionQuestion = createToken({ name: 'QuestionQuestion', pattern: /\\?\\?/ });\nconst Colon = createToken({ name: 'Colon', pattern: /:/ });\n\nconst allTokens = [\n WhiteSpace,\n DotDot,\n Dot,\n EqEq,\n NotEqEq,\n Eq,\n NotEq,\n LtEq,\n GtEq,\n Lt,\n Gt,\n AndAnd,\n OrOr,\n NotNot,\n And,\n Or,\n Not,\n In,\n True,\n False,\n Null,\n Plus,\n Minus,\n Mult,\n Div,\n Mod,\n Power,\n LParen,\n RParen,\n LBracket,\n RBracket,\n LBrace,\n // Template tokens must come before RBrace so that TemplateTail/TemplateMiddle can match }\n TemplateHead,\n TemplateMiddle,\n TemplateTail,\n TemplateNoSub,\n RBrace,\n Comma,\n QuestionQuestion,\n Question,\n Colon,\n Hash,\n Dollar,\n NumberLiteral,\n StringLiteral,\n Identifier,\n];\n\n// === PARSER (precedence via rule layering) ===\n// Precedence (lowest to highest):\n// 1. Ternary: ? :\n// 2. Null coalescing: ??\n// 3. Logical OR: or\n// 4. Logical AND: and\n// 5. Comparison: ==, !=, <, >, <=, >=, in, not in\n// 6. Additive: +, -\n// 7. Multiplicative: *, /, %\n// 8. Power: ^ (RIGHT-ASSOCIATIVE)\n// 9. Unary: not, -\n// 10. Postfix: .property, [index], (call)\n// 11. Primary: literals, identifiers, parentheses\n\nclass ZenExpressionParser extends CstParser {\n constructor() {\n super(allTokens);\n this.performSelfAnalysis();\n }\n\n // Entry - ternary (lowest precedence)\n expression = this.RULE('expression', () => {\n this.SUBRULE(this.nullCoalescingExpression, { LABEL: 'condition' });\n this.OPTION(() => {\n this.CONSUME(Question);\n this.SUBRULE2(this.expression, { LABEL: 'consequent' });\n this.CONSUME(Colon);\n this.SUBRULE3(this.expression, { LABEL: 'alternate' });\n });\n });\n\n nullCoalescingExpression = this.RULE('nullCoalescingExpression', () => {\n this.SUBRULE(this.orExpression, { LABEL: 'lhs' });\n this.MANY(() => {\n this.CONSUME(QuestionQuestion);\n this.SUBRULE2(this.orExpression, { LABEL: 'rhs' });\n });\n });\n\n orExpression = this.RULE('orExpression', () => {\n this.SUBRULE(this.andExpression, { LABEL: 'lhs' });\n this.MANY(() => {\n this.OR([{ ALT: () => this.CONSUME(Or) }, { ALT: () => this.CONSUME(OrOr) }]);\n this.SUBRULE2(this.andExpression, { LABEL: 'rhs' });\n });\n });\n\n andExpression = this.RULE('andExpression', () => {\n this.SUBRULE(this.comparisonExpression, { LABEL: 'lhs' });\n this.MANY(() => {\n this.OR([{ ALT: () => this.CONSUME(And) }, { ALT: () => this.CONSUME(AndAnd) }]);\n this.SUBRULE2(this.comparisonExpression, { LABEL: 'rhs' });\n });\n });\n\n comparisonExpression = this.RULE('comparisonExpression', () => {\n this.SUBRULE(this.additiveExpression, { LABEL: 'lhs' });\n this.OPTION(() => {\n this.OR([\n { ALT: () => this.CONSUME(Eq) },\n { ALT: () => this.CONSUME(NotEq) },\n { ALT: () => this.CONSUME(Lt) },\n { ALT: () => this.CONSUME(Gt) },\n { ALT: () => this.CONSUME(LtEq) },\n { ALT: () => this.CONSUME(GtEq) },\n { ALT: () => this.CONSUME(In) },\n {\n ALT: () => {\n this.CONSUME(Not);\n this.CONSUME2(In);\n },\n }, // not in\n ]);\n this.SUBRULE2(this.additiveExpression, { LABEL: 'rhs' });\n });\n });\n\n additiveExpression = this.RULE('additiveExpression', () => {\n this.SUBRULE(this.multiplicativeExpression, { LABEL: 'lhs' });\n this.MANY(() => {\n this.OR([{ ALT: () => this.CONSUME(Plus) }, { ALT: () => this.CONSUME(Minus) }]);\n this.SUBRULE2(this.multiplicativeExpression, { LABEL: 'rhs' });\n });\n });\n\n multiplicativeExpression = this.RULE('multiplicativeExpression', () => {\n this.SUBRULE(this.powerExpression, { LABEL: 'lhs' });\n this.MANY(() => {\n this.OR([\n { ALT: () => this.CONSUME(Mult) },\n { ALT: () => this.CONSUME(Div) },\n { ALT: () => this.CONSUME(Mod) },\n ]);\n this.SUBRULE2(this.powerExpression, { LABEL: 'rhs' });\n });\n });\n\n // Power is RIGHT-ASSOCIATIVE to match mathematical convention:\n // e.g. 2^3^4 = 2^(3^4) = 2^81, not (2^3)^4 = 8^4 = 4096.\n // Use self-recursion instead of MANY for right-associativity\n powerExpression = this.RULE('powerExpression', () => {\n this.SUBRULE(this.unaryExpression, { LABEL: 'base' });\n this.OPTION(() => {\n this.CONSUME(Power);\n this.SUBRULE(this.powerExpression, { LABEL: 'exponent' }); // Self-recursion!\n });\n });\n\n unaryExpression = this.RULE('unaryExpression', () => {\n this.OR([\n {\n ALT: () => {\n this.CONSUME(Not);\n this.SUBRULE(this.unaryExpression, { LABEL: 'operand' });\n },\n },\n {\n ALT: () => {\n this.CONSUME(NotNot);\n this.SUBRULE2(this.unaryExpression, { LABEL: 'operand' });\n },\n },\n {\n ALT: () => {\n this.CONSUME(Minus);\n this.SUBRULE3(this.unaryExpression, { LABEL: 'operand' });\n },\n },\n { ALT: () => this.SUBRULE(this.postfixExpression) },\n ]);\n });\n\n // Postfix: .property, [index], (args)\n postfixExpression = this.RULE('postfixExpression', () => {\n this.SUBRULE(this.primaryExpression);\n this.MANY(() => {\n this.OR([\n {\n ALT: () => {\n this.CONSUME(Dot);\n this.CONSUME(Identifier, { LABEL: 'property' });\n },\n },\n {\n ALT: () => {\n this.CONSUME(LBracket);\n this.SUBRULE(this.expression, { LABEL: 'index' });\n this.CONSUME(RBracket);\n },\n },\n {\n ALT: () => {\n this.CONSUME(LParen);\n this.OPTION(() => this.SUBRULE(this.argumentList));\n this.CONSUME(RParen);\n },\n },\n ]);\n });\n });\n\n primaryExpression = this.RULE('primaryExpression', () => {\n this.OR([\n { ALT: () => this.CONSUME(NumberLiteral) },\n { ALT: () => this.CONSUME(StringLiteral) },\n { ALT: () => this.SUBRULE(this.templateLiteral) },\n { ALT: () => this.CONSUME(True) },\n { ALT: () => this.CONSUME(False) },\n { ALT: () => this.CONSUME(Null) },\n { ALT: () => this.CONSUME(Hash) }, // # for current element in higher-order functions\n { ALT: () => this.CONSUME(Dollar) }, // $ for explicit reference in unary mode\n { ALT: () => this.CONSUME(Identifier) },\n // Array literal: [1, 2, 3]\n {\n GATE: () => this.isArrayLiteralStart(),\n ALT: () => this.SUBRULE(this.arrayLiteralExpression),\n },\n // Object literal: {key: value, ...}\n {\n GATE: () => this.isObjectLiteralStart(),\n ALT: () => this.SUBRULE(this.objectLiteralExpression),\n },\n {\n ALT: () => {\n this.CONSUME(LParen);\n this.SUBRULE(this.expression);\n this.CONSUME(RParen);\n },\n },\n // Interval: use GATE to check for DotDot lookahead\n {\n GATE: () => this.isIntervalStart(),\n ALT: () => this.SUBRULE(this.intervalExpression),\n },\n ]);\n });\n\n // Template string: `Hello ${name}, you have ${count} items`\n templateLiteral = this.RULE('templateLiteral', () => {\n this.OR([\n // Simple template with no interpolation\n { ALT: () => this.CONSUME(TemplateNoSub) },\n // Template with interpolation\n {\n ALT: () => {\n this.CONSUME(TemplateHead);\n this.SUBRULE(this.expression, { LABEL: 'expr' });\n this.MANY(() => {\n this.CONSUME(TemplateMiddle);\n this.SUBRULE2(this.expression, { LABEL: 'expr' });\n });\n this.CONSUME(TemplateTail);\n },\n },\n ]);\n });\n\n // Interval: [a..b] or (a..b) with open/closed variations\n intervalExpression = this.RULE('intervalExpression', () => {\n this.OR([\n { ALT: () => this.CONSUME(LBracket, { LABEL: 'startBracket' }) },\n { ALT: () => this.CONSUME(LParen, { LABEL: 'startBracket' }) },\n ]);\n\n this.SUBRULE(this.expression, { LABEL: 'start' });\n this.CONSUME(DotDot);\n this.SUBRULE2(this.expression, { LABEL: 'end' });\n\n this.OR2([\n { ALT: () => this.CONSUME(RBracket, { LABEL: 'endBracket' }) },\n { ALT: () => this.CONSUME(RParen, { LABEL: 'endBracket' }) },\n ]);\n });\n\n // Array literal: [1, 2, 3] or []\n arrayLiteralExpression = this.RULE('arrayLiteralExpression', () => {\n this.CONSUME(LBracket);\n this.OPTION(() => this.SUBRULE(this.argumentList));\n this.CONSUME(RBracket);\n });\n\n // Object literal: {key: value, ...} or {}\n objectLiteralExpression = this.RULE('objectLiteralExpression', () => {\n this.CONSUME(LBrace);\n this.OPTION(() => this.SUBRULE(this.objectPropertyList));\n this.CONSUME(RBrace);\n });\n\n // Object property list for object literals\n objectPropertyList = this.RULE('objectPropertyList', () => {\n this.SUBRULE(this.objectProperty, { LABEL: 'prop' });\n this.MANY(() => {\n this.CONSUME(Comma);\n this.SUBRULE2(this.objectProperty, { LABEL: 'prop' });\n });\n });\n\n // Single object property: key: value\n objectProperty = this.RULE('objectProperty', () => {\n this.OR([\n { ALT: () => this.CONSUME(StringLiteral, { LABEL: 'key' }) },\n { ALT: () => this.CONSUME(Identifier, { LABEL: 'key' }) },\n ]);\n this.CONSUME(Colon);\n this.SUBRULE(this.expression, { LABEL: 'value' });\n });\n\n argumentList = this.RULE('argumentList', () => {\n this.SUBRULE(this.expression, { LABEL: 'arg' });\n this.MANY(() => {\n this.CONSUME(Comma);\n this.SUBRULE2(this.expression, { LABEL: 'arg' });\n });\n });\n\n // Helper: Check if current position starts an array literal\n // An array literal is [ followed by expressions and commas, then ]\n // We must distinguish [1,2] from [a..b]. An interval ALWAYS contains .. before closing\n private isArrayLiteralStart(): boolean {\n const lookahead = this.LA(1);\n if (!lookahead || lookahead.tokenType !== LBracket) {\n return false;\n }\n\n // Check if we have .. before a closing bracket (interval)\n // If yes, this is not an array literal\n return !this.isIntervalStart();\n }\n\n // Helper: Check if current position starts an object literal\n // An object literal is { followed by key:value pairs and commas, then }\n private isObjectLiteralStart(): boolean {\n const lookahead = this.LA(1);\n if (!lookahead || lookahead.tokenType !== LBrace) {\n return false;\n }\n return true;\n }\n\n // Helper: Check if current position starts an interval (lookahead for ..)\n // An interval is [expr..expr] or (expr..expr)\n //\n // We verify that after the start bracket, we'll eventually see .. before a closing bracket\n // O(n) lookahead required because interval syntax '[1..10]' is ambiguous with array literals\n // '[1,2,3]' - we must scan ahead to find '..' token to disambiguate, potentially examining\n // entire token stream for malformed input.\n private isIntervalStart(): boolean {\n const lookahead = this.LA(1);\n if (!lookahead) {\n return false;\n }\n const tokenType = lookahead.tokenType;\n\n // Only intervals start with [ or ( and must contain .. before closing\n if (tokenType !== LBracket && tokenType !== LParen) {\n return false;\n }\n\n // Look ahead through tokens to see if we find DotDot before a closing bracket\n // Note: Chevrotain's LA() returns EOF token (not null) when past end of input\n let depth = 0;\n let i = 0;\n while (true) {\n const token = this.LA(++i);\n // Check for end of input - LA() returns EOF token, not null\n if (!token || token.tokenType.name === 'EOF') {\n break;\n }\n\n const tt = token.tokenType;\n if (tt === LBracket || tt === LParen || tt === LBrace) {\n depth++;\n } else if (tt === RBracket || tt === RParen || tt === RBrace) {\n if (depth === 0) {\n // Found end before DotDot - not an interval\n return false;\n }\n depth--;\n } else if (tt === DotDot) {\n // Found DotDot before closing - this is an interval!\n return true;\n }\n }\n\n return false;\n }\n}\n\nexport const parser = new ZenExpressionParser();\nexport const lexer = new Lexer(allTokens);\n\n/**\n * Parse an expression string and return the CST.\n *\n * @param input - The expression string to parse\n * @param location - Optional source location for error reporting\n * @returns The Concrete Syntax Tree (CST)\n * @throws Error if the parse fails\n */\nexport function parseExpression(input: string, location?: SourceLocation): any {\n const lexResult = lexer.tokenize(input);\n\n if (lexResult.errors.length > 0) {\n throw new CompilationError(\n `Lexer error: ${lexResult.errors.map((e) => e.message).join(', ')}`,\n ErrorCode.PARSE_ERROR,\n location,\n { expression: input },\n );\n }\n\n parser.input = lexResult.tokens;\n const cst = parser.expression();\n\n if (parser.errors.length > 0) {\n throw new CompilationError(\n `Parse error: ${parser.errors.map((e) => e.message).join(', ')}`,\n ErrorCode.PARSE_ERROR,\n location,\n { expression: input },\n );\n }\n\n return cst;\n}\n\nexport type { IToken };\n","import { parser } from './expression-parser';\nimport {\n type ExpressionAST,\n type StringLiteral,\n type Interval,\n type TemplateLiteral,\n type ArrayLiteral,\n type ObjectLiteral,\n type BinaryOperator,\n} from './ast-types';\nimport type { CstNode } from 'chevrotain';\n\nconst BaseCstVisitor = parser.getBaseCstVisitorConstructor();\n\n/**\n * Converts Chevrotain CST to our AST format.\n */\nclass ExpressionAstBuilder extends BaseCstVisitor {\n constructor() {\n super();\n this.validateVisitor();\n }\n\n expression(ctx: any): ExpressionAST {\n const condition = this.visit(ctx.condition);\n\n if (ctx.Question) {\n return {\n type: 'TernaryOp',\n condition,\n consequent: this.visit(ctx.consequent),\n alternate: this.visit(ctx.alternate),\n };\n }\n\n return condition;\n }\n\n nullCoalescingExpression(ctx: any): ExpressionAST {\n let result = this.visit(ctx.lhs);\n\n if (ctx.rhs) {\n for (const rhsNode of ctx.rhs) {\n result = {\n type: 'BinaryOp',\n op: '??',\n left: result,\n right: this.visit(rhsNode),\n };\n }\n }\n\n return result;\n }\n\n orExpression(ctx: any): ExpressionAST {\n let result = this.visit(ctx.lhs);\n\n if (ctx.rhs) {\n for (const rhsNode of ctx.rhs) {\n result = {\n type: 'BinaryOp',\n op: 'or',\n left: result,\n right: this.visit(rhsNode),\n };\n }\n }\n\n return result;\n }\n\n andExpression(ctx: any): ExpressionAST {\n let result = this.visit(ctx.lhs);\n\n if (ctx.rhs) {\n for (const rhsNode of ctx.rhs) {\n result = {\n type: 'BinaryOp',\n op: 'and',\n left: result,\n right: this.visit(rhsNode),\n };\n }\n }\n\n return result;\n }\n\n comparisonExpression(ctx: any): ExpressionAST {\n const lhs = this.visit(ctx.lhs);\n\n if (!ctx.rhs) {\n return lhs;\n }\n\n // Determine operator\n let op: BinaryOperator;\n if (ctx.Eq) {\n op = '==';\n } else if (ctx.NotEq) {\n op = '!=';\n } else if (ctx.Lt) {\n op = '<';\n } else if (ctx.Gt) {\n op = '>';\n } else if (ctx.LtEq) {\n op = '<=';\n } else if (ctx.GtEq) {\n op = '>=';\n } else if (ctx.In) {\n op = ctx.Not ? 'not in' : 'in';\n } else {\n throw new Error('Unknown comparison operator');\n }\n\n return {\n type: 'BinaryOp',\n op,\n left: lhs,\n right: this.visit(ctx.rhs),\n };\n }\n\n additiveExpression(ctx: any): ExpressionAST {\n return this.buildLeftAssociativeBinaryOp(ctx, ['Plus', 'Minus'], ['+', '-']);\n }\n\n multiplicativeExpression(ctx: any): ExpressionAST {\n return this.buildLeftAssociativeBinaryOp(ctx, ['Mult', 'Div', 'Mod'], ['*', '/', '%']);\n }\n\n // Power is right-associative, handled differently via recursion in grammar\n powerExpression(ctx: any): ExpressionAST {\n const base = this.visit(ctx.base);\n\n if (ctx.exponent) {\n return {\n type: 'BinaryOp',\n op: '^',\n left: base,\n right: this.visit(ctx.exponent),\n };\n }\n\n return base;\n }\n\n unaryExpression(ctx: any): ExpressionAST {\n if (ctx.Not || ctx.NotNot) {\n return { type: 'UnaryOp', op: 'not', operand: this.visit(ctx.operand) };\n }\n if (ctx.Minus) {\n return { type: 'UnaryOp', op: '-', operand: this.visit(ctx.operand) };\n }\n return this.visit(ctx.postfixExpression);\n }\n\n postfixExpression(ctx: any): ExpressionAST {\n let result = this.visit(ctx.primaryExpression);\n\n // Collect all postfix operations with their source positions\n type PostfixOp =\n | { type: 'member'; offset: number; idx: number }\n | { type: 'index'; offset: number; idx: number }\n | { type: 'call'; offset: number; idx: number };\n\n const ops: PostfixOp[] = [];\n\n if (ctx.Dot) {\n for (let i = 0; i < ctx.Dot.length; i++) {\n ops.push({ type: 'member', offset: ctx.Dot[i].startOffset, idx: i });\n }\n }\n\n if (ctx.LBracket) {\n for (let i = 0; i < ctx.LBracket.length; i++) {\n ops.push({ type: 'index', offset: ctx.LBracket[i].startOffset, idx: i });\n }\n }\n\n if (ctx.LParen) {\n for (let i = 0; i < ctx.LParen.length; i++) {\n ops.push({ type: 'call', offset: ctx.LParen[i].startOffset, idx: i });\n }\n }\n\n // Sort by source position to apply in correct order: Chevrotain collects each operator\n // type separately, but the actual evaluation order depends on source position when multiple\n // operator types can appear.\n //\n // We must sort by position to reconstruct left-to-right evaluation order\n ops.sort((a, b) => a.offset - b.offset);\n\n // Apply each operation in order\n for (const op of ops) {\n if (op.type === 'member') {\n const prop = ctx.property[op.idx].image;\n result = { type: 'MemberAccess', object: result, property: prop };\n } else if (op.type === 'index') {\n const indexExpr = ctx.index[op.idx];\n result = { type: 'IndexAccess', object: result, index: this.visit(indexExpr) };\n } else if (op.type === 'call') {\n // Check if there's an argumentList for this call\n const args =\n ctx.argumentList && ctx.argumentList[op.idx] ? this.visit(ctx.argumentList[op.idx]) : [];\n result = { type: 'FunctionCall', callee: result, args };\n }\n }\n\n return result;\n }\n\n primaryExpression(ctx: any): ExpressionAST {\n if (ctx.NumberLiteral) {\n const raw = ctx.NumberLiteral[0].image.replace(/_/g, '');\n return { type: 'NumberLiteral', value: parseFloat(raw) };\n }\n if (ctx.StringLiteral) {\n const raw = ctx.StringLiteral[0].image;\n const value = this.unescapeString(raw.slice(1, -1));\n return { type: 'StringLiteral', value };\n }\n if (ctx.True) {\n return { type: 'BooleanLiteral', value: true };\n }\n if (ctx.False) {\n return { type: 'BooleanLiteral', value: false };\n }\n if (ctx.Null) {\n return { type: 'NullLiteral' };\n }\n if (ctx.Hash) {\n return { type: 'HashRef' };\n }\n if (ctx.Dollar) {\n return { type: 'DollarRef' };\n }\n if (ctx.Identifier) {\n return { type: 'Identifier', name: ctx.Identifier[0].image };\n }\n if (ctx.arrayLiteralExpression) {\n return this.visit(ctx.arrayLiteralExpression);\n }\n if (ctx.objectLiteralExpression) {\n return this.visit(ctx.objectLiteralExpression);\n }\n if (ctx.expression) {\n return this.visit(ctx.expression);\n }\n if (ctx.intervalExpression) {\n return this.visit(ctx.intervalExpression);\n }\n if (ctx.templateLiteral) {\n return this.visit(ctx.templateLiteral);\n }\n\n throw new Error('Unknown primary expression');\n }\n\n intervalExpression(ctx: any): Interval {\n const startBracket = ctx.startBracket[0];\n const endBracket = ctx.endBracket[0];\n\n return {\n type: 'Interval',\n start: this.visit(ctx.start) as ExpressionAST,\n end: this.visit(ctx.end) as ExpressionAST,\n startInclusive: startBracket.tokenType.name === 'LBracket',\n endInclusive: endBracket.tokenType.name === 'RBracket',\n };\n }\n\n arrayLiteralExpression(ctx: any): ArrayLiteral {\n if (!ctx.argumentList) {\n return { type: 'ArrayLiteral', elements: [] };\n }\n const args = this.visit(ctx.argumentList);\n return { type: 'ArrayLiteral', elements: args as ExpressionAST[] };\n }\n\n objectLiteralExpression(ctx: any): ObjectLiteral {\n if (!ctx.objectPropertyList) {\n return { type: 'ObjectLiteral', properties: [] };\n }\n const props = this.visit(ctx.objectPropertyList);\n return {\n type: 'ObjectLiteral',\n properties: props as Array<{ key: string; value: ExpressionAST }>,\n };\n }\n\n objectPropertyList(ctx: any): Array<{ key: string; value: ExpressionAST }> {\n return ctx.prop.map(\n (propNode: CstNode) => this.visit(propNode) as { key: string; value: ExpressionAST },\n );\n }\n\n objectProperty(ctx: any): { key: string; value: ExpressionAST } {\n const keyToken = ctx.key[0];\n const key =\n keyToken.tokenType.name === 'StringLiteral'\n ? this.unescapeString(keyToken.image.slice(1, -1))\n : keyToken.image;\n const value = this.visit(ctx.value) as ExpressionAST;\n return { key, value };\n }\n\n templateLiteral(ctx: any): TemplateLiteral | StringLiteral {\n // Handle simple template with no substitution\n if (ctx.TemplateNoSub) {\n const raw = ctx.TemplateNoSub[0].image;\n return { type: 'StringLiteral', value: this.unescapeString(raw.slice(1, -1)) };\n }\n\n // Handle template with interpolation\n const parts: Array<{ text: string } | { expr: ExpressionAST }> = [];\n\n // Extract text from TemplateHead (remove ` and ${)\n const headRaw = ctx.TemplateHead[0].image;\n const headText = this.unescapeString(headRaw.slice(1, -2));\n if (headText) {\n parts.push({ text: headText });\n }\n\n // Add expressions and middle parts\n for (let i = 0; i < ctx.expr.length; i++) {\n parts.push({ expr: this.visit(ctx.expr[i]) as ExpressionAST });\n\n if (ctx.TemplateMiddle && ctx.TemplateMiddle[i]) {\n const midRaw = ctx.TemplateMiddle[i].image;\n const midText = this.unescapeString(midRaw.slice(1, -2));\n if (midText) {\n parts.push({ text: midText });\n }\n }\n }\n\n // Extract text from TemplateTail (remove } and `)\n const tailRaw = ctx.TemplateTail[0].image;\n const tailText = this.unescapeString(tailRaw.slice(1, -1));\n if (tailText) {\n parts.push({ text: tailText });\n }\n\n // Template literals with no interpolation (just text) can be converted to simple string\n // literals, avoiding runtime template processing overhead.\n if (parts.every((p) => 'text' in p)) {\n const combined = parts.map((p) => (p as { text: string }).text).join('');\n return { type: 'StringLiteral', value: combined };\n }\n\n return { type: 'TemplateLiteral', parts };\n }\n\n argumentList(ctx: any): ExpressionAST[] {\n return ctx.arg.map((argNode: CstNode) => this.visit(argNode) as ExpressionAST);\n }\n\n /**\n * Helper to unescape string literals.\n * Handles basic escape sequences like \\n, \\t, \\\", \\', \\\\, etc.\n */\n private unescapeString(s: string): string {\n return s\n .replace(/\\\\n/g, '\\n')\n .replace(/\\\\t/g, '\\t')\n .replace(/\\\\r/g, '\\r')\n .replace(/\\\\'/g, \"'\")\n .replace(/\"/g, '\"')\n .replace(/\\\\\\\\/g, '\\\\');\n }\n\n /**\n * Helper for left-associative binary operators.\n * Collects all operator tokens, sorts them by position, and pairs them with RHS operands.\n */\n private buildLeftAssociativeBinaryOp(\n ctx: any,\n tokenNames: string[],\n ops: BinaryOperator[],\n ): ExpressionAST {\n let result = this.visit(ctx.lhs) as ExpressionAST;\n\n if (!ctx.rhs) {\n // No right-hand side: return just the left expression\n return result;\n }\n\n // Collect all operator tokens with their corresponding operator symbol\n const operatorTokens: Array<{ op: BinaryOperator; offset: number }> = [];\n for (let j = 0; j < tokenNames.length; j++) {\n const tokens = ctx[tokenNames[j]];\n if (tokens) {\n for (const token of tokens) {\n operatorTokens.push({ op: ops[j], offset: token.startOffset });\n }\n }\n }\n\n // Sort operators by their position in the source\n operatorTokens.sort((a, b) => a.offset - b.offset);\n\n // Build the expression tree left-to-right\n for (let i = 0; i < ctx.rhs.length; i++) {\n const op = operatorTokens[i]?.op;\n if (!op) {\n throw new Error(`Operator not found for ${tokenNames.join(', ')}`);\n }\n\n result = {\n type: 'BinaryOp',\n op,\n left: result,\n right: this.visit(ctx.rhs[i]) as ExpressionAST,\n };\n }\n\n return result;\n }\n}\n\nexport const astBuilder = new ExpressionAstBuilder();\n\n/**\n * Convert a CST (Concrete Syntax Tree) to an AST (Abstract Syntax Tree).\n * CST contains low-level parsing artifacts; AST simplifies structure for compilation\n *\n * @param cst - The CST from the Chevrotain parser\n * @returns The AST node\n */\nexport function cstToAst(cst: CstNode): ExpressionAST {\n return astBuilder.visit(cst);\n}\n","/**\n * Unary AST transformation utilities.\n *\n * This module provides AST-level transformations specific to unary (decision table)\n * context. These transformations are applied AFTER parsing to convert a standard AST\n * into an AST that reflects the semantic meaning in unary context.\n *\n * Key transformations:\n * - Bare identifiers → string literals (for implicit string matching)\n * - Comparison without LHS → $ comparison (e.g., \"> 100\" → \"$ > 100\")\n * - Multiple comma-separated values → OR chain\n *\n * This separates SEMANTIC transformations from SYNTACTIC parsing, keeping\n * the parser focused solely on syntax-to-AST conversion.\n */\n\nimport type { ExpressionAST, BinaryOperator, BinaryOp } from './ast-types';\n\n/**\n * Convert a bare Identifier node to a StringLiteral node.\n *\n * In decision table cells, unquoted words like \"premium\" are semantic values to match against,\n * not variable references. This prevents errors when authors write intuitive cell values without\n * quotes. This is a key DMN/JDM usability feature.\n *\n * This handles the common JDM/DMN convention where cell values like:\n * - premium means match the string \"premium\" (identifier → string)\n * - \"premium\" means match the string \"premium\" (already a string)\n *\n * We only convert top-level Identifiers. More complex expressions (member access,\n * function calls, etc.) are left as-is since they likely involve actual variables.\n *\n * @param ast - The AST node that may be an Identifier\n * @returns The AST node, with Identifier converted to StringLiteral if applicable\n */\nexport function convertIdentifierToStringLiteral(ast: ExpressionAST): ExpressionAST {\n if (ast.type === 'Identifier') {\n return { type: 'StringLiteral', value: (ast as { type: 'Identifier'; name: string }).name };\n }\n return ast;\n}\n\n/**\n * Wrap an AST value in a comparison with DollarRef (the implicit cell input).\n *\n * In unary context, expressions like \"> 100\" implicitly compare against the input value.\n * This function creates the full comparison AST: \"$ <op> <value>\".\n *\n * @param ast - The right-hand side value AST\n * @param op - The comparison operator\n * @returns A BinaryOp AST with DollarRef on the left\n */\nexport function wrapWithDollarComparison(ast: ExpressionAST, op: BinaryOperator): BinaryOp {\n return {\n type: 'BinaryOp',\n op,\n left: { type: 'DollarRef' },\n right: ast,\n };\n}\n\n/**\n * Create an equality comparison with implicit identifier-to-string conversion.\n *\n * This is the default transformation for unary values - they become equality\n * comparisons against the input value ($). For equality/inequality comparisons,\n * bare identifiers are converted to string literals.\n *\n * @param ast - The value to compare against\n * @param op - The equality operator (== or !=)\n * @returns A BinaryOp AST representing the equality comparison\n */\nexport function createEqualityComparison(ast: ExpressionAST, op: '==' | '!='): BinaryOp {\n const value = convertIdentifierToStringLiteral(ast);\n return wrapWithDollarComparison(value, op);\n}\n\n/**\n * Create an interval membership check.\n *\n * In unary context, interval notation like \"[1..10]\" becomes \"$ in [1..10]\".\n *\n * @param intervalAst - The interval AST node\n * @returns A BinaryOp AST representing the membership check\n */\nexport function createIntervalCheck(intervalAst: ExpressionAST): BinaryOp {\n return wrapWithDollarComparison(intervalAst, 'in');\n}\n\n/**\n * Create an array membership check.\n *\n * In unary context, array literals like \"['gold', 'platinum']\" become\n * \"$ in ['gold', 'platinum']\".\n *\n * @param arrayAst - The array literal AST node\n * @returns A BinaryOp AST representing the membership check\n */\nexport function createArrayMembershipCheck(arrayAst: ExpressionAST): BinaryOp {\n return wrapWithDollarComparison(arrayAst, 'in');\n}\n\n/**\n * Combine multiple expression ASTs into an OR chain.\n *\n * In unary context, comma-separated values represent OR semantics.\n * For example, \"a, b, c\" becomes \"$ == 'a' or $ == 'b' or $ == 'c'\".\n *\n * @param exprs - Array of expression ASTs to combine\n * @returns A single AST representing the OR of all expressions\n */\nexport function combineWithOr(exprs: ExpressionAST[]): ExpressionAST {\n if (exprs.length === 0) {\n return { type: 'BooleanLiteral', value: true };\n }\n if (exprs.length === 1) {\n return exprs[0];\n }\n return exprs.reduce((acc, expr) => ({\n type: 'BinaryOp',\n op: 'or',\n left: acc,\n right: expr,\n }));\n}\n\n/**\n * Combine multiple expression ASTs into an AND chain.\n *\n * Used for compound unary expressions like \">= 13 and < 15\".\n *\n * @param exprs - Array of expression ASTs to combine\n * @returns A single AST representing the AND of all expressions\n */\nexport function combineWithAnd(exprs: ExpressionAST[]): ExpressionAST {\n if (exprs.length === 0) {\n return { type: 'BooleanLiteral', value: true };\n }\n if (exprs.length === 1) {\n return exprs[0];\n }\n return exprs.reduce((acc, expr) => ({\n type: 'BinaryOp',\n op: 'and',\n left: acc,\n right: expr,\n }));\n}\n","/**\n * Unary expression parser for decision table cells.\n *\n * This module provides parsing for unary mode expressions, which are used in\n * decision table cells. The parser is responsible for SYNTACTIC analysis only -\n * converting text to AST nodes. Semantic transformations (like converting\n * identifiers to string literals) are handled by the unary-ast-transforms module.\n *\n * Separation of Concerns:\n * - This module: Tokenization, lexing, parsing (text → AST)\n * - unary-ast-transforms: Semantic transformations (AST → transformed AST)\n * - unary-transform: Dollar reference substitution for compilation (AST → compiled AST)\n */\n\nimport { parser, lexer } from './expression-parser';\nimport { type ExpressionAST, type BinaryOperator } from './ast-types';\nimport { cstToAst } from './cst-visitor';\nimport { CompilationError, ErrorCode, type SourceLocation } from './errors';\nimport {\n wrapWithDollarComparison,\n createEqualityComparison,\n createIntervalCheck,\n createArrayMembershipCheck,\n combineWithOr,\n combineWithAnd,\n} from './unary-ast-transforms';\n\n/**\n * Parse an expression in unary mode (for decision table cells).\n *\n * In DMN/JDM convention, decision table cells contain concise expressions that implicitly\n * compare against the input column value ($). This allows table authors to write \"premium\"\n * instead of \"$ == 'premium'\" or \"> 100\" instead of \"$ > 100\", making tables more readable.\n *\n * Unary mode transformations:\n * - \"admin\" -> $ == \"admin\"\n * - > 100 -> $ > 100\n * - [1..10] -> $ in [1..10]\n * - \"a\", \"b\", \"c\" -> $ == \"a\" or $ == \"b\" or $ == \"c\"\n * - $ > 100 -> $ > 100 (explicit $ disables transformations)\n *\n * @param input - The unary expression to parse\n * @returns The AST node\n */\nexport function parseUnaryExpression(input: string): ExpressionAST {\n const trimmed = input.trim();\n\n // Empty cell = always matches\n if (trimmed === '' || trimmed === '-') {\n return { type: 'BooleanLiteral', value: true };\n }\n\n // Check if expression uses explicit $ - if so, parse as standard expression\n if (trimmed.includes('$')) {\n return parseStandardExpression(trimmed);\n }\n\n // Check for comma-separated values (OR semantics)\n // But only if it's not an array literal\n if (trimmed.includes(',') && !isArrayLiteral(trimmed)) {\n const parts = splitByComma(trimmed);\n const comparisons = parts.map((part) => transformUnaryPart(part.trim()));\n return combineWithOr(comparisons);\n }\n\n // Check for compound expressions with 'and' or 'or' that need implicit $ expansion\n // e.g., \">= 13 and < 15\" should become \"$ >= 13 and $ < 15\"\n const compoundResult = parseCompoundUnary(trimmed);\n if (compoundResult) {\n return compoundResult;\n }\n\n return transformUnaryPart(trimmed);\n}\n\n/**\n * Parse a single unary part and apply semantic transformations.\n *\n * This function performs both parsing and transformation in a single step:\n * 1. Parse the input using the standard expression parser\n * 2. Apply unary-context semantic transformations (AST operations)\n *\n * @param input - The unary part to parse\n * @returns The transformed AST node\n */\nfunction transformUnaryPart(input: string): ExpressionAST {\n // Check for comparison operator at start\n const comparisonMatch = input.match(/^(==|!=|<=|>=|<|>)\\s*(.+)$/);\n if (comparisonMatch) {\n const [, op, valueExpr] = comparisonMatch;\n const value = parseStandardExpression(valueExpr);\n // For equality/inequality comparisons, convert bare identifiers to strings\n if (op === '==' || op === '!=') {\n return createEqualityComparison(value, op as '==' | '!=');\n }\n return wrapWithDollarComparison(value, op as BinaryOperator);\n }\n\n // Check for interval notation\n if (input.match(/^[[].+\\.\\..*[\\])]$/)) {\n const intervalAst = parseStandardExpression(input);\n return createIntervalCheck(intervalAst);\n }\n\n // Check for array literal - use 'in' for membership\n // e.g., \"['gold', 'platinum']\" should become \"$ in ['gold', 'platinum']\"\n if (isArrayLiteral(input)) {\n const arrayAst = parseStandardExpression(input);\n return createArrayMembershipCheck(arrayAst);\n }\n\n // Default: equality comparison\n // Convert bare identifiers to string literals for implicit equality\n const value = parseStandardExpression(input);\n return createEqualityComparison(value, '==');\n}\n\n/**\n * Parse compound unary expressions that use 'and' or 'or' with implicit $\n * Examples:\n * - \">= 13 and < 15\" -> \"$ >= 13 and $ < 15\"\n * - \"> 0 or == null\" -> \"$ > 0 or $ == null\"\n *\n * @param input - The expression to parse\n * @returns The AST if compound, null otherwise\n */\nfunction parseCompoundUnary(input: string): ExpressionAST | null {\n // Match patterns like: <op1> <val1> and/or <op2> <val2>\n // We need to split by ' and ' or ' or ' while preserving quotes and brackets\n const andParts = splitByLogicalOp(input, 'and');\n if (andParts.length > 1) {\n const comparisons = andParts.map((part) => transformUnaryPart(part.trim()));\n return combineWithAnd(comparisons);\n }\n\n const orParts = splitByLogicalOp(input, 'or');\n if (orParts.length > 1) {\n const comparisons = orParts.map((part) => transformUnaryPart(part.trim()));\n return combineWithOr(comparisons);\n }\n\n return null;\n}\n\n/**\n * Split input by a logical operator (' and ' or ' or '), respecting quotes and brackets.\n *\n * This is a parsing helper that performs tokenization while respecting nested structures.\n */\nfunction splitByLogicalOp(input: string, op: 'and' | 'or'): string[] {\n const pattern = ` ${op} `;\n const parts: string[] = [];\n let current = '';\n let depth = 0;\n let inString = false;\n let stringChar = '';\n let i = 0;\n\n while (i < input.length) {\n const char = input[i];\n\n if (inString) {\n current += char;\n if (char === stringChar && input[i - 1] !== '\\\\') {\n inString = false;\n }\n i++;\n continue;\n }\n\n if (char === '\"' || char === \"'\") {\n inString = true;\n stringChar = char;\n current += char;\n i++;\n } else if (char === '[' || char === '(' || char === '{') {\n depth++;\n current += char;\n i++;\n } else if (char === ']' || char === ')' || char === '}') {\n depth--;\n current += char;\n i++;\n } else if (depth === 0 && input.substring(i, i + pattern.length).toLowerCase() === pattern) {\n parts.push(current);\n current = '';\n i += pattern.length;\n } else {\n current += char;\n i++;\n }\n }\n\n if (current) {\n parts.push(current);\n }\n return parts;\n}\n\n/**\n * Check if a string represents an array literal (not an interval).\n *\n * Arrays and intervals both use bracket syntax but have different semantics.\n * Arrays check membership ($ in [1,2,3]), intervals check ranges ($ in [1..10]).\n * Must detect .. to parse correctly.\n */\nfunction isArrayLiteral(input: string): boolean {\n return input.startsWith('[') && input.endsWith(']') && !input.includes('..');\n}\n\n/**\n * Smart split by comma that respects brackets and strings.\n *\n * This is a parsing helper for tokenizing comma-separated unary values\n * while respecting nested structures.\n *\n * Examples:\n * - \"a, b, c\" -> [\"a\", \"b\", \"c\"]\n * - \"[1, 2], [3, 4]\" -> [\"[1, 2]\", \"[3, 4]\"]\n * - '\"a, b\", \"c, d\"' -> ['\"a, b\"', '\"c, d\"']\n */\nfunction splitByComma(input: string): string[] {\n const parts: string[] = [];\n let current = '';\n let depth = 0;\n let inString = false;\n let stringChar = '';\n\n for (let i = 0; i < input.length; i++) {\n const char = input[i];\n\n if (inString) {\n current += char;\n // Check if string ends (and handle escaped quotes)\n if (char === stringChar && input[i - 1] !== '\\\\') {\n inString = false;\n }\n continue;\n }\n\n if (char === '\"' || char === \"'\") {\n inString = true;\n stringChar = char;\n current += char;\n } else if (char === '[' || char === '(') {\n depth++;\n current += char;\n } else if (char === ']' || char === ')') {\n depth--;\n current += char;\n } else if (char === ',' && depth === 0) {\n parts.push(current);\n current = '';\n } else {\n current += char;\n }\n }\n\n if (current) {\n parts.push(current);\n }\n return parts;\n}\n\n/**\n * Parse a standard (non-unary) expression.\n *\n * This is the core parsing function that converts an expression string to an AST.\n * It uses the Chevrotain lexer and parser defined in expression-parser.ts,\n * then converts the CST to AST using cst-visitor.ts.\n *\n * @param input - The expression string to parse\n * @param location - Optional source location for error reporting\n * @returns The AST node\n */\nexport function parseStandardExpression(input: string, location?: SourceLocation): ExpressionAST {\n const lexingResult = lexer.tokenize(input);\n\n if (lexingResult.errors.length > 0) {\n throw new CompilationError(\n `Lexer error: ${lexingResult.errors.map((e: any) => e.message).join(', ')}`,\n ErrorCode.PARSE_ERROR,\n location,\n { expression: input },\n );\n }\n\n parser.input = lexingResult.tokens;\n const cst = parser.expression();\n\n if (parser.errors.length > 0) {\n throw new CompilationError(\n `Parse error: ${parser.errors.map((e: any) => e.message).join(', ')}`,\n ErrorCode.PARSE_ERROR,\n location,\n { expression: input },\n );\n }\n\n return cstToAst(cst);\n}\n","/**\n * Optimization Pipeline for JDM to WebAssembly Compilation\n *\n * This module defines the interface for optimization passes and the runner\n * that applies them sequentially to transform the compiled AST into an\n * optimized form before code generation.\n */\n\nimport { type JDMDecision, type JDMNode, NodeType } from './parser';\nimport {\n type ExpressionAST,\n type NumberLiteral,\n type StringLiteral,\n type BooleanLiteral,\n isNumberLiteral,\n isStringLiteral,\n isBooleanLiteral,\n isNullLiteral,\n isBinaryOp,\n isUnaryOp,\n isTernaryOp,\n} from './ast-types';\nimport { parseStandardExpression, parseUnaryExpression } from './unary-parser';\n\n/**\n * Cache for parsed expression ASTs.\n * Maps expression strings to their parsed AST nodes to avoid redundant parsing.\n */\ntype ExpressionCache = Map<string, ExpressionAST>;\n\n/**\n * Compiled AST - the intermediate representation after parsing.\n *\n * JDMDecision structure is simple enough for in-place transformation, avoiding the\n * complexity and memory overhead of building a separate intermediate representation.\n */\nexport type CompiledAST = JDMDecision;\n\n/**\n * Interface for an optimization pass.\n *\n * Each optimization pass receives the compiled AST and returns a\n * potentially modified/optimized AST.\n */\nexport interface OptimizationPass {\n /** Human-readable name of the optimization pass */\n name: string;\n\n /**\n * Run the optimization pass on the given AST.\n *\n * @param ast - The compiled AST to optimize\n * @returns The optimized AST\n */\n run(ast: CompiledAST): CompiledAST;\n}\n\n/**\n * Ordered list of optimization passes.\n *\n * Passes have dependencies - one pass may create opportunities for the next. For example,\n * constant folding might convert \"if (2 > 3)\" to \"if (false)\", then dead code elimination\n * removes the unreachable branch. Running DCE before folding would miss this optimization.\n */\nexport const optimizer: OptimizationPass[] = [\n { name: 'Constant Folding', run: constantFolding },\n { name: 'Dead Code Elimination', run: deadCodeElimination },\n { name: 'Expression Inlining', run: expressionInlining },\n { name: 'Table Indexing', run: tableIndexing },\n];\n\n/**\n * Run all optimization passes sequentially on the given AST.\n *\n * @param ast - The compiled AST to optimize\n * @returns The fully optimized AST\n */\nexport function runOptimizations(ast: CompiledAST): CompiledAST {\n let optimized = ast;\n\n for (const pass of optimizer) {\n optimized = pass.run(optimized);\n }\n\n return optimized;\n}\n\n// ============================================================================\n// Expression Cache Utilities\n// ============================================================================\n\n/**\n * Get the expression cache for a node, creating it if it doesn't exist.\n */\nfunction getExpressionCache(node: JDMNode): ExpressionCache {\n if (!node.parsedContent) {\n node.parsedContent = {};\n }\n if (!node.parsedContent._cachedExprs) {\n node.parsedContent._cachedExprs = new Map<string, ExpressionAST>();\n }\n return node.parsedContent._cachedExprs as ExpressionCache;\n}\n\n/**\n * Parse an expression with caching.\n * Checks the cache first, and only parses if not found.\n */\nfunction cachedParseUnary(node: JDMNode, expr: string): ExpressionAST {\n const cache = getExpressionCache(node);\n const cached = cache.get(expr);\n if (cached) {\n return cached;\n }\n const parsed = parseUnaryExpression(expr);\n cache.set(expr, parsed);\n return parsed;\n}\n\n/**\n * Parse a standard expression with caching.\n * Checks the cache first, and only parses if not found.\n */\nfunction cachedParseStandard(node: JDMNode, expr: string): ExpressionAST {\n const cache = getExpressionCache(node);\n const cached = cache.get(expr);\n if (cached) {\n return cached;\n }\n const parsed = parseStandardExpression(expr);\n cache.set(expr, parsed);\n return parsed;\n}\n\n/**\n * Clear the expression cache for a node.\n * Should be called when the node's expressions are modified.\n */\nfunction clearExpressionCache(node: JDMNode): void {\n if (node.parsedContent && node.parsedContent._cachedExprs) {\n node.parsedContent._cachedExprs.clear();\n }\n}\n\n// Export individual optimization passes for testing\nexport { constantFolding, deadCodeElimination, expressionInlining, tableIndexing };\n\n// Export cache utilities for testing\nexport { getExpressionCache, clearExpressionCache };\n\n// ============================================================================\n// Constant Folding\n// ============================================================================\n\n/**\n * Fold constant expressions at compile time.\n *\n * This pass traverses expression ASTs and evaluates them at compile time\n * when possible. Examples:\n * - Replace (2 + 3) with 5\n * - Replace true and false with false\n * - Replace \"hello\" + \" world\" with \"hello world\"\n *\n * @param ast - The compiled AST to optimize\n * @returns The AST with folded constants\n */\nfunction constantFolding(ast: CompiledAST): CompiledAST {\n // Create a deep copy to avoid mutating the original\n const optimized = JSON.parse(JSON.stringify(ast)) as JDMDecision;\n\n // Apply constant folding to each node's expression content\n optimized.nodes = optimized.nodes.map((node: JDMNode) => foldNodeExpressions(node));\n\n return optimized;\n}\n\n/**\n * Apply constant folding to expressions within a node.\n */\nfunction foldNodeExpressions(node: JDMNode): JDMNode {\n if (!node.content) {\n return node;\n }\n\n const content = node.content;\n\n // Handle decision table nodes\n if (node.type === NodeType.DECISION_TABLE) {\n return foldDecisionTableExpressions(node, content);\n }\n\n // Handle switch nodes\n if (node.type === NodeType.SWITCH) {\n return foldSwitchExpressions(node, content);\n }\n\n // Handle expression nodes\n if (node.type === NodeType.EXPRESSION) {\n return foldExpressionNode(node, content);\n }\n\n return node;\n}\n\n/**\n * Fold expressions in a decision table node.\n */\nfunction foldDecisionTableExpressions(node: JDMNode, content: Record<string, unknown>): JDMNode {\n const { rules, inputs } = content as { rules: any[]; inputs: any[] };\n let modified = false;\n\n // Update each rule's input conditions with folded expressions\n const foldedRules = rules.map((rule: Record<string, unknown>) => {\n const foldedRule = { ...rule };\n\n for (const input of inputs) {\n const expr = rule[input.id] as string | undefined;\n if (!expr || expr === '' || expr === '-') {\n continue;\n }\n\n // Parse the expression in unary mode (using cache)\n try {\n const ast = cachedParseUnary(node, expr);\n const folded = foldExpression(ast);\n\n // If folding succeeded, update the expression string\n if (folded !== null && isLiteral(folded)) {\n const newExpr = literalToExprString(folded);\n if (newExpr !== expr) {\n foldedRule[input.id] = newExpr;\n modified = true;\n }\n }\n } catch {\n // If expression can't be parsed or folded, keep original\n }\n }\n\n return foldedRule;\n });\n\n // Clear cache if expressions were modified\n if (modified) {\n clearExpressionCache(node);\n }\n\n return {\n ...node,\n content: {\n ...content,\n rules: foldedRules,\n },\n };\n}\n\n/**\n * Fold expressions in a switch node.\n */\nfunction foldSwitchExpressions(node: JDMNode, content: any): JDMNode {\n const { conditions } = content;\n let modified = false;\n\n const foldedConditions = conditions.map((condition: any) => {\n const expr = condition.expression;\n if (!expr || expr === '') {\n return condition;\n }\n\n try {\n const ast = cachedParseStandard(node, expr);\n const folded = foldExpression(ast);\n\n if (folded !== null && isLiteral(folded)) {\n const newExpr = literalToExprString(folded);\n if (newExpr !== expr) {\n modified = true;\n return {\n ...condition,\n expression: newExpr,\n };\n }\n }\n } catch {\n // If expression can't be parsed or folded, keep original\n }\n\n return condition;\n });\n\n // Clear cache if expressions were modified\n if (modified) {\n clearExpressionCache(node);\n }\n\n return {\n ...node,\n content: {\n ...content,\n conditions: foldedConditions,\n },\n };\n}\n\n/**\n * Fold expressions in an expression node.\n */\nfunction foldExpressionNode(node: JDMNode, content: any): JDMNode {\n const expr = content.expression;\n if (!expr) {\n return node;\n }\n\n try {\n const ast = cachedParseStandard(node, expr);\n const folded = foldExpression(ast);\n\n if (folded !== null && isLiteral(folded)) {\n const newExpr = literalToExprString(folded);\n if (newExpr !== expr) {\n // Clear cache since we're modifying the expression\n clearExpressionCache(node);\n return {\n ...node,\n content: {\n ...content,\n expression: newExpr,\n },\n };\n }\n }\n } catch {\n // If expression can't be parsed or folded, keep original\n }\n\n return node;\n}\n\n/**\n * Recursively fold an expression AST.\n * Returns the folded AST node, or null if folding is not possible.\n */\nfunction foldExpression(expr: ExpressionAST): ExpressionAST | null {\n if (isLiteralExpr(expr)) {\n return expr;\n }\n\n if (isBinaryOp(expr)) {\n const leftFolded = foldExpression(expr.left);\n const rightFolded = foldExpression(expr.right);\n\n // If both sides are literals, try to evaluate at compilation time\n if (leftFolded && rightFolded && isLiteral(leftFolded) && isLiteral(rightFolded)) {\n const result = evaluateConstantBinaryOp(expr.op, leftFolded, rightFolded);\n if (result !== null) {\n return result;\n }\n }\n\n return {\n ...expr,\n left: leftFolded || expr.left,\n right: rightFolded || expr.right,\n };\n }\n\n if (isUnaryOp(expr)) {\n const operandFolded = foldExpression(expr.operand);\n\n if (operandFolded && isLiteral(operandFolded)) {\n const result = evaluateConstantUnaryOp(expr.op, operandFolded);\n if (result !== null) {\n return result;\n }\n }\n\n return {\n ...expr,\n operand: operandFolded || expr.operand,\n };\n }\n\n if (isTernaryOp(expr)) {\n const conditionFolded = foldExpression(expr.condition);\n const consequentFolded = foldExpression(expr.consequent);\n const alternateFolded = foldExpression(expr.alternate);\n\n if (conditionFolded && isLiteral(conditionFolded) && isBooleanLiteral(conditionFolded)) {\n return conditionFolded.value\n ? consequentFolded || expr.consequent\n : alternateFolded || expr.alternate;\n }\n\n return {\n ...expr,\n condition: conditionFolded || expr.condition,\n consequent: consequentFolded || expr.consequent,\n alternate: alternateFolded || expr.alternate,\n };\n }\n\n // Can't fold other expression types (identifiers, function calls, etc.)\n return null;\n}\n\n/**\n * Check if an expression is a literal value.\n */\nfunction isLiteralExpr(expr: ExpressionAST): boolean {\n return (\n isNumberLiteral(expr) || isStringLiteral(expr) || isBooleanLiteral(expr) || isNullLiteral(expr)\n );\n}\n\n/**\n * Check if a node is a literal.\n */\nfunction isLiteral(\n node: ExpressionAST | null,\n): node is NumberLiteral | StringLiteral | BooleanLiteral {\n return node !== null && isLiteralExpr(node);\n}\n\n/**\n * Evaluate a binary operation with constant operands.\n */\nfunction evaluateConstantBinaryOp(\n op: string,\n left: NumberLiteral | StringLiteral | BooleanLiteral,\n right: NumberLiteral | StringLiteral | BooleanLiteral,\n): ExpressionAST | null {\n // Numeric operations\n if (isNumberLiteral(left) && isNumberLiteral(right)) {\n switch (op) {\n case '+':\n return { type: 'NumberLiteral', value: left.value + right.value };\n case '-':\n return { type: 'NumberLiteral', value: left.value - right.value };\n case '*':\n return { type: 'NumberLiteral', value: left.value * right.value };\n case '/':\n return { type: 'NumberLiteral', value: left.value / right.value };\n case '%':\n return { type: 'NumberLiteral', value: left.value % right.value };\n case '^':\n return { type: 'NumberLiteral', value: Math.pow(left.value, right.value) };\n case '<':\n return { type: 'BooleanLiteral', value: left.value < right.value };\n case '>':\n return { type: 'BooleanLiteral', value: left.value > right.value };\n case '<=':\n return { type: 'BooleanLiteral', value: left.value <= right.value };\n case '>=':\n return { type: 'BooleanLiteral', value: left.value >= right.value };\n case '==':\n return { type: 'BooleanLiteral', value: left.value === right.value };\n case '!=':\n return { type: 'BooleanLiteral', value: left.value !== right.value };\n }\n }\n\n // String operations\n if (isStringLiteral(left) && isStringLiteral(right)) {\n switch (op) {\n case '+':\n return { type: 'StringLiteral', value: left.value + right.value };\n case '==':\n return { type: 'BooleanLiteral', value: left.value === right.value };\n case '!=':\n return { type: 'BooleanLiteral', value: left.value !== right.value };\n }\n }\n\n // Boolean operations\n if (isBooleanLiteral(left) && isBooleanLiteral(right)) {\n switch (op) {\n case 'and':\n return { type: 'BooleanLiteral', value: left.value && right.value };\n case 'or':\n return { type: 'BooleanLiteral', value: left.value || right.value };\n case '==':\n return { type: 'BooleanLiteral', value: left.value === right.value };\n case '!=':\n return { type: 'BooleanLiteral', value: left.value !== right.value };\n }\n }\n\n return null;\n}\n\n/**\n * Evaluate a unary operation with a constant operand.\n */\nfunction evaluateConstantUnaryOp(\n op: string,\n operand: NumberLiteral | StringLiteral | BooleanLiteral,\n): ExpressionAST | null {\n if (op === 'not' && isBooleanLiteral(operand)) {\n return { type: 'BooleanLiteral', value: !operand.value };\n }\n\n if (op === '-' && isNumberLiteral(operand)) {\n return { type: 'NumberLiteral', value: -operand.value };\n }\n\n return null;\n}\n\n/**\n * Convert a literal AST node to its string representation.\n */\nfunction literalToExprString(node: NumberLiteral | StringLiteral | BooleanLiteral): string {\n switch (node.type) {\n case 'NumberLiteral':\n return String(node.value);\n case 'StringLiteral':\n return `\"${node.value}\"`;\n case 'BooleanLiteral':\n return String(node.value);\n }\n}\n\n// ============================================================================\n// Dead Code Elimination\n// ============================================================================\n\n/**\n * Remove unreachable code.\n *\n * This pass identifies and removes branches that can never be reached.\n * Examples:\n * - Remove if branches with constant false conditions\n * - Remove decision table rows with always-false conditions\n * - Remove decision table rows that can never match after previous rows\n *\n * @param ast - The compiled AST to optimize\n * @returns The AST with dead code removed\n */\nfunction deadCodeElimination(ast: CompiledAST): CompiledAST {\n const optimized = JSON.parse(JSON.stringify(ast)) as JDMDecision;\n\n optimized.nodes = optimized.nodes.map((node: JDMNode) => eliminateDeadCodeInNode(node));\n\n return optimized;\n}\n\n/**\n * Apply dead code elimination to a node.\n */\nfunction eliminateDeadCodeInNode(node: JDMNode): JDMNode {\n if (!node.content) {\n return node;\n }\n\n const content = node.content;\n\n if (node.type === NodeType.DECISION_TABLE) {\n return eliminateDeadCodeInDecisionTable(node, content);\n }\n\n if (node.type === NodeType.SWITCH) {\n return eliminateDeadCodeInSwitch(node, content);\n }\n\n return node;\n}\n\n/**\n * Check if a unary expression is always false.\n * In unary mode, \"false\" is equivalent to \"$ == false\".\n */\nfunction isUnaryAlwaysFalse(expr: ExpressionAST): boolean {\n if (isBinaryOp(expr) && expr.op === '==') {\n const leftIsDollar = expr.left.type === 'DollarRef';\n const rightIsFalse = isBooleanLiteral(expr.right) && !expr.right.value;\n return leftIsDollar && rightIsFalse;\n }\n\n if (isBinaryOp(expr) && expr.op === '!=') {\n const leftIsDollar = expr.left.type === 'DollarRef';\n const rightIsTrue = isBooleanLiteral(expr.right) && expr.right.value;\n return leftIsDollar && rightIsTrue;\n }\n\n return false;\n}\n\n/**\n * Eliminate dead code in decision table nodes.\n */\nfunction eliminateDeadCodeInSwitch(node: JDMNode, content: any): JDMNode {\n const { conditions } = content;\n\n // Filter out conditions that are always false\n const liveConditions = conditions.filter((condition: any) => {\n const expr = condition.expression;\n if (!expr || expr === '') {\n return true;\n }\n\n try {\n const parsed = cachedParseStandard(node, expr);\n\n if (isBooleanLiteral(parsed) && !parsed.value) {\n return false;\n }\n } catch {}\n\n return true;\n });\n\n return {\n ...node,\n content: {\n ...content,\n conditions: liveConditions,\n },\n };\n}\n\n/**\n * Eliminate dead code in decision table nodes.\n */\nfunction eliminateDeadCodeInDecisionTable(node: JDMNode, content: any): JDMNode {\n const { rules, inputs } = content;\n\n // Filter out rules that have a non-trivial always-false condition\n const liveRules = rules.filter((rule: any) => {\n for (const input of inputs) {\n const expr = rule[input.id];\n if (!expr || expr === '' || expr === '-') {\n continue;\n }\n\n try {\n const parsed = cachedParseUnary(node, expr);\n\n // Check if this is a boolean literal (not common in unary mode, but possible)\n if (isBooleanLiteral(parsed) && !parsed.value) {\n return false;\n }\n\n // Check if this is a unary expression that's always false\n // e.g., \"false\" in a decision table cell is interpreted as \"$ == false\"\n if (isUnaryAlwaysFalse(parsed)) {\n return false;\n }\n } catch {\n // If we can't parse it, assume the rule is live\n }\n }\n\n return true;\n });\n\n return {\n ...node,\n content: {\n ...content,\n rules: liveRules,\n },\n };\n}\n\n// ============================================================================\n// Expression Inlining\n// ============================================================================\n\n/**\n * Inline small expressions.\n *\n * This pass replaces function calls with evaluated results for pure functions.\n * Examples:\n * - Inline small arithmetic operations in decision table cells\n * - Pre-evaluate expressions that don't depend on runtime values\n *\n * @param ast - The compiled AST to optimize\n * @returns The AST with inlined expressions\n */\nfunction expressionInlining(ast: CompiledAST): CompiledAST {\n // Create a deep copy to avoid mutating the original\n const optimized = JSON.parse(JSON.stringify(ast)) as JDMDecision;\n\n // Only functions without side effects can be safely evaluated at compile time. Arithmetic\n // (sum, max, min, abs, floor, ceil, round) and string functions (upper, lower, len) are\n // pure and deterministic, so their results with constant inputs are predictable.\n optimized.nodes = optimized.nodes.map((node: JDMNode) => inlineExpressionsInNode(node));\n\n return optimized;\n}\n\n/**\n * Apply expression inlining to a node.\n */\nfunction inlineExpressionsInNode(node: JDMNode): JDMNode {\n if (!node.content) {\n return node;\n }\n\n const content = node.content;\n\n // Handle decision table nodes\n if (node.type === NodeType.DECISION_TABLE && content && content.rules && content.inputs) {\n return inlineDecisionTableExpressions(node, content);\n }\n\n return node;\n}\n\n/**\n * Inline expressions in decision table nodes.\n */\nfunction inlineDecisionTableExpressions(node: JDMNode, content: any): JDMNode {\n const { rules, inputs } = content;\n\n const inlinedRules = rules.map((rule: any) => {\n const inlinedRule = { ...rule };\n\n for (const input of inputs) {\n const expr = rule[input.id];\n if (!expr || expr === '' || expr === '-') {\n continue;\n }\n\n const inlined = tryInlineExpression(expr);\n if (inlined !== expr) {\n inlinedRule[input.id] = inlined;\n }\n }\n\n return inlinedRule;\n });\n\n return {\n ...node,\n content: {\n ...content,\n rules: inlinedRules,\n },\n };\n}\n\n/**\n * Try to inline an expression by evaluating simple pure function calls.\n * Returns the inlined expression string, or the original if inlining is not possible.\n */\nfunction tryInlineExpression(expr: string): string {\n const trimmed = expr.trim();\n\n // Inline simple arithmetic operations wrapped in function notation\n // Examples: sum(2, 3) → 5, min(10, 5) → 5, abs(-5) → 5, upper(\"hello\") → \"HELLO\"\n\n // Match sum(a, b, ...) pattern where all arguments are numeric literals\n const sumMatch = trimmed.match(/^sum\\((.+)\\)$/i);\n if (sumMatch) {\n const args = sumMatch[1].split(',').map((s: string) => s.trim());\n if (args.every((arg: string) => /^-?\\d+\\.?\\d*$/.test(arg))) {\n const sum = args.reduce((acc: number, arg: string) => acc + parseFloat(arg), 0);\n return String(sum);\n }\n }\n\n // Match max(a, b) pattern where both arguments are numeric literals\n const maxMatch = trimmed.match(/^max\\((.+),(.+)\\)$/i);\n if (maxMatch) {\n const [_, arg1, arg2] = maxMatch;\n const num1 = parseFloat(arg1.trim());\n const num2 = parseFloat(arg2.trim());\n if (!isNaN(num1) && !isNaN(num2)) {\n return String(Math.max(num1, num2));\n }\n }\n\n // Match min(a, b) pattern where both arguments are numeric literals\n const minMatch = trimmed.match(/^min\\((.+),(.+)\\)$/i);\n if (minMatch) {\n const [_, arg1, arg2] = minMatch;\n const num1 = parseFloat(arg1.trim());\n const num2 = parseFloat(arg2.trim());\n if (!isNaN(num1) && !isNaN(num2)) {\n return String(Math.min(num1, num2));\n }\n }\n\n // Match abs(a) pattern where argument is a numeric literal\n const absMatch = trimmed.match(/^abs\\((.+)\\)$/i);\n if (absMatch) {\n const val = parseFloat(absMatch[1].trim());\n if (!isNaN(val)) {\n return String(Math.abs(val));\n }\n }\n\n // Match floor(a) pattern where argument is a numeric literal\n const floorMatch = trimmed.match(/^floor\\((.+)\\)$/i);\n if (floorMatch) {\n const val = parseFloat(floorMatch[1].trim());\n if (!isNaN(val)) {\n return String(Math.floor(val));\n }\n }\n\n // Match ceil(a) pattern where argument is a numeric literal\n const ceilMatch = trimmed.match(/^ceil\\((.+)\\)$/i);\n if (ceilMatch) {\n const val = parseFloat(ceilMatch[1].trim());\n if (!isNaN(val)) {\n return String(Math.ceil(val));\n }\n }\n\n // Match round(a) pattern where argument is a numeric literal\n const roundMatch = trimmed.match(/^round\\((.+)\\)$/i);\n if (roundMatch) {\n const val = parseFloat(roundMatch[1].trim());\n if (!isNaN(val)) {\n return String(Math.round(val));\n }\n }\n\n // Match upper(\"string\") pattern for constant string literals\n const upperMatch = trimmed.match(/^upper\\(\"(.+)\"\\)$/i);\n if (upperMatch) {\n return `\"${upperMatch[1].toUpperCase()}\"`;\n }\n\n // Match lower(\"string\") pattern for constant string literals\n const lowerMatch = trimmed.match(/^lower\\(\"(.+)\"\\)$/i);\n if (lowerMatch) {\n return `\"${lowerMatch[1].toLowerCase()}\"`;\n }\n\n // Match len(\"string\") pattern for constant string literals\n const lenMatch = trimmed.match(/^len\\(\"(.*)\"\\)$/i);\n if (lenMatch) {\n return String(lenMatch[1].length);\n }\n\n // Match len(123) pattern for numeric literals (counting digits excluding sign)\n const lenNumMatch = trimmed.match(/^len\\(-?\\d+\\.?\\d*\\)$/i);\n if (lenNumMatch) {\n const numStr = trimmed.match(/^len\\((.+)\\)$/i)![1].trim();\n // Count digits ignoring sign and decimal point\n const digitCount = numStr.replace(/^-/, '').replace('.', '').length;\n return String(digitCount);\n }\n\n return expr;\n}\n\n// ============================================================================\n// Table Indexing\n// ============================================================================\n\n/**\n * Build index structures for efficient table lookup.\n *\n * This pass transforms linear search structures into more efficient alternatives.\n * Examples:\n * - Convert decision table rows with equality checks to index-based lookup\n * - Mark tables that are good candidates for switch statement generation\n *\n * Table indexing converts O(n) linear search to O(1) hash lookup when all rules check\n * equality on a single column with unique values - this is common in lookup tables\n * (e.g., pricing tiers by customer type) and can improve evaluation time by 10-100x\n * for large tables.\n *\n * @param ast - The compiled AST to optimize\n * @returns The AST with optimized table lookups\n */\nfunction tableIndexing(ast: CompiledAST): CompiledAST {\n const optimized = JSON.parse(JSON.stringify(ast)) as JDMDecision;\n\n optimized.nodes = optimized.nodes.map((node: JDMNode) => indexTableInNode(node));\n\n return optimized;\n}\n\n/**\n * Apply table indexing to a node.\n */\nfunction indexTableInNode(node: JDMNode): JDMNode {\n if (!node.content) {\n return node;\n }\n\n const content = node.content;\n\n if (node.type === NodeType.DECISION_TABLE) {\n return indexDecisionTable(node, content);\n }\n\n return node;\n}\n\n/**\n * Index decision table for efficient lookup.\n *\n * This pass analyzes the decision table to identify patterns that can be\n * optimized, such as equality checks on a single column that could be\n * converted to a switch statement or hash map.\n */\nfunction indexDecisionTable(node: JDMNode, content: any): JDMNode {\n const { rules, inputs } = content;\n\n // Analyze each input column to find indexing opportunities\n const indexedInputs = inputs.map((input: any) => {\n const inputValues = rules.map((rule: any) => {\n const expr = rule[input.id];\n if (!expr || expr === '' || expr === '-') {\n return null;\n }\n return expr.trim();\n });\n\n // Check if this column is a good candidate for indexing:\n // - All values are string or number literals\n // - No intervals or complex expressions\n // - No duplicate values\n const allLiterals = inputValues.every((val: string | null) => {\n if (!val) {\n return true;\n }\n return /^([\"'])(?:(?=(\\\\?))\\2.)*?\\1$|^-?\\d+\\.?\\d*$/.test(val);\n });\n\n const uniqueValues = new Set(inputValues.filter((v: string | null) => v !== null));\n const hasDuplicates =\n uniqueValues.size < inputValues.filter((v: string | null) => v !== null).length;\n\n return {\n ...input,\n // Hash-based lookup becomes beneficial with ~10+ unique values, but overhead matters\n // for small tables. 50 is a practical limit where indexing provides clear wins without\n // excessive memory for the lookup structure.\n _indexable: allLiterals && !hasDuplicates && uniqueValues.size > 0 && uniqueValues.size < 50,\n _uniqueValues: Array.from(uniqueValues),\n };\n });\n\n return {\n ...node,\n content: {\n ...content,\n inputs: indexedInputs,\n },\n };\n}\n","/**\n * Runtime validation code generation for decision models.\n *\n * This module provides functions that generate or perform validation code\n * that executes at runtime. These functions validate actual data against\n * schemas when the decision is evaluated.\n *\n * For compile-time static analysis (checking references exist, etc.),\n * see compile-time-validation.ts.\n */\n\nimport type { FlattenedLayout } from './types';\n\n/**\n * Validation error containing field path, expected type, and actual value.\n */\nexport interface ValidationError {\n /** The field path (e.g., \"customer.age\") */\n path: string;\n /** Error message describing the issue */\n message: string;\n /** The expected type */\n expected?: string;\n /** The actual value that failed validation */\n actual?: unknown;\n}\n\n/**\n * Result of runtime validation.\n */\nexport interface ValidationResult {\n /** Whether validation passed */\n valid: boolean;\n /** Array of validation errors (empty if valid) */\n errors: ValidationError[];\n}\n\n/**\n * Validate runtime input data against the input schema.\n *\n * This function checks that all required input fields from the schema\n * are present in the provided input data AND that they have correct types.\n * It returns a list of validation errors including missing fields and\n * type mismatches.\n *\n * Security note: This validation prevents malformed input with wrong types\n * (string instead of number, object instead of array) from being marshaled\n * to WASM, which could cause runtime errors or unexpected behavior.\n *\n * @param inputData - Runtime input data as a JavaScript object\n * @param inputLayout - Flattened layout from the input schema\n * @returns Array of missing/invalid input field paths (empty if all valid)\n */\nexport function validateRuntimeInputs(\n inputData: Record<string, any>,\n inputLayout: FlattenedLayout,\n): string[] {\n const result = validateRuntimeInputsDetailed(inputData, inputLayout);\n // Return just the paths for backwards compatibility\n return result.errors.map((e) => e.path);\n}\n\n/**\n * Validate runtime input data with detailed error information.\n *\n * This function performs comprehensive validation including:\n * - Presence checking: All required fields must be present\n * - Type checking: Values must match expected types\n * - Range checking: Numbers must be finite (not NaN/Infinity unless intended)\n *\n * @param inputData - Runtime input data as a JavaScript object\n * @param inputLayout - Flattened layout from the input schema\n * @returns Detailed validation result with errors\n */\nexport function validateRuntimeInputsDetailed(\n inputData: Record<string, any>,\n inputLayout: FlattenedLayout,\n): ValidationResult {\n const errors: ValidationError[] = [];\n\n for (const field of inputLayout.fields) {\n const path = field.path;\n const parts = path.split('.');\n\n let current: any = inputData;\n let exists = true;\n\n // Navigate to the nested value\n for (const part of parts) {\n if (current === null || current === undefined || current[part] === undefined) {\n exists = false;\n break;\n }\n current = current[part];\n }\n\n if (!exists) {\n errors.push({\n path,\n message: 'Required field is missing',\n expected: field.type,\n actual: undefined,\n });\n continue;\n }\n\n // Now check type\n const typeError = validateFieldType(current, field.type, path);\n if (typeError) {\n errors.push(typeError);\n }\n }\n\n return {\n valid: errors.length === 0,\n errors,\n };\n}\n\n/**\n * Validate that a value matches the expected field type.\n *\n * @param value - The actual value to validate\n * @param expectedType - The expected type from the schema\n * @param path - The field path for error reporting\n * @returns ValidationError if type mismatch, null if valid\n */\nfunction validateFieldType(\n value: unknown,\n expectedType: 'f64' | 'i32' | 'i64' | 'bool' | 'string' | 'array',\n path: string,\n): ValidationError | null {\n const actualType = typeof value;\n\n switch (expectedType) {\n case 'f64':\n case 'i32':\n case 'i64': {\n // Check for number type\n if (actualType !== 'number' && actualType !== 'bigint') {\n return {\n path,\n message: `Expected ${expectedType} (number), got ${actualType}`,\n expected: expectedType,\n actual: value,\n };\n }\n\n // For number types, also check for NaN\n if (actualType === 'number' && Number.isNaN(value)) {\n return {\n path,\n message: `Invalid number: NaN is not allowed`,\n expected: expectedType,\n actual: value,\n };\n }\n\n // For integer types, check that the value is actually an integer\n if (expectedType === 'i32' || expectedType === 'i64') {\n if (actualType === 'number' && !Number.isInteger(value)) {\n return {\n path,\n message: `Expected integer, got floating-point number`,\n expected: expectedType,\n actual: value,\n };\n }\n }\n break;\n }\n\n case 'bool': {\n if (actualType !== 'boolean') {\n return {\n path,\n message: `Expected boolean, got ${actualType}`,\n expected: 'boolean',\n actual: value,\n };\n }\n break;\n }\n\n case 'string': {\n if (actualType !== 'string') {\n return {\n path,\n message: `Expected string, got ${actualType}`,\n expected: 'string',\n actual: value,\n };\n }\n break;\n }\n\n case 'array': {\n if (!Array.isArray(value)) {\n return {\n path,\n message: `Expected array, got ${actualType}`,\n expected: 'array',\n actual: value,\n };\n }\n break;\n }\n\n default: {\n // Unknown type - this shouldn't happen with a valid schema\n // but we'll accept any value for forward compatibility\n break;\n }\n }\n\n return null;\n}\n\n/**\n * Validate runtime output data against the output schema.\n *\n * This function checks that all required output fields from the schema\n * are present in the provided output data AND that they have correct types.\n * It returns a list of validation errors including missing fields and\n * type mismatches.\n *\n * @param outputData - Runtime output data as a JavaScript object\n * @param outputLayout - Flattened layout from the output schema\n * @returns Array of missing/invalid output field paths (empty if all valid)\n */\nexport function validateRuntimeOutputs(\n outputData: Record<string, any>,\n outputLayout: FlattenedLayout,\n): string[] {\n const result = validateRuntimeOutputsDetailed(outputData, outputLayout);\n return result.errors.map((e) => e.path);\n}\n\n/**\n * Validate runtime output data with detailed error information.\n *\n * This function performs comprehensive validation including:\n * - Presence checking: All required output fields must be present\n * - Type checking: Values must match expected types\n *\n * @param outputData - Runtime output data as a JavaScript object\n * @param outputLayout - Flattened layout from the output schema\n * @returns Detailed validation result with errors\n */\nexport function validateRuntimeOutputsDetailed(\n outputData: Record<string, any>,\n outputLayout: FlattenedLayout,\n): ValidationResult {\n const errors: ValidationError[] = [];\n\n for (const field of outputLayout.fields) {\n const path = field.path;\n const parts = path.split('.');\n\n // Allows objects to be built incrementally (e.g., output.customer.name and\n // output.customer.age) instead of requiring the entire object at once.\n let current: any = outputData;\n let exists = true;\n\n for (const part of parts) {\n if (current === null || current === undefined || current[part] === undefined) {\n exists = false;\n break;\n }\n current = current[part];\n }\n\n if (!exists) {\n errors.push({\n path,\n message: 'Required output field is missing',\n expected: field.type,\n actual: undefined,\n });\n continue;\n }\n\n // Now check type\n const typeError = validateFieldType(current, field.type, path);\n if (typeError) {\n errors.push(typeError);\n }\n }\n\n return {\n valid: errors.length === 0,\n errors,\n };\n}\n"],"mappings":";AAkCO,IAAK,YAAL,kBAAKA,eAAL;AAEL,EAAAA,WAAA,kBAAe;AACf,EAAAA,WAAA,4BAAyB;AACzB,EAAAA,WAAA,wBAAqB;AACrB,EAAAA,WAAA,yBAAsB;AACtB,EAAAA,WAAA,0BAAuB;AACvB,EAAAA,WAAA,oBAAiB;AACjB,EAAAA,WAAA,kBAAe;AAGf,EAAAA,WAAA,+BAA4B;AAC5B,EAAAA,WAAA,4BAAyB;AAGzB,EAAAA,WAAA,iBAAc;AACd,EAAAA,WAAA,sBAAmB;AACnB,EAAAA,WAAA,mBAAgB;AAChB,EAAAA,WAAA,mBAAgB;AAGhB,EAAAA,WAAA,qBAAkB;AAClB,EAAAA,WAAA,oBAAiB;AAtBP,SAAAA;AAAA,GAAA;AA+BL,IAAM,mBAAN,MAAM,0BAAyB,MAAM;AAAA,EAG1C,YACE,SACgB,MACA,UACA,SAChB;AACA,UAAM,OAAO;AAJG;AACA;AACA;AAOhB,QAAI,MAAM,mBAAmB;AAC3B,YAAM,kBAAkB,MAAM,iBAAgB;AAAA,IAChD;AAAA,EACF;AAAA,EAhBS,OAAO;AAAA;AAAA;AAAA;AAAA,EAqBhB,sBAA8B;AAC5B,UAAM,QAAkB,CAAC;AAEzB,QAAI,KAAK,UAAU;AACjB,YAAM,WAAqB,CAAC;AAC5B,UAAI,KAAK,SAAS,UAAU;AAC1B,iBAAS,KAAK,KAAK,SAAS,QAAQ;AAAA,MACtC;AACA,UAAI,KAAK,SAAS,QAAQ;AACxB,iBAAS,KAAK,QAAQ,KAAK,SAAS,MAAM,GAAG;AAAA,MAC/C;AACA,UAAI,KAAK,SAAS,OAAO;AACvB,iBAAS,KAAK,IAAI,KAAK,SAAS,KAAK,EAAE;AAAA,MACzC;AAEA,UAAI,KAAK,SAAS,S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ACA,SAAS;AAAA,IACT,iBAAiB,CAAC,SAAS,wBAAwB,IAAI;AAAA,IACvD,sBAAsB,CAAC,SAAS,qBAAyB,IAAI;AAAA,IAC7D,aAAa,kBAAkB;AAAA,IAC/B,cAAc,QAAQ,gBAAgB,uBAAuB,QAAQ,YAAY;AAAA;AAAA,IAEjF,sBAAsB,oBAAI,IAAI;AAAA;AAAA,IAE9B,cAAc,CAAC;AAAA,IACf,iBAAiB,oBAAI,IAAI;AAAA,EAC3B;AAGA,QAAM,SAAS,gBAAgB,QAAQ,OAAO;AAG9C,QAAM,EAAE,QAAQ,IAAI,IAAI,MAAM,sBAAsB,QAAQ,IAAI;AAGhE,QAAM,cAAc,oBAAoB,aAAa,cAAc,UAAU;AAC7E,QAAM,iBAAiB,uBAAuB,QAAQ,WAAW;AAEjE,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA,KAAK,KAAK,QAAQ,MAAM;AAAA,IACxB,gBAAgB,KAAK,QAAQ,SAAS;AAAA,EACxC;AACF;AAEA,SAAS,oBAAgD;AACvD,QAAM,WAAW,oBAAI,IAAoB;AACzC,SAAO,CAAC,WAAmB;AACzB,UAAM,QAAQ,SAAS,IAAI,MAAM,KAAK;AACtC,aAAS,IAAI,QAAQ,QAAQ,CAAC;AAC9B,WAAO,GAAG,MAAM,IAAI,KAAK;AAAA,EAC3B;AACF;","names":["ErrorCode","TokenType","Position","SourceLocation","offset","Parser","ref","parse","parser","DestructuringErrors","TokContext","Scope","Node","BranchID","RegExpValidationState","current","Token","parse","NodeType","path","path","ast","compiledExpr","literal","path","statements","branchCode","wrapperCode","sanitizeId","generateNodeEvaluationCode","data","dirname","data","module","current","Kind","createHash","path","readFileSync","path","lookahead","value","current","path","current","path","readFileSync"]}