ecma-evaluator 2.0.5 → 2.0.7

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 CHANGED
@@ -380,7 +380,7 @@ evalExpression(`require('fs').readFileSync('/etc/passwd')`, { require: require }
380
380
  ```js
381
381
  // ❌ These will throw errors:
382
382
  evalExpression("arr.push(1)", { arr: [1, 2, 3] });
383
- // Error: Cannot call mutable prototype method: push
383
+ // Error: Array.prototype.push is not allow
384
384
 
385
385
  evalExpression("new Function('return 1')");
386
386
  // Error: Cannot use new with Function constructor
package/README.zh-CN.md CHANGED
@@ -380,7 +380,7 @@ evalExpression(`require('fs').readFileSync('/etc/passwd')`, { require: require }
380
380
  ```js
381
381
  // ❌ 这些将抛出错误:
382
382
  evalExpression("arr.push(1)", { arr: [1, 2, 3] });
383
- // Error: Cannot call mutable prototype method: push
383
+ // Error: Array.prototype.push is not allow
384
384
 
385
385
  evalExpression("new Function('return 1')");
386
386
  // Error: Cannot use new with Function constructor
@@ -359,18 +359,17 @@ function _is_native_reflect_construct() {
359
359
  })();
360
360
  }
361
361
  var ERROR_MESSAGES = {
362
- DELETE_NOT_SUPPORTED: "Delete operator is not allow",
363
- NEW_FUNCTION_NOT_ALLOWED: "Cannot use new with Function constructor",
364
- NOT_A_FUNCTION: "is not a function",
365
- PROPERTY_READ_ERROR: "Cannot read property",
366
- VARIABLE_NOT_DEFINED: "is not defined",
367
- FUNCTION_CONSTRUCTOR_NOT_ALLOWED: "Function constructor is not allowed",
368
- THIS_NOT_ALLOWED: "'this' keyword is not allowed",
369
- NOT_A_VALID_SYNTAX: "is not a valid syntax",
370
- ACCESSING_PROTOTYPE_NOT_ALLOWED: "Accessing prototype properties is not allowed",
371
- WITH_NOT_ALLOWED: "'with' statement is not allowed",
372
- FUNCTION_EXPRESSION_NOT_ALLOWED: "Function expressions are not allowed",
373
- METHOD_NOT_ALLOWED: "is not allowed"
362
+ CAN_NOT_READ_PROPERTY: "Cannot read property of {0} (reading '{1}')",
363
+ IS_NOT_FUNCTION: "{0} is not a function",
364
+ IS_NOT_DEFINED: "{0} is not defined",
365
+ IS_NOT_VALID_SYNTAX: "{0} is not a valid syntax",
366
+ IS_NOT_ALLOWED: "{0} is not allowed"
367
+ };
368
+ var renderErrorMessage = function(template) {
369
+ var context = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
370
+ return template.replace(/{(\w+)}/g, function(_, key) {
371
+ return String(context[key]);
372
+ });
374
373
  };
375
374
  var BINARY_OPERATION_MAP = {
376
375
  "+": function(a, b) {
@@ -582,7 +581,9 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
582
581
  case "ObjectExpression":
583
582
  return this.handleObjectExpression(node);
584
583
  case "FunctionExpression":
585
- throw new Error(ERROR_MESSAGES.FUNCTION_EXPRESSION_NOT_ALLOWED);
584
+ throw new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [
585
+ "Function expression"
586
+ ]));
586
587
  case "ArrowFunctionExpression":
587
588
  return this.handleArrowFunctionExpression(node);
588
589
  case "CallExpression":
@@ -591,7 +592,9 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
591
592
  return this.visit(node.test) ? this.visit(node.consequent) : this.visit(node.alternate);
592
593
  case "NewExpression":
593
594
  if ("Identifier" !== node.callee.type) throw new Error("Unsupported callee type '".concat(node.callee.type, "' in new expression"));
594
- if ("Function" === node.callee.name) throw new Error(ERROR_MESSAGES.NEW_FUNCTION_NOT_ALLOWED);
595
+ if ("Function" === node.callee.name) throw new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [
596
+ "new Function() constructor"
597
+ ]));
595
598
  var Constructor = this.visit(node.callee);
596
599
  var args = node.arguments.length ? node.arguments.map(function(arg) {
597
600
  return _this.visit(arg);
@@ -602,13 +605,19 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
602
605
  case "TemplateLiteral":
603
606
  return this.handleTemplateLiteral(node);
604
607
  case "ThisExpression":
605
- throw new Error(ERROR_MESSAGES.THIS_NOT_ALLOWED);
608
+ throw new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [
609
+ "'this' expression"
610
+ ]));
606
611
  case "WithStatement":
607
- throw new Error(ERROR_MESSAGES.WITH_NOT_ALLOWED);
612
+ throw new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [
613
+ "'with' statement"
614
+ ]));
608
615
  default:
609
616
  var content = this.source.slice(node.start, node.end);
610
617
  if (content.length > 20) content = content.slice(0, 17) + "...";
611
- throw new Error("'".concat(content, "'") + " " + ERROR_MESSAGES.NOT_A_VALID_SYNTAX);
618
+ throw new SyntaxError("'".concat(content, "'") + " " + renderErrorMessage(ERROR_MESSAGES.IS_NOT_VALID_SYNTAX, [
619
+ content
620
+ ]));
612
621
  }
613
622
  }
614
623
  },
@@ -619,7 +628,7 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
619
628
  var left = this.visit(node.left);
620
629
  var right = this.visit(node.right);
621
630
  if (BINARY_OPERATION_MAP.hasOwnProperty(op)) return BINARY_OPERATION_MAP[op](left, right);
622
- throw new Error("Unsupported operator: ".concat(node.operator));
631
+ throw new SyntaxError("Unsupported operator: ".concat(node.operator));
623
632
  }
624
633
  },
625
634
  {
@@ -636,7 +645,7 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
636
645
  var left2 = this.visit(node.left);
637
646
  return null != left2 ? left2 : this.visit(node.right);
638
647
  default:
639
- throw new Error("Unsupported logical operator: ".concat(node.operator));
648
+ throw new SyntaxError("Unsupported logical operator: ".concat(node.operator));
640
649
  }
