ecma-evaluator 2.0.10 → 2.1.1
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/README.md +4 -4
- package/README.zh-CN.md +4 -4
- package/dist/cjs/Evaluator.d.cts +6 -4
- package/dist/cjs/index.cjs +1024 -194
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/Evaluator.d.mts +6 -4
- package/dist/esm/index.mjs +1024 -194
- package/dist/esm/index.mjs.map +1 -1
- package/package.json +16 -7
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cjs/index.cjs","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../src/block.js","../../src/Evaluator.js","../../src/TemplateParser.js","../../src/index.js"],"sourcesContent":["__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const mutableMethods = [\n\t\"Array.prototype.push\",\n\t\"Array.prototype.pop\",\n\t\"Array.prototype.shift\",\n\t\"Array.prototype.unshift\",\n\t\"Array.prototype.splice\",\n\t\"Array.prototype.reverse\",\n\t\"Array.prototype.sort\",\n\t\"Array.prototype.fill\",\n\t\"Array.prototype.copyWithin\",\n\n\t\"Object.defineProperty\",\n\t\"Object.defineProperties\",\n\t\"Object.preventExtensions\",\n\t\"Object.seal\",\n\t\"Object.freeze\",\n\t\"Object.setPrototypeOf\",\n\t\"Object.assign\",\n\t\"Object.prototype.__defineGetter__\",\n\t\"Object.prototype.__defineSetter__\",\n\n\t\"Reflect.set\",\n\t\"Reflect.defineProperty\",\n\t\"Reflect.deleteProperty\",\n\t\"Reflect.setPrototypeOf\",\n\t\"Reflect.preventExtensions\",\n\n\t\"Set.prototype.add\",\n\t\"Set.prototype.delete\",\n\t\"Set.prototype.clear\",\n\t\"WeakSet.prototype.add\",\n\t\"WeakSet.prototype.delete\",\n\n\t\"Map.prototype.set\",\n\t\"Map.prototype.delete\",\n\t\"Map.prototype.clear\",\n\t\"WeakMap.prototype.set\",\n\t\"WeakMap.prototype.delete\",\n\n\t\"Date.prototype.setTime\",\n\t\"Date.prototype.setMilliseconds\",\n\t\"Date.prototype.setUTCSeconds\",\n\t\"Date.prototype.setSeconds\",\n\t\"Date.prototype.setMinutes\",\n\t\"Date.prototype.setHours\",\n\t\"Date.prototype.setDate\",\n\t\"Date.prototype.setMonth\",\n\t\"Date.prototype.setFullYear\",\n\t\"Date.prototype.setYear\",\n\t\"Date.prototype.setUTCMilliseconds\",\n\t\"Date.prototype.setUTCMinutes\",\n\t\"Date.prototype.setUTCHours\",\n\t\"Date.prototype.setUTCDate\",\n\t\"Date.prototype.setUTCMonth\",\n\t\"Date.prototype.setUTCFullYear\",\n\n\t\"RegExp.prototype.compile\",\n\n\t\"Int8Array.prototype.set\",\n\t\"Uint8Array.prototype.set\",\n\t\"Uint8ClampedArray.prototype.set\",\n\t\"Int16Array.prototype.set\",\n\t\"Uint16Array.prototype.set\",\n\t\"Int32Array.prototype.set\",\n\t\"Uint32Array.prototype.set\",\n\t\"Float32Array.prototype.set\",\n\t\"Float64Array.prototype.set\",\n\t\"BigInt64Array.prototype.set\",\n\t\"BigUint64Array.prototype.set\",\n\n\t\"Int8Array.prototype.fill\",\n\t\"Uint8Array.prototype.fill\",\n\t\"Uint8ClampedArray.prototype.fill\",\n\t\"Int16Array.prototype.fill\",\n\t\"Uint16Array.prototype.fill\",\n\t\"Int32Array.prototype.fill\",\n\t\"Uint32Array.prototype.fill\",\n\t\"Float32Array.prototype.fill\",\n\t\"Float64Array.prototype.fill\",\n\t\"BigInt64Array.prototype.fill\",\n\t\"BigUint64Array.prototype.fill\",\n\n\t\"Int8Array.prototype.reverse\",\n\t\"Uint8Array.prototype.reverse\",\n\t\"Uint8ClampedArray.prototype.reverse\",\n\t\"Int16Array.prototype.reverse\",\n\t\"Uint16Array.prototype.reverse\",\n\t\"Int32Array.prototype.reverse\",\n\t\"Uint32Array.prototype.reverse\",\n\t\"Float32Array.prototype.reverse\",\n\t\"Float64Array.prototype.reverse\",\n\t\"BigInt64Array.prototype.reverse\",\n\t\"BigUint64Array.prototype.reverse\",\n\n\t\"Int8Array.prototype.sort\",\n\t\"Uint8Array.prototype.sort\",\n\t\"Uint8ClampedArray.prototype.sort\",\n\t\"Int16Array.prototype.sort\",\n\t\"Uint16Array.prototype.sort\",\n\t\"Int32Array.prototype.sort\",\n\t\"Uint32Array.prototype.sort\",\n\t\"Float32Array.prototype.sort\",\n\t\"Float64Array.prototype.sort\",\n\t\"BigInt64Array.prototype.sort\",\n\t\"BigUint64Array.prototype.sort\",\n\n\t\"Int8Array.prototype.copyWithin\",\n\t\"Uint8Array.prototype.copyWithin\",\n\t\"Uint8ClampedArray.prototype.copyWithin\",\n\t\"Int16Array.prototype.copyWithin\",\n\t\"Uint16Array.prototype.copyWithin\",\n\t\"Int32Array.prototype.copyWithin\",\n\t\"Uint32Array.prototype.copyWithin\",\n\t\"Float32Array.prototype.copyWithin\",\n\t\"Float64Array.prototype.copyWithin\",\n\t\"BigInt64Array.prototype.copyWithin\",\n\t\"BigUint64Array.prototype.copyWithin\",\n\n\t\"ArrayBuffer.prototype.transfer\",\n\t\"ArrayBuffer.prototype.transferToFixedLength\",\n\n\t\"SharedArrayBuffer.prototype.grow\",\n\n\t\"DataView.prototype.setInt8\",\n\t\"DataView.prototype.setUint8\",\n\t\"DataView.prototype.setInt16\",\n\t\"DataView.prototype.setUint16\",\n\t\"DataView.prototype.setInt32\",\n\t\"DataView.prototype.setUint32\",\n\t\"DataView.prototype.setFloat32\",\n\t\"DataView.prototype.setFloat64\",\n\t\"DataView.prototype.setBigInt64\",\n\t\"DataView.prototype.setBigUint64\",\n\n\t\"Generator.prototype.next\",\n\t\"Generator.prototype.return\",\n\t\"Generator.prototype.throw\",\n\n\t\"AsyncGenerator.prototype.next\",\n\t\"AsyncGenerator.prototype.return\",\n\t\"AsyncGenerator.prototype.throw\",\n\n\t\"Iterator.prototype.next\",\n\n\t\"WeakRef.prototype.deref\",\n\n\t\"FinalizationRegistry.prototype.register\",\n\t\"FinalizationRegistry.prototype.unregister\",\n\n\t\"URLSearchParams.prototype.append\",\n\t\"URLSearchParams.prototype.delete\",\n\t\"URLSearchParams.prototype.set\",\n\t\"URLSearchParams.prototype.sort\",\n\n\t\"FormData.prototype.append\",\n\t\"FormData.prototype.delete\",\n\t\"FormData.prototype.set\",\n\n\t\"Headers.prototype.append\",\n\t\"Headers.prototype.delete\",\n\t\"Headers.prototype.set\",\n\n\t// Function call/apply/bind can be used to invoke with arbitrary `this`\n\t\"Function.prototype.call\",\n\t\"Function.prototype.apply\",\n\t\"Function.prototype.bind\",\n\t\"Function.prototype.constructor\",\n\n\t// Legacy lookup helpers\n\t\"Object.prototype.__lookupGetter__\",\n\t\"Object.prototype.__lookupSetter__\",\n\n\t// Constructor property can be abused to retrieve the Function constructor\n\t\"Object.prototype.constructor\",\n];\n\nconst dangerousMethods = [\n\t\"Object.getPrototypeOf\",\n\t// Various reflective/object-inspection APIs that may expose internals\n\t\"Object.getOwnPropertyDescriptor\",\n\t\"Object.getOwnPropertyDescriptors\",\n\t\"Object.getOwnPropertyNames\",\n\t\"Object.getOwnPropertySymbols\",\n\n\t// Error reflection: Error.captureStackTrace(obj) installs a host `stack`\n\t// property on any object - including Object.prototype - polluting the\n\t// host. Error.prepareStackTrace is a host-installed callback that, if\n\t// called with attacker-controlled Error/frames, executes host code paths.\n\t\"Error.captureStackTrace\",\n\t\"Error.prepareStackTrace\",\n];\n\n// Some prototype-style aliases/properties that can be used to break sandboxes\nmutableMethods.push(\"Object.prototype.__proto__\");\n\n/**\n * List of methods to block due to mutability or dangerousness\n */\nexport const blockedMethods = [...mutableMethods, ...dangerousMethods];\n\n/**\n * List of global built-ins to block entirely\n */\nexport const blockedGlobalBuiltIns = [\n\t\"Function\",\n\t\"GeneratorFunction\",\n\t\"AsyncFunction\",\n\t\"AsyncGeneratorFunction\",\n\t\"eval\",\n\t\"setTimeout\",\n\t\"setInterval\",\n\t\"clearTimeout\",\n\t\"clearInterval\",\n\t\"setImmediate\",\n\t\"XMLHttpRequest\",\n\t\"fetch\",\n\t\"WebSocket\",\n\t\"globalThis\",\n\n\t// Node / runtime globals\n\t\"process\",\n\t\"require\",\n\t\"module\",\n\t\"exports\",\n\t\"global\",\n\t\"Buffer\",\n\t\"setImmediate\",\n\t\"clearImmediate\",\n\n\t// Worker / threading / messaging\n\t\"importScripts\",\n\t\"Worker\",\n\t\"SharedWorker\",\n\t\"ServiceWorker\",\n\t\"BroadcastChannel\",\n\t\"MessageChannel\",\n\t\"MessagePort\",\n\t\"postMessage\",\n\n\t// Host environment globals (browser)\n\t\"window\",\n\t\"document\",\n\t\"navigator\",\n\t\"location\",\n\t\"localStorage\",\n\t\"sessionStorage\",\n\t\"indexedDB\",\n\t\"performance\",\n\n\t// Low-level / concurrent / binary APIs\n\t\"Proxy\",\n\t\"Reflect\",\n\t\"Atomics\",\n\t\"WebAssembly\",\n\t// SharedArrayBuffer escapes as a live reference to host shared memory\n\t// (structuredClone copies the handle, not the memory) and its constructor\n\t// allows multi-GiB allocations from ~20 characters of input\n\t\"SharedArrayBuffer\",\n\n\t// Asynchronous scheduling primitives that invoke callbacks in the host\n\t// runtime after evaluate() returns, escaping synchronous error handling\n\t\"queueMicrotask\",\n\t// AbortSignal.timeout() schedules a host timer whose abort listener runs\n\t// outside the interpreter; the whole global is blocked to close that hole\n\t\"AbortSignal\",\n\n\t// Promise is removed entirely. Any Promise that escapes evaluate() would\n\t// schedule its settlement callbacks in the host microtask queue, where\n\t// errors bypass the caller's synchronous try/catch and become unhandled\n\t// rejections. This single entry replaces the former per-method blocklist\n\t// (then/catch/finally/resolve/reject/all/race/any/allSettled/withResolvers).\n\t\"Promise\",\n\n\t// Console and internationalization\n\t\"console\",\n\t\"Intl\",\n\n\t// Other runtimes\n\t\"Deno\",\n];\n","import * as acorn from \"acorn\";\nimport globals from \"globals\";\nimport { blockedGlobalBuiltIns, blockedMethods } from \"./block.js\";\n\n// Error message constants for better maintainability\nconst ERROR_MESSAGES = {\n\tCAN_NOT_READ_PROPERTY: \"Cannot read property of {0} (reading '{1}')\",\n\tIS_INVALID_SYNTAX: \"{0} is not a valid syntax\",\n\tIS_NOT_FUNCTION: \"{0} is not a function\",\n\tIS_NOT_DEFINED: \"{0} is not defined\",\n\tIS_NOT_ALLOWED: \"{0} is not allowed\",\n\tEXPRESSION_TOO_LONG: \"Expression exceeds the maximum length of {0} characters\",\n};\n\n/**\n * Default maximum input length for a single expression.\n * Protects against resource exhaustion from overly long inputs.\n * Can be overridden per-instance via `new Evaluator(variables, { maxInputLength })`.\n */\nconst DEFAULT_MAX_INPUT_LENGTH = 10000;\nconst MAX_CONFIGURABLE_INPUT_LENGTH = 100000;\nconst DEFAULT_MAX_EVALUATION_STEPS = 10000;\nconst MAX_CONFIGURABLE_EVALUATION_STEPS = 100000;\nconst MAX_ARRAY_LENGTH = 10000;\nconst MAX_BUFFER_BYTES = 1000000;\nconst MAX_STRING_LENGTH = 100000;\nconst MAX_DATA_NODES = 100000;\nconst MAX_BIGINT_EXPONENT = 256n;\nconst MAX_BIGINT_BITS = 65536;\nconst TYPED_ARRAY_CONSTRUCTORS = new Set(\n\t[\n\t\tInt8Array,\n\t\tUint8Array,\n\t\tUint8ClampedArray,\n\t\tInt16Array,\n\t\tUint16Array,\n\t\tInt32Array,\n\t\tUint32Array,\n\t\tFloat32Array,\n\t\tFloat64Array,\n\t\ttypeof BigInt64Array === \"function\" ? BigInt64Array : null,\n\t\ttypeof BigUint64Array === \"function\" ? BigUint64Array : null,\n\t].filter((constructor) => typeof constructor === \"function\")\n);\n/**\n * Sentinel used to distinguish \"caller passed no pre-evaluated object\" from\n * \"the object expression itself evaluated to undefined\". See\n * {@link Evaluator#handleMemberExpression}.\n */\nconst NO_OBJECT = Symbol(\"no-object\");\n\n/**\n * Renders an error message by replacing placeholders with context values.\n * @param {string} template\n * @param {Record<string, any>} context\n * @example\n * ```js\n * const msg = renderErrorMessage(\"Cannot call mutable prototype method: {method}\", { method: \"push\" });\n * ```\n */\nconst renderErrorMessage = (template, context = {}) => template.replace(/{(\\w+)}/g, (_, key) => String(context[key]));\n\nfunction validateLimit(value, name, defaultValue, maximum) {\n\tif (value === undefined) {\n\t\treturn defaultValue;\n\t}\n\tif (!Number.isSafeInteger(value) || value < 1 || value > maximum) {\n\t\tthrow new RangeError(`${name} must be an integer between 1 and ${maximum}`);\n\t}\n\treturn value;\n}\n\nfunction countLiteralMatches(value, search, all) {\n\tif (search === \"\") {\n\t\treturn all ? value.length + 1 : 1;\n\t}\n\tlet count = 0;\n\tlet position = 0;\n\twhile ((position = value.indexOf(search, position)) !== -1) {\n\t\tcount++;\n\t\tif (!all) {\n\t\t\tbreak;\n\t\t}\n\t\tposition += search.length;\n\t}\n\treturn count;\n}\n\nfunction assertBoundedData(value, label) {\n\tconst pending = [value];\n\tconst seen = new WeakSet();\n\tlet dataSize = 0;\n\tlet dataNodes = 0;\n\tconst enqueueProperties = (object) => {\n\t\tconst keys = Object.keys(object);\n\t\tif (pending.length + keys.length > MAX_DATA_NODES) {\n\t\t\tthrow new RangeError(`${label} exceeds the maximum data node count`);\n\t\t}\n\t\tfor (const key of keys) {\n\t\t\tdataSize += key.length;\n\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(object, key);\n\t\t\tif (!descriptor || !Object.hasOwn(descriptor, \"value\")) {\n\t\t\t\tthrow new TypeError(`${label} cannot contain accessor properties`);\n\t\t\t}\n\t\t\tpending.push(descriptor.value);\n\t\t}\n\t};\n\n\twhile (pending.length > 0) {\n\t\tconst current = pending.pop();\n\t\tdataNodes++;\n\t\tif (dataNodes > MAX_DATA_NODES) {\n\t\t\tthrow new RangeError(`${label} exceeds the maximum data node count`);\n\t\t}\n\n\t\tif (typeof current === \"string\") {\n\t\t\tif (current.length > MAX_STRING_LENGTH) {\n\t\t\t\tthrow new RangeError(`${label} contains a string that exceeds the maximum length`);\n\t\t\t}\n\t\t\tdataSize += current.length + 8;\n\t\t} else if (current === null || (typeof current !== \"object\" && typeof current !== \"function\")) {\n\t\t\tdataSize += 8;\n\t\t\tcontinue;\n\t\t} else if (typeof current === \"function\" || seen.has(current)) {\n\t\t\tcontinue;\n\t\t} else {\n\t\t\tseen.add(current);\n\t\t\tdataSize += 16;\n\t\t\tif (current instanceof ArrayBuffer || ArrayBuffer.isView(current)) {\n\t\t\t\tdataSize += current.byteLength;\n\t\t\t} else if (Array.isArray(current)) {\n\t\t\t\tif (current.length > MAX_ARRAY_LENGTH) {\n\t\t\t\t\tthrow new RangeError(`${label} contains an array that exceeds the maximum length`);\n\t\t\t\t}\n\t\t\t\tdataSize += current.length * 8;\n\t\t\t\tenqueueProperties(current);\n\t\t\t} else if (current instanceof Map) {\n\t\t\t\tif (current.size > MAX_ARRAY_LENGTH) {\n\t\t\t\t\tthrow new RangeError(`${label} contains a map that exceeds the maximum size`);\n\t\t\t\t}\n\t\t\t\tdataSize += current.size * 16;\n\t\t\t\tMap.prototype.forEach.call(current, (item, key) => pending.push(key, item));\n\t\t\t} else if (current instanceof Set) {\n\t\t\t\tif (current.size > MAX_ARRAY_LENGTH) {\n\t\t\t\t\tthrow new RangeError(`${label} contains a set that exceeds the maximum size`);\n\t\t\t\t}\n\t\t\t\tdataSize += current.size * 8;\n\t\t\t\tSet.prototype.forEach.call(current, (item) => pending.push(item));\n\t\t\t} else {\n\t\t\t\tenqueueProperties(current);\n\t\t\t}\n\t\t}\n\n\t\tif (dataSize > MAX_BUFFER_BYTES) {\n\t\t\tthrow new RangeError(`${label} exceeds the maximum data size`);\n\t\t}\n\t}\n\treturn { dataSize, dataNodes };\n}\n\nconst BINARY_OPERATION_MAP = {\n\t\"+\": (a, b) => a + b,\n\t\"-\": (a, b) => a - b,\n\t\"*\": (a, b) => a * b,\n\t\"**\": (a, b) => a ** b,\n\t\"==\": (a, b) => a == b,\n\t\"===\": (a, b) => a === b,\n\t\"!=\": (a, b) => a != b,\n\t\"!==\": (a, b) => a !== b,\n\t\">\": (a, b) => a > b,\n\t\">=\": (a, b) => a >= b,\n\t\"<\": (a, b) => a < b,\n\t\"<=\": (a, b) => a <= b,\n\t\"%\": (a, b) => a % b,\n\t\"/\": (a, b) => a / b,\n\t\"|\": (a, b) => a | b,\n\t\"&\": (a, b) => a & b,\n\t\"^\": (a, b) => a ^ b,\n\t\"<<\": (a, b) => a << b,\n\t\">>\": (a, b) => a >> b,\n\t\">>>\": (a, b) => a >>> b,\n\tin: (a, b) => a in b,\n\tinstanceof: (a, b) => a instanceof b,\n};\n\nfunction createGlobalScope() {\n\tconst scope = Object.create(null);\n\tconst { builtin } = globals;\n\n\tfor (const key in builtin) {\n\t\tif (blockedGlobalBuiltIns.includes(key)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t/** @type {boolean} */\n\t\tconst isWritable = builtin[key];\n\n\t\tObject.defineProperty(scope, key, {\n\t\t\tvalue: globalThis[key],\n\t\t\twritable: isWritable,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: false,\n\t\t});\n\t}\n\n\tObject.defineProperty(scope, \"globalThis\", {\n\t\tvalue: scope,\n\t\twritable: false,\n\t\tenumerable: false,\n\t\tconfigurable: false,\n\t});\n\n\treturn scope;\n}\n\nconst getBlockedMethods = (() => {\n\t/**\n\t * @type {Map<Function, string>}\n\t */\n\tlet BLOCKED_METHODS = null;\n\n\treturn () => {\n\t\tif (BLOCKED_METHODS) return BLOCKED_METHODS;\n\n\t\tconst map = new Map();\n\t\tfor (const path of blockedMethods) {\n\t\t\tconst [object, ...properties] = path.split(\".\");\n\t\t\tlet current = globalThis[object];\n\t\t\tfor (const prop of properties) {\n\t\t\t\tif (current && Object.hasOwn(current, prop)) {\n\t\t\t\t\tcurrent = current[prop];\n\t\t\t\t} else {\n\t\t\t\t\tcurrent = null;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (typeof current === \"function\") map.set(current, path);\n\t\t}\n\t\tBLOCKED_METHODS = map;\n\n\t\treturn BLOCKED_METHODS;\n\t};\n})();\n\n/**\n * A JavaScript expression evaluator that safely evaluates expressions within a sandboxed environment.\n * Supports various JavaScript features including arithmetic, logical operations, functions, and more.\n *\n * Security features:\n * - Blocks mutable methods to prevent side effects\n * - No access to eval() or Function() constructor\n * - Sandboxed scope with limited global objects\n *\n * @example\n * const evaluator = new Evaluator({ x: 10, y: 20 });\n * evaluator.evaluate('x + y') // returns 30\n */\nexport class Evaluator {\n\t/**\n\t * Creates a new Evaluator instance with a custom variable context.\n\t * The scope hierarchy is: user variables -> global scope\n\t * @param {Object} [variables={}] - An optional object containing variables to make available in the evaluation context\n\t * @param {Object} [options={}] - Additional configuration options\n\t * @param {number} [options.maxInputLength=10000] - Maximum expression length (hard maximum: 100000)\n\t * @param {number} [options.maxEvaluationSteps=10000] - Maximum AST node visits per evaluation (hard maximum: 100000)\n\t */\n\tconstructor(variables = Object.create(null), options) {\n\t\tthis.maxInputLength = validateLimit(options?.maxInputLength, \"maxInputLength\", DEFAULT_MAX_INPUT_LENGTH, MAX_CONFIGURABLE_INPUT_LENGTH);\n\t\tthis.maxEvaluationSteps = validateLimit(options?.maxEvaluationSteps, \"maxEvaluationSteps\", DEFAULT_MAX_EVALUATION_STEPS, MAX_CONFIGURABLE_EVALUATION_STEPS);\n\t\tassertBoundedData(variables, \"Evaluation context\");\n\t\tconst clonedVariables = structuredClone(variables);\n\t\tthis.scopes = [clonedVariables, createGlobalScope()].filter((scope) => scope !== null && scope !== undefined);\n\t\tthis.source = undefined;\n\t\tthis.remainingEvaluationSteps = 0;\n\t\tthis.remainingDataSize = MAX_BUFFER_BYTES;\n\t\tthis.remainingDataNodes = MAX_DATA_NODES;\n\t}\n\n\t/**\n\t * Evaluates a JavaScript expression with an optional context.\n\t * @param {string} expression\n\t * @param {unknown} [context]\n\t * @returns\n\t */\n\tstatic evaluate(expression, context) {\n\t\tconst evaluator = new Evaluator(context);\n\t\treturn evaluator.evaluate(expression);\n\t}\n\n\t/**\n\t * Parses and evaluates a JavaScript expression using acorn parser.\n\t * @param {string} expression - The JavaScript expression to evaluate\n\t * @returns {*} The result of the evaluation\n\t * @throws {SyntaxError} If the expression has invalid syntax\n\t * @throws {ReferenceError} If referencing undefined variables\n\t * @throws {TypeError} If performing invalid operations\n\t */\n\tevaluate(expression) {\n\t\tif (typeof expression !== \"string\") {\n\t\t\tthrow new TypeError(\"Expression must be a string\");\n\t\t}\n\n\t\tif (expression.length > this.maxInputLength) {\n\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.EXPRESSION_TOO_LONG, [this.maxInputLength]));\n\t\t}\n\n\t\tthis.source = expression;\n\t\tthis.remainingEvaluationSteps = this.maxEvaluationSteps;\n\t\tthis.remainingDataSize = MAX_BUFFER_BYTES;\n\t\tthis.remainingDataNodes = MAX_DATA_NODES;\n\n\t\tconst ast = acorn.parse(expression, { ecmaVersion: \"latest\" });\n\n\t\t// Start recursive evaluation from the root node\n\t\ttry {\n\t\t\treturn this.execute(ast.body);\n\t\t} finally {\n\t\t\tthis.source = undefined;\n\t\t}\n\t}\n\n\t/**\n\t * Executes an array of AST body nodes sequentially.\n\t * @private\n\t * @param {Array} body - Array of AST nodes to execute\n\t * @returns {*} The result of the last executed node\n\t */\n\texecute(body) {\n\t\tif (this.remainingEvaluationSteps === 0) {\n\t\t\tthis.remainingEvaluationSteps = this.maxEvaluationSteps;\n\t\t\tthis.remainingDataSize = MAX_BUFFER_BYTES;\n\t\t\tthis.remainingDataNodes = MAX_DATA_NODES;\n\t\t}\n\t\tlet result;\n\n\t\tfor (const node of body) {\n\t\t\tresult = this.visit(node);\n\t\t}\n\n\t\tif (typeof result === \"function\") {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Returning functions from expressions\"]));\n\t\t}\n\n\t\tassertBoundedData(result, \"Evaluation result\");\n\n\t\t// A leaked Promise schedules sandbox callbacks (and rejection errors)\n\t\t// in the host microtask queue, outside the caller's try/catch. Never\n\t\t// allow one to escape evaluate() as a value.\n\t\tif (result instanceof Promise) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Returning promises from expressions\"]));\n\t\t}\n\n\t\t// Final gate: the return value must be cloneable, pure data. A\n\t\t// function (or any non-cloneable object) smuggled inside an object or\n\t\t// array - no matter how deeply nested - fails structuredClone with a\n\t\t// DataCloneError. Without this, closures could escape evaluate() (e.g.\n\t\t// `({ f: () => secret })`) and keep reading the evaluator's scopes\n\t\t// (and host-passed objects) long after evaluate() returned. Cloning\n\t\t// also hands the host a copy instead of a reference to sandbox\n\t\t// internals, and it rejects WeakRef/FinalizationRegistry/Proxy and\n\t\t// other host-only objects.\n\t\ttry {\n\t\t\treturn structuredClone(result);\n\t\t} catch (error) {\n\t\t\tif (error && error.name === \"DataCloneError\") {\n\t\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Returning non-cloneable values from expressions\"]));\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Visits an AST node and delegates to the appropriate handler based on node type.\n\t * @private\n\t * @param {import(\"acorn\").Node} node - The AST node to visit\n\t * @returns {*} The result of visiting the node\n\t */\n\tvisit(node) {\n\t\tthis.remainingEvaluationSteps--;\n\t\tif (this.remainingEvaluationSteps < 0) {\n\t\t\tthrow new RangeError(\"Evaluation step limit exceeded\");\n\t\t}\n\n\t\tswitch (node.type) {\n\t\t\tcase \"ExpressionStatement\": {\n\t\t\t\treturn this.visit(node.expression);\n\t\t\t}\n\t\t\tcase \"BinaryExpression\": {\n\t\t\t\treturn this.handleBinaryExpression(node);\n\t\t\t}\n\t\t\tcase \"LogicalExpression\": {\n\t\t\t\treturn this.handleLogicalExpression(node);\n\t\t\t}\n\t\t\tcase \"UnaryExpression\": {\n\t\t\t\treturn this.handleUnaryExpression(node);\n\t\t\t}\n\t\t\tcase \"Identifier\": {\n\t\t\t\treturn this.handleIdentifier(node);\n\t\t\t}\n\t\t\tcase \"Literal\": {\n\t\t\t\treturn node.value;\n\t\t\t}\n\t\t\tcase \"MemberExpression\": {\n\t\t\t\treturn this.handleMemberExpression(node);\n\t\t\t}\n\t\t\tcase \"ArrayExpression\": {\n\t\t\t\treturn this.handleArrayExpression(node);\n\t\t\t}\n\t\t\tcase \"SpreadElement\": {\n\t\t\t\treturn this.handleSpreadElement(node);\n\t\t\t}\n\t\t\tcase \"ObjectExpression\": {\n\t\t\t\treturn this.handleObjectExpression(node);\n\t\t\t}\n\t\t\tcase \"FunctionExpression\": {\n\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Function expression\"]));\n\t\t\t}\n\t\t\tcase \"ArrowFunctionExpression\": {\n\t\t\t\treturn this.handleArrowFunctionExpression(node);\n\t\t\t}\n\t\t\tcase \"CallExpression\": {\n\t\t\t\treturn this.handleCallExpression(node);\n\t\t\t}\n\t\t\tcase \"ConditionalExpression\": {\n\t\t\t\treturn this.visit(node.test) ? this.visit(node.consequent) : this.visit(node.alternate);\n\t\t\t}\n\t\t\tcase \"NewExpression\": {\n\t\t\t\tif (node.callee.type !== \"Identifier\") {\n\t\t\t\t\tthrow new Error(`Unsupported callee type '${node.callee.type}' in new expression`);\n\t\t\t\t}\n\n\t\t\t\tif (node.callee.name === \"Function\") {\n\t\t\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"new Function() constructor\"]));\n\t\t\t\t}\n\n\t\t\t\t// Promise is fully removed from the sandbox; give a clear error\n\t\t\t\t// instead of a generic \"not defined\". Its executor runs\n\t\t\t\t// synchronously, but a throwing executor would turn into a\n\t\t\t\t// rejected Promise that escapes evaluate() and crashes the host.\n\t\t\t\tif (node.callee.name === \"Promise\") {\n\t\t\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Promise constructor\"]));\n\t\t\t\t}\n\t\t\t\tconst Constructor = this.visit(node.callee);\n\n\t\t\t\t// 仅在存在参数时构建数组\n\t\t\t\tconst args = node.arguments.length ? node.arguments.map((arg) => this.visit(arg)) : [];\n\t\t\t\tthis.assertBoundedConstruction(Constructor, args);\n\n\t\t\t\treturn new Constructor(...args);\n\t\t\t}\n\t\t\tcase \"ChainExpression\": {\n\t\t\t\treturn this.visit(node.expression);\n\t\t\t}\n\t\t\tcase \"TemplateLiteral\": {\n\t\t\t\treturn this.handleTemplateLiteral(node);\n\t\t\t}\n\t\t\tcase \"ThisExpression\": {\n\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"'this' expression\"]));\n\t\t\t}\n\t\t\tcase \"WithStatement\": {\n\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"'with' statement\"]));\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tlet content = this.source.slice(node.start, node.end);\n\n\t\t\t\tif (content.length > 20) {\n\t\t\t\t\tcontent = content.slice(0, 17) + \"...\";\n\t\t\t\t}\n\n\t\t\t\tthrow new SyntaxError(`'${content}'` + \" \" + renderErrorMessage(ERROR_MESSAGES.IS_INVALID_SYNTAX, [content]));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Handles binary expressions (arithmetic and comparison operations).\n\t * @param {import('acorn').BinaryExpression} node\n\t * @private\n\t */\n\thandleBinaryExpression(node) {\n\t\tconst op = node.operator;\n\t\tconst left = this.visit(node.left);\n\t\tconst right = this.visit(node.right);\n\t\tif (op === \"+\" && (typeof left === \"string\" || typeof right === \"string\")) {\n\t\t\tif (String(left).length + String(right).length > MAX_STRING_LENGTH) {\n\t\t\t\tthrow new RangeError(\"String result exceeds the maximum allowed length\");\n\t\t\t}\n\t\t}\n\t\tif (typeof left === \"bigint\" && typeof right === \"bigint\") {\n\t\t\tif (op === \"**\" && (right > MAX_BIGINT_EXPONENT || right < 0n)) {\n\t\t\t\tthrow new RangeError(`BigInt exponent must be between 0 and ${MAX_BIGINT_EXPONENT}`);\n\t\t\t}\n\t\t\tconst leftBits = left.toString(2).length;\n\t\t\tconst rightBits = right.toString(2).length;\n\t\t\tif (\n\t\t\t\t(op === \"**\" && leftBits * Number(right) > MAX_BIGINT_BITS) ||\n\t\t\t\t(op === \"<<\" && right > BigInt(MAX_BIGINT_BITS)) ||\n\t\t\t\t(op === \"<<\" && right >= 0n && leftBits + Number(right) > MAX_BIGINT_BITS) ||\n\t\t\t\t(op === \"*\" && leftBits + rightBits > MAX_BIGINT_BITS) ||\n\t\t\t\t((op === \"+\" || op === \"-\") && Math.max(leftBits, rightBits) + 1 > MAX_BIGINT_BITS)\n\t\t\t) {\n\t\t\t\tthrow new RangeError(\"BigInt result exceeds the maximum allowed size\");\n\t\t\t}\n\t\t}\n\n\t\tif (BINARY_OPERATION_MAP.hasOwnProperty(op)) {\n\t\t\treturn BINARY_OPERATION_MAP[op](left, right);\n\t\t}\n\n\t\tthrow new SyntaxError(`Unsupported operator: ${node.operator}`);\n\t}\n\n\tassertBoundedConstruction(Constructor, args) {\n\t\tconst size = args[0];\n\t\tif (Constructor === Array && args.length === 1 && typeof size === \"number\" && size > MAX_ARRAY_LENGTH) {\n\t\t\tthrow new RangeError(\"Array length exceeds the maximum allowed length\");\n\t\t}\n\t\tif (Constructor === ArrayBuffer && (size > MAX_BUFFER_BYTES || args[1]?.maxByteLength > MAX_BUFFER_BYTES)) {\n\t\t\tthrow new RangeError(\"ArrayBuffer size exceeds the maximum allowed size\");\n\t\t}\n\t\tif (Constructor === DataView && size instanceof ArrayBuffer && size.byteLength > MAX_BUFFER_BYTES) {\n\t\t\tthrow new RangeError(\"DataView size exceeds the maximum allowed size\");\n\t\t}\n\t\tif (Constructor === Map || Constructor === Set) {\n\t\t\tconst collectionSize = typeof size === \"string\" || Array.isArray(size) ? size.length : size?.size ?? size?.length;\n\t\t\tif (typeof collectionSize === \"number\" && collectionSize > MAX_ARRAY_LENGTH) {\n\t\t\t\tthrow new RangeError(\"Collection source exceeds the maximum allowed size\");\n\t\t\t}\n\t\t}\n\t\tif (TYPED_ARRAY_CONSTRUCTORS.has(Constructor)) {\n\t\t\tlet byteLength;\n\t\t\tif (size instanceof ArrayBuffer) {\n\t\t\t\tconst offset = args[1] ?? 0;\n\t\t\t\tconst elementCount = args[2] ?? Math.floor((size.byteLength - offset) / Constructor.BYTES_PER_ELEMENT);\n\t\t\t\tbyteLength = elementCount * Constructor.BYTES_PER_ELEMENT;\n\t\t\t} else {\n\t\t\t\tconst elementCount = typeof size === \"number\" ? size : size?.length ?? 0;\n\t\t\t\tbyteLength = elementCount * Constructor.BYTES_PER_ELEMENT;\n\t\t\t}\n\t\t\tif (byteLength > MAX_BUFFER_BYTES) {\n\t\t\t\tthrow new RangeError(\"Typed array size exceeds the maximum allowed size\");\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Handles logical expressions (&&, ||, ??).\n\t * Implements proper short-circuit evaluation for performance.\n\t * @private\n\t */\n\thandleLogicalExpression(node) {\n\t\tswitch (node.operator) {\n\t\t\tcase \"&&\": {\n\t\t\t\tconst left = this.visit(node.left);\n\t\t\t\treturn left ? this.visit(node.right) : left;\n\t\t\t}\n\t\t\tcase \"||\": {\n\t\t\t\tconst left = this.visit(node.left);\n\t\t\t\treturn left ? left : this.visit(node.right);\n\t\t\t}\n\t\t\tcase \"??\": {\n\t\t\t\tconst left = this.visit(node.left);\n\t\t\t\treturn left !== null && left !== undefined ? left : this.visit(node.right);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new SyntaxError(`Unsupported logical operator: ${node.operator}`);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Handles unary expressions (-, +, !, ~, typeof, void).\n\t * @private\n\t */\n\thandleUnaryExpression(node) {\n\t\tswitch (node.operator) {\n\t\t\tcase \"-\": {\n\t\t\t\treturn -this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"+\": {\n\t\t\t\treturn +this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"!\": {\n\t\t\t\treturn !this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"~\": {\n\t\t\t\treturn ~this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"typeof\": {\n\t\t\t\treturn typeof this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"void\": {\n\t\t\t\treturn void this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"delete\": {\n\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Delete operator\"]));\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new SyntaxError(`Unsupported unary operator: ${node.operator}`);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Handles identifier (variable) lookups in the scope chain.\n\t * @private\n\t */\n\thandleIdentifier(node) {\n\t\tconst name = node.name;\n\t\tfor (const scope of this.scopes) {\n\t\t\tif (Object.hasOwn(scope, name)) {\n\t\t\t\treturn scope[name];\n\t\t\t}\n\t\t}\n\n\t\tthrow new ReferenceError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_DEFINED, [name]));\n\t}\n\n\t/**\n\t * Handles member expressions (property access like obj.prop or obj[prop]).\n\t * @private\n\t */\n\thandleMemberExpression(node, objectValue = NO_OBJECT) {\n\t\tconst object = objectValue === NO_OBJECT ? this.visit(node.object) : objectValue;\n\t\t// Determine property name: either identifier name or computed value\n\t\tconst isStaticProperty = node.property.type === \"Identifier\" && !node.computed;\n\t\tconst property = isStaticProperty ? node.property.name : this.visit(node.property);\n\n\t\t// Reading `.stack` on an Error instance forces V8 to materialize the\n\t\t// stack, which invokes a host-installed Error.prepareStackTrace with\n\t\t// sandbox-owned values. Block it *before* any property access, since\n\t\t// even the prototype check below would trigger the getter.\n\t\tif (property === \"stack\" && object instanceof Error) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Accessing error stack\"]));\n\t\t}\n\n\t\t// Prevent access to prototype properties\n\t\tif (typeof object !== \"undefined\" && object !== null && object[property] === object?.__proto__) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Accessing prototype properties\"]));\n\t\t}\n\n\t\tif (object === null || object === undefined) {\n\t\t\t// optional chaining\n\t\t\tif (node.optional) {\n\t\t\t\treturn void 0;\n\t\t\t}\n\t\t\tthrow new TypeError(renderErrorMessage(ERROR_MESSAGES.CAN_NOT_READ_PROPERTY, [object, property]));\n\t\t}\n\n\t\tconst result = object[property];\n\n\t\t// The Function constructor must never be reachable from an expression.\n\t\t// If it escapes as a value, native callbacks (e.g. Promise.then,\n\t\t// Array.prototype.map) invoke it outside the interpreter's call path,\n\t\t// enabling arbitrary host code execution. This is a structural guard:\n\t\t// no matter how many `.constructor` hops an expression takes, the\n\t\t// final value can never be `Function` (or its prototype).\n\t\tif (result === Function || result === Function.prototype) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Function constructor\"]));\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Handles array literal expressions.\n\t * @private\n\t */\n\thandleArrayExpression(node) {\n\t\tconst result = [];\n\n\t\tfor (let i = 0; i < node.elements.length; i++) {\n\t\t\tconst element = node.elements.at(i);\n\n\t\t\t// Array holes (`[1, , 3]`) are represented as null elements by\n\t\t\t// acorn. Preserve them instead of crashing on node.type access.\n\t\t\tif (element === null) {\n\t\t\t\tresult.length++;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst value = this.visit(element);\n\n\t\t\tif (element.type === \"SpreadElement\") {\n\t\t\t\tthis.assertBoundedSpread(result.length, value);\n\t\t\t\tresult.push(...value);\n\t\t\t} else {\n\t\t\t\tresult.push(value);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tassertBoundedSpread(currentLength, value) {\n\t\tconst size = typeof value === \"string\" || Array.isArray(value) ? value.length : value?.size;\n\t\tif (typeof size === \"number\" && currentLength + size > MAX_ARRAY_LENGTH) {\n\t\t\tthrow new RangeError(\"Spread value exceeds the maximum allowed length\");\n\t\t}\n\t}\n\n\t/**\n\t * Handles object literal expressions.\n\t * @returns\n\t */\n\thandleObjectExpression(node) {\n\t\tconst obj = {};\n\t\tlet spreadPropertyCount = 0;\n\t\tfor (const prop of node.properties) {\n\t\t\tif (prop.type === \"SpreadElement\") {\n\t\t\t\tconst spreadValue = this.visit(prop.argument);\n\t\t\t\tspreadPropertyCount += Object.keys(spreadValue).length;\n\t\t\t\tif (spreadPropertyCount > MAX_ARRAY_LENGTH) {\n\t\t\t\t\tthrow new RangeError(\"Object spread exceeds the maximum allowed property count\");\n\t\t\t\t}\n\t\t\t\tObject.assign(obj, spreadValue);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// Computed keys must be *evaluated* (`{ [1 + 1]: v }` -> key \"2\"),\n\t\t\t// not taken from the property name. Non-computed keys keep the\n\t\t\t// literal `__proto__: v` semantics (which sets the prototype via\n\t\t\t// the Object.prototype.__proto__ setter), while computed keys are\n\t\t\t// plain properties: `{ [\"__proto__\"]: v }` must NOT touch the\n\t\t\t// prototype.\n\t\t\tconst key = prop.computed ? this.visit(prop.key) : prop.key.name || prop.key.value;\n\t\t\tconst value = this.visit(prop.value);\n\t\t\tif (prop.computed) {\n\t\t\t\tObject.defineProperty(obj, key, { value, writable: true, enumerable: true, configurable: true });\n\t\t\t} else {\n\t\t\t\tobj[key] = value;\n\t\t\t}\n\t\t}\n\t\treturn obj;\n\t}\n\n\thandleSpreadElement(node) {\n\t\treturn this.visit(node.argument);\n\t}\n\n\t/**\n\t * Handles arrow function expressions.\n\t * Creates a closure that captures the current scope and executes the function body\n\t * with parameters bound to a new scope.\n\t * @private\n\t */\n\thandleArrowFunctionExpression(node) {\n\t\treturn (...args) => {\n\t\t\t// Create new scope with parameters bound to arguments\n\t\t\tconst newScope = {};\n\t\t\tconst paramCount = node.params.length;\n\t\t\tfor (let i = 0; i < paramCount; i++) {\n\t\t\t\tnewScope[node.params[i].name] = args[i];\n\t\t\t}\n\n\t\t\t// Push new scope, evaluate body, then pop scope. The scope must be\n\t\t\t// popped even when the body throws: a leaked scope would make the\n\t\t\t// parameter bindings visible to subsequent evaluations on the same\n\t\t\t// instance.\n\t\t\tthis.scopes.unshift(newScope);\n\t\t\ttry {\n\t\t\t\tconst result = this.visit(node.body);\n\t\t\t\tthis.consumeEvaluationValue(result);\n\t\t\t\treturn result;\n\t\t\t} finally {\n\t\t\t\tthis.scopes.shift();\n\t\t\t}\n\t\t};\n\t}\n\n\tconsumeEvaluationValue(value) {\n\t\tconst { dataSize, dataNodes } = assertBoundedData(value, \"Intermediate evaluation result\");\n\t\tthis.remainingDataSize -= dataSize;\n\t\tthis.remainingDataNodes -= dataNodes;\n\t\tif (this.remainingDataSize < 0 || this.remainingDataNodes < 0) {\n\t\t\tthrow new RangeError(\"Evaluation allocation budget exceeded\");\n\t\t}\n\t}\n\n\t/**\n\t * Handles function call expressions, including optional chaining.\n\t * @private\n\t */\n\thandleCallExpression(node) {\n\t\tconst isOptional = node.optional || (node.callee.type === \"MemberExpression\" && node.callee.optional);\n\t\tlet func;\n\t\tlet target = null;\n\n\t\tif (node.callee.type === \"MemberExpression\") {\n\t\t\t// Evaluate the object expression exactly once, then resolve the\n\t\t\t// property through handleMemberExpression so that all of its\n\t\t\t// guards (.stack access, prototype access, Function constructor)\n\t\t\t// still apply. Visiting the whole callee and then the object again\n\t\t\t// would double-evaluate side-effecting expressions such as\n\t\t\t// `new Date(1000).getTime()` or `f().g()`.\n\t\t\ttarget = this.visit(node.callee.object);\n\t\t\tfunc = this.handleMemberExpression(node.callee, target);\n\t\t} else {\n\t\t\tfunc = this.visit(node.callee);\n\t\t}\n\n\t\tif ((func === undefined || func === null) && isOptional) {\n\t\t\treturn void 0;\n\t\t}\n\n\t\tif (func === Function) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Function constructor\"]));\n\t\t}\n\t\t// Error.prepareStackTrace is a host-installed callback. It must be\n\t\t// checked dynamically: the blocked-methods map is built lazily on first\n\t\t// use, so a host that installs the callback *after* that point would\n\t\t// otherwise evade the static blocklist.\n\t\tif (func === Error.prepareStackTrace) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Error.prepareStackTrace\"]));\n\t\t}\n\n\t\tif (getBlockedMethods().has(func)) {\n\t\t\tconst path = getBlockedMethods().get(func);\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [path]));\n\t\t}\n\n\t\t// 仅在存在参数时构建数组\n\t\tconst args = (() => {\n\t\t\tif (node.arguments.length === 0) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tlet result = [];\n\n\t\t\tfor (let i = 0; i < node.arguments.length; i++) {\n\t\t\t\tconst element = node.arguments.at(i);\n\t\t\t\tconst value = this.visit(element);\n\n\t\t\t\tif (element.type === \"SpreadElement\") {\n\t\t\t\t\tthis.assertBoundedSpread(result.length, value);\n\t\t\t\t\tresult.push(...value);\n\t\t\t\t} else {\n\t\t\t\t\tresult.push(value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t})();\n\n\t\t// Defense in depth: even if a `Function` reference were somehow\n\t\t// produced by an expression, it must not be passed as an argument.\n\t\t// Native methods (Promise.then, Array.prototype.map, ...) would\n\t\t// invoke it in the host runtime, outside this interpreter's checks.\n\t\tif (args.some((arg) => arg === Function)) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Function constructor\"]));\n\t\t}\n\t\tif (typeof target === \"string\") {\n\t\t\tif (String.prototype.repeat && func === String.prototype.repeat && target.length * Number(args[0]) > MAX_STRING_LENGTH) {\n\t\t\t\tthrow new RangeError(\"String result exceeds the maximum allowed length\");\n\t\t\t}\n\t\t\tif ((String.prototype.padStart && func === String.prototype.padStart || func === String.prototype.padEnd) && Number(args[0]) > MAX_STRING_LENGTH) {\n\t\t\t\tthrow new RangeError(\"String result exceeds the maximum allowed length\");\n\t\t\t}\n\t\t\tif (String.prototype.concat && func === String.prototype.concat) {\n\t\t\t\tconst resultLength = target.length + args.reduce((length, value) => length + String(value).length, 0);\n\t\t\t\tif (resultLength > MAX_STRING_LENGTH) {\n\t\t\t\t\tthrow new RangeError(\"String result exceeds the maximum allowed length\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ((String.prototype.replace && func === String.prototype.replace) || (String.prototype.replaceAll && func === String.prototype.replaceAll)) {\n\t\t\t\tif (typeof args[0] === \"string\") {\n\t\t\t\t\tif (typeof args[1] === \"function\" || (typeof args[1] === \"string\" && /\\$(?:[$&'`])/u.test(args[1]))) {\n\t\t\t\t\t\tthrow new Error(\"Only literal string replacements are allowed\");\n\t\t\t\t\t}\n\t\t\t\t\tif (target.length * Math.max(1, args[0].length) > 10000000) {\n\t\t\t\t\t\tthrow new RangeError(\"String operation exceeds the maximum work limit\");\n\t\t\t\t\t}\n\t\t\t\t\tconst matchCount = countLiteralMatches(target, args[0], func === String.prototype.replaceAll);\n\t\t\t\t\tif (target.length + matchCount * String(args[1]).length > MAX_STRING_LENGTH) {\n\t\t\t\t\t\tthrow new RangeError(\"String result exceeds the maximum allowed length\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (func === String.prototype.split) {\n\t\t\t\tif (args[0] === \"\" && target.length > MAX_ARRAY_LENGTH) {\n\t\t\t\t\tthrow new RangeError(\"Split result exceeds the maximum allowed length\");\n\t\t\t\t}\n\t\t\t\tif (typeof args[0] === \"string\" && args[0] !== \"\" && countLiteralMatches(target, args[0], true) >= MAX_ARRAY_LENGTH) {\n\t\t\t\t\tthrow new RangeError(\"Split result exceeds the maximum allowed length\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif ((target === Array || TYPED_ARRAY_CONSTRUCTORS.has(target)) && func === target.from) {\n\t\t\tconst source = args[0];\n\t\t\tconst size = typeof source === \"string\" || Array.isArray(source) ? source.length : source?.size ?? source?.length;\n\t\t\tif (typeof size === \"number\" && size > MAX_ARRAY_LENGTH) {\n\t\t\t\tthrow new RangeError(\"Array.from source exceeds the maximum allowed length\");\n\t\t\t}\n\t\t}\n\n\t\tif (typeof func !== \"function\") {\n\t\t\tconst calledString = getNodeString(node.callee);\n\t\t\tthrow new TypeError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_FUNCTION, [calledString]));\n\t\t}\n\n\t\tconst result = func.apply(target, args);\n\n\t\t// Defense in depth: never let a Promise escape as a call result. Its\n\t\t// settlement callbacks run in the host microtask queue, where errors\n\t\t// bypass the caller's synchronous try/catch entirely.\n\t\tif (result instanceof Promise) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Returning promises from expressions\"]));\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Handles template literal expressions.\n\t * More efficient implementation that interleaves quasis and expressions without sorting.\n\t * @private\n\t */\n\thandleTemplateLiteral(node) {\n\t\tlet result = \"\";\n\t\tconst expressionCount = node.expressions.length;\n\n\t\tfor (let i = 0; i < node.quasis.length; i++) {\n\t\t\tresult += node.quasis[i].value.raw;\n\t\t\tif (i < expressionCount) {\n\t\t\t\tresult += this.visit(node.expressions[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n}\n\n/**\n *\n * @param {import('acorn').Node} node\n * @returns\n */\nexport function getNodeString(node) {\n\tswitch (node.type) {\n\t\tcase \"Identifier\": {\n\t\t\treturn node.name;\n\t\t}\n\t\tcase \"Literal\": {\n\t\t\treturn node.raw;\n\t\t}\n\t\tcase \"ArrayExpression\": {\n\t\t\treturn `[${node.elements.map((child) => getNodeString(child)).join(\",\")}]`;\n\t\t}\n\t\tcase \"ObjectExpression\": {\n\t\t\t// if keys is empty\n\t\t\tif (node.properties.length === 0) {\n\t\t\t\treturn \"{}\";\n\t\t\t}\n\n\t\t\treturn \"{(intermediate value)}\";\n\t\t}\n\t\tcase \"MemberExpression\": {\n\t\t\tconst objectStr = getNodeString(node.object);\n\t\t\tconst propertyStr = getNodeString(node.property);\n\n\t\t\tif (node.computed) {\n\t\t\t\treturn `${objectStr}[${propertyStr}]`;\n\t\t\t}\n\t\t\treturn `${objectStr}.${propertyStr}`;\n\t\t}\n\t\tdefault: {\n\t\t\treturn null;\n\t\t}\n\t}\n}\n","/**\n * 简单状态机模板解析器\n * 能够正确处理表达式中包含字符串、转义字符和结束标记的情况\n * @class SimpleStateTemplateParser\n */\nconst DEFAULT_MAX_TEMPLATE_LENGTH = 100000;\nconst MAX_CONFIGURABLE_TEMPLATE_LENGTH = 1000000;\nconst DEFAULT_MAX_TOKENS = 1000;\nconst MAX_CONFIGURABLE_TOKENS = 10000;\n\nfunction validateLimit(value, name, defaultValue, maximum) {\n\tif (value === undefined) {\n\t\treturn defaultValue;\n\t}\n\tif (!Number.isSafeInteger(value) || value < 1 || value > maximum) {\n\t\tthrow new RangeError(`${name} must be an integer between 1 and ${maximum}`);\n\t}\n\treturn value;\n}\n\nclass TemplateParser {\n\t/**\n\t * 创建解析器实例\n\t * @param {Object} [options] - 配置选项\n\t * @param {string} [options.expressionStart='{{'] - 表达式开始标记\n\t * @param {string} [options.expressionEnd='}}'] - 表达式结束标记\n\t * @param {boolean} [options.preserveWhitespace=true] - 是否保留表达式周围的空白字符\n\t */\n\tconstructor(options = {}) {\n\t\toptions ??= {};\n\t\tthis.maxTemplateLength = validateLimit(options.maxTemplateLength, \"maxTemplateLength\", DEFAULT_MAX_TEMPLATE_LENGTH, MAX_CONFIGURABLE_TEMPLATE_LENGTH);\n\t\tthis.maxTokens = validateLimit(options.maxTokens, \"maxTokens\", DEFAULT_MAX_TOKENS, MAX_CONFIGURABLE_TOKENS);\n\t\tif (options.expressionStart !== undefined && (typeof options.expressionStart !== \"string\" || options.expressionStart.length === 0 || options.expressionStart.length > 128)) {\n\t\t\tthrow new TypeError(\"expressionStart must be a non-empty string of at most 128 characters\");\n\t\t}\n\t\tif (options.expressionEnd !== undefined && (typeof options.expressionEnd !== \"string\" || options.expressionEnd.length === 0 || options.expressionEnd.length > 128)) {\n\t\t\tthrow new TypeError(\"expressionEnd must be a non-empty string of at most 128 characters\");\n\t\t}\n\t\t// 表达式标记配置\n\t\tthis.exprStart = options.expressionStart || \"{{\";\n\t\tthis.exprEnd = options.expressionEnd || \"}}\";\n\n\t\t// 标记长度缓存,避免重复计算\n\t\tthis.startLen = this.exprStart.length;\n\t\tthis.endLen = this.exprEnd.length;\n\n\t\t// 其他配置\n\t\tthis.preserveWhitespace = options.preserveWhitespace === true;\n\t}\n\n\t/**\n\t * 解析模板字符串,将其转换为 token 数组\n\t * @param {string} template - 要解析的模板字符串\n\t * @returns {Array<{type: string, value: string}>} token 数组\n\t */\n\tparse(template) {\n\t\t// 输入验证\n\t\tif (typeof template !== \"string\") {\n\t\t\tthrow new TypeError(\"模板必须是字符串\");\n\t\t}\n\t\tif (template.length > this.maxTemplateLength) {\n\t\t\tthrow new RangeError(`Template exceeds the maximum length of ${this.maxTemplateLength} characters`);\n\t\t}\n\n\t\tconst tokens = []; // 存储解析结果的 token 数组\n\t\tconst pushToken = (token) => {\n\t\t\tif (tokens.length >= this.maxTokens) {\n\t\t\t\tthrow new RangeError(`Template exceeds the maximum token count of ${this.maxTokens}`);\n\t\t\t}\n\t\t\ttokens.push(token);\n\t\t};\n\t\tconst length = template.length;\n\n\t\t// 状态机变量\n\t\tlet state = \"TEXT\"; // 当前状态:TEXT | EXPR | STRING_SQ | STRING_DQ | TEMPLATE | ESCAPE_*\n\t\tlet buffer = \"\"; // 当前状态的字符缓冲区\n\t\tlet exprStartPos = 0; // 当前表达式的开始位置(用于错误恢复)\n\t\tlet pos = 0; // 当前扫描位置\n\n\t\t// 主解析循环:逐个字符扫描模板\n\t\twhile (pos < length) {\n\t\t\tconst char = template[pos];\n\t\t\tconst nextChar = template[pos + 1];\n\n\t\t\t// 状态机核心逻辑\n\t\t\tswitch (state) {\n\t\t\t\t// ==================== 文本状态 ====================\n\t\t\t\tcase \"TEXT\":\n\t\t\t\t\t// 检查是否遇到表达式开始标记\n\t\t\t\t\tif (this._isMatch(pos, template, this.exprStart)) {\n\t\t\t\t\t\t// 将缓冲区中的文本保存为 token\n\t\t\t\t\t\tif (buffer.length > 0) {\n\t\t\t\t\t\t\tpushToken({ type: \"text\", value: buffer, start: pos - buffer.length, end: pos });\n\t\t\t\t\t\t\tbuffer = \"\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// 切换到表达式状态\n\t\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\t\texprStartPos = pos; // 记录表达式开始位置\n\t\t\t\t\t\tpos += this.startLen; // 跳过开始标记\n\t\t\t\t\t\tcontinue; // 继续处理下一个字符(跳过本次循环的剩余部分)\n\t\t\t\t\t}\n\t\t\t\t\t// 普通文本字符,添加到缓冲区\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\t// ==================== 表达式状态 ====================\n\t\t\t\tcase \"EXPR\":\n\t\t\t\t\t// 在表达式中,需要处理各种字符串和转义字符\n\t\t\t\t\tif (char === \"'\") {\n\t\t\t\t\t\t// 进入单引号字符串状态\n\t\t\t\t\t\tstate = \"STRING_SQ\";\n\t\t\t\t\t} else if (char === '\"') {\n\t\t\t\t\t\t// 进入双引号字符串状态\n\t\t\t\t\t\tstate = \"STRING_DQ\";\n\t\t\t\t\t} else if (char === \"`\") {\n\t\t\t\t\t\t// 进入模板字符串状态\n\t\t\t\t\t\tstate = \"TEMPLATE\";\n\t\t\t\t\t} else if (char === \"\\\\\") {\n\t\t\t\t\t\t// 遇到转义字符,根据当前上下文进入相应的转义状态\n\t\t\t\t\t\tif (nextChar === \"'\") state = \"ESCAPE_SQ\";\n\t\t\t\t\t\telse if (nextChar === '\"') state = \"ESCAPE_DQ\";\n\t\t\t\t\t\telse if (nextChar === \"`\") state = \"ESCAPE_TEMPLATE\";\n\t\t\t\t\t\telse state = \"ESCAPE_EXPR\";\n\t\t\t\t\t} else if (this._isMatch(pos, template, this.exprEnd)) {\n\t\t\t\t\t\t// 找到表达式结束标记,且不在字符串中\n\t\t\t\t\t\tconst exprValue = this.preserveWhitespace ? buffer : buffer.trim();\n\t\t\t\t\t\tif (exprValue.length > 0) {\n\t\t\t\t\t\t\tpushToken({\n\t\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\t\tvalue: exprValue,\n\t\t\t\t\t\t\t\tstart: exprStartPos,\n\t\t\t\t\t\t\t\tend: pos + this.endLen,\n\t\t\t\t\t\t\t\tcontentStart: exprStartPos + this.startLen,\n\t\t\t\t\t\t\t\tcontentEnd: pos,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// 重置状态,准备处理后续文本\n\t\t\t\t\t\tbuffer = \"\";\n\t\t\t\t\t\tstate = \"TEXT\";\n\t\t\t\t\t\tpos += this.endLen; // 跳过结束标记\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t// 将当前字符添加到表达式缓冲区\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\t// ==================== 字符串状态 ====================\n\t\t\t\tcase \"STRING_SQ\": // 单引号字符串\n\t\t\t\t\tif (char === \"\\\\\") {\n\t\t\t\t\t\tstate = \"ESCAPE_SQ\"; // 遇到转义字符\n\t\t\t\t\t} else if (char === \"'\") {\n\t\t\t\t\t\tstate = \"EXPR\"; // 字符串结束,回到表达式状态\n\t\t\t\t\t}\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"STRING_DQ\": // 双引号字符串\n\t\t\t\t\tif (char === \"\\\\\") {\n\t\t\t\t\t\tstate = \"ESCAPE_DQ\";\n\t\t\t\t\t} else if (char === '\"') {\n\t\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\t}\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"TEMPLATE\": // 模板字符串\n\t\t\t\t\tif (char === \"\\\\\") {\n\t\t\t\t\t\tstate = \"ESCAPE_TEMPLATE\";\n\t\t\t\t\t} else if (char === \"`\") {\n\t\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\t}\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\t// ==================== 转义状态 ====================\n\t\t\t\t// 转义状态:处理转义字符,然后返回到之前的状态\n\t\t\t\tcase \"ESCAPE_SQ\":\n\t\t\t\t\tbuffer += char; // 添加转义后的字符\n\t\t\t\t\tstate = \"STRING_SQ\"; // 回到单引号字符串状态\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"ESCAPE_DQ\":\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tstate = \"STRING_DQ\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"ESCAPE_TEMPLATE\":\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tstate = \"TEMPLATE\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"ESCAPE_EXPR\":\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// 移动到下一个字符\n\t\t\tpos++;\n\t\t}\n\n\t\t// ==================== 后处理 ====================\n\t\t// 处理扫描结束后缓冲区中剩余的内容\n\t\tif (buffer.length > 0) {\n\t\t\tif (state === \"TEXT\") {\n\t\t\t\t// 剩余的文本内容\n\t\t\t\tpushToken({ type: \"text\", value: buffer, start: pos - buffer.length, end: pos });\n\t\t\t} else {\n\t\t\t\t// 未完成的表达式,将其作为普通文本处理\n\t\t\t\tconst incompleteExpr = this.exprStart + buffer;\n\t\t\t\tpushToken({ type: \"text\", value: incompleteExpr, start: exprStartPos, end: pos });\n\t\t\t}\n\t\t}\n\n\t\treturn tokens;\n\t}\n\n\t/**\n\t * 检查指定位置是否匹配给定的字符序列\n\t * @param {number} pos - 开始检查的位置\n\t * @param {string} template - 模板字符串\n\t * @param {string} sequence - 要匹配的字符序列\n\t * @returns {boolean} 是否匹配\n\t * @private\n\t */\n\t_isMatch(pos, template, sequence) {\n\t\t// 检查剩余长度是否足够\n\t\tif (pos + sequence.length > template.length) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// 逐个字符比较\n\t\tfor (let i = 0; i < sequence.length; i++) {\n\t\t\tif (template[pos + i] !== sequence[i]) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * 静态方法:快速解析模板\n\t * @param {string} template - 模板字符串\n\t * @param {Object} [options] - 配置选项\n\t * @returns {Array} token 数组\n\t */\n\tstatic parse(template, options) {\n\t\tconst parser = new TemplateParser(options);\n\t\treturn parser.parse(template);\n\t}\n}\n\nexport { TemplateParser };\n","import { Evaluator } from \"./Evaluator.js\";\nimport { TemplateParser } from \"./TemplateParser.js\";\n\nexport { Evaluator, TemplateParser };\n\nconst DEFAULT_MAX_TEMPLATE_EXPRESSIONS = 100;\nconst MAX_TEMPLATE_EXPRESSIONS = 1000;\nconst DEFAULT_MAX_TEMPLATE_OUTPUT_LENGTH = 100000;\nconst MAX_TEMPLATE_OUTPUT_LENGTH = 1000000;\n\nfunction validateLimit(value, name, defaultValue, maximum) {\n\tif (value === undefined) {\n\t\treturn defaultValue;\n\t}\n\tif (!Number.isSafeInteger(value) || value < 1 || value > maximum) {\n\t\tthrow new RangeError(`${name} must be an integer between 1 and ${maximum}`);\n\t}\n\treturn value;\n}\n\n/**\n * Evaluates a JavaScript expression with an optional context.\n * @param {string} expression - The JavaScript expression to evaluate\n * @param {unknown} [context] - Optional context object with variables to use in the expression\n * @returns {*} The result of evaluating the expression\n * @example\n * evalExpression('a + b', { a: 1, b: 2 }) // returns 3\n */\nexport function evalExpression(expression, context) {\n\treturn Evaluator.evaluate(expression, context);\n}\n\n/**\n * Evaluates a template string by replacing {{ expression }} patterns with their evaluated values.\n * Undefined variables in expressions are replaced with empty strings instead of throwing errors.\n * @param {string} template - The template string containing {{ expression }} patterns\n * @param {Object} [context] - Optional context object with variables to use in expressions\n * @param {Object} [templateParserOptions] - Optional options for the template parser\n * @returns {string} The template with all expressions evaluated and replaced\n * @example\n * evalTemplate('Hello {{ name }}!', { name: 'World' }) // returns 'Hello World!'\n */\nexport function evalTemplate(template, context, templateParserOptions) {\n\tconst options = templateParserOptions ?? {};\n\tconst maxExpressions = validateLimit(options.maxExpressions, \"maxExpressions\", DEFAULT_MAX_TEMPLATE_EXPRESSIONS, MAX_TEMPLATE_EXPRESSIONS);\n\tconst maxOutputLength = validateLimit(options.maxOutputLength, \"maxOutputLength\", DEFAULT_MAX_TEMPLATE_OUTPUT_LENGTH, MAX_TEMPLATE_OUTPUT_LENGTH);\n\tconst tokens = TemplateParser.parse(template, options);\n\tlet result = \"\";\n\tlet expressionCount = 0;\n\n\t// Reuse a single Evaluator instance for every expression in the template.\n\t// `Evaluator.evaluate` builds a new instance per call, cloning the whole\n\t// context via structuredClone for each expression - wasteful when a\n\t// template contains many expressions. Reusing one instance is safe here:\n\t// evaluate() never mutates the scope chain outside its own call (arrow\n\t// function scopes are pushed and popped in a finally block), and closures\n\t// cannot escape because the cloneable-return gate rejects them.\n\tconst evaluator = new Evaluator(context, {\n\t\tmaxInputLength: options.maxExpressionLength,\n\t\tmaxEvaluationSteps: options.maxEvaluationSteps,\n\t});\n\n\tconst typeHandler = {\n\t\ttext: (token) => token.value,\n\t\texpression: (token) => {\n\t\t\ttry {\n\t\t\t\treturn evaluator.evaluate(token.value);\n\t\t\t} catch (error) {\n\t\t\t\t// Replace undefined variables with empty string for graceful degradation\n\t\t\t\tif (error instanceof ReferenceError && error.message.endsWith(\"is not defined\")) {\n\t\t\t\t\treturn \"undefined\";\n\t\t\t\t} else {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t};\n\n\tfor (const token of tokens) {\n\t\t// Unknown token type, treat as text\n\t\tconst handler = typeHandler[token.type] ?? typeHandler[\"text\"];\n\t\tif (token.type === \"expression\") {\n\t\t\texpressionCount++;\n\t\t\tif (expressionCount > maxExpressions) {\n\t\t\t\tthrow new RangeError(`Template exceeds the maximum expression count of ${maxExpressions}`);\n\t\t\t}\n\t\t}\n\n\t\tconst chunk = String(handler(token));\n\t\tif (result.length + chunk.length > maxOutputLength) {\n\t\t\tthrow new RangeError(`Template output exceeds the maximum length of ${maxOutputLength} characters`);\n\t\t}\n\t\tresult += chunk;\n\t}\n\n\treturn result;\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","mutableMethods","dangerousMethods","blockedMethods","blockedGlobalBuiltIns","ERROR_MESSAGES","DEFAULT_MAX_INPUT_LENGTH","MAX_CONFIGURABLE_INPUT_LENGTH","DEFAULT_MAX_EVALUATION_STEPS","MAX_CONFIGURABLE_EVALUATION_STEPS","MAX_ARRAY_LENGTH","MAX_BUFFER_BYTES","MAX_STRING_LENGTH","MAX_DATA_NODES","MAX_BIGINT_EXPONENT","MAX_BIGINT_BITS","TYPED_ARRAY_CONSTRUCTORS","Set","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array","constructor","NO_OBJECT","renderErrorMessage","template","context","_","String","validateLimit","value","name","defaultValue","maximum","undefined","Number","RangeError","countLiteralMatches","search","all","count","position","assertBoundedData","label","pending","seen","WeakSet","dataSize","dataNodes","enqueueProperties","object","keys","_iteratorError","descriptor","TypeError","current","_type_of","_instanceof","ArrayBuffer","Array","Map","item","BINARY_OPERATION_MAP","a","b","createGlobalScope","scope","builtin","globals","isWritable","globalThis","getBlockedMethods","BLOCKED_METHODS","map","path","_path_split","properties","_iteratorError1","Evaluator","variables","options","clonedVariables","structuredClone","evaluate","expression","SyntaxError","ast","acorn","execute","body","result","node","Error","Promise","error","visit","Constructor","args","arg","content","handleBinaryExpression","op","left","right","leftBits","rightBits","BigInt","Math","assertBoundedConstruction","_args_","size","DataView","_size_size","collectionSize","byteLength","_args_1","offset","_args_2","elementCount","_size_length","elementCount1","handleLogicalExpression","left1","left2","handleUnaryExpression","handleIdentifier","ReferenceError","handleMemberExpression","objectValue","isStaticProperty","property","Function","handleArrayExpression","i","element","_result","assertBoundedSpread","currentLength","handleObjectExpression","spreadPropertyCount","spreadValue","handleSpreadElement","handleArrowFunctionExpression","newScope","paramCount","consumeEvaluationValue","_assertBoundedData","handleCallExpression","isOptional","func","target","resultLength","length","matchCount","source","_source_size","calledString","getNodeString","handleTemplateLiteral","expressionCount","evaluator","child","objectStr","propertyStr","DEFAULT_MAX_TEMPLATE_LENGTH","MAX_CONFIGURABLE_TEMPLATE_LENGTH","DEFAULT_MAX_TOKENS","MAX_CONFIGURABLE_TOKENS","TemplateParser","parse","tokens","pushToken","token","state","buffer","exprStartPos","pos","char","nextChar","exprValue","incompleteExpr","_isMatch","sequence","parser","DEFAULT_MAX_TEMPLATE_EXPRESSIONS","MAX_TEMPLATE_EXPRESSIONS","DEFAULT_MAX_TEMPLATE_OUTPUT_LENGTH","MAX_TEMPLATE_OUTPUT_LENGTH","evalExpression","evalTemplate","templateParserOptions","maxExpressions","maxOutputLength","typeHandler","_typeHandler_token_type","handler","chunk"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,SAAS,QAAO,EAAEC,UAAU;QACnD,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,SAASI,GAAG,EAAEC,IAAI;QAAI,OAAOF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;IAAO;;;ICCtGL,oBAAoB,CAAC,GAAG,SAAS,QAAO;QACvC,IAAG,AAAkB,eAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACNA,IAAMI,iBAAiB;IACtB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IAEA;IACA;IACA;IAEA;IAEA;IAEA;IACA;IAEA;IACA;IACA;IACA;IAEA;IACA;IACA;IAEA;IACA;IACA;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time/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../src/block.js","../../src/regExpSafety.js","../../src/Evaluator.js","../../src/TemplateParser.js","../../src/index.js"],"sourcesContent":["__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const mutableMethods = [\n\t\"Array.prototype.push\",\n\t\"Array.prototype.pop\",\n\t\"Array.prototype.shift\",\n\t\"Array.prototype.unshift\",\n\t\"Array.prototype.splice\",\n\t\"Array.prototype.reverse\",\n\t\"Array.prototype.sort\",\n\t\"Array.prototype.fill\",\n\t\"Array.prototype.copyWithin\",\n\n\t\"Object.create\",\n\t\"Object.defineProperty\",\n\t\"Object.defineProperties\",\n\t\"Object.preventExtensions\",\n\t\"Object.seal\",\n\t\"Object.freeze\",\n\t\"Object.setPrototypeOf\",\n\t\"Object.assign\",\n\t\"Object.prototype.__defineGetter__\",\n\t\"Object.prototype.__defineSetter__\",\n\n\t\"Reflect.set\",\n\t\"Reflect.defineProperty\",\n\t\"Reflect.deleteProperty\",\n\t\"Reflect.setPrototypeOf\",\n\t\"Reflect.preventExtensions\",\n\n\t\"Set.prototype.add\",\n\t\"Set.prototype.delete\",\n\t\"Set.prototype.clear\",\n\t\"WeakSet.prototype.add\",\n\t\"WeakSet.prototype.delete\",\n\n\t\"Map.prototype.set\",\n\t\"Map.prototype.delete\",\n\t\"Map.prototype.clear\",\n\t\"WeakMap.prototype.set\",\n\t\"WeakMap.prototype.delete\",\n\n\t\"Date.prototype.setTime\",\n\t\"Date.prototype.setMilliseconds\",\n\t\"Date.prototype.setUTCSeconds\",\n\t\"Date.prototype.setSeconds\",\n\t\"Date.prototype.setMinutes\",\n\t\"Date.prototype.setHours\",\n\t\"Date.prototype.setDate\",\n\t\"Date.prototype.setMonth\",\n\t\"Date.prototype.setFullYear\",\n\t\"Date.prototype.setYear\",\n\t\"Date.prototype.setUTCMilliseconds\",\n\t\"Date.prototype.setUTCMinutes\",\n\t\"Date.prototype.setUTCHours\",\n\t\"Date.prototype.setUTCDate\",\n\t\"Date.prototype.setUTCMonth\",\n\t\"Date.prototype.setUTCFullYear\",\n\n\t\"RegExp.prototype.compile\",\n\n\t\"Int8Array.prototype.set\",\n\t\"Uint8Array.prototype.set\",\n\t\"Uint8ClampedArray.prototype.set\",\n\t\"Int16Array.prototype.set\",\n\t\"Uint16Array.prototype.set\",\n\t\"Int32Array.prototype.set\",\n\t\"Uint32Array.prototype.set\",\n\t\"Float32Array.prototype.set\",\n\t\"Float64Array.prototype.set\",\n\t\"BigInt64Array.prototype.set\",\n\t\"BigUint64Array.prototype.set\",\n\n\t\"Int8Array.prototype.fill\",\n\t\"Uint8Array.prototype.fill\",\n\t\"Uint8ClampedArray.prototype.fill\",\n\t\"Int16Array.prototype.fill\",\n\t\"Uint16Array.prototype.fill\",\n\t\"Int32Array.prototype.fill\",\n\t\"Uint32Array.prototype.fill\",\n\t\"Float32Array.prototype.fill\",\n\t\"Float64Array.prototype.fill\",\n\t\"BigInt64Array.prototype.fill\",\n\t\"BigUint64Array.prototype.fill\",\n\n\t\"Int8Array.prototype.reverse\",\n\t\"Uint8Array.prototype.reverse\",\n\t\"Uint8ClampedArray.prototype.reverse\",\n\t\"Int16Array.prototype.reverse\",\n\t\"Uint16Array.prototype.reverse\",\n\t\"Int32Array.prototype.reverse\",\n\t\"Uint32Array.prototype.reverse\",\n\t\"Float32Array.prototype.reverse\",\n\t\"Float64Array.prototype.reverse\",\n\t\"BigInt64Array.prototype.reverse\",\n\t\"BigUint64Array.prototype.reverse\",\n\n\t\"Int8Array.prototype.sort\",\n\t\"Uint8Array.prototype.sort\",\n\t\"Uint8ClampedArray.prototype.sort\",\n\t\"Int16Array.prototype.sort\",\n\t\"Uint16Array.prototype.sort\",\n\t\"Int32Array.prototype.sort\",\n\t\"Uint32Array.prototype.sort\",\n\t\"Float32Array.prototype.sort\",\n\t\"Float64Array.prototype.sort\",\n\t\"BigInt64Array.prototype.sort\",\n\t\"BigUint64Array.prototype.sort\",\n\n\t\"Int8Array.prototype.copyWithin\",\n\t\"Uint8Array.prototype.copyWithin\",\n\t\"Uint8ClampedArray.prototype.copyWithin\",\n\t\"Int16Array.prototype.copyWithin\",\n\t\"Uint16Array.prototype.copyWithin\",\n\t\"Int32Array.prototype.copyWithin\",\n\t\"Uint32Array.prototype.copyWithin\",\n\t\"Float32Array.prototype.copyWithin\",\n\t\"Float64Array.prototype.copyWithin\",\n\t\"BigInt64Array.prototype.copyWithin\",\n\t\"BigUint64Array.prototype.copyWithin\",\n\n\t\"ArrayBuffer.prototype.transfer\",\n\t\"ArrayBuffer.prototype.transferToFixedLength\",\n\n\t\"SharedArrayBuffer.prototype.grow\",\n\n\t\"DataView.prototype.setInt8\",\n\t\"DataView.prototype.setUint8\",\n\t\"DataView.prototype.setInt16\",\n\t\"DataView.prototype.setUint16\",\n\t\"DataView.prototype.setInt32\",\n\t\"DataView.prototype.setUint32\",\n\t\"DataView.prototype.setFloat32\",\n\t\"DataView.prototype.setFloat64\",\n\t\"DataView.prototype.setBigInt64\",\n\t\"DataView.prototype.setBigUint64\",\n\n\t\"Generator.prototype.next\",\n\t\"Generator.prototype.return\",\n\t\"Generator.prototype.throw\",\n\n\t\"AsyncGenerator.prototype.next\",\n\t\"AsyncGenerator.prototype.return\",\n\t\"AsyncGenerator.prototype.throw\",\n\n\t\"Iterator.prototype.next\",\n\n\t\"WeakRef.prototype.deref\",\n\n\t\"FinalizationRegistry.prototype.register\",\n\t\"FinalizationRegistry.prototype.unregister\",\n\n\t\"URLSearchParams.prototype.append\",\n\t\"URLSearchParams.prototype.delete\",\n\t\"URLSearchParams.prototype.set\",\n\t\"URLSearchParams.prototype.sort\",\n\n\t\"FormData.prototype.append\",\n\t\"FormData.prototype.delete\",\n\t\"FormData.prototype.set\",\n\n\t\"Headers.prototype.append\",\n\t\"Headers.prototype.delete\",\n\t\"Headers.prototype.set\",\n\n\t// Function call/apply/bind can be used to invoke with arbitrary `this`\n\t\"Function.prototype.call\",\n\t\"Function.prototype.apply\",\n\t\"Function.prototype.bind\",\n\t\"Function.prototype.constructor\",\n\n\t// Legacy lookup helpers\n\t\"Object.prototype.__lookupGetter__\",\n\t\"Object.prototype.__lookupSetter__\",\n\n\t// Constructor property can be abused to retrieve the Function constructor\n\t\"Object.prototype.constructor\",\n];\n\nconst dangerousMethods = [\n\t\"Object.getPrototypeOf\",\n\t// Various reflective/object-inspection APIs that may expose internals\n\t\"Object.getOwnPropertyDescriptor\",\n\t\"Object.getOwnPropertyDescriptors\",\n\t\"Object.getOwnPropertyNames\",\n\t\"Object.getOwnPropertySymbols\",\n\n\t// Error reflection: Error.captureStackTrace(obj) installs a host `stack`\n\t// property on any object - including Object.prototype - polluting the\n\t// host. Error.prepareStackTrace is a host-installed callback that, if\n\t// called with attacker-controlled Error/frames, executes host code paths.\n\t\"Error.captureStackTrace\",\n\t\"Error.prepareStackTrace\",\n];\n\n// Some prototype-style aliases/properties that can be used to break sandboxes\nmutableMethods.push(\"Object.prototype.__proto__\");\n\n/**\n * List of methods to block due to mutability or dangerousness\n */\nexport const blockedMethods = [...mutableMethods, ...dangerousMethods];\n\n/**\n * List of global built-ins to block entirely\n */\nexport const blockedGlobalBuiltIns = [\n\t\"Function\",\n\t\"GeneratorFunction\",\n\t\"AsyncFunction\",\n\t\"AsyncGeneratorFunction\",\n\t\"eval\",\n\t\"setTimeout\",\n\t\"setInterval\",\n\t\"clearTimeout\",\n\t\"clearInterval\",\n\t\"setImmediate\",\n\t\"XMLHttpRequest\",\n\t\"fetch\",\n\t\"WebSocket\",\n\t\"globalThis\",\n\n\t// Node / runtime globals\n\t\"process\",\n\t\"require\",\n\t\"module\",\n\t\"exports\",\n\t\"global\",\n\t\"Buffer\",\n\t\"setImmediate\",\n\t\"clearImmediate\",\n\n\t// Worker / threading / messaging\n\t\"importScripts\",\n\t\"Worker\",\n\t\"SharedWorker\",\n\t\"ServiceWorker\",\n\t\"BroadcastChannel\",\n\t\"MessageChannel\",\n\t\"MessagePort\",\n\t\"postMessage\",\n\n\t// Host environment globals (browser)\n\t\"window\",\n\t\"document\",\n\t\"navigator\",\n\t\"location\",\n\t\"localStorage\",\n\t\"sessionStorage\",\n\t\"indexedDB\",\n\t\"performance\",\n\n\t// Low-level / concurrent / binary APIs\n\t\"Proxy\",\n\t\"Reflect\",\n\t\"Atomics\",\n\t\"WebAssembly\",\n\t// SharedArrayBuffer escapes as a live reference to host shared memory\n\t// (structuredClone copies the handle, not the memory) and its constructor\n\t// allows multi-GiB allocations from ~20 characters of input\n\t\"SharedArrayBuffer\",\n\n\t// Asynchronous scheduling primitives that invoke callbacks in the host\n\t// runtime after evaluate() returns, escaping synchronous error handling\n\t\"queueMicrotask\",\n\t// AbortSignal.timeout() schedules a host timer whose abort listener runs\n\t// outside the interpreter; the whole global is blocked to close that hole\n\t\"AbortSignal\",\n\n\t// Promise is removed entirely. Any Promise that escapes evaluate() would\n\t// schedule its settlement callbacks in the host microtask queue, where\n\t// errors bypass the caller's synchronous try/catch and become unhandled\n\t// rejections. This single entry replaces the former per-method blocklist\n\t// (then/catch/finally/resolve/reject/all/race/any/allSettled/withResolvers).\n\t\"Promise\",\n\n\t// Console and internationalization\n\t\"console\",\n\t\"Intl\",\n\n\t// Other runtimes\n\t\"Deno\",\n];\n","/**\n * Conservative static screen for catastrophic-backtracking (\"ReDoS\") patterns.\n *\n * A native `RegExp` has no execution-time limit, so a pathological pattern can\n * block the event loop for an unbounded time on a tiny input (e.g.\n * `/^(a+)+$/.test(\"aaaa…!\")`). This module flags three structural shapes:\n *\n * 1. An unbounded quantifier over a sub-expression that itself contains an\n * unbounded quantifier, e.g. `(a+)+`, `(\\d+)*`, `(a*b+)+` — exponential.\n * 2. An unbounded quantifier over an alternation whose branches can match the\n * same first character, e.g. `(a|ab)+`, `(a|.)+`, `([ab]|a)+` —\n * exponential. Overlap is detected both textually (one branch is a prefix\n * of another) and through an approximate first-character set.\n * 3. Adjacent unbounded quantifiers over overlapping characters, e.g.\n * `.*.*x`, `a*a*b`, `(a*)(a*)b` — polynomial (quadratic).\n *\n * This is a heuristic screen, not a proof: it is intentionally conservative\n * (it may reject some safe patterns such as `(a|ab)+`) and it does not catch\n * every ReDoS shape. It removes the demonstrated exploit classes but must not\n * be treated as a guarantee. Callers that need a hard bound should not evaluate\n * untrusted patterns at all.\n *\n * @param {string} pattern - A regular-expression source (without slashes).\n * @returns {boolean} `true` when the pattern is potentially catastrophic.\n */\nexport function isUnsafeRegExpPattern(pattern) {\n let pos = 0;\n let depth = 0;\n const MAX_DEPTH = 1000;\n\n function parseAlternation() {\n const start = pos;\n const branches = [parseSequence()];\n while (pattern[pos] === \"|\") {\n pos++;\n branches.push(parseSequence());\n }\n if (branches.length === 1) {\n return branches[0];\n }\n return { type: \"alt\", branches, start, end: pos };\n }\n\n function parseSequence() {\n const start = pos;\n const terms = [];\n while (pos < pattern.length && pattern[pos] !== \"|\" && pattern[pos] !== \")\") {\n terms.push(parseTerm());\n }\n return { type: \"seq\", terms, start, end: pos };\n }\n\n function parseTerm() {\n const atom = parseAtom();\n const quantifier = parseQuantifier();\n if (quantifier) {\n return { type: \"quant\", min: quantifier.min, max: quantifier.max, body: atom, start: atom.start, end: pos };\n }\n return atom;\n }\n\n function parseQuantifier() {\n const ch = pattern[pos];\n if (ch === \"*\") {\n pos++;\n return { min: 0, max: Infinity };\n }\n if (ch === \"+\") {\n pos++;\n return { min: 1, max: Infinity };\n }\n if (ch === \"?\") {\n pos++;\n return { min: 0, max: 1 };\n }\n if (ch === \"{\") {\n const match = /^\\{(\\d+)(,(\\d*))?\\}/.exec(pattern.slice(pos));\n if (match) {\n pos += match[0].length;\n const min = Number(match[1]);\n let max;\n if (match[2] === undefined) {\n max = min;\n } else {\n max = match[3] === \"\" ? Infinity : Number(match[3]);\n }\n return { min, max };\n }\n }\n return null;\n }\n\n function parseAtom() {\n const start = pos;\n const ch = pattern[pos];\n\n if (ch === \"(\") {\n pos++;\n let zeroWidth = false;\n if (pattern[pos] === \"?\") {\n const rest = pattern.slice(pos);\n if (rest.startsWith(\"?:\")) {\n pos += 2;\n } else if (rest.startsWith(\"?=\") || rest.startsWith(\"?!\")) {\n pos += 2;\n zeroWidth = true;\n } else if (rest.startsWith(\"?<=\") || rest.startsWith(\"?<!\")) {\n pos += 3;\n zeroWidth = true;\n } else if (rest.startsWith(\"?<\")) {\n const named = /^\\?<[A-Za-z_$][\\w$]*>/.exec(rest);\n pos += named ? named[0].length : 2;\n } else {\n pos += 1;\n }\n }\n depth++;\n if (depth > MAX_DEPTH) {\n throw new RangeError(\"regexp nesting too deep\");\n }\n const body = parseAlternation();\n depth--;\n if (pattern[pos] === \")\") {\n pos++;\n }\n return { type: \"group\", body, zeroWidth, start, end: pos };\n }\n\n if (ch === \"[\") {\n pos++;\n if (pattern[pos] === \"^\") {\n pos++;\n }\n if (pattern[pos] === \"]\") {\n pos++;\n }\n while (pos < pattern.length && pattern[pos] !== \"]\") {\n if (pattern[pos] === \"\\\\\") {\n pos++;\n }\n pos++;\n }\n pos++;\n return { type: \"char\", zeroWidth: false, start, end: pos };\n }\n\n if (ch === \"\\\\\") {\n pos += 2;\n const escaped = pattern[start + 1];\n return { type: \"char\", zeroWidth: escaped === \"b\" || escaped === \"B\", start, end: pos };\n }\n\n pos++;\n return { type: \"char\", zeroWidth: ch === \"^\" || ch === \"$\", start, end: pos };\n }\n\n const raw = (node) => pattern.slice(node.start, node.end);\n\n /**\n * Approximate set of characters a node can start with, as a `Set<string>`\n * or the sentinel `ANY` when it cannot be bounded (a negated class, a\n * wildcard, a backreference, an unbounded quantifier, …). It is only used\n * to decide whether two branches/terms *might* consume the same\n * character, so over-approximation is safe: a false \"may overlap\" only\n * rejects a pattern that is already suspicious. A precise set is worth\n * the effort though — treating `\\s` and `\\w` as `ANY` would wrongly flag\n * the ubiquitous `\\s*\\w+` as a polynomial risk.\n */\n const ANY = Symbol(\"any\");\n const DIGITS = new Set(\"0123456789\".split(\"\"));\n const WORD = new Set(\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_\".split(\"\"));\n const SPACES = new Set([\" \", \"\\t\", \"\\n\", \"\\r\", \"\\f\", \"\\v\", \"\\u00a0\", \"\\ufeff\", \"\\u2028\", \"\\u2029\"]);\n\n /** Expands a single (already unescaped) class escape such as `d`, `w`, `s`. */\n function escapeSet(esc) {\n switch (esc) {\n case \"d\":\n return DIGITS;\n case \"w\":\n return WORD;\n case \"s\":\n return SPACES;\n case \"n\":\n return new Set([\"\\n\"]);\n case \"t\":\n return new Set([\"\\t\"]);\n case \"r\":\n return new Set([\"\\r\"]);\n case \"f\":\n return new Set([\"\\f\"]);\n case \"v\":\n return new Set([\"\\v\"]);\n case \"0\":\n return new Set([\"\\0\"]);\n default:\n // A backreference (`\\1`) or a negated class (`\\D`, `\\W`,\n // `\\S`) cannot be enumerated; treat it as unbounded.\n if (/[0-9A-Za-z]/.test(esc)) {\n return ANY;\n }\n // Escaped punctuation (`\\.`, `\\+`, `\\*`, …) is the\n // literal character itself.\n return new Set([esc]);\n }\n }\n\n /** Parses a `[...]` character class into a concrete set, or `ANY` when negated/opaque. */\n function classSet(text) {\n // text is the raw slice including the surrounding brackets.\n const inner = text.slice(1, -1);\n if (inner.startsWith(\"^\")) {\n return ANY;\n }\n const set = new Set();\n for (let i = 0; i < inner.length; i++) {\n let ch = inner[i];\n if (ch === \"\\\\\") {\n const esc = inner[++i];\n const expanded = escapeSet(esc);\n if (expanded === ANY) {\n return ANY;\n }\n for (const c of expanded) set.add(c);\n continue;\n }\n // Range: `a-z`.\n if (inner[i + 1] === \"-\" && inner[i + 2] !== undefined && inner[i + 2] !== \"]\") {\n const end = inner[i + 2];\n const startCode = ch.codePointAt(0);\n const endCode = end.codePointAt(0);\n // Cap the expansion so a huge range cannot blow up memory.\n if (endCode - startCode > 1024) {\n return ANY;\n }\n for (let code = startCode; code <= endCode; code++) {\n set.add(String.fromCodePoint(code));\n }\n i += 2;\n continue;\n }\n set.add(ch);\n }\n return set;\n }\n\n function firstCharSet(node) {\n switch (node.type) {\n case \"char\": {\n const text = raw(node);\n if (node.zeroWidth || text.startsWith(\"^\") || text.startsWith(\"$\")) {\n return new Set();\n }\n if (text === \".\") {\n return ANY;\n }\n if (text.startsWith(\"[\")) {\n return classSet(text);\n }\n if (text.startsWith(\"\\\\\")) {\n const esc = text.slice(1);\n if (esc.length === 1) {\n return escapeSet(esc);\n }\n // \\p{..}, \\k<..>, \\1 backrefs, etc. are opaque.\n return ANY;\n }\n return new Set([text[0]]);\n }\n case \"quant\":\n return node.min === 0 ? ANY : firstCharSet(node.body);\n case \"group\":\n return node.zeroWidth ? ANY : firstCharSet(node.body);\n case \"alt\": {\n const union = new Set();\n for (const branch of node.branches) {\n const set = firstCharSet(branch);\n if (set === ANY) return ANY;\n for (const ch of set) union.add(ch);\n }\n return union;\n }\n case \"seq\":\n for (const term of node.terms) {\n const set = firstCharSet(term);\n if (set === ANY) return ANY;\n if (set.size > 0) return set;\n }\n return new Set();\n default:\n return ANY;\n }\n }\n\n /** `true` when the two sets share at least one start character (or either is `ANY`). */\n function setsIntersect(a, b) {\n if (a === ANY || b === ANY) return true;\n if (a.size === 0 || b.size === 0) return false;\n const [small, large] = a.size <= b.size ? [a, b] : [b, a];\n for (const ch of small) {\n if (large.has(ch)) return true;\n }\n return false;\n }\n\n /**\n * The set of characters a quantifier can consume. Unlike\n * {@link firstCharSet}, this never returns `ANY` merely because the\n * quantifier may match the empty string: `\\s*` consumes only whitespace,\n * so it does not overlap `\\w+`.\n */\n function consumableCharSet(quantNode) {\n return firstCharSet(quantNode.body);\n }\n\n /**\n * Adjacent unbounded quantifiers whose consumed character sets overlap\n * (`a*a*b`, `.*.*x`) backtrack polynomially — quadratic on a\n * non-matching input. This is a *different* shape from the\n * nested-quantifier case: neither quantifier is inside the other. Two\n * `*`/`+` terms over disjoint characters (`a*b*`, `\\s*\\w+`) are safe and\n * must not be flagged.\n *\n * The quantifiers need not be literal siblings: `(a*)(a*)b` is the same\n * hazard with each quantifier wrapped in its own group, so the boundary\n * between two terms is compared through their *trailing* and *leading*\n * quantifiers respectively.\n */\n function trailingQuantifier(node) {\n switch (node.type) {\n case \"quant\":\n return node.max === Infinity ? node : null;\n case \"group\":\n return node.zeroWidth ? null : trailingQuantifier(node.body);\n case \"seq\": {\n for (let i = node.terms.length - 1; i >= 0; i--) {\n const quantifier = trailingQuantifier(node.terms[i]);\n if (quantifier) return quantifier;\n const set = firstCharSet(node.terms[i]);\n if (set === ANY || set.size > 0) return null;\n }\n return null;\n }\n default:\n return null;\n }\n }\n\n function leadingQuantifier(node) {\n switch (node.type) {\n case \"quant\":\n return node.max === Infinity ? node : null;\n case \"group\":\n return node.zeroWidth ? null : leadingQuantifier(node.body);\n case \"seq\": {\n for (const term of node.terms) {\n const quantifier = leadingQuantifier(term);\n if (quantifier) return quantifier;\n const set = firstCharSet(term);\n if (set === ANY || set.size > 0) return null;\n }\n return null;\n }\n default:\n return null;\n }\n }\n\n function hasAdjacentOverlappingQuantifiers(seqNode) {\n const terms = seqNode.terms;\n for (let i = 0; i + 1 < terms.length; i++) {\n const left = trailingQuantifier(terms[i]);\n const right = leadingQuantifier(terms[i + 1]);\n if (left && right && setsIntersect(consumableCharSet(left), consumableCharSet(right))) {\n return true;\n }\n }\n return false;\n }\n\n function containsUnboundedQuantifier(node) {\n switch (node.type) {\n case \"quant\":\n if (node.max === Infinity) {\n return true;\n }\n return containsUnboundedQuantifier(node.body);\n case \"group\":\n return containsUnboundedQuantifier(node.body);\n case \"alt\":\n return node.branches.some(containsUnboundedQuantifier);\n case \"seq\":\n return node.terms.some(containsUnboundedQuantifier);\n default:\n return false;\n }\n }\n\n function alternationOverlaps(node) {\n if (node.type !== \"alt\") {\n return false;\n }\n // A branch that can match the empty string makes every branch\n // ambiguous with it. Otherwise, one branch is a prefix of another\n // exactly when the two are adjacent after a lexicographic sort, so\n // this stays O(branches * log branches) instead of quadratic.\n const texts = node.branches.map(raw).sort();\n for (let i = 0; i + 1 < texts.length; i++) {\n if (texts[i] === \"\" || texts[i + 1].startsWith(texts[i])) {\n return true;\n }\n }\n // Textual prefixes miss branches that overlap through a character\n // class or a different literal that starts the same way, e.g.\n // `(a|.)`, `([ab]|a)`, `(\\w|a)`. Those are catastrophic under an\n // unbounded quantifier exactly like `(a|ab)` is, so also compare\n // the (over-approximated) set of first characters each branch can\n // consume. This is a superset of the prefix case.\n const sets = node.branches.map(firstCharSet);\n for (let i = 0; i < sets.length; i++) {\n for (let j = i + 1; j < sets.length; j++) {\n if (setsIntersect(sets[i], sets[j])) {\n return true;\n }\n }\n }\n return false;\n }\n\n function isCatastrophic(node) {\n switch (node.type) {\n case \"quant\": {\n if (node.max === Infinity) {\n const inner = node.body.type === \"group\" ? node.body.body : node.body;\n if (containsUnboundedQuantifier(inner)) {\n return true;\n }\n if (inner.type === \"alt\" && alternationOverlaps(inner)) {\n return true;\n }\n }\n return isCatastrophic(node.body);\n }\n case \"group\":\n return isCatastrophic(node.body);\n case \"alt\":\n return node.branches.some(isCatastrophic);\n case \"seq\":\n return hasAdjacentOverlappingQuantifiers(node) || node.terms.some(isCatastrophic);\n default:\n return false;\n }\n }\n\n try {\n return isCatastrophic(parseAlternation());\n } catch {\n // The pattern is already validated by the host RegExp constructor, so a\n // parse failure means this analyzer is incomplete, not that the input is\n // invalid. Fail open (do not reject) to avoid breaking valid patterns.\n return false;\n }\n}\n","import * as acorn from \"acorn\";\nimport globals from \"globals\";\nimport { blockedGlobalBuiltIns, blockedMethods } from \"./block.js\";\nimport { isUnsafeRegExpPattern } from \"./regExpSafety.js\";\n\n// Error message constants for better maintainability\nconst ERROR_MESSAGES = {\n\tCAN_NOT_READ_PROPERTY: \"Cannot read property of {0} (reading '{1}')\",\n\tIS_INVALID_SYNTAX: \"{0} is not a valid syntax\",\n\tIS_NOT_FUNCTION: \"{0} is not a function\",\n\tIS_NOT_DEFINED: \"{0} is not defined\",\n\tIS_NOT_ALLOWED: \"{0} is not allowed\",\n\tEXPRESSION_TOO_LONG: \"Expression exceeds the maximum length of {0} characters\",\n};\n\n/**\n * Default maximum input length for a single expression.\n * Protects against resource exhaustion from overly long inputs.\n * Can be overridden per-instance via `new Evaluator(variables, { maxInputLength })`.\n */\nconst DEFAULT_MAX_INPUT_LENGTH = 10000;\nconst MAX_CONFIGURABLE_INPUT_LENGTH = 100000;\nconst DEFAULT_MAX_EVALUATION_STEPS = 10000;\nconst MAX_CONFIGURABLE_EVALUATION_STEPS = 100000;\nconst MAX_ARRAY_LENGTH = 10000;\nconst MAX_BUFFER_BYTES = 1000000;\nconst MAX_STRING_LENGTH = 100000;\nconst MAX_DATA_NODES = 100000;\nconst MAX_BIGINT_EXPONENT = 256n;\nconst MAX_BIGINT_BITS = 65536;\nconst DEFAULT_MAX_DEPTH = 1000;\nconst MAX_CONFIGURABLE_DEPTH = 2000;\nconst MAX_REGEXP_SOURCE_LENGTH = 1000;\nconst MAX_REGEXP_FLAGS_LENGTH = 32;\n/**\n * Builtins that must never be exposed even though the host runtime provides\n * them. They are either host-only references (WeakRef/FinalizationRegistry),\n * escaped-memory handles (SharedArrayBuffer), deprecated helpers, or reflection\n * surfaces with no legitimate expression use. Kept as an explicit exclusion\n * list on top of the allowlist below so a future V8 global cannot slip in.\n */\nconst NON_SANDBOX_GLOBALS = new Set([\"WeakRef\", \"FinalizationRegistry\", \"Iterator\", \"SharedArrayBuffer\", \"escape\", \"unescape\"]);\nconst TYPED_ARRAY_CONSTRUCTORS = new Set(\n\t[\n\t\tInt8Array,\n\t\tUint8Array,\n\t\tUint8ClampedArray,\n\t\tInt16Array,\n\t\tUint16Array,\n\t\tInt32Array,\n\t\tUint32Array,\n\t\ttypeof Float16Array === \"function\" ? Float16Array : null,\n\t\tFloat32Array,\n\t\tFloat64Array,\n\t\ttypeof BigInt64Array === \"function\" ? BigInt64Array : null,\n\t\ttypeof BigUint64Array === \"function\" ? BigUint64Array : null,\n\t].filter((constructor) => typeof constructor === \"function\")\n);\n\n/**\n * Returns whether `value` is a typed-array constructor. The explicit set is\n * the fast path; the `BYTES_PER_ELEMENT` probe also catches typed-array\n * constructors added to the host *after* this module was loaded, so a new\n * global (e.g. a future Float16Array) cannot silently escape the size bounds\n * enforced by {@link Evaluator#assertBoundedConstruction}.\n */\nfunction isTypedArrayConstructor(value) {\n\treturn TYPED_ARRAY_CONSTRUCTORS.has(value) || (typeof value === \"function\" && typeof value.BYTES_PER_ELEMENT === \"number\");\n}\n\n/**\n * Prototype mutators shared by every typed array. They are inherited from\n * `%TypedArray%.prototype`, so a `hasOwnProperty` walk over each typed-array\n * prototype never finds them - the explicit string paths in `block.js` are\n * therefore resolved here against the actual prototype functions.\n */\nconst TYPED_ARRAY_MUTATORS = (() => {\n\tconst map = new Map();\n\tfor (const constructor of TYPED_ARRAY_CONSTRUCTORS) {\n\t\tfor (const name of [\"set\", \"fill\", \"reverse\", \"sort\", \"copyWithin\"]) {\n\t\t\tconst method = constructor.prototype[name];\n\t\t\tif (typeof method === \"function\" && !map.has(method)) {\n\t\t\t\tmap.set(method, name);\n\t\t\t}\n\t\t}\n\t}\n\treturn map;\n})();\n/**\n * Sentinel used to distinguish \"caller passed no pre-evaluated object\" from\n * \"the object expression itself evaluated to undefined\". See\n * {@link Evaluator#handleMemberExpression}.\n */\n/**\n * The `RegExp.prototype` methods that execute the receiver's own pattern when\n * reached through a `Symbol.*` key (`re[Symbol.match](s)` and friends). They are\n * distinct function objects from `test`/`exec`, so the invocation screen must\n * name them explicitly.\n */\nconst REGEXP_SYMBOL_METHODS = new Set(\n\t[Symbol.match, Symbol.matchAll, Symbol.replace, Symbol.search, Symbol.split]\n\t\t.map((symbol) => RegExp.prototype[symbol])\n\t\t.filter((method) => typeof method === \"function\"),\n);\n\n/**\n * Maps the native methods whose invocation can execute an unscreened pattern to\n * how the pattern is reached, so {@link assertSafeRegExpInvocation} can bail out\n * with a single lookup for every other call.\n */\nconst REGEXP_INVOCATION_KIND = (() => {\n\tconst map = new Map();\n\tfor (const method of [String.prototype.match, String.prototype.matchAll, String.prototype.search]) {\n\t\tmap.set(method, \"stringPattern\");\n\t}\n\tfor (const method of [RegExp.prototype.test, RegExp.prototype.exec, ...REGEXP_SYMBOL_METHODS]) {\n\t\tmap.set(method, \"receiverPattern\");\n\t}\n\tfor (const method of [String.prototype.replace, String.prototype.replaceAll, String.prototype.split]) {\n\t\tmap.set(method, \"regexArgument\");\n\t}\n\treturn map;\n})();\n\nconst NO_OBJECT = Symbol(\"no-object\");\n\n/**\n * Renders an error message by replacing placeholders with context values.\n * @param {string} template\n * @param {Record<string, any>} context\n * @example\n * ```js\n * const msg = renderErrorMessage(\"Cannot call mutable prototype method: {method}\", { method: \"push\" });\n * ```\n */\nconst renderErrorMessage = (template, context = {}) => template.replace(/{(\\w+)}/g, (_, key) => String(context[key]));\n\n/**\n * Bounded memo of patterns already proven safe. A regex literal is screened on\n * every evaluation of its node and the analysis costs ~150-400ns, a measurable\n * share of a short regex expression. Only safe patterns are cached; an unsafe\n * one throws on first sight, so it never reaches the cache. Eviction is FIFO,\n * mirroring {@link PARSE_CACHE}.\n */\nconst SAFE_REGEXP_PATTERNS = new Set();\nconst MAX_SAFE_REGEXP_PATTERNS = 1000;\n\n/**\n * Rejects a pattern that is structurally prone to catastrophic backtracking.\n * There is no execution-time limit on a native RegExp, so this screen is the\n * only thing standing between an untrusted pattern and an event-loop hang.\n * @param {string} pattern\n */\nfunction assertSafeRegExpPattern(pattern) {\n\tif (typeof pattern !== \"string\" || SAFE_REGEXP_PATTERNS.has(pattern)) {\n\t\treturn;\n\t}\n\tif (isUnsafeRegExpPattern(pattern)) {\n\t\tthrow new RangeError(\"RegExp pattern may cause catastrophic backtracking and is not allowed\");\n\t}\n\tif (SAFE_REGEXP_PATTERNS.size >= MAX_SAFE_REGEXP_PATTERNS) {\n\t\tSAFE_REGEXP_PATTERNS.delete(SAFE_REGEXP_PATTERNS.values().next().value);\n\t}\n\tSAFE_REGEXP_PATTERNS.add(pattern);\n}\n\n/**\n * Screens a regex that reaches a native method by a path the construction-time\n * screen does not cover:\n *\n * - a `RegExp` supplied by the host in the evaluation context (it is cloned in\n * verbatim and never passed through {@link assertSafeRegExpPattern});\n * - a string argument to `String.prototype.match`/`matchAll`/`search`, which\n * the host compiles with `new RegExp(...)` internally, so a pattern like\n * `\"(a+)+b\"` is never seen by the literal / `RegExp()` screen.\n *\n * `replace`/`replaceAll`/`split` treat a *string* argument as a literal, so only\n * a `RegExp` argument can execute as a pattern there.\n * @param {Function} func - The resolved callee.\n * @param {*} target - The call receiver.\n * @param {Array<*>} args - The evaluated arguments.\n */\nfunction assertSafeRegExpInvocation(func, target, args) {\n\t// One Set lookup keeps this off the hot path for ordinary calls.\n\tconst kind = REGEXP_INVOCATION_KIND.get(func);\n\tif (kind === undefined) {\n\t\treturn;\n\t}\n\tif (kind === \"stringPattern\") {\n\t\t// match/matchAll/search compile a *string* argument into a RegExp\n\t\t// internally, so the pattern never passes the construction-time screen.\n\t\tconst pattern = args[0];\n\t\tif (typeof pattern === \"string\") {\n\t\t\tassertSafeRegExpPattern(pattern);\n\t\t} else if (pattern instanceof RegExp) {\n\t\t\tassertSafeRegExpPattern(pattern.source);\n\t\t}\n\t\treturn;\n\t}\n\t// \"receiverPattern\": test/exec and the `RegExp.prototype[Symbol.*]` methods all\n\t// run the receiver's own pattern, which may be a context-supplied RegExp.\n\t// \"regexArgument\": replace/replaceAll/split run a RegExp *argument*; a string\n\t// argument there is a literal, so it cannot execute as a pattern.\n\tconst regexp = kind === \"receiverPattern\" ? target : args[0];\n\tif (regexp instanceof RegExp) {\n\t\tassertSafeRegExpPattern(regexp.source);\n\t}\n}\n\nfunction validateLimit(value, name, defaultValue, maximum) {\n\tif (value === undefined) {\n\t\treturn defaultValue;\n\t}\n\tif (!Number.isSafeInteger(value) || value < 1 || value > maximum) {\n\t\tthrow new RangeError(`${name} must be an integer between 1 and ${maximum}`);\n\t}\n\treturn value;\n}\n\nfunction countLiteralMatches(value, search, all) {\n\tif (search === \"\") {\n\t\treturn all ? value.length + 1 : 1;\n\t}\n\tlet count = 0;\n\tlet position = 0;\n\twhile ((position = value.indexOf(search, position)) !== -1) {\n\t\tcount++;\n\t\tif (!all) {\n\t\t\tbreak;\n\t\t}\n\t\tposition += search.length;\n\t}\n\treturn count;\n}\n\n/**\n * Counts the matches a `replace`/`replaceAll` call would make, so the output\n * size can be bounded *before* the native engine builds the whole result. The\n * pattern has already passed {@link assertSafeRegExpPattern}, so the per-match\n * work is bounded; the only hazard here is a zero-width match, where `exec`\n * leaves `lastIndex` unchanged and the loop would never terminate. Advancing\n * `lastIndex` manually mirrors `String.prototype.replace`'s own empty-match\n * handling. The count is capped so a pathological target cannot spin the loop.\n */\nfunction countRegExpMatches(value, regexp, all) {\n\tconst flags = regexp.flags.includes(\"g\") ? regexp.flags : regexp.flags + \"g\";\n\tconst re = new RegExp(regexp.source, flags);\n\tlet count = 0;\n\tlet match;\n\twhile ((match = re.exec(value)) !== null) {\n\t\tcount++;\n\t\tif (!all || count > MAX_STRING_LENGTH) {\n\t\t\tbreak;\n\t\t}\n\t\tif (re.lastIndex === match.index) {\n\t\t\tre.lastIndex++;\n\t\t}\n\t}\n\treturn count;\n}\n\n/**\n * Bounded, module-level cache of parsed ASTs. Expressions are frequently\n * evaluated many times (templates, repeated rules), and acorn parsing dominates\n * the runtime of a short expression - re-parsing on every call is the single\n * biggest cost in the hot path. The AST is treated as immutable after parsing\n * (no handler mutates a node), so a cached tree can be shared safely across\n * evaluations and instances.\n *\n * The cache is bounded by both entry count and total source length so a stream\n * of distinct large inputs cannot grow it without limit. Eviction is FIFO\n * (oldest-inserted first): a hit must not touch the Map, because a read-modify\n * \"refresh\" on every hit costs ~60ns versus ~8ns for a plain `get`.\n */\nconst PARSE_CACHE = new Map();\nconst MAX_PARSE_CACHE_ENTRIES = 1000;\nconst MAX_PARSE_CACHE_CHARS = 200000;\nlet parseCacheChars = 0;\n\nfunction parseExpression(expression) {\n\tconst cached = PARSE_CACHE.get(expression);\n\tif (cached !== undefined) {\n\t\treturn cached;\n\t}\n\n\tlet ast;\n\ttry {\n\t\tast = acorn.parse(expression, { ecmaVersion: \"latest\" });\n\t} catch (error) {\n\t\t// acorn parses recursively; a deeply nested expression can exhaust the\n\t\t// host call stack before evaluation ever starts. Surface it as a\n\t\t// normal SyntaxError instead of leaking a stack-overflow RangeError.\n\t\tif (error instanceof RangeError && /call stack/i.test(error.message)) {\n\t\t\tthrow new SyntaxError(\"Expression nesting is too deep to parse\");\n\t\t}\n\t\tthrow error;\n\t}\n\n\tif (expression.length <= MAX_PARSE_CACHE_CHARS) {\n\t\twhile (PARSE_CACHE.size >= MAX_PARSE_CACHE_ENTRIES || parseCacheChars + expression.length > MAX_PARSE_CACHE_CHARS) {\n\t\t\tconst oldestKey = PARSE_CACHE.keys().next().value;\n\t\t\tif (oldestKey === undefined) break;\n\t\t\tparseCacheChars -= oldestKey.length;\n\t\t\tPARSE_CACHE.delete(oldestKey);\n\t\t}\n\t\tPARSE_CACHE.set(expression, ast);\n\t\tparseCacheChars += expression.length;\n\t}\n\n\treturn ast;\n}\n\nfunction assertBoundedData(value, label) {\n\t// Fast path: a primitive has no properties, cycles, or references to walk,\n\t// so the traversal (and its `pending` array + `WeakSet` allocations) is pure\n\t// overhead. This is the common case for arrow-function return values such as\n\t// `arr.map(v => v * 2)`, where the callback returns a primitive per element.\n\t// The accounting mirrors the slow path exactly (a string costs length + 8 and\n\t// is length-bounded; every other primitive costs 8), so the budget behaves\n\t// identically whether or not the fast path is taken.\n\tconst valueType = typeof value;\n\tif (valueType === \"string\") {\n\t\tif (value.length > MAX_STRING_LENGTH) {\n\t\t\tthrow new RangeError(`${label} contains a string that exceeds the maximum length`);\n\t\t}\n\t\treturn { dataSize: value.length + 8, dataNodes: 1 };\n\t}\n\tif (value === null || valueType === \"undefined\" || valueType === \"number\" || valueType === \"boolean\" || valueType === \"bigint\") {\n\t\treturn { dataSize: 8, dataNodes: 1 };\n\t}\n\n\tconst pending = [value];\n\tconst seen = new WeakSet();\n\tlet dataSize = 0;\n\tlet dataNodes = 0;\n\tconst enqueueProperties = (object) => {\n\t\tconst keys = Object.keys(object);\n\t\tif (pending.length + keys.length > MAX_DATA_NODES) {\n\t\t\tthrow new RangeError(`${label} exceeds the maximum data node count`);\n\t\t}\n\t\tfor (const key of keys) {\n\t\t\tdataSize += key.length;\n\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(object, key);\n\t\t\tif (!descriptor || !Object.hasOwn(descriptor, \"value\")) {\n\t\t\t\tthrow new TypeError(`${label} cannot contain accessor properties`);\n\t\t\t}\n\t\t\tpending.push(descriptor.value);\n\t\t}\n\t};\n\n\twhile (pending.length > 0) {\n\t\tconst current = pending.pop();\n\t\tdataNodes++;\n\t\tif (dataNodes > MAX_DATA_NODES) {\n\t\t\tthrow new RangeError(`${label} exceeds the maximum data node count`);\n\t\t}\n\n\t\tif (typeof current === \"string\") {\n\t\t\tif (current.length > MAX_STRING_LENGTH) {\n\t\t\t\tthrow new RangeError(`${label} contains a string that exceeds the maximum length`);\n\t\t\t}\n\t\t\tdataSize += current.length + 8;\n\t\t} else if (current === null || (typeof current !== \"object\" && typeof current !== \"function\")) {\n\t\t\tdataSize += 8;\n\t\t\tcontinue;\n\t\t} else if (typeof current === \"function\" || seen.has(current)) {\n\t\t\tcontinue;\n\t\t} else {\n\t\t\tseen.add(current);\n\t\t\tdataSize += 16;\n\t\t\tif (current instanceof ArrayBuffer || ArrayBuffer.isView(current)) {\n\t\t\t\tdataSize += current.byteLength;\n\t\t\t} else if (Array.isArray(current)) {\n\t\t\t\tif (current.length > MAX_ARRAY_LENGTH) {\n\t\t\t\t\tthrow new RangeError(`${label} contains an array that exceeds the maximum length`);\n\t\t\t\t}\n\t\t\t\tdataSize += current.length * 8;\n\t\t\t\tenqueueProperties(current);\n\t\t\t} else if (current instanceof Map) {\n\t\t\t\tif (current.size > MAX_ARRAY_LENGTH) {\n\t\t\t\t\tthrow new RangeError(`${label} contains a map that exceeds the maximum size`);\n\t\t\t\t}\n\t\t\t\tdataSize += current.size * 16;\n\t\t\t\tMap.prototype.forEach.call(current, (item, key) => pending.push(key, item));\n\t\t\t} else if (current instanceof Set) {\n\t\t\t\tif (current.size > MAX_ARRAY_LENGTH) {\n\t\t\t\t\tthrow new RangeError(`${label} contains a set that exceeds the maximum size`);\n\t\t\t\t}\n\t\t\t\tdataSize += current.size * 8;\n\t\t\t\tSet.prototype.forEach.call(current, (item) => pending.push(item));\n\t\t\t} else {\n\t\t\t\tenqueueProperties(current);\n\t\t\t}\n\t\t}\n\n\t\tif (dataSize > MAX_BUFFER_BYTES) {\n\t\t\tthrow new RangeError(`${label} exceeds the maximum data size`);\n\t\t}\n\t}\n\treturn { dataSize, dataNodes };\n}\n\nconst BINARY_OPERATION_MAP = new Map([\n\t[\"+\", (a, b) => a + b],\n\t[\"-\", (a, b) => a - b],\n\t[\"*\", (a, b) => a * b],\n\t[\"**\", (a, b) => a ** b],\n\t[\"==\", (a, b) => a == b],\n\t[\"===\", (a, b) => a === b],\n\t[\"!=\", (a, b) => a != b],\n\t[\"!==\", (a, b) => a !== b],\n\t[\">\", (a, b) => a > b],\n\t[\">=\", (a, b) => a >= b],\n\t[\"<\", (a, b) => a < b],\n\t[\"<=\", (a, b) => a <= b],\n\t[\"%\", (a, b) => a % b],\n\t[\"/\", (a, b) => a / b],\n\t[\"|\", (a, b) => a | b],\n\t[\"&\", (a, b) => a & b],\n\t[\"^\", (a, b) => a ^ b],\n\t[\"<<\", (a, b) => a << b],\n\t[\">>\", (a, b) => a >> b],\n\t[\">>>\", (a, b) => a >>> b],\n\t[\"in\", (a, b) => a in b],\n\t[\"instanceof\", (a, b) => a instanceof b],\n]);\n\nfunction createGlobalScope() {\n\tconst scope = Object.create(null);\n\tconst { builtin } = globals;\n\n\t// Allowlist: expose a builtin only when the host actually provides it and\n\t// it is not explicitly denied. A missing global (e.g. BigInt64Array on an\n\t// old runtime, or Float16Array before it shipped) is simply skipped instead\n\t// of being defined as `undefined`, so `typeof Missing === \"undefined\"` and\n\t// identifier resolution behave as the platform does.\n\tfor (const key in builtin) {\n\t\tif (blockedGlobalBuiltIns.includes(key)) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (NON_SANDBOX_GLOBALS.has(key)) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (!Object.hasOwn(globalThis, key)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t/** @type {boolean} */\n\t\tconst isWritable = builtin[key];\n\n\t\tObject.defineProperty(scope, key, {\n\t\t\tvalue: globalThis[key],\n\t\t\twritable: isWritable,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: false,\n\t\t});\n\t}\n\n\tObject.defineProperty(scope, \"globalThis\", {\n\t\tvalue: scope,\n\t\twritable: false,\n\t\tenumerable: false,\n\t\tconfigurable: false,\n\t});\n\n\treturn scope;\n}\n\n// The sandbox global scope is identical for every instance, so build it once.\n// Rebuilding it per `new Evaluator()` cost a full `defineProperty` pass over\n// every builtin (measurably ~5x slower for short-lived instances). Construction\n// is deferred to first use and memoised so that importing the module has no\n// side effect at all - `sideEffects: false` in package.json then holds exactly,\n// and a bundler may drop the whole module when nothing from it is used.\nlet GLOBAL_SCOPE = null;\n\nfunction getGlobalScope() {\n\tif (GLOBAL_SCOPE === null) {\n\t\tGLOBAL_SCOPE = createGlobalScope();\n\t}\n\treturn GLOBAL_SCOPE;\n}\n\n/**\n * Shared default evaluation context. It is frozen and has a null prototype, and\n * the evaluator never writes to a context scope (arrow-function parameter scopes\n * are separate objects), so every instance can safely share this single object.\n * Without it, the default `variables = Object.create(null)` parameter would make\n * each construction `structuredClone` a fresh empty object - the dominant cost of\n * the one-shot `evalExpression` / `Evaluator.evaluate` path.\n */\nconst EMPTY_CONTEXT = Object.freeze(Object.create(null));\n\nconst getBlockedMethods = (() => {\n\t/**\n\t * @type {Map<Function, string>}\n\t */\n\tlet BLOCKED_METHODS = null;\n\n\treturn () => {\n\t\tif (BLOCKED_METHODS) return BLOCKED_METHODS;\n\n\t\tconst map = new Map();\n\t\tfor (const path of blockedMethods) {\n\t\t\tconst [object, ...properties] = path.split(\".\");\n\t\t\tlet current = globalThis[object];\n\t\t\tfor (const prop of properties) {\n\t\t\t\tif (current && Object.hasOwn(current, prop)) {\n\t\t\t\t\tcurrent = current[prop];\n\t\t\t\t} else {\n\t\t\t\t\tcurrent = null;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (typeof current === \"function\") map.set(current, path);\n\t\t}\n\t\tBLOCKED_METHODS = map;\n\n\t\treturn BLOCKED_METHODS;\n\t};\n})();\n\n/**\n * A JavaScript expression evaluator that safely evaluates expressions within a sandboxed environment.\n * Supports various JavaScript features including arithmetic, logical operations, functions, and more.\n *\n * Security features:\n * - Blocks mutable methods to prevent side effects\n * - No access to eval() or Function() constructor\n * - Sandboxed scope with limited global objects\n *\n * @example\n * const evaluator = new Evaluator({ x: 10, y: 20 });\n * evaluator.evaluate('x + y') // returns 30\n */\nexport class Evaluator {\n\t/**\n\t * Creates a new Evaluator instance with a custom variable context.\n\t * The scope hierarchy is: user variables -> global scope\n\t * @param {Object} [variables={}] - An optional object containing variables to make available in the evaluation context\n\t * @param {Object} [options={}] - Additional configuration options\n\t * @param {number} [options.maxInputLength=10000] - Maximum expression length (hard maximum: 100000)\n\t * @param {number} [options.maxEvaluationSteps=10000] - Maximum AST node visits per evaluation (hard maximum: 100000)\n\t * @param {number} [options.maxDepth=1000] - Maximum interpreter recursion depth (hard maximum: 2000)\n\t */\n\tconstructor(variables = EMPTY_CONTEXT, options) {\n\t\tthis.maxInputLength = validateLimit(options?.maxInputLength, \"maxInputLength\", DEFAULT_MAX_INPUT_LENGTH, MAX_CONFIGURABLE_INPUT_LENGTH);\n\t\tthis.maxEvaluationSteps = validateLimit(options?.maxEvaluationSteps, \"maxEvaluationSteps\", DEFAULT_MAX_EVALUATION_STEPS, MAX_CONFIGURABLE_EVALUATION_STEPS);\n\t\tthis.maxDepth = validateLimit(options?.maxDepth, \"maxDepth\", DEFAULT_MAX_DEPTH, MAX_CONFIGURABLE_DEPTH);\n\t\t// The shared default context is known to be empty and immutable, so it needs\n\t\t// neither the bounded-data walk nor a clone. Caller-supplied contexts are\n\t\t// validated and cloned so the sandbox never holds a live reference to host state.\n\t\tlet clonedVariables = EMPTY_CONTEXT;\n\t\tif (variables !== EMPTY_CONTEXT) {\n\t\t\tassertBoundedData(variables, \"Evaluation context\");\n\t\t\tclonedVariables = structuredClone(variables);\n\t\t}\n\t\tthis.scopes = [clonedVariables, getGlobalScope()].filter((scope) => scope !== null && scope !== undefined);\n\t\tthis.source = undefined;\n\t\tthis.evaluating = false;\n\t\tthis.remainingEvaluationSteps = 0;\n\t\tthis.remainingDataSize = MAX_BUFFER_BYTES;\n\t\tthis.remainingDataNodes = MAX_DATA_NODES;\n\t\tthis.evaluationDepth = 0;\n\t}\n\n\t/**\n\t * Resets the per-evaluation resource budgets. Called at the start of every\n\t * `evaluate()` and, for a direct `execute()` call, at its entry. Centralised\n\t * so a thrown limit never leaves a stale counter behind.\n\t * @private\n\t */\n\tresetBudget() {\n\t\tthis.remainingEvaluationSteps = this.maxEvaluationSteps;\n\t\tthis.remainingDataSize = MAX_BUFFER_BYTES;\n\t\tthis.remainingDataNodes = MAX_DATA_NODES;\n\t\tthis.evaluationDepth = 0;\n\t}\n\n\t/**\n\t * Evaluates a JavaScript expression with an optional context.\n\t * @param {string} expression\n\t * @param {unknown} [context]\n\t * @returns\n\t */\n\tstatic evaluate(expression, context) {\n\t\tconst evaluator = new Evaluator(context);\n\t\treturn evaluator.evaluate(expression);\n\t}\n\n\t/**\n\t * Parses and evaluates a JavaScript expression using acorn parser.\n\t * @param {string} expression - The JavaScript expression to evaluate\n\t * @returns {*} The result of the evaluation\n\t * @throws {SyntaxError} If the expression has invalid syntax\n\t * @throws {ReferenceError} If referencing undefined variables\n\t * @throws {TypeError} If performing invalid operations\n\t */\n\tevaluate(expression) {\n\t\tif (typeof expression !== \"string\") {\n\t\t\tthrow new TypeError(\"Expression must be a string\");\n\t\t}\n\n\t\tif (expression.length > this.maxInputLength) {\n\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.EXPRESSION_TOO_LONG, [this.maxInputLength]));\n\t\t}\n\n\t\tthis.source = expression;\n\t\tthis.resetBudget();\n\n\t\tconst ast = parseExpression(expression);\n\n\t\t// Start recursive evaluation from the root node\n\t\tthis.evaluating = true;\n\t\ttry {\n\t\t\treturn this.execute(ast.body);\n\t\t} finally {\n\t\t\tthis.evaluating = false;\n\t\t\tthis.source = undefined;\n\t\t}\n\t}\n\n\t/**\n\t * Executes an array of AST body nodes sequentially.\n\t * @private\n\t * @param {Array} body - Array of AST nodes to execute\n\t * @returns {*} The result of the last executed node\n\t */\n\texecute(body) {\n\t\t// `evaluate()` resets the budget before calling in. A direct call to this\n\t\t// method (a documented escape hatch used by tests) has no such reset, so\n\t\t// initialise on entry. Keying on `evaluating` rather than on a counter value\n\t\t// avoids the previous bug where a thrown step limit left\n\t\t// `remainingEvaluationSteps` at -1 and defeated the `=== 0` guard.\n\t\tif (!this.evaluating) {\n\t\t\tthis.resetBudget();\n\t\t}\n\t\tlet result;\n\n\t\tfor (const node of body) {\n\t\t\tresult = this.visit(node);\n\t\t}\n\n\t\tif (typeof result === \"function\") {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Returning functions from expressions\"]));\n\t\t}\n\n\t\tassertBoundedData(result, \"Evaluation result\");\n\n\t\t// A leaked Promise schedules sandbox callbacks (and rejection errors)\n\t\t// in the host microtask queue, outside the caller's try/catch. Never\n\t\t// allow one to escape evaluate() as a value.\n\t\tif (result instanceof Promise) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Returning promises from expressions\"]));\n\t\t}\n\n\t\t// Fast path: a primitive needs no clone. structuredClone costs ~300ns\n\t\t// even for a number, which dominates short expressions, while a primitive\n\t\t// is already an immutable value with no sandbox reference to leak.\n\t\t// Symbols are deliberately excluded so they still hit the clone gate\n\t\t// below and raise the non-cloneable error.\n\t\tconst resultType = typeof result;\n\t\tif (result === null || resultType === \"string\" || resultType === \"number\" || resultType === \"boolean\" || resultType === \"undefined\" || resultType === \"bigint\") {\n\t\t\treturn result;\n\t\t}\n\n\t\t// Final gate: the return value must be cloneable, pure data. A\n\t\t// function (or any non-cloneable object) smuggled inside an object or\n\t\t// array - no matter how deeply nested - fails structuredClone with a\n\t\t// DataCloneError. Without this, closures could escape evaluate() (e.g.\n\t\t// `({ f: () => secret })`) and keep reading the evaluator's scopes\n\t\t// (and host-passed objects) long after evaluate() returned. Cloning\n\t\t// also hands the host a copy instead of a reference to sandbox\n\t\t// internals, and it rejects WeakRef/FinalizationRegistry/Proxy and\n\t\t// other host-only objects.\n\t\ttry {\n\t\t\treturn structuredClone(result);\n\t\t} catch (error) {\n\t\t\tif (error && error.name === \"DataCloneError\") {\n\t\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Returning non-cloneable values from expressions\"]));\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Visits an AST node and delegates to the appropriate handler based on node type.\n\t * @private\n\t * @param {import(\"acorn\").Node} node - The AST node to visit\n\t * @returns {*} The result of visiting the node\n\t */\n\tvisit(node) {\n\t\tthis.remainingEvaluationSteps--;\n\t\tif (this.remainingEvaluationSteps < 0) {\n\t\t\tthrow new RangeError(\"Evaluation step limit exceeded\");\n\t\t}\n\n\t\t// Bound interpreter recursion depth so a deeply nested expression\n\t\t// (e.g. `[[[[...]]]]`) cannot exhaust the host call stack. The parser\n\t\t// has its own, lower practical limit, but the visitor is reached from\n\t\t// native callbacks too, so it needs an explicit ceiling.\n\t\tthis.evaluationDepth++;\n\t\tif (this.evaluationDepth > this.maxDepth) {\n\t\t\tthis.evaluationDepth--;\n\t\t\tthrow new RangeError(\"Maximum evaluation depth exceeded\");\n\t\t}\n\t\ttry {\n\t\t\tswitch (node.type) {\n\t\t\t\tcase \"ExpressionStatement\": {\n\t\t\t\t\treturn this.visit(node.expression);\n\t\t\t\t}\n\t\t\t\tcase \"BinaryExpression\": {\n\t\t\t\t\treturn this.handleBinaryExpression(node);\n\t\t\t\t}\n\t\t\t\tcase \"LogicalExpression\": {\n\t\t\t\t\treturn this.handleLogicalExpression(node);\n\t\t\t\t}\n\t\t\t\tcase \"UnaryExpression\": {\n\t\t\t\t\treturn this.handleUnaryExpression(node);\n\t\t\t\t}\n\t\t\t\tcase \"Identifier\": {\n\t\t\t\t\treturn this.handleIdentifier(node);\n\t\t\t\t}\n\t\t\t\tcase \"Literal\": {\n\t\t\t\t\t// A regex literal is parsed by acorn into `node.regex`, but\n\t\t\t\t\t// `node.value` is a live RegExp that the sandbox would otherwise\n\t\t\t\t\t// hand back. Screen the pattern before it can be used.\n\t\t\t\t\tif (node.regex) {\n\t\t\t\t\t\tassertSafeRegExpPattern(node.regex.pattern);\n\t\t\t\t\t}\n\t\t\t\t\treturn node.value;\n\t\t\t\t}\n\t\t\t\tcase \"MemberExpression\": {\n\t\t\t\t\treturn this.handleMemberExpression(node);\n\t\t\t\t}\n\t\t\t\tcase \"ArrayExpression\": {\n\t\t\t\t\treturn this.handleArrayExpression(node);\n\t\t\t\t}\n\t\t\t\tcase \"SpreadElement\": {\n\t\t\t\t\treturn this.handleSpreadElement(node);\n\t\t\t\t}\n\t\t\t\tcase \"ObjectExpression\": {\n\t\t\t\t\treturn this.handleObjectExpression(node);\n\t\t\t\t}\n\t\t\t\tcase \"FunctionExpression\": {\n\t\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Function expression\"]));\n\t\t\t\t}\n\t\t\t\tcase \"ArrowFunctionExpression\": {\n\t\t\t\t\treturn this.handleArrowFunctionExpression(node);\n\t\t\t\t}\n\t\t\t\tcase \"CallExpression\": {\n\t\t\t\t\treturn this.handleCallExpression(node);\n\t\t\t\t}\n\t\t\t\tcase \"ConditionalExpression\": {\n\t\t\t\t\treturn this.visit(node.test) ? this.visit(node.consequent) : this.visit(node.alternate);\n\t\t\t\t}\n\t\t\t\tcase \"NewExpression\": {\n\t\t\t\t\tif (node.callee.type !== \"Identifier\") {\n\t\t\t\t\t\tthrow new Error(`Unsupported callee type '${node.callee.type}' in new expression`);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (node.callee.name === \"Function\") {\n\t\t\t\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"new Function() constructor\"]));\n\t\t\t\t\t}\n\n\t\t\t\t\t// Promise is fully removed from the sandbox; give a clear error\n\t\t\t\t\t// instead of a generic \"not defined\". Its executor runs\n\t\t\t\t\t// synchronously, but a throwing executor would turn into a\n\t\t\t\t\t// rejected Promise that escapes evaluate() and crashes the host.\n\t\t\t\t\tif (node.callee.name === \"Promise\") {\n\t\t\t\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Promise constructor\"]));\n\t\t\t\t\t}\n\t\t\t\t\tconst Constructor = this.visit(node.callee);\n\n\t\t\t\t\t// 仅在存在参数时构建数组\n\t\t\t\t\tconst args = node.arguments.length ? node.arguments.map((arg) => this.visit(arg)) : [];\n\t\t\t\t\tthis.assertBoundedConstruction(Constructor, args);\n\n\t\t\t\t\treturn new Constructor(...args);\n\t\t\t\t}\n\t\t\t\tcase \"ChainExpression\": {\n\t\t\t\t\treturn this.visit(node.expression);\n\t\t\t\t}\n\t\t\t\tcase \"TemplateLiteral\": {\n\t\t\t\t\treturn this.handleTemplateLiteral(node);\n\t\t\t\t}\n\t\t\t\tcase \"ThisExpression\": {\n\t\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"'this' expression\"]));\n\t\t\t\t}\n\t\t\t\tcase \"WithStatement\": {\n\t\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"'with' statement\"]));\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tlet content = this.source.slice(node.start, node.end);\n\n\t\t\t\t\tif (content.length > 20) {\n\t\t\t\t\t\tcontent = content.slice(0, 17) + \"...\";\n\t\t\t\t\t}\n\n\t\t\t\t\tthrow new SyntaxError(`'${content}'` + \" \" + renderErrorMessage(ERROR_MESSAGES.IS_INVALID_SYNTAX, [content]));\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tthis.evaluationDepth--;\n\t\t}\n\t}\n\n\t/**\n\t * Handles binary expressions (arithmetic and comparison operations).\n\t * @param {import('acorn').BinaryExpression} node\n\t * @private\n\t */\n\thandleBinaryExpression(node) {\n\t\tconst op = node.operator;\n\t\tconst left = this.visit(node.left);\n\t\tconst right = this.visit(node.right);\n\t\tif (op === \"+\" && (typeof left === \"string\" || typeof right === \"string\")) {\n\t\t\tif (String(left).length + String(right).length > MAX_STRING_LENGTH) {\n\t\t\t\tthrow new RangeError(\"String result exceeds the maximum allowed length\");\n\t\t\t}\n\t\t}\n\t\tif (typeof left === \"bigint\" && typeof right === \"bigint\") {\n\t\t\tif (op === \"**\" && (right > MAX_BIGINT_EXPONENT || right < 0n)) {\n\t\t\t\tthrow new RangeError(`BigInt exponent must be between 0 and ${MAX_BIGINT_EXPONENT}`);\n\t\t\t}\n\t\t\tconst leftBits = left.toString(2).length;\n\t\t\tconst rightBits = right.toString(2).length;\n\t\t\tif (\n\t\t\t\t(op === \"**\" && leftBits * Number(right) > MAX_BIGINT_BITS) ||\n\t\t\t\t(op === \"<<\" && right > BigInt(MAX_BIGINT_BITS)) ||\n\t\t\t\t(op === \"<<\" && right >= 0n && leftBits + Number(right) > MAX_BIGINT_BITS) ||\n\t\t\t\t(op === \"*\" && leftBits + rightBits > MAX_BIGINT_BITS) ||\n\t\t\t\t((op === \"+\" || op === \"-\") && Math.max(leftBits, rightBits) + 1 > MAX_BIGINT_BITS)\n\t\t\t) {\n\t\t\t\tthrow new RangeError(\"BigInt result exceeds the maximum allowed size\");\n\t\t\t}\n\t\t}\n\n\t\tconst apply = BINARY_OPERATION_MAP.get(op);\n\t\tif (apply !== undefined) {\n\t\t\treturn apply(left, right);\n\t\t}\n\n\t\tthrow new SyntaxError(`Unsupported operator: ${node.operator}`);\n\t}\n\n\t/**\n\t * Bounds a regular-expression pattern. There is no execution-time limit on\n\t * a native RegExp, so an oversized source/flags string is rejected up front\n\t * and a pattern with catastrophic-backtracking structure is refused, rather\n\t * than allowed to build a pathological matcher.\n\t * @private\n\t */\n\tassertBoundedRegExp(args) {\n\t\tif (typeof args[0] === \"string\" && args[0].length > MAX_REGEXP_SOURCE_LENGTH) {\n\t\t\tthrow new RangeError(\"RegExp source exceeds the maximum allowed length\");\n\t\t}\n\t\tif (typeof args[1] === \"string\" && args[1].length > MAX_REGEXP_FLAGS_LENGTH) {\n\t\t\tthrow new RangeError(\"RegExp flags exceed the maximum allowed length\");\n\t\t}\n\t\tassertSafeRegExpPattern(args[0]);\n\t}\n\n\tassertBoundedConstruction(Constructor, args) {\n\t\tif (Constructor === RegExp) {\n\t\t\tthis.assertBoundedRegExp(args);\n\t\t}\n\t\tconst size = args[0];\n\t\tif (Constructor === Array && args.length === 1 && typeof size === \"number\" && size > MAX_ARRAY_LENGTH) {\n\t\t\tthrow new RangeError(\"Array length exceeds the maximum allowed length\");\n\t\t}\n\t\tif (Constructor === ArrayBuffer && (size > MAX_BUFFER_BYTES || args[1]?.maxByteLength > MAX_BUFFER_BYTES)) {\n\t\t\tthrow new RangeError(\"ArrayBuffer size exceeds the maximum allowed size\");\n\t\t}\n\t\tif (Constructor === DataView && size instanceof ArrayBuffer && size.byteLength > MAX_BUFFER_BYTES) {\n\t\t\tthrow new RangeError(\"DataView size exceeds the maximum allowed size\");\n\t\t}\n\t\tif (Constructor === Map || Constructor === Set) {\n\t\t\tconst collectionSize = typeof size === \"string\" || Array.isArray(size) ? size.length : size?.size ?? size?.length;\n\t\t\tif (typeof collectionSize === \"number\" && collectionSize > MAX_ARRAY_LENGTH) {\n\t\t\t\tthrow new RangeError(\"Collection source exceeds the maximum allowed size\");\n\t\t\t}\n\t\t}\n\t\tif (isTypedArrayConstructor(Constructor)) {\n\t\t\tlet byteLength;\n\t\t\tif (size instanceof ArrayBuffer) {\n\t\t\t\tconst offset = args[1] ?? 0;\n\t\t\t\tconst elementCount = args[2] ?? Math.floor((size.byteLength - offset) / Constructor.BYTES_PER_ELEMENT);\n\t\t\t\tbyteLength = elementCount * Constructor.BYTES_PER_ELEMENT;\n\t\t\t} else {\n\t\t\t\tconst elementCount = typeof size === \"number\" ? size : size?.length ?? 0;\n\t\t\t\tbyteLength = elementCount * Constructor.BYTES_PER_ELEMENT;\n\t\t\t}\n\t\t\tif (byteLength > MAX_BUFFER_BYTES) {\n\t\t\t\tthrow new RangeError(\"Typed array size exceeds the maximum allowed size\");\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Handles logical expressions (&&, ||, ??).\n\t * Implements proper short-circuit evaluation for performance.\n\t * @private\n\t */\n\thandleLogicalExpression(node) {\n\t\tswitch (node.operator) {\n\t\t\tcase \"&&\": {\n\t\t\t\tconst left = this.visit(node.left);\n\t\t\t\treturn left ? this.visit(node.right) : left;\n\t\t\t}\n\t\t\tcase \"||\": {\n\t\t\t\tconst left = this.visit(node.left);\n\t\t\t\treturn left ? left : this.visit(node.right);\n\t\t\t}\n\t\t\tcase \"??\": {\n\t\t\t\tconst left = this.visit(node.left);\n\t\t\t\treturn left !== null && left !== undefined ? left : this.visit(node.right);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new SyntaxError(`Unsupported logical operator: ${node.operator}`);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Handles unary expressions (-, +, !, ~, typeof, void).\n\t * @private\n\t */\n\thandleUnaryExpression(node) {\n\t\tswitch (node.operator) {\n\t\t\tcase \"-\": {\n\t\t\t\treturn -this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"+\": {\n\t\t\t\treturn +this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"!\": {\n\t\t\t\treturn !this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"~\": {\n\t\t\t\treturn ~this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"typeof\": {\n\t\t\t\treturn typeof this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"void\": {\n\t\t\t\treturn void this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"delete\": {\n\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Delete operator\"]));\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new SyntaxError(`Unsupported unary operator: ${node.operator}`);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Handles identifier (variable) lookups in the scope chain.\n\t * @private\n\t */\n\thandleIdentifier(node) {\n\t\tconst name = node.name;\n\t\t// Indexed loop: `for...of` allocates an iterator per lookup, and identifier\n\t\t// resolution is the most frequent visitor call.\n\t\tconst scopes = this.scopes;\n\t\tfor (let i = 0; i < scopes.length; i++) {\n\t\t\tconst scope = scopes[i];\n\t\t\tif (Object.hasOwn(scope, name)) {\n\t\t\t\treturn scope[name];\n\t\t\t}\n\t\t}\n\n\t\tthrow new ReferenceError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_DEFINED, [name]));\n\t}\n\n\t/**\n\t * Handles member expressions (property access like obj.prop or obj[prop]).\n\t * @private\n\t */\n\thandleMemberExpression(node, objectValue = NO_OBJECT) {\n\t\tconst object = objectValue === NO_OBJECT ? this.visit(node.object) : objectValue;\n\t\t// Determine property name: either identifier name or computed value\n\t\tconst isStaticProperty = node.property.type === \"Identifier\" && !node.computed;\n\t\tconst property = isStaticProperty ? node.property.name : this.visit(node.property);\n\n\t\t// Reading `.stack` on an Error instance forces V8 to materialize the\n\t\t// stack, which invokes a host-installed Error.prepareStackTrace with\n\t\t// sandbox-owned values. Block it *before* any property access, since\n\t\t// even the prototype check below would trigger the getter.\n\t\tif (property === \"stack\" && object instanceof Error) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Accessing error stack\"]));\n\t\t}\n\n\t\tif (object === null || object === undefined) {\n\t\t\t// optional chaining\n\t\t\tif (node.optional) {\n\t\t\t\treturn void 0;\n\t\t\t}\n\t\t\tthrow new TypeError(renderErrorMessage(ERROR_MESSAGES.CAN_NOT_READ_PROPERTY, [object, property]));\n\t\t}\n\n\t\t// Read the property once: the guards below all consume the same value, and a\n\t\t// getter must not run (or run twice) just to be checked. Doing this after the\n\t\t// null check also avoids touching `__proto__` on a null/undefined receiver.\n\t\tconst result = object[property];\n\n\t\t// The Function constructor must never be reachable from an expression.\n\t\t// If it escapes as a value, native callbacks (e.g. Promise.then,\n\t\t// Array.prototype.map) invoke it outside the interpreter's call path,\n\t\t// enabling arbitrary host code execution. This is a structural guard:\n\t\t// no matter how many `.constructor` hops an expression takes, the\n\t\t// final value can never be `Function` (or its prototype).\n\t\tif (result === Function || result === Function.prototype) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Function constructor\"]));\n\t\t}\n\n\t\t// Prevent access to prototype properties. The comparison must be guarded\n\t\t// against a null/undefined prototype: for a null-prototype object\n\t\t// (`Object.create(null)`) `object[property]` and `object.__proto__` are\n\t\t// both `undefined`, and `undefined === undefined` would otherwise reject\n\t\t// every missing property with a misleading \"prototype\" error.\n\t\tconst prototype = object.__proto__;\n\t\tif (prototype !== undefined && result === prototype) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Accessing prototype properties\"]));\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Handles array literal expressions.\n\t * @private\n\t */\n\thandleArrayExpression(node) {\n\t\tconst result = [];\n\n\t\tfor (let i = 0; i < node.elements.length; i++) {\n\t\t\tconst element = node.elements[i];\n\n\t\t\t// Array holes (`[1, , 3]`) are represented as null elements by\n\t\t\t// acorn. Preserve them instead of crashing on node.type access.\n\t\t\tif (element === null) {\n\t\t\t\tresult.length++;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst value = this.visit(element);\n\n\t\t\tif (element.type === \"SpreadElement\") {\n\t\t\t\tthis.assertBoundedSpread(result.length, value);\n\t\t\t\tresult.push(...value);\n\t\t\t} else {\n\t\t\t\tresult.push(value);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tassertBoundedSpread(currentLength, value) {\n\t\tconst size = typeof value === \"string\" || Array.isArray(value) ? value.length : value?.size;\n\t\tif (typeof size === \"number\" && currentLength + size > MAX_ARRAY_LENGTH) {\n\t\t\tthrow new RangeError(\"Spread value exceeds the maximum allowed length\");\n\t\t}\n\t}\n\n\t/**\n\t * Handles object literal expressions.\n\t * @returns\n\t */\n\thandleObjectExpression(node) {\n\t\tconst obj = {};\n\t\tlet spreadPropertyCount = 0;\n\t\tfor (const prop of node.properties) {\n\t\t\tif (prop.type === \"SpreadElement\") {\n\t\t\t\tconst spreadValue = this.visit(prop.argument);\n\t\t\t\tspreadPropertyCount += Object.keys(spreadValue).length;\n\t\t\t\tif (spreadPropertyCount > MAX_ARRAY_LENGTH) {\n\t\t\t\t\tthrow new RangeError(\"Object spread exceeds the maximum allowed property count\");\n\t\t\t\t}\n\t\t\t\tObject.assign(obj, spreadValue);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// Computed keys must be *evaluated* (`{ [1 + 1]: v }` -> key \"2\"),\n\t\t\t// not taken from the property name. Non-computed keys keep the\n\t\t\t// literal `__proto__: v` semantics (which sets the prototype via\n\t\t\t// the Object.prototype.__proto__ setter), while computed keys are\n\t\t\t// plain properties: `{ [\"__proto__\"]: v }` must NOT touch the\n\t\t\t// prototype.\n\t\t\tconst key = prop.computed ? this.visit(prop.key) : prop.key.name || prop.key.value;\n\t\t\tconst value = this.visit(prop.value);\n\t\t\tif (prop.computed) {\n\t\t\t\tObject.defineProperty(obj, key, { value, writable: true, enumerable: true, configurable: true });\n\t\t\t} else {\n\t\t\t\tobj[key] = value;\n\t\t\t}\n\t\t}\n\t\treturn obj;\n\t}\n\n\thandleSpreadElement(node) {\n\t\treturn this.visit(node.argument);\n\t}\n\n\t/**\n\t * Handles arrow function expressions.\n\t * Creates a closure that captures the current scope and executes the function body\n\t * with parameters bound to a new scope.\n\t * @private\n\t */\n\thandleArrowFunctionExpression(node) {\n\t\t// Only simple identifier parameters are supported. A destructuring,\n\t\t// default (`a = 1`) or rest (`...a`) parameter is not an Identifier, so\n\t\t// `param.name` would be `undefined` and the binding would be written to a\n\t\t// property literally named \"undefined\" — silently mis-binding the argument\n\t\t// and shadowing the `undefined` global inside the body. Reject such a\n\t\t// signature up front instead of evaluating it incorrectly.\n\t\tfor (const param of node.params) {\n\t\t\tif (param.type !== \"Identifier\") {\n\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Destructuring, default, and rest parameters\"]));\n\t\t\t}\n\t\t}\n\t\treturn (...args) => {\n\t\t\t// Create new scope with parameters bound to arguments\n\t\t\tconst newScope = {};\n\t\t\tconst paramCount = node.params.length;\n\t\t\tfor (let i = 0; i < paramCount; i++) {\n\t\t\t\tnewScope[node.params[i].name] = args[i];\n\t\t\t}\n\n\t\t\t// Push new scope, evaluate body, then pop scope. The scope must be\n\t\t\t// popped even when the body throws: a leaked scope would make the\n\t\t\t// parameter bindings visible to subsequent evaluations on the same\n\t\t\t// instance.\n\t\t\tthis.scopes.unshift(newScope);\n\t\t\ttry {\n\t\t\t\tconst result = this.visit(node.body);\n\t\t\t\tthis.consumeEvaluationValue(result);\n\t\t\t\treturn result;\n\t\t\t} finally {\n\t\t\t\tthis.scopes.shift();\n\t\t\t}\n\t\t};\n\t}\n\n\tconsumeEvaluationValue(value) {\n\t\tconst { dataSize, dataNodes } = assertBoundedData(value, \"Intermediate evaluation result\");\n\t\tthis.remainingDataSize -= dataSize;\n\t\tthis.remainingDataNodes -= dataNodes;\n\t\tif (this.remainingDataSize < 0 || this.remainingDataNodes < 0) {\n\t\t\tthrow new RangeError(\"Evaluation allocation budget exceeded\");\n\t\t}\n\t}\n\n\t/**\n\t * Handles function call expressions, including optional chaining.\n\t * @private\n\t */\n\thandleCallExpression(node) {\n\t\tconst isOptional = node.optional || (node.callee.type === \"MemberExpression\" && node.callee.optional);\n\t\tlet func;\n\t\tlet target = null;\n\n\t\tif (node.callee.type === \"MemberExpression\") {\n\t\t\t// Evaluate the object expression exactly once, then resolve the\n\t\t\t// property through handleMemberExpression so that all of its\n\t\t\t// guards (.stack access, prototype access, Function constructor)\n\t\t\t// still apply. Visiting the whole callee and then the object again\n\t\t\t// would double-evaluate side-effecting expressions such as\n\t\t\t// `new Date(1000).getTime()` or `f().g()`.\n\t\t\ttarget = this.visit(node.callee.object);\n\t\t\tfunc = this.handleMemberExpression(node.callee, target);\n\t\t} else {\n\t\t\tfunc = this.visit(node.callee);\n\t\t}\n\n\t\tif ((func === undefined || func === null) && isOptional) {\n\t\t\treturn void 0;\n\t\t}\n\n\t\tif (func === Function) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Function constructor\"]));\n\t\t}\n\t\t// Error.prepareStackTrace is a host-installed callback. It must be\n\t\t// checked dynamically: the blocked-methods map is built lazily on first\n\t\t// use, so a host that installs the callback *after* that point would\n\t\t// otherwise evade the static blocklist. The `typeof` guard matters: on\n\t\t// runtimes that leave `Error.prepareStackTrace` undefined (Node 18, 24),\n\t\t// a bare identity test also matches a non-function callee (`undefined`),\n\t\t// which would mask the real \"is not a function\" error.\n\t\tif (typeof func === \"function\" && func === Error.prepareStackTrace) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Error.prepareStackTrace\"]));\n\t\t}\n\n\t\tconst blockedPath = getBlockedMethods().get(func);\n\t\tif (blockedPath !== undefined) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [blockedPath]));\n\t\t}\n\t\t// Typed-array mutators live on `%TypedArray%.prototype`, which the\n\t\t// own-property walk in `getBlockedMethods` never reaches, so resolve\n\t\t// them against the real prototype functions here.\n\t\tif (TYPED_ARRAY_MUTATORS.has(func)) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [`TypedArray.prototype.${TYPED_ARRAY_MUTATORS.get(func)}`]));\n\t\t}\n\n\t\t// 仅在存在参数时构建数组\n\t\tconst args = (() => {\n\t\t\tif (node.arguments.length === 0) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tlet result = [];\n\n\t\t\tfor (let i = 0; i < node.arguments.length; i++) {\n\t\t\t\tconst element = node.arguments[i];\n\t\t\t\tconst value = this.visit(element);\n\n\t\t\t\tif (element.type === \"SpreadElement\") {\n\t\t\t\t\tthis.assertBoundedSpread(result.length, value);\n\t\t\t\t\tresult.push(...value);\n\t\t\t\t} else {\n\t\t\t\t\tresult.push(value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t})();\n\n\t\t// Defense in depth: even if a `Function` reference were somehow\n\t\t// produced by an expression, it must not be passed as an argument.\n\t\t// Native methods (Promise.then, Array.prototype.map, ...) would\n\t\t// invoke it in the host runtime, outside this interpreter's checks.\n\t\tif (args.some((arg) => arg === Function)) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Function constructor\"]));\n\t\t}\n\t\tif (typeof target === \"string\") {\n\t\t\tif (String.prototype.repeat && func === String.prototype.repeat && target.length * Number(args[0]) > MAX_STRING_LENGTH) {\n\t\t\t\tthrow new RangeError(\"String result exceeds the maximum allowed length\");\n\t\t\t}\n\t\t\tif ((String.prototype.padStart && func === String.prototype.padStart || func === String.prototype.padEnd) && Number(args[0]) > MAX_STRING_LENGTH) {\n\t\t\t\tthrow new RangeError(\"String result exceeds the maximum allowed length\");\n\t\t\t}\n\t\t\tif (String.prototype.concat && func === String.prototype.concat) {\n\t\t\t\tconst resultLength = target.length + args.reduce((length, value) => length + String(value).length, 0);\n\t\t\t\tif (resultLength > MAX_STRING_LENGTH) {\n\t\t\t\t\tthrow new RangeError(\"String result exceeds the maximum allowed length\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ((String.prototype.replace && func === String.prototype.replace) || (String.prototype.replaceAll && func === String.prototype.replaceAll)) {\n\t\t\t\tconst all = func === String.prototype.replaceAll;\n\t\t\t\tconst search = args[0];\n\t\t\t\tconst replacement = args[1];\n\t\t\t\tif (typeof replacement === \"function\") {\n\t\t\t\t\tthrow new Error(\"Only literal string replacements are allowed\");\n\t\t\t\t}\n\t\t\t\t// `$&`, `` $` ``, `$'` and `$$` expand against the matched text, so a\n\t\t\t\t// tiny pattern can be amplified into an arbitrarily large result. This\n\t\t\t\t// must be rejected for string *and* RegExp patterns: the native engine\n\t\t\t\t// builds the whole expanded string before any post-hoc length check, so\n\t\t\t\t// a check that only covered string patterns left a memory-exhaustion\n\t\t\t\t// hole (`\"a\".repeat(1e5).replace(/a/g, \"$&\".repeat(1000))`).\n\t\t\t\tif (typeof replacement === \"string\" && /\\$(?:[$&'`])/u.test(replacement)) {\n\t\t\t\t\tthrow new Error(\"Only literal string replacements are allowed\");\n\t\t\t\t}\n\t\t\t\tlet matchCount;\n\t\t\t\tif (typeof search === \"string\") {\n\t\t\t\t\tif (target.length * Math.max(1, search.length) > 10000000) {\n\t\t\t\t\t\tthrow new RangeError(\"String operation exceeds the maximum work limit\");\n\t\t\t\t\t}\n\t\t\t\t\tmatchCount = countLiteralMatches(target, search, all);\n\t\t\t\t} else if (search instanceof RegExp) {\n\t\t\t\t\t// `replace` with a *global* pattern also replaces every match, so it\n\t\t\t\t\t// needs the full count just like `replaceAll` - otherwise a large\n\t\t\t\t\t// replacement string is under-counted and the native engine allocates\n\t\t\t\t\t// the whole expanded result before the boundary check.\n\t\t\t\t\tmatchCount = countRegExpMatches(target, search, all || search.flags.includes(\"g\"));\n\t\t\t\t} else {\n\t\t\t\t\tmatchCount = 0;\n\t\t\t\t}\n\t\t\t\tif (target.length + matchCount * String(replacement).length > MAX_STRING_LENGTH) {\n\t\t\t\t\tthrow new RangeError(\"String result exceeds the maximum allowed length\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (func === String.prototype.split) {\n\t\t\t\tif (args[0] === \"\" && target.length > MAX_ARRAY_LENGTH) {\n\t\t\t\t\tthrow new RangeError(\"Split result exceeds the maximum allowed length\");\n\t\t\t\t}\n\t\t\t\tif (typeof args[0] === \"string\" && args[0] !== \"\" && countLiteralMatches(target, args[0], true) >= MAX_ARRAY_LENGTH) {\n\t\t\t\t\tthrow new RangeError(\"Split result exceeds the maximum allowed length\");\n\t\t\t\t}\n\t\t\t\t// A RegExp separator splits on every match, so it must be bounded the\n\t\t\t\t// same way as a string separator; otherwise `split(/a/)` on a large\n\t\t\t\t// string builds an array far past the configured entry limit.\n\t\t\t\tif (args[0] instanceof RegExp && countRegExpMatches(target, args[0], true) >= MAX_ARRAY_LENGTH) {\n\t\t\t\t\tthrow new RangeError(\"Split result exceeds the maximum allowed length\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (func === RegExp) {\n\t\t\tthis.assertBoundedRegExp(args);\n\t\t}\n\t\t// A regex can reach a native method without passing the construction-time\n\t\t// screen: a host-supplied `RegExp` in the context, or a string argument to\n\t\t// `match`/`matchAll`/`search` (which the host compiles internally). Screen\n\t\t// it here, right before the call.\n\t\tassertSafeRegExpInvocation(func, target, args);\n\t\tif ((target === Array || isTypedArrayConstructor(target)) && func === target.from) {\n\t\t\tconst source = args[0];\n\t\t\tconst size = typeof source === \"string\" || Array.isArray(source) ? source.length : source?.size ?? source?.length;\n\t\t\tif (typeof size === \"number\" && size > MAX_ARRAY_LENGTH) {\n\t\t\t\tthrow new RangeError(\"Array.from source exceeds the maximum allowed length\");\n\t\t\t}\n\t\t}\n\n\t\tif (typeof func !== \"function\") {\n\t\t\tconst calledString = getNodeString(node.callee);\n\t\t\tthrow new TypeError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_FUNCTION, [calledString]));\n\t\t}\n\n\t\tconst result = func.apply(target, args);\n\n\t\t// Defense in depth: never let a Promise escape as a call result. Its\n\t\t// settlement callbacks run in the host microtask queue, where errors\n\t\t// bypass the caller's synchronous try/catch entirely.\n\t\tif (result instanceof Promise) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Returning promises from expressions\"]));\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Handles template literal expressions.\n\t * More efficient implementation that interleaves quasis and expressions without sorting.\n\t * @private\n\t */\n\thandleTemplateLiteral(node) {\n\t\tlet result = \"\";\n\t\tconst expressionCount = node.expressions.length;\n\n\t\tfor (let i = 0; i < node.quasis.length; i++) {\n\t\t\tresult += node.quasis[i].value.raw;\n\t\t\tif (i < expressionCount) {\n\t\t\t\tresult += this.visit(node.expressions[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n}\n\n/**\n *\n * @param {import('acorn').Node} node\n * @returns\n */\nexport function getNodeString(node) {\n\tswitch (node.type) {\n\t\tcase \"Identifier\": {\n\t\t\treturn node.name;\n\t\t}\n\t\tcase \"Literal\": {\n\t\t\treturn node.raw;\n\t\t}\n\t\tcase \"ArrayExpression\": {\n\t\t\treturn `[${node.elements.map((child) => (child === null ? \"\" : getNodeString(child))).join(\",\")}]`;\n\t\t}\n\t\tcase \"ObjectExpression\": {\n\t\t\t// if keys is empty\n\t\t\tif (node.properties.length === 0) {\n\t\t\t\treturn \"{}\";\n\t\t\t}\n\n\t\t\treturn \"{(intermediate value)}\";\n\t\t}\n\t\tcase \"MemberExpression\": {\n\t\t\tconst objectStr = getNodeString(node.object);\n\t\t\tconst propertyStr = getNodeString(node.property);\n\n\t\t\tif (node.computed) {\n\t\t\t\treturn `${objectStr}[${propertyStr}]`;\n\t\t\t}\n\t\t\treturn `${objectStr}.${propertyStr}`;\n\t\t}\n\t\tdefault: {\n\t\t\treturn null;\n\t\t}\n\t}\n}\n","/**\n * 简单状态机模板解析器\n * 能够正确处理表达式中包含字符串、转义字符和结束标记的情况\n * @class SimpleStateTemplateParser\n */\nconst DEFAULT_MAX_TEMPLATE_LENGTH = 100000;\nconst MAX_CONFIGURABLE_TEMPLATE_LENGTH = 1000000;\nconst DEFAULT_MAX_TOKENS = 1000;\nconst MAX_CONFIGURABLE_TOKENS = 10000;\n\nfunction validateLimit(value, name, defaultValue, maximum) {\n\tif (value === undefined) {\n\t\treturn defaultValue;\n\t}\n\tif (!Number.isSafeInteger(value) || value < 1 || value > maximum) {\n\t\tthrow new RangeError(`${name} must be an integer between 1 and ${maximum}`);\n\t}\n\treturn value;\n}\n\nclass TemplateParser {\n\t/**\n\t * 创建解析器实例\n\t * @param {Object} [options] - 配置选项\n\t * @param {string} [options.expressionStart='{{'] - 表达式开始标记\n\t * @param {string} [options.expressionEnd='}}'] - 表达式结束标记\n\t * @param {boolean} [options.preserveWhitespace=true] - 是否保留表达式周围的空白字符\n\t */\n\tconstructor(options = {}) {\n\t\toptions ??= {};\n\t\tthis.maxTemplateLength = validateLimit(options.maxTemplateLength, \"maxTemplateLength\", DEFAULT_MAX_TEMPLATE_LENGTH, MAX_CONFIGURABLE_TEMPLATE_LENGTH);\n\t\tthis.maxTokens = validateLimit(options.maxTokens, \"maxTokens\", DEFAULT_MAX_TOKENS, MAX_CONFIGURABLE_TOKENS);\n\t\tif (options.expressionStart !== undefined && (typeof options.expressionStart !== \"string\" || options.expressionStart.length === 0 || options.expressionStart.length > 128)) {\n\t\t\tthrow new TypeError(\"expressionStart must be a non-empty string of at most 128 characters\");\n\t\t}\n\t\tif (options.expressionEnd !== undefined && (typeof options.expressionEnd !== \"string\" || options.expressionEnd.length === 0 || options.expressionEnd.length > 128)) {\n\t\t\tthrow new TypeError(\"expressionEnd must be a non-empty string of at most 128 characters\");\n\t\t}\n\t\t// 表达式标记配置\n\t\tthis.exprStart = options.expressionStart || \"{{\";\n\t\tthis.exprEnd = options.expressionEnd || \"}}\";\n\n\t\t// 标记长度缓存,避免重复计算\n\t\tthis.startLen = this.exprStart.length;\n\t\tthis.endLen = this.exprEnd.length;\n\n\t\t// 其他配置\n\t\tthis.preserveWhitespace = options.preserveWhitespace === true;\n\t}\n\n\t/**\n\t * 解析模板字符串,将其转换为 token 数组\n\t * @param {string} template - 要解析的模板字符串\n\t * @returns {Array<{type: string, value: string}>} token 数组\n\t */\n\tparse(template) {\n\t\t// 输入验证\n\t\tif (typeof template !== \"string\") {\n\t\t\tthrow new TypeError(\"模板必须是字符串\");\n\t\t}\n\t\tif (template.length > this.maxTemplateLength) {\n\t\t\tthrow new RangeError(`Template exceeds the maximum length of ${this.maxTemplateLength} characters`);\n\t\t}\n\n\t\tconst tokens = []; // 存储解析结果的 token 数组\n\t\tconst pushToken = (token) => {\n\t\t\tif (tokens.length >= this.maxTokens) {\n\t\t\t\tthrow new RangeError(`Template exceeds the maximum token count of ${this.maxTokens}`);\n\t\t\t}\n\t\t\ttokens.push(token);\n\t\t};\n\t\tconst length = template.length;\n\n\t\t// 状态机变量\n\t\tlet state = \"TEXT\"; // 当前状态:TEXT | EXPR | STRING_SQ | STRING_DQ | TEMPLATE | REGEX | REGEX_CLASS | ESCAPE_*\n\t\tlet buffer = \"\"; // 当前状态的字符缓冲区\n\t\tlet exprStartPos = 0; // 当前表达式的开始位置(用于错误恢复)\n\t\tlet pos = 0; // 当前扫描位置\n\t\t// 上一次有意义的表达式字符,用于区分正则字面量的 `/` 与除号 `/`\n\t\tlet prevExprChar = \"\";\n\n\t\t// 主解析循环:逐个字符扫描模板\n\t\twhile (pos < length) {\n\t\t\tconst char = template[pos];\n\t\t\tconst nextChar = template[pos + 1];\n\n\t\t\t// 状态机核心逻辑\n\t\t\tswitch (state) {\n\t\t\t\t// ==================== 文本状态 ====================\n\t\t\t\tcase \"TEXT\":\n\t\t\t\t\t// 检查是否遇到表达式开始标记\n\t\t\t\t\tif (this._isMatch(pos, template, this.exprStart)) {\n\t\t\t\t\t\t// 将缓冲区中的文本保存为 token\n\t\t\t\t\t\tif (buffer.length > 0) {\n\t\t\t\t\t\t\tpushToken({ type: \"text\", value: buffer, start: pos - buffer.length, end: pos });\n\t\t\t\t\t\t\tbuffer = \"\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// 切换到表达式状态\n\t\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\t\texprStartPos = pos; // 记录表达式开始位置\n\t\t\t\t\t\tprevExprChar = \"\"; // 每个表达式独立判断正则/除号上下文\n\t\t\t\t\t\tpos += this.startLen; // 跳过开始标记\n\t\t\t\t\t\tcontinue; // 继续处理下一个字符(跳过本次循环的剩余部分)\n\t\t\t\t\t}\n\t\t\t\t\t// 普通文本字符,添加到缓冲区\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\t// ==================== 表达式状态 ====================\n\t\t\t\tcase \"EXPR\":\n\t\t\t\t\t// 在表达式中,需要处理各种字符串和转义字符\n\t\t\t\t\tif (char === \"'\") {\n\t\t\t\t\t\t// 进入单引号字符串状态\n\t\t\t\t\t\tstate = \"STRING_SQ\";\n\t\t\t\t\t} else if (char === '\"') {\n\t\t\t\t\t\t// 进入双引号字符串状态\n\t\t\t\t\t\tstate = \"STRING_DQ\";\n\t\t\t\t\t} else if (char === \"`\") {\n\t\t\t\t\t\t// 进入模板字符串状态\n\t\t\t\t\t\tstate = \"TEMPLATE\";\n\t\t\t\t\t} else if (char === \"/\" && this._isRegexPosition(prevExprChar)) {\n\t\t\t\t\t\t// A `/` in expression position starts a regex literal, which may\n\t\t\t\t\t\t// itself contain the closing delimiter (e.g. `/}}/`). Track it so\n\t\t\t\t\t\t// the delimiter inside the pattern is not mistaken for the end of\n\t\t\t\t\t\t// the expression.\n\t\t\t\t\t\tstate = \"REGEX\";\n\t\t\t\t\t} else if (char === \"\\\\\") {\n\t\t\t\t\t\t// 遇到转义字符,根据当前上下文进入相应的转义状态\n\t\t\t\t\t\tif (nextChar === \"'\") state = \"ESCAPE_SQ\";\n\t\t\t\t\t\telse if (nextChar === '\"') state = \"ESCAPE_DQ\";\n\t\t\t\t\t\telse if (nextChar === \"`\") state = \"ESCAPE_TEMPLATE\";\n\t\t\t\t\t\telse state = \"ESCAPE_EXPR\";\n\t\t\t\t\t} else if (this._isMatch(pos, template, this.exprEnd)) {\n\t\t\t\t\t\t// 找到表达式结束标记,且不在字符串中\n\t\t\t\t\t\tconst exprValue = this.preserveWhitespace ? buffer : buffer.trim();\n\t\t\t\t\t\tif (exprValue.length > 0) {\n\t\t\t\t\t\t\tpushToken({\n\t\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\t\tvalue: exprValue,\n\t\t\t\t\t\t\t\tstart: exprStartPos,\n\t\t\t\t\t\t\t\tend: pos + this.endLen,\n\t\t\t\t\t\t\t\tcontentStart: exprStartPos + this.startLen,\n\t\t\t\t\t\t\t\tcontentEnd: pos,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// 重置状态,准备处理后续文本\n\t\t\t\t\t\tbuffer = \"\";\n\t\t\t\t\t\tstate = \"TEXT\";\n\t\t\t\t\t\tpos += this.endLen; // 跳过结束标记\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t// 将当前字符添加到表达式缓冲区。空白字符不更新 prevExprChar,\n\t\t\t\t\t// 这样 `{{ /re/ }}` 中前导空格不会让 `/` 被误判为除号。\n\t\t\t\t\tif (!/\\s/u.test(char)) {\n\t\t\t\t\t\tprevExprChar = char;\n\t\t\t\t\t}\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\t// ==================== 字符串状态 ====================\n\t\t\t\tcase \"STRING_SQ\": // 单引号字符串\n\t\t\t\t\tif (char === \"\\\\\") {\n\t\t\t\t\t\tstate = \"ESCAPE_SQ\"; // 遇到转义字符\n\t\t\t\t\t} else if (char === \"'\") {\n\t\t\t\t\t\tstate = \"EXPR\"; // 字符串结束,回到表达式状态\n\t\t\t\t\t}\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"STRING_DQ\": // 双引号字符串\n\t\t\t\t\tif (char === \"\\\\\") {\n\t\t\t\t\t\tstate = \"ESCAPE_DQ\";\n\t\t\t\t\t} else if (char === '\"') {\n\t\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\t}\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"TEMPLATE\": // 模板字符串\n\t\t\t\t\tif (char === \"\\\\\") {\n\t\t\t\t\t\tstate = \"ESCAPE_TEMPLATE\";\n\t\t\t\t\t} else if (char === \"`\") {\n\t\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\t}\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"REGEX\": // 正则字面量\n\t\t\t\t\tif (char === \"\\\\\") {\n\t\t\t\t\t\tstate = \"ESCAPE_REGEX\";\n\t\t\t\t\t} else if (char === \"[\") {\n\t\t\t\t\t\t// A character class may contain an unescaped `/`.\n\t\t\t\t\t\tstate = \"REGEX_CLASS\";\n\t\t\t\t\t} else if (char === \"/\") {\n\t\t\t\t\t\tstate = \"EXPR\"; // 正则结束(flags 之后回到表达式状态)\n\t\t\t\t\t}\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"REGEX_CLASS\": // 正则字符类 [...]\n\t\t\t\t\tif (char === \"\\\\\") {\n\t\t\t\t\t\tstate = \"ESCAPE_REGEX\";\n\t\t\t\t\t} else if (char === \"]\") {\n\t\t\t\t\t\tstate = \"REGEX\";\n\t\t\t\t\t}\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\t// ==================== 转义状态 ====================\n\t\t\t\t// 转义状态:处理转义字符,然后返回到之前的状态\n\t\t\t\tcase \"ESCAPE_SQ\":\n\t\t\t\t\tbuffer += char; // 添加转义后的字符\n\t\t\t\t\tstate = \"STRING_SQ\"; // 回到单引号字符串状态\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"ESCAPE_DQ\":\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tstate = \"STRING_DQ\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"ESCAPE_TEMPLATE\":\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tstate = \"TEMPLATE\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"ESCAPE_REGEX\":\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tstate = \"REGEX\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"ESCAPE_EXPR\":\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// 移动到下一个字符\n\t\t\tpos++;\n\t\t}\n\n\t\t// ==================== 后处理 ====================\n\t\t// 处理扫描结束后缓冲区中剩余的内容\n\t\tif (buffer.length > 0) {\n\t\t\tif (state === \"TEXT\") {\n\t\t\t\t// 剩余的文本内容\n\t\t\t\tpushToken({ type: \"text\", value: buffer, start: pos - buffer.length, end: pos });\n\t\t\t} else {\n\t\t\t\t// 未完成的表达式,将其作为普通文本处理\n\t\t\t\tconst incompleteExpr = this.exprStart + buffer;\n\t\t\t\tpushToken({ type: \"text\", value: incompleteExpr, start: exprStartPos, end: pos });\n\t\t\t}\n\t\t}\n\n\t\treturn tokens;\n\t}\n\n\t/**\n\t * 判断 `/` 是否处于正则字面量的起始位置。当上一个有意义的字符是\n\t * 开头、运算符或左括号时,`/` 开始一个正则;否则它是除号。\n\t * @param {string} prev - 上一个有意义的表达式字符(可能为空)\n\t * @returns {boolean}\n\t * @private\n\t */\n\t_isRegexPosition(prev) {\n\t\treturn prev === \"\" || \"(,=:[!&|?{};+-*%^~<>\".includes(prev);\n\t}\n\n\t/**\n\t * 检查指定位置是否匹配给定的字符序列\n\t * @param {number} pos - 开始检查的位置\n\t * @param {string} template - 模板字符串\n\t * @param {string} sequence - 要匹配的字符序列\n\t * @returns {boolean} 是否匹配\n\t * @private\n\t */\n\t_isMatch(pos, template, sequence) {\n\t\t// 检查剩余长度是否足够\n\t\tif (pos + sequence.length > template.length) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// 逐个字符比较\n\t\tfor (let i = 0; i < sequence.length; i++) {\n\t\t\tif (template[pos + i] !== sequence[i]) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * 静态方法:快速解析模板\n\t * @param {string} template - 模板字符串\n\t * @param {Object} [options] - 配置选项\n\t * @returns {Array} token 数组\n\t */\n\tstatic parse(template, options) {\n\t\tconst parser = new TemplateParser(options);\n\t\treturn parser.parse(template);\n\t}\n}\n\nexport { TemplateParser };\n","import { Evaluator } from \"./Evaluator.js\";\nimport { TemplateParser } from \"./TemplateParser.js\";\n\nexport { Evaluator, TemplateParser };\n\nconst DEFAULT_MAX_TEMPLATE_EXPRESSIONS = 100;\nconst MAX_TEMPLATE_EXPRESSIONS = 1000;\nconst DEFAULT_MAX_TEMPLATE_OUTPUT_LENGTH = 100000;\nconst MAX_TEMPLATE_OUTPUT_LENGTH = 1000000;\n\nfunction validateLimit(value, name, defaultValue, maximum) {\n\tif (value === undefined) {\n\t\treturn defaultValue;\n\t}\n\tif (!Number.isSafeInteger(value) || value < 1 || value > maximum) {\n\t\tthrow new RangeError(`${name} must be an integer between 1 and ${maximum}`);\n\t}\n\treturn value;\n}\n\n/**\n * Evaluates a JavaScript expression with an optional context.\n * @param {string} expression - The JavaScript expression to evaluate\n * @param {unknown} [context] - Optional context object with variables to use in the expression\n * @returns {*} The result of evaluating the expression\n * @example\n * evalExpression('a + b', { a: 1, b: 2 }) // returns 3\n */\nexport function evalExpression(expression, context) {\n\treturn Evaluator.evaluate(expression, context);\n}\n\n/**\n * Evaluates a template string by replacing {{ expression }} patterns with their evaluated values.\n * An expression that references an undefined variable resolves to the string\n * `\"undefined\"` instead of throwing, so a missing variable degrades gracefully.\n * @param {string} template - The template string containing {{ expression }} patterns\n * @param {Object} [context] - Optional context object with variables to use in expressions\n * @param {Object} [templateParserOptions] - Optional options for the template parser\n * @returns {string} The template with all expressions evaluated and replaced\n * @example\n * evalTemplate('Hello {{ name }}!', { name: 'World' }) // returns 'Hello World!'\n */\nexport function evalTemplate(template, context, templateParserOptions) {\n\tconst options = templateParserOptions ?? {};\n\tconst maxExpressions = validateLimit(options.maxExpressions, \"maxExpressions\", DEFAULT_MAX_TEMPLATE_EXPRESSIONS, MAX_TEMPLATE_EXPRESSIONS);\n\tconst maxOutputLength = validateLimit(options.maxOutputLength, \"maxOutputLength\", DEFAULT_MAX_TEMPLATE_OUTPUT_LENGTH, MAX_TEMPLATE_OUTPUT_LENGTH);\n\tconst tokens = TemplateParser.parse(template, options);\n\tlet result = \"\";\n\tlet expressionCount = 0;\n\n\t// Reuse a single Evaluator instance for every expression in the template.\n\t// `Evaluator.evaluate` builds a new instance per call, cloning the whole\n\t// context via structuredClone for each expression - wasteful when a\n\t// template contains many expressions. Reusing one instance is safe here:\n\t// evaluate() never mutates the scope chain outside its own call (arrow\n\t// function scopes are pushed and popped in a finally block), and closures\n\t// cannot escape because the cloneable-return gate rejects them.\n\tconst evaluator = new Evaluator(context, {\n\t\tmaxInputLength: options.maxExpressionLength,\n\t\tmaxEvaluationSteps: options.maxEvaluationSteps,\n\t});\n\n\tconst typeHandler = {\n\t\ttext: (token) => token.value,\n\t\texpression: (token) => {\n\t\t\ttry {\n\t\t\t\treturn evaluator.evaluate(token.value);\n\t\t\t} catch (error) {\n\t\t\t\t// Replace undefined variables with empty string for graceful degradation\n\t\t\t\tif (error instanceof ReferenceError && error.message.endsWith(\"is not defined\")) {\n\t\t\t\t\treturn \"undefined\";\n\t\t\t\t} else {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t};\n\n\tfor (const token of tokens) {\n\t\t// Unknown token type, treat as text\n\t\tconst handler = typeHandler[token.type] ?? typeHandler[\"text\"];\n\t\tif (token.type === \"expression\") {\n\t\t\texpressionCount++;\n\t\t\tif (expressionCount > maxExpressions) {\n\t\t\t\tthrow new RangeError(`Template exceeds the maximum expression count of ${maxExpressions}`);\n\t\t\t}\n\t\t}\n\n\t\tconst chunk = String(handler(token));\n\t\tif (result.length + chunk.length > maxOutputLength) {\n\t\t\tthrow new RangeError(`Template output exceeds the maximum length of ${maxOutputLength} characters`);\n\t\t}\n\t\tresult += chunk;\n\t}\n\n\treturn result;\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","mutableMethods","dangerousMethods","blockedMethods","blockedGlobalBuiltIns","isUnsafeRegExpPattern","pattern","pos","depth","MAX_DEPTH","parseAlternation","start","branches","parseSequence","terms","parseTerm","atom","parseAtom","quantifier","parseQuantifier","ch","Infinity","match","min","Number","max","undefined","zeroWidth","rest","named","RangeError","body","escaped","raw","node","ANY","DIGITS","Set","WORD","SPACES","escapeSet","esc","classSet","text","inner","set","i","expanded","_iteratorError","c","end","startCode","endCode","code","String","firstCharSet","union","branch","_iteratorError1","_iteratorError2","term","set1","setsIntersect","a","b","_ref","small","large","consumableCharSet","quantNode","trailingQuantifier","leadingQuantifier","hasAdjacentOverlappingQuantifiers","seqNode","left","right","containsUnboundedQuantifier","alternationOverlaps","texts","sets","i1","j","isCatastrophic","ERROR_MESSAGES","DEFAULT_MAX_INPUT_LENGTH","MAX_CONFIGURABLE_INPUT_LENGTH","DEFAULT_MAX_EVALUATION_STEPS","MAX_CONFIGURABLE_EVALUATION_STEPS","MAX_ARRAY_LENGTH","MAX_BUFFER_BYTES","MAX_STRING_LENGTH","MAX_DATA_NODES","MAX_BIGINT_EXPONENT","MAX_BIGINT_BITS","DEFAULT_MAX_DEPTH","MAX_CONFIGURABLE_DEPTH","MAX_REGEXP_SOURCE_LENGTH","MAX_REGEXP_FLAGS_LENGTH","NON_SANDBOX_GLOBALS","TYPED_ARRAY_CONSTRUCTORS","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float16Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array","constructor","isTypedArrayConstructor","value","TYPED_ARRAY_MUTATORS","map","Map","_iter","name","method","REGEXP_SYMBOL_METHODS","symbol","RegExp","REGEXP_INVOCATION_KIND","method1","_iter1","method2","NO_OBJECT","renderErrorMessage","template","context","_","SAFE_REGEXP_PATTERNS","MAX_SAFE_REGEXP_PATTERNS","assertSafeRegExpPattern","assertSafeRegExpInvocation","func","target","args","kind","_instanceof","regexp","validateLimit","defaultValue","maximum","countLiteralMatches","search","all","count","position","countRegExpMatches","flags","re","PARSE_CACHE","MAX_PARSE_CACHE_ENTRIES","MAX_PARSE_CACHE_CHARS","parseCacheChars","parseExpression","expression","cached","ast","acorn","error","SyntaxError","oldestKey","assertBoundedData","label","valueType","_type_of","pending","seen","WeakSet","dataSize","dataNodes","enqueueProperties","object","keys","descriptor","TypeError","current","ArrayBuffer","Array","item","BINARY_OPERATION_MAP","createGlobalScope","scope","builtin","globals","globalThis","isWritable","GLOBAL_SCOPE","getGlobalScope","EMPTY_CONTEXT","getBlockedMethods","BLOCKED_METHODS","path","_path_split","properties","Evaluator","variables","options","clonedVariables","structuredClone","resetBudget","evaluate","execute","result","Error","Promise","resultType","visit","Constructor","arg","content","handleBinaryExpression","op","leftBits","rightBits","BigInt","Math","apply","assertBoundedRegExp","assertBoundedConstruction","_args_","size","DataView","_size_size","collectionSize","byteLength","_args_1","offset","_args_2","elementCount","_size_length","elementCount1","handleLogicalExpression","left1","left2","handleUnaryExpression","handleIdentifier","scopes","ReferenceError","handleMemberExpression","objectValue","isStaticProperty","property","Function","prototype","handleArrayExpression","element","_result","assertBoundedSpread","currentLength","handleObjectExpression","spreadPropertyCount","spreadValue","handleSpreadElement","handleArrowFunctionExpression","param","newScope","paramCount","consumeEvaluationValue","_assertBoundedData","handleCallExpression","isOptional","blockedPath","resultLength","length","replacement","matchCount","source","_source_size","calledString","getNodeString","handleTemplateLiteral","expressionCount","evaluator","child","objectStr","propertyStr","DEFAULT_MAX_TEMPLATE_LENGTH","MAX_CONFIGURABLE_TEMPLATE_LENGTH","DEFAULT_MAX_TOKENS","MAX_CONFIGURABLE_TOKENS","TemplateParser","parse","tokens","pushToken","token","state","buffer","exprStartPos","prevExprChar","char","nextChar","exprValue","incompleteExpr","_isRegexPosition","prev","_isMatch","sequence","parser","DEFAULT_MAX_TEMPLATE_EXPRESSIONS","MAX_TEMPLATE_EXPRESSIONS","DEFAULT_MAX_TEMPLATE_OUTPUT_LENGTH","MAX_TEMPLATE_OUTPUT_LENGTH","evalExpression","evalTemplate","templateParserOptions","maxExpressions","maxOutputLength","typeHandler","_typeHandler_token_type","handler","chunk"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,SAAS,QAAO,EAAEC,UAAU;QACnD,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,SAASI,GAAG,EAAEC,IAAI;QAAI,OAAOF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;IAAO;;;ICCtGL,oBAAoB,CAAC,GAAG,SAAS,QAAO;QACvC,IAAG,AAAkB,eAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACNA,IAAMI,iBAAiB;IACtB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IAEA;IACA;IACA;IAEA;IAEA;IAEA;IACA;IAEA;IACA;IACA;IACA;IAEA;IACA;IACA;IAEA;IACA;IACA;IAGA;IACA;IACA;IACA;IAGA;IACA;IAGA;CACA;AAED,IAAMC,mBAAmB;IACxB;IAEA;IACA;IACA;IACA;IAMA;IACA;CACA;AAGDD,eAAe,IAAI,CAAC;AAKb,IAAME,iBAAkB,qBAAGF,gBAAAA,MAAAA,CAAgB,qBAAGC;AAK9C,IAAME,wBAAwB;IACpC;IACA;IACA;IACA;IAC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