chrome-devtools-mcp 0.25.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +55 -6
  2. package/build/src/DevtoolsUtils.js +13 -0
  3. package/build/src/HeapSnapshotManager.js +26 -2
  4. package/build/src/McpContext.js +3 -0
  5. package/build/src/McpResponse.js +51 -21
  6. package/build/src/ToolHandler.js +217 -0
  7. package/build/src/WaitForHelper.js +18 -4
  8. package/build/src/bin/check-latest-version.js +25 -1
  9. package/build/src/bin/chrome-devtools-cli-options.js +38 -2
  10. package/build/src/bin/chrome-devtools-mcp-cli-options.js +2 -8
  11. package/build/src/bin/chrome-devtools-mcp-main.js +4 -3
  12. package/build/src/bin/chrome-devtools.js +0 -2
  13. package/build/src/daemon/client.js +12 -6
  14. package/build/src/formatters/HeapSnapshotFormatter.js +27 -6
  15. package/build/src/index.js +11 -164
  16. package/build/src/telemetry/ClearcutLogger.js +34 -118
  17. package/build/src/telemetry/errors.js +18 -0
  18. package/build/src/telemetry/flagUtils.js +4 -3
  19. package/build/src/telemetry/{toolMetricsUtils.js → metricsRegistry.js} +3 -3
  20. package/build/src/telemetry/persistence.js +20 -2
  21. package/build/src/telemetry/transformation.js +134 -0
  22. package/build/src/telemetry/types.js +0 -8
  23. package/build/src/third_party/THIRD_PARTY_NOTICES +140 -857
  24. package/build/src/third_party/bundled-packages.json +3 -3
  25. package/build/src/third_party/devtools-formatter-worker.js +475 -146
  26. package/build/src/third_party/devtools-heap-snapshot-worker.js +39 -44
  27. package/build/src/third_party/index.js +4055 -30401
  28. package/build/src/third_party/issue-descriptions/genericBackUINavigationWouldSkipAd.md +4 -0
  29. package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +4236 -4219
  30. package/build/src/tools/ToolDefinition.js +1 -1
  31. package/build/src/tools/emulation.js +3 -2
  32. package/build/src/tools/input.js +46 -16
  33. package/build/src/tools/lighthouse.js +7 -7
  34. package/build/src/tools/memory.js +24 -0
  35. package/build/src/tools/script.js +32 -10
  36. package/build/src/version.js +1 -1
  37. package/package.json +10 -7
  38. package/build/src/telemetry/metricUtils.js +0 -15
@@ -2643,14 +2643,9 @@ CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript
2643
2643
  var ExperimentName;
2644
2644
  (function (ExperimentName) {
2645
2645
  ExperimentName["ALL"] = "*";
2646
- ExperimentName["CAPTURE_NODE_CREATION_STACKS"] = "capture-node-creation-stacks";
2647
- ExperimentName["LIVE_HEAP_PROFILE"] = "live-heap-profile";
2648
2646
  ExperimentName["PROTOCOL_MONITOR"] = "protocol-monitor";
2649
- ExperimentName["TIMELINE_INVALIDATION_TRACKING"] = "timeline-invalidation-tracking";
2650
- ExperimentName["FONT_EDITOR"] = "font-editor";
2651
2647
  ExperimentName["INSTRUMENTATION_BREAKPOINTS"] = "instrumentation-breakpoints";
2652
2648
  ExperimentName["USE_SOURCE_MAP_SCOPES"] = "use-source-map-scopes";
2653
- ExperimentName["TIMELINE_DEBUG_MODE"] = "timeline-debug-mode";
2654
2649
  ExperimentName["DURABLE_MESSAGES"] = "durable-messages";
2655
2650
  ExperimentName["JPEG_XL"] = "jpeg-xl";
2656
2651
  })(ExperimentName || (ExperimentName = {}));
@@ -2768,10 +2763,10 @@ class FormattedContentBuilder {
2768
2763
  }
2769
2764
  }
2770
2765
 
2771
- var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 81, 2, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 9, 5351, 0, 7, 14, 13835, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 983, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
2772
- var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 4026, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 757, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938, 6, 4191];
2773
- var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0898-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
2774
- var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
2766
+ var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 78, 5, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 199, 7, 137, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 55, 9, 266, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 233, 0, 3, 0, 8, 1, 6, 0, 475, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
2767
+ var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 7, 25, 39, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 5, 57, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 24, 43, 261, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 33, 24, 3, 24, 45, 74, 6, 0, 67, 12, 65, 1, 2, 0, 15, 4, 10, 7381, 42, 31, 98, 114, 8702, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 208, 30, 2, 2, 2, 1, 2, 6, 3, 4, 10, 1, 225, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4381, 3, 5773, 3, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 8489];
2768
+ var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1add\u1ae0-\u1aeb\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65";
2769
+ var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088f\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5c\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdc-\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7dc\ua7f1-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
2775
2770
  var reservedWords = {
2776
2771
  3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",
2777
2772
  5: "class enum extends super const export import",
@@ -2981,8 +2976,9 @@ var hasOwn = Object.hasOwn || (function (obj, propName) {
2981
2976
  var isArray = Array.isArray || (function (obj) {
2982
2977
  return (toString.call(obj) === "[object Array]");
2983
2978
  });
2979
+ var regexpCache = Object.create(null);
2984
2980
  function wordsRegexp(words) {
2985
- return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$");
2981
+ return regexpCache[words] || (regexpCache[words] = new RegExp("^(?:" + words.replace(/ /g, "|") + ")$"));
2986
2982
  }
2987
2983
  function codePointToString(code) {
2988
2984
  if (code <= 0xFFFF) {
@@ -3069,6 +3065,9 @@ function getOptions(opts) {
3069
3065
  if (isArray(options.onComment)) {
3070
3066
  options.onComment = pushComment(options, options.onComment);
3071
3067
  }
3068
+ if (options.sourceType === "commonjs" && options.allowAwaitOutsideFunction) {
3069
+ throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");
3070
+ }
3072
3071
  return options;
3073
3072
  }
3074
3073
  function pushComment(options, array) {
@@ -3088,7 +3087,7 @@ function pushComment(options, array) {
3088
3087
  array.push(comment);
3089
3088
  };
3090
3089
  }
3091
- var SCOPE_TOP = 1, SCOPE_FUNCTION = 2, SCOPE_ASYNC = 4, SCOPE_GENERATOR = 8, SCOPE_ARROW = 16, SCOPE_SIMPLE_CATCH = 32, SCOPE_SUPER = 64, SCOPE_DIRECT_SUPER = 128, SCOPE_CLASS_STATIC_BLOCK = 256, SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;
3090
+ var SCOPE_TOP = 1, SCOPE_FUNCTION = 2, SCOPE_ASYNC = 4, SCOPE_GENERATOR = 8, SCOPE_ARROW = 16, SCOPE_SIMPLE_CATCH = 32, SCOPE_SUPER = 64, SCOPE_DIRECT_SUPER = 128, SCOPE_CLASS_STATIC_BLOCK = 256, SCOPE_CLASS_FIELD_INIT = 512, SCOPE_SWITCH = 1024, SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK;
3092
3091
  function functionFlags(async, generator) {
3093
3092
  return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0);
3094
3093
  }
@@ -3143,44 +3142,71 @@ var Parser$1 = function Parser(options, input, startPos) {
3143
3142
  this.skipLineComment(2);
3144
3143
  }
3145
3144
  this.scopeStack = [];
3146
- this.enterScope(SCOPE_TOP);
3145
+ this.enterScope(this.options.sourceType === "commonjs"
3146
+ ? SCOPE_FUNCTION
3147
+ : SCOPE_TOP);
3147
3148
  this.regexpState = null;
3148
3149
  this.privateNameStack = [];
3149
3150
  };
3150
- var prototypeAccessors = { inFunction: { configurable: true }, inGenerator: { configurable: true }, inAsync: { configurable: true }, canAwait: { configurable: true }, allowSuper: { configurable: true }, allowDirectSuper: { configurable: true }, treatFunctionsAsVar: { configurable: true }, allowNewDotTarget: { configurable: true }, inClassStaticBlock: { configurable: true } };
3151
+ var prototypeAccessors = { inFunction: { configurable: true }, inGenerator: { configurable: true }, inAsync: { configurable: true }, canAwait: { configurable: true }, allowReturn: { configurable: true }, allowSuper: { configurable: true }, allowDirectSuper: { configurable: true }, treatFunctionsAsVar: { configurable: true }, allowNewDotTarget: { configurable: true }, allowUsing: { configurable: true }, inClassStaticBlock: { configurable: true } };
3151
3152
  Parser$1.prototype.parse = function parse() {
3152
3153
  var node = this.options.program || this.startNode();
3153
3154
  this.nextToken();
3154
3155
  return this.parseTopLevel(node);
3155
3156
  };
3156
3157
  prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0; };
3157
- prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit; };
3158
- prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit; };
3158
+ prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0; };
3159
+ prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0; };
3159
3160
  prototypeAccessors.canAwait.get = function () {
3160
3161
  for (var i = this.scopeStack.length - 1; i >= 0; i--) {
3161
- var scope = this.scopeStack[i];
3162
- if (scope.inClassFieldInit || scope.flags & SCOPE_CLASS_STATIC_BLOCK) {
3162
+ var ref = this.scopeStack[i];
3163
+ var flags = ref.flags;
3164
+ if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT)) {
3163
3165
  return false;
3164
3166
  }
3165
- if (scope.flags & SCOPE_FUNCTION) {
3166
- return (scope.flags & SCOPE_ASYNC) > 0;
3167
+ if (flags & SCOPE_FUNCTION) {
3168
+ return (flags & SCOPE_ASYNC) > 0;
3167
3169
  }
3168
3170
  }
3169
3171
  return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction;
3170
3172
  };
