solve-engine 1.0.1 → 1.0.2

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 (55) hide show
  1. package/dist/{Lexer-BN5mt30n.d.ts → Lexer-CNmWxabg.d.ts} +30 -0
  2. package/dist/{Lexer-D78E2yDW.d.cts → Lexer-DpjdaQ98.d.cts} +30 -0
  3. package/dist/{PackageRegistry-DCUEzbQt.d.ts → PackageRegistry-ClIFXxAe.d.ts} +1 -1
  4. package/dist/{PackageRegistry-B37mRvvz.d.cts → PackageRegistry-zuzqt51V.d.cts} +1 -1
  5. package/dist/{chunk-2XLQPQKI.cjs → chunk-524F3ATQ.cjs} +3 -3
  6. package/dist/{chunk-2XLQPQKI.cjs.map → chunk-524F3ATQ.cjs.map} +1 -1
  7. package/dist/{chunk-TBN7DEHO.js → chunk-7FSDNNNC.js} +3 -3
  8. package/dist/{chunk-TBN7DEHO.js.map → chunk-7FSDNNNC.js.map} +1 -1
  9. package/dist/{chunk-5F4C26RU.js → chunk-AA3KTWTX.js} +3 -3
  10. package/dist/{chunk-5F4C26RU.js.map → chunk-AA3KTWTX.js.map} +1 -1
  11. package/dist/{chunk-KBSXGXPM.cjs → chunk-FE23VSSA.cjs} +4 -4
  12. package/dist/{chunk-KBSXGXPM.cjs.map → chunk-FE23VSSA.cjs.map} +1 -1
  13. package/dist/{chunk-QY25VWBF.js → chunk-FQGX2PA2.js} +29 -4
  14. package/dist/chunk-FQGX2PA2.js.map +1 -0
  15. package/dist/{chunk-B7TLZABL.cjs → chunk-HBVFFBRR.cjs} +23 -21
  16. package/dist/chunk-HBVFFBRR.cjs.map +1 -0
  17. package/dist/{chunk-YPPPYLSR.js → chunk-IP7ASJEW.js} +3 -3
  18. package/dist/{chunk-YPPPYLSR.js.map → chunk-IP7ASJEW.js.map} +1 -1
  19. package/dist/{chunk-V5PYO44Y.js → chunk-NG2JHZHE.js} +9 -7
  20. package/dist/chunk-NG2JHZHE.js.map +1 -0
  21. package/dist/{chunk-YWQ6V4ZN.cjs → chunk-R7YVBHCV.cjs} +29 -4
  22. package/dist/chunk-R7YVBHCV.cjs.map +1 -0
  23. package/dist/{chunk-3AFRJYP4.cjs → chunk-SESSWASV.cjs} +46 -46
  24. package/dist/{chunk-3AFRJYP4.cjs.map → chunk-SESSWASV.cjs.map} +1 -1
  25. package/dist/{chunk-BHTNFEGZ.cjs → chunk-T556MJDZ.cjs} +5 -5
  26. package/dist/{chunk-BHTNFEGZ.cjs.map → chunk-T556MJDZ.cjs.map} +1 -1
  27. package/dist/{chunk-HMOISHXR.js → chunk-YXCTLWOH.js} +4 -4
  28. package/dist/{chunk-HMOISHXR.js.map → chunk-YXCTLWOH.js.map} +1 -1
  29. package/dist/constants.cjs +4 -4
  30. package/dist/constants.js +1 -1
  31. package/dist/engine.cjs +16 -16
  32. package/dist/engine.d.cts +3 -3
  33. package/dist/engine.d.ts +3 -3
  34. package/dist/engine.js +6 -6
  35. package/dist/index.cjs +13 -13
  36. package/dist/index.d.cts +3 -3
  37. package/dist/index.d.ts +3 -3
  38. package/dist/index.js +7 -7
  39. package/dist/language.d.cts +3 -3
  40. package/dist/language.d.ts +3 -3
  41. package/dist/lexer.cjs +8 -8
  42. package/dist/lexer.d.cts +2 -2
  43. package/dist/lexer.d.ts +2 -2
  44. package/dist/lexer.js +2 -2
  45. package/dist/normalizer.cjs +8 -8
  46. package/dist/normalizer.js +2 -2
  47. package/dist/packages.cjs +26 -26
  48. package/dist/packages.d.cts +2 -2
  49. package/dist/packages.d.ts +2 -2
  50. package/dist/packages.js +3 -3
  51. package/package.json +1 -1
  52. package/dist/chunk-B7TLZABL.cjs.map +0 -1
  53. package/dist/chunk-QY25VWBF.js.map +0 -1
  54. package/dist/chunk-V5PYO44Y.js.map +0 -1
  55. package/dist/chunk-YWQ6V4ZN.cjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../node_modules/semver/internal/constants.js","../node_modules/semver/internal/debug.js","../node_modules/semver/internal/re.js","../node_modules/semver/internal/parse-options.js","../node_modules/semver/internal/identifiers.js","../node_modules/semver/classes/semver.js","../node_modules/semver/functions/parse.js","../node_modules/semver/functions/valid.js","../node_modules/semver/functions/clean.js","../node_modules/semver/functions/inc.js","../node_modules/semver/functions/diff.js","../node_modules/semver/functions/major.js","../node_modules/semver/functions/minor.js","../node_modules/semver/functions/patch.js","../node_modules/semver/functions/prerelease.js","../node_modules/semver/functions/compare.js","../node_modules/semver/functions/rcompare.js","../node_modules/semver/functions/compare-loose.js","../node_modules/semver/functions/compare-build.js","../node_modules/semver/functions/sort.js","../node_modules/semver/functions/rsort.js","../node_modules/semver/functions/gt.js","../node_modules/semver/functions/lt.js","../node_modules/semver/functions/eq.js","../node_modules/semver/functions/neq.js","../node_modules/semver/functions/gte.js","../node_modules/semver/functions/lte.js","../node_modules/semver/functions/cmp.js","../node_modules/semver/functions/coerce.js","../node_modules/semver/functions/truncate.js","../node_modules/semver/internal/lrucache.js","../node_modules/semver/classes/range.js","../node_modules/semver/classes/comparator.js","../node_modules/semver/functions/satisfies.js","../node_modules/semver/ranges/to-comparators.js","../node_modules/semver/ranges/max-satisfying.js","../node_modules/semver/ranges/min-satisfying.js","../node_modules/semver/ranges/min-version.js","../node_modules/semver/ranges/valid.js","../node_modules/semver/ranges/outside.js","../node_modules/semver/ranges/gtr.js","../node_modules/semver/ranges/ltr.js","../node_modules/semver/ranges/intersects.js","../node_modules/semver/ranges/simplify.js","../node_modules/semver/ranges/subset.js","../node_modules/semver/index.js","../src/cache/LineCache.ts","../src/api/PackageCompatibility.ts","../src/api/EngineVersionCompatibility.ts","../src/workers/engine.worker.ts","../src/engine/ExecutionPool.ts","../src/engine/AsyncResolutionBatcher.ts","../src/telemetry/AllocationTracker.ts","../src/engine/ExpressionEngineSafety.ts","../src/engine/ExpressionEngine.ts","../src/engine/SegmentTree.ts","../src/engine/DocumentModel.ts","../src/engine/CompilationWorkerManager.ts","../src/engine/PageManager.ts","../src/engine/ThreeTierEvaluator.ts"],"names":["coerce","satisfies","require_valid","validRange","require_semver","reads","writes","expression","EvalTier"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,IAAA,iBAAA,GAAA,UAAA,CAAA;AAAA,EAAA,2CAAA,CAAA,OAAA,EAAA,MAAA,EAAA;AAIA,IAAA,IAAM,mBAAA,GAAsB,OAAA;AAE5B,IAAA,IAAM,UAAA,GAAa,GAAA;AACnB,IAAA,IAAM,mBAAmB,MAAA,CAAO,gBAAA;AAAA,IACL,gBAAA;AAG3B,IAAA,IAAM,yBAAA,GAA4B,EAAA;AAIlC,IAAA,IAAM,wBAAwB,UAAA,GAAa,CAAA;AAE3C,IAAA,IAAM,aAAA,GAAgB;AAAA,MACpB,OAAA;AAAA,MACA,UAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA;AAAA,MACA;AAAA,KACF;AAEA,IAAA,MAAA,CAAO,OAAA,GAAU;AAAA,MACf,UAAA;AAAA,MACA,yBAAA;AAAA,MACA,qBAAA;AAAA,MACA,gBAAA;AAAA,MACA,aAAA;AAAA,MACA,mBAAA;AAAA,MACA,uBAAA,EAAyB,CAAA;AAAA,MACzB,UAAA,EAAY;AAAA,KACd;AAAA,EAAA;AAAA,CAAA,CAAA;;;ACpCA,IAAA,aAAA,GAAA,UAAA,CAAA;AAAA,EAAA,uCAAA,CAAA,OAAA,EAAA,MAAA,EAAA;AAEA,IAAA,IAAM,KAAA,GACJ,OAAO,OAAA,KAAY,QAAA,IACnB,QAAQ,GAAA,IACR,OAAA,CAAQ,GAAA,CAAI,UAAA,IACZ,aAAA,CAAc,IAAA,CAAK,QAAQ,GAAA,CAAI,UAAU,CAAA,GACvC,CAAA,GAAI,IAAA,KAAS,OAAA,CAAQ,MAAM,QAAA,EAAU,GAAG,IAAI,CAAA,GAC5C,MAAM;AAAA,IAAC,CAAA;AAEX,IAAA,MAAA,CAAO,OAAA,GAAU,KAAA;AAAA,EAAA;AAAA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A,MAAW,cAAc,WAAA,EAAa;AACrC,QAAA,IAAI,CAAC,UAAA,CAAW,IAAA,EAAK,EAAG;AACxB,QAAA,KAAA,CAAM,IAAA,CAAK;AAAA,UACV,QAAQ,KAAA,CAAM,MAAA;AAAA,UACd,UAAA;AAAA,UACA,UAAU,KAAA,CAAM;AAAA,SAChB,CAAA;AAAA,MACF;AAAA,IACD;AAEA,IAAA,OAAO,KAAA;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaQ,mBAAmB,KAAA,EAAuE;AAEjG,IAAA,IAAI,KAAA,CAAM,WAAA,CAAY,MAAA,GAAS,CAAA,EAAG;AACjC,MAAA,OAAO,EAAE,WAAA,EAAa,KAAA,CAAM,WAAA,EAAa,gBAAA,EAAkB,MAAM,gBAAA,EAAiB;AAAA,IACnF;AAEA,IAAA,MAAM,OAAA,GAAU,KAAA,CAAM,IAAA,CAAK,IAAA,EAAK;AAChC,IAAA,IAAI,OAAA,CAAQ,WAAW,CAAA,EAAG,OAAO,EAAE,WAAA,EAAa,EAAC,EAAG,gBAAA,EAAkB,CAAA,EAAE;AAGxE,IAAA,MAAM,WAAA,GAAc,WAAA,CAAY,gBAAA,CAAiB,KAAA,CAAM,IAAI,CAAA;AAC3D,IAAA,IAAI,WAAA,CAAY,SAAS,CAAA,EAAG;AAC3B,MAAA,OAAO;AAAA,QACN,WAAA,EAAa,WAAA,CAAY,GAAA,CAAI,CAAA,CAAA,KAAK,EAAE,UAAU,CAAA;AAAA,QAC9C,kBAAkB,WAAA,CAAY;AAAA,OAC/B;AAAA,IACD;AAGA,IAAA,OAAO,EAAE,WAAA,EAAa,CAAC,OAAO,CAAA,EAAG,kBAAkB,CAAA,EAAE;AAAA,EACtD;AACD","file":"chunk-V5PYO44Y.js","sourcesContent":["'use strict'\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nconst SEMVER_SPEC_VERSION = '2.0.0'\n\nconst MAX_LENGTH = 256\nconst MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||\n/* istanbul ignore next */ 9007199254740991\n\n// Max safe segment length for coercion.\nconst MAX_SAFE_COMPONENT_LENGTH = 16\n\n// Max safe length for a build identifier. The max length minus 6 characters for\n// the shortest version with a build 0.0.0+BUILD.\nconst MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6\n\nconst RELEASE_TYPES = [\n 'major',\n 'premajor',\n 'minor',\n 'preminor',\n 'patch',\n 'prepatch',\n 'prerelease',\n]\n\nmodule.exports = {\n MAX_LENGTH,\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_SAFE_INTEGER,\n RELEASE_TYPES,\n SEMVER_SPEC_VERSION,\n FLAG_INCLUDE_PRERELEASE: 0b001,\n FLAG_LOOSE: 0b010,\n}\n","'use strict'\n\nconst debug = (\n typeof process === 'object' &&\n process.env &&\n process.env.NODE_DEBUG &&\n /\\bsemver\\b/i.test(process.env.NODE_DEBUG)\n) ? (...args) => console.error('SEMVER', ...args)\n : () => {}\n\nmodule.exports = debug\n","'use strict'\n\nconst {\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_LENGTH,\n} = require('./constants')\nconst debug = require('./debug')\nexports = module.exports = {}\n\n// The actual regexps go on exports.re\nconst re = exports.re = []\nconst safeRe = exports.safeRe = []\nconst src = exports.src = []\nconst safeSrc = exports.safeSrc = []\nconst t = exports.t = {}\nlet R = 0\n\nconst LETTERDASHNUMBER = '[a-zA-Z0-9-]'\n\n// Replace some greedy regex tokens to prevent regex dos issues. These regex are\n// used internally via the safeRe object since all inputs in this library get\n// normalized first to trim and collapse all extra whitespace. The original\n// regexes are exported for userland consumption and lower level usage. A\n// future breaking change could export the safer regex only with a note that\n// all input should have extra whitespace removed.\nconst safeRegexReplacements = [\n ['\\\\s', 1],\n ['\\\\d', MAX_LENGTH],\n [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],\n]\n\nconst makeSafeRegex = (value) => {\n for (const [token, max] of safeRegexReplacements) {\n value = value\n .split(`${token}*`).join(`${token}{0,${max}}`)\n .split(`${token}+`).join(`${token}{1,${max}}`)\n }\n return value\n}\n\nconst createToken = (name, value, isGlobal) => {\n const safe = makeSafeRegex(value)\n const index = R++\n debug(name, index, value)\n t[name] = index\n src[index] = value\n safeSrc[index] = safe\n re[index] = new RegExp(value, isGlobal ? 'g' : undefined)\n safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)\n}\n\n// The following Regular Expressions can be used for tokenizing,\n// validating, and parsing SemVer version strings.\n\n// ## Numeric Identifier\n// A single `0`, or a non-zero digit followed by zero or more digits.\n\ncreateToken('NUMERICIDENTIFIER', '0|[1-9]\\\\d*')\ncreateToken('NUMERICIDENTIFIERLOOSE', '\\\\d+')\n\n// ## Non-numeric Identifier\n// Zero or more digits, followed by a letter or hyphen, and then zero or\n// more letters, digits, or hyphens.\n\ncreateToken('NONNUMERICIDENTIFIER', `\\\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)\n\n// ## Main Version\n// Three dot-separated numeric identifiers.\n\ncreateToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version Identifier\n// A numeric identifier, or a non-numeric identifier.\n// Non-numeric identifiers include numeric identifiers but can be longer.\n// Therefore non-numeric identifiers must go first.\n\ncreateToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version\n// Hyphen, followed by one or more dot-separated pre-release version\n// identifiers.\n\ncreateToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIER]})*))`)\n\ncreateToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)\n\n// ## Build Metadata Identifier\n// Any combination of digits, letters, or hyphens.\n\ncreateToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)\n\n// ## Build Metadata\n// Plus sign, followed by one or more period-separated build metadata\n// identifiers.\n\ncreateToken('BUILD', `(?:\\\\+(${src[t.BUILDIDENTIFIER]\n}(?:\\\\.${src[t.BUILDIDENTIFIER]})*))`)\n\n// ## Full Version String\n// A main version, followed optionally by a pre-release version and\n// build metadata.\n\n// Note that the only major, minor, patch, and pre-release sections of\n// the version string are capturing groups. The build metadata is not a\n// capturing group, because it should not ever be used in version\n// comparison.\n\ncreateToken('FULLPLAIN', `v?${src[t.MAINVERSION]\n}${src[t.PRERELEASE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('FULL', `^${src[t.FULLPLAIN]}$`)\n\n// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n// common in the npm registry.\ncreateToken('LOOSEPLAIN', `[v=\\\\s]*${src[t.MAINVERSIONLOOSE]\n}${src[t.PRERELEASELOOSE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)\n\ncreateToken('GTLT', '((?:<|>)?=?)')\n\n// Something like \"2.*\" or \"1.2.x\".\n// Note that \"x.x\" is a valid xRange identifier, meaning \"any version\"\n// Only the first item is strictly required.\ncreateToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`)\ncreateToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\\\*`)\n\ncreateToken('XRANGEPLAIN', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:${src[t.PRERELEASE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGEPLAINLOOSE', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:${src[t.PRERELEASELOOSE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAIN]}$`)\ncreateToken('XRANGELOOSE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Coercion.\n// Extract anything that could conceivably be a part of a valid semver\ncreateToken('COERCEPLAIN', `${'(^|[^\\\\d])' +\n '(\\\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)\ncreateToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\\\d])`)\ncreateToken('COERCEFULL', src[t.COERCEPLAIN] +\n `(?:${src[t.PRERELEASE]})?` +\n `(?:${src[t.BUILD]})?` +\n `(?:$|[^\\\\d])`)\ncreateToken('COERCERTL', src[t.COERCE], true)\ncreateToken('COERCERTLFULL', src[t.COERCEFULL], true)\n\n// Tilde ranges.\n// Meaning is \"reasonably at or greater than\"\ncreateToken('LONETILDE', '(?:~>?)')\n\ncreateToken('TILDETRIM', `(\\\\s*)${src[t.LONETILDE]}\\\\s+`, true)\nexports.tildeTrimReplace = '$1~'\n\ncreateToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Caret ranges.\n// Meaning is \"at least and backwards compatible with\"\ncreateToken('LONECARET', '(?:\\\\^)')\n\ncreateToken('CARETTRIM', `(\\\\s*)${src[t.LONECARET]}\\\\s+`, true)\nexports.caretTrimReplace = '$1^'\n\ncreateToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\ncreateToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]})$|^$`)\ncreateToken('COMPARATOR', `^${src[t.GTLT]}\\\\s*(${src[t.FULLPLAIN]})$|^$`)\n\n// An expression to strip any whitespace between the gtlt and the thing\n// it modifies, so that `> 1.2.3` ==> `>1.2.3`\ncreateToken('COMPARATORTRIM', `(\\\\s*)${src[t.GTLT]\n}\\\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)\nexports.comparatorTrimReplace = '$1$2$3'\n\n// Something like `1.2.3 - 1.2.4`\n// Note that these all use the loose form, because they'll be\n// checked against either the strict or loose comparator form\n// later.\ncreateToken('HYPHENRANGE', `^\\\\s*(${src[t.XRANGEPLAIN]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAIN]})` +\n `\\\\s*$`)\n\ncreateToken('HYPHENRANGELOOSE', `^\\\\s*(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s*$`)\n\n// Star ranges basically just allow anything at all.\ncreateToken('STAR', '(<|>)?=?\\\\s*\\\\*')\n// >=0.0.0 is like a star\ncreateToken('GTE0', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$')\ncreateToken('GTE0PRE', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$')\n","'use strict'\n\n// parse out just the options we care about\nconst looseOption = Object.freeze({ loose: true })\nconst emptyOpts = Object.freeze({ })\nconst parseOptions = options => {\n if (!options) {\n return emptyOpts\n }\n\n if (typeof options !== 'object') {\n return looseOption\n }\n\n return options\n}\nmodule.exports = parseOptions\n","'use strict'\n\nconst numeric = /^[0-9]+$/\nconst compareIdentifiers = (a, b) => {\n if (typeof a === 'number' && typeof b === 'number') {\n return a === b ? 0 : a < b ? -1 : 1\n }\n\n const anum = numeric.test(a)\n const bnum = numeric.test(b)\n\n if (anum && bnum) {\n a = +a\n b = +b\n }\n\n return a === b ? 0\n : (anum && !bnum) ? -1\n : (bnum && !anum) ? 1\n : a < b ? -1\n : 1\n}\n\nconst rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)\n\nmodule.exports = {\n compareIdentifiers,\n rcompareIdentifiers,\n}\n","'use strict'\n\nconst debug = require('../internal/debug')\nconst { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst parseOptions = require('../internal/parse-options')\nconst { compareIdentifiers } = require('../internal/identifiers')\n\nconst isPrereleaseIdentifier = (prerelease, identifier) => {\n const identifiers = identifier.split('.')\n if (identifiers.length > prerelease.length) {\n return false\n }\n\n for (let i = 0; i < identifiers.length; i++) {\n if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) {\n return false\n }\n }\n\n return true\n}\n\nclass SemVer {\n constructor (version, options) {\n options = parseOptions(options)\n\n if (version instanceof SemVer) {\n if (version.loose === !!options.loose &&\n version.includePrerelease === !!options.includePrerelease) {\n return version\n } else {\n version = version.version\n }\n } else if (typeof version !== 'string') {\n throw new TypeError(`Invalid version. Must be a string. Got type \"${typeof version}\".`)\n }\n\n if (version.length > MAX_LENGTH) {\n throw new TypeError(\n `version is longer than ${MAX_LENGTH} characters`\n )\n }\n\n debug('SemVer', version, options)\n this.options = options\n this.loose = !!options.loose\n // this isn't actually relevant for versions, but keep it so that we\n // don't run into trouble passing this.options around.\n this.includePrerelease = !!options.includePrerelease\n\n const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])\n\n if (!m) {\n throw new TypeError(`Invalid Version: ${version}`)\n }\n\n this.raw = version\n\n // these are actually numbers\n this.major = +m[1]\n this.minor = +m[2]\n this.patch = +m[3]\n\n if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n throw new TypeError('Invalid major version')\n }\n\n if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n throw new TypeError('Invalid minor version')\n }\n\n if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n throw new TypeError('Invalid patch version')\n }\n\n // numberify any prerelease numeric ids\n if (!m[4]) {\n this.prerelease = []\n } else {\n this.prerelease = m[4].split('.').map((id) => {\n if (/^[0-9]+$/.test(id)) {\n const num = +id\n if (num >= 0 && num < MAX_SAFE_INTEGER) {\n return num\n }\n }\n return id\n })\n }\n\n this.build = m[5] ? m[5].split('.') : []\n this.format()\n }\n\n format () {\n this.version = `${this.major}.${this.minor}.${this.patch}`\n if (this.prerelease.length) {\n this.version += `-${this.prerelease.join('.')}`\n }\n return this.version\n }\n\n toString () {\n return this.version\n }\n\n compare (other) {\n debug('SemVer.compare', this.version, this.options, other)\n if (!(other instanceof SemVer)) {\n if (typeof other === 'string' && other === this.version) {\n return 0\n }\n other = new SemVer(other, this.options)\n }\n\n if (other.version === this.version) {\n return 0\n }\n\n return this.compareMain(other) || this.comparePre(other)\n }\n\n compareMain (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n if (this.major < other.major) {\n return -1\n }\n if (this.major > other.major) {\n return 1\n }\n if (this.minor < other.minor) {\n return -1\n }\n if (this.minor > other.minor) {\n return 1\n }\n if (this.patch < other.patch) {\n return -1\n }\n if (this.patch > other.patch) {\n return 1\n }\n return 0\n }\n\n comparePre (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length) {\n return -1\n } else if (!this.prerelease.length && other.prerelease.length) {\n return 1\n } else if (!this.prerelease.length && !other.prerelease.length) {\n return 0\n }\n\n let i = 0\n do {\n const a = this.prerelease[i]\n const b = other.prerelease[i]\n debug('prerelease compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n compareBuild (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n let i = 0\n do {\n const a = this.build[i]\n const b = other.build[i]\n debug('build compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n // preminor will bump the version up to the next minor release, and immediately\n // down to pre-release. premajor and prepatch work the same way.\n inc (release, identifier, identifierBase) {\n if (release.startsWith('pre')) {\n if (!identifier && identifierBase === false) {\n throw new Error('invalid increment argument: identifier is empty')\n }\n // Avoid an invalid semver results\n if (identifier) {\n const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])\n if (!match || match[1] !== identifier) {\n throw new Error(`invalid identifier: ${identifier}`)\n }\n }\n }\n\n switch (release) {\n case 'premajor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor = 0\n this.major++\n this.inc('pre', identifier, identifierBase)\n break\n case 'preminor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor++\n this.inc('pre', identifier, identifierBase)\n break\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0\n this.inc('patch', identifier, identifierBase)\n this.inc('pre', identifier, identifierBase)\n break\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0) {\n this.inc('patch', identifier, identifierBase)\n }\n this.inc('pre', identifier, identifierBase)\n break\n case 'release':\n if (this.prerelease.length === 0) {\n throw new Error(`version ${this.raw} is not a prerelease`)\n }\n this.prerelease.length = 0\n break\n\n case 'major':\n // If this is a pre-major version, bump up to the same major version.\n // Otherwise increment major.\n // 1.0.0-5 bumps to 1.0.0\n // 1.1.0 bumps to 2.0.0\n if (\n this.minor !== 0 ||\n this.patch !== 0 ||\n this.prerelease.length === 0\n ) {\n this.major++\n }\n this.minor = 0\n this.patch = 0\n this.prerelease = []\n break\n case 'minor':\n // If this is a pre-minor version, bump up to the same minor version.\n // Otherwise increment minor.\n // 1.2.0-5 bumps to 1.2.0\n // 1.2.1 bumps to 1.3.0\n if (this.patch !== 0 || this.prerelease.length === 0) {\n this.minor++\n }\n this.patch = 0\n this.prerelease = []\n break\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0) {\n this.patch++\n }\n this.prerelease = []\n break\n // This probably shouldn't be used publicly.\n // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.\n case 'pre': {\n const base = Number(identifierBase) ? 1 : 0\n\n if (this.prerelease.length === 0) {\n this.prerelease = [base]\n } else {\n let i = this.prerelease.length\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++\n i = -2\n }\n }\n if (i === -1) {\n // didn't increment anything\n if (identifier === this.prerelease.join('.') && identifierBase === false) {\n throw new Error('invalid increment argument: identifier already exists')\n }\n this.prerelease.push(base)\n }\n }\n if (identifier) {\n // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n let prerelease = [identifier, base]\n if (identifierBase === false) {\n prerelease = [identifier]\n }\n if (isPrereleaseIdentifier(this.prerelease, identifier)) {\n const prereleaseBase = this.prerelease[identifier.split('.').length]\n if (isNaN(prereleaseBase)) {\n this.prerelease = prerelease\n }\n } else {\n this.prerelease = prerelease\n }\n }\n break\n }\n default:\n throw new Error(`invalid increment argument: ${release}`)\n }\n this.raw = this.format()\n if (this.build.length) {\n this.raw += `+${this.build.join('.')}`\n }\n return this\n }\n}\n\nmodule.exports = SemVer\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst parse = (version, options, throwErrors = false) => {\n if (version instanceof SemVer) {\n return version\n }\n try {\n return new SemVer(version, options)\n } catch (er) {\n if (!throwErrors) {\n return null\n }\n throw er\n }\n}\n\nmodule.exports = parse\n","'use strict'\n\nconst parse = require('./parse')\nconst valid = (version, options) => {\n const v = parse(version, options)\n return v ? v.version : null\n}\nmodule.exports = valid\n","'use strict'\n\nconst parse = require('./parse')\nconst clean = (version, options) => {\n const s = parse(version.trim().replace(/^[=v]+/, ''), options)\n return s ? s.version : null\n}\nmodule.exports = clean\n","'use strict'\n\nconst SemVer = require('../classes/semver')\n\nconst inc = (version, release, options, identifier, identifierBase) => {\n if (typeof (options) === 'string') {\n identifierBase = identifier\n identifier = options\n options = undefined\n }\n\n try {\n return new SemVer(\n version instanceof SemVer ? version.version : version,\n options\n ).inc(release, identifier, identifierBase).version\n } catch (er) {\n return null\n }\n}\nmodule.exports = inc\n","'use strict'\n\nconst parse = require('./parse.js')\n\nconst diff = (version1, version2) => {\n const v1 = parse(version1, null, true)\n const v2 = parse(version2, null, true)\n const comparison = v1.compare(v2)\n\n if (comparison === 0) {\n return null\n }\n\n const v1Higher = comparison > 0\n const highVersion = v1Higher ? v1 : v2\n const lowVersion = v1Higher ? v2 : v1\n const highHasPre = !!highVersion.prerelease.length\n const lowHasPre = !!lowVersion.prerelease.length\n\n if (lowHasPre && !highHasPre) {\n // Going from prerelease -> no prerelease requires some special casing\n\n // If the low version has only a major, then it will always be a major\n // Some examples:\n // 1.0.0-1 -> 1.0.0\n // 1.0.0-1 -> 1.1.1\n // 1.0.0-1 -> 2.0.0\n if (!lowVersion.patch && !lowVersion.minor) {\n return 'major'\n }\n\n // If the main part has no difference\n if (lowVersion.compareMain(highVersion) === 0) {\n if (lowVersion.minor && !lowVersion.patch) {\n return 'minor'\n }\n return 'patch'\n }\n }\n\n // add the `pre` prefix if we are going to a prerelease version\n const prefix = highHasPre ? 'pre' : ''\n\n if (v1.major !== v2.major) {\n return prefix + 'major'\n }\n\n if (v1.minor !== v2.minor) {\n return prefix + 'minor'\n }\n\n if (v1.patch !== v2.patch) {\n return prefix + 'patch'\n }\n\n // high and low are prereleases\n return 'prerelease'\n}\n\nmodule.exports = diff\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst major = (a, loose) => new SemVer(a, loose).major\nmodule.exports = major\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst minor = (a, loose) => new SemVer(a, loose).minor\nmodule.exports = minor\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst patch = (a, loose) => new SemVer(a, loose).patch\nmodule.exports = patch\n","'use strict'\n\nconst parse = require('./parse')\nconst prerelease = (version, options) => {\n const parsed = parse(version, options)\n return (parsed && parsed.prerelease.length) ? parsed.prerelease : null\n}\nmodule.exports = prerelease\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst compare = (a, b, loose) =>\n new SemVer(a, loose).compare(new SemVer(b, loose))\n\nmodule.exports = compare\n","'use strict'\n\nconst compare = require('./compare')\nconst rcompare = (a, b, loose) => compare(b, a, loose)\nmodule.exports = rcompare\n","'use strict'\n\nconst compare = require('./compare')\nconst compareLoose = (a, b) => compare(a, b, true)\nmodule.exports = compareLoose\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst compareBuild = (a, b, loose) => {\n const versionA = new SemVer(a, loose)\n const versionB = new SemVer(b, loose)\n return versionA.compare(versionB) || versionA.compareBuild(versionB)\n}\nmodule.exports = compareBuild\n","'use strict'\n\nconst compareBuild = require('./compare-build')\nconst sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))\nmodule.exports = sort\n","'use strict'\n\nconst compareBuild = require('./compare-build')\nconst rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))\nmodule.exports = rsort\n","'use strict'\n\nconst compare = require('./compare')\nconst gt = (a, b, loose) => compare(a, b, loose) > 0\nmodule.exports = gt\n","'use strict'\n\nconst compare = require('./compare')\nconst lt = (a, b, loose) => compare(a, b, loose) < 0\nmodule.exports = lt\n","'use strict'\n\nconst compare = require('./compare')\nconst eq = (a, b, loose) => compare(a, b, loose) === 0\nmodule.exports = eq\n","'use strict'\n\nconst compare = require('./compare')\nconst neq = (a, b, loose) => compare(a, b, loose) !== 0\nmodule.exports = neq\n","'use strict'\n\nconst compare = require('./compare')\nconst gte = (a, b, loose) => compare(a, b, loose) >= 0\nmodule.exports = gte\n","'use strict'\n\nconst compare = require('./compare')\nconst lte = (a, b, loose) => compare(a, b, loose) <= 0\nmodule.exports = lte\n","'use strict'\n\nconst eq = require('./eq')\nconst neq = require('./neq')\nconst gt = require('./gt')\nconst gte = require('./gte')\nconst lt = require('./lt')\nconst lte = require('./lte')\n\nconst cmp = (a, op, b, loose) => {\n switch (op) {\n case '===':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a === b\n\n case '!==':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a !== b\n\n case '':\n case '=':\n case '==':\n return eq(a, b, loose)\n\n case '!=':\n return neq(a, b, loose)\n\n case '>':\n return gt(a, b, loose)\n\n case '>=':\n return gte(a, b, loose)\n\n case '<':\n return lt(a, b, loose)\n\n case '<=':\n return lte(a, b, loose)\n\n default:\n throw new TypeError(`Invalid operator: ${op}`)\n }\n}\nmodule.exports = cmp\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst parse = require('./parse')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst coerce = (version, options) => {\n if (version instanceof SemVer) {\n return version\n }\n\n if (typeof version === 'number') {\n version = String(version)\n }\n\n if (typeof version !== 'string') {\n return null\n }\n\n options = options || {}\n\n let match = null\n if (!options.rtl) {\n match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE])\n } else {\n // Find the right-most coercible string that does not share\n // a terminus with a more left-ward coercible string.\n // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'\n // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4'\n //\n // Walk through the string checking with a /g regexp\n // Manually set the index so as to pick up overlapping matches.\n // Stop when we get a match that ends at the string end, since no\n // coercible string can be more right-ward without the same terminus.\n const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL]\n let next\n while ((next = coerceRtlRegex.exec(version)) &&\n (!match || match.index + match[0].length !== version.length)\n ) {\n if (!match ||\n next.index + next[0].length !== match.index + match[0].length) {\n match = next\n }\n coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length\n }\n // leave it in a clean state\n coerceRtlRegex.lastIndex = -1\n }\n\n if (match === null) {\n return null\n }\n\n const major = match[2]\n const minor = match[3] || '0'\n const patch = match[4] || '0'\n const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : ''\n const build = options.includePrerelease && match[6] ? `+${match[6]}` : ''\n\n return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options)\n}\nmodule.exports = coerce\n","'use strict'\n\nconst parse = require('./parse')\nconst constants = require('../internal/constants')\nconst SemVer = require('../classes/semver')\n\nconst truncate = (version, truncation, options) => {\n if (!constants.RELEASE_TYPES.includes(truncation)) {\n return null\n }\n\n const clonedVersion = cloneInputVersion(version, options)\n return clonedVersion && doTruncation(clonedVersion, truncation)\n}\n\nconst cloneInputVersion = (version, options) => {\n const versionStringToParse = (\n version instanceof SemVer ? version.version : version\n )\n\n return parse(versionStringToParse, options)\n}\n\nconst doTruncation = (version, truncation) => {\n if (isPrerelease(truncation)) {\n return version.version\n }\n\n version.prerelease = []\n\n switch (truncation) {\n case 'major':\n version.minor = 0\n version.patch = 0\n break\n case 'minor':\n version.patch = 0\n break\n }\n\n return version.format()\n}\n\nconst isPrerelease = (type) => {\n return type.startsWith('pre')\n}\n\nmodule.exports = truncate\n","'use strict'\n\nclass LRUCache {\n constructor () {\n this.max = 1000\n this.map = new Map()\n }\n\n get (key) {\n const value = this.map.get(key)\n if (value === undefined) {\n return undefined\n } else {\n // Remove the key from the map and add it to the end\n this.map.delete(key)\n this.map.set(key, value)\n return value\n }\n }\n\n delete (key) {\n return this.map.delete(key)\n }\n\n set (key, value) {\n const deleted = this.delete(key)\n\n if (!deleted && value !== undefined) {\n // If cache is full, delete the least recently used item\n if (this.map.size >= this.max) {\n const firstKey = this.map.keys().next().value\n this.delete(firstKey)\n }\n\n this.map.set(key, value)\n }\n\n return this\n }\n}\n\nmodule.exports = LRUCache\n","'use strict'\n\nconst SPACE_CHARACTERS = /\\s+/g\n\n// hoisted class for cyclic dependency\nclass Range {\n constructor (range, options) {\n options = parseOptions(options)\n\n if (range instanceof Range) {\n if (\n range.loose === !!options.loose &&\n range.includePrerelease === !!options.includePrerelease\n ) {\n return range\n } else {\n return new Range(range.raw, options)\n }\n }\n\n if (range instanceof Comparator) {\n // just put it in the set and return\n this.raw = range.value\n this.set = [[range]]\n this.formatted = undefined\n return this\n }\n\n this.options = options\n this.loose = !!options.loose\n this.includePrerelease = !!options.includePrerelease\n\n // First reduce all whitespace as much as possible so we do not have to rely\n // on potentially slow regexes like \\s*. This is then stored and used for\n // future error messages as well.\n this.raw = range.trim().replace(SPACE_CHARACTERS, ' ')\n\n // First, split on ||\n this.set = this.raw\n .split('||')\n // map the range to a 2d array of comparators\n .map(r => this.parseRange(r.trim()))\n // throw out any comparator lists that are empty\n // this generally means that it was not a valid range, which is allowed\n // in loose mode, but will still throw if the WHOLE range is invalid.\n .filter(c => c.length)\n\n if (!this.set.length) {\n throw new TypeError(`Invalid SemVer Range: ${this.raw}`)\n }\n\n // if we have any that are not the null set, throw out null sets.\n if (this.set.length > 1) {\n // keep the first one, in case they're all null sets\n const first = this.set[0]\n this.set = this.set.filter(c => !isNullSet(c[0]))\n if (this.set.length === 0) {\n this.set = [first]\n } else if (this.set.length > 1) {\n // if we have any that are *, then the range is just *\n for (const c of this.set) {\n if (c.length === 1 && isAny(c[0])) {\n this.set = [c]\n break\n }\n }\n }\n }\n\n this.formatted = undefined\n }\n\n get range () {\n if (this.formatted === undefined) {\n this.formatted = ''\n for (let i = 0; i < this.set.length; i++) {\n if (i > 0) {\n this.formatted += '||'\n }\n const comps = this.set[i]\n for (let k = 0; k < comps.length; k++) {\n if (k > 0) {\n this.formatted += ' '\n }\n this.formatted += comps[k].toString().trim()\n }\n }\n }\n return this.formatted\n }\n\n format () {\n return this.range\n }\n\n toString () {\n return this.range\n }\n\n parseRange (range) {\n // strip build metadata so it can't bleed into the version\n range = range.replace(BUILDSTRIPRE, '')\n\n // memoize range parsing for performance.\n // this is a very hot path, and fully deterministic.\n const memoOpts =\n (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |\n (this.options.loose && FLAG_LOOSE)\n const memoKey = memoOpts + ':' + range\n const cached = cache.get(memoKey)\n if (cached) {\n return cached\n }\n\n const loose = this.options.loose\n // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]\n range = range.replace(hr, hyphenReplace(this.options.includePrerelease))\n debug('hyphen replace', range)\n\n // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)\n debug('comparator trim', range)\n\n // `~ 1.2.3` => `~1.2.3`\n range = range.replace(re[t.TILDETRIM], tildeTrimReplace)\n debug('tilde trim', range)\n\n // `^ 1.2.3` => `^1.2.3`\n range = range.replace(re[t.CARETTRIM], caretTrimReplace)\n debug('caret trim', range)\n\n // At this point, the range is completely trimmed and\n // ready to be split into comparators.\n\n let rangeList = range\n .split(' ')\n .map(comp => parseComparator(comp, this.options))\n .join(' ')\n .split(/\\s+/)\n // >=0.0.0 is equivalent to *\n .map(comp => replaceGTE0(comp, this.options))\n\n if (loose) {\n // in loose mode, throw out any that are not valid comparators\n rangeList = rangeList.filter(comp => {\n debug('loose invalid filter', comp, this.options)\n return !!comp.match(re[t.COMPARATORLOOSE])\n })\n }\n debug('range list', rangeList)\n\n // if any comparators are the null set, then replace with JUST null set\n // if more than one comparator, remove any * comparators\n // also, don't include the same comparator more than once\n const rangeMap = new Map()\n const comparators = rangeList.map(comp => new Comparator(comp, this.options))\n for (const comp of comparators) {\n if (isNullSet(comp)) {\n return [comp]\n }\n rangeMap.set(comp.value, comp)\n }\n if (rangeMap.size > 1 && rangeMap.has('')) {\n rangeMap.delete('')\n }\n\n const result = [...rangeMap.values()]\n cache.set(memoKey, result)\n return result\n }\n\n intersects (range, options) {\n if (!(range instanceof Range)) {\n throw new TypeError('a Range is required')\n }\n\n return this.set.some((thisComparators) => {\n return (\n isSatisfiable(thisComparators, options) &&\n range.set.some((rangeComparators) => {\n return (\n isSatisfiable(rangeComparators, options) &&\n thisComparators.every((thisComparator) => {\n return rangeComparators.every((rangeComparator) => {\n return thisComparator.intersects(rangeComparator, options)\n })\n })\n )\n })\n )\n })\n }\n\n // if ANY of the sets match ALL of its comparators, then pass\n test (version) {\n if (!version) {\n return false\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n for (let i = 0; i < this.set.length; i++) {\n if (testSet(this.set[i], version, this.options)) {\n return true\n }\n }\n return false\n }\n}\n\nmodule.exports = Range\n\nconst LRU = require('../internal/lrucache')\nconst cache = new LRU()\n\nconst parseOptions = require('../internal/parse-options')\nconst Comparator = require('./comparator')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst {\n safeRe: re,\n src,\n t,\n comparatorTrimReplace,\n tildeTrimReplace,\n caretTrimReplace,\n} = require('../internal/re')\nconst { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants')\n\n// unbounded global build-metadata stripper used by parseRange\nconst BUILDSTRIPRE = new RegExp(src[t.BUILD], 'g')\n\nconst isNullSet = c => c.value === '<0.0.0-0'\nconst isAny = c => c.value === ''\n\n// take a set of comparators and determine whether there\n// exists a version which can satisfy it\nconst isSatisfiable = (comparators, options) => {\n let result = true\n const remainingComparators = comparators.slice()\n let testComparator = remainingComparators.pop()\n\n while (result && remainingComparators.length) {\n result = remainingComparators.every((otherComparator) => {\n return testComparator.intersects(otherComparator, options)\n })\n\n testComparator = remainingComparators.pop()\n }\n\n return result\n}\n\n// comprised of xranges, tildes, stars, and gtlt's at this point.\n// already replaced the hyphen ranges\n// turn into a set of JUST comparators.\nconst parseComparator = (comp, options) => {\n comp = comp.replace(re[t.BUILD], '')\n debug('comp', comp, options)\n comp = replaceCarets(comp, options)\n debug('caret', comp)\n comp = replaceTildes(comp, options)\n debug('tildes', comp)\n comp = replaceXRanges(comp, options)\n debug('xrange', comp)\n comp = replaceStars(comp, options)\n debug('stars', comp)\n return comp\n}\n\nconst isX = id => !id || id.toLowerCase() === 'x' || id === '*'\n\nconst invalidXRangeOrder = (M, m, p) => (\n (isX(M) && !isX(m)) ||\n (isX(m) && p && !isX(p))\n)\n\n// ~, ~> --> * (any, kinda silly)\n// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0\n// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0\n// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0\n// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0\n// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0\n// ~0.0.1 --> >=0.0.1 <0.1.0-0\nconst replaceTildes = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceTilde(c, options))\n .join(' ')\n}\n\nconst replaceTilde = (comp, options) => {\n const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]\n // if we're including prereleases in the match, then the lower bound is\n // -0, the lowest possible prerelease value, just like x-ranges and carets.\n // this keeps `~1.2` equivalent to the `1.2.x` x-range it's documented as.\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('tilde', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n // ~1.2 == >=1.2.0 <1.3.0-0\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else if (pr) {\n debug('replaceTilde pr', pr)\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n } else {\n // ~1.2.3 == >=1.2.3 <1.3.0-0\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('tilde return', ret)\n return ret\n })\n}\n\n// ^ --> * (any, kinda silly)\n// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0\n// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0\n// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0\n// ^1.2.3 --> >=1.2.3 <2.0.0-0\n// ^1.2.0 --> >=1.2.0 <2.0.0-0\n// ^0.0.1 --> >=0.0.1 <0.0.2-0\n// ^0.1.0 --> >=0.1.0 <0.2.0-0\nconst replaceCarets = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceCaret(c, options))\n .join(' ')\n}\n\nconst replaceCaret = (comp, options) => {\n debug('caret', comp, options)\n const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('caret', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n if (M === '0') {\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else {\n ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`\n }\n } else if (pr) {\n debug('replaceCaret pr', pr)\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${+M + 1}.0.0-0`\n }\n } else {\n debug('no pr')\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p\n } <${+M + 1}.0.0-0`\n }\n }\n\n debug('caret return', ret)\n return ret\n })\n}\n\nconst replaceXRanges = (comp, options) => {\n debug('replaceXRanges', comp, options)\n return comp\n .split(/\\s+/)\n .map((c) => replaceXRange(c, options))\n .join(' ')\n}\n\nconst replaceXRange = (comp, options) => {\n comp = comp.trim()\n const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]\n return comp.replace(r, (ret, gtlt, M, m, p, pr) => {\n debug('xRange', comp, ret, gtlt, M, m, p, pr)\n if (invalidXRangeOrder(M, m, p)) {\n return comp\n }\n\n const xM = isX(M)\n const xm = xM || isX(m)\n const xp = xm || isX(p)\n const anyX = xp\n\n if (gtlt === '=' && anyX) {\n gtlt = ''\n }\n\n // if we're including prereleases in the match, then we need\n // to fix this to -0, the lowest possible prerelease value\n pr = options.includePrerelease ? '-0' : ''\n\n if (xM) {\n if (gtlt === '>' || gtlt === '<') {\n // nothing is allowed\n ret = '<0.0.0-0'\n } else {\n // nothing is forbidden\n ret = '*'\n }\n } else if (gtlt && anyX) {\n // we know patch is an x, because we have any x at all.\n // replace X with 0\n if (xm) {\n m = 0\n }\n p = 0\n\n if (gtlt === '>') {\n // >1 => >=2.0.0\n // >1.2 => >=1.3.0\n gtlt = '>='\n if (xm) {\n M = +M + 1\n m = 0\n p = 0\n } else {\n m = +m + 1\n p = 0\n }\n } else if (gtlt === '<=') {\n // <=0.7.x is actually <0.8.0, since any 0.7.x should\n // pass. Similarly, <=7.x is actually <8.0.0, etc.\n gtlt = '<'\n if (xm) {\n M = +M + 1\n } else {\n m = +m + 1\n }\n }\n\n if (gtlt === '<') {\n pr = '-0'\n }\n\n ret = `${gtlt + M}.${m}.${p}${pr}`\n } else if (xm) {\n ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`\n } else if (xp) {\n ret = `>=${M}.${m}.0${pr\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('xRange return', ret)\n\n return ret\n })\n}\n\n// Because * is AND-ed with everything else in the comparator,\n// and '' means \"any version\", just remove the *s entirely.\nconst replaceStars = (comp, options) => {\n debug('replaceStars', comp, options)\n // Looseness is ignored here. star is always as loose as it gets!\n return comp\n .trim()\n .replace(re[t.STAR], '')\n}\n\nconst replaceGTE0 = (comp, options) => {\n debug('replaceGTE0', comp, options)\n return comp\n .trim()\n .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')\n}\n\n// This function is passed to string.replace(re[t.HYPHENRANGE])\n// M, m, patch, prerelease, build\n// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do\n// 1.2 - 3.4 => >=1.2.0 <3.5.0-0\n// TODO build?\nconst hyphenReplace = incPr => ($0,\n from, fM, fm, fp, fpr, fb,\n to, tM, tm, tp, tpr) => {\n if (isX(fM)) {\n from = ''\n } else if (isX(fm)) {\n from = `>=${fM}.0.0${incPr ? '-0' : ''}`\n } else if (isX(fp)) {\n from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`\n } else if (fpr) {\n from = `>=${from}`\n } else {\n from = `>=${from}${incPr ? '-0' : ''}`\n }\n\n if (isX(tM)) {\n to = ''\n } else if (isX(tm)) {\n to = `<${+tM + 1}.0.0-0`\n } else if (isX(tp)) {\n to = `<${tM}.${+tm + 1}.0-0`\n } else if (tpr) {\n to = `<=${tM}.${tm}.${tp}-${tpr}`\n } else if (incPr) {\n to = `<${tM}.${tm}.${+tp + 1}-0`\n } else {\n to = `<=${to}`\n }\n\n return `${from} ${to}`.trim()\n}\n\nconst testSet = (set, version, options) => {\n for (let i = 0; i < set.length; i++) {\n if (!set[i].test(version)) {\n return false\n }\n }\n\n if (version.prerelease.length && !options.includePrerelease) {\n // Find the set of versions that are allowed to have prereleases\n // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n // That should allow `1.2.3-pr.2` to pass.\n // However, `1.2.4-alpha.notready` should NOT be allowed,\n // even though it's within the range set by the comparators.\n for (let i = 0; i < set.length; i++) {\n debug(set[i].semver)\n if (set[i].semver === Comparator.ANY) {\n continue\n }\n\n if (set[i].semver.prerelease.length > 0) {\n const allowed = set[i].semver\n if (allowed.major === version.major &&\n allowed.minor === version.minor &&\n allowed.patch === version.patch) {\n return true\n }\n }\n }\n\n // Version has a -pre, but it's not one of the ones we like.\n return false\n }\n\n return true\n}\n","'use strict'\n\nconst ANY = Symbol('SemVer ANY')\n// hoisted class for cyclic dependency\nclass Comparator {\n static get ANY () {\n return ANY\n }\n\n constructor (comp, options) {\n options = parseOptions(options)\n\n if (comp instanceof Comparator) {\n if (comp.loose === !!options.loose) {\n return comp\n } else {\n comp = comp.value\n }\n }\n\n comp = comp.trim().split(/\\s+/).join(' ')\n debug('comparator', comp, options)\n this.options = options\n this.loose = !!options.loose\n this.parse(comp)\n\n if (this.semver === ANY) {\n this.value = ''\n } else {\n this.value = this.operator + this.semver.version\n }\n\n debug('comp', this)\n }\n\n parse (comp) {\n const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]\n const m = comp.match(r)\n\n if (!m) {\n throw new TypeError(`Invalid comparator: ${comp}`)\n }\n\n this.operator = m[1] !== undefined ? m[1] : ''\n if (this.operator === '=') {\n this.operator = ''\n }\n\n // if it literally is just '>' or '' then allow anything.\n if (!m[2]) {\n this.semver = ANY\n } else {\n this.semver = new SemVer(m[2], this.options.loose)\n }\n }\n\n toString () {\n return this.value\n }\n\n test (version) {\n debug('Comparator.test', version, this.options.loose)\n\n if (this.semver === ANY || version === ANY) {\n return true\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n return cmp(version, this.operator, this.semver, this.options)\n }\n\n intersects (comp, options) {\n if (!(comp instanceof Comparator)) {\n throw new TypeError('a Comparator is required')\n }\n\n if (this.operator === '') {\n if (this.value === '') {\n return true\n }\n return new Range(comp.value, options).test(this.value)\n } else if (comp.operator === '') {\n if (comp.value === '') {\n return true\n }\n return new Range(this.value, options).test(comp.semver)\n }\n\n options = parseOptions(options)\n\n // Special cases where nothing can possibly be lower\n if (options.includePrerelease &&\n (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {\n return false\n }\n if (!options.includePrerelease &&\n (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {\n return false\n }\n\n // Same direction increasing (> or >=)\n if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {\n return true\n }\n // Same direction decreasing (< or <=)\n if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {\n return true\n }\n // same SemVer and both sides are inclusive (<= or >=)\n if (\n (this.semver.version === comp.semver.version) &&\n this.operator.includes('=') && comp.operator.includes('=')) {\n return true\n }\n // opposite directions less than\n if (cmp(this.semver, '<', comp.semver, options) &&\n this.operator.startsWith('>') && comp.operator.startsWith('<')) {\n return true\n }\n // opposite directions greater than\n if (cmp(this.semver, '>', comp.semver, options) &&\n this.operator.startsWith('<') && comp.operator.startsWith('>')) {\n return true\n }\n return false\n }\n}\n\nmodule.exports = Comparator\n\nconst parseOptions = require('../internal/parse-options')\nconst { safeRe: re, t } = require('../internal/re')\nconst cmp = require('../functions/cmp')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst Range = require('./range')\n","'use strict'\n\nconst Range = require('../classes/range')\nconst satisfies = (version, range, options) => {\n try {\n range = new Range(range, options)\n } catch (er) {\n return false\n }\n return range.test(version)\n}\nmodule.exports = satisfies\n","'use strict'\n\nconst Range = require('../classes/range')\n\n// Mostly just for testing and legacy API reasons\nconst toComparators = (range, options) =>\n new Range(range, options).set\n .map(comp => comp.map(c => c.value).join(' ').trim().split(' '))\n\nmodule.exports = toComparators\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\n\nconst maxSatisfying = (versions, range, options) => {\n let max = null\n let maxSV = null\n let rangeObj = null\n try {\n rangeObj = new Range(range, options)\n } catch (er) {\n return null\n }\n versions.forEach((v) => {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!max || maxSV.compare(v) === -1) {\n // compare(max, v, true)\n max = v\n maxSV = new SemVer(max, options)\n }\n }\n })\n return max\n}\nmodule.exports = maxSatisfying\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\nconst minSatisfying = (versions, range, options) => {\n let min = null\n let minSV = null\n let rangeObj = null\n try {\n rangeObj = new Range(range, options)\n } catch (er) {\n return null\n }\n versions.forEach((v) => {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!min || minSV.compare(v) === 1) {\n // compare(min, v, true)\n min = v\n minSV = new SemVer(min, options)\n }\n }\n })\n return min\n}\nmodule.exports = minSatisfying\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Range = require('../classes/range')\nconst gt = require('../functions/gt')\n\nconst minVersion = (range, loose) => {\n range = new Range(range, loose)\n\n let minver = new SemVer('0.0.0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = new SemVer('0.0.0-0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = null\n for (let i = 0; i < range.set.length; ++i) {\n const comparators = range.set[i]\n\n let setMin = null\n comparators.forEach((comparator) => {\n // Clone to avoid manipulating the comparator's semver object.\n const compver = new SemVer(comparator.semver.version)\n switch (comparator.operator) {\n case '>':\n if (compver.prerelease.length === 0) {\n compver.patch++\n } else {\n compver.prerelease.push(0)\n }\n compver.raw = compver.format()\n /* fallthrough */\n case '':\n case '>=':\n if (!setMin || gt(compver, setMin)) {\n setMin = compver\n }\n break\n case '<':\n case '<=':\n /* Ignore maximum versions */\n break\n /* istanbul ignore next */\n default:\n throw new Error(`Unexpected operation: ${comparator.operator}`)\n }\n })\n if (setMin && (!minver || gt(minver, setMin))) {\n minver = setMin\n }\n }\n\n if (minver && range.test(minver)) {\n return minver\n }\n\n return null\n}\nmodule.exports = minVersion\n","'use strict'\n\nconst Range = require('../classes/range')\nconst validRange = (range, options) => {\n try {\n // Return '*' instead of '' so that truthiness works.\n // This will throw if it's invalid anyway\n return new Range(range, options).range || '*'\n } catch (er) {\n return null\n }\n}\nmodule.exports = validRange\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst Comparator = require('../classes/comparator')\nconst { ANY } = Comparator\nconst Range = require('../classes/range')\nconst satisfies = require('../functions/satisfies')\nconst gt = require('../functions/gt')\nconst lt = require('../functions/lt')\nconst lte = require('../functions/lte')\nconst gte = require('../functions/gte')\n\nconst outside = (version, range, hilo, options) => {\n version = new SemVer(version, options)\n range = new Range(range, options)\n\n let gtfn, ltefn, ltfn, comp, ecomp\n switch (hilo) {\n case '>':\n gtfn = gt\n ltefn = lte\n ltfn = lt\n comp = '>'\n ecomp = '>='\n break\n case '<':\n gtfn = lt\n ltefn = gte\n ltfn = gt\n comp = '<'\n ecomp = '<='\n break\n default:\n throw new TypeError('Must provide a hilo val of \"<\" or \">\"')\n }\n\n // If it satisfies the range it is not outside\n if (satisfies(version, range, options)) {\n return false\n }\n\n // From now on, variable terms are as if we're in \"gtr\" mode.\n // but note that everything is flipped for the \"ltr\" function.\n\n for (let i = 0; i < range.set.length; ++i) {\n const comparators = range.set[i]\n\n let high = null\n let low = null\n\n comparators.forEach((comparator) => {\n if (comparator.semver === ANY) {\n comparator = new Comparator('>=0.0.0')\n }\n high = high || comparator\n low = low || comparator\n if (gtfn(comparator.semver, high.semver, options)) {\n high = comparator\n } else if (ltfn(comparator.semver, low.semver, options)) {\n low = comparator\n }\n })\n\n // If the edge version comparator has a operator then our version\n // isn't outside it\n if (high.operator === comp || high.operator === ecomp) {\n return false\n }\n\n // If the lowest version comparator has an operator and our version\n // is less than it then it isn't higher than the range\n if ((!low.operator || low.operator === comp) &&\n ltefn(version, low.semver)) {\n return false\n } else if (low.operator === ecomp && ltfn(version, low.semver)) {\n return false\n }\n }\n return true\n}\n\nmodule.exports = outside\n","'use strict'\n\n// Determine if version is greater than all the versions possible in the range.\nconst outside = require('./outside')\nconst gtr = (version, range, options) => outside(version, range, '>', options)\nmodule.exports = gtr\n","'use strict'\n\nconst outside = require('./outside')\n// Determine if version is less than all the versions possible in the range\nconst ltr = (version, range, options) => outside(version, range, '<', options)\nmodule.exports = ltr\n","'use strict'\n\nconst Range = require('../classes/range')\nconst intersects = (r1, r2, options) => {\n r1 = new Range(r1, options)\n r2 = new Range(r2, options)\n return r1.intersects(r2, options)\n}\nmodule.exports = intersects\n","'use strict'\n\n// given a set of versions and a range, create a \"simplified\" range\n// that includes the same versions that the original range does\n// If the original range is shorter than the simplified one, return that.\nconst satisfies = require('../functions/satisfies.js')\nconst compare = require('../functions/compare.js')\nmodule.exports = (versions, range, options) => {\n const set = []\n let first = null\n let prev = null\n const v = versions.sort((a, b) => compare(a, b, options))\n for (const version of v) {\n const included = satisfies(version, range, options)\n if (included) {\n prev = version\n if (!first) {\n first = version\n }\n } else {\n if (prev) {\n set.push([first, prev])\n }\n prev = null\n first = null\n }\n }\n if (first) {\n set.push([first, null])\n }\n\n const ranges = []\n for (const [min, max] of set) {\n if (min === max) {\n ranges.push(min)\n } else if (!max && min === v[0]) {\n ranges.push('*')\n } else if (!max) {\n ranges.push(`>=${min}`)\n } else if (min === v[0]) {\n ranges.push(`<=${max}`)\n } else {\n ranges.push(`${min} - ${max}`)\n }\n }\n const simplified = ranges.join(' || ')\n const original = typeof range.raw === 'string' ? range.raw : String(range)\n return simplified.length < original.length ? simplified : range\n}\n","'use strict'\n\nconst Range = require('../classes/range.js')\nconst Comparator = require('../classes/comparator.js')\nconst { ANY } = Comparator\nconst satisfies = require('../functions/satisfies.js')\nconst compare = require('../functions/compare.js')\n\n// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:\n// - Every simple range `r1, r2, ...` is a null set, OR\n// - Every simple range `r1, r2, ...` which is not a null set is a subset of\n// some `R1, R2, ...`\n//\n// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:\n// - If c is only the ANY comparator\n// - If C is only the ANY comparator, return true\n// - Else if in prerelease mode, return false\n// - else replace c with `[>=0.0.0]`\n// - If C is only the ANY comparator\n// - if in prerelease mode, return true\n// - else replace C with `[>=0.0.0]`\n// - Let EQ be the set of = comparators in c\n// - If EQ is more than one, return true (null set)\n// - Let GT be the highest > or >= comparator in c\n// - Let LT be the lowest < or <= comparator in c\n// - If GT and LT, and GT.semver > LT.semver, return true (null set)\n// - If any C is a = range, and GT or LT are set, return false\n// - If EQ\n// - If GT, and EQ does not satisfy GT, return true (null set)\n// - If LT, and EQ does not satisfy LT, return true (null set)\n// - If EQ satisfies every C, return true\n// - Else return false\n// - If GT\n// - If GT.semver is lower than any > or >= comp in C, return false\n// - If GT is >=, and GT.semver does not satisfy every C, return false\n// - If GT.semver has a prerelease, and not in prerelease mode\n// - If no C has a prerelease and the GT.semver tuple, return false\n// - If LT\n// - If LT.semver is greater than any < or <= comp in C, return false\n// - If LT is <=, and LT.semver does not satisfy every C, return false\n// - If LT.semver has a prerelease, and not in prerelease mode\n// - If no C has a prerelease and the LT.semver tuple, return false\n// - Else return true\n\nconst subset = (sub, dom, options = {}) => {\n if (sub === dom) {\n return true\n }\n\n sub = new Range(sub, options)\n dom = new Range(dom, options)\n let sawNonNull = false\n\n OUTER: for (const simpleSub of sub.set) {\n for (const simpleDom of dom.set) {\n const isSub = simpleSubset(simpleSub, simpleDom, options)\n sawNonNull = sawNonNull || isSub !== null\n if (isSub) {\n continue OUTER\n }\n }\n // the null set is a subset of everything, but null simple ranges in\n // a complex range should be ignored. so if we saw a non-null range,\n // then we know this isn't a subset, but if EVERY simple range was null,\n // then it is a subset.\n if (sawNonNull) {\n return false\n }\n }\n return true\n}\n\nconst minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')]\nconst minimumVersion = [new Comparator('>=0.0.0')]\n\nconst simpleSubset = (sub, dom, options) => {\n if (sub === dom) {\n return true\n }\n\n if (sub.length === 1 && sub[0].semver === ANY) {\n if (dom.length === 1 && dom[0].semver === ANY) {\n return true\n } else if (options.includePrerelease) {\n sub = minimumVersionWithPreRelease\n } else {\n sub = minimumVersion\n }\n }\n\n if (dom.length === 1 && dom[0].semver === ANY) {\n if (options.includePrerelease) {\n return true\n } else {\n dom = minimumVersion\n }\n }\n\n const eqSet = new Set()\n let gt, lt\n for (const c of sub) {\n if (c.operator === '>' || c.operator === '>=') {\n gt = higherGT(gt, c, options)\n } else if (c.operator === '<' || c.operator === '<=') {\n lt = lowerLT(lt, c, options)\n } else {\n eqSet.add(c.semver)\n }\n }\n\n if (eqSet.size > 1) {\n return null\n }\n\n let gtltComp\n if (gt && lt) {\n gtltComp = compare(gt.semver, lt.semver, options)\n if (gtltComp > 0) {\n return null\n } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {\n return null\n }\n }\n\n // will iterate one or zero times\n for (const eq of eqSet) {\n if (gt && !satisfies(eq, String(gt), options)) {\n return null\n }\n\n if (lt && !satisfies(eq, String(lt), options)) {\n return null\n }\n\n for (const c of dom) {\n if (!satisfies(eq, String(c), options)) {\n return false\n }\n }\n\n return true\n }\n\n let higher, lower\n let hasDomLT, hasDomGT\n // if the subset has a prerelease, we need a comparator in the superset\n // with the same tuple and a prerelease, or it's not a subset\n let needDomLTPre = lt &&\n !options.includePrerelease &&\n lt.semver.prerelease.length ? lt.semver : false\n let needDomGTPre = gt &&\n !options.includePrerelease &&\n gt.semver.prerelease.length ? gt.semver : false\n // exception: <1.2.3-0 is the same as <1.2.3\n if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&\n lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {\n needDomLTPre = false\n }\n\n for (const c of dom) {\n hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='\n hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='\n if (gt) {\n if (needDomGTPre) {\n if (c.semver.prerelease && c.semver.prerelease.length &&\n c.semver.major === needDomGTPre.major &&\n c.semver.minor === needDomGTPre.minor &&\n c.semver.patch === needDomGTPre.patch) {\n needDomGTPre = false\n }\n }\n if (c.operator === '>' || c.operator === '>=') {\n higher = higherGT(gt, c, options)\n if (higher === c && higher !== gt) {\n return false\n }\n } else if (gt.operator === '>=' && !c.test(gt.semver)) {\n return false\n }\n }\n if (lt) {\n if (needDomLTPre) {\n if (c.semver.prerelease && c.semver.prerelease.length &&\n c.semver.major === needDomLTPre.major &&\n c.semver.minor === needDomLTPre.minor &&\n c.semver.patch === needDomLTPre.patch) {\n needDomLTPre = false\n }\n }\n if (c.operator === '<' || c.operator === '<=') {\n lower = lowerLT(lt, c, options)\n if (lower === c && lower !== lt) {\n return false\n }\n } else if (lt.operator === '<=' && !c.test(lt.semver)) {\n return false\n }\n }\n if (!c.operator && (lt || gt) && gtltComp !== 0) {\n return false\n }\n }\n\n // if there was a < or >, and nothing in the dom, then must be false\n // UNLESS it was limited by another range in the other direction.\n // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0\n if (gt && hasDomLT && !lt && gtltComp !== 0) {\n return false\n }\n\n if (lt && hasDomGT && !gt && gtltComp !== 0) {\n return false\n }\n\n // we needed a prerelease range in a specific tuple, but didn't get one\n // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,\n // because it includes prereleases in the 1.2.3 tuple\n if (needDomGTPre || needDomLTPre) {\n return false\n }\n\n return true\n}\n\n// >=1.2.3 is lower than >1.2.3\nconst higherGT = (a, b, options) => {\n if (!a) {\n return b\n }\n const comp = compare(a.semver, b.semver, options)\n return comp > 0 ? a\n : comp < 0 ? b\n : b.operator === '>' && a.operator === '>=' ? b\n : a\n}\n\n// <=1.2.3 is higher than <1.2.3\nconst lowerLT = (a, b, options) => {\n if (!a) {\n return b\n }\n const comp = compare(a.semver, b.semver, options)\n return comp < 0 ? a\n : comp > 0 ? b\n : b.operator === '<' && a.operator === '<=' ? b\n : a\n}\n\nmodule.exports = subset\n","'use strict'\n\n// just pre-load all the stuff that index.js lazily exports\nconst internalRe = require('./internal/re')\nconst constants = require('./internal/constants')\nconst SemVer = require('./classes/semver')\nconst identifiers = require('./internal/identifiers')\nconst parse = require('./functions/parse')\nconst valid = require('./functions/valid')\nconst clean = require('./functions/clean')\nconst inc = require('./functions/inc')\nconst diff = require('./functions/diff')\nconst major = require('./functions/major')\nconst minor = require('./functions/minor')\nconst patch = require('./functions/patch')\nconst prerelease = require('./functions/prerelease')\nconst compare = require('./functions/compare')\nconst rcompare = require('./functions/rcompare')\nconst compareLoose = require('./functions/compare-loose')\nconst compareBuild = require('./functions/compare-build')\nconst sort = require('./functions/sort')\nconst rsort = require('./functions/rsort')\nconst gt = require('./functions/gt')\nconst lt = require('./functions/lt')\nconst eq = require('./functions/eq')\nconst neq = require('./functions/neq')\nconst gte = require('./functions/gte')\nconst lte = require('./functions/lte')\nconst cmp = require('./functions/cmp')\nconst coerce = require('./functions/coerce')\nconst truncate = require('./functions/truncate')\nconst Comparator = require('./classes/comparator')\nconst Range = require('./classes/range')\nconst satisfies = require('./functions/satisfies')\nconst toComparators = require('./ranges/to-comparators')\nconst maxSatisfying = require('./ranges/max-satisfying')\nconst minSatisfying = require('./ranges/min-satisfying')\nconst minVersion = require('./ranges/min-version')\nconst validRange = require('./ranges/valid')\nconst outside = require('./ranges/outside')\nconst gtr = require('./ranges/gtr')\nconst ltr = require('./ranges/ltr')\nconst intersects = require('./ranges/intersects')\nconst simplifyRange = require('./ranges/simplify')\nconst subset = require('./ranges/subset')\nmodule.exports = {\n parse,\n valid,\n clean,\n inc,\n diff,\n major,\n minor,\n patch,\n prerelease,\n compare,\n rcompare,\n compareLoose,\n compareBuild,\n sort,\n rsort,\n gt,\n lt,\n eq,\n neq,\n gte,\n lte,\n cmp,\n coerce,\n truncate,\n Comparator,\n Range,\n satisfies,\n toComparators,\n maxSatisfying,\n minSatisfying,\n minVersion,\n validRange,\n outside,\n gtr,\n ltr,\n intersects,\n simplifyRange,\n subset,\n SemVer,\n re: internalRe.re,\n src: internalRe.src,\n tokens: internalRe.t,\n SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,\n RELEASE_TYPES: constants.RELEASE_TYPES,\n compareIdentifiers: identifiers.compareIdentifiers,\n rcompareIdentifiers: identifiers.rcompareIdentifiers,\n}\n","import { Value } from \"@solve-js/vm/Value\";\nimport { BytecodeProgram } from \"@solve-js/parser/BytecodeBuilder\";\n\n/**\n * One line's compiled bytecode, plus the variables it reads and writes.\n *\n * The reads and writes are what let the dependency graph re-evaluate only the\n * lines an edit actually affected.\n */\nexport class LineCacheEntry {\n constructor(\n public result: Value,\n public bytecode: BytecodeProgram,\n public readVariables: string[],\n public writeVariable: string | null\n ) {}\n}\n\n/**\n * Per-line result + bytecode cache.\n *\n * Entries are stored in a two-level map (line number → expression → entry)\n * so per-line operations, getEntryForLine, removeAllForLine, are O(1)\n * lookups instead of scans over every cached key. Entries with no\n * expression are stored under the empty-string key.\n *\n * The string keys exposed by keys()/forEach() keep the historical\n * \"line\" / \"line:expression\" format for diagnostics consumers.\n *\n * INVARIANT: at most one entry per line number at a time. `set()` stores\n * the expression alongside the entry ONLY as a same-key staleness check for\n * `get(line, expression)`, a line's previous text is never meaningfully\n * cacheable once the line has moved on, since `get()`/`getEntryForLine()`\n * are only ever called with the line's CURRENT text (see\n * `ExpressionEngine.reEvaluateLine()`). Before this invariant was enforced,\n * every distinct keystroke state of a line accumulated its own entry here\n * forever (nothing ever called `remove()`/`removeAllForLine()` per-edit,\n * only a full `clear()` on document switch), an unbounded, session-long\n * memory leak reachable via ordinary typing, and a latent correctness bug\n * in `getEntryForLine()`, which picks \"first in insertion order\" and could\n * silently return a STALE entry from an old edit of the line instead of\n * its current one once more than one entry had piled up.\n */\nexport class LineCache {\n /** line number → (expression, or \"\" for expressionless entries) → entry */\n private byLine: Map<number, Map<string, LineCacheEntry>> = new Map();\n private count = 0;\n\n private static exprKey(expression?: string): string {\n return expression ?? \"\";\n }\n\n private static displayKey(line: number, exprKey: string): string {\n return exprKey === \"\" ? `${line}` : `${line}:${exprKey}`;\n }\n\n get(line: number, expression?: string): LineCacheEntry | undefined {\n return this.byLine.get(line)?.get(LineCache.exprKey(expression));\n }\n\n /** Find any cache entry for the given line number, regardless of expression suffix */\n getEntryForLine(line: number): LineCacheEntry | undefined {\n const entries = this.byLine.get(line);\n if (!entries) return undefined;\n // First entry in insertion order, matches the historical scan behavior.\n for (const entry of entries.values()) {\n return entry;\n }\n return undefined;\n }\n\n set(line: number, entry: LineCacheEntry, expression?: string): void {\n let entries = this.byLine.get(line);\n if (!entries) {\n entries = new Map();\n this.byLine.set(line, entries);\n }\n const key = LineCache.exprKey(expression);\n // Enforce the one-entry-per-line invariant (see class doc comment):\n // any entry under a DIFFERENT expression key for this same line is for\n // text this line no longer has, drop it rather than let it pile up.\n if (entries.size > 0 && !entries.has(key)) {\n this.count -= entries.size;\n entries.clear();\n }\n if (!entries.has(key)) this.count++;\n entries.set(key, entry);\n }\n\n has(line: number, expression?: string): boolean {\n return this.byLine.get(line)?.has(LineCache.exprKey(expression)) ?? false;\n }\n\n remove(line: number, expression?: string): void {\n const entries = this.byLine.get(line);\n if (!entries) return;\n if (entries.delete(LineCache.exprKey(expression))) {\n this.count--;\n if (entries.size === 0) this.byLine.delete(line);\n }\n }\n\n removeAllForLine(line: number): void {\n const entries = this.byLine.get(line);\n if (!entries) return;\n this.count -= entries.size;\n this.byLine.delete(line);\n }\n\n clearLine(line: number): void {\n this.removeAllForLine(line);\n }\n\n /**\n * Number of entries in the cache. Useful for diagnostics.\n */\n get size(): number {\n return this.count;\n }\n\n clear(): void {\n this.byLine.clear();\n this.count = 0;\n }\n\n /**\n * Iterate all cache entries for diagnostics/debugging.\n */\n forEach(callback: (key: string, entry: LineCacheEntry) => void): void {\n for (const [line, entries] of this.byLine) {\n for (const [exprKey, entry] of entries) {\n callback(LineCache.displayKey(line, exprKey), entry);\n }\n }\n }\n\n /**\n * Get all entry keys.\n */\n keys(): string[] {\n const result: string[] = [];\n for (const [line, entries] of this.byLine) {\n for (const exprKey of entries.keys()) {\n result.push(LineCache.displayKey(line, exprKey));\n }\n }\n return result;\n }\n}\n","import type { IEnginePackage } from \"@solve-js/api/PackageRegistry\";\n\n/**\n * Package load-time compatibility checking, the \"detect overlapping\n * logic between packages\" SDK surface.\n *\n * This engine's package system (`IEnginePackage`) has always had SOME\n * collision visibility, but it's inconsistent and scattered: `ParseletRegistry`\n * warns on a token-type overwrite, `asConverterRegistry` warns on a converter\n * name overwrite, and `PhraseTrie` warns on... nothing at all, a second\n * package fusing the exact same multi-word phrase to a different token type\n * silently wins with zero signal, the same class of gap\n * `ParseletRegistry.registerPrefix()`'s collision-visibility fix closed for\n * parselets specifically (see `ARCHITECTURE.md`'s punch list). And none of\n * these existing checks can be run BEFORE registration, they only fire at\n * the moment a collision actually happens, deep inside a live engine.\n *\n * `checkPackageCompatibility()` is a single, pure, side-effect-free function\n * that statically compares one candidate package's declared descriptor\n * against a list of already-registered packages' descriptors, across every\n * collision-capable field `IEnginePackage` has, callable standalone (a host\n * building a plugin marketplace could run it before ever constructing an\n * engine) or wired into registration itself (see\n * `ExpressionEngine.registerPackage()`, which calls this automatically and\n * logs every conflict found, the \"load-up resiliency\" half of this\n * mechanism).\n *\n * A real, concrete motivating bug (found the same session this module was\n * built): the currency package's real `IEnginePackage` descriptor\n * (`CurrencyPackage.ts`) and its parallel test-harness registration helper\n * (`parselets/index.ts`'s `registerCurrencyParselets()`) drifted out of sync\n *, new currency-symbol token types were wired into one but not the other\n * caught only by a test happening to exercise the stale path. This module\n * doesn't catch THAT specific class of bug (two hand-written registration\n * functions for the same logical package diverging is a source-consistency\n * problem, not a runtime collision), but it DOES catch the more common and\n * more dangerous sibling: two DIFFERENT, independently-authored packages\n * unknowingly claiming the same token type, phrase, converter name, plugin\n * function index, or lexer keyword.\n */\n\n/** How serious a detected conflict is. */\nexport type CompatibilitySeverity = \"error\" | \"warning\" | \"info\";\n\n/** The category of overlap detected between two packages. */\nexport type CompatibilityConflictKind =\n | \"prefixParseletTokenType\"\n | \"infixParseletTokenType\"\n | \"phrase\"\n | \"converterName\"\n | \"pluginFunctionIndex\"\n | \"lexerKeyword\"\n | \"lexerOperator\"\n | \"asyncResolverNamespace\"\n | \"tokenCategory\";\n\n/** One way two packages collide, for example claiming the same keyword. */\nexport interface CompatibilityConflict {\n kind: CompatibilityConflictKind;\n severity: CompatibilitySeverity;\n /** Human-readable description, safe to log directly. */\n detail: string;\n /** The two package names involved, [existing, candidate]. */\n packages: [string, string];\n}\n\n/** Every conflict found between a candidate package and those already registered. */\nexport interface CompatibilityReport {\n /** `false` iff at least one \"error\"-severity conflict was found. */\n compatible: boolean;\n conflicts: CompatibilityConflict[];\n}\n\nfunction collectParseletConflicts(\n kind: \"prefixParseletTokenType\" | \"infixParseletTokenType\",\n fieldName: \"prefixParselets\" | \"infixParselets\",\n existingPkg: IEnginePackage,\n candidate: IEnginePackage,\n out: CompatibilityConflict[],\n): void {\n const existingEntries = existingPkg[fieldName];\n const candidateEntries = candidate[fieldName];\n if (!existingEntries || !candidateEntries) return;\n const existingTypes = new Set(existingEntries.map((e) => e.tokenType));\n for (const entry of candidateEntries) {\n if (existingTypes.has(entry.tokenType)) {\n out.push({\n kind,\n // A different parselet INSTANCE silently wins at registration time\n // (matches ParseletRegistry.registerPrefix/registerInfix's own\n // \"warn on a genuinely different instance, stay quiet on idempotent\n // re-registration\" behavior), flagged as a warning, not an error\n // since deliberate override is sometimes the intended use (a\n // package explicitly built to replace a built-in's grammar).\n severity: \"warning\",\n detail: `Both \"${existingPkg.name}\" and \"${candidate.name}\" register a ${fieldName === \"prefixParselets\" ? \"prefix\" : \"infix\"} parselet for token type \"${entry.tokenType}\" — the later-registered one silently wins.`,\n packages: [existingPkg.name, candidate.name],\n });\n }\n }\n}\n\nfunction checkOnePackagePair(existingPkg: IEnginePackage, candidate: IEnginePackage): CompatibilityConflict[] {\n const conflicts: CompatibilityConflict[] = [];\n\n collectParseletConflicts(\"prefixParseletTokenType\", \"prefixParselets\", existingPkg, candidate, conflicts);\n collectParseletConflicts(\"infixParseletTokenType\", \"infixParselets\", existingPkg, candidate, conflicts);\n\n // Phrases, the ONE category with zero pre-existing runtime warning\n // anywhere (PhraseTrie silently overwrites on an exact-key collision).\n if (existingPkg.phrases && candidate.phrases) {\n for (const [phrase, tokenType] of Object.entries(candidate.phrases)) {\n const existingTokenType = existingPkg.phrases[phrase];\n if (existingTokenType !== undefined && existingTokenType !== tokenType) {\n conflicts.push({\n kind: \"phrase\",\n severity: \"warning\",\n detail: `Both \"${existingPkg.name}\" (-> \"${existingTokenType}\") and \"${candidate.name}\" (-> \"${tokenType}\") fuse the phrase \"${phrase}\" to DIFFERENT token types — PhraseTrie has no collision detection of its own, so the later-registered mapping silently wins with no other signal.`,\n packages: [existingPkg.name, candidate.name],\n });\n }\n }\n }\n\n // asConverters, mirrors registerAsConverter()'s own runtime warning, but\n // callable before either package is ever registered.\n if (existingPkg.asConverters && candidate.asConverters) {\n for (const name of Object.keys(candidate.asConverters)) {\n const key = name.toLowerCase();\n if (Object.keys(existingPkg.asConverters).some((n) => n.toLowerCase() === key)) {\n conflicts.push({\n kind: \"converterName\",\n severity: \"warning\",\n detail: `Both \"${existingPkg.name}\" and \"${candidate.name}\" register an \"as ${name}\" converter — the later-registered handler silently wins.`,\n packages: [existingPkg.name, candidate.name],\n });\n }\n }\n }\n\n // pluginFunctions, index collisions are ALWAYS a real bug (unlike\n // parselet/converter overrides, there's no legitimate \"intentional\n // replacement\" use case for two packages sharing a CALL_PLUGIN index;\n // allocatePluginFunctionIndex() exists specifically to make this\n // unreachable when used correctly, so a collision here means one side\n // hardcoded a number instead). This is the exact bug class that hit\n // THREE separate parallel background agents in one session before\n // this checker existed.\n if (existingPkg.pluginFunctions && candidate.pluginFunctions) {\n const existingIndices = new Set(existingPkg.pluginFunctions.map((f) => f.index));\n for (const fn of candidate.pluginFunctions) {\n if (existingIndices.has(fn.index)) {\n conflicts.push({\n kind: \"pluginFunctionIndex\",\n severity: \"error\",\n detail: `Both \"${existingPkg.name}\" and \"${candidate.name}\" register a pluginFunctions handler at index ${fn.index} — one of them almost certainly hardcoded this index instead of calling allocatePluginFunctionIndex(). Whichever registers second silently overwrites the first's handler in pluginFunctionRegistry.`,\n packages: [existingPkg.name, candidate.name],\n });\n }\n }\n }\n\n // Lexer keywords/operators, a word/symbol can only mean ONE token type.\n // `units` is deliberately NOT checked here: units live in a Set, and two\n // packages both recognizing the same unit WORD is harmless/idempotent\n // (there's no \"which token type wins\" ambiguity the way there is for a\n // keyword->tokenType or operator->tokenType mapping).\n const existingVocab = existingPkg.lexerVocabulary;\n const candidateVocab = candidate.lexerVocabulary;\n if (existingVocab?.keywords && candidateVocab?.keywords) {\n for (const [word, tokenType] of Object.entries(candidateVocab.keywords)) {\n const existingTokenType = existingVocab.keywords[word];\n if (existingTokenType !== undefined && existingTokenType !== tokenType) {\n conflicts.push({\n kind: \"lexerKeyword\",\n severity: \"error\",\n detail: `Both \"${existingPkg.name}\" (-> \"${existingTokenType}\") and \"${candidate.name}\" (-> \"${tokenType}\") register the lexer keyword \"${word}\" for DIFFERENT token types — whichever package registers second wins, and the loser's grammar becomes silently unreachable for that word.`,\n packages: [existingPkg.name, candidate.name],\n });\n }\n }\n }\n if (existingVocab?.operators && candidateVocab?.operators) {\n for (const [op, tokenType] of Object.entries(candidateVocab.operators)) {\n const existingTokenType = existingVocab.operators[op];\n if (existingTokenType !== undefined && existingTokenType !== tokenType) {\n conflicts.push({\n kind: \"lexerOperator\",\n severity: \"error\",\n detail: `Both \"${existingPkg.name}\" (-> \"${existingTokenType}\") and \"${candidate.name}\" (-> \"${tokenType}\") register the lexer operator \"${op}\" for DIFFERENT token types.`,\n packages: [existingPkg.name, candidate.name],\n });\n }\n }\n }\n\n // Async resolver namespaces, ResolverRegistry is keyed by namespace;\n // the JSDoc on IEnginePackage.asyncResolvers already states \"each\n // resolver must have a unique namespace\" as a hard requirement.\n if (existingPkg.asyncResolvers && candidate.asyncResolvers) {\n const existingNamespaces = new Set(existingPkg.asyncResolvers.map((r) => r.namespace));\n for (const resolver of candidate.asyncResolvers) {\n if (existingNamespaces.has(resolver.namespace)) {\n conflicts.push({\n kind: \"asyncResolverNamespace\",\n severity: \"error\",\n detail: `Both \"${existingPkg.name}\" and \"${candidate.name}\" register an async resolver under the namespace \"${resolver.namespace}\" — ResolverRegistry is keyed by namespace, so one resolver's cache/preflight state will silently clobber the other's.`,\n packages: [existingPkg.name, candidate.name],\n });\n }\n }\n }\n\n // Token categories. Same token type, different highlight category.\n // Cosmetic only (doesn't break parsing/evaluation), so \"info\" not\n // \"warning\"/\"error\", but still worth surfacing, since a silently-wrong\n // highlight color is exactly the kind of thing that's invisible until a\n // user notices their editor coloring looks off.\n if (existingPkg.tokenCategories && candidate.tokenCategories) {\n for (const [tokenType, category] of Object.entries(candidate.tokenCategories)) {\n const existingCategory = existingPkg.tokenCategories[tokenType];\n if (existingCategory !== undefined && existingCategory !== category) {\n conflicts.push({\n kind: \"tokenCategory\",\n severity: \"info\",\n detail: `Both \"${existingPkg.name}\" (-> \"${existingCategory}\") and \"${candidate.name}\" (-> \"${category}\") declare a highlight category for token type \"${tokenType}\" — cosmetic only, but the later registration wins.`,\n packages: [existingPkg.name, candidate.name],\n });\n }\n }\n }\n\n return conflicts;\n}\n\n/**\n * Statically check `candidate` against every package in `existing` for\n * overlapping/conflicting declarations, across every collision-capable\n * field `IEnginePackage` has. Pure and side-effect-free, does not touch\n * any shared registry, does not require a live `ExpressionEngine`.\n *\n * @example\n * ```ts\n * const report = checkPackageCompatibility(myNewPackage, BUILTIN_PACKAGES);\n * if (!report.compatible) {\n * for (const c of report.conflicts) console.error(c.detail);\n * }\n * ```\n */\nexport function checkPackageCompatibility(\n candidate: IEnginePackage,\n existing: IEnginePackage[],\n): CompatibilityReport {\n const conflicts: CompatibilityConflict[] = [];\n for (const existingPkg of existing) {\n if (existingPkg === candidate || existingPkg.name === candidate.name) continue;\n conflicts.push(...checkOnePackagePair(existingPkg, candidate));\n }\n return {\n compatible: !conflicts.some((c) => c.severity === \"error\"),\n conflicts,\n };\n}\n","import { satisfies, validRange, coerce } from \"semver\";\nimport type { IEnginePackage } from \"@solve-js/api/PackageRegistry\";\nimport { ENGINE_VERSION } from \"@solve-js/constants/version\";\nimport { ErrorFactory } from \"@solve-js/errors/UnifiedErrorFramework\";\n\n/**\n * Engine-version package compatibility gating, the \"reject a package built\n * for a different engine version\" SDK surface.\n *\n * This is a DIFFERENT kind of check from `api/PackageCompatibility.ts`'s\n * `checkPackageCompatibility()`, and deliberately kept in its own module\n * rather than folded into that one. `checkPackageCompatibility()` answers\n * \"do these two SIMULTANEOUSLY-registered packages' declared fields\n * collide\" and its contract, pure, package-vs-package, every conflict\n * including \"error\" severity is advisory, the caller always just logs and\n * proceeds, is locked in by its own regression suite and stated explicitly\n * in `ExpressionEngine.registerPackage()`'s comments. This module answers a\n * different question, \"can THIS package's declared engine-version range\n * run against the engine that's actually running RIGHT NOW\", and, unlike\n * every other compatibility signal in this codebase, a mismatch here is a\n * hard REJECTION, not a warning. Mixing that blocking behavior into\n * `checkPackageCompatibility()`'s report type would be a footgun for any\n * future reader who's learned (correctly, until now) that every conflict\n * that module can produce stays advisory.\n *\n * `checkEngineVersionCompatibility()` is the pure predicate (mirrors\n * `checkPackageCompatibility()`'s \"return a result, caller decides\" shape,\n * and this codebase's own testing convention of asserting against plain\n * result objects rather than `toThrow()` for a pure function).\n * `assertEngineVersionCompatible()` is the thin throwing wrapper both\n * `ExpressionEngine.registerPackage()` and the `PackageRegistry` singleton\n * call as the very first thing they do. See `ARCHITECTURE.md` §5.3.\n */\n\nexport type EngineVersionCheckResult =\n | { compatible: true }\n | { compatible: false; reason: \"range-not-satisfied\"; declaredRange: string; engineVersion: string }\n | { compatible: false; reason: \"invalid-range\"; declaredRange: string; engineVersion: string };\n\n/**\n * Pure, side-effect-free. Returns `{ compatible: true }` when `pkg` declares\n * no `engineVersion` at all (no constraint = always allowed, preserves\n * every package that predates this field), when the declared range is\n * satisfied by `engineVersion`, or a `{ compatible: false, reason, ... }`\n * result otherwise. A malformed/unparseable range string (a typo in the\n * package's own descriptor) is its own distinct `\"invalid-range\"` reason\n * never conflated with a genuine `\"range-not-satisfied\"` mismatch, so a\n * package author gets feedback about the actual problem they have.\n */\nexport function checkEngineVersionCompatibility(\n pkg: IEnginePackage,\n engineVersion: string = ENGINE_VERSION,\n): EngineVersionCheckResult {\n if (!pkg.engineVersion) return { compatible: true };\n\n if (validRange(pkg.engineVersion) === null) {\n return { compatible: false, reason: \"invalid-range\", declaredRange: pkg.engineVersion, engineVersion };\n }\n\n // Compare against the release the prerelease is a prerelease OF, not the\n // prerelease string itself.\n //\n // Semver sorts 1.0.0-beta.0 BELOW 1.0.0, so it falls outside `^1.0.0` and a\n // package declaring that range would be rejected by the very beta meant to\n // ship its API. `includePrerelease` does not help: the ordering is what\n // excludes it, not a prerelease filter. Verified empirically against the\n // installed semver, including that `^0.1.0` still correctly rejects a 1.0.0\n // engine and that 1.2.3 and 2.0.0 behave unchanged against `^1.0.0`.\n //\n // Coercing is also the semantically right answer: 1.0.0-beta.N presents the\n // 1.0.0 API surface, which is the thing a package declares a range against.\n const comparableVersion = coerce(engineVersion)?.version ?? engineVersion;\n\n if (!satisfies(comparableVersion, pkg.engineVersion)) {\n return { compatible: false, reason: \"range-not-satisfied\", declaredRange: pkg.engineVersion, engineVersion };\n }\n\n return { compatible: true };\n}\n\n/**\n * Throws an `EngineError` (`ErrorCategory.CONFIG`, matching the existing\n * precedent for `PLUGIN_KEYWORD_COLLISION`/`PLUGIN_OPERATOR_COLLISION`/\n * `PLUGIN_UNIT_COLLISION` in `lexer/ExpressionLexer.ts`, the only other\n * place in this codebase that hard-rejects a package at registration time)\n * when `pkg` is not engine-version compatible. Does nothing when compatible.\n */\nexport function assertEngineVersionCompatible(\n pkg: IEnginePackage,\n engineVersion: string = ENGINE_VERSION,\n): void {\n const result = checkEngineVersionCompatibility(pkg, engineVersion);\n if (result.compatible) return;\n\n if (result.reason === \"invalid-range\") {\n throw ErrorFactory.config({\n code: \"PACKAGE_ENGINE_VERSION_INVALID_RANGE\",\n message: `Package \"${pkg.name}\" declares an invalid engineVersion range: \"${result.declaredRange}\" is not a valid semver range.`,\n expected: `a valid semver range string (e.g. \"^0.1.0\", \">=0.2.0 <1.0.0\")`,\n found: `\"${result.declaredRange}\"`,\n suggestion: `This is a range-syntax typo in \"${pkg.name}\"'s own descriptor, not a version mismatch with the running engine — check for a stray character.`,\n context: { packageName: pkg.name, declaredRange: result.declaredRange },\n });\n }\n\n throw ErrorFactory.config({\n code: \"PACKAGE_ENGINE_VERSION_MISMATCH\",\n message: `Package \"${pkg.name}\" declares engineVersion \"${result.declaredRange}\", which is not satisfied by the running engine version \"${result.engineVersion}\".`,\n expected: `an engine version satisfying \"${result.declaredRange}\"`,\n found: `engine version \"${result.engineVersion}\"`,\n suggestion: `Update \"${pkg.name}\" to a version built against solve-engine ${result.engineVersion}, or pin solve-engine to a version satisfying \"${result.declaredRange}\".`,\n context: { packageName: pkg.name, declaredRange: result.declaredRange, engineVersion: result.engineVersion },\n });\n}\n","/**\n * Engine worker, offloads both compilation and VM execution to a\n * background thread (plan L6: worker consolidation).\n *\n * Previously two separate worker files (compilation.worker.ts,\n * execution.worker.ts) duplicated the Transferable ArrayBuffer protocol,\n * postMessage/onmessage boilerplate, and lazy-init pattern. This file\n * merges them behind a single `self.onmessage` dispatching on `msg.type`\n * the message shapes are UNCHANGED from the two original files, so\n * CompilationWorkerManager and ExecutionPool (the main-thread consumers)\n * require no changes beyond importing this file's factory.\n *\n * Each Worker instance created from this file is used exclusively by ONE\n * consumer (a CompilationWorkerManager sends only COMPILE_BATCH; an\n * ExecutionPool sends only EXECUTE_BATCH), the module-level `engine` and\n * `vm` singletons below are independent lazy state, so there is no\n * cross-contamination between the two roles even though they share code.\n *\n * Message protocol:\n * Main → Worker:\n * { type: \"COMPILE_BATCH\", id, items: CompileItem[] }\n * { type: \"EXECUTE_BATCH\", id, items: ExecuteItem[] }\n * { type: \"TERMINATE\", id }\n *\n * Worker → Main:\n * { id, type: \"COMPILE_RESULT\", results: CompileResult[] }\n * { id, type: \"EXECUTE_RESULT\", results: ExecuteResult[] }\n *\n * Transferable objects: bytecode opcodes/numbers buffers are transferred\n * (zero-copy) in both directions, same pattern as the original files.\n */\n\nimport { ExpressionEngine } from \"../engine/ExpressionEngine\";\nimport type { Bytecode } from \"../vm/VM\";\nimport { createVM, executeBytecode } from \"../vm/VM\";\nimport { sharedOpRegistry } from \"../vm/OpRegistry\";\nimport { ValueType } from \"../vm/Value\";\n\n// ── Compile message types ──────────────────────────────────────────────\n\ninterface CompileItem {\n\tlineId: number;\n\texpression: string;\n\ttextHash: number;\n}\n\ninterface CompileBatchMsg {\n\ttype: \"COMPILE_BATCH\";\n\tid: number;\n\titems: CompileItem[];\n}\n\ninterface CompileResult {\n\tlineId: number;\n\texpression: string;\n\tcompiledAgainstHash: number;\n\topcodesBuffer: ArrayBuffer;\n\tnumbersBuffer: ArrayBuffer;\n\topcodesLength: number;\n\tnumbersLength: number;\n\tstrings: string[];\n\treads: string[];\n\twrites: string[];\n\tisVariableDef: boolean;\n\terror: string | null;\n}\n\n// ── Execute message types ──────────────────────────────────────────────\n\ninterface ExecuteItem {\n\tlineNumber: number;\n\topcodesBuffer: ArrayBuffer;\n\tnumbersBuffer: ArrayBuffer;\n\topcodesLength: number;\n\tnumbersLength: number;\n\tstrings: string[];\n}\n\ninterface ExecuteBatchMsg {\n\ttype: \"EXECUTE_BATCH\";\n\tid: number;\n\titems: ExecuteItem[];\n}\n\ninterface ExecuteResult {\n\tlineNumber: number;\n\tvalueType: ValueType;\n\tvalue: number;\n\tunit?: string;\n\tisPending: boolean;\n\tqueryKey?: string;\n}\n\ninterface TerminateMsg {\n\ttype: \"TERMINATE\";\n\tid: number;\n}\n\ntype EngineWorkerMessage = CompileBatchMsg | ExecuteBatchMsg | TerminateMsg;\n\n// ── Worker body ───────────────────────────────────────────────────────\n\n// A host that builds with esbuild-plugin-inline-worker gets this replaced by a\n// real factory returning a Worker. Nothing else does, the published tsup bundle\n// included, so this stub is a live runtime path rather than a dead sentinel.\n//\n// Throwing is the contract, not a failure to handle the case. Both consumers\n// probe availability by calling this inside a try/catch\n// ({@link ExecutionPool.isAvailable}, and the equivalent in\n// CompilationWorkerManager), so the throw is how they learn workers are\n// unavailable and fall back to the main thread. The message is for a developer\n// reading a stack trace, and is otherwise swallowed by design.\n//\n// The one raw `throw new Error` in the codebase. It stays raw because it is a\n// build-configuration signal rather than an engine error, and routing it\n// through ErrorFactory would imply a caller should inspect its code.\nexport default (() => {\n\tthrow new Error(\"engine.worker.ts was not processed by esbuild-plugin-inline-worker, so worker offload is unavailable\");\n}) as unknown as () => Worker;\n\n// ── Lazy per-role state, independent, only the used one is created ────\n\nlet compileEngine: ExpressionEngine | null = null;\nfunction getCompileEngine(): ExpressionEngine {\n\tif (!compileEngine) {\n\t\tcompileEngine = new ExpressionEngine(\"en\", false);\n\t}\n\treturn compileEngine;\n}\n\nlet executeVm: ReturnType<typeof createVM> | null = null;\nfunction getExecuteVm(): ReturnType<typeof createVM> {\n\tif (!executeVm) {\n\t\texecuteVm = createVM(sharedOpRegistry, 200, 50000);\n\t}\n\treturn executeVm;\n}\n\n// ── Compile ──────────────────────────────────────────────────────────\n\n/**\n * Compile a single expression and produce a transfer-ready CompileResult.\n * Extracts ArrayBuffers from the compiled TypedArrays so they can be\n * transferred via postMessage, after this call, the original TypedArrays\n * are detached on the worker side.\n */\nfunction compileOne(item: CompileItem): CompileResult {\n\tconst base: Omit<CompileResult, \"opcodesBuffer\" | \"numbersBuffer\" | \"opcodesLength\" | \"numbersLength\"> = {\n\t\tlineId: item.lineId,\n\t\texpression: item.expression,\n\t\tcompiledAgainstHash: item.textHash,\n\t\tstrings: [],\n\t\treads: [],\n\t\twrites: [],\n\t\tisVariableDef: false,\n\t\terror: null,\n\t};\n\n\ttry {\n\t\tconst eng = getCompileEngine();\n\t\tconst { program, reads, writes } = eng.compileExpression(item.expression);\n\t\tconst isVariableDef = writes.length > 0;\n\n\t\tconst opcodes = program.opcodes;\n\t\tconst numbers = program.numbers;\n\n\t\t// Transfer only the exact used slice of the ArrayBuffer. The engine's\n\t\t// buffer pool is write-only, so detaching the source view is fine.\n\t\t//\n\t\t// The casts narrow ArrayBufferLike to ArrayBuffer. A TypedArray's\n\t\t// `buffer` is typed as the union including SharedArrayBuffer, which\n\t\t// TypeScript 6 enforces where 5.1 did not, and the postMessage\n\t\t// transfer list below accepts only ArrayBuffer. The narrowing is\n\t\t// sound here because these buffers come from the engine's own pool,\n\t\t// which allocates plain ArrayBuffers; a SharedArrayBuffer could not\n\t\t// reach this point, and would not be transferable if it did.\n\t\tconst opcodesBuffer = (opcodes.buffer as ArrayBuffer).slice(\n\t\t\topcodes.byteOffset,\n\t\t\topcodes.byteOffset + opcodes.byteLength\n\t\t);\n\t\tconst numbersBuffer = (numbers.buffer as ArrayBuffer).slice(\n\t\t\tnumbers.byteOffset,\n\t\t\tnumbers.byteOffset + numbers.byteLength\n\t\t);\n\n\t\treturn {\n\t\t\t...base,\n\t\t\topcodesBuffer,\n\t\t\tnumbersBuffer,\n\t\t\topcodesLength: opcodes.length,\n\t\t\tnumbersLength: numbers.length,\n\t\t\tstrings: [...program.strings],\n\t\t\treads,\n\t\t\twrites,\n\t\t\tisVariableDef,\n\t\t};\n\t} catch (e) {\n\t\treturn {\n\t\t\t...base,\n\t\t\topcodesBuffer: new ArrayBuffer(0),\n\t\t\tnumbersBuffer: new ArrayBuffer(0),\n\t\t\topcodesLength: 0,\n\t\t\tnumbersLength: 0,\n\t\t\terror: e instanceof Error ? e.message : String(e),\n\t\t};\n\t}\n}\n\nfunction handleCompileBatch(msg: CompileBatchMsg): void {\n\tconst results: CompileResult[] = [];\n\tconst transferList: ArrayBuffer[] = [];\n\n\tfor (const item of msg.items) {\n\t\tconst result = compileOne(item);\n\t\tresults.push(result);\n\t\tif (result.opcodesBuffer.byteLength > 0) transferList.push(result.opcodesBuffer);\n\t\tif (result.numbersBuffer.byteLength > 0) transferList.push(result.numbersBuffer);\n\t}\n\n\t(self as unknown as Worker).postMessage(\n\t\t{ id: msg.id, type: \"COMPILE_RESULT\", results },\n\t\ttransferList\n\t);\n}\n\n// ── Execute ──────────────────────────────────────────────────────────\n\n/**\n * Execute a single bytecode program and produce a serialized ExecuteResult.\n * Reconstructs TypedArrays from the transferred ArrayBuffers (zero-copy).\n * Resets the worker VM before each execution, no state carries over\n * between lines in a batch.\n */\nfunction executeOne(item: ExecuteItem): ExecuteResult {\n\tconst vmm = getExecuteVm();\n\tvmm.reset();\n\n\tconst opcodes = new Uint8Array(item.opcodesBuffer, 0, item.opcodesLength);\n\tconst numbers = new Float64Array(item.numbersBuffer, 0, item.numbersLength);\n\tconst bytecode: Bytecode = { opcodes, numbers, strings: item.strings };\n\n\ttry {\n\t\tconst result = executeBytecode(bytecode, vmm);\n\n\t\tif (result.type === \"pending\") {\n\t\t\treturn {\n\t\t\t\tlineNumber: item.lineNumber,\n\t\t\t\tvalueType: ValueType.Pending,\n\t\t\t\tvalue: 0,\n\t\t\t\tisPending: true,\n\t\t\t\tqueryKey: result.queryKey,\n\t\t\t};\n\t\t}\n\n\t\tif (result.type === \"error\") {\n\t\t\treturn {\n\t\t\t\tlineNumber: item.lineNumber,\n\t\t\t\tvalueType: ValueType.Error,\n\t\t\t\tvalue: 0,\n\t\t\t\tisPending: false,\n\t\t\t\tunit: result.error.message,\n\t\t\t};\n\t\t}\n\n\t\tconst val = result.value;\n\t\treturn {\n\t\t\tlineNumber: item.lineNumber,\n\t\t\tvalueType: val.type,\n\t\t\tvalue: typeof val.value === \"number\"\n\t\t\t\t? val.value\n\t\t\t\t: typeof val.value === \"bigint\"\n\t\t\t\t\t? Number(val.value)\n\t\t\t\t\t: 0,\n\t\t\tunit: val.unit,\n\t\t\tisPending: false,\n\t\t};\n\t} catch {\n\t\t// Execution error, return error-type value so main thread can\n\t\t// propagate through DAG as errorValue.\n\t\treturn {\n\t\t\tlineNumber: item.lineNumber,\n\t\t\tvalueType: ValueType.Error,\n\t\t\tvalue: 0,\n\t\t\tisPending: false,\n\t\t\tunit: \"Worker execution failed\",\n\t\t};\n\t}\n}\n\nfunction handleExecuteBatch(msg: ExecuteBatchMsg): void {\n\tconst results: ExecuteResult[] = [];\n\tfor (const item of msg.items) {\n\t\tresults.push(executeOne(item));\n\t}\n\t// No transferables needed for the response, results are plain\n\t// objects with numbers and strings (structured-cloned).\n\t(self as unknown as Worker).postMessage({\n\t\tid: msg.id,\n\t\ttype: \"EXECUTE_RESULT\",\n\t\tresults,\n\t});\n}\n\n// ── Message handler ───────────────────────────────────────────────────\n\n/**\n * Whether this module is executing inside a real worker global scope.\n *\n * Only `esbuild-plugin-inline-worker` splits this file into a separate worker\n * bundle. Any other bundler, tsup included, treats it as an ordinary module and\n * inlines the whole body into whatever imported it, which means the code below\n * runs on the main thread or in Node rather than in a worker.\n *\n * Without this guard, importing the published package from Node throws\n * `self is not defined` before a single expression can be evaluated. The check\n * distinguishes the three environments: Node defines neither `self` nor\n * `window`, a browser main thread defines both, and a worker defines only\n * `self`.\n */\nconst inWorkerScope = typeof self !== \"undefined\" && typeof window === \"undefined\";\n\nconst handleMessage = (event: MessageEvent) => {\n\t// A real postMessage always carries a browser-populated origin the\n\t// sender cannot spoof, so this only ever rejects a genuine mismatch. It\n\t// is skipped, not enforced, when either side is unset, which covers the\n\t// test harness driving this handler directly with a plain object and\n\t// no location global (see WorkerIntegration.spec.ts), without opening\n\t// anything a real message could exploit.\n\tif (event.origin && self.location && event.origin !== self.location.origin) return;\n\n\tconst msg = event.data as EngineWorkerMessage;\n\n\tswitch (msg.type) {\n\t\tcase \"COMPILE_BATCH\":\n\t\t\thandleCompileBatch(msg);\n\t\t\tbreak;\n\n\t\tcase \"EXECUTE_BATCH\":\n\t\t\thandleExecuteBatch(msg);\n\t\t\tbreak;\n\n\t\tcase \"TERMINATE\": {\n\t\t\t// Not sent by either production manager today, both call the\n\t\t\t// native Worker.terminate() directly instead. Kept for protocol\n\t\t\t// completeness and future consumers. Clears whichever per-role\n\t\t\t// state this instance happened to create.\n\t\t\tif (compileEngine) {\n\t\t\t\tcompileEngine.clear();\n\t\t\t\tcompileEngine = null;\n\t\t\t}\n\t\t\tif (executeVm) {\n\t\t\t\texecuteVm.reset();\n\t\t\t\texecuteVm = null;\n\t\t\t}\n\t\t\t(self as unknown as Worker).postMessage({\n\t\t\t\tid: msg.id,\n\t\t\t\ttype: \"COMPILE_RESULT\",\n\t\t\t\tresults: [],\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault: {\n\t\t\t(self as unknown as Worker).postMessage({\n\t\t\t\tid: -1,\n\t\t\t\ttype: \"COMPILE_RESULT\",\n\t\t\t\tresults: [],\n\t\t\t\terror: `Unknown message type: ${(msg as { type?: string }).type}`,\n\t\t\t});\n\t\t}\n\t}\n};\n\n// Installed only when genuinely running as a worker. Everywhere else this\n// module has been inlined into a host bundle, where binding a handler would at\n// best be inert and at worst intercept the host's own messages.\nif (inWorkerScope) {\n\tself.onmessage = handleMessage;\n}\n","/**\n * ExecutionPool, manages a pool of execution workers for offloading\n * VM bytecode re-execution when AsyncResolutionBatcher.flush() has >50\n * affected lines.\n *\n * Workers are created lazily (on first dispatch). Each worker runs\n * executeBytecode() with its own isolated VM, no shared state between\n * worker and main thread, no scope leakage.\n *\n * Design decisions:\n * - Pool size: Math.min(navigator.hardwareConcurrency ?? 4, 4). Capped at\n * 4 to avoid excessive thread creation on high-core machines.\n * - Round-robin dispatch distributes batches evenly across workers.\n * - Workers are terminated on pool.clear() (engine clear) and recreated\n * lazily on next dispatch.\n * - Falls back to synchronous main-thread execution when Worker is\n * unavailable (Node.js, SSR, testing without jsdom worker support).\n *\n * Transferable protocol (shares engine.worker.ts with CompilationWorkerManager):\n * - Main thread clones bytecode ArrayBuffers via .slice() per entry\n * - Transfers cloned buffers to worker (zero-copy, detached on main side)\n * - Worker receives buffers, reconstructs TypedArrays, executes, returns\n * serialized results (plain objects with numbers/strings)\n *\n * Message protocol:\n * Pool → Worker: { type: \"EXECUTE_BATCH\", id, items: ExecuteItem[] }\n * Worker → Pool: { id, type: \"EXECUTE_RESULT\", results: ExecuteResult[] }\n */\n\nimport type { LineCacheEntry } from \"@solve-js/cache/LineCache\";\nimport { ValueType } from \"@solve-js/vm/Value\";\nimport { numberValue, uomValue, hexValue, bigIntValue, stringValue, boolValue, datetimeValue, percentageValue, errorValue, pendingValue } from \"@solve-js/vm/Value\";\nimport type { Value } from \"@solve-js/vm/Value\";\n\n/** Timeout for worker batch execution (30s). If exceeded, returns empty results. */\nconst WORKER_BATCH_TIMEOUT_MS = 30_000;\n\n// ── Static import of the inline worker factory ────────────────────────────\n// esbuild-plugin-inline-worker transforms this into a function that\n// returns Worker (using blob URL or equivalent). At build time it's a\n// factory; at dev time it throws.\nimport createExecutionWorker from \"@solve-js/workers/engine.worker\";\n\n// ── Worker message types (mirrors the EXECUTE_* shapes in engine.worker.ts) ──\n\ninterface ExecuteItem {\n\tlineNumber: number;\n\topcodesBuffer: ArrayBuffer;\n\tnumbersBuffer: ArrayBuffer;\n\topcodesLength: number;\n\tnumbersLength: number;\n\tstrings: string[];\n}\n\ninterface ExecuteResult {\n\tlineNumber: number;\n\tvalueType: ValueType;\n\tvalue: number;\n\tunit?: string;\n\tisPending: boolean;\n\tqueryKey?: string;\n}\n\n// ── Batch tracking ────────────────────────────────────────────────────────\n\ninterface PendingBatch {\n\t/** Correlation ID sent to the worker. */\n\tid: number;\n\t/** Line numbers in this batch (in order). Used for result correlation. */\n\tlineNumbers: number[];\n\t/** Resolve when results arrive. */\n\tresolve: (results: ExecuteResult[]) => void;\n}\n\n/** Number of affected lines before we offload to worker pool. */\nexport const WORKER_OFFLOAD_THRESHOLD = 50;\n\n// ── Pool ──────────────────────────────────────────────────────────────────\n\n/**\n * Runs bytecode on background workers instead of the main thread.\n *\n * Used for scroll-driven batches, where evaluating a screenful of lines on the\n * main thread would drop frames. Degrades to the main thread when workers are\n * unavailable, which is the normal case in Node and in any bundle not built\n * with esbuild-plugin-inline-worker. See {@link ExecutionPool.isAvailable}.\n */\nexport class ExecutionPool {\n\tprivate workers: Worker[] = [];\n\tprivate nextWorker = 0;\n\tprivate nextId = 1;\n\tprivate pendingBatches = new Map<number, PendingBatch>();\n\tprivate terminated = false;\n\tprivate poolSize: number;\n\n\tconstructor(poolSize?: number) {\n\t\tthis.poolSize = Math.min(poolSize ?? this.defaultPoolSize(), 4);\n\t}\n\n\tprivate defaultPoolSize(): number {\n\t\tif (typeof navigator !== \"undefined\" && navigator.hardwareConcurrency) {\n\t\t\treturn Math.min(navigator.hardwareConcurrency, 4);\n\t\t}\n\t\treturn 2;\n\t}\n\n\t// ── Public API ────────────────────────────────────────────────────────\n\n\t/** Cached availability flag. Checked once; createExecutionWorker never called again. */\n\tprivate _available: boolean | null = null;\n\n\t/**\n\t * Whether worker-based execution is available.\n\t * Returns false in Node.js / jsdom test environments where Worker\n\t * may be polyfilled but execution workers aren't functional.\n\t */\n\tisAvailable(): boolean {\n\t\tif (this.terminated) return false;\n\t\tif (this._available !== null) return this._available;\n\t\tif (typeof Worker === \"undefined\") {\n\t\t\tthis._available = false;\n\t\t\treturn false;\n\t\t}\n\t\ttry {\n\t\t\t// Create a test worker, then immediately terminate it.\n\t\t\tconst w = createExecutionWorker();\n\t\t\tw.terminate();\n\t\t\tthis._available = true;\n\t\t\treturn true;\n\t\t} catch {\n\t\t\tthis._available = false;\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Execute a batch of line entries via the worker pool.\n\t *\n\t * Takes ordered line numbers and their LineCache entries. Clones bytecode\n\t * ArrayBuffers for transfer, dispatches to workers round-robin, and\n\t * returns the serialized results (with 30s timeout fallback).\n\t *\n\t * Falls back to undefined when workers are unavailable, caller should\n\t * use the main-thread path.\n\t *\n\t * @returns ExecuteResult[] on success, undefined if workers unavailable.\n\t */\n\texecuteBatch(\n\t\torderedLineNumbers: number[],\n\t\tentries: Map<number, LineCacheEntry | undefined>,\n\t): Promise<ExecuteResult[]> | undefined {\n\t\tif (!this.isAvailable()) return undefined;\n\t\tif (orderedLineNumbers.length === 0) return Promise.resolve([]);\n\n\t\t// Lazy-initialize workers\n\t\tthis.ensureWorkers();\n\n\t\t// Clone bytecode buffers for transfer. Each worker needs its own\n\t\t// copy because transfer detaches the ArrayBuffer on the sender side.\n\t\tconst items: ExecuteItem[] = [];\n\t\tfor (const lineNumber of orderedLineNumbers) {\n\t\t\tconst entry = entries.get(lineNumber);\n\t\t\tif (!entry || entry.bytecode.opcodes.length === 0) continue;\n\n\t\t\tconst opcodes = entry.bytecode.opcodes;\n\t\t\tconst numbers = entry.bytecode.numbers;\n\n\t\t\t// Clone the exact used slice of each ArrayBuffer for transfer.\n\t\t\t// After transfer, the clone is detached on the main thread\n\t\t\t// the original LineCache entry's buffers are untouched.\n\t\t\tconst opcodesClone = opcodes.buffer.slice(\n\t\t\t\topcodes.byteOffset,\n\t\t\t\topcodes.byteOffset + opcodes.byteLength,\n\t\t\t) as ArrayBuffer;\n\t\t\tconst numbersClone = numbers.buffer.slice(\n\t\t\t\tnumbers.byteOffset,\n\t\t\t\tnumbers.byteOffset + numbers.byteLength,\n\t\t\t) as ArrayBuffer;\n\n\t\t\titems.push({\n\t\t\t\tlineNumber,\n\t\t\t\topcodesBuffer: opcodesClone,\n\t\t\t\tnumbersBuffer: numbersClone,\n\t\t\t\topcodesLength: opcodes.length,\n\t\t\t\tnumbersLength: numbers.length,\n\t\t\t\tstrings: [...entry.bytecode.strings],\n\t\t\t});\n\t\t}\n\n\t\tif (items.length === 0) return Promise.resolve([]);\n\n\t\t// Collect transferable ArrayBuffers for zero-copy postMessage.\n\t\tconst transferList: ArrayBuffer[] = [];\n\t\tfor (const item of items) {\n\t\t\tif (item.opcodesBuffer.byteLength > 0) transferList.push(item.opcodesBuffer);\n\t\t\tif (item.numbersBuffer.byteLength > 0) transferList.push(item.numbersBuffer);\n\t\t}\n\n\t\tconst batchId = this.nextId++;\n\t\tconst worker = this.getNextWorker();\n\n\t\treturn new Promise<ExecuteResult[]>((resolve) => {\n\t\t\t// Timeout guard: if worker hangs (infinite bytecode loop despite\n\t\t\t// VM instruction limit), resolve with empty results after 30s.\n\t\t\tconst timeoutId = setTimeout(() => {\n\t\t\t\tthis.pendingBatches.delete(batchId);\n\t\t\t\tresolve([]);\n\t\t\t}, WORKER_BATCH_TIMEOUT_MS);\n\n\t\t\tthis.pendingBatches.set(batchId, {\n\t\t\t\tid: batchId,\n\t\t\t\tlineNumbers: orderedLineNumbers,\n\t\t\t\tresolve: (results: ExecuteResult[]) => {\n\t\t\t\t\tclearTimeout(timeoutId);\n\t\t\t\t\tresolve(results);\n\t\t\t\t},\n\t\t\t});\n\n\t\t\tworker.postMessage(\n\t\t\t\t{ type: \"EXECUTE_BATCH\", id: batchId, items },\n\t\t\t\ttransferList,\n\t\t\t);\n\t\t});\n\t}\n\n\t/**\n\t * Clean up all workers and pending batches. Called on engine clear.\n\t * Workers are recreated lazily on next dispatch.\n\t */\n\tclear(): void {\n\t\t// Reject all pending batches\n\t\tfor (const [, batch] of this.pendingBatches) {\n\t\t\tbatch.resolve([]);\n\t\t}\n\t\tthis.pendingBatches.clear();\n\n\t\t// Terminate all workers\n\t\tfor (const w of this.workers) {\n\t\t\tw.terminate();\n\t\t}\n\t\tthis.workers = [];\n\t\tthis.nextWorker = 0;\n\t}\n\n\t/**\n\t * Full teardown. After destroy(), the pool is permanently unusable.\n\t */\n\tdestroy(): void {\n\t\tthis.terminated = true;\n\t\tthis.clear();\n\t}\n\n\t// ── Private ────────────────────────────────────────────────────────────\n\n\tprivate ensureWorkers(): void {\n\t\tif (this.workers.length > 0) return;\n\n\t\tfor (let i = 0; i < this.poolSize; i++) {\n\t\t\tconst worker = createExecutionWorker();\n\t\t\tworker.onmessage = (event: MessageEvent) => {\n\t\t\t\tthis.handleWorkerMessage(event.data);\n\t\t\t};\n\t\t\tworker.onerror = (err: ErrorEvent) => {\n\t\t\t\tconsole.error(`[ExecutionPool] Worker ${i} error:`, err.message);\n\t\t\t\t// Resolve ALL pending batches with empty results so callers\n\t\t\t\t// don't hang. Any in-flight execution results are lost, but\n\t\t\t\t// the batcher will re-evaluate on next resolution.\n\t\t\t\tfor (const [id, batch] of this.pendingBatches) {\n\t\t\t\t\tbatch.resolve([]);\n\t\t\t\t\tthis.pendingBatches.delete(id);\n\t\t\t\t}\n\t\t\t};\n\t\t\tthis.workers.push(worker);\n\t\t}\n\t}\n\n\tprivate getNextWorker(): Worker {\n\t\tconst w = this.workers[this.nextWorker];\n\t\tthis.nextWorker = (this.nextWorker + 1) % this.workers.length;\n\t\treturn w;\n\t}\n\n\tprivate handleWorkerMessage(data: { id: number; type: string; results: ExecuteResult[] }): void {\n\t\tif (data.type !== \"EXECUTE_RESULT\") return;\n\n\t\tconst batch = this.pendingBatches.get(data.id);\n\t\tif (!batch) return;\n\n\t\tthis.pendingBatches.delete(data.id);\n\t\tbatch.resolve(data.results);\n\t}\n}\n\n// ── Value reconstruction helpers ──────────────────────────────────────────\n\n/**\n * Reconstruct a Value object from a serialized ExecuteResult.\n *\n * Called on the main thread after worker execution completes.\n * Maps ValueType → appropriate constructor function.\n */\nexport function reconstructValue(result: ExecuteResult): Value {\n\tswitch (result.valueType) {\n\t\tcase ValueType.Number:\n\t\t\treturn numberValue(result.value);\n\t\tcase ValueType.Hex:\n\t\t\treturn hexValue(result.value);\n\t\tcase ValueType.BigInt:\n\t\t\treturn bigIntValue(BigInt(result.value));\n\t\tcase ValueType.String:\n\t\t\treturn stringValue(String(result.value));\n\t\tcase ValueType.Datetime:\n\t\t\treturn datetimeValue(result.value);\n\t\tcase ValueType.Percentage:\n\t\t\treturn percentageValue(result.value);\n\t\tcase ValueType.Uom:\n\t\t\treturn uomValue(result.value, result.unit ?? \"\");\n\t\tcase ValueType.Matrix:\n\t\t\t// Pre-existing simplification carried over from the old Array\n\t\t\t// type: the worker-pool's {valueType, value, unit} serialization\n\t\t\t// has no slot for MatrixData's rows/cols/data shape, so a Matrix\n\t\t\t// result degrades to a plain number here rather than round-\n\t\t\t// tripping intact. Not fixed as part of Matrix support. This\n\t\t\t// gap already existed for vectors before this rename.\n\t\t\treturn numberValue(result.value);\n\t\tcase ValueType.Boolean:\n\t\t\treturn boolValue(result.value !== 0);\n\t\tcase ValueType.Pending:\n\t\t\treturn pendingValue(result.queryKey ?? \"\");\n\t\tcase ValueType.Error:\n\t\t\treturn errorValue(\"WORKER_EXECUTION_ERROR\", result.unit ?? \"Unknown worker error\");\n\t\tdefault:\n\t\t\treturn numberValue(result.value);\n\t}\n}\n","import type { DependencyGraph } from \"@solve-js/vm/DependencyGraph\";\nimport type { LineCache, LineCacheEntry } from \"@solve-js/cache/LineCache\";\nimport { type Value, errorValue } from \"@solve-js/vm/Value\";\nimport { executeBytecode } from \"@solve-js/vm/VM\";\nimport type { VM } from \"@solve-js/vm/OpRegistry\";\nimport { normalizeUnknownError } from \"@solve-js/errors/EngineError\";\nimport {\n\tExecutionPool,\n\tWORKER_OFFLOAD_THRESHOLD,\n\treconstructValue,\n} from \"@solve-js/engine/ExecutionPool\";\n\n// ── Event types ────────────────────────────────────────────────────────\n\n/** Emitted when one or more lines have updated results after async resolution. */\nexport interface LinesUpdatedEvent {\n\ttype: \"lines-updated\";\n\t/** Line numbers whose results changed (1-based). */\n\tlineNumbers: number[];\n\t/** The query keys whose resolution triggered this update. */\n\taffectedQueryKeys: string[];\n}\n\n/** Emitted when an async resolution fails with an error. */\nexport interface AsyncErrorEvent {\n\ttype: \"error\";\n\t/** The query key that failed. */\n\tqueryKey: string;\n\t/** The package whose resolver failed. */\n\tpackageId: string;\n\t/** The error that caused the failure. */\n\terror: Error;\n}\n\n/** Something an async resolution produced: updated lines, or a failure. */\nexport type AsyncResolutionEvent = LinesUpdatedEvent | AsyncErrorEvent;\n\n// ── Internal batch entry ───────────────────────────────────────────────\n\ninterface BatchEntry {\n\t/** The query key that just resolved (or errored). */\n\tqueryKey: string;\n\t/** The package that owns this data. */\n\tpackageId: string;\n\t/** AbortSignal for staleness detection. */\n\tsignal: AbortSignal;\n\t/** Whether this was an error resolution. */\n\tisError: boolean;\n\t/** Error if isError. */\n\terror?: Error;\n}\n\n// ── Batcher ────────────────────────────────────────────────────────────\n\n/**\n * Micro-batches async resolution completions into a single DAG walk + re-evaluation pass.\n *\n * When multiple promises resolve within the same event-loop tick (e.g., 3 currency\n * rates: USD→GBP, USD→EUR, USD→JPY all return within 2ms), this batcher collapses\n * them into ONE DAG walk and ONE re-execution pass instead of 3 separate ones.\n *\n * Lifecycle:\n * - Engine calls `add()` after each `resolveAsync()` completes\n * - `queueMicrotask()` schedules `flush()` for the end of the current tick\n * - `flush()` deduplicates queryKeys, walks DAG once for all resolved keys,\n * topologically sorts affected lines, re-executes, and fires listener events\n *\n * Perf: For N resolutions in a tick, reduces DAG walks from N to 1 and\n * re-executions from N*avgAffected to totalAffected.\n *\n * ## Streaming Architecture\n *\t * Events are published to a native {@link ReadableStream}. Stream-based\n\t * consumers read from the stream via `getReader()`, gaining built-in\n\t * cancellation (`reader.cancel()`), proper resource cleanup\n\t * (`reader.releaseLock()`), and the ability to\n\t * `pipeTo()` / `pipeThrough()` / `tee()` the event flow.\n *\n * The stream uses a configurable {@link CountQueuingStrategy} with a default\n * `highWaterMark` of 64 events to limit the internal buffer size.\n */\nexport class AsyncResolutionBatcher {\n\tprivate pending: BatchEntry[] = [];\n\tprivate scheduled = false;\n\t/** Set to true by clearPending(), flush() checks this to abort stale work. */\n\tprivate cleared = false;\n\n\tprivate dag: DependencyGraph;\n\tprivate lineCache: LineCache;\n\tprivate vm: VM;\n\n\t/**\n\t * Worker pool for offloading VM re-execution when the affected line\n\t * count exceeds WORKER_OFFLOAD_THRESHOLD (50). Lazily created on\n\t * first dispatch; cleared on clearAll().\n\t */\n\tprivate executionPool: ExecutionPool | null = null;\n\n\t/**\n\t * Number of flushes actually dispatched to the worker pool (as opposed\n\t * to falling back to the main thread because Worker is unavailable).\n\t * Exposed via {@link workerOffloadCount} for the Workers diagnostic tab.\n\t */\n\tprivate workerOffloadDispatchCount = 0;\n\n\t// ── Web Streams API integration ──────────────────────────────────\n\n\t/**\n\t * Default high-water mark for the internal event stream.\n\t * Limits the internal buffer size before the stream signals to\n\t * consumers that they need to catch up.\n\t */\n\tprivate static readonly DEFAULT_HIGH_WATER_MARK = 64;\n\n\t/**\n\t * Internal {@link ReadableStream} for async resolution events.\n\t * All events (lines-updated and error) are enqueued here.\n\t */\n\tprivate _eventStream: ReadableStream<AsyncResolutionEvent>;\n\n\t/**\n\t * Controller for the internal event stream. Set during stream\n\t * initialization; cleared on stream cancellation or clearAll().\n\t */\n\tprivate _streamController: ReadableStreamDefaultController<AsyncResolutionEvent> | null = null;\n\n\t/**\n\t * Test-only synchronous capture array. When enabled (non-null), every\n\t * event is synchronously pushed here in addition to the stream.\n\t * Tests read from this array to avoid async stream reader timing issues.\n\t */\n\tpublic _testCaptures: AsyncResolutionEvent[] | null = null;\n\n\t/**\n\t * Called for each line whose result is patched after an async resolution,\n\t * on both the main-thread and worker-pool paths.\n\t *\n\t * **A host that displays async results must set this.** It is the only\n\t * mechanism that moves a resolved value out of the LineCache and into the\n\t * host's own document state. The engine cannot do it itself: it does not own\n\t * a document, the host does, and the batcher has no reference to one.\n\t *\n\t * Nullable rather than a constructor parameter because it is cleared by\n\t * `clearAll()` and re-wired on re-subscribe, so it cannot be readonly. That\n\t * makes it easy to miss, which is why {@link warnIfUnwired} exists: leaving\n\t * it unset means async values resolve into the cache and are never shown,\n\t * with nothing to indicate why. A host that genuinely does not want async\n\t * results should not register async resolvers at all.\n\t */\n\tonLineResult: ((lineNumber: number, value: Value) => void) | null = null;\n\n\t/**\n\t * Whether {@link warnIfUnwired} has already fired.\n\t *\n\t * Once per instance, not once per resolution. A document with fifty live\n\t * data lines would otherwise produce fifty identical warnings on the first\n\t * fetch, which is how a useful warning becomes noise people filter out.\n\t */\n\tprivate warnedAboutMissingHook = false;\n\n\t/**\n\t * Warn once if an async result resolved with no {@link onLineResult} wired.\n\t *\n\t * The failure this catches is silent by nature: the value arrives, the cache\n\t * updates, and the line keeps showing pending forever. Without this a host\n\t * author has no thread to pull on.\n\t */\n\tprivate warnIfUnwired(): void {\n\t\tif (this.onLineResult || this.warnedAboutMissingHook) return;\n\t\tthis.warnedAboutMissingHook = true;\n\t\tconsole.warn(\n\t\t\t\"[solve-engine] An async result resolved but AsyncResolutionBatcher.onLineResult \" +\n\t\t\t\"is not set, so the value cannot reach your document and the line will keep \" +\n\t\t\t\"showing as pending. Set it to mirror resolved values into your own state. \" +\n\t\t\t\"This warning appears once per batcher.\",\n\t\t);\n\t}\n\n\t/** High-water mark used when (re)creating the event stream. */\n\tprivate readonly highWaterMark: number;\n\n\tconstructor(\n\t\tdag: DependencyGraph,\n\t\tlineCache: LineCache,\n\t\tvm: VM,\n\t\thighWaterMark: number = AsyncResolutionBatcher.DEFAULT_HIGH_WATER_MARK,\n\t) {\n\t\tthis.dag = dag;\n\t\tthis.lineCache = lineCache;\n\t\tthis.vm = vm;\n\t\tthis.highWaterMark = highWaterMark;\n\n\t\tthis._eventStream = this.createEventStream();\n\t}\n\n\t/**\n\t * Create a fresh internal event stream and wire its controller.\n\t * Called from the constructor and again from clearAll() so the batcher\n\t * keeps emitting events after an engine clear, the engine instance\n\t * (and this batcher) live on across clear() calls.\n\t */\n\tprivate createEventStream(): ReadableStream<AsyncResolutionEvent> {\n\t\treturn new ReadableStream<AsyncResolutionEvent>({\n\t\t\tstart: (controller) => {\n\t\t\t\tthis._streamController = controller;\n\t\t\t},\n\t\t\tcancel: () => {\n\t\t\t\tthis._streamController = null;\n\t\t\t},\n\t\t}, new CountQueuingStrategy({ highWaterMark: this.highWaterMark }));\n\t}\n\n\t// ── Public API ────────────────────────────────────────────────────\n\n\t/**\n\t * Add a resolved query key to the pending batch.\n\t *\n\t * Called by ExpressionEngine.resolveAsync() after a promise resolves or errors.\n\t * If this is the first entry in the current tick, schedules a microtask flush.\n\t */\n\tadd(entry: BatchEntry): void {\n\t\t// Re-arm after engine clear (clearAll sets cleared=true).\n\t\tthis.cleared = false;\n\n\t\t// Deduplicate: if the same (packageId:queryKey) is already in the batch, skip.\n\t\t// This handles the case where the same data source is resolved multiple times\n\t\t// (e.g., fetch → error → retry) within the same tick.\n\t\tfor (const existing of this.pending) {\n\t\t\tif (existing.packageId === entry.packageId && existing.queryKey === entry.queryKey) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tthis.pending.push(entry);\n\n\t\tif (!this.scheduled) {\n\t\t\tthis.scheduled = true;\n\t\t\t// Hard backstop, deliberately redundant with reExecuteMainThread()'s\n\t\t\t// own per-line try/catch: this runs inside a bare queueMicrotask\n\t\t\t// callback, which has no caller able to catch anything that escapes\n\t\t\t// it, an uncaught throw here becomes an uncaughtException that can\n\t\t\t// crash the host process. flush() is expected to never throw past\n\t\t\t// its own internal per-line containment, but \"expected to never\" is\n\t\t\t// exactly the assumption that was silently wrong before this pass\n\t\t\t// (see reExecuteMainThread()'s doc comment). This exists so a\n\t\t\t// FUTURE regression in flush()'s own control flow (topologicalSort(),\n\t\t\t// the DAG walk, an error-listener notification) degrades to a\n\t\t\t// logged, contained failure instead of a repeat of that bug.\n\t\t\tqueueMicrotask(() => {\n\t\t\t\ttry {\n\t\t\t\t\tthis.flush();\n\t\t\t\t} catch (e) {\n\t\t\t\t\tconst engineError = normalizeUnknownError(e);\n\t\t\t\t\tconsole.error(`[AsyncResolutionBatcher] flush() failed unexpectedly — this should never happen; please report: ${engineError.format()}`);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Get the native event stream for stream-based consumers.\n\t *\n\t * Use this for backpressure, cancellation, or the ability\n\t * to `pipeTo()` / `pipeThrough()` the event flow.\n\t *\n\t * @returns A {@link ReadableStream} that emits {@link AsyncResolutionEvent}\n\t * items as the batcher processes async resolutions.\n\t */\n\tgetEventStream(): ReadableStream<AsyncResolutionEvent> {\n\t\treturn this._eventStream;\n\t}\n\n\t/** Number of resolutions currently queued for the next flush. */\n\tget pendingCount(): number {\n\t\treturn this.pending.length;\n\t}\n\n\t/** Number of pending entries collapsed by (packageId, queryKey) deduplication. */\n\tget dedupCount(): number {\n\t\tconst dedup = new Set<string>();\n\t\tfor (const entry of this.pending) {\n\t\t\tdedup.add(`${entry.packageId}:${entry.queryKey}`);\n\t\t}\n\t\treturn Math.max(0, this.pending.length - dedup.size);\n\t}\n\n\t/**\n\t * Whether the internal event stream currently has an active reader.\n\t * `1` if a consumer has called `getEventStream().getReader()` (or\n\t * otherwise locked the stream) and not released it, `0` otherwise.\n\t */\n\tget listenerCount(): number {\n\t\treturn this._eventStream.locked ? 1 : 0;\n\t}\n\n\t/** Number of flushes that were actually dispatched to the worker pool. */\n\tget workerOffloadCount(): number {\n\t\treturn this.workerOffloadDispatchCount;\n\t}\n\n\t/** Remove all listeners and cancel pending batch. Called on engine clear. */\n\tclearAll(): void {\n\t\tthis.pending = [];\n\t\tthis.scheduled = false;\n\t\tthis.cleared = true;\n\n\t\t// Clear test capture to match stream-close semantics, after\n\t\t// clearAll(), no further events reach old subscribers.\n\t\tthis._testCaptures = null;\n\t\tthis.onLineResult = null;\n\n\t\t// Close the old stream gracefully so existing consumers get a clean\n\t\t// done signal, then create a fresh stream. The engine instance (and\n\t\t// this batcher) survive clear(), so getEventStream() must keep\n\t\t// returning a live stream for new subscribers.\n\t\ttry {\n\t\t\tthis._streamController?.close();\n\t\t} catch {\n\t\t\t// Controller may already be closed or errored.\n\t\t}\n\t\tthis._streamController = null;\n\t\tthis._eventStream = this.createEventStream();\n\n\t\tif (this.executionPool) {\n\t\t\tthis.executionPool.clear();\n\t\t\tthis.executionPool = null;\n\t\t}\n\n\t\tthis.workerOffloadDispatchCount = 0;\n\t}\n\n\t// ── Private: flush ────────────────────────────────────────────────\n\n\t/**\n\t * Flush all pending resolutions in a single batched pass.\n\t *\n\t * Called automatically via queueMicrotask. Never called directly.\n\t */\n\tprivate flush(): void {\n\t\tthis.scheduled = false;\n\t\tif (this.cleared) return; // Engine was cleared — abort stale flush\n\t\tif (this.pending.length === 0) return;\n\n\t\t// Take ownership of the pending array (swap with empty).\n\t\tconst batch = this.pending;\n\t\tthis.pending = [];\n\n\t\t// Deduplicate by (packageId, queryKey), keep last entry per key.\n\t\tconst deduped = new Map<string, BatchEntry>();\n\t\tfor (const entry of batch) {\n\t\t\tconst compositeKey = `${entry.packageId}:${entry.queryKey}`;\n\t\t\tdeduped.set(compositeKey, entry);\n\t\t}\n\n\t\t// Step 1: Separate errors from successes, but re-evaluate for BOTH.\n\t\t// Error entries must also trigger DAG re-evaluation so downstream\n\t\t// lines can pick up the Error Value from AsyncResultCache.\n\t\tconst errorEntries: BatchEntry[] = [];\n\t\tconst okEntries: BatchEntry[] = [];\n\t\tfor (const entry of deduped.values()) {\n\t\t\tif (entry.isError) {\n\t\t\t\terrorEntries.push(entry);\n\t\t\t} else {\n\t\t\t\tokEntries.push(entry);\n\t\t\t}\n\t\t}\n\n\t\t// Notify error listeners first (before re-evaluation).\n\t\tfor (const entry of errorEntries) {\n\t\t\tif (entry.signal.aborted) continue;\n\t\t\tthis.notifyListeners({\n\t\t\t\ttype: \"error\",\n\t\t\t\tqueryKey: entry.queryKey,\n\t\t\t\tpackageId: entry.packageId,\n\t\t\t\terror: entry.error ?? new Error(\"Unknown async resolution error\"),\n\t\t\t});\n\t\t}\n\n\t\t// Step 2: Single DAG walk, collect ALL affected lines from ALL resolved\n\t\t// queryKeys (both success AND error). Errors also need re-evaluation so\n\t\t// downstream lines can receive errorValue() results.\n\t\tconst allAffected = new Set<number>();\n\t\tconst allQueryKeys: string[] = [];\n\n\t\tconst allEntries = [...okEntries, ...errorEntries];\n\t\tfor (const entry of allEntries) {\n\t\t\tif (entry.signal.aborted) continue;\n\t\t\tallQueryKeys.push(entry.queryKey);\n\n\t\t\tconst affected = this.dag.getAffectedLinesByDataSource(\n\t\t\t\tentry.packageId,\n\t\t\t\t[entry.queryKey],\n\t\t\t);\n\t\t\tfor (const line of affected) {\n\t\t\t\tallAffected.add(line);\n\t\t\t}\n\t\t}\n\n\t\tif (allAffected.size === 0) {\n\t\t\t// No lines affected, still notify listeners so UI can update\n\t\t\t// (e.g., clear loading indicators).\n\t\t\tthis.notifyListeners({\n\t\t\t\ttype: \"lines-updated\",\n\t\t\t\tlineNumbers: [],\n\t\t\t\taffectedQueryKeys: allQueryKeys,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\t// Step 3: Topological sort affected lines.\n\t\t// We need to re-evaluate in dependency order so that variable producers\n\t\t// execute before their consumers. We use getAffectedLinesInOrder() but\n\t\t// that requires a starting variable. Instead, we do our own Kahn's algo\n\t\t// on the subgraph of affected lines.\n\t\tconst ordered = this.topologicalSort(Array.from(allAffected));\n\n\t\t// Step 4: Re-execute all affected lines.\n\t\t// For ≤50 lines: main-thread synchronous loop (fast, no worker overhead).\n\t\t// For >50 lines: offload to worker pool to avoid UI freeze.\n\t\tif (ordered.length > WORKER_OFFLOAD_THRESHOLD) {\n\t\t\t// Build a Map for fast entry lookup in the worker dispatch path.\n\t\t\tconst entryMap = new Map<number, ReturnType<LineCache[\"getEntryForLine\"]>>();\n\t\t\tfor (const lineNumber of ordered) {\n\t\t\t\tentryMap.set(lineNumber, this.lineCache.getEntryForLine(lineNumber));\n\t\t\t}\n\t\t\t// .catch() is required, not optional: reExecuteViaWorkerPool() is an\n\t\t\t// async method dispatched with `void` (fire-and-forget), without a\n\t\t\t// handler here, a rejection (a worker crash, `executionPool.executeBatch`\n\t\t\t// throwing) becomes an unhandled promise rejection, the async\n\t\t\t// equivalent of the uncaught-exception risk `add()`'s queueMicrotask\n\t\t\t// backstop guards against for the synchronous path.\n\t\t\tvoid this.reExecuteViaWorkerPool(ordered, entryMap, allQueryKeys).catch((e) => {\n\t\t\t\tconst engineError = normalizeUnknownError(e);\n\t\t\t\tconsole.error(`[AsyncResolutionBatcher] reExecuteViaWorkerPool() failed unexpectedly: ${engineError.format()}`);\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tthis.reExecuteMainThread(ordered, allQueryKeys);\n\t}\n\n\t// ── Private: topological sort ─────────────────────────────────────\n\n\t/**\n\t * Topologically sort affected lines using Kahn's algorithm.\n\t *\n\t * Lines that produce variables come before lines that consume them.\n\t * This ensures correct evaluation order when multiple interdependent\n\t * lines are affected by async resolution.\n\t */\n\tprivate topologicalSort(lines: number[]): number[] {\n\t\tif (lines.length <= 1) return lines;\n\n\t\t// Build in-degree map and producer lookup.\n\t\tconst inDegree = new Map<number, number>();\n\t\tconst adjacency = new Map<number, number[]>();\n\n\t\t// Variable → producing line number (within affected set).\n\t\tconst producerOf = new Map<string, number>();\n\n\t\tfor (const line of lines) {\n\t\t\tinDegree.set(line, 0);\n\t\t\tadjacency.set(line, []);\n\t\t}\n\n\t\t// First pass: identify which variables are produced by which affected lines.\n\t\tfor (const line of lines) {\n\t\t\tconst writes = this.dag.getWrites(line);\n\t\t\tfor (const w of writes) {\n\t\t\t\tproducerOf.set(w, line);\n\t\t\t}\n\t\t}\n\n\t\t// Second pass: build edges from producer → consumer.\n\t\tfor (const line of lines) {\n\t\t\tconst reads = this.dag.getDependencies(line);\n\t\t\tfor (const readVar of reads) {\n\t\t\t\tconst producer = producerOf.get(readVar);\n\t\t\t\tif (producer !== undefined && producer !== line) {\n\t\t\t\t\tadjacency.get(producer)!.push(line);\n\t\t\t\t\tinDegree.set(line, (inDegree.get(line) ?? 0) + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Kahn's algorithm.\n\t\tconst queue: number[] = [];\n\t\tfor (const [line, degree] of inDegree) {\n\t\t\tif (degree === 0) queue.push(line);\n\t\t}\n\n\t\t// Fallback: if all lines have dependencies (cycles), sort by line number.\n\t\tif (queue.length === 0 && lines.length > 0) {\n\t\t\treturn [...lines].sort((a, b) => a - b);\n\t\t}\n\n\t\tconst ordered: number[] = [];\n\t\twhile (queue.length > 0) {\n\t\t\tconst current = queue.shift()!;\n\t\t\tordered.push(current);\n\n\t\t\tfor (const downstream of adjacency.get(current) ?? []) {\n\t\t\t\tconst newDegree = (inDegree.get(downstream) ?? 1) - 1;\n\t\t\t\tinDegree.set(downstream, newDegree);\n\t\t\t\tif (newDegree === 0) queue.push(downstream);\n\t\t\t}\n\t\t}\n\n\t\t// Append unresolvable lines (cycles).\n\t\tif (ordered.length < lines.length) {\n\t\t\tconst remaining = lines\n\t\t\t\t.filter((l) => !ordered.includes(l))\n\t\t\t\t.sort((a, b) => a - b);\n\t\t\tordered.push(...remaining);\n\t\t}\n\n\t\treturn ordered;\n\t}\n\n\t// ── Private: worker-pool re-execution ─────────────────────────────\n\n\t/**\n\t * Offload VM re-execution to the worker pool for large batches.\n\t *\n\t * Called when ordered.length > WORKER_OFFLOAD_THRESHOLD (50).\n\t * Clones bytecode ArrayBuffers, dispatches to workers, and asynchronously\n\t * patches results back into LineCache before notifying listeners.\n\t *\n\t * Handles pending results: lines that return { type: 'pending' } from the\n\t * worker are NOT marked as updated, the engine's resolveAsync will handle\n\t * them when the async resolver completes.\n\t *\n\t * Safety: checks this.cleared before applying results, if the engine was\n\t * cleared while the worker batch was in-flight, results are discarded.\n\t */\n\tprivate async reExecuteViaWorkerPool(\n\t\tordered: number[],\n\t\tentryMap: Map<number, ReturnType<LineCache[\"getEntryForLine\"]>>,\n\t\tallQueryKeys: string[],\n\t): Promise<void> {\n\t\t// Lazily create the pool on first use.\n\t\tif (!this.executionPool) {\n\t\t\tthis.executionPool = new ExecutionPool();\n\t\t}\n\n\t\tconst results = this.executionPool.executeBatch(ordered, entryMap);\n\n\t\t// If workers are unavailable (Node.js, SSR, test env without jsdom\n\t\t// worker support), executeBatch returns undefined. Fall back to\n\t\t// main-thread execution.\n\t\tif (!results) {\n\t\t\tthis.reExecuteMainThread(ordered, allQueryKeys, entryMap);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.workerOffloadDispatchCount++;\n\n\t\t// Await worker results.\n\t\tconst workerResults = await results;\n\n\t\t// Guard: if engine was cleared while the worker batch was in-flight,\n\t\t// discard results, the LineCache/DAG are stale.\n\t\tif (this.cleared) return;\n\n\t\t// Patch results back into LineCache.\n\t\tconst updatedLineNumbers: number[] = [];\n\t\tfor (const wr of workerResults) {\n\t\t\tconst entry = entryMap.get(wr.lineNumber);\n\t\t\tif (!entry) continue;\n\n\t\t\tif (wr.isPending) {\n\t\t\t\t// Don't mark as updated, will be resolved in a future batch.\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Reconstruct Value from serialized result.\n\t\t\tconst value = reconstructValue(wr);\n\t\t\tentry.result = value;\n\t\t\tthis.warnIfUnwired();\n\t\t\tthis.onLineResult?.(wr.lineNumber, value);\n\t\t\tupdatedLineNumbers.push(wr.lineNumber);\n\t\t}\n\n\t\t// Notify listeners (only if not cleared during await).\n\t\tif (this.cleared) return;\n\t\tif (updatedLineNumbers.length > 0 || allQueryKeys.length > 0) {\n\t\t\tthis.notifyListeners({\n\t\t\t\ttype: \"lines-updated\",\n\t\t\t\tlineNumbers: updatedLineNumbers,\n\t\t\t\taffectedQueryKeys: allQueryKeys,\n\t\t\t});\n\t\t}\n\t}\n\n\t// ── Private: main-thread re-execution ────────────────────────────\n\n\t/**\n\t * Execute ordered lines on the main thread, update LineCache, and notify\n\t * listeners. Returns the list of line numbers that actually changed.\n\t *\n\t * Used by both flush() (≤50 lines) and reExecuteViaWorkerPool() (fallback\n\t * when workers are unavailable). Extracted to avoid code duplication.\n\t *\n\t * **Per-line containment (fatal-bug fix)**: `executeBytecode()` used to\n\t * run here with NO try/catch anywhere in this method's call chain, and\n\t * this whole batch runs inside a bare `queueMicrotask` (see `add()`) with\n\t * no surrounding try/catch at any caller either, so if any ONE line's\n\t * cached bytecode threw (a stack/instruction-limit error, an undefined\n\t * variable, a corrupted-bytecode `TypeError`), the `for` loop aborted\n\t * immediately: every line scheduled AFTER the failure in this batch was\n\t * silently never re-executed or notified even though nothing was wrong\n\t * with them, every line BEFORE it had already had its `entry.result`\n\t * mutated in-place but `notifyListeners()` was never reached (a silent\n\t * `LineCache`/host desync), and, because a bare `queueMicrotask`\n\t * callback has no caller to catch it, the exception was uncatchable:\n\t * an `uncaughtException` that could crash the host process outright.\n\t * (`__tests__/async/AsyncResolutionBatcher.spec.ts`'s topological-sort\n\t * describe block used to have a test skipped specifically because of\n\t * this. See that file, now un-skipped and rewritten.) Each line's\n\t * execution is now its own try/catch: a failure is recorded as an\n\t * `Error` `Value` for THAT line (still counted as \"updated\" so the host\n\t * learns about it and stops showing a stale Pending state) and the loop\n\t * continues, one line's failure can no longer take out its neighbors.\n\t */\n\tprivate reExecuteMainThread(\n\t\tordered: number[],\n\t\tallQueryKeys: string[],\n\t\tentryMap?: Map<number, LineCacheEntry | undefined>,\n\t): number[] {\n\t\tconst updatedLineNumbers: number[] = [];\n\n\t\tfor (const lineNumber of ordered) {\n\t\t\tconst entry = entryMap\n\t\t\t\t? entryMap.get(lineNumber)\n\t\t\t\t: this.lineCache.getEntryForLine(lineNumber);\n\t\t\tif (!entry || entry.bytecode.opcodes.length === 0) continue;\n\n\t\t\t// Do NOT reset the VM here: reset() clears the variable table, which\n\t\t\t// would wipe values produced by earlier lines in this topologically\n\t\t\t// ordered batch (and by unaffected lines outside it). Instead, mirror\n\t\t\t// the engine's execution pattern: snapshot the stack depth and pop\n\t\t\t// back to it after execution.\n\t\t\tconst stackBefore = this.vm.getStack().length;\n\t\t\ttry {\n\t\t\t\tconst result = executeBytecode(entry.bytecode, this.vm);\n\t\t\t\twhile (this.vm.getStack().length > stackBefore) {\n\t\t\t\t\tthis.vm.pop();\n\t\t\t\t}\n\n\t\t\t\tif (result.type === \"value\") {\n\t\t\t\t\tentry.result = result.value;\n\t\t\t\t\tthis.warnIfUnwired();\n\t\t\t\t\tthis.onLineResult?.(lineNumber, result.value);\n\t\t\t\t\tupdatedLineNumbers.push(lineNumber);\n\t\t\t\t} else if (result.type === \"error\") {\n\t\t\t\t\t// executeBytecode() reports controlled failures (undefined\n\t\t\t\t\t// variable, stack/instruction limits, a plugin throw) as this\n\t\t\t\t\t// {type:'error'} return value now, not a thrown exception, the\n\t\t\t\t\t// catch block below only remains as a backstop for whatever\n\t\t\t\t\t// still throws outside that contract (e.g. a bug in the\n\t\t\t\t\t// stack-cleanup loop itself). Without this branch, a VM-level\n\t\t\t\t\t// error here fell through both the \"value\" and \"pending\" cases\n\t\t\t\t\t// silently: no entry.result update, no onLineResult, not counted\n\t\t\t\t\t// in updatedLineNumbers, the same class of silent-drop bug this\n\t\t\t\t\t// method's containment fix exists to prevent, just moved one\n\t\t\t\t\t// level up from \"uncaught exception\" to \"unhandled Result arm\".\n\t\t\t\t\tconst value = errorValue(result.error.code, result.error.message);\n\t\t\t\t\tentry.result = value;\n\t\t\t\t\tthis.warnIfUnwired();\n\t\t\t\t\tthis.warnIfUnwired();\n\t\t\t\tthis.onLineResult?.(lineNumber, value);\n\t\t\t\t\tupdatedLineNumbers.push(lineNumber);\n\t\t\t\t}\n\t\t\t\t// If still pending, don't mark as updated, will be handled by the\n\t\t\t\t// next resolution batch.\n\t\t\t} catch (e) {\n\t\t\t\t// Restore the stack to its pre-execution depth even on failure\n\t\t\t\t// a partially-executed opcode sequence may have pushed values it\n\t\t\t\t// never got to pop, and leaving them would corrupt every\n\t\t\t\t// subsequent line's execution in this same shared VM.\n\t\t\t\twhile (this.vm.getStack().length > stackBefore) {\n\t\t\t\t\tthis.vm.pop();\n\t\t\t\t}\n\t\t\t\tconst engineError = normalizeUnknownError(e);\n\t\t\t\tconst value = errorValue(engineError.code, engineError.message);\n\t\t\t\tentry.result = value;\n\t\t\t\tthis.warnIfUnwired();\n\t\t\t\tthis.onLineResult?.(lineNumber, value);\n\t\t\t\tupdatedLineNumbers.push(lineNumber);\n\t\t\t}\n\t\t}\n\n\t\t// Notify listeners of updated lines.\n\t\tif (updatedLineNumbers.length > 0 || allQueryKeys.length > 0) {\n\t\t\tthis.notifyListeners({\n\t\t\t\ttype: \"lines-updated\",\n\t\t\t\tlineNumbers: updatedLineNumbers,\n\t\t\t\taffectedQueryKeys: allQueryKeys,\n\t\t\t});\n\t\t}\n\n\t\treturn updatedLineNumbers;\n\t}\n\n\t/**\n\t * Notify all consumers of an async resolution event.\n\t *\n\t * Enqueues the event into the internal {@link ReadableStream}.\n\t * If the stream has been closed or errored (consumer cancelled),\n\t * the enqueue silently fails (caught by try/catch).\n\t */\n\tprivate notifyListeners(event: AsyncResolutionEvent): void {\n\t\t// Test capture, synchronous, no timing issues (enabled only in tests).\n\t\tif (this._testCaptures) {\n\t\t\tthis._testCaptures.push(event);\n\t\t}\n\n\t\tif (this._streamController) {\n\t\t\ttry {\n\t\t\t\tthis._streamController.enqueue(event);\n\t\t\t} catch {\n\t\t\t\t// Stream closed or errored, consumer may have cancelled.\n\t\t\t}\n\t\t}\n\t}\n}\n","// ── Allocation Tracker Telemetry Framework ─────────────────────────────────\n// Phase 1: Per-stage allocation + wall-time tracking for the 5-layer pipeline.\n//\n// Usage:\n// AllocationTracker.enable();\n// const { result, alloc } = AllocationTracker.track('lexer', () => lexer.tokenizeAll());\n// AllocationTracker.disable();\n//\n// Each track() call captures:\n// - Wall-clock time (via process.hrtime in Node.js, performance.now in browser)\n// - Heap delta (via process.memoryUsage in Node.js, unavailable in browser)\n// - Object counts (reserved for Phase 2+ with --expose-gc heap snapshots)\n//\n// Design principle: Zero overhead when disabled. The enabled flag is a static\n// boolean, a single branch that V8's JIT eliminates when allocation tracking\n// is disabled in production.\n\n\n// ── Types ─────────────────────────────────────────────────────────────────\n\n/** The pipeline stages allocation is attributed to. */\nexport type PipelineStage =\n | 'lexer'\n | 'normalizer'\n | 'parser'\n | 'resolver'\n | 'vm'\n | 'orchestrator';\n\n/** What one stage allocated during one measured span. */\nexport interface StageAllocation {\n /** Pipeline stage name. */\n stage: PipelineStage;\n /** Number of objects allocated (reserved, requires --expose-gc snapshots). */\n allocCount: number;\n /** Heap bytes allocated (delta of process.memoryUsage().heapUsed). */\n allocBytes: number;\n /** Breakdown of object types allocated (reserved, requires heap snapshots). */\n objectCounts: Record<string, number>;\n /** Wall-clock duration in nanoseconds. */\n wallTimeNs: number;\n /** Optional: sub-stage name for finer-grained tracking within a stage. */\n subStage?: string;\n /** Optional: whether this stage hit a cache (zero-parse, zero-lex). */\n cacheHit?: boolean;\n}\n\n/** Per-stage allocation for a single expression, in pipeline order. */\nexport interface PipelineTelemetry {\n /** The expression text that was evaluated. */\n expression: string;\n /** Per-stage allocation and timing data, in execution order. */\n stages: StageAllocation[];\n /** Total heap bytes allocated across all stages. */\n totalAllocBytes: number;\n /** Total wall-clock duration in nanoseconds. */\n totalWallTimeNs: number;\n /** Whether the expression took the orchestrator fast path. */\n fastPath: boolean;\n}\n\n/** Aggregate statistics across multiple pipeline runs. */\nexport interface StageAggregate {\n stage: PipelineStage;\n count: number;\n meanAllocBytes: number;\n meanWallTimeNs: number;\n minWallTimeNs: number;\n maxWallTimeNs: number;\n p50WallTimeNs: number;\n p95WallTimeNs: number;\n p99WallTimeNs: number;\n}\n\n// ── AllocationTracker ─────────────────────────────────────────────────────\n\n/**\n * Measures heap allocation per pipeline stage.\n *\n * A development tool: it reads `process.memoryUsage().heapUsed` around each\n * stage, which is only meaningful over the exact span it wraps. Widening a\n * measured span to cover more work does not measure more, it measures garbage\n * collection, and produces negative readings when a collection lands inside.\n */\nexport class AllocationTracker {\n /** Master kill-switch. Disabled in production, zero allocation overhead. */\n private static enabled: boolean = false;\n\n // ══ Lifecycle ═══════════════════════════════════════════════════════════\n\n /** Enable allocation tracking. Idempotent. */\n static enable(): void {\n this.enabled = true;\n }\n\n /** Disable allocation tracking. Idempotent. */\n static disable(): void {\n this.enabled = false;\n }\n\n /** Query whether tracking is currently enabled. */\n static isEnabled(): boolean {\n return this.enabled;\n }\n\n // ══ Core: Track a pipeline stage ═══════════════════════════════════════\n\n /**\n * Execute a function and capture allocation + wall-time data.\n *\n * When disabled, executes `fn()` with zero overhead (no measurements taken).\n * When enabled, captures heap delta via process.memoryUsage() (Node.js) and\n * wall-clock via process.hrtime() (Node.js) or performance.now() (browser).\n *\n * @param stage - Pipeline stage name (e.g., 'lexer', 'parser', 'vm').\n * @param fn - The pipeline stage function to execute and measure.\n * @param opts - Optional: sub-stage name and cache-hit flag.\n * @returns The function's result and the allocation/timing data.\n */\n static track<T>(\n stage: PipelineStage,\n fn: () => T,\n opts?: { subStage?: string; cacheHit?: boolean }\n ): { result: T; alloc: StageAllocation | null } {\n if (!this.enabled) {\n return { result: fn(), alloc: null };\n }\n\n // ══ Capture pre-execution state ══\n const startMem = typeof process !== 'undefined' && process.memoryUsage\n ? process.memoryUsage()\n : null;\n // hrtime() returns [seconds, nanoseconds]; performance.now() returns milliseconds\n const startTime = typeof process !== 'undefined' && process.hrtime\n ? process.hrtime()\n : performance.now();\n\n // ══ Execute the pipeline stage ══\n // Errors propagate naturally, track() must not swallow.\n const result = fn();\n\n // ══ Capture post-execution state ══\n const endTime = typeof process !== 'undefined' && process.hrtime\n ? process.hrtime(startTime as [number, number])\n : undefined;\n const endMem = typeof process !== 'undefined' && process.memoryUsage\n ? process.memoryUsage()\n : null;\n\n // Compute wall time:\n // Node.js: endTime is [seconds, nanoseconds] → convert to ns\n // Browser: endTime undefined, startTime is performance.now() → compute delta in ns\n const wallTimeNs: number = endTime\n ? endTime[0] * 1e9 + endTime[1]\n : (performance.now() - (startTime as number)) * 1e6;\n\n const allocBytes: number = startMem && endMem\n ? endMem.heapUsed - startMem.heapUsed\n : 0;\n\n const alloc: StageAllocation = {\n stage,\n allocCount: 0, // Reserved — requires --expose-gc heap snapshots (Phase 2+)\n allocBytes,\n objectCounts: {}, // Reserved — requires heap snapshots (Phase 2+)\n wallTimeNs,\n ...opts,\n };\n\n return { result, alloc };\n }\n\n // ══ Report Generation ══════════════════════════════════════════════════\n\n /**\n * Generate a markdown table from an array of PipelineTelemetry records.\n *\n * Aggregates by stage and outputs mean/min/max wall time, mean alloc bytes,\n * and p50/p95/p99 percentiles.\n *\n * @param telemetry - Array of pipeline telemetry records from multiple runs.\n * @param title - Optional title for the markdown section.\n * @returns A markdown-formatted string with per-stage and total aggregate tables.\n */\n static generateReport(telemetry: PipelineTelemetry[], title?: string): string {\n const lines: string[] = [];\n\n lines.push(title ? `## ${title}` : '## Pipeline Allocation Report');\n lines.push('');\n lines.push(`**Runs:** ${telemetry.length} | **Generated:** ${new Date().toISOString()}`);\n lines.push('');\n\n // Aggregate by stage\n const aggregate = this.aggregate(telemetry);\n\n if (aggregate.length === 0) {\n lines.push('_No telemetry data._');\n return lines.join('\\n');\n }\n\n // Per-stage table\n lines.push('### Per-Stage Breakdown');\n lines.push('');\n lines.push('| Stage | Count | Mean Wall (µs) | Mean Alloc (bytes) | Min (µs) | Max (µs) | p50 (µs) | p95 (µs) | p99 (µs) |');\n lines.push('|-------|:-----:|:--------------:|:------------------:|:--------:|:--------:|:--------:|:--------:|:--------:|');\n\n for (const agg of aggregate) {\n lines.push(\n `| ${agg.stage} | ${agg.count} | ` +\n `${(agg.meanWallTimeNs / 1000).toFixed(2)} | ` +\n `${agg.meanAllocBytes.toFixed(0)} | ` +\n `${(agg.minWallTimeNs / 1000).toFixed(2)} | ` +\n `${(agg.maxWallTimeNs / 1000).toFixed(2)} | ` +\n `${(agg.p50WallTimeNs / 1000).toFixed(2)} | ` +\n `${(agg.p95WallTimeNs / 1000).toFixed(2)} | ` +\n `${(agg.p99WallTimeNs / 1000).toFixed(2)} |`\n );\n }\n\n // Total stats\n const totalAllocBytes = telemetry.reduce((sum, t) => sum + t.totalAllocBytes, 0);\n const totalWallNs = telemetry.reduce((sum, t) => sum + t.totalWallTimeNs, 0);\n const fastPathCount = telemetry.filter(t => t.fastPath).length;\n\n lines.push('');\n lines.push('### Totals');\n lines.push('');\n lines.push(`- **Total wall time:** ${(totalWallNs / 1e6).toFixed(2)} ms (${telemetry.length} runs)`);\n lines.push(`- **Total heap allocated:** ${totalAllocBytes.toLocaleString()} bytes`);\n lines.push(`- **Fast-path runs:** ${fastPathCount}/${telemetry.length} (${((fastPathCount / telemetry.length) * 100).toFixed(0)}%)`);\n lines.push(`- **Mean per-run:** ${(totalWallNs / telemetry.length / 1000).toFixed(2)} µs, ${(totalAllocBytes / telemetry.length).toFixed(0)} bytes`);\n\n return lines.join('\\n');\n }\n\n /**\n * Aggregate PipelineTelemetry records by stage.\n *\n * Computes count, mean/min/max wall time, mean alloc bytes, and\n * p50/p95/p99 percentiles for each pipeline stage.\n */\n static aggregate(telemetry: PipelineTelemetry[]): StageAggregate[] {\n const stageMap = new Map<PipelineStage, StageAllocation[]>();\n\n // Collect all stage allocations by stage\n for (const t of telemetry) {\n for (const s of t.stages) {\n if (!stageMap.has(s.stage)) {\n stageMap.set(s.stage, []);\n }\n stageMap.get(s.stage)!.push(s);\n }\n }\n\n // Compute aggregates\n const result: StageAggregate[] = [];\n for (const [stage, allocations] of stageMap) {\n const wallTimes = allocations.map(a => a.wallTimeNs).sort((a, b) => a - b);\n const allocBytes = allocations.map(a => a.allocBytes);\n const count = allocations.length;\n\n result.push({\n stage,\n count,\n meanAllocBytes: allocBytes.reduce((s, v) => s + v, 0) / count,\n meanWallTimeNs: wallTimes.reduce((s, v) => s + v, 0) / count,\n minWallTimeNs: wallTimes[0],\n maxWallTimeNs: wallTimes[wallTimes.length - 1],\n p50WallTimeNs: percentile(wallTimes, 50),\n p95WallTimeNs: percentile(wallTimes, 95),\n p99WallTimeNs: percentile(wallTimes, 99),\n });\n }\n\n // Sort by stage name for consistent output\n result.sort((a, b) => a.stage.localeCompare(b.stage));\n return result;\n }\n\n /**\n * Create a PipelineTelemetry from a collection of StageAllocations.\n *\n * @param expression - The expression that was evaluated.\n * @param stages - Per-stage allocation data in execution order.\n * @param fastPath - Whether the orchestrator took the fast path.\n */\n static createTelemetry(\n expression: string,\n stages: StageAllocation[],\n fastPath: boolean = false\n ): PipelineTelemetry {\n const totalAllocBytes = stages.reduce((sum, s) => sum + s.allocBytes, 0);\n const totalWallTimeNs = stages.reduce((sum, s) => sum + s.wallTimeNs, 0);\n return { expression, stages, totalAllocBytes, totalWallTimeNs, fastPath };\n }\n}\n\n// ── Helpers ───────────────────────────────────────────────────────────────\n\n/**\n * Compute the nth percentile from a sorted array of numbers.\n * Uses linear interpolation between neighboring values.\n */\nfunction percentile(sorted: number[], p: number): number {\n if (sorted.length === 0) return 0;\n if (sorted.length === 1) return sorted[0];\n\n const index = (p / 100) * (sorted.length - 1);\n const lower = Math.floor(index);\n const upper = Math.ceil(index);\n if (lower === upper) return sorted[lower];\n\n const fraction = index - lower;\n return sorted[lower] * (1 - fraction) + sorted[upper] * fraction;\n}\n","import type { Token } from \"@solve-js/lexer/Token\";\nimport { InlineSolvePosition } from \"@solve-js/types/ParsingResult\";\nimport { ErrorFactory, type EngineError } from \"@solve-js/errors/UnifiedErrorFramework\";\nimport { numberValue, Value } from \"@solve-js/vm/Value\";\nimport { BytecodeProgram } from \"@solve-js/parser/BytecodeBuilder\";\n// Deliberately the shared lexer, not an engine's own.\n//\n// `classifyLine` and `findInlineSolves` are character-level scans for headings,\n// comment markers, code fences and backtick spans. Neither consults the\n// keyword, unit or operator tables, so every lexer returns the same answer and\n// there is nothing per-engine to respect. Pinned by\n// __tests__/lexer/LineClassificationIsVocabularyIndependent.spec.ts, which\n// compares a bare lexer against one carrying extra vocabulary.\n//\n// This matters because these are free functions with no engine to ask. Making\n// them engine-aware would mean changing their signatures and every caller for\n// no behavioural difference.\nimport { sharedLexer } from \"@solve-js/lexer/Lexer\";\nimport { globalDagKey } from \"@solve-js/vm/GlobalVariableStore\";\n\n// ── Validation config ────────────────────────────────────────────────────\n\n/** Bounds applied to input before parsing: length and nesting depth. */\nexport interface ValidationConfig {\n maxExpressionLength: number;\n maxComplexity: number;\n}\n\n// ── Safety result ─────────────────────────────────────────────────────────\n\n/** Whether input passed the safety bounds, and which one it failed. */\nexport interface SafetyCheckResult {\n passed: boolean;\n /**\n * `error.error` (a plain string) exists purely because it's spread\n * directly into `evaluateExpressionWithDiagnostic()`'s own return shape\n * (`{value, tokens, program, error?: string, ...}`), which deliberately\n * keeps errors as display strings for the debug/diagnostic pipeline\n * see that method's own doc comment. `error.engineError` is additive\n * (doesn't replace the string field, so existing consumers of this\n * exported type are unaffected): it carries the real EngineError this\n * check constructed internally, so callers that DO want the original\n * code/category/expected/found/suggestion (prepareExpression(), not the\n * diagnostic pipeline) don't have to reconstruct a generic one from just\n * the flattened message.\n */\n error?: { value: Value; tokens: Token[]; program: BytecodeProgram; error: string; engineError?: EngineError };\n}\n\n// ── Safety checks ─────────────────────────────────────────────────────────\n\n/**\n * Check that the expression doesn't exceed the maximum allowed length.\n */\nexport function checkExpressionLength(\n expression: string,\n config: ValidationConfig\n): SafetyCheckResult {\n if (expression.length > config.maxExpressionLength) {\n const err = ErrorFactory.validation(\n \"EXPRESSION_TOO_LONG\",\n `Expression exceeds max length of ${config.maxExpressionLength} characters (got ${expression.length})`,\n { expressionLength: expression.length, maxLength: config.maxExpressionLength }\n );\n return {\n passed: false,\n error: {\n value: numberValue(0),\n tokens: [],\n program: { opcodes: new Uint8Array(0), numbers: new Float64Array(0), strings: [], hasAsync: false },\n error: err.message,\n engineError: err,\n },\n };\n }\n return { passed: true };\n}\n\n/**\n * Score expression complexity based on token count, function calls, and nesting depth.\n * Returns the complexity score and whether it exceeds the configured maximum.\n */\nexport function checkExpressionComplexity(\n tokens: Token[],\n config: ValidationConfig\n): { passed: boolean; complexityScore: number; errorMessage?: string; engineError?: EngineError } {\n let functionCallCount = 0;\n let nestingDepth = 0;\n let maxParens = 0;\n for (const t of tokens) {\n if (t.type === \"FUNC\") functionCallCount++;\n if (t.value === \"(\" || t.type === \"LPAREN\") { nestingDepth++; maxParens = Math.max(maxParens, nestingDepth); }\n if (t.value === \")\" || t.type === \"RPAREN\") nestingDepth--;\n }\n const complexityScore = tokens.length + functionCallCount * 5 + maxParens * 10;\n if (complexityScore > config.maxComplexity) {\n const err = ErrorFactory.validation(\n \"EXPRESSION_TOO_COMPLEX\",\n `Expression complexity score ${complexityScore} exceeds maximum of ${config.maxComplexity}`,\n { complexity: complexityScore, maxComplexity: config.maxComplexity }\n );\n return { passed: false, complexityScore, errorMessage: err.message, engineError: err };\n }\n return { passed: true, complexityScore };\n}\n\n// ── Read/write extraction ─────────────────────────────────────────────────\n\n/**\n * Guard: true if the token is a valid variable name type.\n * Accepts both IDENT and UNIT tokens, UNIT occurs when the variable name\n * collides with a known unit (e.g., \"b\" for bits, \"s\" for seconds).\n */\nfunction isVarName(t: Token): boolean {\n return t.type === \"IDENT\" || t.type === \"UNIT\";\n}\n\n/**\n * True if a UNIT token at this position is being consumed as a\n * unit-of-measure literal rather than a variable reference, i.e. it's\n * immediately preceded by a value (NUMBER, a closing paren) or a\n * conversion keyword (TO, IN). This mirrors exactly where\n * UomLiteralParselet/ConvertParselet/PercentageChangeParselet accept a\n * UNIT token themselves: `500 EUR`, `(x + y) km`, `to JPY`, `in m`.\n * In all of these the compiler emits PUSH_STRING for the unit name, not\n * LOAD_VAR, so treating them as a DAG read is a false positive, the\n * classic case being any bare currency/unit conversion like\n * \"500 EUR to JPY\", which falsely reported \"EUR\" and \"JPY\" as variable\n * dependencies even though the compiled bytecode never loads a variable.\n */\nfunction isUnitLiteralContext(prev: Token): boolean {\n return prev.type === \"NUMBER\" || prev.type === \"TO\" || prev.type === \"IN\" || prev.type === \"RPAREN\";\n}\n\n/**\n * From an LPAREN token index, scan forward tracking paren depth and return\n * the index of the matching RPAREN, or `null` if unbalanced. Mirrors\n * `PrecedenceParser.ts`'s `findMatchingRParen`, necessarily duplicated\n * here since this file is a standalone, parser-instance-free static token\n * scan (same \"dead-code-but-must-stay-synced mirror\" pattern as\n * `NumberParselet.ts`).\n */\nfunction findMatchingRParenIdx(tokens: Token[], openIdx: number): number | null {\n let depth = 0;\n for (let i = openIdx; i < tokens.length; i++) {\n if (tokens[i].type === \"LPAREN\") depth++;\n else if (tokens[i].type === \"RPAREN\") {\n depth--;\n if (depth === 0) return i;\n }\n }\n return null;\n}\n\n/**\n * Pre-scan for user-defined-function DEFINITION shapes (`name(params) =\n * body`) to collect the set of PARAMETER names that must be excluded from\n * `reads`/`writes` in {@link extractReadsAndWrites} below. Without this, a\n * parameter name colliding with an unrelated document-level `:variable` of\n * the same name would register a spurious DAG dependency, `f(x) = 2*x+1`\n * must not depend on some unrelated `:x` defined elsewhere in the document,\n * and `x` itself must never be reported as a document-level WRITE (the\n * parameter isn't being assigned to at document scope at all). Scoped to a\n * single line's own token stream, matching how `extractReadsAndWrites` is\n * already called per-line, no cross-line interference with an unrelated\n * `:x` on a different line.\n */\nfunction collectFunctionParamNames(tokens: Token[]): Set<string> {\n const excluded = new Set<string>();\n for (let i = 0; i < tokens.length; i++) {\n if (!isVarName(tokens[i])) continue;\n if (i > 0 && tokens[i - 1].type === \"COLON\") continue; // :name(...) is a different grammar entirely\n if (tokens[i + 1]?.type !== \"LPAREN\") continue;\n const closeIdx = findMatchingRParenIdx(tokens, i + 1);\n if (closeIdx === null) continue;\n if (tokens[closeIdx + 1]?.type !== \"EQUALS\") continue; // a CALL, not a DEFINITION — no params to exclude\n for (let j = i + 2; j < closeIdx; j++) {\n if (isVarName(tokens[j])) excluded.add(tokens[j].value);\n }\n }\n return excluded;\n}\n\n/**\n * Extract variable reads and writes from a token stream.\n *\n * Handles both IDENT and UNIT tokens as potential variable references.\n * UNIT tokens occur when the variable name collides with a known unit\n * (e.g., \"b\" for bits, \"s\" for seconds). The colon prefix unambiguously\n * signals a variable definition context (handled by VariableParselet).\n * A standalone UNIT token is only a real variable reference when it\n * isn't in unit-literal position (see {@link isUnitLiteralContext})\n * otherwise it's a quantity/conversion unit name, never LOAD_VAR'd.\n *\n * Also detects user-defined-function DEFINITIONS (`name(params) = body`)\n * as a read+write of the function's own name, mirroring `:name = value`'s\n * existing convention of registering the defined name as both, and\n * excludes the definition's own PARAMETER names from reads/writes\n * entirely (see {@link collectFunctionParamNames}). A function CALL\n * (`name(args)`, no trailing `=`) needs no special detection: the call's\n * own name falls through to the ordinary bare-identifier read-tracking\n * below, the same as any other `LOAD_VAR`-producing identifier. This is\n * already correct once calls compile successfully, no change needed.\n */\nexport function extractReadsAndWrites(tokens: Token[]): { reads: string[]; writes: string[] } {\n const reads: string[] = [];\n const writes: string[] = [];\n const functionParamNames = collectFunctionParamNames(tokens);\n\n for (let i = 0; i < tokens.length; i++) {\n const t = tokens[i];\n if (t.type === \"GLOBAL\") {\n // global :name [= expr], GLOBAL, COLON, IDENT/UNIT are three\n // separate tokens (matching GlobalVariableParselet). Emit a\n // \"global:\"-prefixed synthetic name into THIS document's own\n // DAG (via globalDagKey) so a local :hello and global :hello\n // never collide in this document's own reads/writes tracking\n // the bare-COLON branch below explicitly skips the colon that\n // follows GLOBAL, since it's handled here instead.\n if (i + 2 < tokens.length && tokens[i + 1].type === \"COLON\" && isVarName(tokens[i + 2])) {\n const key = globalDagKey(tokens[i + 2].value);\n reads.push(key);\n if (i + 3 < tokens.length && tokens[i + 3].type === \"EQUALS\") {\n writes.push(key);\n }\n }\n continue;\n }\n if (t.type === \"COLON\") {\n // Skip. This colon belongs to a `global :name` sequence\n // already handled by the GLOBAL branch above.\n if (i > 0 && tokens[i - 1].type === \"GLOBAL\") continue;\n // The moo lexer produces COLON as a bare \":\" token. The variable\n // name follows as a separate IDENT or UNIT token (matching VariableParselet).\n if (i + 1 < tokens.length && isVarName(tokens[i + 1])) {\n const varName = tokens[i + 1].value;\n reads.push(varName);\n // Colon-prefix variable definition: :name = expr\n // COLON + IDENT/UNIT are separate tokens, so EQUALS is at i+2.\n if (i + 2 < tokens.length && tokens[i + 2].type === \"EQUALS\") {\n writes.push(varName);\n }\n }\n }\n if (isVarName(t)) {\n // Skip if already consumed by preceding COLON handler above.\n if (i > 0 && tokens[i - 1].type === \"COLON\") continue;\n // Skip UNIT tokens acting as a quantity/conversion unit name\n // rather than a variable (see isUnitLiteralContext above).\n if (t.type === \"UNIT\" && i > 0 && isUnitLiteralContext(tokens[i - 1])) continue;\n // A user-defined-function's own PARAMETER name, never a\n // document-level read or write (see collectFunctionParamNames).\n if (functionParamNames.has(t.value)) continue;\n // A user-defined-function DEFINITION's own name: `name(params) =\n // body`. Registered as both a read and a write, mirroring\n // `:name = value`'s existing convention just below.\n if (tokens[i + 1]?.type === \"LPAREN\") {\n const closeIdx = findMatchingRParenIdx(tokens, i + 1);\n if (closeIdx !== null && tokens[closeIdx + 1]?.type === \"EQUALS\") {\n reads.push(t.value);\n writes.push(t.value);\n continue;\n }\n // else: a CALL (or malformed), falls through below, same as\n // any other bare identifier read.\n }\n reads.push(t.value);\n // Check if next token is EQUALS -> this is a write\n if (i + 1 < tokens.length && tokens[i + 1].type === \"EQUALS\") {\n writes.push(t.value);\n }\n }\n }\n return { reads, writes };\n}\n\n// ── Line classification ───────────────────────────────────────────────────\n\n/**\n * Check if a line is effectively empty (whitespace only or only markdown syntax).\n *\n * Phase B: Delegates to the ExpressionLexer's character-by-character\n * markdown line scanner, replacing the old regex-based heuristics.\n *\n * Skips lines that contain no evaluable expression:\n * - Whitespace-only lines\n * - Markdown structural markers (headings, blockquotes, lists without inline solves)\n * - Code block fences (```)\n * - MathJax block fences ($$)\n * - Table separator rows (|---|)\n * - Horizontal rules (---, ***, ___)\n * - Standalone wikilinks / embeds ([[...]], ![[...]])\n * - Whole-line comments (a line whose first non-whitespace characters are `//`)\n *\n * Lines containing inline solves (s\\`...\\`) are never considered empty.\n *\n * Note: a trailing `#`/`//` comment in the MIDDLE of an otherwise-evaluable\n * line does NOT make isEmptyLine() return true, that line is still an\n * \"expression\" line (skip: false). The comment is instead stripped at\n * tokenization time (ExpressionLexer's HASH/`//` handling emits a COMMENT\n * token for the rest of the line) and then filtered out of the token\n * stream by ExpressionEngine.prepareExpression() before parsing, so\n * `<expr> // note` evaluates identically to `<expr>` alone.\n */\nexport function isEmptyLine(lineText: string): boolean {\n const classification = sharedLexer.classifyLine(lineText);\n return classification.skip;\n}\n\n/**\n * Find all inline solves in a line with precise coordinate mapping.\n *\n * Phase B: Delegates to the ExpressionLexer's character-by-character\n * scanner (no regex, handles escaped backticks).\n */\nexport function findInlineSolvesInLine(lineText: string, lineNumber: number): InlineSolvePosition[] {\n const spans = sharedLexer.findInlineSolves(lineText);\n return spans.map(s => ({\n start: s.start,\n end: s.end,\n expression: s.expression,\n lineNumber,\n columnNumber: s.columnNumber,\n }));\n}\n","//#region Imports\n\nimport { VM, type EquationDef, type ScalarEquationDef } from \"@solve-js/vm/OpRegistry\";\nimport { matrixMultiply, inverse } from \"@solve-js/vm/MatrixOps\";\nimport { DependencyGraph } from \"@solve-js/vm/DependencyGraph\";\nimport { LineCache, LineCacheEntry } from \"@solve-js/cache/LineCache\";\nimport { ScopeManager } from \"@solve-js/vm/ScopeManager\";\nimport { Lexer } from \"@solve-js/lexer/Lexer\";\nimport { PrecedenceParser } from \"@solve-js/parser/PrecedenceParser\";\nimport { ParseletRegistry } from \"@solve-js/parser/registry/ParseletRegistry\";\nimport { BytecodeBuilder, type BytecodeProgram } from \"@solve-js/parser/BytecodeBuilder\";\nimport { createVM, executeBytecode } from \"@solve-js/vm/VM\";\nimport type { EvalResult, LineExecutionContext } from \"@solve-js/vm/VM\";\nimport type { DocumentModel } from \"@solve-js/engine/DocumentModel\";\nimport { registerAsConverter, unregisterAsConverter } from \"@solve-js/vm/VMBuiltins\";\nimport { createEngineContext } from \"@solve-js/engine/EngineContext\";\nimport type { EngineContext } from \"@solve-js/engine/EngineContext\";\nimport { Value, ValueType, numberValue, stringValue, pendingValue, freezeIfDev, errorValue, type MatrixData } from \"@solve-js/vm/Value\";\nimport { BUILTIN_PACKAGES } from \"@solve-js/packages/builtins\";\nimport type { IEnginePackage } from \"@solve-js/api/PackageRegistry\";\nimport { checkPackageCompatibility } from \"@solve-js/api/PackageCompatibility\";\nimport { assertEngineVersionCompatible } from \"@solve-js/api/EngineVersionCompatibility\";\nimport { registerTokenCategory, unregisterTokenCategory } from \"@solve-js/language/TokenCategoryMap\";\nimport type { CompletionItem } from \"@solve-js/language/LanguageService\";\nimport type { LexerVocabulary } from \"@solve-js/lexer/ExpressionLexer\";\nimport { QueryClient } from \"@tanstack/query-core\";\nimport { createQueryClient, setActiveQueryClient, getActiveQueryClient } from \"@solve-js/services/DataQueryService\";\nimport { ErrorFactory, EngineError, normalizeUnknownError } from \"@solve-js/errors/UnifiedErrorFramework\";\nimport { countLines } from \"@solve-js/utilities/Strings\";\nimport {\n\tResolverRegistry,\n} from \"@solve-js/resolvers/ResolverRegistry\";\nimport {\n\tAsyncResolutionBatcher,\n\ttype AsyncResolutionEvent,\n} from \"@solve-js/engine/AsyncResolutionBatcher\";\nimport { AllocationTracker, type PipelineTelemetry, type StageAllocation } from \"@solve-js/telemetry\";\nimport {\n ParsingResult,\n ParsedLine,\n InlineSolvePosition,\n UnifiedParsingOptions,\n} from \"@solve-js/types/ParsingResult\";\nimport { DiagnosticReportJSON } from \"@solve-js/diagnostics\";\nimport type { Token, ScanLineResult } from \"@solve-js/lexer\";\nimport { DEFAULT_CONFIG, mergeEngineConfig, type EngineConfig } from \"@solve-js/constants/Configuration\";\nimport {\n DiagnosticPipeline,\n TimelineDiagnosticCollector,\n DiagnosticEventType\n} from \"@solve-js/diagnostics\";\nimport {\n checkExpressionLength,\n checkExpressionComplexity,\n extractReadsAndWrites,\n} from \"@solve-js/engine/ExpressionEngineSafety\";\nimport { buildTokenLookup } from \"@solve-js/lexer/tokenRegistration\";\nimport { containsSymbolicCall } from \"@solve-js/packages/symbolic\";\nimport { solveEquationValues } from \"@solve-js/vm/SymbolicOps\";\nimport { abortLogger } from \"@solve-js/utilities/AbortControllerLogger\";\nimport { TokenNormalizer, BUILTIN_PHRASES, implicitMultiplyRule } from \"@solve-js/normalizer\";\nimport type { TokenFusion } from \"@solve-js/normalizer\";\nimport {\n type DiagnosticPipelineResult,\n type PipelineStageResult,\n type StageOutput,\n type InlineSolveSpanInfo,\n type CacheSnapshot,\n type BatcherMetrics,\n type CheckpointSnapshot,\n type BytecodeCacheEntry,\n type LineCacheEntryInfo,\n type AsyncCachePackageInfo,\n} from \"@solve-js/types/DiagnosticPipelineResult\";\n\n// Re-export for consumers (playground imports these from ExpressionEngine)\nexport type { CacheSnapshot, BatcherMetrics, CheckpointSnapshot, BytecodeCacheEntry, LineCacheEntryInfo, AsyncCachePackageInfo };\nexport type { DagSnapshot } from \"@solve-js/vm/DependencyGraph\";\n\n/**\n * Return type of {@link evaluateLine} and {@link evaluateExpression}.\n *\n * A single-element `Value[]`, kept as an array (rather than a bare\n * `Value`) for API stability.\n */\nexport interface EvalResults extends Array<Value> {}\n\n/** Explicit result of {@link ExpressionEngine.evaluateLineDetailed}. */\nexport interface LineEvaluation {\n /** The evaluated value, wrapped in a single-element array. */\n values: Value[];\n}\n\n//#endregion\n\n/**\n * Core expression evaluation engine, the top-level orchestrator.\n *\n * Owns the full evaluation pipeline: lexing, parsing, bytecode compilation,\n * VM execution, DAG-based dependency tracking, and async resolution.\n *\n * Key responsibilities:\n * - Pipeline orchestration: lex → parse → compile → execute → cache\n * - Bytecode caching for repeated expressions\n * - DAG-based incremental re-evaluation on variable changes\n * - Async resolution via ResolverRegistry + AsyncResolutionBatcher\n * - Package registration (built-in + external plugins)\n * - Safety validation (length, complexity, nesting)\n * - Diagnostic pipeline integration\n * - Keystroke-level AbortSignal management\n *\n * Each engine instance has its own isolated lexer, registry, parser, and\n * LineCache. The VM uses this engine's own opcode registry, and each engine\n * creates its own VM instance with configurable limits.\n *\n * ## Lifecycle\n *\n * Call {@link ExpressionEngine.clear} when you are finished with an engine that\n * has parsed a document. Dropping your last reference is not sufficient: the\n * async batcher is reachable from the module-level data-query service, so a\n * parsed engine stays retained until `clear()` releases it. Measured per engine\n * after a forced collection, with a 40-line document:\n *\n * | Lifecycle | Retained |\n * | --- | --- |\n * | constructed, never parsed | 8.2KB |\n * | constructed and parsed | 46.9KB |\n * | constructed, parsed, cleared | 10.0KB |\n *\n * This matters for hosts that create one engine per document or per tab, which\n * is the intended usage. Reusing a single engine across documents is also fine:\n * `clear()` resets it for the next one rather than consuming it.\n *\n * @example\n * ```typescript\n * import { ExpressionEngine } from \"solve-engine\";\n * const engine = new ExpressionEngine(\"en\");\n * const [value] = engine.evaluateExpression(\"2 + 2 * 10\");\n * console.log(value.toNumber()); // 22\n * ```\n */\n//#region Class: ExpressionEngine\n\nexport class ExpressionEngine {\n //#region Private Properties\n private dag = new DependencyGraph();\n private lineCache = new LineCache();\n private scopeManager = new ScopeManager();\n private lexer: Lexer;\n private registry: ParseletRegistry;\n private parser: PrecedenceParser;\n private localeCode: string;\n private vm: VM;\n /**\n * Registries this engine owns, rather than shares with every other\n * instance in the process. See {@link EngineContext}.\n */\n private readonly context: EngineContext;\n private config: typeof DEFAULT_CONFIG;\n private diagnosticPipeline: DiagnosticPipeline;\n /**\n * Direct reference to the timeline collector registered above (when\n * diagnosticMode is on), kept alongside the generic `diagnosticPipeline`\n * so `evaluateExpressionWithDiagnostic()` can cheaply read its current\n * `parseletMatchCount` as a \"before\" baseline without paying for a full\n * `getReport()` build (which copies the whole cumulative parselets\n * array). See that method's use of it for why a baseline is needed at\n * all, `TimelineDiagnosticCollector`'s state is deliberately cumulative\n * across an entire document pass, not reset per line.\n */\n private timelineCollector?: TimelineDiagnosticCollector;\n /** Registry of async resolvers from registered packages. */\n private resolverRegistry = new ResolverRegistry();\n\n /**\n * Per-package record of contributions made to the SHARED registries\n * (this engine's variable resolver / resolver namespaces), so\n * {@link unregisterPackage} can reverse them. Keyed by package name.\n */\n private packageContributions = new Map<string, {\n pluginFunctionIndices: number[];\n variableSources: import(\"@solve-js/variables/IVariableSource\").IVariableSource[];\n resolverNamespaces: string[];\n tokenCategories: string[];\n lexerVocabulary: LexerVocabulary | undefined;\n asConverterNames: string[];\n normalizerRuleNames: string[];\n }>();\n\n /**\n * The actual `IEnginePackage` descriptor of every package currently\n * registered on this engine instance, keyed by name, separate from\n * {@link packageContributions} (which tracks what was WRITTEN into\n * shared registries, not the original descriptor). Used by\n * {@link registerPackage}'s automatic `checkPackageCompatibility()` call\n *. See `api/PackageCompatibility.ts`'s module doc for why this exists.\n */\n private registeredPackages = new Map<string, IEnginePackage>();\n\n /**\n * The `DocumentModel` this engine is currently evaluating, if any\n * `null` for a bare engine with no document (e.g. anything only ever\n * calling `evaluateExpression()`). `ExpressionEngine` doesn't own its\n * `DocumentModel` (`ThreeTierEvaluator` constructs and owns both as\n * siblings). This is set once, via {@link setDocumentModel}, purely so\n * {@link makeLineContext} can answer \"what's line N's cached result\"\n * for cross-line features (`prev`/`line<N>`/aggregation. See\n * `packages/lines/`) without the engine needing to own document\n * lifecycle itself.\n */\n private documentModel: DocumentModel | null = null;\n\n /**\n * Called once by `ThreeTierEvaluator`'s constructor. Not part of the\n * public evaluate-a-document contract, purely internal wiring so\n * {@link makeLineContext} has something to read from.\n */\n setDocumentModel(doc: DocumentModel | null): void {\n this.documentModel = doc;\n }\n\n /**\n * Build the {@link LineExecutionContext} passed to `executeBytecode()`\n * for a given line. `lineNumber = -1` (the existing sentinel\n * `evaluateExpression()`/`evaluateLine(-1, ...)` already use for \"no\n * real document\") naturally produces a context with both closures\n * `undefined`, a cross-line plugin function must check for that itself\n * and return a clear error, never assume line 0 exists.\n */\n private makeLineContext(lineNumber: number): LineExecutionContext {\n const doc = this.documentModel;\n return {\n lineIndex: lineNumber,\n getLineResult: doc ? (n: number) => doc.getLineAt(n)?.result ?? undefined : undefined,\n isLineBoundary: doc\n ? (n: number) => {\n const state = doc.getLineAt(n);\n if (!state) return true; // out of range counts as a boundary — nothing to aggregate past it\n return state.isEmpty || /^\\s*#/.test(state.text);\n }\n : undefined,\n };\n }\n\n /**\n * Package-contributed completion candidates (`IEnginePackage.completionItems`),\n * keyed by package name, engine-instance-local, not a shared registry\n * (unlike tokenCategories), so no separate register/unregister module is\n * needed: registerPackage()/unregisterPackage() just set/delete the\n * package's own entry. {@link getPackageCompletionItems} flattens it.\n */\n private packageCompletionItems = new Map<string, CompletionItem[]>();\n\n /**\n * Keystroke-level AbortSignal, set by the UI layer (MarkdownEditorViewPlugin)\n * before each evaluation. When the user types a new keystroke, the old signal\n * is aborted, causing all in-flight async work (fetches, preflight checks,\n * batcher flushes) to be canceled atomically.\n *\n * executeAndStore() and executeRaw() link their local AbortControllers to\n * this signal so that when the keystroke changes, all per-evaluation controllers\n * are aborted together.\n */\n private keystrokeSignal: AbortSignal | null = null;\n\n /**\n * Micro-batcher that collapses multiple async resolutions into a single\n * DAG walk + re-evaluation pass. Replaces the old single-callback pattern.\n */\n private batcher: AsyncResolutionBatcher;\n /** Post-lexer token normalizer for phrase fusion, implicit multiply, etc. */\n private normalizer: TokenNormalizer;\n /** TanStack Query client, injected into resolvers for cache reads/writes. */\n readonly queryClient: QueryClient;\n // Bytecode cache, avoids re-parsing identical expressions.\n // Bounded by config.performance.defaultCacheSize: when full, the oldest\n // entry (Map insertion order) is evicted so unique expressions across a\n // long session can't grow memory unboundedly.\n private bytecodeCache: Map<string, BytecodeProgram> = new Map();\n\n /**\n * Insert into the bytecode cache, evicting the oldest entry when full.\n *\n * Bug fix (found during release hardening): this used to check against\n * a hardcoded `BYTECODE_CACHE_MAX_ENTRIES = 2000` constant that never\n * read `config.performance.defaultCacheSize`, despite that field being\n * documented (see `EngineConfig`'s JSDoc example) as exactly this knob.\n * A host raising `defaultCacheSize` for large documents had zero effect;\n * every document beyond ~2000 unique expressions per line silently lost\n * the bytecode-cache benefit on re-evaluation regardless of config.\n */\n private cacheBytecode(expression: string, program: BytecodeProgram): void {\n const maxEntries = this.config.performance.defaultCacheSize;\n if (this.bytecodeCache.size >= maxEntries) {\n const oldest = this.bytecodeCache.keys().next().value;\n if (oldest !== undefined) {\n this.bytecodeCache.delete(oldest);\n }\n }\n this.bytecodeCache.set(expression, program);\n }\n // Pre-allocated BytecodeBuilder pool\n private builderPool: BytecodeBuilder[] = [\n new BytecodeBuilder(),\n new BytecodeBuilder(),\n new BytecodeBuilder(),\n new BytecodeBuilder(),\n ];\n // Index into the builder pool, incremented modulo pool size.\n private builderPoolIndex = 0;\n // Most recent pipeline telemetry, populated when AllocationTracker.isEnabled().\n private lastTelemetry: PipelineTelemetry | null = null;\n\n //#endregion\n\n //#region Constructor\n constructor(\n localeCode = \"en\",\n diagnosticMode = false,\n config?: Partial<typeof DEFAULT_CONFIG>,\n diagnosticPipeline?: DiagnosticPipeline,\n packages?: IEnginePackage[]\n ) {\n this.localeCode = localeCode;\n // Per-section merge, not a top-level shallow spread, overriding one\n // field of a section (e.g. `{ performance: { defaultCacheSize: 500 } }`)\n // used to silently replace the WHOLE section, dropping every other\n // field in it back to `undefined` instead of keeping its default.\n this.config = mergeEngineConfig(DEFAULT_CONFIG, config ?? {});\n this.lexer = new Lexer(localeCode, buildTokenLookup(localeCode));\n this.registry = new ParseletRegistry();\n // Before the package loop below, which registers plugin functions into it.\n this.context = createEngineContext();\n\n// Wire diagnostic pipeline: use provided, create timeline if enabled, or leave empty for production\n if (diagnosticPipeline) {\n this.diagnosticPipeline = diagnosticPipeline;\n } else if (diagnosticMode) {\n this.diagnosticPipeline = new DiagnosticPipeline();\n this.timelineCollector = new TimelineDiagnosticCollector();\n this.diagnosticPipeline.register(this.timelineCollector);\n } else {\n this.diagnosticPipeline = new DiagnosticPipeline();\n // Production: no collectors, pipeline length-check exits immediately with zero overhead\n }\n\n // Register providers via IEnginePackage data.\n // Defaults to BUILTIN_PACKAGES (all built-in providers). Callers can\n // pass a filtered subset via the `packages` constructor parameter to\n // selectively include/exclude specific providers (e.g., omit dice or\n // vector support for a calculator-only engine).\n // Each package's parselets go into the engine's isolated registry\n // (not sharedParseletRegistry), lexer plugins into the engine's\n // isolated lexer, and opcode/variable handlers into shared registries.\n\n // ── Create normalizer BEFORE package registration ──\n // Packages may register phrases and normalizer rules, so the normalizer\n // must exist before registerPackage() is called.\n this.normalizer = new TokenNormalizer();\n\n // Register built-in phrases into the PhraseTrie, single-pass\n // O(depth) matching per position instead of separate rule scans.\n for (const [phrase, tokenType] of Object.entries(BUILTIN_PHRASES)) {\n this.normalizer.addPhrase(phrase, tokenType);\n }\n\n // Register built-in normalizer rules (implicit multiply, etc.)\n // Pass the trie's canStart predicate so the implicit multiply rule\n // stays in sync with package-registered phrases.\n this.normalizer.register(implicitMultiplyRule(\n 50,\n (word) => this.normalizer.canStartPhrase(word),\n ));\n\n const pkgList = packages ?? BUILTIN_PACKAGES;\n for (const pkg of pkgList) {\n // Per-package containment: registerPackage() can throw (a\n // lexerVocabulary keyword/operator/unit colliding with a\n // built-in one, ExpressionLexer.registerVocabulary()'s hard\n // guard, the one sub-registration in registerPackage() that\n // isn't already \"warn and proceed\"). Unguarded, that throw used\n // to escape the constructor itself: every package after the\n // offender in pkgList never got registered, `new\n // ExpressionEngine(...)` never returned an instance, and\n // whatever THIS package or earlier ones already wrote into\n // shared module-level registries (pluginFunctionRegistry,\n // TokenCategoryMap, asConverterRegistry)\n // had no owning engine instance left to call\n // unregisterPackage() and clean it up. Same containment shape\n // as AsyncResolutionBatcher.reExecuteMainThread()'s fatal-bug\n // fix: one bad package (most likely a third-party one passed via\n // the `packages` constructor param, not a built-in) is skipped\n // with a clear, verbose error instead of taking the whole engine\n // down.\n try {\n this.registerPackage(pkg);\n } catch (e) {\n const engineError = normalizeUnknownError(e);\n console.error(\n `[ExpressionEngine] Failed to register package \"${pkg.name}\" — skipping it and continuing ` +\n `construction with the remaining packages: ${engineError.format()}`\n );\n }\n }\n\n this.parser = new PrecedenceParser(this.registry, this.config.validation.maxNestingDepth, localeCode);\n this.vm = createVM(\n this.context.opRegistry,\n this.config.vm.maxStackDepth,\n this.config.vm.maxInstructions,\n undefined,\n this.config.vm.maxCollectionSize,\n this.config.vm.maxAllocatedElements,\n this.config.vm.maxFunctionCalls,\n this.config.date.maxOffsetYears,\n this.config.date.minOffsetYears,\n this.context,\n );\n this.queryClient = createQueryClient();\n this.batcher = new AsyncResolutionBatcher(this.dag, this.lineCache, this.vm);\n\t}\n\n //#endregion\n\n //#region Public API, Event stream\n\n /**\n * Get the native event stream from the batcher for stream-based consumers.\n *\n * Use this instead of `addAsyncListener()` when you need:\n * - **Backpressure**: the stream buffers up to `highWaterMark` events;\n * when full, `enqueue()` blocks until the consumer reads, preventing\n * unbounded memory growth.\n * - **Cancellation**: call `reader.cancel()` or pass an `AbortSignal` to\n * `pipeTo()` to stop receiving events.\n * - **Piping**: use `stream.pipeTo(writable)` or `stream.pipeThrough(transform)`\n * to build a reactive pipeline.\n * - **Teeing**: use `stream.tee()` to serve multiple independent consumers.\n *\n * @returns A {@link ReadableStream} that emits {@link AsyncResolutionEvent}\n * items as the batcher processes async resolutions.\n */\n getEventStream(): ReadableStream<AsyncResolutionEvent> {\n return this.batcher.getEventStream();\n }\n\n /**\n * Get the batcher instance (for test infrastructure).\n *\n * Tests use this to access `batcher._testCaptures` for synchronous\n * event observation without async stream reader timing issues.\n */\n getBatcher(): AsyncResolutionBatcher {\n return this.batcher;\n }\n\n //#endregion\n\n //#region Public API, Package registration\n\n /**\n * Register a package with the engine's isolated registries.\n *\n * Handles all IEnginePackage fields:\n * - `lexerVocabulary` → engine's isolated lexer (via this.lexer.registerVocabulary)\n * - `prefixParselets` → engine's isolated ParseletRegistry\n * - `infixParselets` → engine's isolated ParseletRegistry\n * - `variableSources` → this engine's own variable resolver\n *\n * Built-in packages (ARITHMETIC, FUNCTION, UOM, etc.) are registered\n * via this method during construction. External user packages can also\n * use this method for data-driven registration.\n *\n * @param pkg - The package to register.\n */\n registerPackage(pkg: IEnginePackage): void {\n // Engine-vs-package version gating, checked FIRST, before the\n // duplicate-name guard below. Unlike checkPackageCompatibility()\n // further down (package-vs-package, always advisory, never blocks\n // ARCHITECTURE.md §5.2), an unsatisfied or malformed engineVersion is\n // a hard rejection: throwing here means re-registering an\n // incompatible REPLACEMENT for an already-working package never\n // unregisters the old one first, the engine is never left with\n // neither version registered. See ARCHITECTURE.md §5.3 and\n // api/EngineVersionCompatibility.ts.\n assertEngineVersionCompatible(pkg);\n\n // Guard against double-registration under the same name: without\n // this, a second registerPackage() call for the same pkg.name would\n // overwrite packageContributions' tracked record for the FIRST\n // registration, permanently orphaning its shared-registry\n // contributions (pluginFunctionRegistry entries, variable sources,\n // resolver namespaces, token categories), unreachable and\n // unreversible for the engine's lifetime, since those are shared\n // module-level registries. Mirrors ResolverRegistry.register()'s\n // existing \"destroy old, warn, replace\" pattern for the same class\n // of problem at the resolver-namespace level.\n if (this.packageContributions.has(pkg.name)) {\n console.warn(\n `[ExpressionEngine] Package \"${pkg.name}\" is already registered. ` +\n `Unregistering the previous registration before re-registering.`,\n );\n this.unregisterPackage(pkg.name);\n }\n\n // Load-up resiliency: statically compare this package's declared\n // fields against every OTHER package already on this engine, before\n // touching any shared registry. See api/PackageCompatibility.ts's\n // module doc for the full reasoning and the real bug that motivated\n // it. Non-fatal (matches this codebase's established \"warn and\n // proceed\" convention for collisions elsewhere, ParseletRegistry\n // asConverterRegistry) even for \"error\"-severity conflicts, since a\n // host may have a deliberate reason to accept a collision; the\n // point is making it IMPOSSIBLE to miss, not blocking registration.\n const compatibility = checkPackageCompatibility(pkg, [...this.registeredPackages.values()]);\n for (const conflict of compatibility.conflicts) {\n const log = conflict.severity === \"error\" ? console.error : console.warn;\n log(`[ExpressionEngine] Package compatibility ${conflict.severity} (${conflict.kind}): ${conflict.detail}`);\n }\n\n // Track shared-registry contributions so unregisterPackage() can\n // reverse them. Isolated per-engine registrations (parselets,\n // phrases) die with the engine and don't need tracking. lexerVocabulary\n // IS tracked (unlike before) so its custom keyword/operator token\n // types can be reverted via ExpressionLexer.unregisterVocabulary()\n // previously that method existed and worked correctly but was never\n // called from here, leaving a package's lexer contribution live\n // after \"unregistering\" it. tokenCategories is tracked the same way.\n //\n // normalizerRuleNames is tracked even though the normalizer is\n // per-engine, because unlike phrases these do NOT die with the engine\n // in any useful sense: a phrase goes into a text-keyed trie and\n // registering it twice is idempotent, whereas a rule is pushed onto an\n // array, so a host re-registering a package on every settings change\n // accumulated one more copy of every rule each time and the normalizer\n // tried all of them at every token position for the rest of the\n // engine's life.\n const contribution = {\n pluginFunctionIndices: [] as number[],\n variableSources: [] as import(\"@solve-js/variables/IVariableSource\").IVariableSource[],\n resolverNamespaces: [] as string[],\n tokenCategories: [] as string[],\n lexerVocabulary: pkg.lexerVocabulary,\n asConverterNames: [] as string[],\n normalizerRuleNames: [] as string[],\n };\n\n // Only lexerVocabulary can throw here (built-in keyword/operator/unit\n // collision, ExpressionLexer.registerVocabulary()'s hard guard)\n // every other sub-registration below is already \"warn and proceed\".\n // Deliberately done BEFORE registeredPackages/packageContributions\n // are recorded (see below) so a throw here leaves no phantom\n // entry, the caller's try/catch (registerPackage() itself still\n // throws for a single bad package; ExpressionEngine's constructor\n // catches per-package so one bad package can't take down engine\n // construction, see that loop's own comment) sees a package that\n // registered NOTHING, not a partially-registered one.\n if (pkg.lexerVocabulary) {\n this.lexer.registerVocabulary(pkg.lexerVocabulary);\n }\n if (pkg.prefixParselets) {\n for (const pp of pkg.prefixParselets) {\n this.registry.registerPrefix(pp.tokenType, pp.parselet);\n }\n }\n if (pkg.infixParselets) {\n for (const ip of pkg.infixParselets) {\n this.registry.registerInfix(ip.tokenType, ip.parselet);\n }\n }\n if (pkg.pluginFunctions) {\n for (const pf of pkg.pluginFunctions) {\n this.context.pluginFunctions[pf.index] = pf.handler;\n this.context.pluginFunctionOwners[pf.index] = pkg.name;\n contribution.pluginFunctionIndices.push(pf.index);\n }\n }\n if (pkg.variableSources) {\n for (const vs of pkg.variableSources) {\n this.context.variableResolver.registerSource(vs);\n contribution.variableSources.push(vs);\n }\n }\n if (pkg.asyncResolvers) {\n for (const resolver of pkg.asyncResolvers) {\n this.resolverRegistry.register(resolver);\n contribution.resolverNamespaces.push(resolver.namespace);\n }\n }\n if (pkg.phrases) {\n for (const [phrase, tokenType] of Object.entries(pkg.phrases)) {\n this.normalizer.addPhrase(phrase, tokenType);\n }\n }\n if (pkg.normalizerRules) {\n for (const rule of pkg.normalizerRules) {\n this.normalizer.register(rule);\n contribution.normalizerRuleNames.push(rule.name);\n }\n }\n if (pkg.tokenCategories) {\n for (const [tokenType, category] of Object.entries(pkg.tokenCategories)) {\n registerTokenCategory(tokenType, category);\n contribution.tokenCategories.push(tokenType);\n }\n }\n if (pkg.completionItems) {\n this.packageCompletionItems.set(pkg.name, pkg.completionItems);\n }\n if (pkg.asConverters) {\n for (const [name, handler] of Object.entries(pkg.asConverters)) {\n registerAsConverter(name, handler);\n contribution.asConverterNames.push(name);\n }\n }\n\n this.packageContributions.set(pkg.name, contribution);\n // Recorded LAST, only once every sub-registration above actually\n // succeeded. If this ran up front (as it used to), a mid-function\n // throw from lexerVocabulary would leave a phantom entry: callers\n // checking registeredPackages.has(pkg.name) would see \"registered\"\n // for a package that contributed nothing.\n this.registeredPackages.set(pkg.name, pkg);\n }\n\n /**\n * Unregister a package previously registered via {@link registerPackage}.\n *\n * Reverses the package's contributions to the SHARED registries, plugin\n * functions (pluginFunctionRegistry), variable sources\n * (this engine's variable resolver), async resolvers, and now\n * token highlight categories (TokenCategoryMap), which registerPackage\n * wrote into process-wide state. Also reverts\n * the package's lexer plugin (custom keyword/operator token types\n * revert to generic IDENT/ERROR, matching ExpressionLexer.unregisterVocabulary()'s\n * own contract). This engine-instance-local registration is reversed\n * here too, even though it isn't a \"shared\" registry, so a package's\n * lexer and highlighting contributions clean up together rather than\n * only half-reversing on unregister. Normalizer rules are reversed here\n * for the same reason: they are per-engine, but they live in an ARRAY the\n * normalizer walks at every token position, so re-registering a package\n * appended a second copy of every rule and lexing got slower with every\n * register/unregister cycle.\n *\n * Per-engine parselets and phrases are still left in place: a parselet\n * lives in this engine's isolated registry and a phrase goes into a\n * text-keyed trie where registering the same phrase twice is the same as\n * registering it once, so neither accumulates and both are discarded with\n * the engine instance.\n *\n * Clears the bytecode cache, removing handlers changes what compiled\n * bytecode is valid.\n *\n * @param packageName - The `name` the package was registered under.\n * @returns true if the package was found and unregistered.\n */\n unregisterPackage(packageName: string): boolean {\n const contribution = this.packageContributions.get(packageName);\n if (!contribution) return false;\n\n for (const index of contribution.pluginFunctionIndices) {\n delete this.context.pluginFunctions[index];\n delete this.context.pluginFunctionOwners[index];\n }\n for (const vs of contribution.variableSources) {\n this.context.variableResolver.unregisterSource(vs);\n }\n for (const namespace of contribution.resolverNamespaces) {\n this.resolverRegistry.unregister(namespace);\n }\n for (const tokenType of contribution.tokenCategories) {\n unregisterTokenCategory(tokenType);\n }\n if (contribution.lexerVocabulary) {\n this.lexer.unregisterVocabulary(contribution.lexerVocabulary);\n }\n for (const name of contribution.asConverterNames) {\n unregisterAsConverter(name);\n }\n for (const ruleName of contribution.normalizerRuleNames) {\n this.normalizer.unregister(ruleName);\n }\n this.packageCompletionItems.delete(packageName);\n\n this.packageContributions.delete(packageName);\n this.registeredPackages.delete(packageName);\n this.bytecodeCache.clear();\n return true;\n }\n\n //#endregion\n\n //#region Public API, Configuration & accessors\n\n /**\n * Get the effective engine configuration currently in use.\n * Includes all defaults merged with any constructor overrides.\n * Useful for introspection, lets consumers see what values are actually\n * in effect after merging with DEFAULT_CONFIG.\n */\n getConfig(): EngineConfig {\n return { ...this.config };\n }\n\n /**\n * Get the underlying diagnostic pipeline for advanced usage.\n */\n getDiagnosticPipeline(): DiagnosticPipeline {\n return this.diagnosticPipeline;\n }\n\n //#endregion\n\n //#region Internal, Execution helpers\n\n /**\n * Store a result in the line cache (with DAG registration).\n * Extracted common pattern from 8 call sites.\n */\n private storeLineResult(\n lineNumber: number,\n result: Value,\n program: BytecodeProgram,\n reads: string[],\n writes: string[],\n expression: string,\n ): void {\n this.lineCache.set(lineNumber, new LineCacheEntry(\n result,\n program,\n reads,\n writes.length > 0 ? writes[0] : null\n ), expression);\n }\n\n /**\n * Execute bytecode and handle the result.\n *\n * Replaces ALL 5 try/catch blocks that previously caught AsyncSuspenseError.\n * Now that executeBytecode returns an EvalResult discriminated union,\n * we simply check result.type instead of catching errors.\n *\n * Sets up AbortController → VM for stale-data prevention.\n * Cleans up the VM stack after execution (success or pending).\n * Fires async resolution via fire-and-forget for pending results.\n *\n * `tracePipeline`/`traceExpression`, when given, are passed straight\n * through to `executeBytecode()`'s own optional VM-step-tracing\n * parameters, used ONLY by {@link evaluateExpressionWithDiagnostic}\n * when `vmTraceEnabled` is on. Omitted by every other caller, with zero\n * behavior change (identical to today's hardcoded `undefined, undefined`).\n */\n private executeAndStore(\n program: BytecodeProgram,\n lineNumber: number,\n expression: string,\n reads: string[],\n writes: string[],\n packageId: string,\n tracePipeline?: DiagnosticPipeline,\n traceExpression?: string,\n ): Value {\n const stackBefore = this.vm.getStack().length;\n\n // Set up AbortController for this evaluation.\n // When the user edits the line before resolution, the old controller\n // is aborted, preventing stale data from surfacing.\n const controller = new AbortController();\n // ── Link to keystroke signal (One AbortController Per Keystroke) ──\n // When the user types a new keystroke, the keystrokeController is aborted,\n // which in turn aborts this local controller, canceling all in-flight\n // async work for this specific evaluation.\n const abortLocal = () => controller.abort();\n this.keystrokeSignal?.addEventListener('abort', abortLocal, { once: true });\n\n abortLogger.localControllerCreated(\"executeAndStore\");\n if (this.keystrokeSignal) {\n abortLogger.signalLinked(\"executeAndStore\");\n }\n\n this.vm.activeSignal = controller.signal;\n this.vm.abortCurrent = () => {\n abortLogger.signalUnlinked(\"executeAndStore\");\n this.keystrokeSignal?.removeEventListener('abort', abortLocal);\n controller.abort();\n };\n\n setActiveQueryClient(this.queryClient);\n const result = executeBytecode(program, this.vm, tracePipeline, traceExpression, this.makeLineContext(lineNumber));\n\n // Single stack cleanup (replaces 10 occurrences)\n while (this.vm.getStack().length > stackBefore) {\n this.vm.pop();\n }\n\n if (result.type === 'pending') {\n // Fire-and-forget async resolution.\n // The keystroke listener stays attached while the async work is\n // in flight so a new keystroke can still cancel it.\n void this.resolveAsync(result);\n\n // Register data source dependency in DAG for re-evaluation tracking\n this.dag.registerLineDataSourceDependency(\n lineNumber,\n result.packageId || packageId,\n [result.queryKey]\n );\n\n const pending = pendingValue(result.queryKey);\n this.storeLineResult(lineNumber, pending, program, reads, writes, expression);\n return pending;\n }\n\n if (result.type === 'error') {\n this.keystrokeSignal?.removeEventListener('abort', abortLocal);\n throw result.error;\n }\n\n // Success path, execution finished synchronously, so unhook the\n // keystroke listener now. Without this, one listener per evaluated\n // line accumulates on the keystroke signal for large documents.\n this.keystrokeSignal?.removeEventListener('abort', abortLocal);\n\n this.dag.registerLine(lineNumber, reads, writes);\n this.storeLineResult(lineNumber, result.value, program, reads, writes, expression);\n return result.value;\n }\n\n /**\n * Execute bytecode and return the raw EvalResult without DAG/LineCache updates.\n * Used by reEvaluateLine, executeCached, and evaluateIncremental which\n * manage their own cache state differently.\n *\n * @param lineNumber - 1-based line this bytecode belongs to, for\n * cross-line features (`prev`/`line<N>`/aggregation. See\n * `makeLineContext()`). Defaults to -1 (the existing \"no real\n * document\" sentinel) for any caller that doesn't have a real line\n * number to pass.\n */\n private executeRaw(program: BytecodeProgram, lineNumber: number = -1): EvalResult {\n const stackBefore = this.vm.getStack().length;\n\n const controller = new AbortController();\n // ── Link to keystroke signal (One AbortController Per Keystroke) ──\n const abortLocal = () => controller.abort();\n this.keystrokeSignal?.addEventListener('abort', abortLocal, { once: true });\n\n abortLogger.localControllerCreated(\"executeRaw\");\n if (this.keystrokeSignal) {\n abortLogger.signalLinked(\"executeRaw\");\n }\n\n this.vm.activeSignal = controller.signal;\n this.vm.abortCurrent = () => {\n abortLogger.signalUnlinked(\"executeRaw\");\n this.keystrokeSignal?.removeEventListener('abort', abortLocal);\n controller.abort();\n };\n\n setActiveQueryClient(this.queryClient);\n const result = executeBytecode(program, this.vm, undefined, undefined, this.makeLineContext(lineNumber));\n\n // Stack cleanup\n while (this.vm.getStack().length > stackBefore) {\n this.vm.pop();\n }\n\n // Sync completion, unhook the keystroke listener to prevent\n // per-evaluation listener accumulation. Pending results keep the\n // listener so in-flight async work stays cancellable.\n if (result.type !== 'pending') {\n this.keystrokeSignal?.removeEventListener('abort', abortLocal);\n }\n\n return result;\n }\n\n /**\n * Fire-and-forget async resolution using async/await.\n *\n * On resolution or error:\n * 1. Checks AbortSignal, if aborted, stale data is discarded.\n * 2. Stores result/error in AsyncResultCache (per-package scoped).\n * 3. Defers re-evaluation to AsyncResolutionBatcher which collapses\n * multiple resolutions into a single DAG walk + re-execution pass\n * and fires typed events to all listeners.\n */\n private async resolveAsync(pending: Extract<EvalResult, { type: 'pending' }>): Promise<void> {\n const { queryKey, resolver, packageId, signal } = pending;\n const effectivePackageId = packageId || '_engine';\n\n // TanStack Query handles dedup + caching automatically via fetchQuery().\n // We just await the resolver and dispatch to the batcher on completion.\n\n try {\n // The resolved value is not needed here, only the fact that it\n // settled: the batcher re-reads it from the cache on re-evaluation.\n await resolver;\n if (signal.aborted) {\n abortLogger.staleDataDiscarded(queryKey, \"signal aborted after resolve\");\n return;\n }\n // Defer re-evaluation to batcher (collapsed across microtask).\n this.batcher.add({\n queryKey,\n packageId: effectivePackageId,\n signal,\n isError: false,\n });\n } catch (err) {\n if (signal.aborted) {\n abortLogger.staleDataDiscarded(queryKey, \"signal aborted after error\");\n return;\n }\n const error = err instanceof Error ? err : new Error(String(err));\n this.batcher.add({\n queryKey,\n packageId: effectivePackageId,\n signal,\n isError: true,\n error,\n });\n }\n }\n\n //#endregion\n\n //#region Public API, Document parsing\n\n /**\n * Unified parsing method that handles different input types and returns comprehensive results\n * with precise coordinate mapping for inline solves.\n */\n parseDocument(input: string, options: UnifiedParsingOptions = { inputType: 'markdown' }): ParsingResult {\n // Refused before the scan rather than during it. Every limit above this\n // one bounds what a single LINE may ask for, and a document's cost is\n // its line count whatever the lines say: two hundred thousand lines of\n // `1 + 1` exhausted the heap on the per-line records alone, which is a\n // process abort no host can catch. See\n // `constants/Configuration.ts`'s `performance.maxDocumentLines`.\n const maxLines = this.config.performance.maxDocumentLines;\n if (countLines(input, maxLines) > maxLines) {\n throw ErrorFactory.execution(\n \"DOCUMENT_TOO_LARGE\",\n `This document has more than ${maxLines.toLocaleString(\"en-US\")} lines, which is the most the engine will process in one pass`,\n { maxLines },\n );\n }\n // Scan the entire document in a single pass, bypasses the old\n // split('\\n') → evaluateLines() → join('\\n') → scanDocument()\n // roundtrip. scanDocument() classifies and tokenizes all lines\n // character-by-character with a single Lexer.reset().\n const scanResults = this.lexer.scanDocument(input);\n const processedLines = this.processScanResults(scanResults);\n\n const result: ParsingResult = {\n lines: processedLines,\n totalLines: processedLines.length,\n errors: [],\n };\n\n // Collect errors from processed lines\n for (const line of processedLines) {\n if (line.error) {\n result.errors.push(`Line ${line.lineNumber}: ${line.error}`);\n }\n for (const solve of line.inlineSolves) {\n if (solve.error) {\n result.errors.push(`Line ${line.lineNumber}: ${solve.error}`);\n }\n }\n }\n\n const includeDiagnostics = options.includeDiagnostics ?? false;\n if (includeDiagnostics) {\n const reports = this.diagnosticPipeline.collectReports();\n if (reports.length > 0) {\n result.diagnostics = reports[0].toJSON();\n }\n }\n\n return result;\n }\n\n /**\n * Batch-evaluate an array of lines in a single pass.\n *\n * Uses scanDocument() to classify and tokenize all lines in a single\n * character-by-character walk through the re-joined document text.\n * This eliminates the per-line Lexer.reset() + classifyLine() +\n * findInlineSolvesInLine() overhead from the old three-pass approach.\n *\n * Tokenization results from scanDocument() are passed directly to the\n * parser via evaluateLineWithPreTokenized(), skipping re-lexing.\n */\n /**\n * Batch-evaluate an array of lines in a single pass.\n *\n * Primarily used by tests. For production, prefer parseDocument()\n * which calls scanDocument() directly on the raw document string,\n * bypassing the split→join roundtrip that this method performs.\n */\n evaluateLines(lines: string[]): ParsedLine[] {\n // Rejoin lines and scan in a single pass, scanDocument() handles\n // classification + tokenization for all lines in one character walk.\n const documentText = lines.join('\\n');\n const scanResults = this.lexer.scanDocument(documentText);\n return this.processScanResults(scanResults);\n }\n\n /**\n * Process pre-scanned line results into ParsedLine objects.\n *\n * Shared by parseDocument() (which scanDocuments the raw input) and\n * evaluateLines() (which scanDocuments joined line arrays). Handles\n * inline solve extraction, variable assignment detection, and\n * expression evaluation for each non-skipped line.\n */\n private processScanResults(scanResults: ScanLineResult[]): ParsedLine[] {\n const result: ParsedLine[] = [];\n\n for (const scanResult of scanResults) {\n const lineText = scanResult.text;\n const lineNumber = scanResult.lineNumber;\n const startPosition = scanResult.startOffset;\n const endPosition = scanResult.endOffset;\n const isEmpty = scanResult.classification.skip;\n const inlineSolves: InlineSolvePosition[] = scanResult.inlineSolves.map(s => ({\n start: s.start,\n end: s.end,\n expression: s.expression,\n lineNumber,\n columnNumber: s.columnNumber,\n }));\n const hasInlineSolves = inlineSolves.length > 0;\n\n const parsedLine: ParsedLine = {\n lineNumber,\n text: lineText,\n startPosition,\n endPosition,\n isEmpty,\n hasInlineSolves,\n inlineSolves,\n expression: null,\n result: null,\n error: null,\n };\n\n if (!isEmpty) {\n const isVariableAssignment = lineText.trim().startsWith(':');\n\n if (hasInlineSolves && !isVariableAssignment) {\n for (const solve of inlineSolves) {\n try {\n const values = this.evaluateLine(lineNumber, solve.expression);\n solve.result = values[0];\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n solve.error = errorMessage;\n }\n }\n } else {\n const expression = lineText.trim();\n if (expression) {\n // Pass pre-tokenized tokens from scanDocument to avoid re-lexing\n try {\n const values = this.evaluateLineWithPreTokenized(\n lineNumber,\n expression,\n scanResult.tokens\n );\n parsedLine.expression = expression;\n parsedLine.result = values[0];\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n parsedLine.error = errorMessage;\n }\n }\n }\n }\n\n result.push(parsedLine);\n }\n\n return result;\n }\n\n /**\n * Evaluate a line using pre-tokenized tokens from scanDocument().\n *\n * Skips the lexing step entirely, the tokens are already available\n * from the document-level scan. Only parsing, compilation, and\n * execution are performed.\n *\n * This is the production fast path for evaluateLines(). Note: this\n * path intentionally bypasses the diagnostic pipeline. For diagnostic\n * events, use evaluateExpressionWithDiagnostic() directly.\n */\n private evaluateLineWithPreTokenized(\n lineNumber: number,\n expression: string,\n preTokenized: Token[]\n ): Value[] {\n // Filter markdown tokens as a defensive safety net.\n // ExpressionLexer never produces MD_* tokens, but this guard\n // prevents accidental breakage if the lexer mode changes.\n const tokens: Token[] = [];\n let hasParens = false;\n for (const t of preTokenized) {\n if (t.type === \"LPAREN\" || t.type === \"RPAREN\") hasParens = true;\n tokens.push(t);\n }\n\n // Directly invoke evaluateWithTokens, no lexing needed\n return [this.evaluateWithTokens(lineNumber, expression, tokens, hasParens)];\n }\n\n //#endregion\n\n //#region Internal, Parsing & compilation\n\n /**\n * Route parse+compile to the active parser (PrecedenceParser or Recursive Descent).\n *\n * Sets up the builder on the active parser, loads tokens, and calls\n * parseExpression(). Abstracts the API difference between the two parsers:\n * - PrecedenceParser: parser.setBuilder(builder); parser.parseExpression(0)\n * - RD: parser.builder = builder; parser.parseExpression(0)\n *\n * @param allowLabelFallback - Whether a line that does not parse whole may\n * be retried as \"&lt;label&gt;: &lt;expression&gt;\". True for a real line, false for\n * the retries that fallback makes itself, which is what stops it costing\n * exponential time; see the loop below, and the comment on its recursive\n * call for the measurement.\n */\n private parseExpression(builder: BytecodeBuilder, tokens: Token[], hasParens?: boolean, allowLabelFallback = true): void {\n this.parser.setBuilder(builder);\n // When autoBalanceParens is disabled, skip the O(n) paren-count scan\n // by always passing false, the parser will fail naturally on unmatched\n // parens instead of silently inserting missing closing/opening tokens.\n this.parser.load(tokens, this.config.validation.autoBalanceParens ? hasParens : false);\n this.parser.parseExpression(0);\n\n // parseExpression() stops as soon as it has one complete top-level\n // expression, it never checked whether that consumed the WHOLE\n // token list. Any leftover tokens (a stray trailing number, an\n // unconsumed comma-and-digits from a malformed \"thousands\"-looking\n // literal, a typo'd second operand with a missing operator, ...)\n // were silently discarded rather than surfaced: \"5 3\" evaluated to\n // a confident \"5\", \"1,2345\" to a confident \"1\", with no indication\n // anything was wrong. Requiring full consumption turns every one\n // of those into a real, visible parse error instead.\n const leftover = this.parser.peek();\n if (leftover) {\n // A single trailing bare \"=\" with nothing after it (e.g.\n // \"355/113=\") is tolerated rather than treated as an error.\n // EQUALS is never registered as an infix operator anywhere in\n // this grammar (confirmed, nothing consumes it after a\n // complete expression), so it can't be a legitimate second\n // operand or a typo'd continuation the way a stray number or\n // identifier could be; it's an unambiguous \"show the result\"\n // marker familiar from pocket calculators and other apps in\n // this category (see GitHub issue #65). This is deliberately\n // narrower than tolerating arbitrary trailing tokens, which\n // would reopen the exact silently-wrong-answer bug this same\n // check was added to close (see this function's own doc\n // comment above).\n if (leftover.type === \"EQUALS\" && !this.parser.peekAt(1)) {\n return;\n }\n\n // Labeled-line fallback: \"<label>: <expression>\", e.g. \"pi\n // approximation: 355/113\" (see GitHub issue #65). Only\n // attempted once the whole-line parse has ALREADY failed, so\n // it can never change behavior for a line that already\n // worked. VALID clock times (\"9:30\"), lap times (\"03:04:05\"),\n // and \":name = value\" variable definitions all consume their\n // colon(s) internally during lexing and never produce a real\n // COLON token, confirmed directly against the token stream\n // not assumed, so this can't misfire on any of them. Only a\n // genuine COLON token past position 0 counts (position 0 is\n // reserved for the existing leading-colon variable syntax).\n //\n // The word VALID is load-bearing, and used not to be here. An\n // out-of-range clock time does leave a real COLON token behind,\n // which landed it in this fallback and had it answered with\n // whatever stood to the right of the colon: \"24:00\" answered 0,\n // \"9:60\" answered 60, \"100:5\" answered 5. Those are ordinary\n // things to type (\"24:00\" is a normal way to write the end of a\n // day, \"9:60\" is a normal typo) and every one of them came back\n // as a confident number with no hint that the time had been\n // thrown away, so the numeric case is now refused outright, see\n // the guard in the loop below.\n //\n // Tries every colon position from rightmost to leftmost, not\n // just the last one: a label can itself precede a\n // \":name = value\" definition (\"input value: :x = 5\"), whose\n // OWN leading colon would otherwise be the rightmost colon in\n // the line, slicing right after it strips the colon\n // VariableParselet needs to recognize a definition at all,\n // leaving a bare \"x = 5\" that fails to parse. Falling back to\n // the next colon to the left (\"value:\") keeps \":x = 5\" intact.\n for (let i = allowLabelFallback ? tokens.length - 1 : 0; i >= 1; i--) {\n if (tokens[i].type !== \"COLON\") continue;\n if (i + 1 >= tokens.length) continue;\n\n // Nothing but numbers to the left of the colon means this is\n // not a label at all: it is a time, a lap time or a timecode\n // that the normalizer refused to fuse because one of its\n // fields is out of range. A label is prose (\"pi\n // approximation:\", \"total:\"), and the labelled lines this\n // fallback exists for all have a word in front of the colon.\n // Reading \"24:00\" as the label \"24\" and the expression \"00\"\n // is never what was meant, so it is an error rather than an\n // answer.\n let labelIsAllNumeric = true;\n for (let j = 0; j < i; j++) {\n const type = tokens[j].type;\n if (type !== \"NUMBER\" && type !== \"COLON\") {\n labelIsAllNumeric = false;\n break;\n }\n }\n if (labelIsAllNumeric) {\n // Rebuilt from the tokens rather than sliced out of the\n // source, which this level does not have. Everything up\n // to and including the field after the colon, so\n // \"24:00 + 1\" names \"24:00\" and not the whole line.\n const literal = tokens.slice(0, i + 2).map((t) => t.value).join(\"\");\n throw ErrorFactory.parsing(\n \"INVALID_TIME_LITERAL\",\n `\"${literal}\" is not a valid time`,\n { tokenType: tokens[i].type, tokenValue: literal }\n );\n }\n\n builder.reset();\n try {\n // `false`: the retry gets a plain parse, with no fallback\n // of its own. It used to get the full one, and that made\n // this loop cost exponential time for no extra coverage.\n //\n // A retry on `tokens.slice(i + 1)` that ran its own\n // fallback would try the suffix after each colon j > i,\n // which is `tokens.slice(j + 1)`, which is a slice THIS\n // loop already tried on an earlier iteration, since it\n // walks rightmost-first and j > i. So every level below\n // the first re-attempted parses that had already failed,\n // and each of those levels re-attempted them again: a line\n // with k colons compiled 2^k times. Measured on a\n // 723-character fuzz case with 19 colons: 524,288 parse\n // attempts, 18 seconds, and then the line was REJECTED. A\n // host evaluating per keystroke froze for that long.\n //\n // Nothing is lost by cutting it. The suffixes the deeper\n // levels reached are exactly the ones this loop visits\n // itself, in the same rightmost-first order.\n this.parseExpression(builder, tokens.slice(i + 1), hasParens, false);\n return;\n } catch {\n // This colon's fragment didn't parse cleanly either\n // try the next one to the left before giving up.\n }\n }\n\n throw ErrorFactory.parsing(\n \"UNEXPECTED_TRAILING_TOKEN\",\n `Unexpected token after expression: \"${leftover.value}\"`,\n { tokenType: leftover.type, tokenValue: leftover.value }\n );\n }\n }\n\n //#region Symbolic algebra, `=>` and bare equation-statement grammar\n\n /**\n * Compiles a standalone token list into a fresh, independent\n * `BytecodeProgram`, used for a `=>`-triggered expression and for a\n * bare equation's own right-hand side. Reuses {@link parseExpression}\n * (the SAME \"compile a token list into a builder, then check for\n * leftover trailing tokens\" logic every ordinary line already goes\n * through), just with a throwaway builder instead of the pooled one\n * (this grammar is rare, a per-call allocation here is a non-issue).\n */\n private compileAdHoc(tokens: Token[]): BytecodeProgram {\n const builder = new BytecodeBuilder();\n this.parseExpression(builder, tokens);\n return builder.build();\n }\n\n /**\n * Executes an already-compiled program in symbolic-tolerant mode (an\n * undefined variable becomes a `Symbolic` placeholder instead of\n * throwing `UNDEFINED_VARIABLE`. See `vm/VM.ts`'s `executeBytecode()`\n * doc comment on its own `symbolicTolerant` parameter). Used by both\n * the \"just simplify this\" `=>` mode and bare equation evaluation\n * (a bare assignment's RHS, and an equation's own RHS at solve time)\n *, every one of these needs forward-tolerant reads of not-yet-defined\n * names, which ordinary evaluation deliberately never allows.\n *\n * `lineNumber` is the 1-based document line this program belongs to, so\n * the RHS still receives a {@link makeLineContext}, a bare assignment's\n * right-hand side (`total = prev`, `x = line2`) can therefore read\n * cross-line results exactly as a bare expression line does. Defaults to\n * `-1` (the \"no real document\" sentinel) for the expression-level and\n * `=>`-without-a-document callers, which naturally yields the same\n * `LINE_REF_NO_DOCUMENT` a single-expression eval already returns.\n */\n private executeSymbolicTolerant(program: BytecodeProgram, lineNumber: number = -1): Value {\n const result = executeBytecode(program, this.vm, undefined, undefined, this.makeLineContext(lineNumber), true);\n if (result.type === 'error') throw result.error;\n if (result.type === 'pending') {\n throw ErrorFactory.execution(\n 'THEREFORE_ASYNC_UNSUPPORTED',\n `\"=>\" doesn't support expressions that call an async operation (weather/stocks/currency).`,\n );\n }\n return result.value;\n }\n\n /** Compiles and executes `tokens` in symbolic-tolerant mode, the \"just simplify this\" `=>` fallback when there's no stored equation to solve. `lineNumber` (1-based, `-1` outside a document) is forwarded so a bare assignment's RHS can resolve cross-line references. */\n private simplifySymbolically(tokens: Token[], lineNumber: number = -1): Value {\n return this.executeSymbolicTolerant(this.compileAdHoc(tokens), lineNumber);\n }\n\n /**\n * Parses a bare (colon-less) equation's left-hand side, `factor1 *\n * factor2 * ... * variable`, into an ordered list of bare names, or\n * `null` if `tokens` isn't EXACTLY that shape (an alternating\n * `IDENT/UNIT`, `STAR`, `IDENT/UNIT`, `STAR`, ... sequence with no\n * other token types). Returning `null` means \"don't intercept this\n * line at all\", it falls through to whatever the ordinary expression\n * grammar already does with a bare `=` in it (today: a clear parse\n * error), so this pattern-match can only ever ADD a new capability,\n * never take one away.\n *\n * Requiring `IDENT`/`UNIT` at every name position is what keeps this\n * safe from the reserved-keyword collision risk `VariableParselet.ts`\n * guards against for the colon-prefixed form: a genuinely reserved\n * word (`clamp`, `global`, ...) always lexes as ITS OWN token type,\n * never `IDENT`/`UNIT`, so it can never satisfy this pattern, the\n * same protection, for free, without a duplicated keyword list.\n */\n private parseFactorChain(tokens: Token[]): string[] | null {\n if (tokens.length === 0 || tokens.length % 2 === 0) return null;\n const names: string[] = [];\n for (let i = 0; i < tokens.length; i++) {\n if (i % 2 === 0) {\n if (tokens[i].type !== 'IDENT' && tokens[i].type !== 'UNIT') return null;\n names.push(tokens[i].value);\n } else {\n if (tokens[i].type !== 'STAR') return null;\n }\n }\n return names;\n }\n\n /**\n * Solves a stored equation, `variable = inv(factor1*factor2*...) *\n * rhs`. Every step is symbolic-aware (`vm/MatrixOps.ts`'s\n * `matrixMultiply()`/`inverse()`), so a factor whose OWN cells are\n * still-unassigned free variables (`s = [sx,0,0;...]`) solves\n * correctly, producing a Matrix whose cells are algebraic formulas\n * rather than plain numbers. Errors (a missing factor, a non-Matrix\n * factor/RHS, a singular combined matrix) are returned as `Error`-typed\n * Values, not thrown, matching this engine's established \"matrix\n * errors propagate as values\" convention (DIMENSION_MISMATCH,\n * SINGULAR_MATRIX, ...).\n */\n private solveEquation(equation: EquationDef, lineNumber: number = -1): Value {\n const factorValues: Value[] = [];\n for (const name of equation.factorNames) {\n const v = this.vm.getVar(name);\n if (v === undefined) {\n return errorValue(\n 'EQUATION_FACTOR_UNDEFINED',\n `Cannot solve for \"${equation.variable}\": \"${name}\" is not yet defined.`,\n );\n }\n if (v.type !== ValueType.Matrix) {\n return errorValue(\n 'EQUATION_FACTOR_NOT_MATRIX',\n `Cannot solve for \"${equation.variable}\": \"${name}\" must be a Matrix (got a different value type).`,\n );\n }\n factorValues.push(v);\n }\n\n let combined = factorValues[0].value as MatrixData;\n for (let i = 1; i < factorValues.length; i++) {\n const product = matrixMultiply(combined, factorValues[i].value as MatrixData);\n if (product.type === ValueType.Error) return product;\n combined = product.value as MatrixData;\n }\n\n const inv = inverse(combined);\n if (inv.type === ValueType.Error) return inv;\n\n const rhsValue = this.executeSymbolicTolerant(equation.rhsProgram, lineNumber);\n if (rhsValue.type !== ValueType.Matrix) {\n return errorValue(\n 'EQUATION_RHS_NOT_MATRIX',\n `Cannot solve for \"${equation.variable}\": the right-hand side must be a Matrix.`,\n );\n }\n\n return matrixMultiply(inv.value as MatrixData, rhsValue.value as MatrixData);\n }\n\n /**\n * Detects and handles this session's two new symbolic-algebra grammar\n * shapes on `normalizedTokens`, returning the computed result directly\n * (bypassing ordinary bytecode compilation/caching entirely, since\n * BOTH shapes have effects, a stored equation, a direct variable\n * assignment, that a cached bytecode program can't represent) or\n * `null` if neither shape matches (meaning ordinary processing should\n * proceed exactly as it did before this feature existed):\n *\n * 1. `<bareIdent> =>` or `<expr> =>`, trailing `THEREFORE`. A bare\n * identifier with a STORED equation solves it (see\n * {@link solveEquation}); anything else (including a bare\n * identifier with NO stored equation) runs in symbolic-tolerant\n * mode and simplifies (see {@link simplifySymbolically}), a\n * near-free \"just simplify this\" mode.\n * 2. `factor1*factor2*...*variable = rhs`, a bare (colon-less), NOT\n * already colon/global-prefixed, top-level `EQUALS` whose LHS\n * matches {@link parseFactorChain}'s narrow pattern. A single bare\n * name (`s = [sx,0,0;...]`) is an ORDINARY (colon-less) assignment\n *, its RHS is ALWAYS evaluated symbolic-tolerantly (so a matrix\n * literal with still-unassigned entries assigns successfully,\n * carrying those free variables as real symbolic cells) and stored\n * via `vm.setVar()`. Two or more names (`s*t*v = rhs`) stores a\n * genuine equation keyed by the LAST name (`v`), solved later via\n * shape 1 above.\n *\n * This is a deliberately narrow pattern match, not a general equation\n * solver. See `OpRegistry.ts`'s `EquationDef` doc comment and this\n * session's own Phase H.2 scope decision (full symbolic MATRICES, not\n * a general CAS).\n */\n private trySymbolicGrammar(normalizedTokens: Token[], lineNumber: number = -1): Value | null {\n if (normalizedTokens.length === 0) return null;\n\n const last = normalizedTokens[normalizedTokens.length - 1];\n if (last.type === 'THEREFORE') {\n const beforeTokens = normalizedTokens.slice(0, -1);\n if (beforeTokens.length === 0) {\n throw ErrorFactory.parsing('THEREFORE_REQUIRES_EXPRESSION', `\"=>\" needs an expression or variable name before it.`);\n }\n if (beforeTokens.length === 1 && (beforeTokens[0].type === 'IDENT' || beforeTokens[0].type === 'UNIT')) {\n // The matrix product-chain equation is checked FIRST and its\n // behaviour is unchanged. The scalar kind is only consulted when\n // that finds nothing, so the older path can never be diverted.\n const name = beforeTokens[0].value;\n const equation = this.vm.getEquation(name);\n const scalar = this.vm.getScalarEquation(name);\n if (equation) {\n const solved = this.solveEquation(equation, lineNumber);\n // A product chain of names is stored as a matrix equation\n // on sight, since whether the factors are matrices is only\n // knowable at solve time. When they turn out not to be,\n // `a*n = 10` with a plain numeric `a` is an ordinary scalar\n // equation, so fall through to that rather than leaving the\n // user with \"must be a Matrix\" for a line that has a\n // perfectly good answer. Every other failure (a missing\n // factor, a singular matrix) still surfaces unchanged.\n const isNotMatrix = solved.type === ValueType.Error && solved.value === 'EQUATION_FACTOR_NOT_MATRIX';\n if (!isNotMatrix || !scalar) return solved;\n }\n if (scalar) {\n return this.solveScalarEquation(scalar, lineNumber);\n }\n }\n return this.simplifySymbolically(beforeTokens, lineNumber);\n }\n\n // An algebra verb (`expand(...)`, and the later phases' `factor`/\n // `solve`) is itself a request to work symbolically, so it does not also\n // need a trailing `=>`. Without this, `expand((x+1)*(x+2))` on its own\n // line would hard-throw UNDEFINED_VARIABLE on `x` before ever reaching\n // the builtin. Placed after the THEREFORE branch so an explicit `=>`\n // still wins, and before the COLON/GLOBAL guard so the existing\n // assignment grammars stay untouched.\n if (containsSymbolicCall(normalizedTokens)) {\n return this.simplifySymbolically(normalizedTokens, lineNumber);\n }\n\n // Already the colon-prefixed (`:name = value`) or `global :name`\n // grammar, completely untouched, don't even attempt to match.\n if (normalizedTokens[0].type === 'COLON' || normalizedTokens[0].type === 'GLOBAL') return null;\n\n const eqIdx = normalizedTokens.findIndex(t => t.type === 'EQUALS');\n if (eqIdx === -1) return null;\n\n const names = this.parseFactorChain(normalizedTokens.slice(0, eqIdx));\n if (names === null) {\n // Not a product chain. It may still be a general scalar equation\n // (`x^2-4 = 0`), which is a strictly narrower attempt made only\n // after every existing shape has declined. See\n // {@link tryStoreScalarEquation} for what it refuses to swallow.\n return this.tryStoreScalarEquation(normalizedTokens, eqIdx);\n }\n\n const rhsTokens = normalizedTokens.slice(eqIdx + 1);\n\n if (names.length === 1) {\n const result = this.simplifySymbolically(rhsTokens, lineNumber);\n this.vm.setVar(names[0], result);\n return result;\n }\n\n const freeVar = names[names.length - 1];\n const factorNames = names.slice(0, -1);\n this.vm.defineEquation(freeVar, factorNames, this.compileAdHoc(rhsTokens));\n // Also stored as a scalar equation, so that `a*n = 10` with a numeric\n // `a` still has an answer. Which of the two kinds applies depends on\n // whether the factors are matrices, and that is not known until solve\n // time; storing both costs one extra compile of a line the user is\n // about to ask about anyway. The matrix kind is always tried first, so\n // this cannot change what an existing document does.\n this.vm.defineScalarEquation(freeVar, this.compileAdHoc(normalizedTokens.slice(0, eqIdx)), this.compileAdHoc(rhsTokens));\n return stringValue(`${freeVar} stored as an equation — solve with \"${freeVar} =>\"`);\n }\n\n /**\n * Stores a general scalar equation (`x^2 - 4 = 0`) keyed by its unknown, or\n * returns `null` to let ordinary processing continue.\n *\n * This is the riskiest pattern match in the file, because a bare `=` is\n * already claimed by three shipped grammars, and swallowing any of them\n * would break a working feature silently. Each is excluded deliberately:\n *\n * - **A user-defined function definition** (`f(x) = 2*x`). Its left side is\n * a name followed by `(`, which no equation ever is, so a `LPAREN` in\n * second position declines outright. This is the exclusion that matters\n * most: `parseFactorChain` already returns `null` for it, so without this\n * guard the definition grammar would be intercepted before the parser\n * ever saw it.\n * - **A bare assignment** (`a = [1,2;3,4]`) and **a product-chain matrix\n * equation** (`a*x = [60;70]`). Both are handled by `parseFactorChain`\n * above and never reach here.\n * - **A colon-prefixed or global assignment**. Excluded earlier still.\n *\n * Two further conditions narrow it to genuine equations. There must be\n * exactly one top-level `=` (an `==` comparison lexes as `EQUALITY`, a\n * different token, so it cannot collide), and at least one side must carry\n * an unknown. Without that last check `2+2 = 4` would become an equation\n * with no variable and report an identity, where today it is a parse error;\n * changing an unrelated line's behaviour is not this feature's business.\n *\n * @param normalizedTokens - The whole line's normalized tokens.\n * @param eqIdx - Index of the first `EQUALS` token.\n * @returns A confirmation value when stored, or `null` to decline.\n */\n private tryStoreScalarEquation(normalizedTokens: Token[], eqIdx: number): Value | null {\n if (normalizedTokens[1]?.type === 'LPAREN') return null;\n if (eqIdx === 0 || eqIdx === normalizedTokens.length - 1) return null;\n\n const lhsTokens = normalizedTokens.slice(0, eqIdx);\n const rhsTokens = normalizedTokens.slice(eqIdx + 1);\n if (rhsTokens.some(t => t.type === 'EQUALS')) return null;\n\n const unknowns = this.equationUnknowns(lhsTokens, rhsTokens);\n if (unknowns.length !== 1) return null;\n\n const variable = unknowns[0];\n this.vm.defineScalarEquation(variable, this.compileAdHoc(lhsTokens), this.compileAdHoc(rhsTokens));\n return stringValue(`${variable} stored as an equation — solve with \"${variable} =>\"`);\n }\n\n /**\n * The names in an equation that have no value yet, which is what makes them\n * the thing to solve for.\n *\n * A name that already holds a value is not an unknown: in `y = 2` followed\n * by `x + y = 5`, only `x` is being solved for. A name that is a defined\n * function is likewise excluded, so a call to one never looks like an\n * unknown.\n *\n * @param lhsTokens - Left-hand side tokens.\n * @param rhsTokens - Right-hand side tokens.\n * @returns The distinct unassigned names, in first-seen order.\n */\n private equationUnknowns(lhsTokens: Token[], rhsTokens: Token[]): string[] {\n const unknowns: string[] = [];\n for (const token of [...lhsTokens, ...rhsTokens]) {\n if (token.type !== 'IDENT' && token.type !== 'UNIT') continue;\n if (this.vm.getVar(token.value) !== undefined) continue;\n if (this.vm.hasUserFunction(token.value)) continue;\n if (!unknowns.includes(token.value)) unknowns.push(token.value);\n }\n return unknowns;\n }\n\n /**\n * Solves a stored scalar equation via `symbolic/Solve.ts`.\n *\n * Both sides are evaluated symbolic-tolerantly first, so the unknown\n * survives as a `Symbolic` value rather than throwing, and a side that\n * reduces to a plain number is lifted into the symbolic domain to match.\n *\n * @param equation - The stored equation.\n * @returns The solution, rendered by the same helper `solve()` uses, so the\n * two surfaces cannot disagree about how an outcome reads.\n */\n private solveScalarEquation(equation: ScalarEquationDef, lineNumber: number = -1): Value {\n const lhs = this.executeSymbolicTolerant(equation.lhsProgram, lineNumber);\n const rhs = this.executeSymbolicTolerant(equation.rhsProgram, lineNumber);\n return solveEquationValues(lhs, rhs, equation.variable);\n }\n\n //#endregion\n\n /**\n * Lex an expression via `resetExpression` (skips `classifyLine`\n * callers already know this is an expression), filtering out COMMENT\n * tokens (they have no parselet) and tracking whether any paren was\n * seen. Shared by every lex-then-{@link prepareExpression} call site:\n * {@link compileExpression}, {@link tryCompileExpression}, and\n * {@link evaluateExpressionWithDiagnostic}. `onToken`, when given, is\n * called once per emitted (already-filtered) token, used ONLY by the\n * diagnostic path to fire its per-token `TokenEmitted` events; every\n * other caller omits it.\n */\n private lexToTokens(expression: string, onToken?: (t: Token) => void): { tokens: Token[]; hasParens: boolean } {\n const tokens: Token[] = [];\n let hasParens = false;\n this.lexer.resetExpression(expression);\n for (const t of this.lexer) {\n if (t.type === 'COMMENT') continue;\n if (t.type === \"LPAREN\" || t.type === \"RPAREN\") hasParens = true;\n tokens.push(t);\n onToken?.(t);\n }\n return { tokens, hasParens };\n }\n\n /**\n * Shared pipeline front-half: safety checks → COMMENT filter →\n * normalize → complexity → read/write extraction → bytecode cache\n * lookup or parse+compile.\n *\n * Used by {@link evaluateWithTokens} (which continues into preflight +\n * execution) and {@link compileExpression} (compile-only). Previously\n * both carried their own copy of this sequence, which had already\n * drifted. Returns a discriminated union instead of throwing so each\n * caller decides whether/how to re-throw.\n *\n * The `'error'` variant carries the actual `EngineError` each safety\n * check or `parseExpression()` itself already constructed, not just\n * its flattened `.message` (the previous shape). A parse failure in\n * particular can be any of dozens of specific codes (UNDEFINED_VARIABLE,\n * NO_PREFIX_PARSELET, FUNCTION_ARITY_MISMATCH, ...), each with its own\n * `expected`/`found`/`suggestion` detail, callers used to discard all\n * of that and reconstruct a generic EVALUATION_ERROR/PARSE_ERROR wrapper\n * around just the message, which directly worked against this session's\n * \"errors are verbose and easy to understand\" goal. Callers should\n * generally just `throw prep.error` (see {@link evaluateWithTokens},\n * {@link compileExpression}) rather than wrapping it again.\n *\n * `onFusion`, when given, is passed straight through to the normalizer's\n * own optional per-fusion callback, used ONLY by\n * {@link evaluateExpressionWithDiagnostic} to observe individual token\n * fusions for its `normalizer` diagnostic stage. Omitted by every other\n * caller, with zero behavior change (identical to not passing a 2nd\n * argument to `normalizer.normalize()` at all).\n *\n * The `'error'` variant's `normalizedTokens` is populated whenever\n * normalization already ran before the failure (`'complexity'`/`'parse'`\n * stages), `undefined` when it failed before tokens were even considered\n * (`'length'` stage), lets {@link evaluateExpressionWithDiagnostic}\n * reconstruct its own diagnostic-stage payloads (which need the\n * normalized tokens to recompute a display-only complexity score) without\n * re-deriving them by hand.\n *\n * The `'ready'` (uncached) variant's `parserAlloc` is the\n * `AllocationTracker.track('parser', ...)` result for JUST the actual\n * parse+build call (`null` whenever `AllocationTracker.isEnabled()` is\n * false, or on a cache hit, no parsing happened). This has to be\n * measured HERE, not reconstructed by a caller after the fact: unlike\n * every other diagnostic field, a heap-delta measurement only means\n * anything over the EXACT span it's wrapped around, wrapping the\n * whole `prepareExpression()` call from the outside (as\n * {@link evaluateExpressionWithDiagnostic} briefly did) widens that span\n * to also cover normalize/complexity-check/cache-lookup, which measurably\n * produced negative-allocation readings (a GC sweep landing inside the\n * wider window) in `AllocationTracker.spec.ts` well over half the time.\n */\n private prepareExpression(\n expression: string,\n tokens: Token[],\n hasParens: boolean | undefined,\n onFusion?: (fusion: TokenFusion) => void,\n lineNumber: number = -1,\n ):\n | { kind: 'empty' }\n | { kind: 'error'; stage: 'length' | 'complexity' | 'parse'; error: EngineError; reads?: string[]; writes?: string[]; normalizedTokens?: Token[] }\n | { kind: 'ready'; normalizedTokens: Token[]; reads: string[]; writes: string[]; program: BytecodeProgram; cached: boolean; parserAlloc?: StageAllocation | null }\n | { kind: 'symbolic-solve'; normalizedTokens: Token[]; value: Value } {\n // ══ SAFETY CHECK 1: Expression length limit ══\n const lengthCheck = checkExpressionLength(expression, this.config.validation);\n if (!lengthCheck.passed) {\n return { kind: 'error', stage: 'length', error: lengthCheck.error!.engineError! };\n }\n\n // Filter COMMENT tokens, they have no parselet.\n const exprTokens = tokens.filter(t => t.type !== 'COMMENT');\n if (exprTokens.length === 0) {\n return { kind: 'empty' };\n }\n\n // ══ NORMALIZER ══\n // Phrase fusion, implicit multiply, domain token merging.\n const normalizedTokens = this.normalizer.normalize(exprTokens, onFusion);\n\n // ══ SAFETY CHECK 2: Complexity scoring ══\n const complexityCheck = checkExpressionComplexity(normalizedTokens, this.config.validation);\n if (!complexityCheck.passed) {\n return { kind: 'error', stage: 'complexity', error: complexityCheck.engineError!, normalizedTokens };\n }\n\n // ══ SYMBOLIC ALGEBRA: `=>` / bare equation-statement grammar ══\n // Bypasses bytecode caching entirely, both shapes have effects\n // (a stored equation, a direct vm.setVar()) a cached program can't\n // represent. See trySymbolicGrammar()'s own doc comment.\n // The symbolic grammar parses its own operand sub-ranges (see\n // simplifySymbolically/compileAdHoc), so it can throw the parser's\n // errors from here, ahead of the try/catch guarding the main parse\n // below. Caught into the same 'parse' result every other failure in\n // this method returns, because a throw escaping prepareExpression\n // reaches tryCompileExpression(), which is documented as a\n // non-throwing boolean and is called by LanguageService on every\n // visible line on every keystroke. `total =` is a line half-typed on\n // the way to `total = 5`, and it took the editor down.\n let symbolicResult: Value | null;\n try {\n symbolicResult = this.trySymbolicGrammar(normalizedTokens, lineNumber);\n } catch (e) {\n // reads/writes supplied for the same reason the main parse's catch\n // supplies them: the line names variables even though it does not\n // yet parse, so a caller tracking dependencies can re-evaluate it\n // once the user finishes typing.\n const { reads, writes } = extractReadsAndWrites(normalizedTokens);\n return { kind: 'error', stage: 'parse', error: normalizeUnknownError(e), reads, writes, normalizedTokens };\n }\n if (symbolicResult !== null) {\n return { kind: 'symbolic-solve', normalizedTokens, value: symbolicResult };\n }\n\n const { reads, writes } = extractReadsAndWrites(normalizedTokens);\n\n // ══ BYTECODE CACHE / PARSE+COMPILE ══\n const cachedProgram = this.bytecodeCache.get(expression);\n if (cachedProgram) {\n return { kind: 'ready', normalizedTokens, reads, writes, program: cachedProgram, cached: true };\n }\n\n // Get a pooled builder, avoids 4 heap allocations per expression\n const builder = this.builderPool[this.builderPoolIndex++ % this.builderPool.length];\n builder.reset();\n let program: BytecodeProgram;\n let parserAlloc: StageAllocation | null = null;\n try {\n // build() allocates TypedArrays directly from builder arrays\n // a single copy (builder → TypedArray). Wrapped together with\n // parseExpression() under one 'parser' allocation measurement,\n // matching the exact span this file's diagnostic path has always\n // measured (see this method's own doc comment on `parserAlloc`).\n const parseResult = AllocationTracker.track('parser', () => {\n this.parseExpression(builder, normalizedTokens, hasParens);\n return builder.build();\n });\n program = parseResult.result;\n parserAlloc = parseResult.alloc;\n } catch (e) {\n // reads/writes were already extracted above from the full token\n // list (independent of whether parsing succeeds), returned\n // alongside the error (not merged into its context here, since\n // EngineError.context is readonly) so callers that track\n // dependencies (ThreeTierEvaluator's compile-fallback DAG\n // registration, via compileExpression()'s merge below) still\n // learn what this line references and can re-evaluate it once\n // those variables become defined.\n return { kind: 'error', stage: 'parse', error: normalizeUnknownError(e), reads, writes, normalizedTokens };\n }\n\n this.cacheBytecode(expression, program);\n return { kind: 'ready', normalizedTokens, reads, writes, program, cached: false, parserAlloc };\n }\n\n /**\n * Shared async-resolver preflight check, run before VM execution.\n *\n * O(1) guard: skips the O(n) resolver scan when the bytecode has no\n * async opcodes AND no resolvers are registered. Either condition alone\n * is enough to warrant a preflight scan:\n * - program.hasAsync: bytecode contains CALL_PLUGIN (async VM path)\n * - resolverRegistry.size > 0: resolvers may intercept any expression\n * For purely sync expressions (e.g., `2 + 2`) with no resolvers, this is\n * an O(1) fast-path that bypasses the resolver scan entirely.\n *\n * If any registered resolver says \"data not ready\", registers a DAG\n * data-source dependency, stores a Pending result, and fires async\n * resolution (fire-and-forget, resolves later, re-evaluates on\n * completion), the caller should skip VM execution entirely and return\n * the pending Value as-is. Otherwise the caller should proceed to\n * {@link executeAndStore}.\n *\n * Used by both {@link evaluateWithTokens} and\n * {@link evaluateExpressionWithDiagnostic}, previously each carried its\n * own copy of this exact sequence (differing only in a cosmetic\n * abortLogger label), which is how the `=>` grammar shipped silently\n * dead on the diagnostic path earlier this session: a future top-level\n * grammar addition can no longer be wired into only one of the two.\n */\n private preflightAsync(\n normalizedTokens: Token[],\n program: BytecodeProgram,\n lineNumber: number,\n expression: string,\n reads: string[],\n writes: string[],\n ): { kind: 'pending'; value: Value } | { kind: 'proceed' } {\n if (!(program.hasAsync || this.resolverRegistry.size > 0)) {\n return { kind: 'proceed' };\n }\n\n // Check all registered async resolvers BEFORE VM execution.\n // If any resolver says \"data not ready\", skip VM and return Pending.\n // Link the preflight AbortController to the keystroke signal so\n // that in-flight preflight checks are canceled on new keystrokes.\n const preflightController = new AbortController();\n const abortPreflight = () => preflightController.abort();\n this.keystrokeSignal?.addEventListener('abort', abortPreflight, { once: true });\n\n abortLogger.localControllerCreated(\"preflightAsync\");\n if (this.keystrokeSignal) {\n abortLogger.signalLinked(\"preflightAsync\");\n }\n\n const preflightSignal = preflightController.signal;\n const asyncCheck = this.resolverRegistry.preflightAll(\n normalizedTokens, program, '_engine', preflightSignal, this.queryClient\n );\n if (asyncCheck) {\n // Fire-and-forget, resolves asynchronously, re-evaluates on completion\n void this.resolveAsync({\n type: 'pending',\n queryKey: asyncCheck.queryKey,\n resolver: asyncCheck.resolver,\n packageId: asyncCheck.packageId || '_engine',\n signal: asyncCheck.signal,\n });\n\n // Register data source dependency for DAG re-evaluation tracking\n this.dag.registerLineDataSourceDependency(\n lineNumber,\n asyncCheck.packageId || '_engine',\n [asyncCheck.queryKey]\n );\n\n const pending = pendingValue(asyncCheck.queryKey);\n this.storeLineResult(lineNumber, pending, program, reads, writes, expression);\n return { kind: 'pending', value: pending };\n }\n // Sync path, no async resolution started, so the preflight\n // controller is inert. Unhook its keystroke listener.\n this.keystrokeSignal?.removeEventListener('abort', abortPreflight);\n return { kind: 'proceed' };\n }\n\n /**\n * Evaluate an expression using already-lexed tokens.\n *\n * The lean, non-diagnostic-instrumented path, used by\n * {@link evaluateLineWithPreTokenized} (tokens from `scanDocument()`)\n * and, via {@link compileExpression}/{@link tryCompileExpression},\n * compile-only callers. NOT used by `evaluateLine()`/\n * `evaluateExpression()`, those route through\n * {@link evaluateExpressionWithDiagnostic} instead (evaluateLine ->\n * evaluateLineDetailed -> evaluateLineWithDebug ->\n * evaluateExpressionWithDiagnostic), which does its own lexing and its\n * own diagnostic-instrumented front-half, delegating to the SAME\n * {@link prepareExpression} this method calls. Delegates the front-half\n * to {@link prepareExpression}, then runs async preflight (via\n * {@link preflightAsync}) + VM execution (via {@link executeAndStore}).\n */\n private evaluateWithTokens(\n lineNumber: number,\n expression: string,\n tokens: Token[],\n hasParens?: boolean\n ): Value {\n const prep = this.prepareExpression(expression, tokens, hasParens, undefined, lineNumber);\n\n if (prep.kind === 'empty') {\n const v = numberValue(0);\n this.lineCache.set(lineNumber, new LineCacheEntry(v, { opcodes: new Uint8Array(0), numbers: new Float64Array(0), strings: [], hasAsync: false }, [], null), expression);\n return v;\n }\n if (prep.kind === 'error') {\n // Re-throw the original error as-is, its own code/category\n // (EXPRESSION_TOO_LONG/EXPRESSION_TOO_COMPLEX/whatever the\n // parser actually threw) and expected/found/suggestion detail\n // are more specific and useful than the generic EVALUATION_ERROR\n // wrapper this used to construct around just the message.\n throw prep.error;\n }\n if (prep.kind === 'symbolic-solve') {\n // No DAG registration, a stored equation/bare-assignment's\n // effect (vm.equations, vm.setVar) isn't reads/writes-trackable\n // the same way ordinary bytecode is, so this line won't\n // auto-re-evaluate if some unrelated line later changes one of\n // its factor variables. A disclosed limitation of this\n // narrow, bounded grammar (see trySymbolicGrammar()'s own doc\n // comment), not an oversight.\n this.storeLineResult(lineNumber, prep.value, { opcodes: new Uint8Array(0), numbers: new Float64Array(0), strings: [], hasAsync: false }, [], [], expression);\n return prep.value;\n }\n\n const { normalizedTokens, reads, writes, program } = prep;\n\n // ══ PRE-FLIGHT ASYNC CHECK ══\n const preflight = this.preflightAsync(normalizedTokens, program, lineNumber, expression, reads, writes);\n if (preflight.kind === 'pending') {\n return preflight.value;\n }\n\n // Execute and handle result, no try/catch needed.\n // executeBytecode now returns EvalResult (discriminated union).\n return this.executeAndStore(program, lineNumber, expression, reads, writes, '_engine');\n }\n\n //#endregion\n\n //#region Public API, Line-level evaluation\n\n\t/**\n\t * Evaluate a single expression line with full DAG and LineCache integration.\n\t *\n\t * @param lineNumber - 1-based line position in the document.\n\t * @param lineText - The raw line text.\n\t * @returns The evaluated Value, wrapped in a single-element array.\n\t * @throws {EngineError} On evaluation failure.\n\t */\n\tevaluateLine(\n lineNumber: number,\n lineText: string\n ): EvalResults {\n const detailed = this.evaluateLineDetailed(lineNumber, lineText);\n return detailed.values.slice() as EvalResults;\n }\n\n /**\n * Evaluate a line and return an explicit `{ values }` object.\n *\n * @throws {EngineError} On evaluation failure.\n */\n evaluateLineDetailed(lineNumber: number, lineText: string): LineEvaluation {\n const result = this.evaluateLineWithDebug(lineNumber, lineText);\n if (result.error) {\n // Re-throw the original error (its own specific code/category/\n // expected/found/suggestion, e.g. CLAMP_EXPECTED_BETWEEN_OR_FROM\n // or UNDEFINED_VARIABLE) rather than the generic EVALUATION_ERROR\n // wrapper this used to always construct around just the message\n //, engineError is only absent if some future failure path in\n // the diagnostic pipeline sets `error` without it, which the\n // fallback below still handles.\n if (result.engineError) {\n throw result.engineError;\n }\n throw ErrorFactory.execution(\n 'EVALUATION_ERROR',\n result.error,\n { lineNumber }\n );\n }\n return { values: [freezeIfDev(result.value)] };\n }\n\n /**\n * Evaluate a line with diagnostic information, supporting both regular expressions and inline solves.\n *\n * This is the primary entry point for the playground's debug/DIagnostic mode.\n * It delegates to {@link evaluateExpressionWithDiagnostic} for all actual evaluation,\n * but first checks for inline solve syntax (`s`expression``) and wraps the result\n * with inline solve position metadata when found.\n *\n * @param lineNumber - 1-based line number in the document.\n * @param lineText - Raw line text, which may be a regular expression or an inline solve.\n * @param inputType - Optional input type hint passed through to the diagnostic pipeline.\n * @returns An object containing the evaluated `value`, the raw `tokens`, the compiled\n * `program`, optional `error` message, optional `debug` report JSON, and optional\n * structured `diagnostic` pipeline result with all 15 pipeline stages.\n */\n evaluateLineWithDebug(\n lineNumber: number,\n lineText: string,\n inputType: string = \"expression\"\n ): { value: Value; tokens: Token[]; program: BytecodeProgram; error?: string; engineError?: EngineError; inlineSolve?: InlineSolvePosition; debug?: DiagnosticReportJSON; diagnostic?: DiagnosticPipelineResult } {\n const inlineSolveMatch = lineText.match(/^s`([^`]*)`$/);\n if (inlineSolveMatch) {\n const expression = inlineSolveMatch[1];\n const result = this.evaluateExpressionWithDiagnostic(expression, lineNumber, inputType);\n return {\n ...result,\n inlineSolve: {\n start: 0,\n end: lineText.length,\n expression,\n lineNumber,\n columnNumber: 1\n }\n };\n }\n return this.evaluateExpressionWithDiagnostic(lineText, lineNumber, inputType);\n }\n\n //#endregion\n\n //#region Diagnostic Pipeline, Structured stage recording\n\n /**\n * Build a single pipeline stage result for the structured diagnostic output.\n *\n * Appends a `PipelineStageResult` to the given `stages` array with the provided\n * metadata. This runs in parallel with the existing event-based diagnostic system\n * (via `DiagnosticPipeline.fire*` methods). Both paths are enabled by the same\n * `hasCollectors` guard so there is no performance impact when `diagnosticMode`\n * is `false`, the stages array stays empty because this method is never called.\n *\n * Each stage captures:\n * - **Identity**: `stage` name (e.g., `\"lexer\"`), display `label`, `icon`, `colorClass`\n * - **Position**: `stepNumber` in the pipeline (0-15)\n * - **Timing**: `elapsedNs` wall-time (overridden by TimelineDiagnosticCollector)\n * - **State**: `skipped` flag for stages bypassed by cache hits or guard conditions\n * - **Payload**: `output`, a discriminated union typed per stage\n *\n * @param stages - Mutable array being accumulated for the final DiagnosticPipelineResult.\n * @param stage - Canonical stage identifier (kebab-case, e.g. `\"async_preflight\"`).\n * @param label - Human-readable stage name for the dashboard.\n * @param icon - Single emoji/character icon for visual identification.\n * @param colorClass - CSS class name for color-coding the stage in the UI.\n * @param stepNumber - Ordinal position in the 15-stage pipeline.\n * @param elapsedNs - Wall-clock time in nanoseconds (0 placeholder; timeline overrides).\n * @param skipped - Whether this stage was bypassed (e.g., cache hit, guard short-circuit).\n * @param output - Stage-specific data payload typed via the StageOutput discriminated union.\n */\n private addDiagnosticStage(\n stages: PipelineStageResult[],\n stage: string,\n label: string,\n icon: string,\n colorClass: string,\n stepNumber: number,\n elapsedNs: number,\n skipped: boolean,\n output: StageOutput,\n ): void {\n stages.push({ stage, label, icon, colorClass, stepNumber, elapsedNs, skipped, output });\n }\n\n /**\n * Core expression evaluation logic with diagnostic pipeline integration.\n *\n * Executes the full 15-stage evaluation pipeline while simultaneously\n * populating two diagnostic data structures:\n *\n * 1. **Event-based**, fires typed events to registered `DiagnosticCollector`\n * instances via `DiagnosticPipeline.fire*()` methods. Supports streaming\n * diagnostics via `TimelineDiagnosticCollector`.\n * 2. **Structured stages**, accumulates a `PipelineStageResult[]` array\n * with per-stage typed payloads (see `DiagnosticPipelineResult.ts`).\n * This is returned as the `diagnostic` field for declarative rendering.\n *\n * The 15 stages, in order:\n * ```\n * 1 pipeline_start, Pipeline initialization + metadata\n * 2 safety_length, Expression length validation\n * 3 lexer, Tokenization via ExpressionLexer\n * 4 normalizer, Token fusion (phrase, implicit multiply)\n * 5 safety_complexity, Token-count & nesting-depth check\n * 6 readwrite, Variable read/write extraction for DAG\n * 7 cache_check, Bytecode cache hit/miss\n * 8 parser, AST construction via PrecedenceParser\n * 9 compiler, Bytecode generation + constant table\n * 10 async_preflight, Async resolver pre-flight check\n * 11 vm_execute, Bytecode execution on the VM\n * 12 dag_registration, DAG node registration for incremental eval\n * 13 linecache, Result stored in LineCache\n * 14 result, Final value + formatting\n * 15 pipeline_end, Completion summary + statistics\n * ```\n *\n * Early-exit paths are taken for safety violations, empty expressions,\n * parse failures, and async pending results. Each early exit still\n * fires relevant pipeline events and records partial stages.\n *\n * When `AllocationTracker.isEnabled()`, each pipeline stage is wrapped\n * with `AllocationTracker.track()` to capture wall-time and heap delta.\n * When disabled (production), `track()` is a zero-overhead passthrough\n * that returns the result directly.\n *\n * The stages above describe OBSERVABLE shape, not a second implementation\n * of the underlying work: normalize/complexity-check/symbolic-grammar/\n * readwrite/cache-lookup/parse/compile are delegated to\n * {@link prepareExpression} (the SAME method the lean\n * {@link evaluateWithTokens} path calls), async preflight to\n * {@link preflightAsync}, and VM execution to {@link executeAndStore}\n * every stage/event below is reconstructed from what those shared\n * methods return, not fired from inside a second hand-duplicated copy\n * of their logic. This matters: a new top-level grammar shape wired\n * into `prepareExpression()` is automatically reachable from BOTH\n * `evaluateLine()`/`evaluateExpression()` (this method) and the lean\n * path, previously they were two independent implementations that had\n * already drifted once (the `=>`/equation-statement grammar shipped\n * dead on this, the real path, until a dedicated test caught it).\n *\n * @param expression - The raw expression string to evaluate.\n * @param lineNumber - 1-based line number for DAG and LineCache entries.\n * @param inputType - Input type hint (default `\"expression\"`), passed to\n * the diagnostic pipeline for metadata.\n * @returns An object with `value`, `tokens`, `program`, optional `error`,\n * optional `debug` report JSON, and optional `diagnostic` containing\n * the full structured pipeline stages array when collectors are active.\n */\n private evaluateExpressionWithDiagnostic(expression: string, lineNumber: number, inputType: string = \"expression\"): { value: Value; tokens: Token[]; program: BytecodeProgram; error?: string; engineError?: EngineError; debug?: DiagnosticReportJSON; diagnostic?: DiagnosticPipelineResult } {\n const pipeline = this.diagnosticPipeline;\n const hasCollectors = pipeline.hasCollectors;\n // Baseline for slicing THIS line's own parselet_matched events out of\n // the timeline collector's cumulative-across-the-document array below\n //. See debug.parselets' construction at the end of this method.\n const parseletsBefore = this.timelineCollector?.parseletMatchCount ?? 0;\n const trackEnabled = AllocationTracker.isEnabled();\n const stageAllocs: StageAllocation[] = [];\n const stages: PipelineStageResult[] = [];\n const zeroElapsed = 0; // Placeholder — timeline collector overrides with real ns\n\n // === SAFETY CHECK 1: Expression length limit ===\n const lengthCheck = checkExpressionLength(expression, this.config.validation);\n if (!lengthCheck.passed) {\n if (hasCollectors) {\n this.addDiagnosticStage(stages, 'safety_length', 'Safety: Length', '🛡️', 'validate', 2, zeroElapsed, false, {\n type: 'safety_length',\n passed: false,\n expressionLength: expression.length,\n maxLength: this.config.validation.maxExpressionLength,\n errorMessage: lengthCheck.error!.error,\n });\n }\n return { ...lengthCheck.error!, debug: undefined, diagnostic: undefined };\n }\n\n // Pipeline event: start + structured stage\n if (hasCollectors) {\n pipeline.firePipelineStart({\n type: DiagnosticEventType.PipelineStart,\n elapsedNs: 0,\n expression,\n inputType,\n });\n this.addDiagnosticStage(stages, 'pipeline_start', 'Pipeline Start', '▶', 'pipeline', 1, zeroElapsed, false, {\n type: 'pipeline_start', expression, inputType,\n });\n this.addDiagnosticStage(stages, 'safety_length', 'Safety: Length', '🛡️', 'validate', 2, zeroElapsed, false, {\n type: 'safety_length',\n passed: true,\n expressionLength: expression.length,\n maxLength: this.config.validation.maxExpressionLength,\n });\n }\n\n // ══ LEXER STAGE ══\n // Lexing with token emission events. This file's shared\n // lexToTokens() (also used by compileExpression/\n // tryCompileExpression) skips redundant classifyLine (caller\n // already knows this is an expression) and filters COMMENT tokens\n // (they have no parselet and would cause \"No prefix parselet\n // found\" errors at the parser); `onToken` fires the per-token\n // TokenEmitted diagnostic event, genuinely specific to this path.\n const onToken = hasCollectors ? (t: Token) => {\n pipeline.fireTokenEmitted({\n type: DiagnosticEventType.TokenEmitted,\n elapsedNs: 0, // zero-cost placeholder (timeline collector overrides)\n expression,\n token: {\n type: t.type,\n value: t.value,\n offset: t.offset || 0,\n line: t.line || lineNumber,\n col: t.col || 0,\n },\n });\n } : undefined;\n const lexResult = AllocationTracker.track('lexer', () => this.lexToTokens(expression, onToken));\n const tokens = lexResult.result.tokens;\n const hasParens = lexResult.result.hasParens;\n if (trackEnabled && lexResult.alloc) stageAllocs.push(lexResult.alloc);\n\n // Structured: lexer stage output\n if (hasCollectors) {\n const tokenTypes: Record<string, number> = {};\n for (const t of tokens) {\n tokenTypes[t.type] = (tokenTypes[t.type] || 0) + 1;\n }\n this.addDiagnosticStage(stages, 'lexer', 'Lexer', '🔤', 'lexer', 3, zeroElapsed, false, {\n type: 'lexer',\n tokenCount: tokens.length,\n tokenTypes,\n hasParens,\n locale: this.localeCode,\n tokens: [...tokens],\n });\n\n // Structured: line classification, detect inline solve spans from token stream\n const inlineSolveSpans: InlineSolveSpanInfo[] = [];\n for (let i = 0; i < tokens.length; i++) {\n const t = tokens[i];\n if (t.type === 'INLINE_SOLVE_START') {\n // Find closing backtick\n let endIdx = -1;\n for (let j = i + 1; j < tokens.length; j++) {\n if (tokens[j].type === 'BACKTICK_OPEN') {\n endIdx = j;\n break;\n }\n }\n if (endIdx > i) {\n const exprTokens = tokens.slice(i + 1, endIdx);\n const expression = exprTokens.map(et => et.value).join('');\n inlineSolveSpans.push({\n startTokenIndex: i,\n endTokenIndex: endIdx,\n expression,\n columnNumber: t.col || 1,\n });\n i = endIdx; // skip past this span\n }\n }\n }\n this.addDiagnosticStage(stages, 'line_classification', 'Line Classification', '📋', 'classify', 3.5, zeroElapsed, false, {\n type: 'line_classification',\n classification: 'expression',\n skip: false,\n hasInlineSolve: inlineSolveSpans.length > 0,\n inlineSolveSpans,\n });\n }\n\n if (tokens.length === 0) {\n const v = numberValue(0);\n this.lineCache.set(lineNumber, new LineCacheEntry(v, { opcodes: new Uint8Array(0), numbers: new Float64Array(0), strings: [], hasAsync: false }, [], null), expression);\n\n if (hasCollectors) {\n pipeline.firePipelineEnd({\n type: DiagnosticEventType.PipelineEnd,\n elapsedNs: 0,\n expression,\n success: true,\n totalTokens: 0,\n totalOpcodes: 0,\n });\n }\n\n return { value: v, tokens, program: { opcodes: new Uint8Array(0), numbers: new Float64Array(0), strings: [], hasAsync: false }, debug: undefined, diagnostic: undefined };\n }\n\n // ══ FRONT-HALF DELEGATION ══\n // normalize -> complexity -> symbolic-grammar -> readwrite -> cache\n // lookup/parse/compile, all via the SAME prepareExpression() the\n // lean path (evaluateWithTokens/compileExpression/\n // tryCompileExpression) already calls. This is the actual fix for\n // the bug found earlier this session (a new top-level grammar\n // shape silently dead on THIS, the real evaluateLine()/\n // evaluateExpression() path): a future addition wired into\n // prepareExpression() now automatically covers both paths, since\n // there is only one implementation left of \"what does this line\n // mean.\" Every stage below is reconstructed from\n // prepareExpression()'s return value, plus a couple of cheap\n // pure, side-effect-free recomputations for display-only fields it\n // doesn't itself carry (the complexity score), instead of being\n // fired from inside a second, hand-duplicated copy of its logic.\n let fusionCount = 0;\n const normalizerFusions: TokenFusion[] = [];\n const normalizerRuleCounts = new Map<string, number>();\n const onFusion = hasCollectors ? (fusion: TokenFusion) => {\n fusionCount++;\n normalizerFusions.push(fusion);\n normalizerRuleCounts.set(fusion.rule, (normalizerRuleCounts.get(fusion.rule) || 0) + 1);\n pipeline.fireTokenFused({\n type: DiagnosticEventType.TokenFused,\n elapsedNs: 0,\n expression,\n ruleName: fusion.rule,\n sourceTokenCount: fusion.sourceTokens.length,\n fusedTokenType: fusion.fusedToken.type,\n fusedTokenValue: fusion.fusedToken.value,\n });\n } : undefined;\n\n if (hasCollectors && this.normalizer.ruleCount > 0) {\n pipeline.fireNormalizerStart({\n type: DiagnosticEventType.NormalizerStart,\n elapsedNs: 0,\n expression,\n inputTokenCount: tokens.length,\n });\n }\n\n // Peeked BEFORE calling prepareExpression() so hit/miss is already\n // known for the stage/event construction below, and so the\n // parser's diagnostic-pipeline reference is only linked when a real\n // parse attempt is actually about to happen, a cache hit never\n // reaches parseExpression() at all, matching the original's own\n // cache-miss-only gating of this same call.\n const cachedBefore = this.bytecodeCache.get(expression);\n if (hasCollectors && !cachedBefore) {\n this.parser.setDiagnosticPipeline(pipeline, expression);\n }\n\n // NOT wrapped in AllocationTracker.track('parser', ...) here\n // prepareExpression() already measures its OWN internal parse+build\n // call under that exact label internally (see its own doc comment\n // on `parserAlloc`) and reports the result back on its 'ready'\n // variant below. Wrapping the whole call from out here would widen\n // the measured span to also cover normalize/complexity-check/cache-\n // lookup, which measurably produced negative-allocation readings (a\n // GC sweep landing inside the wider window) well over half the time.\n const prep = this.prepareExpression(expression, tokens, hasParens, onFusion, lineNumber);\n if (trackEnabled && prep.kind === 'ready' && prep.parserAlloc) {\n stageAllocs.push(prep.parserAlloc);\n }\n\n if (hasCollectors && !cachedBefore) {\n this.parser.setDiagnosticPipeline(undefined, \"\");\n }\n\n // From here on, `prep.normalizedTokens` is always defined, the two\n // variants that lack it ('empty', and 'error' at the 'length'\n // stage) are provably unreachable from this call site: the\n // safety-length check and the raw-tokens-empty check above already\n // handled both cases before prepareExpression() was ever invoked.\n const normalizedTokens: Token[] = prep.kind === 'empty' ? tokens : (prep.normalizedTokens ?? tokens);\n\n if (hasCollectors) {\n if (this.normalizer.ruleCount > 0) {\n pipeline.fireNormalizerEnd({\n type: DiagnosticEventType.NormalizerEnd,\n elapsedNs: 0,\n expression,\n outputTokenCount: normalizedTokens.length,\n fusionsCount: fusionCount,\n });\n this.addDiagnosticStage(stages, 'normalizer', 'Normalizer', '🔄', 'normalizer', 4, zeroElapsed, false, {\n type: 'normalizer',\n inputTokenCount: tokens.length,\n outputTokenCount: normalizedTokens.length,\n fusions: normalizerFusions,\n rulesApplied: [...normalizerRuleCounts.entries()].map(([rule, count]) => ({ rule, count })),\n tokens: [...normalizedTokens],\n phrases: this.normalizer.getPhrases(),\n });\n } else {\n this.addDiagnosticStage(stages, 'normalizer', 'Normalizer', '🔄', 'normalizer', 4, zeroElapsed, true, {\n type: 'normalizer',\n inputTokenCount: tokens.length,\n outputTokenCount: tokens.length,\n fusions: [],\n rulesApplied: [],\n tokens: [...tokens],\n phrases: this.normalizer.getPhrases(),\n });\n }\n }\n\n // ══ 'empty' / 'error'-at-'length' outcomes ══\n // Provably unreachable from this call site (see comment above)\n // handled only so the discriminated union stays exhaustively\n // covered.\n if (prep.kind === 'empty' || (prep.kind === 'error' && prep.stage === 'length')) {\n if (hasCollectors) {\n pipeline.firePipelineEnd({\n type: DiagnosticEventType.PipelineEnd,\n elapsedNs: 0,\n expression,\n success: prep.kind === 'empty',\n totalTokens: tokens.length,\n totalOpcodes: 0,\n });\n }\n if (prep.kind === 'empty') {\n const v = numberValue(0);\n this.lineCache.set(lineNumber, new LineCacheEntry(v, { opcodes: new Uint8Array(0), numbers: new Float64Array(0), strings: [], hasAsync: false }, [], null), expression);\n return { value: v, tokens, program: { opcodes: new Uint8Array(0), numbers: new Float64Array(0), strings: [], hasAsync: false }, debug: undefined, diagnostic: undefined };\n }\n return {\n value: numberValue(0),\n tokens: [],\n program: { opcodes: new Uint8Array(0), numbers: new Float64Array(0), strings: [], hasAsync: false },\n error: prep.error.message,\n engineError: prep.error,\n debug: undefined,\n diagnostic: undefined,\n };\n }\n\n // Recompute the complexity score for display, cheap, pure\n // side-effect-free; prepareExpression() already made the actual\n // pass/fail DECISION, this is purely for the diagnostic stage's own\n // display fields it doesn't itself return.\n const complexityCheck = checkExpressionComplexity(normalizedTokens, this.config.validation);\n\n if (prep.kind === 'error' && prep.stage === 'complexity') {\n if (hasCollectors) {\n this.addDiagnosticStage(stages, 'safety_complexity', 'Safety: Complexity', '🛡️', 'validate', 5, zeroElapsed, false, {\n type: 'safety_complexity',\n passed: false,\n complexityScore: complexityCheck.complexityScore ?? 0,\n maxComplexity: this.config.validation.maxComplexity,\n breakdown: {\n tokenCount: normalizedTokens.length,\n functionCalls: 0,\n nestingDepth: 0,\n },\n errorMessage: complexityCheck.errorMessage!,\n });\n pipeline.firePipelineEnd({\n type: DiagnosticEventType.PipelineEnd,\n elapsedNs: 0,\n expression,\n success: false,\n totalTokens: tokens.length,\n totalOpcodes: 0,\n });\n }\n return {\n value: numberValue(0),\n tokens: [],\n program: { opcodes: new Uint8Array(0), numbers: new Float64Array(0), strings: [], hasAsync: false },\n error: complexityCheck.errorMessage!,\n engineError: complexityCheck.engineError,\n debug: undefined,\n diagnostic: undefined,\n };\n }\n\n if (hasCollectors) {\n this.addDiagnosticStage(stages, 'safety_complexity', 'Safety: Complexity', '🛡️', 'validate', 5, zeroElapsed, false, {\n type: 'safety_complexity',\n passed: true,\n complexityScore: complexityCheck.complexityScore ?? normalizedTokens.length,\n maxComplexity: this.config.validation.maxComplexity,\n breakdown: {\n tokenCount: normalizedTokens.length,\n functionCalls: 0,\n nestingDepth: 0,\n },\n });\n }\n\n if (prep.kind === 'symbolic-solve') {\n if (hasCollectors) {\n pipeline.firePipelineEnd({\n type: DiagnosticEventType.PipelineEnd,\n elapsedNs: 0,\n expression,\n success: true,\n totalTokens: tokens.length,\n totalOpcodes: 0,\n });\n }\n const emptyProgram: BytecodeProgram = { opcodes: new Uint8Array(0), numbers: new Float64Array(0), strings: [], hasAsync: false };\n this.storeLineResult(lineNumber, prep.value, emptyProgram, [], [], expression);\n return {\n value: prep.value,\n tokens: normalizedTokens,\n program: emptyProgram,\n debug: undefined,\n diagnostic: undefined,\n };\n }\n\n // From here, prep.kind is 'ready' or 'error' at the 'parse' stage\n // both carry `reads`/`writes` (extracted before the cache lookup/\n // parse attempt).\n const reads = prep.reads ?? [];\n const writes = prep.writes ?? [];\n\n if (hasCollectors) {\n this.addDiagnosticStage(stages, 'readwrite', 'Read/Write', '📋', 'readwrite', 6, zeroElapsed, false, {\n type: 'readwrite',\n reads,\n writes,\n isAssignment: writes.length > 0,\n });\n this.addDiagnosticStage(stages, 'cache_check', 'Cache Check', '💾', 'cache', 7, zeroElapsed, false, {\n type: 'cache_check',\n hit: !!cachedBefore,\n cacheSize: this.bytecodeCache.size,\n cacheKey: expression,\n });\n if (cachedBefore) {\n pipeline.fireCacheHit({ type: DiagnosticEventType.CacheHit, elapsedNs: 0, expression, cache: \"bytecode\", key: expression });\n } else {\n pipeline.fireCacheMiss({ type: DiagnosticEventType.CacheMiss, elapsedNs: 0, expression, cache: \"bytecode\", key: expression });\n }\n }\n\n if (prep.kind === 'error' && prep.stage === 'parse') {\n // No 'parser'/'compiler' stage, the parse attempt itself is\n // where this failed, matching the original's exact shape (it\n // only ever got as far as the cache_check stage above before\n // the parse threw).\n if (hasCollectors) {\n pipeline.firePipelineEnd({\n type: DiagnosticEventType.PipelineEnd,\n elapsedNs: 0,\n expression,\n success: false,\n totalTokens: tokens.length,\n totalOpcodes: 0,\n });\n }\n return {\n value: numberValue(0),\n tokens: normalizedTokens,\n program: { opcodes: new Uint8Array(0), numbers: new Float64Array(0), strings: [], hasAsync: false },\n error: prep.error.message,\n engineError: prep.error,\n debug: undefined,\n diagnostic: undefined,\n };\n }\n\n if (prep.kind !== 'ready') {\n // Unreachable: every other variant ('empty', 'error' at any\n // stage, 'symbolic-solve') was already returned above. Kept\n // only so TypeScript's discriminated-union narrowing (which\n // doesn't always simplify a chain of `kind === X || (kind ===\n // Y && stage === Z)` guards perfectly) treats `prep.program`\n // below as definitely accessible, without an `as` cast.\n throw ErrorFactory.internal({\n code: \"UNEXPECTED_ERROR\",\n message: \"Internal error: prepareExpression() returned an unexpected variant after all other cases were handled\",\n });\n }\n const program = prep.program;\n\n if (hasCollectors) {\n this.addDiagnosticStage(stages, 'parser', 'Parser', '🌳', 'parser', 8, zeroElapsed, !!cachedBefore, {\n type: 'parser',\n parselets: [],\n uniqueParseletTypes: [],\n astDepth: 0,\n });\n this.addDiagnosticStage(stages, 'compiler', 'Compiler', '⚙️', 'compiler', 9, zeroElapsed, !!cachedBefore, {\n type: 'compiler',\n opcodeCount: program.opcodes.length,\n numberConstants: program.numbers.length,\n stringConstants: program.strings.length,\n hasAsync: program.hasAsync,\n cached: !!cachedBefore,\n });\n pipeline.fireBytecodeBuilt({\n type: DiagnosticEventType.BytecodeBuilt,\n elapsedNs: 0,\n expression,\n opcodesLength: program.opcodes.length,\n numbersLength: program.numbers.length,\n stringsLength: program.strings.length,\n isCached: !!cachedBefore,\n });\n }\n\n // ══ PRE-FLIGHT ASYNC CHECK ══\n const hasAsyncGuard = program.hasAsync || this.resolverRegistry.size > 0;\n const preflight = this.preflightAsync(normalizedTokens, program, lineNumber, expression, reads, writes);\n\n if (hasCollectors) {\n if (preflight.kind === 'pending') {\n this.addDiagnosticStage(stages, 'async_preflight', 'Async Preflight', '🔮', 'async', 10, zeroElapsed, false, {\n type: 'async_preflight',\n path: 'pending',\n pendingQueryKey: preflight.value.value as string,\n resolverCount: this.resolverRegistry.size,\n skippedGuard: true,\n });\n } else if (hasAsyncGuard) {\n this.addDiagnosticStage(stages, 'async_preflight', 'Async Preflight', '🔮', 'async', 10, zeroElapsed, false, {\n type: 'async_preflight',\n path: 'sync',\n resolverCount: this.resolverRegistry.size,\n skippedGuard: false,\n });\n } else {\n this.addDiagnosticStage(stages, 'async_preflight', 'Async Preflight', '🔮', 'async', 10, zeroElapsed, true, {\n type: 'async_preflight',\n path: 'sync',\n resolverCount: 0,\n skippedGuard: true,\n });\n }\n }\n\n if (preflight.kind === 'pending') {\n if (hasCollectors) {\n pipeline.firePipelineEnd({\n type: DiagnosticEventType.PipelineEnd,\n elapsedNs: 0,\n expression,\n success: true,\n totalTokens: tokens.length,\n totalOpcodes: program.opcodes.length,\n });\n }\n return {\n value: preflight.value,\n tokens: normalizedTokens,\n program,\n debug: undefined,\n diagnostic: hasCollectors ? this.buildDiagnosticResult(stages, preflight.value, normalizedTokens, program, null) : undefined,\n };\n }\n\n // ══ VM STAGE ══\n // Delegates to executeAndStore(), the SAME method the lean path\n // calls, which already handles the AbortController/keystroke-\n // signal linking, stack cleanup, and resolveAsync/DAG-registration/\n // storeLineResult side effects internally. executeAndStore()\n // throws on a VM runtime error (matching the lean path's own\n // contract); caught here and converted to a soft `error` return,\n // exactly as this method's own inline VM-execution block used to\n // do directly, so a caller evaluating a whole multi-line document\n // one line at a time still doesn't have one bad line abort every\n // subsequent line.\n const emitVmTrace = hasCollectors && this.config.diagnostic.vmTraceEnabled === true;\n let result: Value;\n try {\n const vmResult = AllocationTracker.track('vm', () => {\n return this.executeAndStore(program, lineNumber, expression, reads, writes, '_engine', emitVmTrace ? pipeline : undefined, expression);\n }, { cacheHit: !!cachedBefore });\n result = vmResult.result;\n if (trackEnabled && vmResult.alloc) stageAllocs.push(vmResult.alloc);\n } catch (e) {\n const engineError = normalizeUnknownError(e);\n if (hasCollectors) {\n pipeline.firePipelineEnd({\n type: DiagnosticEventType.PipelineEnd,\n elapsedNs: 0,\n expression,\n success: false,\n totalTokens: tokens.length,\n totalOpcodes: program.opcodes.length,\n });\n }\n return {\n value: numberValue(0),\n tokens: normalizedTokens,\n program,\n error: engineError.message,\n engineError,\n debug: undefined,\n diagnostic: undefined,\n };\n }\n\n const isPending = result.type === ValueType.Pending;\n\n if (hasCollectors) {\n const resultValue = isPending ? 'pending' : String(result.value ?? '');\n const resultType = isPending ? 'Pending' : (result.unit ? 'Uom' : 'Number');\n this.addDiagnosticStage(stages, 'vm_execute', 'VM Execute', '⚡', 'vm', 11, zeroElapsed, false, {\n type: 'vm_execute',\n totalInstructions: program.opcodes.length,\n stackDepth: this.vm.getStack().length,\n resultType,\n resultValue,\n isPending,\n });\n }\n\n if (isPending) {\n if (hasCollectors) {\n pipeline.firePipelineEnd({\n type: DiagnosticEventType.PipelineEnd,\n elapsedNs: 0,\n expression,\n success: true,\n totalTokens: tokens.length,\n totalOpcodes: program.opcodes.length,\n });\n }\n return {\n value: result,\n tokens: normalizedTokens,\n program,\n debug: undefined,\n diagnostic: hasCollectors ? this.buildDiagnosticResult(stages, result, normalizedTokens, program, null) : undefined,\n };\n }\n\n // ══ BUILD TELEMETRY ══\n if (trackEnabled && stageAllocs.length > 0) {\n this.lastTelemetry = AllocationTracker.createTelemetry(\n expression,\n stageAllocs,\n !!cachedBefore\n );\n }\n\n // Structured: DAG Registration + LineCache + Result + PipelineEnd\n if (hasCollectors) {\n this.addDiagnosticStage(stages, 'dag_registration', 'DAG Registration', '🔗', 'dag', 12, zeroElapsed, false, {\n type: 'dag_registration',\n readsRegistered: reads,\n writesRegistered: writes,\n dataSourcesRegistered: [],\n });\n this.addDiagnosticStage(stages, 'linecache', 'Line Cache', '📦', 'cache', 13, zeroElapsed, false, {\n type: 'linecache',\n lineNumber,\n expression,\n stored: true,\n });\n this.addDiagnosticStage(stages, 'result', 'Result', '✓', 'result', 14, zeroElapsed, false, {\n type: 'result',\n rawValue: String(result.value),\n formattedValue: String(result.value),\n valueType: result.type === 0 ? 'Number' : 'Value',\n unit: result.unit,\n });\n\n pipeline.fireVmHalt({\n type: DiagnosticEventType.VmHalt,\n elapsedNs: 0,\n expression,\n result: result ? {\n type: result.type,\n value: result.value,\n unit: result.unit,\n } : undefined,\n });\n\n this.addDiagnosticStage(stages, 'pipeline_end', 'Pipeline End', '⏹', 'pipeline', 15, zeroElapsed, false, {\n type: 'pipeline_end',\n success: true,\n totalTokens: tokens.length,\n totalOpcodes: program.opcodes.length,\n cacheHit: !!cachedBefore,\n });\n\n pipeline.firePipelineEnd({\n type: DiagnosticEventType.PipelineEnd,\n elapsedNs: 0,\n expression,\n success: true,\n totalTokens: tokens.length,\n totalOpcodes: program.opcodes.length,\n });\n }\n\n // Build debug info, structured diagnostic report\n if (hasCollectors) {\n const reports = pipeline.collectReports();\n const rawDebug = reports[0]?.toJSON();\n // `rawDebug.parselets` as returned by TimelineDiagnosticCollector\n // is cumulative across the WHOLE document pass (deliberately\n // see onPipelineStart's doc comment), not scoped to this one\n // line. Without this slice, every line after the first reports\n // whichever parselet fired FIRST in the entire session\n // (typically NumberParselet, from the document's very first\n // token) as if it were this line's own, a real, confusing\n // display bug, not evidence that NumberParselet does all the\n // parsing work. Slicing from the pre-parse baseline gives just\n // the events this line's own parse actually fired.\n let debug = rawDebug;\n if (rawDebug) {\n const lineParselets = rawDebug.parselets.slice(parseletsBefore);\n // summary.totalParselets/parseCategories are recomputed from\n // the SAME per-line slice above, for the same reason\n // TimelineDiagnosticCollector's parseCategories Map is\n // cumulative across the whole document pass, so reusing it\n // as-is would report \"distinct categories seen all session\"\n // instead of \"categories this line's own parse used\" (e.g.\n // a document that touches arithmetic/datetime/finance\n // packages across many lines would show totalParselets: 3\n // on EVERY line once all three had been seen once,\n // regardless of what that specific line actually parsed).\n // summary.totalTokens/totalOpcodes/cacheHit/elapsedNs are\n // deliberately left as the collector's session-cumulative\n // values, none of them currently has a UI consumer to\n // validate a per-line reinterpretation against, and\n // equivalent, already-correct per-line values exist\n // elsewhere for tokens/opcodes/cache-hit (see LineResult's\n // own token/opcodeCount/wasCached fields in\n // packages/playground-bridge/src/engine.ts).\n const lineParseCategories: Record<string, number> = {};\n for (const p of lineParselets) {\n lineParseCategories[p.parseletCategory] = (lineParseCategories[p.parseletCategory] ?? 0) + 1;\n }\n debug = {\n ...rawDebug,\n parselets: lineParselets,\n summary: {\n ...rawDebug.summary,\n totalParselets: Object.keys(lineParseCategories).length,\n parseCategories: lineParseCategories,\n },\n };\n }\n return {\n value: result,\n tokens: normalizedTokens,\n program,\n debug,\n diagnostic: this.buildDiagnosticResult(stages, result, normalizedTokens, program, null),\n };\n }\n\n return {\n value: result,\n tokens: normalizedTokens,\n program,\n };\n }\n\n //#endregion\n\n //#region Diagnostic Result, Snapshot population\n\n /**\n * Build a complete DiagnosticPipelineResult with engine-wide snapshot data.\n *\n * Populates dagSnapshot, cacheSnapshot, batcherMetrics, and checkpoints\n * alongside the per-line pipeline stages, value, tokens, and program.\n * Previously the playground made separate engine method calls for each.\n */\n private buildDiagnosticResult(\n stages: PipelineStageResult[],\n value: Value,\n tokens: Token[],\n program: BytecodeProgram,\n error: string | null,\n ): DiagnosticPipelineResult {\n return {\n stages,\n value,\n tokens,\n program,\n error,\n dagSnapshot: this.dag.getSnapshot(),\n cacheSnapshot: this.getCacheSnapshot(),\n batcherMetrics: this.getBatcherMetrics(),\n checkpoints: this.getCheckpoints(),\n };\n }\n\n //#endregion\n\n //#region Incremental Evaluation, DAG-driven re-execution\n\n /**\n * Re-evaluate a cached line without reparsing.\n *\n * Used when a variable referenced by this line has changed. Skips\n * lexing, parsing, and compilation, performs only a pre-flight async\n * check and VM execution against the cached bytecode.\n *\n * Returns `undefined` if the line is not in cache.\n *\n * @param lineNumber - The line to re-evaluate.\n * @param expression - The original expression string (used for cache lookup).\n * @returns The updated `Value`, or `undefined` if uncached.\n */\n reEvaluateLine(lineNumber: number, expression: string): Value | undefined {\n const entry = this.lineCache.get(lineNumber, expression);\n if (!entry) return undefined;\n\n const program = this.bytecodeCache.get(expression);\n if (!program) return undefined;\n\n // ══ PRE-FLIGHT ASYNC CHECK ══\n // O(1) guard: skip the O(n) resolver scan when the bytecode has no\n // async opcodes AND no resolvers are registered.\n if (entry.bytecode.hasAsync || this.resolverRegistry.size > 0) {\n // Pre-flight async check, run before VM even for cached bytecode\n // ── Link to keystroke signal ──\n const preflightController = new AbortController();\n const abortPreflight = () => preflightController.abort();\n this.keystrokeSignal?.addEventListener('abort', abortPreflight, { once: true });\n\n abortLogger.localControllerCreated(\"reEvaluateLine preflight\");\n if (this.keystrokeSignal) {\n abortLogger.signalLinked(\"reEvaluateLine preflight\");\n }\n\n const preflightSignal = preflightController.signal;\n const asyncCheck = this.resolverRegistry.preflightAll(\n [], entry.bytecode, '_engine', preflightSignal, this.queryClient\n );\n if (asyncCheck) {\n void this.resolveAsync({\n type: 'pending',\n queryKey: asyncCheck.queryKey,\n resolver: asyncCheck.resolver,\n packageId: asyncCheck.packageId || '_engine',\n signal: asyncCheck.signal,\n });\n return pendingValue(asyncCheck.queryKey);\n }\n // Sync path, unhook the inert preflight controller's keystroke listener.\n this.keystrokeSignal?.removeEventListener('abort', abortPreflight);\n } // end hasAsync guard\n\n // No vm.reset() here: reset() clears the variable table, which would\n // wipe variables defined by other lines that this line's bytecode may\n // read. executeRaw() already snapshots and restores the stack depth.\n const evalResult = this.executeRaw(program, lineNumber);\n\n if (evalResult.type === 'pending') {\n void this.resolveAsync(evalResult);\n return pendingValue(evalResult.queryKey);\n }\n if (evalResult.type === 'error') {\n throw evalResult.error;\n }\n\n const result = evalResult.value;\n entry.result = result;\n\n return result;\n }\n\n getDag(): DependencyGraph {\n return this.dag;\n }\n\n getLineCache(): LineCache {\n return this.lineCache;\n }\n\n getBytecodeCache(): Map<string, BytecodeProgram> {\n return this.bytecodeCache;\n }\n\n /**\n * Get the shared VM instance.\n * Used by VMCheckpointer to create/restore checkpoints.\n */\n getVM(): VM {\n return this.vm;\n }\n\n /**\n * This engine's registries.\n *\n * For introspection: checking what a package registered, or asserting that\n * unregistering removed it. These used to be module-level singletons a\n * caller could import directly, which is exactly the coupling\n * {@link EngineContext} removes, so reaching them now goes through the\n * engine that owns them.\n *\n * @returns The context created for this engine. Mutating what it holds\n * affects this engine's behaviour, so treat it as read-only unless you are\n * deliberately registering something.\n */\n getContext(): EngineContext {\n return this.context;\n }\n\n getScopeManager(): ScopeManager {\n return this.scopeManager;\n }\n\n getLexer(): Lexer {\n return this.lexer;\n }\n\n /**\n * This engine's token normalizer, with every phrase and rule its packages\n * registered.\n *\n * Exposed for the highlighting path. `LanguageService` classifies tokens\n * after the lexer but can only see phrase-fused types (a date literal, a\n * timecode, a package's own fused token) by running the same normalizer\n * evaluation runs. Sharing this instance rather than building a second one\n * is what keeps the two from disagreeing.\n */\n getNormalizer(): TokenNormalizer {\n return this.normalizer;\n }\n\n /**\n * Every completion candidate contributed by currently-registered\n * packages (`IEnginePackage.completionItems`), flattened across all of\n * them. Used by `LanguageService.getCompletions()`.\n */\n getPackageCompletionItems(): CompletionItem[] {\n const items: CompletionItem[] = [];\n for (const pkgItems of this.packageCompletionItems.values()) {\n items.push(...pkgItems);\n }\n return items;\n }\n\n getParseletRegistry(): { prefix: Array<{ tokenType: string; bindingPower: number; category?: string }>; infix: Array<{ tokenType: string; leftBindingPower: number; rightBindingPower: number; category?: string }> } {\n return {\n prefix: this.registry.getAllPrefix(),\n infix: this.registry.getAllInfix(),\n };\n }\n\n /**\n * Lex + normalize (phrase fusion, implicit multiply, domain token\n * merging) `text` WITHOUT parsing or executing it, a cheap way for a\n * host to inspect what token stream a line would actually produce,\n * without paying for a full parse/compile/VM pass.\n *\n * Built for line-classification heuristics like \"does this look like a\n * real expression, or is it prose I shouldn't bother evaluating\", a\n * host that only checks for digits/operators/symbols before deciding\n * whether to evaluate a line will incorrectly skip genuine all-word\n * expressions (`weather in Tokyo`, `time in Paris`, `average of X, Y,\n * Z`), since none of those contain a digit or symbol. Checking whether\n * `tokenizeForClassification(text)[0]?.type` is anything OTHER than the\n * generic `IDENT` fallback is a reliable signal that the lexer/normalizer\n * actually recognized a specific keyword or fused multi-word phrase\n * i.e., this is real, registered vocabulary, not an arbitrary word that\n * merely happens to be lexable (every word lexes as IDENT if nothing\n * more specific claims it, so IDENT alone proves nothing about intent).\n *\n * Assumes the caller has already ruled out markdown-structural lines\n * (headings, code fences, etc.) via `getLexer().classifyLine()`. This\n * always tokenizes as a plain expression line, mirroring\n * `Lexer.resetExpression()`'s own \"caller already knows this is\n * evaluable\" contract.\n */\n tokenizeForClassification(text: string): Token[] {\n this.lexer.resetExpression(text);\n const rawTokens = Array.from(this.lexer);\n const exprTokens = rawTokens.filter(t => t.type !== 'COMMENT');\n if (exprTokens.length === 0) return [];\n return this.normalizer.normalize(exprTokens);\n }\n\n getParser(): PrecedenceParser {\n return this.parser;\n }\n\n isDiagnosticMode(): boolean {\n return this.diagnosticPipeline.hasCollectors;\n }\n\n //#endregion\n\n //#region Public API, Keystroke signal\n\n /**\n * Set the keystroke-level AbortSignal for the current evaluation cycle.\n *\n * Called by the UI layer (via ThreeTierEvaluator) before evaluate() or\n * evaluateAll(). All per-evaluation AbortControllers created during this\n * cycle link to this signal so that when the user types a new keystroke,\n * all in-flight async work is canceled atomically.\n *\n * @param signal The keystroke's AbortSignal, or null to clear.\n */\n setKeystrokeSignal(signal: AbortSignal | null): void {\n if (signal) {\n abortLogger.keystrokeSignalSet(signal.aborted);\n } else {\n abortLogger.keystrokeSignalCleared();\n }\n this.keystrokeSignal = signal;\n }\n\n /**\n * Get a serializable cache snapshot for diagnostic rendering.\n *\n * Returns bytecode cache entries, line cache entries, and async cache\n * packages, all as plain objects with no internal references. Previously\n * the playground accessed this via `(engine as any).getCacheSnapshot?.()`.\n */\n getCacheSnapshot(): CacheSnapshot {\n const bytecode: BytecodeCacheEntry[] = [];\n for (const [expression, program] of this.bytecodeCache) {\n bytecode.push({\n expression,\n opcodesLength: program.opcodes.length,\n numbersLength: program.numbers.length,\n stringsLength: program.strings.length,\n hasAsync: program.hasAsync,\n });\n }\n\n const lineCacheEntries: LineCacheEntryInfo[] = [];\n for (const key of this.lineCache.keys()) {\n // Keys are \"lineNumber\" or \"lineNumber:expression\", parse out both parts.\n const colonIdx = key.indexOf(':');\n const lineNumber = colonIdx > 0\n ? (parseInt(key.slice(0, colonIdx), 10) || 0)\n : (parseInt(key, 10) || 0);\n const expressionPart = colonIdx > 0 ? key.slice(colonIdx + 1) : undefined;\n\n const entry = expressionPart !== undefined\n ? this.lineCache.get(lineNumber, expressionPart)\n : this.lineCache.getEntryForLine(lineNumber);\n if (!entry) continue;\n\n lineCacheEntries.push({\n key,\n lineNumber,\n resultType: String(entry.result?.type ?? ''),\n resultValue: String(entry.result?.value ?? ''),\n reads: entry.readVariables ?? [],\n writeVar: entry.writeVariable ?? null,\n });\n }\n\n // Build async cache snapshot from TanStack Query cache\n const queryCache = this.queryClient.getQueryCache();\n const allQueries = queryCache.getAll();\n const asyncCache = allQueries.map(q => {\n const status = q.state.status === 'success' ? 'resolved' as const\n : q.state.status === 'error' ? 'error' as const\n : 'in_flight' as const;\n return {\n packageId: (q.queryKey[0] as string) ?? 'unknown',\n resolvedCount: q.state.status === 'success' ? 1 : 0,\n inFlightCount: q.state.status !== 'success' && q.state.status !== 'error' ? 1 : 0,\n errorCount: q.state.status === 'error' ? 1 : 0,\n entries: [{ key: q.queryKey.join(':'), status }],\n };\n });\n\n return { bytecode, lineCache: lineCacheEntries, asyncCache };\n }\n\n /**\n * Get serializable batcher metrics for the Workers diagnostic tab.\n *\n * Reads the typed read-only accessors on {@link AsyncResolutionBatcher}\n * (`pendingCount`/`dedupCount`/`workerOffloadCount`/`listenerCount`)\n * instead of reaching into its private fields via `(this.batcher as any)`.\n */\n getBatcherMetrics(): BatcherMetrics {\n return {\n pendingCount: this.batcher.pendingCount,\n dedupCount: this.batcher.dedupCount,\n workerOffloadCount: this.batcher.workerOffloadCount,\n listenerCount: this.batcher.listenerCount,\n };\n }\n\n /**\n * Get a serializable snapshot of VM checkpoints for diagnostics.\n *\n * The checkpointer lives on the ThreeTierEvaluator (not the engine),\n * so this returns an empty array when no checkpointer is available.\n * Previously accessed via `(vm as any).checkpointer.getAllCheckpoints?.()`.\n */\n getCheckpoints(): CheckpointSnapshot[] {\n // ThreeTierEvaluator attaches the checkpointer to the VM at runtime, so\n // it is not on the VM's declared surface. Describing the shape being\n // read, rather than reaching through `any`, keeps the expectation\n // checkable: if getAllCheckpoints' signature moves, this stops\n // compiling instead of failing at the call.\n const vmWithCheckpointer = this.vm as {\n checkpointer?: {\n getAllCheckpoints(): readonly { lineNumber: number; variables: Record<string, unknown> }[];\n };\n };\n const checkpointer = vmWithCheckpointer.checkpointer;\n if (!checkpointer) return [];\n\n const raw = checkpointer.getAllCheckpoints();\n return raw.map(cp => ({\n lineNumber: cp.lineNumber,\n variables: Object.keys(cp.variables),\n variableCount: Object.keys(cp.variables).length,\n }));\n }\n\n /**\n * Get the most recent pipeline telemetry from AllocationTracker.\n *\n * Returns null when AllocationTracker.isEnabled() is false (production\n * zero overhead), or when no expression has been evaluated via\n * evaluateExpressionWithDiagnostic() since the last clear().\n *\n * Use this in test/benchmark suites to inspect per-stage wall-time and\n * heap allocation data without enabling the full diagnostic pipeline.\n */\n getLastTelemetry(): PipelineTelemetry | null {\n return this.lastTelemetry;\n }\n\n //#endregion\n\n //#region Public API, Evaluation\n\n /**\n * Evaluate a raw expression string without line-number context.\n * Returns the Value result. Throws on error.\n */\n evaluateExpression(expression: string): EvalResults {\n return this.evaluateLine(-1, expression);\n }\n\n//#endregion\n\n//#region Compilation, Bytecode-only path\n\n /**\n * Compile-only path: lex → parse → bytecode, without execution.\n *\n * Used by Tier 3 (background) evaluation to discover reads/writes\n * for the dependency graph without running display-only expressions.\n *\n * Uses the bytecode cache, repeated compilations of the same expression\n * return the cached program with zero allocation.\n *\n * @param expression - The raw expression string to compile.\n * @returns Object with compiled `program`, lexed `tokens`, and extracted `reads`/`writes`.\n * @throws ErrorFactory on parse failure or safety check failure.\n */\n\tcompileExpression(expression: string): {\n\t\tprogram: BytecodeProgram;\n\t\ttokens: Token[];\n\t\treads: string[];\n\t\twrites: string[];\n\t} {\n\t\tconst { tokens, hasParens } = this.lexToTokens(expression);\n\n\t\t// Shared front-half: safety → normalize → complexity → cache/compile.\n\t\tconst prep = this.prepareExpression(expression, tokens, hasParens);\n\n\t\tif (prep.kind === 'empty') {\n\t\t\treturn {\n\t\t\t\tprogram: { opcodes: new Uint8Array(0), numbers: new Float64Array(0), strings: [], hasAsync: false },\n\t\t\t\ttokens: [],\n\t\t\t\treads: [],\n\t\t\t\twrites: [],\n\t\t\t};\n\t\t}\n\t\tif (prep.kind === 'error') {\n\t\t\tif (prep.stage === 'parse' && (prep.reads?.length || prep.writes?.length)) {\n\t\t\t\t// Preserve the original error's own code/category/expected/\n\t\t\t\t// found/suggestion (whatever the parser actually threw\n\t\t\t\t// UNDEFINED_VARIABLE, FUNCTION_ARITY_MISMATCH, ...) rather\n\t\t\t\t// than the generic PARSE_ERROR wrapper this used to\n\t\t\t\t// construct, but still attach the already-extracted\n\t\t\t\t// reads/writes as context so DAG-registering callers (e.g.\n\t\t\t\t// ThreeTierEvaluator's compile fallback) can track this\n\t\t\t\t// line's dependencies even though it failed to compile.\n\t\t\t\t// EngineError.context is readonly, so this constructs a new\n\t\t\t\t// error carrying every other field through unchanged rather\n\t\t\t\t// than mutating prep.error in place.\n\t\t\t\tthrow new EngineError(prep.error.category, {\n\t\t\t\t\tcode: prep.error.code,\n\t\t\t\t\tmessage: prep.error.message,\n\t\t\t\t\texpected: prep.error.expected,\n\t\t\t\t\tfound: prep.error.found,\n\t\t\t\t\tsuggestion: prep.error.suggestion,\n\t\t\t\t\trecoverable: prep.error.recoverable,\n\t\t\t\t\tspan: prep.error.span,\n\t\t\t\t\tcause: prep.error.cause,\n\t\t\t\t\tcontext: { ...prep.error.context, reads: prep.reads ?? [], writes: prep.writes ?? [] },\n\t\t\t\t});\n\t\t\t}\n\t\t\tthrow prep.error;\n\t\t}\n\t\tif (prep.kind === 'symbolic-solve') {\n\t\t\t// No real bytecode representation for a `=>`/bare-equation line\n\t\t\t// (its effect, a stored equation, a direct vm.setVar(), was\n\t\t\t// already fully computed inside prepareExpression() itself)\n\t\t\t// same \"nothing to compile\" shape as the 'empty' case above.\n\t\t\t// External tooling asking for the compiled program of a `=>`\n\t\t\t// line gets an empty one; a disclosed limitation of this\n\t\t\t// narrow grammar, not an oversight.\n\t\t\treturn {\n\t\t\t\tprogram: { opcodes: new Uint8Array(0), numbers: new Float64Array(0), strings: [], hasAsync: false },\n\t\t\t\ttokens: prep.normalizedTokens,\n\t\t\t\treads: [],\n\t\t\t\twrites: [],\n\t\t\t};\n\t\t}\n\n\t\treturn { program: prep.program, tokens, reads: prep.reads, writes: prep.writes };\n\t}\n\n\t/**\n\t * Non-throwing \"does this compile\" check. Same lex → prepare pipeline as\n\t * {@link compileExpression}, but returns a boolean instead of throwing on\n\t * failure.\n\t *\n\t * compileExpression()'s failure path constructs a EngineError via\n\t * ErrorFactory, which calls Error.captureStackTrace(), one of V8's more\n\t * expensive operations. That's fine for genuine execution/compile errors\n\t * (rare, and the caller needs the message), but LanguageService's\n\t * syntax-highlighting gate calls compileExpression() purely to ask \"does\n\t * this parse\", on every visible line, every keystroke, and the common\n\t * case for a real markdown document is prose lines that DON'T parse, not\n\t * the rare case. Benchmarked: constructing-and-throwing that exception on\n\t * every non-matching line was responsible for highlighting an\n\t * unrecognized-prose line costing roughly an order of magnitude more than\n\t * a recognized expression. This skips that construction entirely, still\n\t * reuses the bytecode cache and prepareExpression()'s normal work, just\n\t * never builds an Error object for the \"no\" answer.\n\t *\n\t * Note: this only avoids the outer exception compileExpression() itself\n\t * would construct. A genuinely deep parse failure (an unmatched token\n\t * mid-expression, not just \"stopped early with leftover tokens\") still\n\t * goes through the parser's own throw/catch inside prepareExpression()\n\t * unavoidable without restructuring the parser's failure signaling, which\n\t * is out of scope here.\n\t *\n\t * The \"non-throwing\" in the first line is a contract callers rely on, not\n\t * a description of the happy path, so it is enforced here rather than left\n\t * to every stage below agreeing to return its errors. It had been left to\n\t * them, and they did not all agree: the lexer throws on an unterminated\n\t * string (`\"`), and the symbolic grammar threw on an assignment whose\n\t * right-hand side is still empty (`total =`). LanguageService calls this\n\t * per visible line per keystroke, so both reached CodeMirror's transaction\n\t * dispatch and broke the editor on input that is merely half-typed.\n\t *\n\t * A catch costs nothing on the path that does not throw, so the \"no\" answer\n\t * this method exists to make cheap stays cheap. Anything that does throw\n\t * was already paying for the Error it constructed.\n\t */\n\ttryCompileExpression(expression: string): boolean {\n\t\ttry {\n\t\t\treturn this.tryCompileExpressionUnguarded(expression);\n\t\t} catch {\n\t\t\t// \"Does this compile\" has a truthful answer for every one of these:\n\t\t\t// no. Swallowing is safe precisely because the answer is a boolean\n\t\t\t// with no detail to lose; callers wanting the reason call\n\t\t\t// compileExpression(), which still throws.\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/** The body of {@link tryCompileExpression}, which owns the contract. */\n\tprivate tryCompileExpressionUnguarded(expression: string): boolean {\n\t\tconst { tokens, hasParens } = this.lexToTokens(expression);\n\t\tconst prep = this.prepareExpression(expression, tokens, hasParens);\n\t\treturn prep.kind !== 'error';\n\t}\n\n\t/**\n\t * Execute pre-compiled bytecode against the engine's shared VM.\n\t * Used by Tier 2 (scroll into view) to re-execute cached bytecode\n\t * without re-lexing, re-parsing, or re-compiling.\n\t *\n\t * Preserves the VM stack, pops any leftover items after execution.\n\t * Does NOT update DAG or LineCache (caller is responsible for state\n\t * management via DocumentModel).\n\t *\n\t * @returns The execution result, or undefined if bytecode is empty.\n\t * @param lineNumber - 1-based line this bytecode belongs to, for\n\t * cross-line features (see `makeLineContext()`). Defaults to -1.\n\t */\n\texecuteCached(program: BytecodeProgram, lineNumber: number = -1): Value {\n\t\tif (program.opcodes.length === 0) {\n\t\t\treturn numberValue(0);\n\t\t}\n\t\tconst evalResult = this.executeRaw(program, lineNumber);\n\n\t\tif (evalResult.type === 'pending') {\n\t\t\tvoid this.resolveAsync(evalResult);\n\t\t\treturn pendingValue(evalResult.queryKey);\n\t\t}\n\t\tif (evalResult.type === 'error') {\n\t\t\t// This is exactly the Tier-2/LOAD_GLOBAL_VAR bypass path\n\t\t\t// ARCHITECTURE.md's P0 item describes, executeCached() never\n\t\t\t// calls preflightAll(), so a global-variable read that should\n\t\t\t// have been guaranteed-resolved by preflight can now surface\n\t\t\t// here as a controlled GLOBAL_VARIABLE_NOT_RESOLVED error\n\t\t\t// (see VM.ts's LOAD_GLOBAL_VAR case) instead of a raw\n\t\t\t// uncaught TypeError. Re-throw so the caller's existing\n\t\t\t// error handling (ThreeTierEvaluator's own per-tier try/catch)\n\t\t\t// handles it exactly like any other executeCached() failure.\n\t\t\tthrow evalResult.error;\n\t\t}\n\n\t\treturn evalResult.value;\n\t}\n\n /**\n * Fast path: evaluate an expression and return a number directly.\n *\n * Skips Value object allocation when only a numeric result is needed.\n * Returns NaN on error or for bare undefined variable references.\n *\n * Performs a pre-check for bare identifiers (single-token variable\n * references). If the identifier is not a known variable, returns NaN\n * immediately without attempting evaluation, avoids the ambiguity of\n * \"result === 0\" when a variable might legitimately store the value 0.\n *\n * @param expression - The raw expression string to evaluate.\n * @returns The numeric result, or NaN on error/undefined variable.\n */\n evaluateNumber(expression: string): number {\n const trimmed = expression.trim();\n\n // Pre-check: bare identifiers that aren't known variables → NaN.\n // Doing this before evaluation avoids the ambiguity of \"result === 0\"\n // when a variable might legitimately store the value 0.\n if (/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(trimmed)) {\n if (this.vm.getVar(trimmed) === undefined) {\n return NaN;\n }\n }\n\n try {\n const results = this.evaluateLine(-1, expression);\n return results[0].toNumber();\n } catch {\n return NaN;\n }\n }\n\n //#endregion\n\n //#region State management, Clear / reset\n\n clear(): void {\n // Cancel pending batcher flushes and clear listeners to prevent\n // stale re-evaluations from in-flight promises that resolve after clear.\n\t\t// This call is what actually releases per-document state. The batcher is\n\t\t// reachable from the module-level data-query service, so an engine that\n\t\t// goes out of scope without clear() stays retained: measured at 46.9KB\n\t\t// per engine against 8.2KB for one that never parsed. See the class doc.\n\t\tthis.batcher.clearAll();\n\n\t\t// The query cache holds a garbage-collection timer per cached query,\n\t\t// armed for `gcTime` (ten minutes). Those timers keep a Node process\n\t\t// alive on their own, so an engine cleared but not emptied here leaves\n\t\t// the host unable to exit for up to ten minutes after its last live\n\t\t// lookup. That is what it was doing to the test suite: every spec\n\t\t// passed, then Jest sat waiting on timers belonging to engines whose\n\t\t// documents were long gone.\n\t\t//\n\t\t// It also belongs here on its own terms. This method is documented as\n\t\t// the call that releases per-document state, and cached query results\n\t\t// are per-document state.\n\t\tthis.queryClient.clear();\n\n\t\t// The active client is a module-level hand-off for synchronous VM\n\t\t// plugin functions. Leaving ours published after clear() would let a\n\t\t// later execution read a cache this engine no longer owns.\n\t\tif (getActiveQueryClient() === this.queryClient) setActiveQueryClient(null);\n\n this.dag.clear();\n this.lineCache.clear();\n this.scopeManager.clear();\n this.bytecodeCache.clear();\n this.vm.reset();\n this.lastTelemetry = null;\n }\n\n //#endregion\n\n //#region Public API, Incremental evaluation\n\n /**\n * Incrementally re-evaluate lines affected by a variable change.\n * Walks the DAG from the changed variable to find exactly which lines\n * need re-execution, no dirty-set indirection, no sorting guesswork.\n * Uses Kahn's algorithm for topological ordering: producers always\n * execute before consumers, regardless of document line order.\n */\n evaluateIncremental(variable: string, newValue: number): Map<number, Value> {\n // Phase 1.4 DAG-walk: get affected lines in topological order.\n // This replaces the old approach of markDirtyFromVariable() →\n // getDirtyLines() → ascending sort, which (a) double-iterated,\n // (b) picked up unrelated dirty lines, and (c) failed for\n // non-ascending dependency chains.\n const affectedLines = this.dag.getAffectedLinesInOrder(variable);\n\n // Preserve existing VM state while overriding the changed variable.\n this.vm.setVar(variable, numberValue(newValue));\n\n const updated = new Map<number, Value>();\n\n for (const lineNumber of affectedLines) {\n const entry = this.lineCache.getEntryForLine(lineNumber);\n if (!entry || entry.bytecode.opcodes.length === 0) continue;\n const evalResult = this.executeRaw(entry.bytecode, lineNumber);\n\n if (evalResult.type === 'pending') {\n void this.resolveAsync(evalResult);\n // Don't block, continue processing other affected lines.\n // The pending result will trigger re-evaluation when resolved.\n continue;\n }\n if (evalResult.type === 'error') {\n // Same per-line-containment shape as\n // AsyncResolutionBatcher.reExecuteMainThread()'s fatal-bug\n // fix: this loop re-executes potentially many DAG-affected\n // lines in one pass, a throw here would abort every\n // remaining affected line even though nothing was wrong\n // with them. Record this one line's failure as an Error\n // Value and continue, rather than letting one bad line take\n // out the whole incremental-update batch.\n const value = errorValue(evalResult.error.code, evalResult.error.message);\n updated.set(lineNumber, value);\n entry.result = value;\n continue;\n }\n\n const result = evalResult.value;\n updated.set(lineNumber, result);\n entry.result = result;\n }\n return updated;\n }\n\n //#endregion\n}\n\n//#endregion","/**\n * SegmentTree, an order-statistic Treap (randomized BST).\n *\n * Replaces the flat `lineOrder: number[]` array in DocumentModel with a\n * balanced tree that supports O(log N) insert, delete, and get-at-index\n * operations. Each node stores a `lineId` and its subtree size, enabling\n * order-statistic queries (find the k-th element by position).\n *\n * Key operations:\n * getAt(index), O(log N) expected\n * insertAt(index), O(log N) expected\n * deleteAt(index), O(log N) expected\n * spliceAt(index, deleteCount, newIds), O(log N + deleteCount + insertCount)\n * indexOf(lineId), O(N) without reverse map; cached lazily in DocumentModel\n *\n * Implementation: Treap (Tree + Heap) with implicit keys.\n * Nodes are ordered by position (in-order traversal), not by lineId value.\n * The `size` field enables O(log N) order statistics.\n * Random priorities maintain balance with high probability (O(log N) depth).\n *\n * Memory: ~40 bytes per node (lineId + size + priority + left + right).\n * For 100K lines: ~4MB for tree structure (acceptable).\n */\n\n// ── Types ──────────────────────────────────────────────────────────────────\n\ninterface Node {\n\tlineId: number;\n\t/** Total number of nodes in this subtree (including self). */\n\tsize: number;\n\t/** Random priority for heap property (maintains balance). */\n\tpriority: number;\n\tleft: Node | null;\n\tright: Node | null;\n}\n\n// ── SegmentTree ────────────────────────────────────────────────────────────\n\n/**\n * Maps document offsets to line numbers in logarithmic time.\n *\n * A document is edited constantly, and every edit shifts the offsets of every\n * line after it. Recomputing them linearly on each keystroke is what this\n * avoids.\n */\nexport class SegmentTree {\n\tprivate root: Node | null = null;\n\n\t// ── Public API ───────────────────────────────────────────────────────\n\n\t/** Total number of elements in the tree. */\n\tget length(): number {\n\t\treturn this.root ? this.root.size : 0;\n\t}\n\n\t/** Whether the tree is empty. */\n\tget isEmpty(): boolean {\n\t\treturn this.root === null;\n\t}\n\n\t/**\n\t * Get the lineId at the given 0-based index.\n\t * Returns undefined if index is out of bounds.\n\t * O(log N) expected.\n\t */\n\tgetAt(index: number): number | undefined {\n\t\tif (index < 0 || index >= (this.root?.size ?? 0)) return undefined;\n\t\treturn this.nodeAt(this.root, index).lineId;\n\t}\n\n\t/**\n\t * Insert a single lineId at the given 0-based index.\n\t * O(log N) expected.\n\t */\n\tinsertAt(index: number, lineId: number): void {\n\t\tconst [left, right] = split(this.root, index);\n\t\tthis.root = merge(merge(left, createNode(lineId)), right);\n\t}\n\n\t/**\n\t * Delete a single element at the given 0-based index.\n\t * Returns the removed lineId, or undefined if out of bounds.\n\t * O(log N) expected.\n\t */\n\tdeleteAt(index: number): number | undefined {\n\t\tif (index < 0 || index >= (this.root?.size ?? 0)) return undefined;\n\n\t\tconst [left, midRight] = split(this.root, index);\n\t\tconst [mid, right] = split(midRight, 1);\n\n\t\tconst removed = mid ? mid.lineId : undefined;\n\t\tthis.root = merge(left, right);\n\t\treturn removed;\n\t}\n\n\t/**\n\t * Bulk splice: delete `deleteCount` elements at `startIndex` (0-based),\n\t * then insert `newIds` in their place.\n\t *\n\t * Returns the removed lineId array.\n\t * O(log N + deleteCount + insertCount) expected.\n\t */\n\tspliceAt(\n\t\tstartIndex: number,\n\t\tdeleteCount: number,\n\t\tnewIds: number[]\n\t): number[] {\n\t\tconst clampedStart = Math.max(0, startIndex);\n\t\tconst clampedCount = Math.min(\n\t\t\tMath.max(0, deleteCount),\n\t\t\t(this.root?.size ?? 0) - clampedStart\n\t\t);\n\n\t\t// Split into three parts: [0, start) [start, start+count) [start+count, end)\n\t\tconst [left, midRight] = split(this.root, clampedStart);\n\t\tconst [mid, right] = split(midRight, clampedCount);\n\n\t\t// Collect removed IDs\n\t\tconst removed = collectInOrder(mid);\n\n\t\t// Build a treap from the new IDs and merge\n\t\tconst newTree = buildTreap(newIds, 0, newIds.length);\n\t\tthis.root = merge(merge(left, newTree), right);\n\n\t\treturn removed;\n\t}\n\n\t/**\n\t * Replace the entire tree with a new set of lineIds.\n\t * O(N), builds a balanced treap from a flat array.\n\t */\n\treplaceAll(lineIds: number[]): void {\n\t\tthis.root = buildTreap(lineIds, 0, lineIds.length);\n\t}\n\n\t/**\n\t * Get a contiguous range of lineIds by index.\n\t * O(rangeSize + log N), single in-order walk instead of N × O(log N).\n\t *\n\t * This is the hot path for viewport rendering in DocumentModel.getVisibleLines().\n\t */\n\tgetRange(startIndex: number, endIndex: number): number[] {\n\t\tconst clampedStart = Math.max(0, startIndex);\n\t\tconst clampedEnd = Math.min((this.root?.size ?? 0) - 1, endIndex);\n\t\tif (clampedStart > clampedEnd) return [];\n\n\t\tconst result: number[] = [];\n\t\tthis.collectRange(this.root, clampedStart, clampedEnd, 0, result);\n\t\treturn result;\n\t}\n\n\t/**\n\t * Clear the tree.\n\t */\n\tclear(): void {\n\t\tthis.root = null;\n\t}\n\n\t// ── Iteration ─────────────────────────────────────────────────────────\n\n\t/**\n\t * In-order iterator yielding all lineIds.\n\t */\n\t*[Symbol.iterator](): IterableIterator<number> {\n\t\tyield* this.inOrder(this.root);\n\t}\n\n\tprivate *inOrder(node: Node | null): IterableIterator<number> {\n\t\tif (!node) return;\n\t\tyield* this.inOrder(node.left);\n\t\tyield node.lineId;\n\t\tyield* this.inOrder(node.right);\n\t}\n\n\t// ── Private helpers ───────────────────────────────────────────────────\n\n\tprivate nodeAt(node: Node | null, index: number): Node {\n\t\t// This is only called with valid indices, so node is non-null\n\t\tconst leftSize = node!.left ? node!.left.size : 0;\n\n\t\tif (index < leftSize) {\n\t\t\treturn this.nodeAt(node!.left, index);\n\t\t} else if (index === leftSize) {\n\t\t\treturn node!;\n\t\t} else {\n\t\t\treturn this.nodeAt(node!.right, index - leftSize - 1);\n\t\t}\n\t}\n\n\t/**\n\t * Collect all node values in the range [targetStart, targetEnd] into result.\n\t * `offset` is the 0-based start of the current subtree within the full tree.\n\t * O(rangeSize + log N), skips entire subtrees outside the target range.\n\t */\n\tprivate collectRange(\n\t\tnode: Node | null,\n\t\ttargetStart: number,\n\t\ttargetEnd: number,\n\t\toffset: number,\n\t\tresult: number[]\n\t): void {\n\t\tif (!node) return;\n\n\t\tconst leftSize = node.left ? node.left.size : 0;\n\t\tconst nodeIndex = offset + leftSize;\n\n\t\t// Traverse left subtree if it overlaps the target range\n\t\tif (nodeIndex > targetStart && node.left) {\n\t\t\tthis.collectRange(node.left, targetStart, targetEnd, offset, result);\n\t\t}\n\n\t\t// Include this node if within range\n\t\tif (nodeIndex >= targetStart && nodeIndex <= targetEnd) {\n\t\t\tresult.push(node.lineId);\n\t\t}\n\n\t\t// Traverse right subtree if it overlaps the target range\n\t\tif (nodeIndex < targetEnd && node.right) {\n\t\t\tthis.collectRange(node.right, targetStart, targetEnd, nodeIndex + 1, result);\n\t\t}\n\t}\n}\n\n// ── Free functions ──────────────────────────────────────────────────────────\n\n/** Create a new treap node. */\nfunction createNode(lineId: number): Node {\n\treturn {\n\t\tlineId,\n\t\tsize: 1,\n\t\tpriority: Math.random(),\n\t\tleft: null,\n\t\tright: null,\n\t};\n}\n\n/** Update a node's size from its children. */\nfunction updateSize(node: Node): void {\n\tnode.size = 1 + (node.left ? node.left.size : 0) + (node.right ? node.right.size : 0);\n}\n\n/**\n * Merge two treaps. All keys in `left` must be ≤ all keys in `right`.\n * O(log N) expected.\n */\nfunction merge(left: Node | null, right: Node | null): Node | null {\n\tif (!left) return right;\n\tif (!right) return left;\n\n\tif (left.priority > right.priority) {\n\t\tleft.right = merge(left.right, right);\n\t\tupdateSize(left);\n\t\treturn left;\n\t} else {\n\t\tright.left = merge(left, right.left);\n\t\tupdateSize(right);\n\t\treturn right;\n\t}\n}\n\n/**\n * Split a treap at `index` (0-based).\n * Returns [left, right] where `left` contains the first `index` elements\n * and `right` contains the rest.\n * O(log N) expected.\n */\nfunction split(\n\tnode: Node | null,\n\tindex: number\n): [Node | null, Node | null] {\n\tif (!node) return [null, null];\n\n\tconst leftSize = node.left ? node.left.size : 0;\n\n\tif (index <= leftSize) {\n\t\tconst [left, right] = split(node.left, index);\n\t\tnode.left = right;\n\t\tupdateSize(node);\n\t\treturn [left, node];\n\t} else {\n\t\tconst [left, right] = split(node.right, index - leftSize - 1);\n\t\tnode.right = left;\n\t\tupdateSize(node);\n\t\treturn [node, right];\n\t}\n}\n\n/**\n * Collect all lineIds from a treap in-order.\n * O(N).\n */\nfunction collectInOrder(node: Node | null): number[] {\n\tconst result: number[] = [];\n\tcollect(node, result);\n\treturn result;\n}\n\nfunction collect(node: Node | null, result: number[]): void {\n\tif (!node) return;\n\tcollect(node.left, result);\n\tresult.push(node.lineId);\n\tcollect(node.right, result);\n}\n\n/**\n * Build a balanced treap from a flat array of lineIds.\n * Uses divide-and-conquer with pre-sorted priorities to produce\n * a heap-ordered tree in O(N) time.\n * O(N).\n */\nfunction buildTreap(lineIds: number[], start: number, end: number): Node | null {\n\tif (start >= end) return null;\n\n\tconst mid = Math.floor((start + end) / 2);\n\n\t// Generate a deterministic-but-random priority based on position\n\t// This ensures the same array always produces the same tree shape\n\tconst priority = pseudoRandom(mid);\n\n\tconst node: Node = {\n\t\tlineId: lineIds[mid],\n\t\tsize: end - start,\n\t\tpriority,\n\t\tleft: buildTreap(lineIds, start, mid),\n\t\tright: buildTreap(lineIds, mid + 1, end),\n\t};\n\n\treturn node;\n}\n\n/**\n * Simple pseudo-random number generator for deterministic treap building.\n * Uses a multiplicative hash of the input.\n */\nfunction pseudoRandom(seed: number): number {\n\tlet x = seed;\n\tx = ((x >> 16) ^ x) * 0x45d9f3b;\n\tx = ((x >> 16) ^ x) * 0x45d9f3b;\n\tx = (x >> 16) ^ x;\n\treturn x / 0xffffffff; // normalize to [0, 1)\n}\n","import { Value } from \"@solve-js/vm/Value\";\nimport { BytecodeProgram } from \"@solve-js/parser/BytecodeBuilder\";\nimport { djb2Hash } from \"@solve-js/utilities/Hash\";\nimport { SegmentTree } from \"@solve-js/engine/SegmentTree\";\nimport { DEFAULT_CONFIG } from \"@solve-js/constants/Configuration\";\nimport { countLines } from \"@solve-js/utilities/Strings\";\nimport { ErrorFactory } from \"@solve-js/errors/UnifiedErrorFramework\";\n\n// ── LineState ──────────────────────────────────────────────────────────────\n\n/**\n * Persistent per-line state tracked by the DocumentModel.\n *\n * Each line receives an immutable `lineId` that survives structural edits\n * (insertions, deletions, line shifts). This allows caches, the dependency\n * graph, and VM checkpoints to reference lines by ID instead of by volatile\n * line numbers.\n *\n * ── Multi-expression support ─────────────────────────────────────────\n * A single document line may contain multiple inline solves (`s\\`...\\``).\n * To support this without breaking the 1:1 line-to-DAG-node contract:\n * - `expressions[]` holds all extracted expression strings (1 entry for\n * full-line expressions, N entries for N inline solves).\n * - `bytecodes[]` holds compiled bytecode in corresponding order.\n * - `results[]` holds evaluation **result groups** in corresponding order.\n * Each element is a `Value[]`, a group of Values produced by that expression.\n * For variable definitions, the group always has exactly 1 element.\n * For multi-output expressions (e.g., currency conversion), the group\n * may have multiple Values (one per target unit).\n * - `reads[]` and `writes[]` are aggregated across ALL expressions on\n * the line, the DAG treats the line as a single dependency node.\n * - `inlineSolveCount` is 0 for full-line expressions, >0 for inline solves.\n */\nexport interface LineState {\n\t/** Immutable unique identifier, survives all structural edits. */\n\treadonly lineId: number;\n\n\t/** djb2 hash of the line text, used for O(1) change detection. */\n\ttextHash: number;\n\n\t/** The full line text (may include markdown). */\n\ttext: string;\n\n\t/**\n\t * Extracted expression texts.\n\t * - Full-line expressions: one entry (the trimmed text).\n\t * - Inline solve lines: one entry per `s\\`...\\`` span, in left-to-right order.\n\t * - Markdown-only lines: empty array.\n\t */\n\texpressions: string[];\n\n\t/**\n\t * Compiled bytecode for each expression, in corresponding order.\n\t * Parallel to {@link expressions}.\n\t */\n\tbytecodes: BytecodeProgram[];\n\n\t/** Variables this line reads (for dependency tracking). Aggregated across all expressions. */\n\treads: string[];\n\n\t/** Variables this line writes (empty if not a variable definition). Aggregated across all expressions. */\n\twrites: string[];\n\n\t/**\n\t * Evaluation result groups for each expression, in corresponding order.\n\t * Each `Value[]` is a group of Values produced by one expression.\n\t * Variable definitions always produce exactly 1 Value per group.\n\t * Multi-output expressions (e.g. currency conversion) may produce N Values.\n\t */\n\tresults: Value[][];\n\n\t/**\n\t * Convenience accessor for the first expression's first result.\n\t * Equals `results[0]?.[0] ?? null`. For single-expression lines,\n\t * this is the primary result. For multi-expression (inline solve) lines,\n\t * prefer accessing `results[i][j]` directly.\n\t */\n\tresult: Value | null;\n\n\t/** True if this line needs re-evaluation. */\n\tdirty: boolean;\n\n\t/** True if any expression on this line defines a variable (never evict bytecode). */\n\tisVariableDef: boolean;\n\n\t/** True if this line contains only markdown (no evaluable expression). */\n\tisEmpty: boolean;\n\n\t/**\n\t * Number of inline solve expressions on this line.\n\t * 0 = full-line expression (or markdown-only).\n\t * >0 = N inline solves embedded in markdown text.\n\t */\n\tinlineSolveCount: number;\n}\n\n// ── ViewportRange ──────────────────────────────────────────────────────────\n\n/** The visible line range, used to decide which lines are evaluated eagerly. */\nexport interface ViewportRange {\n\tstartLine: number; // 1-based, inclusive\n\tendLine: number; // 1-based, inclusive\n}\n\n// ── LineChange ─────────────────────────────────────────────────────────────\n\n/** Describes a structural change to the document's line list. */\nexport interface LineChange {\n\t/** 1-based line number where the change starts. */\n\tstartLine: number;\n\t/** Number of lines deleted (0 for pure insertion). */\n\tdeleteCount: number;\n\t/** New line texts inserted in place of deleted lines. */\n\tinsertLines: string[];\n}\n\n// ── ApplyChangesResult ─────────────────────────────────────────────────────\n\n/** Result of applying changes to the document model. */\nexport interface ApplyChangesResult {\n\t/** Line IDs of newly inserted lines. */\n\tinserted: number[];\n\t/** Line IDs that were removed. */\n\tremoved: number[];\n}\n\n// ── DocumentModel ──────────────────────────────────────────────────────────\n\n/**\n * Persistent document model with O(log N) line lookups and structural edits.\n *\n * Design:\n * - Each line has an immutable `lineId` (monotonically increasing counter).\n * - `LineState` objects are stored in a `Map<lineId, LineState>` for O(1) access.\n * - Line ordering is maintained in a `SegmentTree` (order-statistic Treap) that\n * supports O(log N) insert, delete, and get-at-index operations.\n * - A lazy position cache (`Map<lineId, number>`) provides O(1) position lookups\n * after the first `getLinePosition()` call and is invalidated on structural edits.\n *\n * Key invariant: line IDs never change, only their positions in the order tree.\n * This means cached bytecode, dependency graph entries, and VM checkpoints\n * keyed by lineId remain valid across all structural edits.\n */\nexport class DocumentModel {\n\t/** Persistent line ID → LineState. */\n\tprivate lines: Map<number, LineState> = new Map();\n\n\t/** Order-statistic treap representing the current document line order. */\n\tprivate orderTree: SegmentTree = new SegmentTree();\n\n\t/** Monotonically increasing counter for new line IDs. */\n\tprivate nextLineId: number = 1;\n\n\t/**\n\t * Lazy position cache: lineId → 1-based position.\n\t * Built on first `getLinePosition()` call, invalidated on structural edits.\n\t */\n\tprivate _positionCache: Map<number, number> | null = null;\n\n\t/**\n\t * Line IDs currently marked dirty, maintained alongside every\n\t * `state.dirty` mutation (in this class and in every other module that\n\t * holds a direct `LineState` reference: ThreeTierEvaluator, PageManager).\n\t * Lets {@link hasAnyDirtyLineBefore} answer \"is anything before position\n\t * X dirty\" in O(d log N), d = current dirty count, typically tiny once\n\t * a document has settled after its initial evaluation, instead of\n\t * O(N log N), which used to mean every scroll event re-walked the WHOLE\n\t * document via `getLineAt()` regardless of how little of it was actually\n\t * dirty. Benchmarked: ~10.6ms per setViewport() call scrolled near the\n\t * bottom of a 20k-line document before this fix.\n\t */\n\tprivate dirtyLineIds: Set<number> = new Set();\n\n\t/**\n\t * Most lines this model will hold. See `constants/Configuration.ts`'s\n\t * `performance.maxDocumentLines`, which is where the default comes from and\n\t * which a host raises through its engine config; a host that builds a\n\t * DocumentModel directly passes it here instead.\n\t */\n\tprivate readonly maxLines: number;\n\n\t/**\n\t * @param maxLines - Ceiling on the line count, defaulting to the engine's\n\t * configured one. Every line costs a LineState with six arrays in it\n\t * whatever the line says, so the cost of a document is its line count and\n\t * nothing else bounds it: two hundred thousand lines of `1 + 1` exhausted\n\t * the heap here, before a single expression had been looked at.\n\t */\n\tconstructor(maxLines: number = DEFAULT_CONFIG.performance.maxDocumentLines) {\n\t\tthis.maxLines = maxLines;\n\t}\n\n\t// ── Initialization ──────────────────────────────────────────────────\n\n\t/**\n\t * Initialize or replace the entire document from a text blob.\n\t * Clears all existing state and assigns new persistent line IDs.\n\t *\n\t * @throws `DOCUMENT_TOO_LARGE` for a document past {@link maxLines}, before\n\t * any of it is stored. Recoverable: nothing has been replaced yet, so the\n\t * model still holds whatever it held.\n\t */\n\tsetDocument(text: string): void {\n\t\t// Counted before anything is cleared, so a refused document leaves the\n\t\t// previous one intact rather than half-replaced.\n\t\tconst lineCount = countLines(text, this.maxLines);\n\t\tif (lineCount > this.maxLines) {\n\t\t\tthrow ErrorFactory.execution(\n\t\t\t\t\"DOCUMENT_TOO_LARGE\",\n\t\t\t\t`This document has more than ${this.maxLines.toLocaleString(\"en-US\")} lines, which is the most the engine will hold at once`,\n\t\t\t\t{ maxLines: this.maxLines },\n\t\t\t);\n\t\t}\n\t\tthis.lines.clear();\n\t\tthis.orderTree.clear();\n\t\tthis._positionCache = null;\n\t\tthis.dirtyLineIds.clear();\n\t\tthis.nextLineId = 1;\n\n\t\tconst rawLines = text.split(\"\\n\");\n\t\tconst lineIds = new Array<number>(rawLines.length);\n\n\t\tfor (let i = 0; i < rawLines.length; i++) {\n\t\t\tconst lineId = this.nextLineId++;\n\t\t\tlineIds[i] = lineId;\n\t\t\tthis.lines.set(lineId, {\n\t\t\t\tlineId,\n\t\t\t\ttextHash: djb2Hash(rawLines[i]),\n\t\t\t\ttext: rawLines[i],\n\t\t\t\texpressions: [],\n\t\t\t\tbytecodes: [],\n\t\t\t\treads: [],\n\t\t\t\twrites: [],\n\t\t\t\tresults: [],\n\t\t\t\tresult: null,\n\t\t\t\tdirty: true,\n\t\t\t\tisVariableDef: false,\n\t\t\t\tisEmpty: rawLines[i].trim().length === 0,\n\t\t\t\tinlineSolveCount: 0,\n\t\t\t});\n\t\t}\n\n\t\t// O(N) balanced treap build from flat array\n\t\tthis.orderTree.replaceAll(lineIds);\n\n\t\t// Every line starts dirty (see the object literal above), seed the\n\t\t// tracking set to match. This is the one place the set is legitimately\n\t\t// O(N): a fresh document needs full evaluation anyway.\n\t\tfor (const id of lineIds) this.dirtyLineIds.add(id);\n\t}\n\n\t// ── Structural edits ────────────────────────────────────────────────\n\n\t/**\n\t * Apply one or more line-level changes to the document.\n\t *\n\t * **Precondition:** Changes must be **non-overlapping** in their line ranges.\n\t * If two changes target the same or adjacent lines, the reverse-order\n\t * processing may produce incorrect results because the first-applied\n\t * change shifts the line numbers that the second change references.\n\t *\n\t * Changes are applied in **reverse order** (highest startLine first) so\n\t * that earlier changes in the document don't shift the indices of later\n\t * changes during processing.\n\t *\n\t * Returns both the newly inserted line IDs and the removed line IDs.\n\t * Callers should use `removed` to clean up the dependency graph and\n\t * other data structures keyed by lineId.\n\t */\n\tapplyChanges(changes: LineChange[]): ApplyChangesResult {\n\t\tconst inserted: number[] = [];\n\t\tconst removed: number[] = [];\n\n\t\t// Sort descending by startLine so earlier changes don't shift later indices\n\t\tconst sorted = [...changes].sort((a, b) => b.startLine - a.startLine);\n\n\t\tfor (const change of sorted) {\n\t\t\tconst startIdx = change.startLine - 1; // convert to 0-based\n\n\t\t\t// Create new LineState entries for inserted lines\n\t\t\tconst newIds: number[] = [];\n\t\t\tfor (const text of change.insertLines) {\n\t\t\t\tconst lineId = this.nextLineId++;\n\t\t\t\tnewIds.push(lineId);\n\t\t\t\tinserted.push(lineId);\n\t\t\t\tthis.lines.set(lineId, {\n\t\t\t\t\tlineId,\n\t\t\t\t\ttextHash: djb2Hash(text),\n\t\t\t\t\ttext,\n\t\t\t\t\texpressions: [],\n\t\t\t\t\tbytecodes: [],\n\t\t\t\t\treads: [],\n\t\t\t\t\twrites: [],\n\t\t\t\t\tresults: [],\n\t\t\t\t\tresult: null,\n\t\t\t\t\tdirty: true,\n\t\t\t\t\tisVariableDef: false,\n\t\t\t\t\tisEmpty: text.trim().length === 0,\n\t\t\t\t\tinlineSolveCount: 0,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// New lines start dirty (see the object literal above), track them.\n\t\t\tfor (const id of newIds) this.dirtyLineIds.add(id);\n\n\t\t\t// O(log N) splice: delete old IDs, insert new IDs\n\t\t\tconst removedIds = this.orderTree.spliceAt(\n\t\t\t\tstartIdx,\n\t\t\t\tchange.deleteCount,\n\t\t\t\tnewIds\n\t\t\t);\n\t\t\tfor (const id of removedIds) {\n\t\t\t\tremoved.push(id);\n\t\t\t\tthis.lines.delete(id);\n\t\t\t\tthis.dirtyLineIds.delete(id);\n\t\t\t}\n\t\t}\n\n\t\t// Invalidate position cache, positions shifted for all lines\n\t\tthis._positionCache = null;\n\n\t\treturn { inserted, removed };\n\t}\n\n\t/**\n\t * Insert new lines at the given 1-based position.\n\t * Convenience wrapper around applyChanges.\n\t */\n\tinsertLines(atLine: number, texts: string[]): number[] {\n\t\tconst change: LineChange = {\n\t\t\tstartLine: atLine,\n\t\t\tdeleteCount: 0,\n\t\t\tinsertLines: texts,\n\t\t};\n\t\tconst result = this.applyChanges([change]);\n\t\treturn result.inserted;\n\t}\n\n\t/**\n\t * Delete lines in the given 1-based range [startLine, endLine] inclusive.\n\t * Convenience wrapper around applyChanges.\n\t */\n\tdeleteLines(startLine: number, endLine: number): number[] {\n\t\tconst change: LineChange = {\n\t\t\tstartLine,\n\t\t\tdeleteCount: endLine - startLine + 1,\n\t\t\tinsertLines: [],\n\t\t};\n\t\tconst result = this.applyChanges([change]);\n\t\treturn result.removed;\n\t}\n\n\t/**\n\t * Update the text of a single line in place.\n\t * If the text hash differs, marks the line dirty and clears its\n\t * bytecode/result so it gets re-evaluated.\n\t *\n\t * Returns true if the text actually changed (hash mismatch).\n\t */\n\teditLine(lineNumber: number, newText: string): boolean {\n\t\tconst state = this.getLineAt(lineNumber);\n\t\tif (!state) return false;\n\n\t\tconst newHash = djb2Hash(newText);\n\t\tif (newHash === state.textHash) return false;\n\n\t\tstate.text = newText;\n\t\tstate.textHash = newHash;\n\t\tstate.expressions = [];\n\t\tstate.bytecodes = [];\n\t\tstate.results = [];\n\t\tstate.result = null;\n\t\tstate.inlineSolveCount = 0;\n\t\tstate.dirty = true;\n\t\tthis.dirtyLineIds.add(state.lineId);\n\t\tstate.isEmpty = newText.trim().length === 0;\n\t\treturn true;\n\t}\n\n\t// ── Queries ─────────────────────────────────────────────────────────\n\n\t/**\n\t * Get the LineState at the given 1-based line position. O(1).\n\t */\n\tgetLineAt(position: number): LineState | undefined {\n\t\tconst idx = position - 1;\n\t\tconst lineId = this.orderTree.getAt(idx);\n\t\tif (lineId === undefined) return undefined;\n\t\treturn this.lines.get(lineId);\n\t}\n\n\t/**\n\t * Get the 1-based position of a line by its persistent ID.\n\t * Returns -1 if the line ID is not in the document.\n\t *\n\t * Uses a lazy position cache: O(N) on first call after structural edit,\n\t * O(1) on subsequent calls. The cache is invalidated by any structural edit.\n\t */\n\tgetLinePosition(lineId: number): number {\n\t\tif (this._positionCache) {\n\t\t\treturn this._positionCache.get(lineId) ?? -1;\n\t\t}\n\n\t\t// Build position cache on first call after invalidation\n\t\tthis._positionCache = new Map();\n\t\tlet pos = 1;\n\t\tfor (const id of this.orderTree) {\n\t\t\tthis._positionCache.set(id, pos++);\n\t\t}\n\n\t\treturn this._positionCache.get(lineId) ?? -1;\n\t}\n\n\t/**\n\t * Get all LineState entries within the given viewport range (1-based, inclusive).\n\t * Uses SegmentTree.getRange() for O(viewport + log N) collection instead of\n\t * O(viewport × log N) per-line lookups.\n\t */\n\tgetVisibleLines(startLine: number, endLine: number): LineState[] {\n\t\tconst lineIds = this.orderTree.getRange(startLine - 1, endLine - 1);\n\t\tconst result: LineState[] = [];\n\t\tfor (const lineId of lineIds) {\n\t\t\tconst state = this.lines.get(lineId);\n\t\t\tif (state) result.push(state);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * Get all LineState entries in order. Useful for batch processing.\n\t */\n\tgetAllLines(): LineState[] {\n\t\treturn this.getVisibleLines(1, this.lineCount);\n\t}\n\n\t/**\n\t * Get a LineState by its persistent line ID. O(1).\n\t */\n\tgetLineById(lineId: number): LineState | undefined {\n\t\treturn this.lines.get(lineId);\n\t}\n\n\t/**\n\t * Get all lines that are marked dirty.\n\t */\n\tgetDirtyLines(): LineState[] {\n\t\tconst result: LineState[] = [];\n\t\tfor (const state of this.lines.values()) {\n\t\t\tif (state.dirty) result.push(state);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * Whether any line before `position` (1-based, exclusive) is dirty.\n\t *\n\t * Used by ThreeTierEvaluator.setViewport() to decide whether cached\n\t * checkpoint state might be stale and a full evaluate() (from line 1) is\n\t * needed instead of the cheap viewport-only path.\n\t *\n\t * O(d log N) where d = current dirty line count via {@link dirtyLineIds},\n\t * not O(N log N), a document that's mostly clean (the steady state after\n\t * initial load) answers this in the cost of resolving a handful of\n\t * lineIds to positions, not walking every line up to `position`.\n\t */\n\thasAnyDirtyLineBefore(position: number): boolean {\n\t\tfor (const lineId of this.dirtyLineIds) {\n\t\t\tconst pos = this.getLinePosition(lineId);\n\t\t\tif (pos >= 1 && pos < position) return true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Whether any **variable-definition** line before `position` (1-based,\n\t * exclusive) is dirty.\n\t *\n\t * Narrower than {@link hasAnyDirtyLineBefore}: `VMCheckpointer.snapshot()`\n\t * only ever records state for lines with `writes.length > 0` (see\n\t * VMCheckpoints.ts), so a dirty plain-expression line before the viewport\n\t * cannot have invalidated any checkpoint, there's no checkpoint entry\n\t * for it to invalidate. Only a dirty variable-def line can mean the VM\n\t * state a checkpoint would restore is stale.\n\t *\n\t * This distinction matters because `PageManager.evictPageBytecode()`\n\t * marks evicted non-variable-def lines dirty (so they get Tier 1 if\n\t * scrolled back into view), and Tier 3's compile-only path never clears\n\t * `dirty` for non-variable-def lines by design. Using the broader\n\t * `hasAnyDirtyLineBefore` here meant scrolling far into a large,\n\t * variable-def-free document would trip `setViewport()`'s fallback to\n\t * `evaluate()` on every single call, evaluate() reprocesses the evicted\n\t * lines via Tier 3, which recompiles their bytecode without clearing\n\t * dirty, so the very next `maintainAfterEval()` re-evicts and re-dirties\n\t * the same lines, forever re-triggering the fallback on an otherwise\n\t * unchanged viewport.\n\t */\n\thasAnyDirtyVariableDefLineBefore(position: number): boolean {\n\t\tfor (const lineId of this.dirtyLineIds) {\n\t\t\tconst state = this.lines.get(lineId);\n\t\t\tif (!state || !state.isVariableDef) continue;\n\t\t\tconst pos = this.getLinePosition(lineId);\n\t\t\tif (pos >= 1 && pos < position) return true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/** Number of lines currently marked dirty. For diagnostics/tests. */\n\tget dirtyCount(): number {\n\t\treturn this.dirtyLineIds.size;\n\t}\n\n\t// ── Thread-safety validation ────────────────────────────────────────\n\n\t/**\n\t * Verify that bytecode compiled by a worker is still valid for this line.\n\t *\n\t * When Phase 5.2h sends compilation to a worker, the worker posts back\n\t * `{lineId, bytecode, reads, writes, compiledAgainstHash}`. Between dispatch\n\t * and response, the user may have edited the line. This method lets the\n\t * main thread check whether the bytecode is still applicable.\n\t *\n\t * @returns true if the line still exists and its text hash matches.\n\t */\n\tisBytecodeValid(lineId: number, compiledAgainstHash: number): boolean {\n\t\tconst state = this.lines.get(lineId);\n\t\treturn state !== undefined && state.textHash === compiledAgainstHash;\n\t}\n\n\t// ── State mutations ─────────────────────────────────────────────────\n\n\t/**\n\t * Mark a line as clean (re-evaluated successfully).\n\t */\n\tmarkClean(lineId: number): void {\n\t\tconst state = this.lines.get(lineId);\n\t\tif (state) {\n\t\t\tstate.dirty = false;\n\t\t\tthis.dirtyLineIds.delete(lineId);\n\t\t}\n\t}\n\n\t/**\n\t * Mark a line as dirty (needs re-evaluation) by its 1-based position.\n\t * Convenience for callers that have line numbers instead of line IDs.\n\t */\n\tmarkDirtyByLineNumber(lineNumber: number): void {\n\t\tconst state = this.getLineAt(lineNumber);\n\t\tif (state) {\n\t\t\tstate.dirty = true;\n\t\t\tthis.dirtyLineIds.add(state.lineId);\n\t\t}\n\t}\n\n\t/**\n\t * Mark a line as dirty (needs re-evaluation).\n\t */\n\tmarkDirty(lineId: number): void {\n\t\tconst state = this.lines.get(lineId);\n\t\tif (state) {\n\t\t\tstate.dirty = true;\n\t\t\tthis.dirtyLineIds.add(lineId);\n\t\t}\n\t}\n\n\t/**\n\t * Mark all lines as dirty (e.g., after plugin register/unregister).\n\t */\n\tinvalidateAll(): void {\n\t\tfor (const state of this.lines.values()) {\n\t\t\tstate.dirty = true;\n\t\t}\n\t\tthis.dirtyLineIds = new Set(this.lines.keys());\n\t}\n\n\t/**\n\t * Update a line's evaluation state after successful execution (Tier 1 / Tier 2).\n\t *\n\t * Sets results, bytecodes, reads, writes, and marks the line clean.\n\t * Supports multi-expression lines (inline solves) via parallel arrays.\n\t *\n\t * @param lineId - Persistent line identifier.\n\t * @param results - Evaluation result groups for each expression (in order). Each element is a Value[].\n\t * @param bytecodes - Compiled bytecode for each expression (in order).\n\t * @param expressions - Extracted expression strings (in order).\n\t * @param reads - Aggregated read variables across all expressions.\n\t * @param writes - Aggregated write variables across all expressions.\n\t * @param isVariableDef - True if any expression defines a variable.\n\t * @param inlineSolveCount - Number of inline solves (0 for full-line).\n\t */\n\tupdateLineResult(\n\t\tlineId: number,\n\t\tresults: Value[][],\n\t\tbytecodes: BytecodeProgram[],\n\t\texpressions: string[],\n\t\treads: string[],\n\t\twrites: string[],\n\t\tisVariableDef: boolean,\n\t\tinlineSolveCount: number = 0,\n\t): void {\n\t\tconst state = this.lines.get(lineId);\n\t\tif (!state) return;\n\t\tstate.results = results;\n\t\tstate.result = results[0]?.[0] ?? null;\n\t\tstate.bytecodes = bytecodes;\n\t\tstate.expressions = expressions;\n\t\tstate.reads = reads;\n\t\tstate.writes = writes;\n\t\tstate.isVariableDef = isVariableDef;\n\t\tstate.inlineSolveCount = inlineSolveCount;\n\t\tstate.dirty = false;\n\t\tthis.dirtyLineIds.delete(lineId);\n\t}\n\n\t/**\n\t * Update a line's compile-only state (Tier 3: background compilation).\n\t *\n\t * Stores expressions, bytecodes, reads, and writes. Does NOT set results\n\t * and does NOT mark the line clean, it still needs execution (Tier 1 or\n\t * Tier 2) to produce results. This distinction allows the three-tier\n\t * evaluation strategy: compile invisible lines in the background without\n\t * executing them, then execute from cached bytecode when scrolled into view.\n\t *\n\t * @param lineId - Persistent line identifier.\n\t * @param expressions - Extracted expression strings (in order).\n\t * @param bytecodes - Compiled bytecode for each expression (in order).\n\t * @param reads - Aggregated read variables across all expressions.\n\t * @param writes - Aggregated write variables across all expressions.\n\t * @param isVariableDef - True if any expression defines a variable.\n\t * @param inlineSolveCount - Number of inline solves (0 for full-line).\n\t */\n\tupdateLineCompiled(\n\t\tlineId: number,\n\t\texpressions: string[],\n\t\tbytecodes: BytecodeProgram[],\n\t\treads: string[],\n\t\twrites: string[],\n\t\tisVariableDef: boolean,\n\t\tinlineSolveCount: number = 0,\n\t): void {\n\t\tconst state = this.lines.get(lineId);\n\t\tif (!state) return;\n\t\tstate.expressions = expressions;\n\t\tstate.bytecodes = bytecodes;\n\t\tstate.reads = reads;\n\t\tstate.writes = writes;\n\t\tstate.isVariableDef = isVariableDef;\n\t\tstate.inlineSolveCount = inlineSolveCount;\n\t\t// NOTE: dirty remains unchanged, line still needs execution\n\t}\n\n\t// ── Properties ──────────────────────────────────────────────────────\n\n\tget lineCount(): number {\n\t\treturn this.orderTree.length;\n\t}\n\n\tget isEmpty(): boolean {\n\t\treturn this.orderTree.isEmpty;\n\t}\n\n\t/**\n\t * Iterator over LineState in document order.\n\t */\n\t*[Symbol.iterator](): IterableIterator<LineState> {\n\t\tfor (const lineId of this.orderTree) {\n\t\t\tconst state = this.lines.get(lineId);\n\t\t\tif (state) yield state;\n\t\t}\n\t}\n\n\t// ── Lifecycle ───────────────────────────────────────────────────────\n\n\tclear(): void {\n\t\tthis.lines.clear();\n\t\tthis.orderTree.clear();\n\t\tthis._positionCache = null;\n\t\tthis.nextLineId = 1;\n\t}\n\n\t/**\n\t * Serialize the document model to a plain object for debugging.\n\t */\n\ttoJSON(): object {\n\t\treturn {\n\t\t\tlineCount: this.lineCount,\n\t\t\tlines: this.getAllLines().map((s) => ({\n\t\t\t\tlineId: s.lineId,\n\t\t\t\ttext: s.text.substring(0, 80), // truncate for readability\n\t\t\t\ttextHash: s.textHash,\n\t\t\t\tdirty: s.dirty,\n\t\t\t\tisVariableDef: s.isVariableDef,\n\t\t\t\tisEmpty: s.isEmpty,\n\t\t\t\thasBytecode: s.bytecodes.length > 0,\n\t\t\t\thasResult: s.results.length > 0,\n\t\t\t\tinlineSolveCount: s.inlineSolveCount,\n\t\t\t\treads: s.reads,\n\t\t\t\twrites: s.writes,\n\t\t\t})),\n\t\t};\n\t}\n}\n","/**\n * CompilationWorkerManager, main-thread bridge to the compilation worker.\n *\n * Manages the worker lifecycle and provides a batch compilation API.\n * Receives transferred ArrayBuffers from the worker and reconstructs\n * BytecodeProgram objects with zero-copy TypedArray views.\n *\n * Usage:\n * const manager = new CompilationWorkerManager();\n * const bytecodeByLineId = await manager.compileBatch(items, docModel);\n *\n * Thread safety:\n * Each result includes `compiledAgainstHash`. Before storing bytecode\n * in the DocumentModel, we validate via `docModel.isBytecodeValid()`.\n * If the line was edited between dispatch and response, the bytecode\n * is discarded, the next evaluate() will recompile it synchronously.\n */\n\nimport { DocumentModel } from \"@solve-js/engine/DocumentModel\";\nimport type { BytecodeProgram } from \"@solve-js/parser/BytecodeBuilder\";\nimport createCompilationWorker from \"@solve-js/workers/engine.worker\";\n\n// ── Types ─────────────────────────────────────────────────────────────────\n\n/** One line sent to a worker for compilation. */\nexport interface CompileRequestItem {\n\tlineId: number;\n\texpression: string;\n\ttextHash: number;\n}\n\n/** Compiled bytecode returned from a worker, or the error that stopped it. */\nexport interface CompileResponseItem {\n\tlineId: number;\n\t/** Hash of the expression text when the compile was dispatched (for safety validation). */\n\tcompiledAgainstHash: number;\n\tprogram: BytecodeProgram;\n\treads: string[];\n\twrites: string[];\n\tisVariableDef: boolean;\n\terror: string | null;\n}\n\n// Raw result from worker (before BytecodeProgram reconstruction)\ninterface WorkerCompileResult {\n\tlineId: number;\n\tcompiledAgainstHash: number;\n\topcodesBuffer: ArrayBuffer;\n\tnumbersBuffer: ArrayBuffer;\n\topcodesLength: number;\n\tnumbersLength: number;\n\tstrings: string[];\n\treads: string[];\n\twrites: string[];\n\tisVariableDef: boolean;\n\terror: string | null;\n}\n\n// ── CompilationWorkerManager ──────────────────────────────────────────────\n\n/**\n * Compiles lines on a background worker.\n *\n * A response is discarded when the line changed between dispatch and return,\n * because bytecode compiled against stale text would produce a result for an\n * expression the user has already edited. The next evaluation recompiles it\n * synchronously.\n */\nexport class CompilationWorkerManager {\n\tprivate worker: Worker | null = null;\n\tprivate nextId = 1;\n\tprivate pending = new Map<\n\t\tnumber,\n\t\t{\n\t\t\tresolve: (results: CompileResponseItem[]) => void;\n\t\t\treject: (error: Error) => void;\n\t\t}\n\t>();\n\n\tconstructor() {}\n\n\t/**\n\t * Ensure the worker is started (lazy initialization).\n\t * Uses esbuild-plugin-inline-worker to inline the worker as a blob URL.\n\t */\n\tprivate ensureWorker(): Worker {\n\t\tif (this.worker) return this.worker;\n\n\t\tthis.worker = createCompilationWorker();\n\n\t\tthis.worker.onmessage = (event: MessageEvent) => {\n\t\t\tconst data = event.data;\n\t\t\tif (!data || data.type !== \"COMPILE_RESULT\") return;\n\n\t\t\tconst pending = this.pending.get(data.id);\n\t\t\tif (!pending) return;\n\n\t\t\tthis.pending.delete(data.id);\n\n\t\t\tconst results: CompileResponseItem[] = [];\n\t\t\tfor (const raw of data.results as WorkerCompileResult[]) {\n\t\t\t\tresults.push(this.reconstructResult(raw));\n\t\t\t}\n\t\t\tpending.resolve(results);\n\t\t};\n\n\t\tthis.worker.onerror = (err) => {\n\t\t\t// Reject all pending requests on worker error\n\t\t\tfor (const [id, pending] of this.pending) {\n\t\t\t\tpending.reject(\n\t\t\t\t\tnew Error(`Compilation worker error: ${err.message}`)\n\t\t\t\t);\n\t\t\t\tthis.pending.delete(id);\n\t\t\t}\n\t\t};\n\n\t\treturn this.worker;\n\t}\n\n\t/**\n\t * Batch-compile expressions in the worker.\n\t *\n\t * Sends a batch of { lineId, expression, textHash } to the worker,\n\t * which compiles each and transfers bytecode ArrayBuffers back.\n\t * Bytecode is reconstructed into BytecodeProgram objects.\n\t *\n\t * Results are returned in the same order as the input items.\n\t *\n\t * @param items Expressions to compile.\n\t * @returns Compiled bytecode for each item (or error).\n\t */\n\tasync compileBatch(items: CompileRequestItem[]): Promise<CompileResponseItem[]> {\n\t\tif (items.length === 0) return [];\n\n\t\tconst worker = this.ensureWorker();\n\t\tconst id = this.nextId++;\n\n\t\treturn new Promise<CompileResponseItem[]>((resolve, reject) => {\n\t\t\tthis.pending.set(id, { resolve, reject });\n\n\t\t\tworker.postMessage({\n\t\t\t\ttype: \"COMPILE_BATCH\",\n\t\t\t\tid,\n\t\t\t\titems,\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Store worker-compiled bytecode into the DocumentModel, with safety\n\t * validation. Only stores bytecode for lines whose text has not changed\n\t * since the compilation request was dispatched.\n\t *\n\t * Results for the same lineId are batched, all bytecodes from\n\t * successful compilations are passed to updateLineCompiled in a single\n\t * call. This supports multi-expression lines (inline solves).\n\t *\n\t * @param results Compiled results from the worker.\n\t * @param doc The target document model.\n\t * @returns Number of results successfully stored (passed safety check).\n\t */\n\tstoreResults(\n\t\tresults: CompileResponseItem[],\n\t\tdoc: DocumentModel\n\t): number {\n\t\t// Batch results by lineId (multiple inline solves share the same lineId)\n\t\tconst byLineId = new Map<\n\t\t\tnumber,\n\t\t\t{\n\t\t\t\tbytecodes: BytecodeProgram[];\n\t\t\t\treads: Set<string>;\n\t\t\t\twrites: Set<string>;\n\t\t\t\tisVariableDef: boolean;\n\t\t\t\texpressions: string[];\n\t\t\t\ttextHash: number;\n\t\t\t}\n\t\t>();\n\t\tlet validCount = 0;\n\n\t\tfor (const result of results) {\n\t\t\tif (result.error) continue;\n\n\t\t\t// Safety check: has the line been edited since dispatch?\n\t\t\tconst state = doc.getLineById(result.lineId);\n\t\t\tif (!state) continue;\n\n\t\t\t// Validate that the line text hasn't changed since dispatch.\n\t\t\tif (state.textHash !== result.compiledAgainstHash) continue;\n\n\t\t\t// Batch by lineId\n\t\t\tlet batch = byLineId.get(result.lineId);\n\t\t\tif (!batch) {\n\t\t\t\tbatch = {\n\t\t\t\t\tbytecodes: [],\n\t\t\t\t\treads: new Set(),\n\t\t\t\t\twrites: new Set(),\n\t\t\t\t\tisVariableDef: false,\n\t\t\t\t\texpressions: state.expressions.length > 0 ? [...state.expressions] : [],\n\t\t\t\t\ttextHash: result.compiledAgainstHash,\n\t\t\t\t};\n\t\t\t\tbyLineId.set(result.lineId, batch);\n\t\t\t}\n\n\t\t\tbatch.bytecodes.push(result.program);\n\t\t\tfor (const r of result.reads) batch.reads.add(r);\n\t\t\tfor (const w of result.writes) batch.writes.add(w);\n\t\t\tif (result.isVariableDef) batch.isVariableDef = true;\n\t\t\tvalidCount++;\n\t\t}\n\n\t\t// Store batched results\n\t\tlet stored = 0;\n\t\tfor (const [lineId, batch] of byLineId) {\n\t\t\tif (batch.bytecodes.length === 0) continue;\n\t\t\t// Preserve inlineSolveCount from the LineState so the evaluator\n\t\t\t// knows this line has multiple expressions (avoids re-extraction).\n\t\t\tconst state = doc.getLineById(lineId);\n\t\t\tconst inlineSolveCount = state?.inlineSolveCount ?? 0;\n\t\t\tdoc.updateLineCompiled(\n\t\t\t\tlineId,\n\t\t\t\tbatch.expressions,\n\t\t\t\tbatch.bytecodes,\n\t\t\t\t[...batch.reads],\n\t\t\t\t[...batch.writes],\n\t\t\t\tbatch.isVariableDef,\n\t\t\t\tinlineSolveCount,\n\t\t\t);\n\t\t\tstored += batch.bytecodes.length;\n\t\t}\n\n\t\treturn stored;\n\t}\n\n\t/**\n\t * Terminate the worker and clean up.\n\t */\n\tterminate(): void {\n\t\tif (this.worker) {\n\t\t\tthis.worker.terminate();\n\t\t\tthis.worker = null;\n\t\t\tthis.pending.clear();\n\t\t}\n\t}\n\n\t/**\n\t * Whether the worker is currently active.\n\t */\n\tget isActive(): boolean {\n\t\treturn this.worker !== null;\n\t}\n\n\t// ── Private helpers ────────────────────────────────────────────────\n\n\t/**\n\t * Reconstruct a BytecodeProgram from transferred ArrayBuffers.\n\t *\n\t * The transferred ArrayBuffers are zero-copy, we create TypedArray\n\t * views directly over them. No data is copied or serialized.\n\t */\n\tprivate reconstructResult(raw: WorkerCompileResult): CompileResponseItem {\n\t\tif (raw.error) {\n\t\t\treturn {\n\t\t\t\tlineId: raw.lineId,\n\t\t\t\tcompiledAgainstHash: raw.compiledAgainstHash,\n\t\t\t\tprogram: { opcodes: new Uint8Array(0), numbers: new Float64Array(0), strings: [], hasAsync: false },\n\t\t\t\treads: [],\n\t\t\t\twrites: [],\n\t\t\t\tisVariableDef: false,\n\t\t\t\terror: raw.error,\n\t\t\t};\n\t\t}\n\n\t\t// Reconstruct TypedArrays from transferred ArrayBuffers.\n\t\t// These are views over the same memory, zero-copy from worker.\n\t\tconst opcodes =\n\t\t\traw.opcodesLength > 0\n\t\t\t\t? new Uint8Array(raw.opcodesBuffer, 0, raw.opcodesLength)\n\t\t\t\t: new Uint8Array(0);\n\t\tconst numbers =\n\t\t\traw.numbersLength > 0\n\t\t\t\t? new Float64Array(raw.numbersBuffer, 0, raw.numbersLength)\n\t\t\t\t: new Float64Array(0);\n\n\t\tconst program: BytecodeProgram = {\n\t\t\topcodes,\n\t\t\tnumbers,\n\t\t\tstrings: raw.strings,\n\t\t\thasAsync: false,\n\t\t};\n\n\t\treturn {\n\t\t\tlineId: raw.lineId,\n\t\t\tcompiledAgainstHash: raw.compiledAgainstHash,\n\t\t\tprogram,\n\t\t\treads: raw.reads,\n\t\t\twrites: raw.writes,\n\t\t\tisVariableDef: raw.isVariableDef,\n\t\t\terror: null,\n\t\t};\n\t}\n}\n","/**\n * PageManager, page-based LRU eviction + directional preloading.\n *\n * Groups document lines into fixed-size pages (128 lines each) and manages\n * three temperature tiers:\n * • Hot (viewport ± 3 pages): Keep bytecode + results\n * • Warm (viewport ± 6 pages): Keep bytecode, evict results\n * • Cold (beyond ± 6 pages): Evict bytecode + results (except variable defs)\n *\n * Variable definition bytecode is **never evicted** because it forms the\n * backbone of the dependency graph and VM checkpoints.\n *\n * Preloading: When the user scrolls in a consistent direction, the next\n * 1–2 pages are pre-compiled via the background worker so bytecode is\n * cache-hot by the time those lines scroll into view.\n *\n * Usage:\n * const pm = new PageManager();\n * // After evaluation:\n * pm.maintainAfterEval(viewport, doc);\n * // After scroll (viewport-only change):\n * pm.maintainAfterEval(viewport, doc);\n * const targets = pm.getPreloadTargets(viewport, doc);\n * // dispatch targets to compilation worker\n */\n\nimport { DocumentModel } from \"@solve-js/engine/DocumentModel\";\n// Deliberately the shared lexer, not an engine's own.\n//\n// `classifyLine` and `findInlineSolves` are character-level scans for headings,\n// comment markers, code fences and backtick spans. Neither consults the\n// keyword, unit or operator tables, so every lexer returns the same answer and\n// there is nothing per-engine to respect. Pinned by\n// __tests__/lexer/LineClassificationIsVocabularyIndependent.spec.ts, which\n// compares a bare lexer against one carrying extra vocabulary.\n//\n// This matters because these are free functions with no engine to ask. Making\n// them engine-aware would mean changing their signatures and every caller for\n// no behavioural difference.\nimport { sharedLexer } from \"@solve-js/lexer/Lexer\";\n\n// ── Constants ────────────────────────────────────────────────────────────\n\n/** Number of lines per page. Tunable, 128 balances granularity with overhead. */\nexport const PAGE_SIZE = 128;\n\n/** Number of pages on each side of the viewport considered \"hot.\" */\nconst HOT_PAGE_RADIUS = 3;\n\n/** Number of pages on each side of the viewport considered \"warm\" (includes hot). */\nconst WARM_PAGE_RADIUS = 6;\n\n/** Number of pages to preload ahead of the scroll direction. */\nconst PRELOAD_PAGE_COUNT = 2;\n\n/**\n * Pages just beyond the warm range that are \"newly cold\", they were warm\n * on the previous scroll and now need bytecode eviction. Once evicted, they\n * stay cold and don't need re-eviction on subsequent frames (the inner\n * `evictPageBytecode` checks for non-null bytecode and short-circuits).\n *\n * This buffer lets us skip iterating the vast majority of cold pages on\n * every scroll, reducing `maintainAfterEval` from O(total pages) to\n * O(hot + warm + buffer) ≈ O(1) for any document size.\n */\nconst COLD_EVICT_BUFFER = HOT_PAGE_RADIUS;\n\n// ── PageManager ──────────────────────────────────────────────────────────\n\n/**\n * Splits a long document into pages so only what is near the viewport is held\n * in full.\n *\n * A document is edited constantly and most of it is off screen. Paging keeps\n * the cost of a keystroke proportional to what is visible rather than to the\n * length of the document.\n */\nexport class PageManager {\n\t/** Previous viewport for scroll direction detection. null = no previous viewport. */\n\tprivate lastViewportStart: number | null = null;\n\n\t/** Saved scroll direction from the most recent maintainAfterEval call. */\n\tprivate savedDirection: \"down\" | \"up\" | null = null;\n\n\t/** Per-page access counter for LRU tracking. */\n\tprivate pageAccess: Map<number, number> = new Map();\n\n\t/** Monotonically increasing access sequence number. */\n\tprivate accessSeq = 0;\n\n\t// ── Static helpers ─────────────────────────────────────────────────\n\n\t/** Get the page number for a 1-based line number (0-based page index). */\n\tstatic pageForLine(lineNumber: number): number {\n\t\treturn Math.floor((lineNumber - 1) / PAGE_SIZE);\n\t}\n\n\t/** Get the 1-based inclusive line range for a page. */\n\tstatic pageRange(\n\t\tpageNum: number,\n\t\tdocLineCount: number\n\t): { startLine: number; endLine: number } {\n\t\treturn {\n\t\t\tstartLine: pageNum * PAGE_SIZE + 1,\n\t\t\tendLine: Math.min((pageNum + 1) * PAGE_SIZE, docLineCount),\n\t\t};\n\t}\n\n\t// ── Public API ─────────────────────────────────────────────────────\n\n\t/**\n\t * Detect scroll direction from viewport movement.\n\t * Returns null on first call (no previous viewport) or no movement.\n\t */\n\tdetectDirection(newViewport: { startLine: number }): \"down\" | \"up\" | null {\n\t\tif (this.lastViewportStart === null) return null;\n\t\tif (newViewport.startLine > this.lastViewportStart) return \"down\";\n\t\tif (newViewport.startLine < this.lastViewportStart) return \"up\";\n\t\treturn null;\n\t}\n\n\t/**\n\t * Maintain page tiers after evaluation.\n\t *\n\t * 1. Records the new viewport position\n\t * 2. Touches hot pages (viewport ± HOT_PAGE_RADIUS) for LRU\n\t * 3. Evicts cold/warm pages based on distance from viewport\n\t *\n\t * Call this after every `evaluate()`, `setViewport()`, or `evaluateAll()`.\n\t */\n\tmaintainAfterEval(\n\t\tviewport: { startLine: number; endLine: number },\n\t\tdoc: DocumentModel\n\t): void {\n\t\t// ── Capture direction BEFORE updating lastViewportStart ───\n\t\tthis.savedDirection = this.detectDirection(viewport);\n\t\tthis.lastViewportStart = viewport.startLine;\n\n\t\tconst docLineCount = doc.lineCount;\n\t\tconst viewportStartPage = PageManager.pageForLine(viewport.startLine);\n\t\tconst viewportEndPage = PageManager.pageForLine(viewport.endLine);\n\t\tconst lastPage = PageManager.pageForLine(docLineCount);\n\n\t\t// Compute hot/warm page ranges in O(1) using range math:\n\t\t// A page is within RADIUS of the viewport span iff it falls in\n\t\t// [viewportStartPage - RADIUS, viewportEndPage + RADIUS].\n\t\tconst hotStart = Math.max(0, viewportStartPage - HOT_PAGE_RADIUS);\n\t\tconst hotEnd = Math.min(lastPage, viewportEndPage + HOT_PAGE_RADIUS);\n\t\tconst warmStart = Math.max(0, viewportStartPage - WARM_PAGE_RADIUS);\n\t\tconst warmEnd = Math.min(lastPage, viewportEndPage + WARM_PAGE_RADIUS);\n\n\t\t// Touch hot pages to keep them fresh in LRU\n\t\tfor (let p = hotStart; p <= hotEnd; p++) {\n\t\t\tthis.touchPage(p);\n\t\t}\n\n\t\t// Evict warm-but-not-hot pages: keep bytecode, evict results only\n\t\tfor (let p = warmStart; p <= warmEnd; p++) {\n\t\t\tif (p >= hotStart && p <= hotEnd) continue;\n\t\t\tthis.evictPageResults(p, doc, docLineCount);\n\t\t}\n\n\t\t// Evict \"newly cold\" pages: a buffer zone just outside the warm\n\t\t// range. Pages beyond this buffer were already evicted on prior\n\t\t// scrolls and don't need re-eviction.\n\t\t// ── Left side (just above page 0, just below warm range) ──\n\t\tconst coldLeftEnd = warmStart - 1;\n\t\tconst coldLeftStart = Math.max(0, coldLeftEnd - COLD_EVICT_BUFFER + 1);\n\t\tfor (let p = coldLeftStart; p <= coldLeftEnd; p++) {\n\t\t\tthis.evictPageBytecode(p, doc, docLineCount);\n\t\t}\n\t\t// ── Right side (just above warm range, just below lastPage) ──\n\t\tconst coldRightStart = warmEnd + 1;\n\t\tconst coldRightEnd = Math.min(lastPage, coldRightStart + COLD_EVICT_BUFFER - 1);\n\t\tfor (let p = coldRightStart; p <= coldRightEnd; p++) {\n\t\t\tthis.evictPageBytecode(p, doc, docLineCount);\n\t\t}\n\t}\n\n\t/**\n\t * Get lines ahead of the viewport that should be pre-compiled.\n\t *\n\t * Looks PRELOAD_PAGE_COUNT pages ahead of the current scroll direction.\n\t * Only returns lines that are dirty, don't already have bytecode,\n\t * and are not empty/markdown-only.\n\t *\n\t * @param viewport The current viewport.\n\t * @param doc The document model.\n\t * @returns Items ready to send to the compilation worker.\n\t */\n\tgetPreloadTargets(\n\t\tviewport: { startLine: number; endLine: number },\n\t\tdoc: DocumentModel\n\t): Array<{ lineId: number; expression: string; textHash: number }> {\n\t\t// Use the direction saved by the last maintainAfterEval call.\n\t\t// We cannot re-detect because maintainAfterEval already updated\n\t\t// lastViewportStart to the current viewport position.\n\t\tconst direction = this.savedDirection;\n\t\tif (!direction) return [];\n\n\t\tconst items: Array<{ lineId: number; expression: string; textHash: number }> = [];\n\t\t// Use viewport end page for downward preload start, start page for upward.\n\t\t// This ensures we preload *beyond* the full viewport span, not just its start.\n\t\tconst viewportEndPage = PageManager.pageForLine(viewport.endLine);\n\t\tconst viewportStartPage = PageManager.pageForLine(viewport.startLine);\n\t\tconst lastPage = PageManager.pageForLine(doc.lineCount);\n\n\t\tconst pages: number[] = [];\n\t\tif (direction === \"down\") {\n\t\t\t// Preload pages immediately after the viewport's hot radius beyond its end\n\t\t\tconst startPage = viewportEndPage + HOT_PAGE_RADIUS + 1;\n\t\t\tconst endPage = Math.min(startPage + PRELOAD_PAGE_COUNT - 1, lastPage);\n\t\t\tfor (let p = startPage; p <= endPage && p <= lastPage; p++) {\n\t\t\t\tpages.push(p);\n\t\t\t}\n\t\t} else {\n\t\t\t// Preload pages immediately before the viewport's hot radius before its start\n\t\t\tconst firstPreloadPage = viewportStartPage - HOT_PAGE_RADIUS - 1;\n\t\t\tfor (let p = firstPreloadPage; p > firstPreloadPage - PRELOAD_PAGE_COUNT && p >= 0; p--) {\n\t\t\t\tpages.push(p);\n\t\t\t}\n\t\t}\n\n\t\tfor (const pageNum of pages) {\n\t\t\tconst range = PageManager.pageRange(pageNum, doc.lineCount);\n\t\t\tfor (let pos = range.startLine; pos <= range.endLine; pos++) {\n\t\t\t\tconst state = doc.getLineAt(pos);\n\t\t\t\tif (!state) continue;\n\t\t\t\tif (!state.dirty) continue;\n\t\t\t\tif (state.bytecodes.length > 0 && !state.isVariableDef) continue;\n\t\t\t\tif (state.isEmpty) continue;\n\n\t\t\t\t// Extract expressions using the shared lexer to handle inline\n\t\t\t\t// solves (s`...`). For full-line expressions, this returns [text].\n\t\t\t\t// For inline solve lines, this returns each extracted expression.\n\t\t\t\tif (state.expressions.length > 0) {\n\t\t\t\t\t// Use pre-extracted expressions (from prior evaluation)\n\t\t\t\t\tfor (const expression of state.expressions) {\n\t\t\t\t\t\tif (!expression.trim()) continue;\n\t\t\t\t\t\titems.push({\n\t\t\t\t\t\t\tlineId: state.lineId,\n\t\t\t\t\t\t\texpression,\n\t\t\t\t\t\t\ttextHash: state.textHash,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Expressions not yet extracted, use lexer to find inline solves\n\t\t\t\t\tconst inlineSpans = sharedLexer.findInlineSolves(state.text);\n\t\t\t\t\tif (inlineSpans.length > 0) {\n\t\t\t\t\t\tfor (const span of inlineSpans) {\n\t\t\t\t\t\t\tif (!span.expression.trim()) continue;\n\t\t\t\t\t\t\titems.push({\n\t\t\t\t\t\t\t\tlineId: state.lineId,\n\t\t\t\t\t\t\t\texpression: span.expression,\n\t\t\t\t\t\t\t\ttextHash: state.textHash,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Full-line expression\n\t\t\t\t\t\tconst expression = state.text.trim();\n\t\t\t\t\t\tif (expression) {\n\t\t\t\t\t\t\titems.push({\n\t\t\t\t\t\t\t\tlineId: state.lineId,\n\t\t\t\t\t\t\t\texpression,\n\t\t\t\t\t\t\t\ttextHash: state.textHash,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn items;\n\t}\n\n\t/**\n\t * Reset internal state (e.g., after document switch).\n\t */\n\tclear(): void {\n\t\tthis.pageAccess.clear();\n\t\tthis.accessSeq = 0;\n\t\tthis.lastViewportStart = null;\n\t\tthis.savedDirection = null;\n\t}\n\n\t// ── Private helpers ─────────────────────────────────────────────────\n\n\t/** Record a page access with a monotonic sequence number. */\n\tprivate touchPage(pageNum: number): void {\n\t\tthis.pageAccess.set(pageNum, ++this.accessSeq);\n\t}\n\n\t/**\n\t * Evict results from all non-variable-def lines in a page.\n\t * Bytecode is preserved so Tier 2 execution works on scroll-back.\n\t */\n\tprivate evictPageResults(\n\t\tpageNum: number,\n\t\tdoc: DocumentModel,\n\t\tdocLineCount: number\n\t): void {\n\t\tconst range = PageManager.pageRange(pageNum, docLineCount);\n\t\tfor (let pos = range.startLine; pos <= range.endLine; pos++) {\n\t\t\tconst state = doc.getLineAt(pos);\n\t\t\tif (state && !state.isVariableDef && state.results.length > 0) {\n\t\t\t\tstate.results = [];\n\t\t\t\tstate.result = null;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Evict bytecode + results from all non-variable-def lines in a page.\n\t * Variable definition bytecode is **never** evicted, it forms the\n\t * backbone of the DAG and VM checkpoints.\n\t *\n\t * Evicted lines are marked dirty so they get Tier 1 re-evaluation\n\t * when scrolled back into view.\n\t */\n\tprivate evictPageBytecode(\n\t\tpageNum: number,\n\t\tdoc: DocumentModel,\n\t\tdocLineCount: number\n\t): void {\n\t\tconst range = PageManager.pageRange(pageNum, docLineCount);\n\t\tfor (let pos = range.startLine; pos <= range.endLine; pos++) {\n\t\t\tconst state = doc.getLineAt(pos);\n\t\t\tif (!state || state.isVariableDef) continue;\n\n\t\t\tif (state.bytecodes.length > 0 || state.results.length > 0) {\n\t\t\t\tstate.bytecodes = [];\n\t\t\t\tstate.results = [];\n\t\t\t\tstate.result = null;\n\t\t\t\tdoc.markDirty(state.lineId);\n\t\t\t}\n\t\t}\n\t}\n}\n","import { ExpressionEngine } from \"@solve-js/engine/ExpressionEngine\";\nimport {\n\tDocumentModel,\n\tLineChange,\n\tLineState,\n\tViewportRange,\n} from \"@solve-js/engine/DocumentModel\";\nimport { Value, ValueType, enableValueArena, disableValueArena, errorValue } from \"@solve-js/vm/Value\";\nimport { DependencyGraph } from \"@solve-js/vm/DependencyGraph\";\nimport { VMCheckpointer } from \"@solve-js/vm/VMCheckpoints\";\nimport { isEmptyLine } from \"@solve-js/engine/ExpressionEngineSafety\";\n// Deliberately the shared lexer, not an engine's own.\n//\n// `classifyLine` and `findInlineSolves` are character-level scans for headings,\n// comment markers, code fences and backtick spans. Neither consults the\n// keyword, unit or operator tables, so every lexer returns the same answer and\n// there is nothing per-engine to respect. Pinned by\n// __tests__/lexer/LineClassificationIsVocabularyIndependent.spec.ts, which\n// compares a bare lexer against one carrying extra vocabulary.\n//\n// This matters because these are free functions with no engine to ask. Making\n// them engine-aware would mean changing their signatures and every caller for\n// no behavioural difference.\nimport { sharedLexer } from \"@solve-js/lexer/Lexer\";\nimport { CompilationWorkerManager, type CompileRequestItem } from \"@solve-js/engine/CompilationWorkerManager\";\nimport { PageManager } from \"@solve-js/engine/PageManager\";\nimport type { BytecodeProgram } from \"@solve-js/parser/BytecodeBuilder\";\nimport { EngineError } from \"@solve-js/errors/UnifiedErrorFramework\";\nimport { sharedGlobalVariableStore, globalDagKey } from \"@solve-js/vm/GlobalVariableStore\";\n\n// ── EvalTier (diagnostic enum) ──────────────────────────────────────────\n\n/**\n * How much work a line's evaluation required.\n *\n * The tiers exist because most lines in a document have not changed. A line\n * that is clean and cached costs far less than one being compiled fresh, and\n * knowing which happened is how a slow document gets diagnosed.\n */\nexport enum EvalTier {\n\t/** Full pipeline: Lex → Parse → Compile → Execute (visible + dirty). */\n\tTier1 = 1,\n\t/** Execute-only from cached bytecode (visible + cached). */\n\tTier2 = 2,\n\t/** Compile-only for dependency tracking (invisible). Executes only variable assignments. */\n\tTier3 = 3,\n\t/** Skipped, already clean or non-evaluable. */\n\tSkipped = 0,\n}\n\n// ── EvalLineResult ──────────────────────────────────────────────────────\n\n/** Outcome for one line, including which tier handled it. */\nexport interface EvalLineResult {\n\t/** The line's persistent ID from DocumentModel. */\n\tlineId: number;\n\t/** 1-based line position. */\n\tlineNumber: number;\n\t/** Which tier was used. */\n\ttier: EvalTier;\n\t/** The first evaluation result, or null on error / non-evaluable. */\n\tresult: Value | null;\n\t/** All result groups (one per expression/inline-solve), or undefined if skipped. */\n\tresults?: Value[][];\n\t/** Error message, or null. */\n\terror: string | null;\n}\n\n// ── EvalResult ──────────────────────────────────────────────────────────\n\n/** Outcome for a whole evaluation pass, with per-tier counts. */\nexport interface EvalResult {\n\t/** Per-line evaluation results. */\n\tlines: EvalLineResult[];\n\t/** Map of line numbers → flattened results for quick lookup. */\n\tresultMap: Map<number, Value[]>;\n\t/** Number of lines processed at each tier. */\n\ttierCounts: { tier1: number; tier2: number; tier3: number; skipped: number };\n}\n\n// ── ThreeTierEvaluator ──────────────────────────────────────────────────\n\n/**\n * Orchestrates three-tier evaluation over a persistent DocumentModel.\n *\n * ── Tier assignment ─────────────────────────────────────────────────\n * | Tier | Condition | Action |\n * |───────|────────────────────────────────────|───────────────────────────────|\n * | **1** | Visible + Dirty (new/changed) | Full pipeline: lex→parse→compile→execute |\n * | **2** | Visible + Cached (scroll into view)| Execute from cached bytecode |\n * | **3** | Invisible + Dirty | Compile-only; execute only variable defs |\n * | Skip | Clean, empty, or non-evaluable | No action |\n *\n * ── Evaluation order ─────────────────────────────────────────────────\n * Lines are always processed in ascending document order (line 1 → end)\n * so that variable assignments flow correctly through the shared VM.\n * Tier 2 relies on this: by the time a clean cached line is reached,\n * the VM already contains all variables from preceding Tier-1 lines.\n *\n * ── Thread safety ────────────────────────────────────────────────────\n * Tier 1 (visible+dirty) compilation runs synchronously on the main thread\n * for immediate rendering. Tier 3 (invisible+dirty) compilation can be\n * dispatched to a Web Worker via `dispatchBackgroundCompiles()`. Worker-\n * compiled bytecode is stored in the DocumentModel and validated via\n * `isBytecodeValid()` to ensure the line text hasn't changed between\n * dispatch and response.\n */\nexport class ThreeTierEvaluator {\n\tprivate doc: DocumentModel;\n\tprivate engine: ExpressionEngine;\n\tprivate dag: DependencyGraph;\n\tprivate checkpointer: VMCheckpointer | null;\n\tprivate compilationWorker: CompilationWorkerManager | null = null;\n\tprivate pageManager: PageManager;\n\n\t/**\n\t * Unsubscribe from sharedGlobalVariableStore, set in the constructor\n\t * called from terminateWorker(). See the subscription itself below for\n\t * why this only marks lines dirty and never re-evaluates synchronously.\n\t */\n\tprivate globalUnsubscribe: (() => void) | null = null;\n\n\t/**\n\t * @param doc The persistent document model.\n\t * @param engine The expression engine (shared VM is accessed via engine.getVM()).\n\t * @param checkpointer Optional VM state checkpointer. If provided, the evaluator\n\t * will create checkpoints after variable-definition lines and support fast VM\n\t * restoration via `restoreTo()`. If omitted, checkpointing is disabled.\n\t */\n\tconstructor(\n\t\tdoc: DocumentModel,\n\t\tengine: ExpressionEngine,\n\t\tcheckpointer?: VMCheckpointer\n\t) {\n\t\tthis.doc = doc;\n\t\tthis.engine = engine;\n\t\tthis.dag = engine.getDag();\n\t\tthis.checkpointer = checkpointer ?? null;\n\t\tthis.pageManager = new PageManager();\n\n\t\t// Lets the engine answer \"what's line N's cached result\" for\n\t\t// cross-line features (prev/line<N>/aggregation) without owning\n\t\t// document lifecycle itself. See ExpressionEngine.makeLineContext().\n\t\tthis.engine.setDocumentModel(this.doc);\n\n\t\t// ── Cross-document global-variable propagation ──────────────────\n\t\t// GlobalVariableAsyncResolver (via preflight) handles a line's FIRST\n\t\t// resolution when a global it reads wasn't known yet. This handles\n\t\t// the ONGOING case: a line that already has a real (non-pending)\n\t\t// value for `global :x` needs to go dirty again when some OTHER\n\t\t// document writes a NEW value to x, so this document's next\n\t\t// evaluate() picks up the change, \"dealing with the DAG across\n\t\t// pages\", not just first-resolution.\n\t\tthis.globalUnsubscribe = sharedGlobalVariableStore.subscribe((name) => {\n\t\t\t// Mark-dirty ONLY, never synchronously re-evaluate here.\n\t\t\t// enableValueArena/disableValueArena (Value.ts) is a single\n\t\t\t// non-reentrant module-level flag; evaluate()/setViewport() both\n\t\t\t// wrap their body in it, so a re-entrant evaluate() call from\n\t\t\t// inside this callback (itself possibly firing from INSIDE\n\t\t\t// another evaluate() call, via a STORE_GLOBAL_VAR opcode in some\n\t\t\t// other document being evaluated concurrently) would disable the\n\t\t\t// arena out from under the still-running outer call. This\n\t\t\t// mirrors applyTransaction()'s existing contract exactly: mark\n\t\t\t// dirty, let the caller's own evaluate() cadence pick it up.\n\t\t\tfor (const lineNumber of this.dag.getAffectedLines(globalDagKey(name))) {\n\t\t\t\tthis.doc.markDirtyByLineNumber(lineNumber);\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Evaluate all lines needed to render the given viewport.\n\t *\n\t * Processes lines from 1 to `viewport.endLine` in document order.\n\t * Dirty lines in the viewport get Tier-1 full pipeline; clean cached\n\t * lines get Tier-2 bytecode execution. Lines after the viewport\n\t * get Tier-3 compile-only (with variable-def execution).\n\t *\n\t * @returns Results for all processed lines, including tier metadata.\n\t */\n\tevaluate(viewport: ViewportRange, signal?: AbortSignal): EvalResult {\n\t\t// ── One AbortController Per Keystroke ────────────────────────\n\t\t// Link the UI layer's keystroke signal to the engine so that\n\t\t// all per-evaluation AbortControllers created during this call\n\t\t// are canceled when the user types a new keystroke.\n\t\tthis.engine.setKeystrokeSignal(signal ?? null);\n\n\t\t// ── Phase 5.3: Enable arena for zero-allocation Value reuse ──\n\t\tenableValueArena();\n\t\ttry {\n\t\t\tconst lines: EvalLineResult[] = [];\n\t\t\tconst resultMap = new Map<number, Value[]>();\n\t\t\tconst tierCounts = { tier1: 0, tier2: 0, tier3: 0, skipped: 0 };\n\n\t\t\t// Process from line 1 to the end of the viewport for correct VM state.\n\t\t\t// We go to viewport.endLine because Tier 3 for invisible lines can be\n\t\t\t// done separately via backgroundCompile().\n\t\t\tconst docEnd = this.doc.lineCount;\n\t\t\tconst evalEnd = Math.min(viewport.endLine, docEnd);\n\n\t\t\tfor (let pos = 1; pos <= evalEnd; pos++) {\n\t\t\t\tconst state = this.doc.getLineAt(pos);\n\t\t\t\tif (!state) {\n\t\t\t\t\ttierCounts.skipped++;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst inViewport = pos >= viewport.startLine && pos <= viewport.endLine;\n\n\t\t\t\tconst lineResult = this.evaluateSingleLine(state, pos, inViewport);\n\t\t\t\tlines.push(lineResult);\n\n\t\t\t\tif (lineResult.tier === EvalTier.Tier1) tierCounts.tier1++;\n\t\t\t\telse if (lineResult.tier === EvalTier.Tier2) tierCounts.tier2++;\n\t\t\t\telse if (lineResult.tier === EvalTier.Tier3) tierCounts.tier3++;\n\t\t\t\telse tierCounts.skipped++;\n\n\t\t\t\tif (lineResult.results && inViewport) {\n\t\t\t\t\tresultMap.set(pos, lineResult.results.flat());\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// ── Phase 5.2g: Page-based LRU eviction ──────────────────────\n\t\t\t// Evict bytecode/results from cold/warm pages to bound memory.\n\t\t\tthis.pageManager.maintainAfterEval(viewport, this.doc);\n\n\t\t\treturn { lines, resultMap, tierCounts };\n\t\t} finally {\n\t\t\t// Clear keystroke signal to prevent stale signal references\n\t\t\t// from being used by subsequent evaluations from other code paths.\n\t\t\tthis.engine.setKeystrokeSignal(null);\n\n\t\t\t// Phase 5.3: Always disable arena, even on exception.\n\t\t\t// Prevents arena Values from leaking into subsequent evaluations or tests.\n\t\t\tdisableValueArena();\n\t\t}\n\t}\n\n\t/**\n\t * Background-compile invisible dirty lines beyond the viewport (Tier 3 only).\n\t *\n\t * Compiles expressions to discover reads/writes for the dependency graph\n\t * without executing display-only expressions. Variable definitions are\n\t * executed to maintain VM state for future Tier-2 executions.\n\t *\n\t * This is intended to be called after evaluate() so visible lines are\n\t * rendered first, then background work fills in the dependency graph.\n\t *\n\t * **Phase 5.2h:** This synchronous method is retained for environments\n\t * without Worker support. Prefer `dispatchBackgroundCompiles()` which\n\t * offloads compilation to a Web Worker with Transferable bytecode.\n\t */\n\tbackgroundCompile(viewport: ViewportRange): EvalLineResult[] {\n\t\tconst results: EvalLineResult[] = [];\n\t\tconst docEnd = this.doc.lineCount;\n\t\tconst startPos = viewport.endLine + 1;\n\n\t\tfor (let pos = startPos; pos <= docEnd; pos++) {\n\t\t\tconst state = this.doc.getLineAt(pos);\n\t\t\tif (!state) continue;\n\n\t\t\t// Skip clean lines, already compiled + executed\n\t\t\tif (!state.dirty) continue;\n\n\t\t\t// Skip already-compiled Tier 3 lines, they have bytecode\n\t\t\t// but were compiled without execution (non-variable-def).\n\t\t\t// Recompiling is wasteful since the text hasn't changed\n\t\t\t// (text change clears bytecodes via editLine).\n\t\t\tif (state.bytecodes.length > 0 && !state.isVariableDef) continue;\n\n\t\t\tconst lineResult = this.evaluateSingleLine(state, pos, false);\n\t\t\tresults.push(lineResult);\n\t\t}\n\n\t\treturn results;\n\t}\n\n\t/**\n\t * Dispatch background compilation to a Web Worker (Phase 5.2h).\n\t *\n\t * Collects invisible dirty lines beyond the viewport that need compilation,\n\t * sends them to the compilation worker, and asynchronously stores the\n\t * transferred bytecode in the DocumentModel when the worker responds.\n\t *\n\t * This is the non-blocking alternative to `backgroundCompile()`. The worker\n\t * compiles expressions with Transferable ArrayBuffers (zero-copy postMessage),\n\t * so bytecode appears on the main thread without serialization overhead.\n\t *\n\t * Lines that already have cached bytecode (from a previous worker pass or\n\t * synchronous compile) are skipped, only truly uncompiled dirty lines are\n\t * sent to the worker.\n\t *\n\t * **Usage:** Call after `evaluate()` so visible lines render first, then\n\t * this fills the bytecode cache for future Tier-2 scrolls.\n\t *\n\t * @param viewport The current visible range. Lines beyond viewport.endLine\n\t * that are dirty and don't have bytecode are dispatched.\n\t */\n\tdispatchBackgroundCompiles(viewport: ViewportRange): void {\n\t\t// Collect invisible dirty lines that need compilation\n\t\tconst items = this.collectInvisibleCompileTargets(viewport);\n\t\tif (items.length === 0) return;\n\n\t\t// Lazy-init the worker (only if there are items to compile)\n\t\tif (!this.compilationWorker) {\n\t\t\tthis.compilationWorker = new CompilationWorkerManager();\n\t\t}\n\n\t\t// Fire-and-forget: send to worker, store results when they arrive\n\t\tthis.compilationWorker.compileBatch(items).then((results) => {\n\t\t\tthis.compilationWorker!.storeResults(results, this.doc);\n\t\t}).catch((_err) => {\n\t\t\t// Worker failure is non-fatal, next evaluate() will compile\n\t\t\t// these expressions synchronously.\n\t\t});\n\t}\n\n\t/**\n\t * Terminate the compilation worker if active, and unsubscribe from\n\t * sharedGlobalVariableStore. Call this when the evaluator is no longer\n\t * needed to clean up resources, every call site that retires a\n\t * ThreeTierEvaluator (document switch, pane destroy()) already calls\n\t * this unconditionally, so folding the global-store unsubscribe in here\n\t * needs no new call sites anywhere.\n\t */\n\tterminateWorker(): void {\n\t\tif (this.compilationWorker) {\n\t\t\tthis.compilationWorker.terminate();\n\t\t\tthis.compilationWorker = null;\n\t\t}\n\t\tif (this.globalUnsubscribe) {\n\t\t\tthis.globalUnsubscribe();\n\t\t\tthis.globalUnsubscribe = null;\n\t\t}\n\t}\n\n\t/**\n\t * Get the DocumentModel (read-only access for decoration building).\n\t */\n\tgetDoc(): DocumentModel {\n\t\treturn this.doc;\n\t}\n\n\t/**\n\t * Evaluate all dirty lines in the document, regardless of viewport.\n\t * Used for full re-evaluation after plugin register/unregister.\n\t */\n\tevaluateAll(signal?: AbortSignal): EvalResult {\n\t\tconst viewport = { startLine: 1, endLine: this.doc.lineCount };\n\t\tconst result = this.evaluate(viewport, signal);\n\t\t// evaluate() already calls maintainAfterEval internally\n\t\treturn result;\n\t}\n\n\t/**\n\t * Zero-allocation viewport evaluation, the Phase 5.2e \"holy grail.\"\n\t *\n\t * **Key insight:** When the user scrolls (viewport-only change, no edits),\n\t * we don't need to re-evaluate from line 1. Instead:\n\t *\n\t * 1. Restore the VM to just before the viewport via the nearest checkpoint.\n\t * 2. Evaluate ONLY the visible lines (Tier 2 for clean cached, Tier 1 for dirty).\n\t * 3. Lines before the viewport are completely skipped, their state lives in\n\t * the VM checkpointer's prototypal chain.\n\t *\n\t * **Correctness guard:** If any variable-definition line before the viewport\n\t * is dirty (e.g., the user edited a variable def that hasn't been\n\t * re-evaluated yet), we clear stale checkpoints and fall back to `evaluate()`\n\t * which processes from line 1 and rebuilds fresh checkpoints. This\n\t * guarantees that stale checkpoints are never used as restoration targets.\n\t * Only variable-def lines matter here, `VMCheckpointer.snapshot()` only\n\t * records state for lines that write a variable, so a dirty plain-expression\n\t * line before the viewport has no checkpoint to invalidate (see\n\t * `DocumentModel.hasAnyDirtyVariableDefLineBefore()`).\n\t *\n\t * **Performance:** O(visible lines) instead of O(document length). Target:\n\t * < 1ms for a typical ~30-line viewport, independent of document size.\n\t *\n\t * @param viewport The visible line range.\n\t * @returns Results for visible lines only. Lines before the viewport are\n\t * not included in `lines[]` or `resultMap`.\n\t */\n\tsetViewport(viewport: ViewportRange, signal?: AbortSignal): EvalResult {\n\t\t// ── One AbortController Per Keystroke ────────────────────────\n\t\t// Link the UI layer's keystroke signal to the engine.\n\t\tthis.engine.setKeystrokeSignal(signal ?? null);\n\n\t\t// ── Correctness guard: dirty lines before viewport invalidate checkpoints ──\n\t\tif (viewport.startLine > 1 && this.hasDirtyLinesBefore(viewport.startLine)) {\n\t\t\t// Clear stale checkpoints, evaluate() will rebuild them from line 1.\n\t\t\t// evaluate() handles its own arena enable/disable and signal cleanup.\n\t\t\tthis.checkpointer?.clear();\n\t\t\treturn this.evaluate(viewport, signal);\n\t\t}\n\n\t\t// ── Phase 5.2g: Page-based LRU eviction (MUST run before preload) ──\n\t\t// maintainAfterEval captures the scroll direction and updates lastViewportStart\n\t\t// BEFORE preloadNextPages reads the direction for preloading.\n\t\tthis.pageManager.maintainAfterEval(viewport, this.doc);\n\n\t\t// ── Phase 5.2g: Detect scroll direction & preload ───────────\n\t\tthis.preloadNextPages(viewport);\n\n\t\t// ── Restore VM state from nearest checkpoint before the viewport ──\n\t\t// This sets all variables that were defined at or before startLine-1.\n\t\tthis.restoreTo(viewport.startLine - 1);\n\n\t\t// ── Phase 5.3: Enable arena for zero-allocation Tier 2 execution ──\n\t\tenableValueArena();\n\t\ttry {\n\t\t\t// ── Evaluate only visible lines ──\n\t\t\tconst result = this.collectEvalResults(viewport.startLine, viewport.endLine);\n\t\t\treturn result;\n\t\t} finally {\n\t\t\t// Clear keystroke signal to prevent stale signal references.\n\t\t\tthis.engine.setKeystrokeSignal(null);\n\n\t\t\t// Phase 5.3: Always disable arena, even on exception.\n\t\t\t// Prevents cross-test contamination from arena leaks.\n\t\t\tdisableValueArena();\n\t\t}\n\t}\n\n\t/**\n\t * Apply incremental line-level changes to the document model.\n\t *\n\t * **Phase 5.2f:** Replaces the O(N) `setDocument()` + full re-evaluation\n\t * with O(changed) incremental updates. Key benefits:\n\t *\n\t * 1. Unchanged lines retain their persistent lineIds → bytecode survives\n\t * 2. Only changed + DAG-downstream lines are marked dirty → Tier 1 re-evaluation\n\t * 3. Clean lines in viewport use Tier 2 (cached bytecode execution)\n\t * 4. Clean lines outside viewport are skipped entirely\n\t *\n\t * The DAG is fully cleared after propagation: shifted lines would have\n\t * stale entries keyed by old line numbers, so the DAG is rebuilt from\n\t * scratch during the subsequent `evaluate()` call.\n\t *\n\t * **Caller should follow up with `evaluate(viewport)`** to re-evaluate\n\t * dirty lines from line 1 and rebuild the DAG + checkpoints.\n\t *\n\t * @param changes Line-level changes to apply. Must be non-overlapping.\n\t * @returns Metadata about the applied changes.\n\t */\n\tapplyTransaction(changes: LineChange[]): {\n\t\tinserted: number[];\n\t\tremoved: number[];\n\t} {\n\t\t// ── Phase 1: Collect DAG writes + downstream lineIds ───────────\n\t\t// Must happen BEFORE applyChanges() because line numbers are still\n\t\t// valid at this point. We collect writes from deleted lines and\n\t\t// resolve downstream consumers to lineIds (not line numbers) so\n\t\t// they survive the position shifts that applyChanges() causes.\n\t\tconst allWrites = new Set<string>();\n\n\t\tfor (const change of changes) {\n\t\t\tfor (let i = 0; i < change.deleteCount; i++) {\n\t\t\t\tconst lineNum = change.startLine + i;\n\t\t\t\tconst writes = this.dag.getWrites(lineNum);\n\t\t\t\tfor (const w of writes) {\n\t\t\t\t\tallWrites.add(w);\n\t\t\t\t}\n\t\t\t\t// Clean up DAG references for this line\n\t\t\t\tthis.dag.removeLine(lineNum);\n\t\t\t\t// And its cached bytecode. The dependency graph was already\n\t\t\t\t// pruned here; the LineCache was not, so a deleted line kept its\n\t\t\t\t// entry until the whole cache was dropped on a document switch.\n\t\t\t\t// Editing a long document over a session accumulated entries for\n\t\t\t\t// line numbers that no longer existed.\n\t\t\t\tthis.engine.getLineCache().removeAllForLine(lineNum);\n\t\t\t}\n\t\t}\n\n\t\t// Resolve downstream consumers to persistent lineIds BEFORE the\n\t\t// structural change shifts line numbers. After applyChanges(),\n\t\t// we mark these lineIds dirty, their positions don't matter.\n\t\tconst downstreamLineIds = new Set<number>();\n\t\tfor (const writeVar of allWrites) {\n\t\t\tconst affected = this.dag.getAffectedLines(writeVar);\n\t\t\tfor (const lineNum of affected) {\n\t\t\t\tconst state = this.doc.getLineAt(lineNum);\n\t\t\t\tif (state) {\n\t\t\t\t\tdownstreamLineIds.add(state.lineId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// ── Phase 2: Apply structural changes to DocumentModel ─────────\n\t\tconst result = this.doc.applyChanges(changes);\n\n\t\t// ── Phase 3: Clear checkpointer (line numbers shifted) ─────────\n\t\tthis.checkpointer?.clear();\n\n\t\t// ── Phase 4: Mark DAG-downstream lines dirty by lineId ─────────\n\t\t// Using lineId instead of line number is position-agnostic:\n\t\t// lines that shifted due to insertions/deletions above them are\n\t\t// still correctly targeted. Lines that were deleted (lineId no\n\t\t// longer in the doc) are silently ignored by markDirty().\n\t\tfor (const lineId of downstreamLineIds) {\n\t\t\tthis.doc.markDirty(lineId);\n\t\t}\n\n\t\t// ── Phase 5: Clear DAG to avoid phantom entries ────────────────\n\t\t// Entries keyed by old line numbers are stale after structural\n\t\t// changes. Rather than updating shifted entries, we clear the DAG\n\t\t// and let the subsequent evaluate() call rebuild it from scratch.\n\t\tthis.dag.clear();\n\n\t\treturn {\n\t\t\tinserted: result.inserted,\n\t\t\tremoved: result.removed,\n\t\t};\n\t}\n\n\t// ── Private helpers ─────────────────────────────────────────────────\n\n\t/**\n\t * Collect evaluation results for a contiguous range of lines.\n\t *\n\t * Used by both `evaluate()` (startLine=1) and `setViewport()` (any start).\n\t * All lines in the range are treated as in-viewport (visible), callers that\n\t * need the invisible/dirty → Tier 3 handling should use `evaluate()` instead.\n\t *\n\t * @param startLine First line to evaluate (1-based, inclusive).\n\t * @param endLine Last line to evaluate (1-based, inclusive). Clamped to docEnd.\n\t */\n\tprivate collectEvalResults(startLine: number, endLine: number): EvalResult {\n\t\tconst lines: EvalLineResult[] = [];\n\t\tconst resultMap = new Map<number, Value[]>();\n\t\tconst tierCounts = { tier1: 0, tier2: 0, tier3: 0, skipped: 0 };\n\n\t\tconst docEnd = this.doc.lineCount;\n\t\tconst evalEnd = Math.min(endLine, docEnd);\n\n\t\tfor (let pos = startLine; pos <= evalEnd; pos++) {\n\t\t\tconst state = this.doc.getLineAt(pos);\n\t\t\tif (!state) continue;\n\n\t\t\t// All processed lines are in-viewport for setViewport, or conditionally\n\t\t\t// in-viewport for evaluate (handled by caller). We pass `true` here\n\t\t\t// because evaluateSingleLine's `inViewport` param controls Tier 1 vs\n\t\t\t// Tier 3 dispatch; callers must manage this distinction externally.\n\t\t\t//\n\t\t\t// evaluate() handles this by passing `inViewport` per-line; it loops\n\t\t\t// directly rather than using this helper for that reason.\n\t\t\tconst lineResult = this.evaluateSingleLine(state, pos, true);\n\t\t\tlines.push(lineResult);\n\n\t\t\tif (lineResult.tier === EvalTier.Tier1) tierCounts.tier1++;\n\t\t\telse if (lineResult.tier === EvalTier.Tier2) tierCounts.tier2++;\n\t\t\telse if (lineResult.tier === EvalTier.Tier3) tierCounts.tier3++;\n\t\t\telse tierCounts.skipped++;\n\n\t\t\tif (lineResult.results) {\n\t\t\t\tresultMap.set(pos, lineResult.results.flat());\n\t\t\t}\n\t\t}\n\n\t\treturn { lines, resultMap, tierCounts };\n\t}\n\n\t/**\n\t * Check whether any **variable-definition** line before `position`\n\t * (1-based, exclusive) is dirty.\n\t *\n\t * Used by `setViewport()` to decide whether to fall back to `evaluate()`:\n\t * if a variable-def before the viewport is dirty, the checkpoint state\n\t * `restoreTo()` would use may be stale and we need to reprocess from\n\t * line 1 to rebuild checkpoints correctly.\n\t *\n\t * Deliberately narrower than `DocumentModel.hasAnyDirtyLineBefore()`:\n\t * checkpoints only snapshot variable-def lines (see VMCheckpointer), so a\n\t * dirty plain-expression line before the viewport can't have invalidated\n\t * one, there's nothing checkpointed for it to invalidate. Using the\n\t * broader check here previously caused a real perf bug: `PageManager`'s\n\t * cold-page eviction marks evicted non-variable-def lines dirty, so\n\t * scrolling far into a large, variable-def-free document would trip this\n\t * guard, fall back to `evaluate()`, which recompiles those lines via\n\t * Tier 3 (never clearing their dirty flag by design), causing the very\n\t * next `maintainAfterEval()` to re-evict and re-dirty them, a\n\t * self-sustaining loop that pinned every subsequent `setViewport()` call\n\t * to the cost of a full re-evaluation instead of O(visible lines).\n\t *\n\t * Delegates to DocumentModel.hasAnyDirtyVariableDefLineBefore(), which\n\t * tracks dirty lineIds incrementally instead of scanning every line up to\n\t * `position` on every call. This used to be a real per-scroll cost\n\t * (benchmarked at ~10ms scrolled near the bottom of a 20k-line document)\n\t * since it fired on every viewport change, not just edits.\n\t */\n\tprivate hasDirtyLinesBefore(position: number): boolean {\n\t\treturn this.doc.hasAnyDirtyVariableDefLineBefore(position);\n\t}\n\n\t/**\n\t * Evaluate a single line using the appropriate tier.\n\t *\n\t * Tier assignment logic:\n\t * - Empty/markdown-only lines → skipped\n\t * - Dirty + in-viewport → Tier 1 (full pipeline)\n\t * - Dirty + not in viewport → Tier 3 (compile-only, execute variable defs)\n\t * - Clean + has bytecode + in viewport → Tier 2 (execute from cache)\n\t * - Clean + no bytecode → skipped (non-evaluable)\n\t */\n\tprivate evaluateSingleLine(\n\t\tstate: LineState,\n\t\tlineNumber: number,\n\t\tinViewport: boolean\n\t): EvalLineResult {\n\t\tconst baseResult: Omit<EvalLineResult, \"tier\" | \"result\" | \"error\"> = {\n\t\t\tlineId: state.lineId,\n\t\t\tlineNumber,\n\t\t};\n\n\t\t// Skip empty/markdown-only lines\n\t\tif (state.isEmpty || isEmptyLine(state.text)) {\n\t\t\tstate.isEmpty = true;\n\t\t\tthis.doc.markClean(state.lineId);\n\t\t\treturn { ...baseResult, tier: EvalTier.Skipped, result: null, error: null };\n\t\t}\n\n\t\t// Extract all evaluable expressions (may be multiple inline solves)\n\t\tconst { expressions, inlineSolveCount } = this.extractExpressions(state);\n\t\tif (expressions.length === 0) {\n\t\t\tstate.isEmpty = true;\n\t\t\tthis.doc.markClean(state.lineId);\n\t\t\treturn { ...baseResult, tier: EvalTier.Skipped, result: null, error: null };\n\t\t}\n\n\t\t// Determine the expression to evaluate (only needed for dirty lines)\n\t\tif (state.dirty) {\n\t\t\tif (inViewport) {\n\t\t\t\t// ── Tier 1: Visible + Dirty → Full Pipeline ──────────\n\t\t\t\treturn this.evaluateTier1(state, lineNumber, expressions, inlineSolveCount, baseResult);\n\t\t\t} else {\n\t\t\t\t// ── Tier 3: Invisible + Dirty → Compile-only ─────────\n\t\t\t\t// Skip recompilation if already compiled by a previous Tier 3 pass.\n\t\t\t\t// Non-variable-def lines keep dirty=true after Tier 3 (so they get\n\t\t\t\t// Tier 1 when scrolled into view), but recompiling identical text\n\t\t\t\t// produces the same bytecode and DAG entries. Text changes clear\n\t\t\t\t// bytecodes via DocumentModel.editLine(), so a length check is safe.\n\t\t\t\tif (state.bytecodes.length > 0 && state.bytecodes.length === expressions.length && !state.isVariableDef) {\n\t\t\t\t\treturn { ...baseResult, tier: EvalTier.Skipped, result: null, error: null };\n\t\t\t\t}\n\t\t\t\treturn this.evaluateTier3(state, lineNumber, expressions, inlineSolveCount, baseResult);\n\t\t\t}\n\t\t}\n\n\t\t// Line is clean\n\t\tif (inViewport && state.bytecodes.length > 0) {\n\t\t\t// ── Tier 2: Visible + Cached → Execute from bytecode ────\n\t\t\treturn this.evaluateTier2(state, lineNumber, baseResult);\n\t\t}\n\n\t\t// Clean, not in viewport, or no bytecode → skip\n\t\treturn { ...baseResult, tier: EvalTier.Skipped, result: null, error: null };\n\t}\n\n\t/**\n\t * Tier 1: Full pipeline, lex, parse, compile, execute.\n\t * Uses the engine's existing evaluateLine() which handles all pipeline\n\t * stages including DAG updates and LineCache population.\n\t *\n\t * Supports multiple expressions per line (inline solves). Evaluates each\n\t * expression left-to-right through the engine so variable definitions in\n\t * earlier solves update the VM state before later solves are evaluated.\n\t * Reads/writes are aggregated across all expressions for the DAG.\n\t */\n\tprivate evaluateTier1(\n\t\tstate: LineState,\n\t\tlineNumber: number,\n\t\texpressions: string[],\n\t\tinlineSolveCount: number,\n\t\tbaseResult: Omit<EvalLineResult, \"tier\" | \"result\" | \"error\">\n\t): EvalLineResult {\n\t\tconst allResults: Value[][] = [];\n\t\tconst allBytecodes: BytecodeProgram[] = [];\n\t\tconst allReads = new Set<string>();\n\t\tconst allWrites = new Set<string>();\n\t\tlet hasVariableDef = false;\n\t\tlet lastValue: Value | null = null;\n\t\tlet firstError: string | null = null;\n\t\tlet anyFailed = false;\n\t\t/** Set when any expression returned a value still waiting on a resolver. */\n\t\tlet anyPending = false;\n\n\t\t// Evaluate each expression independently, a failure in one expression\n\t\t// (e.g., parse error in s`bad syntax`) must not prevent other expressions\n\t\t// on the same line from being evaluated and having their results stored.\n\t\t// Without per-expression error handling, same-line cross-reference inline\n\t\t// solves (s`:a = 5` s`:b = a + 3` s`a + b`) would lose ALL results when\n\t\t// the third expression throws because 'b' references cross a VM state\n\t\t// boundary or the engine encounters a transient error.\n\t\tfor (const expression of expressions) {\n\t\t\tif (!expression.trim()) continue;\n\n\t\t\tlet value: Value[] | null = null;\n\t\t\tlet entry: { bytecode: BytecodeProgram; readVariables: string[]; writeVariable: string | null } | undefined;\n\n\t\t\ttry {\n\t\t\t\tconst evaluation = this.engine.evaluateLineDetailed(lineNumber, expression);\n\t\t\t\tvalue = evaluation.values;\n\t\t\t\tlastValue = value[0];\n\t\t\t\t// Sync the DocumentModel from the LineCache.\n\t\t\t\t// Use get(lineNumber, expression) instead of getEntryForLine(lineNumber)\n\t\t\t\t// because multiple expressions on the same line share the same lineNumber\n\t\t\t\t// and getEntryForLine always returns the FIRST entry (Map insertion order).\n\t\t\t\tentry = this.engine.getLineCache().get(lineNumber, expression) as typeof entry;\n\t\t\t} catch (e) {\n\t\t\t\tconst errorMessage = e instanceof Error ? e.message : String(e);\n\t\t\t\tif (!firstError) firstError = errorMessage;\n\t\t\t\tanyFailed = true;\n\t\t\t\tvalue = null;\n\t\t\t}\n\n\t\t\t// An unresolved async value does not throw, so `anyFailed` alone would\n\t\t\t// let this line be marked clean while its data has not arrived. Once\n\t\t\t// clean, nothing re-runs the resolver preflight and the value stays\n\t\t\t// pending for good. Treat it as not-yet-complete instead.\n\t\t\tif (value && value.some((v) => v.type === ValueType.Pending)) {\n\t\t\t\tanyPending = true;\n\t\t\t}\n\n\t\t\tif (value) {\n\t\t\t\tallResults.push(value);\n\t\t\t} else {\n\t\t\t\t// Expression failed, push an ErrorValue sentinel so results[] stays\n\t\t\t\t// aligned with expressions[] and bytecodes[] indices. Downstream code\n\t\t\t\t// checking result.type === Error will find it, vs a raw null that NPEs.\n\t\t\t\tallResults.push([errorValue(\"eval_failed\", firstError ?? \"unknown error\")]);\n\t\t\t}\n\n\t\t\tif (entry) {\n\t\t\t\tallBytecodes.push(entry.bytecode);\n\t\t\t\tfor (const r of entry.readVariables) allReads.add(r);\n\t\t\t\tif (entry.writeVariable) {\n\t\t\t\t\tallWrites.add(entry.writeVariable);\n\t\t\t\t\thasVariableDef = true;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Fallback: LineCache missed, compile expression ourselves\n\t\t\t\ttry {\n\t\t\t\t\tconst { program, reads, writes } = this.engine.compileExpression(expression);\n\t\t\t\t\tallBytecodes.push(program);\n\t\t\t\t\tfor (const r of reads) allReads.add(r);\n\t\t\t\t\tfor (const w of writes) allWrites.add(w);\n\t\t\t\t\tif (writes.length > 0) hasVariableDef = true;\n\t\t\t\t} catch (compileErr) {\n\t\t\t\t\t// Push empty bytecode, expression will recompile on next pass.\n\t\t\t\t\t// The expression still failed to compile, but reads/writes were\n\t\t\t\t\t// already extracted from its tokens before the parse attempt\n\t\t\t\t\t// compileExpression() surfaces them via the thrown error's\n\t\t\t\t\t// context. Register them anyway so the DAG knows this line\n\t\t\t\t\t// depends on those variables and re-evaluates it once they\n\t\t\t\t\t// become defined, instead of losing the dependency entirely.\n\t\t\t\t\tallBytecodes.push({ opcodes: new Uint8Array(0), numbers: new Float64Array(0), strings: [], hasAsync: false });\n\t\t\t\t\tif (compileErr instanceof EngineError && compileErr.context) {\n\t\t\t\t\t\tconst errReads = compileErr.context.reads;\n\t\t\t\t\t\tconst errWrites = compileErr.context.writes;\n\t\t\t\t\t\tif (Array.isArray(errReads)) for (const r of errReads) allReads.add(r);\n\t\t\t\t\t\tif (Array.isArray(errWrites)) for (const w of errWrites) allWrites.add(w);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst reads = [...allReads];\n\t\tconst writes = [...allWrites];\n\n\t\t// Always store results, even partial ones. If any expression failed\n\t\t// the line stays dirty so the failed expression(s) get retried on the\n\t\t// next evaluation pass. But successfully-evaluated expressions' results\n\t\t// are preserved so the DAG, UI decorations, and downstream consumers\n\t\t// can use them immediately.\n\t\tif (anyFailed || anyPending) {\n\t\t\t// Store partial results via updateLineCompiled (doesn't clear dirty).\n\t\t\t// The successful expressions' bytecodes are cached so Tier 2 works\n\t\t\t// for them on the next scroll pass.\n\t\t\tthis.doc.updateLineCompiled(\n\t\t\t\tstate.lineId,\n\t\t\t\texpressions,\n\t\t\t\tallBytecodes,\n\t\t\t\treads,\n\t\t\t\twrites,\n\t\t\t\thasVariableDef,\n\t\t\t\tinlineSolveCount,\n\t\t\t);\n\t\t\t// Also set results for the successful expressions\n\t\t\tstate.results = allResults;\n\t\t\tstate.result = allResults[0]?.[0] ?? null;\n\t\t\tstate.inlineSolveCount = inlineSolveCount;\n\t\t\tstate.expressions = expressions;\n\t\t} else {\n\t\t\t// All expressions succeeded, store full results and mark clean\n\t\t\tthis.doc.updateLineResult(\n\t\t\t\tstate.lineId,\n\t\t\t\tallResults,\n\t\t\t\tallBytecodes,\n\t\t\t\texpressions,\n\t\t\t\treads,\n\t\t\t\twrites,\n\t\t\t\thasVariableDef,\n\t\t\t\tinlineSolveCount,\n\t\t\t);\n\t\t}\n\n\t\t// Register reads/writes in DAG (aggregated across all expressions).\n\t\t// Always register, even lines with no reads/writes (pure expressions\n\t\t// like \"2+2\") need DAG entries so downstream queries for line presence work.\n\t\tthis.dag.registerLine(lineNumber, reads, writes);\n\n\t\t// ── Checkpoint after variable definition ──\n\t\t// A pending value is not a value worth checkpointing: restoring it would\n\t\t// reinstate the unresolved placeholder rather than the eventual result.\n\t\tif (this.checkpointer && writes.length > 0 && !anyFailed && !anyPending) {\n\t\t\tthis.checkpointer.snapshot(lineNumber, state.lineId, writes);\n\t\t}\n\n\t\treturn {\n\t\t\t...baseResult,\n\t\t\ttier: EvalTier.Tier1,\n\t\t\tresult: lastValue,\n\t\t\tresults: allResults,\n\t\t\terror: firstError,\n\t\t};\n\t}\n\n\t/**\n\t * Tier 2: Execute from cached bytecode only.\n\t * Skips lexing, parsing, and compiling, runs the pre-compiled bytecode\n\t * against the engine's shared VM. Supports multiple bytecodes per line\n\t * (inline solves), each is executed left-to-right so variable definitions\n\t * in earlier bytecodes update the VM before later ones run.\n\t * Assumes the VM already has correct variable state from preceding\n\t * Tier-1 evaluations.\n\t */\n\tprivate evaluateTier2(\n\t\tstate: LineState,\n\t\tlineNumber: number,\n\t\tbaseResult: Omit<EvalLineResult, \"tier\" | \"result\" | \"error\">\n\t): EvalLineResult {\n\t\tif (state.bytecodes.length === 0) {\n\t\t\treturn { ...baseResult, tier: EvalTier.Skipped, result: null, error: null };\n\t\t}\n\n\t\tconst results: Value[][] = [];\n\t\tlet lastValue: Value | null = null;\n\t\tlet firstError: string | null = null;\n\t\tlet anyFailed = false;\n\n\t\t// Execute each bytecode independently, a failure in one should not\n\t\t// prevent other bytecodes on the same line from executing. Same-line\n\t\t// inline solves with variable definitions (s`:a = 5` s`a + 3`) rely\n\t\t// on earlier bytecodes updating the VM before later ones execute.\n\t\tfor (const bytecode of state.bytecodes) {\n\t\t\tif (bytecode.opcodes.length === 0) continue;\n\t\t\ttry {\n\t\t\t\tconst value = this.engine.executeCached(bytecode, lineNumber);\n\t\t\t\tlastValue = value;\n\t\t\t\tresults.push([value]);\n\t\t\t} catch (e) {\n\t\t\t\tconst errorMessage = e instanceof Error ? e.message : String(e);\n\t\t\t\tif (!firstError) firstError = errorMessage;\n\t\t\t\tanyFailed = true;\n\t\t\t\t// Push error sentinel to maintain results[i] ↔ bytecodes[i] alignment\n\t\t\t\tresults.push([errorValue(\"exec_failed\", errorMessage)]);\n\t\t\t}\n\t\t}\n\n\t\t// Update DAG: re-register reads/writes from the cached metadata.\n\t\t// Always register, even empty reads/writes so DAG line-presence queries work.\n\t\tthis.dag.registerLine(lineNumber, state.reads, state.writes);\n\n\t\tstate.results = results;\n\t\tstate.result = results[0]?.[0] ?? null;\n\t\tif (anyFailed) {\n\t\t\t// Mark dirty so failed bytecodes are re-compiled (Tier 1) next pass\n\t\t\tthis.doc.markDirty(state.lineId);\n\t\t}\n\n\t\treturn { ...baseResult, tier: EvalTier.Tier2, result: lastValue, results, error: firstError };\n\t}\n\n\t/**\n\t * Tier 3: Compile-only for invisible lines.\n\t * Lex → Parse → Compile to discover reads/writes for the dependency graph.\n\t * Executes the bytecode ONLY if the line defines a variable (isVariableDef\n\t * or writes.length > 0), because variable assignments affect VM state\n\t * that other lines depend on. Pure expression lines are compiled but NOT\n\t * executed, saving CPU for large documents.\n\t *\n\t * Supports multiple expressions per line (inline solves). Each is compiled\n\t * separately; variable-def expressions are also executed.\n\t */\n\tprivate evaluateTier3(\n\t\tstate: LineState,\n\t\tlineNumber: number,\n\t\texpressions: string[],\n\t\tinlineSolveCount: number,\n\t\tbaseResult: Omit<EvalLineResult, \"tier\" | \"result\" | \"error\">\n\t): EvalLineResult {\n\t\tconst allBytecodes: BytecodeProgram[] = [];\n\t\tconst allReads = new Set<string>();\n\t\tconst allWrites = new Set<string>();\n\t\tlet hasVariableDef = false;\n\t\tlet lastResult: Value | null = null;\n\t\tlet firstError: string | null = null;\n\t\tlet anyFailed = false;\n\t\t/** Set when a result is still waiting on a resolver. */\n\t\tlet anyPending = false;\n\n\t\t// Compile each expression independently, a parse error in one\n\t\t// should not prevent other expressions from being compiled and\n\t\t// having their reads/writes registered in the DAG.\n\t\tfor (const expression of expressions) {\n\t\t\tif (!expression.trim()) continue;\n\n\t\t\ttry {\n\t\t\t\tconst { program, reads, writes } = this.engine.compileExpression(expression);\n\t\t\t\tallBytecodes.push(program);\n\t\t\t\tfor (const r of reads) allReads.add(r);\n\t\t\t\tfor (const w of writes) allWrites.add(w);\n\t\t\t\tif (writes.length > 0) hasVariableDef = true;\n\n\t\t\t\tif (writes.length > 0 && program.opcodes.length > 0) {\n\t\t\t\t\t// Variable definitions MUST execute to maintain VM state\n\t\t\t\t\tlastResult = this.engine.executeCached(program, lineNumber);\n\t\t\t\t\t// Same reasoning as Tier 1: a pending result does not throw,\n\t\t\t\t\t// and marking the line clean would strand it unresolved.\n\t\t\t\t\tif (lastResult && lastResult.type === ValueType.Pending) {\n\t\t\t\t\t\tanyPending = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tconst errorMessage = e instanceof Error ? e.message : String(e);\n\t\t\t\tif (!firstError) firstError = errorMessage;\n\t\t\t\tanyFailed = true;\n\t\t\t\t// Push empty bytecode placeholder for alignment\n\t\t\t\tallBytecodes.push({ opcodes: new Uint8Array(0), numbers: new Float64Array(0), strings: [], hasAsync: false });\n\t\t\t}\n\t\t}\n\n\t\tconst reads = [...allReads];\n\t\tconst writes = [...allWrites];\n\n\t\t// Store compile-only state in DocumentModel, even partial results\n\t\t// preserve successful expressions' bytecodes and DAG data.\n\t\tthis.doc.updateLineCompiled(\n\t\t\tstate.lineId,\n\t\t\texpressions,\n\t\t\tallBytecodes,\n\t\t\treads,\n\t\t\twrites,\n\t\t\thasVariableDef,\n\t\t\tinlineSolveCount,\n\t\t);\n\n\t\t// Register reads/writes in DAG regardless, partial data is valid.\n\t\t// Always register, even empty reads/writes for DAG line-presence queries.\n\t\tthis.dag.registerLine(lineNumber, reads, writes);\n\n\t\tif (hasVariableDef && lastResult && !anyFailed && !anyPending) {\n\t\t\tstate.results = [[lastResult]];\n\t\t\tstate.result = lastResult;\n\t\t\tthis.doc.markClean(state.lineId);\n\n\t\t\t// ── Checkpoint after variable definition ────────────\n\t\t\tif (this.checkpointer) {\n\t\t\t\tthis.checkpointer.snapshot(lineNumber, state.lineId, writes);\n\t\t\t}\n\t\t}\n\n\t\treturn { ...baseResult, tier: EvalTier.Tier3, result: lastResult, results: hasVariableDef && lastResult && !anyFailed && !anyPending ? [[lastResult]] : undefined, error: firstError };\n\t}\n\n\t// ── Public checkpoint API (used by Phase 5.2e setViewport) ──────\n\n\t/**\n\t * Restore the VM to the state at or just after the given line number.\n\t *\n\t * Finds the nearest checkpoint at or before `lineNumber` and replays\n\t * all variable definitions from the checkpoint chain into the VM.\n\t * After calling this, the VM is ready to evaluate lines starting at\n\t * `lineNumber + 1` without re-evaluating all preceding lines.\n\t *\n\t * **Usage:** Phase 5.2e's `setViewport()` calls `restoreTo(viewport.startLine - 1)`\n\t * before evaluating only the newly visible lines. This is the key to\n\t * O(visible lines) scrolling.\n\t *\n\t * @param lineNumber The line number to restore to. Variables defined\n\t * at lines ≤ this number will be available in the VM.\n\t */\n\trestoreTo(lineNumber: number): void {\n\t\tif (this.checkpointer) {\n\t\t\tthis.checkpointer.restoreTo(lineNumber);\n\t\t}\n\t}\n\n\t/**\n\t * Get the VM checkpointer, or null if checkpointing is disabled.\n\t */\n\tgetCheckpointer(): VMCheckpointer | null {\n\t\treturn this.checkpointer;\n\t}\n\n\t/**\n\t * Get the PageManager (Phase 5.2g).\n\t * Exposed for testing.\n\t */\n\tgetPageManager(): PageManager {\n\t\treturn this.pageManager;\n\t}\n\n\t// ── Phase 5.2g: Directional preloading ──────────────────────────\n\n\t/**\n\t * Preload the next 1–2 pages in the current scroll direction.\n\t *\n\t * Called during `setViewport()` (scroll-only path). Collects dirty\n\t * uncompiled lines in pages just beyond the viewport and dispatches\n\t * them to the background compilation worker so bytecode is ready\n\t * before the user scrolls those lines into view.\n\t */\n\tprivate preloadNextPages(viewport: ViewportRange): void {\n\t\tconst targets = this.pageManager.getPreloadTargets(viewport, this.doc);\n\t\tif (targets.length === 0) return;\n\n\t\t// Lazy-init worker if needed\n\t\tif (!this.compilationWorker) {\n\t\t\tthis.compilationWorker = new CompilationWorkerManager();\n\t\t}\n\n\t\t// Fire-and-forget: worker compiles, stores bytecode on response\n\t\tthis.compilationWorker.compileBatch(targets).then((results) => {\n\t\t\tthis.compilationWorker!.storeResults(results, this.doc);\n\t\t}).catch((_err) => {\n\t\t\t// Non-fatal, next evaluate() will compile synchronously\n\t\t});\n\t}\n\n\t/**\n\t * Collect invisible dirty lines that need background compilation.\n\t *\n\t * Iterates lines beyond `viewport.endLine`, filtering for:\n\t * - Dirty lines (need re-compilation)\n\t * - Non-empty, non-markdown lines\n\t * - No existing bytecode (skip already-compiled Tier 3 lines)\n\t *\n\t * Returns CompileRequestItem[] suitable for CompilationWorkerManager.\n\t */\n\tprivate collectInvisibleCompileTargets(viewport: ViewportRange): CompileRequestItem[] {\n\t\tconst items: CompileRequestItem[] = [];\n\t\tconst docEnd = this.doc.lineCount;\n\t\tconst startPos = viewport.endLine + 1;\n\n\t\tfor (let pos = startPos; pos <= docEnd; pos++) {\n\t\t\tconst state = this.doc.getLineAt(pos);\n\t\t\tif (!state) continue;\n\n\t\t\t// Skip clean lines\n\t\t\tif (!state.dirty) continue;\n\n\t\t\t// Skip already-compiled lines\n\t\t\tif (state.bytecodes.length > 0 && !state.isVariableDef) continue;\n\n\t\t\t// Skip empty/markdown-only lines\n\t\t\tif (state.isEmpty || isEmptyLine(state.text)) continue;\n\n\t\t\tconst { expressions } = this.extractExpressions(state);\n\t\t\tif (expressions.length === 0) continue;\n\n\t\t\t// Create one CompileRequestItem per expression (inline solves\n\t\t\t// on the same line share the same lineId + textHash). The worker\n\t\t\t// compiles each independently; storeResults batches by lineId.\n\t\t\tfor (const expression of expressions) {\n\t\t\t\tif (!expression.trim()) continue;\n\t\t\t\titems.push({\n\t\t\t\t\tlineId: state.lineId,\n\t\t\t\t\texpression,\n\t\t\t\t\ttextHash: state.textHash,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn items;\n\t}\n\n\t/**\n\t * Extract all evaluable expressions from a LineState.\n\t *\n\t * For full-line expressions: returns `{ expressions: [trimmedText], inlineSolveCount: 0 }`.\n\t * For inline solve lines: returns `{ expressions: [...allSolves], inlineSolveCount: N }`.\n\t * For pre-extracted (cached) expressions: returns the cached array.\n\t *\n\t * Inline solves are extracted left-to-right via the sharedLexer, so variable\n\t * definitions in earlier solves (e.g., `s\\`x = 5\\` more text s\\`x + 1\\``)\n\t * correctly update the VM state before later solves are evaluated.\n\t */\n\tprivate extractExpressions(state: LineState): { expressions: string[]; inlineSolveCount: number } {\n\t\t// Use pre-extracted expressions if available (from cache / previous evaluation)\n\t\tif (state.expressions.length > 0) {\n\t\t\treturn { expressions: state.expressions, inlineSolveCount: state.inlineSolveCount };\n\t\t}\n\n\t\tconst trimmed = state.text.trim();\n\t\tif (trimmed.length === 0) return { expressions: [], inlineSolveCount: 0 };\n\n\t\t// Check for inline solve syntax: s`expression`\n\t\tconst inlineSpans = sharedLexer.findInlineSolves(state.text);\n\t\tif (inlineSpans.length > 0) {\n\t\t\treturn {\n\t\t\t\texpressions: inlineSpans.map(s => s.expression),\n\t\t\t\tinlineSolveCount: inlineSpans.length,\n\t\t\t};\n\t\t}\n\n\t\t// Full-line expression\n\t\treturn { expressions: [trimmed], inlineSolveCount: 0 };\n\t}\n}\n"]}