/******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = (Array(19).concat([ /* 19 */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ rewriteCSS) /* harmony export */ }); /* harmony import */ var _url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20); // import { parse, walk, generate } from "css-tree"; function rewriteCSS(css, origin) { // const ast = parse(css); // walk(ast, (node) => { // if (node.type === "Url") { // node.value = rewriteURL(node.value as any, origin) as any; // } // }); // return generate(ast); return css = css.replace(/(?<=url\("?'?)[^"'][\S]*[^"'](?="?'?\);?)/g, (0,_url__WEBPACK_IMPORTED_MODULE_0__["default"])('$&', origin)); } /***/ }), /* 20 */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ rewriteURL), /* harmony export */ "unwriteURL": () => (/* binding */ unwriteURL) /* harmony export */ }); /* harmony import */ var _js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21); function combine(url, path) { if (!url.pathname) return path; url.pathname = url.pathname.replace(/[^/]+?\.[^/]+?$/, ""); if (/^\//.test(path)) { return url.origin + path; } else if (/^\.\//.test(path)) { return url.href.replace(/\/$/, "") + path.replace(/^\./, ""); } else if (/^\.\.\//.test(path)) { return url.href.replace(/\/[^/]+?\/?$/, "") + path.replace(/^\.\./, ""); } else { return url.href.replace(/\/?$/, "/") + path; } } function rewriteURL(url, origin) { const config = self.__osana$config; if (new RegExp(`^${config.prefix}`).test(url)) return url; let fakeLocation; if ("window" in self) { fakeLocation = new URL(config.codec.decode(location.pathname.replace(new RegExp(`^${config.prefix}`), ""))); } if (origin) { fakeLocation = new URL(origin); } if (/^(#|about|data|mailto):/.test(url)) { return url; } else if (/^javascript:/.test(url)) { return `javascript:${(0,_js__WEBPACK_IMPORTED_MODULE_0__["default"])(url.slice('javascript:'.length))}`; } else { if (!fakeLocation) return url; try { return `${config.prefix}${config.codec.encode(new URL(url, fakeLocation.href).href)}`; } catch (_a) { return `${config.prefix}${config.codec.encode(url)}`; } } } function unwriteURL(url) { const config = self.__osana$config; if (!url) return url; let newURL; if (/^https?:\/\//.test(url)) { newURL = new URL(config.codec.decode(new URL(url).pathname.replace(new RegExp(`^${config.prefix}`), ""))); } else { newURL = new URL(config.codec.decode(url.replace(new RegExp(`^${config.prefix}`), ""))); } return newURL.href; } /***/ }), /* 21 */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ rewriteJS) /* harmony export */ }); /* harmony import */ var meriyah__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22); /* harmony import */ var esotope_hammerhead__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(23); function rewriteJS(js) { let AST = getAST(js); AST = walkAST(AST, null, (node, parent) => { if (node.type === "MemberExpression") { if (parent.type !== "CallExpression") { node.object = rewriteNode(node.object); } else if (node.object.type === "Identifier") { if (["location", "localStorage", "sessionStorage"].includes(node.object.name)) { node.object = rewriteNode(node.object); } } } // if (node.type === "Identifier") { // if (node.name !== "window") { // if (parent.type !== "MemberExpression") { // node = rewriteNode(node); // } // } // } return node; }); return (0,esotope_hammerhead__WEBPACK_IMPORTED_MODULE_1__.generate)(AST, { format: { quotes: 'double' } }); } function rewriteNode(node) { if (node.type === "Identifier") { switch (node.name) { case "self": node.name = "__self"; break; case "window": node.name = "__window"; break; case "parent": node.name = "__parent"; break; case "location": node.name = "__location"; break; case "localStorage": node.name = "__localStorage"; break; case "sessionStorage": node.name = "__sessionStorage"; break; case "top": node.name = "__top"; break; } } return node; } function walkAST(AST, parent, handler) { if (!AST || typeof AST !== "object") return AST; AST = handler(AST, parent); for (let node in AST) { if (Array.isArray(AST[node])) { for (let n in AST[node]) { AST[node][n] = walkAST(AST[node][n], AST[node], handler); } } else { AST[node] = walkAST(AST[node], AST, handler); } } return AST; } function getAST(js) { try { return (0,meriyah__WEBPACK_IMPORTED_MODULE_0__.parseScript)(js, { module: true }); } catch (error) { console.log(error); return (0,meriyah__WEBPACK_IMPORTED_MODULE_0__.parseScript)(""); } } /***/ }), /* 22 */ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "ESTree": () => (/* binding */ estree), /* harmony export */ "parse": () => (/* binding */ parse), /* harmony export */ "parseModule": () => (/* binding */ parseModule), /* harmony export */ "parseScript": () => (/* binding */ parseScript), /* harmony export */ "version": () => (/* binding */ version) /* harmony export */ }); const errorMessages = { [0]: 'Unexpected token', [28]: "Unexpected token: '%0'", [1]: 'Octal escape sequences are not allowed in strict mode', [2]: 'Octal escape sequences are not allowed in template strings', [3]: 'Unexpected token `#`', [4]: 'Illegal Unicode escape sequence', [5]: 'Invalid code point %0', [6]: 'Invalid hexadecimal escape sequence', [8]: 'Octal literals are not allowed in strict mode', [7]: 'Decimal integer literals with a leading zero are forbidden in strict mode', [9]: 'Expected number in radix %0', [145]: 'Invalid left-hand side assignment to a destructible right-hand side', [10]: 'Non-number found after exponent indicator', [11]: 'Invalid BigIntLiteral', [12]: 'No identifiers allowed directly after numeric literal', [13]: 'Escapes \\8 or \\9 are not syntactically valid escapes', [14]: 'Unterminated string literal', [15]: 'Unterminated template literal', [16]: 'Multiline comment was not closed properly', [17]: 'The identifier contained dynamic unicode escape that was not closed', [18]: "Illegal character '%0'", [19]: 'Missing hexadecimal digits', [20]: 'Invalid implicit octal', [21]: 'Invalid line break in string literal', [22]: 'Only unicode escapes are legal in identifier names', [23]: "Expected '%0'", [24]: 'Invalid left-hand side in assignment', [25]: 'Invalid left-hand side in async arrow', [26]: 'Calls to super must be in the "constructor" method of a class expression or class declaration that has a superclass', [27]: 'Member access on super must be in a method', [29]: 'Await expression not allowed in formal parameter', [30]: 'Yield expression not allowed in formal parameter', [92]: "Unexpected token: 'escaped keyword'", [31]: 'Unary expressions as the left operand of an exponentiation expression must be disambiguated with parentheses', [119]: 'Async functions can only be declared at the top level or inside a block', [32]: 'Unterminated regular expression', [33]: 'Unexpected regular expression flag', [34]: "Duplicate regular expression flag '%0'", [35]: '%0 functions must have exactly %1 argument%2', [36]: 'Setter function argument must not be a rest parameter', [37]: '%0 declaration must have a name in this context', [38]: 'Function name may not contain any reserved words or be eval or arguments in strict mode', [39]: 'The rest operator is missing an argument', [40]: 'A getter cannot be a generator', [41]: 'A computed property name must be followed by a colon or paren', [130]: 'Object literal keys that are strings or numbers must be a method or have a colon', [43]: 'Found `* async x(){}` but this should be `async * x(){}`', [42]: 'Getters and setters can not be generators', [44]: "'%0' can not be generator method", [45]: "No line break is allowed after '=>'", [46]: 'The left-hand side of the arrow can only be destructed through assignment', [47]: 'The binding declaration is not destructible', [48]: 'Async arrow can not be followed by new expression', [49]: "Classes may not have a static property named 'prototype'", [50]: 'Class constructor may not be a %0', [51]: 'Duplicate constructor method in class', [52]: 'Invalid increment/decrement operand', [53]: 'Invalid use of `new` keyword on an increment/decrement expression', [54]: '`=>` is an invalid assignment target', [55]: 'Rest element may not have a trailing comma', [56]: 'Missing initializer in %0 declaration', [57]: "'for-%0' loop head declarations can not have an initializer", [58]: 'Invalid left-hand side in for-%0 loop: Must have a single binding', [59]: 'Invalid shorthand property initializer', [60]: 'Property name __proto__ appears more than once in object literal', [61]: 'Let is disallowed as a lexically bound name', [62]: "Invalid use of '%0' inside new expression", [63]: "Illegal 'use strict' directive in function with non-simple parameter list", [64]: 'Identifier "let" disallowed as left-hand side expression in strict mode', [65]: 'Illegal continue statement', [66]: 'Illegal break statement', [67]: 'Cannot have `let[...]` as a var name in strict mode', [68]: 'Invalid destructuring assignment target', [69]: 'Rest parameter may not have a default initializer', [70]: 'The rest argument must the be last parameter', [71]: 'Invalid rest argument', [73]: 'In strict mode code, functions can only be declared at top level or inside a block', [74]: 'In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement', [75]: 'Without web compatibility enabled functions can not be declared at top level, inside a block, or as the body of an if statement', [76]: "Class declaration can't appear in single-statement context", [77]: 'Invalid left-hand side in for-%0', [78]: 'Invalid assignment in for-%0', [79]: 'for await (... of ...) is only valid in async functions and async generators', [80]: 'The first token after the template expression should be a continuation of the template', [82]: '`let` declaration not allowed here and `let` cannot be a regular var name in strict mode', [81]: '`let \n [` is a restricted production at the start of a statement', [83]: 'Catch clause requires exactly one parameter, not more (and no trailing comma)', [84]: 'Catch clause parameter does not support default values', [85]: 'Missing catch or finally after try', [86]: 'More than one default clause in switch statement', [87]: 'Illegal newline after throw', [88]: 'Strict mode code may not include a with statement', [89]: 'Illegal return statement', [90]: 'The left hand side of the for-header binding declaration is not destructible', [91]: 'new.target only allowed within functions', [93]: "'#' not followed by identifier", [99]: 'Invalid keyword', [98]: "Can not use 'let' as a class name", [97]: "'A lexical declaration can't define a 'let' binding", [96]: 'Can not use `let` as variable name in strict mode', [94]: "'%0' may not be used as an identifier in this context", [95]: 'Await is only valid in async functions', [100]: 'The %0 keyword can only be used with the module goal', [101]: 'Unicode codepoint must not be greater than 0x10FFFF', [102]: '%0 source must be string', [103]: 'Only a identifier can be used to indicate alias', [104]: "Only '*' or '{...}' can be imported after default", [105]: 'Trailing decorator may be followed by method', [106]: "Decorators can't be used with a constructor", [108]: 'HTML comments are only allowed with web compatibility (Annex B)', [109]: "The identifier 'let' must not be in expression position in strict mode", [110]: 'Cannot assign to `eval` and `arguments` in strict mode', [111]: "The left-hand side of a for-of loop may not start with 'let'", [112]: 'Block body arrows can not be immediately invoked without a group', [113]: 'Block body arrows can not be immediately accessed without a group', [114]: 'Unexpected strict mode reserved word', [115]: 'Unexpected eval or arguments in strict mode', [116]: 'Decorators must not be followed by a semicolon', [117]: 'Calling delete on expression not allowed in strict mode', [118]: 'Pattern can not have a tail', [120]: 'Can not have a `yield` expression on the left side of a ternary', [121]: 'An arrow function can not have a postfix update operator', [122]: 'Invalid object literal key character after generator star', [123]: 'Private fields can not be deleted', [125]: 'Classes may not have a field called constructor', [124]: 'Classes may not have a private element named constructor', [126]: 'A class field initializer may not contain arguments', [127]: 'Generators can only be declared at the top level or inside a block', [128]: 'Async methods are a restricted production and cannot have a newline following it', [129]: 'Unexpected character after object literal property name', [131]: 'Invalid key token', [132]: "Label '%0' has already been declared", [133]: 'continue statement must be nested within an iteration statement', [134]: "Undefined label '%0'", [135]: 'Trailing comma is disallowed inside import(...) arguments', [136]: 'import() requires exactly one argument', [137]: 'Cannot use new with import(...)', [138]: '... is not allowed in import()', [139]: "Expected '=>'", [140]: "Duplicate binding '%0'", [141]: "Cannot export a duplicate name '%0'", [144]: 'Duplicate %0 for-binding', [142]: "Exported binding '%0' needs to refer to a top-level declared variable", [143]: 'Unexpected private field', [147]: 'Numeric separators are not allowed at the end of numeric literals', [146]: 'Only one underscore is allowed as numeric separator', [148]: 'JSX value should be either an expression or a quoted JSX text', [149]: 'Expected corresponding JSX closing tag for %0', [150]: 'Adjacent JSX elements must be wrapped in an enclosing tag', [151]: "JSX attributes must only be assigned a non-empty 'expression'", [152]: "'%0' has already been declared", [153]: "'%0' shadowed a catch clause binding", [154]: 'Dot property must be an identifier', [155]: 'Encountered invalid input after spread/rest argument', [156]: 'Catch without try', [157]: 'Finally without try', [158]: 'Expected corresponding closing tag for JSX fragment', [159]: 'Coalescing and logical operators used together in the same expression must be disambiguated with parentheses', [160]: 'Invalid tagged template on optional chain', [161]: 'Invalid optional chain from super property', [162]: 'Invalid optional chain from new expression', [163]: 'Cannot use "import.meta" outside a module', [164]: 'Leading decorators must be attached to a class declaration' }; class ParseError extends SyntaxError { constructor(startindex, line, column, type, ...params) { const message = '[' + line + ':' + column + ']: ' + errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]); super(`${message}`); this.index = startindex; this.line = line; this.column = column; this.description = message; this.loc = { line, column }; } } function report(parser, type, ...params) { throw new ParseError(parser.index, parser.line, parser.column, type, ...params); } function reportScopeError(scope) { throw new ParseError(scope.index, scope.line, scope.column, scope.type, scope.params); } function reportMessageAt(index, line, column, type, ...params) { throw new ParseError(index, line, column, type, ...params); } function reportScannerError(index, line, column, type) { throw new ParseError(index, line, column, type); } const unicodeLookup = ((compressed, lookup) => { const result = new Uint32Array(104448); let index = 0; let subIndex = 0; while (index < 3540) { const inst = compressed[index++]; if (inst < 0) { subIndex -= inst; } else { let code = compressed[index++]; if (inst & 2) code = lookup[code]; if (inst & 1) { result.fill(code, subIndex, subIndex += compressed[index++]); } else { result[subIndex++] = code; } } } return result; })([-1, 2, 24, 2, 25, 2, 5, -1, 0, 77595648, 3, 44, 2, 3, 0, 14, 2, 57, 2, 58, 3, 0, 3, 0, 3168796671, 0, 4294956992, 2, 1, 2, 0, 2, 59, 3, 0, 4, 0, 4294966523, 3, 0, 4, 2, 16, 2, 60, 2, 0, 0, 4294836735, 0, 3221225471, 0, 4294901942, 2, 61, 0, 134152192, 3, 0, 2, 0, 4294951935, 3, 0, 2, 0, 2683305983, 0, 2684354047, 2, 17, 2, 0, 0, 4294961151, 3, 0, 2, 2, 19, 2, 0, 0, 608174079, 2, 0, 2, 131, 2, 6, 2, 56, -1, 2, 37, 0, 4294443263, 2, 1, 3, 0, 3, 0, 4294901711, 2, 39, 0, 4089839103, 0, 2961209759, 0, 1342439375, 0, 4294543342, 0, 3547201023, 0, 1577204103, 0, 4194240, 0, 4294688750, 2, 2, 0, 80831, 0, 4261478351, 0, 4294549486, 2, 2, 0, 2967484831, 0, 196559, 0, 3594373100, 0, 3288319768, 0, 8469959, 2, 194, 2, 3, 0, 3825204735, 0, 123747807, 0, 65487, 0, 4294828015, 0, 4092591615, 0, 1080049119, 0, 458703, 2, 3, 2, 0, 0, 2163244511, 0, 4227923919, 0, 4236247022, 2, 66, 0, 4284449919, 0, 851904, 2, 4, 2, 11, 0, 67076095, -1, 2, 67, 0, 1073741743, 0, 4093591391, -1, 0, 50331649, 0, 3265266687, 2, 32, 0, 4294844415, 0, 4278190047, 2, 18, 2, 129, -1, 3, 0, 2, 2, 21, 2, 0, 2, 9, 2, 0, 2, 14, 2, 15, 3, 0, 10, 2, 69, 2, 0, 2, 70, 2, 71, 2, 72, 2, 0, 2, 73, 2, 0, 2, 10, 0, 261632, 2, 23, 3, 0, 2, 2, 12, 2, 4, 3, 0, 18, 2, 74, 2, 5, 3, 0, 2, 2, 75, 0, 2088959, 2, 27, 2, 8, 0, 909311, 3, 0, 2, 0, 814743551, 2, 41, 0, 67057664, 3, 0, 2, 2, 40, 2, 0, 2, 28, 2, 0, 2, 29, 2, 7, 0, 268374015, 2, 26, 2, 49, 2, 0, 2, 76, 0, 134153215, -1, 2, 6, 2, 0, 2, 7, 0, 2684354559, 0, 67044351, 0, 3221160064, 0, 1, -1, 3, 0, 2, 2, 42, 0, 1046528, 3, 0, 3, 2, 8, 2, 0, 2, 51, 0, 4294960127, 2, 9, 2, 38, 2, 10, 0, 4294377472, 2, 11, 3, 0, 7, 0, 4227858431, 3, 0, 8, 2, 12, 2, 0, 2, 78, 2, 9, 2, 0, 2, 79, 2, 80, 2, 81, -1, 2, 124, 0, 1048577, 2, 82, 2, 13, -1, 2, 13, 0, 131042, 2, 83, 2, 84, 2, 85, 2, 0, 2, 33, -83, 2, 0, 2, 53, 2, 7, 3, 0, 4, 0, 1046559, 2, 0, 2, 14, 2, 0, 0, 2147516671, 2, 20, 3, 86, 2, 2, 0, -16, 2, 87, 0, 524222462, 2, 4, 2, 0, 0, 4269801471, 2, 4, 2, 0, 2, 15, 2, 77, 2, 16, 3, 0, 2, 2, 47, 2, 0, -1, 2, 17, -16, 3, 0, 206, -2, 3, 0, 655, 2, 18, 3, 0, 36, 2, 68, -1, 2, 17, 2, 9, 3, 0, 8, 2, 89, 2, 121, 2, 0, 0, 3220242431, 3, 0, 3, 2, 19, 2, 90, 2, 91, 3, 0, 2, 2, 92, 2, 0, 2, 93, 2, 94, 2, 0, 0, 4351, 2, 0, 2, 8, 3, 0, 2, 0, 67043391, 0, 3909091327, 2, 0, 2, 22, 2, 8, 2, 18, 3, 0, 2, 0, 67076097, 2, 7, 2, 0, 2, 20, 0, 67059711, 0, 4236247039, 3, 0, 2, 0, 939524103, 0, 8191999, 2, 97, 2, 98, 2, 15, 2, 21, 3, 0, 3, 0, 67057663, 3, 0, 349, 2, 99, 2, 100, 2, 6, -264, 3, 0, 11, 2, 22, 3, 0, 2, 2, 31, -1, 0, 3774349439, 2, 101, 2, 102, 3, 0, 2, 2, 19, 2, 103, 3, 0, 10, 2, 9, 2, 17, 2, 0, 2, 45, 2, 0, 2, 30, 2, 104, 2, 23, 0, 1638399, 2, 172, 2, 105, 3, 0, 3, 2, 18, 2, 24, 2, 25, 2, 5, 2, 26, 2, 0, 2, 7, 2, 106, -1, 2, 107, 2, 108, 2, 109, -1, 3, 0, 3, 2, 11, -2, 2, 0, 2, 27, -3, 2, 150, -4, 2, 18, 2, 0, 2, 35, 0, 1, 2, 0, 2, 62, 2, 28, 2, 11, 2, 9, 2, 0, 2, 110, -1, 3, 0, 4, 2, 9, 2, 21, 2, 111, 2, 6, 2, 0, 2, 112, 2, 0, 2, 48, -4, 3, 0, 9, 2, 20, 2, 29, 2, 30, -4, 2, 113, 2, 114, 2, 29, 2, 20, 2, 7, -2, 2, 115, 2, 29, 2, 31, -2, 2, 0, 2, 116, -2, 0, 4277137519, 0, 2269118463, -1, 3, 18, 2, -1, 2, 32, 2, 36, 2, 0, 3, 29, 2, 2, 34, 2, 19, -3, 3, 0, 2, 2, 33, -1, 2, 0, 2, 34, 2, 0, 2, 34, 2, 0, 2, 46, -10, 2, 0, 0, 203775, -2, 2, 18, 2, 43, 2, 35, -2, 2, 17, 2, 117, 2, 20, 3, 0, 2, 2, 36, 0, 2147549120, 2, 0, 2, 11, 2, 17, 2, 135, 2, 0, 2, 37, 2, 52, 0, 5242879, 3, 0, 2, 0, 402644511, -1, 2, 120, 0, 1090519039, -2, 2, 122, 2, 38, 2, 0, 0, 67045375, 2, 39, 0, 4226678271, 0, 3766565279, 0, 2039759, -4, 3, 0, 2, 0, 3288270847, 0, 3, 3, 0, 2, 0, 67043519, -5, 2, 0, 0, 4282384383, 0, 1056964609, -1, 3, 0, 2, 0, 67043345, -1, 2, 0, 2, 40, 2, 41, -1, 2, 10, 2, 42, -6, 2, 0, 2, 11, -3, 3, 0, 2, 0, 2147484671, 2, 125, 0, 4190109695, 2, 50, -2, 2, 126, 0, 4244635647, 0, 27, 2, 0, 2, 7, 2, 43, 2, 0, 2, 63, -1, 2, 0, 2, 40, -8, 2, 54, 2, 44, 0, 67043329, 2, 127, 2, 45, 0, 8388351, -2, 2, 128, 0, 3028287487, 2, 46, 2, 130, 0, 33259519, 2, 41, -9, 2, 20, -5, 2, 64, -2, 3, 0, 28, 2, 31, -3, 3, 0, 3, 2, 47, 3, 0, 6, 2, 48, -85, 3, 0, 33, 2, 47, -126, 3, 0, 18, 2, 36, -269, 3, 0, 17, 2, 40, 2, 7, 2, 41, -2, 2, 17, 2, 49, 2, 0, 2, 20, 2, 50, 2, 132, 2, 23, -21, 3, 0, 2, -4, 3, 0, 2, 0, 4294936575, 2, 0, 0, 4294934783, -2, 0, 196635, 3, 0, 191, 2, 51, 3, 0, 38, 2, 29, -1, 2, 33, -279, 3, 0, 8, 2, 7, -1, 2, 133, 2, 52, 3, 0, 11, 2, 6, -72, 3, 0, 3, 2, 134, 0, 1677656575, -166, 0, 4161266656, 0, 4071, 0, 15360, -4, 0, 28, -13, 3, 0, 2, 2, 37, 2, 0, 2, 136, 2, 137, 2, 55, 2, 0, 2, 138, 2, 139, 2, 140, 3, 0, 10, 2, 141, 2, 142, 2, 15, 3, 37, 2, 3, 53, 2, 3, 54, 2, 0, 4294954999, 2, 0, -16, 2, 0, 2, 88, 2, 0, 0, 2105343, 0, 4160749584, 0, 65534, -42, 0, 4194303871, 0, 2011, -6, 2, 0, 0, 1073684479, 0, 17407, -11, 2, 0, 2, 31, -40, 3, 0, 6, 0, 8323103, -1, 3, 0, 2, 2, 42, -37, 2, 55, 2, 144, 2, 145, 2, 146, 2, 147, 2, 148, -105, 2, 24, -32, 3, 0, 1334, 2, 9, -1, 3, 0, 129, 2, 27, 3, 0, 6, 2, 9, 3, 0, 180, 2, 149, 3, 0, 233, 0, 1, -96, 3, 0, 16, 2, 9, -47, 3, 0, 154, 2, 56, -22381, 3, 0, 7, 2, 23, -6130, 3, 5, 2, -1, 0, 69207040, 3, 44, 2, 3, 0, 14, 2, 57, 2, 58, -3, 0, 3168731136, 0, 4294956864, 2, 1, 2, 0, 2, 59, 3, 0, 4, 0, 4294966275, 3, 0, 4, 2, 16, 2, 60, 2, 0, 2, 33, -1, 2, 17, 2, 61, -1, 2, 0, 2, 56, 0, 4294885376, 3, 0, 2, 0, 3145727, 0, 2617294944, 0, 4294770688, 2, 23, 2, 62, 3, 0, 2, 0, 131135, 2, 95, 0, 70256639, 0, 71303167, 0, 272, 2, 40, 2, 56, -1, 2, 37, 2, 30, -1, 2, 96, 2, 63, 0, 4278255616, 0, 4294836227, 0, 4294549473, 0, 600178175, 0, 2952806400, 0, 268632067, 0, 4294543328, 0, 57540095, 0, 1577058304, 0, 1835008, 0, 4294688736, 2, 65, 2, 64, 0, 33554435, 2, 123, 2, 65, 2, 151, 0, 131075, 0, 3594373096, 0, 67094296, 2, 64, -1, 0, 4294828000, 0, 603979263, 2, 160, 0, 3, 0, 4294828001, 0, 602930687, 2, 183, 0, 393219, 0, 4294828016, 0, 671088639, 0, 2154840064, 0, 4227858435, 0, 4236247008, 2, 66, 2, 36, -1, 2, 4, 0, 917503, 2, 36, -1, 2, 67, 0, 537788335, 0, 4026531935, -1, 0, 1, -1, 2, 32, 2, 68, 0, 7936, -3, 2, 0, 0, 2147485695, 0, 1010761728, 0, 4292984930, 0, 16387, 2, 0, 2, 14, 2, 15, 3, 0, 10, 2, 69, 2, 0, 2, 70, 2, 71, 2, 72, 2, 0, 2, 73, 2, 0, 2, 11, -1, 2, 23, 3, 0, 2, 2, 12, 2, 4, 3, 0, 18, 2, 74, 2, 5, 3, 0, 2, 2, 75, 0, 253951, 3, 19, 2, 0, 122879, 2, 0, 2, 8, 0, 276824064, -2, 3, 0, 2, 2, 40, 2, 0, 0, 4294903295, 2, 0, 2, 29, 2, 7, -1, 2, 17, 2, 49, 2, 0, 2, 76, 2, 41, -1, 2, 20, 2, 0, 2, 27, -2, 0, 128, -2, 2, 77, 2, 8, 0, 4064, -1, 2, 119, 0, 4227907585, 2, 0, 2, 118, 2, 0, 2, 48, 2, 173, 2, 9, 2, 38, 2, 10, -1, 0, 74440192, 3, 0, 6, -2, 3, 0, 8, 2, 12, 2, 0, 2, 78, 2, 9, 2, 0, 2, 79, 2, 80, 2, 81, -3, 2, 82, 2, 13, -3, 2, 83, 2, 84, 2, 85, 2, 0, 2, 33, -83, 2, 0, 2, 53, 2, 7, 3, 0, 4, 0, 817183, 2, 0, 2, 14, 2, 0, 0, 33023, 2, 20, 3, 86, 2, -17, 2, 87, 0, 524157950, 2, 4, 2, 0, 2, 88, 2, 4, 2, 0, 2, 15, 2, 77, 2, 16, 3, 0, 2, 2, 47, 2, 0, -1, 2, 17, -16, 3, 0, 206, -2, 3, 0, 655, 2, 18, 3, 0, 36, 2, 68, -1, 2, 17, 2, 9, 3, 0, 8, 2, 89, 0, 3072, 2, 0, 0, 2147516415, 2, 9, 3, 0, 2, 2, 23, 2, 90, 2, 91, 3, 0, 2, 2, 92, 2, 0, 2, 93, 2, 94, 0, 4294965179, 0, 7, 2, 0, 2, 8, 2, 91, 2, 8, -1, 0, 1761345536, 2, 95, 0, 4294901823, 2, 36, 2, 18, 2, 96, 2, 34, 2, 166, 0, 2080440287, 2, 0, 2, 33, 2, 143, 0, 3296722943, 2, 0, 0, 1046675455, 0, 939524101, 0, 1837055, 2, 97, 2, 98, 2, 15, 2, 21, 3, 0, 3, 0, 7, 3, 0, 349, 2, 99, 2, 100, 2, 6, -264, 3, 0, 11, 2, 22, 3, 0, 2, 2, 31, -1, 0, 2700607615, 2, 101, 2, 102, 3, 0, 2, 2, 19, 2, 103, 3, 0, 10, 2, 9, 2, 17, 2, 0, 2, 45, 2, 0, 2, 30, 2, 104, -3, 2, 105, 3, 0, 3, 2, 18, -1, 3, 5, 2, 2, 26, 2, 0, 2, 7, 2, 106, -1, 2, 107, 2, 108, 2, 109, -1, 3, 0, 3, 2, 11, -2, 2, 0, 2, 27, -8, 2, 18, 2, 0, 2, 35, -1, 2, 0, 2, 62, 2, 28, 2, 29, 2, 9, 2, 0, 2, 110, -1, 3, 0, 4, 2, 9, 2, 17, 2, 111, 2, 6, 2, 0, 2, 112, 2, 0, 2, 48, -4, 3, 0, 9, 2, 20, 2, 29, 2, 30, -4, 2, 113, 2, 114, 2, 29, 2, 20, 2, 7, -2, 2, 115, 2, 29, 2, 31, -2, 2, 0, 2, 116, -2, 0, 4277075969, 2, 29, -1, 3, 18, 2, -1, 2, 32, 2, 117, 2, 0, 3, 29, 2, 2, 34, 2, 19, -3, 3, 0, 2, 2, 33, -1, 2, 0, 2, 34, 2, 0, 2, 34, 2, 0, 2, 48, -10, 2, 0, 0, 197631, -2, 2, 18, 2, 43, 2, 118, -2, 2, 17, 2, 117, 2, 20, 2, 119, 2, 51, -2, 2, 119, 2, 23, 2, 17, 2, 33, 2, 119, 2, 36, 0, 4294901904, 0, 4718591, 2, 119, 2, 34, 0, 335544350, -1, 2, 120, 2, 121, -2, 2, 122, 2, 38, 2, 7, -1, 2, 123, 2, 65, 0, 3758161920, 0, 3, -4, 2, 0, 2, 27, 0, 2147485568, 0, 3, 2, 0, 2, 23, 0, 176, -5, 2, 0, 2, 47, 2, 186, -1, 2, 0, 2, 23, 2, 197, -1, 2, 0, 0, 16779263, -2, 2, 11, -7, 2, 0, 2, 121, -3, 3, 0, 2, 2, 124, 2, 125, 0, 2147549183, 0, 2, -2, 2, 126, 2, 35, 0, 10, 0, 4294965249, 0, 67633151, 0, 4026597376, 2, 0, 0, 536871935, -1, 2, 0, 2, 40, -8, 2, 54, 2, 47, 0, 1, 2, 127, 2, 23, -3, 2, 128, 2, 35, 2, 129, 2, 130, 0, 16778239, -10, 2, 34, -5, 2, 64, -2, 3, 0, 28, 2, 31, -3, 3, 0, 3, 2, 47, 3, 0, 6, 2, 48, -85, 3, 0, 33, 2, 47, -126, 3, 0, 18, 2, 36, -269, 3, 0, 17, 2, 40, 2, 7, -3, 2, 17, 2, 131, 2, 0, 2, 23, 2, 48, 2, 132, 2, 23, -21, 3, 0, 2, -4, 3, 0, 2, 0, 67583, -1, 2, 103, -2, 0, 11, 3, 0, 191, 2, 51, 3, 0, 38, 2, 29, -1, 2, 33, -279, 3, 0, 8, 2, 7, -1, 2, 133, 2, 52, 3, 0, 11, 2, 6, -72, 3, 0, 3, 2, 134, 2, 135, -187, 3, 0, 2, 2, 37, 2, 0, 2, 136, 2, 137, 2, 55, 2, 0, 2, 138, 2, 139, 2, 140, 3, 0, 10, 2, 141, 2, 142, 2, 15, 3, 37, 2, 3, 53, 2, 3, 54, 2, 2, 143, -73, 2, 0, 0, 1065361407, 0, 16384, -11, 2, 0, 2, 121, -40, 3, 0, 6, 2, 117, -1, 3, 0, 2, 0, 2063, -37, 2, 55, 2, 144, 2, 145, 2, 146, 2, 147, 2, 148, -138, 3, 0, 1334, 2, 9, -1, 3, 0, 129, 2, 27, 3, 0, 6, 2, 9, 3, 0, 180, 2, 149, 3, 0, 233, 0, 1, -96, 3, 0, 16, 2, 9, -47, 3, 0, 154, 2, 56, -28517, 2, 0, 0, 1, -1, 2, 124, 2, 0, 0, 8193, -21, 2, 193, 0, 10255, 0, 4, -11, 2, 64, 2, 171, -1, 0, 71680, -1, 2, 161, 0, 4292900864, 0, 805306431, -5, 2, 150, -1, 2, 157, -1, 0, 6144, -2, 2, 127, -1, 2, 154, -1, 0, 2147532800, 2, 151, 2, 165, 2, 0, 2, 164, 0, 524032, 0, 4, -4, 2, 190, 0, 205128192, 0, 1333757536, 0, 2147483696, 0, 423953, 0, 747766272, 0, 2717763192, 0, 4286578751, 0, 278545, 2, 152, 0, 4294886464, 0, 33292336, 0, 417809, 2, 152, 0, 1327482464, 0, 4278190128, 0, 700594195, 0, 1006647527, 0, 4286497336, 0, 4160749631, 2, 153, 0, 469762560, 0, 4171219488, 0, 8323120, 2, 153, 0, 202375680, 0, 3214918176, 0, 4294508592, 2, 153, -1, 0, 983584, 0, 48, 0, 58720273, 0, 3489923072, 0, 10517376, 0, 4293066815, 0, 1, 0, 2013265920, 2, 177, 2, 0, 0, 2089, 0, 3221225552, 0, 201375904, 2, 0, -2, 0, 256, 0, 122880, 0, 16777216, 2, 150, 0, 4160757760, 2, 0, -6, 2, 167, -11, 0, 3263218176, -1, 0, 49664, 0, 2160197632, 0, 8388802, -1, 0, 12713984, -1, 2, 154, 2, 159, 2, 178, -2, 2, 162, -20, 0, 3758096385, -2, 2, 155, 0, 4292878336, 2, 90, 2, 169, 0, 4294057984, -2, 2, 163, 2, 156, 2, 175, -2, 2, 155, -1, 2, 182, -1, 2, 170, 2, 124, 0, 4026593280, 0, 14, 0, 4292919296, -1, 2, 158, 0, 939588608, -1, 0, 805306368, -1, 2, 124, 0, 1610612736, 2, 156, 2, 157, 2, 4, 2, 0, -2, 2, 158, 2, 159, -3, 0, 267386880, -1, 2, 160, 0, 7168, -1, 0, 65024, 2, 154, 2, 161, 2, 179, -7, 2, 168, -8, 2, 162, -1, 0, 1426112704, 2, 163, -1, 2, 164, 0, 271581216, 0, 2149777408, 2, 23, 2, 161, 2, 124, 0, 851967, 2, 180, -1, 2, 23, 2, 181, -4, 2, 158, -20, 2, 195, 2, 165, -56, 0, 3145728, 2, 185, -4, 2, 166, 2, 124, -4, 0, 32505856, -1, 2, 167, -1, 0, 2147385088, 2, 90, 1, 2155905152, 2, -3, 2, 103, 2, 0, 2, 168, -2, 2, 169, -6, 2, 170, 0, 4026597375, 0, 1, -1, 0, 1, -1, 2, 171, -3, 2, 117, 2, 64, -2, 2, 166, -2, 2, 176, 2, 124, -878, 2, 159, -36, 2, 172, -1, 2, 201, -10, 2, 188, -5, 2, 174, -6, 0, 4294965251, 2, 27, -1, 2, 173, -1, 2, 174, -2, 0, 4227874752, -3, 0, 2146435072, 2, 159, -2, 0, 1006649344, 2, 124, -1, 2, 90, 0, 201375744, -3, 0, 134217720, 2, 90, 0, 4286677377, 0, 32896, -1, 2, 158, -3, 2, 175, -349, 2, 176, 0, 1920, 2, 177, 3, 0, 264, -11, 2, 157, -2, 2, 178, 2, 0, 0, 520617856, 0, 2692743168, 0, 36, -3, 0, 524284, -11, 2, 23, -1, 2, 187, -1, 2, 184, 0, 3221291007, 2, 178, -1, 2, 202, 0, 2158720, -3, 2, 159, 0, 1, -4, 2, 124, 0, 3808625411, 0, 3489628288, 2, 200, 0, 1207959680, 0, 3221274624, 2, 0, -3, 2, 179, 0, 120, 0, 7340032, -2, 2, 180, 2, 4, 2, 23, 2, 163, 3, 0, 4, 2, 159, -1, 2, 181, 2, 177, -1, 0, 8176, 2, 182, 2, 179, 2, 183, -1, 0, 4290773232, 2, 0, -4, 2, 163, 2, 189, 0, 15728640, 2, 177, -1, 2, 161, -1, 0, 4294934512, 3, 0, 4, -9, 2, 90, 2, 170, 2, 184, 3, 0, 4, 0, 704, 0, 1849688064, 2, 185, -1, 2, 124, 0, 4294901887, 2, 0, 0, 130547712, 0, 1879048192, 2, 199, 3, 0, 2, -1, 2, 186, 2, 187, -1, 0, 17829776, 0, 2025848832, 0, 4261477888, -2, 2, 0, -1, 0, 4286580608, -1, 0, 29360128, 2, 192, 0, 16252928, 0, 3791388672, 2, 38, 3, 0, 2, -2, 2, 196, 2, 0, -1, 2, 103, -1, 0, 66584576, -1, 2, 191, 3, 0, 9, 2, 124, -1, 0, 4294755328, 3, 0, 2, -1, 2, 161, 2, 178, 3, 0, 2, 2, 23, 2, 188, 2, 90, -2, 0, 245760, 0, 2147418112, -1, 2, 150, 2, 203, 0, 4227923456, -1, 2, 164, 2, 161, 2, 90, -3, 0, 4292870145, 0, 262144, 2, 124, 3, 0, 2, 0, 1073758848, 2, 189, -1, 0, 4227921920, 2, 190, 0, 68289024, 0, 528402016, 0, 4292927536, 3, 0, 4, -2, 0, 268435456, 2, 91, -2, 2, 191, 3, 0, 5, -1, 2, 192, 2, 163, 2, 0, -2, 0, 4227923936, 2, 62, -1, 2, 155, 2, 95, 2, 0, 2, 154, 2, 158, 3, 0, 6, -1, 2, 177, 3, 0, 3, -2, 0, 2146959360, 0, 9440640, 0, 104857600, 0, 4227923840, 3, 0, 2, 0, 768, 2, 193, 2, 77, -2, 2, 161, -2, 2, 119, -1, 2, 155, 3, 0, 8, 0, 512, 0, 8388608, 2, 194, 2, 172, 2, 187, 0, 4286578944, 3, 0, 2, 0, 1152, 0, 1266679808, 2, 191, 0, 576, 0, 4261707776, 2, 95, 3, 0, 9, 2, 155, 3, 0, 5, 2, 16, -1, 0, 2147221504, -28, 2, 178, 3, 0, 3, -3, 0, 4292902912, -6, 2, 96, 3, 0, 85, -33, 0, 4294934528, 3, 0, 126, -18, 2, 195, 3, 0, 269, -17, 2, 155, 2, 124, 2, 198, 3, 0, 2, 2, 23, 0, 4290822144, -2, 0, 67174336, 0, 520093700, 2, 17, 3, 0, 21, -2, 2, 179, 3, 0, 3, -2, 0, 30720, -1, 0, 32512, 3, 0, 2, 0, 4294770656, -191, 2, 174, -38, 2, 170, 2, 0, 2, 196, 3, 0, 279, -8, 2, 124, 2, 0, 0, 4294508543, 0, 65295, -11, 2, 177, 3, 0, 72, -3, 0, 3758159872, 0, 201391616, 3, 0, 155, -7, 2, 170, -1, 0, 384, -1, 0, 133693440, -3, 2, 196, -2, 2, 26, 3, 0, 4, 2, 169, -2, 2, 90, 2, 155, 3, 0, 4, -2, 2, 164, -1, 2, 150, 0, 335552923, 2, 197, -1, 0, 538974272, 0, 2214592512, 0, 132000, -10, 0, 192, -8, 0, 12288, -21, 0, 134213632, 0, 4294901761, 3, 0, 42, 0, 100663424, 0, 4294965284, 3, 0, 6, -1, 0, 3221282816, 2, 198, 3, 0, 11, -1, 2, 199, 3, 0, 40, -6, 0, 4286578784, 2, 0, -2, 0, 1006694400, 3, 0, 24, 2, 35, -1, 2, 94, 3, 0, 2, 0, 1, 2, 163, 3, 0, 6, 2, 197, 0, 4110942569, 0, 1432950139, 0, 2701658217, 0, 4026532864, 0, 4026532881, 2, 0, 2, 45, 3, 0, 8, -1, 2, 158, -2, 2, 169, 0, 98304, 0, 65537, 2, 170, -5, 0, 4294950912, 2, 0, 2, 118, 0, 65528, 2, 177, 0, 4294770176, 2, 26, 3, 0, 4, -30, 2, 174, 0, 3758153728, -3, 2, 169, -2, 2, 155, 2, 188, 2, 158, -1, 2, 191, -1, 2, 161, 0, 4294754304, 3, 0, 2, -3, 0, 33554432, -2, 2, 200, -3, 2, 169, 0, 4175478784, 2, 201, 0, 4286643712, 0, 4286644216, 2, 0, -4, 2, 202, -1, 2, 165, 0, 4227923967, 3, 0, 32, -1334, 2, 163, 2, 0, -129, 2, 94, -6, 2, 163, -180, 2, 203, -233, 2, 4, 3, 0, 96, -16, 2, 163, 3, 0, 47, -154, 2, 165, 3, 0, 22381, -7, 2, 17, 3, 0, 6128], [4294967295, 4294967291, 4092460543, 4294828031, 4294967294, 134217726, 268435455, 2147483647, 1048575, 1073741823, 3892314111, 134217727, 1061158911, 536805376, 4294910143, 4160749567, 4294901759, 4294901760, 536870911, 262143, 8388607, 4294902783, 4294918143, 65535, 67043328, 2281701374, 4294967232, 2097151, 4294903807, 4194303, 255, 67108863, 4294967039, 511, 524287, 131071, 127, 4292870143, 4294902271, 4294549487, 33554431, 1023, 67047423, 4294901888, 4286578687, 4294770687, 67043583, 32767, 15, 2047999, 67043343, 16777215, 4294902000, 4294934527, 4294966783, 4294967279, 2047, 262083, 20511, 4290772991, 41943039, 493567, 4294959104, 603979775, 65536, 602799615, 805044223, 4294965206, 8191, 1031749119, 4294917631, 2134769663, 4286578493, 4282253311, 4294942719, 33540095, 4294905855, 4294967264, 2868854591, 1608515583, 265232348, 534519807, 2147614720, 1060109444, 4093640016, 17376, 2139062143, 224, 4169138175, 4294909951, 4286578688, 4294967292, 4294965759, 2044, 4292870144, 4294966272, 4294967280, 8289918, 4294934399, 4294901775, 4294965375, 1602223615, 4294967259, 4294443008, 268369920, 4292804608, 486341884, 4294963199, 3087007615, 1073692671, 4128527, 4279238655, 4294902015, 4294966591, 2445279231, 3670015, 3238002687, 31, 63, 4294967288, 4294705151, 4095, 3221208447, 4294549472, 2147483648, 4285526655, 4294966527, 4294705152, 4294966143, 64, 4294966719, 16383, 3774873592, 458752, 536807423, 67043839, 3758096383, 3959414372, 3755993023, 2080374783, 4294835295, 4294967103, 4160749565, 4087, 184024726, 2862017156, 1593309078, 268434431, 268434414, 4294901763, 536870912, 2952790016, 202506752, 139264, 402653184, 4261412864, 4227922944, 49152, 61440, 3758096384, 117440512, 65280, 3233808384, 3221225472, 2097152, 4294965248, 32768, 57152, 67108864, 4293918720, 4290772992, 25165824, 57344, 4227915776, 4278190080, 4227907584, 65520, 4026531840, 4227858432, 4160749568, 3758129152, 4294836224, 63488, 1073741824, 4294967040, 4194304, 251658240, 196608, 4294963200, 64512, 417808, 4227923712, 12582912, 50331648, 65472, 4294967168, 4294966784, 16, 4294917120, 2080374784, 4096, 65408, 524288, 65532]); function advanceChar(parser) { parser.column++; return (parser.currentChar = parser.source.charCodeAt(++parser.index)); } function consumeMultiUnitCodePoint(parser, hi) { if ((hi & 0xfc00) !== 55296) return 0; const lo = parser.source.charCodeAt(parser.index + 1); if ((lo & 0xfc00) !== 0xdc00) return 0; hi = parser.currentChar = 65536 + ((hi & 0x3ff) << 10) + (lo & 0x3ff); if (((unicodeLookup[(hi >>> 5) + 0] >>> hi) & 31 & 1) === 0) { report(parser, 18, fromCodePoint(hi)); } parser.index++; parser.column++; return 1; } function consumeLineFeed(parser, state) { parser.currentChar = parser.source.charCodeAt(++parser.index); parser.flags |= 1; if ((state & 4) === 0) { parser.column = 0; parser.line++; } } function scanNewLine(parser) { parser.flags |= 1; parser.currentChar = parser.source.charCodeAt(++parser.index); parser.column = 0; parser.line++; } function isExoticECMAScriptWhitespace(ch) { return (ch === 160 || ch === 65279 || ch === 133 || ch === 5760 || (ch >= 8192 && ch <= 8203) || ch === 8239 || ch === 8287 || ch === 12288 || ch === 8201 || ch === 65519); } function fromCodePoint(codePoint) { return codePoint <= 65535 ? String.fromCharCode(codePoint) : String.fromCharCode(codePoint >>> 10) + String.fromCharCode(codePoint & 0x3ff); } function toHex(code) { return code < 65 ? code - 48 : (code - 65 + 10) & 0xf; } function convertTokenType(t) { switch (t) { case 134283266: return 'NumericLiteral'; case 134283267: return 'StringLiteral'; case 86021: case 86022: return 'BooleanLiteral'; case 86023: return 'NullLiteral'; case 65540: return 'RegularExpression'; case 67174408: case 67174409: case 132: return 'TemplateLiteral'; default: if ((t & 143360) === 143360) return 'Identifier'; if ((t & 4096) === 4096) return 'Keyword'; return 'Punctuator'; } } const CharTypes = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8 | 1024, 0, 0, 8 | 2048, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8192, 0, 1 | 2, 0, 0, 8192, 0, 0, 0, 256, 0, 256 | 32768, 0, 0, 2 | 16 | 128 | 32 | 64, 2 | 16 | 128 | 32 | 64, 2 | 16 | 32 | 64, 2 | 16 | 32 | 64, 2 | 16 | 32 | 64, 2 | 16 | 32 | 64, 2 | 16 | 32 | 64, 2 | 16 | 32 | 64, 2 | 16 | 512 | 64, 2 | 16 | 512 | 64, 0, 0, 16384, 0, 0, 0, 0, 1 | 2 | 64, 1 | 2 | 64, 1 | 2 | 64, 1 | 2 | 64, 1 | 2 | 64, 1 | 2 | 64, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 1 | 2, 0, 1, 0, 0, 1 | 2 | 4096, 0, 1 | 2 | 4 | 64, 1 | 2 | 4 | 64, 1 | 2 | 4 | 64, 1 | 2 | 4 | 64, 1 | 2 | 4 | 64, 1 | 2 | 4 | 64, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 1 | 2 | 4, 16384, 0, 0, 0, 0 ]; const isIdStart = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 ]; const isIdPart = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 ]; function isIdentifierStart(code) { return code <= 0x7F ? isIdStart[code] : (unicodeLookup[(code >>> 5) + 34816] >>> code) & 31 & 1; } function isIdentifierPart(code) { return code <= 0x7F ? isIdPart[code] : (unicodeLookup[(code >>> 5) + 0] >>> code) & 31 & 1 || (code === 8204 || code === 8205); } const CommentTypes = ['SingleLine', 'MultiLine', 'HTMLOpen', 'HTMLClose', 'HashbangComment']; function skipHashBang(parser) { const source = parser.source; if (parser.currentChar === 35 && source.charCodeAt(parser.index + 1) === 33) { advanceChar(parser); advanceChar(parser); skipSingleLineComment(parser, source, 0, 4, parser.tokenPos, parser.linePos, parser.colPos); } } function skipSingleHTMLComment(parser, source, state, context, type, start, line, column) { if (context & 2048) report(parser, 0); return skipSingleLineComment(parser, source, state, type, start, line, column); } function skipSingleLineComment(parser, source, state, type, start, line, column) { const { index } = parser; parser.tokenPos = parser.index; parser.linePos = parser.line; parser.colPos = parser.column; while (parser.index < parser.end) { if (CharTypes[parser.currentChar] & 8) { const isCR = parser.currentChar === 13; scanNewLine(parser); if (isCR && parser.index < parser.end && parser.currentChar === 10) parser.currentChar = source.charCodeAt(++parser.index); break; } else if ((parser.currentChar ^ 8232) <= 1) { scanNewLine(parser); break; } advanceChar(parser); parser.tokenPos = parser.index; parser.linePos = parser.line; parser.colPos = parser.column; } if (parser.onComment) { const loc = { start: { line, column }, end: { line: parser.linePos, column: parser.colPos } }; parser.onComment(CommentTypes[type & 0xff], source.slice(index, parser.tokenPos), start, parser.tokenPos, loc); } return state | 1; } function skipMultiLineComment(parser, source, state) { const { index } = parser; while (parser.index < parser.end) { if (parser.currentChar < 0x2b) { let skippedOneAsterisk = false; while (parser.currentChar === 42) { if (!skippedOneAsterisk) { state &= ~4; skippedOneAsterisk = true; } if (advanceChar(parser) === 47) { advanceChar(parser); if (parser.onComment) { const loc = { start: { line: parser.linePos, column: parser.colPos }, end: { line: parser.line, column: parser.column } }; parser.onComment(CommentTypes[1 & 0xff], source.slice(index, parser.index - 2), index - 2, parser.index, loc); } parser.tokenPos = parser.index; parser.linePos = parser.line; parser.colPos = parser.column; return state; } } if (skippedOneAsterisk) { continue; } if (CharTypes[parser.currentChar] & 8) { if (parser.currentChar === 13) { state |= 1 | 4; scanNewLine(parser); } else { consumeLineFeed(parser, state); state = (state & ~4) | 1; } } else { advanceChar(parser); } } else if ((parser.currentChar ^ 8232) <= 1) { state = (state & ~4) | 1; scanNewLine(parser); } else { state &= ~4; advanceChar(parser); } } report(parser, 16); } function scanRegularExpression(parser, context) { const bodyStart = parser.index; let preparseState = 0; loop: while (true) { const ch = parser.currentChar; advanceChar(parser); if (preparseState & 1) { preparseState &= ~1; } else { switch (ch) { case 47: if (!preparseState) break loop; else break; case 92: preparseState |= 1; break; case 91: preparseState |= 2; break; case 93: preparseState &= 1; break; case 13: case 10: case 8232: case 8233: report(parser, 32); } } if (parser.index >= parser.source.length) { return report(parser, 32); } } const bodyEnd = parser.index - 1; let mask = 0; let char = parser.currentChar; const { index: flagStart } = parser; while (isIdentifierPart(char)) { switch (char) { case 103: if (mask & 2) report(parser, 34, 'g'); mask |= 2; break; case 105: if (mask & 1) report(parser, 34, 'i'); mask |= 1; break; case 109: if (mask & 4) report(parser, 34, 'm'); mask |= 4; break; case 117: if (mask & 16) report(parser, 34, 'u'); mask |= 16; break; case 121: if (mask & 8) report(parser, 34, 'y'); mask |= 8; break; case 115: if (mask & 32) report(parser, 34, 's'); mask |= 32; break; case 100: if (mask & 64) report(parser, 34, 'd'); mask |= 64; break; default: report(parser, 33); } char = advanceChar(parser); } const flags = parser.source.slice(flagStart, parser.index); const pattern = parser.source.slice(bodyStart, bodyEnd); parser.tokenRegExp = { pattern, flags }; if (context & 512) parser.tokenRaw = parser.source.slice(parser.tokenPos, parser.index); parser.tokenValue = validate(parser, pattern, flags); return 65540; } function validate(parser, pattern, flags) { try { return new RegExp(pattern, flags); } catch (e) { try { new RegExp(pattern, flags.replace('d', '')); return null; } catch (e) { report(parser, 32); } } } function scanString(parser, context, quote) { const { index: start } = parser; let ret = ''; let char = advanceChar(parser); let marker = parser.index; while ((CharTypes[char] & 8) === 0) { if (char === quote) { ret += parser.source.slice(marker, parser.index); advanceChar(parser); if (context & 512) parser.tokenRaw = parser.source.slice(start, parser.index); parser.tokenValue = ret; return 134283267; } if ((char & 8) === 8 && char === 92) { ret += parser.source.slice(marker, parser.index); char = advanceChar(parser); if (char < 0x7f || char === 8232 || char === 8233) { const code = parseEscape(parser, context, char); if (code >= 0) ret += fromCodePoint(code); else handleStringError(parser, code, 0); } else { ret += fromCodePoint(char); } marker = parser.index + 1; } if (parser.index >= parser.end) report(parser, 14); char = advanceChar(parser); } report(parser, 14); } function parseEscape(parser, context, first) { switch (first) { case 98: return 8; case 102: return 12; case 114: return 13; case 110: return 10; case 116: return 9; case 118: return 11; case 13: { if (parser.index < parser.end) { const nextChar = parser.source.charCodeAt(parser.index + 1); if (nextChar === 10) { parser.index = parser.index + 1; parser.currentChar = nextChar; } } } case 10: case 8232: case 8233: parser.column = -1; parser.line++; return -1; case 48: case 49: case 50: case 51: { let code = first - 48; let index = parser.index + 1; let column = parser.column + 1; if (index < parser.end) { const next = parser.source.charCodeAt(index); if ((CharTypes[next] & 32) === 0) { if ((code !== 0 || CharTypes[next] & 512) && context & 1024) return -2; } else if (context & 1024) { return -2; } else { parser.currentChar = next; code = (code << 3) | (next - 48); index++; column++; if (index < parser.end) { const next = parser.source.charCodeAt(index); if (CharTypes[next] & 32) { parser.currentChar = next; code = (code << 3) | (next - 48); index++; column++; } } parser.flags |= 64; parser.index = index - 1; parser.column = column - 1; } } return code; } case 52: case 53: case 54: case 55: { if (context & 1024) return -2; let code = first - 48; const index = parser.index + 1; const column = parser.column + 1; if (index < parser.end) { const next = parser.source.charCodeAt(index); if (CharTypes[next] & 32) { code = (code << 3) | (next - 48); parser.currentChar = next; parser.index = index; parser.column = column; } } parser.flags |= 64; return code; } case 120: { const ch1 = advanceChar(parser); if ((CharTypes[ch1] & 64) === 0) return -4; const hi = toHex(ch1); const ch2 = advanceChar(parser); if ((CharTypes[ch2] & 64) === 0) return -4; const lo = toHex(ch2); return (hi << 4) | lo; } case 117: { const ch = advanceChar(parser); if (parser.currentChar === 123) { let code = 0; while ((CharTypes[advanceChar(parser)] & 64) !== 0) { code = (code << 4) | toHex(parser.currentChar); if (code > 1114111) return -5; } if (parser.currentChar < 1 || parser.currentChar !== 125) { return -4; } return code; } else { if ((CharTypes[ch] & 64) === 0) return -4; const ch2 = parser.source.charCodeAt(parser.index + 1); if ((CharTypes[ch2] & 64) === 0) return -4; const ch3 = parser.source.charCodeAt(parser.index + 2); if ((CharTypes[ch3] & 64) === 0) return -4; const ch4 = parser.source.charCodeAt(parser.index + 3); if ((CharTypes[ch4] & 64) === 0) return -4; parser.index += 3; parser.column += 3; parser.currentChar = parser.source.charCodeAt(parser.index); return (toHex(ch) << 12) | (toHex(ch2) << 8) | (toHex(ch3) << 4) | toHex(ch4); } } case 56: case 57: if ((context & 256) === 0) return -3; default: return first; } } function handleStringError(state, code, isTemplate) { switch (code) { case -1: return; case -2: report(state, isTemplate ? 2 : 1); case -3: report(state, 13); case -4: report(state, 6); case -5: report(state, 101); } } function scanTemplate(parser, context) { const { index: start } = parser; let token = 67174409; let ret = ''; let char = advanceChar(parser); while (char !== 96) { if (char === 36 && parser.source.charCodeAt(parser.index + 1) === 123) { advanceChar(parser); token = 67174408; break; } else if ((char & 8) === 8 && char === 92) { char = advanceChar(parser); if (char > 0x7e) { ret += fromCodePoint(char); } else { const code = parseEscape(parser, context | 1024, char); if (code >= 0) { ret += fromCodePoint(code); } else if (code !== -1 && context & 65536) { ret = undefined; char = scanBadTemplate(parser, char); if (char < 0) token = 67174408; break; } else { handleStringError(parser, code, 1); } } } else { if (parser.index < parser.end && char === 13 && parser.source.charCodeAt(parser.index) === 10) { ret += fromCodePoint(char); parser.currentChar = parser.source.charCodeAt(++parser.index); } if (((char & 83) < 3 && char === 10) || (char ^ 8232) <= 1) { parser.column = -1; parser.line++; } ret += fromCodePoint(char); } if (parser.index >= parser.end) report(parser, 15); char = advanceChar(parser); } advanceChar(parser); parser.tokenValue = ret; parser.tokenRaw = parser.source.slice(start + 1, parser.index - (token === 67174409 ? 1 : 2)); return token; } function scanBadTemplate(parser, ch) { while (ch !== 96) { switch (ch) { case 36: { const index = parser.index + 1; if (index < parser.end && parser.source.charCodeAt(index) === 123) { parser.index = index; parser.column++; return -ch; } break; } case 10: case 8232: case 8233: parser.column = -1; parser.line++; } if (parser.index >= parser.end) report(parser, 15); ch = advanceChar(parser); } return ch; } function scanTemplateTail(parser, context) { if (parser.index >= parser.end) report(parser, 0); parser.index--; parser.column--; return scanTemplate(parser, context); } function scanNumber(parser, context, kind) { let char = parser.currentChar; let value = 0; let digit = 9; let atStart = kind & 64 ? 0 : 1; let digits = 0; let allowSeparator = 0; if (kind & 64) { value = '.' + scanDecimalDigitsOrSeparator(parser, char); char = parser.currentChar; if (char === 110) report(parser, 11); } else { if (char === 48) { char = advanceChar(parser); if ((char | 32) === 120) { kind = 8 | 128; char = advanceChar(parser); while (CharTypes[char] & (64 | 4096)) { if (char === 95) { if (!allowSeparator) report(parser, 146); allowSeparator = 0; char = advanceChar(parser); continue; } allowSeparator = 1; value = value * 0x10 + toHex(char); digits++; char = advanceChar(parser); } if (digits === 0 || !allowSeparator) { report(parser, digits === 0 ? 19 : 147); } } else if ((char | 32) === 111) { kind = 4 | 128; char = advanceChar(parser); while (CharTypes[char] & (32 | 4096)) { if (char === 95) { if (!allowSeparator) { report(parser, 146); } allowSeparator = 0; char = advanceChar(parser); continue; } allowSeparator = 1; value = value * 8 + (char - 48); digits++; char = advanceChar(parser); } if (digits === 0 || !allowSeparator) { report(parser, digits === 0 ? 0 : 147); } } else if ((char | 32) === 98) { kind = 2 | 128; char = advanceChar(parser); while (CharTypes[char] & (128 | 4096)) { if (char === 95) { if (!allowSeparator) { report(parser, 146); } allowSeparator = 0; char = advanceChar(parser); continue; } allowSeparator = 1; value = value * 2 + (char - 48); digits++; char = advanceChar(parser); } if (digits === 0 || !allowSeparator) { report(parser, digits === 0 ? 0 : 147); } } else if (CharTypes[char] & 32) { if (context & 1024) report(parser, 1); kind = 1; while (CharTypes[char] & 16) { if (CharTypes[char] & 512) { kind = 32; atStart = 0; break; } value = value * 8 + (char - 48); char = advanceChar(parser); } } else if (CharTypes[char] & 512) { if (context & 1024) report(parser, 1); parser.flags |= 64; kind = 32; } else if (char === 95) { report(parser, 0); } } if (kind & 48) { if (atStart) { while (digit >= 0 && CharTypes[char] & (16 | 4096)) { if (char === 95) { char = advanceChar(parser); if (char === 95 || kind & 32) { reportScannerError(parser.index, parser.line, parser.index + 1, 146); } allowSeparator = 1; continue; } allowSeparator = 0; value = 10 * value + (char - 48); char = advanceChar(parser); --digit; } if (allowSeparator) { reportScannerError(parser.index, parser.line, parser.index + 1, 147); } if (digit >= 0 && !isIdentifierStart(char) && char !== 46) { parser.tokenValue = value; if (context & 512) parser.tokenRaw = parser.source.slice(parser.tokenPos, parser.index); return 134283266; } } value += scanDecimalDigitsOrSeparator(parser, char); char = parser.currentChar; if (char === 46) { if (advanceChar(parser) === 95) report(parser, 0); kind = 64; value += '.' + scanDecimalDigitsOrSeparator(parser, parser.currentChar); char = parser.currentChar; } } } const end = parser.index; let isBigInt = 0; if (char === 110 && kind & 128) { isBigInt = 1; char = advanceChar(parser); } else { if ((char | 32) === 101) { char = advanceChar(parser); if (CharTypes[char] & 256) char = advanceChar(parser); const { index } = parser; if ((CharTypes[char] & 16) === 0) report(parser, 10); value += parser.source.substring(end, index) + scanDecimalDigitsOrSeparator(parser, char); char = parser.currentChar; } } if ((parser.index < parser.end && CharTypes[char] & 16) || isIdentifierStart(char)) { report(parser, 12); } if (isBigInt) { parser.tokenRaw = parser.source.slice(parser.tokenPos, parser.index); parser.tokenValue = BigInt(value); return 134283389; } parser.tokenValue = kind & (1 | 2 | 8 | 4) ? value : kind & 32 ? parseFloat(parser.source.substring(parser.tokenPos, parser.index)) : +value; if (context & 512) parser.tokenRaw = parser.source.slice(parser.tokenPos, parser.index); return 134283266; } function scanDecimalDigitsOrSeparator(parser, char) { let allowSeparator = 0; let start = parser.index; let ret = ''; while (CharTypes[char] & (16 | 4096)) { if (char === 95) { const { index } = parser; char = advanceChar(parser); if (char === 95) { reportScannerError(parser.index, parser.line, parser.index + 1, 146); } allowSeparator = 1; ret += parser.source.substring(start, index); start = parser.index; continue; } allowSeparator = 0; char = advanceChar(parser); } if (allowSeparator) { reportScannerError(parser.index, parser.line, parser.index + 1, 147); } return ret + parser.source.substring(start, parser.index); } const KeywordDescTable = [ 'end of source', 'identifier', 'number', 'string', 'regular expression', 'false', 'true', 'null', 'template continuation', 'template tail', '=>', '(', '{', '.', '...', '}', ')', ';', ',', '[', ']', ':', '?', '\'', '"', '', '++', '--', '=', '<<=', '>>=', '>>>=', '**=', '+=', '-=', '*=', '/=', '%=', '^=', '|=', '&=', '||=', '&&=', '??=', 'typeof', 'delete', 'void', '!', '~', '+', '-', 'in', 'instanceof', '*', '%', '/', '**', '&&', '||', '===', '!==', '==', '!=', '<=', '>=', '<', '>', '<<', '>>', '>>>', '&', '|', '^', 'var', 'let', 'const', 'break', 'case', 'catch', 'class', 'continue', 'debugger', 'default', 'do', 'else', 'export', 'extends', 'finally', 'for', 'function', 'if', 'import', 'new', 'return', 'super', 'switch', 'this', 'throw', 'try', 'while', 'with', 'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield', 'as', 'async', 'await', 'constructor', 'get', 'set', 'from', 'of', 'enum', 'eval', 'arguments', 'escaped keyword', 'escaped future reserved keyword', 'reserved if strict', '#', 'BigIntLiteral', '??', '?.', 'WhiteSpace', 'Illegal', 'LineTerminator', 'PrivateField', 'Template', '@', 'target', 'meta', 'LineFeed', 'Escaped', 'JSXText' ]; const descKeywordTable = Object.create(null, { this: { value: 86113 }, function: { value: 86106 }, if: { value: 20571 }, return: { value: 20574 }, var: { value: 86090 }, else: { value: 20565 }, for: { value: 20569 }, new: { value: 86109 }, in: { value: 8738868 }, typeof: { value: 16863277 }, while: { value: 20580 }, case: { value: 20558 }, break: { value: 20557 }, try: { value: 20579 }, catch: { value: 20559 }, delete: { value: 16863278 }, throw: { value: 86114 }, switch: { value: 86112 }, continue: { value: 20561 }, default: { value: 20563 }, instanceof: { value: 8476725 }, do: { value: 20564 }, void: { value: 16863279 }, finally: { value: 20568 }, async: { value: 209007 }, await: { value: 209008 }, class: { value: 86096 }, const: { value: 86092 }, constructor: { value: 12401 }, debugger: { value: 20562 }, export: { value: 20566 }, extends: { value: 20567 }, false: { value: 86021 }, from: { value: 12404 }, get: { value: 12402 }, implements: { value: 36966 }, import: { value: 86108 }, interface: { value: 36967 }, let: { value: 241739 }, null: { value: 86023 }, of: { value: 274549 }, package: { value: 36968 }, private: { value: 36969 }, protected: { value: 36970 }, public: { value: 36971 }, set: { value: 12403 }, static: { value: 36972 }, super: { value: 86111 }, true: { value: 86022 }, with: { value: 20581 }, yield: { value: 241773 }, enum: { value: 86134 }, eval: { value: 537079927 }, as: { value: 77934 }, arguments: { value: 537079928 }, target: { value: 143494 }, meta: { value: 143495 }, }); function scanIdentifier(parser, context, isValidAsKeyword) { while (isIdPart[advanceChar(parser)]) { } parser.tokenValue = parser.source.slice(parser.tokenPos, parser.index); return parser.currentChar !== 92 && parser.currentChar < 0x7e ? descKeywordTable[parser.tokenValue] || 208897 : scanIdentifierSlowCase(parser, context, 0, isValidAsKeyword); } function scanUnicodeIdentifier(parser, context) { const cookedChar = scanIdentifierUnicodeEscape(parser); if (!isIdentifierPart(cookedChar)) report(parser, 4); parser.tokenValue = fromCodePoint(cookedChar); return scanIdentifierSlowCase(parser, context, 1, CharTypes[cookedChar] & 4); } function scanIdentifierSlowCase(parser, context, hasEscape, isValidAsKeyword) { let start = parser.index; while (parser.index < parser.end) { if (parser.currentChar === 92) { parser.tokenValue += parser.source.slice(start, parser.index); hasEscape = 1; const code = scanIdentifierUnicodeEscape(parser); if (!isIdentifierPart(code)) report(parser, 4); isValidAsKeyword = isValidAsKeyword && CharTypes[code] & 4; parser.tokenValue += fromCodePoint(code); start = parser.index; } else if (isIdentifierPart(parser.currentChar) || consumeMultiUnitCodePoint(parser, parser.currentChar)) { advanceChar(parser); } else { break; } } if (parser.index <= parser.end) { parser.tokenValue += parser.source.slice(start, parser.index); } const length = parser.tokenValue.length; if (isValidAsKeyword && length >= 2 && length <= 11) { const token = descKeywordTable[parser.tokenValue]; if (token === void 0) return 208897; if (!hasEscape) return token; if (context & 1024) { return token === 209008 && (context & (2048 | 4194304)) === 0 ? token : token === 36972 ? 122 : (token & 36864) === 36864 ? 122 : 121; } if (context & 1073741824 && (context & 8192) === 0 && (token & 20480) === 20480) return token; if (token === 241773) { return context & 1073741824 ? 143483 : context & 2097152 ? 121 : token; } return token === 209007 && context & 1073741824 ? 143483 : (token & 36864) === 36864 ? token : token === 209008 && (context & 4194304) === 0 ? token : 121; } return 208897; } function scanPrivateIdentifier(parser) { if (!isIdentifierStart(advanceChar(parser))) report(parser, 93); return 131; } function scanIdentifierUnicodeEscape(parser) { if (parser.source.charCodeAt(parser.index + 1) !== 117) { report(parser, 4); } parser.currentChar = parser.source.charCodeAt((parser.index += 2)); return scanUnicodeEscape(parser); } function scanUnicodeEscape(parser) { let codePoint = 0; const char = parser.currentChar; if (char === 123) { const begin = parser.index - 2; while (CharTypes[advanceChar(parser)] & 64) { codePoint = (codePoint << 4) | toHex(parser.currentChar); if (codePoint > 1114111) reportScannerError(begin, parser.line, parser.index + 1, 101); } if (parser.currentChar !== 125) { reportScannerError(begin, parser.line, parser.index - 1, 6); } advanceChar(parser); return codePoint; } if ((CharTypes[char] & 64) === 0) report(parser, 6); const char2 = parser.source.charCodeAt(parser.index + 1); if ((CharTypes[char2] & 64) === 0) report(parser, 6); const char3 = parser.source.charCodeAt(parser.index + 2); if ((CharTypes[char3] & 64) === 0) report(parser, 6); const char4 = parser.source.charCodeAt(parser.index + 3); if ((CharTypes[char4] & 64) === 0) report(parser, 6); codePoint = (toHex(char) << 12) | (toHex(char2) << 8) | (toHex(char3) << 4) | toHex(char4); parser.currentChar = parser.source.charCodeAt((parser.index += 4)); return codePoint; } const TokenLookup = [ 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 136, 128, 128, 130, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 16842800, 134283267, 131, 208897, 8457015, 8455751, 134283267, 67174411, 16, 8457014, 25233970, 18, 25233971, 67108877, 8457016, 134283266, 134283266, 134283266, 134283266, 134283266, 134283266, 134283266, 134283266, 134283266, 134283266, 21, 1074790417, 8456258, 1077936157, 8456259, 22, 133, 208897, 208897, 208897, 208897, 208897, 208897, 208897, 208897, 208897, 208897, 208897, 208897, 208897, 208897, 208897, 208897, 208897, 208897, 208897, 208897, 208897, 208897, 208897, 208897, 208897, 208897, 69271571, 137, 20, 8455497, 208897, 132, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 208897, 4096, 208897, 208897, 4096, 208897, 4096, 208897, 4096, 208897, 4096, 4096, 4096, 208897, 4096, 4096, 208897, 4096, 4096, 2162700, 8455240, 1074790415, 16842801, 129 ]; function nextToken(parser, context) { parser.flags = (parser.flags | 1) ^ 1; parser.startPos = parser.index; parser.startColumn = parser.column; parser.startLine = parser.line; parser.token = scanSingleToken(parser, context, 0); if (parser.onToken && parser.token !== 1048576) { const loc = { start: { line: parser.linePos, column: parser.colPos }, end: { line: parser.line, column: parser.column } }; parser.onToken(convertTokenType(parser.token), parser.tokenPos, parser.index, loc); } } function scanSingleToken(parser, context, state) { const isStartOfLine = parser.index === 0; const source = parser.source; let startPos = parser.index; let startLine = parser.line; let startColumn = parser.column; while (parser.index < parser.end) { parser.tokenPos = parser.index; parser.colPos = parser.column; parser.linePos = parser.line; let char = parser.currentChar; if (char <= 0x7e) { const token = TokenLookup[char]; switch (token) { case 67174411: case 16: case 2162700: case 1074790415: case 69271571: case 20: case 21: case 1074790417: case 18: case 16842801: case 133: case 129: advanceChar(parser); return token; case 208897: return scanIdentifier(parser, context, 0); case 4096: return scanIdentifier(parser, context, 1); case 134283266: return scanNumber(parser, context, 16 | 128); case 134283267: return scanString(parser, context, char); case 132: return scanTemplate(parser, context); case 137: return scanUnicodeIdentifier(parser, context); case 131: return scanPrivateIdentifier(parser); case 128: advanceChar(parser); break; case 130: state |= 1 | 4; scanNewLine(parser); break; case 136: consumeLineFeed(parser, state); state = (state & ~4) | 1; break; case 8456258: let ch = advanceChar(parser); if (parser.index < parser.end) { if (ch === 60) { if (parser.index < parser.end && advanceChar(parser) === 61) { advanceChar(parser); return 4194334; } return 8456516; } else if (ch === 61) { advanceChar(parser); return 8456256; } if (ch === 33) { const index = parser.index + 1; if (index + 1 < parser.end && source.charCodeAt(index) === 45 && source.charCodeAt(index + 1) == 45) { parser.column += 3; parser.currentChar = source.charCodeAt((parser.index += 3)); state = skipSingleHTMLComment(parser, source, state, context, 2, parser.tokenPos, parser.linePos, parser.colPos); startPos = parser.tokenPos; startLine = parser.linePos; startColumn = parser.colPos; continue; } return 8456258; } if (ch === 47) { if ((context & 16) === 0) return 8456258; const index = parser.index + 1; if (index < parser.end) { ch = source.charCodeAt(index); if (ch === 42 || ch === 47) break; } advanceChar(parser); return 25; } } return 8456258; case 1077936157: { advanceChar(parser); const ch = parser.currentChar; if (ch === 61) { if (advanceChar(parser) === 61) { advanceChar(parser); return 8455996; } return 8455998; } if (ch === 62) { advanceChar(parser); return 10; } return 1077936157; } case 16842800: if (advanceChar(parser) !== 61) { return 16842800; } if (advanceChar(parser) !== 61) { return 8455999; } advanceChar(parser); return 8455997; case 8457015: if (advanceChar(parser) !== 61) return 8457015; advanceChar(parser); return 4194342; case 8457014: { advanceChar(parser); if (parser.index >= parser.end) return 8457014; const ch = parser.currentChar; if (ch === 61) { advanceChar(parser); return 4194340; } if (ch !== 42) return 8457014; if (advanceChar(parser) !== 61) return 8457273; advanceChar(parser); return 4194337; } case 8455497: if (advanceChar(parser) !== 61) return 8455497; advanceChar(parser); return 4194343; case 25233970: { advanceChar(parser); const ch = parser.currentChar; if (ch === 43) { advanceChar(parser); return 33619995; } if (ch === 61) { advanceChar(parser); return 4194338; } return 25233970; } case 25233971: { advanceChar(parser); const ch = parser.currentChar; if (ch === 45) { advanceChar(parser); if ((state & 1 || isStartOfLine) && parser.currentChar === 62) { if ((context & 256) === 0) report(parser, 108); advanceChar(parser); state = skipSingleHTMLComment(parser, source, state, context, 3, startPos, startLine, startColumn); startPos = parser.tokenPos; startLine = parser.linePos; startColumn = parser.colPos; continue; } return 33619996; } if (ch === 61) { advanceChar(parser); return 4194339; } return 25233971; } case 8457016: { advanceChar(parser); if (parser.index < parser.end) { const ch = parser.currentChar; if (ch === 47) { advanceChar(parser); state = skipSingleLineComment(parser, source, state, 0, parser.tokenPos, parser.linePos, parser.colPos); startPos = parser.tokenPos; startLine = parser.linePos; startColumn = parser.colPos; continue; } if (ch === 42) { advanceChar(parser); state = skipMultiLineComment(parser, source, state); startPos = parser.tokenPos; startLine = parser.linePos; startColumn = parser.colPos; continue; } if (context & 32768) { return scanRegularExpression(parser, context); } if (ch === 61) { advanceChar(parser); return 4259877; } } return 8457016; } case 67108877: const next = advanceChar(parser); if (next >= 48 && next <= 57) return scanNumber(parser, context, 64 | 16); if (next === 46) { const index = parser.index + 1; if (index < parser.end && source.charCodeAt(index) === 46) { parser.column += 2; parser.currentChar = source.charCodeAt((parser.index += 2)); return 14; } } return 67108877; case 8455240: { advanceChar(parser); const ch = parser.currentChar; if (ch === 124) { advanceChar(parser); if (parser.currentChar === 61) { advanceChar(parser); return 4194346; } return 8979003; } if (ch === 61) { advanceChar(parser); return 4194344; } return 8455240; } case 8456259: { advanceChar(parser); const ch = parser.currentChar; if (ch === 61) { advanceChar(parser); return 8456257; } if (ch !== 62) return 8456259; advanceChar(parser); if (parser.index < parser.end) { const ch = parser.currentChar; if (ch === 62) { if (advanceChar(parser) === 61) { advanceChar(parser); return 4194336; } return 8456518; } if (ch === 61) { advanceChar(parser); return 4194335; } } return 8456517; } case 8455751: { advanceChar(parser); const ch = parser.currentChar; if (ch === 38) { advanceChar(parser); if (parser.currentChar === 61) { advanceChar(parser); return 4194347; } return 8979258; } if (ch === 61) { advanceChar(parser); return 4194345; } return 8455751; } case 22: { let ch = advanceChar(parser); if (ch === 63) { advanceChar(parser); if (parser.currentChar === 61) { advanceChar(parser); return 4194348; } return 276889982; } if (ch === 46) { const index = parser.index + 1; if (index < parser.end) { ch = source.charCodeAt(index); if (!(ch >= 48 && ch <= 57)) { advanceChar(parser); return 67108991; } } } return 22; } } } else { if ((char ^ 8232) <= 1) { state = (state & ~4) | 1; scanNewLine(parser); continue; } if ((char & 0xfc00) === 0xd800 || ((unicodeLookup[(char >>> 5) + 34816] >>> char) & 31 & 1) !== 0) { if ((char & 0xfc00) === 0xdc00) { char = ((char & 0x3ff) << 10) | (char & 0x3ff) | 0x10000; if (((unicodeLookup[(char >>> 5) + 0] >>> char) & 31 & 1) === 0) { report(parser, 18, fromCodePoint(char)); } parser.index++; parser.currentChar = char; } parser.column++; parser.tokenValue = ''; return scanIdentifierSlowCase(parser, context, 0, 0); } if (isExoticECMAScriptWhitespace(char)) { advanceChar(parser); continue; } report(parser, 18, fromCodePoint(char)); } } return 1048576; } const entities = { AElig: '\u00C6', AMP: '\u0026', Aacute: '\u00C1', Abreve: '\u0102', Acirc: '\u00C2', Acy: '\u0410', Afr: '\uD835\uDD04', Agrave: '\u00C0', Alpha: '\u0391', Amacr: '\u0100', And: '\u2A53', Aogon: '\u0104', Aopf: '\uD835\uDD38', ApplyFunction: '\u2061', Aring: '\u00C5', Ascr: '\uD835\uDC9C', Assign: '\u2254', Atilde: '\u00C3', Auml: '\u00C4', Backslash: '\u2216', Barv: '\u2AE7', Barwed: '\u2306', Bcy: '\u0411', Because: '\u2235', Bernoullis: '\u212C', Beta: '\u0392', Bfr: '\uD835\uDD05', Bopf: '\uD835\uDD39', Breve: '\u02D8', Bscr: '\u212C', Bumpeq: '\u224E', CHcy: '\u0427', COPY: '\u00A9', Cacute: '\u0106', Cap: '\u22D2', CapitalDifferentialD: '\u2145', Cayleys: '\u212D', Ccaron: '\u010C', Ccedil: '\u00C7', Ccirc: '\u0108', Cconint: '\u2230', Cdot: '\u010A', Cedilla: '\u00B8', CenterDot: '\u00B7', Cfr: '\u212D', Chi: '\u03A7', CircleDot: '\u2299', CircleMinus: '\u2296', CirclePlus: '\u2295', CircleTimes: '\u2297', ClockwiseContourIntegral: '\u2232', CloseCurlyDoubleQuote: '\u201D', CloseCurlyQuote: '\u2019', Colon: '\u2237', Colone: '\u2A74', Congruent: '\u2261', Conint: '\u222F', ContourIntegral: '\u222E', Copf: '\u2102', Coproduct: '\u2210', CounterClockwiseContourIntegral: '\u2233', Cross: '\u2A2F', Cscr: '\uD835\uDC9E', Cup: '\u22D3', CupCap: '\u224D', DD: '\u2145', DDotrahd: '\u2911', DJcy: '\u0402', DScy: '\u0405', DZcy: '\u040F', Dagger: '\u2021', Darr: '\u21A1', Dashv: '\u2AE4', Dcaron: '\u010E', Dcy: '\u0414', Del: '\u2207', Delta: '\u0394', Dfr: '\uD835\uDD07', DiacriticalAcute: '\u00B4', DiacriticalDot: '\u02D9', DiacriticalDoubleAcute: '\u02DD', DiacriticalGrave: '\u0060', DiacriticalTilde: '\u02DC', Diamond: '\u22C4', DifferentialD: '\u2146', Dopf: '\uD835\uDD3B', Dot: '\u00A8', DotDot: '\u20DC', DotEqual: '\u2250', DoubleContourIntegral: '\u222F', DoubleDot: '\u00A8', DoubleDownArrow: '\u21D3', DoubleLeftArrow: '\u21D0', DoubleLeftRightArrow: '\u21D4', DoubleLeftTee: '\u2AE4', DoubleLongLeftArrow: '\u27F8', DoubleLongLeftRightArrow: '\u27FA', DoubleLongRightArrow: '\u27F9', DoubleRightArrow: '\u21D2', DoubleRightTee: '\u22A8', DoubleUpArrow: '\u21D1', DoubleUpDownArrow: '\u21D5', DoubleVerticalBar: '\u2225', DownArrow: '\u2193', DownArrowBar: '\u2913', DownArrowUpArrow: '\u21F5', DownBreve: '\u0311', DownLeftRightVector: '\u2950', DownLeftTeeVector: '\u295E', DownLeftVector: '\u21BD', DownLeftVectorBar: '\u2956', DownRightTeeVector: '\u295F', DownRightVector: '\u21C1', DownRightVectorBar: '\u2957', DownTee: '\u22A4', DownTeeArrow: '\u21A7', Downarrow: '\u21D3', Dscr: '\uD835\uDC9F', Dstrok: '\u0110', ENG: '\u014A', ETH: '\u00D0', Eacute: '\u00C9', Ecaron: '\u011A', Ecirc: '\u00CA', Ecy: '\u042D', Edot: '\u0116', Efr: '\uD835\uDD08', Egrave: '\u00C8', Element: '\u2208', Emacr: '\u0112', EmptySmallSquare: '\u25FB', EmptyVerySmallSquare: '\u25AB', Eogon: '\u0118', Eopf: '\uD835\uDD3C', Epsilon: '\u0395', Equal: '\u2A75', EqualTilde: '\u2242', Equilibrium: '\u21CC', Escr: '\u2130', Esim: '\u2A73', Eta: '\u0397', Euml: '\u00CB', Exists: '\u2203', ExponentialE: '\u2147', Fcy: '\u0424', Ffr: '\uD835\uDD09', FilledSmallSquare: '\u25FC', FilledVerySmallSquare: '\u25AA', Fopf: '\uD835\uDD3D', ForAll: '\u2200', Fouriertrf: '\u2131', Fscr: '\u2131', GJcy: '\u0403', GT: '\u003E', Gamma: '\u0393', Gammad: '\u03DC', Gbreve: '\u011E', Gcedil: '\u0122', Gcirc: '\u011C', Gcy: '\u0413', Gdot: '\u0120', Gfr: '\uD835\uDD0A', Gg: '\u22D9', Gopf: '\uD835\uDD3E', GreaterEqual: '\u2265', GreaterEqualLess: '\u22DB', GreaterFullEqual: '\u2267', GreaterGreater: '\u2AA2', GreaterLess: '\u2277', GreaterSlantEqual: '\u2A7E', GreaterTilde: '\u2273', Gscr: '\uD835\uDCA2', Gt: '\u226B', HARDcy: '\u042A', Hacek: '\u02C7', Hat: '\u005E', Hcirc: '\u0124', Hfr: '\u210C', HilbertSpace: '\u210B', Hopf: '\u210D', HorizontalLine: '\u2500', Hscr: '\u210B', Hstrok: '\u0126', HumpDownHump: '\u224E', HumpEqual: '\u224F', IEcy: '\u0415', IJlig: '\u0132', IOcy: '\u0401', Iacute: '\u00CD', Icirc: '\u00CE', Icy: '\u0418', Idot: '\u0130', Ifr: '\u2111', Igrave: '\u00CC', Im: '\u2111', Imacr: '\u012A', ImaginaryI: '\u2148', Implies: '\u21D2', Int: '\u222C', Integral: '\u222B', Intersection: '\u22C2', InvisibleComma: '\u2063', InvisibleTimes: '\u2062', Iogon: '\u012E', Iopf: '\uD835\uDD40', Iota: '\u0399', Iscr: '\u2110', Itilde: '\u0128', Iukcy: '\u0406', Iuml: '\u00CF', Jcirc: '\u0134', Jcy: '\u0419', Jfr: '\uD835\uDD0D', Jopf: '\uD835\uDD41', Jscr: '\uD835\uDCA5', Jsercy: '\u0408', Jukcy: '\u0404', KHcy: '\u0425', KJcy: '\u040C', Kappa: '\u039A', Kcedil: '\u0136', Kcy: '\u041A', Kfr: '\uD835\uDD0E', Kopf: '\uD835\uDD42', Kscr: '\uD835\uDCA6', LJcy: '\u0409', LT: '\u003C', Lacute: '\u0139', Lambda: '\u039B', Lang: '\u27EA', Laplacetrf: '\u2112', Larr: '\u219E', Lcaron: '\u013D', Lcedil: '\u013B', Lcy: '\u041B', LeftAngleBracket: '\u27E8', LeftArrow: '\u2190', LeftArrowBar: '\u21E4', LeftArrowRightArrow: '\u21C6', LeftCeiling: '\u2308', LeftDoubleBracket: '\u27E6', LeftDownTeeVector: '\u2961', LeftDownVector: '\u21C3', LeftDownVectorBar: '\u2959', LeftFloor: '\u230A', LeftRightArrow: '\u2194', LeftRightVector: '\u294E', LeftTee: '\u22A3', LeftTeeArrow: '\u21A4', LeftTeeVector: '\u295A', LeftTriangle: '\u22B2', LeftTriangleBar: '\u29CF', LeftTriangleEqual: '\u22B4', LeftUpDownVector: '\u2951', LeftUpTeeVector: '\u2960', LeftUpVector: '\u21BF', LeftUpVectorBar: '\u2958', LeftVector: '\u21BC', LeftVectorBar: '\u2952', Leftarrow: '\u21D0', Leftrightarrow: '\u21D4', LessEqualGreater: '\u22DA', LessFullEqual: '\u2266', LessGreater: '\u2276', LessLess: '\u2AA1', LessSlantEqual: '\u2A7D', LessTilde: '\u2272', Lfr: '\uD835\uDD0F', Ll: '\u22D8', Lleftarrow: '\u21DA', Lmidot: '\u013F', LongLeftArrow: '\u27F5', LongLeftRightArrow: '\u27F7', LongRightArrow: '\u27F6', Longleftarrow: '\u27F8', Longleftrightarrow: '\u27FA', Longrightarrow: '\u27F9', Lopf: '\uD835\uDD43', LowerLeftArrow: '\u2199', LowerRightArrow: '\u2198', Lscr: '\u2112', Lsh: '\u21B0', Lstrok: '\u0141', Lt: '\u226A', Map: '\u2905', Mcy: '\u041C', MediumSpace: '\u205F', Mellintrf: '\u2133', Mfr: '\uD835\uDD10', MinusPlus: '\u2213', Mopf: '\uD835\uDD44', Mscr: '\u2133', Mu: '\u039C', NJcy: '\u040A', Nacute: '\u0143', Ncaron: '\u0147', Ncedil: '\u0145', Ncy: '\u041D', NegativeMediumSpace: '\u200B', NegativeThickSpace: '\u200B', NegativeThinSpace: '\u200B', NegativeVeryThinSpace: '\u200B', NestedGreaterGreater: '\u226B', NestedLessLess: '\u226A', NewLine: '\u000A', Nfr: '\uD835\uDD11', NoBreak: '\u2060', NonBreakingSpace: '\u00A0', Nopf: '\u2115', Not: '\u2AEC', NotCongruent: '\u2262', NotCupCap: '\u226D', NotDoubleVerticalBar: '\u2226', NotElement: '\u2209', NotEqual: '\u2260', NotEqualTilde: '\u2242\u0338', NotExists: '\u2204', NotGreater: '\u226F', NotGreaterEqual: '\u2271', NotGreaterFullEqual: '\u2267\u0338', NotGreaterGreater: '\u226B\u0338', NotGreaterLess: '\u2279', NotGreaterSlantEqual: '\u2A7E\u0338', NotGreaterTilde: '\u2275', NotHumpDownHump: '\u224E\u0338', NotHumpEqual: '\u224F\u0338', NotLeftTriangle: '\u22EA', NotLeftTriangleBar: '\u29CF\u0338', NotLeftTriangleEqual: '\u22EC', NotLess: '\u226E', NotLessEqual: '\u2270', NotLessGreater: '\u2278', NotLessLess: '\u226A\u0338', NotLessSlantEqual: '\u2A7D\u0338', NotLessTilde: '\u2274', NotNestedGreaterGreater: '\u2AA2\u0338', NotNestedLessLess: '\u2AA1\u0338', NotPrecedes: '\u2280', NotPrecedesEqual: '\u2AAF\u0338', NotPrecedesSlantEqual: '\u22E0', NotReverseElement: '\u220C', NotRightTriangle: '\u22EB', NotRightTriangleBar: '\u29D0\u0338', NotRightTriangleEqual: '\u22ED', NotSquareSubset: '\u228F\u0338', NotSquareSubsetEqual: '\u22E2', NotSquareSuperset: '\u2290\u0338', NotSquareSupersetEqual: '\u22E3', NotSubset: '\u2282\u20D2', NotSubsetEqual: '\u2288', NotSucceeds: '\u2281', NotSucceedsEqual: '\u2AB0\u0338', NotSucceedsSlantEqual: '\u22E1', NotSucceedsTilde: '\u227F\u0338', NotSuperset: '\u2283\u20D2', NotSupersetEqual: '\u2289', NotTilde: '\u2241', NotTildeEqual: '\u2244', NotTildeFullEqual: '\u2247', NotTildeTilde: '\u2249', NotVerticalBar: '\u2224', Nscr: '\uD835\uDCA9', Ntilde: '\u00D1', Nu: '\u039D', OElig: '\u0152', Oacute: '\u00D3', Ocirc: '\u00D4', Ocy: '\u041E', Odblac: '\u0150', Ofr: '\uD835\uDD12', Ograve: '\u00D2', Omacr: '\u014C', Omega: '\u03A9', Omicron: '\u039F', Oopf: '\uD835\uDD46', OpenCurlyDoubleQuote: '\u201C', OpenCurlyQuote: '\u2018', Or: '\u2A54', Oscr: '\uD835\uDCAA', Oslash: '\u00D8', Otilde: '\u00D5', Otimes: '\u2A37', Ouml: '\u00D6', OverBar: '\u203E', OverBrace: '\u23DE', OverBracket: '\u23B4', OverParenthesis: '\u23DC', PartialD: '\u2202', Pcy: '\u041F', Pfr: '\uD835\uDD13', Phi: '\u03A6', Pi: '\u03A0', PlusMinus: '\u00B1', Poincareplane: '\u210C', Popf: '\u2119', Pr: '\u2ABB', Precedes: '\u227A', PrecedesEqual: '\u2AAF', PrecedesSlantEqual: '\u227C', PrecedesTilde: '\u227E', Prime: '\u2033', Product: '\u220F', Proportion: '\u2237', Proportional: '\u221D', Pscr: '\uD835\uDCAB', Psi: '\u03A8', QUOT: '\u0022', Qfr: '\uD835\uDD14', Qopf: '\u211A', Qscr: '\uD835\uDCAC', RBarr: '\u2910', REG: '\u00AE', Racute: '\u0154', Rang: '\u27EB', Rarr: '\u21A0', Rarrtl: '\u2916', Rcaron: '\u0158', Rcedil: '\u0156', Rcy: '\u0420', Re: '\u211C', ReverseElement: '\u220B', ReverseEquilibrium: '\u21CB', ReverseUpEquilibrium: '\u296F', Rfr: '\u211C', Rho: '\u03A1', RightAngleBracket: '\u27E9', RightArrow: '\u2192', RightArrowBar: '\u21E5', RightArrowLeftArrow: '\u21C4', RightCeiling: '\u2309', RightDoubleBracket: '\u27E7', RightDownTeeVector: '\u295D', RightDownVector: '\u21C2', RightDownVectorBar: '\u2955', RightFloor: '\u230B', RightTee: '\u22A2', RightTeeArrow: '\u21A6', RightTeeVector: '\u295B', RightTriangle: '\u22B3', RightTriangleBar: '\u29D0', RightTriangleEqual: '\u22B5', RightUpDownVector: '\u294F', RightUpTeeVector: '\u295C', RightUpVector: '\u21BE', RightUpVectorBar: '\u2954', RightVector: '\u21C0', RightVectorBar: '\u2953', Rightarrow: '\u21D2', Ropf: '\u211D', RoundImplies: '\u2970', Rrightarrow: '\u21DB', Rscr: '\u211B', Rsh: '\u21B1', RuleDelayed: '\u29F4', SHCHcy: '\u0429', SHcy: '\u0428', SOFTcy: '\u042C', Sacute: '\u015A', Sc: '\u2ABC', Scaron: '\u0160', Scedil: '\u015E', Scirc: '\u015C', Scy: '\u0421', Sfr: '\uD835\uDD16', ShortDownArrow: '\u2193', ShortLeftArrow: '\u2190', ShortRightArrow: '\u2192', ShortUpArrow: '\u2191', Sigma: '\u03A3', SmallCircle: '\u2218', Sopf: '\uD835\uDD4A', Sqrt: '\u221A', Square: '\u25A1', SquareIntersection: '\u2293', SquareSubset: '\u228F', SquareSubsetEqual: '\u2291', SquareSuperset: '\u2290', SquareSupersetEqual: '\u2292', SquareUnion: '\u2294', Sscr: '\uD835\uDCAE', Star: '\u22C6', Sub: '\u22D0', Subset: '\u22D0', SubsetEqual: '\u2286', Succeeds: '\u227B', SucceedsEqual: '\u2AB0', SucceedsSlantEqual: '\u227D', SucceedsTilde: '\u227F', SuchThat: '\u220B', Sum: '\u2211', Sup: '\u22D1', Superset: '\u2283', SupersetEqual: '\u2287', Supset: '\u22D1', THORN: '\u00DE', TRADE: '\u2122', TSHcy: '\u040B', TScy: '\u0426', Tab: '\u0009', Tau: '\u03A4', Tcaron: '\u0164', Tcedil: '\u0162', Tcy: '\u0422', Tfr: '\uD835\uDD17', Therefore: '\u2234', Theta: '\u0398', ThickSpace: '\u205F\u200A', ThinSpace: '\u2009', Tilde: '\u223C', TildeEqual: '\u2243', TildeFullEqual: '\u2245', TildeTilde: '\u2248', Topf: '\uD835\uDD4B', TripleDot: '\u20DB', Tscr: '\uD835\uDCAF', Tstrok: '\u0166', Uacute: '\u00DA', Uarr: '\u219F', Uarrocir: '\u2949', Ubrcy: '\u040E', Ubreve: '\u016C', Ucirc: '\u00DB', Ucy: '\u0423', Udblac: '\u0170', Ufr: '\uD835\uDD18', Ugrave: '\u00D9', Umacr: '\u016A', UnderBar: '\u005F', UnderBrace: '\u23DF', UnderBracket: '\u23B5', UnderParenthesis: '\u23DD', Union: '\u22C3', UnionPlus: '\u228E', Uogon: '\u0172', Uopf: '\uD835\uDD4C', UpArrow: '\u2191', UpArrowBar: '\u2912', UpArrowDownArrow: '\u21C5', UpDownArrow: '\u2195', UpEquilibrium: '\u296E', UpTee: '\u22A5', UpTeeArrow: '\u21A5', Uparrow: '\u21D1', Updownarrow: '\u21D5', UpperLeftArrow: '\u2196', UpperRightArrow: '\u2197', Upsi: '\u03D2', Upsilon: '\u03A5', Uring: '\u016E', Uscr: '\uD835\uDCB0', Utilde: '\u0168', Uuml: '\u00DC', VDash: '\u22AB', Vbar: '\u2AEB', Vcy: '\u0412', Vdash: '\u22A9', Vdashl: '\u2AE6', Vee: '\u22C1', Verbar: '\u2016', Vert: '\u2016', VerticalBar: '\u2223', VerticalLine: '\u007C', VerticalSeparator: '\u2758', VerticalTilde: '\u2240', VeryThinSpace: '\u200A', Vfr: '\uD835\uDD19', Vopf: '\uD835\uDD4D', Vscr: '\uD835\uDCB1', Vvdash: '\u22AA', Wcirc: '\u0174', Wedge: '\u22C0', Wfr: '\uD835\uDD1A', Wopf: '\uD835\uDD4E', Wscr: '\uD835\uDCB2', Xfr: '\uD835\uDD1B', Xi: '\u039E', Xopf: '\uD835\uDD4F', Xscr: '\uD835\uDCB3', YAcy: '\u042F', YIcy: '\u0407', YUcy: '\u042E', Yacute: '\u00DD', Ycirc: '\u0176', Ycy: '\u042B', Yfr: '\uD835\uDD1C', Yopf: '\uD835\uDD50', Yscr: '\uD835\uDCB4', Yuml: '\u0178', ZHcy: '\u0416', Zacute: '\u0179', Zcaron: '\u017D', Zcy: '\u0417', Zdot: '\u017B', ZeroWidthSpace: '\u200B', Zeta: '\u0396', Zfr: '\u2128', Zopf: '\u2124', Zscr: '\uD835\uDCB5', aacute: '\u00E1', abreve: '\u0103', ac: '\u223E', acE: '\u223E\u0333', acd: '\u223F', acirc: '\u00E2', acute: '\u00B4', acy: '\u0430', aelig: '\u00E6', af: '\u2061', afr: '\uD835\uDD1E', agrave: '\u00E0', alefsym: '\u2135', aleph: '\u2135', alpha: '\u03B1', amacr: '\u0101', amalg: '\u2A3F', amp: '\u0026', and: '\u2227', andand: '\u2A55', andd: '\u2A5C', andslope: '\u2A58', andv: '\u2A5A', ang: '\u2220', ange: '\u29A4', angle: '\u2220', angmsd: '\u2221', angmsdaa: '\u29A8', angmsdab: '\u29A9', angmsdac: '\u29AA', angmsdad: '\u29AB', angmsdae: '\u29AC', angmsdaf: '\u29AD', angmsdag: '\u29AE', angmsdah: '\u29AF', angrt: '\u221F', angrtvb: '\u22BE', angrtvbd: '\u299D', angsph: '\u2222', angst: '\u00C5', angzarr: '\u237C', aogon: '\u0105', aopf: '\uD835\uDD52', ap: '\u2248', apE: '\u2A70', apacir: '\u2A6F', ape: '\u224A', apid: '\u224B', apos: '\u0027', approx: '\u2248', approxeq: '\u224A', aring: '\u00E5', ascr: '\uD835\uDCB6', ast: '\u002A', asymp: '\u2248', asympeq: '\u224D', atilde: '\u00E3', auml: '\u00E4', awconint: '\u2233', awint: '\u2A11', bNot: '\u2AED', backcong: '\u224C', backepsilon: '\u03F6', backprime: '\u2035', backsim: '\u223D', backsimeq: '\u22CD', barvee: '\u22BD', barwed: '\u2305', barwedge: '\u2305', bbrk: '\u23B5', bbrktbrk: '\u23B6', bcong: '\u224C', bcy: '\u0431', bdquo: '\u201E', becaus: '\u2235', because: '\u2235', bemptyv: '\u29B0', bepsi: '\u03F6', bernou: '\u212C', beta: '\u03B2', beth: '\u2136', between: '\u226C', bfr: '\uD835\uDD1F', bigcap: '\u22C2', bigcirc: '\u25EF', bigcup: '\u22C3', bigodot: '\u2A00', bigoplus: '\u2A01', bigotimes: '\u2A02', bigsqcup: '\u2A06', bigstar: '\u2605', bigtriangledown: '\u25BD', bigtriangleup: '\u25B3', biguplus: '\u2A04', bigvee: '\u22C1', bigwedge: '\u22C0', bkarow: '\u290D', blacklozenge: '\u29EB', blacksquare: '\u25AA', blacktriangle: '\u25B4', blacktriangledown: '\u25BE', blacktriangleleft: '\u25C2', blacktriangleright: '\u25B8', blank: '\u2423', blk12: '\u2592', blk14: '\u2591', blk34: '\u2593', block: '\u2588', bne: '\u003D\u20E5', bnequiv: '\u2261\u20E5', bnot: '\u2310', bopf: '\uD835\uDD53', bot: '\u22A5', bottom: '\u22A5', bowtie: '\u22C8', boxDL: '\u2557', boxDR: '\u2554', boxDl: '\u2556', boxDr: '\u2553', boxH: '\u2550', boxHD: '\u2566', boxHU: '\u2569', boxHd: '\u2564', boxHu: '\u2567', boxUL: '\u255D', boxUR: '\u255A', boxUl: '\u255C', boxUr: '\u2559', boxV: '\u2551', boxVH: '\u256C', boxVL: '\u2563', boxVR: '\u2560', boxVh: '\u256B', boxVl: '\u2562', boxVr: '\u255F', boxbox: '\u29C9', boxdL: '\u2555', boxdR: '\u2552', boxdl: '\u2510', boxdr: '\u250C', boxh: '\u2500', boxhD: '\u2565', boxhU: '\u2568', boxhd: '\u252C', boxhu: '\u2534', boxminus: '\u229F', boxplus: '\u229E', boxtimes: '\u22A0', boxuL: '\u255B', boxuR: '\u2558', boxul: '\u2518', boxur: '\u2514', boxv: '\u2502', boxvH: '\u256A', boxvL: '\u2561', boxvR: '\u255E', boxvh: '\u253C', boxvl: '\u2524', boxvr: '\u251C', bprime: '\u2035', breve: '\u02D8', brvbar: '\u00A6', bscr: '\uD835\uDCB7', bsemi: '\u204F', bsim: '\u223D', bsime: '\u22CD', bsol: '\u005C', bsolb: '\u29C5', bsolhsub: '\u27C8', bull: '\u2022', bullet: '\u2022', bump: '\u224E', bumpE: '\u2AAE', bumpe: '\u224F', bumpeq: '\u224F', cacute: '\u0107', cap: '\u2229', capand: '\u2A44', capbrcup: '\u2A49', capcap: '\u2A4B', capcup: '\u2A47', capdot: '\u2A40', caps: '\u2229\uFE00', caret: '\u2041', caron: '\u02C7', ccaps: '\u2A4D', ccaron: '\u010D', ccedil: '\u00E7', ccirc: '\u0109', ccups: '\u2A4C', ccupssm: '\u2A50', cdot: '\u010B', cedil: '\u00B8', cemptyv: '\u29B2', cent: '\u00A2', centerdot: '\u00B7', cfr: '\uD835\uDD20', chcy: '\u0447', check: '\u2713', checkmark: '\u2713', chi: '\u03C7', cir: '\u25CB', cirE: '\u29C3', circ: '\u02C6', circeq: '\u2257', circlearrowleft: '\u21BA', circlearrowright: '\u21BB', circledR: '\u00AE', circledS: '\u24C8', circledast: '\u229B', circledcirc: '\u229A', circleddash: '\u229D', cire: '\u2257', cirfnint: '\u2A10', cirmid: '\u2AEF', cirscir: '\u29C2', clubs: '\u2663', clubsuit: '\u2663', colon: '\u003A', colone: '\u2254', coloneq: '\u2254', comma: '\u002C', commat: '\u0040', comp: '\u2201', compfn: '\u2218', complement: '\u2201', complexes: '\u2102', cong: '\u2245', congdot: '\u2A6D', conint: '\u222E', copf: '\uD835\uDD54', coprod: '\u2210', copy: '\u00A9', copysr: '\u2117', crarr: '\u21B5', cross: '\u2717', cscr: '\uD835\uDCB8', csub: '\u2ACF', csube: '\u2AD1', csup: '\u2AD0', csupe: '\u2AD2', ctdot: '\u22EF', cudarrl: '\u2938', cudarrr: '\u2935', cuepr: '\u22DE', cuesc: '\u22DF', cularr: '\u21B6', cularrp: '\u293D', cup: '\u222A', cupbrcap: '\u2A48', cupcap: '\u2A46', cupcup: '\u2A4A', cupdot: '\u228D', cupor: '\u2A45', cups: '\u222A\uFE00', curarr: '\u21B7', curarrm: '\u293C', curlyeqprec: '\u22DE', curlyeqsucc: '\u22DF', curlyvee: '\u22CE', curlywedge: '\u22CF', curren: '\u00A4', curvearrowleft: '\u21B6', curvearrowright: '\u21B7', cuvee: '\u22CE', cuwed: '\u22CF', cwconint: '\u2232', cwint: '\u2231', cylcty: '\u232D', dArr: '\u21D3', dHar: '\u2965', dagger: '\u2020', daleth: '\u2138', darr: '\u2193', dash: '\u2010', dashv: '\u22A3', dbkarow: '\u290F', dblac: '\u02DD', dcaron: '\u010F', dcy: '\u0434', dd: '\u2146', ddagger: '\u2021', ddarr: '\u21CA', ddotseq: '\u2A77', deg: '\u00B0', delta: '\u03B4', demptyv: '\u29B1', dfisht: '\u297F', dfr: '\uD835\uDD21', dharl: '\u21C3', dharr: '\u21C2', diam: '\u22C4', diamond: '\u22C4', diamondsuit: '\u2666', diams: '\u2666', die: '\u00A8', digamma: '\u03DD', disin: '\u22F2', div: '\u00F7', divide: '\u00F7', divideontimes: '\u22C7', divonx: '\u22C7', djcy: '\u0452', dlcorn: '\u231E', dlcrop: '\u230D', dollar: '\u0024', dopf: '\uD835\uDD55', dot: '\u02D9', doteq: '\u2250', doteqdot: '\u2251', dotminus: '\u2238', dotplus: '\u2214', dotsquare: '\u22A1', doublebarwedge: '\u2306', downarrow: '\u2193', downdownarrows: '\u21CA', downharpoonleft: '\u21C3', downharpoonright: '\u21C2', drbkarow: '\u2910', drcorn: '\u231F', drcrop: '\u230C', dscr: '\uD835\uDCB9', dscy: '\u0455', dsol: '\u29F6', dstrok: '\u0111', dtdot: '\u22F1', dtri: '\u25BF', dtrif: '\u25BE', duarr: '\u21F5', duhar: '\u296F', dwangle: '\u29A6', dzcy: '\u045F', dzigrarr: '\u27FF', eDDot: '\u2A77', eDot: '\u2251', eacute: '\u00E9', easter: '\u2A6E', ecaron: '\u011B', ecir: '\u2256', ecirc: '\u00EA', ecolon: '\u2255', ecy: '\u044D', edot: '\u0117', ee: '\u2147', efDot: '\u2252', efr: '\uD835\uDD22', eg: '\u2A9A', egrave: '\u00E8', egs: '\u2A96', egsdot: '\u2A98', el: '\u2A99', elinters: '\u23E7', ell: '\u2113', els: '\u2A95', elsdot: '\u2A97', emacr: '\u0113', empty: '\u2205', emptyset: '\u2205', emptyv: '\u2205', emsp13: '\u2004', emsp14: '\u2005', emsp: '\u2003', eng: '\u014B', ensp: '\u2002', eogon: '\u0119', eopf: '\uD835\uDD56', epar: '\u22D5', eparsl: '\u29E3', eplus: '\u2A71', epsi: '\u03B5', epsilon: '\u03B5', epsiv: '\u03F5', eqcirc: '\u2256', eqcolon: '\u2255', eqsim: '\u2242', eqslantgtr: '\u2A96', eqslantless: '\u2A95', equals: '\u003D', equest: '\u225F', equiv: '\u2261', equivDD: '\u2A78', eqvparsl: '\u29E5', erDot: '\u2253', erarr: '\u2971', escr: '\u212F', esdot: '\u2250', esim: '\u2242', eta: '\u03B7', eth: '\u00F0', euml: '\u00EB', euro: '\u20AC', excl: '\u0021', exist: '\u2203', expectation: '\u2130', exponentiale: '\u2147', fallingdotseq: '\u2252', fcy: '\u0444', female: '\u2640', ffilig: '\uFB03', fflig: '\uFB00', ffllig: '\uFB04', ffr: '\uD835\uDD23', filig: '\uFB01', fjlig: '\u0066\u006A', flat: '\u266D', fllig: '\uFB02', fltns: '\u25B1', fnof: '\u0192', fopf: '\uD835\uDD57', forall: '\u2200', fork: '\u22D4', forkv: '\u2AD9', fpartint: '\u2A0D', frac12: '\u00BD', frac13: '\u2153', frac14: '\u00BC', frac15: '\u2155', frac16: '\u2159', frac18: '\u215B', frac23: '\u2154', frac25: '\u2156', frac34: '\u00BE', frac35: '\u2157', frac38: '\u215C', frac45: '\u2158', frac56: '\u215A', frac58: '\u215D', frac78: '\u215E', frasl: '\u2044', frown: '\u2322', fscr: '\uD835\uDCBB', gE: '\u2267', gEl: '\u2A8C', gacute: '\u01F5', gamma: '\u03B3', gammad: '\u03DD', gap: '\u2A86', gbreve: '\u011F', gcirc: '\u011D', gcy: '\u0433', gdot: '\u0121', ge: '\u2265', gel: '\u22DB', geq: '\u2265', geqq: '\u2267', geqslant: '\u2A7E', ges: '\u2A7E', gescc: '\u2AA9', gesdot: '\u2A80', gesdoto: '\u2A82', gesdotol: '\u2A84', gesl: '\u22DB\uFE00', gesles: '\u2A94', gfr: '\uD835\uDD24', gg: '\u226B', ggg: '\u22D9', gimel: '\u2137', gjcy: '\u0453', gl: '\u2277', glE: '\u2A92', gla: '\u2AA5', glj: '\u2AA4', gnE: '\u2269', gnap: '\u2A8A', gnapprox: '\u2A8A', gne: '\u2A88', gneq: '\u2A88', gneqq: '\u2269', gnsim: '\u22E7', gopf: '\uD835\uDD58', grave: '\u0060', gscr: '\u210A', gsim: '\u2273', gsime: '\u2A8E', gsiml: '\u2A90', gt: '\u003E', gtcc: '\u2AA7', gtcir: '\u2A7A', gtdot: '\u22D7', gtlPar: '\u2995', gtquest: '\u2A7C', gtrapprox: '\u2A86', gtrarr: '\u2978', gtrdot: '\u22D7', gtreqless: '\u22DB', gtreqqless: '\u2A8C', gtrless: '\u2277', gtrsim: '\u2273', gvertneqq: '\u2269\uFE00', gvnE: '\u2269\uFE00', hArr: '\u21D4', hairsp: '\u200A', half: '\u00BD', hamilt: '\u210B', hardcy: '\u044A', harr: '\u2194', harrcir: '\u2948', harrw: '\u21AD', hbar: '\u210F', hcirc: '\u0125', hearts: '\u2665', heartsuit: '\u2665', hellip: '\u2026', hercon: '\u22B9', hfr: '\uD835\uDD25', hksearow: '\u2925', hkswarow: '\u2926', hoarr: '\u21FF', homtht: '\u223B', hookleftarrow: '\u21A9', hookrightarrow: '\u21AA', hopf: '\uD835\uDD59', horbar: '\u2015', hscr: '\uD835\uDCBD', hslash: '\u210F', hstrok: '\u0127', hybull: '\u2043', hyphen: '\u2010', iacute: '\u00ED', ic: '\u2063', icirc: '\u00EE', icy: '\u0438', iecy: '\u0435', iexcl: '\u00A1', iff: '\u21D4', ifr: '\uD835\uDD26', igrave: '\u00EC', ii: '\u2148', iiiint: '\u2A0C', iiint: '\u222D', iinfin: '\u29DC', iiota: '\u2129', ijlig: '\u0133', imacr: '\u012B', image: '\u2111', imagline: '\u2110', imagpart: '\u2111', imath: '\u0131', imof: '\u22B7', imped: '\u01B5', in: '\u2208', incare: '\u2105', infin: '\u221E', infintie: '\u29DD', inodot: '\u0131', int: '\u222B', intcal: '\u22BA', integers: '\u2124', intercal: '\u22BA', intlarhk: '\u2A17', intprod: '\u2A3C', iocy: '\u0451', iogon: '\u012F', iopf: '\uD835\uDD5A', iota: '\u03B9', iprod: '\u2A3C', iquest: '\u00BF', iscr: '\uD835\uDCBE', isin: '\u2208', isinE: '\u22F9', isindot: '\u22F5', isins: '\u22F4', isinsv: '\u22F3', isinv: '\u2208', it: '\u2062', itilde: '\u0129', iukcy: '\u0456', iuml: '\u00EF', jcirc: '\u0135', jcy: '\u0439', jfr: '\uD835\uDD27', jmath: '\u0237', jopf: '\uD835\uDD5B', jscr: '\uD835\uDCBF', jsercy: '\u0458', jukcy: '\u0454', kappa: '\u03BA', kappav: '\u03F0', kcedil: '\u0137', kcy: '\u043A', kfr: '\uD835\uDD28', kgreen: '\u0138', khcy: '\u0445', kjcy: '\u045C', kopf: '\uD835\uDD5C', kscr: '\uD835\uDCC0', lAarr: '\u21DA', lArr: '\u21D0', lAtail: '\u291B', lBarr: '\u290E', lE: '\u2266', lEg: '\u2A8B', lHar: '\u2962', lacute: '\u013A', laemptyv: '\u29B4', lagran: '\u2112', lambda: '\u03BB', lang: '\u27E8', langd: '\u2991', langle: '\u27E8', lap: '\u2A85', laquo: '\u00AB', larr: '\u2190', larrb: '\u21E4', larrbfs: '\u291F', larrfs: '\u291D', larrhk: '\u21A9', larrlp: '\u21AB', larrpl: '\u2939', larrsim: '\u2973', larrtl: '\u21A2', lat: '\u2AAB', latail: '\u2919', late: '\u2AAD', lates: '\u2AAD\uFE00', lbarr: '\u290C', lbbrk: '\u2772', lbrace: '\u007B', lbrack: '\u005B', lbrke: '\u298B', lbrksld: '\u298F', lbrkslu: '\u298D', lcaron: '\u013E', lcedil: '\u013C', lceil: '\u2308', lcub: '\u007B', lcy: '\u043B', ldca: '\u2936', ldquo: '\u201C', ldquor: '\u201E', ldrdhar: '\u2967', ldrushar: '\u294B', ldsh: '\u21B2', le: '\u2264', leftarrow: '\u2190', leftarrowtail: '\u21A2', leftharpoondown: '\u21BD', leftharpoonup: '\u21BC', leftleftarrows: '\u21C7', leftrightarrow: '\u2194', leftrightarrows: '\u21C6', leftrightharpoons: '\u21CB', leftrightsquigarrow: '\u21AD', leftthreetimes: '\u22CB', leg: '\u22DA', leq: '\u2264', leqq: '\u2266', leqslant: '\u2A7D', les: '\u2A7D', lescc: '\u2AA8', lesdot: '\u2A7F', lesdoto: '\u2A81', lesdotor: '\u2A83', lesg: '\u22DA\uFE00', lesges: '\u2A93', lessapprox: '\u2A85', lessdot: '\u22D6', lesseqgtr: '\u22DA', lesseqqgtr: '\u2A8B', lessgtr: '\u2276', lesssim: '\u2272', lfisht: '\u297C', lfloor: '\u230A', lfr: '\uD835\uDD29', lg: '\u2276', lgE: '\u2A91', lhard: '\u21BD', lharu: '\u21BC', lharul: '\u296A', lhblk: '\u2584', ljcy: '\u0459', ll: '\u226A', llarr: '\u21C7', llcorner: '\u231E', llhard: '\u296B', lltri: '\u25FA', lmidot: '\u0140', lmoust: '\u23B0', lmoustache: '\u23B0', lnE: '\u2268', lnap: '\u2A89', lnapprox: '\u2A89', lne: '\u2A87', lneq: '\u2A87', lneqq: '\u2268', lnsim: '\u22E6', loang: '\u27EC', loarr: '\u21FD', lobrk: '\u27E6', longleftarrow: '\u27F5', longleftrightarrow: '\u27F7', longmapsto: '\u27FC', longrightarrow: '\u27F6', looparrowleft: '\u21AB', looparrowright: '\u21AC', lopar: '\u2985', lopf: '\uD835\uDD5D', loplus: '\u2A2D', lotimes: '\u2A34', lowast: '\u2217', lowbar: '\u005F', loz: '\u25CA', lozenge: '\u25CA', lozf: '\u29EB', lpar: '\u0028', lparlt: '\u2993', lrarr: '\u21C6', lrcorner: '\u231F', lrhar: '\u21CB', lrhard: '\u296D', lrm: '\u200E', lrtri: '\u22BF', lsaquo: '\u2039', lscr: '\uD835\uDCC1', lsh: '\u21B0', lsim: '\u2272', lsime: '\u2A8D', lsimg: '\u2A8F', lsqb: '\u005B', lsquo: '\u2018', lsquor: '\u201A', lstrok: '\u0142', lt: '\u003C', ltcc: '\u2AA6', ltcir: '\u2A79', ltdot: '\u22D6', lthree: '\u22CB', ltimes: '\u22C9', ltlarr: '\u2976', ltquest: '\u2A7B', ltrPar: '\u2996', ltri: '\u25C3', ltrie: '\u22B4', ltrif: '\u25C2', lurdshar: '\u294A', luruhar: '\u2966', lvertneqq: '\u2268\uFE00', lvnE: '\u2268\uFE00', mDDot: '\u223A', macr: '\u00AF', male: '\u2642', malt: '\u2720', maltese: '\u2720', map: '\u21A6', mapsto: '\u21A6', mapstodown: '\u21A7', mapstoleft: '\u21A4', mapstoup: '\u21A5', marker: '\u25AE', mcomma: '\u2A29', mcy: '\u043C', mdash: '\u2014', measuredangle: '\u2221', mfr: '\uD835\uDD2A', mho: '\u2127', micro: '\u00B5', mid: '\u2223', midast: '\u002A', midcir: '\u2AF0', middot: '\u00B7', minus: '\u2212', minusb: '\u229F', minusd: '\u2238', minusdu: '\u2A2A', mlcp: '\u2ADB', mldr: '\u2026', mnplus: '\u2213', models: '\u22A7', mopf: '\uD835\uDD5E', mp: '\u2213', mscr: '\uD835\uDCC2', mstpos: '\u223E', mu: '\u03BC', multimap: '\u22B8', mumap: '\u22B8', nGg: '\u22D9\u0338', nGt: '\u226B\u20D2', nGtv: '\u226B\u0338', nLeftarrow: '\u21CD', nLeftrightarrow: '\u21CE', nLl: '\u22D8\u0338', nLt: '\u226A\u20D2', nLtv: '\u226A\u0338', nRightarrow: '\u21CF', nVDash: '\u22AF', nVdash: '\u22AE', nabla: '\u2207', nacute: '\u0144', nang: '\u2220\u20D2', nap: '\u2249', napE: '\u2A70\u0338', napid: '\u224B\u0338', napos: '\u0149', napprox: '\u2249', natur: '\u266E', natural: '\u266E', naturals: '\u2115', nbsp: '\u00A0', nbump: '\u224E\u0338', nbumpe: '\u224F\u0338', ncap: '\u2A43', ncaron: '\u0148', ncedil: '\u0146', ncong: '\u2247', ncongdot: '\u2A6D\u0338', ncup: '\u2A42', ncy: '\u043D', ndash: '\u2013', ne: '\u2260', neArr: '\u21D7', nearhk: '\u2924', nearr: '\u2197', nearrow: '\u2197', nedot: '\u2250\u0338', nequiv: '\u2262', nesear: '\u2928', nesim: '\u2242\u0338', nexist: '\u2204', nexists: '\u2204', nfr: '\uD835\uDD2B', ngE: '\u2267\u0338', nge: '\u2271', ngeq: '\u2271', ngeqq: '\u2267\u0338', ngeqslant: '\u2A7E\u0338', nges: '\u2A7E\u0338', ngsim: '\u2275', ngt: '\u226F', ngtr: '\u226F', nhArr: '\u21CE', nharr: '\u21AE', nhpar: '\u2AF2', ni: '\u220B', nis: '\u22FC', nisd: '\u22FA', niv: '\u220B', njcy: '\u045A', nlArr: '\u21CD', nlE: '\u2266\u0338', nlarr: '\u219A', nldr: '\u2025', nle: '\u2270', nleftarrow: '\u219A', nleftrightarrow: '\u21AE', nleq: '\u2270', nleqq: '\u2266\u0338', nleqslant: '\u2A7D\u0338', nles: '\u2A7D\u0338', nless: '\u226E', nlsim: '\u2274', nlt: '\u226E', nltri: '\u22EA', nltrie: '\u22EC', nmid: '\u2224', nopf: '\uD835\uDD5F', not: '\u00AC', notin: '\u2209', notinE: '\u22F9\u0338', notindot: '\u22F5\u0338', notinva: '\u2209', notinvb: '\u22F7', notinvc: '\u22F6', notni: '\u220C', notniva: '\u220C', notnivb: '\u22FE', notnivc: '\u22FD', npar: '\u2226', nparallel: '\u2226', nparsl: '\u2AFD\u20E5', npart: '\u2202\u0338', npolint: '\u2A14', npr: '\u2280', nprcue: '\u22E0', npre: '\u2AAF\u0338', nprec: '\u2280', npreceq: '\u2AAF\u0338', nrArr: '\u21CF', nrarr: '\u219B', nrarrc: '\u2933\u0338', nrarrw: '\u219D\u0338', nrightarrow: '\u219B', nrtri: '\u22EB', nrtrie: '\u22ED', nsc: '\u2281', nsccue: '\u22E1', nsce: '\u2AB0\u0338', nscr: '\uD835\uDCC3', nshortmid: '\u2224', nshortparallel: '\u2226', nsim: '\u2241', nsime: '\u2244', nsimeq: '\u2244', nsmid: '\u2224', nspar: '\u2226', nsqsube: '\u22E2', nsqsupe: '\u22E3', nsub: '\u2284', nsubE: '\u2AC5\u0338', nsube: '\u2288', nsubset: '\u2282\u20D2', nsubseteq: '\u2288', nsubseteqq: '\u2AC5\u0338', nsucc: '\u2281', nsucceq: '\u2AB0\u0338', nsup: '\u2285', nsupE: '\u2AC6\u0338', nsupe: '\u2289', nsupset: '\u2283\u20D2', nsupseteq: '\u2289', nsupseteqq: '\u2AC6\u0338', ntgl: '\u2279', ntilde: '\u00F1', ntlg: '\u2278', ntriangleleft: '\u22EA', ntrianglelefteq: '\u22EC', ntriangleright: '\u22EB', ntrianglerighteq: '\u22ED', nu: '\u03BD', num: '\u0023', numero: '\u2116', numsp: '\u2007', nvDash: '\u22AD', nvHarr: '\u2904', nvap: '\u224D\u20D2', nvdash: '\u22AC', nvge: '\u2265\u20D2', nvgt: '\u003E\u20D2', nvinfin: '\u29DE', nvlArr: '\u2902', nvle: '\u2264\u20D2', nvlt: '\u003C\u20D2', nvltrie: '\u22B4\u20D2', nvrArr: '\u2903', nvrtrie: '\u22B5\u20D2', nvsim: '\u223C\u20D2', nwArr: '\u21D6', nwarhk: '\u2923', nwarr: '\u2196', nwarrow: '\u2196', nwnear: '\u2927', oS: '\u24C8', oacute: '\u00F3', oast: '\u229B', ocir: '\u229A', ocirc: '\u00F4', ocy: '\u043E', odash: '\u229D', odblac: '\u0151', odiv: '\u2A38', odot: '\u2299', odsold: '\u29BC', oelig: '\u0153', ofcir: '\u29BF', ofr: '\uD835\uDD2C', ogon: '\u02DB', ograve: '\u00F2', ogt: '\u29C1', ohbar: '\u29B5', ohm: '\u03A9', oint: '\u222E', olarr: '\u21BA', olcir: '\u29BE', olcross: '\u29BB', oline: '\u203E', olt: '\u29C0', omacr: '\u014D', omega: '\u03C9', omicron: '\u03BF', omid: '\u29B6', ominus: '\u2296', oopf: '\uD835\uDD60', opar: '\u29B7', operp: '\u29B9', oplus: '\u2295', or: '\u2228', orarr: '\u21BB', ord: '\u2A5D', order: '\u2134', orderof: '\u2134', ordf: '\u00AA', ordm: '\u00BA', origof: '\u22B6', oror: '\u2A56', orslope: '\u2A57', orv: '\u2A5B', oscr: '\u2134', oslash: '\u00F8', osol: '\u2298', otilde: '\u00F5', otimes: '\u2297', otimesas: '\u2A36', ouml: '\u00F6', ovbar: '\u233D', par: '\u2225', para: '\u00B6', parallel: '\u2225', parsim: '\u2AF3', parsl: '\u2AFD', part: '\u2202', pcy: '\u043F', percnt: '\u0025', period: '\u002E', permil: '\u2030', perp: '\u22A5', pertenk: '\u2031', pfr: '\uD835\uDD2D', phi: '\u03C6', phiv: '\u03D5', phmmat: '\u2133', phone: '\u260E', pi: '\u03C0', pitchfork: '\u22D4', piv: '\u03D6', planck: '\u210F', planckh: '\u210E', plankv: '\u210F', plus: '\u002B', plusacir: '\u2A23', plusb: '\u229E', pluscir: '\u2A22', plusdo: '\u2214', plusdu: '\u2A25', pluse: '\u2A72', plusmn: '\u00B1', plussim: '\u2A26', plustwo: '\u2A27', pm: '\u00B1', pointint: '\u2A15', popf: '\uD835\uDD61', pound: '\u00A3', pr: '\u227A', prE: '\u2AB3', prap: '\u2AB7', prcue: '\u227C', pre: '\u2AAF', prec: '\u227A', precapprox: '\u2AB7', preccurlyeq: '\u227C', preceq: '\u2AAF', precnapprox: '\u2AB9', precneqq: '\u2AB5', precnsim: '\u22E8', precsim: '\u227E', prime: '\u2032', primes: '\u2119', prnE: '\u2AB5', prnap: '\u2AB9', prnsim: '\u22E8', prod: '\u220F', profalar: '\u232E', profline: '\u2312', profsurf: '\u2313', prop: '\u221D', propto: '\u221D', prsim: '\u227E', prurel: '\u22B0', pscr: '\uD835\uDCC5', psi: '\u03C8', puncsp: '\u2008', qfr: '\uD835\uDD2E', qint: '\u2A0C', qopf: '\uD835\uDD62', qprime: '\u2057', qscr: '\uD835\uDCC6', quaternions: '\u210D', quatint: '\u2A16', quest: '\u003F', questeq: '\u225F', quot: '\u0022', rAarr: '\u21DB', rArr: '\u21D2', rAtail: '\u291C', rBarr: '\u290F', rHar: '\u2964', race: '\u223D\u0331', racute: '\u0155', radic: '\u221A', raemptyv: '\u29B3', rang: '\u27E9', rangd: '\u2992', range: '\u29A5', rangle: '\u27E9', raquo: '\u00BB', rarr: '\u2192', rarrap: '\u2975', rarrb: '\u21E5', rarrbfs: '\u2920', rarrc: '\u2933', rarrfs: '\u291E', rarrhk: '\u21AA', rarrlp: '\u21AC', rarrpl: '\u2945', rarrsim: '\u2974', rarrtl: '\u21A3', rarrw: '\u219D', ratail: '\u291A', ratio: '\u2236', rationals: '\u211A', rbarr: '\u290D', rbbrk: '\u2773', rbrace: '\u007D', rbrack: '\u005D', rbrke: '\u298C', rbrksld: '\u298E', rbrkslu: '\u2990', rcaron: '\u0159', rcedil: '\u0157', rceil: '\u2309', rcub: '\u007D', rcy: '\u0440', rdca: '\u2937', rdldhar: '\u2969', rdquo: '\u201D', rdquor: '\u201D', rdsh: '\u21B3', real: '\u211C', realine: '\u211B', realpart: '\u211C', reals: '\u211D', rect: '\u25AD', reg: '\u00AE', rfisht: '\u297D', rfloor: '\u230B', rfr: '\uD835\uDD2F', rhard: '\u21C1', rharu: '\u21C0', rharul: '\u296C', rho: '\u03C1', rhov: '\u03F1', rightarrow: '\u2192', rightarrowtail: '\u21A3', rightharpoondown: '\u21C1', rightharpoonup: '\u21C0', rightleftarrows: '\u21C4', rightleftharpoons: '\u21CC', rightrightarrows: '\u21C9', rightsquigarrow: '\u219D', rightthreetimes: '\u22CC', ring: '\u02DA', risingdotseq: '\u2253', rlarr: '\u21C4', rlhar: '\u21CC', rlm: '\u200F', rmoust: '\u23B1', rmoustache: '\u23B1', rnmid: '\u2AEE', roang: '\u27ED', roarr: '\u21FE', robrk: '\u27E7', ropar: '\u2986', ropf: '\uD835\uDD63', roplus: '\u2A2E', rotimes: '\u2A35', rpar: '\u0029', rpargt: '\u2994', rppolint: '\u2A12', rrarr: '\u21C9', rsaquo: '\u203A', rscr: '\uD835\uDCC7', rsh: '\u21B1', rsqb: '\u005D', rsquo: '\u2019', rsquor: '\u2019', rthree: '\u22CC', rtimes: '\u22CA', rtri: '\u25B9', rtrie: '\u22B5', rtrif: '\u25B8', rtriltri: '\u29CE', ruluhar: '\u2968', rx: '\u211E', sacute: '\u015B', sbquo: '\u201A', sc: '\u227B', scE: '\u2AB4', scap: '\u2AB8', scaron: '\u0161', sccue: '\u227D', sce: '\u2AB0', scedil: '\u015F', scirc: '\u015D', scnE: '\u2AB6', scnap: '\u2ABA', scnsim: '\u22E9', scpolint: '\u2A13', scsim: '\u227F', scy: '\u0441', sdot: '\u22C5', sdotb: '\u22A1', sdote: '\u2A66', seArr: '\u21D8', searhk: '\u2925', searr: '\u2198', searrow: '\u2198', sect: '\u00A7', semi: '\u003B', seswar: '\u2929', setminus: '\u2216', setmn: '\u2216', sext: '\u2736', sfr: '\uD835\uDD30', sfrown: '\u2322', sharp: '\u266F', shchcy: '\u0449', shcy: '\u0448', shortmid: '\u2223', shortparallel: '\u2225', shy: '\u00AD', sigma: '\u03C3', sigmaf: '\u03C2', sigmav: '\u03C2', sim: '\u223C', simdot: '\u2A6A', sime: '\u2243', simeq: '\u2243', simg: '\u2A9E', simgE: '\u2AA0', siml: '\u2A9D', simlE: '\u2A9F', simne: '\u2246', simplus: '\u2A24', simrarr: '\u2972', slarr: '\u2190', smallsetminus: '\u2216', smashp: '\u2A33', smeparsl: '\u29E4', smid: '\u2223', smile: '\u2323', smt: '\u2AAA', smte: '\u2AAC', smtes: '\u2AAC\uFE00', softcy: '\u044C', sol: '\u002F', solb: '\u29C4', solbar: '\u233F', sopf: '\uD835\uDD64', spades: '\u2660', spadesuit: '\u2660', spar: '\u2225', sqcap: '\u2293', sqcaps: '\u2293\uFE00', sqcup: '\u2294', sqcups: '\u2294\uFE00', sqsub: '\u228F', sqsube: '\u2291', sqsubset: '\u228F', sqsubseteq: '\u2291', sqsup: '\u2290', sqsupe: '\u2292', sqsupset: '\u2290', sqsupseteq: '\u2292', squ: '\u25A1', square: '\u25A1', squarf: '\u25AA', squf: '\u25AA', srarr: '\u2192', sscr: '\uD835\uDCC8', ssetmn: '\u2216', ssmile: '\u2323', sstarf: '\u22C6', star: '\u2606', starf: '\u2605', straightepsilon: '\u03F5', straightphi: '\u03D5', strns: '\u00AF', sub: '\u2282', subE: '\u2AC5', subdot: '\u2ABD', sube: '\u2286', subedot: '\u2AC3', submult: '\u2AC1', subnE: '\u2ACB', subne: '\u228A', subplus: '\u2ABF', subrarr: '\u2979', subset: '\u2282', subseteq: '\u2286', subseteqq: '\u2AC5', subsetneq: '\u228A', subsetneqq: '\u2ACB', subsim: '\u2AC7', subsub: '\u2AD5', subsup: '\u2AD3', succ: '\u227B', succapprox: '\u2AB8', succcurlyeq: '\u227D', succeq: '\u2AB0', succnapprox: '\u2ABA', succneqq: '\u2AB6', succnsim: '\u22E9', succsim: '\u227F', sum: '\u2211', sung: '\u266A', sup1: '\u00B9', sup2: '\u00B2', sup3: '\u00B3', sup: '\u2283', supE: '\u2AC6', supdot: '\u2ABE', supdsub: '\u2AD8', supe: '\u2287', supedot: '\u2AC4', suphsol: '\u27C9', suphsub: '\u2AD7', suplarr: '\u297B', supmult: '\u2AC2', supnE: '\u2ACC', supne: '\u228B', supplus: '\u2AC0', supset: '\u2283', supseteq: '\u2287', supseteqq: '\u2AC6', supsetneq: '\u228B', supsetneqq: '\u2ACC', supsim: '\u2AC8', supsub: '\u2AD4', supsup: '\u2AD6', swArr: '\u21D9', swarhk: '\u2926', swarr: '\u2199', swarrow: '\u2199', swnwar: '\u292A', szlig: '\u00DF', target: '\u2316', tau: '\u03C4', tbrk: '\u23B4', tcaron: '\u0165', tcedil: '\u0163', tcy: '\u0442', tdot: '\u20DB', telrec: '\u2315', tfr: '\uD835\uDD31', there4: '\u2234', therefore: '\u2234', theta: '\u03B8', thetasym: '\u03D1', thetav: '\u03D1', thickapprox: '\u2248', thicksim: '\u223C', thinsp: '\u2009', thkap: '\u2248', thksim: '\u223C', thorn: '\u00FE', tilde: '\u02DC', times: '\u00D7', timesb: '\u22A0', timesbar: '\u2A31', timesd: '\u2A30', tint: '\u222D', toea: '\u2928', top: '\u22A4', topbot: '\u2336', topcir: '\u2AF1', topf: '\uD835\uDD65', topfork: '\u2ADA', tosa: '\u2929', tprime: '\u2034', trade: '\u2122', triangle: '\u25B5', triangledown: '\u25BF', triangleleft: '\u25C3', trianglelefteq: '\u22B4', triangleq: '\u225C', triangleright: '\u25B9', trianglerighteq: '\u22B5', tridot: '\u25EC', trie: '\u225C', triminus: '\u2A3A', triplus: '\u2A39', trisb: '\u29CD', tritime: '\u2A3B', trpezium: '\u23E2', tscr: '\uD835\uDCC9', tscy: '\u0446', tshcy: '\u045B', tstrok: '\u0167', twixt: '\u226C', twoheadleftarrow: '\u219E', twoheadrightarrow: '\u21A0', uArr: '\u21D1', uHar: '\u2963', uacute: '\u00FA', uarr: '\u2191', ubrcy: '\u045E', ubreve: '\u016D', ucirc: '\u00FB', ucy: '\u0443', udarr: '\u21C5', udblac: '\u0171', udhar: '\u296E', ufisht: '\u297E', ufr: '\uD835\uDD32', ugrave: '\u00F9', uharl: '\u21BF', uharr: '\u21BE', uhblk: '\u2580', ulcorn: '\u231C', ulcorner: '\u231C', ulcrop: '\u230F', ultri: '\u25F8', umacr: '\u016B', uml: '\u00A8', uogon: '\u0173', uopf: '\uD835\uDD66', uparrow: '\u2191', updownarrow: '\u2195', upharpoonleft: '\u21BF', upharpoonright: '\u21BE', uplus: '\u228E', upsi: '\u03C5', upsih: '\u03D2', upsilon: '\u03C5', upuparrows: '\u21C8', urcorn: '\u231D', urcorner: '\u231D', urcrop: '\u230E', uring: '\u016F', urtri: '\u25F9', uscr: '\uD835\uDCCA', utdot: '\u22F0', utilde: '\u0169', utri: '\u25B5', utrif: '\u25B4', uuarr: '\u21C8', uuml: '\u00FC', uwangle: '\u29A7', vArr: '\u21D5', vBar: '\u2AE8', vBarv: '\u2AE9', vDash: '\u22A8', vangrt: '\u299C', varepsilon: '\u03F5', varkappa: '\u03F0', varnothing: '\u2205', varphi: '\u03D5', varpi: '\u03D6', varpropto: '\u221D', varr: '\u2195', varrho: '\u03F1', varsigma: '\u03C2', varsubsetneq: '\u228A\uFE00', varsubsetneqq: '\u2ACB\uFE00', varsupsetneq: '\u228B\uFE00', varsupsetneqq: '\u2ACC\uFE00', vartheta: '\u03D1', vartriangleleft: '\u22B2', vartriangleright: '\u22B3', vcy: '\u0432', vdash: '\u22A2', vee: '\u2228', veebar: '\u22BB', veeeq: '\u225A', vellip: '\u22EE', verbar: '\u007C', vert: '\u007C', vfr: '\uD835\uDD33', vltri: '\u22B2', vnsub: '\u2282\u20D2', vnsup: '\u2283\u20D2', vopf: '\uD835\uDD67', vprop: '\u221D', vrtri: '\u22B3', vscr: '\uD835\uDCCB', vsubnE: '\u2ACB\uFE00', vsubne: '\u228A\uFE00', vsupnE: '\u2ACC\uFE00', vsupne: '\u228B\uFE00', vzigzag: '\u299A', wcirc: '\u0175', wedbar: '\u2A5F', wedge: '\u2227', wedgeq: '\u2259', weierp: '\u2118', wfr: '\uD835\uDD34', wopf: '\uD835\uDD68', wp: '\u2118', wr: '\u2240', wreath: '\u2240', wscr: '\uD835\uDCCC', xcap: '\u22C2', xcirc: '\u25EF', xcup: '\u22C3', xdtri: '\u25BD', xfr: '\uD835\uDD35', xhArr: '\u27FA', xharr: '\u27F7', xi: '\u03BE', xlArr: '\u27F8', xlarr: '\u27F5', xmap: '\u27FC', xnis: '\u22FB', xodot: '\u2A00', xopf: '\uD835\uDD69', xoplus: '\u2A01', xotime: '\u2A02', xrArr: '\u27F9', xrarr: '\u27F6', xscr: '\uD835\uDCCD', xsqcup: '\u2A06', xuplus: '\u2A04', xutri: '\u25B3', xvee: '\u22C1', xwedge: '\u22C0', yacute: '\u00FD', yacy: '\u044F', ycirc: '\u0177', ycy: '\u044B', yen: '\u00A5', yfr: '\uD835\uDD36', yicy: '\u0457', yopf: '\uD835\uDD6A', yscr: '\uD835\uDCCE', yucy: '\u044E', yuml: '\u00FF', zacute: '\u017A', zcaron: '\u017E', zcy: '\u0437', zdot: '\u017C', zeetrf: '\u2128', zeta: '\u03B6', zfr: '\uD835\uDD37', zhcy: '\u0436', zigrarr: '\u21DD', zopf: '\uD835\uDD6B', zscr: '\uD835\uDCCF', zwj: '\u200D', zwnj: '\u200C' }; const decodeMap = { '0': 65533, '128': 8364, '130': 8218, '131': 402, '132': 8222, '133': 8230, '134': 8224, '135': 8225, '136': 710, '137': 8240, '138': 352, '139': 8249, '140': 338, '142': 381, '145': 8216, '146': 8217, '147': 8220, '148': 8221, '149': 8226, '150': 8211, '151': 8212, '152': 732, '153': 8482, '154': 353, '155': 8250, '156': 339, '158': 382, '159': 376 }; function decodeHTMLStrict(text) { return text.replace(/&(?:[a-zA-Z]+|#[xX][\da-fA-F]+|#\d+);/g, (key) => { if (key.charAt(1) === '#') { const secondChar = key.charAt(2); const codePoint = secondChar === 'X' || secondChar === 'x' ? parseInt(key.slice(3), 16) : parseInt(key.slice(2), 10); return decodeCodePoint(codePoint); } return entities[key.slice(1, -1)] || key; }); } function decodeCodePoint(codePoint) { if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) { return '\uFFFD'; } if (codePoint in decodeMap) { codePoint = decodeMap[codePoint]; } return String.fromCodePoint(codePoint); } function scanJSXAttributeValue(parser, context) { parser.startPos = parser.tokenPos = parser.index; parser.startColumn = parser.colPos = parser.column; parser.startLine = parser.linePos = parser.line; parser.token = CharTypes[parser.currentChar] & 8192 ? scanJSXString(parser, context) : scanSingleToken(parser, context, 0); return parser.token; } function scanJSXString(parser, context) { const quote = parser.currentChar; let char = advanceChar(parser); const start = parser.index; while (char !== quote) { if (parser.index >= parser.end) report(parser, 14); char = advanceChar(parser); } if (char !== quote) report(parser, 14); parser.tokenValue = parser.source.slice(start, parser.index); advanceChar(parser); if (context & 512) parser.tokenRaw = parser.source.slice(parser.tokenPos, parser.index); return 134283267; } function scanJSXToken(parser, context) { parser.startPos = parser.tokenPos = parser.index; parser.startColumn = parser.colPos = parser.column; parser.startLine = parser.linePos = parser.line; if (parser.index >= parser.end) return (parser.token = 1048576); const token = TokenLookup[parser.source.charCodeAt(parser.index)]; switch (token) { case 8456258: { advanceChar(parser); if (parser.currentChar === 47) { advanceChar(parser); parser.token = 25; } else { parser.token = 8456258; } break; } case 2162700: { advanceChar(parser); parser.token = 2162700; break; } default: { let state = 0; while (parser.index < parser.end) { const type = CharTypes[parser.source.charCodeAt(parser.index)]; if (type & 1024) { state |= 1 | 4; scanNewLine(parser); } else if (type & 2048) { consumeLineFeed(parser, state); state = (state & ~4) | 1; } else { advanceChar(parser); } if (CharTypes[parser.currentChar] & 16384) break; } const raw = parser.source.slice(parser.tokenPos, parser.index); if (context & 512) parser.tokenRaw = raw; parser.tokenValue = decodeHTMLStrict(raw); parser.token = 138; } } return parser.token; } function scanJSXIdentifier(parser) { if ((parser.token & 143360) === 143360) { const { index } = parser; let char = parser.currentChar; while (CharTypes[char] & (32768 | 2)) { char = advanceChar(parser); } parser.tokenValue += parser.source.slice(index, parser.index); } parser.token = 208897; return parser.token; } function matchOrInsertSemicolon(parser, context, specDeviation) { if ((parser.flags & 1) === 0 && (parser.token & 1048576) !== 1048576 && !specDeviation) { report(parser, 28, KeywordDescTable[parser.token & 255]); } consumeOpt(parser, context, 1074790417); } function isValidStrictMode(parser, index, tokenPos, tokenValue) { if (index - tokenPos < 13 && tokenValue === 'use strict') { if ((parser.token & 1048576) === 1048576 || parser.flags & 1) { return 1; } } return 0; } function optionalBit(parser, context, t) { if (parser.token !== t) return 0; nextToken(parser, context); return 1; } function consumeOpt(parser, context, t) { if (parser.token !== t) return false; nextToken(parser, context); return true; } function consume(parser, context, t) { if (parser.token !== t) report(parser, 23, KeywordDescTable[t & 255]); nextToken(parser, context); } function reinterpretToPattern(state, node) { switch (node.type) { case 'ArrayExpression': node.type = 'ArrayPattern'; const elements = node.elements; for (let i = 0, n = elements.length; i < n; ++i) { const element = elements[i]; if (element) reinterpretToPattern(state, element); } return; case 'ObjectExpression': node.type = 'ObjectPattern'; const properties = node.properties; for (let i = 0, n = properties.length; i < n; ++i) { reinterpretToPattern(state, properties[i]); } return; case 'AssignmentExpression': node.type = 'AssignmentPattern'; if (node.operator !== '=') report(state, 68); delete node.operator; reinterpretToPattern(state, node.left); return; case 'Property': reinterpretToPattern(state, node.value); return; case 'SpreadElement': node.type = 'RestElement'; reinterpretToPattern(state, node.argument); } } function validateBindingIdentifier(parser, context, kind, t, skipEvalArgCheck) { if (context & 1024) { if ((t & 36864) === 36864) { report(parser, 114); } if (!skipEvalArgCheck && (t & 537079808) === 537079808) { report(parser, 115); } } if ((t & 20480) === 20480) { report(parser, 99); } if (kind & (8 | 16) && t === 241739) { report(parser, 97); } if (context & (4194304 | 2048) && t === 209008) { report(parser, 95); } if (context & (2097152 | 1024) && t === 241773) { report(parser, 94, 'yield'); } } function validateFunctionName(parser, context, t) { if (context & 1024) { if ((t & 36864) === 36864) { report(parser, 114); } if ((t & 537079808) === 537079808) { report(parser, 115); } if (t === 122) { report(parser, 92); } if (t === 121) { report(parser, 92); } } if ((t & 20480) === 20480) { report(parser, 99); } if (context & (4194304 | 2048) && t === 209008) { report(parser, 95); } if (context & (2097152 | 1024) && t === 241773) { report(parser, 94, 'yield'); } } function isStrictReservedWord(parser, context, t) { if (t === 209008) { if (context & (4194304 | 2048)) report(parser, 95); parser.destructible |= 128; } if (t === 241773 && context & 2097152) report(parser, 94, 'yield'); return ((t & 20480) === 20480 || (t & 36864) === 36864 || t == 122); } function isPropertyWithPrivateFieldKey(expr) { return !expr.property ? false : expr.property.type === 'PrivateIdentifier'; } function isValidLabel(parser, labels, name, isIterationStatement) { while (labels) { if (labels['$' + name]) { if (isIterationStatement) report(parser, 133); return 1; } if (isIterationStatement && labels.loop) isIterationStatement = 0; labels = labels['$']; } return 0; } function validateAndDeclareLabel(parser, labels, name) { let set = labels; while (set) { if (set['$' + name]) report(parser, 132, name); set = set['$']; } labels['$' + name] = 1; } function finishNode(parser, context, start, line, column, node) { if (context & 2) { node.start = start; node.end = parser.startPos; node.range = [start, parser.startPos]; } if (context & 4) { node.loc = { start: { line, column }, end: { line: parser.startLine, column: parser.startColumn } }; if (parser.sourceFile) { node.loc.source = parser.sourceFile; } } return node; } function isEqualTagName(elementName) { switch (elementName.type) { case 'JSXIdentifier': return elementName.name; case 'JSXNamespacedName': return elementName.namespace + ':' + elementName.name; case 'JSXMemberExpression': return isEqualTagName(elementName.object) + '.' + isEqualTagName(elementName.property); } } function createArrowHeadParsingScope(parser, context, value) { const scope = addChildScope(createScope(), 1024); addBlockName(parser, context, scope, value, 1, 0); return scope; } function recordScopeError(parser, type, ...params) { const { index, line, column } = parser; return { type, params, index, line, column }; } function createScope() { return { parent: void 0, type: 2 }; } function addChildScope(parent, type) { return { parent, type, scopeError: void 0 }; } function addVarOrBlock(parser, context, scope, name, kind, origin) { if (kind & 4) { addVarName(parser, context, scope, name, kind); } else { addBlockName(parser, context, scope, name, kind, origin); } if (origin & 64) { declareUnboundVariable(parser, name); } } function addBlockName(parser, context, scope, name, kind, origin) { const value = scope['#' + name]; if (value && (value & 2) === 0) { if (kind & 1) { scope.scopeError = recordScopeError(parser, 140, name); } else if (context & 256 && value & 64 && origin & 2) ; else { report(parser, 140, name); } } if (scope.type & 128 && (scope.parent['#' + name] && (scope.parent['#' + name] & 2) === 0)) { report(parser, 140, name); } if (scope.type & 1024 && value && (value & 2) === 0) { if (kind & 1) { scope.scopeError = recordScopeError(parser, 140, name); } } if (scope.type & 64) { if (scope.parent['#' + name] & 768) report(parser, 153, name); } scope['#' + name] = kind; } function addVarName(parser, context, scope, name, kind) { let currentScope = scope; while (currentScope && (currentScope.type & 256) === 0) { const value = currentScope['#' + name]; if (value & 248) { if (context & 256 && (context & 1024) === 0 && ((kind & 128 && value & 68) || (value & 128 && kind & 68))) ; else { report(parser, 140, name); } } if (currentScope === scope) { if (value & 1 && kind & 1) { currentScope.scopeError = recordScopeError(parser, 140, name); } } if (value & (512 | 256)) { if ((value & 512) === 0 || (context & 256) === 0 || context & 1024) { report(parser, 140, name); } } currentScope['#' + name] = kind; currentScope = currentScope.parent; } } function declareUnboundVariable(parser, name) { if (parser.exportedNames !== void 0 && name !== '') { if (parser.exportedNames['#' + name]) { report(parser, 141, name); } parser.exportedNames['#' + name] = 1; } } function addBindingToExports(parser, name) { if (parser.exportedBindings !== void 0 && name !== '') { parser.exportedBindings['#' + name] = 1; } } function pushComment(context, array) { return function (type, value, start, end, loc) { const comment = { type, value }; if (context & 2) { comment.start = start; comment.end = end; comment.range = [start, end]; } if (context & 4) { comment.loc = loc; } array.push(comment); }; } function pushToken(context, array) { return function (token, start, end, loc) { const tokens = { token }; if (context & 2) { tokens.start = start; tokens.end = end; tokens.range = [start, end]; } if (context & 4) { tokens.loc = loc; } array.push(tokens); }; } function isValidIdentifier(context, t) { if (context & (1024 | 2097152)) { if (context & 2048 && t === 209008) return false; if (context & 2097152 && t === 241773) return false; return (t & 143360) === 143360 || (t & 12288) === 12288; } return ((t & 143360) === 143360 || (t & 12288) === 12288 || (t & 36864) === 36864); } function classifyIdentifier(parser, context, t, isArrow) { if ((t & 537079808) === 537079808) { if (context & 1024) report(parser, 115); if (isArrow) parser.flags |= 512; } if (!isValidIdentifier(context, t)) report(parser, 0); } function create(source, sourceFile, onComment, onToken) { return { source, flags: 0, index: 0, line: 1, column: 0, startPos: 0, end: source.length, tokenPos: 0, startColumn: 0, colPos: 0, linePos: 1, startLine: 1, sourceFile, tokenValue: '', token: 1048576, tokenRaw: '', tokenRegExp: void 0, currentChar: source.charCodeAt(0), exportedNames: [], exportedBindings: [], assignable: 1, destructible: 0, onComment, onToken, leadingDecorators: [] }; } function parseSource(source, options, context) { let sourceFile = ''; let onComment; let onToken; if (options != null) { if (options.module) context |= 2048 | 1024; if (options.next) context |= 1; if (options.loc) context |= 4; if (options.ranges) context |= 2; if (options.uniqueKeyInPattern) context |= -2147483648; if (options.lexical) context |= 64; if (options.webcompat) context |= 256; if (options.directives) context |= 8 | 512; if (options.globalReturn) context |= 32; if (options.raw) context |= 512; if (options.preserveParens) context |= 128; if (options.impliedStrict) context |= 1024; if (options.jsx) context |= 16; if (options.identifierPattern) context |= 268435456; if (options.specDeviation) context |= 536870912; if (options.source) sourceFile = options.source; if (options.onComment != null) { onComment = Array.isArray(options.onComment) ? pushComment(context, options.onComment) : options.onComment; } if (options.onToken != null) { onToken = Array.isArray(options.onToken) ? pushToken(context, options.onToken) : options.onToken; } } const parser = create(source, sourceFile, onComment, onToken); if (context & 1) skipHashBang(parser); const scope = context & 64 ? createScope() : void 0; let body = []; let sourceType = 'script'; if (context & 2048) { sourceType = 'module'; body = parseModuleItemList(parser, context | 8192, scope); if (scope) { for (const key in parser.exportedBindings) { if (key[0] === '#' && !scope[key]) report(parser, 142, key.slice(1)); } } } else { body = parseStatementList(parser, context | 8192, scope); } const node = { type: 'Program', sourceType, body }; if (context & 2) { node.start = 0; node.end = source.length; node.range = [0, source.length]; } if (context & 4) { node.loc = { start: { line: 1, column: 0 }, end: { line: parser.line, column: parser.column } }; if (parser.sourceFile) node.loc.source = sourceFile; } return node; } function parseStatementList(parser, context, scope) { nextToken(parser, context | 32768 | 1073741824); const statements = []; while (parser.token === 134283267) { const { index, tokenPos, tokenValue, linePos, colPos, token } = parser; const expr = parseLiteral(parser, context); if (isValidStrictMode(parser, index, tokenPos, tokenValue)) context |= 1024; statements.push(parseDirective(parser, context, expr, token, tokenPos, linePos, colPos)); } while (parser.token !== 1048576) { statements.push(parseStatementListItem(parser, context, scope, 4, {})); } return statements; } function parseModuleItemList(parser, context, scope) { nextToken(parser, context | 32768); const statements = []; if (context & 8) { while (parser.token === 134283267) { const { tokenPos, linePos, colPos, token } = parser; statements.push(parseDirective(parser, context, parseLiteral(parser, context), token, tokenPos, linePos, colPos)); } } while (parser.token !== 1048576) { statements.push(parseModuleItem(parser, context, scope)); } return statements; } function parseModuleItem(parser, context, scope) { parser.leadingDecorators = parseDecorators(parser, context); let moduleItem; switch (parser.token) { case 20566: moduleItem = parseExportDeclaration(parser, context, scope); break; case 86108: moduleItem = parseImportDeclaration(parser, context, scope); break; default: moduleItem = parseStatementListItem(parser, context, scope, 4, {}); } if (parser.leadingDecorators.length) { report(parser, 164); } return moduleItem; } function parseStatementListItem(parser, context, scope, origin, labels) { const start = parser.tokenPos; const line = parser.linePos; const column = parser.colPos; switch (parser.token) { case 86106: return parseFunctionDeclaration(parser, context, scope, origin, 1, 0, 0, start, line, column); case 133: case 86096: return parseClassDeclaration(parser, context, scope, 0, start, line, column); case 86092: return parseLexicalDeclaration(parser, context, scope, 16, 0, start, line, column); case 241739: return parseLetIdentOrVarDeclarationStatement(parser, context, scope, origin, start, line, column); case 20566: report(parser, 100, 'export'); case 86108: nextToken(parser, context); switch (parser.token) { case 67174411: return parseImportCallDeclaration(parser, context, start, line, column); case 67108877: return parseImportMetaDeclaration(parser, context, start, line, column); default: report(parser, 100, 'import'); } case 209007: return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, origin, labels, 1, start, line, column); default: return parseStatement(parser, context, scope, origin, labels, 1, start, line, column); } } function parseStatement(parser, context, scope, origin, labels, allowFuncDecl, start, line, column) { switch (parser.token) { case 86090: return parseVariableStatement(parser, context, scope, 0, start, line, column); case 20574: return parseReturnStatement(parser, context, start, line, column); case 20571: return parseIfStatement(parser, context, scope, labels, start, line, column); case 20569: return parseForStatement(parser, context, scope, labels, start, line, column); case 20564: return parseDoWhileStatement(parser, context, scope, labels, start, line, column); case 20580: return parseWhileStatement(parser, context, scope, labels, start, line, column); case 86112: return parseSwitchStatement(parser, context, scope, labels, start, line, column); case 1074790417: return parseEmptyStatement(parser, context, start, line, column); case 2162700: return parseBlock(parser, context, scope ? addChildScope(scope, 2) : scope, labels, start, line, column); case 86114: return parseThrowStatement(parser, context, start, line, column); case 20557: return parseBreakStatement(parser, context, labels, start, line, column); case 20561: return parseContinueStatement(parser, context, labels, start, line, column); case 20579: return parseTryStatement(parser, context, scope, labels, start, line, column); case 20581: return parseWithStatement(parser, context, scope, labels, start, line, column); case 20562: return parseDebuggerStatement(parser, context, start, line, column); case 209007: return parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, origin, labels, 0, start, line, column); case 20559: report(parser, 156); case 20568: report(parser, 157); case 86106: report(parser, context & 1024 ? 73 : (context & 256) === 0 ? 75 : 74); case 86096: report(parser, 76); default: return parseExpressionOrLabelledStatement(parser, context, scope, origin, labels, allowFuncDecl, start, line, column); } } function parseExpressionOrLabelledStatement(parser, context, scope, origin, labels, allowFuncDecl, start, line, column) { const { tokenValue, token } = parser; let expr; switch (token) { case 241739: expr = parseIdentifier(parser, context, 0); if (context & 1024) report(parser, 82); if (parser.token === 69271571) report(parser, 81); break; default: expr = parsePrimaryExpression(parser, context, 2, 0, 1, 0, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); } if (token & 143360 && parser.token === 21) { return parseLabelledStatement(parser, context, scope, origin, labels, tokenValue, expr, token, allowFuncDecl, start, line, column); } expr = parseMemberOrUpdateExpression(parser, context, expr, 0, 0, start, line, column); expr = parseAssignmentExpression(parser, context, 0, 0, start, line, column, expr); if (parser.token === 18) { expr = parseSequenceExpression(parser, context, 0, start, line, column, expr); } return parseExpressionStatement(parser, context, expr, start, line, column); } function parseBlock(parser, context, scope, labels, start, line, column) { const body = []; consume(parser, context | 32768, 2162700); while (parser.token !== 1074790415) { body.push(parseStatementListItem(parser, context, scope, 2, { $: labels })); } consume(parser, context | 32768, 1074790415); return finishNode(parser, context, start, line, column, { type: 'BlockStatement', body }); } function parseReturnStatement(parser, context, start, line, column) { if ((context & 32) === 0 && context & 8192) report(parser, 89); nextToken(parser, context | 32768); const argument = parser.flags & 1 || parser.token & 1048576 ? null : parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); matchOrInsertSemicolon(parser, context | 32768); return finishNode(parser, context, start, line, column, { type: 'ReturnStatement', argument }); } function parseExpressionStatement(parser, context, expression, start, line, column) { matchOrInsertSemicolon(parser, context | 32768); return finishNode(parser, context, start, line, column, { type: 'ExpressionStatement', expression }); } function parseLabelledStatement(parser, context, scope, origin, labels, value, expr, token, allowFuncDecl, start, line, column) { validateBindingIdentifier(parser, context, 0, token, 1); validateAndDeclareLabel(parser, labels, value); nextToken(parser, context | 32768); const body = allowFuncDecl && (context & 1024) === 0 && context & 256 && parser.token === 86106 ? parseFunctionDeclaration(parser, context, addChildScope(scope, 2), origin, 0, 0, 0, parser.tokenPos, parser.linePos, parser.colPos) : parseStatement(parser, context, scope, origin, labels, allowFuncDecl, parser.tokenPos, parser.linePos, parser.colPos); return finishNode(parser, context, start, line, column, { type: 'LabeledStatement', label: expr, body }); } function parseAsyncArrowOrAsyncFunctionDeclaration(parser, context, scope, origin, labels, allowFuncDecl, start, line, column) { const { token, tokenValue } = parser; let expr = parseIdentifier(parser, context, 0); if (parser.token === 21) { return parseLabelledStatement(parser, context, scope, origin, labels, tokenValue, expr, token, 1, start, line, column); } const asyncNewLine = parser.flags & 1; if (!asyncNewLine) { if (parser.token === 86106) { if (!allowFuncDecl) report(parser, 119); return parseFunctionDeclaration(parser, context, scope, origin, 1, 0, 1, start, line, column); } if ((parser.token & 143360) === 143360) { expr = parseAsyncArrowAfterIdent(parser, context, 1, start, line, column); if (parser.token === 18) expr = parseSequenceExpression(parser, context, 0, start, line, column, expr); return parseExpressionStatement(parser, context, expr, start, line, column); } } if (parser.token === 67174411) { expr = parseAsyncArrowOrCallExpression(parser, context, expr, 1, 1, 0, asyncNewLine, start, line, column); } else { if (parser.token === 10) { classifyIdentifier(parser, context, token, 1); expr = parseArrowFromIdentifier(parser, context, parser.tokenValue, expr, 0, 1, 0, start, line, column); } parser.assignable = 1; } expr = parseMemberOrUpdateExpression(parser, context, expr, 0, 0, start, line, column); if (parser.token === 18) expr = parseSequenceExpression(parser, context, 0, start, line, column, expr); expr = parseAssignmentExpression(parser, context, 0, 0, start, line, column, expr); parser.assignable = 1; return parseExpressionStatement(parser, context, expr, start, line, column); } function parseDirective(parser, context, expression, token, start, line, column) { if (token !== 1074790417) { parser.assignable = 2; expression = parseMemberOrUpdateExpression(parser, context, expression, 0, 0, start, line, column); if (parser.token !== 1074790417) { expression = parseAssignmentExpression(parser, context, 0, 0, start, line, column, expression); if (parser.token === 18) { expression = parseSequenceExpression(parser, context, 0, start, line, column, expression); } } matchOrInsertSemicolon(parser, context | 32768); } return context & 8 && expression.type === 'Literal' && typeof expression.value === 'string' ? finishNode(parser, context, start, line, column, { type: 'ExpressionStatement', expression, directive: expression.raw.slice(1, -1) }) : finishNode(parser, context, start, line, column, { type: 'ExpressionStatement', expression }); } function parseEmptyStatement(parser, context, start, line, column) { nextToken(parser, context | 32768); return finishNode(parser, context, start, line, column, { type: 'EmptyStatement' }); } function parseThrowStatement(parser, context, start, line, column) { nextToken(parser, context | 32768); if (parser.flags & 1) report(parser, 87); const argument = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); matchOrInsertSemicolon(parser, context | 32768); return finishNode(parser, context, start, line, column, { type: 'ThrowStatement', argument }); } function parseIfStatement(parser, context, scope, labels, start, line, column) { nextToken(parser, context); consume(parser, context | 32768, 67174411); parser.assignable = 1; const test = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.line, parser.colPos); consume(parser, context | 32768, 16); const consequent = parseConsequentOrAlternative(parser, context, scope, labels, parser.tokenPos, parser.linePos, parser.colPos); let alternate = null; if (parser.token === 20565) { nextToken(parser, context | 32768); alternate = parseConsequentOrAlternative(parser, context, scope, labels, parser.tokenPos, parser.linePos, parser.colPos); } return finishNode(parser, context, start, line, column, { type: 'IfStatement', test, consequent, alternate }); } function parseConsequentOrAlternative(parser, context, scope, labels, start, line, column) { return context & 1024 || (context & 256) === 0 || parser.token !== 86106 ? parseStatement(parser, context, scope, 0, { $: labels }, 0, parser.tokenPos, parser.linePos, parser.colPos) : parseFunctionDeclaration(parser, context, addChildScope(scope, 2), 0, 0, 0, 0, start, line, column); } function parseSwitchStatement(parser, context, scope, labels, start, line, column) { nextToken(parser, context); consume(parser, context | 32768, 67174411); const discriminant = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); consume(parser, context, 16); consume(parser, context, 2162700); const cases = []; let seenDefault = 0; if (scope) scope = addChildScope(scope, 8); while (parser.token !== 1074790415) { const { tokenPos, linePos, colPos } = parser; let test = null; const consequent = []; if (consumeOpt(parser, context | 32768, 20558)) { test = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); } else { consume(parser, context | 32768, 20563); if (seenDefault) report(parser, 86); seenDefault = 1; } consume(parser, context | 32768, 21); while (parser.token !== 20558 && parser.token !== 1074790415 && parser.token !== 20563) { consequent.push(parseStatementListItem(parser, context | 4096, scope, 2, { $: labels })); } cases.push(finishNode(parser, context, tokenPos, linePos, colPos, { type: 'SwitchCase', test, consequent })); } consume(parser, context | 32768, 1074790415); return finishNode(parser, context, start, line, column, { type: 'SwitchStatement', discriminant, cases }); } function parseWhileStatement(parser, context, scope, labels, start, line, column) { nextToken(parser, context); consume(parser, context | 32768, 67174411); const test = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); consume(parser, context | 32768, 16); const body = parseIterationStatementBody(parser, context, scope, labels); return finishNode(parser, context, start, line, column, { type: 'WhileStatement', test, body }); } function parseIterationStatementBody(parser, context, scope, labels) { return parseStatement(parser, ((context | 134217728) ^ 134217728) | 131072, scope, 0, { loop: 1, $: labels }, 0, parser.tokenPos, parser.linePos, parser.colPos); } function parseContinueStatement(parser, context, labels, start, line, column) { if ((context & 131072) === 0) report(parser, 65); nextToken(parser, context); let label = null; if ((parser.flags & 1) === 0 && parser.token & 143360) { const { tokenValue } = parser; label = parseIdentifier(parser, context | 32768, 0); if (!isValidLabel(parser, labels, tokenValue, 1)) report(parser, 134, tokenValue); } matchOrInsertSemicolon(parser, context | 32768); return finishNode(parser, context, start, line, column, { type: 'ContinueStatement', label }); } function parseBreakStatement(parser, context, labels, start, line, column) { nextToken(parser, context | 32768); let label = null; if ((parser.flags & 1) === 0 && parser.token & 143360) { const { tokenValue } = parser; label = parseIdentifier(parser, context | 32768, 0); if (!isValidLabel(parser, labels, tokenValue, 0)) report(parser, 134, tokenValue); } else if ((context & (4096 | 131072)) === 0) { report(parser, 66); } matchOrInsertSemicolon(parser, context | 32768); return finishNode(parser, context, start, line, column, { type: 'BreakStatement', label }); } function parseWithStatement(parser, context, scope, labels, start, line, column) { nextToken(parser, context); if (context & 1024) report(parser, 88); consume(parser, context | 32768, 67174411); const object = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); consume(parser, context | 32768, 16); const body = parseStatement(parser, context, scope, 2, labels, 0, parser.tokenPos, parser.linePos, parser.colPos); return finishNode(parser, context, start, line, column, { type: 'WithStatement', object, body }); } function parseDebuggerStatement(parser, context, start, line, column) { nextToken(parser, context | 32768); matchOrInsertSemicolon(parser, context | 32768); return finishNode(parser, context, start, line, column, { type: 'DebuggerStatement' }); } function parseTryStatement(parser, context, scope, labels, start, line, column) { nextToken(parser, context | 32768); const firstScope = scope ? addChildScope(scope, 32) : void 0; const block = parseBlock(parser, context, firstScope, { $: labels }, parser.tokenPos, parser.linePos, parser.colPos); const { tokenPos, linePos, colPos } = parser; const handler = consumeOpt(parser, context | 32768, 20559) ? parseCatchBlock(parser, context, scope, labels, tokenPos, linePos, colPos) : null; let finalizer = null; if (parser.token === 20568) { nextToken(parser, context | 32768); const finalizerScope = firstScope ? addChildScope(scope, 4) : void 0; finalizer = parseBlock(parser, context, finalizerScope, { $: labels }, parser.tokenPos, parser.linePos, parser.colPos); } if (!handler && !finalizer) { report(parser, 85); } return finishNode(parser, context, start, line, column, { type: 'TryStatement', block, handler, finalizer }); } function parseCatchBlock(parser, context, scope, labels, start, line, column) { let param = null; let additionalScope = scope; if (consumeOpt(parser, context, 67174411)) { if (scope) scope = addChildScope(scope, 4); param = parseBindingPattern(parser, context, scope, (parser.token & 2097152) === 2097152 ? 256 : 512, 0, parser.tokenPos, parser.linePos, parser.colPos); if (parser.token === 18) { report(parser, 83); } else if (parser.token === 1077936157) { report(parser, 84); } consume(parser, context | 32768, 16); if (scope) additionalScope = addChildScope(scope, 64); } const body = parseBlock(parser, context, additionalScope, { $: labels }, parser.tokenPos, parser.linePos, parser.colPos); return finishNode(parser, context, start, line, column, { type: 'CatchClause', param, body }); } function parseStaticBlock(parser, context, scope, start, line, column) { if (scope) scope = addChildScope(scope, 2); const ctorContext = 16384 | 524288; context = ((context | ctorContext) ^ ctorContext) | 262144; const { body } = parseBlock(parser, context, scope, {}, start, line, column); return finishNode(parser, context, start, line, column, { type: 'StaticBlock', body }); } function parseDoWhileStatement(parser, context, scope, labels, start, line, column) { nextToken(parser, context | 32768); const body = parseIterationStatementBody(parser, context, scope, labels); consume(parser, context, 20580); consume(parser, context | 32768, 67174411); const test = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); consume(parser, context | 32768, 16); consumeOpt(parser, context, 1074790417); return finishNode(parser, context, start, line, column, { type: 'DoWhileStatement', body, test }); } function parseLetIdentOrVarDeclarationStatement(parser, context, scope, origin, start, line, column) { const { token, tokenValue } = parser; let expr = parseIdentifier(parser, context, 0); if (parser.token & (143360 | 2097152)) { const declarations = parseVariableDeclarationList(parser, context, scope, 8, 0); matchOrInsertSemicolon(parser, context | 32768); return finishNode(parser, context, start, line, column, { type: 'VariableDeclaration', kind: 'let', declarations }); } parser.assignable = 1; if (context & 1024) report(parser, 82); if (parser.token === 21) { return parseLabelledStatement(parser, context, scope, origin, {}, tokenValue, expr, token, 0, start, line, column); } if (parser.token === 10) { let scope = void 0; if (context & 64) scope = createArrowHeadParsingScope(parser, context, tokenValue); parser.flags = (parser.flags | 128) ^ 128; expr = parseArrowFunctionExpression(parser, context, scope, [expr], 0, start, line, column); } else { expr = parseMemberOrUpdateExpression(parser, context, expr, 0, 0, start, line, column); expr = parseAssignmentExpression(parser, context, 0, 0, start, line, column, expr); } if (parser.token === 18) { expr = parseSequenceExpression(parser, context, 0, start, line, column, expr); } return parseExpressionStatement(parser, context, expr, start, line, column); } function parseLexicalDeclaration(parser, context, scope, kind, origin, start, line, column) { nextToken(parser, context); const declarations = parseVariableDeclarationList(parser, context, scope, kind, origin); matchOrInsertSemicolon(parser, context | 32768); return finishNode(parser, context, start, line, column, { type: 'VariableDeclaration', kind: kind & 8 ? 'let' : 'const', declarations }); } function parseVariableStatement(parser, context, scope, origin, start, line, column) { nextToken(parser, context); const declarations = parseVariableDeclarationList(parser, context, scope, 4, origin); matchOrInsertSemicolon(parser, context | 32768); return finishNode(parser, context, start, line, column, { type: 'VariableDeclaration', kind: 'var', declarations }); } function parseVariableDeclarationList(parser, context, scope, kind, origin) { let bindingCount = 1; const list = [parseVariableDeclaration(parser, context, scope, kind, origin)]; while (consumeOpt(parser, context, 18)) { bindingCount++; list.push(parseVariableDeclaration(parser, context, scope, kind, origin)); } if (bindingCount > 1 && origin & 32 && parser.token & 262144) { report(parser, 58, KeywordDescTable[parser.token & 255]); } return list; } function parseVariableDeclaration(parser, context, scope, kind, origin) { const { token, tokenPos, linePos, colPos } = parser; let init = null; const id = parseBindingPattern(parser, context, scope, kind, origin, tokenPos, linePos, colPos); if (parser.token === 1077936157) { nextToken(parser, context | 32768); init = parseExpression(parser, context, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); if (origin & 32 || (token & 2097152) === 0) { if (parser.token === 274549 || (parser.token === 8738868 && (token & 2097152 || (kind & 4) === 0 || context & 1024))) { reportMessageAt(tokenPos, parser.line, parser.index - 3, 57, parser.token === 274549 ? 'of' : 'in'); } } } else if ((kind & 16 || (token & 2097152) > 0) && (parser.token & 262144) !== 262144) { report(parser, 56, kind & 16 ? 'const' : 'destructuring'); } return finishNode(parser, context, tokenPos, linePos, colPos, { type: 'VariableDeclarator', id, init }); } function parseForStatement(parser, context, scope, labels, start, line, column) { nextToken(parser, context); const forAwait = ((context & 4194304) > 0 || ((context & 2048) > 0 && (context & 8192) > 0)) && consumeOpt(parser, context, 209008); consume(parser, context | 32768, 67174411); if (scope) scope = addChildScope(scope, 1); let test = null; let update = null; let destructible = 0; let init = null; let isVarDecl = parser.token === 86090 || parser.token === 241739 || parser.token === 86092; let right; const { token, tokenPos, linePos, colPos } = parser; if (isVarDecl) { if (token === 241739) { init = parseIdentifier(parser, context, 0); if (parser.token & (143360 | 2097152)) { if (parser.token === 8738868) { if (context & 1024) report(parser, 64); } else { init = finishNode(parser, context, tokenPos, linePos, colPos, { type: 'VariableDeclaration', kind: 'let', declarations: parseVariableDeclarationList(parser, context | 134217728, scope, 8, 32) }); } parser.assignable = 1; } else if (context & 1024) { report(parser, 64); } else { isVarDecl = false; parser.assignable = 1; init = parseMemberOrUpdateExpression(parser, context, init, 0, 0, tokenPos, linePos, colPos); if (parser.token === 274549) report(parser, 111); } } else { nextToken(parser, context); init = finishNode(parser, context, tokenPos, linePos, colPos, token === 86090 ? { type: 'VariableDeclaration', kind: 'var', declarations: parseVariableDeclarationList(parser, context | 134217728, scope, 4, 32) } : { type: 'VariableDeclaration', kind: 'const', declarations: parseVariableDeclarationList(parser, context | 134217728, scope, 16, 32) }); parser.assignable = 1; } } else if (token === 1074790417) { if (forAwait) report(parser, 79); } else if ((token & 2097152) === 2097152) { init = token === 2162700 ? parseObjectLiteralOrPattern(parser, context, void 0, 1, 0, 0, 2, 32, tokenPos, linePos, colPos) : parseArrayExpressionOrPattern(parser, context, void 0, 1, 0, 0, 2, 32, tokenPos, linePos, colPos); destructible = parser.destructible; if (context & 256 && destructible & 64) { report(parser, 60); } parser.assignable = destructible & 16 ? 2 : 1; init = parseMemberOrUpdateExpression(parser, context | 134217728, init, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); } else { init = parseLeftHandSideExpression(parser, context | 134217728, 1, 0, 1, tokenPos, linePos, colPos); } if ((parser.token & 262144) === 262144) { if (parser.token === 274549) { if (parser.assignable & 2) report(parser, 77, forAwait ? 'await' : 'of'); reinterpretToPattern(parser, init); nextToken(parser, context | 32768); right = parseExpression(parser, context, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); consume(parser, context | 32768, 16); const body = parseIterationStatementBody(parser, context, scope, labels); return finishNode(parser, context, start, line, column, { type: 'ForOfStatement', left: init, right, body, await: forAwait }); } if (parser.assignable & 2) report(parser, 77, 'in'); reinterpretToPattern(parser, init); nextToken(parser, context | 32768); if (forAwait) report(parser, 79); right = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); consume(parser, context | 32768, 16); const body = parseIterationStatementBody(parser, context, scope, labels); return finishNode(parser, context, start, line, column, { type: 'ForInStatement', body, left: init, right }); } if (forAwait) report(parser, 79); if (!isVarDecl) { if (destructible & 8 && parser.token !== 1077936157) { report(parser, 77, 'loop'); } init = parseAssignmentExpression(parser, context | 134217728, 0, 0, tokenPos, linePos, colPos, init); } if (parser.token === 18) init = parseSequenceExpression(parser, context, 0, parser.tokenPos, parser.linePos, parser.colPos, init); consume(parser, context | 32768, 1074790417); if (parser.token !== 1074790417) test = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); consume(parser, context | 32768, 1074790417); if (parser.token !== 16) update = parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); consume(parser, context | 32768, 16); const body = parseIterationStatementBody(parser, context, scope, labels); return finishNode(parser, context, start, line, column, { type: 'ForStatement', init, test, update, body }); } function parseRestrictedIdentifier(parser, context, scope) { if (!isValidIdentifier(context, parser.token)) report(parser, 114); if ((parser.token & 537079808) === 537079808) report(parser, 115); if (scope) addBlockName(parser, context, scope, parser.tokenValue, 8, 0); return parseIdentifier(parser, context, 0); } function parseImportDeclaration(parser, context, scope) { const start = parser.tokenPos; const line = parser.linePos; const column = parser.colPos; nextToken(parser, context); let source = null; const { tokenPos, linePos, colPos } = parser; let specifiers = []; if (parser.token === 134283267) { source = parseLiteral(parser, context); } else { if (parser.token & 143360) { const local = parseRestrictedIdentifier(parser, context, scope); specifiers = [ finishNode(parser, context, tokenPos, linePos, colPos, { type: 'ImportDefaultSpecifier', local }) ]; if (consumeOpt(parser, context, 18)) { switch (parser.token) { case 8457014: specifiers.push(parseImportNamespaceSpecifier(parser, context, scope)); break; case 2162700: parseImportSpecifierOrNamedImports(parser, context, scope, specifiers); break; default: report(parser, 104); } } } else { switch (parser.token) { case 8457014: specifiers = [parseImportNamespaceSpecifier(parser, context, scope)]; break; case 2162700: parseImportSpecifierOrNamedImports(parser, context, scope, specifiers); break; case 67174411: return parseImportCallDeclaration(parser, context, start, line, column); case 67108877: return parseImportMetaDeclaration(parser, context, start, line, column); default: report(parser, 28, KeywordDescTable[parser.token & 255]); } } source = parseModuleSpecifier(parser, context); } matchOrInsertSemicolon(parser, context | 32768); return finishNode(parser, context, start, line, column, { type: 'ImportDeclaration', specifiers, source }); } function parseImportNamespaceSpecifier(parser, context, scope) { const { tokenPos, linePos, colPos } = parser; nextToken(parser, context); consume(parser, context, 77934); if ((parser.token & 134217728) === 134217728) { reportMessageAt(tokenPos, parser.line, parser.index, 28, KeywordDescTable[parser.token & 255]); } return finishNode(parser, context, tokenPos, linePos, colPos, { type: 'ImportNamespaceSpecifier', local: parseRestrictedIdentifier(parser, context, scope) }); } function parseModuleSpecifier(parser, context) { consumeOpt(parser, context, 12404); if (parser.token !== 134283267) report(parser, 102, 'Import'); return parseLiteral(parser, context); } function parseImportSpecifierOrNamedImports(parser, context, scope, specifiers) { nextToken(parser, context); while (parser.token & 143360) { let { token, tokenValue, tokenPos, linePos, colPos } = parser; const imported = parseIdentifier(parser, context, 0); let local; if (consumeOpt(parser, context, 77934)) { if ((parser.token & 134217728) === 134217728 || parser.token === 18) { report(parser, 103); } else { validateBindingIdentifier(parser, context, 16, parser.token, 0); } tokenValue = parser.tokenValue; local = parseIdentifier(parser, context, 0); } else { validateBindingIdentifier(parser, context, 16, token, 0); local = imported; } if (scope) addBlockName(parser, context, scope, tokenValue, 8, 0); specifiers.push(finishNode(parser, context, tokenPos, linePos, colPos, { type: 'ImportSpecifier', local, imported })); if (parser.token !== 1074790415) consume(parser, context, 18); } consume(parser, context, 1074790415); return specifiers; } function parseImportMetaDeclaration(parser, context, start, line, column) { let expr = parseImportMetaExpression(parser, context, finishNode(parser, context, start, line, column, { type: 'Identifier', name: 'import' }), start, line, column); expr = parseMemberOrUpdateExpression(parser, context, expr, 0, 0, start, line, column); expr = parseAssignmentExpression(parser, context, 0, 0, start, line, column, expr); return parseExpressionStatement(parser, context, expr, start, line, column); } function parseImportCallDeclaration(parser, context, start, line, column) { let expr = parseImportExpression(parser, context, 0, start, line, column); expr = parseMemberOrUpdateExpression(parser, context, expr, 0, 0, start, line, column); return parseExpressionStatement(parser, context, expr, start, line, column); } function parseExportDeclaration(parser, context, scope) { const start = parser.tokenPos; const line = parser.linePos; const column = parser.colPos; nextToken(parser, context | 32768); const specifiers = []; let declaration = null; let source = null; let key; if (consumeOpt(parser, context | 32768, 20563)) { switch (parser.token) { case 86106: { declaration = parseFunctionDeclaration(parser, context, scope, 4, 1, 1, 0, parser.tokenPos, parser.linePos, parser.colPos); break; } case 133: case 86096: declaration = parseClassDeclaration(parser, context, scope, 1, parser.tokenPos, parser.linePos, parser.colPos); break; case 209007: const { tokenPos, linePos, colPos } = parser; declaration = parseIdentifier(parser, context, 0); const { flags } = parser; if ((flags & 1) === 0) { if (parser.token === 86106) { declaration = parseFunctionDeclaration(parser, context, scope, 4, 1, 1, 1, tokenPos, linePos, colPos); } else { if (parser.token === 67174411) { declaration = parseAsyncArrowOrCallExpression(parser, context, declaration, 1, 1, 0, flags, tokenPos, linePos, colPos); declaration = parseMemberOrUpdateExpression(parser, context, declaration, 0, 0, tokenPos, linePos, colPos); declaration = parseAssignmentExpression(parser, context, 0, 0, tokenPos, linePos, colPos, declaration); } else if (parser.token & 143360) { if (scope) scope = createArrowHeadParsingScope(parser, context, parser.tokenValue); declaration = parseIdentifier(parser, context, 0); declaration = parseArrowFunctionExpression(parser, context, scope, [declaration], 1, tokenPos, linePos, colPos); } } } break; default: declaration = parseExpression(parser, context, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); matchOrInsertSemicolon(parser, context | 32768); } if (scope) declareUnboundVariable(parser, 'default'); return finishNode(parser, context, start, line, column, { type: 'ExportDefaultDeclaration', declaration }); } switch (parser.token) { case 8457014: { nextToken(parser, context); let exported = null; const isNamedDeclaration = consumeOpt(parser, context, 77934); if (isNamedDeclaration) { if (scope) declareUnboundVariable(parser, parser.tokenValue); exported = parseIdentifier(parser, context, 0); } consume(parser, context, 12404); if (parser.token !== 134283267) report(parser, 102, 'Export'); source = parseLiteral(parser, context); matchOrInsertSemicolon(parser, context | 32768); return finishNode(parser, context, start, line, column, { type: 'ExportAllDeclaration', source, exported }); } case 2162700: { nextToken(parser, context); const tmpExportedNames = []; const tmpExportedBindings = []; while (parser.token & 143360) { const { tokenPos, tokenValue, linePos, colPos } = parser; const local = parseIdentifier(parser, context, 0); let exported; if (parser.token === 77934) { nextToken(parser, context); if ((parser.token & 134217728) === 134217728) { report(parser, 103); } if (scope) { tmpExportedNames.push(parser.tokenValue); tmpExportedBindings.push(tokenValue); } exported = parseIdentifier(parser, context, 0); } else { if (scope) { tmpExportedNames.push(parser.tokenValue); tmpExportedBindings.push(parser.tokenValue); } exported = local; } specifiers.push(finishNode(parser, context, tokenPos, linePos, colPos, { type: 'ExportSpecifier', local, exported })); if (parser.token !== 1074790415) consume(parser, context, 18); } consume(parser, context, 1074790415); if (consumeOpt(parser, context, 12404)) { if (parser.token !== 134283267) report(parser, 102, 'Export'); source = parseLiteral(parser, context); } else if (scope) { let i = 0; let iMax = tmpExportedNames.length; for (; i < iMax; i++) { declareUnboundVariable(parser, tmpExportedNames[i]); } i = 0; iMax = tmpExportedBindings.length; for (; i < iMax; i++) { addBindingToExports(parser, tmpExportedBindings[i]); } } matchOrInsertSemicolon(parser, context | 32768); break; } case 86096: declaration = parseClassDeclaration(parser, context, scope, 2, parser.tokenPos, parser.linePos, parser.colPos); break; case 86106: declaration = parseFunctionDeclaration(parser, context, scope, 4, 1, 2, 0, parser.tokenPos, parser.linePos, parser.colPos); break; case 241739: declaration = parseLexicalDeclaration(parser, context, scope, 8, 64, parser.tokenPos, parser.linePos, parser.colPos); break; case 86092: declaration = parseLexicalDeclaration(parser, context, scope, 16, 64, parser.tokenPos, parser.linePos, parser.colPos); break; case 86090: declaration = parseVariableStatement(parser, context, scope, 64, parser.tokenPos, parser.linePos, parser.colPos); break; case 209007: const { tokenPos, linePos, colPos } = parser; nextToken(parser, context); if ((parser.flags & 1) === 0 && parser.token === 86106) { declaration = parseFunctionDeclaration(parser, context, scope, 4, 1, 2, 1, tokenPos, linePos, colPos); if (scope) { key = declaration.id ? declaration.id.name : ''; declareUnboundVariable(parser, key); } break; } default: report(parser, 28, KeywordDescTable[parser.token & 255]); } return finishNode(parser, context, start, line, column, { type: 'ExportNamedDeclaration', declaration, specifiers, source }); } function parseExpression(parser, context, canAssign, isPattern, inGroup, start, line, column) { let expr = parsePrimaryExpression(parser, context, 2, 0, canAssign, isPattern, inGroup, 1, start, line, column); expr = parseMemberOrUpdateExpression(parser, context, expr, inGroup, 0, start, line, column); return parseAssignmentExpression(parser, context, inGroup, 0, start, line, column, expr); } function parseSequenceExpression(parser, context, inGroup, start, line, column, expr) { const expressions = [expr]; while (consumeOpt(parser, context | 32768, 18)) { expressions.push(parseExpression(parser, context, 1, 0, inGroup, parser.tokenPos, parser.linePos, parser.colPos)); } return finishNode(parser, context, start, line, column, { type: 'SequenceExpression', expressions }); } function parseExpressions(parser, context, inGroup, canAssign, start, line, column) { const expr = parseExpression(parser, context, canAssign, 0, inGroup, start, line, column); return parser.token === 18 ? parseSequenceExpression(parser, context, inGroup, start, line, column, expr) : expr; } function parseAssignmentExpression(parser, context, inGroup, isPattern, start, line, column, left) { const { token } = parser; if ((token & 4194304) === 4194304) { if (parser.assignable & 2) report(parser, 24); if ((!isPattern && token === 1077936157 && left.type === 'ArrayExpression') || left.type === 'ObjectExpression') { reinterpretToPattern(parser, left); } nextToken(parser, context | 32768); const right = parseExpression(parser, context, 1, 1, inGroup, parser.tokenPos, parser.linePos, parser.colPos); parser.assignable = 2; return finishNode(parser, context, start, line, column, isPattern ? { type: 'AssignmentPattern', left, right } : { type: 'AssignmentExpression', left, operator: KeywordDescTable[token & 255], right }); } if ((token & 8454144) === 8454144) { left = parseBinaryExpression(parser, context, inGroup, start, line, column, 4, token, left); } if (consumeOpt(parser, context | 32768, 22)) { left = parseConditionalExpression(parser, context, left, start, line, column); } return left; } function parseAssignmentExpressionOrPattern(parser, context, inGroup, isPattern, start, line, column, left) { const { token } = parser; nextToken(parser, context | 32768); const right = parseExpression(parser, context, 1, 1, inGroup, parser.tokenPos, parser.linePos, parser.colPos); left = finishNode(parser, context, start, line, column, isPattern ? { type: 'AssignmentPattern', left, right } : { type: 'AssignmentExpression', left, operator: KeywordDescTable[token & 255], right }); parser.assignable = 2; return left; } function parseConditionalExpression(parser, context, test, start, line, column) { const consequent = parseExpression(parser, (context | 134217728) ^ 134217728, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); consume(parser, context | 32768, 21); parser.assignable = 1; const alternate = parseExpression(parser, context, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); parser.assignable = 2; return finishNode(parser, context, start, line, column, { type: 'ConditionalExpression', test, consequent, alternate }); } function parseBinaryExpression(parser, context, inGroup, start, line, column, minPrec, operator, left) { const bit = -((context & 134217728) > 0) & 8738868; let t; let prec; parser.assignable = 2; while (parser.token & 8454144) { t = parser.token; prec = t & 3840; if ((t & 524288 && operator & 268435456) || (operator & 524288 && t & 268435456)) { report(parser, 159); } if (prec + ((t === 8457273) << 8) - ((bit === t) << 12) <= minPrec) break; nextToken(parser, context | 32768); left = finishNode(parser, context, start, line, column, { type: t & 524288 || t & 268435456 ? 'LogicalExpression' : 'BinaryExpression', left, right: parseBinaryExpression(parser, context, inGroup, parser.tokenPos, parser.linePos, parser.colPos, prec, t, parseLeftHandSideExpression(parser, context, 0, inGroup, 1, parser.tokenPos, parser.linePos, parser.colPos)), operator: KeywordDescTable[t & 255] }); } if (parser.token === 1077936157) report(parser, 24); return left; } function parseUnaryExpression(parser, context, isLHS, start, line, column, inGroup) { if (!isLHS) report(parser, 0); const unaryOperator = parser.token; nextToken(parser, context | 32768); const arg = parseLeftHandSideExpression(parser, context, 0, inGroup, 1, parser.tokenPos, parser.linePos, parser.colPos); if (parser.token === 8457273) report(parser, 31); if (context & 1024 && unaryOperator === 16863278) { if (arg.type === 'Identifier') { report(parser, 117); } else if (isPropertyWithPrivateFieldKey(arg)) { report(parser, 123); } } parser.assignable = 2; return finishNode(parser, context, start, line, column, { type: 'UnaryExpression', operator: KeywordDescTable[unaryOperator & 255], argument: arg, prefix: true }); } function parseAsyncExpression(parser, context, inGroup, isLHS, canAssign, isPattern, inNew, start, line, column) { const { token } = parser; const expr = parseIdentifier(parser, context, isPattern); const { flags } = parser; if ((flags & 1) === 0) { if (parser.token === 86106) { return parseFunctionExpression(parser, context, 1, inGroup, start, line, column); } if ((parser.token & 143360) === 143360) { if (!isLHS) report(parser, 0); return parseAsyncArrowAfterIdent(parser, context, canAssign, start, line, column); } } if (!inNew && parser.token === 67174411) { return parseAsyncArrowOrCallExpression(parser, context, expr, canAssign, 1, 0, flags, start, line, column); } if (parser.token === 10) { classifyIdentifier(parser, context, token, 1); if (inNew) report(parser, 48); return parseArrowFromIdentifier(parser, context, parser.tokenValue, expr, inNew, canAssign, 0, start, line, column); } return expr; } function parseYieldExpression(parser, context, inGroup, canAssign, start, line, column) { if (inGroup) parser.destructible |= 256; if (context & 2097152) { nextToken(parser, context | 32768); if (context & 8388608) report(parser, 30); if (!canAssign) report(parser, 24); if (parser.token === 22) report(parser, 120); let argument = null; let delegate = false; if ((parser.flags & 1) === 0) { delegate = consumeOpt(parser, context | 32768, 8457014); if (parser.token & (12288 | 65536) || delegate) { argument = parseExpression(parser, context, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); } } parser.assignable = 2; return finishNode(parser, context, start, line, column, { type: 'YieldExpression', argument, delegate }); } if (context & 1024) report(parser, 94, 'yield'); return parseIdentifierOrArrow(parser, context, start, line, column); } function parseAwaitExpression(parser, context, inNew, inGroup, start, line, column) { if (inGroup) parser.destructible |= 128; if (context & 4194304 || (context & 2048 && context & 8192)) { if (inNew) report(parser, 0); if (context & 8388608) { reportMessageAt(parser.index, parser.line, parser.index, 29); } nextToken(parser, context | 32768); const argument = parseLeftHandSideExpression(parser, context, 0, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); if (parser.token === 8457273) report(parser, 31); parser.assignable = 2; return finishNode(parser, context, start, line, column, { type: 'AwaitExpression', argument }); } if (context & 2048) report(parser, 95); return parseIdentifierOrArrow(parser, context, start, line, column); } function parseFunctionBody(parser, context, scope, origin, firstRestricted, scopeError) { const { tokenPos, linePos, colPos } = parser; consume(parser, context | 32768, 2162700); const body = []; const prevContext = context; if (parser.token !== 1074790415) { while (parser.token === 134283267) { const { index, tokenPos, tokenValue, token } = parser; const expr = parseLiteral(parser, context); if (isValidStrictMode(parser, index, tokenPos, tokenValue)) { context |= 1024; if (parser.flags & 128) { reportMessageAt(parser.index, parser.line, parser.tokenPos, 63); } if (parser.flags & 64) { reportMessageAt(parser.index, parser.line, parser.tokenPos, 8); } } body.push(parseDirective(parser, context, expr, token, tokenPos, parser.linePos, parser.colPos)); } if (context & 1024) { if (firstRestricted) { if ((firstRestricted & 537079808) === 537079808) { report(parser, 115); } if ((firstRestricted & 36864) === 36864) { report(parser, 38); } } if (parser.flags & 512) report(parser, 115); if (parser.flags & 256) report(parser, 114); } if (context & 64 && scope && scopeError !== void 0 && (prevContext & 1024) === 0 && (context & 8192) === 0) { reportScopeError(scopeError); } } parser.flags = (parser.flags | 512 | 256 | 64) ^ (512 | 256 | 64); parser.destructible = (parser.destructible | 256) ^ 256; while (parser.token !== 1074790415) { body.push(parseStatementListItem(parser, context, scope, 4, {})); } consume(parser, origin & (16 | 8) ? context | 32768 : context, 1074790415); parser.flags &= ~(128 | 64); if (parser.token === 1077936157) report(parser, 24); return finishNode(parser, context, tokenPos, linePos, colPos, { type: 'BlockStatement', body }); } function parseSuperExpression(parser, context, start, line, column) { nextToken(parser, context); switch (parser.token) { case 67108991: report(parser, 161); case 67174411: { if ((context & 524288) === 0) report(parser, 26); if (context & 16384) report(parser, 27); parser.assignable = 2; break; } case 69271571: case 67108877: { if ((context & 262144) === 0) report(parser, 27); if (context & 16384) report(parser, 27); parser.assignable = 1; break; } default: report(parser, 28, 'super'); } return finishNode(parser, context, start, line, column, { type: 'Super' }); } function parseLeftHandSideExpression(parser, context, canAssign, inGroup, isLHS, start, line, column) { const expression = parsePrimaryExpression(parser, context, 2, 0, canAssign, 0, inGroup, isLHS, start, line, column); return parseMemberOrUpdateExpression(parser, context, expression, inGroup, 0, start, line, column); } function parseUpdateExpression(parser, context, expr, start, line, column) { if (parser.assignable & 2) report(parser, 52); const { token } = parser; nextToken(parser, context); parser.assignable = 2; return finishNode(parser, context, start, line, column, { type: 'UpdateExpression', argument: expr, operator: KeywordDescTable[token & 255], prefix: false }); } function parseMemberOrUpdateExpression(parser, context, expr, inGroup, inChain, start, line, column) { if ((parser.token & 33619968) === 33619968 && (parser.flags & 1) === 0) { expr = parseUpdateExpression(parser, context, expr, start, line, column); } else if ((parser.token & 67108864) === 67108864) { context = (context | 134217728) ^ 134217728; switch (parser.token) { case 67108877: { nextToken(parser, (context | 1073741824 | 8192) ^ 8192); parser.assignable = 1; const property = parsePropertyOrPrivatePropertyName(parser, context); expr = finishNode(parser, context, start, line, column, { type: 'MemberExpression', object: expr, computed: false, property }); break; } case 69271571: { let restoreHasOptionalChaining = false; if ((parser.flags & 2048) === 2048) { restoreHasOptionalChaining = true; parser.flags = (parser.flags | 2048) ^ 2048; } nextToken(parser, context | 32768); const { tokenPos, linePos, colPos } = parser; const property = parseExpressions(parser, context, inGroup, 1, tokenPos, linePos, colPos); consume(parser, context, 20); parser.assignable = 1; expr = finishNode(parser, context, start, line, column, { type: 'MemberExpression', object: expr, computed: true, property }); if (restoreHasOptionalChaining) { parser.flags |= 2048; } break; } case 67174411: { if ((parser.flags & 1024) === 1024) { parser.flags = (parser.flags | 1024) ^ 1024; return expr; } let restoreHasOptionalChaining = false; if ((parser.flags & 2048) === 2048) { restoreHasOptionalChaining = true; parser.flags = (parser.flags | 2048) ^ 2048; } const args = parseArguments(parser, context, inGroup); parser.assignable = 2; expr = finishNode(parser, context, start, line, column, { type: 'CallExpression', callee: expr, arguments: args }); if (restoreHasOptionalChaining) { parser.flags |= 2048; } break; } case 67108991: { nextToken(parser, (context | 1073741824 | 8192) ^ 8192); parser.flags |= 2048; parser.assignable = 2; expr = parseOptionalChain(parser, context, expr, start, line, column); break; } default: if ((parser.flags & 2048) === 2048) { report(parser, 160); } parser.assignable = 2; expr = finishNode(parser, context, start, line, column, { type: 'TaggedTemplateExpression', tag: expr, quasi: parser.token === 67174408 ? parseTemplate(parser, context | 65536) : parseTemplateLiteral(parser, context, parser.tokenPos, parser.linePos, parser.colPos) }); } expr = parseMemberOrUpdateExpression(parser, context, expr, 0, 1, start, line, column); } if (inChain === 0 && (parser.flags & 2048) === 2048) { parser.flags = (parser.flags | 2048) ^ 2048; expr = finishNode(parser, context, start, line, column, { type: 'ChainExpression', expression: expr }); } return expr; } function parseOptionalChain(parser, context, expr, start, line, column) { let restoreHasOptionalChaining = false; let node; if (parser.token === 69271571 || parser.token === 67174411) { if ((parser.flags & 2048) === 2048) { restoreHasOptionalChaining = true; parser.flags = (parser.flags | 2048) ^ 2048; } } if (parser.token === 69271571) { nextToken(parser, context | 32768); const { tokenPos, linePos, colPos } = parser; const property = parseExpressions(parser, context, 0, 1, tokenPos, linePos, colPos); consume(parser, context, 20); parser.assignable = 2; node = finishNode(parser, context, start, line, column, { type: 'MemberExpression', object: expr, computed: true, optional: true, property }); } else if (parser.token === 67174411) { const args = parseArguments(parser, context, 0); parser.assignable = 2; node = finishNode(parser, context, start, line, column, { type: 'CallExpression', callee: expr, arguments: args, optional: true }); } else { if ((parser.token & (143360 | 4096)) === 0) report(parser, 154); const property = parseIdentifier(parser, context, 0); parser.assignable = 2; node = finishNode(parser, context, start, line, column, { type: 'MemberExpression', object: expr, computed: false, optional: true, property }); } if (restoreHasOptionalChaining) { parser.flags |= 2048; } return node; } function parsePropertyOrPrivatePropertyName(parser, context) { if ((parser.token & (143360 | 4096)) === 0 && parser.token !== 131) { report(parser, 154); } return context & 1 && parser.token === 131 ? parsePrivateIdentifier(parser, context, parser.tokenPos, parser.linePos, parser.colPos) : parseIdentifier(parser, context, 0); } function parseUpdateExpressionPrefixed(parser, context, inNew, isLHS, start, line, column) { if (inNew) report(parser, 53); if (!isLHS) report(parser, 0); const { token } = parser; nextToken(parser, context | 32768); const arg = parseLeftHandSideExpression(parser, context, 0, 0, 1, parser.tokenPos, parser.linePos, parser.colPos); if (parser.assignable & 2) { report(parser, 52); } parser.assignable = 2; return finishNode(parser, context, start, line, column, { type: 'UpdateExpression', argument: arg, operator: KeywordDescTable[token & 255], prefix: true }); } function parsePrimaryExpression(parser, context, kind, inNew, canAssign, isPattern, inGroup, isLHS, start, line, column) { if ((parser.token & 143360) === 143360) { switch (parser.token) { case 209008: return parseAwaitExpression(parser, context, inNew, inGroup, start, line, column); case 241773: return parseYieldExpression(parser, context, inGroup, canAssign, start, line, column); case 209007: return parseAsyncExpression(parser, context, inGroup, isLHS, canAssign, isPattern, inNew, start, line, column); } const { token, tokenValue } = parser; const expr = parseIdentifier(parser, context | 65536, isPattern); if (parser.token === 10) { if (!isLHS) report(parser, 0); classifyIdentifier(parser, context, token, 1); return parseArrowFromIdentifier(parser, context, tokenValue, expr, inNew, canAssign, 0, start, line, column); } if (context & 16384 && token === 537079928) report(parser, 126); if (token === 241739) { if (context & 1024) report(parser, 109); if (kind & (8 | 16)) report(parser, 97); } parser.assignable = context & 1024 && (token & 537079808) === 537079808 ? 2 : 1; return expr; } if ((parser.token & 134217728) === 134217728) { return parseLiteral(parser, context); } switch (parser.token) { case 33619995: case 33619996: return parseUpdateExpressionPrefixed(parser, context, inNew, isLHS, start, line, column); case 16863278: case 16842800: case 16842801: case 25233970: case 25233971: case 16863277: case 16863279: return parseUnaryExpression(parser, context, isLHS, start, line, column, inGroup); case 86106: return parseFunctionExpression(parser, context, 0, inGroup, start, line, column); case 2162700: return parseObjectLiteral(parser, context, canAssign ? 0 : 1, inGroup, start, line, column); case 69271571: return parseArrayLiteral(parser, context, canAssign ? 0 : 1, inGroup, start, line, column); case 67174411: return parseParenthesizedExpression(parser, context, canAssign, 1, 0, start, line, column); case 86021: case 86022: case 86023: return parseNullOrTrueOrFalseLiteral(parser, context, start, line, column); case 86113: return parseThisExpression(parser, context); case 65540: return parseRegExpLiteral(parser, context, start, line, column); case 133: case 86096: return parseClassExpression(parser, context, inGroup, start, line, column); case 86111: return parseSuperExpression(parser, context, start, line, column); case 67174409: return parseTemplateLiteral(parser, context, start, line, column); case 67174408: return parseTemplate(parser, context); case 86109: return parseNewExpression(parser, context, inGroup, start, line, column); case 134283389: return parseBigIntLiteral(parser, context, start, line, column); case 131: return parsePrivateIdentifier(parser, context, start, line, column); case 86108: return parseImportCallOrMetaExpression(parser, context, inNew, inGroup, start, line, column); case 8456258: if (context & 16) return parseJSXRootElementOrFragment(parser, context, 1, start, line, column); default: if (isValidIdentifier(context, parser.token)) return parseIdentifierOrArrow(parser, context, start, line, column); report(parser, 28, KeywordDescTable[parser.token & 255]); } } function parseImportCallOrMetaExpression(parser, context, inNew, inGroup, start, line, column) { let expr = parseIdentifier(parser, context, 0); if (parser.token === 67108877) { return parseImportMetaExpression(parser, context, expr, start, line, column); } if (inNew) report(parser, 137); expr = parseImportExpression(parser, context, inGroup, start, line, column); parser.assignable = 2; return parseMemberOrUpdateExpression(parser, context, expr, inGroup, 0, start, line, column); } function parseImportMetaExpression(parser, context, meta, start, line, column) { if ((context & 2048) === 0) report(parser, 163); nextToken(parser, context); if (parser.token !== 143495 && parser.tokenValue !== 'meta') report(parser, 28, KeywordDescTable[parser.token & 255]); parser.assignable = 2; return finishNode(parser, context, start, line, column, { type: 'MetaProperty', meta, property: parseIdentifier(parser, context, 0) }); } function parseImportExpression(parser, context, inGroup, start, line, column) { consume(parser, context | 32768, 67174411); if (parser.token === 14) report(parser, 138); const source = parseExpression(parser, context, 1, 0, inGroup, parser.tokenPos, parser.linePos, parser.colPos); consume(parser, context, 16); return finishNode(parser, context, start, line, column, { type: 'ImportExpression', source }); } function parseBigIntLiteral(parser, context, start, line, column) { const { tokenRaw, tokenValue } = parser; nextToken(parser, context); parser.assignable = 2; return finishNode(parser, context, start, line, column, context & 512 ? { type: 'Literal', value: tokenValue, bigint: tokenRaw.slice(0, -1), raw: tokenRaw } : { type: 'Literal', value: tokenValue, bigint: tokenRaw.slice(0, -1) }); } function parseTemplateLiteral(parser, context, start, line, column) { parser.assignable = 2; const { tokenValue, tokenRaw, tokenPos, linePos, colPos } = parser; consume(parser, context, 67174409); const quasis = [parseTemplateElement(parser, context, tokenValue, tokenRaw, tokenPos, linePos, colPos, true)]; return finishNode(parser, context, start, line, column, { type: 'TemplateLiteral', expressions: [], quasis }); } function parseTemplate(parser, context) { context = (context | 134217728) ^ 134217728; const { tokenValue, tokenRaw, tokenPos, linePos, colPos } = parser; consume(parser, context | 32768, 67174408); const quasis = [ parseTemplateElement(parser, context, tokenValue, tokenRaw, tokenPos, linePos, colPos, false) ]; const expressions = [parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos)]; if (parser.token !== 1074790415) report(parser, 80); while ((parser.token = scanTemplateTail(parser, context)) !== 67174409) { const { tokenValue, tokenRaw, tokenPos, linePos, colPos } = parser; consume(parser, context | 32768, 67174408); quasis.push(parseTemplateElement(parser, context, tokenValue, tokenRaw, tokenPos, linePos, colPos, false)); expressions.push(parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos)); if (parser.token !== 1074790415) report(parser, 80); } { const { tokenValue, tokenRaw, tokenPos, linePos, colPos } = parser; consume(parser, context, 67174409); quasis.push(parseTemplateElement(parser, context, tokenValue, tokenRaw, tokenPos, linePos, colPos, true)); } return finishNode(parser, context, tokenPos, linePos, colPos, { type: 'TemplateLiteral', expressions, quasis }); } function parseTemplateElement(parser, context, cooked, raw, start, line, col, tail) { const node = finishNode(parser, context, start, line, col, { type: 'TemplateElement', value: { cooked, raw }, tail }); const tailSize = tail ? 1 : 2; if (context & 2) { node.start += 1; node.range[0] += 1; node.end -= tailSize; node.range[1] -= tailSize; } if (context & 4) { node.loc.start.column += 1; node.loc.end.column -= tailSize; } return node; } function parseSpreadElement(parser, context, start, line, column) { context = (context | 134217728) ^ 134217728; consume(parser, context | 32768, 14); const argument = parseExpression(parser, context, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); parser.assignable = 1; return finishNode(parser, context, start, line, column, { type: 'SpreadElement', argument }); } function parseArguments(parser, context, inGroup) { nextToken(parser, context | 32768); const args = []; if (parser.token === 16) { nextToken(parser, context); return args; } while (parser.token !== 16) { if (parser.token === 14) { args.push(parseSpreadElement(parser, context, parser.tokenPos, parser.linePos, parser.colPos)); } else { args.push(parseExpression(parser, context, 1, 0, inGroup, parser.tokenPos, parser.linePos, parser.colPos)); } if (parser.token !== 18) break; nextToken(parser, context | 32768); if (parser.token === 16) break; } consume(parser, context, 16); return args; } function parseIdentifier(parser, context, isPattern) { const { tokenValue, tokenPos, linePos, colPos } = parser; nextToken(parser, context); return finishNode(parser, context, tokenPos, linePos, colPos, context & 268435456 ? { type: 'Identifier', name: tokenValue, pattern: isPattern === 1 } : { type: 'Identifier', name: tokenValue }); } function parseLiteral(parser, context) { const { tokenValue, tokenRaw, tokenPos, linePos, colPos } = parser; if (parser.token === 134283389) { return parseBigIntLiteral(parser, context, tokenPos, linePos, colPos); } nextToken(parser, context); parser.assignable = 2; return finishNode(parser, context, tokenPos, linePos, colPos, context & 512 ? { type: 'Literal', value: tokenValue, raw: tokenRaw } : { type: 'Literal', value: tokenValue }); } function parseNullOrTrueOrFalseLiteral(parser, context, start, line, column) { const raw = KeywordDescTable[parser.token & 255]; const value = parser.token === 86023 ? null : raw === 'true'; nextToken(parser, context); parser.assignable = 2; return finishNode(parser, context, start, line, column, context & 512 ? { type: 'Literal', value, raw } : { type: 'Literal', value }); } function parseThisExpression(parser, context) { const { tokenPos, linePos, colPos } = parser; nextToken(parser, context); parser.assignable = 2; return finishNode(parser, context, tokenPos, linePos, colPos, { type: 'ThisExpression' }); } function parseFunctionDeclaration(parser, context, scope, origin, allowGen, flags, isAsync, start, line, column) { nextToken(parser, context | 32768); const isGenerator = allowGen ? optionalBit(parser, context, 8457014) : 0; let id = null; let firstRestricted; let functionScope = scope ? createScope() : void 0; if (parser.token === 67174411) { if ((flags & 1) === 0) report(parser, 37, 'Function'); } else { const kind = origin & 4 && ((context & 8192) === 0 || (context & 2048) === 0) ? 4 : 64; validateFunctionName(parser, context | ((context & 3072) << 11), parser.token); if (scope) { if (kind & 4) { addVarName(parser, context, scope, parser.tokenValue, kind); } else { addBlockName(parser, context, scope, parser.tokenValue, kind, origin); } functionScope = addChildScope(functionScope, 256); if (flags) { if (flags & 2) { declareUnboundVariable(parser, parser.tokenValue); } } } firstRestricted = parser.token; if (parser.token & 143360) { id = parseIdentifier(parser, context, 0); } else { report(parser, 28, KeywordDescTable[parser.token & 255]); } } context = ((context | 32243712) ^ 32243712) | 67108864 | ((isAsync * 2 + isGenerator) << 21) | (isGenerator ? 0 : 1073741824); if (scope) functionScope = addChildScope(functionScope, 512); const params = parseFormalParametersOrFormalList(parser, context | 8388608, functionScope, 0, 1); const body = parseFunctionBody(parser, (context | 8192 | 4096 | 131072) ^ (8192 | 4096 | 131072), scope ? addChildScope(functionScope, 128) : functionScope, 8, firstRestricted, scope ? functionScope.scopeError : void 0); return finishNode(parser, context, start, line, column, { type: 'FunctionDeclaration', id, params, body, async: isAsync === 1, generator: isGenerator === 1 }); } function parseFunctionExpression(parser, context, isAsync, inGroup, start, line, column) { nextToken(parser, context | 32768); const isGenerator = optionalBit(parser, context, 8457014); const generatorAndAsyncFlags = (isAsync * 2 + isGenerator) << 21; let id = null; let firstRestricted; let scope = context & 64 ? createScope() : void 0; if ((parser.token & (143360 | 4096 | 36864)) > 0) { validateFunctionName(parser, ((context | 0x1ec0000) ^ 0x1ec0000) | generatorAndAsyncFlags, parser.token); if (scope) scope = addChildScope(scope, 256); firstRestricted = parser.token; id = parseIdentifier(parser, context, 0); } context = ((context | 32243712) ^ 32243712) | 67108864 | generatorAndAsyncFlags | (isGenerator ? 0 : 1073741824); if (scope) scope = addChildScope(scope, 512); const params = parseFormalParametersOrFormalList(parser, context | 8388608, scope, inGroup, 1); const body = parseFunctionBody(parser, context & ~(0x8001000 | 8192 | 4096 | 131072 | 16384), scope ? addChildScope(scope, 128) : scope, 0, firstRestricted, void 0); parser.assignable = 2; return finishNode(parser, context, start, line, column, { type: 'FunctionExpression', id, params, body, async: isAsync === 1, generator: isGenerator === 1 }); } function parseArrayLiteral(parser, context, skipInitializer, inGroup, start, line, column) { const expr = parseArrayExpressionOrPattern(parser, context, void 0, skipInitializer, inGroup, 0, 2, 0, start, line, column); if (context & 256 && parser.destructible & 64) { report(parser, 60); } if (parser.destructible & 8) { report(parser, 59); } return expr; } function parseArrayExpressionOrPattern(parser, context, scope, skipInitializer, inGroup, isPattern, kind, origin, start, line, column) { nextToken(parser, context | 32768); const elements = []; let destructible = 0; context = (context | 134217728) ^ 134217728; while (parser.token !== 20) { if (consumeOpt(parser, context | 32768, 18)) { elements.push(null); } else { let left; const { token, tokenPos, linePos, colPos, tokenValue } = parser; if (token & 143360) { left = parsePrimaryExpression(parser, context, kind, 0, 1, 0, inGroup, 1, tokenPos, linePos, colPos); if (parser.token === 1077936157) { if (parser.assignable & 2) report(parser, 24); nextToken(parser, context | 32768); if (scope) addVarOrBlock(parser, context, scope, tokenValue, kind, origin); const right = parseExpression(parser, context, 1, 1, inGroup, parser.tokenPos, parser.linePos, parser.colPos); left = finishNode(parser, context, tokenPos, linePos, colPos, isPattern ? { type: 'AssignmentPattern', left, right } : { type: 'AssignmentExpression', operator: '=', left, right }); destructible |= parser.destructible & 256 ? 256 : 0 | (parser.destructible & 128) ? 128 : 0; } else if (parser.token === 18 || parser.token === 20) { if (parser.assignable & 2) { destructible |= 16; } else if (scope) { addVarOrBlock(parser, context, scope, tokenValue, kind, origin); } destructible |= parser.destructible & 256 ? 256 : 0 | (parser.destructible & 128) ? 128 : 0; } else { destructible |= kind & 1 ? 32 : (kind & 2) === 0 ? 16 : 0; left = parseMemberOrUpdateExpression(parser, context, left, inGroup, 0, tokenPos, linePos, colPos); if (parser.token !== 18 && parser.token !== 20) { if (parser.token !== 1077936157) destructible |= 16; left = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, left); } else if (parser.token !== 1077936157) { destructible |= parser.assignable & 2 ? 16 : 32; } } } else if (token & 2097152) { left = parser.token === 2162700 ? parseObjectLiteralOrPattern(parser, context, scope, 0, inGroup, isPattern, kind, origin, tokenPos, linePos, colPos) : parseArrayExpressionOrPattern(parser, context, scope, 0, inGroup, isPattern, kind, origin, tokenPos, linePos, colPos); destructible |= parser.destructible; parser.assignable = parser.destructible & 16 ? 2 : 1; if (parser.token === 18 || parser.token === 20) { if (parser.assignable & 2) { destructible |= 16; } } else if (parser.destructible & 8) { report(parser, 68); } else { left = parseMemberOrUpdateExpression(parser, context, left, inGroup, 0, tokenPos, linePos, colPos); destructible = parser.assignable & 2 ? 16 : 0; if (parser.token !== 18 && parser.token !== 20) { left = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, left); } else if (parser.token !== 1077936157) { destructible |= parser.assignable & 2 ? 16 : 32; } } } else if (token === 14) { left = parseSpreadOrRestElement(parser, context, scope, 20, kind, origin, 0, inGroup, isPattern, tokenPos, linePos, colPos); destructible |= parser.destructible; if (parser.token !== 18 && parser.token !== 20) report(parser, 28, KeywordDescTable[parser.token & 255]); } else { left = parseLeftHandSideExpression(parser, context, 1, 0, 1, tokenPos, linePos, colPos); if (parser.token !== 18 && parser.token !== 20) { left = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, left); if ((kind & (2 | 1)) === 0 && token === 67174411) destructible |= 16; } else if (parser.assignable & 2) { destructible |= 16; } else if (token === 67174411) { destructible |= parser.assignable & 1 && kind & (2 | 1) ? 32 : 16; } } elements.push(left); if (consumeOpt(parser, context | 32768, 18)) { if (parser.token === 20) break; } else break; } } consume(parser, context, 20); const node = finishNode(parser, context, start, line, column, { type: isPattern ? 'ArrayPattern' : 'ArrayExpression', elements }); if (!skipInitializer && parser.token & 4194304) { return parseArrayOrObjectAssignmentPattern(parser, context, destructible, inGroup, isPattern, start, line, column, node); } parser.destructible = destructible; return node; } function parseArrayOrObjectAssignmentPattern(parser, context, destructible, inGroup, isPattern, start, line, column, node) { if (parser.token !== 1077936157) report(parser, 24); nextToken(parser, context | 32768); if (destructible & 16) report(parser, 24); if (!isPattern) reinterpretToPattern(parser, node); const { tokenPos, linePos, colPos } = parser; const right = parseExpression(parser, context, 1, 1, inGroup, tokenPos, linePos, colPos); parser.destructible = ((destructible | 64 | 8) ^ (8 | 64)) | (parser.destructible & 128 ? 128 : 0) | (parser.destructible & 256 ? 256 : 0); return finishNode(parser, context, start, line, column, isPattern ? { type: 'AssignmentPattern', left: node, right } : { type: 'AssignmentExpression', left: node, operator: '=', right }); } function parseSpreadOrRestElement(parser, context, scope, closingToken, kind, origin, isAsync, inGroup, isPattern, start, line, column) { nextToken(parser, context | 32768); let argument = null; let destructible = 0; let { token, tokenValue, tokenPos, linePos, colPos } = parser; if (token & (4096 | 143360)) { parser.assignable = 1; argument = parsePrimaryExpression(parser, context, kind, 0, 1, 0, inGroup, 1, tokenPos, linePos, colPos); token = parser.token; argument = parseMemberOrUpdateExpression(parser, context, argument, inGroup, 0, tokenPos, linePos, colPos); if (parser.token !== 18 && parser.token !== closingToken) { if (parser.assignable & 2 && parser.token === 1077936157) report(parser, 68); destructible |= 16; argument = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, argument); } if (parser.assignable & 2) { destructible |= 16; } else if (token === closingToken || token === 18) { if (scope) addVarOrBlock(parser, context, scope, tokenValue, kind, origin); } else { destructible |= 32; } destructible |= parser.destructible & 128 ? 128 : 0; } else if (token === closingToken) { report(parser, 39); } else if (token & 2097152) { argument = parser.token === 2162700 ? parseObjectLiteralOrPattern(parser, context, scope, 1, inGroup, isPattern, kind, origin, tokenPos, linePos, colPos) : parseArrayExpressionOrPattern(parser, context, scope, 1, inGroup, isPattern, kind, origin, tokenPos, linePos, colPos); token = parser.token; if (token !== 1077936157 && token !== closingToken && token !== 18) { if (parser.destructible & 8) report(parser, 68); argument = parseMemberOrUpdateExpression(parser, context, argument, inGroup, 0, tokenPos, linePos, colPos); destructible |= parser.assignable & 2 ? 16 : 0; if ((parser.token & 4194304) === 4194304) { if (parser.token !== 1077936157) destructible |= 16; argument = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, argument); } else { if ((parser.token & 8454144) === 8454144) { argument = parseBinaryExpression(parser, context, 1, tokenPos, linePos, colPos, 4, token, argument); } if (consumeOpt(parser, context | 32768, 22)) { argument = parseConditionalExpression(parser, context, argument, tokenPos, linePos, colPos); } destructible |= parser.assignable & 2 ? 16 : 32; } } else { destructible |= closingToken === 1074790415 && token !== 1077936157 ? 16 : parser.destructible; } } else { destructible |= 32; argument = parseLeftHandSideExpression(parser, context, 1, inGroup, 1, parser.tokenPos, parser.linePos, parser.colPos); const { token, tokenPos, linePos, colPos } = parser; if (token === 1077936157 && token !== closingToken && token !== 18) { if (parser.assignable & 2) report(parser, 24); argument = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, argument); destructible |= 16; } else { if (token === 18) { destructible |= 16; } else if (token !== closingToken) { argument = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, argument); } destructible |= parser.assignable & 1 ? 32 : 16; } parser.destructible = destructible; if (parser.token !== closingToken && parser.token !== 18) report(parser, 155); return finishNode(parser, context, start, line, column, { type: isPattern ? 'RestElement' : 'SpreadElement', argument: argument }); } if (parser.token !== closingToken) { if (kind & 1) destructible |= isAsync ? 16 : 32; if (consumeOpt(parser, context | 32768, 1077936157)) { if (destructible & 16) report(parser, 24); reinterpretToPattern(parser, argument); const right = parseExpression(parser, context, 1, 1, inGroup, parser.tokenPos, parser.linePos, parser.colPos); argument = finishNode(parser, context, tokenPos, linePos, colPos, isPattern ? { type: 'AssignmentPattern', left: argument, right } : { type: 'AssignmentExpression', left: argument, operator: '=', right }); destructible = 16; } else { destructible |= 16; } } parser.destructible = destructible; return finishNode(parser, context, start, line, column, { type: isPattern ? 'RestElement' : 'SpreadElement', argument: argument }); } function parseMethodDefinition(parser, context, kind, inGroup, start, line, column) { const modifierFlags = (kind & 64) === 0 ? 31981568 : 14680064; context = ((context | modifierFlags) ^ modifierFlags) | ((kind & 88) << 18) | 100925440; let scope = context & 64 ? addChildScope(createScope(), 512) : void 0; const params = parseMethodFormals(parser, context | 8388608, scope, kind, 1, inGroup); if (scope) scope = addChildScope(scope, 128); const body = parseFunctionBody(parser, context & ~(0x8001000 | 8192), scope, 0, void 0, void 0); return finishNode(parser, context, start, line, column, { type: 'FunctionExpression', params, body, async: (kind & 16) > 0, generator: (kind & 8) > 0, id: null }); } function parseObjectLiteral(parser, context, skipInitializer, inGroup, start, line, column) { const expr = parseObjectLiteralOrPattern(parser, context, void 0, skipInitializer, inGroup, 0, 2, 0, start, line, column); if (context & 256 && parser.destructible & 64) { report(parser, 60); } if (parser.destructible & 8) { report(parser, 59); } return expr; } function parseObjectLiteralOrPattern(parser, context, scope, skipInitializer, inGroup, isPattern, kind, origin, start, line, column) { nextToken(parser, context); const properties = []; let destructible = 0; let prototypeCount = 0; context = (context | 134217728) ^ 134217728; while (parser.token !== 1074790415) { const { token, tokenValue, linePos, colPos, tokenPos } = parser; if (token === 14) { properties.push(parseSpreadOrRestElement(parser, context, scope, 1074790415, kind, origin, 0, inGroup, isPattern, tokenPos, linePos, colPos)); } else { let state = 0; let key = null; let value; const t = parser.token; if (parser.token & (143360 | 4096) || parser.token === 121) { key = parseIdentifier(parser, context, 0); if (parser.token === 18 || parser.token === 1074790415 || parser.token === 1077936157) { state |= 4; if (context & 1024 && (token & 537079808) === 537079808) { destructible |= 16; } else { validateBindingIdentifier(parser, context, kind, token, 0); } if (scope) addVarOrBlock(parser, context, scope, tokenValue, kind, origin); if (consumeOpt(parser, context | 32768, 1077936157)) { destructible |= 8; const right = parseExpression(parser, context, 1, 1, inGroup, parser.tokenPos, parser.linePos, parser.colPos); destructible |= parser.destructible & 256 ? 256 : 0 | (parser.destructible & 128) ? 128 : 0; value = finishNode(parser, context, tokenPos, linePos, colPos, { type: 'AssignmentPattern', left: context & -2147483648 ? Object.assign({}, key) : key, right }); } else { destructible |= (token === 209008 ? 128 : 0) | (token === 121 ? 16 : 0); value = context & -2147483648 ? Object.assign({}, key) : key; } } else if (consumeOpt(parser, context | 32768, 21)) { const { tokenPos, linePos, colPos } = parser; if (tokenValue === '__proto__') prototypeCount++; if (parser.token & 143360) { const tokenAfterColon = parser.token; const valueAfterColon = parser.tokenValue; destructible |= t === 121 ? 16 : 0; value = parsePrimaryExpression(parser, context, kind, 0, 1, 0, inGroup, 1, tokenPos, linePos, colPos); const { token } = parser; value = parseMemberOrUpdateExpression(parser, context, value, inGroup, 0, tokenPos, linePos, colPos); if (parser.token === 18 || parser.token === 1074790415) { if (token === 1077936157 || token === 1074790415 || token === 18) { destructible |= parser.destructible & 128 ? 128 : 0; if (parser.assignable & 2) { destructible |= 16; } else if (scope && (tokenAfterColon & 143360) === 143360) { addVarOrBlock(parser, context, scope, valueAfterColon, kind, origin); } } else { destructible |= parser.assignable & 1 ? 32 : 16; } } else if ((parser.token & 4194304) === 4194304) { if (parser.assignable & 2) { destructible |= 16; } else if (token !== 1077936157) { destructible |= 32; } else if (scope) { addVarOrBlock(parser, context, scope, valueAfterColon, kind, origin); } value = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, value); } else { destructible |= 16; if ((parser.token & 8454144) === 8454144) { value = parseBinaryExpression(parser, context, 1, tokenPos, linePos, colPos, 4, token, value); } if (consumeOpt(parser, context | 32768, 22)) { value = parseConditionalExpression(parser, context, value, tokenPos, linePos, colPos); } } } else if ((parser.token & 2097152) === 2097152) { value = parser.token === 69271571 ? parseArrayExpressionOrPattern(parser, context, scope, 0, inGroup, isPattern, kind, origin, tokenPos, linePos, colPos) : parseObjectLiteralOrPattern(parser, context, scope, 0, inGroup, isPattern, kind, origin, tokenPos, linePos, colPos); destructible = parser.destructible; parser.assignable = destructible & 16 ? 2 : 1; if (parser.token === 18 || parser.token === 1074790415) { if (parser.assignable & 2) destructible |= 16; } else if (parser.destructible & 8) { report(parser, 68); } else { value = parseMemberOrUpdateExpression(parser, context, value, inGroup, 0, tokenPos, linePos, colPos); destructible = parser.assignable & 2 ? 16 : 0; if ((parser.token & 4194304) === 4194304) { value = parseAssignmentExpressionOrPattern(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, value); } else { if ((parser.token & 8454144) === 8454144) { value = parseBinaryExpression(parser, context, 1, tokenPos, linePos, colPos, 4, token, value); } if (consumeOpt(parser, context | 32768, 22)) { value = parseConditionalExpression(parser, context, value, tokenPos, linePos, colPos); } destructible |= parser.assignable & 2 ? 16 : 32; } } } else { value = parseLeftHandSideExpression(parser, context, 1, inGroup, 1, tokenPos, linePos, colPos); destructible |= parser.assignable & 1 ? 32 : 16; if (parser.token === 18 || parser.token === 1074790415) { if (parser.assignable & 2) destructible |= 16; } else { value = parseMemberOrUpdateExpression(parser, context, value, inGroup, 0, tokenPos, linePos, colPos); destructible = parser.assignable & 2 ? 16 : 0; if (parser.token !== 18 && token !== 1074790415) { if (parser.token !== 1077936157) destructible |= 16; value = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, value); } } } } else if (parser.token === 69271571) { destructible |= 16; if (token === 209007) state |= 16; state |= (token === 12402 ? 256 : token === 12403 ? 512 : 1) | 2; key = parseComputedPropertyName(parser, context, inGroup); destructible |= parser.assignable; value = parseMethodDefinition(parser, context, state, inGroup, parser.tokenPos, parser.linePos, parser.colPos); } else if (parser.token & (143360 | 4096)) { destructible |= 16; if (token === 121) report(parser, 92); if (token === 209007) { if (parser.flags & 1) report(parser, 128); state |= 16; } key = parseIdentifier(parser, context, 0); state |= token === 12402 ? 256 : token === 12403 ? 512 : 1; value = parseMethodDefinition(parser, context, state, inGroup, parser.tokenPos, parser.linePos, parser.colPos); } else if (parser.token === 67174411) { destructible |= 16; state |= 1; value = parseMethodDefinition(parser, context, state, inGroup, parser.tokenPos, parser.linePos, parser.colPos); } else if (parser.token === 8457014) { destructible |= 16; if (token === 12402 || token === 12403) { report(parser, 40); } else if (token === 143483) { report(parser, 92); } nextToken(parser, context); state |= 8 | 1 | (token === 209007 ? 16 : 0); if (parser.token & 143360) { key = parseIdentifier(parser, context, 0); } else if ((parser.token & 134217728) === 134217728) { key = parseLiteral(parser, context); } else if (parser.token === 69271571) { state |= 2; key = parseComputedPropertyName(parser, context, inGroup); destructible |= parser.assignable; } else { report(parser, 28, KeywordDescTable[parser.token & 255]); } value = parseMethodDefinition(parser, context, state, inGroup, parser.tokenPos, parser.linePos, parser.colPos); } else if ((parser.token & 134217728) === 134217728) { if (token === 209007) state |= 16; state |= token === 12402 ? 256 : token === 12403 ? 512 : 1; destructible |= 16; key = parseLiteral(parser, context); value = parseMethodDefinition(parser, context, state, inGroup, parser.tokenPos, parser.linePos, parser.colPos); } else { report(parser, 129); } } else if ((parser.token & 134217728) === 134217728) { key = parseLiteral(parser, context); if (parser.token === 21) { consume(parser, context | 32768, 21); const { tokenPos, linePos, colPos } = parser; if (tokenValue === '__proto__') prototypeCount++; if (parser.token & 143360) { value = parsePrimaryExpression(parser, context, kind, 0, 1, 0, inGroup, 1, tokenPos, linePos, colPos); const { token, tokenValue: valueAfterColon } = parser; value = parseMemberOrUpdateExpression(parser, context, value, inGroup, 0, tokenPos, linePos, colPos); if (parser.token === 18 || parser.token === 1074790415) { if (token === 1077936157 || token === 1074790415 || token === 18) { if (parser.assignable & 2) { destructible |= 16; } else if (scope) { addVarOrBlock(parser, context, scope, valueAfterColon, kind, origin); } } else { destructible |= parser.assignable & 1 ? 32 : 16; } } else if (parser.token === 1077936157) { if (parser.assignable & 2) destructible |= 16; value = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, value); } else { destructible |= 16; value = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, value); } } else if ((parser.token & 2097152) === 2097152) { value = parser.token === 69271571 ? parseArrayExpressionOrPattern(parser, context, scope, 0, inGroup, isPattern, kind, origin, tokenPos, linePos, colPos) : parseObjectLiteralOrPattern(parser, context, scope, 0, inGroup, isPattern, kind, origin, tokenPos, linePos, colPos); destructible = parser.destructible; parser.assignable = destructible & 16 ? 2 : 1; if (parser.token === 18 || parser.token === 1074790415) { if (parser.assignable & 2) { destructible |= 16; } } else if ((parser.destructible & 8) !== 8) { value = parseMemberOrUpdateExpression(parser, context, value, inGroup, 0, tokenPos, linePos, colPos); destructible = parser.assignable & 2 ? 16 : 0; if ((parser.token & 4194304) === 4194304) { value = parseAssignmentExpressionOrPattern(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, value); } else { if ((parser.token & 8454144) === 8454144) { value = parseBinaryExpression(parser, context, 1, tokenPos, linePos, colPos, 4, token, value); } if (consumeOpt(parser, context | 32768, 22)) { value = parseConditionalExpression(parser, context, value, tokenPos, linePos, colPos); } destructible |= parser.assignable & 2 ? 16 : 32; } } } else { value = parseLeftHandSideExpression(parser, context, 1, 0, 1, tokenPos, linePos, colPos); destructible |= parser.assignable & 1 ? 32 : 16; if (parser.token === 18 || parser.token === 1074790415) { if (parser.assignable & 2) { destructible |= 16; } } else { value = parseMemberOrUpdateExpression(parser, context, value, inGroup, 0, tokenPos, linePos, colPos); destructible = parser.assignable & 1 ? 0 : 16; if (parser.token !== 18 && parser.token !== 1074790415) { if (parser.token !== 1077936157) destructible |= 16; value = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, value); } } } } else if (parser.token === 67174411) { state |= 1; value = parseMethodDefinition(parser, context, state, inGroup, parser.tokenPos, parser.linePos, parser.colPos); destructible = parser.assignable | 16; } else { report(parser, 130); } } else if (parser.token === 69271571) { key = parseComputedPropertyName(parser, context, inGroup); destructible |= parser.destructible & 256 ? 256 : 0; state |= 2; if (parser.token === 21) { nextToken(parser, context | 32768); const { tokenPos, linePos, colPos, tokenValue, token: tokenAfterColon } = parser; if (parser.token & 143360) { value = parsePrimaryExpression(parser, context, kind, 0, 1, 0, inGroup, 1, tokenPos, linePos, colPos); const { token } = parser; value = parseMemberOrUpdateExpression(parser, context, value, inGroup, 0, tokenPos, linePos, colPos); if ((parser.token & 4194304) === 4194304) { destructible |= parser.assignable & 2 ? 16 : token === 1077936157 ? 0 : 32; value = parseAssignmentExpressionOrPattern(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, value); } else if (parser.token === 18 || parser.token === 1074790415) { if (token === 1077936157 || token === 1074790415 || token === 18) { if (parser.assignable & 2) { destructible |= 16; } else if (scope && (tokenAfterColon & 143360) === 143360) { addVarOrBlock(parser, context, scope, tokenValue, kind, origin); } } else { destructible |= parser.assignable & 1 ? 32 : 16; } } else { destructible |= 16; value = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, value); } } else if ((parser.token & 2097152) === 2097152) { value = parser.token === 69271571 ? parseArrayExpressionOrPattern(parser, context, scope, 0, inGroup, isPattern, kind, origin, tokenPos, linePos, colPos) : parseObjectLiteralOrPattern(parser, context, scope, 0, inGroup, isPattern, kind, origin, tokenPos, linePos, colPos); destructible = parser.destructible; parser.assignable = destructible & 16 ? 2 : 1; if (parser.token === 18 || parser.token === 1074790415) { if (parser.assignable & 2) destructible |= 16; } else if (destructible & 8) { report(parser, 59); } else { value = parseMemberOrUpdateExpression(parser, context, value, inGroup, 0, tokenPos, linePos, colPos); destructible = parser.assignable & 2 ? destructible | 16 : 0; if ((parser.token & 4194304) === 4194304) { if (parser.token !== 1077936157) destructible |= 16; value = parseAssignmentExpressionOrPattern(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, value); } else { if ((parser.token & 8454144) === 8454144) { value = parseBinaryExpression(parser, context, 1, tokenPos, linePos, colPos, 4, token, value); } if (consumeOpt(parser, context | 32768, 22)) { value = parseConditionalExpression(parser, context, value, tokenPos, linePos, colPos); } destructible |= parser.assignable & 2 ? 16 : 32; } } } else { value = parseLeftHandSideExpression(parser, context, 1, 0, 1, tokenPos, linePos, colPos); destructible |= parser.assignable & 1 ? 32 : 16; if (parser.token === 18 || parser.token === 1074790415) { if (parser.assignable & 2) destructible |= 16; } else { value = parseMemberOrUpdateExpression(parser, context, value, inGroup, 0, tokenPos, linePos, colPos); destructible = parser.assignable & 1 ? 0 : 16; if (parser.token !== 18 && parser.token !== 1074790415) { if (parser.token !== 1077936157) destructible |= 16; value = parseAssignmentExpression(parser, context, inGroup, isPattern, tokenPos, linePos, colPos, value); } } } } else if (parser.token === 67174411) { state |= 1; value = parseMethodDefinition(parser, context, state, inGroup, parser.tokenPos, linePos, colPos); destructible = 16; } else { report(parser, 41); } } else if (token === 8457014) { consume(parser, context | 32768, 8457014); state |= 8; if (parser.token & 143360) { const { token, line, index } = parser; key = parseIdentifier(parser, context, 0); state |= 1; if (parser.token === 67174411) { destructible |= 16; value = parseMethodDefinition(parser, context, state, inGroup, parser.tokenPos, parser.linePos, parser.colPos); } else { reportMessageAt(index, line, index, token === 209007 ? 43 : token === 12402 || parser.token === 12403 ? 42 : 44, KeywordDescTable[token & 255]); } } else if ((parser.token & 134217728) === 134217728) { destructible |= 16; key = parseLiteral(parser, context); state |= 1; value = parseMethodDefinition(parser, context, state, inGroup, tokenPos, linePos, colPos); } else if (parser.token === 69271571) { destructible |= 16; state |= 2 | 1; key = parseComputedPropertyName(parser, context, inGroup); value = parseMethodDefinition(parser, context, state, inGroup, parser.tokenPos, parser.linePos, parser.colPos); } else { report(parser, 122); } } else { report(parser, 28, KeywordDescTable[token & 255]); } destructible |= parser.destructible & 128 ? 128 : 0; parser.destructible = destructible; properties.push(finishNode(parser, context, tokenPos, linePos, colPos, { type: 'Property', key: key, value, kind: !(state & 768) ? 'init' : state & 512 ? 'set' : 'get', computed: (state & 2) > 0, method: (state & 1) > 0, shorthand: (state & 4) > 0 })); } destructible |= parser.destructible; if (parser.token !== 18) break; nextToken(parser, context); } consume(parser, context, 1074790415); if (prototypeCount > 1) destructible |= 64; const node = finishNode(parser, context, start, line, column, { type: isPattern ? 'ObjectPattern' : 'ObjectExpression', properties }); if (!skipInitializer && parser.token & 4194304) { return parseArrayOrObjectAssignmentPattern(parser, context, destructible, inGroup, isPattern, start, line, column, node); } parser.destructible = destructible; return node; } function parseMethodFormals(parser, context, scope, kind, type, inGroup) { consume(parser, context, 67174411); const params = []; parser.flags = (parser.flags | 128) ^ 128; if (parser.token === 16) { if (kind & 512) { report(parser, 35, 'Setter', 'one', ''); } nextToken(parser, context); return params; } if (kind & 256) { report(parser, 35, 'Getter', 'no', 's'); } if (kind & 512 && parser.token === 14) { report(parser, 36); } context = (context | 134217728) ^ 134217728; let setterArgs = 0; let isSimpleParameterList = 0; while (parser.token !== 18) { let left = null; const { tokenPos, linePos, colPos } = parser; if (parser.token & 143360) { if ((context & 1024) === 0) { if ((parser.token & 36864) === 36864) { parser.flags |= 256; } if ((parser.token & 537079808) === 537079808) { parser.flags |= 512; } } left = parseAndClassifyIdentifier(parser, context, scope, kind | 1, 0, tokenPos, linePos, colPos); } else { if (parser.token === 2162700) { left = parseObjectLiteralOrPattern(parser, context, scope, 1, inGroup, 1, type, 0, tokenPos, linePos, colPos); } else if (parser.token === 69271571) { left = parseArrayExpressionOrPattern(parser, context, scope, 1, inGroup, 1, type, 0, tokenPos, linePos, colPos); } else if (parser.token === 14) { left = parseSpreadOrRestElement(parser, context, scope, 16, type, 0, 0, inGroup, 1, tokenPos, linePos, colPos); } isSimpleParameterList = 1; if (parser.destructible & (32 | 16)) report(parser, 47); } if (parser.token === 1077936157) { nextToken(parser, context | 32768); isSimpleParameterList = 1; const right = parseExpression(parser, context, 1, 1, 0, parser.tokenPos, parser.linePos, parser.colPos); left = finishNode(parser, context, tokenPos, linePos, colPos, { type: 'AssignmentPattern', left: left, right }); } setterArgs++; params.push(left); if (!consumeOpt(parser, context, 18)) break; if (parser.token === 16) { break; } } if (kind & 512 && setterArgs !== 1) { report(parser, 35, 'Setter', 'one', ''); } if (scope && scope.scopeError !== void 0) reportScopeError(scope.scopeError); if (isSimpleParameterList) parser.flags |= 128; consume(parser, context, 16); return params; } function parseComputedPropertyName(parser, context, inGroup) { nextToken(parser, context | 32768); const key = parseExpression(parser, (context | 134217728) ^ 134217728, 1, 0, inGroup, parser.tokenPos, parser.linePos, parser.colPos); consume(parser, context, 20); return key; } function parseParenthesizedExpression(parser, context, canAssign, kind, origin, start, line, column) { parser.flags = (parser.flags | 128) ^ 128; const { tokenPos: piStart, linePos: plStart, colPos: pcStart } = parser; nextToken(parser, context | 32768 | 1073741824); const scope = context & 64 ? addChildScope(createScope(), 1024) : void 0; context = (context | 134217728) ^ 134217728; if (consumeOpt(parser, context, 16)) { return parseParenthesizedArrow(parser, context, scope, [], canAssign, 0, start, line, column); } let destructible = 0; parser.destructible &= ~(256 | 128); let expr; let expressions = []; let isSequence = 0; let isSimpleParameterList = 0; const { tokenPos: iStart, linePos: lStart, colPos: cStart } = parser; parser.assignable = 1; while (parser.token !== 16) { const { token, tokenPos, linePos, colPos } = parser; if (token & (143360 | 4096)) { if (scope) addBlockName(parser, context, scope, parser.tokenValue, 1, 0); expr = parsePrimaryExpression(parser, context, kind, 0, 1, 0, 1, 1, tokenPos, linePos, colPos); if (parser.token === 16 || parser.token === 18) { if (parser.assignable & 2) { destructible |= 16; isSimpleParameterList = 1; } else if ((token & 537079808) === 537079808 || (token & 36864) === 36864) { isSimpleParameterList = 1; } } else { if (parser.token === 1077936157) { isSimpleParameterList = 1; } else { destructible |= 16; } expr = parseMemberOrUpdateExpression(parser, context, expr, 1, 0, tokenPos, linePos, colPos); if (parser.token !== 16 && parser.token !== 18) { expr = parseAssignmentExpression(parser, context, 1, 0, tokenPos, linePos, colPos, expr); } } } else if ((token & 2097152) === 2097152) { expr = token === 2162700 ? parseObjectLiteralOrPattern(parser, context | 1073741824, scope, 0, 1, 0, kind, origin, tokenPos, linePos, colPos) : parseArrayExpressionOrPattern(parser, context | 1073741824, scope, 0, 1, 0, kind, origin, tokenPos, linePos, colPos); destructible |= parser.destructible; isSimpleParameterList = 1; parser.assignable = 2; if (parser.token !== 16 && parser.token !== 18) { if (destructible & 8) report(parser, 118); expr = parseMemberOrUpdateExpression(parser, context, expr, 0, 0, tokenPos, linePos, colPos); destructible |= 16; if (parser.token !== 16 && parser.token !== 18) { expr = parseAssignmentExpression(parser, context, 0, 0, tokenPos, linePos, colPos, expr); } } } else if (token === 14) { expr = parseSpreadOrRestElement(parser, context, scope, 16, kind, origin, 0, 1, 0, tokenPos, linePos, colPos); if (parser.destructible & 16) report(parser, 71); isSimpleParameterList = 1; if (isSequence && (parser.token === 16 || parser.token === 18)) { expressions.push(expr); } destructible |= 8; break; } else { destructible |= 16; expr = parseExpression(parser, context, 1, 0, 1, tokenPos, linePos, colPos); if (isSequence && (parser.token === 16 || parser.token === 18)) { expressions.push(expr); } if (parser.token === 18) { if (!isSequence) { isSequence = 1; expressions = [expr]; } } if (isSequence) { while (consumeOpt(parser, context | 32768, 18)) { expressions.push(parseExpression(parser, context, 1, 0, 1, parser.tokenPos, parser.linePos, parser.colPos)); } parser.assignable = 2; expr = finishNode(parser, context, iStart, lStart, cStart, { type: 'SequenceExpression', expressions }); } consume(parser, context, 16); parser.destructible = destructible; return expr; } if (isSequence && (parser.token === 16 || parser.token === 18)) { expressions.push(expr); } if (!consumeOpt(parser, context | 32768, 18)) break; if (!isSequence) { isSequence = 1; expressions = [expr]; } if (parser.token === 16) { destructible |= 8; break; } } if (isSequence) { parser.assignable = 2; expr = finishNode(parser, context, iStart, lStart, cStart, { type: 'SequenceExpression', expressions }); } consume(parser, context, 16); if (destructible & 16 && destructible & 8) report(parser, 145); destructible |= parser.destructible & 256 ? 256 : 0 | (parser.destructible & 128) ? 128 : 0; if (parser.token === 10) { if (destructible & (32 | 16)) report(parser, 46); if (context & (4194304 | 2048) && destructible & 128) report(parser, 29); if (context & (1024 | 2097152) && destructible & 256) { report(parser, 30); } if (isSimpleParameterList) parser.flags |= 128; return parseParenthesizedArrow(parser, context, scope, isSequence ? expressions : [expr], canAssign, 0, start, line, column); } else if (destructible & 8) { report(parser, 139); } parser.destructible = ((parser.destructible | 256) ^ 256) | destructible; return context & 128 ? finishNode(parser, context, piStart, plStart, pcStart, { type: 'ParenthesizedExpression', expression: expr }) : expr; } function parseIdentifierOrArrow(parser, context, start, line, column) { const { tokenValue } = parser; const expr = parseIdentifier(parser, context, 0); parser.assignable = 1; if (parser.token === 10) { let scope = void 0; if (context & 64) scope = createArrowHeadParsingScope(parser, context, tokenValue); parser.flags = (parser.flags | 128) ^ 128; return parseArrowFunctionExpression(parser, context, scope, [expr], 0, start, line, column); } return expr; } function parseArrowFromIdentifier(parser, context, value, expr, inNew, canAssign, isAsync, start, line, column) { if (!canAssign) report(parser, 54); if (inNew) report(parser, 48); parser.flags &= ~128; const scope = context & 64 ? createArrowHeadParsingScope(parser, context, value) : void 0; return parseArrowFunctionExpression(parser, context, scope, [expr], isAsync, start, line, column); } function parseParenthesizedArrow(parser, context, scope, params, canAssign, isAsync, start, line, column) { if (!canAssign) report(parser, 54); for (let i = 0; i < params.length; ++i) reinterpretToPattern(parser, params[i]); return parseArrowFunctionExpression(parser, context, scope, params, isAsync, start, line, column); } function parseArrowFunctionExpression(parser, context, scope, params, isAsync, start, line, column) { if (parser.flags & 1) report(parser, 45); consume(parser, context | 32768, 10); context = ((context | 15728640) ^ 15728640) | (isAsync << 22); const expression = parser.token !== 2162700; let body; if (scope && scope.scopeError !== void 0) { reportScopeError(scope.scopeError); } if (expression) { body = parseExpression(parser, context, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); } else { if (scope) scope = addChildScope(scope, 128); body = parseFunctionBody(parser, (context | 134221824 | 8192 | 16384) ^ (134221824 | 8192 | 16384), scope, 16, void 0, void 0); switch (parser.token) { case 69271571: if ((parser.flags & 1) === 0) { report(parser, 112); } break; case 67108877: case 67174409: case 22: report(parser, 113); case 67174411: if ((parser.flags & 1) === 0) { report(parser, 112); } parser.flags |= 1024; break; } if ((parser.token & 8454144) === 8454144 && (parser.flags & 1) === 0) report(parser, 28, KeywordDescTable[parser.token & 255]); if ((parser.token & 33619968) === 33619968) report(parser, 121); } parser.assignable = 2; return finishNode(parser, context, start, line, column, { type: 'ArrowFunctionExpression', params, body, async: isAsync === 1, expression }); } function parseFormalParametersOrFormalList(parser, context, scope, inGroup, kind) { consume(parser, context, 67174411); parser.flags = (parser.flags | 128) ^ 128; const params = []; if (consumeOpt(parser, context, 16)) return params; context = (context | 134217728) ^ 134217728; let isSimpleParameterList = 0; while (parser.token !== 18) { let left; const { tokenPos, linePos, colPos } = parser; if (parser.token & 143360) { if ((context & 1024) === 0) { if ((parser.token & 36864) === 36864) { parser.flags |= 256; } if ((parser.token & 537079808) === 537079808) { parser.flags |= 512; } } left = parseAndClassifyIdentifier(parser, context, scope, kind | 1, 0, tokenPos, linePos, colPos); } else { if (parser.token === 2162700) { left = parseObjectLiteralOrPattern(parser, context, scope, 1, inGroup, 1, kind, 0, tokenPos, linePos, colPos); } else if (parser.token === 69271571) { left = parseArrayExpressionOrPattern(parser, context, scope, 1, inGroup, 1, kind, 0, tokenPos, linePos, colPos); } else if (parser.token === 14) { left = parseSpreadOrRestElement(parser, context, scope, 16, kind, 0, 0, inGroup, 1, tokenPos, linePos, colPos); } else { report(parser, 28, KeywordDescTable[parser.token & 255]); } isSimpleParameterList = 1; if (parser.destructible & (32 | 16)) { report(parser, 47); } } if (parser.token === 1077936157) { nextToken(parser, context | 32768); isSimpleParameterList = 1; const right = parseExpression(parser, context, 1, 1, inGroup, parser.tokenPos, parser.linePos, parser.colPos); left = finishNode(parser, context, tokenPos, linePos, colPos, { type: 'AssignmentPattern', left, right }); } params.push(left); if (!consumeOpt(parser, context, 18)) break; if (parser.token === 16) { break; } } if (isSimpleParameterList) parser.flags |= 128; if (scope && (isSimpleParameterList || context & 1024) && scope.scopeError !== void 0) { reportScopeError(scope.scopeError); } consume(parser, context, 16); return params; } function parseMembeExpressionNoCall(parser, context, expr, inGroup, start, line, column) { const { token } = parser; if (token & 67108864) { if (token === 67108877) { nextToken(parser, context | 1073741824); parser.assignable = 1; const property = parsePropertyOrPrivatePropertyName(parser, context); return parseMembeExpressionNoCall(parser, context, finishNode(parser, context, start, line, column, { type: 'MemberExpression', object: expr, computed: false, property }), 0, start, line, column); } else if (token === 69271571) { nextToken(parser, context | 32768); const { tokenPos, linePos, colPos } = parser; const property = parseExpressions(parser, context, inGroup, 1, tokenPos, linePos, colPos); consume(parser, context, 20); parser.assignable = 1; return parseMembeExpressionNoCall(parser, context, finishNode(parser, context, start, line, column, { type: 'MemberExpression', object: expr, computed: true, property }), 0, start, line, column); } else if (token === 67174408 || token === 67174409) { parser.assignable = 2; return parseMembeExpressionNoCall(parser, context, finishNode(parser, context, start, line, column, { type: 'TaggedTemplateExpression', tag: expr, quasi: parser.token === 67174408 ? parseTemplate(parser, context | 65536) : parseTemplateLiteral(parser, context, parser.tokenPos, parser.linePos, parser.colPos) }), 0, start, line, column); } } return expr; } function parseNewExpression(parser, context, inGroup, start, line, column) { const id = parseIdentifier(parser, context | 32768, 0); const { tokenPos, linePos, colPos } = parser; if (consumeOpt(parser, context, 67108877)) { if (context & 67108864 && parser.token === 143494) { parser.assignable = 2; return parseMetaProperty(parser, context, id, start, line, column); } report(parser, 91); } parser.assignable = 2; if ((parser.token & 16842752) === 16842752) { report(parser, 62, KeywordDescTable[parser.token & 255]); } const expr = parsePrimaryExpression(parser, context, 2, 1, 0, 0, inGroup, 1, tokenPos, linePos, colPos); context = (context | 134217728) ^ 134217728; if (parser.token === 67108991) report(parser, 162); const callee = parseMembeExpressionNoCall(parser, context, expr, inGroup, tokenPos, linePos, colPos); parser.assignable = 2; return finishNode(parser, context, start, line, column, { type: 'NewExpression', callee, arguments: parser.token === 67174411 ? parseArguments(parser, context, inGroup) : [] }); } function parseMetaProperty(parser, context, meta, start, line, column) { const property = parseIdentifier(parser, context, 0); return finishNode(parser, context, start, line, column, { type: 'MetaProperty', meta, property }); } function parseAsyncArrowAfterIdent(parser, context, canAssign, start, line, column) { if (parser.token === 209008) report(parser, 29); if (context & (1024 | 2097152) && parser.token === 241773) { report(parser, 30); } if ((parser.token & 537079808) === 537079808) { parser.flags |= 512; } return parseArrowFromIdentifier(parser, context, parser.tokenValue, parseIdentifier(parser, context, 0), 0, canAssign, 1, start, line, column); } function parseAsyncArrowOrCallExpression(parser, context, callee, canAssign, kind, origin, flags, start, line, column) { nextToken(parser, context | 32768); const scope = context & 64 ? addChildScope(createScope(), 1024) : void 0; context = (context | 134217728) ^ 134217728; if (consumeOpt(parser, context, 16)) { if (parser.token === 10) { if (flags & 1) report(parser, 45); return parseParenthesizedArrow(parser, context, scope, [], canAssign, 1, start, line, column); } return finishNode(parser, context, start, line, column, { type: 'CallExpression', callee, arguments: [] }); } let destructible = 0; let expr = null; let isSimpleParameterList = 0; parser.destructible = (parser.destructible | 256 | 128) ^ (256 | 128); const params = []; while (parser.token !== 16) { const { token, tokenPos, linePos, colPos } = parser; if (token & (143360 | 4096)) { if (scope) addBlockName(parser, context, scope, parser.tokenValue, kind, 0); expr = parsePrimaryExpression(parser, context, kind, 0, 1, 0, 1, 1, tokenPos, linePos, colPos); if (parser.token === 16 || parser.token === 18) { if (parser.assignable & 2) { destructible |= 16; isSimpleParameterList = 1; } else if ((token & 537079808) === 537079808) { parser.flags |= 512; } else if ((token & 36864) === 36864) { parser.flags |= 256; } } else { if (parser.token === 1077936157) { isSimpleParameterList = 1; } else { destructible |= 16; } expr = parseMemberOrUpdateExpression(parser, context, expr, 1, 0, tokenPos, linePos, colPos); if (parser.token !== 16 && parser.token !== 18) { expr = parseAssignmentExpression(parser, context, 1, 0, tokenPos, linePos, colPos, expr); } } } else if (token & 2097152) { expr = token === 2162700 ? parseObjectLiteralOrPattern(parser, context, scope, 0, 1, 0, kind, origin, tokenPos, linePos, colPos) : parseArrayExpressionOrPattern(parser, context, scope, 0, 1, 0, kind, origin, tokenPos, linePos, colPos); destructible |= parser.destructible; isSimpleParameterList = 1; if (parser.token !== 16 && parser.token !== 18) { if (destructible & 8) report(parser, 118); expr = parseMemberOrUpdateExpression(parser, context, expr, 0, 0, tokenPos, linePos, colPos); destructible |= 16; if ((parser.token & 8454144) === 8454144) { expr = parseBinaryExpression(parser, context, 1, start, line, column, 4, token, expr); } if (consumeOpt(parser, context | 32768, 22)) { expr = parseConditionalExpression(parser, context, expr, start, line, column); } } } else if (token === 14) { expr = parseSpreadOrRestElement(parser, context, scope, 16, kind, origin, 1, 1, 0, tokenPos, linePos, colPos); destructible |= (parser.token === 16 ? 0 : 16) | parser.destructible; isSimpleParameterList = 1; } else { expr = parseExpression(parser, context, 1, 0, 0, tokenPos, linePos, colPos); destructible = parser.assignable; params.push(expr); while (consumeOpt(parser, context | 32768, 18)) { params.push(parseExpression(parser, context, 1, 0, 0, tokenPos, linePos, colPos)); } destructible |= parser.assignable; consume(parser, context, 16); parser.destructible = destructible | 16; parser.assignable = 2; return finishNode(parser, context, start, line, column, { type: 'CallExpression', callee, arguments: params }); } params.push(expr); if (!consumeOpt(parser, context | 32768, 18)) break; } consume(parser, context, 16); destructible |= parser.destructible & 256 ? 256 : 0 | (parser.destructible & 128) ? 128 : 0; if (parser.token === 10) { if (destructible & (32 | 16)) report(parser, 25); if (parser.flags & 1 || flags & 1) report(parser, 45); if (destructible & 128) report(parser, 29); if (context & (1024 | 2097152) && destructible & 256) report(parser, 30); if (isSimpleParameterList) parser.flags |= 128; return parseParenthesizedArrow(parser, context, scope, params, canAssign, 1, start, line, column); } else if (destructible & 8) { report(parser, 59); } parser.assignable = 2; return finishNode(parser, context, start, line, column, { type: 'CallExpression', callee, arguments: params }); } function parseRegExpLiteral(parser, context, start, line, column) { const { tokenRaw, tokenRegExp, tokenValue } = parser; nextToken(parser, context); parser.assignable = 2; return context & 512 ? finishNode(parser, context, start, line, column, { type: 'Literal', value: tokenValue, regex: tokenRegExp, raw: tokenRaw }) : finishNode(parser, context, start, line, column, { type: 'Literal', value: tokenValue, regex: tokenRegExp }); } function parseClassDeclaration(parser, context, scope, flags, start, line, column) { context = (context | 16777216 | 1024) ^ 16777216; let decorators = parseDecorators(parser, context); if (decorators.length) { start = parser.tokenPos; line = parser.linePos; column = parser.colPos; } if (parser.leadingDecorators.length) { parser.leadingDecorators.push(...decorators); decorators = parser.leadingDecorators; parser.leadingDecorators = []; } nextToken(parser, context); let id = null; let superClass = null; const { tokenValue } = parser; if (parser.token & 4096 && parser.token !== 20567) { if (isStrictReservedWord(parser, context, parser.token)) { report(parser, 114); } if ((parser.token & 537079808) === 537079808) { report(parser, 115); } if (scope) { addBlockName(parser, context, scope, tokenValue, 32, 0); if (flags) { if (flags & 2) { declareUnboundVariable(parser, tokenValue); } } } id = parseIdentifier(parser, context, 0); } else { if ((flags & 1) === 0) report(parser, 37, 'Class'); } let inheritedContext = context; if (consumeOpt(parser, context | 32768, 20567)) { superClass = parseLeftHandSideExpression(parser, context, 0, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); inheritedContext |= 524288; } else { inheritedContext = (inheritedContext | 524288) ^ 524288; } const body = parseClassBody(parser, inheritedContext, context, scope, 2, 8, 0); return finishNode(parser, context, start, line, column, context & 1 ? { type: 'ClassDeclaration', id, superClass, decorators, body } : { type: 'ClassDeclaration', id, superClass, body }); } function parseClassExpression(parser, context, inGroup, start, line, column) { let id = null; let superClass = null; context = (context | 1024 | 16777216) ^ 16777216; const decorators = parseDecorators(parser, context); if (decorators.length) { start = parser.tokenPos; line = parser.linePos; column = parser.colPos; } nextToken(parser, context); if (parser.token & 4096 && parser.token !== 20567) { if (isStrictReservedWord(parser, context, parser.token)) report(parser, 114); if ((parser.token & 537079808) === 537079808) { report(parser, 115); } id = parseIdentifier(parser, context, 0); } let inheritedContext = context; if (consumeOpt(parser, context | 32768, 20567)) { superClass = parseLeftHandSideExpression(parser, context, 0, inGroup, 0, parser.tokenPos, parser.linePos, parser.colPos); inheritedContext |= 524288; } else { inheritedContext = (inheritedContext | 524288) ^ 524288; } const body = parseClassBody(parser, inheritedContext, context, void 0, 2, 0, inGroup); parser.assignable = 2; return finishNode(parser, context, start, line, column, context & 1 ? { type: 'ClassExpression', id, superClass, decorators, body } : { type: 'ClassExpression', id, superClass, body }); } function parseDecorators(parser, context) { const list = []; if (context & 1) { while (parser.token === 133) { list.push(parseDecoratorList(parser, context, parser.tokenPos, parser.linePos, parser.colPos)); } } return list; } function parseDecoratorList(parser, context, start, line, column) { nextToken(parser, context | 32768); let expression = parsePrimaryExpression(parser, context, 2, 0, 1, 0, 0, 1, start, line, column); expression = parseMemberOrUpdateExpression(parser, context, expression, 0, 0, start, line, column); return finishNode(parser, context, start, line, column, { type: 'Decorator', expression }); } function parseClassBody(parser, context, inheritedContext, scope, kind, origin, inGroup) { const { tokenPos, linePos, colPos } = parser; consume(parser, context | 32768, 2162700); context = (context | 134217728) ^ 134217728; parser.flags = (parser.flags | 32) ^ 32; const body = []; let decorators; while (parser.token !== 1074790415) { let length = 0; decorators = parseDecorators(parser, context); length = decorators.length; if (length > 0 && parser.tokenValue === 'constructor') { report(parser, 106); } if (parser.token === 1074790415) report(parser, 105); if (consumeOpt(parser, context, 1074790417)) { if (length > 0) report(parser, 116); continue; } body.push(parseClassElementList(parser, context, scope, inheritedContext, kind, decorators, 0, inGroup, parser.tokenPos, parser.linePos, parser.colPos)); } consume(parser, origin & 8 ? context | 32768 : context, 1074790415); return finishNode(parser, context, tokenPos, linePos, colPos, { type: 'ClassBody', body }); } function parseClassElementList(parser, context, scope, inheritedContext, type, decorators, isStatic, inGroup, start, line, column) { let kind = isStatic ? 32 : 0; let key = null; const { token, tokenPos, linePos, colPos } = parser; if (token & (143360 | 36864)) { key = parseIdentifier(parser, context, 0); switch (token) { case 36972: if (!isStatic && parser.token !== 67174411) { return parseClassElementList(parser, context, scope, inheritedContext, type, decorators, 1, inGroup, start, line, column); } break; case 209007: if (parser.token !== 67174411 && (parser.flags & 1) === 0) { if (context & 1 && (parser.token & 1073741824) === 1073741824) { return parsePropertyDefinition(parser, context, key, kind, decorators, tokenPos, linePos, colPos); } kind |= 16 | (optionalBit(parser, context, 8457014) ? 8 : 0); } break; case 12402: if (parser.token !== 67174411) { if (context & 1 && (parser.token & 1073741824) === 1073741824) { return parsePropertyDefinition(parser, context, key, kind, decorators, tokenPos, linePos, colPos); } kind |= 256; } break; case 12403: if (parser.token !== 67174411) { if (context & 1 && (parser.token & 1073741824) === 1073741824) { return parsePropertyDefinition(parser, context, key, kind, decorators, tokenPos, linePos, colPos); } kind |= 512; } break; } } else if (token === 69271571) { kind |= 2; key = parseComputedPropertyName(parser, inheritedContext, inGroup); } else if ((token & 134217728) === 134217728) { key = parseLiteral(parser, context); } else if (token === 8457014) { kind |= 8; nextToken(parser, context); } else if (context & 1 && parser.token === 131) { kind |= 4096; key = parsePrivateIdentifier(parser, context | 16384, tokenPos, linePos, colPos); } else if (context & 1 && (parser.token & 1073741824) === 1073741824) { kind |= 128; } else if (isStatic && token === 2162700) { return parseStaticBlock(parser, context, scope, tokenPos, linePos, colPos); } else if (token === 122) { key = parseIdentifier(parser, context, 0); if (parser.token !== 67174411) report(parser, 28, KeywordDescTable[parser.token & 255]); } else { report(parser, 28, KeywordDescTable[parser.token & 255]); } if (kind & (8 | 16 | 768)) { if (parser.token & 143360) { key = parseIdentifier(parser, context, 0); } else if ((parser.token & 134217728) === 134217728) { key = parseLiteral(parser, context); } else if (parser.token === 69271571) { kind |= 2; key = parseComputedPropertyName(parser, context, 0); } else if (parser.token === 122) { key = parseIdentifier(parser, context, 0); } else if (context & 1 && parser.token === 131) { kind |= 4096; key = parsePrivateIdentifier(parser, context, tokenPos, linePos, colPos); } else report(parser, 131); } if ((kind & 2) === 0) { if (parser.tokenValue === 'constructor') { if ((parser.token & 1073741824) === 1073741824) { report(parser, 125); } else if ((kind & 32) === 0 && parser.token === 67174411) { if (kind & (768 | 16 | 128 | 8)) { report(parser, 50, 'accessor'); } else if ((context & 524288) === 0) { if (parser.flags & 32) report(parser, 51); else parser.flags |= 32; } } kind |= 64; } else if ((kind & 4096) === 0 && kind & (32 | 768 | 8 | 16) && parser.tokenValue === 'prototype') { report(parser, 49); } } if (context & 1 && parser.token !== 67174411) { return parsePropertyDefinition(parser, context, key, kind, decorators, tokenPos, linePos, colPos); } const value = parseMethodDefinition(parser, context, kind, inGroup, parser.tokenPos, parser.linePos, parser.colPos); return finishNode(parser, context, start, line, column, context & 1 ? { type: 'MethodDefinition', kind: (kind & 32) === 0 && kind & 64 ? 'constructor' : kind & 256 ? 'get' : kind & 512 ? 'set' : 'method', static: (kind & 32) > 0, computed: (kind & 2) > 0, key, decorators, value } : { type: 'MethodDefinition', kind: (kind & 32) === 0 && kind & 64 ? 'constructor' : kind & 256 ? 'get' : kind & 512 ? 'set' : 'method', static: (kind & 32) > 0, computed: (kind & 2) > 0, key, value }); } function parsePrivateIdentifier(parser, context, start, line, column) { nextToken(parser, context); const { tokenValue } = parser; if (tokenValue === 'constructor') report(parser, 124); nextToken(parser, context); return finishNode(parser, context, start, line, column, { type: 'PrivateIdentifier', name: tokenValue }); } function parsePropertyDefinition(parser, context, key, state, decorators, start, line, column) { let value = null; if (state & 8) report(parser, 0); if (parser.token === 1077936157) { nextToken(parser, context | 32768); const { tokenPos, linePos, colPos } = parser; if (parser.token === 537079928) report(parser, 115); value = parsePrimaryExpression(parser, context | 16384, 2, 0, 1, 0, 0, 1, tokenPos, linePos, colPos); if ((parser.token & 1073741824) !== 1073741824) { value = parseMemberOrUpdateExpression(parser, context | 16384, value, 0, 0, tokenPos, linePos, colPos); value = parseAssignmentExpression(parser, context | 16384, 0, 0, tokenPos, linePos, colPos, value); if (parser.token === 18) { value = parseSequenceExpression(parser, context, 0, start, line, column, value); } } } return finishNode(parser, context, start, line, column, { type: 'PropertyDefinition', key, value, static: (state & 32) > 0, computed: (state & 2) > 0, decorators }); } function parseBindingPattern(parser, context, scope, type, origin, start, line, column) { if (parser.token & 143360) return parseAndClassifyIdentifier(parser, context, scope, type, origin, start, line, column); if ((parser.token & 2097152) !== 2097152) report(parser, 28, KeywordDescTable[parser.token & 255]); const left = parser.token === 69271571 ? parseArrayExpressionOrPattern(parser, context, scope, 1, 0, 1, type, origin, start, line, column) : parseObjectLiteralOrPattern(parser, context, scope, 1, 0, 1, type, origin, start, line, column); if (parser.destructible & 16) report(parser, 47); if (parser.destructible & 32) report(parser, 47); return left; } function parseAndClassifyIdentifier(parser, context, scope, kind, origin, start, line, column) { const { tokenValue, token } = parser; if (context & 1024) { if ((token & 537079808) === 537079808) { report(parser, 115); } else if ((token & 36864) === 36864) { report(parser, 114); } } if ((token & 20480) === 20480) { report(parser, 99); } if (context & (2048 | 2097152) && token === 241773) { report(parser, 30); } if (token === 241739) { if (kind & (8 | 16)) report(parser, 97); } if (context & (4194304 | 2048) && token === 209008) { report(parser, 95); } nextToken(parser, context); if (scope) addVarOrBlock(parser, context, scope, tokenValue, kind, origin); return finishNode(parser, context, start, line, column, { type: 'Identifier', name: tokenValue }); } function parseJSXRootElementOrFragment(parser, context, inJSXChild, start, line, column) { nextToken(parser, context); if (parser.token === 8456259) { return finishNode(parser, context, start, line, column, { type: 'JSXFragment', openingFragment: parseOpeningFragment(parser, context, start, line, column), children: parseJSXChildren(parser, context), closingFragment: parseJSXClosingFragment(parser, context, inJSXChild, parser.tokenPos, parser.linePos, parser.colPos) }); } let closingElement = null; let children = []; const openingElement = parseJSXOpeningFragmentOrSelfCloseElement(parser, context, inJSXChild, start, line, column); if (!openingElement.selfClosing) { children = parseJSXChildren(parser, context); closingElement = parseJSXClosingElement(parser, context, inJSXChild, parser.tokenPos, parser.linePos, parser.colPos); const close = isEqualTagName(closingElement.name); if (isEqualTagName(openingElement.name) !== close) report(parser, 149, close); } return finishNode(parser, context, start, line, column, { type: 'JSXElement', children, openingElement, closingElement }); } function parseOpeningFragment(parser, context, start, line, column) { scanJSXToken(parser, context); return finishNode(parser, context, start, line, column, { type: 'JSXOpeningFragment' }); } function parseJSXClosingElement(parser, context, inJSXChild, start, line, column) { consume(parser, context, 25); const name = parseJSXElementName(parser, context, parser.tokenPos, parser.linePos, parser.colPos); if (inJSXChild) { consume(parser, context, 8456259); } else { parser.token = scanJSXToken(parser, context); } return finishNode(parser, context, start, line, column, { type: 'JSXClosingElement', name }); } function parseJSXClosingFragment(parser, context, inJSXChild, start, line, column) { consume(parser, context, 25); if (inJSXChild) { consume(parser, context, 8456259); } else { consume(parser, context, 8456259); } return finishNode(parser, context, start, line, column, { type: 'JSXClosingFragment' }); } function parseJSXChildren(parser, context) { const children = []; while (parser.token !== 25) { parser.index = parser.tokenPos = parser.startPos; parser.column = parser.colPos = parser.startColumn; parser.line = parser.linePos = parser.startLine; scanJSXToken(parser, context); children.push(parseJSXChild(parser, context, parser.tokenPos, parser.linePos, parser.colPos)); } return children; } function parseJSXChild(parser, context, start, line, column) { if (parser.token === 138) return parseJSXText(parser, context, start, line, column); if (parser.token === 2162700) return parseJSXExpressionContainer(parser, context, 0, 0, start, line, column); if (parser.token === 8456258) return parseJSXRootElementOrFragment(parser, context, 0, start, line, column); report(parser, 0); } function parseJSXText(parser, context, start, line, column) { scanJSXToken(parser, context); const node = { type: 'JSXText', value: parser.tokenValue }; if (context & 512) { node.raw = parser.tokenRaw; } return finishNode(parser, context, start, line, column, node); } function parseJSXOpeningFragmentOrSelfCloseElement(parser, context, inJSXChild, start, line, column) { if ((parser.token & 143360) !== 143360 && (parser.token & 4096) !== 4096) report(parser, 0); const tagName = parseJSXElementName(parser, context, parser.tokenPos, parser.linePos, parser.colPos); const attributes = parseJSXAttributes(parser, context); const selfClosing = parser.token === 8457016; if (parser.token === 8456259) { scanJSXToken(parser, context); } else { consume(parser, context, 8457016); if (inJSXChild) { consume(parser, context, 8456259); } else { scanJSXToken(parser, context); } } return finishNode(parser, context, start, line, column, { type: 'JSXOpeningElement', name: tagName, attributes, selfClosing }); } function parseJSXElementName(parser, context, start, line, column) { scanJSXIdentifier(parser); let key = parseJSXIdentifier(parser, context, start, line, column); if (parser.token === 21) return parseJSXNamespacedName(parser, context, key, start, line, column); while (consumeOpt(parser, context, 67108877)) { scanJSXIdentifier(parser); key = parseJSXMemberExpression(parser, context, key, start, line, column); } return key; } function parseJSXMemberExpression(parser, context, object, start, line, column) { const property = parseJSXIdentifier(parser, context, parser.tokenPos, parser.linePos, parser.colPos); return finishNode(parser, context, start, line, column, { type: 'JSXMemberExpression', object, property }); } function parseJSXAttributes(parser, context) { const attributes = []; while (parser.token !== 8457016 && parser.token !== 8456259 && parser.token !== 1048576) { attributes.push(parseJsxAttribute(parser, context, parser.tokenPos, parser.linePos, parser.colPos)); } return attributes; } function parseJSXSpreadAttribute(parser, context, start, line, column) { nextToken(parser, context); consume(parser, context, 14); const expression = parseExpression(parser, context, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); consume(parser, context, 1074790415); return finishNode(parser, context, start, line, column, { type: 'JSXSpreadAttribute', argument: expression }); } function parseJsxAttribute(parser, context, start, line, column) { if (parser.token === 2162700) return parseJSXSpreadAttribute(parser, context, start, line, column); scanJSXIdentifier(parser); let value = null; let name = parseJSXIdentifier(parser, context, start, line, column); if (parser.token === 21) { name = parseJSXNamespacedName(parser, context, name, start, line, column); } if (parser.token === 1077936157) { const token = scanJSXAttributeValue(parser, context); const { tokenPos, linePos, colPos } = parser; switch (token) { case 134283267: value = parseLiteral(parser, context); break; case 8456258: value = parseJSXRootElementOrFragment(parser, context, 1, tokenPos, linePos, colPos); break; case 2162700: value = parseJSXExpressionContainer(parser, context, 1, 1, tokenPos, linePos, colPos); break; default: report(parser, 148); } } return finishNode(parser, context, start, line, column, { type: 'JSXAttribute', value, name }); } function parseJSXNamespacedName(parser, context, namespace, start, line, column) { consume(parser, context, 21); const name = parseJSXIdentifier(parser, context, parser.tokenPos, parser.linePos, parser.colPos); return finishNode(parser, context, start, line, column, { type: 'JSXNamespacedName', namespace, name }); } function parseJSXExpressionContainer(parser, context, inJSXChild, isAttr, start, line, column) { nextToken(parser, context | 32768); const { tokenPos, linePos, colPos } = parser; if (parser.token === 14) return parseJSXSpreadChild(parser, context, tokenPos, linePos, colPos); let expression = null; if (parser.token === 1074790415) { if (isAttr) report(parser, 151); expression = parseJSXEmptyExpression(parser, context, parser.startPos, parser.startLine, parser.startColumn); } else { expression = parseExpression(parser, context, 1, 0, 0, tokenPos, linePos, colPos); } if (inJSXChild) { consume(parser, context, 1074790415); } else { scanJSXToken(parser, context); } return finishNode(parser, context, start, line, column, { type: 'JSXExpressionContainer', expression }); } function parseJSXSpreadChild(parser, context, start, line, column) { consume(parser, context, 14); const expression = parseExpression(parser, context, 1, 0, 0, parser.tokenPos, parser.linePos, parser.colPos); consume(parser, context, 1074790415); return finishNode(parser, context, start, line, column, { type: 'JSXSpreadChild', expression }); } function parseJSXEmptyExpression(parser, context, start, line, column) { parser.startPos = parser.tokenPos; parser.startLine = parser.linePos; parser.startColumn = parser.colPos; return finishNode(parser, context, start, line, column, { type: 'JSXEmptyExpression' }); } function parseJSXIdentifier(parser, context, start, line, column) { const { tokenValue } = parser; nextToken(parser, context); return finishNode(parser, context, start, line, column, { type: 'JSXIdentifier', name: tokenValue }); } var estree = /*#__PURE__*/Object.freeze({ __proto__: null }); var version$1 = "4.3.0"; const version = version$1; function parseScript(source, options) { return parseSource(source, options, 0); } function parseModule(source, options) { return parseSource(source, options, 1024 | 2048); } function parse(source, options) { return parseSource(source, options, 0); } /***/ }), /* 23 */ /***/ ((__unused_webpack_module, exports) => { // ------------------------------------------------------------- // WARNING: this file is used by both the client and the server. // Do not use any browser or node-specific API! // ------------------------------------------------------------- /* Copyright (C) 2014 Ivan Nikulin Copyright (C) 2012-2014 Yusuke Suzuki Copyright (C) 2012-2013 Michael Ficarra Copyright (C) 2012-2013 Mathias Bynens Copyright (C) 2013 Irakli Gozalishvili Copyright (C) 2012 Robert Gust-Bardon Copyright (C) 2012 John Freeman Copyright (C) 2011-2012 Ariya Hidayat Copyright (C) 2012 Joost-Wim Boekesteijn Copyright (C) 2012 Kris Kowal Copyright (C) 2012 Arpad Borsos Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ var isArray, json, renumber, hexadecimal, quotes, escapeless, parentheses, semicolons, safeConcatenation, directive, extra, parse; var Syntax = { AssignmentExpression: 'AssignmentExpression', AssignmentPattern: 'AssignmentPattern', ArrayExpression: 'ArrayExpression', ArrayPattern: 'ArrayPattern', ArrowFunctionExpression: 'ArrowFunctionExpression', AwaitExpression: 'AwaitExpression', BlockStatement: 'BlockStatement', BinaryExpression: 'BinaryExpression', BreakStatement: 'BreakStatement', CallExpression: 'CallExpression', CatchClause: 'CatchClause', ClassBody: 'ClassBody', ClassDeclaration: 'ClassDeclaration', ClassExpression: 'ClassExpression', ComprehensionBlock: 'ComprehensionBlock', ComprehensionExpression: 'ComprehensionExpression', ConditionalExpression: 'ConditionalExpression', ContinueStatement: 'ContinueStatement', DirectiveStatement: 'DirectiveStatement', DoWhileStatement: 'DoWhileStatement', DebuggerStatement: 'DebuggerStatement', EmptyStatement: 'EmptyStatement', ExportAllDeclaration: 'ExportAllDeclaration', ExportBatchSpecifier: 'ExportBatchSpecifier', ExportDeclaration: 'ExportDeclaration', ExportNamedDeclaration: 'ExportNamedDeclaration', ExportSpecifier: 'ExportSpecifier', ExpressionStatement: 'ExpressionStatement', ForStatement: 'ForStatement', ForInStatement: 'ForInStatement', ForOfStatement: 'ForOfStatement', FunctionDeclaration: 'FunctionDeclaration', FunctionExpression: 'FunctionExpression', GeneratorExpression: 'GeneratorExpression', Identifier: 'Identifier', IfStatement: 'IfStatement', ImportExpression: 'ImportExpression', ImportSpecifier: 'ImportSpecifier', ImportDeclaration: 'ImportDeclaration', ChainExpression: 'ChainExpression', Literal: 'Literal', LabeledStatement: 'LabeledStatement', LogicalExpression: 'LogicalExpression', MemberExpression: 'MemberExpression', MetaProperty: 'MetaProperty', MethodDefinition: 'MethodDefinition', ModuleDeclaration: 'ModuleDeclaration', NewExpression: 'NewExpression', ObjectExpression: 'ObjectExpression', ObjectPattern: 'ObjectPattern', Program: 'Program', Property: 'Property', RestElement: 'RestElement', ReturnStatement: 'ReturnStatement', SequenceExpression: 'SequenceExpression', SpreadElement: 'SpreadElement', Super: 'Super', SwitchStatement: 'SwitchStatement', SwitchCase: 'SwitchCase', TaggedTemplateExpression: 'TaggedTemplateExpression', TemplateElement: 'TemplateElement', TemplateLiteral: 'TemplateLiteral', ThisExpression: 'ThisExpression', ThrowStatement: 'ThrowStatement', TryStatement: 'TryStatement', UnaryExpression: 'UnaryExpression', UpdateExpression: 'UpdateExpression', VariableDeclaration: 'VariableDeclaration', VariableDeclarator: 'VariableDeclarator', WhileStatement: 'WhileStatement', WithStatement: 'WithStatement', YieldExpression: 'YieldExpression' }; exports.Syntax = Syntax; var Precedence = { Sequence: 0, Yield: 1, Assignment: 1, Conditional: 2, ArrowFunction: 2, Coalesce: 3, LogicalOR: 3, LogicalAND: 4, BitwiseOR: 5, BitwiseXOR: 6, BitwiseAND: 7, Equality: 8, Relational: 9, BitwiseSHIFT: 10, Additive: 11, Multiplicative: 12, Unary: 13, Exponentiation: 14, Postfix: 14, Await: 14, Call: 15, New: 16, TaggedTemplate: 17, OptionalChaining: 17, Member: 18, Primary: 19 }; var BinaryPrecedence = { '||': Precedence.LogicalOR, '&&': Precedence.LogicalAND, '|': Precedence.BitwiseOR, '^': Precedence.BitwiseXOR, '&': Precedence.BitwiseAND, '==': Precedence.Equality, '!=': Precedence.Equality, '===': Precedence.Equality, '!==': Precedence.Equality, 'is': Precedence.Equality, 'isnt': Precedence.Equality, '<': Precedence.Relational, '>': Precedence.Relational, '<=': Precedence.Relational, '>=': Precedence.Relational, 'in': Precedence.Relational, 'instanceof': Precedence.Relational, '<<': Precedence.BitwiseSHIFT, '>>': Precedence.BitwiseSHIFT, '>>>': Precedence.BitwiseSHIFT, '+': Precedence.Additive, '-': Precedence.Additive, '*': Precedence.Multiplicative, '%': Precedence.Multiplicative, '/': Precedence.Multiplicative, '??': Precedence.Coalesce, '**': Precedence.Exponentiation }; function getDefaultOptions () { // default options return { indent: null, base: null, parse: null, format: { indent: { style: ' ', base: 0 }, newline: '\n', space: ' ', json: false, renumber: false, hexadecimal: false, quotes: 'single', escapeless: false, compact: false, parentheses: true, semicolons: true, safeConcatenation: false }, directive: false, raw: true, verbatim: null }; } //-------------------------------------------------===------------------------------------------------------ // Lexical utils //-------------------------------------------------===------------------------------------------------------ //Const var NON_ASCII_WHITESPACES = [ 0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF ]; //Regular expressions var NON_ASCII_IDENTIFIER_CHARACTERS_REGEXP = new RegExp( '[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376' + '\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-' + '\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA' + '\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-' + '\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0\u08A2-\u08AC\u08E4-\u08FE\u0900-' + '\u0963\u0966-\u096F\u0971-\u0977\u0979-\u097F\u0981-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-' + '\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-' + '\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38' + '\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83' + '\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9' + '\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-' + '\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-' + '\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E' + '\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-' + '\u0BEF\u0C01-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D-\u0C44\u0C46-' + '\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C82\u0C83\u0C85-\u0C8C\u0C8E-' + '\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE' + '\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D02\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44' + '\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-' + '\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E01-\u0E3A' + '\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-' + '\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9' + '\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84' + '\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\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\u135D-\u135F\u1380-' + '\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-' + '\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD' + '\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191C\u1920-\u192B' + '\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E' + '\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-' + '\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1D00-\u1DE6\u1DFC-\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\u200C\u200D\u203F' + '\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115' + '\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188' + '\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-' + '\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-' + '\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A' + '\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5' + '\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA697' + '\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA827\uA840-\uA873' + '\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-' + '\uA9D9\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7B\uAA80-\uAAC2\uAADB-\uAADD\uAAE0-' + '\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABEA\uABEC' + '\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-' + '\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D' + '\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE26\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74' + '\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-' + '\uFFD7\uFFDA-\uFFDC]' ); //Methods function isIdentifierCh (cp) { if (cp < 0x80) { return cp >= 97 && cp <= 122 || // a..z cp >= 65 && cp <= 90 || // A..Z cp >= 48 && cp <= 57 || // 0..9 cp === 36 || cp === 95 || // $ (dollar) and _ (underscore) cp === 92; // \ (backslash) } var ch = String.fromCharCode(cp); return NON_ASCII_IDENTIFIER_CHARACTERS_REGEXP.test(ch); } function isLineTerminator (cp) { return cp === 0x0A || cp === 0x0D || cp === 0x2028 || cp === 0x2029; } function isWhitespace (cp) { return cp === 0x20 || cp === 0x09 || isLineTerminator(cp) || cp === 0x0B || cp === 0x0C || cp === 0xA0 || (cp >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(cp) >= 0); } function isDecimalDigit (cp) { return cp >= 48 && cp <= 57; } function stringRepeat (str, num) { var result = ''; for (num |= 0; num > 0; num >>>= 1, str += str) { if (num & 1) { result += str; } } return result; } isArray = Array.isArray; if (!isArray) { isArray = function isArray (array) { return Object.prototype.toString.call(array) === '[object Array]'; }; } function updateDeeply (target, override) { var key, val; function isHashObject (target) { return typeof target === 'object' && target instanceof Object && !(target instanceof RegExp); } for (key in override) { if (override.hasOwnProperty(key)) { val = override[key]; if (isHashObject(val)) { if (isHashObject(target[key])) { updateDeeply(target[key], val); } else { target[key] = updateDeeply({}, val); } } else { target[key] = val; } } } return target; } function generateNumber (value) { var result, point, temp, exponent, pos; if (value === 1 / 0) { return json ? 'null' : renumber ? '1e400' : '1e+400'; } result = '' + value; if (!renumber || result.length < 3) { return result; } point = result.indexOf('.'); //NOTE: 0x30 == '0' if (!json && result.charCodeAt(0) === 0x30 && point === 1) { point = 0; result = result.slice(1); } temp = result; result = result.replace('e+', 'e'); exponent = 0; if ((pos = temp.indexOf('e')) > 0) { exponent = +temp.slice(pos + 1); temp = temp.slice(0, pos); } if (point >= 0) { exponent -= temp.length - point - 1; temp = +(temp.slice(0, point) + temp.slice(point + 1)) + ''; } pos = 0; //NOTE: 0x30 == '0' while (temp.charCodeAt(temp.length + pos - 1) === 0x30) { --pos; } if (pos !== 0) { exponent -= pos; temp = temp.slice(0, pos); } if (exponent !== 0) { temp += 'e' + exponent; } if ((temp.length < result.length || (hexadecimal && value > 1e12 && Math.floor(value) === value && (temp = '0x' + value.toString(16)).length < result.length)) && +temp === value) { result = temp; } return result; } // Generate valid RegExp expression. // This function is based on https://github.com/Constellation/iv Engine function escapeRegExpCharacter (ch, previousIsBackslash) { // not handling '\' and handling \u2028 or \u2029 to unicode escape sequence if ((ch & ~1) === 0x2028) { return (previousIsBackslash ? 'u' : '\\u') + ((ch === 0x2028) ? '2028' : '2029'); } else if (ch === 10 || ch === 13) { // \n, \r return (previousIsBackslash ? '' : '\\') + ((ch === 10) ? 'n' : 'r'); } return String.fromCharCode(ch); } function generateRegExp (reg) { var match, result, flags, i, iz, ch, characterInBrack, previousIsBackslash; result = reg.toString(); if (reg.source) { // extract flag from toString result match = result.match(/\/([^/]*)$/); if (!match) { return result; } flags = match[1]; result = ''; characterInBrack = false; previousIsBackslash = false; for (i = 0, iz = reg.source.length; i < iz; ++i) { ch = reg.source.charCodeAt(i); if (!previousIsBackslash) { if (characterInBrack) { if (ch === 93) { // ] characterInBrack = false; } } else { if (ch === 47) { // / result += '\\'; } else if (ch === 91) { // [ characterInBrack = true; } } result += escapeRegExpCharacter(ch, previousIsBackslash); previousIsBackslash = ch === 92; // \ } else { // if new RegExp("\\\n') is provided, create /\n/ result += escapeRegExpCharacter(ch, previousIsBackslash); // prevent like /\\[/]/ previousIsBackslash = false; } } return '/' + result + '/' + flags; } return result; } function escapeAllowedCharacter (code, next) { var hex, result = '\\'; switch (code) { case 0x08: // \b result += 'b'; break; case 0x0C: // \f result += 'f'; break; case 0x09: // \t result += 't'; break; default: hex = code.toString(16).toUpperCase(); if (json || code > 0xFF) { result += 'u' + '0000'.slice(hex.length) + hex; } else if (code === 0x0000 && !isDecimalDigit(next)) { result += '0'; } else if (code === 0x000B) { // \v result += 'x0B'; } else { result += 'x' + '00'.slice(hex.length) + hex; } break; } return result; } function escapeDisallowedCharacter (code) { var result = '\\'; switch (code) { case 0x5C // \ : result += '\\'; break; case 0x0A // \n : result += 'n'; break; case 0x0D // \r : result += 'r'; break; case 0x2028: result += 'u2028'; break; case 0x2029: result += 'u2029'; break; } return result; } function escapeDirective (str) { var i, iz, code, quote; quote = quotes === 'double' ? '"' : '\''; for (i = 0, iz = str.length; i < iz; ++i) { code = str.charCodeAt(i); if (code === 0x27) { // ' quote = '"'; break; } else if (code === 0x22) { // " quote = '\''; break; } else if (code === 0x5C) { // \ ++i; } } return quote + str + quote; } function escapeString (str) { var result = '', i, len, code, singleQuotes = 0, doubleQuotes = 0, single, quote; //TODO http://jsperf.com/character-counting/8 for (i = 0, len = str.length; i < len; ++i) { code = str.charCodeAt(i); if (code === 0x27) { // ' ++singleQuotes; } else if (code === 0x22) { // " ++doubleQuotes; } else if (code === 0x2F && json) { // / result += '\\'; } else if (isLineTerminator(code) || code === 0x5C) { // \ result += escapeDisallowedCharacter(code); continue; } else if ((json && code < 0x20) || // SP !(json || escapeless || (code >= 0x20 && code <= 0x7E))) { // SP, ~ result += escapeAllowedCharacter(code, str.charCodeAt(i + 1)); continue; } result += String.fromCharCode(code); } single = !(quotes === 'double' || (quotes === 'auto' && doubleQuotes < singleQuotes)); quote = single ? '\'' : '"'; if (!(single ? singleQuotes : doubleQuotes)) { return quote + result + quote; } str = result; result = quote; for (i = 0, len = str.length; i < len; ++i) { code = str.charCodeAt(i); if ((code === 0x27 && single) || (code === 0x22 && !single)) { // ', " result += '\\'; } result += String.fromCharCode(code); } return result + quote; } function join (l, r) { if (!l.length) return r; if (!r.length) return l; var lCp = l.charCodeAt(l.length - 1), rCp = r.charCodeAt(0); if (isIdentifierCh(lCp) && isIdentifierCh(rCp) || lCp === rCp && (lCp === 0x2B || lCp === 0x2D) || // + +, - - lCp === 0x2F && rCp === 0x69) { // /re/ instanceof foo return l + _.space + r; } else if (isWhitespace(lCp) || isWhitespace(rCp)) return l + r; return l + _.optSpace + r; } function shiftIndent () { var prevIndent = _.indent; _.indent += _.indentUnit; return prevIndent; } function adoptionPrefix ($stmt) { if ($stmt.type === Syntax.BlockStatement) return _.optSpace; if ($stmt.type === Syntax.EmptyStatement) return ''; return _.newline + _.indent + _.indentUnit; } function adoptionSuffix ($stmt) { if ($stmt.type === Syntax.BlockStatement) return _.optSpace; return _.newline + _.indent; } //Subentities generators function generateVerbatim ($expr, settings) { var verbatim = $expr[extra.verbatim], strVerbatim = typeof verbatim === 'string', precedence = !strVerbatim && verbatim.precedence !== void 0 ? verbatim.precedence : Precedence.Sequence, parenthesize = precedence < settings.precedence, content = strVerbatim ? verbatim : verbatim.content, chunks = content.split(/\r\n|\n/), chunkCount = chunks.length; if (parenthesize) _.js += '('; _.js += chunks[0]; for (var i = 1; i < chunkCount; i++) _.js += _.newline + _.indent + chunks[i]; if (parenthesize) _.js += ')'; } function generateFunctionParams ($node) { var $params = $node.params, paramCount = $params.length, lastParamIdx = paramCount - 1, arrowFuncWithoutParentheses = $node.type === Syntax.ArrowFunctionExpression && paramCount === 1 && $params[0].type === Syntax.Identifier; //NOTE: arg => { } case if (arrowFuncWithoutParentheses) _.js += $params[0].name; else { _.js += '('; for (var i = 0; i < paramCount; ++i) { var $param = $params[i]; if ($params[i].type === Syntax.Identifier) _.js += $param.name; else ExprGen[$param.type]($param, Preset.e4); if (i !== lastParamIdx) _.js += ',' + _.optSpace; } _.js += ')'; } } function generateFunctionBody ($node) { var $body = $node.body; generateFunctionParams($node); if ($node.type === Syntax.ArrowFunctionExpression) _.js += _.optSpace + '=>'; if ($node.expression) { _.js += _.optSpace; var exprJs = exprToJs($body, Preset.e4); if (exprJs.charAt(0) === '{') exprJs = '(' + exprJs + ')'; _.js += exprJs; } else { _.js += adoptionPrefix($body); StmtGen[$body.type]($body, Preset.s8); } } //-------------------------------------------------===------------------------------------------------------ // Syntactic entities generation presets //-------------------------------------------------===------------------------------------------------------ var Preset = { e1: function (allowIn) { return { precedence: Precedence.Assignment, allowIn: allowIn, allowCall: true, allowUnparenthesizedNew: true }; }, e2: function (allowIn) { return { precedence: Precedence.LogicalOR, allowIn: allowIn, allowCall: true, allowUnparenthesizedNew: true }; }, e3: { precedence: Precedence.Call, allowIn: true, allowCall: true, allowUnparenthesizedNew: false }, e4: { precedence: Precedence.Assignment, allowIn: true, allowCall: true, allowUnparenthesizedNew: true }, e5: { precedence: Precedence.Sequence, allowIn: true, allowCall: true, allowUnparenthesizedNew: true }, e6: function (allowUnparenthesizedNew) { return { precedence: Precedence.New, allowIn: true, allowCall: false, allowUnparenthesizedNew: allowUnparenthesizedNew }; }, e7: { precedence: Precedence.Unary, allowIn: true, allowCall: true, allowUnparenthesizedNew: true }, e8: { precedence: Precedence.Postfix, allowIn: true, allowCall: true, allowUnparenthesizedNew: true }, e9: { precedence: void 0, allowIn: true, allowCall: true, allowUnparenthesizedNew: true }, e10: { precedence: Precedence.Call, allowIn: true, allowCall: true, allowUnparenthesizedNew: true }, e11: function (allowCall) { return { precedence: Precedence.Call, allowIn: true, allowCall: allowCall, allowUnparenthesizedNew: false }; }, e12: { precedence: Precedence.Primary, allowIn: false, allowCall: false, allowUnparenthesizedNew: true }, e13: { precedence: Precedence.Primary, allowIn: true, allowCall: true, allowUnparenthesizedNew: true }, e14: { precedence: Precedence.Sequence, allowIn: false, allowCall: true, allowUnparenthesizedNew: true }, e15: function (allowCall) { return { precedence: Precedence.Sequence, allowIn: true, allowCall: allowCall, allowUnparenthesizedNew: true }; }, e16: function (precedence, allowIn) { return { precedence: precedence, allowIn: allowIn, allowCall: true, allowUnparenthesizedNew: true }; }, e17: function (allowIn) { return { precedence: Precedence.Call, allowIn: allowIn, allowCall: true, allowUnparenthesizedNew: true } }, e18: function (allowIn) { return { precedence: Precedence.Assignment, allowIn: allowIn, allowCall: true, allowUnparenthesizedNew: true } }, e19: { precedence: Precedence.Sequence, allowIn: true, allowCall: true, semicolonOptional: false }, e20: { precedence: Precedence.Await, allowCall: true }, s1: function (functionBody, semicolonOptional) { return { allowIn: true, functionBody: false, directiveContext: functionBody, semicolonOptional: semicolonOptional }; }, s2: { allowIn: true, functionBody: false, directiveContext: false, semicolonOptional: true }, s3: function (allowIn) { return { allowIn: allowIn, functionBody: false, directiveContext: false, semicolonOptional: false }; }, s4: function (semicolonOptional) { return { allowIn: true, functionBody: false, directiveContext: false, semicolonOptional: semicolonOptional }; }, s5: function (semicolonOptional) { return { allowIn: true, functionBody: false, directiveContext: true, semicolonOptional: semicolonOptional, }; }, s6: { allowIn: false, functionBody: false, directiveContext: false, semicolonOptional: false }, s7: { allowIn: true, functionBody: false, directiveContext: false, semicolonOptional: false }, s8: { allowIn: true, functionBody: true, directiveContext: false, semicolonOptional: false } }; //-------------------------------------------------===------------------------------------------------------- // Expressions //-------------------------------------------------===------------------------------------------------------- //Regular expressions var FLOATING_OR_OCTAL_REGEXP = /[.eExX]|^0[0-9]+/, LAST_DECIMAL_DIGIT_REGEXP = /[0-9]$/; //Common expression generators function isLogicalExpression(node) { if (!node) return false; return node.type === Syntax.LogicalExpression; } function needParensForLogicalExpression (node, parent) { switch (node.operator) { case "||": if (!isLogicalExpression(parent)) return false; return parent.operator === "??" || parent.operator === "&&"; case "&&": return isLogicalExpression(parent, { operator: "??" }); case "??": return isLogicalExpression(parent) && parent.operator !== "??"; } } function generateLogicalOrBinaryExpression ($expr, settings, $parent) { var op = $expr.operator, precedence = BinaryPrecedence[$expr.operator], parenthesize = precedence < settings.precedence, allowIn = settings.allowIn || parenthesize, operandGenSettings = Preset.e16(precedence, allowIn), exprJs = exprToJs($expr.left, operandGenSettings, $expr); parenthesize |= op === 'in' && !allowIn; var needParens = needParensForLogicalExpression($expr, $parent); if (parenthesize || needParens) _.js += '('; // 0x2F = '/' if (exprJs.charCodeAt(exprJs.length - 1) === 0x2F && isIdentifierCh(op.charCodeAt(0))) exprJs = exprJs + _.space + op; else exprJs = join(exprJs, op); operandGenSettings.precedence++; var rightJs = exprToJs($expr.right, operandGenSettings); //NOTE: If '/' concats with '/' or `<` concats with `!--`, it is interpreted as comment start if (op === '/' && rightJs.charAt(0) === '/' || op.slice(-1) === '<' && rightJs.slice(0, 3) === '!--') exprJs += _.space + rightJs; else exprJs = join(exprJs, rightJs); _.js += exprJs; if (parenthesize || needParens) _.js += ')'; } function generateArrayPatternOrExpression ($expr) { var $elems = $expr.elements, elemCount = $elems.length; if (elemCount) { var lastElemIdx = elemCount - 1, multiline = elemCount > 1, prevIndent = shiftIndent(), itemPrefix = _.newline + _.indent; _.js += '['; for (var i = 0; i < elemCount; i++) { var $elem = $elems[i]; if (multiline) _.js += itemPrefix; if ($elem) ExprGen[$elem.type]($elem, Preset.e4); if (i !== lastElemIdx || !$elem) _.js += ','; } _.indent = prevIndent; if (multiline) _.js += _.newline + _.indent; _.js += ']'; } else _.js += '[]'; } function generateGeneratorOrComprehensionExpression ($expr) { //NOTE: GeneratorExpression should be parenthesized with (...), ComprehensionExpression with [...] var $blocks = $expr.blocks, $filter = $expr.filter, isGenerator = $expr.type === Syntax.GeneratorExpression, exprJs = isGenerator ? '(' : '[', bodyJs = exprToJs($expr.body, Preset.e4); if ($blocks) { var prevIndent = shiftIndent(), blockCount = $blocks.length; for (var i = 0; i < blockCount; ++i) { var blockJs = exprToJs($blocks[i], Preset.e5); exprJs = i > 0 ? join(exprJs, blockJs) : (exprJs + blockJs); } _.indent = prevIndent; } if ($filter) { var filterJs = exprToJs($filter, Preset.e5); exprJs = join(exprJs, 'if' + _.optSpace); exprJs = join(exprJs, '(' + filterJs + ')'); } exprJs = join(exprJs, bodyJs); exprJs += isGenerator ? ')' : ']'; _.js += exprJs; } //Expression raw generator dictionary var ExprRawGen = { SequenceExpression: function generateSequenceExpression ($expr, settings) { var $children = $expr.expressions, childrenCount = $children.length, lastChildIdx = childrenCount - 1, parenthesize = Precedence.Sequence < settings.precedence, exprGenSettings = Preset.e1(settings.allowIn || parenthesize); if (parenthesize) _.js += '('; for (var i = 0; i < childrenCount; i++) { var $child = $children[i]; ExprGen[$child.type]($child, exprGenSettings); if (i !== lastChildIdx) _.js += ',' + _.optSpace; } if (parenthesize) _.js += ')'; }, AssignmentExpression: function generateAssignmentExpression ($expr, settings) { var $left = $expr.left, $right = $expr.right, parenthesize = Precedence.Assignment < settings.precedence, allowIn = settings.allowIn || parenthesize; if (parenthesize) _.js += '('; ExprGen[$left.type]($left, Preset.e17(allowIn)); _.js += _.optSpace + $expr.operator + _.optSpace; ExprGen[$right.type]($right, Preset.e18(allowIn)); if (parenthesize) _.js += ')'; }, AssignmentPattern: function generateAssignmentPattern ($node) { var $fakeAssign = { left: $node.left, right: $node.right, operator: '=' }; ExprGen.AssignmentExpression($fakeAssign, Preset.e4); }, ArrowFunctionExpression: function generateArrowFunctionExpression ($expr, settings) { var parenthesize = Precedence.ArrowFunction < settings.precedence; if (parenthesize) _.js += '('; if ($expr.async) _.js += 'async '; generateFunctionBody($expr); if (parenthesize) _.js += ')'; }, AwaitExpression: function generateAwaitExpression ($expr, settings) { var parenthesize = Precedence.Await < settings.precedence; if (parenthesize) _.js += '('; _.js += $expr.all ? 'await* ' : 'await '; ExprGen[$expr.argument.type]($expr.argument, Preset.e20); if (parenthesize) _.js += ')'; }, ConditionalExpression: function generateConditionalExpression ($expr, settings) { var $test = $expr.test, $conseq = $expr.consequent, $alt = $expr.alternate, parenthesize = Precedence.Conditional < settings.precedence, allowIn = settings.allowIn || parenthesize, testGenSettings = Preset.e2(allowIn), branchGenSettings = Preset.e1(allowIn); if (parenthesize) _.js += '('; ExprGen[$test.type]($test, testGenSettings); _.js += _.optSpace + '?' + _.optSpace; ExprGen[$conseq.type]($conseq, branchGenSettings); _.js += _.optSpace + ':' + _.optSpace; ExprGen[$alt.type]($alt, branchGenSettings); if (parenthesize) _.js += ')'; }, LogicalExpression: generateLogicalOrBinaryExpression, BinaryExpression: generateLogicalOrBinaryExpression, CallExpression: function generateCallExpression ($expr, settings) { var $callee = $expr.callee, $args = $expr['arguments'], argCount = $args.length, lastArgIdx = argCount - 1, parenthesize = !settings.allowCall || Precedence.Call < settings.precedence; if (parenthesize) _.js += '('; ExprGen[$callee.type]($callee, Preset.e3); if ($expr.optional) _.js += '?.'; _.js += '('; for (var i = 0; i < argCount; ++i) { var $arg = $args[i]; ExprGen[$arg.type]($arg, Preset.e4); if (i !== lastArgIdx) _.js += ',' + _.optSpace; } _.js += ')'; if (parenthesize) _.js += ')'; }, NewExpression: function generateNewExpression ($expr, settings) { var $args = $expr['arguments'], parenthesize = Precedence.New < settings.precedence, argCount = $args.length, lastArgIdx = argCount - 1, withCall = !settings.allowUnparenthesizedNew || parentheses || argCount > 0, calleeJs = exprToJs($expr.callee, Preset.e6(!withCall)); if (parenthesize) _.js += '('; _.js += join('new', calleeJs); if (withCall) { _.js += '('; for (var i = 0; i < argCount; ++i) { var $arg = $args[i]; ExprGen[$arg.type]($arg, Preset.e4); if (i !== lastArgIdx) _.js += ',' + _.optSpace; } _.js += ')'; } if (parenthesize) _.js += ')'; }, MemberExpression: function generateMemberExpression ($expr, settings) { var $obj = $expr.object, $prop = $expr.property, parenthesize = Precedence.Member < settings.precedence, isNumObj = !$expr.computed && $obj.type === Syntax.Literal && typeof $obj.value === 'number'; if (parenthesize) _.js += '('; if (isNumObj) { //NOTE: When the following conditions are all true: // 1. No floating point // 2. Don't have exponents // 3. The last character is a decimal digit // 4. Not hexadecimal OR octal number literal // then we should add a floating point. var numJs = exprToJs($obj, Preset.e11(settings.allowCall)), withPoint = LAST_DECIMAL_DIGIT_REGEXP.test(numJs) && !FLOATING_OR_OCTAL_REGEXP.test(numJs); _.js += withPoint ? (numJs + '.') : numJs; } else ExprGen[$obj.type]($obj, Preset.e11(settings.allowCall)); if ($expr.computed) { if ($expr.optional) _.js += '?.'; _.js += '['; ExprGen[$prop.type]($prop, Preset.e15(settings.allowCall)); _.js += ']'; } else _.js += ($expr.optional ? '?.' : '.') + $prop.name; if (parenthesize) _.js += ')'; }, UnaryExpression: function generateUnaryExpression ($expr, settings) { var parenthesize = Precedence.Unary < settings.precedence, op = $expr.operator, argJs = exprToJs($expr.argument, Preset.e7); if (parenthesize) _.js += '('; //NOTE: delete, void, typeof // get `typeof []`, not `typeof[]` if (_.optSpace === '' || op.length > 2) _.js += join(op, argJs); else { _.js += op; //NOTE: Prevent inserting spaces between operator and argument if it is unnecessary // like, `!cond` var leftCp = op.charCodeAt(op.length - 1), rightCp = argJs.charCodeAt(0); // 0x2B = '+', 0x2D = '-' if (leftCp === rightCp && (leftCp === 0x2B || leftCp === 0x2D) || isIdentifierCh(leftCp) && isIdentifierCh(rightCp)) { _.js += _.space; } _.js += argJs; } if (parenthesize) _.js += ')'; }, YieldExpression: function generateYieldExpression ($expr, settings) { var $arg = $expr.argument, js = $expr.delegate ? 'yield*' : 'yield', parenthesize = Precedence.Yield < settings.precedence; if (parenthesize) _.js += '('; if ($arg) { var argJs = exprToJs($arg, Preset.e4); js = join(js, argJs); } _.js += js; if (parenthesize) _.js += ')'; }, UpdateExpression: function generateUpdateExpression ($expr, settings) { var $arg = $expr.argument, $op = $expr.operator, prefix = $expr.prefix, precedence = prefix ? Precedence.Unary : Precedence.Postfix, parenthesize = precedence < settings.precedence; if (parenthesize) _.js += '('; if (prefix) { _.js += $op; ExprGen[$arg.type]($arg, Preset.e8); } else { ExprGen[$arg.type]($arg, Preset.e8); _.js += $op; } if (parenthesize) _.js += ')'; }, FunctionExpression: function generateFunctionExpression ($expr) { var isGenerator = !!$expr.generator; if ($expr.async) _.js += 'async '; _.js += isGenerator ? 'function*' : 'function'; if ($expr.id) { _.js += isGenerator ? _.optSpace : _.space; _.js += $expr.id.name; } else _.js += _.optSpace; generateFunctionBody($expr); }, ExportBatchSpecifier: function generateExportBatchSpecifier () { _.js += '*'; }, ArrayPattern: generateArrayPatternOrExpression, ArrayExpression: generateArrayPatternOrExpression, ClassExpression: function generateClassExpression ($expr) { var $id = $expr.id, $super = $expr.superClass, $body = $expr.body, exprJs = 'class'; if ($id) { var idJs = exprToJs($id, Preset.e9); exprJs = join(exprJs, idJs); } if ($super) { var superJs = exprToJs($super, Preset.e4); superJs = join('extends', superJs); exprJs = join(exprJs, superJs); } _.js += exprJs + _.optSpace; StmtGen[$body.type]($body, Preset.s2); }, MetaProperty: function generateMetaProperty ($expr, settings) { var $meta = $expr.meta, $property = $expr.property, parenthesize = Precedence.Member < settings.precedence; if (parenthesize) _.js += '('; _.js += (typeof $meta === "string" ? $meta : $meta.name) + '.' + (typeof $property === "string" ? $property : $property.name); if (parenthesize) _.js += ')'; }, MethodDefinition: function generateMethodDefinition ($expr) { var exprJs = $expr['static'] ? 'static' + _.optSpace : '', keyJs = exprToJs($expr.key, Preset.e5); if ($expr.computed) keyJs = '[' + keyJs + ']'; if ($expr.kind === 'get' || $expr.kind === 'set') { keyJs = join($expr.kind, keyJs); _.js += join(exprJs, keyJs); } else { if ($expr.value.generator) _.js += exprJs + '*' + keyJs; else if ($expr.value.async) _.js += exprJs + 'async ' + keyJs; else _.js += join(exprJs, keyJs); } generateFunctionBody($expr.value); }, Property: function generateProperty ($expr) { var $val = $expr.value, $kind = $expr.kind, keyJs = exprToJs($expr.key, Preset.e4); if ($expr.computed) keyJs = '[' + keyJs + ']'; if ($kind === 'get' || $kind === 'set') { _.js += $kind + _.space + keyJs; generateFunctionBody($val); } else { if ($expr.shorthand) _.js += keyJs; else if ($expr.method) { if ($val.generator) keyJs = '*' + keyJs; else if ($val.async) keyJs = 'async ' + keyJs; _.js += keyJs; generateFunctionBody($val) } else { _.js += keyJs + ':' + _.optSpace; ExprGen[$val.type]($val, Preset.e4); } } }, ObjectExpression: function generateObjectExpression ($expr) { var $props = $expr.properties, propCount = $props.length; if (propCount) { var lastPropIdx = propCount - 1, prevIndent = shiftIndent(); _.js += '{'; for (var i = 0; i < propCount; i++) { var $prop = $props[i], propType = $prop.type || Syntax.Property; _.js += _.newline + _.indent; ExprGen[propType]($prop, Preset.e5); if (i !== lastPropIdx) _.js += ','; } _.indent = prevIndent; _.js += _.newline + _.indent + '}'; } else _.js += '{}'; }, ObjectPattern: function generateObjectPattern ($expr) { var $props = $expr.properties, propCount = $props.length; if (propCount) { var lastPropIdx = propCount - 1, multiline = false; if (propCount === 1) multiline = $props[0].value.type !== Syntax.Identifier; else { for (var i = 0; i < propCount; i++) { if (!$props[i].shorthand) { multiline = true; break; } } } _.js += multiline ? ('{' + _.newline) : '{'; var prevIndent = shiftIndent(), propSuffix = ',' + (multiline ? _.newline : _.optSpace); for (var i = 0; i < propCount; i++) { var $prop = $props[i]; if (multiline) _.js += _.indent; ExprGen[$prop.type]($prop, Preset.e5); if (i !== lastPropIdx) _.js += propSuffix; } _.indent = prevIndent; _.js += multiline ? (_.newline + _.indent + '}') : '}'; } else _.js += '{}'; }, ThisExpression: function generateThisExpression () { _.js += 'this'; }, Identifier: function generateIdentifier ($expr, precedence, flag) { _.js += $expr.name; }, ImportExpression: function generateImportExpression ($expr, settings) { var parenthesize = Precedence.Call < settings.precedence; var $source = $expr.source; if (parenthesize) _.js += '('; _.js += 'import('; ExprGen[$source.type]($source, Preset.e4); _.js += ')'; if (parenthesize) _.js += ')'; }, ImportSpecifier: function generateImportSpecifier ($expr) { _.js += $expr.imported.name; if ($expr.local) _.js += _.space + 'as' + _.space + $expr.local.name; }, ExportSpecifier: function generateImportOrExportSpecifier ($expr) { _.js += $expr.local.name; if ($expr.exported) _.js += _.space + 'as' + _.space + $expr.exported.name; }, ChainExpression: function generateChainExpression ($expr, settings) { var parenthesize = Precedence.OptionalChaining < settings.precedence; var $expression = $expr.expression; settings = settings || {}; var newSettings = { precedence: Precedence.OptionalChaining, allowIn: settings.allowIn , allowCall: settings.allowCall, allowUnparenthesizedNew: settings.allowUnparenthesizedNew } if (parenthesize) { newSettings.allowCall = true; _.js += '('; } ExprGen[$expression.type]($expression, newSettings); if (parenthesize) _.js += ')'; }, Literal: function generateLiteral ($expr) { if (extra.raw && $expr.raw !== void 0) _.js += $expr.raw; else if ($expr.value === null) _.js += 'null'; else { var valueType = typeof $expr.value; if (valueType === 'string') _.js += escapeString($expr.value); else if (valueType === 'number') _.js += generateNumber($expr.value); else if (valueType === 'boolean') _.js += $expr.value ? 'true' : 'false'; else _.js += generateRegExp($expr.value); } }, GeneratorExpression: generateGeneratorOrComprehensionExpression, ComprehensionExpression: generateGeneratorOrComprehensionExpression, ComprehensionBlock: function generateComprehensionBlock ($expr) { var $left = $expr.left, leftJs = void 0, rightJs = exprToJs($expr.right, Preset.e5); if ($left.type === Syntax.VariableDeclaration) leftJs = $left.kind + _.space + stmtToJs($left.declarations[0], Preset.s6); else leftJs = exprToJs($left, Preset.e10); leftJs = join(leftJs, $expr.of ? 'of' : 'in'); _.js += 'for' + _.optSpace + '(' + join(leftJs, rightJs) + ')'; }, RestElement: function generateRestElement ($node) { _.js += '...' + $node.argument.name; }, SpreadElement: function generateSpreadElement ($expr) { var $arg = $expr.argument; _.js += '...'; ExprGen[$arg.type]($arg, Preset.e4); }, TaggedTemplateExpression: function generateTaggedTemplateExpression ($expr, settings) { var $tag = $expr.tag, $quasi = $expr.quasi, parenthesize = Precedence.TaggedTemplate < settings.precedence; if (parenthesize) _.js += '('; ExprGen[$tag.type]($tag, Preset.e11(settings.allowCall)); ExprGen[$quasi.type]($quasi, Preset.e12); if (parenthesize) _.js += ')'; }, TemplateElement: function generateTemplateElement ($expr) { //NOTE: Don't use "cooked". Since tagged template can use raw template // representation. So if we do so, it breaks the script semantics. _.js += $expr.value.raw; }, TemplateLiteral: function generateTemplateLiteral ($expr) { var $quasis = $expr.quasis, $childExprs = $expr.expressions, quasiCount = $quasis.length, lastQuasiIdx = quasiCount - 1; _.js += '`'; for (var i = 0; i < quasiCount; ++i) { var $quasi = $quasis[i]; ExprGen[$quasi.type]($quasi, Preset.e13); if (i !== lastQuasiIdx) { var $childExpr = $childExprs[i]; _.js += '${' + _.optSpace; ExprGen[$childExpr.type]($childExpr, Preset.e5); _.js += _.optSpace + '}'; } } _.js += '`'; }, Super: function generateSuper () { _.js += 'super'; } }; //-------------------------------------------------===------------------------------------------------------ // Statements //-------------------------------------------------===------------------------------------------------------ //Regular expressions var EXPR_STMT_UNALLOWED_EXPR_REGEXP = /^{|^class(?:\s|{)|^(async )?function(?:\s|\*|\()/; //Common statement generators function generateTryStatementHandlers (stmtJs, $finalizer, handlers) { var handlerCount = handlers.length, lastHandlerIdx = handlerCount - 1; for (var i = 0; i < handlerCount; ++i) { var handlerJs = stmtToJs(handlers[i], Preset.s7); stmtJs = join(stmtJs, handlerJs); if ($finalizer || i !== lastHandlerIdx) stmtJs += adoptionSuffix(handlers[i].body); } return stmtJs; } function generateForStatementIterator ($op, $stmt, settings) { var $body = $stmt.body, $left = $stmt.left, bodySemicolonOptional = !semicolons && settings.semicolonOptional, prevIndent1 = shiftIndent(), awaitStr = $stmt.await ? ' await' : '', stmtJs = 'for' + awaitStr + _.optSpace + '('; if ($left.type === Syntax.VariableDeclaration) { var prevIndent2 = shiftIndent(); stmtJs += $left.kind + _.space + stmtToJs($left.declarations[0], Preset.s6); _.indent = prevIndent2; } else stmtJs += exprToJs($left, Preset.e10); stmtJs = join(stmtJs, $op); var rightJs = exprToJs($stmt.right, Preset.e4); stmtJs = join(stmtJs, rightJs) + ')'; _.indent = prevIndent1; _.js += stmtJs + adoptionPrefix($body); StmtGen[$body.type]($body, Preset.s4(bodySemicolonOptional)); } //Statement generator dictionary var StmtRawGen = { BlockStatement: function generateBlockStatement ($stmt, settings) { var $body = $stmt.body, len = $body.length, lastIdx = len - 1, prevIndent = shiftIndent(); _.js += '{' + _.newline; for (var i = 0; i < len; i++) { var $item = $body[i]; _.js += _.indent; StmtGen[$item.type]($item, Preset.s1(settings.functionBody, i === lastIdx)); _.js += _.newline; } _.indent = prevIndent; _.js += _.indent + '}'; }, BreakStatement: function generateBreakStatement ($stmt, settings) { if ($stmt.label) _.js += 'break ' + $stmt.label.name; else _.js += 'break'; if (semicolons || !settings.semicolonOptional) _.js += ';'; }, ContinueStatement: function generateContinueStatement ($stmt, settings) { if ($stmt.label) _.js += 'continue ' + $stmt.label.name; else _.js += 'continue'; if (semicolons || !settings.semicolonOptional) _.js += ';'; }, ClassBody: function generateClassBody ($stmt) { var $body = $stmt.body, itemCount = $body.length, lastItemIdx = itemCount - 1, prevIndent = shiftIndent(); _.js += '{' + _.newline; for (var i = 0; i < itemCount; i++) { var $item = $body[i], itemType = $item.type || Syntax.Property; _.js += _.indent; ExprGen[itemType]($item, Preset.e5); if (i !== lastItemIdx) _.js += _.newline; } _.indent = prevIndent; _.js += _.newline + _.indent + '}'; }, ClassDeclaration: function generateClassDeclaration ($stmt) { var $body = $stmt.body, $super = $stmt.superClass, js = 'class ' + $stmt.id.name; if ($super) { var superJs = exprToJs($super, Preset.e4); js += _.space + join('extends', superJs); } _.js += js + _.optSpace; StmtGen[$body.type]($body, Preset.s2); }, DirectiveStatement: function generateDirectiveStatement ($stmt, settings) { if (extra.raw && $stmt.raw) _.js += $stmt.raw; else _.js += escapeDirective($stmt.directive); if (semicolons || !settings.semicolonOptional) _.js += ';'; }, DoWhileStatement: function generateDoWhileStatement ($stmt, settings) { var $body = $stmt.body, $test = $stmt.test, bodyJs = adoptionPrefix($body) + stmtToJs($body, Preset.s7) + adoptionSuffix($body); //NOTE: Because `do 42 while (cond)` is Syntax Error. We need semicolon. var stmtJs = join('do', bodyJs); _.js += join(stmtJs, 'while' + _.optSpace + '('); ExprGen[$test.type]($test, Preset.e5); _.js += ')'; if (semicolons || !settings.semicolonOptional) _.js += ';'; }, CatchClause: function generateCatchClause ($stmt) { var $param = $stmt.param, $guard = $stmt.guard, $body = $stmt.body, prevIndent = shiftIndent(); _.js += 'catch' + _.optSpace; if ($param) { _.js += '('; ExprGen[$param.type]($param, Preset.e5); } if ($guard) { _.js += ' if '; ExprGen[$guard.type]($guard, Preset.e5); } _.indent = prevIndent; if ($param) { _.js += ')'; } _.js += adoptionPrefix($body); StmtGen[$body.type]($body, Preset.s7); }, DebuggerStatement: function generateDebuggerStatement ($stmt, settings) { _.js += 'debugger'; if (semicolons || !settings.semicolonOptional) _.js += ';'; }, EmptyStatement: function generateEmptyStatement () { _.js += ';'; }, ExportAllDeclaration: function ($stmt, settings) { StmtRawGen.ExportDeclaration($stmt, settings, true); }, ExportDeclaration: function generateExportDeclaration ($stmt, settings, exportAll) { var $specs = $stmt.specifiers, $decl = $stmt.declaration, withSemicolon = semicolons || !settings.semicolonOptional; // export default AssignmentExpression[In] ; if ($stmt['default']) { var declJs = exprToJs($decl, Preset.e4); _.js += join('export default', declJs); if (withSemicolon) _.js += ';'; } // export * FromClause ; // export ExportClause[NoReference] FromClause ; // export ExportClause ; else if ($specs || exportAll) { var stmtJs = 'export'; if (exportAll) stmtJs += _.optSpace + '*'; else if ($specs.length === 0) stmtJs += _.optSpace + '{' + _.optSpace + '}'; else if ($specs[0].type === Syntax.ExportBatchSpecifier) { var specJs = exprToJs($specs[0], Preset.e5); stmtJs = join(stmtJs, specJs); } else { var prevIndent = shiftIndent(), specCount = $specs.length, lastSpecIdx = specCount - 1; stmtJs += _.optSpace + '{'; for (var i = 0; i < specCount; ++i) { stmtJs += _.newline + _.indent; stmtJs += exprToJs($specs[i], Preset.e5); if (i !== lastSpecIdx) stmtJs += ','; } _.indent = prevIndent; stmtJs += _.newline + _.indent + '}'; } if ($stmt.source) { _.js += join(stmtJs, 'from' + _.optSpace); ExprGen.Literal($stmt.source); } else _.js += stmtJs; if (withSemicolon) _.js += ';'; } // export VariableStatement // export Declaration[Default] else if ($decl) { var declJs = stmtToJs($decl, Preset.s4(!withSemicolon)); _.js += join('export', declJs); } }, ExportNamedDeclaration: function ($stmt, settings) { StmtRawGen.ExportDeclaration($stmt, settings); }, ExpressionStatement: function generateExpressionStatement ($stmt, settings) { var exprJs = exprToJs($stmt.expression, Preset.e5), parenthesize = EXPR_STMT_UNALLOWED_EXPR_REGEXP.test(exprJs) || (directive && settings.directiveContext && $stmt.expression.type === Syntax.Literal && typeof $stmt.expression.value === 'string'); //NOTE: '{', 'function', 'class' are not allowed in expression statement. // Therefore, they should be parenthesized. if (parenthesize) _.js += '(' + exprJs + ')'; else _.js += exprJs; if (semicolons || !settings.semicolonOptional) _.js += ';'; }, ImportDeclaration: function generateImportDeclaration ($stmt, settings) { var $specs = $stmt.specifiers, stmtJs = 'import', specCount = $specs.length; //NOTE: If no ImportClause is present, // this should be `import ModuleSpecifier` so skip `from` // ModuleSpecifier is StringLiteral. if (specCount) { var hasBinding = !!$specs[0]['default'], firstNamedIdx = hasBinding ? 1 : 0, lastSpecIdx = specCount - 1; // ImportedBinding if (hasBinding) stmtJs = join(stmtJs, $specs[0].id.name); // NamedImports if (firstNamedIdx < specCount) { if (hasBinding) stmtJs += ','; stmtJs += _.optSpace + '{'; // import { ... } from "..."; if (firstNamedIdx === lastSpecIdx) stmtJs += _.optSpace + exprToJs($specs[firstNamedIdx], Preset.e5) + _.optSpace; else { var prevIndent = shiftIndent(); // import { // ..., // ..., // } from "..."; for (var i = firstNamedIdx; i < specCount; i++) { stmtJs += _.newline + _.indent + exprToJs($specs[i], Preset.e5); if (i !== lastSpecIdx) stmtJs += ','; } _.indent = prevIndent; stmtJs += _.newline + _.indent; } stmtJs += '}' + _.optSpace; } stmtJs = join(stmtJs, 'from') } _.js += stmtJs + _.optSpace; ExprGen.Literal($stmt.source); if (semicolons || !settings.semicolonOptional) _.js += ';'; }, VariableDeclarator: function generateVariableDeclarator ($stmt, settings) { var $id = $stmt.id, $init = $stmt.init, genSettings = Preset.e1(settings.allowIn); if ($init) { ExprGen[$id.type]($id, genSettings); _.js += _.optSpace + '=' + _.optSpace; ExprGen[$init.type]($init, genSettings, $stmt); } else { if ($id.type === Syntax.Identifier) _.js += $id.name; else ExprGen[$id.type]($id, genSettings); } }, VariableDeclaration: function generateVariableDeclaration ($stmt, settings) { var $decls = $stmt.declarations, len = $decls.length, prevIndent = len > 1 ? shiftIndent() : _.indent, declGenSettings = Preset.s3(settings.allowIn); _.js += $stmt.kind; for (var i = 0; i < len; i++) { var $decl = $decls[i]; _.js += i === 0 ? _.space : (',' + _.optSpace); StmtGen[$decl.type]($decl, declGenSettings); } if (semicolons || !settings.semicolonOptional) _.js += ';'; _.indent = prevIndent; }, ThrowStatement: function generateThrowStatement ($stmt, settings) { var argJs = exprToJs($stmt.argument, Preset.e5); _.js += join('throw', argJs); if (semicolons || !settings.semicolonOptional) _.js += ';'; }, TryStatement: function generateTryStatement ($stmt) { var $block = $stmt.block, $finalizer = $stmt.finalizer, stmtJs = 'try' + adoptionPrefix($block) + stmtToJs($block, Preset.s7) + adoptionSuffix($block); var $handlers = $stmt.handlers || $stmt.guardedHandlers; if ($handlers) stmtJs = generateTryStatementHandlers(stmtJs, $finalizer, $handlers); if ($stmt.handler) { $handlers = isArray($stmt.handler) ? $stmt.handler : [$stmt.handler]; stmtJs = generateTryStatementHandlers(stmtJs, $finalizer, $handlers); } if ($finalizer) { stmtJs = join(stmtJs, 'finally' + adoptionPrefix($finalizer)); stmtJs += stmtToJs($finalizer, Preset.s7); } _.js += stmtJs; }, SwitchStatement: function generateSwitchStatement ($stmt) { var $cases = $stmt.cases, $discr = $stmt.discriminant, prevIndent = shiftIndent(); _.js += 'switch' + _.optSpace + '('; ExprGen[$discr.type]($discr, Preset.e5); _.js += ')' + _.optSpace + '{' + _.newline; _.indent = prevIndent; if ($cases) { var caseCount = $cases.length, lastCaseIdx = caseCount - 1; for (var i = 0; i < caseCount; i++) { var $case = $cases[i]; _.js += _.indent; StmtGen[$case.type]($case, Preset.s4(i === lastCaseIdx)); _.js += _.newline; } } _.js += _.indent + '}'; }, SwitchCase: function generateSwitchCase ($stmt, settings) { var $conseqs = $stmt.consequent, $firstConseq = $conseqs[0], $test = $stmt.test, i = 0, conseqSemicolonOptional = !semicolons && settings.semicolonOptional, conseqCount = $conseqs.length, lastConseqIdx = conseqCount - 1, prevIndent = shiftIndent(); if ($test) { var testJs = exprToJs($test, Preset.e5); _.js += join('case', testJs) + ':'; } else _.js += 'default:'; if (conseqCount && $firstConseq.type === Syntax.BlockStatement) { i++; _.js += adoptionPrefix($firstConseq); StmtGen[$firstConseq.type]($firstConseq, Preset.s7); } for (; i < conseqCount; i++) { var $conseq = $conseqs[i], semicolonOptional = i === lastConseqIdx && conseqSemicolonOptional; _.js += _.newline + _.indent; StmtGen[$conseq.type]($conseq, Preset.s4(semicolonOptional)); } _.indent = prevIndent; }, IfStatement: function generateIfStatement ($stmt, settings) { var $conseq = $stmt.consequent, $test = $stmt.test, prevIndent = shiftIndent(), semicolonOptional = !semicolons && settings.semicolonOptional; _.js += 'if' + _.optSpace + '('; ExprGen[$test.type]($test, Preset.e5); _.js += ')'; _.indent = prevIndent; _.js += adoptionPrefix($conseq); if ($stmt.alternate) { var conseq = stmtToJs($conseq, Preset.s7) + adoptionSuffix($conseq), alt = stmtToJs($stmt.alternate, Preset.s4(semicolonOptional)); if ($stmt.alternate.type === Syntax.IfStatement) alt = 'else ' + alt; else alt = join('else', adoptionPrefix($stmt.alternate) + alt); _.js += join(conseq, alt); } else StmtGen[$conseq.type]($conseq, Preset.s4(semicolonOptional)); }, ForStatement: function generateForStatement ($stmt, settings) { var $init = $stmt.init, $test = $stmt.test, $body = $stmt.body, $update = $stmt.update, bodySemicolonOptional = !semicolons && settings.semicolonOptional, prevIndent = shiftIndent(); _.js += 'for' + _.optSpace + '('; if ($init) { if ($init.type === Syntax.VariableDeclaration) StmtGen[$init.type]($init, Preset.s6); else { ExprGen[$init.type]($init, Preset.e14); _.js += ';'; } } else _.js += ';'; if ($test) { _.js += _.optSpace; ExprGen[$test.type]($test, Preset.e5); } _.js += ';'; if ($update) { _.js += _.optSpace; ExprGen[$update.type]($update, Preset.e5); } _.js += ')'; _.indent = prevIndent; _.js += adoptionPrefix($body); StmtGen[$body.type]($body, Preset.s4(bodySemicolonOptional)); }, ForInStatement: function generateForInStatement ($stmt, settings) { generateForStatementIterator('in', $stmt, settings); }, ForOfStatement: function generateForOfStatement ($stmt, settings) { generateForStatementIterator('of', $stmt, settings); }, LabeledStatement: function generateLabeledStatement ($stmt, settings) { var $body = $stmt.body, bodySemicolonOptional = !semicolons && settings.semicolonOptional, prevIndent = _.indent; _.js += $stmt.label.name + ':' + adoptionPrefix($body); if ($body.type !== Syntax.BlockStatement) prevIndent = shiftIndent(); StmtGen[$body.type]($body, Preset.s4(bodySemicolonOptional)); _.indent = prevIndent; }, ModuleDeclaration: function generateModuleDeclaration ($stmt, settings) { _.js += 'module' + _.space + $stmt.id.name + _.space + 'from' + _.optSpace; ExprGen.Literal($stmt.source); if (semicolons || !settings.semicolonOptional) _.js += ';'; }, Program: function generateProgram ($stmt) { var $body = $stmt.body, len = $body.length, lastIdx = len - 1; if (safeConcatenation && len > 0) _.js += '\n'; for (var i = 0; i < len; i++) { var $item = $body[i]; _.js += _.indent; StmtGen[$item.type]($item, Preset.s5(!safeConcatenation && i === lastIdx)); if (i !== lastIdx) _.js += _.newline; } }, FunctionDeclaration: function generateFunctionDeclaration ($stmt) { var isGenerator = !!$stmt.generator; if ($stmt.async) _.js += 'async '; _.js += isGenerator ? ('function*' + _.optSpace) : ('function' + _.space ); _.js += $stmt.id.name; generateFunctionBody($stmt); }, ReturnStatement: function generateReturnStatement ($stmt, settings) { var $arg = $stmt.argument; if ($arg) { var argJs = exprToJs($arg, Preset.e5); _.js += join('return', argJs); } else _.js += 'return'; if (semicolons || !settings.semicolonOptional) _.js += ';'; }, WhileStatement: function generateWhileStatement ($stmt, settings) { var $body = $stmt.body, $test = $stmt.test, bodySemicolonOptional = !semicolons && settings.semicolonOptional, prevIndent = shiftIndent(); _.js += 'while' + _.optSpace + '('; ExprGen[$test.type]($test, Preset.e5); _.js += ')'; _.indent = prevIndent; _.js += adoptionPrefix($body); StmtGen[$body.type]($body, Preset.s4(bodySemicolonOptional)); }, WithStatement: function generateWithStatement ($stmt, settings) { var $body = $stmt.body, $obj = $stmt.object, bodySemicolonOptional = !semicolons && settings.semicolonOptional, prevIndent = shiftIndent(); _.js += 'with' + _.optSpace + '('; ExprGen[$obj.type]($obj, Preset.e5); _.js += ')'; _.indent = prevIndent; _.js += adoptionPrefix($body); StmtGen[$body.type]($body, Preset.s4(bodySemicolonOptional)); } }; function generateStatement ($stmt, option) { StmtGen[$stmt.type]($stmt, option); } //CodeGen //----------------------------------------------------------------------------------- function exprToJs ($expr, settings, $parent) { var savedJs = _.js; _.js = ''; ExprGen[$expr.type]($expr, settings, $parent); var src = _.js; _.js = savedJs; return src; } function stmtToJs ($stmt, settings) { var savedJs = _.js; _.js = ''; StmtGen[$stmt.type]($stmt, settings); var src = _.js; _.js = savedJs; return src; } function run ($node) { _.js = ''; if (StmtGen[$node.type]) StmtGen[$node.type]($node, Preset.s7); else ExprGen[$node.type]($node, Preset.e19); return _.js; } function wrapExprGen (gen) { return function ($expr, settings) { if (extra.verbatim && $expr.hasOwnProperty(extra.verbatim)) generateVerbatim($expr, settings); else gen($expr, settings); } } function createExprGenWithExtras () { var gens = {}; for (var key in ExprRawGen) { if (ExprRawGen.hasOwnProperty(key)) gens[key] = wrapExprGen(ExprRawGen[key]); } return gens; } //Strings var _ = { js: '', newline: '\n', optSpace: ' ', space: ' ', indentUnit: ' ', indent: '' }; //Generators var ExprGen = void 0, StmtGen = StmtRawGen; exports.generate = function ($node, options) { var defaultOptions = getDefaultOptions(), result, pair; if (options != null) { //NOTE: Obsolete options // // `options.indent` // `options.base` // // Instead of them, we can use `option.format.indent`. if (typeof options.indent === 'string') { defaultOptions.format.indent.style = options.indent; } if (typeof options.base === 'number') { defaultOptions.format.indent.base = options.base; } options = updateDeeply(defaultOptions, options); _.indentUnit = options.format.indent.style; if (typeof options.base === 'string') { _.indent = options.base; } else { _.indent = stringRepeat(_.indentUnit, options.format.indent.base); } } else { options = defaultOptions; _.indentUnit = options.format.indent.style; _.indent = stringRepeat(_.indentUnit, options.format.indent.base); } json = options.format.json; renumber = options.format.renumber; hexadecimal = json ? false : options.format.hexadecimal; quotes = json ? 'double' : options.format.quotes; escapeless = options.format.escapeless; _.newline = options.format.newline; _.optSpace = options.format.space; if (options.format.compact) _.newline = _.optSpace = _.indentUnit = _.indent = ''; _.space = _.optSpace ? _.optSpace : ' '; parentheses = options.format.parentheses; semicolons = options.format.semicolons; safeConcatenation = options.format.safeConcatenation; directive = options.directive; parse = json ? null : options.parse; extra = options; if (extra.verbatim) ExprGen = createExprGenWithExtras(); else ExprGen = ExprRawGen; return run($node); }; /***/ }), /* 24 */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "request": () => (/* binding */ request), /* harmony export */ "response": () => (/* binding */ response) /* harmony export */ }); /* harmony import */ var _url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20); function request(headers, requestURL) { headers["host"] = requestURL.host; return headers; } function response(headers, requestURL) { ["Cache-Control", "Content-Security-Policy", "Content-Security-Policy-Report-Only", /* "Content-Encoding", "Content-Length", */ "Cross-Origin-Opener-Policy", "Cross-Origin-Opener-Policy-Report-Only", "Report-To", "Strict-Transport-Security", "X-Content-Type-Options", "X-Frame-Options", "Access-Control-Allow-Origin"].forEach((header) => { delete headers[header]; delete headers[header.toLowerCase()]; }); headers["Location"] = (0,_url__WEBPACK_IMPORTED_MODULE_0__["default"])(headers["Location"] || headers["location"]); return headers; } /***/ }), /* 25 */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ rewriteHTML), /* harmony export */ "rewriteSrcset": () => (/* binding */ rewriteSrcset) /* harmony export */ }); /* harmony import */ var parse5__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26); /* harmony import */ var _url__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(20); /* harmony import */ var _css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(19); /* harmony import */ var _js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(21); function rewriteHTML(html, origin) { return (0,parse5__WEBPACK_IMPORTED_MODULE_0__.serialize)(rewriteNode((0,parse5__WEBPACK_IMPORTED_MODULE_0__.parse)(html), origin)); } function rewriteNode(node, origin) { if (node.tagName) { switch (node.tagName.toLowerCase()) { case "a": for (let i in node.attrs) { if (node.attrs[i].name === "href") { node.attrs.push({ name: "data-href", value: node.attrs[i].value }); node.attrs[i].value = (0,_url__WEBPACK_IMPORTED_MODULE_1__["default"])(node.attrs[i].value, origin); } } break; case "script": let src = false; for (let i in node.attrs) { if (node.attrs[i].name === "src") { node.attrs.push({ name: "data-src", value: node.attrs[i].value }); node.attrs[i].value = (0,_url__WEBPACK_IMPORTED_MODULE_1__["default"])(node.attrs[i].value, origin); src = true; } else if (node.attrs[i].name === "integrity") { node.attrs.push({ name: "data-integrity", value: node.attrs[i].value }); node.attrs[i].value = ""; } else if (node.attrs[i].name === "nonce") { node.attrs.push({ name: "data-nonce", value: node.attrs[i].value }); node.attrs[i].value = ""; } } if (!src) { for (let i in node.childNodes) { node.childNodes[i].value = (0,_js__WEBPACK_IMPORTED_MODULE_3__["default"])(node.childNodes[i].value); } } break; case "style": for (let i in node.attrs) { if (node.attrs[i].name === "integrity") { node.attrs.push({ name: "data-integrity", value: node.attrs[i].value }); node.attrs[i].value = ""; } else if (node.attrs[i].name === "nonce") { node.attrs.push({ name: "data-nonce", value: node.attrs[i].value }); node.attrs[i].value = ""; } } for (let i in node.childNodes) { node.childNodes[i].value = (0,_css__WEBPACK_IMPORTED_MODULE_2__["default"])(node.childNodes[i].value, origin); } break; case "link": for (let i in node.attrs) { if (node.attrs[i].name === "href") { node.attrs.push({ name: "data-href", value: node.attrs[i].value }); node.attrs[i].value = (0,_url__WEBPACK_IMPORTED_MODULE_1__["default"])(node.attrs[i].value, origin); } else if (node.attrs[i].name === "integrity") { node.attrs.push({ name: "data-integrity", value: node.attrs[i].value }); node.attrs[i].value = ""; } else if (node.attrs[i].name === "nonce") { node.attrs.push({ name: "data-nonce", value: node.attrs[i].value }); node.attrs[i].value = ""; } } break; case "img": for (let i in node.attrs) { if (node.attrs[i].name === "src") { node.attrs.push({ name: "data-src", value: node.attrs[i].value }); node.attrs[i].value = (0,_url__WEBPACK_IMPORTED_MODULE_1__["default"])(node.attrs[i].value, origin); } else if (node.attrs[i].name === "srcset") { node.attrs.push({ name: "data-srcset", value: node.attrs[i].value }); node.attrs[i].value = rewriteSrcset(node.attrs[i].value, origin); } } break; case "source": for (let i in node.attrs) { if (node.attrs[i].name === "src") { node.attrs.push({ name: "data-src", value: node.attrs[i].value }); node.attrs[i].value = (0,_url__WEBPACK_IMPORTED_MODULE_1__["default"])(node.attrs[i].value, origin); } else if (node.attrs[i].name === "srcset") { node.attrs.push({ name: "data-srcset", value: node.attrs[i].value }); node.attrs[i].value = rewriteSrcset(node.attrs[i].value, origin); } } break; case "form": for (let i in node.attrs) { if (node.attrs[i].name === "action") { node.attrs.push({ name: "data-action", value: node.attrs[i].value }); node.attrs[i].value = (0,_url__WEBPACK_IMPORTED_MODULE_1__["default"])(node.attrs[i].value, origin); } } break; case "iframe": for (let i in node.attrs) { if (node.attrs[i].name === "src") { node.attrs.push({ name: "data-src", value: node.attrs[i].value }); node.attrs[i].value = (0,_url__WEBPACK_IMPORTED_MODULE_1__["default"])(node.attrs[i].value, origin); } } break; case "meta": for (let i in node.attrs) { if (node.attrs[i].name === "http-equiv") { if (node.attrs[i].value === "Content-Security-Policy") { node.attrs.push({ name: "data-Content-Security-Policy", value: node.attrs[i].value }); node.attrs[i].value = "*"; } for (let i in node.attrs) { if (node.attrs[i].name === "content") { node.attrs.push({ name: "data-content", value: node.attrs[i].value }); node.attrs[i].value = ""; } } } } } } if (node.childNodes) { for (let childNode in node.childNodes) { childNode = rewriteNode(node.childNodes[childNode], origin); } } return node; } function rewriteSrcset(value, origin) { const urls = value.split(/ [0-9]+x,? ?/g); if (!urls) return ""; const sufixes = value.match(/ [0-9]+x,? ?/g); if (!sufixes) return ""; const rewrittenUrls = urls.map((url, i) => { if (url && sufixes[i]) return (0,_url__WEBPACK_IMPORTED_MODULE_1__["default"])(url, origin) + sufixes[i]; }); return rewrittenUrls.join(""); } /***/ }), /* 26 */ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Parser": () => (/* reexport safe */ _parser_index_js__WEBPACK_IMPORTED_MODULE_0__.Parser), /* harmony export */ "Token": () => (/* reexport module object */ _common_token_js__WEBPACK_IMPORTED_MODULE_5__), /* harmony export */ "Tokenizer": () => (/* reexport safe */ _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_6__.Tokenizer), /* harmony export */ "TokenizerMode": () => (/* reexport safe */ _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_6__.TokenizerMode), /* harmony export */ "defaultTreeAdapter": () => (/* reexport safe */ _tree_adapters_default_js__WEBPACK_IMPORTED_MODULE_1__.defaultTreeAdapter), /* harmony export */ "foreignContent": () => (/* reexport module object */ _common_foreign_content_js__WEBPACK_IMPORTED_MODULE_3__), /* harmony export */ "html": () => (/* reexport module object */ _common_html_js__WEBPACK_IMPORTED_MODULE_4__), /* harmony export */ "parse": () => (/* binding */ parse), /* harmony export */ "parseFragment": () => (/* binding */ parseFragment), /* harmony export */ "serialize": () => (/* reexport safe */ _serializer_index_js__WEBPACK_IMPORTED_MODULE_2__.serialize), /* harmony export */ "serializeOuter": () => (/* reexport safe */ _serializer_index_js__WEBPACK_IMPORTED_MODULE_2__.serializeOuter) /* harmony export */ }); /* harmony import */ var _parser_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27); /* harmony import */ var _tree_adapters_default_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(40); /* harmony import */ var _serializer_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(43); /* harmony import */ var _common_foreign_content_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(42); /* harmony import */ var _common_html_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(37); /* harmony import */ var _common_token_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(32); /* harmony import */ var _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(28); /** @internal */ /** @internal */ /** @internal */ /** @internal */ // Shorthands /** * Parses an HTML string. * * @param html Input HTML string. * @param options Parsing options. * @returns Document * * @example * * ```js * const parse5 = require('parse5'); * * const document = parse5.parse('Hi there!'); * * console.log(document.childNodes[1].tagName); //> 'html' *``` */ function parse(html, options) { return _parser_index_js__WEBPACK_IMPORTED_MODULE_0__.Parser.parse(html, options); } function parseFragment(fragmentContext, html, options) { if (typeof fragmentContext === 'string') { options = html; html = fragmentContext; fragmentContext = null; } const parser = _parser_index_js__WEBPACK_IMPORTED_MODULE_0__.Parser.getFragmentParser(fragmentContext, options); parser.tokenizer.write(html, true); return parser.getFragment(); } //# sourceMappingURL=index.js.map /***/ }), /* 27 */ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "Parser": () => (/* binding */ Parser) /* harmony export */ }); /* harmony import */ var _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(28); /* harmony import */ var _open_element_stack_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(38); /* harmony import */ var _formatting_element_list_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(39); /* harmony import */ var _tree_adapters_default_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(40); /* harmony import */ var _common_doctype_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(41); /* harmony import */ var _common_foreign_content_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(42); /* harmony import */ var _common_error_codes_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(31); /* harmony import */ var _common_unicode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(30); /* harmony import */ var _common_html_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(37); /* harmony import */ var _common_token_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(32); //Misc constants const HIDDEN_INPUT_TYPE = 'hidden'; //Adoption agency loops iteration count const AA_OUTER_LOOP_ITER = 8; const AA_INNER_LOOP_ITER = 3; //Insertion modes var InsertionMode; (function (InsertionMode) { InsertionMode[InsertionMode["INITIAL"] = 0] = "INITIAL"; InsertionMode[InsertionMode["BEFORE_HTML"] = 1] = "BEFORE_HTML"; InsertionMode[InsertionMode["BEFORE_HEAD"] = 2] = "BEFORE_HEAD"; InsertionMode[InsertionMode["IN_HEAD"] = 3] = "IN_HEAD"; InsertionMode[InsertionMode["IN_HEAD_NO_SCRIPT"] = 4] = "IN_HEAD_NO_SCRIPT"; InsertionMode[InsertionMode["AFTER_HEAD"] = 5] = "AFTER_HEAD"; InsertionMode[InsertionMode["IN_BODY"] = 6] = "IN_BODY"; InsertionMode[InsertionMode["TEXT"] = 7] = "TEXT"; InsertionMode[InsertionMode["IN_TABLE"] = 8] = "IN_TABLE"; InsertionMode[InsertionMode["IN_TABLE_TEXT"] = 9] = "IN_TABLE_TEXT"; InsertionMode[InsertionMode["IN_CAPTION"] = 10] = "IN_CAPTION"; InsertionMode[InsertionMode["IN_COLUMN_GROUP"] = 11] = "IN_COLUMN_GROUP"; InsertionMode[InsertionMode["IN_TABLE_BODY"] = 12] = "IN_TABLE_BODY"; InsertionMode[InsertionMode["IN_ROW"] = 13] = "IN_ROW"; InsertionMode[InsertionMode["IN_CELL"] = 14] = "IN_CELL"; InsertionMode[InsertionMode["IN_SELECT"] = 15] = "IN_SELECT"; InsertionMode[InsertionMode["IN_SELECT_IN_TABLE"] = 16] = "IN_SELECT_IN_TABLE"; InsertionMode[InsertionMode["IN_TEMPLATE"] = 17] = "IN_TEMPLATE"; InsertionMode[InsertionMode["AFTER_BODY"] = 18] = "AFTER_BODY"; InsertionMode[InsertionMode["IN_FRAMESET"] = 19] = "IN_FRAMESET"; InsertionMode[InsertionMode["AFTER_FRAMESET"] = 20] = "AFTER_FRAMESET"; InsertionMode[InsertionMode["AFTER_AFTER_BODY"] = 21] = "AFTER_AFTER_BODY"; InsertionMode[InsertionMode["AFTER_AFTER_FRAMESET"] = 22] = "AFTER_AFTER_FRAMESET"; })(InsertionMode || (InsertionMode = {})); const BASE_LOC = { startLine: -1, startCol: -1, startOffset: -1, endLine: -1, endCol: -1, endOffset: -1, }; const TABLE_STRUCTURE_TAGS = new Set([_common_html_js__WEBPACK_IMPORTED_MODULE_8__.TAG_ID.TABLE, _common_html_js__WEBPACK_IMPORTED_MODULE_8__.TAG_ID.TBODY, _common_html_js__WEBPACK_IMPORTED_MODULE_8__.TAG_ID.TFOOT, _common_html_js__WEBPACK_IMPORTED_MODULE_8__.TAG_ID.THEAD, _common_html_js__WEBPACK_IMPORTED_MODULE_8__.TAG_ID.TR]); const defaultParserOptions = { scriptingEnabled: true, sourceCodeLocationInfo: false, treeAdapter: _tree_adapters_default_js__WEBPACK_IMPORTED_MODULE_3__.defaultTreeAdapter, onParseError: null, }; //Parser class Parser { constructor(options, document, fragmentContext = null, scriptHandler = null) { this.fragmentContext = fragmentContext; this.scriptHandler = scriptHandler; this.currentToken = null; this.stopped = false; this.insertionMode = InsertionMode.INITIAL; this.originalInsertionMode = InsertionMode.INITIAL; this.headElement = null; this.formElement = null; /** Indicates that the current node is not an element in the HTML namespace */ this.currentNotInHTML = false; /** * The template insertion mode stack is maintained from the left. * Ie. the topmost element will always have index 0. */ this.tmplInsertionModeStack = []; this.pendingCharacterTokens = []; this.hasNonWhitespacePendingCharacterToken = false; this.framesetOk = true; this.skipNextNewLine = false; this.fosterParentingEnabled = false; this.options = { ...defaultParserOptions, ...options, }; this.treeAdapter = this.options.treeAdapter; this.onParseError = this.options.onParseError; // Always enable location info if we report parse errors. if (this.onParseError) { this.options.sourceCodeLocationInfo = true; } this.document = document !== null && document !== void 0 ? document : this.treeAdapter.createDocument(); this.tokenizer = new _tokenizer_index_js__WEBPACK_IMPORTED_MODULE_0__.Tokenizer(this.options, this); this.activeFormattingElements = new _formatting_element_list_js__WEBPACK_IMPORTED_MODULE_2__.FormattingElementList(this.treeAdapter); this.fragmentContextID = fragmentContext ? (0,_common_html_js__WEBPACK_IMPORTED_MODULE_8__.getTagID)(this.treeAdapter.getTagName(fragmentContext)) : _common_html_js__WEBPACK_IMPORTED_MODULE_8__.TAG_ID.UNKNOWN; this._setContextModes(fragmentContext !== null && fragmentContext !== void 0 ? fragmentContext : this.document, this.fragmentContextID); this.openElements = new _open_element_stack_js__WEBPACK_IMPORTED_MODULE_1__.OpenElementStack(this.document, this.treeAdapter, this); } // API static parse(html, options) { const parser = new this(options); parser.tokenizer.write(html, true); return parser.document; } static getFragmentParser(fragmentContext, options) { const opts = { ...defaultParserOptions, ...options, }; //NOTE: use a