3173
+ prototypeAccessors.allowReturn.get = function () {
3174
+ if (this.inFunction) {
3175
+ return true;
3176
+ }
3177
+ if (this.options.allowReturnOutsideFunction && this.currentVarScope().flags & SCOPE_TOP) {
3178
+ return true;
3179
+ }
3180
+ return false;
3181
+ };
3171
3182
  prototypeAccessors.allowSuper.get = function () {
3172
3183
  var ref = this.currentThisScope();
3173
3184
  var flags = ref.flags;
3174
- var inClassFieldInit = ref.inClassFieldInit;
3175
- return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod;
3185
+ return (flags & SCOPE_SUPER) > 0 || this.options.allowSuperOutsideMethod;
3176
3186
  };
3177
3187
  prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0; };
3178
3188
  prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()); };
3179
3189
  prototypeAccessors.allowNewDotTarget.get = function () {
3180
- var ref = this.currentThisScope();
3190
+ for (var i = this.scopeStack.length - 1; i >= 0; i--) {
3191
+ var ref = this.scopeStack[i];
3192
+ var flags = ref.flags;
3193
+ if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT) ||
3194
+ ((flags & SCOPE_FUNCTION) && !(flags & SCOPE_ARROW))) {
3195
+ return true;
3196
+ }
3197
+ }
3198
+ return false;
3199
+ };
3200
+ prototypeAccessors.allowUsing.get = function () {
3201
+ var ref = this.currentScope();
3181
3202
  var flags = ref.flags;
3182
- var inClassFieldInit = ref.inClassFieldInit;
3183
- return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit;
3203
+ if (flags & SCOPE_SWITCH) {
3204
+ return false;
3205
+ }
3206
+ if (!this.inModule && flags & SCOPE_TOP) {
3207
+ return false;
3208
+ }
3209
+ return true;
3184
3210
  };