641
650
  }
642
651
  },
@@ -657,9 +666,11 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
657
666
  case "void":
658
667
  return void this.visit(node.argument);
659
668
  case "delete":
660
- throw new Error(ERROR_MESSAGES.DELETE_NOT_SUPPORTED);
669
+ throw new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [
670
+ "Delete operator"
671
+ ]));
661
672
  default:
662
- throw new Error("Unsupported unary operator: ".concat(node.operator));
673
+ throw new SyntaxError("Unsupported unary operator: ".concat(node.operator));
663
674
  }
664
675
  }
665
676
  },
@@ -683,7 +694,9 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
683
694
  if (_didIteratorError) throw _iteratorError;
684
695
  }
685
696
  }
686
- throw new ReferenceError("".concat(name, " ").concat(ERROR_MESSAGES.VARIABLE_NOT_DEFINED));
697
+ throw new ReferenceError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_DEFINED, [
698
+ name
699
+ ]));
687
700
  }
688
701
  },
689
702
  {
@@ -692,10 +705,15 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
692
705
  var object = this.visit(node.object);
693
706
  var isStaticProperty = "Identifier" === node.property.type && !node.computed;
694
707
  var property = isStaticProperty ? node.property.name : this.visit(node.property);
695
- if (null != object && object[property] === (null == object ? void 0 : object.__proto__)) throw new Error(ERROR_MESSAGES.ACCESSING_PROTOTYPE_NOT_ALLOWED);
708
+ if (null != object && object[property] === (null == object ? void 0 : object.__proto__)) throw new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [
709
+ "Accessing prototype properties"
710
+ ]));
696
711
  if (null == object) {
697
712
  if (node.optional) return;
698
- throw new TypeError("".concat(ERROR_MESSAGES.PROPERTY_READ_ERROR, " '").concat(property, "' of ").concat(object));
713
+ throw new TypeError(renderErrorMessage(ERROR_MESSAGES.CAN_NOT_READ_PROPERTY, [
714
+ object,
715
+ property
716
+ ]));
699
717
  }
700
718
  return object[property];
701
719
  }
@@ -770,17 +788,17 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
770
788
  key: "handleCallExpression",
771
789
  value: function(node) {
772
790
  var _this = this;
773
- var calledString = getNodeString(node.callee);
774
791
  var func = this.visit(node.callee);
775
- if ("function" != typeof func) {
776
- var isOptional = node.optional || node.callee.optional;
777
- if (null == func && isOptional) return;
778
- throw new TypeError("".concat(calledString, " ").concat(ERROR_MESSAGES.NOT_A_FUNCTION));
779
- }
780
- if (func === Function) throw new Error(ERROR_MESSAGES.FUNCTION_CONSTRUCTOR_NOT_ALLOWED);
792
+ var isOptional = node.optional || node.callee.optional;
793
+ if (null == func && isOptional) return;
794
+ if (func === Function) throw new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [
795
+ "Function constructor"
796
+ ]));
781
797
  if (getBlockedMethods().has(func)) {
782
798
  var path = getBlockedMethods().get(func);
783
- throw new Error("".concat(path, " ").concat(ERROR_MESSAGES.METHOD_NOT_ALLOWED));
799
+ throw new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [
800
+ path
801
+ ]));
784
802
  }
785
803
  var args = function() {
786
804
  if (0 === node.arguments.length) return [];
@@ -796,6 +814,12 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
796
814
  return result;
797
815
  }();
798
816
  var target = "MemberExpression" === node.callee.type ? this.visit(node.callee.object) : null;
817
+ if ("function" != typeof func) {
818
+ var calledString = getNodeString(node.callee);
819
+ throw new TypeError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_FUNCTION, [
820
+ calledString
821
+ ]));
822
+ }
799
823
  return func.apply(target, args);
800
824
  }
801
825
  },
