@cuxt/sandboxjs 0.1.0 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +198 -185
- package/{build → dist/cjs}/Sandbox.d.ts +15 -6
- package/dist/cjs/Sandbox.js +126 -0
- package/dist/{SandboxExec.d.ts → cjs/SandboxExec.d.ts} +8 -17
- package/dist/cjs/SandboxExec.js +227 -0
- package/{build/eval.d.ts → dist/cjs/eval/index.d.ts} +10 -2
- package/dist/cjs/eval/index.js +233 -0
- package/dist/cjs/executor/executorUtils.d.ts +161 -0
- package/dist/cjs/executor/executorUtils.js +930 -0
- package/dist/cjs/executor/index.d.ts +1 -0
- package/dist/cjs/executor/index.js +2 -0
- package/dist/cjs/executor/ops/assignment.d.ts +1 -0
- package/dist/cjs/executor/ops/assignment.js +88 -0
- package/dist/cjs/executor/ops/call.d.ts +1 -0
- package/dist/cjs/executor/ops/call.js +160 -0
- package/dist/cjs/executor/ops/comparison.d.ts +1 -0
- package/dist/cjs/executor/ops/comparison.js +36 -0
- package/dist/cjs/executor/ops/control.d.ts +1 -0
- package/dist/cjs/executor/ops/control.js +203 -0
- package/dist/cjs/executor/ops/functions.d.ts +1 -0
- package/dist/cjs/executor/ops/functions.js +55 -0
- package/dist/cjs/executor/ops/index.d.ts +0 -0
- package/dist/cjs/executor/ops/index.js +11 -0
- package/dist/cjs/executor/ops/literals.d.ts +1 -0
- package/dist/cjs/executor/ops/literals.js +45 -0
- package/dist/cjs/executor/ops/misc.d.ts +1 -0
- package/dist/cjs/executor/ops/misc.js +25 -0
- package/dist/cjs/executor/ops/object.d.ts +1 -0
- package/dist/cjs/executor/ops/object.js +51 -0
- package/dist/cjs/executor/ops/prop.d.ts +1 -0
- package/dist/cjs/executor/ops/prop.js +70 -0
- package/dist/cjs/executor/ops/unary.d.ts +1 -0
- package/dist/cjs/executor/ops/unary.js +48 -0
- package/dist/cjs/executor/ops/variables.d.ts +1 -0
- package/dist/cjs/executor/ops/variables.js +16 -0
- package/dist/cjs/executor/opsRegistry.d.ts +33 -0
- package/dist/cjs/executor/opsRegistry.js +8 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/parser/index.d.ts +3 -0
- package/dist/cjs/parser/index.js +1 -0
- package/dist/{parser.d.ts → cjs/parser/lisp.d.ts} +29 -42
- package/dist/cjs/parser/lispTypes/conditionals.d.ts +2 -0
- package/dist/cjs/parser/lispTypes/conditionals.js +135 -0
- package/dist/cjs/parser/lispTypes/control.d.ts +2 -0
- package/dist/cjs/parser/lispTypes/control.js +204 -0
- package/dist/cjs/parser/lispTypes/declarations.d.ts +2 -0
- package/dist/cjs/parser/lispTypes/declarations.js +99 -0
- package/dist/cjs/parser/lispTypes/index.d.ts +3 -0
- package/dist/cjs/parser/lispTypes/index.js +17 -0
- package/dist/cjs/parser/lispTypes/operators.d.ts +2 -0
- package/dist/cjs/parser/lispTypes/operators.js +252 -0
- package/dist/cjs/parser/lispTypes/shared.d.ts +38 -0
- package/dist/cjs/parser/lispTypes/structures.d.ts +2 -0
- package/dist/cjs/parser/lispTypes/structures.js +188 -0
- package/dist/cjs/parser/lispTypes/values.d.ts +2 -0
- package/dist/cjs/parser/lispTypes/values.js +89 -0
- package/dist/cjs/parser/parserUtils.d.ts +34 -0
- package/dist/cjs/parser/parserUtils.js +968 -0
- package/dist/cjs/utils/CodeString.d.ts +16 -0
- package/dist/cjs/utils/CodeString.js +64 -0
- package/dist/cjs/utils/ExecContext.d.ts +34 -0
- package/dist/cjs/utils/ExecContext.js +171 -0
- package/dist/cjs/utils/Prop.d.ts +16 -0
- package/dist/cjs/utils/Prop.js +81 -0
- package/dist/cjs/utils/Scope.d.ts +47 -0
- package/dist/cjs/utils/Scope.js +127 -0
- package/dist/cjs/utils/errors.d.ts +10 -0
- package/dist/cjs/utils/errors.js +12 -0
- package/dist/cjs/utils/functionReplacements.d.ts +11 -0
- package/dist/cjs/utils/functionReplacements.js +362 -0
- package/dist/cjs/utils/index.d.ts +7 -0
- package/dist/cjs/utils/index.js +7 -0
- package/dist/cjs/utils/types.d.ts +221 -0
- package/dist/cjs/utils/types.js +164 -0
- package/dist/cjs/utils/unraw.js +145 -0
- package/dist/{node → esm}/Sandbox.d.ts +15 -6
- package/dist/esm/Sandbox.js +115 -0
- package/dist/esm/Sandbox.js.map +1 -0
- package/{build → dist/esm}/SandboxExec.d.ts +8 -17
- package/dist/esm/SandboxExec.js +224 -0
- package/dist/esm/SandboxExec.js.map +1 -0
- package/dist/{eval.d.ts → esm/eval/index.d.ts} +10 -2
- package/dist/esm/eval/index.js +235 -0
- package/dist/esm/eval/index.js.map +1 -0
- package/dist/esm/executor/executorUtils.d.ts +161 -0
- package/dist/esm/executor/executorUtils.js +898 -0
- package/dist/esm/executor/executorUtils.js.map +1 -0
- package/dist/esm/executor/index.d.ts +1 -0
- package/dist/esm/executor/index.js +2 -0
- package/dist/esm/executor/ops/assignment.d.ts +1 -0
- package/dist/esm/executor/ops/assignment.js +90 -0
- package/dist/esm/executor/ops/assignment.js.map +1 -0
- package/dist/esm/executor/ops/call.d.ts +1 -0
- package/dist/esm/executor/ops/call.js +162 -0
- package/dist/esm/executor/ops/call.js.map +1 -0
- package/dist/esm/executor/ops/comparison.d.ts +1 -0
- package/dist/esm/executor/ops/comparison.js +38 -0
- package/dist/esm/executor/ops/comparison.js.map +1 -0
- package/dist/esm/executor/ops/control.d.ts +1 -0
- package/dist/esm/executor/ops/control.js +205 -0
- package/dist/esm/executor/ops/control.js.map +1 -0
- package/dist/esm/executor/ops/functions.d.ts +1 -0
- package/dist/esm/executor/ops/functions.js +57 -0
- package/dist/esm/executor/ops/functions.js.map +1 -0
- package/dist/esm/executor/ops/index.d.ts +0 -0
- package/dist/esm/executor/ops/index.js +11 -0
- package/dist/esm/executor/ops/literals.d.ts +1 -0
- package/dist/esm/executor/ops/literals.js +47 -0
- package/dist/esm/executor/ops/literals.js.map +1 -0
- package/dist/esm/executor/ops/misc.d.ts +1 -0
- package/dist/esm/executor/ops/misc.js +27 -0
- package/dist/esm/executor/ops/misc.js.map +1 -0
- package/dist/esm/executor/ops/object.d.ts +1 -0
- package/dist/esm/executor/ops/object.js +53 -0
- package/dist/esm/executor/ops/object.js.map +1 -0
- package/dist/esm/executor/ops/prop.d.ts +1 -0
- package/dist/esm/executor/ops/prop.js +72 -0
- package/dist/esm/executor/ops/prop.js.map +1 -0
- package/dist/esm/executor/ops/unary.d.ts +1 -0
- package/dist/esm/executor/ops/unary.js +50 -0
- package/dist/esm/executor/ops/unary.js.map +1 -0
- package/dist/esm/executor/ops/variables.d.ts +1 -0
- package/dist/esm/executor/ops/variables.js +18 -0
- package/dist/esm/executor/ops/variables.js.map +1 -0
- package/dist/esm/executor/opsRegistry.d.ts +33 -0
- package/dist/esm/executor/opsRegistry.js +9 -0
- package/dist/esm/executor/opsRegistry.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/parser/index.d.ts +3 -0
- package/dist/esm/parser/index.js +1 -0
- package/{build/parser.d.ts → dist/esm/parser/lisp.d.ts} +29 -42
- package/dist/esm/parser/lispTypes/conditionals.d.ts +2 -0
- package/dist/esm/parser/lispTypes/conditionals.js +137 -0
- package/dist/esm/parser/lispTypes/conditionals.js.map +1 -0
- package/dist/esm/parser/lispTypes/control.d.ts +2 -0
- package/dist/esm/parser/lispTypes/control.js +206 -0
- package/dist/esm/parser/lispTypes/control.js.map +1 -0
- package/dist/esm/parser/lispTypes/declarations.d.ts +2 -0
- package/dist/esm/parser/lispTypes/declarations.js +101 -0
- package/dist/esm/parser/lispTypes/declarations.js.map +1 -0
- package/dist/esm/parser/lispTypes/index.d.ts +3 -0
- package/dist/esm/parser/lispTypes/index.js +19 -0
- package/dist/esm/parser/lispTypes/index.js.map +1 -0
- package/dist/esm/parser/lispTypes/operators.d.ts +2 -0
- package/dist/esm/parser/lispTypes/operators.js +254 -0
- package/dist/esm/parser/lispTypes/operators.js.map +1 -0
- package/dist/esm/parser/lispTypes/shared.d.ts +38 -0
- package/dist/esm/parser/lispTypes/structures.d.ts +2 -0
- package/dist/esm/parser/lispTypes/structures.js +190 -0
- package/dist/esm/parser/lispTypes/structures.js.map +1 -0
- package/dist/esm/parser/lispTypes/values.d.ts +2 -0
- package/dist/esm/parser/lispTypes/values.js +91 -0
- package/dist/esm/parser/lispTypes/values.js.map +1 -0
- package/dist/esm/parser/parserUtils.d.ts +34 -0
- package/dist/esm/parser/parserUtils.js +959 -0
- package/dist/esm/parser/parserUtils.js.map +1 -0
- package/dist/esm/utils/CodeString.d.ts +16 -0
- package/dist/esm/utils/CodeString.js +66 -0
- package/dist/esm/utils/CodeString.js.map +1 -0
- package/dist/esm/utils/ExecContext.d.ts +34 -0
- package/dist/esm/utils/ExecContext.js +168 -0
- package/dist/esm/utils/ExecContext.js.map +1 -0
- package/dist/esm/utils/Prop.d.ts +16 -0
- package/dist/esm/utils/Prop.js +80 -0
- package/dist/esm/utils/Prop.js.map +1 -0
- package/dist/esm/utils/Scope.d.ts +47 -0
- package/dist/esm/utils/Scope.js +122 -0
- package/dist/esm/utils/Scope.js.map +1 -0
- package/dist/esm/utils/errors.d.ts +10 -0
- package/dist/esm/utils/errors.js +10 -0
- package/dist/esm/utils/errors.js.map +1 -0
- package/dist/esm/utils/functionReplacements.d.ts +11 -0
- package/dist/esm/utils/functionReplacements.js +361 -0
- package/dist/esm/utils/functionReplacements.js.map +1 -0
- package/dist/esm/utils/index.d.ts +7 -0
- package/dist/esm/utils/index.js +7 -0
- package/dist/esm/utils/types.d.ts +221 -0
- package/dist/esm/utils/types.js +160 -0
- package/dist/esm/utils/types.js.map +1 -0
- package/dist/esm/utils/unraw.js +147 -0
- package/dist/esm/utils/unraw.js.map +1 -0
- package/dist/umd/Sandbox.min.js +2 -0
- package/dist/umd/Sandbox.min.js.map +1 -0
- package/dist/umd/SandboxExec.min.js +2 -0
- package/dist/umd/SandboxExec.min.js.map +1 -0
- package/package.json +70 -68
- package/build/Sandbox.js +0 -62
- package/build/SandboxExec.js +0 -214
- package/build/eval.js +0 -205
- package/build/executor.d.ts +0 -124
- package/build/executor.js +0 -1546
- package/build/parser.js +0 -1527
- package/build/unraw.js +0 -168
- package/build/utils.d.ts +0 -264
- package/build/utils.js +0 -362
- package/dist/Sandbox.d.ts +0 -25
- package/dist/Sandbox.js +0 -270
- package/dist/Sandbox.js.map +0 -1
- package/dist/Sandbox.min.js +0 -2
- package/dist/Sandbox.min.js.map +0 -1
- package/dist/SandboxExec.js +0 -218
- package/dist/SandboxExec.js.map +0 -1
- package/dist/SandboxExec.min.js +0 -2
- package/dist/SandboxExec.min.js.map +0 -1
- package/dist/executor.d.ts +0 -124
- package/dist/executor.js +0 -1550
- package/dist/executor.js.map +0 -1
- package/dist/node/Sandbox.js +0 -277
- package/dist/node/SandboxExec.d.ts +0 -66
- package/dist/node/SandboxExec.js +0 -225
- package/dist/node/eval.d.ts +0 -27
- package/dist/node/executor.d.ts +0 -124
- package/dist/node/executor.js +0 -1567
- package/dist/node/parser.d.ts +0 -154
- package/dist/node/parser.js +0 -1704
- package/dist/node/utils.d.ts +0 -264
- package/dist/node/utils.js +0 -385
- package/dist/parser.js +0 -1690
- package/dist/parser.js.map +0 -1
- package/dist/unraw.d.ts +0 -11
- package/dist/utils.d.ts +0 -264
- package/dist/utils.js +0 -365
- package/dist/utils.js.map +0 -1
- /package/{build → dist/cjs/utils}/unraw.d.ts +0 -0
- /package/dist/{node → esm/utils}/unraw.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sandbox.min.js","names":[],"sources":["../../src/utils/unraw.ts","../../src/utils/errors.ts","../../src/utils/CodeString.ts","../../src/utils/types.ts","../../src/utils/functionReplacements.ts","../../src/utils/Prop.ts","../../src/utils/Scope.ts","../../src/utils/ExecContext.ts","../../src/executor/opsRegistry.ts","../../src/executor/ops/prop.ts","../../src/executor/ops/call.ts","../../src/executor/ops/object.ts","../../src/executor/ops/literals.ts","../../src/executor/ops/unary.ts","../../src/executor/ops/assignment.ts","../../src/executor/ops/comparison.ts","../../src/executor/ops/variables.ts","../../src/executor/ops/misc.ts","../../src/executor/ops/functions.ts","../../src/executor/ops/control.ts","../../src/executor/executorUtils.ts","../../src/parser/lispTypes/conditionals.ts","../../src/parser/lispTypes/control.ts","../../src/parser/lispTypes/declarations.ts","../../src/parser/lispTypes/operators.ts","../../src/parser/lispTypes/structures.ts","../../src/parser/lispTypes/values.ts","../../src/parser/lispTypes/index.ts","../../src/parser/parserUtils.ts","../../src/eval/index.ts","../../src/SandboxExec.ts","../../src/Sandbox.ts"],"sourcesContent":["/**\n * Parse a string as a base-16 number. This is more strict than `parseInt` as it\n * will not allow any other characters, including (for example) \"+\", \"-\", and\n * \".\".\n * @param hex A string containing a hexadecimal number.\n * @returns The parsed integer, or `NaN` if the string is not a valid hex\n * number.\n */\nfunction parseHexToInt(hex: string): number {\n const isOnlyHexChars = !hex.match(/[^a-f0-9]/i);\n return isOnlyHexChars ? parseInt(hex, 16) : NaN;\n}\n\n/**\n * Check the validity and length of a hexadecimal code and optionally enforces\n * a specific number of hex digits.\n * @param hex The string to validate and parse.\n * @param errorName The name of the error message to throw a `SyntaxError` with\n * if `hex` is invalid. This is used to index `errorMessages`.\n * @param enforcedLength If provided, will throw an error if `hex` is not\n * exactly this many characters.\n * @returns The parsed hex number as a normal number.\n * @throws {SyntaxError} If the code is not valid.\n */\nfunction validateAndParseHex(hex: string, errorName: string, enforcedLength?: number): number {\n const parsedHex = parseHexToInt(hex);\n if (Number.isNaN(parsedHex) || (enforcedLength !== undefined && enforcedLength !== hex.length)) {\n throw new SyntaxError(errorName + ': ' + hex);\n }\n return parsedHex;\n}\n\n/**\n * Parse a two-digit hexadecimal character escape code.\n * @param code The two-digit hexadecimal number that represents the character to\n * output.\n * @returns The single character represented by the code.\n * @throws {SyntaxError} If the code is not valid hex or is not the right\n * length.\n */\nfunction parseHexadecimalCode(code: string): string {\n const parsedCode = validateAndParseHex(code, 'Malformed Hexadecimal', 2);\n return String.fromCharCode(parsedCode);\n}\n\n/**\n * Parse a four-digit Unicode character escape code.\n * @param code The four-digit unicode number that represents the character to\n * output.\n * @param surrogateCode Optional four-digit unicode surrogate that represents\n * the other half of the character to output.\n * @returns The single character represented by the code.\n * @throws {SyntaxError} If the codes are not valid hex or are not the right\n * length.\n */\nfunction parseUnicodeCode(code: string, surrogateCode?: string): string {\n const parsedCode = validateAndParseHex(code, 'Malformed Unicode', 4);\n\n if (surrogateCode !== undefined) {\n const parsedSurrogateCode = validateAndParseHex(surrogateCode, 'Malformed Unicode', 4);\n return String.fromCharCode(parsedCode, parsedSurrogateCode);\n }\n\n return String.fromCharCode(parsedCode);\n}\n\n/**\n * Test if the text is surrounded by curly braces (`{}`).\n * @param text Text to check.\n * @returns `true` if the text is in the form `{*}`.\n */\nfunction isCurlyBraced(text: string): boolean {\n return text.charAt(0) === '{' && text.charAt(text.length - 1) === '}';\n}\n\n/**\n * Parse a Unicode code point character escape code.\n * @param codePoint A unicode escape code point, including the surrounding curly\n * braces.\n * @returns The single character represented by the code.\n * @throws {SyntaxError} If the code is not valid hex or does not have the\n * surrounding curly braces.\n */\nfunction parseUnicodeCodePointCode(codePoint: string): string {\n if (!isCurlyBraced(codePoint)) {\n throw new SyntaxError('Malformed Unicode: +' + codePoint);\n }\n const withoutBraces = codePoint.slice(1, -1);\n const parsedCode = validateAndParseHex(withoutBraces, 'Malformed Unicode');\n\n try {\n return String.fromCodePoint(parsedCode);\n } catch (err) {\n throw err instanceof RangeError ? new SyntaxError('Code Point Limit:' + parsedCode) : err;\n }\n}\n\n/**\n * Map of unescaped letters to their corresponding special JS escape characters.\n * Intentionally does not include characters that map to themselves like \"\\'\".\n */\nconst singleCharacterEscapes = new Map<string, string>([\n ['b', '\\b'],\n ['f', '\\f'],\n ['n', '\\n'],\n ['r', '\\r'],\n ['t', '\\t'],\n ['v', '\\v'],\n ['0', '\\0'],\n]);\n\n/**\n * Parse a single character escape sequence and return the matching character.\n * If none is matched, defaults to `code`.\n * @param code A single character code.\n */\nfunction parseSingleCharacterCode(code: string): string {\n return singleCharacterEscapes.get(code) || code;\n}\n\n/**\n * Matches every escape sequence possible, including invalid ones.\n *\n * All capture groups (described below) are unique (only one will match), except\n * for 4, which can only potentially match if 3 does.\n *\n * **Capture Groups:**\n * 0. A single backslash\n * 1. Hexadecimal code\n * 2. Unicode code point code with surrounding curly braces\n * 3. Unicode escape code with surrogate\n * 4. Surrogate code\n * 5. Unicode escape code without surrogate\n * 6. Octal code _NOTE: includes \"0\"._\n * 7. A single character (will never be \\, x, u, or 0-3)\n */\nconst escapeMatch =\n /\\\\(?:(\\\\)|x([\\s\\S]{0,2})|u(\\{[^}]*\\}?)|u([\\s\\S]{4})\\\\u([^{][\\s\\S]{0,3})|u([\\s\\S]{0,4})|([0-3]?[0-7]{1,2})|([\\s\\S])|$)/g;\n\n/**\n * Replace raw escape character strings with their escape characters.\n * @param raw A string where escape characters are represented as raw string\n * values like `\\'` rather than `'`.\n * @param allowOctals If `true`, will process the now-deprecated octal escape\n * sequences (ie, `\\111`).\n * @returns The processed string, with escape characters replaced by their\n * respective actual Unicode characters.\n */\nexport function unraw(raw: string): string {\n return raw.replace(\n escapeMatch,\n function (\n _,\n backslash?: string,\n hex?: string,\n codePoint?: string,\n unicodeWithSurrogate?: string,\n surrogate?: string,\n unicode?: string,\n octal?: string,\n singleCharacter?: string,\n ): string {\n // Compare groups to undefined because empty strings mean different errors\n // Otherwise, `\\u` would fail the same as `\\` which is wrong.\n if (backslash !== undefined) {\n return '\\\\';\n }\n if (hex !== undefined) {\n return parseHexadecimalCode(hex);\n }\n if (codePoint !== undefined) {\n return parseUnicodeCodePointCode(codePoint);\n }\n if (unicodeWithSurrogate !== undefined) {\n return parseUnicodeCode(unicodeWithSurrogate, surrogate);\n }\n if (unicode !== undefined) {\n return parseUnicodeCode(unicode);\n }\n if (octal === '0') {\n return '\\0';\n }\n if (octal !== undefined) {\n throw new SyntaxError('Octal Deprecation: ' + octal);\n }\n if (singleCharacter !== undefined) {\n return parseSingleCharacterCode(singleCharacter);\n }\n throw new SyntaxError('End of string');\n },\n );\n}\nexport default unraw;\n","import { IExecContext, IScope } from './types';\n\nexport class SandboxError extends Error {}\n\nexport class SandboxExecutionQuotaExceededError extends SandboxError {}\n\nexport class SandboxExecutionTreeError extends SandboxError {}\n\nexport class SandboxCapabilityError extends SandboxError {}\n\nexport class SandboxAccessError extends SandboxError {}\n","export class CodeString {\n start: number;\n end: number;\n ref: { str: string };\n constructor(str: string | CodeString) {\n this.ref = { str: '' };\n if (str instanceof CodeString) {\n this.ref = str.ref;\n this.start = str.start;\n this.end = str.end;\n } else {\n this.ref.str = str;\n this.start = 0;\n this.end = str.length;\n }\n }\n\n substring(start: number, end?: number): CodeString {\n if (!this.length) return this;\n start = this.start + start;\n if (start < 0) {\n start = 0;\n }\n if (start > this.end) {\n start = this.end;\n }\n end = end === undefined ? this.end : this.start + end;\n if (end < 0) {\n end = 0;\n }\n if (end > this.end) {\n end = this.end;\n }\n const code = new CodeString(this);\n code.start = start;\n code.end = end;\n return code;\n }\n\n get length() {\n const len = this.end - this.start;\n return len < 0 ? 0 : len;\n }\n\n char(i: number) {\n if (this.start === this.end) return undefined;\n return this.ref.str[this.start + i];\n }\n\n toString() {\n return this.ref.str.substring(this.start, this.end);\n }\n\n trimStart() {\n const found = /^\\s+/.exec(this.toString());\n const code = new CodeString(this);\n if (found) {\n code.start += found[0].length;\n }\n return code;\n }\n\n slice(start: number, end?: number) {\n if (start < 0) {\n start = this.end - this.start + start;\n }\n if (start < 0) {\n start = 0;\n }\n if (end === undefined) {\n end = this.end - this.start;\n }\n\n if (end < 0) {\n end = this.end - this.start + end;\n }\n if (end < 0) {\n end = 0;\n }\n return this.substring(start, end);\n }\n\n trim() {\n const code = this.trimStart();\n const found = /\\s+$/.exec(code.toString());\n if (found) {\n code.end -= found[0].length;\n }\n return code;\n }\n\n valueOf() {\n return this.toString();\n }\n}\n","// Reusable AsyncFunction constructor references\nexport const AsyncFunction: Function = Object.getPrototypeOf(async function () {}).constructor;\nexport const GeneratorFunction: Function = Object.getPrototypeOf(function* () {}).constructor;\nexport const AsyncGeneratorFunction: Function = Object.getPrototypeOf(\n async function* () {},\n).constructor;\n\nimport type { IEvalContext } from '../eval';\nimport type { Change } from '../executor';\nimport type { IExecutionTree } from '../parser';\nimport type SandboxExec from '../SandboxExec';\nimport type { Scope } from './Scope';\n\nexport interface IOptionParams {\n audit?: boolean;\n forbidFunctionCalls?: boolean;\n forbidFunctionCreation?: boolean;\n prototypeWhitelist?: Map<Function, Set<string>>;\n globals?: IGlobals;\n symbolWhitelist?: ISymbolWhitelist;\n executionQuota?: bigint;\n nonBlocking?: boolean;\n haltOnSandboxError?: boolean;\n maxParserRecursionDepth?: number;\n /**\n * Additional function replacements to merge with the built-in tick-checking replacements.\n * Maps a native function to a factory that receives the IContext and returns the replacement.\n * When sandboxed code accesses a property that returns a mapped function, the factory is\n * called once per context and the result is cached and returned instead.\n */\n functionReplacements?: Map<Function, (ctx: IContext) => Function>;\n}\n\nexport interface IOptions {\n audit: boolean;\n forbidFunctionCalls: boolean;\n forbidFunctionCreation: boolean;\n prototypeWhitelist: Map<Function, Set<PropertyKey>>;\n globals: IGlobals;\n symbolWhitelist: ISymbolWhitelist;\n executionQuota?: bigint;\n haltOnSandboxError?: boolean;\n maxParserRecursionDepth: number;\n nonBlocking: boolean;\n functionReplacements: Map<\n Function,\n (ctx: IExecContext, builtInReplacement?: Function) => Function\n >;\n}\n\nexport interface IContext {\n sandbox: SandboxExec;\n globalScope: Scope;\n sandboxGlobal: ISandboxGlobal;\n globalsWhitelist: Set<any>;\n prototypeWhitelist: Map<any, Set<PropertyKey>>;\n sandboxedFunctions: WeakSet<Function>;\n sandboxSymbols: SandboxSymbolContext;\n options: IOptions;\n auditReport?: IAuditReport;\n ticks: Ticks;\n}\n\nexport interface IAuditReport {\n globalsAccess: Set<unknown>;\n prototypeAccess: { [name: string]: Set<PropertyKey> };\n}\n\nexport interface Ticks {\n ticks: bigint;\n tickLimit?: bigint;\n nextYield?: bigint;\n}\n\nexport type SubscriptionSubject = object;\n\nexport type HaltContext =\n | {\n type: 'error';\n error: Error;\n ticks: Ticks;\n scope: Scope;\n context: IExecContext;\n }\n | {\n type: 'manual';\n error?: never;\n ticks?: never;\n scope?: never;\n context?: never;\n }\n | {\n type: 'yield';\n error?: never;\n ticks?: never;\n scope?: never;\n context?: never;\n };\n\nexport interface IExecContext extends IExecutionTree {\n ctx: IContext;\n getSubscriptions: Set<(obj: SubscriptionSubject, name: string) => void>;\n setSubscriptions: WeakMap<SubscriptionSubject, Map<string, Set<(modification: Change) => void>>>;\n changeSubscriptions: WeakMap<SubscriptionSubject, Set<(modification: Change) => void>>;\n setSubscriptionsGlobal: WeakMap<\n SubscriptionSubject,\n Map<string, Set<(modification: Change) => void>>\n >;\n changeSubscriptionsGlobal: WeakMap<SubscriptionSubject, Set<(modification: Change) => void>>;\n registerSandboxFunction: (fn: (...args: any[]) => any) => void;\n evals: Map<Function, Function>;\n allowJit: boolean;\n evalContext?: IEvalContext;\n}\n\nexport interface ISandboxGlobal {\n [key: string]: unknown;\n}\n\nexport interface ISymbolWhitelist {\n [key: string]: symbol;\n}\n\nexport interface SandboxSymbolContext {\n ctor?: Function;\n registry: Map<string, symbol>;\n reverseRegistry: Map<symbol, string>;\n whitelist: ISymbolWhitelist;\n}\n\nexport type IGlobals = ISandboxGlobal;\n\nexport interface IScope {\n [key: string]: any;\n}\n\nexport const NON_BLOCKING_THRESHOLD = 50_000n;\n\nexport const reservedWords = new Set([\n 'await',\n 'break',\n 'case',\n 'catch',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'else',\n 'enum',\n 'export',\n 'extends',\n 'false',\n 'finally',\n 'for',\n 'function',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'let',\n 'new',\n 'null',\n 'return',\n 'super',\n 'switch',\n 'this',\n 'throw',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'while',\n 'with',\n]);\n\nexport const enum VarType {\n let = 'let',\n const = 'const',\n var = 'var',\n internal = 'internal',\n}\n\nexport const enum LispType {\n None,\n Prop,\n StringIndex,\n Let,\n Const,\n Call,\n KeyVal,\n Number,\n Return,\n Assign,\n InlineFunction,\n ArrowFunction,\n CreateArray,\n If,\n IfCase,\n InlineIf,\n InlineIfCase,\n SpreadObject,\n SpreadArray,\n ArrayProp,\n PropOptional,\n CallOptional,\n CreateObject,\n Group,\n Not,\n IncrementBefore,\n IncrementAfter,\n DecrementBefore,\n DecrementAfter,\n And,\n Or,\n StrictNotEqual,\n StrictEqual,\n Plus,\n Var,\n GlobalSymbol,\n Literal,\n Function,\n Loop,\n Try,\n Switch,\n SwitchCase,\n InternalBlock,\n Expression,\n Await,\n New,\n Throw,\n Minus,\n Divide,\n Power,\n Multiply,\n Modulus,\n Equal,\n NotEqual,\n SmallerEqualThan,\n LargerEqualThan,\n SmallerThan,\n LargerThan,\n Negative,\n Positive,\n Typeof,\n Delete,\n Instanceof,\n In,\n Inverse,\n SubractEquals,\n AddEquals,\n DivideEquals,\n PowerEquals,\n MultiplyEquals,\n ModulusEquals,\n BitNegateEquals,\n BitAndEquals,\n BitOrEquals,\n UnsignedShiftRightEquals,\n ShiftRightEquals,\n ShiftLeftEquals,\n BitAnd,\n BitOr,\n BitNegate,\n BitShiftLeft,\n BitShiftRight,\n BitUnsignedShiftRight,\n BigInt,\n LiteralIndex,\n RegexIndex,\n LoopAction,\n Void,\n True,\n NullishCoalescing,\n AndEquals,\n OrEquals,\n NullishCoalescingEquals,\n Block,\n Labeled,\n Internal,\n Yield,\n YieldDelegate,\n Hole,\n\n LispEnumSize,\n}\n","import type { IContext, IExecContext } from './types';\nimport { SandboxExecutionQuotaExceededError } from './errors';\n\n/**\n * Checks if adding `expectTicks` would exceed the tick limit, and throws SandboxExecutionQuotaExceededError\n * (which bypasses user try/catch) if so. Otherwise increments the tick counter.\n */\nexport function checkTicksAndThrow(ctx: IExecContext, expectTicks: bigint): void {\n const { ticks } = ctx.ctx;\n if (ticks.tickLimit !== undefined && ticks.tickLimit <= ticks.ticks + expectTicks) {\n throw new SandboxExecutionQuotaExceededError('Execution quota exceeded');\n }\n ticks.ticks += expectTicks;\n}\n\n// ---------------------------------------------------------------------------\n// TypedArray shared prototype detection (mirrors call.ts)\n// ---------------------------------------------------------------------------\n\nconst _typedArrayCtors = [\n Int8Array,\n Uint8Array,\n Uint8ClampedArray,\n Int16Array,\n Uint16Array,\n Int32Array,\n Uint32Array,\n Float32Array,\n Float64Array,\n];\nexport const typedArrayProtos = new Set(\n _typedArrayCtors.map((T) => Object.getPrototypeOf(T.prototype) as any),\n);\n\nfunction isTypedArray(obj: unknown): obj is { length: number } {\n return (\n ArrayBuffer.isView(obj) &&\n !(obj instanceof DataView) &&\n typedArrayProtos.has(Object.getPrototypeOf(Object.getPrototypeOf(obj)))\n );\n}\n\n// ---------------------------------------------------------------------------\n// Helpers to build replacements\n// ---------------------------------------------------------------------------\n\ntype Factory = (ctx: IExecContext) => Function;\n\nfunction makeReplacement(\n original: Function,\n getTicks: (thisArg: unknown, args: unknown[]) => bigint,\n): Factory {\n return (ctx: IExecContext) =>\n function (this: unknown, ...args: unknown[]) {\n checkTicksAndThrow(ctx, getTicks(this, args));\n return (original as any).apply(this, args);\n };\n}\n\n// ---------------------------------------------------------------------------\n// Array replacements\n// ---------------------------------------------------------------------------\n\nconst arr: any[] = [];\nconst arrProto = Array.prototype as any;\n\nfunction arrayTicks(\n complexity: 'one' | 'n' | 'nlogn' | 'arrs',\n original: Function,\n): (thisArg: unknown, args: unknown[]) => bigint {\n return (thisArg, args) => {\n if (!Array.isArray(thisArg)) return 0n;\n const n = BigInt(thisArg.length);\n switch (complexity) {\n case 'one':\n return 1n;\n case 'n':\n return n;\n case 'nlogn':\n return thisArg.length <= 1 ? 1n : n * BigInt(Math.round(Math.log2(thisArg.length)));\n case 'arrs': {\n let ticks = 0n;\n const maxDepth = original === arr.flat ? (typeof args[0] === 'number' ? args[0] : 1) : 1;\n const recurse = (a: unknown[], depth = 0) => {\n ticks += BigInt(a.length);\n if (depth >= maxDepth) return;\n for (const item of a) {\n if (Array.isArray(item)) recurse(item, depth + 1);\n }\n };\n recurse(thisArg);\n return ticks;\n }\n }\n };\n}\n\nconst arrayReplacementDefs: [Function, 'one' | 'n' | 'nlogn' | 'arrs'][] = [\n // O(1)\n [arr.push, 'one'],\n [arr.pop, 'one'],\n [arrProto.at, 'one'],\n // O(n)\n [arr.fill, 'n'],\n [arr.includes, 'n'],\n [arr.indexOf, 'n'],\n [arr.lastIndexOf, 'n'],\n [arr.find, 'n'],\n [arr.findIndex, 'n'],\n [arrProto.findLast, 'n'],\n [arrProto.findLastIndex, 'n'],\n [arr.forEach, 'n'],\n [arr.map, 'n'],\n [arr.filter, 'n'],\n [arr.reduce, 'n'],\n [arr.reduceRight, 'n'],\n [arr.every, 'n'],\n [arr.some, 'n'],\n [arr.join, 'n'],\n [arr.reverse, 'n'],\n [arr.shift, 'n'],\n [arr.unshift, 'n'],\n [arr.splice, 'n'],\n [arr.slice, 'n'],\n [arr.copyWithin, 'n'],\n [arr.entries, 'n'],\n [arr.keys, 'n'],\n [arr.values, 'n'],\n [arrProto.toReversed, 'n'],\n [arrProto.toSpliced, 'n'],\n [arrProto.with, 'n'],\n [arr.toString, 'n'],\n [arr.toLocaleString, 'n'],\n // O(n log n)\n [arr.sort, 'nlogn'],\n [arrProto.toSorted, 'nlogn'],\n // O(n) across arrays\n [arr.flat, 'arrs'],\n [arr.flatMap, 'arrs'],\n [arr.concat, 'arrs'],\n];\n\n// ---------------------------------------------------------------------------\n// String replacements\n// ---------------------------------------------------------------------------\n\nconst str = '';\nconst strProto = String.prototype as any;\n\nfunction stringTicks(complexity: 'one' | 'n'): (thisArg: unknown, _args: unknown[]) => bigint {\n return (thisArg) => {\n if (typeof thisArg !== 'string') return 0n;\n return complexity === 'one' ? 1n : BigInt(thisArg.length);\n };\n}\n\nconst stringReplacementDefs: [Function, 'one' | 'n'][] = [\n // O(1)\n [str.charAt, 'one'],\n [str.charCodeAt, 'one'],\n [str.codePointAt, 'one'],\n [strProto.at, 'one'],\n // O(n)\n [str.indexOf, 'n'],\n [str.lastIndexOf, 'n'],\n [str.includes, 'n'],\n [str.startsWith, 'n'],\n [str.endsWith, 'n'],\n [str.slice, 'n'],\n [str.substring, 'n'],\n [str.padStart, 'n'],\n [str.padEnd, 'n'],\n [str.repeat, 'n'],\n [str.split, 'n'],\n [str.replace, 'n'],\n [strProto.replaceAll, 'n'],\n [str.match, 'n'],\n [str.matchAll, 'n'],\n [str.search, 'n'],\n [str.trim, 'n'],\n [str.trimStart, 'n'],\n [str.trimEnd, 'n'],\n [str.toLowerCase, 'n'],\n [str.toUpperCase, 'n'],\n [str.toLocaleLowerCase, 'n'],\n [str.toLocaleUpperCase, 'n'],\n [str.normalize, 'n'],\n [str.concat, 'n'],\n [str.toString, 'n'],\n [str.valueOf, 'n'],\n];\n\n// ---------------------------------------------------------------------------\n// Map replacements\n// ---------------------------------------------------------------------------\n\nconst _map = new Map<never, never>();\n\nconst mapReplacementDefs: [Function, 'one' | 'n'][] = [\n [_map.get, 'one'],\n [_map.set, 'one'],\n [_map.has, 'one'],\n [_map.delete, 'one'],\n [_map.keys, 'n'],\n [_map.values, 'n'],\n [_map.entries, 'n'],\n [_map.forEach, 'n'],\n [_map.clear, 'n'],\n];\n\nfunction mapTicks(complexity: 'one' | 'n'): (thisArg: unknown, _args: unknown[]) => bigint {\n return (thisArg) => {\n if (!(thisArg instanceof Map)) return 0n;\n return complexity === 'one' ? 1n : BigInt(thisArg.size);\n };\n}\n\n// ---------------------------------------------------------------------------\n// Set replacements\n// ---------------------------------------------------------------------------\n\nconst _set = new Set<never>();\n\nconst setReplacementDefs: [Function, 'one' | 'n'][] = [\n [_set.add, 'one'],\n [_set.has, 'one'],\n [_set.delete, 'one'],\n [_set.values, 'n'],\n [_set.keys, 'n'],\n [_set.entries, 'n'],\n [_set.forEach, 'n'],\n [_set.clear, 'n'],\n];\n\nfunction setTicks(complexity: 'one' | 'n'): (thisArg: unknown, _args: unknown[]) => bigint {\n return (thisArg) => {\n if (!(thisArg instanceof Set)) return 0n;\n return complexity === 'one' ? 1n : BigInt(thisArg.size);\n };\n}\n\n// ---------------------------------------------------------------------------\n// TypedArray replacements\n// ---------------------------------------------------------------------------\n\nconst typedArrayReplacementDefs: [Function, 'one' | 'n' | 'nlogn'][] = [];\nfor (const proto of typedArrayProtos) {\n if (proto.at) typedArrayReplacementDefs.push([proto.at, 'one']);\n if (proto.set) typedArrayReplacementDefs.push([proto.set, 'one']);\n const nMethods = [\n 'fill',\n 'find',\n 'findIndex',\n 'findLast',\n 'findLastIndex',\n 'includes',\n 'indexOf',\n 'lastIndexOf',\n 'forEach',\n 'map',\n 'filter',\n 'reduce',\n 'reduceRight',\n 'every',\n 'some',\n 'join',\n 'reverse',\n 'slice',\n 'subarray',\n 'copyWithin',\n 'entries',\n 'keys',\n 'values',\n 'toReversed',\n 'with',\n 'toString',\n 'toLocaleString',\n ] as const;\n for (const m of nMethods) {\n if (proto[m]) typedArrayReplacementDefs.push([proto[m], 'n']);\n }\n if (proto.sort) typedArrayReplacementDefs.push([proto.sort, 'nlogn']);\n if (proto.toSorted) typedArrayReplacementDefs.push([proto.toSorted, 'nlogn']);\n}\n\nfunction typedArrayTicks(\n complexity: 'one' | 'n' | 'nlogn',\n): (thisArg: unknown, _args: unknown[]) => bigint {\n return (thisArg) => {\n if (!isTypedArray(thisArg)) return 0n;\n const n = BigInt(thisArg.length);\n switch (complexity) {\n case 'one':\n return 1n;\n case 'n':\n return n;\n case 'nlogn':\n return (thisArg as any).length <= 1\n ? 1n\n : n * BigInt(Math.round(Math.log2((thisArg as any).length)));\n }\n };\n}\n\n// ---------------------------------------------------------------------------\n// Math replacements\n// ---------------------------------------------------------------------------\n\nconst mathReplacementDefs: [Function][] = [[Math.max], [Math.min], [Math.hypot]];\n\n// ---------------------------------------------------------------------------\n// JSON replacements\n// ---------------------------------------------------------------------------\n\n// (JSON.stringify with subscription traversal is handled separately in LispType.Call)\n\n// ---------------------------------------------------------------------------\n// RegExp replacements\n// ---------------------------------------------------------------------------\n\nconst _re = /x/;\n\nconst regexpReplacementDefs: Function[] = [\n _re.exec,\n _re.test,\n (_re as any)[Symbol.match],\n (_re as any)[Symbol.matchAll],\n (_re as any)[Symbol.replace],\n (_re as any)[Symbol.search],\n (_re as any)[Symbol.split],\n];\n\n// ---------------------------------------------------------------------------\n// Promise replacements\n// ---------------------------------------------------------------------------\n\nconst promiseReplacementDefs: Function[] = [\n Promise.all,\n Promise.allSettled,\n Promise.race,\n ...(typeof (Promise as any).any === 'function' ? [(Promise as any).any] : []),\n];\n\n// ---------------------------------------------------------------------------\n// Object replacements\n// ---------------------------------------------------------------------------\n\nconst objectReplacementDefs: [Function, 'one' | 'n'][] = [\n [Object.prototype.hasOwnProperty, 'one'],\n [Object.prototype.propertyIsEnumerable, 'one'],\n [Object.prototype.isPrototypeOf, 'one'],\n [Object.create, 'one'],\n [Object.getPrototypeOf, 'one'],\n [Object.setPrototypeOf, 'one'],\n [Object.is, 'one'],\n [Object.defineProperty, 'one'],\n [Object.getOwnPropertyDescriptor, 'one'],\n [Object.isExtensible, 'one'],\n [Object.preventExtensions, 'one'],\n [Object.keys, 'n'],\n [Object.values, 'n'],\n [Object.entries, 'n'],\n [Object.assign, 'n'],\n [Object.fromEntries, 'n'],\n [Object.getOwnPropertyNames, 'n'],\n [Object.getOwnPropertySymbols, 'n'],\n [Object.getOwnPropertyDescriptors, 'n'],\n [Object.freeze, 'n'],\n [Object.seal, 'n'],\n [Object.isFrozen, 'n'],\n [Object.isSealed, 'n'],\n];\n\nfunction objectTicks(\n complexity: 'one' | 'n',\n isStatic: boolean,\n): (thisArg: unknown, args: unknown[]) => bigint {\n return (thisArg, args) => {\n if (complexity === 'one') return 1n;\n const target = isStatic ? args[0] : thisArg;\n if (target !== null && typeof target === 'object')\n return BigInt(Object.keys(target as object).length);\n return 1n;\n };\n}\n\n// Static Object methods whose tick count is based on args[0] key count\nconst staticObjectMethods = new Set<Function>([\n Object.keys,\n Object.values,\n Object.entries,\n Object.assign,\n Object.fromEntries,\n Object.getOwnPropertyNames,\n Object.getOwnPropertySymbols,\n Object.getOwnPropertyDescriptors,\n Object.freeze,\n Object.seal,\n Object.isFrozen,\n Object.isSealed,\n]);\n\n// ---------------------------------------------------------------------------\n// Array.from / Array.fromAsync\n// ---------------------------------------------------------------------------\n\n// ---------------------------------------------------------------------------\n// Build the default replacements map\n// ---------------------------------------------------------------------------\n\nexport const DEFAULT_FUNCTION_REPLACEMENTS = new Map<Function, Factory>();\nexport const THIS_DEPENDENT_FUNCTION_REPLACEMENTS = new Set<Function>();\n\n// Array\nfor (const [original, complexity] of arrayReplacementDefs) {\n if (!original) continue;\n DEFAULT_FUNCTION_REPLACEMENTS.set(\n original,\n makeReplacement(original, arrayTicks(complexity, original)),\n );\n THIS_DEPENDENT_FUNCTION_REPLACEMENTS.add(original);\n}\n\n// String\nfor (const [original, complexity] of stringReplacementDefs) {\n if (!original) continue;\n DEFAULT_FUNCTION_REPLACEMENTS.set(original, makeReplacement(original, stringTicks(complexity)));\n THIS_DEPENDENT_FUNCTION_REPLACEMENTS.add(original);\n}\n\n// Map\nfor (const [original, complexity] of mapReplacementDefs) {\n if (!original) continue;\n DEFAULT_FUNCTION_REPLACEMENTS.set(original, makeReplacement(original, mapTicks(complexity)));\n THIS_DEPENDENT_FUNCTION_REPLACEMENTS.add(original);\n}\n\n// Set\nfor (const [original, complexity] of setReplacementDefs) {\n if (!original) continue;\n DEFAULT_FUNCTION_REPLACEMENTS.set(original, makeReplacement(original, setTicks(complexity)));\n THIS_DEPENDENT_FUNCTION_REPLACEMENTS.add(original);\n}\n\n// TypedArray\nfor (const [original, complexity] of typedArrayReplacementDefs) {\n if (!original) continue;\n DEFAULT_FUNCTION_REPLACEMENTS.set(\n original,\n makeReplacement(original, typedArrayTicks(complexity)),\n );\n THIS_DEPENDENT_FUNCTION_REPLACEMENTS.add(original);\n}\n\n// Math — O(n) on arg count\nfor (const [original] of mathReplacementDefs) {\n if (!original) continue;\n DEFAULT_FUNCTION_REPLACEMENTS.set(\n original,\n makeReplacement(original, (_thisArg, args) => BigInt(args.length)),\n );\n}\n\n// JSON — O(n) on string/object size\nfor (const original of [JSON.parse, JSON.stringify]) {\n DEFAULT_FUNCTION_REPLACEMENTS.set(\n original,\n makeReplacement(original, (_thisArg, args) => {\n const target = args[0];\n if (typeof target === 'string') return BigInt(target.length);\n if (target !== null && typeof target === 'object')\n return BigInt(Object.keys(target as object).length);\n return 1n;\n }),\n );\n}\n\n// RegExp — O(n) on input string length\nfor (const original of regexpReplacementDefs) {\n if (!original) continue;\n DEFAULT_FUNCTION_REPLACEMENTS.set(\n original,\n makeReplacement(original, (_thisArg, args) => {\n const input = args[0];\n return typeof input === 'string' ? BigInt(input.length) : 1n;\n }),\n );\n THIS_DEPENDENT_FUNCTION_REPLACEMENTS.add(original);\n}\n\n// Promise.all/allSettled/race/any — O(n) on iterable length\nfor (const original of promiseReplacementDefs) {\n if (!original) continue;\n DEFAULT_FUNCTION_REPLACEMENTS.set(\n original,\n makeReplacement(original, (_thisArg, args) => {\n const iterable = args[0];\n return Array.isArray(iterable) ? BigInt(iterable.length) : 0n;\n }),\n );\n}\n\n// Object static & instance methods\nfor (const [original, complexity] of objectReplacementDefs) {\n if (!original) continue;\n const isStatic = staticObjectMethods.has(original);\n DEFAULT_FUNCTION_REPLACEMENTS.set(\n original,\n makeReplacement(original, objectTicks(complexity, isStatic)),\n );\n if (!isStatic) {\n THIS_DEPENDENT_FUNCTION_REPLACEMENTS.add(original);\n }\n}\n\n// Array.from — O(n) on source length\nif (Array.from) {\n DEFAULT_FUNCTION_REPLACEMENTS.set(\n Array.from,\n makeReplacement(Array.from, (_thisArg, args) => {\n const source = args[0];\n if (source != null && typeof (source as any).length === 'number')\n return BigInt((source as any).length);\n return 0n;\n }),\n );\n}\n\n// Array.fromAsync — O(n) on source length (if available)\nif (typeof (Array as any).fromAsync === 'function') {\n const fromAsync = (Array as any).fromAsync as Function;\n DEFAULT_FUNCTION_REPLACEMENTS.set(\n fromAsync,\n makeReplacement(fromAsync, (_thisArg, args) => {\n const source = args[0];\n if (source != null && typeof (source as any).length === 'number')\n return BigInt((source as any).length);\n return 0n;\n }),\n );\n}\n","import type { IExecContext } from './types';\nimport { THIS_DEPENDENT_FUNCTION_REPLACEMENTS } from './functionReplacements';\n\nconst boundFunctionCache = new WeakMap<Function, WeakMap<object, Function>>();\nconst replacementReceiver = new WeakMap<Function, object>();\n\nexport class Prop<T = unknown> {\n constructor(\n public context: T,\n public prop: PropertyKey,\n public isConst = false,\n public isGlobal = false,\n public isVariable = false,\n public isInternal = false,\n ) {}\n\n get<T = unknown>(context: IExecContext): T {\n const ctx = this.context;\n if (ctx === undefined) throw new ReferenceError(`${this.prop.toString()} is not defined`);\n if (ctx === null)\n throw new TypeError(`Cannot read properties of null, (reading '${this.prop.toString()}')`);\n context.getSubscriptions.forEach((cb) => cb(ctx, this.prop.toString()));\n const val = (ctx as any)[this.prop];\n return getReplacementValue(val, context, ctx) as T;\n }\n}\n\nexport function hasOwnProperty(obj: unknown, prop: PropertyKey): boolean {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nexport function getReplacementReceiver(fn: Function) {\n return replacementReceiver.get(fn);\n}\n\nexport function resolveSandboxProp(val: unknown, context: IExecContext, prop?: Prop) {\n if (!val) return;\n if (val instanceof Prop) {\n if (!prop) {\n prop = val;\n }\n val = val.get(context);\n }\n const p = prop?.prop || 'prop';\n if (val === globalThis) {\n return new Prop(\n {\n [p]: context.ctx.sandboxGlobal,\n },\n p,\n prop?.isConst || false,\n false,\n prop?.isVariable || false,\n );\n }\n if (prop && !prop.isVariable) {\n return;\n }\n const replacement = getReplacementValue(val, context, prop?.context);\n if (replacement !== val) {\n return new Prop(\n { [p]: replacement },\n p,\n prop?.isConst || false,\n prop?.isGlobal || false,\n prop?.isVariable || false,\n );\n }\n}\n\nfunction getReplacementValue(val: unknown, context: IExecContext, bindContext?: unknown) {\n if (typeof val !== 'function') {\n return val;\n }\n const replacement = context.evals.get(val as Function);\n if (replacement === undefined) {\n return val;\n }\n if (!shouldBindReplacement(val as Function, bindContext, context)) {\n return replacement;\n }\n return bindReplacement(replacement, bindContext as object, val as Function, context);\n}\n\nfunction shouldBindReplacement(original: Function, bindContext: unknown, context: IExecContext) {\n return (\n THIS_DEPENDENT_FUNCTION_REPLACEMENTS.has(original) &&\n bindContext !== null &&\n (typeof bindContext === 'object' || typeof bindContext === 'function') &&\n bindContext !== context.ctx.sandboxGlobal &&\n !context.ctx.globalsWhitelist.has(bindContext)\n );\n}\n\nfunction bindReplacement(\n replacement: Function,\n bindContext: object,\n original: Function,\n context: IExecContext,\n) {\n let cache = boundFunctionCache.get(replacement);\n if (!cache) {\n cache = new WeakMap<object, Function>();\n boundFunctionCache.set(replacement, cache);\n }\n\n let bound = cache.get(bindContext);\n if (bound) {\n return bound;\n }\n\n bound = function (this: unknown, ...args: unknown[]) {\n return replacement.apply(this, args);\n };\n\n redefineFunctionMetadata(bound, original);\n context.ctx.sandboxedFunctions.add(bound);\n replacementReceiver.set(bound, bindContext);\n cache.set(bindContext, bound);\n return bound;\n}\n\nfunction redefineFunctionMetadata(\n target: Function,\n source: Function,\n overrides: Partial<Record<'name' | 'length', string | number>> = {},\n) {\n for (const key of ['name', 'length'] as const) {\n const descriptor = Object.getOwnPropertyDescriptor(source, key);\n if (descriptor?.configurable) {\n Object.defineProperty(target, key, {\n ...descriptor,\n value: overrides[key] ?? source[key],\n });\n }\n }\n}\n","import { reservedWords, VarType } from './types';\nimport { Prop, resolveSandboxProp, hasOwnProperty } from './Prop';\nimport { SandboxError } from './errors';\nimport type { IExecContext, IScope } from './types';\n\nfunction keysOnly(obj: unknown): Record<string, true> {\n const ret: Record<string, true> = Object.assign({}, obj);\n for (const key in ret) {\n ret[key] = true;\n }\n return ret;\n}\n\nexport type Unknown = undefined | null | Record<string | number, unknown>;\n\nexport class Scope {\n parent: Scope | null;\n const: { [key: string]: true } = {};\n let: { [key: string]: true } = {};\n var: { [key: string]: true } = {};\n internal: { [key: string]: true } = {};\n globals: { [key: string]: true };\n allVars: { [key: string]: unknown } & object;\n internalVars: { [key: string]: unknown } = {};\n functionThis?: Unknown;\n constructor(parent: Scope | null, vars = {}, functionThis?: Unknown) {\n const isFuncScope = functionThis !== undefined || parent === null;\n this.parent = parent;\n this.allVars = vars;\n this.let = isFuncScope ? this.let : keysOnly(vars);\n this.var = isFuncScope ? keysOnly(vars) : this.var;\n this.globals = parent === null ? keysOnly(vars) : {};\n this.functionThis = functionThis;\n }\n\n get(key: string, internal: boolean): Prop {\n const isThis = key === 'this';\n const scope = this.getWhereValScope(key, isThis, internal);\n if (scope && isThis) {\n return new Prop({ this: scope.functionThis }, key, false, false, true);\n }\n if (!scope) {\n return new Prop(undefined, key);\n }\n if (internal && scope.internalVars[key]) {\n return new Prop(scope.internalVars, key, false, false, true, true);\n }\n return new Prop(\n scope.allVars,\n key,\n hasOwnProperty(scope.const, key),\n hasOwnProperty(scope.globals, key),\n true,\n );\n }\n\n set(key: string, val: unknown, internal: boolean) {\n if (key === 'this') throw new SyntaxError('\"this\" cannot be assigned');\n if (reservedWords.has(key)) throw new SyntaxError(\"Unexepected token '\" + key + \"'\");\n const prop = this.get(key, internal);\n if (prop.context === undefined) {\n throw new ReferenceError(`Variable '${key}' was not declared.`);\n }\n if (prop.context === null) {\n throw new TypeError(`Cannot set properties of null, (setting '${key}')`);\n }\n if (prop.isConst) {\n throw new TypeError(`Assignment to constant variable`);\n }\n if (prop.isGlobal) {\n throw new SandboxError(`Cannot override global variable '${key}'`);\n }\n (prop.context as any)[prop.prop] = val;\n return prop;\n }\n\n getWhereValScope(key: string, isThis: boolean, internal: boolean): Scope | null {\n let scope: Scope = this;\n if (isThis) {\n do {\n if (scope.functionThis !== undefined) return scope;\n scope = scope.parent!;\n } while (scope !== null);\n return null;\n }\n do {\n if (\n internal &&\n key in scope.internalVars &&\n !(key in {} && !hasOwnProperty(scope.internalVars, key))\n ) {\n return scope;\n }\n if (key in scope.allVars && !(key in {} && !hasOwnProperty(scope.allVars, key))) {\n return scope;\n }\n scope = scope.parent!;\n } while (scope !== null);\n return null;\n }\n\n getWhereVarScope(key: string, localScope: boolean, internal: boolean): Scope {\n let scope: Scope = this;\n do {\n if (\n internal &&\n key in scope.internalVars &&\n !(key in {} && !hasOwnProperty(scope.internalVars, key))\n ) {\n return scope;\n }\n if (key in scope.allVars && !(key in {} && !hasOwnProperty(scope.allVars, key))) {\n return scope;\n }\n if (scope.parent === null || localScope || scope.functionThis !== undefined) {\n return scope;\n }\n scope = scope.parent!;\n } while (scope !== null);\n return scope;\n }\n\n declare(key: string, type: VarType, value: unknown, isGlobal: boolean, internal: boolean): Prop {\n if (key === 'this') throw new SyntaxError('\"this\" cannot be declared');\n if (reservedWords.has(key)) throw new SyntaxError(\"Unexepected token '\" + key + \"'\");\n const existingScope = this.getWhereVarScope(key, type !== VarType.var, internal);\n if (type === VarType.var) {\n if (existingScope.var[key]) {\n existingScope.allVars[key] = value;\n if (!isGlobal) {\n delete existingScope.globals[key];\n } else {\n existingScope.globals[key] = true;\n }\n return new Prop(existingScope.allVars, key, false, existingScope.globals[key], true);\n } else if (key in existingScope.allVars) {\n throw new SyntaxError(`Identifier '${key}' has already been declared`);\n }\n }\n if (key in existingScope.allVars || key in existingScope.internalVars) {\n throw new SyntaxError(`Identifier '${key}' has already been declared`);\n }\n\n if (isGlobal) {\n existingScope.globals[key] = true;\n }\n existingScope[type][key] = true;\n if (type === VarType.internal) {\n existingScope.internalVars[key] = value;\n } else {\n existingScope.allVars[key] = value;\n }\n\n return new Prop(\n type === VarType.internal ? this.internalVars : this.allVars,\n key,\n type === VarType.const,\n isGlobal,\n true,\n type === VarType.internal,\n );\n }\n}\n\nexport class FunctionScope implements IScope {}\n\nexport class LocalScope implements IScope {}\n\nexport const optional = {};\n\nexport class DelayedSynchronousResult {\n readonly result: unknown;\n constructor(cb: () => unknown) {\n this.result = cb();\n }\n}\n\nexport function delaySynchronousResult(cb: () => Promise<unknown>) {\n return new DelayedSynchronousResult(cb);\n}\n\nexport function sanitizeProp(\n value: unknown,\n context: IExecContext,\n cache = new WeakSet<object>(),\n): unknown {\n if (value === null || (typeof value !== 'object' && typeof value !== 'function')) return value;\n\n value = resolveSandboxProp(value, context) || value;\n\n if (value instanceof Prop) {\n value = value.get(context);\n }\n\n if (value === optional) {\n return undefined;\n }\n\n return value;\n}\n\nexport function sanitizeScope(scope: IScope, context: IExecContext, cache = new WeakSet<object>()) {\n if (cache.has(scope)) return;\n cache.add(scope);\n for (const key in scope) {\n const val = scope[key];\n if (val !== null && typeof val === 'object') {\n sanitizeScope(val, context, cache);\n }\n scope[key] = sanitizeProp(val, context);\n }\n}\n\nexport function sanitizeScopes(\n scopes: IScope[],\n context: IExecContext,\n cache = new WeakSet<object>(),\n) {\n for (const scope of scopes) {\n sanitizeScope(scope, context, cache);\n }\n}\n","import type { IEvalContext } from '../eval';\nimport type { Change } from '../executor';\nimport { DEFAULT_FUNCTION_REPLACEMENTS } from './functionReplacements';\nimport type { IConstants, IExecutionTree, Lisp, LispItem } from '../parser';\nimport type SandboxExec from '../SandboxExec';\nimport {\n AsyncFunction,\n GeneratorFunction,\n AsyncGeneratorFunction,\n NON_BLOCKING_THRESHOLD,\n LispType,\n type IContext,\n type IExecContext,\n type IOptions,\n type ISymbolWhitelist,\n type ISandboxGlobal,\n type SandboxSymbolContext,\n type SubscriptionSubject,\n} from './types';\nimport { Scope } from './Scope';\nimport { hasOwnProperty } from './Prop';\n\nexport class ExecContext implements IExecContext {\n constructor(\n public ctx: IContext,\n public constants: IConstants,\n public tree: Lisp[],\n public getSubscriptions: Set<(obj: SubscriptionSubject, name: string) => void>,\n public setSubscriptions: WeakMap<\n SubscriptionSubject,\n Map<string, Set<(modification: Change) => void>>\n >,\n public changeSubscriptions: WeakMap<SubscriptionSubject, Set<(modification: Change) => void>>,\n public setSubscriptionsGlobal: WeakMap<\n SubscriptionSubject,\n Map<string, Set<(modification: Change) => void>>\n >,\n public changeSubscriptionsGlobal: WeakMap<\n SubscriptionSubject,\n Set<(modification: Change) => void>\n >,\n public evals: Map<any, any>,\n public registerSandboxFunction: (fn: (...args: any[]) => any) => void,\n public allowJit: boolean,\n public evalContext?: IEvalContext,\n ) {}\n}\n\nfunction createSandboxSymbolContext(symbolWhitelist: ISymbolWhitelist): SandboxSymbolContext {\n return {\n registry: new Map<string, symbol>(),\n reverseRegistry: new Map<symbol, string>(),\n whitelist: { ...symbolWhitelist },\n };\n}\n\nconst RESERVED_SYMBOL_PROPERTIES = new Set(['length', 'name', 'prototype', 'for', 'keyFor']);\n\nfunction copyWhitelistedSymbols(target: Function, symbolWhitelist: ISymbolWhitelist) {\n for (const [key, value] of Object.entries(symbolWhitelist)) {\n if (RESERVED_SYMBOL_PROPERTIES.has(key)) continue;\n const descriptor = Object.getOwnPropertyDescriptor(Symbol, key);\n if (descriptor) {\n Object.defineProperty(target, key, descriptor);\n }\n }\n}\n\nexport function getSandboxSymbolCtor(symbols: SandboxSymbolContext) {\n if (symbols.ctor) {\n return symbols.ctor;\n }\n\n function SandboxSymbol(this: unknown, description?: unknown) {\n if (new.target) {\n throw new TypeError('Symbol is not a constructor');\n }\n return Symbol(description === undefined ? undefined : String(description));\n }\n\n copyWhitelistedSymbols(SandboxSymbol, symbols.whitelist);\n Object.defineProperties(SandboxSymbol, {\n prototype: {\n value: Symbol.prototype,\n enumerable: false,\n configurable: false,\n writable: false,\n },\n for: {\n value(key: unknown) {\n const stringKey = String(key);\n let symbol = symbols.registry.get(stringKey);\n if (!symbol) {\n symbol = Symbol(stringKey);\n symbols.registry.set(stringKey, symbol);\n symbols.reverseRegistry.set(symbol, stringKey);\n }\n return symbol;\n },\n enumerable: false,\n configurable: true,\n writable: true,\n },\n keyFor: {\n value(symbol: unknown) {\n return typeof symbol === 'symbol' ? symbols.reverseRegistry.get(symbol) : undefined;\n },\n enumerable: false,\n configurable: true,\n writable: true,\n },\n });\n\n symbols.ctor = SandboxSymbol;\n return SandboxSymbol;\n}\n\nfunction SandboxGlobal() {}\ninterface SandboxGlobalConstructor {\n new (): ISandboxGlobal;\n}\nexport function sandboxedGlobal(globals: ISandboxGlobal): SandboxGlobalConstructor {\n SG.prototype = SandboxGlobal.prototype;\n return SG as unknown as SandboxGlobalConstructor;\n function SG(this: ISandboxGlobal) {\n for (const i in globals) {\n this[i] = globals[i];\n }\n }\n}\n\nexport function createContext(sandbox: SandboxExec, options: IOptions): IContext {\n const sandboxSymbols = createSandboxSymbolContext(options.symbolWhitelist);\n const SandboxGlobal = sandboxedGlobal(options.globals);\n const sandboxGlobal = new SandboxGlobal();\n const context: IContext = {\n sandbox: sandbox,\n globalsWhitelist: new Set(Object.values(options.globals)),\n prototypeWhitelist: new Map([...options.prototypeWhitelist].map((a) => [a[0].prototype, a[1]])),\n sandboxSymbols,\n options,\n globalScope: new Scope(null, sandboxGlobal, sandboxGlobal),\n sandboxGlobal,\n ticks: {\n ticks: 0n,\n tickLimit: options.executionQuota,\n nextYield: options.nonBlocking ? NON_BLOCKING_THRESHOLD : undefined,\n },\n sandboxedFunctions: new WeakSet<Function>(),\n };\n context.prototypeWhitelist.set(Object.getPrototypeOf(sandboxGlobal), new Set());\n context.prototypeWhitelist.set(Object.getPrototypeOf([][Symbol.iterator]()) as object, new Set());\n // Whitelist Generator and AsyncGenerator prototype chains\n const genProto = Object.getPrototypeOf((function* () {})());\n context.prototypeWhitelist.set(Object.getPrototypeOf(genProto), new Set());\n const asyncGenProto = Object.getPrototypeOf((async function* () {})());\n context.prototypeWhitelist.set(Object.getPrototypeOf(asyncGenProto), new Set());\n // Fetch API 构造函数本身(静态方法如 Response.json)也加白名单\n if (typeof Response !== 'undefined')\n context.prototypeWhitelist.set(Response.prototype, new Set());\n if (typeof Request !== 'undefined') context.prototypeWhitelist.set(Request.prototype, new Set());\n if (typeof Headers !== 'undefined') context.prototypeWhitelist.set(Headers.prototype, new Set());\n if (typeof FormData !== 'undefined')\n context.prototypeWhitelist.set(FormData.prototype, new Set());\n if (typeof Blob !== 'undefined') context.prototypeWhitelist.set(Blob.prototype, new Set());\n if (typeof URLSearchParams !== 'undefined')\n context.prototypeWhitelist.set(URLSearchParams.prototype, new Set());\n if (typeof AbortController !== 'undefined')\n context.prototypeWhitelist.set(AbortController.prototype, new Set());\n if (typeof ReadableStream !== 'undefined')\n context.prototypeWhitelist.set(ReadableStream.prototype, new Set());\n if (typeof TransformStream !== 'undefined')\n context.prototypeWhitelist.set(TransformStream.prototype, new Set());\n if (typeof WritableStream !== 'undefined')\n context.prototypeWhitelist.set(WritableStream.prototype, new Set());\n if (typeof TextEncoder !== 'undefined')\n context.prototypeWhitelist.set(TextEncoder.prototype, new Set());\n if (typeof TextDecoder !== 'undefined')\n context.prototypeWhitelist.set(TextDecoder.prototype, new Set());\n return context;\n}\n\nexport function createExecContext(\n sandbox: {\n readonly setSubscriptions: WeakMap<\n SubscriptionSubject,\n Map<string, Set<(modification: Change) => void>>\n >;\n readonly changeSubscriptions: WeakMap<SubscriptionSubject, Set<(modification: Change) => void>>;\n readonly sandboxFunctions: WeakMap<(...args: any[]) => any, IExecContext>;\n readonly context: IContext;\n },\n executionTree: IExecutionTree,\n evalContext?: IEvalContext,\n): IExecContext {\n const evals = new Map();\n const execContext: IExecContext = new ExecContext(\n sandbox.context,\n executionTree.constants,\n executionTree.tree,\n new Set<(obj: SubscriptionSubject, name: string) => void>(),\n new WeakMap<SubscriptionSubject, Map<string, Set<(modification: Change) => void>>>(),\n new WeakMap<SubscriptionSubject, Set<(modification: Change) => void>>(),\n sandbox.setSubscriptions,\n sandbox.changeSubscriptions,\n evals,\n (fn: any) => sandbox.sandboxFunctions.set(fn, execContext),\n !!evalContext,\n evalContext,\n );\n if (evalContext) {\n const func = evalContext.sandboxFunction(execContext);\n const asyncFunc = evalContext.sandboxAsyncFunction(execContext);\n const genFunc = evalContext.sandboxGeneratorFunction(execContext);\n const asyncGenFunc = evalContext.sandboxAsyncGeneratorFunction(execContext);\n const sandboxSymbol = evalContext.sandboxedSymbol(execContext);\n evals.set(Function, func);\n evals.set(AsyncFunction, asyncFunc);\n evals.set(GeneratorFunction, genFunc);\n evals.set(AsyncGeneratorFunction, asyncGenFunc);\n evals.set(Symbol, sandboxSymbol);\n evals.set(eval, evalContext.sandboxedEval(func, execContext));\n evals.set(setTimeout, evalContext.sandboxedSetTimeout(func, execContext));\n evals.set(setInterval, evalContext.sandboxedSetInterval(func, execContext));\n evals.set(clearTimeout, evalContext.sandboxedClearTimeout(execContext));\n evals.set(clearInterval, evalContext.sandboxedClearInterval(execContext));\n\n for (const [original, factory] of DEFAULT_FUNCTION_REPLACEMENTS) {\n evals.set(original, factory(execContext));\n }\n\n for (const [original, factory] of sandbox.context.options.functionReplacements) {\n evals.set(original, factory(execContext, evals.get(original)));\n }\n\n const ptwl = sandbox.context.prototypeWhitelist;\n\n for (const [key, value] of evals) {\n if (!ptwl.has(key.prototype)) {\n ptwl.set(key.prototype, new Set());\n }\n if (!ptwl.has(value.prototype)) {\n ptwl.set(value.prototype, ptwl.get(key.prototype) || new Set());\n }\n if (sandbox.context.globalsWhitelist.has(key)) {\n sandbox.context.globalsWhitelist.add(value);\n }\n if (hasOwnProperty(sandbox.context.sandboxGlobal, key.name)) {\n sandbox.context.sandboxGlobal[key.name] = value;\n }\n }\n if (sandbox.context.sandboxGlobal.globalThis) {\n sandbox.context.sandboxGlobal.globalThis = sandbox.context.sandboxGlobal;\n }\n }\n return execContext;\n}\n\nexport function isLisp<Type extends Lisp = Lisp>(item: LispItem | LispItem): item is Type {\n return (\n Array.isArray(item) &&\n typeof item[0] === 'number' &&\n item[0] !== LispType.None &&\n item[0] !== LispType.True\n );\n}\n","/**\n * Ops registry — kept separate from executorUtils.ts so that ops/*.ts files\n * can import addOps without creating a circular initialization problem.\n *\n * executorUtils.ts imports from here; ops/*.ts imports from here too.\n * No imports from executorUtils.ts allowed in this file.\n */\nimport { LispType } from '../utils';\nimport type { LispItem } from '../parser';\nimport type { IExecContext, Ticks } from '../utils';\nimport type { Scope } from '../utils';\nimport type { YieldValue, Done } from './executorUtils';\n\nexport type ControlFlowAction = 'break' | 'continue';\n\nexport interface ControlFlowTarget {\n label?: string;\n acceptsBreak: boolean;\n acceptsContinue: boolean;\n acceptsUnlabeledBreak: boolean;\n acceptsUnlabeledContinue: boolean;\n}\n\nexport type ControlFlowTargets = readonly ControlFlowTarget[] | undefined;\n\nexport type Execution = <T = any>(\n ticks: Ticks,\n tree: LispItem,\n scope: Scope,\n context: IExecContext,\n done: Done<T>,\n statementLabels: ControlFlowTargets,\n internal: boolean,\n generatorYield: ((yv: YieldValue, done?: Done) => void) | undefined,\n) => void;\n\nexport type OpsCallbackParams<a, b, obj, bobj> = {\n op: LispType;\n exec: Execution;\n a: a;\n b: b;\n obj: obj;\n bobj: bobj;\n ticks: Ticks;\n tree: LispItem;\n scope: Scope;\n context: IExecContext;\n done: Done;\n statementLabels: ControlFlowTargets;\n internal: boolean;\n generatorYield: ((yv: YieldValue, done?: Done) => void) | undefined;\n};\n\ntype OpCallback<a, b, obj, bobj> = (params: OpsCallbackParams<a, b, obj, bobj>) => void;\n\nexport const ops = new Map<LispType, OpCallback<any, any, any, any>>();\n\nexport function addOps<a = unknown, b = unknown, obj = unknown, bobj = unknown>(\n type: LispType,\n cb: OpCallback<a, b, obj, bobj>,\n) {\n ops.set(type, cb);\n}\n","import { addOps, hasPossibleProperties, isPropertyKey } from '../executorUtils';\nimport {\n LispType,\n Prop,\n SandboxAccessError,\n resolveSandboxProp,\n hasOwnProperty,\n} from '../../utils';\n\naddOps<unknown, PropertyKey>(LispType.Prop, ({ done, a, b, obj, context, scope, internal }) => {\n if (a === null) {\n throw new TypeError(`Cannot read properties of null (reading '${b?.toString()}')`);\n }\n\n if (!isPropertyKey(b)) {\n b = `${b}`;\n }\n\n if (a === undefined && obj === undefined && typeof b === 'string') {\n // is variable access\n const prop = scope.get(b, internal);\n if (prop.context === undefined) {\n throw new ReferenceError(`${b} is not defined`);\n }\n if (prop.context === context.ctx.sandboxGlobal) {\n if (context.ctx.options.audit) {\n context.ctx.auditReport?.globalsAccess.add(b);\n }\n }\n const val = (prop.context as any)[prop.prop];\n const p = resolveSandboxProp(val, context, prop) || prop;\n\n done(undefined, p);\n return;\n } else if (a === undefined) {\n throw new TypeError(`Cannot read properties of undefined (reading '${b.toString()}')`);\n }\n\n if (!hasPossibleProperties(a)) {\n done(undefined, new Prop(undefined, b));\n return;\n }\n\n const prototypeAccess = typeof a === 'function' || !hasOwnProperty(a, b);\n\n if (context.ctx.options.audit && prototypeAccess) {\n let prot: {} = Object.getPrototypeOf(a);\n do {\n if (hasOwnProperty(prot, b)) {\n if (\n context.ctx.auditReport &&\n !context.ctx.auditReport.prototypeAccess[prot.constructor.name]\n ) {\n context.ctx.auditReport.prototypeAccess[prot.constructor.name] = new Set();\n }\n context.ctx.auditReport?.prototypeAccess[prot.constructor.name].add(b);\n }\n } while ((prot = Object.getPrototypeOf(prot)));\n }\n\n if (prototypeAccess) {\n if (typeof a === 'function') {\n if (hasOwnProperty(a, b)) {\n const whitelist = context.ctx.prototypeWhitelist.get(a.prototype);\n if (\n !(whitelist && (!whitelist.size || whitelist.has(b))) &&\n !context.ctx.sandboxedFunctions.has(a)\n ) {\n throw new SandboxAccessError(\n `Static method or property access not permitted: ${a.name}.${b.toString()}`,\n );\n }\n }\n }\n\n let prot: {} = a;\n while ((prot = Object.getPrototypeOf(prot))) {\n if (hasOwnProperty(prot, b) || b === '__proto__') {\n const whitelist = context.ctx.prototypeWhitelist.get(prot);\n if (\n (whitelist && (!whitelist.size || whitelist.has(b))) ||\n context.ctx.sandboxedFunctions.has(prot.constructor)\n ) {\n break;\n }\n if (b === '__proto__') {\n throw new SandboxAccessError(`Access to prototype of global object is not permitted`);\n }\n throw new SandboxAccessError(\n `Method or property access not permitted: ${prot.constructor.name}.${b.toString()}`,\n );\n }\n }\n }\n\n if (typeof a === 'function') {\n if (b === 'prototype' && !context.ctx.sandboxedFunctions.has(a)) {\n throw new SandboxAccessError(`Access to prototype of global object is not permitted`);\n }\n if (['caller', 'callee', 'arguments'].includes(b as string)) {\n throw new SandboxAccessError(`Access to '${b as string}' property is not permitted`);\n }\n }\n const val = a[b as keyof typeof a] as unknown;\n\n if (b === '__proto__' && !context.ctx.sandboxedFunctions.has(val?.constructor as any)) {\n throw new SandboxAccessError(`Access to prototype of global object is not permitted`);\n }\n\n const p = resolveSandboxProp(val, context, new Prop(a, b, false, false));\n if (p) {\n done(undefined, p);\n return;\n }\n\n const isSandboxGlobal = a === context.ctx.sandboxGlobal;\n const g =\n (!isSandboxGlobal && obj instanceof Prop && obj.isGlobal) ||\n (typeof a === 'function' && !context.ctx.sandboxedFunctions.has(a)) ||\n context.ctx.globalsWhitelist.has(a) ||\n (isSandboxGlobal &&\n typeof b === 'string' &&\n hasOwnProperty(context.ctx.globalScope.globals, b));\n\n done(undefined, new Prop(a, b, false, g, false));\n});\n\naddOps<unknown, string>(LispType.StringIndex, ({ done, b, context }) =>\n done(undefined, context.constants.strings[parseInt(b)]),\n);\n","import { addOps, arrayChange, Change, checkHaltExpectedTicks, SpreadArray } from '../executorUtils';\nimport {\n checkTicksAndThrow,\n typedArrayProtos as _typedArrayProtos,\n} from '../../utils/functionReplacements';\nimport type { Lisp } from '../../parser';\nimport {\n DelayedSynchronousResult,\n getReplacementReceiver,\n LispType,\n SandboxAccessError,\n SandboxCapabilityError,\n sanitizeProp,\n} from '../../utils';\n\naddOps<unknown, Lisp[], any>(LispType.Call, (params) => {\n const { done, a, b, obj, context } = params;\n if (context.ctx.options.forbidFunctionCalls)\n throw new SandboxCapabilityError('Function invocations are not allowed');\n if (typeof a !== 'function') {\n throw new TypeError(\n `${typeof obj?.prop === 'symbol' ? 'Symbol' : obj?.prop} is not a function`,\n );\n }\n const vals = new Array<unknown>(b.length);\n let valsLen = 0;\n for (let i = 0; i < b.length; i++) {\n const item = b[i];\n if (item instanceof SpreadArray) {\n const expanded = Array.isArray(item.item) ? item.item : [...(item.item as Iterable<unknown>)];\n if (checkHaltExpectedTicks(params, BigInt(expanded.length))) return;\n for (let j = 0; j < expanded.length; j++)\n vals[valsLen++] = sanitizeProp(expanded[j], context);\n } else {\n vals[valsLen++] = sanitizeProp(item, context);\n }\n }\n vals.length = valsLen;\n\n if (a === String) {\n const result = String(vals[0]);\n checkTicksAndThrow(context, BigInt(result.length));\n done(undefined, result);\n return;\n }\n\n if (typeof obj === 'function') {\n // Direct function call (not a method): obj is the function itself\n const evl = context.evals.get(obj);\n const receiver = getReplacementReceiver(obj);\n let ret = evl\n ? evl(obj, ...vals)\n : receiver === undefined\n ? obj(...vals)\n : obj.call(receiver, ...vals);\n ret = sanitizeProp(ret, context);\n if (ret !== null && typeof ret === 'object' && ret instanceof DelayedSynchronousResult) {\n Promise.resolve(ret.result).then(\n (res) => done(undefined, res),\n (err) => done(err),\n );\n } else {\n done(undefined, ret);\n }\n return;\n }\n\n // Method call: obj is a Prop. `a` is already the replacement (from Prop.get()).\n // The original function is still accessible via obj.context[obj.prop] for subscription checks.\n const originalFn: unknown = obj.context[obj.prop];\n\n if (originalFn === JSON.stringify && context.getSubscriptions.size) {\n const cache = new WeakSet<any>();\n let ticks = 0n;\n const recurse = (x: unknown) => {\n if (!x || !(typeof x === 'object') || cache.has(x)) return;\n cache.add(x);\n const keys = Object.keys(x) as (keyof typeof x)[];\n ticks += BigInt(keys.length);\n for (const y of keys) {\n context.getSubscriptions.forEach((cb) => cb(x, y));\n recurse(x[y]);\n }\n };\n recurse(vals[0]);\n checkTicksAndThrow(context, ticks);\n }\n\n if (\n obj.context instanceof Array &&\n arrayChange.has(originalFn as any) &&\n (context.changeSubscriptions.get(obj.context) ||\n context.changeSubscriptionsGlobal.get(obj.context))\n ) {\n let change: Change = undefined!;\n let changed = false;\n if (obj.prop === 'push') {\n change = { type: 'push', added: vals };\n changed = !!vals.length;\n } else if (obj.prop === 'pop') {\n change = { type: 'pop', removed: obj.context.slice(-1) };\n changed = !!change.removed.length;\n } else if (obj.prop === 'shift') {\n change = { type: 'shift', removed: obj.context.slice(0, 1) };\n changed = !!change.removed.length;\n } else if (obj.prop === 'unshift') {\n change = { type: 'unshift', added: vals };\n changed = !!vals.length;\n } else if (obj.prop === 'splice') {\n change = {\n type: 'splice',\n startIndex: vals[0] as number,\n deleteCount: vals[1] === undefined ? obj.context.length : vals[1],\n added: vals.slice(2),\n removed: obj.context.slice(\n vals[0],\n vals[1] === undefined ? undefined : (vals[0] as number) + (vals[1] as number),\n ),\n };\n changed = !!change.added.length || !!change.removed.length;\n } else if (obj.prop === 'reverse' || obj.prop === 'sort') {\n change = { type: obj.prop };\n changed = !!obj.context.length;\n } else if (obj.prop === 'copyWithin') {\n const len =\n vals[2] === undefined\n ? obj.context.length - (vals[1] as number)\n : Math.min(obj.context.length, (vals[2] as number) - (vals[1] as number));\n change = {\n type: 'copyWithin',\n startIndex: vals[0] as number,\n endIndex: (vals[0] as number) + len,\n added: obj.context.slice(vals[1] as number, (vals[1] as number) + len),\n removed: obj.context.slice(vals[0] as number, (vals[0] as number) + len),\n };\n changed = !!change.added.length || !!change.removed.length;\n }\n if (changed) {\n const subs = context.changeSubscriptions.get(obj.context);\n if (subs !== undefined) for (const cb of subs) cb(change);\n const subsG = context.changeSubscriptionsGlobal.get(obj.context);\n if (subsG !== undefined) for (const cb of subsG) cb(change);\n }\n }\n\n // Trigger get-subscriptions, then call via `a` (which may be a replacement from evals).\n // Sandboxed wrappers for globals (Function, eval, etc.) must be called without `this`;\n // tick-checking replacements must be called with `this`.\n obj.get(context);\n const evl = context.evals.get(originalFn as Function);\n const receiver = getReplacementReceiver(originalFn as Function);\n const thisArg = obj.isVariable && receiver !== undefined ? receiver : obj.context;\n let ret = evl ? evl.call(thisArg, ...vals) : (a as Function).call(thisArg, ...vals);\n ret = sanitizeProp(ret, context);\n if (ret !== null && typeof ret === 'object' && ret instanceof DelayedSynchronousResult) {\n Promise.resolve(ret.result).then(\n (res) => done(undefined, res),\n (err) => done(err),\n );\n } else {\n done(undefined, ret);\n }\n});\n\naddOps<new (...args: unknown[]) => void, unknown[]>(LispType.New, (params) => {\n const { done, a, b, context } = params;\n if (!context.ctx.globalsWhitelist.has(a) && !context.ctx.sandboxedFunctions.has(a)) {\n throw new SandboxAccessError(`Object construction not allowed: ${a.constructor.name}`);\n }\n const vals = b.map((item) => sanitizeProp(item, context));\n const replacement = context.evals.get(a);\n if (replacement) {\n const ret = new (replacement as new (...args: unknown[]) => unknown)(...vals);\n done(undefined, ret);\n return;\n }\n const expectedTicks = getNewTicks(a, vals);\n if (expectedTicks > 0n && checkHaltExpectedTicks(params, expectedTicks)) return;\n const ret = new a(...vals);\n done(undefined, ret);\n});\n\nfunction getNewTicks(ctor: Function, args: unknown[]): bigint {\n // new Array(n) or new TypedArray(n) — allocates n elements\n if (ctor === Array) {\n const n = args[0];\n if (typeof n === 'number' && args.length === 1) return BigInt(n);\n return BigInt(args.length);\n }\n if (_typedArrayProtos.has(Object.getPrototypeOf(ctor.prototype))) {\n const n = args[0];\n if (typeof n === 'number') return BigInt(n);\n if (Array.isArray(n) || ArrayBuffer.isView(n)) return BigInt((n as ArrayLike<unknown>).length);\n return 0n;\n }\n // new Map(iterable) or new Set(iterable) — O(n) of iterable length\n if (ctor === Map || ctor === Set) {\n const iterable = args[0];\n if (Array.isArray(iterable)) return BigInt(iterable.length);\n return 0n;\n }\n // new String(s) or new RegExp(pattern) — O(n) of string length\n if (ctor === String || ctor === RegExp) {\n const s = args[0];\n if (typeof s === 'string') return BigInt(s.length);\n return 0n;\n }\n return 0n;\n}\n","import {\n addOps,\n checkHaltExpectedTicks,\n SpreadArray,\n SpreadObject,\n KeyVal,\n ArrayHole,\n} from '../executorUtils';\nimport type { Lisp, LispItem } from '../../parser';\nimport { LispType, sanitizeProp } from '../../utils';\n\naddOps<unknown, KeyVal[]>(LispType.CreateObject, (params) => {\n const { done, b } = params;\n let res = {} as any;\n for (const item of b) {\n if (item.key instanceof SpreadObject) {\n const keys = Object.keys(item.key.item);\n if (checkHaltExpectedTicks(params, BigInt(keys.length))) return;\n res = { ...res, ...item.key.item };\n } else {\n res[item.key] = item.val;\n }\n }\n done(undefined, res);\n});\n\naddOps<PropertyKey, LispItem>(LispType.KeyVal, ({ done, a, b }) =>\n done(undefined, new KeyVal(a, b)),\n);\n\naddOps<unknown, Lisp[]>(LispType.CreateArray, (params) => {\n const { done, b, context } = params;\n const items: unknown[] = [];\n for (const item of b) {\n if (item instanceof SpreadArray) {\n const expanded = Array.isArray(item.item) ? item.item : [...(item.item as Iterable<unknown>)];\n if (checkHaltExpectedTicks(params, BigInt(expanded.length))) return;\n for (const v of expanded) items.push(sanitizeProp(v, context));\n } else if (item instanceof ArrayHole) {\n items.length++;\n } else {\n items.push(sanitizeProp(item, context));\n }\n }\n done(undefined, items);\n});\n\naddOps(LispType.Hole, ({ done }) => done(undefined, new ArrayHole()));\n\naddOps<unknown, unknown>(LispType.Group, ({ done, b }) => done(undefined, b));\n\naddOps<unknown, string>(LispType.GlobalSymbol, ({ done, b }) => {\n switch (b) {\n case 'true':\n return done(undefined, true);\n case 'false':\n return done(undefined, false);\n case 'null':\n return done(undefined, null);\n case 'undefined':\n return done(undefined, undefined);\n case 'NaN':\n return done(undefined, NaN);\n case 'Infinity':\n return done(undefined, Infinity);\n }\n done(new Error('Unknown symbol: ' + b));\n});\n\naddOps<unknown, unknown[]>(LispType.SpreadArray, ({ done, b }) => {\n done(undefined, new SpreadArray(b));\n});\n\naddOps<unknown, Record<string, unknown>>(LispType.SpreadObject, ({ done, b }) => {\n done(undefined, new SpreadObject(b));\n});\n","import { addOps, literalRegex, checkHaltExpectedTicks } from '../executorUtils';\nimport type { Lisp, IRegEx } from '../../parser';\nimport { LispType, SandboxCapabilityError, sanitizeProp } from '../../utils';\n\naddOps<unknown, string>(LispType.Number, ({ done, b }) =>\n done(undefined, Number(b.replace(/_/g, ''))),\n);\n\naddOps<unknown, string>(LispType.BigInt, ({ done, b }) =>\n done(undefined, BigInt(b.replace(/_/g, ''))),\n);\n\naddOps<unknown, string>(LispType.RegexIndex, ({ done, b, context }) => {\n const reg: IRegEx = context.constants.regexes[parseInt(b)];\n if (!context.ctx.globalsWhitelist.has(RegExp)) {\n throw new SandboxCapabilityError('Regex not permitted');\n } else {\n const RegExpCtor =\n (context.evals.get(RegExp) as\n | (new (pattern: string, flags?: string) => unknown)\n | undefined) ?? RegExp;\n done(undefined, new RegExpCtor(reg.regex, reg.flags));\n }\n});\n\naddOps<unknown, string>(LispType.LiteralIndex, (params) => {\n const { exec, done, ticks, b, context, scope, internal, generatorYield } = params;\n const item = context.constants.literals[parseInt(b)];\n const [, name, js] = item;\n const found: Lisp[] = [];\n let f: RegExpExecArray | null;\n const resnums: string[] = [];\n while ((f = literalRegex.exec(name))) {\n if (!f[2]) {\n found.push(js[parseInt(f[3], 10)]);\n resnums.push(f[3]);\n }\n }\n\n exec<unknown[]>(\n ticks,\n found,\n scope,\n context,\n (...args: unknown[]) => {\n const reses: Record<string, unknown> = {};\n if (args.length === 1) {\n done(args[0]);\n return;\n }\n const processed = args[1];\n for (const i of Object.keys(processed!) as (keyof typeof processed)[]) {\n const num = resnums[i];\n reses[num] = processed![i];\n }\n const result = name.replace(/(\\\\\\\\)*(\\\\)?\\${(\\d+)}/g, (match, $$, $, num) => {\n if ($) return match;\n const res = reses[num];\n return ($$ ? $$ : '') + `${sanitizeProp(res, context)}`;\n });\n if (checkHaltExpectedTicks(params, BigInt(result.length))) return;\n done(undefined, result);\n },\n undefined,\n internal,\n generatorYield,\n );\n});\n","import { addOps, assignCheck } from '../executorUtils';\nimport type { LispItem } from '../../parser';\nimport { LispType, Prop, sanitizeProp } from '../../utils';\n\naddOps<unknown, unknown>(LispType.Not, ({ done, b }) => done(undefined, !b));\n\naddOps<unknown, number>(LispType.Inverse, ({ done, b }) => done(undefined, ~b));\n\naddOps<unknown, unknown, Prop<any>>(LispType.IncrementBefore, ({ done, obj, context }) => {\n assignCheck(obj, context);\n done(undefined, ++obj.context[obj.prop]);\n});\n\naddOps<unknown, unknown, Prop<any>>(LispType.IncrementAfter, ({ done, obj, context }) => {\n assignCheck(obj, context);\n done(undefined, obj.context[obj.prop]++);\n});\n\naddOps<unknown, unknown, Prop<any>>(LispType.DecrementBefore, ({ done, obj, context }) => {\n assignCheck(obj, context);\n done(undefined, --obj.context[obj.prop]);\n});\n\naddOps<unknown, unknown, Prop<any>>(LispType.DecrementAfter, ({ done, obj, context }) => {\n assignCheck(obj, context);\n done(undefined, obj.context[obj.prop]--);\n});\n\naddOps<number, number>(LispType.Positive, ({ done, b }) => done(undefined, +b));\n\naddOps<number, number>(LispType.Negative, ({ done, b }) => done(undefined, -b));\n\naddOps<unknown, LispItem>(\n LispType.Typeof,\n ({ exec, done, ticks, b, context, scope, internal, generatorYield }) => {\n exec(\n ticks,\n b,\n scope,\n context,\n (e, prop) => {\n done(undefined, typeof sanitizeProp(prop, context));\n },\n undefined,\n internal,\n generatorYield,\n );\n },\n);\n\naddOps<unknown, unknown>(LispType.Delete, ({ done, context, bobj }) => {\n if (!(bobj instanceof Prop)) {\n done(undefined, true);\n return;\n }\n assignCheck(bobj, context, 'delete');\n if (bobj.isVariable) {\n done(undefined, false);\n return;\n }\n done(undefined, delete (bobj.context as any)?.[bobj.prop]);\n});\n\naddOps(LispType.Void, ({ done }) => {\n done();\n});\n","import { addOps, assignCheck, checkHaltExpectedTicks } from '../executorUtils';\nimport { LispType, Prop } from '../../utils';\n\naddOps<unknown, unknown, Prop<any>, Prop<any>>(LispType.Assign, (params) => {\n const { done, b, obj, context, scope, bobj, internal } = params;\n assignCheck(obj, context);\n obj.isGlobal = bobj?.isGlobal || false;\n if (obj.isVariable) {\n const s = scope.getWhereValScope(obj.prop as string, obj.prop === 'this', internal);\n if (s === null) {\n throw new ReferenceError(`Cannot assign to undeclared variable '${obj.prop.toString()}'`);\n }\n s.set(obj.prop as string, b, internal);\n if (obj.isGlobal) {\n s.globals[obj.prop.toString()] = true;\n } else {\n delete s.globals[obj.prop.toString()];\n }\n done(undefined, b);\n return;\n }\n if (obj.prop === 'length' && Array.isArray(obj.context) && typeof b === 'number') {\n const delta = BigInt(Math.abs(b - obj.context.length));\n if (delta > 0n && checkHaltExpectedTicks(params, delta)) return;\n }\n done(undefined, (obj.context[obj.prop] = b));\n});\n\naddOps<unknown, unknown, Prop<any>>(LispType.AddEquals, (params) => {\n const { done, b, obj, context } = params;\n assignCheck(obj, context);\n const result = (obj.context[obj.prop] as any) + (b as any);\n if (typeof result === 'string' && checkHaltExpectedTicks(params, BigInt(result.length))) return;\n done(undefined, (obj.context[obj.prop] = result));\n});\n\naddOps<unknown, number, Prop<any>>(LispType.SubractEquals, ({ done, b, obj, context }) => {\n assignCheck(obj, context);\n done(undefined, (obj.context[obj.prop] -= b));\n});\n\naddOps<unknown, number, Prop<any>>(LispType.DivideEquals, ({ done, b, obj, context }) => {\n assignCheck(obj, context);\n done(undefined, (obj.context[obj.prop] /= b));\n});\n\naddOps<unknown, number, Prop<any>>(LispType.MultiplyEquals, ({ done, b, obj, context }) => {\n assignCheck(obj, context);\n done(undefined, (obj.context[obj.prop] *= b));\n});\n\naddOps<unknown, number, Prop<any>>(LispType.PowerEquals, ({ done, b, obj, context }) => {\n assignCheck(obj, context);\n done(undefined, (obj.context[obj.prop] **= b));\n});\n\naddOps<unknown, number, Prop<any>>(LispType.ModulusEquals, ({ done, b, obj, context }) => {\n assignCheck(obj, context);\n done(undefined, (obj.context[obj.prop] %= b));\n});\n\naddOps<unknown, number, Prop<any>>(LispType.BitNegateEquals, ({ done, b, obj, context }) => {\n assignCheck(obj, context);\n done(undefined, (obj.context[obj.prop] ^= b));\n});\n\naddOps<unknown, number, Prop<any>>(LispType.BitAndEquals, ({ done, b, obj, context }) => {\n assignCheck(obj, context);\n done(undefined, (obj.context[obj.prop] &= b));\n});\n\naddOps<unknown, number, Prop<any>>(LispType.BitOrEquals, ({ done, b, obj, context }) => {\n assignCheck(obj, context);\n done(undefined, (obj.context[obj.prop] |= b));\n});\n\naddOps<unknown, number, Prop<any>>(LispType.ShiftLeftEquals, ({ done, b, obj, context }) => {\n assignCheck(obj, context);\n done(undefined, (obj.context[obj.prop] <<= b));\n});\n\naddOps<unknown, number, Prop<any>>(LispType.ShiftRightEquals, ({ done, b, obj, context }) => {\n assignCheck(obj, context);\n done(undefined, (obj.context[obj.prop] >>= b));\n});\n\naddOps<unknown, number, Prop<any>>(\n LispType.UnsignedShiftRightEquals,\n ({ done, b, obj, context }) => {\n assignCheck(obj, context);\n done(undefined, (obj.context[obj.prop] >>>= b));\n },\n);\n\naddOps<unknown, unknown, Prop<any>>(LispType.AndEquals, ({ done, b, obj, context }) => {\n assignCheck(obj, context);\n done(undefined, (obj.context[obj.prop] &&= b));\n});\n\naddOps<unknown, unknown, Prop<any>>(LispType.OrEquals, ({ done, b, obj, context }) => {\n assignCheck(obj, context);\n done(undefined, (obj.context[obj.prop] ||= b));\n});\n\naddOps<unknown, unknown, Prop<any>>(\n LispType.NullishCoalescingEquals,\n ({ done, b, obj, context }) => {\n assignCheck(obj, context);\n done(undefined, (obj.context[obj.prop] ??= b));\n },\n);\n","import { addOps, checkHaltExpectedTicks } from '../executorUtils';\nimport { LispType } from '../../utils';\n\naddOps<number, number>(LispType.LargerThan, ({ done, a, b }) => done(undefined, a > b));\n\naddOps<number, number>(LispType.SmallerThan, ({ done, a, b }) => done(undefined, a < b));\n\naddOps<number, number>(LispType.LargerEqualThan, ({ done, a, b }) => done(undefined, a >= b));\n\naddOps<number, number>(LispType.SmallerEqualThan, ({ done, a, b }) => done(undefined, a <= b));\n\naddOps<number, number>(LispType.Equal, ({ done, a, b }) => done(undefined, a == b));\n\naddOps<number, number>(LispType.StrictEqual, ({ done, a, b }) => done(undefined, a === b));\n\naddOps<number, number>(LispType.NotEqual, ({ done, a, b }) => done(undefined, a != b));\n\naddOps<number, number>(LispType.StrictNotEqual, ({ done, a, b }) => done(undefined, a !== b));\n\naddOps<number, number>(LispType.And, ({ done, a, b }) => done(undefined, a && b));\n\naddOps<number, number>(LispType.Or, ({ done, a, b }) => done(undefined, a || b));\n\naddOps<number, number>(LispType.NullishCoalescing, ({ done, a, b }) => done(undefined, a ?? b));\n\naddOps<number, number>(LispType.BitAnd, ({ done, a, b }) => done(undefined, a & b));\n\naddOps<number, number>(LispType.BitOr, ({ done, a, b }) => done(undefined, a | b));\n\naddOps<number, number>(LispType.Plus, (params) => {\n const { done, a, b } = params;\n const result = (a as any) + (b as any);\n if (typeof result === 'string' && checkHaltExpectedTicks(params, BigInt(result.length))) return;\n done(undefined, result);\n});\n\naddOps<number, number>(LispType.Minus, ({ done, a, b }) => done(undefined, a - b));\n\naddOps<number, number>(LispType.Divide, ({ done, a, b }) => done(undefined, a / b));\n\naddOps<number, number>(LispType.Power, ({ done, a, b }) => done(undefined, a ** b));\n\naddOps<number, number>(LispType.BitNegate, ({ done, a, b }) => done(undefined, a ^ b));\n\naddOps<number, number>(LispType.Multiply, ({ done, a, b }) => done(undefined, a * b));\n\naddOps<number, number>(LispType.Modulus, ({ done, a, b }) => done(undefined, a % b));\n\naddOps<number, number>(LispType.BitShiftLeft, ({ done, a, b }) => done(undefined, a << b));\n\naddOps<number, number>(LispType.BitShiftRight, ({ done, a, b }) => done(undefined, a >> b));\n\naddOps<number, number>(LispType.BitUnsignedShiftRight, ({ done, a, b }) =>\n done(undefined, a >>> b),\n);\n\naddOps<unknown, { new (): unknown }>(LispType.Instanceof, ({ done, a, b }) =>\n done(undefined, a instanceof b),\n);\n\naddOps<string, {}>(LispType.In, ({ done, a, b }) => done(undefined, a in b));\n","import { addOps } from '../executorUtils';\nimport { LispType, Prop, VarType } from '../../utils';\n\naddOps(LispType.Return, ({ done, b }) => done(undefined, b));\n\naddOps<string, unknown, unknown, Prop>(LispType.Var, ({ done, a, b, scope, bobj, internal }) => {\n done(undefined, scope.declare(a, VarType.var, b, bobj?.isGlobal || false, internal));\n});\n\naddOps<string, unknown, unknown, Prop>(LispType.Let, ({ done, a, b, scope, bobj, internal }) => {\n done(undefined, scope.declare(a, VarType.let, b, bobj?.isGlobal || false, internal));\n});\n\naddOps<string, unknown, unknown, Prop>(LispType.Const, ({ done, a, b, scope, bobj, internal }) => {\n done(undefined, scope.declare(a, VarType.const, b, bobj?.isGlobal || false, internal));\n});\n","import {\n addOps,\n findControlFlowTarget,\n ExecReturn,\n normalizeStatementLabel,\n} from '../executorUtils';\nimport type { ControlFlowAction } from '../executorUtils';\nimport type { LispItem, StatementLabel } from '../../parser';\nimport { LispType, Prop, VarType, SandboxCapabilityError } from '../../utils';\n\naddOps<string, unknown, unknown, Prop>(\n LispType.Internal,\n ({ done, a, b, scope, bobj, internal }) => {\n if (!internal) {\n throw new SandboxCapabilityError('Internal variables are not accessible');\n }\n done(undefined, scope.declare(a, VarType.internal, b, bobj?.isGlobal || false, internal));\n },\n);\n\naddOps<LispItem, StatementLabel>(\n LispType.LoopAction,\n ({ done, a, b, context, statementLabels }) => {\n const label = normalizeStatementLabel(b);\n const target = findControlFlowTarget(statementLabels, a as ControlFlowAction, label);\n if (target === null) {\n throw new TypeError('Illegal continue statement');\n }\n if (!target) {\n throw new TypeError(label ? `Undefined label '${label}'` : 'Illegal ' + a + ' statement');\n }\n done(\n undefined,\n new ExecReturn(context.ctx.auditReport, undefined, false, {\n type: a as ControlFlowAction,\n label,\n }),\n );\n },\n);\n\naddOps(LispType.Throw, ({ done, b }) => {\n done(b);\n});\n\naddOps(LispType.None, ({ done }) => done());\n","import {\n addOps,\n createAsyncGeneratorFunction,\n createFunction,\n createFunctionAsync,\n createGeneratorFunction,\n} from '../executorUtils';\nimport type { Lisp } from '../../parser';\nimport { LispType, SandboxCapabilityError, CodeString, Scope, VarType } from '../../utils';\n\naddOps<string[], Lisp[], Lisp>(\n LispType.ArrowFunction,\n ({ done, ticks, a, b, obj, context, scope, internal }) => {\n if (typeof obj[2] === 'string' || obj[2] instanceof CodeString) {\n if (context.allowJit && context.evalContext) {\n obj[2] = b = context.evalContext.lispifyFunction(new CodeString(obj[2]), context.constants);\n } else {\n throw new SandboxCapabilityError('Unevaluated code detected, JIT not allowed');\n }\n }\n const argNames = a.slice(1);\n if (a[0]) {\n done(undefined, createFunctionAsync(argNames, b, ticks, context, scope, undefined, internal));\n } else {\n done(undefined, createFunction(argNames, b, ticks, context, scope, undefined, internal));\n }\n },\n);\n\naddOps<(string | LispType)[], Lisp[], Lisp>(\n LispType.Function,\n ({ done, ticks, a, b, obj, context, scope, internal }) => {\n if (typeof obj[2] === 'string' || obj[2] instanceof CodeString) {\n if (context.allowJit && context.evalContext) {\n obj[2] = b = context.evalContext.lispifyFunction(\n new CodeString(obj[2]),\n context.constants,\n false,\n {\n generatorDepth: a[1] === LispType.True ? 1 : 0,\n asyncDepth: a[0] === LispType.True ? 1 : 0,\n lispDepth: 0,\n },\n );\n } else {\n throw new SandboxCapabilityError('Unevaluated code detected, JIT not allowed');\n }\n }\n const isAsync = a[0];\n const isGenerator = a[1];\n const name = a[2] as string;\n const argNames = a.slice(3) as string[];\n let func;\n if (isAsync === LispType.True && isGenerator === LispType.True) {\n func = createAsyncGeneratorFunction(argNames, b, ticks, context, scope, name, internal);\n } else if (isGenerator === LispType.True) {\n func = createGeneratorFunction(argNames, b, ticks, context, scope, name, internal);\n } else if (isAsync === LispType.True) {\n func = createFunctionAsync(argNames, b, ticks, context, scope, name, internal);\n } else {\n func = createFunction(argNames, b, ticks, context, scope, name, internal);\n }\n if (name) {\n scope.declare(name, VarType.var, func, false, internal);\n }\n done(undefined, func);\n },\n);\n\naddOps<(string | LispType)[], Lisp[], Lisp>(\n LispType.InlineFunction,\n ({ done, ticks, a, b, obj, context, scope, internal }) => {\n if (typeof obj[2] === 'string' || obj[2] instanceof CodeString) {\n if (context.allowJit && context.evalContext) {\n obj[2] = b = context.evalContext.lispifyFunction(\n new CodeString(obj[2]),\n context.constants,\n false,\n {\n generatorDepth: a[1] === LispType.True ? 1 : 0,\n asyncDepth: a[0] === LispType.True ? 1 : 0,\n lispDepth: 0,\n },\n );\n } else {\n throw new SandboxCapabilityError('Unevaluated code detected, JIT not allowed');\n }\n }\n const isAsync = a[0];\n const isGenerator = a[1];\n const name = a[2] as string;\n const argNames = a.slice(3) as string[];\n if (name) {\n scope = new Scope(scope, {});\n }\n let func;\n if (isAsync === LispType.True && isGenerator === LispType.True) {\n func = createAsyncGeneratorFunction(argNames, b, ticks, context, scope, name, internal);\n } else if (isGenerator === LispType.True) {\n func = createGeneratorFunction(argNames, b, ticks, context, scope, name, internal);\n } else if (isAsync === LispType.True) {\n func = createFunctionAsync(argNames, b, ticks, context, scope, name, internal);\n } else {\n func = createFunction(argNames, b, ticks, context, scope, name, internal);\n }\n if (name) {\n scope.declare(name, VarType.let, func, false, internal);\n }\n done(undefined, func);\n },\n);\n","import {\n addOps,\n execAsync,\n execSync,\n asyncDone,\n executeTreeWithDone,\n normalizeStatementLabels,\n addControlFlowTargets,\n createLoopTarget,\n createSwitchTarget,\n createLabeledStatementTarget,\n matchesControlFlowTarget,\n If,\n ExecReturn,\n executeTreeAsync,\n syncDone,\n executeTree,\n normalizeStatementLabel,\n addControlFlowTarget,\n} from '../executorUtils';\nimport type { AsyncDoneRet } from '../executorUtils';\nimport type { Lisp, LispItem, StatementLabel, SwitchCase } from '../../parser';\nimport { LispType, Scope, SandboxError, sanitizeProp } from '../../utils';\n\naddOps<Lisp[], Lisp[]>(\n LispType.Loop,\n ({ exec, done, ticks, a, b, context, scope, statementLabels, internal, generatorYield }) => {\n const [\n checkFirst,\n startInternal,\n getIterator,\n startStep,\n step,\n condition,\n beforeStep,\n isForAwait,\n label,\n ] = a;\n const loopStatementTargets = [\n ...normalizeStatementLabels(label).map((loopLabel) => createLoopTarget(loopLabel, false)),\n createLoopTarget(),\n ];\n const loopTargets = addControlFlowTargets(statementLabels, loopStatementTargets);\n if ((isForAwait as unknown as LispType) === LispType.True && exec !== execAsync) {\n done(new SyntaxError('for-await-of loops are only allowed inside async functions'));\n return;\n }\n let loop = true;\n const loopScope = new Scope(scope, {});\n const internalVars: Record<string, unknown> = {\n $$obj: undefined,\n };\n const interalScope = new Scope(loopScope, internalVars);\n if (exec === execAsync) {\n (async () => {\n let ad: AsyncDoneRet;\n ad = asyncDone((d) =>\n exec(ticks, startStep, loopScope, context, d, undefined, internal, generatorYield),\n );\n internalVars['$$obj'] =\n (ad = asyncDone((d) =>\n exec(ticks, getIterator, loopScope, context, d, undefined, internal, generatorYield),\n )).isInstant === true\n ? ad.instant\n : (await ad.p).result;\n // for-await-of: override $$obj with the correct async iterator\n if ((isForAwait as unknown as LispType) === LispType.True) {\n const obj = internalVars['$$obj'] as any;\n internalVars['$$obj'] = obj[Symbol.asyncIterator]\n ? obj[Symbol.asyncIterator]()\n : obj[Symbol.iterator]\n ? obj[Symbol.iterator]()\n : obj;\n }\n ad = asyncDone((d) =>\n exec(ticks, startInternal, interalScope, context, d, undefined, internal, generatorYield),\n );\n // for-await-of: await the $$next promise after startInternal sets it\n if ((isForAwait as unknown as LispType) === LispType.True) {\n internalVars['$$next'] = await internalVars['$$next'];\n }\n if (checkFirst)\n loop =\n (ad = asyncDone((d) =>\n exec(ticks, condition, interalScope, context, d, undefined, internal, generatorYield),\n )).isInstant === true\n ? ad.instant\n : (await ad.p).result;\n while (loop) {\n const innerLoopVars = {};\n const iterScope = new Scope(interalScope, innerLoopVars);\n ad = asyncDone((d) =>\n exec(ticks, beforeStep, iterScope, context, d, undefined, internal, generatorYield),\n );\n ad.isInstant === true ? ad.instant : (await ad.p).result;\n const res = await executeTreeAsync(\n ticks,\n context,\n b,\n [iterScope],\n loopTargets,\n internal,\n generatorYield,\n );\n if (res instanceof ExecReturn && res.returned) {\n done(undefined, res);\n return;\n }\n if (res instanceof ExecReturn && res.controlFlow) {\n if (\n !loopStatementTargets.some((target) =>\n matchesControlFlowTarget(res.controlFlow!, target),\n )\n ) {\n done(undefined, res);\n return;\n }\n if (res.breakLoop) {\n break;\n }\n }\n ad = asyncDone((d) =>\n exec(ticks, step, interalScope, context, d, undefined, internal, generatorYield),\n );\n // for-await-of: await the $$next promise after step updates it\n if ((isForAwait as unknown as LispType) === LispType.True) {\n internalVars['$$next'] = await internalVars['$$next'];\n }\n loop =\n (ad = asyncDone((d) =>\n exec(ticks, condition, interalScope, context, d, undefined, internal, generatorYield),\n )).isInstant === true\n ? ad.instant\n : (await ad.p).result;\n }\n done();\n })().catch(done);\n } else {\n syncDone((d) =>\n exec(ticks, startStep, loopScope, context, d, undefined, internal, generatorYield),\n );\n internalVars['$$obj'] = syncDone((d) =>\n exec(ticks, getIterator, loopScope, context, d, undefined, internal, generatorYield),\n ).result;\n syncDone((d) =>\n exec(ticks, startInternal, interalScope, context, d, undefined, internal, generatorYield),\n );\n if (checkFirst)\n loop = syncDone((d) =>\n exec(ticks, condition, interalScope, context, d, undefined, internal, generatorYield),\n ).result;\n while (loop) {\n const innerLoopVars = {};\n const iterScope = new Scope(interalScope, innerLoopVars);\n syncDone((d) =>\n exec(ticks, beforeStep, iterScope, context, d, undefined, internal, generatorYield),\n );\n const res = executeTree(\n ticks,\n context,\n b,\n [iterScope],\n loopTargets,\n internal,\n generatorYield,\n );\n if (res instanceof ExecReturn && res.returned) {\n done(undefined, res);\n return;\n }\n if (res instanceof ExecReturn && res.controlFlow) {\n if (\n !loopStatementTargets.some((target) =>\n matchesControlFlowTarget(res.controlFlow!, target),\n )\n ) {\n done(undefined, res);\n return;\n }\n if (res.breakLoop) {\n break;\n }\n }\n syncDone((d) =>\n exec(ticks, step, interalScope, context, d, undefined, internal, generatorYield),\n );\n loop = syncDone((d) =>\n exec(ticks, condition, interalScope, context, d, undefined, internal, generatorYield),\n ).result;\n }\n done();\n }\n },\n);\n\naddOps<LispItem, If>(\n LispType.If,\n ({ exec, done, ticks, a, b, context, scope, statementLabels, internal, generatorYield }) => {\n exec(\n ticks,\n sanitizeProp(a, context) ? b.t : b.f,\n scope,\n context,\n done,\n statementLabels,\n internal,\n generatorYield,\n );\n },\n);\n\naddOps<LispItem, If>(\n LispType.InlineIf,\n ({ exec, done, ticks, a, b, context, scope, internal, generatorYield }) => {\n exec(\n ticks,\n sanitizeProp(a, context) ? b.t : b.f,\n scope,\n context,\n done,\n undefined,\n internal,\n generatorYield,\n );\n },\n);\n\naddOps<Lisp, Lisp>(LispType.InlineIfCase, ({ done, a, b }) => done(undefined, new If(a, b)));\n\naddOps<Lisp, Lisp>(LispType.IfCase, ({ done, a, b }) => done(undefined, new If(a, b)));\n\naddOps<StatementLabel, Lisp>(\n LispType.Labeled,\n ({ exec, done, ticks, a, b, context, scope, statementLabels, internal, generatorYield }) => {\n const target = createLabeledStatementTarget(normalizeStatementLabel(a));\n exec(\n ticks,\n b,\n scope,\n context,\n (...args: unknown[]) => {\n if (args.length === 1) {\n done(args[0]);\n return;\n }\n const res = args[1];\n if (res instanceof ExecReturn && res.controlFlow && target) {\n if (matchesControlFlowTarget(res.controlFlow, target)) {\n done();\n return;\n }\n }\n done(undefined, res as any);\n },\n addControlFlowTarget(statementLabels, target),\n internal,\n generatorYield,\n );\n },\n);\n\naddOps<LispItem, SwitchCase[]>(\n LispType.Switch,\n ({ exec, done, ticks, a, b, context, scope, statementLabels, internal, generatorYield }) => {\n const switchTarget = createSwitchTarget();\n const switchTargets = addControlFlowTarget(statementLabels, switchTarget);\n exec(\n ticks,\n a,\n scope,\n context,\n (...args: unknown[]) => {\n if (args.length === 1) {\n done(args[0]);\n return;\n }\n let toTest = args[1];\n toTest = sanitizeProp(toTest, context);\n if (exec === execSync) {\n let res: ExecReturn<unknown>;\n let isTrue = false;\n for (const caseItem of b) {\n if (\n isTrue ||\n (isTrue =\n !caseItem[1] ||\n toTest ===\n sanitizeProp(\n syncDone((d) =>\n exec(\n ticks,\n caseItem[1],\n scope,\n context,\n d,\n undefined,\n internal,\n generatorYield,\n ),\n ).result,\n context,\n ))\n ) {\n if (!caseItem[2]) continue;\n res = executeTree(\n ticks,\n context,\n caseItem[2],\n [scope],\n switchTargets,\n internal,\n generatorYield,\n );\n if (res.controlFlow) {\n if (!matchesControlFlowTarget(res.controlFlow, switchTarget)) {\n done(undefined, res);\n return;\n }\n if (res.breakLoop) break;\n }\n if (res.returned) {\n done(undefined, res);\n return;\n }\n if (!caseItem[1]) {\n // default case\n break;\n }\n }\n }\n done();\n } else {\n (async () => {\n let res: ExecReturn<unknown>;\n let isTrue = false;\n for (const caseItem of b) {\n let ad: AsyncDoneRet;\n if (\n isTrue ||\n (isTrue =\n !caseItem[1] ||\n toTest ===\n sanitizeProp(\n (ad = asyncDone((d) =>\n exec(\n ticks,\n caseItem[1],\n scope,\n context,\n d,\n undefined,\n internal,\n generatorYield,\n ),\n )).isInstant === true\n ? ad.instant\n : (await ad.p).result,\n context,\n ))\n ) {\n if (!caseItem[2]) continue;\n res = await executeTreeAsync(\n ticks,\n context,\n caseItem[2],\n [scope],\n switchTargets,\n internal,\n generatorYield,\n );\n if (res.controlFlow) {\n if (!matchesControlFlowTarget(res.controlFlow, switchTarget)) {\n done(undefined, res);\n return;\n }\n if (res.breakLoop) break;\n }\n if (res.returned) {\n done(undefined, res);\n return;\n }\n if (!caseItem[1]) {\n // default case\n break;\n }\n }\n }\n done();\n })().catch(done);\n }\n },\n undefined,\n internal,\n generatorYield,\n );\n },\n);\n\naddOps<Lisp[], [string, Lisp[], Lisp[]]>(\n LispType.Try,\n ({ exec, done, ticks, a, b, context, scope, statementLabels, internal, generatorYield }) => {\n const [exception, catchBody, finallyBody] = b;\n\n // Execute try block\n executeTreeWithDone(\n exec,\n (...tryArgs: unknown[]) => {\n const tryHadError = tryArgs.length === 1;\n const tryError = tryHadError ? tryArgs[0] : undefined;\n const tryResult = !tryHadError && tryArgs.length > 1 ? tryArgs[1] : undefined;\n\n // Handler to execute finally and complete\n const executeFinallyAndComplete = (hadError: boolean, errorOrResult: unknown) => {\n if (finallyBody && finallyBody.length > 0) {\n // Execute finally block\n executeTreeWithDone(\n exec,\n (...finallyArgs: unknown[]) => {\n const finallyHadError = finallyArgs.length === 1;\n const finallyResult =\n !finallyHadError && finallyArgs.length > 1 ? finallyArgs[1] : undefined;\n\n // If finally throws an error, it overrides everything\n if (finallyHadError) {\n done(finallyArgs[0]);\n return;\n }\n\n // If finally has a control flow statement (return/break/continue), it overrides everything\n if (\n finallyResult instanceof ExecReturn &&\n (finallyResult.returned || finallyResult.breakLoop || finallyResult.continueLoop)\n ) {\n done(undefined, finallyResult);\n return;\n }\n\n // Otherwise, return the original try/catch result/error\n if (hadError) {\n done(errorOrResult);\n } else if (errorOrResult instanceof ExecReturn) {\n // If try/catch returned or has some other control flow, pass that through\n if (\n errorOrResult.returned ||\n errorOrResult.breakLoop ||\n errorOrResult.continueLoop\n ) {\n done(undefined, errorOrResult);\n } else {\n // Normal completion - don't return a value\n done();\n }\n } else {\n // Try/catch completed normally, just signal completion with no return value\n done();\n }\n },\n ticks,\n context,\n finallyBody,\n [new Scope(scope, {})],\n statementLabels,\n internal,\n generatorYield,\n );\n } else {\n // No finally block, just return result/error\n if (hadError) {\n done(errorOrResult);\n } else if (errorOrResult instanceof ExecReturn) {\n // If try/catch returned or has some other control flow, pass that through\n if (errorOrResult.returned || errorOrResult.breakLoop || errorOrResult.continueLoop) {\n done(undefined, errorOrResult);\n } else {\n // Normal completion - don't return a value\n done();\n }\n } else {\n done();\n }\n }\n };\n\n // SandboxErrors bypass both catch and finally — propagate immediately.\n if (tryHadError && tryError instanceof SandboxError) {\n done(tryError);\n return;\n }\n\n // If try had an error and there's a catch block, execute catch.\n if (tryHadError && catchBody && catchBody.length > 0) {\n const sc: Record<string, unknown> = {};\n if (exception) sc[exception] = tryError;\n\n executeTreeWithDone(\n exec,\n (...catchArgs: unknown[]) => {\n const catchHadError = catchArgs.length === 1;\n const catchErrorOrResult = catchHadError\n ? catchArgs[0]\n : catchArgs.length > 1\n ? catchArgs[1]\n : undefined;\n\n // Execute finally with catch result\n executeFinallyAndComplete(catchHadError, catchErrorOrResult);\n },\n ticks,\n context,\n catchBody,\n [new Scope(scope, sc)],\n statementLabels,\n internal,\n generatorYield,\n );\n } else {\n // No catch or no error, execute finally with try result\n executeFinallyAndComplete(tryHadError, tryHadError ? tryError : tryResult);\n }\n },\n ticks,\n context,\n a,\n [new Scope(scope)],\n statementLabels,\n internal,\n generatorYield,\n );\n },\n);\n\naddOps<unknown[]>(LispType.Expression, ({ done, a }) => done(undefined, a.pop()));\n","import type { LispItem, Lisp, StatementLabel } from '../parser';\nimport {\n hasOwnProperty,\n isLisp,\n LispType,\n LocalScope,\n Prop,\n SandboxExecutionQuotaExceededError,\n SandboxError,\n SandboxExecutionTreeError,\n Scope,\n GeneratorFunction,\n AsyncGeneratorFunction,\n SandboxCapabilityError,\n SandboxAccessError,\n NON_BLOCKING_THRESHOLD,\n sanitizeProp,\n Unknown,\n} from '../utils';\nimport { IAuditReport, IExecContext, IScope, optional, Ticks } from '../utils';\n\nexport type Done<T = any> = (err?: any, res?: T | typeof optional) => void;\n\nexport type ControlFlowAction = 'break' | 'continue';\n\nexport interface ControlFlowSignal {\n type: ControlFlowAction;\n label?: string;\n}\n\ninterface ControlFlowTarget {\n label?: string;\n acceptsBreak: boolean;\n acceptsContinue: boolean;\n acceptsUnlabeledBreak: boolean;\n acceptsUnlabeledContinue: boolean;\n}\n\nexport type ControlFlowTargets = readonly ControlFlowTarget[] | undefined;\n\nexport class ExecReturn<T> {\n constructor(\n public auditReport: IAuditReport | undefined,\n public result: T,\n public returned: boolean,\n public controlFlow?: ControlFlowSignal,\n ) {}\n\n get breakLoop() {\n return this.controlFlow?.type === 'break';\n }\n\n get continueLoop() {\n return this.controlFlow?.type === 'continue';\n }\n}\n\nexport interface IChange {\n type: string;\n}\n\nexport interface ICreate extends IChange {\n type: 'create';\n prop: number | string;\n}\n\nexport interface IReplace extends IChange {\n type: 'replace';\n}\n\nexport interface IDelete extends IChange {\n type: 'delete';\n prop: number | string;\n}\n\nexport interface IReverse extends IChange {\n type: 'reverse';\n}\n\nexport interface ISort extends IChange {\n type: 'sort';\n}\n\nexport interface IPush extends IChange {\n type: 'push';\n added: unknown[];\n}\n\nexport interface IPop extends IChange {\n type: 'pop';\n removed: unknown[];\n}\n\nexport interface IShift extends IChange {\n type: 'shift';\n removed: unknown[];\n}\n\nexport interface IUnShift extends IChange {\n type: 'unshift';\n added: unknown[];\n}\n\nexport interface ISplice extends IChange {\n type: 'splice';\n startIndex: number;\n deleteCount: number;\n added: unknown[];\n removed: unknown[];\n}\n\nexport interface ICopyWithin extends IChange {\n type: 'copyWithin';\n startIndex: number;\n endIndex: number;\n added: unknown[];\n removed: unknown[];\n}\n\nexport type Change =\n | ICreate\n | IReplace\n | IDelete\n | IReverse\n | ISort\n | IPush\n | IPop\n | IUnShift\n | IShift\n | ISplice\n | ICopyWithin;\n\nconst emptyControlFlowTargets: readonly ControlFlowTarget[] = [];\n\nexport function normalizeStatementLabel(label: StatementLabel | undefined) {\n return label === undefined || label === LispType.None ? undefined : label;\n}\n\nexport function normalizeStatementLabels(label: LispItem | StatementLabel | undefined) {\n if (label === undefined || label === LispType.None) return [] as string[];\n if (Array.isArray(label) && !isLisp(label)) {\n return label.filter((item): item is string => typeof item === 'string');\n }\n return [label as string];\n}\n\nexport function createLoopTarget(label?: string, acceptsUnlabeled = true): ControlFlowTarget {\n return {\n label,\n acceptsBreak: true,\n acceptsContinue: true,\n acceptsUnlabeledBreak: acceptsUnlabeled,\n acceptsUnlabeledContinue: acceptsUnlabeled,\n };\n}\n\nexport function createSwitchTarget(label?: string): ControlFlowTarget {\n return {\n label,\n acceptsBreak: true,\n acceptsContinue: false,\n acceptsUnlabeledBreak: true,\n acceptsUnlabeledContinue: false,\n };\n}\n\nexport function createLabeledStatementTarget(label?: string): ControlFlowTarget | undefined {\n if (!label) return undefined;\n return {\n label,\n acceptsBreak: true,\n acceptsContinue: false,\n acceptsUnlabeledBreak: false,\n acceptsUnlabeledContinue: false,\n };\n}\n\nexport function addControlFlowTarget(\n controlFlowTargets: ControlFlowTargets,\n target?: ControlFlowTarget,\n): ControlFlowTargets {\n if (!target) return controlFlowTargets;\n return [...(controlFlowTargets || emptyControlFlowTargets), target];\n}\n\nexport function addControlFlowTargets(\n controlFlowTargets: ControlFlowTargets,\n targets: ControlFlowTarget[],\n): ControlFlowTargets {\n return targets.reduce(\n (currentTargets, target) => addControlFlowTarget(currentTargets, target),\n controlFlowTargets,\n );\n}\n\nexport function matchesControlFlowTarget(signal: ControlFlowSignal, target: ControlFlowTarget) {\n if (signal.type === 'continue') {\n if (!target.acceptsContinue) return false;\n return signal.label ? target.label === signal.label : target.acceptsUnlabeledContinue;\n }\n if (!target.acceptsBreak) return false;\n return signal.label ? target.label === signal.label : target.acceptsUnlabeledBreak;\n}\n\nexport function findControlFlowTarget(\n controlFlowTargets: ControlFlowTargets,\n type: ControlFlowAction,\n label?: string,\n) {\n if (!controlFlowTargets) return undefined;\n for (let i = controlFlowTargets.length - 1; i >= 0; i--) {\n const target = controlFlowTargets[i];\n if (label) {\n if (target.label !== label) continue;\n if (type === 'continue' ? target.acceptsContinue : target.acceptsBreak) {\n return target;\n }\n return null;\n }\n if (type === 'continue' ? target.acceptsUnlabeledContinue : target.acceptsUnlabeledBreak) {\n return target;\n }\n }\n return undefined;\n}\n\nfunction generateArgs(argNames: string[], args: unknown[]) {\n const vars: Record<string, unknown> = {};\n argNames.forEach((arg, i) => {\n if (arg.startsWith('...')) {\n vars[arg.substring(3)] = args.slice(i);\n } else {\n vars[arg] = args[i];\n }\n });\n return vars;\n}\n\nexport function createFunction(\n argNames: string[],\n parsed: Lisp[],\n ticks: Ticks,\n context: IExecContext,\n scope?: Scope,\n name?: string,\n internal = false,\n) {\n if (context.ctx.options.forbidFunctionCreation) {\n throw new SandboxCapabilityError('Function creation is forbidden');\n }\n let func;\n if (name === undefined) {\n func = (...args: unknown[]) => {\n const vars = generateArgs(argNames, args);\n const res = executeTree(\n ticks,\n context,\n parsed,\n scope === undefined ? [] : [new Scope(scope, vars)],\n undefined,\n internal,\n );\n return res.result;\n };\n } else {\n func = function sandboxedObject(this: Unknown, ...args: unknown[]) {\n const vars = generateArgs(argNames, args);\n const res = executeTree(\n ticks,\n context,\n parsed,\n scope === undefined ? [] : [new Scope(scope, vars, this)],\n undefined,\n internal,\n );\n return res.result;\n };\n }\n context.registerSandboxFunction(func);\n context.ctx.sandboxedFunctions.add(func);\n return func;\n}\n\nexport function createFunctionAsync(\n argNames: string[],\n parsed: Lisp[],\n ticks: Ticks,\n context: IExecContext,\n scope?: Scope,\n name?: string,\n internal = false,\n) {\n if (context.ctx.options.forbidFunctionCreation) {\n throw new SandboxCapabilityError('Function creation is forbidden');\n }\n if (!context.ctx.prototypeWhitelist?.has(Promise.prototype)) {\n throw new SandboxCapabilityError('Async/await not permitted');\n }\n let func;\n if (name === undefined) {\n func = async (...args: unknown[]) => {\n const vars = generateArgs(argNames, args);\n const res = await executeTreeAsync(\n ticks,\n context,\n parsed,\n scope === undefined ? [] : [new Scope(scope, vars)],\n undefined,\n internal,\n );\n return res.result;\n };\n } else {\n func = async function sandboxedObject(this: Unknown, ...args: unknown[]) {\n const vars = generateArgs(argNames, args);\n const res = await executeTreeAsync(\n ticks,\n context,\n parsed,\n scope === undefined ? [] : [new Scope(scope, vars, this)],\n undefined,\n internal,\n );\n return res.result;\n };\n }\n context.registerSandboxFunction(func);\n context.ctx.sandboxedFunctions.add(func);\n return func;\n}\n\n// Sentinel class used to communicate yield values from the executor back to the generator.\nexport class YieldValue {\n constructor(\n public value: unknown,\n public delegate: boolean,\n ) {}\n}\n\n// Unique sentinel thrown by captureYieldFn in executeGenBody's default case when a new\n// synchronous yield is encountered. Propagates through the call stack back to the restart loop.\nconst syncYieldPauseSentinel = Symbol('syncYieldPause');\n\nfunction asIterableIterator(value: unknown): Iterator<unknown> & Iterable<unknown> {\n const iterator =\n (value as { [Symbol.iterator]?: () => Iterator<unknown> })?.[Symbol.iterator]?.() ??\n (value as Iterator<unknown>);\n\n if (!iterator || typeof iterator.next !== 'function') {\n throw new TypeError('yield* target is not iterable');\n }\n\n if (typeof (iterator as Iterator<unknown> & Iterable<unknown>)[Symbol.iterator] === 'function') {\n return iterator as Iterator<unknown> & Iterable<unknown>;\n }\n\n return {\n next: iterator.next.bind(iterator),\n throw: iterator.throw?.bind(iterator),\n return: iterator.return?.bind(iterator),\n [Symbol.iterator]() {\n return this;\n },\n };\n}\n\nfunction asAsyncIterableIterator(value: unknown): AsyncIterator<unknown> & AsyncIterable<unknown> {\n const asyncIterator = (value as { [Symbol.asyncIterator]?: () => AsyncIterator<unknown> })?.[\n Symbol.asyncIterator\n ]?.();\n\n if (asyncIterator) {\n return {\n next: asyncIterator.next.bind(asyncIterator),\n throw: asyncIterator.throw?.bind(asyncIterator),\n return: asyncIterator.return?.bind(asyncIterator),\n [Symbol.asyncIterator]() {\n return this;\n },\n };\n }\n\n const iterator = asIterableIterator(value);\n return {\n async next(nextValue?: unknown) {\n return iterator.next(nextValue);\n },\n async throw(err?: unknown) {\n if (typeof iterator.throw === 'function') {\n return iterator.throw(err);\n }\n throw err;\n },\n async return(valueToReturn?: unknown) {\n if (typeof iterator.return === 'function') {\n return iterator.return(valueToReturn);\n }\n return { value: valueToReturn, done: true };\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n };\n}\n\n// executeGenBody: a native generator that lazily executes a generator function body.\n// It handles compound control-flow nodes (statements, if, loop, try, yield) with yield*\n// recursion, and falls back to the existing execSync for all leaf expressions.\n// Only used by createGeneratorFunction — nothing else in the executor is changed.\nfunction* executeGenBody(\n ticks: Ticks,\n tree: Lisp | Lisp[],\n scope: Scope,\n context: IExecContext,\n statementLabels: ControlFlowTargets,\n internal: boolean,\n): Generator<unknown, ExecReturn<unknown> | unknown, unknown> {\n // ── Statement list ──────────────────────────────────────────────────────────\n if (!isLisp(tree as Lisp) && Array.isArray(tree)) {\n const stmts = tree as Lisp[];\n if (stmts.length === 0 || (stmts[0] as unknown) === LispType.None) {\n return new ExecReturn(context.ctx.auditReport, undefined, false);\n }\n for (const stmt of stmts) {\n const res = (yield* executeGenBody(\n ticks,\n stmt,\n scope,\n context,\n statementLabels,\n internal,\n )) as ExecReturn<unknown>;\n if (res instanceof ExecReturn && (res.returned || res.controlFlow)) return res;\n // Mirror _executeWithDoneSync: wrap the result of a return statement\n if (isLisp(stmt) && (stmt as Lisp)[0] === LispType.Return) {\n return new ExecReturn(context.ctx.auditReport, res.result, true);\n }\n }\n return new ExecReturn(context.ctx.auditReport, undefined, false);\n }\n\n const [op, a, b] = tree as Lisp;\n\n switch (op) {\n // ── yield expr ────────────────────────────────────────────────────────────\n case LispType.Yield: {\n const valResult = (yield* executeGenBody(\n ticks,\n a as Lisp,\n scope,\n context,\n statementLabels,\n internal,\n )) as ExecReturn<unknown>;\n const sanitized = sanitizeProp(valResult.result, context);\n const injected: unknown = yield sanitized; // ← real pause point\n return new ExecReturn(context.ctx.auditReport, injected, false);\n }\n\n // ── yield* expr ───────────────────────────────────────────────────────────\n case LispType.YieldDelegate: {\n const iterResult = (yield* executeGenBody(\n ticks,\n a as Lisp,\n scope,\n context,\n statementLabels,\n internal,\n )) as ExecReturn<unknown>;\n const delegatee = sanitizeProp(iterResult.result, context);\n const result: unknown = yield* asIterableIterator(delegatee);\n return new ExecReturn(context.ctx.auditReport, result, false);\n }\n\n // ── if / else ─────────────────────────────────────────────────────────────\n // LispType.If is NOT in unexecTypes — its `a` is the raw condition Lisp,\n // `b` is the raw IfCase node that evaluates to an If object with .t/.f.\n case LispType.If: {\n const condResult = (yield* executeGenBody(\n ticks,\n a as Lisp,\n scope,\n context,\n statementLabels,\n internal,\n )) as ExecReturn<unknown>;\n const ifCase = syncDone((d) =>\n execSync(ticks, b as Lisp, scope, context, d, statementLabels, internal, undefined),\n ).result as If;\n const branch = sanitizeProp(condResult.result, context) ? ifCase.t : ifCase.f;\n if (branch) {\n return (yield* executeGenBody(\n ticks,\n branch,\n scope,\n context,\n statementLabels,\n internal,\n )) as ExecReturn<unknown>;\n }\n return new ExecReturn(context.ctx.auditReport, undefined, false);\n }\n\n // ── loops (while / for / for-of / for-in / do-while) ─────────────────────\n // Mirror the sync path of the existing Loop handler (executor.ts ~1421-1475)\n // but replace `executeTree(b, ...)` with `yield*`.\n case LispType.Loop: {\n const [\n checkFirst,\n startInternal,\n getIterator,\n startStep,\n step,\n condition,\n beforeStep,\n isForAwait,\n label,\n ] = a as Lisp[];\n if ((isForAwait as unknown as LispType) === LispType.True) {\n throw new SyntaxError('for-await-of loops are only allowed inside async functions');\n }\n const loopStatementTargets = [\n ...normalizeStatementLabels(label).map((loopLabel) => createLoopTarget(loopLabel, false)),\n createLoopTarget(),\n ];\n const loopTargets = addControlFlowTargets(statementLabels, loopStatementTargets);\n const loopScope = new Scope(scope, {});\n const internalVars: Record<string, unknown> = { $$obj: undefined };\n const interalScope = new Scope(loopScope, internalVars);\n\n syncDone((d) =>\n execSync(ticks, startStep, loopScope, context, d, undefined, internal, undefined),\n );\n internalVars['$$obj'] = syncDone((d) =>\n execSync(ticks, getIterator, loopScope, context, d, undefined, internal, undefined),\n ).result;\n syncDone((d) =>\n execSync(ticks, startInternal, interalScope, context, d, undefined, internal, undefined),\n );\n\n let loop: unknown = true;\n if (checkFirst) {\n loop = syncDone((d) =>\n execSync(ticks, condition, interalScope, context, d, undefined, internal, undefined),\n ).result;\n }\n\n while (loop) {\n const iterScope = new Scope(interalScope, {});\n syncDone((d) =>\n execSync(ticks, beforeStep, iterScope, context, d, undefined, internal, undefined),\n );\n\n const res = (yield* executeGenBody(\n ticks,\n b as Lisp[],\n iterScope,\n context,\n loopTargets,\n internal,\n )) as ExecReturn<unknown>;\n\n if (res.returned) return res;\n if (res.controlFlow) {\n if (!loopStatementTargets.some((t) => matchesControlFlowTarget(res.controlFlow!, t))) {\n return res; // break/continue targeting an outer labeled loop\n }\n if (res.breakLoop) break;\n // continueLoop: fall through to step + condition check\n }\n syncDone((d) =>\n execSync(ticks, step, interalScope, context, d, undefined, internal, undefined),\n );\n loop = syncDone((d) =>\n execSync(ticks, condition, interalScope, context, d, undefined, internal, undefined),\n ).result;\n }\n return new ExecReturn(context.ctx.auditReport, undefined, false);\n }\n\n // ── try / catch / finally ─────────────────────────────────────────────────\n // Using real native try/catch/finally gives us correct gen.throw() and\n // gen.return() semantics for free (the native generator machinery handles them).\n case LispType.Try: {\n const [exception, catchBody, finallyBody] = b as [string, Lisp[], Lisp[]];\n let result!: ExecReturn<unknown>;\n let finalOverride: ExecReturn<unknown> | undefined;\n try {\n result = (yield* executeGenBody(\n ticks,\n a as Lisp[],\n scope,\n context,\n statementLabels,\n internal,\n )) as ExecReturn<unknown>;\n } catch (e) {\n if (exception && catchBody?.length > 0) {\n const catchScope = new Scope(scope, { [exception]: e });\n result = (yield* executeGenBody(\n ticks,\n catchBody,\n catchScope,\n context,\n statementLabels,\n internal,\n )) as ExecReturn<unknown>;\n } else {\n throw e;\n }\n } finally {\n if (finallyBody?.length > 0) {\n const fr = (yield* executeGenBody(\n ticks,\n finallyBody,\n scope,\n context,\n statementLabels,\n internal,\n )) as ExecReturn<unknown>;\n // finally control flow (return/break/continue) overrides everything\n if (fr.returned || fr.controlFlow) {\n finalOverride = fr;\n }\n }\n }\n if (finalOverride) return finalOverride;\n return result;\n }\n\n // ── labeled statement ─────────────────────────────────────────────────────\n case LispType.Labeled: {\n const target = createLabeledStatementTarget(normalizeStatementLabel(a as StatementLabel));\n const newTargets = addControlFlowTargets(statementLabels, target ? [target] : []);\n const res = (yield* executeGenBody(\n ticks,\n b as Lisp,\n scope,\n context,\n newTargets,\n internal,\n )) as ExecReturn<unknown>;\n if (res.controlFlow && target && matchesControlFlowTarget(res.controlFlow, target)) {\n return new ExecReturn(context.ctx.auditReport, res.result, false);\n }\n return res;\n }\n\n // ── everything else ───────────────────────────────────────────────────────\n // Arithmetic, property access, function calls, assignments, etc. are\n // delegated to execSync. However, a yield expression may be nested inside\n // a non-unexecType node (e.g. `const x = yield 1`). In that case the\n // existing sync yield handler throws syncYieldPauseSentinel. We restart\n // execSync from scratch on each such pause, skipping already-completed\n // yields by immediately calling their continuation with the stored result.\n default: {\n let completedYields = 0;\n const yieldResults: unknown[] = [];\n while (true) {\n let currentYieldIdx = 0;\n let capturedValue: unknown = undefined;\n let capturedDelegate = false;\n let yielded = false;\n const captureYieldFn = (yv: YieldValue, continueDone?: Done) => {\n if (currentYieldIdx < completedYields) {\n // This yield already happened in a prior iteration; fast-forward.\n continueDone!(undefined, yieldResults[currentYieldIdx]);\n currentYieldIdx++;\n return;\n }\n // New yield: capture the value and pause.\n capturedValue = yv.value;\n capturedDelegate = yv.delegate;\n yielded = true;\n currentYieldIdx++;\n throw syncYieldPauseSentinel;\n };\n try {\n const result = syncDone((d) =>\n execSync(\n ticks,\n tree as Lisp,\n scope,\n context,\n d,\n statementLabels,\n internal,\n captureYieldFn,\n ),\n ).result;\n if (result instanceof ExecReturn) return result;\n return new ExecReturn(context.ctx.auditReport, result, false);\n } catch (e) {\n if (!yielded || e !== syncYieldPauseSentinel) throw e;\n const resumedValue: unknown = capturedDelegate\n ? yield* asIterableIterator(capturedValue)\n : yield capturedValue;\n yieldResults.push(resumedValue);\n completedYields++;\n }\n }\n }\n }\n}\n\nexport function createGeneratorFunction(\n argNames: string[],\n parsed: Lisp[],\n ticks: Ticks,\n context: IExecContext,\n scope?: Scope,\n name?: string,\n internal = false,\n) {\n if (context.ctx.options.forbidFunctionCreation) {\n throw new SandboxCapabilityError('Function creation is forbidden');\n }\n const makeGen = (thisArg: Unknown, args: unknown[]) => {\n const vars = generateArgs(argNames, args);\n const genScope =\n scope === undefined ? new Scope(null, vars, thisArg) : new Scope(scope, vars, thisArg);\n\n const executionGen = executeGenBody(ticks, parsed, genScope, context, undefined, internal);\n let isDone = false;\n\n function drive(action: () => IteratorResult<unknown>): IteratorResult<unknown> {\n if (isDone) return { value: undefined, done: true };\n try {\n const r = action();\n if (r.done) {\n isDone = true;\n return {\n value: r.value instanceof ExecReturn ? r.value.result : r.value,\n done: true,\n };\n }\n return { value: r.value, done: false };\n } catch (e) {\n isDone = true;\n throw e;\n }\n }\n\n const iterator: Iterator<unknown> & Iterable<unknown> = {\n next(value?: unknown) {\n return drive(() => executionGen.next(value));\n },\n return(value?: unknown) {\n return drive(() => executionGen.return(value));\n },\n throw(err?: unknown) {\n return drive(() => executionGen.throw(err));\n },\n [Symbol.iterator]() {\n return this;\n },\n };\n return iterator;\n };\n const func = function sandboxedObject(this: Unknown, ...args: unknown[]) {\n return makeGen(this, args);\n };\n Object.setPrototypeOf(func, GeneratorFunction.prototype);\n context.registerSandboxFunction(func);\n context.ctx.sandboxedFunctions.add(func);\n return func;\n}\n\nexport function createAsyncGeneratorFunction(\n argNames: string[],\n parsed: Lisp[],\n ticks: Ticks,\n context: IExecContext,\n scope?: Scope,\n name?: string,\n internal = false,\n) {\n if (context.ctx.options.forbidFunctionCreation) {\n throw new SandboxCapabilityError('Function creation is forbidden');\n }\n if (!context.ctx.prototypeWhitelist?.has(Promise.prototype)) {\n throw new SandboxCapabilityError('Async/await not permitted');\n }\n const makeGen = (thisArg: Unknown, args: unknown[]) => {\n const vars = generateArgs(argNames, args);\n const genScope =\n scope === undefined ? [new Scope(null, vars, thisArg)] : [new Scope(scope, vars, thisArg)];\n return (async function* sandboxedAsyncGenerator(): AsyncGenerator<unknown, unknown, unknown> {\n const yieldQueue: Array<{ yieldValue: YieldValue; continueDone?: Done }> = [];\n let resolveYield: (() => void) | null = null;\n const yieldFn = (yv: YieldValue, continueDone?: Done) => {\n yieldQueue.push({ yieldValue: yv, continueDone });\n if (resolveYield) {\n resolveYield();\n resolveYield = null;\n }\n };\n const bodyPromise = executeTreeAsync(\n ticks,\n context,\n parsed,\n genScope,\n undefined,\n internal,\n yieldFn,\n );\n let bodyDone = false;\n let bodyResult: ExecReturn<unknown> | undefined;\n let bodyError: unknown;\n bodyPromise.then(\n (r) => {\n bodyDone = true;\n bodyResult = r;\n resolveYield?.();\n },\n (e) => {\n bodyDone = true;\n bodyError = e;\n resolveYield?.();\n },\n );\n while (true) {\n if (yieldQueue.length === 0 && !bodyDone) {\n await new Promise<void>((res) => {\n resolveYield = res;\n });\n }\n while (yieldQueue.length > 0) {\n const { yieldValue, continueDone } = yieldQueue.shift()!;\n try {\n const resumedValue = yieldValue.delegate\n ? yield* asAsyncIterableIterator(yieldValue.value)\n : yield yieldValue.value;\n continueDone?.(undefined, resumedValue);\n } catch (err) {\n continueDone?.(err);\n }\n }\n if (bodyDone) break;\n }\n if (bodyError !== undefined) throw bodyError;\n return bodyResult?.result;\n })();\n };\n const func = function sandboxedObject(this: Unknown, ...args: unknown[]) {\n return makeGen(this, args) as unknown as AsyncGenerator;\n };\n Object.setPrototypeOf(func, AsyncGeneratorFunction.prototype);\n context.registerSandboxFunction(func);\n context.ctx.sandboxedFunctions.add(func);\n return func;\n}\n\nexport function assignCheck(obj: Prop, context: IExecContext, op = 'assign') {\n if (obj.context === undefined) {\n throw new ReferenceError(`Cannot ${op} value to undefined.`);\n }\n if (obj.isConst) {\n throw new TypeError(`Assignment to constant variable.`);\n }\n if (obj.isGlobal) {\n throw new SandboxAccessError(\n `Cannot ${op} property '${obj.prop.toString()}' of a global object`,\n );\n }\n if (obj.context === null) {\n throw new TypeError('Cannot set properties of null');\n }\n if (\n typeof (obj.context as any)[obj.prop] === 'function' &&\n !hasOwnProperty(obj.context, obj.prop)\n ) {\n throw new SandboxAccessError(\n `Override prototype property '${obj.prop.toString()}' not allowed`,\n );\n }\n if (op === 'delete') {\n if (hasOwnProperty(obj.context, obj.prop)) {\n context.changeSubscriptions\n .get(obj.context)\n ?.forEach((cb) => cb({ type: 'delete', prop: obj.prop.toString() }));\n context.changeSubscriptionsGlobal\n .get(obj.context)\n ?.forEach((cb) => cb({ type: 'delete', prop: obj.prop.toString() }));\n }\n } else if (hasOwnProperty(obj.context, obj.prop)) {\n context.setSubscriptions\n .get(obj.context)\n ?.get(obj.prop.toString())\n ?.forEach((cb) =>\n cb({\n type: 'replace',\n }),\n );\n context.setSubscriptionsGlobal\n .get(obj.context)\n ?.get(obj.prop.toString())\n ?.forEach((cb) =>\n cb({\n type: 'replace',\n }),\n );\n } else {\n context.changeSubscriptions\n .get(obj.context)\n ?.forEach((cb) => cb({ type: 'create', prop: obj.prop.toString() }));\n context.changeSubscriptionsGlobal\n .get(obj.context)\n ?.forEach((cb) => cb({ type: 'create', prop: obj.prop.toString() }));\n }\n}\nexport const arrayChange = new Set([\n [].push,\n [].pop,\n [].shift,\n [].unshift,\n [].splice,\n [].reverse,\n [].sort,\n [].copyWithin,\n]);\n\nexport class KeyVal {\n constructor(\n public key: PropertyKey | SpreadObject,\n public val: unknown,\n ) {}\n}\n\nexport class SpreadObject {\n constructor(public item: { [key: string]: unknown }) {}\n}\n\nexport class SpreadArray {\n constructor(public item: unknown[]) {}\n}\n\nexport class ArrayHole {}\n\nexport class If {\n constructor(\n public t: Lisp,\n public f: Lisp,\n public label?: string,\n ) {}\n}\n\nexport const literalRegex = /(\\$\\$)*(\\$)?\\${(\\d+)}/g;\n\nexport { ops, addOps } from './opsRegistry';\nimport { ops, Execution } from './opsRegistry';\n\nexport const prorptyKeyTypes = ['string', 'number', 'symbol'];\n\nexport function isPropertyKey(val: unknown): val is PropertyKey {\n return prorptyKeyTypes.includes(typeof val);\n}\n\nexport function hasPossibleProperties(val: unknown): val is {} {\n return val !== null && val !== undefined;\n}\n\nimport './ops/index';\n\nexport function execMany(\n ticks: Ticks,\n exec: Execution,\n tree: Lisp[],\n done: Done,\n scope: Scope,\n context: IExecContext,\n statementLabels: ControlFlowTargets,\n internal: boolean,\n generatorYield: ((yv: YieldValue, done?: Done) => void) | undefined,\n) {\n if (exec === execSync) {\n _execManySync(ticks, tree, done, scope, context, statementLabels, internal, generatorYield);\n } else {\n _execManyAsync(\n ticks,\n tree,\n done,\n scope,\n context,\n statementLabels,\n internal,\n generatorYield,\n ).catch(done);\n }\n}\n\nfunction _execManySync(\n ticks: Ticks,\n tree: Lisp[],\n done: Done,\n scope: Scope,\n context: IExecContext,\n statementLabels: ControlFlowTargets,\n internal: boolean,\n generatorYield: ((yv: YieldValue, done?: Done) => void) | undefined,\n) {\n const ret: any[] = [];\n for (let i = 0; i < tree.length; i++) {\n let res = syncDone((d) =>\n execSync(ticks, tree[i], scope, context, d, statementLabels, internal, generatorYield),\n ).result;\n if (res instanceof ExecReturn && (res.returned || res.breakLoop || res.continueLoop)) {\n done(undefined, res);\n return;\n }\n if (isLisp(tree[i]) && tree[i][0] === LispType.Return) {\n done(undefined, new ExecReturn(context.ctx.auditReport, res, true));\n return;\n }\n ret.push(res);\n }\n done(undefined, ret);\n}\n\nasync function _execManyAsync(\n ticks: Ticks,\n tree: Lisp[],\n done: Done,\n scope: Scope,\n context: IExecContext,\n statementLabels: ControlFlowTargets,\n internal: boolean,\n generatorYield: ((yv: YieldValue, done?: Done) => void) | undefined,\n) {\n const ret: any[] = [];\n for (let i = 0; i < tree.length; i++) {\n let res;\n try {\n let ad: AsyncDoneRet;\n res =\n (ad = asyncDone((d) =>\n execAsync(ticks, tree[i], scope, context, d, statementLabels, internal, generatorYield),\n )).isInstant === true\n ? ad.instant\n : (await ad.p).result;\n } catch (e) {\n done(e);\n return;\n }\n if (res instanceof ExecReturn && (res.returned || res.breakLoop || res.continueLoop)) {\n done(undefined, res);\n return;\n }\n if (isLisp(tree[i]) && tree[i][0] === LispType.Return) {\n done(undefined, new ExecReturn(context.ctx.auditReport, res, true));\n return;\n }\n ret.push(res);\n }\n done(undefined, ret);\n}\n\nexport interface AsyncDoneRet {\n isInstant: boolean;\n instant: any;\n p: Promise<{ result: any }>;\n}\n\nexport function asyncDone(callback: (done: Done) => void): AsyncDoneRet {\n let isInstant = false;\n let instant: unknown;\n const p = new Promise<any>((resolve, reject) => {\n callback((...args: unknown[]) => {\n if (args.length === 1) reject(args[0]);\n else {\n isInstant = true;\n instant = args[1];\n resolve({ result: args[1] });\n }\n });\n });\n return {\n isInstant,\n instant,\n p,\n };\n}\n\nexport function syncDone(callback: (done: Done) => void): { result: any } {\n let result;\n let err: { error: unknown } | undefined;\n callback((...args: unknown[]) => {\n err = args.length === 1 ? { error: args[0] } : undefined;\n result = args[1];\n });\n if (err) throw err.error;\n return { result };\n}\n\nexport async function execAsync<T = any>(\n ticks: Ticks,\n tree: LispItem,\n scope: Scope,\n context: IExecContext,\n doneOriginal: Done<T>,\n statementLabels: ControlFlowTargets,\n internal: boolean,\n generatorYield: ((yv: YieldValue, done?: Done) => void) | undefined,\n): Promise<void> {\n let done: Done<T> = doneOriginal;\n const p = new Promise<void>((resolve) => {\n done = (...args: unknown[]) => {\n doneOriginal(...args);\n resolve();\n };\n });\n if (\n !_execNoneRecurse(\n ticks,\n tree,\n scope,\n context,\n done,\n true,\n statementLabels,\n internal,\n generatorYield,\n ) &&\n isLisp(tree)\n ) {\n let op = tree[0];\n let obj;\n try {\n let ad: AsyncDoneRet;\n obj =\n (ad = asyncDone((d) =>\n execAsync(ticks, tree[1], scope, context, d, statementLabels, internal, generatorYield),\n )).isInstant === true\n ? ad.instant\n : (await ad.p).result;\n } catch (e) {\n done(e);\n return;\n }\n let a = obj;\n try {\n a = obj instanceof Prop ? obj.get(context) : obj;\n } catch (e) {\n done(e);\n return;\n }\n if (op === LispType.PropOptional || op === LispType.CallOptional) {\n if (a === undefined || a === null) {\n done(undefined, optional);\n return;\n }\n op = op === LispType.PropOptional ? LispType.Prop : LispType.Call;\n }\n if (a === optional) {\n if (op === LispType.Prop || op === LispType.Call) {\n done(undefined, a);\n return;\n } else {\n a = undefined;\n }\n }\n // Short-circuit for nullish coalescing: if a is not null/undefined, return a without evaluating b\n if (op === LispType.NullishCoalescing && a !== undefined && a !== null) {\n done(undefined, a);\n return;\n }\n let bobj;\n try {\n let ad: AsyncDoneRet;\n bobj =\n (ad = asyncDone((d) =>\n execAsync(ticks, tree[2], scope, context, d, statementLabels, internal, generatorYield),\n )).isInstant === true\n ? ad.instant\n : (await ad.p).result;\n } catch (e) {\n done(e);\n return;\n }\n let b = bobj;\n try {\n b = bobj instanceof Prop ? bobj.get(context) : bobj;\n } catch (e) {\n done(e);\n return;\n }\n if (b === optional) {\n b = undefined;\n }\n performOp({\n op,\n exec: execAsync,\n done,\n ticks,\n a,\n b,\n obj,\n context,\n scope,\n bobj,\n statementLabels,\n internal,\n generatorYield,\n tree,\n });\n }\n await p;\n}\n\nexport function execSync<T = any>(\n ticks: Ticks,\n tree: LispItem,\n scope: Scope,\n context: IExecContext,\n done: Done<T>,\n statementLabels: ControlFlowTargets,\n internal: boolean,\n generatorYield: ((yv: YieldValue, done?: Done) => void) | undefined,\n) {\n if (\n !_execNoneRecurse(\n ticks,\n tree,\n scope,\n context,\n done,\n false,\n statementLabels,\n internal,\n generatorYield,\n ) &&\n isLisp(tree)\n ) {\n let op = tree[0];\n let obj = syncDone((d) =>\n execSync(ticks, tree[1], scope, context, d, statementLabels, internal, generatorYield),\n ).result;\n let a = obj instanceof Prop ? obj.get(context) : obj;\n if (op === LispType.PropOptional || op === LispType.CallOptional) {\n if (a === undefined || a === null) {\n done(undefined, optional);\n return;\n }\n op = op === LispType.PropOptional ? LispType.Prop : LispType.Call;\n }\n if (a === optional) {\n if (op === LispType.Prop || op === LispType.Call) {\n done(undefined, a);\n return;\n } else {\n a = undefined;\n }\n }\n // Short-circuit for nullish coalescing: if a is not null/undefined, return a without evaluating b\n if (op === LispType.NullishCoalescing && a !== undefined && a !== null) {\n done(undefined, a);\n return;\n }\n let bobj = syncDone((d) =>\n execSync(ticks, tree[2], scope, context, d, statementLabels, internal, generatorYield),\n ).result;\n let b = bobj instanceof Prop ? bobj.get(context) : bobj;\n if (b === optional) {\n b = undefined;\n }\n performOp({\n op,\n exec: execSync,\n done,\n ticks,\n a,\n b,\n obj,\n context,\n scope,\n bobj,\n statementLabels,\n internal,\n generatorYield,\n tree,\n });\n }\n}\n\ntype OpsCallbackParams<a, b, obj, bobj> = {\n op: LispType;\n exec: Execution;\n a: a;\n b: b;\n obj: obj;\n bobj: bobj;\n ticks: Ticks;\n tree: LispItem;\n scope: Scope;\n context: IExecContext;\n done: Done;\n statementLabels: ControlFlowTargets;\n internal: boolean;\n generatorYield: ((yv: YieldValue, done?: Done) => void) | undefined;\n};\n\nexport function checkHaltExpectedTicks(\n params: OpsCallbackParams<any, any, any, any>,\n expectTicks = 0n,\n): boolean {\n const sandbox = params.context.ctx.sandbox;\n const { ticks, scope, context } = params;\n if (sandbox.halted) {\n const sub = sandbox.subscribeResume(() => {\n sub.unsubscribe();\n performOp(params, false);\n });\n return true;\n } else if (ticks.tickLimit !== undefined && ticks.tickLimit <= ticks.ticks + expectTicks) {\n const error = new SandboxExecutionQuotaExceededError('Execution quota exceeded');\n if (context.ctx.options.haltOnSandboxError) {\n const sub = sandbox.subscribeResume(() => {\n sub.unsubscribe();\n performOp(params);\n });\n sandbox.haltExecution({\n type: 'error',\n error,\n ticks,\n scope,\n context,\n });\n } else {\n params.done(error);\n }\n return true;\n } else if (ticks.nextYield && ticks.ticks > ticks.nextYield) {\n const sub = sandbox.subscribeResume(() => {\n sub.unsubscribe();\n performOp(params, false);\n });\n ticks.nextYield += NON_BLOCKING_THRESHOLD;\n sandbox.haltExecution({ type: 'yield' });\n setTimeout(() => sandbox.resumeExecution());\n return true;\n }\n ticks.ticks += expectTicks;\n return false;\n}\n\nfunction performOp(params: OpsCallbackParams<any, any, any, any>, count = true) {\n const { done, op, ticks, context, scope } = params;\n if (count) {\n ticks.ticks++;\n }\n const sandbox = context.ctx.sandbox;\n\n try {\n if (checkHaltExpectedTicks(params)) {\n return;\n }\n const o = ops.get(op);\n if (o === undefined) {\n done(new SandboxExecutionTreeError('Unknown operator: ' + op));\n return;\n }\n o(params);\n } catch (err) {\n if (context.ctx.options.haltOnSandboxError && err instanceof SandboxError) {\n const sub = sandbox.subscribeResume(() => {\n sub.unsubscribe();\n done(err);\n });\n sandbox.haltExecution({\n type: 'error',\n error: err,\n ticks,\n scope,\n context,\n });\n } else {\n done(err);\n }\n }\n}\n\nconst unexecTypes = new Set([\n LispType.ArrowFunction,\n LispType.Function,\n LispType.InlineFunction,\n LispType.Loop,\n LispType.Try,\n LispType.Switch,\n LispType.IfCase,\n LispType.InlineIfCase,\n LispType.Labeled,\n LispType.Typeof,\n]);\n\nfunction _execNoneRecurse<T = any>(\n ticks: Ticks,\n tree: LispItem,\n scope: Scope,\n context: IExecContext,\n done: Done<T>,\n isAsync: boolean,\n statementLabels: ControlFlowTargets,\n internal: boolean,\n generatorYield: ((yv: YieldValue, done?: Done) => void) | undefined,\n): boolean {\n const exec = isAsync ? execAsync : execSync;\n if (tree instanceof Prop) {\n done(undefined, tree.get(context));\n } else if (tree === optional) {\n done();\n } else if (Array.isArray(tree) && !isLisp(tree)) {\n if (tree[0] === LispType.None) {\n done();\n } else {\n execMany(\n ticks,\n exec,\n tree as Lisp[],\n done,\n scope,\n context,\n statementLabels,\n internal,\n generatorYield,\n );\n }\n } else if (!isLisp(tree)) {\n done(undefined, tree);\n } else if (tree[0] === LispType.Block) {\n execMany(\n ticks,\n exec,\n tree[1] as Lisp[],\n done,\n new Scope(scope),\n context,\n statementLabels,\n internal,\n generatorYield,\n );\n } else if (tree[0] === LispType.InternalBlock) {\n execMany(\n ticks,\n exec,\n tree[1] as Lisp[],\n done,\n scope,\n context,\n statementLabels,\n true,\n generatorYield,\n );\n } else if (tree[0] === LispType.Await) {\n if (!isAsync) {\n done(new SyntaxError(\"Illegal use of 'await', must be inside async function\"));\n } else if (context.ctx.prototypeWhitelist?.has(Promise.prototype)) {\n execAsync(\n ticks,\n tree[1],\n scope,\n context,\n async (...args: unknown[]) => {\n if (args.length === 1) done(args[0]);\n else\n try {\n done(undefined, (await sanitizeProp(args[1], context)) as any);\n } catch (err) {\n done(err);\n }\n },\n statementLabels,\n internal,\n generatorYield,\n ).catch(done);\n } else {\n done(new SandboxCapabilityError('Async/await is not permitted'));\n }\n } else if (tree[0] === LispType.Yield || tree[0] === LispType.YieldDelegate) {\n const yieldFn = generatorYield;\n if (!yieldFn) {\n done(new SyntaxError(\"Illegal use of 'yield', must be inside a generator function\"));\n return true;\n }\n const isDelegate = tree[0] === LispType.YieldDelegate;\n if (isAsync) {\n execAsync(\n ticks,\n tree[1],\n scope,\n context,\n async (...args: unknown[]) => {\n if (args.length === 1) {\n done(args[0]);\n return;\n }\n try {\n const val = await sanitizeProp(args[1], context);\n yieldFn(new YieldValue(val, isDelegate), done);\n } catch (err) {\n done(err);\n }\n },\n statementLabels,\n internal,\n generatorYield,\n ).catch(done);\n } else {\n try {\n const val = syncDone((d) =>\n execSync(ticks, tree[1], scope, context, d, statementLabels, internal, generatorYield),\n ).result;\n const sanitized = sanitizeProp(val, context);\n // Pass `done` as second arg so the yieldFn can call it with the injected value.\n // For capture-mode yieldFns (executeGenBody default case), this enables the restart loop.\n // For plain yieldFns (eager mode), done? is ignored and done() is called below.\n yieldFn(new YieldValue(sanitized, isDelegate), done);\n // If yieldFn did not call done (it threw syncYieldPauseSentinel instead), we fall through\n // to the catch which re-throws the sentinel. Otherwise yieldFn called done itself.\n } catch (err) {\n if (err === syncYieldPauseSentinel) throw err; // propagate pause up to restart loop\n done(err);\n }\n }\n } else if (unexecTypes.has(tree[0])) {\n performOp({\n op: tree[0],\n exec,\n done,\n ticks,\n a: tree[1],\n b: tree[2],\n obj: tree,\n tree,\n context,\n scope,\n bobj: undefined,\n statementLabels,\n internal,\n generatorYield,\n });\n } else {\n return false;\n }\n return true;\n}\nexport function executeTree<T>(\n ticks: Ticks,\n context: IExecContext,\n executionTree: Lisp[],\n scopes: IScope[] = [],\n statementLabels: ControlFlowTargets,\n internal: boolean,\n generatorYield?: ((yv: YieldValue, done?: Done) => void) | undefined,\n): ExecReturn<T> {\n return syncDone((done) =>\n executeTreeWithDone(\n execSync,\n done,\n ticks,\n context,\n executionTree,\n scopes,\n statementLabels,\n internal,\n generatorYield,\n ),\n ).result;\n}\n\nexport async function executeTreeAsync<T>(\n ticks: Ticks,\n context: IExecContext,\n executionTree: Lisp[],\n scopes: IScope[] = [],\n statementLabels: ControlFlowTargets,\n internal: boolean,\n generatorYield?: ((yv: YieldValue, done?: Done) => void) | undefined,\n): Promise<ExecReturn<T>> {\n let ad: AsyncDoneRet;\n return (ad = asyncDone((done) =>\n executeTreeWithDone(\n execAsync,\n done,\n ticks,\n context,\n executionTree,\n scopes,\n statementLabels,\n internal,\n generatorYield,\n ),\n )).isInstant === true\n ? ad.instant\n : (await ad.p).result;\n}\n\nexport function executeTreeWithDone(\n exec: Execution,\n done: Done,\n ticks: Ticks,\n context: IExecContext,\n executionTree: Lisp[],\n scopes: IScope[] = [],\n statementLabels: ControlFlowTargets,\n internal: boolean,\n generatorYield?: ((yv: YieldValue, done?: Done) => void) | undefined,\n) {\n if (!executionTree) {\n done();\n return;\n }\n if (!(executionTree instanceof Array)) {\n throw new SyntaxError('Bad execution tree');\n }\n let scope = context.ctx.globalScope;\n let s;\n while ((s = scopes.shift())) {\n if (typeof s !== 'object') continue;\n if (s instanceof Scope) {\n scope = s;\n } else {\n scope = new Scope(scope, s, s instanceof LocalScope ? undefined : null);\n }\n }\n if (context.ctx.options.audit && !context.ctx.auditReport) {\n context.ctx.auditReport = {\n globalsAccess: new Set(),\n prototypeAccess: {},\n };\n }\n if (exec === execSync) {\n _executeWithDoneSync(\n done,\n ticks,\n context,\n executionTree,\n scope,\n statementLabels,\n internal,\n generatorYield,\n );\n } else {\n _executeWithDoneAsync(\n done,\n ticks,\n context,\n executionTree,\n scope,\n statementLabels,\n internal,\n generatorYield,\n ).catch(done);\n }\n}\n\nfunction _executeWithDoneSync(\n done: Done,\n ticks: Ticks,\n context: IExecContext,\n executionTree: Lisp[],\n scope: Scope,\n statementLabels: ControlFlowTargets,\n internal: boolean,\n generatorYield: ((yv: YieldValue, done?: Done) => void) | undefined,\n) {\n if (!(executionTree instanceof Array)) throw new SyntaxError('Bad execution tree');\n let i = 0;\n for (i = 0; i < executionTree.length; i++) {\n let res: unknown;\n let err: { error: unknown } | undefined;\n const current = executionTree[i];\n try {\n execSync(\n ticks,\n current,\n scope,\n context,\n (...args: unknown[]) => {\n if (args.length === 1) err = { error: args[0] };\n else res = args[1];\n },\n statementLabels,\n internal,\n generatorYield,\n );\n } catch (e) {\n err = { error: e };\n }\n if (err) {\n done(err.error);\n return;\n }\n if (res instanceof ExecReturn) {\n done(undefined, res);\n return;\n }\n if (isLisp(current) && current[0] === LispType.Return) {\n done(undefined, new ExecReturn(context.ctx.auditReport, res, true));\n return;\n }\n }\n done(undefined, new ExecReturn(context.ctx.auditReport, undefined, false));\n}\n\nasync function _executeWithDoneAsync(\n done: Done,\n ticks: Ticks,\n context: IExecContext,\n executionTree: Lisp[],\n scope: Scope,\n statementLabels: ControlFlowTargets,\n internal: boolean,\n generatorYield: ((yv: YieldValue, done?: Done) => void) | undefined,\n) {\n if (!(executionTree instanceof Array)) throw new SyntaxError('Bad execution tree');\n let i = 0;\n for (i = 0; i < executionTree.length; i++) {\n let res: unknown;\n let err: { error: unknown } | undefined;\n const current = executionTree[i];\n try {\n await execAsync(\n ticks,\n current,\n scope,\n context,\n (...args: unknown[]) => {\n if (args.length === 1) err = { error: args[0] };\n else res = args[1];\n },\n statementLabels,\n internal,\n generatorYield,\n );\n } catch (e) {\n err = { error: e };\n }\n if (err) {\n done(err.error);\n return;\n }\n if (res instanceof ExecReturn) {\n done(undefined, res);\n return;\n }\n if (isLisp(current) && current[0] === LispType.Return) {\n done(undefined, new ExecReturn(context.ctx.auditReport, res, true));\n return;\n }\n }\n done(undefined, new ExecReturn(context.ctx.auditReport, undefined, false));\n}\n","import { CodeString, LispType, SandboxCapabilityError } from '../../utils';\nimport type { IConstants, IfLisp, IfCase, Lisp, Switch, SwitchCase } from '../lisp';\nimport type { RegisterLispTypesDeps } from './shared';\n\nexport function registerConditionalLispTypes({\n createLisp,\n emptyString,\n extractStatementLabels,\n insertSemicolons,\n lispifyBlock,\n lispifyExpr,\n restOfExp,\n semiColon,\n setLispType,\n wrapLabeledStatement,\n}: RegisterLispTypesDeps) {\n const inlineIfElse = /^:/;\n const elseIf = /^else(?![\\w$])/;\n const ifElse = /^if(?![\\w$])/;\n\n function extractIfElse(constants: IConstants, part: CodeString, depth = 0) {\n if (depth > constants.maxDepth) {\n throw new SandboxCapabilityError('Maximum expression depth exceeded');\n }\n let count = 0;\n let found = part.substring(0, 0);\n let foundElse = emptyString;\n let foundTrue: CodeString | undefined;\n let first = true;\n let elseReg: RegExpExecArray | null;\n let details: any = {};\n while (\n (found = restOfExp(\n constants,\n part.substring(found.end - part.start),\n [elseIf, ifElse, semiColon],\n undefined,\n undefined,\n undefined,\n details,\n )).length ||\n first\n ) {\n first = false;\n const f = part.substring(found.end - part.start).toString();\n\n if (f.startsWith('if')) {\n found.end++;\n count++;\n } else if (f.startsWith('else')) {\n foundTrue = part.substring(0, found.end - part.start);\n found.end++;\n count--;\n if (!count) {\n found.end--;\n }\n } else if ((elseReg = /^;?\\s*else(?![\\w$])/.exec(f))) {\n foundTrue = part.substring(0, found.end - part.start);\n found.end += elseReg[0].length - 1;\n count--;\n if (!count) {\n found.end -= elseReg[0].length - 1;\n }\n } else {\n foundTrue = foundElse.length ? foundTrue : part.substring(0, found.end - part.start);\n break;\n }\n if (!count) {\n const ie = extractIfElse(\n constants,\n part.substring(found.end - part.start + (/^;?\\s*else(?![\\w$])/.exec(f)?.[0].length || 0)),\n depth + 1,\n );\n foundElse = ie.all;\n break;\n }\n details = {};\n }\n foundTrue = foundTrue || part.substring(0, found.end - part.start);\n return {\n all: part.substring(0, Math.max(foundTrue.end, foundElse.end) - part.start),\n true: foundTrue,\n false: foundElse,\n };\n }\n\n setLispType(['if'] as const, (ctx) => {\n const { constants, part, res } = ctx;\n const labels = extractStatementLabels(res[1]);\n let condition = restOfExp(constants, part.substring(res[0].length), [], '(');\n const ie = extractIfElse(constants, part.substring(res[1].length));\n const startTrue = res[0].length - res[1].length + condition.length + 1;\n\n let trueBlock = ie.true.substring(startTrue);\n let elseBlock = ie.false;\n\n condition = condition.trim();\n trueBlock = trueBlock.trim();\n elseBlock = elseBlock.trim();\n\n if (!trueBlock.length || /^else(?![\\w$])/.test(trueBlock.toString())) {\n throw new SyntaxError('Unexpected token');\n }\n if (trueBlock.char(0) === '{') trueBlock = trueBlock.slice(1, -1);\n if (elseBlock.char(0) === '{') elseBlock = elseBlock.slice(1, -1);\n ctx.lispTree = wrapLabeledStatement(\n labels,\n createLisp<IfLisp>({\n op: LispType.If,\n a: lispifyExpr(constants, condition, undefined, ctx),\n b: createLisp<IfCase>({\n op: LispType.IfCase,\n a: lispifyBlock(trueBlock, constants, false, ctx),\n b: lispifyBlock(elseBlock, constants, false, ctx),\n }),\n }),\n ) as Lisp;\n });\n\n setLispType(['switch'] as const, (ctx) => {\n const { constants, part, res } = ctx;\n const labels = extractStatementLabels(res[1]);\n const test = restOfExp(constants, part.substring(res[0].length), [], '(');\n let start = part.toString().indexOf('{', res[0].length + test.length + 1);\n if (start === -1) throw new SyntaxError('Invalid switch');\n let statement = insertSemicolons(\n constants,\n restOfExp(constants, part.substring(start + 1), [], '{'),\n );\n let caseFound: RegExpExecArray | null;\n const caseTest = /^\\s*(case\\s|default)\\s*/;\n const caseNoTestReg = /^\\s*case\\s*:/;\n const cases: SwitchCase[] = [];\n let defaultFound = false;\n while (\n (caseFound = caseTest.exec(statement.toString())) ||\n caseNoTestReg.test(statement.toString())\n ) {\n if (!caseFound) {\n throw new SyntaxError('Unexpected end of expression');\n }\n if (caseFound[1] === 'default') {\n if (defaultFound) throw new SyntaxError('Only one default switch case allowed');\n defaultFound = true;\n }\n const cond = restOfExp(constants, statement.substring(caseFound[0].length), [/^:/]);\n if (caseFound[1] !== 'default' && !cond.trimStart().length) {\n throw new SyntaxError('Unexpected end of expression');\n }\n let found = emptyString;\n let i = (start = caseFound[0].length + cond.length + 1);\n const bracketFound = /^\\s*\\{/.exec(statement.substring(i).toString());\n let exprs: Lisp[] = [];\n if (bracketFound) {\n i += bracketFound[0].length;\n found = restOfExp(constants, statement.substring(i), [], '{');\n i += found.length + 1;\n exprs = lispifyBlock(found, constants, false, ctx);\n } else {\n const notEmpty = restOfExp(constants, statement.substring(i), [caseTest]);\n if (!notEmpty.trim().length) {\n exprs = [];\n i += notEmpty.length;\n } else {\n while ((found = restOfExp(constants, statement.substring(i), [semiColon])).length) {\n i += found.length + (statement.char(i + found.length) === ';' ? 1 : 0);\n if (caseTest.test(statement.substring(i).toString())) {\n break;\n }\n }\n exprs = lispifyBlock(\n statement.substring(start, found.end - statement.start),\n constants,\n false,\n ctx,\n );\n }\n }\n statement = statement.substring(i);\n cases.push(\n createLisp<SwitchCase>({\n op: LispType.SwitchCase,\n a:\n caseFound[1] === 'default'\n ? LispType.None\n : lispifyExpr(constants, cond, undefined, ctx),\n b: exprs,\n }),\n );\n }\n ctx.lispTree = wrapLabeledStatement(\n labels,\n createLisp<Switch>({\n op: LispType.Switch,\n a: lispifyExpr(constants, test, undefined, ctx),\n b: cases,\n }),\n ) as Lisp;\n });\n\n void inlineIfElse;\n}\n","import { CodeString, LispType } from '../../utils';\nimport type {\n Block,\n InternalCode,\n Lisp,\n LispItem,\n Loop,\n LoopAction,\n StatementLabel,\n Try,\n} from '../lisp';\nimport type { RegisterLispTypesDeps } from './shared';\n\nexport function registerControlLispTypes({\n ParseError,\n createLisp,\n emptyString,\n expandDestructure,\n extractStatementLabels,\n insertSemicolons,\n lispify,\n lispifyBlock,\n lispifyExpr,\n lispifyReturnExpr,\n restOfExp,\n semiColon,\n setLispType,\n startingExecpted,\n wrapLabeledStatement,\n}: RegisterLispTypesDeps) {\n const iteratorRegex =\n /^((let|var|const|internal)\\s+)?\\s*([a-zA-Z$_][a-zA-Z\\d$_]*)\\s+(in|of)(?![\\w$])/;\n const iteratorDestructureRegex = /^((let|var|const|internal)\\s+)\\s*([[{])/;\n\n const ofStart2 = lispify(\n { maxDepth: 10 } as any,\n new CodeString('let $$iterator = $$obj[Symbol.iterator]()'),\n ['initialize'],\n );\n const ofStart3 = lispify(\n { maxDepth: 10 } as any,\n new CodeString('let $$next = $$iterator.next()'),\n ['initialize'],\n );\n const ofCondition = lispify({ maxDepth: 10 } as any, new CodeString('return !$$next.done'), [\n 'initialize',\n ]);\n const ofStep = lispify({ maxDepth: 10 } as any, new CodeString('$$next = $$iterator.next()'));\n const asyncOfStart2 = lispify({ maxDepth: 10 } as any, new CodeString('let $$iterator = $$obj'), [\n 'initialize',\n ]);\n const asyncOfStart3 = lispify(\n { maxDepth: 10 } as any,\n new CodeString('let $$next = $$iterator.next()'),\n ['initialize'],\n );\n const asyncOfStep = lispify(\n { maxDepth: 10 } as any,\n new CodeString('$$next = $$iterator.next()'),\n );\n const inStart2 = lispify(\n { maxDepth: 10 } as any,\n new CodeString('let $$keys = Object.keys($$obj)'),\n ['initialize'],\n );\n const inStart3 = lispify({ maxDepth: 10 } as any, new CodeString('let $$keyIndex = 0'), [\n 'initialize',\n ]);\n const inStep = lispify({ maxDepth: 10 } as any, new CodeString('$$keyIndex++'));\n const inCondition = lispify(\n { maxDepth: 10 } as any,\n new CodeString('return $$keyIndex < $$keys.length'),\n ['initialize'],\n );\n\n setLispType(['for', 'do', 'while'] as const, (ctx) => {\n const { constants, type, part, res } = ctx;\n const labels = extractStatementLabels(res[1]);\n let i = 0;\n let startStep: LispItem = LispType.True;\n let startInternal: Lisp[] = [];\n let getIterator: Lisp | LispType.None = LispType.None;\n let beforeStep: LispItem = LispType.None;\n let checkFirst = LispType.True;\n let condition: LispItem;\n let step: LispItem = LispType.True;\n let body: CodeString;\n const isForAwait: LispItem = type === 'for' && res[2] ? LispType.True : LispType.None;\n switch (type) {\n case 'while': {\n i = part.toString().indexOf('(') + 1;\n const extract = restOfExp(constants, part.substring(i), [], '(');\n if (!extract.trimStart().length) {\n throw new SyntaxError('Unexpected end of expression');\n }\n condition = lispifyReturnExpr(constants, extract);\n body = restOfExp(constants, part.substring(i + extract.length + 1)).trim();\n if (body.char(0) === '{') body = body.slice(1, -1);\n break;\n }\n case 'for': {\n i = part.toString().indexOf('(') + 1;\n const args: CodeString[] = [];\n let extract2 = emptyString;\n for (let k = 0; k < 3; k++) {\n extract2 = restOfExp(constants, part.substring(i), [/^[;)]/]);\n args.push(extract2.trim());\n i += extract2.length + 1;\n if (part.char(i - 1) === ')') break;\n }\n let iterator: RegExpExecArray | null;\n let iteratorDestructure: RegExpExecArray | null;\n if (args.length === 1 && (iterator = iteratorRegex.exec(args[0].toString()))) {\n const iterableExpr = args[0].substring(iterator[0].length);\n if (!iterableExpr.trimStart().length) {\n throw new SyntaxError('Unexpected end of expression');\n }\n if (iterator[4] === 'of') {\n getIterator = lispifyReturnExpr(constants, iterableExpr);\n startInternal = isForAwait ? [asyncOfStart2, asyncOfStart3] : [ofStart2, ofStart3];\n condition = ofCondition;\n step = isForAwait ? asyncOfStep : ofStep;\n beforeStep = lispify(\n constants,\n new CodeString((iterator[1] || 'let ') + iterator[3] + ' = $$next.value'),\n ['initialize'],\n );\n } else {\n if (isForAwait) {\n throw new SyntaxError(\"Unexpected token 'in'\");\n }\n getIterator = lispifyReturnExpr(constants, iterableExpr);\n startInternal = [inStart2, inStart3];\n step = inStep;\n condition = inCondition;\n beforeStep = lispify(\n constants,\n new CodeString((iterator[1] || 'let ') + iterator[3] + ' = $$keys[$$keyIndex]'),\n ['initialize'],\n );\n }\n } else if (\n args.length === 1 &&\n (iteratorDestructure = iteratorDestructureRegex.exec(args[0].toString()))\n ) {\n const keyword = iteratorDestructure[1].trim();\n const openBracket = iteratorDestructure[3];\n const closeBracket = openBracket === '[' ? ']' : '}';\n const keywordPrefixLen = iteratorDestructure[0].length - 1;\n const patternContent = restOfExp(\n constants,\n args[0].substring(keywordPrefixLen + 1),\n [],\n openBracket,\n );\n const patternStr = openBracket + patternContent.toString() + closeBracket;\n const afterClose = args[0]\n .substring(keywordPrefixLen + 1 + patternContent.length + 1)\n .trimStart();\n const inOfMatch = /^(in|of)(?![\\w$])\\s*/.exec(afterClose.toString());\n if (!inOfMatch) throw new SyntaxError('Invalid for loop definition');\n const inOf = inOfMatch[1];\n const iterExpr = afterClose.substring(inOfMatch[0].length);\n if (!iterExpr.trimStart().length) {\n throw new SyntaxError('Unexpected end of expression');\n }\n const tempVarName = '$$_fv';\n if (inOf === 'of') {\n getIterator = lispifyReturnExpr(constants, iterExpr);\n startInternal = isForAwait ? [asyncOfStart2, asyncOfStart3] : [ofStart2, ofStart3];\n condition = ofCondition;\n step = isForAwait ? asyncOfStep : ofStep;\n const expandedCode = expandDestructure(keyword, patternStr, tempVarName);\n const stmts = lispifyBlock(new CodeString(expandedCode), constants, false, ctx);\n beforeStep = createLisp<InternalCode>({\n op: LispType.InternalBlock,\n a: [\n lispify(constants, new CodeString(`${keyword} ${tempVarName} = $$next.value`), [\n 'initialize',\n ]),\n ...stmts,\n ],\n b: LispType.None,\n });\n } else {\n getIterator = lispifyReturnExpr(constants, iterExpr);\n startInternal = [inStart2, inStart3];\n step = inStep;\n condition = inCondition;\n const expandedCode = expandDestructure(keyword, patternStr, tempVarName);\n const stmts = lispifyBlock(new CodeString(expandedCode), constants, false, ctx);\n beforeStep = createLisp<InternalCode>({\n op: LispType.InternalBlock,\n a: [\n lispify(\n constants,\n new CodeString(`${keyword} ${tempVarName} = $$keys[$$keyIndex]`),\n ['initialize'],\n ),\n ...stmts,\n ],\n b: LispType.None,\n });\n }\n } else if (args.length === 3) {\n const [startArg, conditionArg, stepArg] = args;\n if (startArg.length) {\n startStep = lispifyExpr(constants, startArg, startingExecpted, ctx);\n }\n condition = conditionArg.length\n ? lispifyReturnExpr(constants, conditionArg)\n : LispType.True;\n if (stepArg.length) {\n step = lispifyExpr(constants, stepArg, undefined, ctx);\n }\n } else {\n throw new SyntaxError('Invalid for loop definition');\n }\n body = restOfExp(constants, part.substring(i)).trim();\n if (body.char(0) === '{') body = body.slice(1, -1);\n break;\n }\n case 'do': {\n checkFirst = LispType.None;\n const isBlock = !!res[2];\n body = restOfExp(constants, part.substring(res[0].length), isBlock ? [/^\\}/] : [semiColon]);\n condition = lispifyReturnExpr(\n constants,\n restOfExp(\n constants,\n part.substring(part.toString().indexOf('(', res[0].length + body.length) + 1),\n [],\n '(',\n ),\n );\n break;\n }\n }\n const a = [\n checkFirst,\n startInternal,\n getIterator,\n startStep,\n step,\n condition,\n beforeStep,\n isForAwait,\n labels,\n ] as LispItem;\n ctx.lispTree = createLisp<Loop>({\n op: LispType.Loop,\n a,\n b: lispifyBlock(body, constants, false, ctx),\n });\n });\n\n setLispType(['block'] as const, (ctx) => {\n const { constants, part, res } = ctx;\n const labels = extractStatementLabels(res[1]);\n ctx.lispTree = wrapLabeledStatement(\n labels,\n createLisp<Block>({\n op: LispType.Block,\n a: lispifyBlock(\n restOfExp(constants, part.substring(res[0].length), [], '{'),\n constants,\n false,\n ctx,\n ),\n b: LispType.None,\n }),\n ) as Lisp;\n });\n\n setLispType(['loopAction'] as const, (ctx) => {\n const { part, res } = ctx;\n const remaining = part.substring(res[0].length).trimStart();\n if (remaining.length && !res[2]) {\n throw new SyntaxError(`Unexpected token '${remaining.char(0)}'`);\n }\n ctx.lispTree = createLisp<LoopAction>({\n op: LispType.LoopAction,\n a: res[1],\n b: (res[2] || LispType.None) as StatementLabel,\n });\n });\n\n const catchReg = /^\\s*(catch\\s*(\\(\\s*([a-zA-Z$_][a-zA-Z\\d$_]*)\\s*\\))?|finally)\\s*\\{/;\n const catchEmptyBindingReg = /^\\s*catch\\s*\\(\\s*\\)/;\n const catchReservedBindingReg =\n /^\\s*catch\\s*\\(\\s*(break|case|catch|continue|debugger|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|this|throw|try|typeof|var|void|while|with|class|const|enum|export|extends|implements|import|interface|let|package|private|protected|public|static|super|yield|await)\\s*\\)/;\n const finallyKeywordReg = /^\\s*finally\\b/;\n\n setLispType(['try'] as const, (ctx) => {\n const { constants, part, res } = ctx;\n const body = restOfExp(constants, part.substring(res[0].length), [], '{');\n const afterBody = part.substring(res[0].length + body.length + 1).toString();\n\n if (catchEmptyBindingReg.test(afterBody)) {\n throw new ParseError(\"Unexpected token ')'\", part.toString());\n }\n\n const reservedMatch = catchReservedBindingReg.exec(afterBody);\n if (reservedMatch) {\n throw new ParseError(`Unexpected token '${reservedMatch[1]}'`, part.toString());\n }\n\n const finallyMatch = finallyKeywordReg.exec(afterBody);\n if (finallyMatch && !/^\\s*\\{/.test(afterBody.substring(finallyMatch[0].length))) {\n throw new ParseError('Unexpected token', part.toString());\n }\n\n let catchRes = catchReg.exec(afterBody);\n let finallyBody;\n let exception = '';\n let catchBody;\n let offset = 0;\n\n if (!catchRes) {\n throw new ParseError('Missing catch or finally after try', part.toString());\n }\n\n if (catchRes[1].startsWith('catch')) {\n catchRes = catchReg.exec(part.substring(res[0].length + body.length + 1).toString());\n exception = catchRes![3] || '';\n catchBody = restOfExp(\n constants,\n part.substring(res[0].length + body.length + 1 + catchRes![0].length),\n [],\n '{',\n );\n offset = res[0].length + body.length + 1 + catchRes![0].length + catchBody.length + 1;\n if (\n (catchRes = catchReg.exec(part.substring(offset).toString())) &&\n catchRes[1].startsWith('finally')\n ) {\n finallyBody = restOfExp(constants, part.substring(offset + catchRes[0].length), [], '{');\n }\n } else {\n finallyBody = restOfExp(\n constants,\n part.substring(res[0].length + body.length + 1 + catchRes![0].length),\n [],\n '{',\n );\n }\n const b = [\n exception,\n lispifyBlock(insertSemicolons(constants, catchBody || emptyString), constants, false, ctx),\n lispifyBlock(insertSemicolons(constants, finallyBody || emptyString), constants, false, ctx),\n ] as LispItem;\n ctx.lispTree = wrapLabeledStatement(\n extractStatementLabels(res[1]),\n createLisp<Try>({\n op: LispType.Try,\n a: lispifyBlock(insertSemicolons(constants, body), constants, false, ctx),\n b,\n }),\n ) as Lisp;\n });\n}\n","import { CodeString, LispType, reservedWords } from '../../utils';\nimport type {\n ArrowFunction,\n Const,\n Function as FunctionLisp,\n InlineFunction,\n Internal,\n InternalCode,\n Let,\n Var,\n} from '../lisp';\nimport type { RegisterLispTypesDeps } from './shared';\n\nexport function registerDeclarationLispTypes({\n createLisp,\n expectTypes,\n expandDestructure,\n expandFunctionParamDestructure,\n lispify,\n lispifyBlock,\n lispifyFunction,\n restOfExp,\n semiColon,\n setLispType,\n splitByCommasDestructure,\n}: RegisterLispTypesDeps) {\n setLispType(['initializeDestructure'] as const, (ctx) => {\n const { constants, part, res } = ctx;\n const keyword = res[1] as string;\n const openBracket = res[2] as string;\n const closeBracket = openBracket === '[' ? ']' : '}';\n\n const patternContent = restOfExp(constants, part.substring(res[0].length), [], openBracket);\n const patternStr = openBracket + patternContent.toString() + closeBracket;\n\n const afterClose = part.substring(res[0].length + patternContent.length + 1).trimStart();\n if (!afterClose.length || afterClose.char(0) !== '=') {\n throw new SyntaxError('Destructuring declaration requires an initializer');\n }\n\n const rhsCode = restOfExp(constants, afterClose.substring(1).trimStart(), [semiColon]);\n const rhsStr = rhsCode.toString();\n const expandedCode = expandDestructure(keyword, patternStr, rhsStr);\n const stmts = lispifyBlock(new CodeString(expandedCode), constants, false, ctx);\n\n ctx.lispTree = createLisp<InternalCode>({\n op: LispType.InternalBlock,\n a: stmts,\n b: LispType.None,\n });\n });\n\n setLispType(['initialize'] as const, (ctx) => {\n const { constants, part, res, expect } = ctx;\n const lt =\n res[1] === 'var'\n ? LispType.Var\n : res[1] === 'let'\n ? LispType.Let\n : res[1] === 'const'\n ? LispType.Const\n : LispType.Internal;\n if (!res[3]) {\n ctx.lispTree = lispify(\n constants,\n part.substring(res[0].length),\n expectTypes[expect].next,\n createLisp<Var | Let | Const | Internal>({\n op: lt,\n a: res[2],\n b: LispType.None,\n }),\n false,\n ctx,\n );\n } else {\n const initExpr = part.substring(res[0].length);\n if (!initExpr.trimStart().length) {\n throw new SyntaxError('Unexpected end of expression');\n }\n ctx.lispTree = createLisp<Var | Let | Const | Internal>({\n op: lt,\n a: res[2],\n b: lispify(constants, initExpr, expectTypes[expect].next, undefined, false, ctx),\n });\n }\n });\n\n setLispType(\n ['function', 'inlineFunction', 'arrowFunction', 'arrowFunctionSingle'] as const,\n (ctx) => {\n const { constants, type, part, res, expect, generatorDepth, asyncDepth } = ctx;\n const isArrow = type !== 'function' && type !== 'inlineFunction';\n const isReturn = isArrow && !res[res.length - 1];\n const isGenerator =\n !isArrow && res[2] && res[2].trimStart().startsWith('*') ? LispType.True : LispType.None;\n const isAsync = res[1] ? LispType.True : LispType.None;\n let rawArgStr: string;\n let bodyOffset: number;\n if (type === 'function' || type === 'inlineFunction') {\n const argsCode = restOfExp(constants, part.substring(res[0].length), [], '(');\n rawArgStr = argsCode.toString().trim();\n bodyOffset = res[0].length + argsCode.length + 1;\n const afterParen = part.substring(bodyOffset).trimStart();\n bodyOffset = part.length - afterParen.length + 1;\n } else {\n rawArgStr = res[2] ?? '';\n bodyOffset = 0;\n }\n const rawArgs: string[] = rawArgStr\n ? splitByCommasDestructure(rawArgStr)\n .map((a) => a.trim())\n .filter(Boolean)\n : [];\n const args: string[] = [...rawArgs];\n if (!isArrow) {\n args.unshift((res[3] || '').trimStart());\n }\n let ended = false;\n args.forEach((arg: string) => {\n if (ended) throw new SyntaxError('Rest parameter must be last formal parameter');\n if (arg.startsWith('...')) ended = true;\n });\n const f = restOfExp(\n constants,\n isArrow ? part.substring(res[0].length) : part.substring(bodyOffset),\n !isReturn ? [/^}/] : [/^[,)}\\]]/, semiColon],\n );\n let funcBody = isReturn ? 'return ' + f : f.toString();\n const funcArgs = isArrow ? args : args.slice(1);\n const expanded = expandFunctionParamDestructure(funcArgs, funcBody);\n const finalArgs = isArrow ? expanded.args : [args[0], ...expanded.args];\n funcBody = expanded.body;\n finalArgs.forEach((arg: string) => {\n if (reservedWords.has(arg.replace(/^\\.\\.\\./, ''))) {\n throw new SyntaxError(`Unexpected token '${arg}'`);\n }\n });\n const afterFunc = isArrow ? res[0].length + f.length + 1 : bodyOffset + f.length + 1;\n ctx.lispTree = lispify(\n constants,\n part.substring(afterFunc),\n expectTypes[expect].next,\n createLisp<FunctionLisp | InlineFunction | ArrowFunction>({\n op: isArrow\n ? LispType.ArrowFunction\n : type === 'function'\n ? LispType.Function\n : LispType.InlineFunction,\n a: isArrow ? [isAsync, ...finalArgs] : [isAsync, isGenerator, ...finalArgs],\n b: constants.eager\n ? lispifyFunction(\n new CodeString(funcBody),\n constants,\n false,\n isArrow\n ? { generatorDepth: 0, asyncDepth: 0, lispDepth: 0 }\n : {\n generatorDepth: isGenerator === LispType.True ? generatorDepth + 1 : 0,\n asyncDepth: isAsync === LispType.True ? asyncDepth + 1 : 0,\n lispDepth: 0,\n },\n )\n : funcBody,\n }),\n false,\n ctx,\n );\n },\n );\n}\n","import { CodeString, isLisp, LispType } from '../../utils';\nimport type {\n AddEquals,\n And,\n AndEquals,\n Assigns,\n BigInt as BigIntLisp,\n BitAnd,\n BitAndEquals,\n BitNegate,\n BitNegateEquals,\n BitOr,\n BitOrEquals,\n BitShiftLeft,\n BitShiftRight,\n BitUnsignedShiftRight,\n Call,\n CreateArray,\n DecrementAfter,\n DecrementBefore,\n Delete,\n Divide,\n DivideEquals,\n Equal,\n GlobalSymbol,\n In,\n IncrementAfter,\n IncrementBefore,\n InlineIf,\n InlineIfCase,\n Instanceof,\n InternalCode,\n Inverse,\n LargerEqualThan,\n LargerThan,\n Lisp,\n Minus,\n Modulus,\n ModulusEquals,\n Multiply,\n MultiplyEquals,\n Negative,\n Not,\n NotEqual,\n NullishCoalescing,\n NullishCoalescingEquals,\n Number as NumberLisp,\n Or,\n OrEquals,\n Plus,\n Positive,\n Power,\n PowerEquals,\n ShiftLeftEquals,\n ShiftRightEquals,\n SmallerEqualThan,\n SmallerThan,\n StrictEqual,\n StrictNotEqual,\n StringIndex,\n SubractEquals,\n Typeof,\n UnsignedShiftRightEquals,\n} from '../lisp';\nimport type { RegisterLispTypesDeps } from './shared';\n\nexport function registerOperatorLispTypes({\n createLisp,\n expandDestructure,\n expectTypes,\n getDestructurePatternSource,\n lispifyBlock,\n restOfExp,\n lispify,\n lispifyExpr,\n setLispType,\n}: RegisterLispTypesDeps) {\n const inlineIfElse = /^:/;\n\n const modifierTypes = {\n inverse: LispType.Inverse,\n not: LispType.Not,\n positive: LispType.Positive,\n negative: LispType.Negative,\n typeof: LispType.Typeof,\n delete: LispType.Delete,\n } as const;\n\n setLispType(['inverse', 'not', 'negative', 'positive', 'typeof', 'delete'] as const, (ctx) => {\n const { constants, type, part, res, expect } = ctx;\n const extract = restOfExp(constants, part.substring(res[0].length), [/^([^\\s.?\\w$]|\\?[^.])/]);\n const remainingAfterOperand = part.substring(extract.length + res[0].length);\n const remainingStr = remainingAfterOperand.trim().toString();\n if (remainingStr.startsWith('**')) {\n throw new SyntaxError(\n 'Unary operator used immediately before exponentiation expression. Parenthesis must be used to disambiguate operator precedence',\n );\n }\n\n ctx.lispTree = lispify(\n constants,\n part.substring(extract.length + res[0].length),\n restOfExp.next,\n createLisp<Inverse | Not | Negative | Positive | Typeof | Delete>({\n op: modifierTypes[type],\n a: ctx.lispTree,\n b: lispify(constants, extract, expectTypes[expect].next),\n }),\n false,\n ctx,\n );\n });\n\n setLispType(['taggedTemplate'] as const, (ctx) => {\n const { constants, part, res, expect } = ctx;\n const literalIndex = res[1];\n const literal = constants.literals[parseInt(literalIndex)];\n const [, templateStr, jsExprs] = literal;\n const stringParts: string[] = [];\n const expressions: Lisp[] = [];\n let currentStr = '';\n let i = 0;\n\n while (i < templateStr.length) {\n if (templateStr.substring(i, i + 2) === '${') {\n let j = i + 2;\n let exprIndex = '';\n let isValidPlaceholder = false;\n while (j < templateStr.length && templateStr[j] !== '}') {\n exprIndex += templateStr[j];\n j++;\n }\n if (j < templateStr.length && templateStr[j] === '}' && /^\\d+$/.test(exprIndex)) {\n isValidPlaceholder = true;\n }\n\n if (isValidPlaceholder) {\n stringParts.push(currentStr);\n currentStr = '';\n expressions.push(jsExprs[parseInt(exprIndex)]);\n i = j + 1;\n } else {\n currentStr += templateStr[i];\n i++;\n }\n } else {\n currentStr += templateStr[i];\n i++;\n }\n }\n stringParts.push(currentStr);\n\n const stringsArray = stringParts.map((str) =>\n createLisp<StringIndex>({\n op: LispType.StringIndex,\n a: LispType.None,\n b: String(constants.strings.push(str) - 1),\n }),\n );\n\n const stringsArrayLisp = createLisp<CreateArray>({\n op: LispType.CreateArray,\n a: createLisp({\n op: LispType.None,\n a: LispType.None,\n b: LispType.None,\n }),\n b: stringsArray,\n });\n\n ctx.lispTree = lispify(\n constants,\n part.substring(res[0].length),\n expectTypes[expect].next,\n createLisp<Call>({\n op: LispType.Call,\n a: ctx.lispTree,\n b: [stringsArrayLisp, ...expressions],\n }),\n false,\n ctx,\n );\n });\n\n const incrementTypes = {\n '++$': LispType.IncrementBefore,\n '--$': LispType.DecrementBefore,\n '$++': LispType.IncrementAfter,\n '$--': LispType.DecrementAfter,\n } as any;\n\n setLispType(['incrementerBefore'] as const, (ctx) => {\n const { constants, part, res } = ctx;\n const extract = restOfExp(constants, part.substring(2), [/^[^\\s.\\w$]/]);\n ctx.lispTree = lispify(\n constants,\n part.substring(extract.length + 2),\n restOfExp.next,\n createLisp<IncrementBefore | DecrementBefore>({\n op: incrementTypes[res[0] + '$'],\n a: lispify(constants, extract, expectTypes.incrementerBefore.next),\n b: LispType.None,\n }),\n false,\n ctx,\n );\n });\n\n setLispType(['incrementerAfter'] as const, (ctx) => {\n const { constants, part, res, expect } = ctx;\n if (\n ctx.lispTree[0] === LispType.Number ||\n ctx.lispTree[0] === LispType.BigInt ||\n ctx.lispTree[0] === LispType.GlobalSymbol ||\n ctx.lispTree[0] === LispType.StringIndex ||\n ctx.lispTree[0] === LispType.LiteralIndex ||\n ctx.lispTree[0] === LispType.RegexIndex\n ) {\n throw new SyntaxError('Invalid left-hand side expression in postfix operation');\n }\n ctx.lispTree = lispify(\n constants,\n part.substring(res[0].length),\n expectTypes[expect].next,\n createLisp<IncrementAfter | DecrementAfter>({\n op: incrementTypes['$' + res[0]],\n a: ctx.lispTree,\n b: LispType.None,\n }),\n false,\n ctx,\n );\n });\n\n const adderTypes = {\n '&&': LispType.And,\n '||': LispType.Or,\n '??': LispType.NullishCoalescing,\n instanceof: LispType.Instanceof,\n in: LispType.In,\n '=': LispType.Assign,\n '-=': LispType.SubractEquals,\n '+=': LispType.AddEquals,\n '/=': LispType.DivideEquals,\n '**=': LispType.PowerEquals,\n '*=': LispType.MultiplyEquals,\n '%=': LispType.ModulusEquals,\n '^=': LispType.BitNegateEquals,\n '&=': LispType.BitAndEquals,\n '|=': LispType.BitOrEquals,\n '>>>=': LispType.UnsignedShiftRightEquals,\n '<<=': LispType.ShiftLeftEquals,\n '>>=': LispType.ShiftRightEquals,\n '&&=': LispType.AndEquals,\n '||=': LispType.OrEquals,\n '??=': LispType.NullishCoalescingEquals,\n } as any;\n\n setLispType(['assign', 'assignModify', 'nullishCoalescing'] as const, (ctx) => {\n const { constants, type, part, res } = ctx;\n if (\n type !== 'nullishCoalescing' &&\n isLisp(ctx.lispTree) &&\n (ctx.lispTree[0] === LispType.PropOptional || ctx.lispTree[0] === LispType.CallOptional)\n ) {\n throw new SyntaxError('Invalid left-hand side in assignment');\n }\n if (res[0] === '=') {\n const patternStr = getDestructurePatternSource(ctx.lispTree);\n if (patternStr) {\n const rhsStr = part.substring(res[0].length).toString();\n const tempName = `$$_da${Math.random().toString(36).slice(2)}`;\n const expandedCode = `internal ${tempName} = (${rhsStr}); ${expandDestructure('', patternStr, tempName)}; ${tempName}`;\n ctx.lispTree = createLisp<InternalCode>({\n op: LispType.InternalBlock,\n a: lispifyBlock(new CodeString(expandedCode), constants, false, ctx),\n b: LispType.None,\n });\n return;\n }\n }\n ctx.lispTree = createLisp<\n | NullishCoalescing\n | Assigns\n | SubractEquals\n | AddEquals\n | DivideEquals\n | PowerEquals\n | MultiplyEquals\n | ModulusEquals\n | BitNegateEquals\n | BitAndEquals\n | BitOrEquals\n | UnsignedShiftRightEquals\n | ShiftLeftEquals\n | ShiftRightEquals\n | AndEquals\n | OrEquals\n | NullishCoalescingEquals\n >({\n op: adderTypes[res[0]],\n a: ctx.lispTree,\n b: lispify(\n constants,\n part.substring(res[0].length),\n expectTypes.assignment.next,\n undefined,\n false,\n { ...ctx, lispDepth: ctx.lispDepth + 1 },\n ),\n });\n });\n\n const opTypes = {\n '&': LispType.BitAnd,\n '|': LispType.BitOr,\n '^': LispType.BitNegate,\n '<<': LispType.BitShiftLeft,\n '>>': LispType.BitShiftRight,\n '>>>': LispType.BitUnsignedShiftRight,\n '<=': LispType.SmallerEqualThan,\n '>=': LispType.LargerEqualThan,\n '<': LispType.SmallerThan,\n '>': LispType.LargerThan,\n '!==': LispType.StrictNotEqual,\n '!=': LispType.NotEqual,\n '===': LispType.StrictEqual,\n '==': LispType.Equal,\n '+': LispType.Plus,\n '-': LispType.Minus,\n '/': LispType.Divide,\n '**': LispType.Power,\n '*': LispType.Multiply,\n '%': LispType.Modulus,\n '&&': LispType.And,\n '||': LispType.Or,\n instanceof: LispType.Instanceof,\n in: LispType.In,\n } as any;\n\n setLispType(\n [\n 'power',\n 'opHigh',\n 'op',\n 'comparitor',\n 'bitwiseShift',\n 'bitwiseAnd',\n 'bitwiseXor',\n 'bitwiseOr',\n 'boolOpAnd',\n 'boolOpOr',\n ] as const,\n (ctx) => {\n const { constants, type, part, res } = ctx;\n const next = [expectTypes.inlineIf.types.inlineIf, inlineIfElse];\n switch (type) {\n case 'power':\n break;\n case 'opHigh':\n next.push(expectTypes.splitter.types.opHigh);\n case 'op':\n next.push(expectTypes.splitter.types.op);\n case 'comparitor':\n next.push(expectTypes.splitter.types.comparitor);\n case 'bitwiseShift':\n next.push(expectTypes.splitter.types.bitwiseShift);\n case 'bitwiseAnd':\n next.push(expectTypes.splitter.types.bitwiseAnd);\n case 'bitwiseXor':\n next.push(expectTypes.splitter.types.bitwiseXor);\n case 'bitwiseOr':\n next.push(expectTypes.splitter.types.bitwiseOr);\n case 'boolOpAnd':\n next.push(expectTypes.splitter.types.boolOpAnd);\n case 'boolOpOr':\n next.push(expectTypes.splitter.types.boolOpOr);\n }\n const extract = restOfExp(constants, part.substring(res[0].length), next);\n ctx.lispTree = lispify(\n constants,\n part.substring(extract.length + res[0].length),\n restOfExp.next,\n createLisp<\n | BitAnd\n | BitOr\n | BitNegate\n | BitShiftLeft\n | BitShiftRight\n | BitUnsignedShiftRight\n | SmallerEqualThan\n | LargerEqualThan\n | SmallerThan\n | LargerThan\n | StrictNotEqual\n | NotEqual\n | StrictEqual\n | Equal\n | Plus\n | Minus\n | Divide\n | Power\n | Multiply\n | Modulus\n | And\n | Or\n | Instanceof\n | In\n >({\n op: opTypes[res[0]],\n a: ctx.lispTree,\n b: lispify(constants, extract, expectTypes.splitter.next),\n }),\n false,\n ctx,\n );\n },\n );\n\n setLispType(['inlineIf'] as const, (ctx) => {\n const { constants, part, res } = ctx;\n let found = false;\n const extract = part.substring(0, 0);\n let quoteCount = 1;\n while (!found && extract.length < part.length) {\n extract.end = restOfExp(constants, part.substring(extract.length + 1), [\n expectTypes.inlineIf.types.inlineIf,\n inlineIfElse,\n ]).end;\n if (part.char(extract.length) === '?') {\n quoteCount++;\n } else {\n quoteCount--;\n }\n if (!quoteCount) {\n found = true;\n }\n }\n extract.start = part.start + 1;\n const falseExpr = part.substring(res[0].length + extract.length + 1);\n if (!falseExpr.trimStart().length) {\n throw new SyntaxError('Unexpected end of expression');\n }\n ctx.lispTree = createLisp<InlineIf>({\n op: LispType.InlineIf,\n a: ctx.lispTree,\n b: createLisp<InlineIfCase>({\n op: LispType.InlineIfCase,\n a: lispifyExpr(constants, extract, undefined, { ...ctx, lispDepth: ctx.lispDepth + 1 }),\n b: lispifyExpr(constants, falseExpr, undefined, { ...ctx, lispDepth: ctx.lispDepth + 1 }),\n }),\n });\n });\n}\n","import { CodeString, isLisp, LispType, reservedWords } from '../../utils';\nimport type {\n ArrayProp,\n Call,\n CallOptional,\n CreateArray,\n CreateObject,\n Group,\n InternalCode,\n KeyValLisp,\n Lisp,\n PropLisp,\n PropOptional,\n SpreadArrayLisp,\n SpreadObjectLisp,\n} from '../lisp';\nimport type { RegisterLispTypesDeps } from './shared';\n\nexport function registerStructureLispTypes({\n NullLisp,\n createLisp,\n emptyString,\n expectTypes,\n expandDestructure,\n findPatternEndIdx,\n lispify,\n lispifyBlock,\n lispifyExpr,\n restOfExp,\n setLispType,\n}: RegisterLispTypesDeps) {\n type LispWithSource = Lisp & { source?: string };\n\n const closingsCreate: { [type: string]: RegExp } = {\n createArray: /^\\]/,\n createObject: /^\\}/,\n group: /^\\)/,\n arrayProp: /^\\]/,\n call: /^\\)/,\n };\n\n const typesCreate = {\n createArray: LispType.CreateArray,\n createObject: LispType.CreateObject,\n group: LispType.Group,\n arrayProp: LispType.ArrayProp,\n call: LispType.Call,\n prop: LispType.Prop,\n '?prop': LispType.PropOptional,\n '?call': LispType.CallOptional,\n } as any;\n\n setLispType(['createArray', 'createObject', 'group', 'arrayProp', 'call'] as const, (ctx) => {\n const { constants, type, part, res, expect } = ctx;\n let extract = emptyString;\n const arg: CodeString[] = [];\n const argIsHole: boolean[] = [];\n let end = false;\n let i = res[0].length;\n const start = i;\n while (i < part.length && !end) {\n extract = restOfExp(constants, part.substring(i), [closingsCreate[type], /^,/]);\n i += extract.length;\n if (extract.trim().length) {\n arg.push(extract);\n argIsHole.push(false);\n } else if (type === 'createArray' && part.char(i) === ',') {\n arg.push(extract);\n argIsHole.push(true);\n }\n if (part.char(i) !== ',') {\n end = true;\n } else {\n if (!extract.trim().length && type === 'call') {\n throw new SyntaxError('Unexpected end of expression');\n }\n if (!extract.trim().length && type === 'createObject') {\n throw new SyntaxError('Unexpected token ,');\n }\n i++;\n }\n }\n const next =\n type === 'createArray' || type === 'createObject' || type === 'group'\n ? ['value', 'modifier', 'prop', 'incrementerBefore', 'assignment', 'expEnd']\n : ['value', 'modifier', 'prop', 'incrementerBefore', 'expEnd'];\n let l: Lisp | Lisp[];\n\n let funcFound: RegExpExecArray | null;\n switch (type) {\n case 'group': {\n const groupContent = part.substring(start, i).trim();\n const groupContentStr = groupContent.toString();\n if (groupContentStr.startsWith('{') || groupContentStr.startsWith('[')) {\n const patternEnd = findPatternEndIdx(groupContentStr);\n const patternStr = groupContentStr.slice(0, patternEnd).trim();\n const afterPattern = groupContentStr.slice(patternEnd).trimStart();\n if (afterPattern.startsWith('=')) {\n const rhsStr = afterPattern.slice(1).trim();\n const tempName = `$$_da${Math.random().toString(36).slice(2)}`;\n const expandedCode = `internal ${tempName} = (${rhsStr}); ${expandDestructure('', patternStr, tempName)}; ${tempName}`;\n l = createLisp<InternalCode>({\n op: LispType.InternalBlock,\n a: lispifyBlock(new CodeString(expandedCode), constants, false, ctx),\n b: LispType.None,\n });\n break;\n }\n }\n }\n case 'arrayProp': {\n const arrayPropExpr = part.substring(start, i);\n if (!arrayPropExpr.trimStart().length) {\n throw new SyntaxError('Unexpected end of expression');\n }\n l = lispifyExpr(constants, arrayPropExpr, undefined, {\n ...ctx,\n lispDepth: ctx.lispDepth + 1,\n });\n break;\n }\n case 'call':\n l = arg.map((e) => lispify(constants, e, [...next, 'spreadArray'], undefined, false, ctx));\n break;\n case 'createArray':\n l = arg.map((e, idx) =>\n argIsHole[idx]\n ? createLisp({ op: LispType.Hole, a: LispType.None, b: LispType.None })\n : lispify(constants, e, [...next, 'spreadArray'], undefined, false, ctx),\n );\n break;\n case 'createObject':\n l = arg.map((str) => {\n str = str.trimStart();\n let value: Lisp;\n let key: string | Lisp = '';\n if (str.char(0) === '[') {\n const innerExpr = restOfExp(constants, str.substring(1), [], '[');\n const afterBracket = str.substring(1 + innerExpr.length + 1).trimStart();\n key = lispify(constants, innerExpr, next);\n if (afterBracket.length > 0 && afterBracket.char(0) === ':') {\n value = lispify(constants, afterBracket.substring(1));\n } else if (afterBracket.length > 0 && afterBracket.char(0) === '(') {\n value = lispify(constants, new CodeString('function' + afterBracket.toString()));\n } else {\n throw new SyntaxError('Unexpected token in computed property');\n }\n return createLisp<KeyValLisp>({\n op: LispType.KeyVal,\n a: key,\n b: value,\n });\n }\n funcFound = expectTypes.expFunction.types.function.exec('function ' + str);\n if (funcFound) {\n key = funcFound[3].trimStart();\n value = lispify(\n constants,\n new CodeString('function ' + str.toString().replace(key, '')),\n );\n } else {\n const extract = restOfExp(constants, str, [/^:/]);\n key = lispify(constants, extract, [...next, 'spreadObject']) as PropLisp;\n\n if (isLisp(key) && key[0] === LispType.SpreadObject) {\n value = NullLisp;\n } else {\n if (key[0] === LispType.Prop) {\n key = (key as PropLisp)[2];\n }\n\n if (str.length > extract.length && str.char(extract.length) === ':') {\n value = lispify(constants, str.substring(extract.length + 1));\n } else {\n value = lispify(constants, extract, next);\n }\n }\n }\n return createLisp<KeyValLisp>({\n op: LispType.KeyVal,\n a: key,\n b: value,\n });\n });\n break;\n }\n const lisptype = (\n type === 'arrayProp'\n ? res[1]\n ? LispType.PropOptional\n : LispType.Prop\n : type === 'call'\n ? res[1]\n ? LispType.CallOptional\n : LispType.Call\n : typesCreate[type]\n ) as (typeof typesCreate)[keyof typeof typesCreate];\n const currentTree = createLisp<\n ArrayProp | PropLisp | Call | CreateObject | CreateArray | Group | PropOptional | CallOptional\n >({\n op: lisptype,\n a: ctx.lispTree,\n b: l,\n }) as LispWithSource;\n if (\n lisptype === LispType.Group ||\n lisptype === LispType.CreateArray ||\n lisptype === LispType.CreateObject\n ) {\n currentTree.source = part.substring(start, i).toString();\n }\n ctx.lispTree = lispify(\n constants,\n part.substring(i + 1),\n expectTypes[expect].next,\n currentTree,\n false,\n ctx,\n );\n });\n\n setLispType(['dot', 'prop'] as const, (ctx) => {\n const { constants, type, part, res, expect } = ctx;\n let prop = res[0];\n let index = res[0].length;\n let op = 'prop';\n if (type === 'dot') {\n if (res[1]) {\n op = '?prop';\n }\n const matches = part.substring(res[0].length).toString().match(expectTypes.prop.types.prop);\n if (matches && matches.length) {\n prop = matches[0];\n index = prop.length + res[0].length;\n } else {\n throw new SyntaxError('Hanging dot');\n }\n } else if (reservedWords.has(prop) && prop !== 'this') {\n throw new SyntaxError(`Unexpected token '${prop}'`);\n }\n ctx.lispTree = lispify(\n constants,\n part.substring(index),\n expectTypes[expect].next,\n createLisp<PropLisp | PropOptional>({\n op: typesCreate[op],\n a: ctx.lispTree,\n b: prop,\n }),\n false,\n ctx,\n );\n });\n\n setLispType(['spreadArray', 'spreadObject'] as const, (ctx) => {\n const { constants, type, part, res, expect } = ctx;\n ctx.lispTree = createLisp<SpreadArrayLisp | SpreadObjectLisp>({\n op: type === 'spreadArray' ? LispType.SpreadArray : LispType.SpreadObject,\n a: LispType.None,\n b: lispify(constants, part.substring(res[0].length), expectTypes[expect].next),\n });\n });\n}\n","import { LispType } from '../../utils';\nimport type {\n Await,\n BigInt as BigIntLisp,\n GlobalSymbol,\n LiteralIndex,\n Number as NumberLisp,\n RegexIndex,\n Return,\n StringIndex,\n Throw,\n Void,\n Yield,\n YieldDelegate,\n} from '../lisp';\nimport type { RegisterLispTypesDeps } from './shared';\n\nexport function registerValueLispTypes({\n createLisp,\n expectTypes,\n lispify,\n lispifyExpr,\n restOfExp,\n semiColon,\n setLispType,\n}: RegisterLispTypesDeps) {\n setLispType(['return', 'throw'] as const, (ctx) => {\n const { constants, type, part, res } = ctx;\n const expr = part.substring(res[0].length);\n if (type === 'throw' && !expr.trimStart().length) {\n throw new SyntaxError('Unexpected end of expression');\n }\n ctx.lispTree = createLisp<Return | Throw>({\n op: type === 'return' ? LispType.Return : LispType.Throw,\n a: LispType.None,\n b: lispifyExpr(constants, expr, undefined, ctx),\n });\n });\n\n setLispType(['number', 'boolean', 'null', 'und', 'NaN', 'Infinity'] as const, (ctx) => {\n const { constants, type, part, res, expect } = ctx;\n ctx.lispTree = lispify(\n constants,\n part.substring(res[0].length),\n expectTypes[expect].next,\n createLisp<NumberLisp | BigIntLisp | GlobalSymbol>({\n op:\n type === 'number' ? (res[12] ? LispType.BigInt : LispType.Number) : LispType.GlobalSymbol,\n a: LispType.None,\n b: res[12] ? res[1] : res[0],\n }),\n false,\n ctx,\n );\n });\n\n setLispType(['string', 'literal', 'regex'] as const, (ctx) => {\n const { constants, type, part, res, expect } = ctx;\n ctx.lispTree = lispify(\n constants,\n part.substring(res[0].length),\n expectTypes[expect].next,\n createLisp<StringIndex | LiteralIndex | RegexIndex>({\n op:\n type === 'string'\n ? LispType.StringIndex\n : type === 'literal'\n ? LispType.LiteralIndex\n : LispType.RegexIndex,\n a: LispType.None,\n b: res[1],\n }),\n false,\n ctx,\n );\n });\n\n setLispType(['void', 'await'] as const, (ctx) => {\n const { constants, type, part, res, expect } = ctx;\n const extract = restOfExp(constants, part.substring(res[0].length), [/^([^\\s.?\\w$]|\\?[^.])/]);\n if (!extract.trimStart().length) {\n throw new SyntaxError('Unexpected end of expression');\n }\n ctx.lispTree = lispify(\n constants,\n part.substring(res[0].length + extract.length),\n expectTypes[expect].next,\n createLisp<Void | Await>({\n op: type === 'void' ? LispType.Void : LispType.Await,\n a: lispify(constants, extract),\n b: LispType.None,\n }),\n false,\n ctx,\n );\n });\n\n setLispType(['yield'] as const, (ctx) => {\n const { constants, part, res, expect, generatorDepth } = ctx;\n if (generatorDepth === 0) {\n throw new SyntaxError('Unexpected token');\n }\n const isDelegate = res[0].trimEnd().endsWith('*');\n const extract = restOfExp(constants, part.substring(res[0].length), [/^([^\\s.?\\w$]|\\?[^.])/]);\n if (isDelegate && !extract.trimStart().length) {\n throw new SyntaxError('Unexpected end of expression');\n }\n ctx.lispTree = lispify(\n constants,\n part.substring(res[0].length + extract.length),\n expectTypes[expect].next,\n createLisp<Yield | YieldDelegate>({\n op: isDelegate ? LispType.YieldDelegate : LispType.Yield,\n a: lispify(constants, extract),\n b: LispType.None,\n }),\n false,\n ctx,\n );\n });\n\n setLispType(['new'] as const, (ctx) => {\n const { constants, part, res } = ctx;\n let i = res[0].length;\n const obj = restOfExp(constants, part.substring(i), [], undefined, '(');\n if (!obj.trimStart().length) {\n throw new SyntaxError('Unexpected end of expression');\n }\n i += obj.length + 1;\n const args = [];\n if (part.char(i - 1) === '(') {\n const argsString = restOfExp(constants, part.substring(i), [], '(');\n i += argsString.length + 1;\n let found;\n let j = 0;\n while ((found = restOfExp(constants, argsString.substring(j), [/^,/])).length) {\n j += found.length + 1;\n args.push(found.trim());\n }\n }\n ctx.lispTree = lispify(\n constants,\n part.substring(i),\n expectTypes.expEdge.next,\n createLisp({\n op: LispType.New,\n a: lispify(constants, obj, expectTypes.initialize.next),\n b: args.map((arg) => lispify(constants, arg, expectTypes.initialize.next)),\n }),\n false,\n ctx,\n );\n });\n\n void semiColon;\n}\n","import type { RegisterLispTypesDeps } from './shared';\nimport { registerConditionalLispTypes } from './conditionals';\nimport { registerControlLispTypes } from './control';\nimport { registerDeclarationLispTypes } from './declarations';\nimport { registerOperatorLispTypes } from './operators';\nimport { registerStructureLispTypes } from './structures';\nimport { registerValueLispTypes } from './values';\n\nexport function registerLispTypes(deps: RegisterLispTypesDeps) {\n registerStructureLispTypes(deps);\n registerOperatorLispTypes(deps);\n registerConditionalLispTypes(deps);\n registerValueLispTypes(deps);\n registerDeclarationLispTypes(deps);\n registerControlLispTypes(deps);\n}\n\nexport type { RegisterLispTypesDeps } from './shared';\n","import { unraw } from '../utils/unraw';\nimport { CodeString, isLisp, LispType, SandboxCapabilityError } from '../utils';\nimport { registerLispTypes } from './lispTypes';\nimport type {\n Expression,\n ExtractLispA,\n ExtractLispB,\n ExtractLispOp,\n IConstants,\n IExecutionTree,\n IRegEx,\n InternalCode,\n Labeled,\n Lisp,\n LispCallback,\n LispCallbackCtx,\n LispDepthCtx,\n LispFamily,\n LispItem,\n LispItemSingle,\n Literal,\n None,\n Return,\n} from './lisp';\n\ntype LispWithSource = Lisp & { source?: string };\n\nfunction createLisp<L extends Lisp>(obj: {\n op: ExtractLispOp<L>;\n a: ExtractLispA<L>;\n b: ExtractLispB<L>;\n}) {\n return [obj.op, obj.a, obj.b] as L;\n}\n\nconst NullLisp = createLisp<None>({ op: LispType.None, a: LispType.None, b: LispType.None });\n\nconst statementLabelRegex = /([a-zA-Z$_][\\w$]*)\\s*:/g;\n\nfunction extractStatementLabels(prefix = '') {\n return [...prefix.matchAll(statementLabelRegex)].map((match) => match[1]);\n}\n\nfunction wrapLabeledStatement<T extends Lisp>(labels: string[], statement: T): Lisp {\n return labels.reduceRight(\n (current, label) =>\n createLisp<Labeled>({\n op: LispType.Labeled,\n a: label,\n b: current,\n }),\n statement as Lisp,\n );\n}\n\nconst lispTypes: Map<string, LispCallback<string>> = new Map();\n\nexport class ParseError extends Error {\n constructor(\n message: string,\n public code: string,\n ) {\n super(message + ': ' + code.substring(0, 40));\n }\n}\n\nlet lastType: CodeString | string;\nlet lastPart: CodeString | string;\nlet lastLastPart: CodeString | string;\nlet lastLastLastPart: CodeString | string;\nlet lastLastLastLastPart: CodeString | string;\n\nconst inlineIfElse = /^:/;\nconst elseIf = /^else(?![\\w$])/;\nconst ifElse = /^if(?![\\w$])/;\nconst space = /^\\s/;\n\nexport const expectTypes = {\n splitter: {\n types: {\n power: /^(\\*\\*)(?!=)/,\n opHigh: /^(\\/|\\*(?!\\*)|%)(?!=)/,\n op: /^(\\+(?!(\\+))|-(?!(-)))(?!=)/,\n comparitor: /^(<=|>=|<(?!<)|>(?!>)|!==|!=(?!=)|===|==)/,\n bitwiseShift: /^(<<|>>(?!>)|>>>)(?!=)/,\n bitwiseAnd: /^(&(?!&))(?!=)/,\n bitwiseXor: /^(\\^)(?!=)/,\n bitwiseOr: /^(\\|(?!\\|))(?!=)/,\n boolOpAnd: /^(&&)(?!=)/,\n boolOpOr: /^(\\|\\|(?!=)|instanceof(?![\\w$])|in(?![\\w$]))/,\n nullishCoalescing: /^\\?\\?(?!=)/,\n },\n next: ['modifier', 'value', 'prop', 'incrementerBefore'],\n },\n inlineIf: {\n types: {\n inlineIf: /^\\?(?!\\.(?!\\d))/,\n },\n next: ['expEnd'],\n },\n assignment: {\n types: {\n assignModify: /^(-=|\\+=|\\/=|\\*\\*=|\\*=|%=|\\^=|&=|\\|=|>>>=|>>=|<<=|&&=|\\|\\|=|\\?\\?=)/,\n assign: /^(=)(?!=)/,\n },\n next: ['modifier', 'value', 'prop', 'incrementerBefore'],\n },\n incrementerBefore: {\n types: { incrementerBefore: /^(\\+\\+|--)/ },\n next: ['prop'],\n },\n expEdge: {\n types: {\n call: /^(\\?\\.)?[(]/,\n incrementerAfter: /^(\\+\\+|--)/,\n taggedTemplate: /^`(\\d+)`/,\n },\n next: ['splitter', 'assignment', 'expEdge', 'dot', 'inlineIf', 'expEnd'],\n },\n modifier: {\n types: {\n not: /^!/,\n inverse: /^~/,\n negative: /^-(?!-)/,\n positive: /^\\+(?!\\+)/,\n typeof: /^typeof(?![\\w$])/,\n delete: /^delete(?![\\w$])/,\n },\n next: ['modifier', 'value', 'prop', 'incrementerBefore'],\n },\n dot: {\n types: {\n arrayProp: /^(\\?\\.)?\\[/,\n dot: /^(\\?)?\\.(?=\\s*[a-zA-Z$_])/,\n },\n next: ['splitter', 'assignment', 'expEdge', 'dot', 'inlineIf', 'expEnd'],\n },\n prop: {\n types: {\n prop: /^[a-zA-Z$_][a-zA-Z\\d$_]*/,\n },\n next: ['splitter', 'assignment', 'expEdge', 'dot', 'inlineIf', 'expEnd'],\n },\n value: {\n types: {\n createObject: /^\\{/,\n createArray: /^\\[/,\n number:\n /^(0b[01]+(_[01]+)*|0o[0-7]+(_[0-7]+)*|0x[\\da-f]+(_[\\da-f]+)*|(\\d+(_\\d+)*(\\.\\d+(_\\d+)*)?|\\.\\d+(_\\d+)*))(e[+-]?\\d+(_\\d+)*)?(n)?(?!\\d)/i,\n string: /^\"(\\d+)\"/,\n literal: /^`(\\d+)`/,\n regex: /^\\/(\\d+)\\/r(?![\\w$])/,\n boolean: /^(true|false)(?![\\w$])/,\n null: /^null(?![\\w$])/,\n und: /^undefined(?![\\w$])/,\n arrowFunctionSingle: /^(async\\s+)?([a-zA-Z$_][a-zA-Z\\d$_]*)\\s*=>\\s*({)?/,\n arrowFunction: /^(async\\s*)?\\(\\s*([^)(]*?)\\s*\\)\\s*=>\\s*({)?/,\n inlineFunction: /^(async\\s+)?function(\\*\\s*|\\s*)([a-zA-Z$_][a-zA-Z\\d$_]*)?\\s*\\(\\s*/,\n yield: /^yield\\*(?![\\w$])\\s*|^yield(?![\\w$])\\s*/,\n group: /^\\(/,\n NaN: /^NaN(?![\\w$])/,\n Infinity: /^Infinity(?![\\w$])/,\n void: /^void(?![\\w$])\\s*/,\n await: /^await(?![\\w$])\\s*/,\n new: /^new(?![\\w$])\\s*/,\n },\n next: ['splitter', 'expEdge', 'dot', 'inlineIf', 'expEnd'],\n },\n initialize: {\n types: {\n initializeDestructure: /^(var|let|const|internal)\\s+([{[])/,\n initialize: /^(var|let|const|internal)\\s+([a-zA-Z$_][a-zA-Z\\d$_]*)\\s*(=)?/,\n return: /^return(?![\\w$])/,\n throw: /^throw(?![\\w$])\\s*/,\n },\n next: ['modifier', 'value', 'prop', 'incrementerBefore', 'expEnd'],\n },\n spreadObject: {\n types: {\n spreadObject: /^\\.\\.\\./,\n },\n next: ['value', 'prop'],\n },\n spreadArray: {\n types: {\n spreadArray: /^\\.\\.\\./,\n },\n next: ['value', 'prop'],\n },\n expEnd: { types: {}, next: [] },\n expFunction: {\n types: {\n function: /^(async\\s+)?function(\\*\\s*|\\s+)([a-zA-Z$_][a-zA-Z\\d$_]*)\\s*\\(\\s*/,\n },\n next: ['expEdge', 'expEnd'],\n },\n expSingle: {\n types: {\n for: /^((?:[a-zA-Z$_][\\w$]*\\s*:\\s*)*)\\s*for(\\s+await)?\\s*\\(/,\n do: /^((?:[a-zA-Z$_][\\w$]*\\s*:\\s*)*)\\s*do(?![\\w$])\\s*(\\{)?/,\n while: /^((?:[a-zA-Z$_][\\w$]*\\s*:\\s*)*)\\s*while\\s*\\(/,\n loopAction: /^(break|continue)(?![\\w$])\\s*([a-zA-Z$_][\\w$]*)?/,\n if: /^((?:[a-zA-Z$_][\\w$]*\\s*:\\s*)*)\\s*if\\s*\\(/,\n try: /^((?:[a-zA-Z$_][\\w$]*\\s*:\\s*)*)\\s*try\\s*{/,\n block: /^((?:[a-zA-Z$_][\\w$]*\\s*:\\s*)*)\\s*{/,\n switch: /^((?:[a-zA-Z$_][\\w$]*\\s*:\\s*)*)\\s*switch\\s*\\(/,\n },\n next: ['expEnd'],\n },\n} as Record<string, { types: Record<string, RegExp>; next: string[] }>;\n\nconst closings = {\n '(': ')',\n '[': ']',\n '{': '}',\n \"'\": \"'\",\n '\"': '\"',\n '`': '`',\n} as Record<string, string>;\n\nexport function testMultiple(str: string, tests: RegExp[]) {\n let found: RegExpExecArray | null = null;\n for (let i = 0; i < tests.length; i++) {\n const test = tests[i];\n found = test.exec(str);\n if (found) break;\n }\n return found;\n}\n\nconst emptyString = new CodeString('');\n\nconst okFirstChars = /^[+\\-~ !]/;\nconst aNumber = expectTypes.value.types.number;\nconst wordReg = /^((if|for|else|while|do|function)(?![\\w$])|[\\w$]+)/;\nconst semiColon = /^;/;\nconst insertedSemicolons: WeakMap<{ str: string }, Array<number>> = new WeakMap();\nconst quoteCache: WeakMap<{ str: string }, Map<number, number>> = new WeakMap();\nexport interface restDetails {\n oneliner?: boolean;\n words?: string[];\n lastWord?: string;\n lastAnyWord?: string;\n regRes?: RegExpExecArray;\n bodyContentAfterKeyword?: boolean;\n}\nexport function restOfExp(\n constants: IConstants,\n part: CodeString,\n tests?: RegExp[],\n quote?: string,\n firstOpening?: string,\n closingsTests?: RegExp[],\n details: restDetails = {},\n depth = 0,\n): CodeString {\n if (!part.length) {\n return part;\n }\n if (depth > constants.maxDepth) {\n throw new SandboxCapabilityError('Maximum expression depth exceeded');\n }\n details.words = details.words || [];\n let isStart = true;\n tests = tests || [];\n const hasSemiTest = tests.includes(semiColon);\n if (hasSemiTest) {\n tests = tests.filter((a) => a !== semiColon);\n }\n const insertedSemis = insertedSemicolons.get(part.ref) || [];\n const cache = quoteCache.get(part.ref) || new Map<number, number>();\n quoteCache.set(part.ref, cache);\n if (quote && cache.has(part.start - 1)) {\n return part.substring(0, cache.get(part.start - 1)! - part.start);\n }\n let escape = false;\n let done = false;\n let lastChar = '';\n let isOneLiner = false;\n let i;\n let lastInertedSemi = false;\n let seenKeyword = false;\n let skipNextWord = false;\n for (i = 0; i < part.length && !done; i++) {\n let char = part.char(i)!;\n if (quote === '\"' || quote === \"'\" || quote === '`') {\n if (quote === '`' && char === '$' && part.char(i + 1) === '{' && !escape) {\n const skip = restOfExp(\n constants,\n part.substring(i + 2),\n [],\n '{',\n undefined,\n undefined,\n {},\n depth + 1,\n );\n i += skip.length + 2;\n } else if (char === quote && !escape) {\n return part.substring(0, i);\n }\n escape = !escape && char === '\\\\';\n } else if (closings[char]) {\n if (!lastInertedSemi && insertedSemis[i + part.start]) {\n lastInertedSemi = true;\n if (hasSemiTest) {\n break;\n }\n i--;\n lastChar = ';';\n continue;\n }\n if (isOneLiner && char === '{') {\n isOneLiner = false;\n }\n if (char === firstOpening) {\n done = true;\n break;\n } else {\n const skip = restOfExp(\n constants,\n part.substring(i + 1),\n [],\n char,\n undefined,\n undefined,\n {},\n depth + 1,\n );\n cache.set(skip.start - 1, skip.end);\n i += skip.length + 1;\n isStart = false;\n if (closingsTests) {\n const sub = part.substring(i);\n let found: RegExpExecArray | null;\n if ((found = testMultiple(sub.toString(), closingsTests))) {\n details.regRes = found;\n done = true;\n }\n }\n }\n } else if (!quote) {\n let sub = part.substring(i).toString();\n let foundWord: RegExpExecArray | null;\n let foundNumber: RegExpExecArray | null;\n if (closingsTests) {\n let found: RegExpExecArray | null;\n if ((found = testMultiple(sub, closingsTests))) {\n details.regRes = found;\n i++;\n done = true;\n break;\n }\n }\n if ((foundNumber = aNumber.exec(sub))) {\n i += foundNumber[0].length - 1;\n sub = part.substring(i).toString();\n if (closingsTests) {\n let found: RegExpExecArray | null;\n if ((found = testMultiple(sub, closingsTests))) {\n details.regRes = found;\n i++;\n done = true;\n break;\n }\n }\n } else if (lastChar != char) {\n let found: [string] | RegExpExecArray | null = null;\n if (char === ';' || (insertedSemis[i + part.start] && !isStart && !lastInertedSemi)) {\n if (hasSemiTest) {\n found = [';'];\n } else if (insertedSemis[i + part.start]) {\n lastInertedSemi = true;\n i--;\n lastChar = ';';\n continue;\n }\n char = sub = ';';\n } else {\n lastInertedSemi = false;\n }\n if (!found) {\n found = testMultiple(sub, tests);\n }\n if (found) {\n done = true;\n }\n if (!done && (foundWord = wordReg.exec(sub))) {\n isOneLiner = true;\n if (foundWord[2]) {\n seenKeyword = true;\n skipNextWord = true;\n } else if (seenKeyword) {\n if (skipNextWord) {\n skipNextWord = false;\n } else {\n details.bodyContentAfterKeyword = true;\n }\n }\n if (foundWord[0].length > 1) {\n details.words.push(foundWord[1]);\n details.lastAnyWord = foundWord[1];\n if (foundWord[2]) {\n details.lastWord = foundWord[2];\n }\n }\n if (foundWord[0].length > 2) {\n i += foundWord[0].length - 2;\n }\n }\n }\n if (isStart) {\n if (okFirstChars.test(sub)) {\n done = false;\n } else {\n isStart = false;\n }\n }\n if (done) break;\n } else if (char === closings[quote]) {\n return part.substring(0, i);\n }\n lastChar = char;\n }\n if (quote) {\n throw new SyntaxError(\"Unclosed '\" + quote + \"'\");\n }\n if (details) {\n details.oneliner = isOneLiner;\n }\n return part.substring(0, i);\n}\nrestOfExp.next = ['splitter', 'expEnd', 'inlineIf'];\n\nconst startingExecpted = [\n 'initialize',\n 'expSingle',\n 'expFunction',\n 'value',\n 'modifier',\n 'prop',\n 'incrementerBefore',\n 'expEnd',\n];\n\nexport const setLispType = <T extends readonly string[]>(types: T, fn: LispCallback<T[number]>) => {\n types.forEach((type) => {\n lispTypes.set(type, fn);\n });\n};\n\nregisterLispTypes({\n NullLisp,\n ParseError,\n createLisp,\n emptyString,\n expectTypes,\n expandDestructure,\n expandFunctionParamDestructure,\n extractStatementLabels,\n findPatternEndIdx,\n getDestructurePatternSource,\n insertSemicolons,\n lispify,\n lispifyBlock,\n lispifyExpr,\n lispifyFunction,\n lispifyReturnExpr,\n restOfExp,\n semiColon,\n setLispType,\n splitByCommasDestructure,\n startingExecpted,\n wrapLabeledStatement,\n});\n\nfunction splitByCommasDestructure(s: string): string[] {\n const parts: string[] = [];\n let depth = 0;\n let cur = '';\n for (let i = 0; i < s.length; i++) {\n const c = s[i];\n if (c === '[' || c === '{' || c === '(') depth++;\n else if (c === ']' || c === '}' || c === ')') depth--;\n if (c === ',' && depth === 0) {\n parts.push(cur);\n cur = '';\n } else {\n cur += c;\n }\n }\n parts.push(cur);\n return parts;\n}\n\nfunction findFirstAtTopLevel(s: string, ch: string): number {\n let depth = 0;\n for (let i = 0; i < s.length; i++) {\n const c = s[i];\n if (c === '[' || c === '{' || c === '(') depth++;\n else if (c === ']' || c === '}' || c === ')') depth--;\n if (c === ch && depth === 0) return i;\n }\n return -1;\n}\n\nfunction findPatternEndIdx(s: string): number {\n let depth = 0;\n for (let i = 0; i < s.length; i++) {\n const c = s[i];\n if (c === '[' || c === '{') depth++;\n else if (c === ']' || c === '}') {\n depth--;\n if (depth === 0) return i + 1;\n }\n }\n return s.length;\n}\n\nconst validIdentifier = /^[a-zA-Z$_][a-zA-Z\\d$_]*$/;\nfunction assertIdentifier(name: string): string {\n if (!validIdentifier.test(name)) throw new SyntaxError(`Invalid destructuring target: '${name}'`);\n return name;\n}\n\nfunction expandDestructure(keyword: string, patternStr: string, rhsStr: string): string {\n const stmts: string[] = [];\n\n function genTemp(): string {\n return `$$_d${Math.random().toString(36).slice(2)}`;\n }\n\n function processPattern(pattern: string, src: string) {\n pattern = pattern.trim();\n if (pattern.startsWith('[')) {\n processArrayPattern(pattern.slice(1, -1), src);\n } else if (pattern.startsWith('{')) {\n processObjectPattern(pattern.slice(1, -1), src);\n }\n }\n\n function processArrayPattern(content: string, src: string) {\n const elements = splitByCommasDestructure(content);\n for (let i = 0; i < elements.length; i++) {\n const elem = elements[i].trim();\n if (!elem) continue;\n\n if (elem.startsWith('...')) {\n const rest = elem.slice(3).trim();\n if (rest.startsWith('[') || rest.startsWith('{')) {\n const t = genTemp();\n stmts.push(`internal ${t} = ${src}.slice(${i})`);\n processPattern(rest, t);\n } else {\n stmts.push(`${keyword} ${assertIdentifier(rest)} = ${src}.slice(${i})`);\n }\n break;\n }\n\n const eqIdx = findFirstAtTopLevel(elem, '=');\n const target = eqIdx !== -1 ? elem.slice(0, eqIdx).trim() : elem.trim();\n const defaultVal = eqIdx !== -1 ? elem.slice(eqIdx + 1).trim() : undefined;\n\n if (target.startsWith('[') || target.startsWith('{')) {\n const t = genTemp();\n stmts.push(\n defaultVal !== undefined\n ? `internal ${t} = ${src}[${i}] !== undefined ? ${src}[${i}] : (${defaultVal})`\n : `internal ${t} = ${src}[${i}]`,\n );\n processPattern(target, t);\n } else {\n stmts.push(\n defaultVal !== undefined\n ? `${keyword} ${assertIdentifier(target)} = ${src}[${i}] !== undefined ? ${src}[${i}] : (${defaultVal})`\n : `${keyword} ${assertIdentifier(target)} = ${src}[${i}]`,\n );\n }\n }\n }\n\n function processObjectPattern(content: string, src: string) {\n const props = splitByCommasDestructure(content);\n const usedKeys: string[] = [];\n\n for (const prop of props) {\n const p = prop.trim();\n if (!p) continue;\n\n if (p.startsWith('...')) {\n // Check that rest is the last element\n const restIdx = props.indexOf(prop);\n const hasMore = props.slice(restIdx + 1).some((pp) => pp.trim().length > 0);\n if (hasMore) {\n throw new SyntaxError('Rest element must be last element');\n }\n const rest = p.slice(3).trim();\n const exclTemp = genTemp();\n const keyTemp = genTemp();\n const resTemp = genTemp();\n const exclEntries = usedKeys.map((k) => `${assertIdentifier(k)}:1`).join(',');\n stmts.push(`internal ${exclTemp} = {${exclEntries}}`);\n stmts.push(`internal ${resTemp} = {}`);\n stmts.push(\n `for (internal ${keyTemp} in ${src}) { if (!(${keyTemp} in ${exclTemp})) { ${resTemp}[${keyTemp}] = ${src}[${keyTemp}] } }`,\n );\n if (rest.startsWith('[') || rest.startsWith('{')) {\n processPattern(rest, resTemp);\n } else {\n stmts.push(`${keyword} ${assertIdentifier(rest)} = ${resTemp}`);\n }\n break;\n }\n\n if (p.startsWith('[')) {\n // Computed property name: [expr]: target\n let closeBracket = -1;\n let depth = 1;\n for (let ci = 1; ci < p.length; ci++) {\n if (p[ci] === '[') depth++;\n else if (p[ci] === ']') {\n depth--;\n if (depth === 0) {\n closeBracket = ci;\n break;\n }\n }\n }\n if (closeBracket !== -1) {\n const computedExpr = p.slice(1, closeBracket);\n const after = p.slice(closeBracket + 1).trim();\n if (after.startsWith(':')) {\n const valueStr = after.slice(1).trim();\n const accessor = `${src}[${computedExpr}]`;\n const eqIdx = findFirstAtTopLevel(valueStr, '=');\n const tgt =\n eqIdx !== -1 && !valueStr.slice(0, eqIdx).trim().match(/^[[{]/)\n ? valueStr.slice(0, eqIdx).trim()\n : valueStr.trim();\n const defVal =\n eqIdx !== -1 && !valueStr.slice(0, eqIdx).trim().match(/^[[{]/)\n ? valueStr.slice(eqIdx + 1).trim()\n : undefined;\n if (tgt.startsWith('[') || tgt.startsWith('{')) {\n const t = genTemp();\n stmts.push(\n defVal !== undefined\n ? `internal ${t} = ${accessor} !== undefined ? ${accessor} : (${defVal})`\n : `internal ${t} = ${accessor}`,\n );\n processPattern(tgt, t);\n } else {\n stmts.push(\n defVal !== undefined\n ? `${keyword} ${assertIdentifier(tgt)} = ${accessor} !== undefined ? ${accessor} : (${defVal})`\n : `${keyword} ${assertIdentifier(tgt)} = ${accessor}`,\n );\n }\n }\n }\n continue;\n }\n\n const colonIdx = findFirstAtTopLevel(p, ':');\n if (colonIdx !== -1) {\n const key = assertIdentifier(p.slice(0, colonIdx).trim());\n const valueStr = p.slice(colonIdx + 1).trim();\n usedKeys.push(key);\n const accessor = `${src}.${key}`;\n const eqIdx = findFirstAtTopLevel(valueStr, '=');\n const beforeEq = eqIdx !== -1 ? valueStr.slice(0, eqIdx).trim() : valueStr.trim();\n const isNestedPattern = beforeEq.startsWith('[') || beforeEq.startsWith('{');\n const tgt = isNestedPattern ? valueStr.trim() : beforeEq;\n const defVal =\n !isNestedPattern && eqIdx !== -1 ? valueStr.slice(eqIdx + 1).trim() : undefined;\n\n if (tgt.startsWith('[') || tgt.startsWith('{')) {\n const patEnd = findPatternEndIdx(tgt);\n const finalPattern = tgt.slice(0, patEnd);\n const afterPat = tgt.slice(patEnd).trim();\n const nestedDef = afterPat.startsWith('=') ? afterPat.slice(1).trim() : undefined;\n const t = genTemp();\n stmts.push(\n nestedDef !== undefined\n ? `internal ${t} = ${accessor} !== undefined ? ${accessor} : (${nestedDef})`\n : `internal ${t} = ${accessor}`,\n );\n processPattern(finalPattern, t);\n } else {\n stmts.push(\n defVal !== undefined\n ? `${keyword} ${assertIdentifier(tgt)} = ${accessor} !== undefined ? ${accessor} : (${defVal})`\n : `${keyword} ${assertIdentifier(tgt)} = ${accessor}`,\n );\n }\n continue;\n }\n\n const eqIdx = findFirstAtTopLevel(p, '=');\n if (eqIdx !== -1) {\n const name = assertIdentifier(p.slice(0, eqIdx).trim());\n const defaultVal = p.slice(eqIdx + 1).trim();\n usedKeys.push(name);\n stmts.push(\n `${keyword} ${name} = ${src}.${name} !== undefined ? ${src}.${name} : (${defaultVal})`,\n );\n } else {\n assertIdentifier(p);\n usedKeys.push(p);\n stmts.push(`${keyword} ${p} = ${src}.${p}`);\n }\n }\n }\n\n const rootTemp = genTemp();\n stmts.unshift(`var ${rootTemp} = (${rhsStr})`);\n processPattern(patternStr, rootTemp);\n return stmts.join('; ');\n}\n\nfunction getDestructurePatternSource(tree: LispItem): string | null {\n if (!isLisp(tree)) return null;\n const source = (tree as LispWithSource).source?.trim();\n if (source && (source.startsWith('[') || source.startsWith('{'))) {\n return source;\n }\n if (tree[0] === LispType.Group) {\n return getDestructurePatternSource(tree[2]);\n }\n return null;\n}\n\nfunction expandFunctionParamDestructure(\n args: string[],\n funcBody: string,\n): { args: string[]; body: string } {\n const injected: string[] = [];\n const newArgs = args.map((arg, i) => {\n const a = arg.trim();\n if (a.startsWith('[') || a.startsWith('{')) {\n const tempName = `$$_p${i}`;\n // Check for a parameter default: {pattern} = defaultVal or [pattern] = defaultVal\n const patEnd = findPatternEndIdx(a);\n const patternOnly = a.slice(0, patEnd);\n const afterPat = a.slice(patEnd).trim();\n if (afterPat.startsWith('=')) {\n const defaultVal = afterPat.slice(1).trim();\n // Use temp var that applies the default, then destructure from it\n injected.push(\n expandDestructure(\n 'const',\n patternOnly,\n `${tempName} !== undefined ? ${tempName} : (${defaultVal})`,\n ),\n );\n } else {\n injected.push(expandDestructure('const', patternOnly, tempName));\n }\n return tempName;\n }\n // Handle simple default: a = defaultVal or ...rest (no default)\n const eqIdx = findFirstAtTopLevel(a, '=');\n if (eqIdx !== -1 && !a.startsWith('...')) {\n const paramName = a.slice(0, eqIdx).trim();\n const defaultVal = a.slice(eqIdx + 1).trim();\n injected.push(`if (${paramName} === undefined) ${paramName} = (${defaultVal})`);\n return paramName;\n }\n return a;\n });\n if (injected.length === 0) return { args: newArgs, body: funcBody };\n return { args: newArgs, body: injected.join('; ') + '; ' + funcBody };\n}\n\nfunction lispify(\n constants: IConstants,\n part: CodeString,\n expected?: readonly string[],\n lispTree?: Lisp,\n topLevel = false,\n depthCtx: LispDepthCtx = { generatorDepth: 0, asyncDepth: 0, lispDepth: 0 },\n): Lisp {\n if (depthCtx.lispDepth > constants.maxDepth) {\n throw new SandboxCapabilityError('Maximum expression depth exceeded');\n }\n const { generatorDepth, asyncDepth, lispDepth } = depthCtx;\n lispTree = lispTree || NullLisp;\n expected = expected || expectTypes.initialize.next;\n if (part === undefined) return lispTree;\n\n part = part.trimStart();\n const str = part.toString();\n if (!part.length && !expected.includes('expEnd')) {\n throw new SyntaxError('Unexpected end of expression');\n }\n if (!part.length) return lispTree;\n\n const ctx: LispCallbackCtx = {\n constants,\n type: '',\n part,\n res: [],\n expect: '',\n lispTree,\n generatorDepth,\n asyncDepth,\n lispDepth,\n };\n\n let res: any;\n for (const expect of expected) {\n if (expect === 'expEnd') {\n continue;\n }\n for (const type in expectTypes[expect].types) {\n if (type === 'expEnd') {\n continue;\n }\n if ((res = expectTypes[expect].types[type].exec(str))) {\n lastType = type;\n lastLastLastLastPart = lastLastLastPart;\n lastLastLastPart = lastLastPart;\n lastLastPart = lastPart;\n lastPart = part;\n ctx.type = type;\n ctx.part = part;\n ctx.res = res;\n ctx.expect = expect;\n try {\n lispTypes.get(type)?.(ctx as LispCallbackCtx & { type: string });\n } catch (e) {\n if (topLevel && e instanceof SyntaxError) {\n throw new ParseError(e.message, str);\n }\n throw e;\n }\n break;\n }\n }\n if (res) break;\n }\n\n if (!res && part.length) {\n if (topLevel) {\n throw new ParseError(`Unexpected token after ${lastType}: ${part.char(0)}`, str);\n }\n throw new SyntaxError(`Unexpected token after ${lastType}: ${part.char(0)}`);\n }\n return ctx.lispTree;\n}\n\nconst startingExpectedWithoutSingle = startingExecpted.filter((r) => r !== 'expSingle');\n\nfunction lispifyExpr(\n constants: IConstants,\n str: CodeString,\n expected?: readonly string[],\n depthCtx: LispDepthCtx = { generatorDepth: 0, asyncDepth: 0, lispDepth: 0 },\n): Lisp {\n if (depthCtx.lispDepth > constants.maxDepth) {\n throw new SandboxCapabilityError('Maximum expression depth exceeded');\n }\n if (!str.trimStart().length) return NullLisp;\n const subExpressions: CodeString[] = [];\n let sub: CodeString;\n let pos = 0;\n expected = expected || expectTypes.initialize.next;\n if (expected.includes('expSingle')) {\n if (testMultiple(str.toString(), Object.values(expectTypes.expSingle.types))) {\n return lispify(constants, str, ['expSingle'], undefined, true, depthCtx);\n }\n }\n if (expected === startingExecpted) expected = startingExpectedWithoutSingle;\n while ((sub = restOfExp(constants, str.substring(pos), [/^,/])).length) {\n subExpressions.push(sub.trimStart());\n pos += sub.length + 1;\n }\n if (subExpressions.length === 1) {\n return lispify(constants, str, expected, undefined, true, depthCtx);\n }\n if (expected.includes('initialize')) {\n const defined = expectTypes.initialize.types.initialize.exec(subExpressions[0].toString());\n if (defined) {\n return createLisp<InternalCode>({\n op: LispType.InternalBlock,\n a: subExpressions.map((str, i) =>\n lispify(\n constants,\n i ? new CodeString(defined![1] + ' ' + str) : str,\n ['initialize'],\n undefined,\n true,\n depthCtx,\n ),\n ),\n b: LispType.None,\n });\n } else if (expectTypes.initialize.types.return.exec(subExpressions[0].toString())) {\n return lispify(constants, str, expected, undefined, true, depthCtx);\n }\n }\n const exprs = subExpressions.map((str) =>\n lispify(constants, str, expected, undefined, true, depthCtx),\n );\n return createLisp<Expression>({ op: LispType.Expression, a: exprs, b: LispType.None });\n}\n\nexport function lispifyReturnExpr(constants: IConstants, str: CodeString) {\n return createLisp<Return>({\n op: LispType.Return,\n a: LispType.None,\n b: lispifyExpr(constants, str),\n });\n}\n\nexport function lispifyBlock(\n str: CodeString,\n constants: IConstants,\n expression = false,\n depthCtx: LispDepthCtx = { generatorDepth: 0, asyncDepth: 0, lispDepth: 0 },\n): Lisp[] {\n str = insertSemicolons(constants, str);\n if (!str.trim().length) return [];\n const parts: CodeString[] = [];\n let part: CodeString;\n let pos = 0;\n let start = 0;\n let details: restDetails = {};\n let skipped = false;\n let isInserted = false;\n while (\n (part = restOfExp(\n constants,\n str.substring(pos),\n [semiColon],\n undefined,\n undefined,\n undefined,\n details,\n )).length\n ) {\n isInserted = !!(str.char(pos + part.length) && str.char(pos + part.length) !== ';');\n pos += part.length + (isInserted ? 0 : 1);\n if (/^\\s*else(?![\\w$])/.test(str.substring(pos).toString())) {\n skipped = true;\n } else if (\n details['words']?.includes('do') &&\n /^\\s*while(?![\\w$])/.test(str.substring(pos).toString())\n ) {\n skipped = true;\n } else {\n skipped = false;\n parts.push(str.substring(start, pos - (isInserted ? 0 : 1)));\n start = pos;\n }\n details = {};\n if (expression) break;\n }\n if (skipped) {\n parts.push(str.substring(start, pos - (isInserted ? 0 : 1)));\n }\n return parts\n .map((str) => str.trimStart())\n .filter((str) => str.length)\n .map((str) => {\n return lispifyExpr(constants, str.trimStart(), startingExecpted, depthCtx);\n });\n}\n\nexport function lispifyFunction(\n str: CodeString,\n constants: IConstants,\n expression = false,\n depthCtx: LispDepthCtx = { generatorDepth: 0, asyncDepth: 0, lispDepth: 0 },\n): Lisp[] {\n if (!str.trim().length) return [];\n const tree = lispifyBlock(str, constants, expression, depthCtx);\n hoist(tree);\n return tree;\n}\n\nfunction hoist(item: LispItem, res: Lisp[] = []): boolean {\n if (isLisp(item)) {\n if (!isLisp<LispFamily>(item)) return false;\n const [op, a, b] = item;\n if (\n op === LispType.Labeled ||\n op === LispType.Try ||\n op === LispType.If ||\n op === LispType.Loop ||\n op === LispType.Switch\n ) {\n hoist(a, res);\n hoist(b, res);\n } else if (op === LispType.Var) {\n res.push(createLisp({ op: LispType.Var, a: a, b: LispType.None }));\n } else if (op === LispType.Function && a[2]) {\n res.push(item);\n return true;\n }\n } else if (Array.isArray(item)) {\n const rep: LispItemSingle[] = [];\n for (const it of item) {\n if (!hoist(it, res)) {\n rep.push(it);\n }\n }\n if (rep.length !== item.length) {\n item.length = 0;\n item.push(...res, ...rep);\n }\n }\n return false;\n}\n\nconst closingsNoInsertion = /^(\\})\\s*(catch|finally|else|while|instanceof)(?![\\w$])/;\n// \\w|)|] \\n \\w = 2 // \\} \\w|\\{ = 5\nconst colonsRegex = /^((([\\w$\\])\"'`]|\\+\\+|--)\\s*\\r?\\n\\s*([\\w$+\\-!~]))|(\\}\\s*[\\w$!~+\\-{(\"'`]))/;\n\n// if () \\w \\n; \\w == \\w \\n \\w | last === if a\n// if () { }; \\w == \\} ^else | last === if b\n// if () \\w \\n; else \\n \\w \\n; == \\w \\n \\w | last === else a\n// if () {} else {}; \\w == \\} \\w | last === else b\n// while () \\n \\w \\n; \\w == \\w \\n \\w | last === while a\n// while () { }; \\w == \\} \\w | last === while b\n// do \\w \\n; while (); \\w == \\w \\n while | last === do a\n// do { } while (); \\w == \\) \\w | last === while c\n// try {} catch () {}; \\w == \\} \\w | last === catch|finally b\n// \\w \\n; \\w == \\w \\n \\w | last === none a\n// cb() \\n \\w == \\) \\n \\w | last === none a\n// obj[a] \\n \\w == \\] \\n \\w | last === none a\n// {} {} == \\} \\{ | last === none b\n\nexport function insertSemicolons(constants: IConstants, str: CodeString): CodeString {\n let rest = str;\n let sub = emptyString;\n let details: restDetails = {};\n let pendingDoWhile = false;\n const inserted = insertedSemicolons.get(str.ref) || new Array(str.ref.str.length);\n while (\n (sub = restOfExp(constants, rest, [], undefined, undefined, [colonsRegex], details)).length\n ) {\n let valid = false;\n let part = sub;\n let edge = sub.length;\n if (details.regRes) {\n valid = true;\n const [, , a, , , b] = details.regRes;\n edge = details.regRes[3] === '++' || details.regRes[3] === '--' ? sub.length + 1 : sub.length;\n part = rest.substring(0, edge);\n if (b) {\n const res = closingsNoInsertion.exec(rest.substring(sub.length - 1).toString());\n if (res) {\n if (res[2] === 'while') {\n if (details.lastWord === 'do') {\n valid = false;\n pendingDoWhile = true;\n } else {\n valid = true;\n }\n } else {\n valid = false;\n }\n } else if (\n details.lastWord === 'function' &&\n details.regRes[5][0] === '}' &&\n details.regRes[5].slice(-1) === '('\n ) {\n valid = false;\n }\n } else if (a) {\n if (pendingDoWhile && details.lastWord === 'while') {\n valid = true;\n pendingDoWhile = false;\n } else if (\n details.lastWord === 'if' ||\n details.lastWord === 'while' ||\n details.lastWord === 'for' ||\n details.lastWord === 'else'\n ) {\n valid = !!details.bodyContentAfterKeyword;\n }\n }\n }\n if (valid) {\n inserted[part.end] = true;\n }\n rest = rest.substring(edge);\n details = {};\n }\n insertedSemicolons.set(str.ref, inserted);\n return str;\n}\n\nexport function checkRegex(str: string): IRegEx | null {\n let i = 1;\n let escape = false;\n let done = false;\n let cancel = false;\n while (i < str.length && !done && !cancel) {\n done = str[i] === '/' && !escape;\n escape = str[i] === '\\\\' && !escape;\n cancel = str[i] === '\\n';\n i++;\n }\n const after = str.substring(i);\n cancel = cancel || !done || /^\\s*\\d/.test(after);\n if (cancel) return null;\n const flags = /^[a-z]*/.exec(after);\n if (/^\\s+[\\w$]/.test(str.substring(i + flags![0].length))) {\n return null;\n }\n const regexPattern = str.substring(1, i - 1);\n const regexFlags = (flags && flags[0]) || '';\n try {\n new RegExp(regexPattern, regexFlags);\n } catch (e) {\n if (e instanceof SyntaxError) throw e;\n }\n return {\n regex: regexPattern,\n flags: regexFlags,\n length: i + ((flags && flags[0].length) || 0),\n };\n}\n\nconst notDivide = /(typeof|delete|instanceof|return|in|of|throw|new|void|do|if)$/;\nconst possibleDivide = /^([\\w$\\])]|\\+\\+|--)[\\s/]/;\nexport function extractConstants(\n constants: IConstants,\n str: string,\n currentEnclosure = '',\n depth = 0,\n): { str: string; length: number } {\n if (depth > constants.maxDepth) {\n throw new SandboxCapabilityError('Maximum expression depth exceeded');\n }\n let quote;\n let extract: (string | number)[] = [];\n let escape = false;\n let regexFound: IRegEx | null;\n let comment = '';\n let commentStart = -1;\n let currJs: string[] = [];\n let char = '';\n const strRes: (string | number)[] = [];\n const enclosures: string[] = [];\n let isPossibleDivide: RegExpExecArray | null = null;\n let i = 0;\n for (i = 0; i < str.length; i++) {\n char = str[i];\n if (comment) {\n if (char === comment) {\n if (comment === '*' && str[i + 1] === '/') {\n comment = '';\n i++;\n } else if (comment === '\\n') {\n comment = '';\n strRes.push('\\n');\n }\n }\n } else {\n if (escape) {\n escape = false;\n extract.push(char);\n continue;\n }\n\n if (quote) {\n if (quote === '`' && char === '$' && str[i + 1] === '{') {\n const skip = extractConstants(constants, str.substring(i + 2), '{', depth + 1);\n if (!skip.str.trim().length) {\n throw new SyntaxError('Unexpected end of expression');\n }\n currJs.push(skip.str);\n extract.push('${', currJs.length - 1, `}`);\n i += skip.length + 2;\n } else if (quote === char) {\n if (quote === '`') {\n const li = createLisp<Literal>({\n op: LispType.Literal,\n a: unraw(extract.join('')),\n b: [],\n });\n li.tempJsStrings = currJs;\n constants.literals.push(li);\n strRes.push(`\\``, constants.literals.length - 1, `\\``);\n } else {\n constants.strings.push(unraw(extract.join('')));\n strRes.push(`\"`, constants.strings.length - 1, `\"`);\n }\n quote = null;\n extract = [];\n } else {\n extract.push(char);\n }\n } else {\n if (char === \"'\" || char === '\"' || char === '`') {\n currJs = [];\n quote = char;\n } else if (closings[currentEnclosure] === char && !enclosures.length) {\n return { str: strRes.join(''), length: i };\n } else if (closings[char]) {\n enclosures.push(char);\n strRes.push(char);\n } else if (closings[enclosures[enclosures.length - 1]] === char) {\n enclosures.pop();\n strRes.push(char);\n } else if (char === '/' && (str[i + 1] === '*' || str[i + 1] === '/')) {\n comment = str[i + 1] === '*' ? '*' : '\\n';\n commentStart = i;\n } else if (\n char === '/' &&\n !isPossibleDivide &&\n (regexFound = checkRegex(str.substring(i)))\n ) {\n constants.regexes.push(regexFound);\n strRes.push(`/`, constants.regexes.length - 1, `/r`);\n i += regexFound.length - 1;\n } else {\n strRes.push(char);\n }\n\n if (!isPossibleDivide || !space.test(char)) {\n if ((isPossibleDivide = possibleDivide.exec(str.substring(i)))) {\n if (notDivide.test(str.substring(0, i + isPossibleDivide[1].length))) {\n isPossibleDivide = null;\n }\n }\n }\n }\n escape = !!(quote && char === '\\\\');\n }\n }\n\n if (quote) {\n throw new SyntaxError(`Unclosed '${quote}'`);\n }\n if (comment) {\n if (comment === '*') {\n throw new SyntaxError(`Unclosed comment '/*': ${str.substring(commentStart)}`);\n }\n }\n return { str: strRes.join(''), length: i };\n}\n\nexport default function parse(\n code: string,\n eager = false,\n expression = false,\n maxParserRecursionDepth = 256,\n): IExecutionTree {\n if (typeof code !== 'string') throw new ParseError(`Cannot parse ${code}`, String(code));\n let str = ' ' + code;\n const constants: IConstants = {\n strings: [],\n literals: [],\n regexes: [],\n eager,\n maxDepth: maxParserRecursionDepth,\n };\n str = extractConstants(constants, str).str;\n\n for (const l of constants.literals) {\n l[2] = l.tempJsStrings!.map((js: string) => lispifyExpr(constants, new CodeString(js)));\n delete l.tempJsStrings;\n }\n return { tree: lispifyFunction(new CodeString(str), constants, expression), constants };\n}\n","import {\n createAsyncGeneratorFunction,\n createFunction,\n createFunctionAsync,\n createGeneratorFunction,\n} from '../executor';\nimport parse, { lispifyFunction } from '../parser';\nimport type { Lisp } from '../parser';\nimport { getSandboxSymbolCtor, LispType } from '../utils';\nimport type { IExecContext } from '../utils';\n\nexport interface IEvalContext {\n sandboxFunction: typeof sandboxFunction;\n sandboxAsyncFunction: typeof sandboxAsyncFunction;\n sandboxGeneratorFunction: typeof sandboxGeneratorFunction;\n sandboxAsyncGeneratorFunction: typeof sandboxAsyncGeneratorFunction;\n sandboxedSymbol: typeof sandboxedSymbol;\n sandboxedEval: (func: SandboxFunction, context: IExecContext) => SandboxEval;\n sandboxedSetTimeout: typeof sandboxedSetTimeout;\n sandboxedSetInterval: typeof sandboxedSetInterval;\n sandboxedClearTimeout: typeof sandboxedClearTimeout;\n sandboxedClearInterval: typeof sandboxedClearInterval;\n lispifyFunction: typeof lispifyFunction;\n}\nexport type SandboxFunction = (code: string, ...args: string[]) => () => unknown;\nexport type SandboxEval = (code: string) => unknown;\nexport type SandboxSetTimeout = (\n handler: TimerHandler,\n timeout?: number,\n ...args: unknown[]\n) => any;\nexport type SandboxSetInterval = (\n handler: TimerHandler,\n timeout?: number,\n ...args: unknown[]\n) => any;\nexport type SandboxClearTimeout = (handle: number) => void;\nexport type SandboxClearInterval = (handle: number) => void;\n\nexport function createEvalContext(): IEvalContext {\n return {\n sandboxFunction,\n sandboxAsyncFunction,\n sandboxGeneratorFunction,\n sandboxAsyncGeneratorFunction,\n sandboxedSymbol,\n sandboxedEval,\n sandboxedSetTimeout,\n sandboxedSetInterval,\n sandboxedClearTimeout,\n sandboxedClearInterval,\n lispifyFunction,\n };\n}\n\nexport function sandboxedSymbol(context: IExecContext) {\n return getSandboxSymbolCtor(context.ctx.sandboxSymbols);\n}\n\nfunction SB() {}\nexport function sandboxFunction(context: IExecContext): SandboxFunction {\n SandboxFunction.prototype = SB.prototype;\n return SandboxFunction;\n function SandboxFunction(...params: string[]) {\n const code = params.pop() || '';\n const parsed = parse(code, false, false, context.ctx.options.maxParserRecursionDepth);\n return createFunction(\n params,\n parsed.tree,\n context.ctx.ticks,\n {\n ...context,\n constants: parsed.constants,\n tree: parsed.tree,\n },\n undefined,\n 'anonymous',\n );\n }\n}\n\nexport type SandboxAsyncFunction = (code: string, ...args: string[]) => () => Promise<unknown>;\nfunction SAF() {}\nexport function sandboxAsyncFunction(context: IExecContext): SandboxAsyncFunction {\n SandboxAsyncFunction.prototype = SAF.prototype;\n return SandboxAsyncFunction;\n function SandboxAsyncFunction(...params: string[]) {\n const code = params.pop() || '';\n const parsed = parse(code, false, false, context.ctx.options.maxParserRecursionDepth);\n return createFunctionAsync(\n params,\n parsed.tree,\n context.ctx.ticks,\n {\n ...context,\n constants: parsed.constants,\n tree: parsed.tree,\n },\n undefined,\n 'anonymous',\n );\n }\n}\n\nexport type SandboxGeneratorFunction = (\n code: string,\n ...args: string[]\n) => () => Iterator<unknown> & Iterable<unknown>;\nfunction SGF() {}\nexport function sandboxGeneratorFunction(context: IExecContext): SandboxGeneratorFunction {\n SandboxGeneratorFunction.prototype = SGF.prototype;\n return SandboxGeneratorFunction;\n function SandboxGeneratorFunction(...params: string[]) {\n const code = params.pop() || '';\n const parsed = parse(code, false, false, context.ctx.options.maxParserRecursionDepth);\n return createGeneratorFunction(\n params,\n parsed.tree,\n context.ctx.ticks,\n {\n ...context,\n constants: parsed.constants,\n tree: parsed.tree,\n },\n undefined,\n 'anonymous',\n );\n }\n}\n\nexport type SandboxAsyncGeneratorFunction = (\n code: string,\n ...args: string[]\n) => () => AsyncGenerator<unknown, unknown, unknown>;\nfunction SAGF() {}\nexport function sandboxAsyncGeneratorFunction(\n context: IExecContext,\n): SandboxAsyncGeneratorFunction {\n SandboxAsyncGeneratorFunction.prototype = SAGF.prototype;\n return SandboxAsyncGeneratorFunction;\n function SandboxAsyncGeneratorFunction(...params: string[]) {\n const code = params.pop() || '';\n const parsed = parse(code, false, false, context.ctx.options.maxParserRecursionDepth);\n return createAsyncGeneratorFunction(\n params,\n parsed.tree,\n context.ctx.ticks,\n {\n ...context,\n constants: parsed.constants,\n tree: parsed.tree,\n },\n undefined,\n 'anonymous',\n );\n }\n}\n\nfunction SE() {}\nexport function sandboxedEval(func: SandboxFunction, context: IExecContext): SandboxEval {\n sandboxEval.prototype = SE.prototype;\n return sandboxEval;\n function sandboxEval(code: string) {\n // Parse the code and wrap last statement in return for completion value\n const parsed = parse(code, false, false, context.ctx.options.maxParserRecursionDepth);\n const tree = wrapLastStatementInReturn(parsed.tree);\n // Create and execute function with modified tree\n return createFunction(\n [],\n tree,\n context.ctx.ticks,\n {\n ...context,\n constants: parsed.constants,\n tree,\n },\n undefined,\n 'anonymous',\n )();\n }\n}\n\nfunction wrapLastStatementInReturn(tree: Lisp[]): Lisp[] {\n if (tree.length === 0) return tree;\n const newTree = [...tree];\n const lastIndex = newTree.length - 1;\n const lastStmt = newTree[lastIndex];\n\n // Only wrap if it's not already a return or throw\n if (Array.isArray(lastStmt) && lastStmt.length >= 1) {\n const op = lastStmt[0];\n\n // Don't wrap Return (8) or Throw (47) - they already control flow\n if (op === LispType.Return || op === LispType.Throw) {\n return newTree;\n }\n\n // List of statement types that should have undefined completion value\n // These match JavaScript semantics where declarations and control structures\n // don't produce a completion value\n const statementTypes = [\n LispType.Let, // 3\n LispType.Const, // 4\n LispType.Var, // 35\n LispType.Function, // 38\n LispType.If, // 14\n LispType.Loop, // 39\n LispType.Try, // 40\n LispType.Switch, // 41\n LispType.InternalBlock, // 43\n LispType.Expression, // 44\n ];\n\n // If the last statement is a declaration or control structure,\n // don't wrap it (it will naturally return undefined)\n if (statementTypes.includes(op)) {\n return newTree;\n }\n\n // For all other types (expressions, operators, etc.),\n // wrap in return to capture the completion value\n newTree[lastIndex] = [LispType.Return, LispType.None, lastStmt];\n }\n\n return newTree;\n}\n\nfunction sST() {}\nexport function sandboxedSetTimeout(\n func: SandboxFunction,\n context: IExecContext,\n): SandboxSetTimeout {\n sandboxSetTimeout.prototype = sST.prototype;\n return sandboxSetTimeout;\n function sandboxSetTimeout(handler: TimerHandler, timeout?: number, ...args: unknown[]) {\n const sandbox = context.ctx.sandbox;\n const exec = (...a: any[]) => {\n const h = typeof handler === 'string' ? func(handler) : handler;\n haltsub.unsubscribe();\n contsub.unsubscribe();\n sandbox.setTimeoutHandles.delete(sandBoxhandle);\n return h(...a);\n };\n\n const sandBoxhandle = ++sandbox.timeoutHandleCounter;\n\n let start = Date.now();\n let handle: number = setTimeout(exec, timeout, ...args);\n\n let elapsed = 0;\n const haltsub = sandbox.subscribeHalt(() => {\n elapsed = Date.now() - start + elapsed;\n clearTimeout(handle);\n });\n const contsub = sandbox.subscribeResume(() => {\n start = Date.now();\n const remaining = Math.floor((timeout || 0) - elapsed);\n handle = setTimeout(exec, remaining, ...args);\n sandbox.setTimeoutHandles.set(sandBoxhandle, {\n handle,\n haltsub,\n contsub,\n });\n });\n sandbox.setTimeoutHandles.set(sandBoxhandle, {\n handle,\n haltsub,\n contsub,\n });\n return sandBoxhandle;\n }\n}\n\nfunction sCT() {}\nexport function sandboxedClearTimeout(context: IExecContext): SandboxClearTimeout {\n sandboxClearTimeout.prototype = sCT.prototype;\n return sandboxClearTimeout;\n function sandboxClearTimeout(handle: number) {\n const sandbox = context.ctx.sandbox;\n const timeoutHandle = sandbox.setTimeoutHandles.get(handle);\n if (timeoutHandle) {\n clearTimeout(timeoutHandle.handle);\n timeoutHandle.haltsub.unsubscribe();\n timeoutHandle.contsub.unsubscribe();\n sandbox.setTimeoutHandles.delete(handle);\n }\n }\n}\nfunction sCI() {}\nexport function sandboxedClearInterval(context: IExecContext): SandboxClearInterval {\n sandboxClearInterval.prototype = sCI.prototype;\n return sandboxClearInterval;\n function sandboxClearInterval(handle: number) {\n const sandbox = context.ctx.sandbox;\n const intervalHandle = sandbox.setIntervalHandles.get(handle);\n if (intervalHandle) {\n clearInterval(intervalHandle.handle);\n clearTimeout(intervalHandle.handle);\n intervalHandle.haltsub.unsubscribe();\n intervalHandle.contsub.unsubscribe();\n sandbox.setIntervalHandles.delete(handle);\n }\n }\n}\n\nfunction sSI() {}\nexport function sandboxedSetInterval(\n func: SandboxFunction,\n context: IExecContext,\n): SandboxSetInterval {\n sandboxSetInterval.prototype = sSI.prototype;\n return sandboxSetInterval;\n function sandboxSetInterval(\n handler: TimerHandler,\n timeout: number | undefined,\n ...args: unknown[]\n ) {\n const sandbox = context.ctx.sandbox;\n const h = typeof handler === 'string' ? func(handler) : handler;\n const exec = (...a: any[]) => {\n start = Date.now();\n elapsed = 0;\n return h(...a);\n };\n\n const sandBoxhandle = ++sandbox.timeoutHandleCounter;\n\n let start = Date.now();\n let handle: number = setInterval(exec, timeout, ...args);\n\n let elapsed = 0;\n const haltsub = sandbox.subscribeHalt(() => {\n elapsed = Date.now() - start + elapsed;\n clearInterval(handle);\n clearTimeout(handle);\n });\n const contsub = sandbox.subscribeResume(() => {\n start = Date.now();\n handle = setTimeout(\n () => {\n start = Date.now();\n elapsed = 0;\n handle = setInterval(exec, timeout, ...args);\n handlObj.handle = handle;\n exec(...args);\n },\n Math.floor((timeout || 0) - elapsed),\n ...args,\n );\n handlObj.handle = handle;\n });\n\n const handlObj = {\n handle,\n haltsub,\n contsub,\n };\n sandbox.setIntervalHandles.set(sandBoxhandle, handlObj);\n return sandBoxhandle;\n }\n}\n","import type { IEvalContext } from './eval';\nimport { Change, ExecReturn, executeTree, executeTreeAsync } from './executor';\nimport { createContext, SandboxExecutionQuotaExceededError } from './utils';\nimport type {\n IContext,\n IExecContext,\n IGlobals,\n IOptionParams,\n IOptions,\n IScope,\n ISymbolWhitelist,\n SubscriptionSubject,\n HaltContext,\n} from './utils';\n\nfunction subscribeSet(\n obj: object,\n name: string,\n callback: (modification: Change) => void,\n context: {\n setSubscriptions: WeakMap<\n SubscriptionSubject,\n Map<string, Set<(modification: Change) => void>>\n >;\n changeSubscriptions: WeakMap<SubscriptionSubject, Set<(modification: Change) => void>>;\n },\n): { unsubscribe: () => void } {\n const names =\n context.setSubscriptions.get(obj) || new Map<string, Set<(modification: Change) => void>>();\n context.setSubscriptions.set(obj, names);\n const callbacks = names.get(name) || new Set();\n names.set(name, callbacks);\n callbacks.add(callback);\n let changeCbs: Set<(modification: Change) => void>;\n const val = (obj as any)[name] as unknown;\n if (val instanceof Object) {\n changeCbs = context.changeSubscriptions.get(val) || new Set();\n changeCbs.add(callback);\n context.changeSubscriptions.set(val, changeCbs);\n }\n return {\n unsubscribe: () => {\n callbacks.delete(callback);\n changeCbs?.delete(callback);\n },\n };\n}\n\nexport class SandboxExec {\n public readonly context: IContext;\n public readonly setSubscriptions: WeakMap<\n SubscriptionSubject,\n Map<string, Set<(modification: Change) => void>>\n > = new WeakMap();\n public readonly changeSubscriptions: WeakMap<\n SubscriptionSubject,\n Set<(modification: Change) => void>\n > = new WeakMap();\n public readonly sandboxFunctions: WeakMap<Function, IExecContext> = new WeakMap();\n private haltSubscriptions: Set<(context: HaltContext) => void> = new Set();\n private resumeSubscriptions: Set<() => void> = new Set();\n public halted = false;\n timeoutHandleCounter = 0;\n public readonly setTimeoutHandles = new Map<\n number,\n {\n handle: number;\n haltsub: { unsubscribe: () => void };\n contsub: { unsubscribe: () => void };\n }\n >();\n public readonly setIntervalHandles = new Map<\n number,\n {\n handle: number;\n haltsub: { unsubscribe: () => void };\n contsub: { unsubscribe: () => void };\n }\n >();\n constructor(\n options?: IOptionParams,\n public evalContext?: IEvalContext,\n ) {\n const opt: IOptions = Object.assign(\n {\n audit: false,\n forbidFunctionCalls: false,\n forbidFunctionCreation: false,\n globals: SandboxExec.SAFE_GLOBALS,\n symbolWhitelist: SandboxExec.SAFE_SYMBOLS,\n prototypeWhitelist: SandboxExec.SAFE_PROTOTYPES,\n maxParserRecursionDepth: 256,\n nonBlocking: false,\n functionReplacements: new Map<\n Function,\n (ctx: IExecContext, builtInReplacement?: Function) => Function\n >(),\n },\n options || {},\n );\n this.context = createContext(this, opt);\n }\n\n static get SAFE_GLOBALS(): IGlobals {\n return {\n globalThis,\n Function,\n eval,\n console: {\n debug: console.debug,\n error: console.error,\n info: console.info,\n log: console.log,\n table: console.table,\n warn: console.warn,\n },\n isFinite,\n isNaN,\n parseFloat,\n parseInt,\n decodeURI,\n decodeURIComponent,\n encodeURI,\n encodeURIComponent,\n escape,\n unescape,\n Boolean,\n Number,\n BigInt,\n String,\n Object,\n Array,\n Symbol,\n Error,\n EvalError,\n RangeError,\n ReferenceError,\n SyntaxError,\n TypeError,\n URIError,\n Int8Array,\n Uint8Array,\n Uint8ClampedArray,\n Int16Array,\n Uint16Array,\n Int32Array,\n Uint32Array,\n Float32Array,\n Float64Array,\n Map,\n Set,\n WeakMap,\n WeakSet,\n Promise,\n Intl,\n JSON,\n Math,\n Date,\n RegExp,\n };\n }\n\n static get SAFE_SYMBOLS(): ISymbolWhitelist {\n const safeSymbols: ISymbolWhitelist = {};\n for (const key of [\n 'asyncIterator',\n 'iterator',\n 'match',\n 'matchAll',\n 'replace',\n 'search',\n 'split',\n ]) {\n const value = (Symbol as unknown as Record<string, symbol | undefined>)[key];\n if (typeof value === 'symbol') {\n safeSymbols[key] = value;\n }\n }\n return safeSymbols;\n }\n\n static get SAFE_PROTOTYPES(): Map<any, Set<string>> {\n const protos = [\n Function,\n Boolean,\n Number,\n BigInt,\n String,\n Date,\n Error,\n Array,\n Int8Array,\n Uint8Array,\n Uint8ClampedArray,\n Int16Array,\n Uint16Array,\n Int32Array,\n Uint32Array,\n Float32Array,\n Float64Array,\n Map,\n Set,\n WeakMap,\n WeakSet,\n Promise,\n Symbol,\n Date,\n RegExp,\n // Fetch API\n Response,\n Request,\n Headers,\n FormData,\n ];\n const map = new Map<any, Set<string>>();\n protos.forEach((proto) => {\n map.set(proto, new Set());\n });\n map.set(\n Object,\n new Set([\n 'constructor',\n 'name',\n 'entries',\n 'fromEntries',\n 'getOwnPropertyNames',\n 'is',\n 'keys',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'toLocaleString',\n 'toString',\n 'valueOf',\n 'values',\n ]),\n );\n return map;\n }\n\n subscribeGet(\n callback: (obj: SubscriptionSubject, name: string) => void,\n context: IExecContext,\n ): { unsubscribe: () => void } {\n context.getSubscriptions.add(callback);\n return { unsubscribe: () => context.getSubscriptions.delete(callback) };\n }\n\n subscribeSet(\n obj: object,\n name: string,\n callback: (modification: Change) => void,\n context: SandboxExec | IExecContext,\n ): { unsubscribe: () => void } {\n return subscribeSet(obj, name, callback, context);\n }\n\n subscribeSetGlobal(\n obj: SubscriptionSubject,\n name: string,\n callback: (modification: Change) => void,\n ): { unsubscribe: () => void } {\n return subscribeSet(obj, name, callback, this);\n }\n\n subscribeHalt(cb: (context: HaltContext) => void) {\n this.haltSubscriptions.add(cb);\n return {\n unsubscribe: () => {\n this.haltSubscriptions.delete(cb);\n },\n };\n }\n subscribeResume(cb: () => void) {\n this.resumeSubscriptions.add(cb);\n return {\n unsubscribe: () => {\n this.resumeSubscriptions.delete(cb);\n },\n };\n }\n\n haltExecution(haltContext: HaltContext = { type: 'manual' }) {\n if (this.halted) return;\n this.halted = true;\n for (const cb of this.haltSubscriptions) {\n cb(haltContext);\n }\n }\n\n resumeExecution() {\n if (!this.halted) return;\n if (\n this.context.ticks.tickLimit !== undefined &&\n this.context.ticks.ticks >= this.context.ticks.tickLimit\n ) {\n throw new SandboxExecutionQuotaExceededError('Cannot resume execution: tick limit exceeded');\n }\n this.halted = false;\n for (const cb of this.resumeSubscriptions) {\n cb();\n }\n }\n\n getContext(fn: (...args: any[]) => any) {\n return this.sandboxFunctions.get(fn);\n }\n\n executeTree<T>(context: IExecContext, scopes: IScope[] = []): ExecReturn<T> {\n return executeTree(context.ctx.ticks, context, context.tree, scopes, undefined, false);\n }\n\n executeTreeAsync<T>(context: IExecContext, scopes: IScope[] = []): Promise<ExecReturn<T>> {\n return executeTreeAsync(context.ctx.ticks, context, context.tree, scopes, undefined, false);\n }\n}\n\nexport default SandboxExec;\n","import { AsyncFunction, createExecContext, SandboxCapabilityError, sanitizeScopes } from './utils';\nimport type { IExecContext, IOptionParams, IScope } from './utils';\nimport { createEvalContext } from './eval';\nimport { ExecReturn } from './executor';\nimport parse from './parser';\nimport SandboxExec from './SandboxExec';\nexport { ParseError } from './parser';\nexport {\n LocalScope,\n SandboxExecutionTreeError,\n SandboxCapabilityError,\n SandboxAccessError,\n SandboxExecutionQuotaExceededError,\n SandboxError,\n delaySynchronousResult,\n} from './utils';\n\nexport type * from './utils';\nexport type * from './parser';\nexport type * from './executor';\nexport type * from './eval';\n\nexport class Sandbox extends SandboxExec {\n constructor(options?: IOptionParams) {\n super(options, createEvalContext());\n }\n\n static audit<T>(code: string, scopes: IScope[] = []): ExecReturn<T> {\n const globals: Record<string, unknown> = {};\n for (const i of Object.getOwnPropertyNames(globalThis) as [keyof typeof globalThis]) {\n globals[i] = globalThis[i];\n }\n const sandbox = new SandboxExec({\n globals,\n audit: true,\n });\n return sandbox.executeTree(\n createExecContext(\n sandbox,\n parse(code, true, false, sandbox.context.options.maxParserRecursionDepth),\n createEvalContext(),\n ),\n scopes,\n );\n }\n\n static parse(code: string) {\n return parse(code, true);\n }\n\n get Function() {\n const context = createExecContext(\n this,\n {\n tree: [],\n constants: {\n strings: [],\n eager: true,\n literals: [],\n maxDepth: this.context.options.maxParserRecursionDepth,\n regexes: [],\n },\n },\n this.evalContext,\n );\n return context.evals.get(Function)!;\n }\n\n get AsyncFunction() {\n const context = createExecContext(\n this,\n {\n tree: [],\n constants: {\n strings: [],\n eager: true,\n literals: [],\n maxDepth: this.context.options.maxParserRecursionDepth,\n regexes: [],\n },\n },\n this.evalContext,\n );\n return context.evals.get(AsyncFunction)!;\n }\n\n get eval() {\n const context = createExecContext(\n this,\n {\n tree: [],\n constants: {\n strings: [],\n eager: true,\n literals: [],\n maxDepth: this.context.options.maxParserRecursionDepth,\n regexes: [],\n },\n },\n this.evalContext,\n );\n return context.evals.get(eval)!;\n }\n\n compile<T>(\n code: string,\n optimize = false,\n ): (...scopes: IScope[]) => { context: IExecContext; run: () => T } {\n if (this.context.options.nonBlocking)\n throw new SandboxCapabilityError(\n 'Non-blocking mode is enabled, use Sandbox.compileAsync() instead.',\n );\n const parsed = parse(code, optimize, false, this.context.options.maxParserRecursionDepth);\n const context = createExecContext(this, parsed, this.evalContext);\n const exec = (...scopes: IScope[]) => {\n sanitizeScopes(scopes, context);\n return { context, run: () => this.executeTree<T>(context, [...scopes]).result };\n };\n return exec;\n }\n\n compileAsync<T>(\n code: string,\n optimize = false,\n ): (...scopes: IScope[]) => { context: IExecContext; run: () => Promise<T> } {\n const parsed = parse(code, optimize, false, this.context.options.maxParserRecursionDepth);\n const context = createExecContext(this, parsed, this.evalContext);\n const exec = (...scopes: IScope[]) => {\n sanitizeScopes(scopes, context);\n return {\n context,\n run: () => this.executeTreeAsync<T>(context, [...scopes]).then((ret) => ret.result),\n };\n };\n return exec;\n }\n\n compileExpression<T>(\n code: string,\n optimize = false,\n ): (...scopes: IScope[]) => { context: IExecContext; run: () => T } {\n const parsed = parse(code, optimize, true, this.context.options.maxParserRecursionDepth);\n const context = createExecContext(this, parsed, this.evalContext);\n const exec = (...scopes: IScope[]) => {\n sanitizeScopes(scopes, context);\n return { context, run: () => this.executeTree<T>(context, [...scopes]).result };\n };\n return exec;\n }\n\n compileExpressionAsync<T>(\n code: string,\n optimize = false,\n ): (...scopes: IScope[]) => { context: IExecContext; run: () => Promise<T> } {\n const parsed = parse(code, optimize, true, this.context.options.maxParserRecursionDepth);\n const context = createExecContext(this, parsed, this.evalContext);\n const exec = (...scopes: IScope[]) => {\n return {\n context,\n run: () => this.executeTreeAsync<T>(context, [...scopes]).then((ret) => ret.result),\n };\n };\n return exec;\n }\n}\n\nexport default Sandbox;\n"],"mappings":"uOAQA,SAAS,cAAc,GAErB,OADwB,EAAI,MAAM,cACU,IAApB,SAAS,EAAK,IAcxC,SAAS,oBAAoB,EAAa,EAAmB,GAC3D,MAAM,EAAY,cAAc,GAChC,GAAI,OAAO,MAAM,SAAkC,IAAnB,GAAgC,IAAmB,EAAI,OACrF,MAAM,IAAI,YAAY,EAAY,KAAO,GAE3C,OAAO,EAWT,SAAS,qBAAqB,GAC5B,MAAM,EAAa,oBAAoB,EAAM,wBAAyB,GACtE,OAAO,OAAO,aAAa,GAa7B,SAAS,iBAAiB,EAAc,GACtC,MAAM,EAAa,oBAAoB,EAAM,oBAAqB,GAElE,QAAsB,IAAlB,EAA6B,CAC/B,MAAM,EAAsB,oBAAoB,EAAe,oBAAqB,GACpF,OAAO,OAAO,aAAa,EAAY,GAGzC,OAAO,OAAO,aAAa,GAQ7B,SAAS,cAAc,GACrB,MAA0B,MAAnB,EAA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X,WAAA,CACE,EACA,GAAO,KAAA,YAAA,wBA5BL,IAAI,iCAIJ,IAAI,8BAC4D,IAAI,+BACP,IAAI,6BACtB,IAAI,iBACnC,4BACO,yBACa,IAAI,4BAQH,IAAI,IAYvC,MAAM,EAAgB,OAAO,OAC3B,CACE,OAAO,EACP,qBAAqB,EACrB,wBAAwB,EACxB,QAAS,EAAY,aACrB,gBAAiB,EAAY,aAC7B,mBAAoB,EAAY,gBAChC,wBAAyB,IACzB,aAAa,EACb,qBAAsB,IAAI,KAK5B,GAAW,CAAA,GAEb,KAAK,QAAU,cAAc,KAAM,GAGrC,uBAAW,GACT,MAAO,CACL,sBACA,kBACA,UACA,QAAS,CACP,MAAO,QAAQ,MACf,MAAO,QAAQ,MACf,KAAM,QAAQ,KACd,IAAK,QAAQ,IACb,MAAO,QAAQ,MACf,KAAM,QAAQ,MAEhB,kBACA,YACA,sBACA,kBACA,oBACA,sCACA,oBACA,sCACA,cACA,kBACA,gBACA,cACA,cACA,cACA,cACA,YACA,cACA,YACA,oBACA,sBACA,8BACA,wBACA,oBACA,kBACA,oBACA,sBACA,oCACA,sBACA,wBACA,sBACA,wBACA,0BACA,0BACA,QACA,QACA,gBACA,gBACA,gBACA,UACA,UACA,UACA,UACA,eAIJ,uBAAW,GACT,MAAM,EAAgC,CAAA,EACtC,IAAK,MAAM,IAAO,CAChB,gBACA,WACA,QACA,WACA,UACA,SACA,SACC,CACD,MAAM,EAAS,OAAyD,GACnD,iBAAV,IACT,EAAY,GAAO,GAGvB,OAAO,EAGT,0BAAW,GACT,MAAM,EAAS,CACb,SACA,QACA,OACA,OACA,OACA,KACA,MACA,MACA,UACA,WACA,kBACA,WACA,YACA,WACA,YACA,aACA,aACA,IACA,IACA,QACA,QACA,QACA,OACA,KACA,OAEA,SACA,QACA,QACA,UAEI,EAAM,IAAI,IAuBhB,OAtBA,EAAO,QAAS,IACd,EAAI,IAAI,EAAO,IAAI,OAErB,EAAI,IACF,OACA,IAAI,IAAI,CACN,c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