3185
3211
  prototypeAccessors.inClassStaticBlock.get = function () {
3186
3212
  return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0;
@@ -3208,7 +3234,7 @@ Parser$1.tokenizer = function tokenizer(input, options) {
3208
3234
  };
3209
3235
  Object.defineProperties(Parser$1.prototype, prototypeAccessors);
3210
3236
  var pp$9 = Parser$1.prototype;
3211
- var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;
3237
+ var literal = /^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;
3212
3238
  pp$9.strictDirective = function (start) {
3213
3239
  if (this.options.ecmaVersion < 5) {
3214
3240
  return false;
@@ -3347,12 +3373,12 @@ pp$9.isSimpleAssignTarget = function (expr) {
3347
3373
  };
3348
3374
  var pp$8 = Parser$1.prototype;
3349
3375
  pp$8.parseTopLevel = function (node) {
3350
- var exports$1 = Object.create(null);
3376
+ var exports = Object.create(null);
3351
3377
  if (!node.body) {
3352
3378
  node.body = [];
3353
3379
  }
3354
3380
  while (this.type !== types$1.eof) {
3355
- var stmt = this.parseStatement(null, true, exports$1);
3381
+ var stmt = this.parseStatement(null, true, exports);
3356
3382
  node.body.push(stmt);
3357
3383
  }
3358
3384
  if (this.inModule) {
@@ -3363,7 +3389,7 @@ pp$8.parseTopLevel = function (node) {
3363
3389
  }
3364
3390
  this.adaptDirectivePrologue(node.body);
3365
3391
  this.next();
3366
- node.sourceType = this.options.sourceType;
3392
+ node.sourceType = this.options.sourceType === "commonjs" ? "script" : this.options.sourceType;
3367
3393
  return this.finishNode(node, "Program");
3368
3394
  };
3369
3395
  var loopLabel = { kind: "loop" }, switchLabel = { kind: "switch" };
@@ -3373,25 +3399,25 @@ pp$8.isLet = function (context) {
3373
3399
  }
3374
3400
  skipWhiteSpace.lastIndex = this.pos;
3375
3401
  var skip = skipWhiteSpace.exec(this.input);
3376
- var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);
3402
+ var next = this.pos + skip[0].length, nextCh = this.fullCharCodeAt(next);
3377
3403
  if (nextCh === 91 || nextCh === 92) {
3378
3404
  return true;
3379
3405
  }
3380
3406
  if (context) {
3381
3407
  return false;
3382
3408
  }
3383
- if (nextCh === 123 || nextCh > 0xd7ff && nextCh < 0xdc00) {
3409
+ if (nextCh === 123) {
3384
3410
  return true;
3385
3411
  }
3386
- if (isIdentifierStart(nextCh, true)) {
3387
- var pos = next + 1;
3388
- while (isIdentifierChar(nextCh = this.input.charCodeAt(pos), true)) {
3389
- ++pos;
3390
- }
3391
- if (nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) {
3412
+ if (isIdentifierStart(nextCh)) {
3413
+ var start = next;
3414
+ do {
3415
+ next += nextCh <= 0xffff ? 1 : 2;
3416
+ } while (isIdentifierChar(nextCh = this.fullCharCodeAt(next)));
3417
+ if (nextCh === 92) {
3392
3418
  return true;
3393
3419
  }
3394
- var ident = this.input.slice(next, pos);
3420
+ var ident = this.input.slice(start, next);
3395
3421
  if (!keywordRelationalOperator.test(ident)) {
3396
3422
  return true;
3397
3423
  }
@@ -3408,9 +3434,57 @@ pp$8.isAsyncFunction = function () {
3408
3434
  return !lineBreak.test(this.input.slice(this.pos, next)) &&
3409
3435
  this.input.slice(next, next + 8) === "function" &&
3410
3436
  (next + 8 === this.input.length ||
3411
- !(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 0xd7ff && after < 0xdc00));
3437
+ !(isIdentifierChar(after = this.fullCharCodeAt(next + 8)) || after === 92 ));
3438
+ };
3439
+ pp$8.isUsingKeyword = function (isAwaitUsing, isFor) {
3440
+ if (this.options.ecmaVersion < 17 || !this.isContextual(isAwaitUsing ? "await" : "using")) {
3441
+ return false;
3442
+ }
3443
+ skipWhiteSpace.lastIndex = this.pos;
3444
+ var skip = skipWhiteSpace.exec(this.input);
3445
+ var next = this.pos + skip[0].length;
3446
+ if (lineBreak.test(this.input.slice(this.pos, next))) {
3447
+ return false;
3448
+ }
3449
+ if (isAwaitUsing) {
3450
+ var usingEndPos = next + 5 , after;
3451
+ if (this.input.slice(next, usingEndPos) !== "using" ||
3452
+ usingEndPos === this.input.length ||
3453
+ isIdentifierChar(after = this.fullCharCodeAt(usingEndPos)) ||
3454
+ after === 92 ) {
3455
+ return false;
3456
+ }
3457
+ skipWhiteSpace.lastIndex = usingEndPos;
3458
+ var skipAfterUsing = skipWhiteSpace.exec(this.input);
3459
+ next = usingEndPos + skipAfterUsing[0].length;
3460
+ if (skipAfterUsing && lineBreak.test(this.input.slice(usingEndPos, next))) {
3461
+ return false;
3462
+ }
3463
+ }
3464
+ var ch = this.fullCharCodeAt(next);
3465
+ if (!isIdentifierStart(ch) && ch !== 92 ) {
3466
+ return false;
3467
+ }
3468
+ var idStart = next;
3469
+ do {
3470
+ next += ch <= 0xffff ? 1 : 2;
3471
+ } while (isIdentifierChar(ch = this.fullCharCodeAt(next)));
3472
+ if (ch === 92) {
3473
+ return true;
3474
+ }
3475
+ var id = this.input.slice(idStart, next);
3476
+ if (keywordRelationalOperator.test(id) || isFor && id === "of") {
3477
+ return false;
3478
+ }
3479
+ return true;
3480
+ };
3481
+ pp$8.isAwaitUsing = function (isFor) {
3482
+ return this.isUsingKeyword(true, isFor);
3483
+ };
3484
+ pp$8.isUsing = function (isFor) {
3485
+ return this.isUsingKeyword(false, isFor);
3412
3486
  };
3413
- pp$8.parseStatement = function (context, topLevel, exports$1) {
3487
+ pp$8.parseStatement = function (context, topLevel, exports) {
3414
3488
  var starttype = this.type, node = this.startNode(), kind;
3415
3489
  if (this.isLet(context)) {
3416
3490
  starttype = types$1._var;
@@ -3467,7 +3541,7 @@ pp$8.parseStatement = function (context, topLevel, exports$1) {
3467
3541
  this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'");
3468
3542
  }
3469
3543
  }
3470
- return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports$1);
3544
+ return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports);
3471
3545
  default:
3472
3546
  if (this.isAsyncFunction()) {
3473
3547
  if (context) {
@@ -3476,6 +3550,22 @@ pp$8.parseStatement = function (context, topLevel, exports$1) {
3476
3550
  this.next();
3477
3551
  return this.parseFunctionStatement(node, true, !context);
3478
3552
  }
3553
+ var usingKind = this.isAwaitUsing(false) ? "await using" : this.isUsing(false) ? "using" : null;
3554
+ if (usingKind) {
3555
+ if (!this.allowUsing) {
3556
+ this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement");
3557
+ }
3558
+ if (usingKind === "await using") {
3559
+ if (!this.canAwait) {
3560
+ this.raise(this.start, "Await using cannot appear outside of async function");
3561
+ }
3562
+ this.next();
3563
+ }
3564
+ this.next();
3565
+ this.parseVar(node, false, usingKind);
3566
+ this.semicolon();
3567
+ return this.finishNode(node, "VariableDeclaration");
3568
+ }
3479
3569
  var maybeName = this.value, expr = this.parseExpression();
3480
3570
  if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon)) {
3481
3571
  return this.parseLabeledStatement(node, maybeName, expr, context);
@@ -3553,36 +3643,42 @@ pp$8.parseForStatement = function (node) {
3553
3643
  this.next();
3554
3644
  this.parseVar(init$1, true, kind);
3555
3645
  this.finishNode(init$1, "VariableDeclaration");
3556
- if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init$1.declarations.length === 1) {
3557
- if (this.options.ecmaVersion >= 9) {
3558
- if (this.type === types$1._in) {
3559
- if (awaitAt > -1) {
3560
- this.unexpected(awaitAt);
3561
- }
3562
- }
3563
- else {
3564
- node.await = awaitAt > -1;
3565
- }
3646
+ return this.parseForAfterInit(node, init$1, awaitAt);
3647
+ }
3648
+ var startsWithLet = this.isContextual("let"), isForOf = false;
3649
+ var usingKind = this.isUsing(true) ? "using" : this.isAwaitUsing(true) ? "await using" : null;
3650
+ if (usingKind) {
3651
+ var init$2 = this.startNode();
3652
+ this.next();
3653
+ if (usingKind === "await using") {
3654
+ if (!this.canAwait) {
3655
+ this.raise(this.start, "Await using cannot appear outside of async function");
3566
3656
  }
3567
- return this.parseForIn(node, init$1);
3568
- }
3569
- if (awaitAt > -1) {
3570
- this.unexpected(awaitAt);
3657
+ this.next();
3571
3658
  }
3572
- return this.parseFor(node, init$1);
3659
+ this.parseVar(init$2, true, usingKind);
3660
+ this.finishNode(init$2, "VariableDeclaration");
3661
+ return this.parseForAfterInit(node, init$2, awaitAt);
3573
3662
  }
3574
- var startsWithLet = this.isContextual("let"), isForOf = false;
3663
+ var containsEsc = this.containsEsc;
3575
3664
  var refDestructuringErrors = new DestructuringErrors;
3576
- var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors);
3665
+ var initPos = this.start;
3666
+ var init = awaitAt > -1
3667
+ ? this.parseExprSubscripts(refDestructuringErrors, "await")
3668
+ : this.parseExpression(true, refDestructuringErrors);
3577
3669
  if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
3578
- if (this.options.ecmaVersion >= 9) {
3670
+ if (awaitAt > -1) {
3579
3671
  if (this.type === types$1._in) {
3580
- if (awaitAt > -1) {
3581
- this.unexpected(awaitAt);
3582
- }
3672
+ this.unexpected(awaitAt);
3583
3673
  }
3584
- else {
3585
- node.await = awaitAt > -1;
3674
+ node.await = true;
3675
+ }
3676
+ else if (isForOf && this.options.ecmaVersion >= 8) {
3677
+ if (init.start === initPos && !containsEsc && init.type === "Identifier" && init.name === "async") {
3678
+ this.unexpected();
3679
+ }
3680
+ else if (this.options.ecmaVersion >= 9) {
3681
+ node.await = false;
3586
3682
  }
3587
3683
  }
3588
3684
  if (startsWithLet && isForOf) {
@@ -3600,6 +3696,25 @@ pp$8.parseForStatement = function (node) {
3600
3696
  }
3601
3697
  return this.parseFor(node, init);
3602
3698
  };
3699
+ pp$8.parseForAfterInit = function (node, init, awaitAt) {
3700
+ if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init.declarations.length === 1) {
3701
+ if (this.options.ecmaVersion >= 9) {
3702
+ if (this.type === types$1._in) {
3703
+ if (awaitAt > -1) {
3704
+ this.unexpected(awaitAt);
3705
+ }
3706
+ }
3707
+ else {
3708
+ node.await = awaitAt > -1;
3709
+ }
3710
+ }
3711
+ return this.parseForIn(node, init);
3712
+ }
3713
+ if (awaitAt > -1) {
3714
+ this.unexpected(awaitAt);
3715
+ }
3716
+ return this.parseFor(node, init);
3717
+ };
3603
3718
  pp$8.parseFunctionStatement = function (node, isAsync, declarationPosition) {
3604
3719
  this.next();
3605
3720
  return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync);
@@ -3612,7 +3727,7 @@ pp$8.parseIfStatement = function (node) {
3612
3727
  return this.finishNode(node, "IfStatement");
3613
3728
  };
3614
3729
  pp$8.parseReturnStatement = function (node) {
3615
- if (!this.inFunction && !this.options.allowReturnOutsideFunction) {
3730
+ if (!this.allowReturn) {
3616
3731
  this.raise(this.start, "'return' outside of function");
3617
3732
  }
3618
3733
  this.next();
@@ -3631,7 +3746,7 @@ pp$8.parseSwitchStatement = function (node) {
3631
3746
  node.cases = [];
3632
3747
  this.expect(types$1.braceL);
3633
3748
  this.labels.push(switchLabel);
3634
- this.enterScope(0);
3749
+ this.enterScope(SCOPE_SWITCH);
3635
3750
  var cur;
3636
3751
  for (var sawDefault = false; this.type !== types$1.braceR;) {
3637
3752
  if (this.type === types$1._case || this.type === types$1._default) {
@@ -3837,6 +3952,9 @@ pp$8.parseVar = function (node, isFor, kind, allowMissingInitializer) {
3837
3952
  else if (!allowMissingInitializer && kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
3838
3953
  this.unexpected();
3839
3954
  }
3955
+ else if (!allowMissingInitializer && (kind === "using" || kind === "await using") && this.options.ecmaVersion >= 17 && this.type !== types$1._in && !this.isContextual("of")) {
3956
+ this.raise(this.lastTokEnd, ("Missing initializer in " + kind + " declaration"));
3957
+ }
3840
3958
  else if (!allowMissingInitializer && decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
3841
3959
  this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
3842
3960
  }
@@ -3851,7 +3969,9 @@ pp$8.parseVar = function (node, isFor, kind, allowMissingInitializer) {
3851
3969
  return node;
3852
3970
  };
3853
3971
  pp$8.parseVarId = function (decl, kind) {
3854
- decl.id = this.parseBindingAtom();
3972
+ decl.id = kind === "using" || kind === "await using"
3973
+ ? this.parseIdent()
3974
+ : this.parseBindingAtom();
3855
3975
  this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
3856
3976
  };
3857
3977
  var FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;
@@ -4047,11 +4167,9 @@ pp$8.parseClassField = function (field) {
4047
4167
  this.raise(field.key.start, "Classes can't have a static field named 'prototype'");
4048
4168
  }
4049
4169
  if (this.eat(types$1.eq)) {
4050
- var scope = this.currentThisScope();
4051
- var inClassFieldInit = scope.inClassFieldInit;
4052
- scope.inClassFieldInit = true;
4170
+ this.enterScope(SCOPE_CLASS_FIELD_INIT | SCOPE_SUPER);
4053
4171
  field.value = this.parseMaybeAssign();
4054
- scope.inClassFieldInit = inClassFieldInit;
4172
+ this.exitScope();
4055
4173
  }
4056
4174
  else {
4057
4175
  field.value = null;
@@ -4144,11 +4262,11 @@ function checkKeyName(node, name) {
4144
4262
  return !computed && (key.type === "Identifier" && key.name === name ||
4145
4263
  key.type === "Literal" && key.value === name);
4146
4264
  }
4147
- pp$8.parseExportAllDeclaration = function (node, exports$1) {
4265
+ pp$8.parseExportAllDeclaration = function (node, exports) {
4148
4266
  if (this.options.ecmaVersion >= 11) {
4149
4267
  if (this.eatContextual("as")) {
4150
4268
  node.exported = this.parseModuleExportName();
4151
- this.checkExport(exports$1, node.exported, this.lastTokStart);
4269
+ this.checkExport(exports, node.exported, this.lastTokStart);
4152
4270
  }
4153
4271
  else {
4154
4272
  node.exported = null;
@@ -4159,38 +4277,47 @@ pp$8.parseExportAllDeclaration = function (node, exports$1) {
4159
4277
  this.unexpected();
4160
4278
  }
4161
4279
  node.source = this.parseExprAtom();
4280
+ if (this.options.ecmaVersion >= 16) {
4281
+ node.attributes = this.parseWithClause();
4282
+ }
4162
4283
  this.semicolon();
4163
4284
  return this.finishNode(node, "ExportAllDeclaration");
4164
4285
  };
4165
- pp$8.parseExport = function (node, exports$1) {
4286
+ pp$8.parseExport = function (node, exports) {
4166
4287
  this.next();
4167
4288
  if (this.eat(types$1.star)) {
4168
- return this.parseExportAllDeclaration(node, exports$1);
4289
+ return this.parseExportAllDeclaration(node, exports);
4169
4290
  }
4170
4291
  if (this.eat(types$1._default)) {
4171
- this.checkExport(exports$1, "default", this.lastTokStart);
4292
+ this.checkExport(exports, "default", this.lastTokStart);
4172
4293
  node.declaration = this.parseExportDefaultDeclaration();
4173
4294
  return this.finishNode(node, "ExportDefaultDeclaration");
4174
4295
  }
4175
4296
  if (this.shouldParseExportStatement()) {
4176
4297
  node.declaration = this.parseExportDeclaration(node);
4177
4298
  if (node.declaration.type === "VariableDeclaration") {
4178
- this.checkVariableExport(exports$1, node.declaration.declarations);
4299
+ this.checkVariableExport(exports, node.declaration.declarations);
4179
4300
  }
4180
4301
  else {
4181
- this.checkExport(exports$1, node.declaration.id, node.declaration.id.start);
4302
+ this.checkExport(exports, node.declaration.id, node.declaration.id.start);
4182
4303
  }
4183
4304
  node.specifiers = [];
4184
4305
  node.source = null;
4306
+ if (this.options.ecmaVersion >= 16) {
4307
+ node.attributes = [];
4308
+ }
4185
4309
  }
4186
4310
  else {
4187
4311
  node.declaration = null;
4188
- node.specifiers = this.parseExportSpecifiers(exports$1);
4312
+ node.specifiers = this.parseExportSpecifiers(exports);
4189
4313
  if (this.eatContextual("from")) {
4190
4314
  if (this.type !== types$1.string) {
4191
4315
  this.unexpected();
4192
4316
  }
4193
4317
  node.source = this.parseExprAtom();
4318
+ if (this.options.ecmaVersion >= 16) {
4319
+ node.attributes = this.parseWithClause();
4320
+ }
4194
4321
  }
4195
4322
  else {
4196
4323
  for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
@@ -4202,6 +4329,9 @@ pp$8.parseExport = function (node, exports$1) {
4202
4329
  }
4203
4330
  }
4204
4331
  node.source = null;
4332
+ if (this.options.ecmaVersion >= 16) {
4333
+ node.attributes = [];
4334
+ }
4205
4335
  }
4206
4336
  this.semicolon();
4207
4337
  }
@@ -4230,57 +4360,54 @@ pp$8.parseExportDefaultDeclaration = function () {
4230
4360
  return declaration;
4231
4361
  }
4232
4362
  };
4233
- pp$8.checkExport = function (exports$1, name, pos) {
4234
- if (!exports$1) {
4363
+ pp$8.checkExport = function (exports, name, pos) {
4364
+ if (!exports) {
4235
4365
  return;
4236
4366
  }
4237
4367
  if (typeof name !== "string") {
4238
4368
  name = name.type === "Identifier" ? name.name : name.value;
4239
4369
  }
4240
- if (hasOwn(exports$1, name)) {
4370
+ if (hasOwn(exports, name)) {
4241
4371
  this.raiseRecoverable(pos, "Duplicate export '" + name + "'");
4242
4372
  }
4243
- exports$1[name] = true;
4373
+ exports[name] = true;
4244
4374
  };
4245
- pp$8.checkPatternExport = function (exports$1, pat) {
4375
+ pp$8.checkPatternExport = function (exports, pat) {
4246
4376
  var type = pat.type;
4247
4377
  if (type === "Identifier") {
4248
- this.checkExport(exports$1, pat, pat.start);
4378
+ this.checkExport(exports, pat, pat.start);
4249
4379
  }
4250
4380
  else if (type === "ObjectPattern") {
4251
4381
  for (var i = 0, list = pat.properties; i < list.length; i += 1) {
4252
4382
  var prop = list[i];
4253
- this.checkPatternExport(exports$1, prop);
4383
+ this.checkPatternExport(exports, prop);
4254
4384
  }
4255
4385
  }
4256
4386
  else if (type === "ArrayPattern") {
4257
4387
  for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
4258
4388
  var elt = list$1[i$1];
4259
4389
  if (elt) {
4260
- this.checkPatternExport(exports$1, elt);
4390
+ this.checkPatternExport(exports, elt);
4261
4391
  }
4262
4392
  }
4263
4393
  }
4264
4394
  else if (type === "Property") {
4265
- this.checkPatternExport(exports$1, pat.value);
4395
+ this.checkPatternExport(exports, pat.value);
4266
4396
  }
4267
4397
  else if (type === "AssignmentPattern") {
4268
- this.checkPatternExport(exports$1, pat.left);
4398
+ this.checkPatternExport(exports, pat.left);
4269
4399
  }
4270
4400
  else if (type === "RestElement") {
4271
- this.checkPatternExport(exports$1, pat.argument);
4272
- }
4273
- else if (type === "ParenthesizedExpression") {
4274
- this.checkPatternExport(exports$1, pat.expression);
4401
+ this.checkPatternExport(exports, pat.argument);
4275
4402
  }
4276
4403
  };
4277
- pp$8.checkVariableExport = function (exports$1, decls) {
4278
- if (!exports$1) {
4404
+ pp$8.checkVariableExport = function (exports, decls) {
4405
+ if (!exports) {
4279
4406
  return;
4280
4407
  }
4281
4408
  for (var i = 0, list = decls; i < list.length; i += 1) {
4282
4409
  var decl = list[i];
4283
- this.checkPatternExport(exports$1, decl.id);
4410
+ this.checkPatternExport(exports, decl.id);
4284
4411
  }
4285
4412
  };
4286
4413
  pp$8.shouldParseExportStatement = function () {
@@ -4291,14 +4418,14 @@ pp$8.shouldParseExportStatement = function () {
4291
4418
  this.isLet() ||
4292
4419
  this.isAsyncFunction();
4293
4420
  };
4294
- pp$8.parseExportSpecifier = function (exports$1) {
4421
+ pp$8.parseExportSpecifier = function (exports) {
4295
4422
  var node = this.startNode();
4296
4423
  node.local = this.parseModuleExportName();
4297
4424
  node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
4298
- this.checkExport(exports$1, node.exported, node.exported.start);
4425
+ this.checkExport(exports, node.exported, node.exported.start);
4299
4426
  return this.finishNode(node, "ExportSpecifier");
4300
4427
  };
4301
- pp$8.parseExportSpecifiers = function (exports$1) {
4428
+ pp$8.parseExportSpecifiers = function (exports) {
4302
4429
  var nodes = [], first = true;
4303
4430
  this.expect(types$1.braceL);
4304
4431
  while (!this.eat(types$1.braceR)) {
@@ -4311,7 +4438,7 @@ pp$8.parseExportSpecifiers = function (exports$1) {
4311
4438
  else {
4312
4439
  first = false;
4313
4440
  }
4314
- nodes.push(this.parseExportSpecifier(exports$1));
4441
+ nodes.push(this.parseExportSpecifier(exports));
4315
4442
  }
4316
4443
  return nodes;
4317
4444
  };
@@ -4326,6 +4453,9 @@ pp$8.parseImport = function (node) {
4326
4453
  this.expectContextual("from");
4327
4454
  node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected();
4328
4455
  }
4456
+ if (this.options.ecmaVersion >= 16) {
4457
+ node.attributes = this.parseWithClause();
4458
+ }
4329
4459
  this.semicolon();
4330
4460
  return this.finishNode(node, "ImportDeclaration");
4331
4461
  };
@@ -4383,6 +4513,44 @@ pp$8.parseImportSpecifiers = function () {
4383
4513
  }
4384
4514
  return nodes;
4385
4515
  };
4516
+ pp$8.parseWithClause = function () {
4517
+ var nodes = [];
4518
+ if (!this.eat(types$1._with)) {
4519
+ return nodes;
4520
+ }
4521
+ this.expect(types$1.braceL);
4522
+ var attributeKeys = {};
4523
+ var first = true;
4524
+ while (!this.eat(types$1.braceR)) {
4525
+ if (!first) {
4526
+ this.expect(types$1.comma);
4527
+ if (this.afterTrailingComma(types$1.braceR)) {
4528
+ break;
4529
+ }
4530
+ }
4531
+ else {
4532
+ first = false;
4533
+ }
4534
+ var attr = this.parseImportAttribute();
4535
+ var keyName = attr.key.type === "Identifier" ? attr.key.name : attr.key.value;
4536
+ if (hasOwn(attributeKeys, keyName)) {
4537
+ this.raiseRecoverable(attr.key.start, "Duplicate attribute key '" + keyName + "'");
4538
+ }
4539
+ attributeKeys[keyName] = true;
4540
+ nodes.push(attr);
4541
+ }
4542
+ return nodes;
4543
+ };
4544
+ pp$8.parseImportAttribute = function () {
4545
+ var node = this.startNode();
4546
+ node.key = this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never");
4547
+ this.expect(types$1.colon);
4548
+ if (this.type !== types$1.string) {
4549
+ this.unexpected();
4550
+ }
4551
+ node.value = this.parseExprAtom();
4552
+ return this.finishNode(node, "ImportAttribute");
4553
+ };
4386
4554
  pp$8.parseModuleExportName = function () {
4387
4555
  if (this.options.ecmaVersion >= 13 && this.type === types$1.string) {
4388
4556
  var stringLiteral = this.parseLiteral(this.value);
@@ -4766,6 +4934,12 @@ types$1._function.updateContext = types$1._class.updateContext = function (prevT
4766
4934
  }
4767
4935
  this.exprAllowed = false;
4768
4936
  };
4937
+ types$1.colon.updateContext = function () {
4938
+ if (this.curContext().token === "function") {
4939
+ this.context.pop();
4940
+ }
4941
+ this.exprAllowed = true;
4942
+ };
4769
4943
  types$1.backQuote.updateContext = function () {
4770
4944
  if (this.curContext() === types.q_tmpl) {
4771
4945
  this.context.pop();
@@ -5009,8 +5183,7 @@ pp$5.parseMaybeUnary = function (refDestructuringErrors, sawUnary, incDec, forIn
5009
5183
  if (update) {
5010
5184
  this.checkLValSimple(node.argument);
5011
5185
  }
5012
- else if (this.strict && node.operator === "delete" &&
5013
- node.argument.type === "Identifier") {
5186
+ else if (this.strict && node.operator === "delete" && isLocalVariableAccess(node.argument)) {
5014
5187
  this.raiseRecoverable(node.start, "Deleting local variable in strict mode");
5015
5188
  }
5016
5189
  else if (node.operator === "delete" && isPrivateFieldAccess(node.argument)) {
@@ -5057,9 +5230,14 @@ pp$5.parseMaybeUnary = function (refDestructuringErrors, sawUnary, incDec, forIn
5057
5230
  return expr;
5058
5231
  }
5059
5232
  };
5233
+ function isLocalVariableAccess(node) {
5234
+ return (node.type === "Identifier" ||
5235
+ node.type === "ParenthesizedExpression" && isLocalVariableAccess(node.expression));
5236
+ }
5060
5237
  function isPrivateFieldAccess(node) {
5061
5238
  return (node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" ||
5062
- node.type === "ChainExpression" && isPrivateFieldAccess(node.expression));
5239
+ node.type === "ChainExpression" && isPrivateFieldAccess(node.expression) ||
5240
+ node.type === "ParenthesizedExpression" && isPrivateFieldAccess(node.expression));
5063
5241
  }
5064
5242
  pp$5.parseExprSubscripts = function (refDestructuringErrors, forInit) {
5065
5243
  var startPos = this.start, startLoc = this.startLoc;
@@ -5282,12 +5460,14 @@ pp$5.parseExprImport = function (forNew) {
5282
5460
  if (this.containsEsc) {
5283
5461
  this.raiseRecoverable(this.start, "Escape sequence in keyword import");
5284
5462
  }
5285
- var meta = this.parseIdent(true);
5463
+ this.next();
5286
5464
  if (this.type === types$1.parenL && !forNew) {
5287
5465
  return this.parseDynamicImport(node);
5288
5466
  }
5289
5467
  else if (this.type === types$1.dot) {
5290
- node.meta = meta;
5468
+ var meta = this.startNodeAt(node.start, node.loc && node.loc.start);
5469
+ meta.name = "import";
5470
+ node.meta = this.finishNode(meta, "Identifier");
5291
5471
  return this.parseImportMeta(node);
5292
5472
  }
5293
5473
  else {
@@ -5297,13 +5477,35 @@ pp$5.parseExprImport = function (forNew) {
5297
5477
  pp$5.parseDynamicImport = function (node) {
5298
5478
  this.next();
5299
5479
  node.source = this.parseMaybeAssign();
5300
- if (!this.eat(types$1.parenR)) {
5301
- var errorPos = this.start;
5302
- if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
5303
- this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
5480
+ if (this.options.ecmaVersion >= 16) {
5481
+ if (!this.eat(types$1.parenR)) {
5482
+ this.expect(types$1.comma);
5483
+ if (!this.afterTrailingComma(types$1.parenR)) {
5484
+ node.options = this.parseMaybeAssign();
5485
+ if (!this.eat(types$1.parenR)) {
5486
+ this.expect(types$1.comma);
5487
+ if (!this.afterTrailingComma(types$1.parenR)) {
5488
+ this.unexpected();
5489
+ }
5490
+ }
5491
+ }
5492
+ else {
5493
+ node.options = null;
5494
+ }
5304
5495
  }
5305
5496
  else {
5306
- this.unexpected(errorPos);
5497
+ node.options = null;
5498
+ }
5499
+ }
5500
+ else {
5501
+ if (!this.eat(types$1.parenR)) {
5502
+ var errorPos = this.start;
5503
+ if (this.eat(types$1.comma) && this.eat(types$1.parenR)) {
5504
+ this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()");
5505
+ }
5506
+ else {
5507
+ this.unexpected(errorPos);
5508
+ }
5307
5509
  }
5308
5510
  }
5309
5511
  return this.finishNode(node, "ImportExpression");
@@ -5328,7 +5530,7 @@ pp$5.parseLiteral = function (value) {
5328
5530
  node.value = value;
5329
5531
  node.raw = this.input.slice(this.start, this.end);
5330
5532
  if (node.raw.charCodeAt(node.raw.length - 1) === 110) {
5331
- node.bigint = node.raw.slice(0, -1).replace(/_/g, "");
5533
+ node.bigint = node.value != null ? node.value.toString() : node.raw.slice(0, -1).replace(/_/g, "");
5332
5534
  }
5333
5535
  this.next();
5334
5536
  return this.finishNode(node, "Literal");
@@ -5420,9 +5622,12 @@ pp$5.parseNew = function () {
5420
5622
  this.raiseRecoverable(this.start, "Escape sequence in keyword new");
5421
5623
  }
5422
5624
  var node = this.startNode();
5423
- var meta = this.parseIdent(true);
5424
- if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) {
5425
- node.meta = meta;
5625
+ this.next();
5626
+ if (this.options.ecmaVersion >= 6 && this.type === types$1.dot) {
5627
+ var meta = this.startNodeAt(node.start, node.loc && node.loc.start);
5628
+ meta.name = "new";
5629
+ node.meta = this.finishNode(meta, "Identifier");
5630
+ this.next();
5426
5631
  var containsEsc = this.containsEsc;
5427
5632
  node.property = this.parseIdent(true);
5428
5633
  if (node.property.name !== "target") {
@@ -5454,7 +5659,7 @@ pp$5.parseTemplateElement = function (ref) {
5454
5659
  this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
5455
5660
  }
5456
5661
  elem.value = {
5457
- raw: this.value,
5662
+ raw: this.value.replace(/\r\n?/g, "\n"),
5458
5663
  cooked: null
5459
5664
  };
5460
5665
  }
@@ -5559,9 +5764,10 @@ pp$5.parseProperty = function (isPattern, refDestructuringErrors) {
5559
5764
  return this.finishNode(prop, "Property");
5560
5765
  };
5561
5766
  pp$5.parseGetterSetter = function (prop) {
5562
- prop.kind = prop.key.name;
5767
+ var kind = prop.key.name;
5563
5768
  this.parsePropertyName(prop);
5564
5769
  prop.value = this.parseMethod(false);
5770
+ prop.kind = kind;
5565
5771
  var paramCount = prop.kind === "get" ? 0 : 1;
5566
5772
  if (prop.value.params.length !== paramCount) {
5567
5773
  var start = prop.value.start;
@@ -5590,9 +5796,9 @@ pp$5.parsePropertyValue = function (prop, isPattern, isGenerator, isAsync, start
5590
5796
  if (isPattern) {
5591
5797
  this.unexpected();
5592
5798
  }
5593
- prop.kind = "init";
5594
5799
  prop.method = true;
5595
5800
  prop.value = this.parseMethod(isGenerator, isAsync);
5801
+ prop.kind = "init";
5596
5802
  }
5597
5803
  else if (!isPattern && !containsEsc &&
5598
5804
  this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" &&
@@ -5611,7 +5817,6 @@ pp$5.parsePropertyValue = function (prop, isPattern, isGenerator, isAsync, start
5611
5817
  if (prop.key.name === "await" && !this.awaitIdentPos) {
5612
5818
  this.awaitIdentPos = startPos;
5613
5819
  }
5614
- prop.kind = "init";
5615
5820
  if (isPattern) {
5616
5821
  prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key));
5617
5822
  }
@@ -5624,6 +5829,7 @@ pp$5.parsePropertyValue = function (prop, isPattern, isGenerator, isAsync, start
5624
5829
  else {
5625
5830
  prop.value = this.copyNode(prop.key);
5626
5831
  }
5832
+ prop.kind = "init";
5627
5833
  prop.shorthand = true;
5628
5834
  }
5629
5835
  else {
@@ -5779,7 +5985,7 @@ pp$5.checkUnreserved = function (ref) {
5779
5985
  if (this.inAsync && name === "await") {
5780
5986
  this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function");
5781
5987
  }
5782
- if (this.currentThisScope().inClassFieldInit && name === "arguments") {
5988
+ if (!(this.currentThisScope().flags & SCOPE_VAR) && name === "arguments") {
5783
5989
  this.raiseRecoverable(start, "Cannot use 'arguments' in class field initializer");
5784
5990
  }
5785
5991
  if (this.inClassStaticBlock && (name === "arguments" || name === "await")) {
@@ -5823,6 +6029,7 @@ pp$5.parseIdentNode = function () {
5823
6029
  (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
5824
6030
  this.context.pop();
5825
6031
  }
6032
+ this.type = types$1.name;
5826
6033
  }
5827
6034
  else {
5828
6035
  this.unexpected();
@@ -5878,6 +6085,9 @@ var pp$4 = Parser$1.prototype;
5878
6085
  pp$4.raise = function (pos, message) {
5879
6086
  var loc = getLineInfo(this.input, pos);
5880
6087
  message += " (" + loc.line + ":" + loc.column + ")";
6088
+ if (this.sourceFile) {
6089
+ message += " in " + this.sourceFile;
6090
+ }
5881
6091
  var err = new SyntaxError(message);
5882
6092
  err.pos = pos;
5883
6093
  err.loc = loc;
@@ -5896,7 +6106,6 @@ var Scope$1 = function Scope(flags) {
5896
6106
  this.var = [];
5897
6107
  this.lexical = [];
5898
6108
  this.functions = [];
5899
- this.inClassFieldInit = false;
5900
6109
  };
5901
6110
  pp$3.enterScope = function (flags) {
5902
6111
  this.scopeStack.push(new Scope$1(flags));
@@ -5964,7 +6173,7 @@ pp$3.currentScope = function () {
5964
6173
  pp$3.currentVarScope = function () {
5965
6174
  for (var i = this.scopeStack.length - 1;; i--) {
5966
6175
  var scope = this.scopeStack[i];
5967
- if (scope.flags & SCOPE_VAR) {
6176
+ if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK)) {
5968
6177
  return scope;
5969
6178
  }
5970
6179
  }
@@ -5972,7 +6181,8 @@ pp$3.currentVarScope = function () {
5972
6181
  pp$3.currentThisScope = function () {
5973
6182
  for (var i = this.scopeStack.length - 1;; i--) {
5974
6183
  var scope = this.scopeStack[i];
5975
- if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) {
6184
+ if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK) &&
6185
+ !(scope.flags & SCOPE_ARROW)) {
5976
6186
  return scope;
5977
6187
  }
5978
6188
  }
@@ -6022,6 +6232,7 @@ pp$2.copyNode = function (node) {
6022
6232
  }
6023
6233
  return newNode;
6024
6234
  };
6235
+ var scriptValuesAddedInUnicode = "Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz";
6025
6236
  var ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS";
6026
6237
  var ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic";
6027
6238
  var ecma11BinaryProperties = ecma10BinaryProperties;
@@ -6051,7 +6262,7 @@ var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Han
6051
6262
  var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
6052
6263
  var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
6053
6264
  var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith";
6054
- var ecma14ScriptValues = ecma13ScriptValues + " Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz";
6265
+ var ecma14ScriptValues = ecma13ScriptValues + " " + scriptValuesAddedInUnicode;
6055
6266
  var unicodeScriptValues = {
6056
6267
  9: ecma9ScriptValues,
6057
6268
  10: ecma10ScriptValues,
@@ -6080,6 +6291,23 @@ for (var i = 0, list = [9, 10, 11, 12, 13, 14]; i < list.length; i += 1) {
6080
6291
  buildUnicodeData(ecmaVersion);
6081
6292
  }
6082
6293
  var pp$1 = Parser$1.prototype;
6294
+ var BranchID = function BranchID(parent, base) {
6295
+ this.parent = parent;
6296
+ this.base = base || this;
6297
+ };
6298
+ BranchID.prototype.separatedFrom = function separatedFrom(alt) {
6299
+ for (var self = this; self; self = self.parent) {
6300
+ for (var other = alt; other; other = other.parent) {
6301
+ if (self.base === other.base && self !== other) {
6302
+ return true;
6303
+ }
6304
+ }
6305
+ }
6306
+ return false;
6307
+ };
6308
+ BranchID.prototype.sibling = function sibling() {
6309
+ return new BranchID(this.parent, this.base);
6310
+ };
6083
6311
  var RegExpValidationState = function RegExpValidationState(parser) {
6084
6312
  this.parser = parser;
6085
6313
  this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : "");
@@ -6096,8 +6324,9 @@ var RegExpValidationState = function RegExpValidationState(parser) {
6096
6324
  this.lastAssertionIsQuantifiable = false;
6097
6325
  this.numCapturingParens = 0;
6098
6326
  this.maxBackReference = 0;
6099
- this.groupNames = [];
6327
+ this.groupNames = Object.create(null);
6100
6328
  this.backReferenceNames = [];
6329
+ this.branchID = null;
6101
6330
  };
6102
6331
  RegExpValidationState.prototype.reset = function reset(start, pattern, flags) {
6103
6332
  var unicodeSets = flags.indexOf("v") !== -1;
@@ -6212,9 +6441,15 @@ pp$1.validateRegExpFlags = function (state) {
6212
6441
  this.raise(state.start, "Invalid regular expression flag");
6213
6442
  }
6214
6443
  };
6444
+ function hasProp(obj) {
6445
+ for (var _ in obj) {
6446
+ return true;
6447
+ }
6448
+ return false;
6449
+ }
6215
6450
  pp$1.validateRegExpPattern = function (state) {
6216
6451
  this.regexp_pattern(state);
6217
- if (!state.switchN && this.options.ecmaVersion >= 9 && state.groupNames.length > 0) {
6452
+ if (!state.switchN && this.options.ecmaVersion >= 9 && hasProp(state.groupNames)) {
6218
6453
  state.switchN = true;
6219
6454
  this.regexp_pattern(state);
6220
6455
  }
@@ -6226,8 +6461,9 @@ pp$1.regexp_pattern = function (state) {
6226
6461
  state.lastAssertionIsQuantifiable = false;
6227
6462
  state.numCapturingParens = 0;
6228
6463
  state.maxBackReference = 0;
6229
- state.groupNames.length = 0;
6464
+ state.groupNames = Object.create(null);
6230
6465
  state.backReferenceNames.length = 0;
6466
+ state.branchID = null;
6231
6467
  this.regexp_disjunction(state);
6232
6468
  if (state.pos !== state.source.length) {
6233
6469
  if (state.eat(0x29 )) {
@@ -6242,16 +6478,26 @@ pp$1.regexp_pattern = function (state) {
6242
6478
  }
6243
6479
  for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) {
6244
6480
  var name = list[i];
6245
- if (state.groupNames.indexOf(name) === -1) {
6481
+ if (!state.groupNames[name]) {
6246
6482
  state.raise("Invalid named capture referenced");
6247
6483
  }
6248
6484
  }
6249
6485
  };
6250
6486
  pp$1.regexp_disjunction = function (state) {
6487
+ var trackDisjunction = this.options.ecmaVersion >= 16;
6488
+ if (trackDisjunction) {
6489
+ state.branchID = new BranchID(state.branchID, null);
6490
+ }
6251
6491
  this.regexp_alternative(state);
6252
6492
  while (state.eat(0x7C )) {
6493
+ if (trackDisjunction) {
6494
+ state.branchID = state.branchID.sibling();
6495
+ }
6253
6496
  this.regexp_alternative(state);
6254
6497
  }
6498
+ if (trackDisjunction) {
6499
+ state.branchID = state.branchID.parent;
6500
+ }
6255
6501
  if (this.regexp_eatQuantifier(state, true)) {
6256
6502
  state.raise("Nothing to repeat");
6257
6503
  }
@@ -6365,12 +6611,39 @@ pp$1.regexp_eatReverseSolidusAtomEscape = function (state) {
6365
6611
  pp$1.regexp_eatUncapturingGroup = function (state) {
6366
6612
  var start = state.pos;
6367
6613
  if (state.eat(0x28 )) {
6368
- if (state.eat(0x3F ) && state.eat(0x3A )) {
6369
- this.regexp_disjunction(state);
6370
- if (state.eat(0x29 )) {
6371
- return true;
6614
+ if (state.eat(0x3F )) {
6615
+ if (this.options.ecmaVersion >= 16) {
6616
+ var addModifiers = this.regexp_eatModifiers(state);
6617
+ var hasHyphen = state.eat(0x2D );
6618
+ if (addModifiers || hasHyphen) {
6619
+ for (var i = 0; i < addModifiers.length; i++) {
6620
+ var modifier = addModifiers.charAt(i);
6621
+ if (addModifiers.indexOf(modifier, i + 1) > -1) {
6622
+ state.raise("Duplicate regular expression modifiers");
6623
+ }
6624
+ }
6625
+ if (hasHyphen) {
6626
+ var removeModifiers = this.regexp_eatModifiers(state);
6627
+ if (!addModifiers && !removeModifiers && state.current() === 0x3A ) {
6628
+ state.raise("Invalid regular expression modifiers");
6629
+ }
6630
+ for (var i$1 = 0; i$1 < removeModifiers.length; i$1++) {
6631
+ var modifier$1 = removeModifiers.charAt(i$1);
6632
+ if (removeModifiers.indexOf(modifier$1, i$1 + 1) > -1 ||
6633
+ addModifiers.indexOf(modifier$1) > -1) {
6634
+ state.raise("Duplicate regular expression modifiers");
6635
+ }
6636
+ }
6637
+ }
6638
+ }
6639
+ }
6640
+ if (state.eat(0x3A )) {
6641
+ this.regexp_disjunction(state);
6642
+ if (state.eat(0x29 )) {
6643
+ return true;
6644
+ }
6645
+ state.raise("Unterminated group");
6372
6646
  }
6373
- state.raise("Unterminated group");
6374
6647
  }
6375
6648
  state.pos = start;
6376
6649
  }
@@ -6393,6 +6666,18 @@ pp$1.regexp_eatCapturingGroup = function (state) {
6393
6666
  }
6394
6667
  return false;
6395
6668
  };
6669
+ pp$1.regexp_eatModifiers = function (state) {
6670
+ var modifiers = "";
6671
+ var ch = 0;
6672
+ while ((ch = state.current()) !== -1 && isRegularExpressionModifier(ch)) {
6673
+ modifiers += codePointToString(ch);
6674
+ state.advance();
6675
+ }
6676
+ return modifiers;
6677
+ };
6678
+ function isRegularExpressionModifier(ch) {
6679
+ return ch === 0x69 || ch === 0x6d || ch === 0x73;
6680
+ }
6396
6681
  pp$1.regexp_eatExtendedAtom = function (state) {
6397
6682
  return (state.eat(0x2E ) ||
6398
6683
  this.regexp_eatReverseSolidusAtomEscape(state) ||
@@ -6450,14 +6735,30 @@ pp$1.regexp_eatExtendedPatternCharacter = function (state) {
6450
6735
  };
6451
6736
  pp$1.regexp_groupSpecifier = function (state) {
6452
6737
  if (state.eat(0x3F )) {
6453
- if (this.regexp_eatGroupName(state)) {
6454
- if (state.groupNames.indexOf(state.lastStringValue) !== -1) {
6738
+ if (!this.regexp_eatGroupName(state)) {
6739
+ state.raise("Invalid group");
6740
+ }
6741
+ var trackDisjunction = this.options.ecmaVersion >= 16;
6742
+ var known = state.groupNames[state.lastStringValue];
6743
+ if (known) {
6744
+ if (trackDisjunction) {
6745
+ for (var i = 0, list = known; i < list.length; i += 1) {
6746
+ var altID = list[i];
6747
+ if (!altID.separatedFrom(state.branchID)) {
6748
+ state.raise("Duplicate capture group name");
6749
+ }
6750
+ }
6751
+ }
6752
+ else {
6455
6753
  state.raise("Duplicate capture group name");
6456
6754
  }
6457
- state.groupNames.push(state.lastStringValue);
6458
- return;
6459
6755
  }
6460
- state.raise("Invalid group");
6756
+ if (trackDisjunction) {
6757
+ (known || (state.groupNames[state.lastStringValue] = [])).push(state.branchID);
6758
+ }
6759
+ else {
6760
+ state.groupNames[state.lastStringValue] = true;
6761
+ }
6461
6762
  }
6462
6763
  };
6463
6764
  pp$1.regexp_eatGroupName = function (state) {
@@ -7237,14 +7538,17 @@ pp.readToken = function (code) {
7237
7538
  }
7238
7539
  return this.getTokenFromCode(code);
7239
7540
  };
7240
- pp.fullCharCodeAtPos = function () {
7241
- var code = this.input.charCodeAt(this.pos);
7541
+ pp.fullCharCodeAt = function (pos) {
7542
+ var code = this.input.charCodeAt(pos);
7242
7543
  if (code <= 0xd7ff || code >= 0xdc00) {
7243
7544
  return code;
7244
7545
  }
7245
- var next = this.input.charCodeAt(this.pos + 1);
7546
+ var next = this.input.charCodeAt(pos + 1);
7246
7547
  return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00;
7247
7548
  };
7549
+ pp.fullCharCodeAtPos = function () {
7550
+ return this.fullCharCodeAt(this.pos);
7551
+ };
7248
7552
  pp.skipBlockComment = function () {
7249
7553
  var startLoc = this.options.onComment && this.curPosition();
7250
7554
  var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
@@ -7868,6 +8172,16 @@ pp.readInvalidTemplateToken = function () {
7868
8172
  }
7869
8173
  case "`":
7870
8174
  return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos));
8175
+ case "\r":
8176
+ if (this.input[this.pos + 1] === "\n") {
8177
+ ++this.pos;
8178
+ }
8179
+ case "\n":
8180
+ case "\u2028":
8181
+ case "\u2029":
8182
+ ++this.curLine;
8183
+ this.lineStart = this.pos + 1;
8184
+ break;
7871
8185
  }
7872
8186
  }
7873
8187
  this.raise(this.start, "Unterminated template");
@@ -7920,6 +8234,10 @@ pp.readEscapedChar = function (inTemplate) {
7920
8234
  return String.fromCharCode(octal);
7921
8235
  }
7922
8236
  if (isNewLine(ch)) {
8237
+ if (this.options.locations) {
8238
+ this.lineStart = this.pos;
8239
+ ++this.curLine;
8240
+ }
7923
8241
  return "";
7924
8242
  }
7925
8243
  return String.fromCharCode(ch);
@@ -7973,7 +8291,7 @@ pp.readWord = function () {
7973
8291
  }
7974
8292
  return this.finishToken(type, word);
7975
8293
  };
7976
- var version = "8.10.0";
8294
+ var version = "8.16.0";
7977
8295
  Parser$1.acorn = {
7978
8296
  Parser: Parser$1,
7979
8297
  version: version,
@@ -12874,7 +13192,7 @@ class AcornTokenizer {
12874
13192
  return this.#tokenLineEnd;
12875
13193
  }
12876
13194
  }
12877
- const ECMA_VERSION = 2022;
13195
+ const ECMA_VERSION = 'latest';
12878
13196
 
12879
13197
  // Copyright 2014 The Chromium Authors
12880
13198
  class ESTreeWalker {
@@ -12954,7 +13272,8 @@ const WALK_ORDER = {
12954
13272
  FunctionDeclaration: ['id', 'params', 'body'],
12955
13273
  FunctionExpression: ['id', 'params', 'body'],
12956
13274
  Identifier: [],
12957
- ImportDeclaration: ['specifiers', 'source'],
13275
+ ImportDeclaration: ['specifiers', 'source', 'attributes'],
13276
+ ImportAttribute: ['key', 'value'],
12958
13277
  ImportDefaultSpecifier: ['local'],
12959
13278
  ImportNamespaceSpecifier: ['local'],
12960
13279
  ImportSpecifier: ['imported', 'local'],
@@ -13137,6 +13456,12 @@ class JavaScriptFormatter {
13137
13456
  }
13138
13457
  return 't';
13139
13458
  }
13459
+ if (nodeType === 'ImportAttribute') {
13460
+ if (AT.punctuator(token, ':')) {
13461
+ return 'ts';
13462
+ }
13463
+ return 't';
13464
+ }
13140
13465
  if (nodeType === 'ArrayExpression') {
13141
13466
  if (AT.punctuator(token, ',')) {
13142
13467
  return 'ts';
@@ -13348,11 +13673,17 @@ class JavaScriptFormatter {
13348
13673
  return 'ts';
13349
13674
  }
13350
13675
  if (AT.punctuator(token, '}')) {
13676
+ if (node.attributes.length > 0) {
13677
+ return 't';
13678
+ }
13351
13679
  return node.source ? 'ts' : 't';
13352
13680
  }
13353
13681
  if (AT.punctuator(token, '*')) {
13354
13682
  return 'sts';
13355
13683
  }
13684
+ if (AT.keyword(token, 'with')) {
13685
+ return 'sts';
13686
+ }
13356
13687
  return 't';
13357
13688
  }
13358
13689
  else if (nodeType === 'MemberExpression') {
@@ -14690,12 +15021,10 @@ class CSSFormatter {
14690
15021
  #toOffset;
14691
15022
  #fromOffset;
14692
15023
  #lineEndings;
14693
- #lastLine;
14694
- #state;
15024
+ #lastLine = -1;
15025
+ #state = {};
14695
15026
  constructor(builder) {
14696
15027
  this.#builder = builder;
14697
- this.#lastLine = -1;
14698
- this.#state = {};
14699
15028
  }
14700
15029
  format(text, lineEndings, fromOffset, toOffset) {
14701
15030
  this.#lineEndings = lineEndings;