@@ -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\"Promise.prototype.catch\",\n\t\"Promise.prototype.finally\",\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\t\"Object.getOwnPropertyDescriptors\",\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\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\tDELETE_NOT_SUPPORTED: \"Delete operator is not allow\",\n\tNEW_FUNCTION_NOT_ALLOWED: \"Cannot use new with Function constructor\",\n\tNOT_A_FUNCTION: \"is not a function\",\n\tPROPERTY_READ_ERROR: \"Cannot read property\",\n\tVARIABLE_NOT_DEFINED: \"is not defined\",\n\tFUNCTION_CONSTRUCTOR_NOT_ALLOWED: \"Function constructor is not allowed\",\n\tTHIS_NOT_ALLOWED: \"'this' keyword is not allowed\",\n\tNOT_A_VALID_SYNTAX: \"is not a valid syntax\",\n\tACCESSING_PROTOTYPE_NOT_ALLOWED: \"Accessing prototype properties is not allowed\",\n\tWITH_NOT_ALLOWED: \"'with' statement is not allowed\",\n\tFUNCTION_EXPRESSION_NOT_ALLOWED: \"Function expressions are not allowed\",\n\tMETHOD_NOT_ALLOWED: \"is not allowed\",\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 */\n\tconstructor(variables = {}) {\n\t\tthis.scopes = [variables, createGlobalScope()];\n\t\tthis.source = undefined;\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\tthis.source = expression;\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\tlet result;\n\t\tfor (const node of body) {\n\t\t\tresult = this.visit(node);\n\t\t}\n\t\treturn result;\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 {Object} node - The AST node to visit\n\t * @returns {*} The result of visiting the node\n\t */\n\tvisit(node) {\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 Error(ERROR_MESSAGES.FUNCTION_EXPRESSION_NOT_ALLOWED);\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(ERROR_MESSAGES.NEW_FUNCTION_NOT_ALLOWED);\n\t\t\t\t}\n\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\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 Error(ERROR_MESSAGES.THIS_NOT_ALLOWED);\n\t\t\t}\n\t\t\tcase \"WithStatement\": {\n\t\t\t\tthrow new Error(ERROR_MESSAGES.WITH_NOT_ALLOWED);\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 Error(`'${content}'` + \" \" + ERROR_MESSAGES.NOT_A_VALID_SYNTAX);\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\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 Error(`Unsupported operator: ${node.operator}`);\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 Error(`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 Error(ERROR_MESSAGES.DELETE_NOT_SUPPORTED);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new Error(`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(`${name} ${ERROR_MESSAGES.VARIABLE_NOT_DEFINED}`);\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) {\n\t\tconst object = this.visit(node.object);\n\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// Prevent access to prototype properties\n\t\tif (typeof object !== \"undefined\" && object !== null && object[property] === object?.__proto__) {\n\t\t\tthrow new Error(ERROR_MESSAGES.ACCESSING_PROTOTYPE_NOT_ALLOWED);\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(`${ERROR_MESSAGES.PROPERTY_READ_ERROR} '${property}' of ${object}`);\n\t\t}\n\n\t\treturn object[property];\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\t\t\tconst value = this.visit(element);\n\n\t\t\tif (element.type === \"SpreadElement\") {\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\t/**\n\t * Handles object literal expressions.\n\t * @returns\n\t */\n\thandleObjectExpression(node) {\n\t\tconst obj = {};\n\t\tfor (const prop of node.properties) {\n\t\t\tif (prop.type === \"SpreadElement\") {\n\t\t\t\tObject.assign(obj, this.visit(prop.argument));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst key = prop.key.name || prop.key.value;\n\t\t\tconst value = this.visit(prop.value);\n\t\t\tobj[key] = value;\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\n\t\t\tthis.scopes.unshift(newScope);\n\t\t\tconst result = this.visit(node.body);\n\t\t\tthis.scopes.shift();\n\t\t\treturn result;\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 calledString = getNodeString(node.callee);\n\n\t\tconst func = this.visit(node.callee);\n\n\t\tif (typeof func !== \"function\") {\n\t\t\tconst isOptional = node.optional || node.callee.optional;\n\t\t\tif ((func === undefined || func === null) && isOptional) {\n\t\t\t\treturn void 0;\n\t\t\t}\n\t\t\tthrow new TypeError(`${calledString} ${ERROR_MESSAGES.NOT_A_FUNCTION}`);\n\t\t}\n\n\t\tif (func === Function) {\n\t\t\tthrow new Error(ERROR_MESSAGES.FUNCTION_CONSTRUCTOR_NOT_ALLOWED);\n\t\t}\n\n\t\tif (getBlockedMethods().has(func)) {\n\t\t\tconst path = getBlockedMethods().get(func);\n\t\t\tthrow new Error(`${path} ${ERROR_MESSAGES.METHOD_NOT_ALLOWED}`);\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\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\tconst target = node.callee.type === \"MemberExpression\" ? this.visit(node.callee.object) : null;\n\n\t\treturn func.apply(target, args);\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 */\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\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\n\t\tconst tokens = []; // 存储解析结果的 token 数组\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\ttokens.push({ 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\ttokens.push({\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\ttokens.push({ type: \"text\", value: buffer, start: pos - buffer.length, end: pos });\n\t\t\t} else {\n\t\t\t\t// 未完成的表达式,将其作为普通文本处理\n\t\t\t\t// 这里可以根据需要选择不同的错误处理策略:\n\t\t\t\t// 1. 抛出错误\n\t\t\t\t// 2. 忽略未完成的表达式\n\t\t\t\t// 3. 将其作为文本处理(当前实现)\n\t\t\t\tconst incompleteExpr = this.exprStart + buffer;\n\t\t\t\ttokens.push({ type: \"text\", value: incompleteExpr, start: exprStartPos, end: pos });\n\n\t\t\t\t// 可选:输出警告\n\t\t\t\tconsole.warn(`警告:在位置 ${exprStartPos} 开始的表达式未正确结束`);\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\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\tlet result = \"\";\n\n\tfor (const token of TemplateParser.parse(template, templateParserOptions)) {\n\t\tif (token.type === \"text\") {\n\t\t\tresult += token.value;\n\t\t} else if (token.type === \"expression\") {\n\t\t\ttry {\n\t\t\t\tresult += Evaluator.evaluate(token.value, context);\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\tresult += \"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\treturn result;\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","mutableMethods","dangerousMethods","blockedMethods","blockedGlobalBuiltIns","ERROR_MESSAGES","BINARY_OPERATION_MAP","a","b","_instanceof","createGlobalScope","scope","builtin","globals","isWritable","globalThis","getBlockedMethods","BLOCKED_METHODS","map","Map","_iteratorError","path","_path_split","object","properties","current","_iteratorError1","Evaluator","variables","undefined","evaluate","expression","ast","acorn","execute","body","result","node","visit","Error","Constructor","args","arg","content","handleBinaryExpression","op","left","right","handleLogicalExpression","left1","left2","handleUnaryExpression","_type_of","handleIdentifier","name","ReferenceError","handleMemberExpression","isStaticProperty","property","TypeError","handleArrayExpression","i","element","value","_result","handleObjectExpression","handleSpreadElement","handleArrowFunctionExpression","newScope","paramCount","handleCallExpression","calledString","getNodeString","func","isOptional","Function","target","handleTemplateLiteral","expressionCount","context","evaluator","child","objectStr","propertyStr","TemplateParser","options","parse","template","tokens","length","state","buffer","exprStartPos","pos","char","nextChar","exprValue","incompleteExpr","console","_isMatch","sequence","parser","evalExpression","evalTemplate","templateParserOptions","token","error"],"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;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;IACA;CACA;AAGDD,eAAe,IAAI,CAAC;AAKb,IAAME,iBAAkB,qBAAGF,gBAAAA,MAAAA,CAAgB,qBAAGC;AAK9C,IAAME,wBAAwB;IACpC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAGA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAGA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAGA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAGA;IACA;IACA;IACA;IAGA;IACA;IAGA;CACA;;;;;;;;;;;;;;;;;;;;;;;;;;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,IAAI;gBACHrE,UAAUT,oBAAAA,QAAkB,CAAC8E,MAAM,KAAK,EAAE1B;YAC3C,EAAE,OAAO2B,OAAO;gBAEf,IAASjG,eAALiG,OAAiBnD,mBAAkBmD,MAAM,OAAO,CAAC,QAAQ,CAAC,mBAC7DtE,UAAU;qBAEV,MAAMsE;YAER;QAEF;;QAfKtF,oBAAAA;QAAAA,iBAAAA;;;iBAAAA,6BAAAA,AAAAA,QAAAA,UAAAA,MAAAA,EAAAA,UAAAA,MAAAA;;gBAAAA,mB,MAAAA;;;IAiBL,OAAOgB;AACR"}
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\"Promise.prototype.catch\",\n\t\"Promise.prototype.finally\",\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\t\"Object.getOwnPropertyDescriptors\",\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\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_NOT_FUNCTION: \"{0} is not a function\",\n\tIS_NOT_DEFINED: \"{0} is not defined\",\n\tIS_NOT_VALID_SYNTAX: \"{0} is not a valid syntax\",\n\tIS_NOT_ALLOWED: \"{0} is not allowed\",\n};\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\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 */\n\tconstructor(variables = {}) {\n\t\tthis.scopes = [variables, createGlobalScope()];\n\t\tthis.source = undefined;\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\tthis.source = expression;\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\tlet result;\n\t\tfor (const node of body) {\n\t\t\tresult = this.visit(node);\n\t\t}\n\t\treturn result;\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\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\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\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_NOT_VALID_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\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\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) {\n\t\tconst object = this.visit(node.object);\n\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// 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\treturn object[property];\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\t\t\tconst value = this.visit(element);\n\n\t\t\tif (element.type === \"SpreadElement\") {\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\t/**\n\t * Handles object literal expressions.\n\t * @returns\n\t */\n\thandleObjectExpression(node) {\n\t\tconst obj = {};\n\t\tfor (const prop of node.properties) {\n\t\t\tif (prop.type === \"SpreadElement\") {\n\t\t\t\tObject.assign(obj, this.visit(prop.argument));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst key = prop.key.name || prop.key.value;\n\t\t\tconst value = this.visit(prop.value);\n\t\t\tobj[key] = value;\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\n\t\t\tthis.scopes.unshift(newScope);\n\t\t\tconst result = this.visit(node.body);\n\t\t\tthis.scopes.shift();\n\t\t\treturn result;\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 func = this.visit(node.callee);\n\n\t\tconst isOptional = node.optional || node.callee.optional;\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\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\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\tconst target = node.callee.type === \"MemberExpression\" ? this.visit(node.callee.object) : null;\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\treturn func.apply(target, args);\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 */\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\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\n\t\tconst tokens = []; // 存储解析结果的 token 数组\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\ttokens.push({ 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\ttokens.push({\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\ttokens.push({ type: \"text\", value: buffer, start: pos - buffer.length, end: pos });\n\t\t\t} else {\n\t\t\t\t// 未完成的表达式,将其作为普通文本处理\n\t\t\t\t// 这里可以根据需要选择不同的错误处理策略:\n\t\t\t\t// 1. 抛出错误\n\t\t\t\t// 2. 忽略未完成的表达式\n\t\t\t\t// 3. 将其作为文本处理(当前实现)\n\t\t\t\tconst incompleteExpr = this.exprStart + buffer;\n\t\t\t\ttokens.push({ type: \"text\", value: incompleteExpr, start: exprStartPos, end: pos });\n\n\t\t\t\t// 可选:输出警告\n\t\t\t\tconsole.warn(`警告:在位置 ${exprStartPos} 开始的表达式未正确结束`);\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\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\tlet result = \"\";\n\n\tfor (const token of TemplateParser.parse(template, templateParserOptions)) {\n\t\tif (token.type === \"text\") {\n\t\t\tresult += token.value;\n\t\t} else if (token.type === \"expression\") {\n\t\t\ttry {\n\t\t\t\tresult += Evaluator.evaluate(token.value, context);\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\tresult += \"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\treturn result;\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","mutableMethods","dangerousMethods","blockedMethods","blockedGlobalBuiltIns","ERROR_MESSAGES","renderErrorMessage","template","context","_","String","BINARY_OPERATION_MAP","a","b","_instanceof","createGlobalScope","scope","builtin","globals","isWritable","globalThis","getBlockedMethods","BLOCKED_METHODS","map","Map","_iteratorError","path","_path_split","object","properties","current","_iteratorError1","Evaluator","variables","undefined","evaluate","expression","ast","acorn","execute","body","result","node","visit","SyntaxError","Error","Constructor","args","arg","content","handleBinaryExpression","op","left","right","handleLogicalExpression","left1","left2","handleUnaryExpression","_type_of","handleIdentifier","name","ReferenceError","handleMemberExpression","isStaticProperty","property","TypeError","handleArrayExpression","i","element","value","_result","handleObjectExpression","handleSpreadElement","handleArrowFunctionExpression","newScope","paramCount","handleCallExpression","func","isOptional","Function","target","calledString","getNodeString","handleTemplateLiteral","expressionCount","evaluator","child","objectStr","propertyStr","TemplateParser","options","parse","tokens","length","state","buffer","exprStartPos","pos","char","nextChar","exprValue","incompleteExpr","console","_isMatch","sequence","parser","evalExpression","evalTemplate","templateParserOptions","token","error"],"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;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;IACA;CACA;AAGDD,eAAe,IAAI,CAAC;AAKb,IAAME,iBAAkB,qBAAGF,gBAAAA,MAAAA,CAAgB,qBAAGC;AAK9C,IAAME,wBAAwB;IACpC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAGA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAGA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAGA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAGA;IACA;IACA;IACA;IAGA;IACA;IAGA;CACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC7PD,IAAMC,iBAAiB;IACtB,uBAAuB;IACvB,iBAAiB;IACjB,gBAAgB;IAChB,qBAAqB;IACrB,gBAAgB;AACjB;AAWA,IAAMC,qBAAqB,SAACC,QAAQ;QAAEC,UAAU,UAAVA,MAAAA,GAAAA,KAAAA,AAAAA,KAAAA,MAAAA,SAAAA,CAAAA,EAAAA,GAAAA,SAAAA,CAAAA,EAAAA,GAAU,CAAC;WAAMD,SAAS,OAAO,CA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UT,oBAAAA,QAAkB,CAAC6E,MAAM,KAAK,EAAErG;YAC3C,EAAE,OAAOsG,OAAO;gBAEf,IAAShG,eAALgG,OAAiBjD,mBAAkBiD,MAAM,OAAO,CAAC,QAAQ,CAAC,mBAC7DrE,UAAU;qBAEV,MAAMqE;YAER;QAEF;;QAfKrF,oBAAAA;QAAAA,iBAAAA;;;iBAAAA,6BAAAA,AAAAA,QAAAA,UAAAA,MAAAA,EAAAA,UAAAA,MAAAA;;gBAAAA,mB,MAAAA;;;IAiBL,OAAOgB;AACR"}
@@ -318,18 +318,17 @@ function _is_native_reflect_construct() {
318
318
  })();
319
319
  }
320
320
  var ERROR_MESSAGES = {
321
- DELETE_NOT_SUPPORTED: "Delete operator is not allow",
322
- NEW_FUNCTION_NOT_ALLOWED: "Cannot use new with Function constructor",
323
- NOT_A_FUNCTION: "is not a function",
324
- PROPERTY_READ_ERROR: "Cannot read property",
325
- VARIABLE_NOT_DEFINED: "is not defined",
326
- FUNCTION_CONSTRUCTOR_NOT_ALLOWED: "Function constructor is not allowed",
327
- THIS_NOT_ALLOWED: "'this' keyword is not allowed",
328
- NOT_A_VALID_SYNTAX: "is not a valid syntax",
329
- ACCESSING_PROTOTYPE_NOT_ALLOWED: "Accessing prototype properties is not allowed",
330
- WITH_NOT_ALLOWED: "'with' statement is not allowed",
331
- FUNCTION_EXPRESSION_NOT_ALLOWED: "Function expressions are not allowed",
332
- METHOD_NOT_ALLOWED: "is not allowed"
321
+ CAN_NOT_READ_PROPERTY: "Cannot read property of {0} (reading '{1}')",
322
+ IS_NOT_FUNCTION: "{0} is not a function",
323
+ IS_NOT_DEFINED: "{0} is not defined",
324
+ IS_NOT_VALID_SYNTAX: "{0} is not a valid syntax",
325
+ IS_NOT_ALLOWED: "{0} is not allowed"
326
+ };
327
+ var renderErrorMessage = function(template) {
328
+ var context = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
329
+ return template.replace(/{(\w+)}/g, function(_, key) {
330
+ return String(context[key]);
331
+ });
333
332
  };
334
333
  var BINARY_OPERATION_MAP = {
335
334
  "+": function(a, b) {
@@ -541,7 +540,9 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
541
540
  case "ObjectExpression":
542
541
  return this.handleObjectExpression(node);
543
542
  case "FunctionExpression":
544
- throw new Error(ERROR_MESSAGES.FUNCTION_EXPRESSION_NOT_ALLOWED);
543
+ throw new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [
544
+ "Function expression"
545
+ ]));
545
546
  case "ArrowFunctionExpression":
546
547
  return this.handleArrowFunctionExpression(node);
547
548
  case "CallExpression":
@@ -550,7 +551,9 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
550
551
  return this.visit(node.test) ? this.visit(node.consequent) : this.visit(node.alternate);
551
552
  case "NewExpression":
552
553
  if ("Identifier" !== node.callee.type) throw new Error("Unsupported callee type '".concat(node.callee.type, "' in new expression"));
553
- if ("Function" === node.callee.name) throw new Error(ERROR_MESSAGES.NEW_FUNCTION_NOT_ALLOWED);
554
+ if ("Function" === node.callee.name) throw new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [
555
+ "new Function() constructor"
556
+ ]));
554
557
  var Constructor = this.visit(node.callee);
555
558
  var args = node.arguments.length ? node.arguments.map(function(arg) {
556
559
  return _this.visit(arg);
@@ -561,13 +564,19 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
561
564
  case "TemplateLiteral":
562
565
  return this.handleTemplateLiteral(node);
563
566
  case "ThisExpression":
564
- throw new Error(ERROR_MESSAGES.THIS_NOT_ALLOWED);
567
+ throw new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [
568
+ "'this' expression"
569
+ ]));
565
570
  case "WithStatement":
566
- throw new Error(ERROR_MESSAGES.WITH_NOT_ALLOWED);
571
+ throw new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [
572
+ "'with' statement"
573
+ ]));
567
574
  default:
568
575
  var content = this.source.slice(node.start, node.end);
569
576
  if (content.length > 20) content = content.slice(0, 17) + "...";
570
- throw new Error("'".concat(content, "'") + " " + ERROR_MESSAGES.NOT_A_VALID_SYNTAX);
577
+ throw new SyntaxError("'".concat(content, "'") + " " + renderErrorMessage(ERROR_MESSAGES.IS_NOT_VALID_SYNTAX, [
578
+ content
579
+ ]));
571
580
  }
572
581
  }
573
582
  },
@@ -578,7 +587,7 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
578
587
  var left = this.visit(node.left);
579
588
  var right = this.visit(node.right);
580
589
  if (BINARY_OPERATION_MAP.hasOwnProperty(op)) return BINARY_OPERATION_MAP[op](left, right);
581
- throw new Error("Unsupported operator: ".concat(node.operator));
590
+ throw new SyntaxError("Unsupported operator: ".concat(node.operator));
582
591
  }
583
592
  },
584
593
  {
@@ -595,7 +604,7 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
595
604
  var left2 = this.visit(node.left);
596
605
  return null != left2 ? left2 : this.visit(node.right);
597
606
  default:
598
- throw new Error("Unsupported logical operator: ".concat(node.operator));
607
+ throw new SyntaxError("Unsupported logical operator: ".concat(node.operator));
599
608
  }
600
609
  }
601
610
  },
@@ -616,9 +625,11 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
616
625
  case "void":
617
626
  return void this.visit(node.argument);
618
627
  case "delete":
619
- throw new Error(ERROR_MESSAGES.DELETE_NOT_SUPPORTED);
628
+ throw new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [
629
+ "Delete operator"
630
+ ]));
620
631
  default:
621
- throw new Error("Unsupported unary operator: ".concat(node.operator));
632
+ throw new SyntaxError("Unsupported unary operator: ".concat(node.operator));
622
633
  }
623
634
  }
624
635
  },
@@ -642,7 +653,9 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
642
653
  if (_didIteratorError) throw _iteratorError;
643
654
  }
644
655
  }
645
- throw new ReferenceError("".concat(name, " ").concat(ERROR_MESSAGES.VARIABLE_NOT_DEFINED));
656
+ throw new ReferenceError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_DEFINED, [
657
+ name
658
+ ]));
646
659
  }
647
660
  },
648
661
  {
@@ -651,10 +664,15 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
651
664
  var object = this.visit(node.object);
652
665
  var isStaticProperty = "Identifier" === node.property.type && !node.computed;
653
666
  var property = isStaticProperty ? node.property.name : this.visit(node.property);
654
- if (null != object && object[property] === (null == object ? void 0 : object.__proto__)) throw new Error(ERROR_MESSAGES.ACCESSING_PROTOTYPE_NOT_ALLOWED);
667
+ if (null != object && object[property] === (null == object ? void 0 : object.__proto__)) throw new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [
668
+ "Accessing prototype properties"
669
+ ]));
655
670
  if (null == object) {
656
671
  if (node.optional) return;
657
- throw new TypeError("".concat(ERROR_MESSAGES.PROPERTY_READ_ERROR, " '").concat(property, "' of ").concat(object));
672
+ throw new TypeError(renderErrorMessage(ERROR_MESSAGES.CAN_NOT_READ_PROPERTY, [
673
+ object,
674
+ property
675
+ ]));
658
676
  }
659
677
  return object[property];
660
678
  }
@@ -729,17 +747,17 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
729
747
  key: "handleCallExpression",
730
748
  value: function(node) {
731
749
  var _this = this;
732
- var calledString = getNodeString(node.callee);
733
750
  var func = this.visit(node.callee);
734
- if ("function" != typeof func) {
735
- var isOptional = node.optional || node.callee.optional;
736
- if (null == func && isOptional) return;
737
- throw new TypeError("".concat(calledString, " ").concat(ERROR_MESSAGES.NOT_A_FUNCTION));
738
- }
739
- if (func === Function) throw new Error(ERROR_MESSAGES.FUNCTION_CONSTRUCTOR_NOT_ALLOWED);
751
+ var isOptional = node.optional || node.callee.optional;
752
+ if (null == func && isOptional) return;
753
+ if (func === Function) throw new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [
754
+ "Function constructor"
755
+ ]));
740
756
  if (getBlockedMethods().has(func)) {
741
757
  var path = getBlockedMethods().get(func);
742
- throw new Error("".concat(path, " ").concat(ERROR_MESSAGES.METHOD_NOT_ALLOWED));
758
+ throw new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [
759
+ path
760
+ ]));
743
761
  }
744
762
  var args = function() {
745
763
  if (0 === node.arguments.length) return [];
@@ -755,6 +773,12 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
755
773
  return result;
756
774
  }();
757
775
  var target = "MemberExpression" === node.callee.type ? this.visit(node.callee.object) : null;
776
+ if ("function" != typeof func) {
777
+ var calledString = getNodeString(node.callee);
778
+ throw new TypeError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_FUNCTION, [
779
+ calledString
780
+ ]));
781
+ }
758
782
  return func.apply(target, args);
759
783
  }
760
784
  },
@@ -1 +1 @@
1
- {"version":3,"file":"esm/index.mjs","sources":["../../src/block.js","../../src/Evaluator.js","../../src/TemplateParser.js","../../src/index.js"],"sourcesContent":["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\"Promise.prototype.catch\",\n\t\"Promise.prototype.finally\",\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\t\"Object.getOwnPropertyDescriptors\",\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\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\tDELETE_NOT_SUPPORTED: \"Delete operator is not allow\",\n\tNEW_FUNCTION_NOT_ALLOWED: \"Cannot use new with Function constructor\",\n\tNOT_A_FUNCTION: \"is not a function\",\n\tPROPERTY_READ_ERROR: \"Cannot read property\",\n\tVARIABLE_NOT_DEFINED: \"is not defined\",\n\tFUNCTION_CONSTRUCTOR_NOT_ALLOWED: \"Function constructor is not allowed\",\n\tTHIS_NOT_ALLOWED: \"'this' keyword is not allowed\",\n\tNOT_A_VALID_SYNTAX: \"is not a valid syntax\",\n\tACCESSING_PROTOTYPE_NOT_ALLOWED: \"Accessing prototype properties is not allowed\",\n\tWITH_NOT_ALLOWED: \"'with' statement is not allowed\",\n\tFUNCTION_EXPRESSION_NOT_ALLOWED: \"Function expressions are not allowed\",\n\tMETHOD_NOT_ALLOWED: \"is not allowed\",\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 */\n\tconstructor(variables = {}) {\n\t\tthis.scopes = [variables, createGlobalScope()];\n\t\tthis.source = undefined;\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\tthis.source = expression;\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\tlet result;\n\t\tfor (const node of body) {\n\t\t\tresult = this.visit(node);\n\t\t}\n\t\treturn result;\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 {Object} node - The AST node to visit\n\t * @returns {*} The result of visiting the node\n\t */\n\tvisit(node) {\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 Error(ERROR_MESSAGES.FUNCTION_EXPRESSION_NOT_ALLOWED);\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(ERROR_MESSAGES.NEW_FUNCTION_NOT_ALLOWED);\n\t\t\t\t}\n\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\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 Error(ERROR_MESSAGES.THIS_NOT_ALLOWED);\n\t\t\t}\n\t\t\tcase \"WithStatement\": {\n\t\t\t\tthrow new Error(ERROR_MESSAGES.WITH_NOT_ALLOWED);\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 Error(`'${content}'` + \" \" + ERROR_MESSAGES.NOT_A_VALID_SYNTAX);\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\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 Error(`Unsupported operator: ${node.operator}`);\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 Error(`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 Error(ERROR_MESSAGES.DELETE_NOT_SUPPORTED);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new Error(`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(`${name} ${ERROR_MESSAGES.VARIABLE_NOT_DEFINED}`);\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) {\n\t\tconst object = this.visit(node.object);\n\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// Prevent access to prototype properties\n\t\tif (typeof object !== \"undefined\" && object !== null && object[property] === object?.__proto__) {\n\t\t\tthrow new Error(ERROR_MESSAGES.ACCESSING_PROTOTYPE_NOT_ALLOWED);\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(`${ERROR_MESSAGES.PROPERTY_READ_ERROR} '${property}' of ${object}`);\n\t\t}\n\n\t\treturn object[property];\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\t\t\tconst value = this.visit(element);\n\n\t\t\tif (element.type === \"SpreadElement\") {\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\t/**\n\t * Handles object literal expressions.\n\t * @returns\n\t */\n\thandleObjectExpression(node) {\n\t\tconst obj = {};\n\t\tfor (const prop of node.properties) {\n\t\t\tif (prop.type === \"SpreadElement\") {\n\t\t\t\tObject.assign(obj, this.visit(prop.argument));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst key = prop.key.name || prop.key.value;\n\t\t\tconst value = this.visit(prop.value);\n\t\t\tobj[key] = value;\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\n\t\t\tthis.scopes.unshift(newScope);\n\t\t\tconst result = this.visit(node.body);\n\t\t\tthis.scopes.shift();\n\t\t\treturn result;\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 calledString = getNodeString(node.callee);\n\n\t\tconst func = this.visit(node.callee);\n\n\t\tif (typeof func !== \"function\") {\n\t\t\tconst isOptional = node.optional || node.callee.optional;\n\t\t\tif ((func === undefined || func === null) && isOptional) {\n\t\t\t\treturn void 0;\n\t\t\t}\n\t\t\tthrow new TypeError(`${calledString} ${ERROR_MESSAGES.NOT_A_FUNCTION}`);\n\t\t}\n\n\t\tif (func === Function) {\n\t\t\tthrow new Error(ERROR_MESSAGES.FUNCTION_CONSTRUCTOR_NOT_ALLOWED);\n\t\t}\n\n\t\tif (getBlockedMethods().has(func)) {\n\t\t\tconst path = getBlockedMethods().get(func);\n\t\t\tthrow new Error(`${path} ${ERROR_MESSAGES.METHOD_NOT_ALLOWED}`);\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\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\tconst target = node.callee.type === \"MemberExpression\" ? this.visit(node.callee.object) : null;\n\n\t\treturn func.apply(target, args);\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 */\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\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\n\t\tconst tokens = []; // 存储解析结果的 token 数组\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\ttokens.push({ 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\ttokens.push({\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\ttokens.push({ type: \"text\", value: buffer, start: pos - buffer.length, end: pos });\n\t\t\t} else {\n\t\t\t\t// 未完成的表达式,将其作为普通文本处理\n\t\t\t\t// 这里可以根据需要选择不同的错误处理策略:\n\t\t\t\t// 1. 抛出错误\n\t\t\t\t// 2. 忽略未完成的表达式\n\t\t\t\t// 3. 将其作为文本处理(当前实现)\n\t\t\t\tconst incompleteExpr = this.exprStart + buffer;\n\t\t\t\ttokens.push({ type: \"text\", value: incompleteExpr, start: exprStartPos, end: pos });\n\n\t\t\t\t// 可选:输出警告\n\t\t\t\tconsole.warn(`警告:在位置 ${exprStartPos} 开始的表达式未正确结束`);\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\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\tlet result = \"\";\n\n\tfor (const token of TemplateParser.parse(template, templateParserOptions)) {\n\t\tif (token.type === \"text\") {\n\t\t\tresult += token.value;\n\t\t} else if (token.type === \"expression\") {\n\t\t\ttry {\n\t\t\t\tresult += Evaluator.evaluate(token.value, context);\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\tresult += \"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\treturn result;\n}\n"],"names":["mutableMethods","dangerousMethods","blockedMethods","blockedGlobalBuiltIns","ERROR_MESSAGES","BINARY_OPERATION_MAP","a","b","_instanceof","createGlobalScope","scope","Object","builtin","globals","key","isWritable","globalThis","getBlockedMethods","BLOCKED_METHODS","map","Map","_iteratorError","path","_path_split","object","properties","current","_iteratorError1","prop","Evaluator","variables","undefined","evaluate","expression","ast","acorn","execute","body","result","node","visit","Error","Constructor","args","arg","content","handleBinaryExpression","op","left","right","handleLogicalExpression","left1","left2","handleUnaryExpression","_type_of","handleIdentifier","name","ReferenceError","handleMemberExpression","isStaticProperty","property","TypeError","handleArrayExpression","i","element","value","_result","handleObjectExpression","obj","handleSpreadElement","handleArrowFunctionExpression","newScope","paramCount","handleCallExpression","calledString","getNodeString","func","isOptional","Function","target","handleTemplateLiteral","expressionCount","context","evaluator","child","objectStr","propertyStr","TemplateParser","options","parse","template","tokens","length","state","buffer","exprStartPos","pos","char","nextChar","exprValue","incompleteExpr","console","_isMatch","sequence","parser","evalExpression","evalTemplate","templateParserOptions","token","error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,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;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;IACA;CACA;AAGDD,eAAe,IAAI,CAAC;AAKb,IAAME,iBAAkB,qBAAGF,gBAAAA,MAAAA,CAAgB,qBAAGC;AAK9C,IAAME,wBAAwB;IACpC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAGA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAGA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAGA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAGA;IACA;IACA;IACA;IAGA;IACA;IAGA;CACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC7PD,IAAMC,iBAAiB;IACtB,sBAAsB;IACtB,0BAA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CAAC,QAAQ,CAAC,mBAC7DvE,UAAU;qBAEV,MAAMuE;YAER;QAEF;;QAfKxF,oBAAAA;QAAAA,iBAAAA;;;iBAAAA,6BAAAA,AAAAA,QAAAA,UAAAA,MAAAA,EAAAA,UAAAA,MAAAA;;gBAAAA,mB,MAAAA;;;IAiBL,OAAOiB;AACR"}
1
+ {"version":3,"file":"esm/index.mjs","sources":["../../src/block.js","../../src/Evaluator.js","../../src/TemplateParser.js","../../src/index.js"],"sourcesContent":["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\"Promise.prototype.catch\",\n\t\"Promise.prototype.finally\",\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\t\"Object.getOwnPropertyDescriptors\",\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\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_NOT_FUNCTION: \"{0} is not a function\",\n\tIS_NOT_DEFINED: \"{0} is not defined\",\n\tIS_NOT_VALID_SYNTAX: \"{0} is not a valid syntax\",\n\tIS_NOT_ALLOWED: \"{0} is not allowed\",\n};\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\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 */\n\tconstructor(variables = {}) {\n\t\tthis.scopes = [variables, createGlobalScope()];\n\t\tthis.source = undefined;\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\tthis.source = expression;\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\tlet result;\n\t\tfor (const node of body) {\n\t\t\tresult = this.visit(node);\n\t\t}\n\t\treturn result;\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\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\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\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_NOT_VALID_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\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\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) {\n\t\tconst object = this.visit(node.object);\n\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// 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\treturn object[property];\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\t\t\tconst value = this.visit(element);\n\n\t\t\tif (element.type === \"SpreadElement\") {\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\t/**\n\t * Handles object literal expressions.\n\t * @returns\n\t */\n\thandleObjectExpression(node) {\n\t\tconst obj = {};\n\t\tfor (const prop of node.properties) {\n\t\t\tif (prop.type === \"SpreadElement\") {\n\t\t\t\tObject.assign(obj, this.visit(prop.argument));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst key = prop.key.name || prop.key.value;\n\t\t\tconst value = this.visit(prop.value);\n\t\t\tobj[key] = value;\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\n\t\t\tthis.scopes.unshift(newScope);\n\t\t\tconst result = this.visit(node.body);\n\t\t\tthis.scopes.shift();\n\t\t\treturn result;\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 func = this.visit(node.callee);\n\n\t\tconst isOptional = node.optional || node.callee.optional;\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\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\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\tconst target = node.callee.type === \"MemberExpression\" ? this.visit(node.callee.object) : null;\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\treturn func.apply(target, args);\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 */\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\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\n\t\tconst tokens = []; // 存储解析结果的 token 数组\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\ttokens.push({ 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\ttokens.push({\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\ttokens.push({ type: \"text\", value: buffer, start: pos - buffer.length, end: pos });\n\t\t\t} else {\n\t\t\t\t// 未完成的表达式,将其作为普通文本处理\n\t\t\t\t// 这里可以根据需要选择不同的错误处理策略:\n\t\t\t\t// 1. 抛出错误\n\t\t\t\t// 2. 忽略未完成的表达式\n\t\t\t\t// 3. 将其作为文本处理(当前实现)\n\t\t\t\tconst incompleteExpr = this.exprStart + buffer;\n\t\t\t\ttokens.push({ type: \"text\", value: incompleteExpr, start: exprStartPos, end: pos });\n\n\t\t\t\t// 可选:输出警告\n\t\t\t\tconsole.warn(`警告:在位置 ${exprStartPos} 开始的表达式未正确结束`);\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\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\tlet result = \"\";\n\n\tfor (const token of TemplateParser.parse(template, templateParserOptions)) {\n\t\tif (token.type === \"text\") {\n\t\t\tresult += token.value;\n\t\t} else if (token.type === \"expression\") {\n\t\t\ttry {\n\t\t\t\tresult += Evaluator.evaluate(token.value, context);\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\tresult += \"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\treturn result;\n}\n"],"names":["mutableMethods","dangerousMethods","blockedMethods","blockedGlobalBuiltIns","ERROR_MESSAGES","renderErrorMessage","template","context","_","key","String","BINARY_OPERATION_MAP","a","b","_instanceof","createGlobalScope","scope","Object","builtin","globals","isWritable","globalThis","getBlockedMethods","BLOCKED_METHODS","map","Map","_iteratorError","path","_path_split","object","properties","current","_iteratorError1","prop","Evaluator","variables","undefined","evaluate","expression","ast","acorn","execute","body","result","node","visit","SyntaxError","Error","Constructor","args","arg","content","handleBinaryExpression","op","left","right","handleLogicalExpression","left1","left2","handleUnaryExpression","_type_of","handleIdentifier","name","ReferenceError","handleMemberExpression","isStaticProperty","property","TypeError","handleArrayExpression","i","element","value","_result","handleObjectExpression","obj","handleSpreadElement","handleArrowFunctionExpression","newScope","paramCount","handleCallExpression","func","isOptional","Function","target","calledString","getNodeString","handleTemplateLiteral","expressionCount","evaluator","child","objectStr","propertyStr","TemplateParser","options","parse","tokens","length","state","buffer","exprStartPos","pos","char","nextChar","exprValue","incompleteExpr","console","_isMatch","sequence","parser","evalExpression","evalTemplate","templateParserOptions","token","error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,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;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;IACA;CACA;AAGDD,eAAe,IAAI,CAAC;AAKb,IAAME,iBAAkB,qBAAGF,gBAAAA,MAAAA,CAAgB,qBAAGC;AAK9C,IAAME,wBAAwB;IACpC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAGA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAGA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAGA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAGA;IACA;IACA;IACA;IAGA;IACA;IAGA;CACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC7PD,IAAMC,iBAAiB;IACtB,uBAAuB;IACvB,iBAAiB;IACjB,gBAAgB;IAChB,qBAAqB;IACrB,gBAAgB;AACjB;AAWA,IAAMC,qBAAqB,SAACC,QAAQ;QAAEC,UAAU,UAAVA,MAAAA,GAAAA,KAAAA,AAAAA,KAAAA,MAAAA,SAAAA,CAAAA,EAAAA,GAAAA,SAAAA,CAAAA,EAAAA,GAAU,CA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,oBAAAA,QAAkB,CAAC8E,MAAM,KAAK,EAAEzG;YAC3C,EAAE,OAAO0G,OAAO;gBAEf,IAASnG,eAALmG,OAAiBlD,mBAAkBkD,MAAM,OAAO,CAAC,QAAQ,CAAC,mBAC7DtE,UAAU;qBAEV,MAAMsE;YAER;QAEF;;QAfKvF,oBAAAA;QAAAA,iBAAAA;;;iBAAAA,6BAAAA,AAAAA,QAAAA,UAAAA,MAAAA,EAAAA,UAAAA,MAAAA;;gBAAAA,mB,MAAAA;;;IAiBL,OAAOiB;AACR"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ecma-evaluator",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "private": false,
5
5
  "description": "A tiny and fast JavaScript expression evaluator.",
6
6
  "sideEffects": false,