@modern-js/module-tools 2.20.0 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/bin/modern.js +0 -1
- package/compiled/postcss-flexbugs-fixes/index.js +1 -1
- package/compiled/postcss-font-variant/index.js +1 -1
- package/compiled/postcss-initial/index.js +1 -1
- package/compiled/postcss-media-minmax/index.js +1 -1
- package/compiled/postcss-nesting/index.js +1 -1
- package/compiled/postcss-page-break/index.js +1 -1
- package/compiled/rollup-plugin-dts/index.js +1 -1
- package/dist/cli.js +7 -2
- package/dist/cli.js.map +1 -1
- package/dist/config/defineConfig.d.ts +0 -1
- package/dist/config/transformLegacyConfig.d.ts +0 -2
- package/dist/constants/buildPresets.d.ts +8 -8
- package/dist/plugins.d.ts +1 -1
- package/dist/types/config/index.d.ts +0 -1
- package/dist/types/legacyConfig/output.d.ts +1 -5
- package/dist/types/legacyConfig/source.d.ts +0 -1
- package/dist/types/legacyConfig/tools.d.ts +0 -4
- package/dist/types/utils.d.ts +0 -2
- package/dist/utils/dts.js.map +1 -1
- package/dist/utils/tspathsTransform.js +4 -4
- package/dist/utils/tspathsTransform.js.map +1 -1
- package/package.json +21 -15
- package/compiled/@babel/code-frame/index.d.ts +0 -1
- package/compiled/@babel/code-frame/index.js +0 -1
- package/compiled/@babel/code-frame/license +0 -22
- package/compiled/@babel/code-frame/package.json +0 -1
- package/compiled/@babel/generator/index.d.ts +0 -1
- package/compiled/@babel/generator/index.js +0 -1
- package/compiled/@babel/generator/license +0 -22
- package/compiled/@babel/generator/package.json +0 -1
- package/compiled/@babel/helper-validator-identifier/index.d.ts +0 -1
- package/compiled/@babel/helper-validator-identifier/index.js +0 -1
- package/compiled/@babel/helper-validator-identifier/license +0 -22
- package/compiled/@babel/helper-validator-identifier/package.json +0 -1
- package/compiled/@babel/highlight/index.d.ts +0 -1
- package/compiled/@babel/highlight/index.js +0 -1
- package/compiled/@babel/highlight/license +0 -22
- package/compiled/@babel/highlight/package.json +0 -1
- package/compiled/@babel/parser/@babel/types/lib/index-legacy.d.ts +0 -2742
- package/compiled/@babel/parser/index.js +0 -1
- package/compiled/@babel/parser/license +0 -19
- package/compiled/@babel/parser/package.json +0 -1
- package/compiled/@babel/parser/typings/babel-parser.d.ts +0 -214
- package/compiled/@babel/template/index.d.ts +0 -1
- package/compiled/@babel/template/index.js +0 -1
- package/compiled/@babel/template/license +0 -22
- package/compiled/@babel/template/package.json +0 -1
- package/compiled/@babel/traverse/index.d.ts +0 -1199
- package/compiled/@babel/traverse/index.js +0 -1
- package/compiled/@babel/traverse/license +0 -22
- package/compiled/@babel/traverse/package.json +0 -1
- package/compiled/@babel/types/index.js +0 -1
- package/compiled/@babel/types/lib/index-legacy.d.ts +0 -2732
- package/compiled/@babel/types/license +0 -22
- package/compiled/@babel/types/package.json +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var e={};(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:true});function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var s={};var i=Object.keys(e);var r,a;for(a=0;a<i.length;a++){r=i[a];if(t.indexOf(r)>=0)continue;s[r]=e[r]}return s}class Position{constructor(e,t,s){this.line=void 0;this.column=void 0;this.index=void 0;this.line=e;this.column=t;this.index=s}}class SourceLocation{constructor(e,t){this.start=void 0;this.end=void 0;this.filename=void 0;this.identifierName=void 0;this.start=e;this.end=t}}function createPositionWithColumnOffset(e,t){const{line:s,column:i,index:r}=e;return new Position(s,i+t,r+t)}const s=Object.freeze({SyntaxError:"BABEL_PARSER_SYNTAX_ERROR",SourceTypeModuleError:"BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED"});const reflect=(e,t=e.length-1)=>({get(){return e.reduce(((e,t)=>e[t]),this)},set(s){e.reduce(((e,i,r)=>r===t?e[i]=s:e[i]),this)}});const instantiate=(e,t,s)=>Object.keys(s).map((e=>[e,s[e]])).filter((([,e])=>!!e)).map((([e,t])=>[e,typeof t==="function"?{value:t,enumerable:false}:typeof t.reflect==="string"?Object.assign({},t,reflect(t.reflect.split("."))):t])).reduce(((e,[t,s])=>Object.defineProperty(e,t,Object.assign({configurable:true},s))),Object.assign(new e,t));var ModuleErrors=e=>({ImportMetaOutsideModule:e(`import.meta may appear only with 'sourceType: "module"'`,{code:s.SourceTypeModuleError}),ImportOutsideModule:e(`'import' and 'export' may appear only with 'sourceType: "module"'`,{code:s.SourceTypeModuleError})});const i={ArrayPattern:"array destructuring pattern",AssignmentExpression:"assignment expression",AssignmentPattern:"assignment expression",ArrowFunctionExpression:"arrow function expression",ConditionalExpression:"conditional expression",ForOfStatement:"for-of statement",ForInStatement:"for-in statement",ForStatement:"for-loop",FormalParameters:"function parameter list",Identifier:"identifier",ObjectPattern:"object destructuring pattern",ParenthesizedExpression:"parenthesized expression",RestElement:"rest element",UpdateExpression:{true:"prefix operation",false:"postfix operation"},VariableDeclarator:"variable declaration",YieldExpression:"yield expression"};const toNodeDescription=({type:e,prefix:t})=>e==="UpdateExpression"?i.UpdateExpression[String(t)]:i[e];var StandardErrors=e=>({AccessorIsGenerator:e((({kind:e})=>`A ${e}ter cannot be a generator.`)),ArgumentsInClass:e("'arguments' is only allowed in functions and class methods."),AsyncFunctionInSingleStatementContext:e("Async functions can only be declared at the top level or inside a block."),AwaitBindingIdentifier:e("Can not use 'await' as identifier inside an async function."),AwaitBindingIdentifierInStaticBlock:e("Can not use 'await' as identifier inside a static block."),AwaitExpressionFormalParameter:e("'await' is not allowed in async function parameters."),AwaitNotInAsyncContext:e("'await' is only allowed within async functions and at the top levels of modules."),AwaitNotInAsyncFunction:e("'await' is only allowed within async functions."),BadGetterArity:e("A 'get' accesor must not have any formal parameters."),BadSetterArity:e("A 'set' accesor must have exactly one formal parameter."),BadSetterRestParameter:e("A 'set' accesor function argument must not be a rest parameter."),ConstructorClassField:e("Classes may not have a field named 'constructor'."),ConstructorClassPrivateField:e("Classes may not have a private field named '#constructor'."),ConstructorIsAccessor:e("Class constructor may not be an accessor."),ConstructorIsAsync:e("Constructor can't be an async function."),ConstructorIsGenerator:e("Constructor can't be a generator."),DeclarationMissingInitializer:e((({kind:e})=>`Missing initializer in ${e} declaration.`)),DecoratorBeforeExport:e("Decorators must be placed *before* the 'export' keyword. You can set the 'decoratorsBeforeExport' option to false to use the 'export @decorator class {}' syntax."),DecoratorConstructor:e("Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?"),DecoratorExportClass:e("Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead."),DecoratorSemicolon:e("Decorators must not be followed by a semicolon."),DecoratorStaticBlock:e("Decorators can't be used with a static block."),DeletePrivateField:e("Deleting a private field is not allowed."),DestructureNamedImport:e("ES2015 named imports do not destructure. Use another statement for destructuring after the import."),DuplicateConstructor:e("Duplicate constructor in the same class."),DuplicateDefaultExport:e("Only one default export allowed per module."),DuplicateExport:e((({exportName:e})=>`\`${e}\` has already been exported. Exported identifiers must be unique.`)),DuplicateProto:e("Redefinition of __proto__ property."),DuplicateRegExpFlags:e("Duplicate regular expression flag."),ElementAfterRest:e("Rest element must be last element."),EscapedCharNotAnIdentifier:e("Invalid Unicode escape."),ExportBindingIsString:e((({localName:e,exportName:t})=>`A string literal cannot be used as an exported binding without \`from\`.\n- Did you mean \`export { '${e}' as '${t}' } from 'some-module'\`?`)),ExportDefaultFromAsIdentifier:e("'from' is not allowed as an identifier after 'export default'."),ForInOfLoopInitializer:e((({type:e})=>`'${e==="ForInStatement"?"for-in":"for-of"}' loop variable declaration may not have an initializer.`)),ForOfAsync:e("The left-hand side of a for-of loop may not be 'async'."),ForOfLet:e("The left-hand side of a for-of loop may not start with 'let'."),GeneratorInSingleStatementContext:e("Generators can only be declared at the top level or inside a block."),IllegalBreakContinue:e((({type:e})=>`Unsyntactic ${e==="BreakStatement"?"break":"continue"}.`)),IllegalLanguageModeDirective:e("Illegal 'use strict' directive in function with non-simple parameter list."),IllegalReturn:e("'return' outside of function."),ImportBindingIsString:e((({importName:e})=>`A string literal cannot be used as an imported binding.\n- Did you mean \`import { "${e}" as foo }\`?`)),ImportCallArgumentTrailingComma:e("Trailing comma is disallowed inside import(...) arguments."),ImportCallArity:e((({maxArgumentCount:e})=>`\`import()\` requires exactly ${e===1?"one argument":"one or two arguments"}.`)),ImportCallNotNewExpression:e("Cannot use new with import(...)."),ImportCallSpreadArgument:e("`...` is not allowed in `import()`."),IncompatibleRegExpUVFlags:e("The 'u' and 'v' regular expression flags cannot be enabled at the same time."),InvalidBigIntLiteral:e("Invalid BigIntLiteral."),InvalidCodePoint:e("Code point out of bounds."),InvalidCoverInitializedName:e("Invalid shorthand property initializer."),InvalidDecimal:e("Invalid decimal."),InvalidDigit:e((({radix:e})=>`Expected number in radix ${e}.`)),InvalidEscapeSequence:e("Bad character escape sequence."),InvalidEscapeSequenceTemplate:e("Invalid escape sequence in template."),InvalidEscapedReservedWord:e((({reservedWord:e})=>`Escape sequence in keyword ${e}.`)),InvalidIdentifier:e((({identifierName:e})=>`Invalid identifier ${e}.`)),InvalidLhs:e((({ancestor:e})=>`Invalid left-hand side in ${toNodeDescription(e)}.`)),InvalidLhsBinding:e((({ancestor:e})=>`Binding invalid left-hand side in ${toNodeDescription(e)}.`)),InvalidNumber:e("Invalid number."),InvalidOrMissingExponent:e("Floating-point numbers require a valid exponent after the 'e'."),InvalidOrUnexpectedToken:e((({unexpected:e})=>`Unexpected character '${e}'.`)),InvalidParenthesizedAssignment:e("Invalid parenthesized assignment pattern."),InvalidPrivateFieldResolution:e((({identifierName:e})=>`Private name #${e} is not defined.`)),InvalidPropertyBindingPattern:e("Binding member expression."),InvalidRecordProperty:e("Only properties and spread elements are allowed in record definitions."),InvalidRestAssignmentPattern:e("Invalid rest operator's argument."),LabelRedeclaration:e((({labelName:e})=>`Label '${e}' is already declared.`)),LetInLexicalBinding:e("'let' is not allowed to be used as a name in 'let' or 'const' declarations."),LineTerminatorBeforeArrow:e("No line break is allowed before '=>'."),MalformedRegExpFlags:e("Invalid regular expression flag."),MissingClassName:e("A class name is required."),MissingEqInAssignment:e("Only '=' operator can be used for specifying default value."),MissingSemicolon:e("Missing semicolon."),MissingPlugin:e((({missingPlugin:e})=>`This experimental syntax requires enabling the parser plugin: ${e.map((e=>JSON.stringify(e))).join(", ")}.`)),MissingOneOfPlugins:e((({missingPlugin:e})=>`This experimental syntax requires enabling one of the following parser plugin(s): ${e.map((e=>JSON.stringify(e))).join(", ")}.`)),MissingUnicodeEscape:e("Expecting Unicode escape sequence \\uXXXX."),MixingCoalesceWithLogical:e("Nullish coalescing operator(??) requires parens when mixing with logical operators."),ModuleAttributeDifferentFromType:e("The only accepted module attribute is `type`."),ModuleAttributeInvalidValue:e("Only string literals are allowed as module attribute values."),ModuleAttributesWithDuplicateKeys:e((({key:e})=>`Duplicate key "${e}" is not allowed in module attributes.`)),ModuleExportNameHasLoneSurrogate:e((({surrogateCharCode:e})=>`An export name cannot include a lone surrogate, found '\\u${e.toString(16)}'.`)),ModuleExportUndefined:e((({localName:e})=>`Export '${e}' is not defined.`)),MultipleDefaultsInSwitch:e("Multiple default clauses."),NewlineAfterThrow:e("Illegal newline after throw."),NoCatchOrFinally:e("Missing catch or finally clause."),NumberIdentifier:e("Identifier directly after number."),NumericSeparatorInEscapeSequence:e("Numeric separators are not allowed inside unicode escape sequences or hex escape sequences."),ObsoleteAwaitStar:e("'await*' has been removed from the async functions proposal. Use Promise.all() instead."),OptionalChainingNoNew:e("Constructors in/after an Optional Chain are not allowed."),OptionalChainingNoTemplate:e("Tagged Template Literals are not allowed in optionalChain."),OverrideOnConstructor:e("'override' modifier cannot appear on a constructor declaration."),ParamDupe:e("Argument name clash."),PatternHasAccessor:e("Object pattern can't contain getter or setter."),PatternHasMethod:e("Object pattern can't contain methods."),PrivateInExpectedIn:e((({identifierName:e})=>`Private names are only allowed in property accesses (\`obj.#${e}\`) or in \`in\` expressions (\`#${e} in obj\`).`)),PrivateNameRedeclaration:e((({identifierName:e})=>`Duplicate private name #${e}.`)),RecordExpressionBarIncorrectEndSyntaxType:e("Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'."),RecordExpressionBarIncorrectStartSyntaxType:e("Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'."),RecordExpressionHashIncorrectStartSyntaxType:e("Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'."),RecordNoProto:e("'__proto__' is not allowed in Record expressions."),RestTrailingComma:e("Unexpected trailing comma after rest element."),SloppyFunction:e("In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement."),StaticPrototype:e("Classes may not have static property named prototype."),SuperNotAllowed:e("`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?"),SuperPrivateField:e("Private fields can't be accessed on super."),TrailingDecorator:e("Decorators must be attached to a class element."),TupleExpressionBarIncorrectEndSyntaxType:e("Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'."),TupleExpressionBarIncorrectStartSyntaxType:e("Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'."),TupleExpressionHashIncorrectStartSyntaxType:e("Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'."),UnexpectedArgumentPlaceholder:e("Unexpected argument placeholder."),UnexpectedAwaitAfterPipelineBody:e('Unexpected "await" after pipeline body; await must have parentheses in minimal proposal.'),UnexpectedDigitAfterHash:e("Unexpected digit after hash token."),UnexpectedImportExport:e("'import' and 'export' may only appear at the top level."),UnexpectedKeyword:e((({keyword:e})=>`Unexpected keyword '${e}'.`)),UnexpectedLeadingDecorator:e("Leading decorators must be attached to a class declaration."),UnexpectedLexicalDeclaration:e("Lexical declaration cannot appear in a single-statement context."),UnexpectedNewTarget:e("`new.target` can only be used in functions or class properties."),UnexpectedNumericSeparator:e("A numeric separator is only allowed between two digits."),UnexpectedPrivateField:e("Unexpected private name."),UnexpectedReservedWord:e((({reservedWord:e})=>`Unexpected reserved word '${e}'.`)),UnexpectedSuper:e("'super' is only allowed in object methods and classes."),UnexpectedToken:e((({expected:e,unexpected:t})=>`Unexpected token${t?` '${t}'.`:""}${e?`, expected "${e}"`:""}`)),UnexpectedTokenUnaryExponentiation:e("Illegal expression. Wrap left hand side or entire exponentiation in parentheses."),UnsupportedBind:e("Binding should be performed on object property."),UnsupportedDecoratorExport:e("A decorated export must export a class declaration."),UnsupportedDefaultExport:e("Only expressions, functions or classes are allowed as the `default` export."),UnsupportedImport:e("`import` can only be used in `import()` or `import.meta`."),UnsupportedMetaProperty:e((({target:e,onlyValidPropertyName:t})=>`The only valid meta property for ${e} is ${e}.${t}.`)),UnsupportedParameterDecorator:e("Decorators cannot be used to decorate parameters."),UnsupportedPropertyDecorator:e("Decorators cannot be used to decorate object literal properties."),UnsupportedSuper:e("'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop])."),UnterminatedComment:e("Unterminated comment."),UnterminatedRegExp:e("Unterminated regular expression."),UnterminatedString:e("Unterminated string constant."),UnterminatedTemplate:e("Unterminated template."),VarRedeclaration:e((({identifierName:e})=>`Identifier '${e}' has already been declared.`)),YieldBindingIdentifier:e("Can not use 'yield' as identifier inside a generator."),YieldInParameter:e("Yield expression is not allowed in formal parameters."),ZeroDigitNumericSeparator:e("Numeric separator can not be used after leading 0.")});var StrictModeErrors=e=>({StrictDelete:e("Deleting local variable in strict mode."),StrictEvalArguments:e((({referenceName:e})=>`Assigning to '${e}' in strict mode.`)),StrictEvalArgumentsBinding:e((({bindingName:e})=>`Binding '${e}' in strict mode.`)),StrictFunction:e("In strict mode code, functions can only be declared at top level or inside a block."),StrictNumericEscape:e("The only valid numeric escape in strict mode is '\\0'."),StrictOctalLiteral:e("Legacy octal literals are not allowed in strict mode."),StrictWith:e("'with' in strict mode.")});const r=new Set(["ArrowFunctionExpression","AssignmentExpression","ConditionalExpression","YieldExpression"]);var PipelineOperatorErrors=e=>({PipeBodyIsTighter:e("Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence."),PipeTopicRequiresHackPipes:e('Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'),PipeTopicUnbound:e("Topic reference is unbound; it must be inside a pipe body."),PipeTopicUnconfiguredToken:e((({token:e})=>`Invalid topic token ${e}. In order to use ${e} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${e}" }.`)),PipeTopicUnused:e("Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once."),PipeUnparenthesizedBody:e((({type:e})=>`Hack-style pipe body cannot be an unparenthesized ${toNodeDescription({type:e})}; please wrap it in parentheses.`)),PipelineBodyNoArrow:e('Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized.'),PipelineBodySequenceExpression:e("Pipeline body may not be a comma-separated sequence expression."),PipelineHeadSequenceExpression:e("Pipeline head should not be a comma-separated sequence expression."),PipelineTopicUnused:e("Pipeline is in topic style but does not use topic reference."),PrimaryTopicNotAllowed:e("Topic reference was used in a lexical context without topic binding."),PrimaryTopicRequiresSmartPipeline:e('Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.')});const a=["toMessage"];function toParseErrorConstructor(e){let{toMessage:t}=e,s=_objectWithoutPropertiesLoose(e,a);return function constructor({loc:e,details:i}){return instantiate(SyntaxError,Object.assign({},s,{loc:e}),{clone(e={}){const t=e.loc||{};return constructor({loc:new Position("line"in t?t.line:this.loc.line,"column"in t?t.column:this.loc.column,"index"in t?t.index:this.loc.index),details:Object.assign({},this.details,e.details)})},details:{value:i,enumerable:false},message:{get(){return`${t(this.details)} (${this.loc.line}:${this.loc.column})`},set(e){Object.defineProperty(this,"message",{value:e})}},pos:{reflect:"loc.index",enumerable:true},missingPlugin:"missingPlugin"in i&&{reflect:"details.missingPlugin",enumerable:true}})}}function toParseErrorCredentials(e,t){return Object.assign({toMessage:typeof e==="string"?()=>e:e},t)}function ParseErrorEnum(e,t){if(Array.isArray(e)){return t=>ParseErrorEnum(t,e[0])}const i=e(toParseErrorCredentials);const r={};for(const e of Object.keys(i)){r[e]=toParseErrorConstructor(Object.assign({code:s.SyntaxError,reasonCode:e},t?{syntaxPlugin:t}:{},i[e]))}return r}const n=Object.assign({},ParseErrorEnum(ModuleErrors),ParseErrorEnum(StandardErrors),ParseErrorEnum(StrictModeErrors),ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors));const{defineProperty:o}=Object;const toUnenumerable=(e,t)=>o(e,t,{enumerable:false,value:e[t]});function toESTreeLocation(e){e.loc.start&&toUnenumerable(e.loc.start,"index");e.loc.end&&toUnenumerable(e.loc.end,"index");return e}var estree=e=>class extends e{parse(){const e=toESTreeLocation(super.parse());if(this.options.tokens){e.tokens=e.tokens.map(toESTreeLocation)}return e}parseRegExpLiteral({pattern:e,flags:t}){let s=null;try{s=new RegExp(e,t)}catch(e){}const i=this.estreeParseLiteral(s);i.regex={pattern:e,flags:t};return i}parseBigIntLiteral(e){let t;try{t=BigInt(e)}catch(e){t=null}const s=this.estreeParseLiteral(t);s.bigint=String(s.value||e);return s}parseDecimalLiteral(e){const t=null;const s=this.estreeParseLiteral(t);s.decimal=String(s.value||e);return s}estreeParseLiteral(e){return this.parseLiteral(e,"Literal")}parseStringLiteral(e){return this.estreeParseLiteral(e)}parseNumericLiteral(e){return this.estreeParseLiteral(e)}parseNullLiteral(){return this.estreeParseLiteral(null)}parseBooleanLiteral(e){return this.estreeParseLiteral(e)}directiveToStmt(e){const t=e.value;const s=this.startNodeAt(e.start,e.loc.start);const i=this.startNodeAt(t.start,t.loc.start);i.value=t.extra.expressionValue;i.raw=t.extra.raw;s.expression=this.finishNodeAt(i,"Literal",t.loc.end);s.directive=t.extra.raw.slice(1,-1);return this.finishNodeAt(s,"ExpressionStatement",e.loc.end)}initFunction(e,t){super.initFunction(e,t);e.expression=false}checkDeclaration(e){if(e!=null&&this.isObjectProperty(e)){this.checkDeclaration(e.value)}else{super.checkDeclaration(e)}}getObjectOrClassMethodParams(e){return e.value.params}isValidDirective(e){var t;return e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&typeof e.expression.value==="string"&&!((t=e.expression.extra)!=null&&t.parenthesized)}parseBlockBody(e,...t){super.parseBlockBody(e,...t);const s=e.directives.map((e=>this.directiveToStmt(e)));e.body=s.concat(e.body);delete e.directives}pushClassMethod(e,t,s,i,r,a){this.parseMethod(t,s,i,r,a,"ClassMethod",true);if(t.typeParameters){t.value.typeParameters=t.typeParameters;delete t.typeParameters}e.body.push(t)}parsePrivateName(){const e=super.parsePrivateName();{if(!this.getPluginOption("estree","classFeatures")){return e}}return this.convertPrivateNameToPrivateIdentifier(e)}convertPrivateNameToPrivateIdentifier(e){const t=super.getPrivateNameSV(e);e=e;delete e.id;e.name=t;e.type="PrivateIdentifier";return e}isPrivateName(e){{if(!this.getPluginOption("estree","classFeatures")){return super.isPrivateName(e)}}return e.type==="PrivateIdentifier"}getPrivateNameSV(e){{if(!this.getPluginOption("estree","classFeatures")){return super.getPrivateNameSV(e)}}return e.name}parseLiteral(e,t){const s=super.parseLiteral(e,t);s.raw=s.extra.raw;delete s.extra;return s}parseFunctionBody(e,t,s=false){super.parseFunctionBody(e,t,s);e.expression=e.body.type!=="BlockStatement"}parseMethod(e,t,s,i,r,a,n=false){let o=this.startNode();o.kind=e.kind;o=super.parseMethod(o,t,s,i,r,a,n);o.type="FunctionExpression";delete o.kind;e.value=o;if(a==="ClassPrivateMethod"){e.computed=false}a="MethodDefinition";return this.finishNode(e,a)}parseClassProperty(...e){const t=super.parseClassProperty(...e);{if(!this.getPluginOption("estree","classFeatures")){return t}}t.type="PropertyDefinition";return t}parseClassPrivateProperty(...e){const t=super.parseClassPrivateProperty(...e);{if(!this.getPluginOption("estree","classFeatures")){return t}}t.type="PropertyDefinition";t.computed=false;return t}parseObjectMethod(e,t,s,i,r){const a=super.parseObjectMethod(e,t,s,i,r);if(a){a.type="Property";if(a.kind==="method")a.kind="init";a.shorthand=false}return a}parseObjectProperty(e,t,s,i,r){const a=super.parseObjectProperty(e,t,s,i,r);if(a){a.kind="init";a.type="Property"}return a}isValidLVal(e,...t){return e==="Property"?"value":super.isValidLVal(e,...t)}isAssignable(e,t){if(e!=null&&this.isObjectProperty(e)){return this.isAssignable(e.value,t)}return super.isAssignable(e,t)}toAssignable(e,t=false){if(e!=null&&this.isObjectProperty(e)){const{key:s,value:i}=e;if(this.isPrivateName(s)){this.classScope.usePrivateName(this.getPrivateNameSV(s),s.loc.start)}this.toAssignable(i,t)}else{super.toAssignable(e,t)}}toAssignableObjectExpressionProp(e){if(e.kind==="get"||e.kind==="set"){this.raise(n.PatternHasAccessor,{at:e.key})}else if(e.method){this.raise(n.PatternHasMethod,{at:e.key})}else{super.toAssignableObjectExpressionProp(...arguments)}}finishCallExpression(e,t){super.finishCallExpression(e,t);if(e.callee.type==="Import"){e.type="ImportExpression";e.source=e.arguments[0];if(this.hasPlugin("importAssertions")){var s;e.attributes=(s=e.arguments[1])!=null?s:null}delete e.arguments;delete e.callee}return e}toReferencedArguments(e){if(e.type==="ImportExpression"){return}super.toReferencedArguments(e)}parseExport(e){super.parseExport(e);switch(e.type){case"ExportAllDeclaration":e.exported=null;break;case"ExportNamedDeclaration":if(e.specifiers.length===1&&e.specifiers[0].type==="ExportNamespaceSpecifier"){e.type="ExportAllDeclaration";e.exported=e.specifiers[0].exported;delete e.specifiers}break}return e}parseSubscript(e,t,s,i,r){const a=super.parseSubscript(e,t,s,i,r);if(r.optionalChainMember){if(a.type==="OptionalMemberExpression"||a.type==="OptionalCallExpression"){a.type=a.type.substring(8)}if(r.stop){const e=this.startNodeAtNode(a);e.expression=a;return this.finishNode(e,"ChainExpression")}}else if(a.type==="MemberExpression"||a.type==="CallExpression"){a.optional=false}return a}hasPropertyAsPrivateName(e){if(e.type==="ChainExpression"){e=e.expression}return super.hasPropertyAsPrivateName(e)}isOptionalChain(e){return e.type==="ChainExpression"}isObjectProperty(e){return e.type==="Property"&&e.kind==="init"&&!e.method}isObjectMethod(e){return e.method||e.kind==="get"||e.kind==="set"}finishNodeAt(e,t,s){return toESTreeLocation(super.finishNodeAt(e,t,s))}resetStartLocation(e,t,s){super.resetStartLocation(e,t,s);toESTreeLocation(e)}resetEndLocation(e,t=this.state.lastTokEndLoc){super.resetEndLocation(e,t);toESTreeLocation(e)}};class TokContext{constructor(e,t){this.token=void 0;this.preserveSpace=void 0;this.token=e;this.preserveSpace=!!t}}const h={brace:new TokContext("{"),j_oTag:new TokContext("<tag"),j_cTag:new TokContext("</tag"),j_expr:new TokContext("<tag>...</tag>",true)};{h.template=new TokContext("`",true)}const c=true;const p=true;const l=true;const u=true;const d=true;const f=true;class ExportedTokenType{constructor(e,t={}){this.label=void 0;this.keyword=void 0;this.beforeExpr=void 0;this.startsExpr=void 0;this.rightAssociative=void 0;this.isLoop=void 0;this.isAssign=void 0;this.prefix=void 0;this.postfix=void 0;this.binop=void 0;this.label=e;this.keyword=t.keyword;this.beforeExpr=!!t.beforeExpr;this.startsExpr=!!t.startsExpr;this.rightAssociative=!!t.rightAssociative;this.isLoop=!!t.isLoop;this.isAssign=!!t.isAssign;this.prefix=!!t.prefix;this.postfix=!!t.postfix;this.binop=t.binop!=null?t.binop:null;{this.updateContext=null}}}const m=new Map;function createKeyword(e,t={}){t.keyword=e;const s=createToken(e,t);m.set(e,s);return s}function createBinop(e,t){return createToken(e,{beforeExpr:c,binop:t})}let y=-1;const x=[];const P=[];const g=[];const T=[];const b=[];const w=[];function createToken(e,t={}){var s,i,r,a;++y;P.push(e);g.push((s=t.binop)!=null?s:-1);T.push((i=t.beforeExpr)!=null?i:false);b.push((r=t.startsExpr)!=null?r:false);w.push((a=t.prefix)!=null?a:false);x.push(new ExportedTokenType(e,t));return y}function createKeywordLike(e,t={}){var s,i,r,a;++y;m.set(e,y);P.push(e);g.push((s=t.binop)!=null?s:-1);T.push((i=t.beforeExpr)!=null?i:false);b.push((r=t.startsExpr)!=null?r:false);w.push((a=t.prefix)!=null?a:false);x.push(new ExportedTokenType("name",t));return y}const A={bracketL:createToken("[",{beforeExpr:c,startsExpr:p}),bracketHashL:createToken("#[",{beforeExpr:c,startsExpr:p}),bracketBarL:createToken("[|",{beforeExpr:c,startsExpr:p}),bracketR:createToken("]"),bracketBarR:createToken("|]"),braceL:createToken("{",{beforeExpr:c,startsExpr:p}),braceBarL:createToken("{|",{beforeExpr:c,startsExpr:p}),braceHashL:createToken("#{",{beforeExpr:c,startsExpr:p}),braceR:createToken("}"),braceBarR:createToken("|}"),parenL:createToken("(",{beforeExpr:c,startsExpr:p}),parenR:createToken(")"),comma:createToken(",",{beforeExpr:c}),semi:createToken(";",{beforeExpr:c}),colon:createToken(":",{beforeExpr:c}),doubleColon:createToken("::",{beforeExpr:c}),dot:createToken("."),question:createToken("?",{beforeExpr:c}),questionDot:createToken("?."),arrow:createToken("=>",{beforeExpr:c}),template:createToken("template"),ellipsis:createToken("...",{beforeExpr:c}),backQuote:createToken("`",{startsExpr:p}),dollarBraceL:createToken("${",{beforeExpr:c,startsExpr:p}),templateTail:createToken("...`",{startsExpr:p}),templateNonTail:createToken("...${",{beforeExpr:c,startsExpr:p}),at:createToken("@"),hash:createToken("#",{startsExpr:p}),interpreterDirective:createToken("#!..."),eq:createToken("=",{beforeExpr:c,isAssign:u}),assign:createToken("_=",{beforeExpr:c,isAssign:u}),slashAssign:createToken("_=",{beforeExpr:c,isAssign:u}),xorAssign:createToken("_=",{beforeExpr:c,isAssign:u}),moduloAssign:createToken("_=",{beforeExpr:c,isAssign:u}),incDec:createToken("++/--",{prefix:d,postfix:f,startsExpr:p}),bang:createToken("!",{beforeExpr:c,prefix:d,startsExpr:p}),tilde:createToken("~",{beforeExpr:c,prefix:d,startsExpr:p}),doubleCaret:createToken("^^",{startsExpr:p}),doubleAt:createToken("@@",{startsExpr:p}),pipeline:createBinop("|>",0),nullishCoalescing:createBinop("??",1),logicalOR:createBinop("||",1),logicalAND:createBinop("&&",2),bitwiseOR:createBinop("|",3),bitwiseXOR:createBinop("^",4),bitwiseAND:createBinop("&",5),equality:createBinop("==/!=/===/!==",6),lt:createBinop("</>/<=/>=",7),gt:createBinop("</>/<=/>=",7),relational:createBinop("</>/<=/>=",7),bitShift:createBinop("<</>>/>>>",8),bitShiftL:createBinop("<</>>/>>>",8),bitShiftR:createBinop("<</>>/>>>",8),plusMin:createToken("+/-",{beforeExpr:c,binop:9,prefix:d,startsExpr:p}),modulo:createToken("%",{binop:10,startsExpr:p}),star:createToken("*",{binop:10}),slash:createBinop("/",10),exponent:createToken("**",{beforeExpr:c,binop:11,rightAssociative:true}),_in:createKeyword("in",{beforeExpr:c,binop:7}),_instanceof:createKeyword("instanceof",{beforeExpr:c,binop:7}),_break:createKeyword("break"),_case:createKeyword("case",{beforeExpr:c}),_catch:createKeyword("catch"),_continue:createKeyword("continue"),_debugger:createKeyword("debugger"),_default:createKeyword("default",{beforeExpr:c}),_else:createKeyword("else",{beforeExpr:c}),_finally:createKeyword("finally"),_function:createKeyword("function",{startsExpr:p}),_if:createKeyword("if"),_return:createKeyword("return",{beforeExpr:c}),_switch:createKeyword("switch"),_throw:createKeyword("throw",{beforeExpr:c,prefix:d,startsExpr:p}),_try:createKeyword("try"),_var:createKeyword("var"),_const:createKeyword("const"),_with:createKeyword("with"),_new:createKeyword("new",{beforeExpr:c,startsExpr:p}),_this:createKeyword("this",{startsExpr:p}),_super:createKeyword("super",{startsExpr:p}),_class:createKeyword("class",{startsExpr:p}),_extends:createKeyword("extends",{beforeExpr:c}),_export:createKeyword("export"),_import:createKeyword("import",{startsExpr:p}),_null:createKeyword("null",{startsExpr:p}),_true:createKeyword("true",{startsExpr:p}),_false:createKeyword("false",{startsExpr:p}),_typeof:createKeyword("typeof",{beforeExpr:c,prefix:d,startsExpr:p}),_void:createKeyword("void",{beforeExpr:c,prefix:d,startsExpr:p}),_delete:createKeyword("delete",{beforeExpr:c,prefix:d,startsExpr:p}),_do:createKeyword("do",{isLoop:l,beforeExpr:c}),_for:createKeyword("for",{isLoop:l}),_while:createKeyword("while",{isLoop:l}),_as:createKeywordLike("as",{startsExpr:p}),_assert:createKeywordLike("assert",{startsExpr:p}),_async:createKeywordLike("async",{startsExpr:p}),_await:createKeywordLike("await",{startsExpr:p}),_from:createKeywordLike("from",{startsExpr:p}),_get:createKeywordLike("get",{startsExpr:p}),_let:createKeywordLike("let",{startsExpr:p}),_meta:createKeywordLike("meta",{startsExpr:p}),_of:createKeywordLike("of",{startsExpr:p}),_sent:createKeywordLike("sent",{startsExpr:p}),_set:createKeywordLike("set",{startsExpr:p}),_static:createKeywordLike("static",{startsExpr:p}),_yield:createKeywordLike("yield",{startsExpr:p}),_asserts:createKeywordLike("asserts",{startsExpr:p}),_checks:createKeywordLike("checks",{startsExpr:p}),_exports:createKeywordLike("exports",{startsExpr:p}),_global:createKeywordLike("global",{startsExpr:p}),_implements:createKeywordLike("implements",{startsExpr:p}),_intrinsic:createKeywordLike("intrinsic",{startsExpr:p}),_infer:createKeywordLike("infer",{startsExpr:p}),_is:createKeywordLike("is",{startsExpr:p}),_mixins:createKeywordLike("mixins",{startsExpr:p}),_proto:createKeywordLike("proto",{startsExpr:p}),_require:createKeywordLike("require",{startsExpr:p}),_keyof:createKeywordLike("keyof",{startsExpr:p}),_readonly:createKeywordLike("readonly",{startsExpr:p}),_unique:createKeywordLike("unique",{startsExpr:p}),_abstract:createKeywordLike("abstract",{startsExpr:p}),_declare:createKeywordLike("declare",{startsExpr:p}),_enum:createKeywordLike("enum",{startsExpr:p}),_module:createKeywordLike("module",{startsExpr:p}),_namespace:createKeywordLike("namespace",{startsExpr:p}),_interface:createKeywordLike("interface",{startsExpr:p}),_type:createKeywordLike("type",{startsExpr:p}),_opaque:createKeywordLike("opaque",{startsExpr:p}),name:createToken("name",{startsExpr:p}),string:createToken("string",{startsExpr:p}),num:createToken("num",{startsExpr:p}),bigint:createToken("bigint",{startsExpr:p}),decimal:createToken("decimal",{startsExpr:p}),regexp:createToken("regexp",{startsExpr:p}),privateName:createToken("#name",{startsExpr:p}),eof:createToken("eof"),jsxName:createToken("jsxName"),jsxText:createToken("jsxText",{beforeExpr:true}),jsxTagStart:createToken("jsxTagStart",{startsExpr:true}),jsxTagEnd:createToken("jsxTagEnd"),placeholder:createToken("%%",{startsExpr:true})};function tokenIsIdentifier(e){return e>=93&&e<=128}function tokenKeywordOrIdentifierIsKeyword(e){return e<=92}function tokenIsKeywordOrIdentifier(e){return e>=58&&e<=128}function tokenIsLiteralPropertyName(e){return e>=58&&e<=132}function tokenComesBeforeExpression(e){return T[e]}function tokenCanStartExpression(e){return b[e]}function tokenIsAssignment(e){return e>=29&&e<=33}function tokenIsFlowInterfaceOrTypeOrOpaque(e){return e>=125&&e<=127}function tokenIsLoop(e){return e>=90&&e<=92}function tokenIsKeyword(e){return e>=58&&e<=92}function tokenIsOperator(e){return e>=39&&e<=59}function tokenIsPostfix(e){return e===34}function tokenIsPrefix(e){return w[e]}function tokenIsTSTypeOperator(e){return e>=117&&e<=119}function tokenIsTSDeclarationStart(e){return e>=120&&e<=126}function tokenLabelName(e){return P[e]}function tokenOperatorPrecedence(e){return g[e]}function tokenIsBinaryOperator(e){return g[e]!==-1}function tokenIsRightAssociative(e){return e===57}function tokenIsTemplate(e){return e>=24&&e<=25}function getExportedToken(e){return x[e]}{x[8].updateContext=e=>{e.pop()};x[5].updateContext=x[7].updateContext=x[23].updateContext=e=>{e.push(h.brace)};x[22].updateContext=e=>{if(e[e.length-1]===h.template){e.pop()}else{e.push(h.template)}};x[138].updateContext=e=>{e.push(h.j_expr,h.j_oTag)}}let E="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟊꟐꟑꟓꟕ-ꟙꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let S="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࢘-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const C=new RegExp("["+E+"]");const I=new RegExp("["+E+S+"]");E=S=null;const k=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2637,96,16,1070,4050,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,46,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,482,44,11,6,17,0,322,29,19,43,1269,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4152,8,221,3,5761,15,7472,3104,541,1507,4938];const N=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,357,0,62,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(e,t){let s=65536;for(let i=0,r=t.length;i<r;i+=2){s+=t[i];if(s>e)return false;s+=t[i+1];if(s>=e)return true}return false}function isIdentifierStart(e){if(e<65)return e===36;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&C.test(String.fromCharCode(e))}return isInAstralSet(e,k)}function isIdentifierChar(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<=90)return true;if(e<97)return e===95;if(e<=122)return true;if(e<=65535){return e>=170&&I.test(String.fromCharCode(e))}return isInAstralSet(e,k)||isInAstralSet(e,N)}const v={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]};const L=new Set(v.keyword);const M=new Set(v.strict);const O=new Set(v.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||M.has(e)}function isStrictBindOnlyReservedWord(e){return O.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return L.has(e)}function isIteratorStart(e,t,s){return e===64&&t===64&&isIdentifierStart(s)}const D=new Set(["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete","implements","interface","let","package","private","protected","public","static","yield","eval","arguments","enum","await"]);function canBeReservedWord(e){return D.has(e)}const F=0,B=1,R=2,j=4,U=8,_=16,K=32,H=64,z=128,V=256,q=B|R|V;const $=1,W=2,J=4,X=8,G=16,Y=64,Q=128,Z=256,ee=512,te=1024,se=2048;const ie=$|W|X|Q,re=$|0|X|0,ae=$|0|J|0,ne=$|0|G|0,oe=0|W|0|Q,he=0|W|0|0,ce=$|W|X|Z,pe=0|0|0|te,le=0|0|0|Y,ue=$|0|0|Y,de=ce|ee,fe=0|0|0|te,me=se;const ye=4,xe=2,Pe=1,ge=xe|Pe;const Te=xe|ye,be=Pe|ye,we=xe,Ae=Pe,Ee=0;class BaseParser{constructor(){this.sawUnambiguousESM=false;this.ambiguousScriptDifferentAst=false}hasPlugin(e){if(typeof e==="string"){return this.plugins.has(e)}else{const[t,s]=e;if(!this.hasPlugin(t)){return false}const i=this.plugins.get(t);for(const e of Object.keys(s)){if((i==null?void 0:i[e])!==s[e]){return false}}return true}}getPluginOption(e,t){var s;return(s=this.plugins.get(e))==null?void 0:s[t]}}function setTrailingComments(e,t){if(e.trailingComments===undefined){e.trailingComments=t}else{e.trailingComments.unshift(...t)}}function setLeadingComments(e,t){if(e.leadingComments===undefined){e.leadingComments=t}else{e.leadingComments.unshift(...t)}}function setInnerComments(e,t){if(e.innerComments===undefined){e.innerComments=t}else{e.innerComments.unshift(...t)}}function adjustInnerComments(e,t,s){let i=null;let r=t.length;while(i===null&&r>0){i=t[--r]}if(i===null||i.start>s.start){setInnerComments(e,s.comments)}else{setTrailingComments(i,s.comments)}}class CommentsParser extends BaseParser{addComment(e){if(this.filename)e.loc.filename=this.filename;this.state.comments.push(e)}processComment(e){const{commentStack:t}=this.state;const s=t.length;if(s===0)return;let i=s-1;const r=t[i];if(r.start===e.end){r.leadingNode=e;i--}const{start:a}=e;for(;i>=0;i--){const s=t[i];const r=s.end;if(r>a){s.containingNode=e;this.finalizeComment(s);t.splice(i,1)}else{if(r===a){s.trailingNode=e}break}}}finalizeComment(e){const{comments:t}=e;if(e.leadingNode!==null||e.trailingNode!==null){if(e.leadingNode!==null){setTrailingComments(e.leadingNode,t)}if(e.trailingNode!==null){setLeadingComments(e.trailingNode,t)}}else{const{containingNode:s,start:i}=e;if(this.input.charCodeAt(i-1)===44){switch(s.type){case"ObjectExpression":case"ObjectPattern":case"RecordExpression":adjustInnerComments(s,s.properties,e);break;case"CallExpression":case"OptionalCallExpression":adjustInnerComments(s,s.arguments,e);break;case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"ObjectMethod":case"ClassMethod":case"ClassPrivateMethod":adjustInnerComments(s,s.params,e);break;case"ArrayExpression":case"ArrayPattern":case"TupleExpression":adjustInnerComments(s,s.elements,e);break;case"ExportNamedDeclaration":case"ImportDeclaration":adjustInnerComments(s,s.specifiers,e);break;default:{setInnerComments(s,t)}}}else{setInnerComments(s,t)}}}finalizeRemainingComments(){const{commentStack:e}=this.state;for(let t=e.length-1;t>=0;t--){this.finalizeComment(e[t])}this.state.commentStack=[]}resetPreviousNodeTrailingComments(e){const{commentStack:t}=this.state;const{length:s}=t;if(s===0)return;const i=t[s-1];if(i.leadingNode===e){i.leadingNode=null}}takeSurroundingComments(e,t,s){const{commentStack:i}=this.state;const r=i.length;if(r===0)return;let a=r-1;for(;a>=0;a--){const r=i[a];const n=r.end;const o=r.start;if(o===s){r.leadingNode=e}else if(n===t){r.trailingNode=e}else if(n<t){break}}}}const Se=/\r\n?|[\n\u2028\u2029]/;const Ce=new RegExp(Se.source,"g");function isNewLine(e){switch(e){case 10:case 13:case 8232:case 8233:return true;default:return false}}const Ie=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;const ke=/(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/y;const Ne=new RegExp("(?=("+ke.source+"))\\1"+/(?=[\n\r\u2028\u2029]|\/\*(?!.*?\*\/)|$)/.source,"y");function isWhitespace(e){switch(e){case 9:case 11:case 12:case 32:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:case 65279:return true;default:return false}}class State{constructor(){this.strict=void 0;this.curLine=void 0;this.lineStart=void 0;this.startLoc=void 0;this.endLoc=void 0;this.errors=[];this.potentialArrowAt=-1;this.noArrowAt=[];this.noArrowParamsConversionAt=[];this.maybeInArrowParameters=false;this.inType=false;this.noAnonFunctionType=false;this.hasFlowComment=false;this.isAmbientContext=false;this.inAbstractClass=false;this.inDisallowConditionalTypesContext=false;this.topicContext={maxNumOfResolvableTopics:0,maxTopicIndex:null};this.soloAwait=false;this.inFSharpPipelineDirectBody=false;this.labels=[];this.decoratorStack=[[]];this.comments=[];this.commentStack=[];this.pos=0;this.type=135;this.value=null;this.start=0;this.end=0;this.lastTokEndLoc=null;this.lastTokStartLoc=null;this.lastTokStart=0;this.context=[h.brace];this.canStartJSXElement=true;this.containsEsc=false;this.strictErrors=new Map;this.tokensLength=0}init({strictMode:e,sourceType:t,startLine:s,startColumn:i}){this.strict=e===false?false:e===true?true:t==="module";this.curLine=s;this.lineStart=-i;this.startLoc=this.endLoc=new Position(s,i,0)}curPosition(){return new Position(this.curLine,this.pos-this.lineStart,this.pos)}clone(e){const t=new State;const s=Object.keys(this);for(let i=0,r=s.length;i<r;i++){const r=s[i];let a=this[r];if(!e&&Array.isArray(a)){a=a.slice()}t[r]=a}return t}}const ve=["at"],Le=["at"];var Me=function isDigit(e){return e>=48&&e<=57};const Oe=new Set([103,109,115,105,121,117,100,118]);const De={decBinOct:new Set([46,66,69,79,95,98,101,111]),hex:new Set([46,88,95,120])};const Fe={bin:e=>e===48||e===49,oct:e=>e>=48&&e<=55,dec:e=>e>=48&&e<=57,hex:e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102};class Token{constructor(e){this.type=e.type;this.value=e.value;this.start=e.start;this.end=e.end;this.loc=new SourceLocation(e.startLoc,e.endLoc)}}class Tokenizer extends CommentsParser{constructor(e,t){super();this.isLookahead=void 0;this.tokens=[];this.state=new State;this.state.init(e);this.input=t;this.length=t.length;this.isLookahead=false}pushToken(e){this.tokens.length=this.state.tokensLength;this.tokens.push(e);++this.state.tokensLength}next(){this.checkKeywordEscapes();if(this.options.tokens){this.pushToken(new Token(this.state))}this.state.lastTokStart=this.state.start;this.state.lastTokEndLoc=this.state.endLoc;this.state.lastTokStartLoc=this.state.startLoc;this.nextToken()}eat(e){if(this.match(e)){this.next();return true}else{return false}}match(e){return this.state.type===e}createLookaheadState(e){return{pos:e.pos,value:null,type:e.type,start:e.start,end:e.end,context:[this.curContext()],inType:e.inType,startLoc:e.startLoc,lastTokEndLoc:e.lastTokEndLoc,curLine:e.curLine,lineStart:e.lineStart,curPosition:e.curPosition}}lookahead(){const e=this.state;this.state=this.createLookaheadState(e);this.isLookahead=true;this.nextToken();this.isLookahead=false;const t=this.state;this.state=e;return t}nextTokenStart(){return this.nextTokenStartSince(this.state.pos)}nextTokenStartSince(e){Ie.lastIndex=e;return Ie.test(this.input)?Ie.lastIndex:e}lookaheadCharCode(){return this.input.charCodeAt(this.nextTokenStart())}codePointAtPos(e){let t=this.input.charCodeAt(e);if((t&64512)===55296&&++e<this.input.length){const s=this.input.charCodeAt(e);if((s&64512)===56320){t=65536+((t&1023)<<10)+(s&1023)}}return t}setStrict(e){this.state.strict=e;if(e){this.state.strictErrors.forEach((([e,t])=>this.raise(e,{at:t})));this.state.strictErrors.clear()}}curContext(){return this.state.context[this.state.context.length-1]}nextToken(){this.skipSpace();this.state.start=this.state.pos;if(!this.isLookahead)this.state.startLoc=this.state.curPosition();if(this.state.pos>=this.length){this.finishToken(135);return}this.getTokenFromCode(this.codePointAtPos(this.state.pos))}skipBlockComment(){let e;if(!this.isLookahead)e=this.state.curPosition();const t=this.state.pos;const s=this.input.indexOf("*/",t+2);if(s===-1){throw this.raise(n.UnterminatedComment,{at:this.state.curPosition()})}this.state.pos=s+2;Ce.lastIndex=t+2;while(Ce.test(this.input)&&Ce.lastIndex<=s){++this.state.curLine;this.state.lineStart=Ce.lastIndex}if(this.isLookahead)return;const i={type:"CommentBlock",value:this.input.slice(t+2,s),start:t,end:s+2,loc:new SourceLocation(e,this.state.curPosition())};if(this.options.tokens)this.pushToken(i);return i}skipLineComment(e){const t=this.state.pos;let s;if(!this.isLookahead)s=this.state.curPosition();let i=this.input.charCodeAt(this.state.pos+=e);if(this.state.pos<this.length){while(!isNewLine(i)&&++this.state.pos<this.length){i=this.input.charCodeAt(this.state.pos)}}if(this.isLookahead)return;const r=this.state.pos;const a=this.input.slice(t+e,r);const n={type:"CommentLine",value:a,start:t,end:r,loc:new SourceLocation(s,this.state.curPosition())};if(this.options.tokens)this.pushToken(n);return n}skipSpace(){const e=this.state.pos;const t=[];e:while(this.state.pos<this.length){const s=this.input.charCodeAt(this.state.pos);switch(s){case 32:case 160:case 9:++this.state.pos;break;case 13:if(this.input.charCodeAt(this.state.pos+1)===10){++this.state.pos}case 10:case 8232:case 8233:++this.state.pos;++this.state.curLine;this.state.lineStart=this.state.pos;break;case 47:switch(this.input.charCodeAt(this.state.pos+1)){case 42:{const e=this.skipBlockComment();if(e!==undefined){this.addComment(e);if(this.options.attachComment)t.push(e)}break}case 47:{const e=this.skipLineComment(2);if(e!==undefined){this.addComment(e);if(this.options.attachComment)t.push(e)}break}default:break e}break;default:if(isWhitespace(s)){++this.state.pos}else if(s===45&&!this.inModule){const s=this.state.pos;if(this.input.charCodeAt(s+1)===45&&this.input.charCodeAt(s+2)===62&&(e===0||this.state.lineStart>e)){const e=this.skipLineComment(3);if(e!==undefined){this.addComment(e);if(this.options.attachComment)t.push(e)}}else{break e}}else if(s===60&&!this.inModule){const e=this.state.pos;if(this.input.charCodeAt(e+1)===33&&this.input.charCodeAt(e+2)===45&&this.input.charCodeAt(e+3)===45){const e=this.skipLineComment(4);if(e!==undefined){this.addComment(e);if(this.options.attachComment)t.push(e)}}else{break e}}else{break e}}}if(t.length>0){const s=this.state.pos;const i={start:e,end:s,comments:t,leadingNode:null,trailingNode:null,containingNode:null};this.state.commentStack.push(i)}}finishToken(e,t){this.state.end=this.state.pos;this.state.endLoc=this.state.curPosition();const s=this.state.type;this.state.type=e;this.state.value=t;if(!this.isLookahead){this.updateContext(s)}}replaceToken(e){this.state.type=e;this.updateContext()}readToken_numberSign(){if(this.state.pos===0&&this.readToken_interpreter()){return}const e=this.state.pos+1;const t=this.codePointAtPos(e);if(t>=48&&t<=57){throw this.raise(n.UnexpectedDigitAfterHash,{at:this.state.curPosition()})}if(t===123||t===91&&this.hasPlugin("recordAndTuple")){this.expectPlugin("recordAndTuple");if(this.getPluginOption("recordAndTuple","syntaxType")!=="hash"){throw this.raise(t===123?n.RecordExpressionHashIncorrectStartSyntaxType:n.TupleExpressionHashIncorrectStartSyntaxType,{at:this.state.curPosition()})}this.state.pos+=2;if(t===123){this.finishToken(7)}else{this.finishToken(1)}}else if(isIdentifierStart(t)){++this.state.pos;this.finishToken(134,this.readWord1(t))}else if(t===92){++this.state.pos;this.finishToken(134,this.readWord1())}else{this.finishOp(27,1)}}readToken_dot(){const e=this.input.charCodeAt(this.state.pos+1);if(e>=48&&e<=57){this.readNumber(true);return}if(e===46&&this.input.charCodeAt(this.state.pos+2)===46){this.state.pos+=3;this.finishToken(21)}else{++this.state.pos;this.finishToken(16)}}readToken_slash(){const e=this.input.charCodeAt(this.state.pos+1);if(e===61){this.finishOp(31,2)}else{this.finishOp(56,1)}}readToken_interpreter(){if(this.state.pos!==0||this.length<2)return false;let e=this.input.charCodeAt(this.state.pos+1);if(e!==33)return false;const t=this.state.pos;this.state.pos+=1;while(!isNewLine(e)&&++this.state.pos<this.length){e=this.input.charCodeAt(this.state.pos)}const s=this.input.slice(t+2,this.state.pos);this.finishToken(28,s);return true}readToken_mult_modulo(e){let t=e===42?55:54;let s=1;let i=this.input.charCodeAt(this.state.pos+1);if(e===42&&i===42){s++;i=this.input.charCodeAt(this.state.pos+2);t=57}if(i===61&&!this.state.inType){s++;t=e===37?33:30}this.finishOp(t,s)}readToken_pipe_amp(e){const t=this.input.charCodeAt(this.state.pos+1);if(t===e){if(this.input.charCodeAt(this.state.pos+2)===61){this.finishOp(30,3)}else{this.finishOp(e===124?41:42,2)}return}if(e===124){if(t===62){this.finishOp(39,2);return}if(this.hasPlugin("recordAndTuple")&&t===125){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar"){throw this.raise(n.RecordExpressionBarIncorrectEndSyntaxType,{at:this.state.curPosition()})}this.state.pos+=2;this.finishToken(9);return}if(this.hasPlugin("recordAndTuple")&&t===93){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar"){throw this.raise(n.TupleExpressionBarIncorrectEndSyntaxType,{at:this.state.curPosition()})}this.state.pos+=2;this.finishToken(4);return}}if(t===61){this.finishOp(30,2);return}this.finishOp(e===124?43:45,1)}readToken_caret(){const e=this.input.charCodeAt(this.state.pos+1);if(e===61&&!this.state.inType){this.finishOp(32,2)}else if(e===94&&this.hasPlugin(["pipelineOperator",{proposal:"hack",topicToken:"^^"}])){this.finishOp(37,2);const e=this.input.codePointAt(this.state.pos);if(e===94){throw this.unexpected()}}else{this.finishOp(44,1)}}readToken_atSign(){const e=this.input.charCodeAt(this.state.pos+1);if(e===64&&this.hasPlugin(["pipelineOperator",{proposal:"hack",topicToken:"@@"}])){this.finishOp(38,2)}else{this.finishOp(26,1)}}readToken_plus_min(e){const t=this.input.charCodeAt(this.state.pos+1);if(t===e){this.finishOp(34,2);return}if(t===61){this.finishOp(30,2)}else{this.finishOp(53,1)}}readToken_lt(){const{pos:e}=this.state;const t=this.input.charCodeAt(e+1);if(t===60){if(this.input.charCodeAt(e+2)===61){this.finishOp(30,3);return}this.finishOp(51,2);return}if(t===61){this.finishOp(49,2);return}this.finishOp(47,1)}readToken_gt(){const{pos:e}=this.state;const t=this.input.charCodeAt(e+1);if(t===62){const t=this.input.charCodeAt(e+2)===62?3:2;if(this.input.charCodeAt(e+t)===61){this.finishOp(30,t+1);return}this.finishOp(52,t);return}if(t===61){this.finishOp(49,2);return}this.finishOp(48,1)}readToken_eq_excl(e){const t=this.input.charCodeAt(this.state.pos+1);if(t===61){this.finishOp(46,this.input.charCodeAt(this.state.pos+2)===61?3:2);return}if(e===61&&t===62){this.state.pos+=2;this.finishToken(19);return}this.finishOp(e===61?29:35,1)}readToken_question(){const e=this.input.charCodeAt(this.state.pos+1);const t=this.input.charCodeAt(this.state.pos+2);if(e===63){if(t===61){this.finishOp(30,3)}else{this.finishOp(40,2)}}else if(e===46&&!(t>=48&&t<=57)){this.state.pos+=2;this.finishToken(18)}else{++this.state.pos;this.finishToken(17)}}getTokenFromCode(e){switch(e){case 46:this.readToken_dot();return;case 40:++this.state.pos;this.finishToken(10);return;case 41:++this.state.pos;this.finishToken(11);return;case 59:++this.state.pos;this.finishToken(13);return;case 44:++this.state.pos;this.finishToken(12);return;case 91:if(this.hasPlugin("recordAndTuple")&&this.input.charCodeAt(this.state.pos+1)===124){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar"){throw this.raise(n.TupleExpressionBarIncorrectStartSyntaxType,{at:this.state.curPosition()})}this.state.pos+=2;this.finishToken(2)}else{++this.state.pos;this.finishToken(0)}return;case 93:++this.state.pos;this.finishToken(3);return;case 123:if(this.hasPlugin("recordAndTuple")&&this.input.charCodeAt(this.state.pos+1)===124){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar"){throw this.raise(n.RecordExpressionBarIncorrectStartSyntaxType,{at:this.state.curPosition()})}this.state.pos+=2;this.finishToken(6)}else{++this.state.pos;this.finishToken(5)}return;case 125:++this.state.pos;this.finishToken(8);return;case 58:if(this.hasPlugin("functionBind")&&this.input.charCodeAt(this.state.pos+1)===58){this.finishOp(15,2)}else{++this.state.pos;this.finishToken(14)}return;case 63:this.readToken_question();return;case 96:this.readTemplateToken();return;case 48:{const e=this.input.charCodeAt(this.state.pos+1);if(e===120||e===88){this.readRadixNumber(16);return}if(e===111||e===79){this.readRadixNumber(8);return}if(e===98||e===66){this.readRadixNumber(2);return}}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:this.readNumber(false);return;case 34:case 39:this.readString(e);return;case 47:this.readToken_slash();return;case 37:case 42:this.readToken_mult_modulo(e);return;case 124:case 38:this.readToken_pipe_amp(e);return;case 94:this.readToken_caret();return;case 43:case 45:this.readToken_plus_min(e);return;case 60:this.readToken_lt();return;case 62:this.readToken_gt();return;case 61:case 33:this.readToken_eq_excl(e);return;case 126:this.finishOp(36,1);return;case 64:this.readToken_atSign();return;case 35:this.readToken_numberSign();return;case 92:this.readWord();return;default:if(isIdentifierStart(e)){this.readWord(e);return}}throw this.raise(n.InvalidOrUnexpectedToken,{at:this.state.curPosition(),unexpected:String.fromCodePoint(e)})}finishOp(e,t){const s=this.input.slice(this.state.pos,this.state.pos+t);this.state.pos+=t;this.finishToken(e,s)}readRegexp(){const e=this.state.startLoc;const t=this.state.start+1;let s,i;let{pos:r}=this.state;for(;;++r){if(r>=this.length){throw this.raise(n.UnterminatedRegExp,{at:createPositionWithColumnOffset(e,1)})}const t=this.input.charCodeAt(r);if(isNewLine(t)){throw this.raise(n.UnterminatedRegExp,{at:createPositionWithColumnOffset(e,1)})}if(s){s=false}else{if(t===91){i=true}else if(t===93&&i){i=false}else if(t===47&&!i){break}s=t===92}}const a=this.input.slice(t,r);++r;let o="";const nextPos=()=>createPositionWithColumnOffset(e,r+2-t);while(r<this.length){const e=this.codePointAtPos(r);const t=String.fromCharCode(e);if(Oe.has(e)){if(e===118){this.expectPlugin("regexpUnicodeSets",nextPos());if(o.includes("u")){this.raise(n.IncompatibleRegExpUVFlags,{at:nextPos()})}}else if(e===117){if(o.includes("v")){this.raise(n.IncompatibleRegExpUVFlags,{at:nextPos()})}}if(o.includes(t)){this.raise(n.DuplicateRegExpFlags,{at:nextPos()})}}else if(isIdentifierChar(e)||e===92){this.raise(n.MalformedRegExpFlags,{at:nextPos()})}else{break}++r;o+=t}this.state.pos=r;this.finishToken(133,{pattern:a,flags:o})}readInt(e,t,s,i=true){const r=this.state.pos;const a=e===16?De.hex:De.decBinOct;const o=e===16?Fe.hex:e===10?Fe.dec:e===8?Fe.oct:Fe.bin;let h=false;let c=0;for(let r=0,p=t==null?Infinity:t;r<p;++r){const t=this.input.charCodeAt(this.state.pos);let r;if(t===95&&i!=="bail"){const e=this.input.charCodeAt(this.state.pos-1);const t=this.input.charCodeAt(this.state.pos+1);if(!i){this.raise(n.NumericSeparatorInEscapeSequence,{at:this.state.curPosition()})}else if(Number.isNaN(t)||!o(t)||a.has(e)||a.has(t)){this.raise(n.UnexpectedNumericSeparator,{at:this.state.curPosition()})}++this.state.pos;continue}if(t>=97){r=t-97+10}else if(t>=65){r=t-65+10}else if(Me(t)){r=t-48}else{r=Infinity}if(r>=e){if(this.options.errorRecovery&&r<=9){r=0;this.raise(n.InvalidDigit,{at:this.state.curPosition(),radix:e})}else if(s){r=0;h=true}else{break}}++this.state.pos;c=c*e+r}if(this.state.pos===r||t!=null&&this.state.pos-r!==t||h){return null}return c}readRadixNumber(e){const t=this.state.curPosition();let s=false;this.state.pos+=2;const i=this.readInt(e);if(i==null){this.raise(n.InvalidDigit,{at:createPositionWithColumnOffset(t,2),radix:e})}const r=this.input.charCodeAt(this.state.pos);if(r===110){++this.state.pos;s=true}else if(r===109){throw this.raise(n.InvalidDecimal,{at:t})}if(isIdentifierStart(this.codePointAtPos(this.state.pos))){throw this.raise(n.NumberIdentifier,{at:this.state.curPosition()})}if(s){const e=this.input.slice(t.index,this.state.pos).replace(/[_n]/g,"");this.finishToken(131,e);return}this.finishToken(130,i)}readNumber(e){const t=this.state.pos;const s=this.state.curPosition();let i=false;let r=false;let a=false;let o=false;let h=false;if(!e&&this.readInt(10)===null){this.raise(n.InvalidNumber,{at:this.state.curPosition()})}const c=this.state.pos-t>=2&&this.input.charCodeAt(t)===48;if(c){const e=this.input.slice(t,this.state.pos);this.recordStrictModeErrors(n.StrictOctalLiteral,{at:s});if(!this.state.strict){const t=e.indexOf("_");if(t>0){this.raise(n.ZeroDigitNumericSeparator,{at:createPositionWithColumnOffset(s,t)})}}h=c&&!/[89]/.test(e)}let p=this.input.charCodeAt(this.state.pos);if(p===46&&!h){++this.state.pos;this.readInt(10);i=true;p=this.input.charCodeAt(this.state.pos)}if((p===69||p===101)&&!h){p=this.input.charCodeAt(++this.state.pos);if(p===43||p===45){++this.state.pos}if(this.readInt(10)===null){this.raise(n.InvalidOrMissingExponent,{at:s})}i=true;o=true;p=this.input.charCodeAt(this.state.pos)}if(p===110){if(i||c){this.raise(n.InvalidBigIntLiteral,{at:s})}++this.state.pos;r=true}if(p===109){this.expectPlugin("decimal",this.state.curPosition());if(o||c){this.raise(n.InvalidDecimal,{at:s})}++this.state.pos;a=true}if(isIdentifierStart(this.codePointAtPos(this.state.pos))){throw this.raise(n.NumberIdentifier,{at:this.state.curPosition()})}const l=this.input.slice(t,this.state.pos).replace(/[_mn]/g,"");if(r){this.finishToken(131,l);return}if(a){this.finishToken(132,l);return}const u=h?parseInt(l,8):parseFloat(l);this.finishToken(130,u)}readCodePoint(e){const t=this.input.charCodeAt(this.state.pos);let s;if(t===123){++this.state.pos;s=this.readHexChar(this.input.indexOf("}",this.state.pos)-this.state.pos,true,e);++this.state.pos;if(s!==null&&s>1114111){if(e){this.raise(n.InvalidCodePoint,{at:this.state.curPosition()})}else{return null}}}else{s=this.readHexChar(4,false,e)}return s}readString(e){let t="",s=++this.state.pos;for(;;){if(this.state.pos>=this.length){throw this.raise(n.UnterminatedString,{at:this.state.startLoc})}const i=this.input.charCodeAt(this.state.pos);if(i===e)break;if(i===92){t+=this.input.slice(s,this.state.pos);t+=this.readEscapedChar(false);s=this.state.pos}else if(i===8232||i===8233){++this.state.pos;++this.state.curLine;this.state.lineStart=this.state.pos}else if(isNewLine(i)){throw this.raise(n.UnterminatedString,{at:this.state.startLoc})}else{++this.state.pos}}t+=this.input.slice(s,this.state.pos++);this.finishToken(129,t)}readTemplateContinuation(){if(!this.match(8)){this.unexpected(null,8)}this.state.pos--;this.readTemplateToken()}readTemplateToken(){let e="",t=this.state.pos,s=false;++this.state.pos;for(;;){if(this.state.pos>=this.length){throw this.raise(n.UnterminatedTemplate,{at:createPositionWithColumnOffset(this.state.startLoc,1)})}const i=this.input.charCodeAt(this.state.pos);if(i===96){++this.state.pos;e+=this.input.slice(t,this.state.pos);this.finishToken(24,s?null:e);return}if(i===36&&this.input.charCodeAt(this.state.pos+1)===123){this.state.pos+=2;e+=this.input.slice(t,this.state.pos);this.finishToken(25,s?null:e);return}if(i===92){e+=this.input.slice(t,this.state.pos);const i=this.readEscapedChar(true);if(i===null){s=true}else{e+=i}t=this.state.pos}else if(isNewLine(i)){e+=this.input.slice(t,this.state.pos);++this.state.pos;switch(i){case 13:if(this.input.charCodeAt(this.state.pos)===10){++this.state.pos}case 10:e+="\n";break;default:e+=String.fromCharCode(i);break}++this.state.curLine;this.state.lineStart=this.state.pos;t=this.state.pos}else{++this.state.pos}}}recordStrictModeErrors(e,{at:t}){const s=t.index;if(this.state.strict&&!this.state.strictErrors.has(s)){this.raise(e,{at:t})}else{this.state.strictErrors.set(s,[e,t])}}readEscapedChar(e){const t=!e;const s=this.input.charCodeAt(++this.state.pos);++this.state.pos;switch(s){case 110:return"\n";case 114:return"\r";case 120:{const e=this.readHexChar(2,false,t);return e===null?null:String.fromCharCode(e)}case 117:{const e=this.readCodePoint(t);return e===null?null:String.fromCodePoint(e)}case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:if(this.input.charCodeAt(this.state.pos)===10){++this.state.pos}case 10:this.state.lineStart=this.state.pos;++this.state.curLine;case 8232:case 8233:return"";case 56:case 57:if(e){return null}else{this.recordStrictModeErrors(n.StrictNumericEscape,{at:createPositionWithColumnOffset(this.state.curPosition(),-1)})}default:if(s>=48&&s<=55){const t=createPositionWithColumnOffset(this.state.curPosition(),-1);const s=this.input.slice(this.state.pos-1,this.state.pos+2).match(/^[0-7]+/);let i=s[0];let r=parseInt(i,8);if(r>255){i=i.slice(0,-1);r=parseInt(i,8)}this.state.pos+=i.length-1;const a=this.input.charCodeAt(this.state.pos);if(i!=="0"||a===56||a===57){if(e){return null}else{this.recordStrictModeErrors(n.StrictNumericEscape,{at:t})}}return String.fromCharCode(r)}return String.fromCharCode(s)}}readHexChar(e,t,s){const i=this.state.curPosition();const r=this.readInt(16,e,t,false);if(r===null){if(s){this.raise(n.InvalidEscapeSequence,{at:i})}else{this.state.pos=i.index-1}}return r}readWord1(e){this.state.containsEsc=false;let t="";const s=this.state.pos;let i=this.state.pos;if(e!==undefined){this.state.pos+=e<=65535?1:2}while(this.state.pos<this.length){const e=this.codePointAtPos(this.state.pos);if(isIdentifierChar(e)){this.state.pos+=e<=65535?1:2}else if(e===92){this.state.containsEsc=true;t+=this.input.slice(i,this.state.pos);const e=this.state.curPosition();const r=this.state.pos===s?isIdentifierStart:isIdentifierChar;if(this.input.charCodeAt(++this.state.pos)!==117){this.raise(n.MissingUnicodeEscape,{at:this.state.curPosition()});i=this.state.pos-1;continue}++this.state.pos;const a=this.readCodePoint(true);if(a!==null){if(!r(a)){this.raise(n.EscapedCharNotAnIdentifier,{at:e})}t+=String.fromCodePoint(a)}i=this.state.pos}else{break}}return t+this.input.slice(i,this.state.pos)}readWord(e){const t=this.readWord1(e);const s=m.get(t);if(s!==undefined){this.finishToken(s,tokenLabelName(s))}else{this.finishToken(128,t)}}checkKeywordEscapes(){const{type:e}=this.state;if(tokenIsKeyword(e)&&this.state.containsEsc){this.raise(n.InvalidEscapedReservedWord,{at:this.state.startLoc,reservedWord:tokenLabelName(e)})}}raise(e,t){const{at:s}=t,i=_objectWithoutPropertiesLoose(t,ve);const r=s instanceof Position?s:s.loc.start;const a=e({loc:r,details:i});if(!this.options.errorRecovery)throw a;if(!this.isLookahead)this.state.errors.push(a);return a}raiseOverwrite(e,t){const{at:s}=t,i=_objectWithoutPropertiesLoose(t,Le);const r=s instanceof Position?s:s.loc.start;const a=r.index;const n=this.state.errors;for(let t=n.length-1;t>=0;t--){const s=n[t];if(s.loc.index===a){return n[t]=e({loc:r,details:i})}if(s.loc.index<a)break}return this.raise(e,t)}updateContext(e){}unexpected(e,t){throw this.raise(n.UnexpectedToken,{expected:t?tokenLabelName(t):null,at:e!=null?e:this.state.startLoc})}expectPlugin(e,t){if(this.hasPlugin(e)){return true}throw this.raise(n.MissingPlugin,{at:t!=null?t:this.state.startLoc,missingPlugin:[e]})}expectOnePlugin(e){if(!e.some((e=>this.hasPlugin(e)))){throw this.raise(n.MissingOneOfPlugins,{at:this.state.startLoc,missingPlugin:e})}}}class Scope{constructor(e){this.var=new Set;this.lexical=new Set;this.functions=new Set;this.flags=e}}class ScopeHandler{constructor(e,t){this.parser=void 0;this.scopeStack=[];this.inModule=void 0;this.undefinedExports=new Map;this.parser=e;this.inModule=t}get inFunction(){return(this.currentVarScopeFlags()&R)>0}get allowSuper(){return(this.currentThisScopeFlags()&_)>0}get allowDirectSuper(){return(this.currentThisScopeFlags()&K)>0}get inClass(){return(this.currentThisScopeFlags()&H)>0}get inClassAndNotInNonArrowFunction(){const e=this.currentThisScopeFlags();return(e&H)>0&&(e&R)===0}get inStaticBlock(){for(let e=this.scopeStack.length-1;;e--){const{flags:t}=this.scopeStack[e];if(t&z){return true}if(t&(q|H)){return false}}}get inNonArrowFunction(){return(this.currentThisScopeFlags()&R)>0}get treatFunctionsAsVar(){return this.treatFunctionsAsVarInScope(this.currentScope())}createScope(e){return new Scope(e)}enter(e){this.scopeStack.push(this.createScope(e))}exit(){this.scopeStack.pop()}treatFunctionsAsVarInScope(e){return!!(e.flags&(R|z)||!this.parser.inModule&&e.flags&B)}declareName(e,t,s){let i=this.currentScope();if(t&X||t&G){this.checkRedeclarationInScope(i,e,t,s);if(t&G){i.functions.add(e)}else{i.lexical.add(e)}if(t&X){this.maybeExportDefined(i,e)}}else if(t&J){for(let r=this.scopeStack.length-1;r>=0;--r){i=this.scopeStack[r];this.checkRedeclarationInScope(i,e,t,s);i.var.add(e);this.maybeExportDefined(i,e);if(i.flags&q)break}}if(this.parser.inModule&&i.flags&B){this.undefinedExports.delete(e)}}maybeExportDefined(e,t){if(this.parser.inModule&&e.flags&B){this.undefinedExports.delete(t)}}checkRedeclarationInScope(e,t,s,i){if(this.isRedeclaredInScope(e,t,s)){this.parser.raise(n.VarRedeclaration,{at:i,identifierName:t})}}isRedeclaredInScope(e,t,s){if(!(s&$))return false;if(s&X){return e.lexical.has(t)||e.functions.has(t)||e.var.has(t)}if(s&G){return e.lexical.has(t)||!this.treatFunctionsAsVarInScope(e)&&e.var.has(t)}return e.lexical.has(t)&&!(e.flags&U&&e.lexical.values().next().value===t)||!this.treatFunctionsAsVarInScope(e)&&e.functions.has(t)}checkLocalExport(e){const{name:t}=e;const s=this.scopeStack[0];if(!s.lexical.has(t)&&!s.var.has(t)&&!s.functions.has(t)){this.undefinedExports.set(t,e.loc.start)}}currentScope(){return this.scopeStack[this.scopeStack.length-1]}currentVarScopeFlags(){for(let e=this.scopeStack.length-1;;e--){const{flags:t}=this.scopeStack[e];if(t&q){return t}}}currentThisScopeFlags(){for(let e=this.scopeStack.length-1;;e--){const{flags:t}=this.scopeStack[e];if(t&(q|H)&&!(t&j)){return t}}}}class FlowScope extends Scope{constructor(...e){super(...e);this.declareFunctions=new Set}}class FlowScopeHandler extends ScopeHandler{createScope(e){return new FlowScope(e)}declareName(e,t,s){const i=this.currentScope();if(t&se){this.checkRedeclarationInScope(i,e,t,s);this.maybeExportDefined(i,e);i.declareFunctions.add(e);return}super.declareName(...arguments)}isRedeclaredInScope(e,t,s){if(super.isRedeclaredInScope(...arguments))return true;if(s&se){return!e.declareFunctions.has(t)&&(e.lexical.has(t)||e.functions.has(t))}return false}checkLocalExport(e){if(!this.scopeStack[0].declareFunctions.has(e.name)){super.checkLocalExport(e)}}}class ClassScope{constructor(){this.privateNames=new Set;this.loneAccessors=new Map;this.undefinedPrivateNames=new Map}}class ClassScopeHandler{constructor(e){this.parser=void 0;this.stack=[];this.undefinedPrivateNames=new Map;this.parser=e}current(){return this.stack[this.stack.length-1]}enter(){this.stack.push(new ClassScope)}exit(){const e=this.stack.pop();const t=this.current();for(const[s,i]of Array.from(e.undefinedPrivateNames)){if(t){if(!t.undefinedPrivateNames.has(s)){t.undefinedPrivateNames.set(s,i)}}else{this.parser.raise(n.InvalidPrivateFieldResolution,{at:i,identifierName:s})}}}declarePrivateName(e,t,s){const{privateNames:i,loneAccessors:r,undefinedPrivateNames:a}=this.current();let o=i.has(e);if(t&ge){const s=o&&r.get(e);if(s){const i=s&ye;const a=t&ye;const n=s≥const h=t≥o=n===h||i!==a;if(!o)r.delete(e)}else if(!o){r.set(e,t)}}if(o){this.parser.raise(n.PrivateNameRedeclaration,{at:s,identifierName:e})}i.add(e);a.delete(e)}usePrivateName(e,t){let s;for(s of this.stack){if(s.privateNames.has(e))return}if(s){s.undefinedPrivateNames.set(e,t)}else{this.parser.raise(n.InvalidPrivateFieldResolution,{at:t,identifierName:e})}}}const Be=0,Re=1,je=2,Ue=3;class ExpressionScope{constructor(e=Be){this.type=void 0;this.type=e}canBeArrowParameterDeclaration(){return this.type===je||this.type===Re}isCertainlyParameterDeclaration(){return this.type===Ue}}class ArrowHeadParsingScope extends ExpressionScope{constructor(e){super(e);this.declarationErrors=new Map}recordDeclarationError(e,{at:t}){const s=t.index;this.declarationErrors.set(s,[e,t])}clearDeclarationError(e){this.declarationErrors.delete(e)}iterateErrors(e){this.declarationErrors.forEach(e)}}class ExpressionScopeHandler{constructor(e){this.parser=void 0;this.stack=[new ExpressionScope];this.parser=e}enter(e){this.stack.push(e)}exit(){this.stack.pop()}recordParameterInitializerError(e,{at:t}){const s={at:t.loc.start};const{stack:i}=this;let r=i.length-1;let a=i[r];while(!a.isCertainlyParameterDeclaration()){if(a.canBeArrowParameterDeclaration()){a.recordDeclarationError(e,s)}else{return}a=i[--r]}this.parser.raise(e,s)}recordArrowParemeterBindingError(e,{at:t}){const{stack:s}=this;const i=s[s.length-1];const r={at:t.loc.start};if(i.isCertainlyParameterDeclaration()){this.parser.raise(e,r)}else if(i.canBeArrowParameterDeclaration()){i.recordDeclarationError(e,r)}else{return}}recordAsyncArrowParametersError({at:e}){const{stack:t}=this;let s=t.length-1;let i=t[s];while(i.canBeArrowParameterDeclaration()){if(i.type===je){i.recordDeclarationError(n.AwaitBindingIdentifier,{at:e})}i=t[--s]}}validateAsPattern(){const{stack:e}=this;const t=e[e.length-1];if(!t.canBeArrowParameterDeclaration())return;t.iterateErrors((([t,s])=>{this.parser.raise(t,{at:s});let i=e.length-2;let r=e[i];while(r.canBeArrowParameterDeclaration()){r.clearDeclarationError(s.index);r=e[--i]}}))}}function newParameterDeclarationScope(){return new ExpressionScope(Ue)}function newArrowHeadScope(){return new ArrowHeadParsingScope(Re)}function newAsyncArrowScope(){return new ArrowHeadParsingScope(je)}function newExpressionScope(){return new ExpressionScope}const _e=0,Ke=1,He=2,ze=4,Ve=8;class ProductionParameterHandler{constructor(){this.stacks=[]}enter(e){this.stacks.push(e)}exit(){this.stacks.pop()}currentFlags(){return this.stacks[this.stacks.length-1]}get hasAwait(){return(this.currentFlags()&He)>0}get hasYield(){return(this.currentFlags()&Ke)>0}get hasReturn(){return(this.currentFlags()&ze)>0}get hasIn(){return(this.currentFlags()&Ve)>0}}function functionFlags(e,t){return(e?He:0)|(t?Ke:0)}class UtilParser extends Tokenizer{addExtra(e,t,s,i=true){if(!e)return;const r=e.extra=e.extra||{};if(i){r[t]=s}else{Object.defineProperty(r,t,{enumerable:i,value:s})}}isContextual(e){return this.state.type===e&&!this.state.containsEsc}isUnparsedContextual(e,t){const s=e+t.length;if(this.input.slice(e,s)===t){const e=this.input.charCodeAt(s);return!(isIdentifierChar(e)||(e&64512)===55296)}return false}isLookaheadContextual(e){const t=this.nextTokenStart();return this.isUnparsedContextual(t,e)}eatContextual(e){if(this.isContextual(e)){this.next();return true}return false}expectContextual(e,t){if(!this.eatContextual(e)){if(t!=null){throw this.raise(t,{at:this.state.startLoc})}throw this.unexpected(null,e)}}canInsertSemicolon(){return this.match(135)||this.match(8)||this.hasPrecedingLineBreak()}hasPrecedingLineBreak(){return Se.test(this.input.slice(this.state.lastTokEndLoc.index,this.state.start))}hasFollowingLineBreak(){Ne.lastIndex=this.state.end;return Ne.test(this.input)}isLineTerminator(){return this.eat(13)||this.canInsertSemicolon()}semicolon(e=true){if(e?this.isLineTerminator():this.eat(13))return;this.raise(n.MissingSemicolon,{at:this.state.lastTokEndLoc})}expect(e,t){this.eat(e)||this.unexpected(t,e)}tryParse(e,t=this.state.clone()){const s={node:null};try{const i=e(((e=null)=>{s.node=e;throw s}));if(this.state.errors.length>t.errors.length){const e=this.state;this.state=t;this.state.tokensLength=e.tokensLength;return{node:i,error:e.errors[t.errors.length],thrown:false,aborted:false,failState:e}}return{node:i,error:null,thrown:false,aborted:false,failState:null}}catch(e){const i=this.state;this.state=t;if(e instanceof SyntaxError){return{node:null,error:e,thrown:true,aborted:false,failState:i}}if(e===s){return{node:s.node,error:null,thrown:false,aborted:true,failState:i}}throw e}}checkExpressionErrors(e,t){if(!e)return false;const{shorthandAssignLoc:s,doubleProtoLoc:i,privateKeyLoc:r,optionalParametersLoc:a}=e;const o=!!s||!!i||!!a||!!r;if(!t){return o}if(s!=null){this.raise(n.InvalidCoverInitializedName,{at:s})}if(i!=null){this.raise(n.DuplicateProto,{at:i})}if(r!=null){this.raise(n.UnexpectedPrivateField,{at:r})}if(a!=null){this.unexpected(a)}}isLiteralPropertyName(){return tokenIsLiteralPropertyName(this.state.type)}isPrivateName(e){return e.type==="PrivateName"}getPrivateNameSV(e){return e.id.name}hasPropertyAsPrivateName(e){return(e.type==="MemberExpression"||e.type==="OptionalMemberExpression")&&this.isPrivateName(e.property)}isOptionalChain(e){return e.type==="OptionalMemberExpression"||e.type==="OptionalCallExpression"}isObjectProperty(e){return e.type==="ObjectProperty"}isObjectMethod(e){return e.type==="ObjectMethod"}initializeScopes(e=this.options.sourceType==="module"){const t=this.state.labels;this.state.labels=[];const s=this.exportedIdentifiers;this.exportedIdentifiers=new Set;const i=this.inModule;this.inModule=e;const r=this.scope;const a=this.getScopeHandler();this.scope=new a(this,e);const n=this.prodParam;this.prodParam=new ProductionParameterHandler;const o=this.classScope;this.classScope=new ClassScopeHandler(this);const h=this.expressionScope;this.expressionScope=new ExpressionScopeHandler(this);return()=>{this.state.labels=t;this.exportedIdentifiers=s;this.inModule=i;this.scope=r;this.prodParam=n;this.classScope=o;this.expressionScope=h}}enterInitialScopes(){let e=_e;if(this.inModule){e|=He}this.scope.enter(B);this.prodParam.enter(e)}checkDestructuringPrivate(e){const{privateKeyLoc:t}=e;if(t!==null){this.expectPlugin("destructuringPrivate",t)}}}class ExpressionErrors{constructor(){this.shorthandAssignLoc=null;this.doubleProtoLoc=null;this.privateKeyLoc=null;this.optionalParametersLoc=null}}class Node{constructor(e,t,s){this.type="";this.start=t;this.end=0;this.loc=new SourceLocation(s);if(e!=null&&e.options.ranges)this.range=[t,0];if(e!=null&&e.filename)this.loc.filename=e.filename}}const qe=Node.prototype;{qe.__clone=function(){const e=new Node;const t=Object.keys(this);for(let s=0,i=t.length;s<i;s++){const i=t[s];if(i!=="leadingComments"&&i!=="trailingComments"&&i!=="innerComments"){e[i]=this[i]}}return e}}function clonePlaceholder(e){return cloneIdentifier(e)}function cloneIdentifier(e){const{type:t,start:s,end:i,loc:r,range:a,extra:n,name:o}=e;const h=Object.create(qe);h.type=t;h.start=s;h.end=i;h.loc=r;h.range=a;h.extra=n;h.name=o;if(t==="Placeholder"){h.expectedNode=e.expectedNode}return h}function cloneStringLiteral(e){const{type:t,start:s,end:i,loc:r,range:a,extra:n}=e;if(t==="Placeholder"){return clonePlaceholder(e)}const o=Object.create(qe);o.type=t;o.start=s;o.end=i;o.loc=r;o.range=a;if(e.raw!==undefined){o.raw=e.raw}else{o.extra=n}o.value=e.value;return o}class NodeUtils extends UtilParser{startNode(){return new Node(this,this.state.start,this.state.startLoc)}startNodeAt(e,t){return new Node(this,e,t)}startNodeAtNode(e){return this.startNodeAt(e.start,e.loc.start)}finishNode(e,t){return this.finishNodeAt(e,t,this.state.lastTokEndLoc)}finishNodeAt(e,t,s){e.type=t;e.end=s.index;e.loc.end=s;if(this.options.ranges)e.range[1]=s.index;if(this.options.attachComment)this.processComment(e);return e}resetStartLocation(e,t,s){e.start=t;e.loc.start=s;if(this.options.ranges)e.range[0]=t}resetEndLocation(e,t=this.state.lastTokEndLoc){e.end=t.index;e.loc.end=t;if(this.options.ranges)e.range[1]=t.index}resetStartLocationFromNode(e,t){this.resetStartLocation(e,t.start,t.loc.start)}}const $e=new Set(["_","any","bool","boolean","empty","extends","false","interface","mixed","null","number","static","string","true","typeof","void"]);const We=ParseErrorEnum`flow`((e=>({AmbiguousConditionalArrow:e("Ambiguous expression: wrap the arrow functions in parentheses to disambiguate."),AmbiguousDeclareModuleKind:e("Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module."),AssignReservedType:e((({reservedType:e})=>`Cannot overwrite reserved type ${e}.`)),DeclareClassElement:e("The `declare` modifier can only appear on class fields."),DeclareClassFieldInitializer:e("Initializers are not allowed in fields with the `declare` modifier."),DuplicateDeclareModuleExports:e("Duplicate `declare module.exports` statement."),EnumBooleanMemberNotInitialized:e((({memberName:e,enumName:t})=>`Boolean enum members need to be initialized. Use either \`${e} = true,\` or \`${e} = false,\` in enum \`${t}\`.`)),EnumDuplicateMemberName:e((({memberName:e,enumName:t})=>`Enum member names need to be unique, but the name \`${e}\` has already been used before in enum \`${t}\`.`)),EnumInconsistentMemberValues:e((({enumName:e})=>`Enum \`${e}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`)),EnumInvalidExplicitType:e((({invalidEnumType:e,enumName:t})=>`Enum type \`${e}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${t}\`.`)),EnumInvalidExplicitTypeUnknownSupplied:e((({enumName:e})=>`Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${e}\`.`)),EnumInvalidMemberInitializerPrimaryType:e((({enumName:e,memberName:t,explicitType:s})=>`Enum \`${e}\` has type \`${s}\`, so the initializer of \`${t}\` needs to be a ${s} literal.`)),EnumInvalidMemberInitializerSymbolType:e((({enumName:e,memberName:t})=>`Symbol enum members cannot be initialized. Use \`${t},\` in enum \`${e}\`.`)),EnumInvalidMemberInitializerUnknownType:e((({enumName:e,memberName:t})=>`The enum member initializer for \`${t}\` needs to be a literal (either a boolean, number, or string) in enum \`${e}\`.`)),EnumInvalidMemberName:e((({enumName:e,memberName:t,suggestion:s})=>`Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${t}\`, consider using \`${s}\`, in enum \`${e}\`.`)),EnumNumberMemberNotInitialized:e((({enumName:e,memberName:t})=>`Number enum members need to be initialized, e.g. \`${t} = 1\` in enum \`${e}\`.`)),EnumStringMemberInconsistentlyInitailized:e((({enumName:e})=>`String enum members need to consistently either all use initializers, or use no initializers, in enum \`${e}\`.`)),GetterMayNotHaveThisParam:e("A getter cannot have a `this` parameter."),ImportTypeShorthandOnlyInPureImport:e("The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements."),InexactInsideExact:e("Explicit inexact syntax cannot appear inside an explicit exact object type."),InexactInsideNonObject:e("Explicit inexact syntax cannot appear in class or interface definitions."),InexactVariance:e("Explicit inexact syntax cannot have variance."),InvalidNonTypeImportInDeclareModule:e("Imports within a `declare module` body must always be `import type` or `import typeof`."),MissingTypeParamDefault:e("Type parameter declaration needs a default, since a preceding type parameter declaration has a default."),NestedDeclareModule:e("`declare module` cannot be used inside another `declare module`."),NestedFlowComment:e("Cannot have a flow comment inside another flow comment."),PatternIsOptional:e("A binding pattern parameter cannot be optional in an implementation signature.",{reasonCode:"OptionalBindingPattern"}),SetterMayNotHaveThisParam:e("A setter cannot have a `this` parameter."),SpreadVariance:e("Spread properties cannot have variance."),ThisParamAnnotationRequired:e("A type annotation is required for the `this` parameter."),ThisParamBannedInConstructor:e("Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions."),ThisParamMayNotBeOptional:e("The `this` parameter cannot be optional."),ThisParamMustBeFirst:e("The `this` parameter must be the first function parameter."),ThisParamNoDefault:e("The `this` parameter may not have a default value."),TypeBeforeInitializer:e("Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`."),TypeCastInPattern:e("The type cast expression is expected to be wrapped with parenthesis."),UnexpectedExplicitInexactInObject:e("Explicit inexact syntax must appear at the end of an inexact object."),UnexpectedReservedType:e((({reservedType:e})=>`Unexpected reserved type ${e}.`)),UnexpectedReservedUnderscore:e("`_` is only allowed as a type argument to call or new."),UnexpectedSpaceBetweenModuloChecks:e("Spaces between `%` and `checks` are not allowed here."),UnexpectedSpreadType:e("Spread operator cannot appear in class or interface definitions."),UnexpectedSubtractionOperand:e('Unexpected token, expected "number" or "bigint".'),UnexpectedTokenAfterTypeParameter:e("Expected an arrow function after this type parameter declaration."),UnexpectedTypeParameterBeforeAsyncArrowFunction:e("Type parameters must come after the async keyword, e.g. instead of `<T> async () => {}`, use `async <T>() => {}`."),UnsupportedDeclareExportKind:e((({unsupportedExportKind:e,suggestion:t})=>`\`declare export ${e}\` is not supported. Use \`${t}\` instead.`)),UnsupportedStatementInDeclareModule:e("Only declares and type imports are allowed inside declare module."),UnterminatedFlowComment:e("Unterminated flow-comment.")})));function isEsModuleType(e){return e.type==="DeclareExportAllDeclaration"||e.type==="DeclareExportDeclaration"&&(!e.declaration||e.declaration.type!=="TypeAlias"&&e.declaration.type!=="InterfaceDeclaration")}function hasTypeImportKind(e){return e.importKind==="type"||e.importKind==="typeof"}function isMaybeDefaultImport(e){return tokenIsKeywordOrIdentifier(e)&&e!==97}const Je={const:"declare export var",let:"declare export var",type:"export type",interface:"export interface"};function partition(e,t){const s=[];const i=[];for(let r=0;r<e.length;r++){(t(e[r],r,e)?s:i).push(e[r])}return[s,i]}const Xe=/\*?\s*@((?:no)?flow)\b/;var flow=e=>class extends e{constructor(...e){super(...e);this.flowPragma=undefined}getScopeHandler(){return FlowScopeHandler}shouldParseTypes(){return this.getPluginOption("flow","all")||this.flowPragma==="flow"}shouldParseEnums(){return!!this.getPluginOption("flow","enums")}finishToken(e,t){if(e!==129&&e!==13&&e!==28){if(this.flowPragma===undefined){this.flowPragma=null}}return super.finishToken(e,t)}addComment(e){if(this.flowPragma===undefined){const t=Xe.exec(e.value);if(!t);else if(t[1]==="flow"){this.flowPragma="flow"}else if(t[1]==="noflow"){this.flowPragma="noflow"}else{throw new Error("Unexpected flow pragma")}}return super.addComment(e)}flowParseTypeInitialiser(e){const t=this.state.inType;this.state.inType=true;this.expect(e||14);const s=this.flowParseType();this.state.inType=t;return s}flowParsePredicate(){const e=this.startNode();const t=this.state.startLoc;this.next();this.expectContextual(107);if(this.state.lastTokStart>t.index+1){this.raise(We.UnexpectedSpaceBetweenModuloChecks,{at:t})}if(this.eat(10)){e.value=this.parseExpression();this.expect(11);return this.finishNode(e,"DeclaredPredicate")}else{return this.finishNode(e,"InferredPredicate")}}flowParseTypeAndPredicateInitialiser(){const e=this.state.inType;this.state.inType=true;this.expect(14);let t=null;let s=null;if(this.match(54)){this.state.inType=e;s=this.flowParsePredicate()}else{t=this.flowParseType();this.state.inType=e;if(this.match(54)){s=this.flowParsePredicate()}}return[t,s]}flowParseDeclareClass(e){this.next();this.flowParseInterfaceish(e,true);return this.finishNode(e,"DeclareClass")}flowParseDeclareFunction(e){this.next();const t=e.id=this.parseIdentifier();const s=this.startNode();const i=this.startNode();if(this.match(47)){s.typeParameters=this.flowParseTypeParameterDeclaration()}else{s.typeParameters=null}this.expect(10);const r=this.flowParseFunctionTypeParams();s.params=r.params;s.rest=r.rest;s.this=r._this;this.expect(11);[s.returnType,e.predicate]=this.flowParseTypeAndPredicateInitialiser();i.typeAnnotation=this.finishNode(s,"FunctionTypeAnnotation");t.typeAnnotation=this.finishNode(i,"TypeAnnotation");this.resetEndLocation(t);this.semicolon();this.scope.declareName(e.id.name,me,e.id.loc.start);return this.finishNode(e,"DeclareFunction")}flowParseDeclare(e,t){if(this.match(80)){return this.flowParseDeclareClass(e)}else if(this.match(68)){return this.flowParseDeclareFunction(e)}else if(this.match(74)){return this.flowParseDeclareVariable(e)}else if(this.eatContextual(123)){if(this.match(16)){return this.flowParseDeclareModuleExports(e)}else{if(t){this.raise(We.NestedDeclareModule,{at:this.state.lastTokStartLoc})}return this.flowParseDeclareModule(e)}}else if(this.isContextual(126)){return this.flowParseDeclareTypeAlias(e)}else if(this.isContextual(127)){return this.flowParseDeclareOpaqueType(e)}else if(this.isContextual(125)){return this.flowParseDeclareInterface(e)}else if(this.match(82)){return this.flowParseDeclareExportDeclaration(e,t)}else{throw this.unexpected()}}flowParseDeclareVariable(e){this.next();e.id=this.flowParseTypeAnnotatableIdentifier(true);this.scope.declareName(e.id.name,ae,e.id.loc.start);this.semicolon();return this.finishNode(e,"DeclareVariable")}flowParseDeclareModule(e){this.scope.enter(F);if(this.match(129)){e.id=this.parseExprAtom()}else{e.id=this.parseIdentifier()}const t=e.body=this.startNode();const s=t.body=[];this.expect(5);while(!this.match(8)){let e=this.startNode();if(this.match(83)){this.next();if(!this.isContextual(126)&&!this.match(87)){this.raise(We.InvalidNonTypeImportInDeclareModule,{at:this.state.lastTokStartLoc})}this.parseImport(e)}else{this.expectContextual(121,We.UnsupportedStatementInDeclareModule);e=this.flowParseDeclare(e,true)}s.push(e)}this.scope.exit();this.expect(8);this.finishNode(t,"BlockStatement");let i=null;let r=false;s.forEach((e=>{if(isEsModuleType(e)){if(i==="CommonJS"){this.raise(We.AmbiguousDeclareModuleKind,{at:e})}i="ES"}else if(e.type==="DeclareModuleExports"){if(r){this.raise(We.DuplicateDeclareModuleExports,{at:e})}if(i==="ES"){this.raise(We.AmbiguousDeclareModuleKind,{at:e})}i="CommonJS";r=true}}));e.kind=i||"CommonJS";return this.finishNode(e,"DeclareModule")}flowParseDeclareExportDeclaration(e,t){this.expect(82);if(this.eat(65)){if(this.match(68)||this.match(80)){e.declaration=this.flowParseDeclare(this.startNode())}else{e.declaration=this.flowParseType();this.semicolon()}e.default=true;return this.finishNode(e,"DeclareExportDeclaration")}else{if(this.match(75)||this.isLet()||(this.isContextual(126)||this.isContextual(125))&&!t){const e=this.state.value;throw this.raise(We.UnsupportedDeclareExportKind,{at:this.state.startLoc,unsupportedExportKind:e,suggestion:Je[e]})}if(this.match(74)||this.match(68)||this.match(80)||this.isContextual(127)){e.declaration=this.flowParseDeclare(this.startNode());e.default=false;return this.finishNode(e,"DeclareExportDeclaration")}else if(this.match(55)||this.match(5)||this.isContextual(125)||this.isContextual(126)||this.isContextual(127)){e=this.parseExport(e);if(e.type==="ExportNamedDeclaration"){e.type="ExportDeclaration";e.default=false;delete e.exportKind}e.type="Declare"+e.type;return e}}throw this.unexpected()}flowParseDeclareModuleExports(e){this.next();this.expectContextual(108);e.typeAnnotation=this.flowParseTypeAnnotation();this.semicolon();return this.finishNode(e,"DeclareModuleExports")}flowParseDeclareTypeAlias(e){this.next();this.flowParseTypeAlias(e);e.type="DeclareTypeAlias";return e}flowParseDeclareOpaqueType(e){this.next();this.flowParseOpaqueType(e,true);e.type="DeclareOpaqueType";return e}flowParseDeclareInterface(e){this.next();this.flowParseInterfaceish(e);return this.finishNode(e,"DeclareInterface")}flowParseInterfaceish(e,t=false){e.id=this.flowParseRestrictedIdentifier(!t,true);this.scope.declareName(e.id.name,t?ne:re,e.id.loc.start);if(this.match(47)){e.typeParameters=this.flowParseTypeParameterDeclaration()}else{e.typeParameters=null}e.extends=[];e.implements=[];e.mixins=[];if(this.eat(81)){do{e.extends.push(this.flowParseInterfaceExtends())}while(!t&&this.eat(12))}if(this.isContextual(114)){this.next();do{e.mixins.push(this.flowParseInterfaceExtends())}while(this.eat(12))}if(this.isContextual(110)){this.next();do{e.implements.push(this.flowParseInterfaceExtends())}while(this.eat(12))}e.body=this.flowParseObjectType({allowStatic:t,allowExact:false,allowSpread:false,allowProto:t,allowInexact:false})}flowParseInterfaceExtends(){const e=this.startNode();e.id=this.flowParseQualifiedTypeIdentifier();if(this.match(47)){e.typeParameters=this.flowParseTypeParameterInstantiation()}else{e.typeParameters=null}return this.finishNode(e,"InterfaceExtends")}flowParseInterface(e){this.flowParseInterfaceish(e);return this.finishNode(e,"InterfaceDeclaration")}checkNotUnderscore(e){if(e==="_"){this.raise(We.UnexpectedReservedUnderscore,{at:this.state.startLoc})}}checkReservedType(e,t,s){if(!$e.has(e))return;this.raise(s?We.AssignReservedType:We.UnexpectedReservedType,{at:t,reservedType:e})}flowParseRestrictedIdentifier(e,t){this.checkReservedType(this.state.value,this.state.startLoc,t);return this.parseIdentifier(e)}flowParseTypeAlias(e){e.id=this.flowParseRestrictedIdentifier(false,true);this.scope.declareName(e.id.name,re,e.id.loc.start);if(this.match(47)){e.typeParameters=this.flowParseTypeParameterDeclaration()}else{e.typeParameters=null}e.right=this.flowParseTypeInitialiser(29);this.semicolon();return this.finishNode(e,"TypeAlias")}flowParseOpaqueType(e,t){this.expectContextual(126);e.id=this.flowParseRestrictedIdentifier(true,true);this.scope.declareName(e.id.name,re,e.id.loc.start);if(this.match(47)){e.typeParameters=this.flowParseTypeParameterDeclaration()}else{e.typeParameters=null}e.supertype=null;if(this.match(14)){e.supertype=this.flowParseTypeInitialiser(14)}e.impltype=null;if(!t){e.impltype=this.flowParseTypeInitialiser(29)}this.semicolon();return this.finishNode(e,"OpaqueType")}flowParseTypeParameter(e=false){const t=this.state.startLoc;const s=this.startNode();const i=this.flowParseVariance();const r=this.flowParseTypeAnnotatableIdentifier();s.name=r.name;s.variance=i;s.bound=r.typeAnnotation;if(this.match(29)){this.eat(29);s.default=this.flowParseType()}else{if(e){this.raise(We.MissingTypeParamDefault,{at:t})}}return this.finishNode(s,"TypeParameter")}flowParseTypeParameterDeclaration(){const e=this.state.inType;const t=this.startNode();t.params=[];this.state.inType=true;if(this.match(47)||this.match(138)){this.next()}else{this.unexpected()}let s=false;do{const e=this.flowParseTypeParameter(s);t.params.push(e);if(e.default){s=true}if(!this.match(48)){this.expect(12)}}while(!this.match(48));this.expect(48);this.state.inType=e;return this.finishNode(t,"TypeParameterDeclaration")}flowParseTypeParameterInstantiation(){const e=this.startNode();const t=this.state.inType;e.params=[];this.state.inType=true;this.expect(47);const s=this.state.noAnonFunctionType;this.state.noAnonFunctionType=false;while(!this.match(48)){e.params.push(this.flowParseType());if(!this.match(48)){this.expect(12)}}this.state.noAnonFunctionType=s;this.expect(48);this.state.inType=t;return this.finishNode(e,"TypeParameterInstantiation")}flowParseTypeParameterInstantiationCallOrNew(){const e=this.startNode();const t=this.state.inType;e.params=[];this.state.inType=true;this.expect(47);while(!this.match(48)){e.params.push(this.flowParseTypeOrImplicitInstantiation());if(!this.match(48)){this.expect(12)}}this.expect(48);this.state.inType=t;return this.finishNode(e,"TypeParameterInstantiation")}flowParseInterfaceType(){const e=this.startNode();this.expectContextual(125);e.extends=[];if(this.eat(81)){do{e.extends.push(this.flowParseInterfaceExtends())}while(this.eat(12))}e.body=this.flowParseObjectType({allowStatic:false,allowExact:false,allowSpread:false,allowProto:false,allowInexact:false});return this.finishNode(e,"InterfaceTypeAnnotation")}flowParseObjectPropertyKey(){return this.match(130)||this.match(129)?this.parseExprAtom():this.parseIdentifier(true)}flowParseObjectTypeIndexer(e,t,s){e.static=t;if(this.lookahead().type===14){e.id=this.flowParseObjectPropertyKey();e.key=this.flowParseTypeInitialiser()}else{e.id=null;e.key=this.flowParseType()}this.expect(3);e.value=this.flowParseTypeInitialiser();e.variance=s;return this.finishNode(e,"ObjectTypeIndexer")}flowParseObjectTypeInternalSlot(e,t){e.static=t;e.id=this.flowParseObjectPropertyKey();this.expect(3);this.expect(3);if(this.match(47)||this.match(10)){e.method=true;e.optional=false;e.value=this.flowParseObjectTypeMethodish(this.startNodeAt(e.start,e.loc.start))}else{e.method=false;if(this.eat(17)){e.optional=true}e.value=this.flowParseTypeInitialiser()}return this.finishNode(e,"ObjectTypeInternalSlot")}flowParseObjectTypeMethodish(e){e.params=[];e.rest=null;e.typeParameters=null;e.this=null;if(this.match(47)){e.typeParameters=this.flowParseTypeParameterDeclaration()}this.expect(10);if(this.match(78)){e.this=this.flowParseFunctionTypeParam(true);e.this.name=null;if(!this.match(11)){this.expect(12)}}while(!this.match(11)&&!this.match(21)){e.params.push(this.flowParseFunctionTypeParam(false));if(!this.match(11)){this.expect(12)}}if(this.eat(21)){e.rest=this.flowParseFunctionTypeParam(false)}this.expect(11);e.returnType=this.flowParseTypeInitialiser();return this.finishNode(e,"FunctionTypeAnnotation")}flowParseObjectTypeCallProperty(e,t){const s=this.startNode();e.static=t;e.value=this.flowParseObjectTypeMethodish(s);return this.finishNode(e,"ObjectTypeCallProperty")}flowParseObjectType({allowStatic:e,allowExact:t,allowSpread:s,allowProto:i,allowInexact:r}){const a=this.state.inType;this.state.inType=true;const n=this.startNode();n.callProperties=[];n.properties=[];n.indexers=[];n.internalSlots=[];let o;let h;let c=false;if(t&&this.match(6)){this.expect(6);o=9;h=true}else{this.expect(5);o=8;h=false}n.exact=h;while(!this.match(o)){let t=false;let a=null;let o=null;const p=this.startNode();if(i&&this.isContextual(115)){const t=this.lookahead();if(t.type!==14&&t.type!==17){this.next();a=this.state.startLoc;e=false}}if(e&&this.isContextual(104)){const e=this.lookahead();if(e.type!==14&&e.type!==17){this.next();t=true}}const l=this.flowParseVariance();if(this.eat(0)){if(a!=null){this.unexpected(a)}if(this.eat(0)){if(l){this.unexpected(l.loc.start)}n.internalSlots.push(this.flowParseObjectTypeInternalSlot(p,t))}else{n.indexers.push(this.flowParseObjectTypeIndexer(p,t,l))}}else if(this.match(10)||this.match(47)){if(a!=null){this.unexpected(a)}if(l){this.unexpected(l.loc.start)}n.callProperties.push(this.flowParseObjectTypeCallProperty(p,t))}else{let e="init";if(this.isContextual(98)||this.isContextual(103)){const t=this.lookahead();if(tokenIsLiteralPropertyName(t.type)){e=this.state.value;this.next()}}const i=this.flowParseObjectTypeProperty(p,t,a,l,e,s,r!=null?r:!h);if(i===null){c=true;o=this.state.lastTokStartLoc}else{n.properties.push(i)}}this.flowObjectTypeSemicolon();if(o&&!this.match(8)&&!this.match(9)){this.raise(We.UnexpectedExplicitInexactInObject,{at:o})}}this.expect(o);if(s){n.inexact=c}const p=this.finishNode(n,"ObjectTypeAnnotation");this.state.inType=a;return p}flowParseObjectTypeProperty(e,t,s,i,r,a,n){if(this.eat(21)){const t=this.match(12)||this.match(13)||this.match(8)||this.match(9);if(t){if(!a){this.raise(We.InexactInsideNonObject,{at:this.state.lastTokStartLoc})}else if(!n){this.raise(We.InexactInsideExact,{at:this.state.lastTokStartLoc})}if(i){this.raise(We.InexactVariance,{at:i})}return null}if(!a){this.raise(We.UnexpectedSpreadType,{at:this.state.lastTokStartLoc})}if(s!=null){this.unexpected(s)}if(i){this.raise(We.SpreadVariance,{at:i})}e.argument=this.flowParseType();return this.finishNode(e,"ObjectTypeSpreadProperty")}else{e.key=this.flowParseObjectPropertyKey();e.static=t;e.proto=s!=null;e.kind=r;let n=false;if(this.match(47)||this.match(10)){e.method=true;if(s!=null){this.unexpected(s)}if(i){this.unexpected(i.loc.start)}e.value=this.flowParseObjectTypeMethodish(this.startNodeAt(e.start,e.loc.start));if(r==="get"||r==="set"){this.flowCheckGetterSetterParams(e)}if(!a&&e.key.name==="constructor"&&e.value.this){this.raise(We.ThisParamBannedInConstructor,{at:e.value.this})}}else{if(r!=="init")this.unexpected();e.method=false;if(this.eat(17)){n=true}e.value=this.flowParseTypeInitialiser();e.variance=i}e.optional=n;return this.finishNode(e,"ObjectTypeProperty")}}flowCheckGetterSetterParams(e){const t=e.kind==="get"?0:1;const s=e.value.params.length+(e.value.rest?1:0);if(e.value.this){this.raise(e.kind==="get"?We.GetterMayNotHaveThisParam:We.SetterMayNotHaveThisParam,{at:e.value.this})}if(s!==t){this.raise(e.kind==="get"?n.BadGetterArity:n.BadSetterArity,{at:e})}if(e.kind==="set"&&e.value.rest){this.raise(n.BadSetterRestParameter,{at:e})}}flowObjectTypeSemicolon(){if(!this.eat(13)&&!this.eat(12)&&!this.match(8)&&!this.match(9)){this.unexpected()}}flowParseQualifiedTypeIdentifier(e,t,s){e=e||this.state.start;t=t||this.state.startLoc;let i=s||this.flowParseRestrictedIdentifier(true);while(this.eat(16)){const s=this.startNodeAt(e,t);s.qualification=i;s.id=this.flowParseRestrictedIdentifier(true);i=this.finishNode(s,"QualifiedTypeIdentifier")}return i}flowParseGenericType(e,t,s){const i=this.startNodeAt(e,t);i.typeParameters=null;i.id=this.flowParseQualifiedTypeIdentifier(e,t,s);if(this.match(47)){i.typeParameters=this.flowParseTypeParameterInstantiation()}return this.finishNode(i,"GenericTypeAnnotation")}flowParseTypeofType(){const e=this.startNode();this.expect(87);e.argument=this.flowParsePrimaryType();return this.finishNode(e,"TypeofTypeAnnotation")}flowParseTupleType(){const e=this.startNode();e.types=[];this.expect(0);while(this.state.pos<this.length&&!this.match(3)){e.types.push(this.flowParseType());if(this.match(3))break;this.expect(12)}this.expect(3);return this.finishNode(e,"TupleTypeAnnotation")}flowParseFunctionTypeParam(e){let t=null;let s=false;let i=null;const r=this.startNode();const a=this.lookahead();const n=this.state.type===78;if(a.type===14||a.type===17){if(n&&!e){this.raise(We.ThisParamMustBeFirst,{at:r})}t=this.parseIdentifier(n);if(this.eat(17)){s=true;if(n){this.raise(We.ThisParamMayNotBeOptional,{at:r})}}i=this.flowParseTypeInitialiser()}else{i=this.flowParseType()}r.name=t;r.optional=s;r.typeAnnotation=i;return this.finishNode(r,"FunctionTypeParam")}reinterpretTypeAsFunctionTypeParam(e){const t=this.startNodeAt(e.start,e.loc.start);t.name=null;t.optional=false;t.typeAnnotation=e;return this.finishNode(t,"FunctionTypeParam")}flowParseFunctionTypeParams(e=[]){let t=null;let s=null;if(this.match(78)){s=this.flowParseFunctionTypeParam(true);s.name=null;if(!this.match(11)){this.expect(12)}}while(!this.match(11)&&!this.match(21)){e.push(this.flowParseFunctionTypeParam(false));if(!this.match(11)){this.expect(12)}}if(this.eat(21)){t=this.flowParseFunctionTypeParam(false)}return{params:e,rest:t,_this:s}}flowIdentToTypeAnnotation(e,t,s,i){switch(i.name){case"any":return this.finishNode(s,"AnyTypeAnnotation");case"bool":case"boolean":return this.finishNode(s,"BooleanTypeAnnotation");case"mixed":return this.finishNode(s,"MixedTypeAnnotation");case"empty":return this.finishNode(s,"EmptyTypeAnnotation");case"number":return this.finishNode(s,"NumberTypeAnnotation");case"string":return this.finishNode(s,"StringTypeAnnotation");case"symbol":return this.finishNode(s,"SymbolTypeAnnotation");default:this.checkNotUnderscore(i.name);return this.flowParseGenericType(e,t,i)}}flowParsePrimaryType(){const e=this.state.start;const t=this.state.startLoc;const s=this.startNode();let i;let r;let a=false;const n=this.state.noAnonFunctionType;switch(this.state.type){case 5:return this.flowParseObjectType({allowStatic:false,allowExact:false,allowSpread:true,allowProto:false,allowInexact:true});case 6:return this.flowParseObjectType({allowStatic:false,allowExact:true,allowSpread:true,allowProto:false,allowInexact:false});case 0:this.state.noAnonFunctionType=false;r=this.flowParseTupleType();this.state.noAnonFunctionType=n;return r;case 47:s.typeParameters=this.flowParseTypeParameterDeclaration();this.expect(10);i=this.flowParseFunctionTypeParams();s.params=i.params;s.rest=i.rest;s.this=i._this;this.expect(11);this.expect(19);s.returnType=this.flowParseType();return this.finishNode(s,"FunctionTypeAnnotation");case 10:this.next();if(!this.match(11)&&!this.match(21)){if(tokenIsIdentifier(this.state.type)||this.match(78)){const e=this.lookahead().type;a=e!==17&&e!==14}else{a=true}}if(a){this.state.noAnonFunctionType=false;r=this.flowParseType();this.state.noAnonFunctionType=n;if(this.state.noAnonFunctionType||!(this.match(12)||this.match(11)&&this.lookahead().type===19)){this.expect(11);return r}else{this.eat(12)}}if(r){i=this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(r)])}else{i=this.flowParseFunctionTypeParams()}s.params=i.params;s.rest=i.rest;s.this=i._this;this.expect(11);this.expect(19);s.returnType=this.flowParseType();s.typeParameters=null;return this.finishNode(s,"FunctionTypeAnnotation");case 129:return this.parseLiteral(this.state.value,"StringLiteralTypeAnnotation");case 85:case 86:s.value=this.match(85);this.next();return this.finishNode(s,"BooleanLiteralTypeAnnotation");case 53:if(this.state.value==="-"){this.next();if(this.match(130)){return this.parseLiteralAtNode(-this.state.value,"NumberLiteralTypeAnnotation",s)}if(this.match(131)){return this.parseLiteralAtNode(-this.state.value,"BigIntLiteralTypeAnnotation",s)}throw this.raise(We.UnexpectedSubtractionOperand,{at:this.state.startLoc})}throw this.unexpected();case 130:return this.parseLiteral(this.state.value,"NumberLiteralTypeAnnotation");case 131:return this.parseLiteral(this.state.value,"BigIntLiteralTypeAnnotation");case 88:this.next();return this.finishNode(s,"VoidTypeAnnotation");case 84:this.next();return this.finishNode(s,"NullLiteralTypeAnnotation");case 78:this.next();return this.finishNode(s,"ThisTypeAnnotation");case 55:this.next();return this.finishNode(s,"ExistsTypeAnnotation");case 87:return this.flowParseTypeofType();default:if(tokenIsKeyword(this.state.type)){const e=tokenLabelName(this.state.type);this.next();return super.createIdentifier(s,e)}else if(tokenIsIdentifier(this.state.type)){if(this.isContextual(125)){return this.flowParseInterfaceType()}return this.flowIdentToTypeAnnotation(e,t,s,this.parseIdentifier())}}throw this.unexpected()}flowParsePostfixType(){const e=this.state.start;const t=this.state.startLoc;let s=this.flowParsePrimaryType();let i=false;while((this.match(0)||this.match(18))&&!this.canInsertSemicolon()){const r=this.startNodeAt(e,t);const a=this.eat(18);i=i||a;this.expect(0);if(!a&&this.match(3)){r.elementType=s;this.next();s=this.finishNode(r,"ArrayTypeAnnotation")}else{r.objectType=s;r.indexType=this.flowParseType();this.expect(3);if(i){r.optional=a;s=this.finishNode(r,"OptionalIndexedAccessType")}else{s=this.finishNode(r,"IndexedAccessType")}}}return s}flowParsePrefixType(){const e=this.startNode();if(this.eat(17)){e.typeAnnotation=this.flowParsePrefixType();return this.finishNode(e,"NullableTypeAnnotation")}else{return this.flowParsePostfixType()}}flowParseAnonFunctionWithoutParens(){const e=this.flowParsePrefixType();if(!this.state.noAnonFunctionType&&this.eat(19)){const t=this.startNodeAt(e.start,e.loc.start);t.params=[this.reinterpretTypeAsFunctionTypeParam(e)];t.rest=null;t.this=null;t.returnType=this.flowParseType();t.typeParameters=null;return this.finishNode(t,"FunctionTypeAnnotation")}return e}flowParseIntersectionType(){const e=this.startNode();this.eat(45);const t=this.flowParseAnonFunctionWithoutParens();e.types=[t];while(this.eat(45)){e.types.push(this.flowParseAnonFunctionWithoutParens())}return e.types.length===1?t:this.finishNode(e,"IntersectionTypeAnnotation")}flowParseUnionType(){const e=this.startNode();this.eat(43);const t=this.flowParseIntersectionType();e.types=[t];while(this.eat(43)){e.types.push(this.flowParseIntersectionType())}return e.types.length===1?t:this.finishNode(e,"UnionTypeAnnotation")}flowParseType(){const e=this.state.inType;this.state.inType=true;const t=this.flowParseUnionType();this.state.inType=e;return t}flowParseTypeOrImplicitInstantiation(){if(this.state.type===128&&this.state.value==="_"){const e=this.state.start;const t=this.state.startLoc;const s=this.parseIdentifier();return this.flowParseGenericType(e,t,s)}else{return this.flowParseType()}}flowParseTypeAnnotation(){const e=this.startNode();e.typeAnnotation=this.flowParseTypeInitialiser();return this.finishNode(e,"TypeAnnotation")}flowParseTypeAnnotatableIdentifier(e){const t=e?this.parseIdentifier():this.flowParseRestrictedIdentifier();if(this.match(14)){t.typeAnnotation=this.flowParseTypeAnnotation();this.resetEndLocation(t)}return t}typeCastToParameter(e){e.expression.typeAnnotation=e.typeAnnotation;this.resetEndLocation(e.expression,e.typeAnnotation.loc.end);return e.expression}flowParseVariance(){let e=null;if(this.match(53)){e=this.startNode();if(this.state.value==="+"){e.kind="plus"}else{e.kind="minus"}this.next();this.finishNode(e,"Variance")}return e}parseFunctionBody(e,t,s=false){if(t){return this.forwardNoArrowParamsConversionAt(e,(()=>super.parseFunctionBody(e,true,s)))}return super.parseFunctionBody(e,false,s)}parseFunctionBodyAndFinish(e,t,s=false){if(this.match(14)){const t=this.startNode();[t.typeAnnotation,e.predicate]=this.flowParseTypeAndPredicateInitialiser();e.returnType=t.typeAnnotation?this.finishNode(t,"TypeAnnotation"):null}super.parseFunctionBodyAndFinish(e,t,s)}parseStatement(e,t){if(this.state.strict&&this.isContextual(125)){const e=this.lookahead();if(tokenIsKeywordOrIdentifier(e.type)){const e=this.startNode();this.next();return this.flowParseInterface(e)}}else if(this.shouldParseEnums()&&this.isContextual(122)){const e=this.startNode();this.next();return this.flowParseEnumDeclaration(e)}const s=super.parseStatement(e,t);if(this.flowPragma===undefined&&!this.isValidDirective(s)){this.flowPragma=null}return s}parseExpressionStatement(e,t){if(t.type==="Identifier"){if(t.name==="declare"){if(this.match(80)||tokenIsIdentifier(this.state.type)||this.match(68)||this.match(74)||this.match(82)){return this.flowParseDeclare(e)}}else if(tokenIsIdentifier(this.state.type)){if(t.name==="interface"){return this.flowParseInterface(e)}else if(t.name==="type"){return this.flowParseTypeAlias(e)}else if(t.name==="opaque"){return this.flowParseOpaqueType(e,false)}}}return super.parseExpressionStatement(e,t)}shouldParseExportDeclaration(){const{type:e}=this.state;if(tokenIsFlowInterfaceOrTypeOrOpaque(e)||this.shouldParseEnums()&&e===122){return!this.state.containsEsc}return super.shouldParseExportDeclaration()}isExportDefaultSpecifier(){const{type:e}=this.state;if(tokenIsFlowInterfaceOrTypeOrOpaque(e)||this.shouldParseEnums()&&e===122){return this.state.containsEsc}return super.isExportDefaultSpecifier()}parseExportDefaultExpression(){if(this.shouldParseEnums()&&this.isContextual(122)){const e=this.startNode();this.next();return this.flowParseEnumDeclaration(e)}return super.parseExportDefaultExpression()}parseConditional(e,t,s,i){if(!this.match(17))return e;if(this.state.maybeInArrowParameters){const t=this.lookaheadCharCode();if(t===44||t===61||t===58||t===41){this.setOptionalParametersError(i);return e}}this.expect(17);const r=this.state.clone();const a=this.state.noArrowAt;const n=this.startNodeAt(t,s);let{consequent:o,failed:h}=this.tryParseConditionalConsequent();let[c,p]=this.getArrowLikeExpressions(o);if(h||p.length>0){const e=[...a];if(p.length>0){this.state=r;this.state.noArrowAt=e;for(let t=0;t<p.length;t++){e.push(p[t].start)}({consequent:o,failed:h}=this.tryParseConditionalConsequent());[c,p]=this.getArrowLikeExpressions(o)}if(h&&c.length>1){this.raise(We.AmbiguousConditionalArrow,{at:r.startLoc})}if(h&&c.length===1){this.state=r;e.push(c[0].start);this.state.noArrowAt=e;({consequent:o,failed:h}=this.tryParseConditionalConsequent())}}this.getArrowLikeExpressions(o,true);this.state.noArrowAt=a;this.expect(14);n.test=e;n.consequent=o;n.alternate=this.forwardNoArrowParamsConversionAt(n,(()=>this.parseMaybeAssign(undefined,undefined)));return this.finishNode(n,"ConditionalExpression")}tryParseConditionalConsequent(){this.state.noArrowParamsConversionAt.push(this.state.start);const e=this.parseMaybeAssignAllowIn();const t=!this.match(14);this.state.noArrowParamsConversionAt.pop();return{consequent:e,failed:t}}getArrowLikeExpressions(e,t){const s=[e];const i=[];while(s.length!==0){const e=s.pop();if(e.type==="ArrowFunctionExpression"){if(e.typeParameters||!e.returnType){this.finishArrowValidation(e)}else{i.push(e)}s.push(e.body)}else if(e.type==="ConditionalExpression"){s.push(e.consequent);s.push(e.alternate)}}if(t){i.forEach((e=>this.finishArrowValidation(e)));return[i,[]]}return partition(i,(e=>e.params.every((e=>this.isAssignable(e,true)))))}finishArrowValidation(e){var t;this.toAssignableList(e.params,(t=e.extra)==null?void 0:t.trailingCommaLoc,false);this.scope.enter(R|j);super.checkParams(e,false,true);this.scope.exit()}forwardNoArrowParamsConversionAt(e,t){let s;if(this.state.noArrowParamsConversionAt.indexOf(e.start)!==-1){this.state.noArrowParamsConversionAt.push(this.state.start);s=t();this.state.noArrowParamsConversionAt.pop()}else{s=t()}return s}parseParenItem(e,t,s){e=super.parseParenItem(e,t,s);if(this.eat(17)){e.optional=true;this.resetEndLocation(e)}if(this.match(14)){const i=this.startNodeAt(t,s);i.expression=e;i.typeAnnotation=this.flowParseTypeAnnotation();return this.finishNode(i,"TypeCastExpression")}return e}assertModuleNodeAllowed(e){if(e.type==="ImportDeclaration"&&(e.importKind==="type"||e.importKind==="typeof")||e.type==="ExportNamedDeclaration"&&e.exportKind==="type"||e.type==="ExportAllDeclaration"&&e.exportKind==="type"){return}super.assertModuleNodeAllowed(e)}parseExport(e){const t=super.parseExport(e);if(t.type==="ExportNamedDeclaration"||t.type==="ExportAllDeclaration"){t.exportKind=t.exportKind||"value"}return t}parseExportDeclaration(e){if(this.isContextual(126)){e.exportKind="type";const t=this.startNode();this.next();if(this.match(5)){e.specifiers=this.parseExportSpecifiers(true);this.parseExportFrom(e);return null}else{return this.flowParseTypeAlias(t)}}else if(this.isContextual(127)){e.exportKind="type";const t=this.startNode();this.next();return this.flowParseOpaqueType(t,false)}else if(this.isContextual(125)){e.exportKind="type";const t=this.startNode();this.next();return this.flowParseInterface(t)}else if(this.shouldParseEnums()&&this.isContextual(122)){e.exportKind="value";const t=this.startNode();this.next();return this.flowParseEnumDeclaration(t)}else{return super.parseExportDeclaration(e)}}eatExportStar(e){if(super.eatExportStar(...arguments))return true;if(this.isContextual(126)&&this.lookahead().type===55){e.exportKind="type";this.next();this.next();return true}return false}maybeParseExportNamespaceSpecifier(e){const{startLoc:t}=this.state;const s=super.maybeParseExportNamespaceSpecifier(e);if(s&&e.exportKind==="type"){this.unexpected(t)}return s}parseClassId(e,t,s){super.parseClassId(e,t,s);if(this.match(47)){e.typeParameters=this.flowParseTypeParameterDeclaration()}}parseClassMember(e,t,s){const{startLoc:i}=this.state;if(this.isContextual(121)){if(this.parseClassMemberFromModifier(e,t)){return}t.declare=true}super.parseClassMember(e,t,s);if(t.declare){if(t.type!=="ClassProperty"&&t.type!=="ClassPrivateProperty"&&t.type!=="PropertyDefinition"){this.raise(We.DeclareClassElement,{at:i})}else if(t.value){this.raise(We.DeclareClassFieldInitializer,{at:t.value})}}}isIterator(e){return e==="iterator"||e==="asyncIterator"}readIterator(){const e=super.readWord1();const t="@@"+e;if(!this.isIterator(e)||!this.state.inType){this.raise(n.InvalidIdentifier,{at:this.state.curPosition(),identifierName:t})}this.finishToken(128,t)}getTokenFromCode(e){const t=this.input.charCodeAt(this.state.pos+1);if(e===123&&t===124){return this.finishOp(6,2)}else if(this.state.inType&&(e===62||e===60)){return this.finishOp(e===62?48:47,1)}else if(this.state.inType&&e===63){if(t===46){return this.finishOp(18,2)}return this.finishOp(17,1)}else if(isIteratorStart(e,t,this.input.charCodeAt(this.state.pos+2))){this.state.pos+=2;return this.readIterator()}else{return super.getTokenFromCode(e)}}isAssignable(e,t){if(e.type==="TypeCastExpression"){return this.isAssignable(e.expression,t)}else{return super.isAssignable(e,t)}}toAssignable(e,t=false){if(!t&&e.type==="AssignmentExpression"&&e.left.type==="TypeCastExpression"){e.left=this.typeCastToParameter(e.left)}super.toAssignable(...arguments)}toAssignableList(e,t,s){for(let t=0;t<e.length;t++){const s=e[t];if((s==null?void 0:s.type)==="TypeCastExpression"){e[t]=this.typeCastToParameter(s)}}super.toAssignableList(e,t,s)}toReferencedList(e,t){for(let i=0;i<e.length;i++){var s;const r=e[i];if(r&&r.type==="TypeCastExpression"&&!((s=r.extra)!=null&&s.parenthesized)&&(e.length>1||!t)){this.raise(We.TypeCastInPattern,{at:r.typeAnnotation})}}return e}parseArrayLike(e,t,s,i){const r=super.parseArrayLike(e,t,s,i);if(t&&!this.state.maybeInArrowParameters){this.toReferencedList(r.elements)}return r}isValidLVal(e,...t){return e==="TypeCastExpression"||super.isValidLVal(e,...t)}parseClassProperty(e){if(this.match(14)){e.typeAnnotation=this.flowParseTypeAnnotation()}return super.parseClassProperty(e)}parseClassPrivateProperty(e){if(this.match(14)){e.typeAnnotation=this.flowParseTypeAnnotation()}return super.parseClassPrivateProperty(e)}isClassMethod(){return this.match(47)||super.isClassMethod()}isClassProperty(){return this.match(14)||super.isClassProperty()}isNonstaticConstructor(e){return!this.match(14)&&super.isNonstaticConstructor(e)}pushClassMethod(e,t,s,i,r,a){if(t.variance){this.unexpected(t.variance.loc.start)}delete t.variance;if(this.match(47)){t.typeParameters=this.flowParseTypeParameterDeclaration()}super.pushClassMethod(e,t,s,i,r,a);if(t.params&&r){const e=t.params;if(e.length>0&&this.isThisParam(e[0])){this.raise(We.ThisParamBannedInConstructor,{at:t})}}else if(t.type==="MethodDefinition"&&r&&t.value.params){const e=t.value.params;if(e.length>0&&this.isThisParam(e[0])){this.raise(We.ThisParamBannedInConstructor,{at:t})}}}pushClassPrivateMethod(e,t,s,i){if(t.variance){this.unexpected(t.variance.loc.start)}delete t.variance;if(this.match(47)){t.typeParameters=this.flowParseTypeParameterDeclaration()}super.pushClassPrivateMethod(e,t,s,i)}parseClassSuper(e){super.parseClassSuper(e);if(e.superClass&&this.match(47)){e.superTypeParameters=this.flowParseTypeParameterInstantiation()}if(this.isContextual(110)){this.next();const t=e.implements=[];do{const e=this.startNode();e.id=this.flowParseRestrictedIdentifier(true);if(this.match(47)){e.typeParameters=this.flowParseTypeParameterInstantiation()}else{e.typeParameters=null}t.push(this.finishNode(e,"ClassImplements"))}while(this.eat(12))}}checkGetterSetterParams(e){super.checkGetterSetterParams(e);const t=this.getObjectOrClassMethodParams(e);if(t.length>0){const s=t[0];if(this.isThisParam(s)&&e.kind==="get"){this.raise(We.GetterMayNotHaveThisParam,{at:s})}else if(this.isThisParam(s)){this.raise(We.SetterMayNotHaveThisParam,{at:s})}}}parsePropertyNamePrefixOperator(e){e.variance=this.flowParseVariance()}parseObjPropValue(e,t,s,i,r,a,n,o){if(e.variance){this.unexpected(e.variance.loc.start)}delete e.variance;let h;if(this.match(47)&&!n){h=this.flowParseTypeParameterDeclaration();if(!this.match(10))this.unexpected()}super.parseObjPropValue(e,t,s,i,r,a,n,o);if(h){(e.value||e).typeParameters=h}}parseAssignableListItemTypes(e){if(this.eat(17)){if(e.type!=="Identifier"){this.raise(We.PatternIsOptional,{at:e})}if(this.isThisParam(e)){this.raise(We.ThisParamMayNotBeOptional,{at:e})}e.optional=true}if(this.match(14)){e.typeAnnotation=this.flowParseTypeAnnotation()}else if(this.isThisParam(e)){this.raise(We.ThisParamAnnotationRequired,{at:e})}if(this.match(29)&&this.isThisParam(e)){this.raise(We.ThisParamNoDefault,{at:e})}this.resetEndLocation(e);return e}parseMaybeDefault(e,t,s){const i=super.parseMaybeDefault(e,t,s);if(i.type==="AssignmentPattern"&&i.typeAnnotation&&i.right.start<i.typeAnnotation.start){this.raise(We.TypeBeforeInitializer,{at:i.typeAnnotation})}return i}shouldParseDefaultImport(e){if(!hasTypeImportKind(e)){return super.shouldParseDefaultImport(e)}return isMaybeDefaultImport(this.state.type)}parseImportSpecifierLocal(e,t,s){t.local=hasTypeImportKind(e)?this.flowParseRestrictedIdentifier(true,true):this.parseIdentifier();e.specifiers.push(this.finishImportSpecifier(t,s))}maybeParseDefaultImportSpecifier(e){e.importKind="value";let t=null;if(this.match(87)){t="typeof"}else if(this.isContextual(126)){t="type"}if(t){const s=this.lookahead();const{type:i}=s;if(t==="type"&&i===55){this.unexpected(null,s.type)}if(isMaybeDefaultImport(i)||i===5||i===55){this.next();e.importKind=t}}return super.maybeParseDefaultImportSpecifier(e)}parseImportSpecifier(e,t,s,i){const r=e.imported;let a=null;if(r.type==="Identifier"){if(r.name==="type"){a="type"}else if(r.name==="typeof"){a="typeof"}}let o=false;if(this.isContextual(93)&&!this.isLookaheadContextual("as")){const t=this.parseIdentifier(true);if(a!==null&&!tokenIsKeywordOrIdentifier(this.state.type)){e.imported=t;e.importKind=a;e.local=cloneIdentifier(t)}else{e.imported=r;e.importKind=null;e.local=this.parseIdentifier()}}else{if(a!==null&&tokenIsKeywordOrIdentifier(this.state.type)){e.imported=this.parseIdentifier(true);e.importKind=a}else{if(t){throw this.raise(n.ImportBindingIsString,{at:e,importName:r.value})}e.imported=r;e.importKind=null}if(this.eatContextual(93)){e.local=this.parseIdentifier()}else{o=true;e.local=cloneIdentifier(e.imported)}}const h=hasTypeImportKind(e);if(s&&h){this.raise(We.ImportTypeShorthandOnlyInPureImport,{at:e})}if(s||h){this.checkReservedType(e.local.name,e.local.loc.start,true)}if(o&&!s&&!h){this.checkReservedWord(e.local.name,e.loc.start,true,true)}return this.finishImportSpecifier(e,"ImportSpecifier")}parseBindingAtom(){switch(this.state.type){case 78:return this.parseIdentifier(true);default:return super.parseBindingAtom()}}parseFunctionParams(e,t){const s=e.kind;if(s!=="get"&&s!=="set"&&this.match(47)){e.typeParameters=this.flowParseTypeParameterDeclaration()}super.parseFunctionParams(e,t)}parseVarId(e,t){super.parseVarId(e,t);if(this.match(14)){e.id.typeAnnotation=this.flowParseTypeAnnotation();this.resetEndLocation(e.id)}}parseAsyncArrowFromCallExpression(e,t){if(this.match(14)){const t=this.state.noAnonFunctionType;this.state.noAnonFunctionType=true;e.returnType=this.flowParseTypeAnnotation();this.state.noAnonFunctionType=t}return super.parseAsyncArrowFromCallExpression(e,t)}shouldParseAsyncArrow(){return this.match(14)||super.shouldParseAsyncArrow()}parseMaybeAssign(e,t){var s;let i=null;let r;if(this.hasPlugin("jsx")&&(this.match(138)||this.match(47))){i=this.state.clone();r=this.tryParse((()=>super.parseMaybeAssign(e,t)),i);if(!r.error)return r.node;const{context:s}=this.state;const a=s[s.length-1];if(a===h.j_oTag||a===h.j_expr){s.pop()}}if((s=r)!=null&&s.error||this.match(47)){var a,n;i=i||this.state.clone();let s;const o=this.tryParse((i=>{var r;s=this.flowParseTypeParameterDeclaration();const a=this.forwardNoArrowParamsConversionAt(s,(()=>{const i=super.parseMaybeAssign(e,t);this.resetStartLocationFromNode(i,s);return i}));if((r=a.extra)!=null&&r.parenthesized)i();const n=this.maybeUnwrapTypeCastExpression(a);if(n.type!=="ArrowFunctionExpression")i();n.typeParameters=s;this.resetStartLocationFromNode(n,s);return a}),i);let h=null;if(o.node&&this.maybeUnwrapTypeCastExpression(o.node).type==="ArrowFunctionExpression"){if(!o.error&&!o.aborted){if(o.node.async){this.raise(We.UnexpectedTypeParameterBeforeAsyncArrowFunction,{at:s})}return o.node}h=o.node}if((a=r)!=null&&a.node){this.state=r.failState;return r.node}if(h){this.state=o.failState;return h}if((n=r)!=null&&n.thrown)throw r.error;if(o.thrown)throw o.error;throw this.raise(We.UnexpectedTokenAfterTypeParameter,{at:s})}return super.parseMaybeAssign(e,t)}parseArrow(e){if(this.match(14)){const t=this.tryParse((()=>{const t=this.state.noAnonFunctionType;this.state.noAnonFunctionType=true;const s=this.startNode();[s.typeAnnotation,e.predicate]=this.flowParseTypeAndPredicateInitialiser();this.state.noAnonFunctionType=t;if(this.canInsertSemicolon())this.unexpected();if(!this.match(19))this.unexpected();return s}));if(t.thrown)return null;if(t.error)this.state=t.failState;e.returnType=t.node.typeAnnotation?this.finishNode(t.node,"TypeAnnotation"):null}return super.parseArrow(e)}shouldParseArrow(e){return this.match(14)||super.shouldParseArrow(e)}setArrowFunctionParameters(e,t){if(this.state.noArrowParamsConversionAt.indexOf(e.start)!==-1){e.params=t}else{super.setArrowFunctionParameters(e,t)}}checkParams(e,t,s){if(s&&this.state.noArrowParamsConversionAt.indexOf(e.start)!==-1){return}for(let t=0;t<e.params.length;t++){if(this.isThisParam(e.params[t])&&t>0){this.raise(We.ThisParamMustBeFirst,{at:e.params[t]})}}return super.checkParams(...arguments)}parseParenAndDistinguishExpression(e){return super.parseParenAndDistinguishExpression(e&&this.state.noArrowAt.indexOf(this.state.start)===-1)}parseSubscripts(e,t,s,i){if(e.type==="Identifier"&&e.name==="async"&&this.state.noArrowAt.indexOf(t)!==-1){this.next();const i=this.startNodeAt(t,s);i.callee=e;i.arguments=this.parseCallExpressionArguments(11,false);e=this.finishNode(i,"CallExpression")}else if(e.type==="Identifier"&&e.name==="async"&&this.match(47)){const r=this.state.clone();const a=this.tryParse((e=>this.parseAsyncArrowWithTypeParameters(t,s)||e()),r);if(!a.error&&!a.aborted)return a.node;const n=this.tryParse((()=>super.parseSubscripts(e,t,s,i)),r);if(n.node&&!n.error)return n.node;if(a.node){this.state=a.failState;return a.node}if(n.node){this.state=n.failState;return n.node}throw a.error||n.error}return super.parseSubscripts(e,t,s,i)}parseSubscript(e,t,s,i,r){if(this.match(18)&&this.isLookaheadToken_lt()){r.optionalChainMember=true;if(i){r.stop=true;return e}this.next();const a=this.startNodeAt(t,s);a.callee=e;a.typeArguments=this.flowParseTypeParameterInstantiation();this.expect(10);a.arguments=this.parseCallExpressionArguments(11,false);a.optional=true;return this.finishCallExpression(a,true)}else if(!i&&this.shouldParseTypes()&&this.match(47)){const i=this.startNodeAt(t,s);i.callee=e;const a=this.tryParse((()=>{i.typeArguments=this.flowParseTypeParameterInstantiationCallOrNew();this.expect(10);i.arguments=this.parseCallExpressionArguments(11,false);if(r.optionalChainMember)i.optional=false;return this.finishCallExpression(i,r.optionalChainMember)}));if(a.node){if(a.error)this.state=a.failState;return a.node}}return super.parseSubscript(e,t,s,i,r)}parseNewCallee(e){super.parseNewCallee(e);let t=null;if(this.shouldParseTypes()&&this.match(47)){t=this.tryParse((()=>this.flowParseTypeParameterInstantiationCallOrNew())).node}e.typeArguments=t}parseAsyncArrowWithTypeParameters(e,t){const s=this.startNodeAt(e,t);this.parseFunctionParams(s);if(!this.parseArrow(s))return;return this.parseArrowExpression(s,undefined,true)}readToken_mult_modulo(e){const t=this.input.charCodeAt(this.state.pos+1);if(e===42&&t===47&&this.state.hasFlowComment){this.state.hasFlowComment=false;this.state.pos+=2;this.nextToken();return}super.readToken_mult_modulo(e)}readToken_pipe_amp(e){const t=this.input.charCodeAt(this.state.pos+1);if(e===124&&t===125){this.finishOp(9,2);return}super.readToken_pipe_amp(e)}parseTopLevel(e,t){const s=super.parseTopLevel(e,t);if(this.state.hasFlowComment){this.raise(We.UnterminatedFlowComment,{at:this.state.curPosition()})}return s}skipBlockComment(){if(this.hasPlugin("flowComments")&&this.skipFlowComment()){if(this.state.hasFlowComment){throw this.raise(We.NestedFlowComment,{at:this.state.startLoc})}this.hasFlowCommentCompletion();this.state.pos+=this.skipFlowComment();this.state.hasFlowComment=true;return}if(this.state.hasFlowComment){const e=this.input.indexOf("*-/",this.state.pos+2);if(e===-1){throw this.raise(n.UnterminatedComment,{at:this.state.curPosition()})}this.state.pos=e+2+3;return}return super.skipBlockComment()}skipFlowComment(){const{pos:e}=this.state;let t=2;while([32,9].includes(this.input.charCodeAt(e+t))){t++}const s=this.input.charCodeAt(t+e);const i=this.input.charCodeAt(t+e+1);if(s===58&&i===58){return t+2}if(this.input.slice(t+e,t+e+12)==="flow-include"){return t+12}if(s===58&&i!==58){return t}return false}hasFlowCommentCompletion(){const e=this.input.indexOf("*/",this.state.pos);if(e===-1){throw this.raise(n.UnterminatedComment,{at:this.state.curPosition()})}}flowEnumErrorBooleanMemberNotInitialized(e,{enumName:t,memberName:s}){this.raise(We.EnumBooleanMemberNotInitialized,{at:e,memberName:s,enumName:t})}flowEnumErrorInvalidMemberInitializer(e,t){return this.raise(!t.explicitType?We.EnumInvalidMemberInitializerUnknownType:t.explicitType==="symbol"?We.EnumInvalidMemberInitializerSymbolType:We.EnumInvalidMemberInitializerPrimaryType,Object.assign({at:e},t))}flowEnumErrorNumberMemberNotInitialized(e,{enumName:t,memberName:s}){this.raise(We.EnumNumberMemberNotInitialized,{at:e,enumName:t,memberName:s})}flowEnumErrorStringMemberInconsistentlyInitailized(e,{enumName:t}){this.raise(We.EnumStringMemberInconsistentlyInitailized,{at:e,enumName:t})}flowEnumMemberInit(){const e=this.state.startLoc;const endOfInit=()=>this.match(12)||this.match(8);switch(this.state.type){case 130:{const t=this.parseNumericLiteral(this.state.value);if(endOfInit()){return{type:"number",loc:t.loc.start,value:t}}return{type:"invalid",loc:e}}case 129:{const t=this.parseStringLiteral(this.state.value);if(endOfInit()){return{type:"string",loc:t.loc.start,value:t}}return{type:"invalid",loc:e}}case 85:case 86:{const t=this.parseBooleanLiteral(this.match(85));if(endOfInit()){return{type:"boolean",loc:t.loc.start,value:t}}return{type:"invalid",loc:e}}default:return{type:"invalid",loc:e}}}flowEnumMemberRaw(){const e=this.state.startLoc;const t=this.parseIdentifier(true);const s=this.eat(29)?this.flowEnumMemberInit():{type:"none",loc:e};return{id:t,init:s}}flowEnumCheckExplicitTypeMismatch(e,t,s){const{explicitType:i}=t;if(i===null){return}if(i!==s){this.flowEnumErrorInvalidMemberInitializer(e,t)}}flowEnumMembers({enumName:e,explicitType:t}){const s=new Set;const i={booleanMembers:[],numberMembers:[],stringMembers:[],defaultedMembers:[]};let r=false;while(!this.match(8)){if(this.eat(21)){r=true;break}const a=this.startNode();const{id:n,init:o}=this.flowEnumMemberRaw();const h=n.name;if(h===""){continue}if(/^[a-z]/.test(h)){this.raise(We.EnumInvalidMemberName,{at:n,memberName:h,suggestion:h[0].toUpperCase()+h.slice(1),enumName:e})}if(s.has(h)){this.raise(We.EnumDuplicateMemberName,{at:n,memberName:h,enumName:e})}s.add(h);const c={enumName:e,explicitType:t,memberName:h};a.id=n;switch(o.type){case"boolean":{this.flowEnumCheckExplicitTypeMismatch(o.loc,c,"boolean");a.init=o.value;i.booleanMembers.push(this.finishNode(a,"EnumBooleanMember"));break}case"number":{this.flowEnumCheckExplicitTypeMismatch(o.loc,c,"number");a.init=o.value;i.numberMembers.push(this.finishNode(a,"EnumNumberMember"));break}case"string":{this.flowEnumCheckExplicitTypeMismatch(o.loc,c,"string");a.init=o.value;i.stringMembers.push(this.finishNode(a,"EnumStringMember"));break}case"invalid":{throw this.flowEnumErrorInvalidMemberInitializer(o.loc,c)}case"none":{switch(t){case"boolean":this.flowEnumErrorBooleanMemberNotInitialized(o.loc,c);break;case"number":this.flowEnumErrorNumberMemberNotInitialized(o.loc,c);break;default:i.defaultedMembers.push(this.finishNode(a,"EnumDefaultedMember"))}}}if(!this.match(8)){this.expect(12)}}return{members:i,hasUnknownMembers:r}}flowEnumStringMembers(e,t,{enumName:s}){if(e.length===0){return t}else if(t.length===0){return e}else if(t.length>e.length){for(const t of e){this.flowEnumErrorStringMemberInconsistentlyInitailized(t,{enumName:s})}return t}else{for(const e of t){this.flowEnumErrorStringMemberInconsistentlyInitailized(e,{enumName:s})}return e}}flowEnumParseExplicitType({enumName:e}){if(!this.eatContextual(101))return null;if(!tokenIsIdentifier(this.state.type)){throw this.raise(We.EnumInvalidExplicitTypeUnknownSupplied,{at:this.state.startLoc,enumName:e})}const{value:t}=this.state;this.next();if(t!=="boolean"&&t!=="number"&&t!=="string"&&t!=="symbol"){this.raise(We.EnumInvalidExplicitType,{at:this.state.startLoc,enumName:e,invalidEnumType:t})}return t}flowEnumBody(e,t){const s=t.name;const i=t.loc.start;const r=this.flowEnumParseExplicitType({enumName:s});this.expect(5);const{members:a,hasUnknownMembers:n}=this.flowEnumMembers({enumName:s,explicitType:r});e.hasUnknownMembers=n;switch(r){case"boolean":e.explicitType=true;e.members=a.booleanMembers;this.expect(8);return this.finishNode(e,"EnumBooleanBody");case"number":e.explicitType=true;e.members=a.numberMembers;this.expect(8);return this.finishNode(e,"EnumNumberBody");case"string":e.explicitType=true;e.members=this.flowEnumStringMembers(a.stringMembers,a.defaultedMembers,{enumName:s});this.expect(8);return this.finishNode(e,"EnumStringBody");case"symbol":e.members=a.defaultedMembers;this.expect(8);return this.finishNode(e,"EnumSymbolBody");default:{const empty=()=>{e.members=[];this.expect(8);return this.finishNode(e,"EnumStringBody")};e.explicitType=false;const t=a.booleanMembers.length;const r=a.numberMembers.length;const n=a.stringMembers.length;const o=a.defaultedMembers.length;if(!t&&!r&&!n&&!o){return empty()}else if(!t&&!r){e.members=this.flowEnumStringMembers(a.stringMembers,a.defaultedMembers,{enumName:s});this.expect(8);return this.finishNode(e,"EnumStringBody")}else if(!r&&!n&&t>=o){for(const e of a.defaultedMembers){this.flowEnumErrorBooleanMemberNotInitialized(e.loc.start,{enumName:s,memberName:e.id.name})}e.members=a.booleanMembers;this.expect(8);return this.finishNode(e,"EnumBooleanBody")}else if(!t&&!n&&r>=o){for(const e of a.defaultedMembers){this.flowEnumErrorNumberMemberNotInitialized(e.loc.start,{enumName:s,memberName:e.id.name})}e.members=a.numberMembers;this.expect(8);return this.finishNode(e,"EnumNumberBody")}else{this.raise(We.EnumInconsistentMemberValues,{at:i,enumName:s});return empty()}}}}flowParseEnumDeclaration(e){const t=this.parseIdentifier();e.id=t;e.body=this.flowEnumBody(this.startNode(),t);return this.finishNode(e,"EnumDeclaration")}isLookaheadToken_lt(){const e=this.nextTokenStart();if(this.input.charCodeAt(e)===60){const t=this.input.charCodeAt(e+1);return t!==60&&t!==61}return false}maybeUnwrapTypeCastExpression(e){return e.type==="TypeCastExpression"?e.expression:e}};const Ge={__proto__:null,quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"};const Ye=ParseErrorEnum`jsx`((e=>({AttributeIsEmpty:e("JSX attributes must only be assigned a non-empty expression."),MissingClosingTagElement:e((({openingTagName:e})=>`Expected corresponding JSX closing tag for <${e}>.`)),MissingClosingTagFragment:e("Expected corresponding JSX closing tag for <>."),UnexpectedSequenceExpression:e("Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?"),UnexpectedToken:e((({unexpected:e,HTMLEntity:t})=>`Unexpected token \`${e}\`. Did you mean \`${t}\` or \`{'${e}'}\`?`)),UnsupportedJsxValue:e("JSX value should be either an expression or a quoted JSX text."),UnterminatedJsxContent:e("Unterminated JSX contents."),UnwrappedAdjacentJSXElements:e("Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?")})));function isFragment(e){return e?e.type==="JSXOpeningFragment"||e.type==="JSXClosingFragment":false}function getQualifiedJSXName(e){if(e.type==="JSXIdentifier"){return e.name}if(e.type==="JSXNamespacedName"){return e.namespace.name+":"+e.name.name}if(e.type==="JSXMemberExpression"){return getQualifiedJSXName(e.object)+"."+getQualifiedJSXName(e.property)}throw new Error("Node had unexpected type: "+e.type)}var jsx=e=>class extends e{jsxReadToken(){let e="";let t=this.state.pos;for(;;){if(this.state.pos>=this.length){throw this.raise(Ye.UnterminatedJsxContent,{at:this.state.startLoc})}const s=this.input.charCodeAt(this.state.pos);switch(s){case 60:case 123:if(this.state.pos===this.state.start){if(s===60&&this.state.canStartJSXElement){++this.state.pos;return this.finishToken(138)}return super.getTokenFromCode(s)}e+=this.input.slice(t,this.state.pos);return this.finishToken(137,e);case 38:e+=this.input.slice(t,this.state.pos);e+=this.jsxReadEntity();t=this.state.pos;break;case 62:case 125:default:if(isNewLine(s)){e+=this.input.slice(t,this.state.pos);e+=this.jsxReadNewLine(true);t=this.state.pos}else{++this.state.pos}}}}jsxReadNewLine(e){const t=this.input.charCodeAt(this.state.pos);let s;++this.state.pos;if(t===13&&this.input.charCodeAt(this.state.pos)===10){++this.state.pos;s=e?"\n":"\r\n"}else{s=String.fromCharCode(t)}++this.state.curLine;this.state.lineStart=this.state.pos;return s}jsxReadString(e){let t="";let s=++this.state.pos;for(;;){if(this.state.pos>=this.length){throw this.raise(n.UnterminatedString,{at:this.state.startLoc})}const i=this.input.charCodeAt(this.state.pos);if(i===e)break;if(i===38){t+=this.input.slice(s,this.state.pos);t+=this.jsxReadEntity();s=this.state.pos}else if(isNewLine(i)){t+=this.input.slice(s,this.state.pos);t+=this.jsxReadNewLine(false);s=this.state.pos}else{++this.state.pos}}t+=this.input.slice(s,this.state.pos++);return this.finishToken(129,t)}jsxReadEntity(){const e=++this.state.pos;if(this.codePointAtPos(this.state.pos)===35){++this.state.pos;let e=10;if(this.codePointAtPos(this.state.pos)===120){e=16;++this.state.pos}const t=this.readInt(e,undefined,false,"bail");if(t!==null&&this.codePointAtPos(this.state.pos)===59){++this.state.pos;return String.fromCodePoint(t)}}else{let t=0;let s=false;while(t++<10&&this.state.pos<this.length&&!(s=this.codePointAtPos(this.state.pos)==59)){++this.state.pos}if(s){const t=this.input.slice(e,this.state.pos);const s=Ge[t];++this.state.pos;if(s){return s}}}this.state.pos=e;return"&"}jsxReadWord(){let e;const t=this.state.pos;do{e=this.input.charCodeAt(++this.state.pos)}while(isIdentifierChar(e)||e===45);return this.finishToken(136,this.input.slice(t,this.state.pos))}jsxParseIdentifier(){const e=this.startNode();if(this.match(136)){e.name=this.state.value}else if(tokenIsKeyword(this.state.type)){e.name=tokenLabelName(this.state.type)}else{this.unexpected()}this.next();return this.finishNode(e,"JSXIdentifier")}jsxParseNamespacedName(){const e=this.state.start;const t=this.state.startLoc;const s=this.jsxParseIdentifier();if(!this.eat(14))return s;const i=this.startNodeAt(e,t);i.namespace=s;i.name=this.jsxParseIdentifier();return this.finishNode(i,"JSXNamespacedName")}jsxParseElementName(){const e=this.state.start;const t=this.state.startLoc;let s=this.jsxParseNamespacedName();if(s.type==="JSXNamespacedName"){return s}while(this.eat(16)){const i=this.startNodeAt(e,t);i.object=s;i.property=this.jsxParseIdentifier();s=this.finishNode(i,"JSXMemberExpression")}return s}jsxParseAttributeValue(){let e;switch(this.state.type){case 5:e=this.startNode();this.setContext(h.brace);this.next();e=this.jsxParseExpressionContainer(e,h.j_oTag);if(e.expression.type==="JSXEmptyExpression"){this.raise(Ye.AttributeIsEmpty,{at:e})}return e;case 138:case 129:return this.parseExprAtom();default:throw this.raise(Ye.UnsupportedJsxValue,{at:this.state.startLoc})}}jsxParseEmptyExpression(){const e=this.startNodeAt(this.state.lastTokEndLoc.index,this.state.lastTokEndLoc);return this.finishNodeAt(e,"JSXEmptyExpression",this.state.startLoc)}jsxParseSpreadChild(e){this.next();e.expression=this.parseExpression();this.setContext(h.j_oTag);this.state.canStartJSXElement=true;this.expect(8);return this.finishNode(e,"JSXSpreadChild")}jsxParseExpressionContainer(e,t){if(this.match(8)){e.expression=this.jsxParseEmptyExpression()}else{const t=this.parseExpression();e.expression=t}this.setContext(t);this.state.canStartJSXElement=true;this.expect(8);return this.finishNode(e,"JSXExpressionContainer")}jsxParseAttribute(){const e=this.startNode();if(this.match(5)){this.setContext(h.brace);this.next();this.expect(21);e.argument=this.parseMaybeAssignAllowIn();this.setContext(h.j_oTag);this.state.canStartJSXElement=true;this.expect(8);return this.finishNode(e,"JSXSpreadAttribute")}e.name=this.jsxParseNamespacedName();e.value=this.eat(29)?this.jsxParseAttributeValue():null;return this.finishNode(e,"JSXAttribute")}jsxParseOpeningElementAt(e,t){const s=this.startNodeAt(e,t);if(this.eat(139)){return this.finishNode(s,"JSXOpeningFragment")}s.name=this.jsxParseElementName();return this.jsxParseOpeningElementAfterName(s)}jsxParseOpeningElementAfterName(e){const t=[];while(!this.match(56)&&!this.match(139)){t.push(this.jsxParseAttribute())}e.attributes=t;e.selfClosing=this.eat(56);this.expect(139);return this.finishNode(e,"JSXOpeningElement")}jsxParseClosingElementAt(e,t){const s=this.startNodeAt(e,t);if(this.eat(139)){return this.finishNode(s,"JSXClosingFragment")}s.name=this.jsxParseElementName();this.expect(139);return this.finishNode(s,"JSXClosingElement")}jsxParseElementAt(e,t){const s=this.startNodeAt(e,t);const i=[];const r=this.jsxParseOpeningElementAt(e,t);let a=null;if(!r.selfClosing){e:for(;;){switch(this.state.type){case 138:e=this.state.start;t=this.state.startLoc;this.next();if(this.eat(56)){a=this.jsxParseClosingElementAt(e,t);break e}i.push(this.jsxParseElementAt(e,t));break;case 137:i.push(this.parseExprAtom());break;case 5:{const e=this.startNode();this.setContext(h.brace);this.next();if(this.match(21)){i.push(this.jsxParseSpreadChild(e))}else{i.push(this.jsxParseExpressionContainer(e,h.j_expr))}break}default:throw this.unexpected()}}if(isFragment(r)&&!isFragment(a)&&a!==null){this.raise(Ye.MissingClosingTagFragment,{at:a})}else if(!isFragment(r)&&isFragment(a)){this.raise(Ye.MissingClosingTagElement,{at:a,openingTagName:getQualifiedJSXName(r.name)})}else if(!isFragment(r)&&!isFragment(a)){if(getQualifiedJSXName(a.name)!==getQualifiedJSXName(r.name)){this.raise(Ye.MissingClosingTagElement,{at:a,openingTagName:getQualifiedJSXName(r.name)})}}}if(isFragment(r)){s.openingFragment=r;s.closingFragment=a}else{s.openingElement=r;s.closingElement=a}s.children=i;if(this.match(47)){throw this.raise(Ye.UnwrappedAdjacentJSXElements,{at:this.state.startLoc})}return isFragment(r)?this.finishNode(s,"JSXFragment"):this.finishNode(s,"JSXElement")}jsxParseElement(){const e=this.state.start;const t=this.state.startLoc;this.next();return this.jsxParseElementAt(e,t)}setContext(e){const{context:t}=this.state;t[t.length-1]=e}parseExprAtom(e){if(this.match(137)){return this.parseLiteral(this.state.value,"JSXText")}else if(this.match(138)){return this.jsxParseElement()}else if(this.match(47)&&this.input.charCodeAt(this.state.pos)!==33){this.replaceToken(138);return this.jsxParseElement()}else{return super.parseExprAtom(e)}}skipSpace(){const e=this.curContext();if(!e.preserveSpace)super.skipSpace()}getTokenFromCode(e){const t=this.curContext();if(t===h.j_expr){return this.jsxReadToken()}if(t===h.j_oTag||t===h.j_cTag){if(isIdentifierStart(e)){return this.jsxReadWord()}if(e===62){++this.state.pos;return this.finishToken(139)}if((e===34||e===39)&&t===h.j_oTag){return this.jsxReadString(e)}}if(e===60&&this.state.canStartJSXElement&&this.input.charCodeAt(this.state.pos+1)!==33){++this.state.pos;return this.finishToken(138)}return super.getTokenFromCode(e)}updateContext(e){const{context:t,type:s}=this.state;if(s===56&&e===138){t.splice(-2,2,h.j_cTag);this.state.canStartJSXElement=false}else if(s===138){t.push(h.j_oTag)}else if(s===139){const s=t[t.length-1];if(s===h.j_oTag&&e===56||s===h.j_cTag){t.pop();this.state.canStartJSXElement=t[t.length-1]===h.j_expr}else{this.setContext(h.j_expr);this.state.canStartJSXElement=true}}else{this.state.canStartJSXElement=tokenComesBeforeExpression(s)}}};class TypeScriptScope extends Scope{constructor(...e){super(...e);this.types=new Set;this.enums=new Set;this.constEnums=new Set;this.classes=new Set;this.exportOnlyBindings=new Set}}class TypeScriptScopeHandler extends ScopeHandler{createScope(e){return new TypeScriptScope(e)}declareName(e,t,s){const i=this.currentScope();if(t&te){this.maybeExportDefined(i,e);i.exportOnlyBindings.add(e);return}super.declareName(...arguments);if(t&W){if(!(t&$)){this.checkRedeclarationInScope(i,e,t,s);this.maybeExportDefined(i,e)}i.types.add(e)}if(t&Z)i.enums.add(e);if(t&ee)i.constEnums.add(e);if(t&Q)i.classes.add(e)}isRedeclaredInScope(e,t,s){if(e.enums.has(t)){if(s&Z){const i=!!(s&ee);const r=e.constEnums.has(t);return i!==r}return true}if(s&Q&&e.classes.has(t)){if(e.lexical.has(t)){return!!(s&$)}else{return false}}if(s&W&&e.types.has(t)){return true}return super.isRedeclaredInScope(...arguments)}checkLocalExport(e){const t=this.scopeStack[0];const{name:s}=e;if(!t.types.has(s)&&!t.exportOnlyBindings.has(s)){super.checkLocalExport(e)}}}const getOwn$1=(e,t)=>Object.hasOwnProperty.call(e,t)&&e[t];function nonNull(e){if(e==null){throw new Error(`Unexpected ${e} value.`)}return e}function assert(e){if(!e){throw new Error("Assert fail")}}function tsTokenCanStartExpression(e){return tokenCanStartExpression(e)||tokenIsBinaryOperator(e)}const Qe=ParseErrorEnum`typescript`((e=>({AbstractMethodHasImplementation:e((({methodName:e})=>`Method '${e}' cannot have an implementation because it is marked abstract.`)),AbstractPropertyHasInitializer:e((({propertyName:e})=>`Property '${e}' cannot have an initializer because it is marked abstract.`)),AccesorCannotDeclareThisParameter:e("'get' and 'set' accessors cannot declare 'this' parameters."),AccesorCannotHaveTypeParameters:e("An accessor cannot have type parameters."),CannotFindName:e((({name:e})=>`Cannot find name '${e}'.`)),ClassMethodHasDeclare:e("Class methods cannot have the 'declare' modifier."),ClassMethodHasReadonly:e("Class methods cannot have the 'readonly' modifier."),ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference:e("A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference."),ConstructorHasTypeParameters:e("Type parameters cannot appear on a constructor declaration."),DeclareAccessor:e((({kind:e})=>`'declare' is not allowed in ${e}ters.`)),DeclareClassFieldHasInitializer:e("Initializers are not allowed in ambient contexts."),DeclareFunctionHasImplementation:e("An implementation cannot be declared in ambient contexts."),DuplicateAccessibilityModifier:e((({modifier:e})=>`Accessibility modifier already seen.`)),DuplicateModifier:e((({modifier:e})=>`Duplicate modifier: '${e}'.`)),EmptyHeritageClauseType:e((({token:e})=>`'${e}' list cannot be empty.`)),EmptyTypeArguments:e("Type argument list cannot be empty."),EmptyTypeParameters:e("Type parameter list cannot be empty."),ExpectedAmbientAfterExportDeclare:e("'export declare' must be followed by an ambient declaration."),ImportAliasHasImportType:e("An import alias can not use 'import type'."),IncompatibleModifiers:e((({modifiers:e})=>`'${e[0]}' modifier cannot be used with '${e[1]}' modifier.`)),IndexSignatureHasAbstract:e("Index signatures cannot have the 'abstract' modifier."),IndexSignatureHasAccessibility:e((({modifier:e})=>`Index signatures cannot have an accessibility modifier ('${e}').`)),IndexSignatureHasDeclare:e("Index signatures cannot have the 'declare' modifier."),IndexSignatureHasOverride:e("'override' modifier cannot appear on an index signature."),IndexSignatureHasStatic:e("Index signatures cannot have the 'static' modifier."),InitializerNotAllowedInAmbientContext:e("Initializers are not allowed in ambient contexts."),InvalidModifierOnTypeMember:e((({modifier:e})=>`'${e}' modifier cannot appear on a type member.`)),InvalidModifierOnTypeParameter:e((({modifier:e})=>`'${e}' modifier cannot appear on a type parameter.`)),InvalidModifierOnTypeParameterPositions:e((({modifier:e})=>`'${e}' modifier can only appear on a type parameter of a class, interface or type alias.`)),InvalidModifiersOrder:e((({orderedModifiers:e})=>`'${e[0]}' modifier must precede '${e[1]}' modifier.`)),InvalidTupleMemberLabel:e("Tuple members must be labeled with a simple identifier."),MissingInterfaceName:e("'interface' declarations must be followed by an identifier."),MixedLabeledAndUnlabeledElements:e("Tuple members must all have names or all not have names."),NonAbstractClassHasAbstractMethod:e("Abstract methods can only appear within an abstract class."),NonClassMethodPropertyHasAbstractModifer:e("'abstract' modifier can only appear on a class, method, or property declaration."),OptionalTypeBeforeRequired:e("A required element cannot follow an optional element."),OverrideNotInSubClass:e("This member cannot have an 'override' modifier because its containing class does not extend another class."),PatternIsOptional:e("A binding pattern parameter cannot be optional in an implementation signature."),PrivateElementHasAbstract:e("Private elements cannot have the 'abstract' modifier."),PrivateElementHasAccessibility:e((({modifier:e})=>`Private elements cannot have an accessibility modifier ('${e}').`)),ReadonlyForMethodSignature:e("'readonly' modifier can only appear on a property declaration or index signature."),ReservedArrowTypeParam:e("This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`."),ReservedTypeAssertion:e("This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead."),SetAccesorCannotHaveOptionalParameter:e("A 'set' accessor cannot have an optional parameter."),SetAccesorCannotHaveRestParameter:e("A 'set' accessor cannot have rest parameter."),SetAccesorCannotHaveReturnType:e("A 'set' accessor cannot have a return type annotation."),SingleTypeParameterWithoutTrailingComma:e((({typeParameterName:e})=>`Single type parameter ${e} should have a trailing comma. Example usage: <${e},>.`)),StaticBlockCannotHaveModifier:e("Static class blocks cannot have any modifier."),TypeAnnotationAfterAssign:e("Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`."),TypeImportCannotSpecifyDefaultAndNamed:e("A type-only import can specify a default import or named bindings, but not both."),TypeModifierIsUsedInTypeExports:e("The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement."),TypeModifierIsUsedInTypeImports:e("The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement."),UnexpectedParameterModifier:e("A parameter property is only allowed in a constructor implementation."),UnexpectedReadonly:e("'readonly' type modifier is only permitted on array and tuple literal types."),UnexpectedTypeAnnotation:e("Did not expect a type annotation here."),UnexpectedTypeCastInParameter:e("Unexpected type cast in parameter position."),UnsupportedImportTypeArgument:e("Argument in a type import must be a string literal."),UnsupportedParameterPropertyKind:e("A parameter property may not be declared using a binding pattern."),UnsupportedSignatureParameterKind:e((({type:e})=>`Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${e}.`))})));function keywordTypeFromName(e){switch(e){case"any":return"TSAnyKeyword";case"boolean":return"TSBooleanKeyword";case"bigint":return"TSBigIntKeyword";case"never":return"TSNeverKeyword";case"number":return"TSNumberKeyword";case"object":return"TSObjectKeyword";case"string":return"TSStringKeyword";case"symbol":return"TSSymbolKeyword";case"undefined":return"TSUndefinedKeyword";case"unknown":return"TSUnknownKeyword";default:return undefined}}function tsIsAccessModifier(e){return e==="private"||e==="public"||e==="protected"}function tsIsVarianceAnnotations(e){return e==="in"||e==="out"}var typescript=e=>class extends e{getScopeHandler(){return TypeScriptScopeHandler}tsIsIdentifier(){return tokenIsIdentifier(this.state.type)}tsTokenCanFollowModifier(){return(this.match(0)||this.match(5)||this.match(55)||this.match(21)||this.match(134)||this.isLiteralPropertyName())&&!this.hasPrecedingLineBreak()}tsNextTokenCanFollowModifier(){this.next();return this.tsTokenCanFollowModifier()}tsParseModifier(e,t){if(!tokenIsIdentifier(this.state.type)&&this.state.type!==58){return undefined}const s=this.state.value;if(e.indexOf(s)!==-1){if(t&&this.tsIsStartOfStaticBlocks()){return undefined}if(this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this))){return s}}return undefined}tsParseModifiers({modified:e,allowedModifiers:t,disallowedModifiers:s,stopOnStartOfClassStaticBlock:i,errorTemplate:r=Qe.InvalidModifierOnTypeMember}){const enforceOrder=(t,s,i,r)=>{if(s===i&&e[r]){this.raise(Qe.InvalidModifiersOrder,{at:t,orderedModifiers:[i,r]})}};const incompatible=(t,s,i,r)=>{if(e[i]&&s===r||e[r]&&s===i){this.raise(Qe.IncompatibleModifiers,{at:t,modifiers:[i,r]})}};for(;;){const{startLoc:a}=this.state;const n=this.tsParseModifier(t.concat(s!=null?s:[]),i);if(!n)break;if(tsIsAccessModifier(n)){if(e.accessibility){this.raise(Qe.DuplicateAccessibilityModifier,{at:a,modifier:n})}else{enforceOrder(a,n,n,"override");enforceOrder(a,n,n,"static");enforceOrder(a,n,n,"readonly");e.accessibility=n}}else if(tsIsVarianceAnnotations(n)){if(e[n]){this.raise(Qe.DuplicateModifier,{at:a,modifier:n})}e[n]=true;enforceOrder(a,n,"in","out")}else{if(Object.hasOwnProperty.call(e,n)){this.raise(Qe.DuplicateModifier,{at:a,modifier:n})}else{enforceOrder(a,n,"static","readonly");enforceOrder(a,n,"static","override");enforceOrder(a,n,"override","readonly");enforceOrder(a,n,"abstract","override");incompatible(a,n,"declare","override");incompatible(a,n,"static","abstract")}e[n]=true}if(s!=null&&s.includes(n)){this.raise(r,{at:a,modifier:n})}}}tsIsListTerminator(e){switch(e){case"EnumMembers":case"TypeMembers":return this.match(8);case"HeritageClauseElement":return this.match(5);case"TupleElementTypes":return this.match(3);case"TypeParametersOrArguments":return this.match(48)}throw new Error("Unreachable")}tsParseList(e,t){const s=[];while(!this.tsIsListTerminator(e)){s.push(t())}return s}tsParseDelimitedList(e,t,s){return nonNull(this.tsParseDelimitedListWorker(e,t,true,s))}tsParseDelimitedListWorker(e,t,s,i){const r=[];let a=-1;for(;;){if(this.tsIsListTerminator(e)){break}a=-1;const i=t();if(i==null){return undefined}r.push(i);if(this.eat(12)){a=this.state.lastTokStart;continue}if(this.tsIsListTerminator(e)){break}if(s){this.expect(12)}return undefined}if(i){i.value=a}return r}tsParseBracketedList(e,t,s,i,r){if(!i){if(s){this.expect(0)}else{this.expect(47)}}const a=this.tsParseDelimitedList(e,t,r);if(s){this.expect(3)}else{this.expect(48)}return a}tsParseImportType(){const e=this.startNode();this.expect(83);this.expect(10);if(!this.match(129)){this.raise(Qe.UnsupportedImportTypeArgument,{at:this.state.startLoc})}e.argument=this.parseExprAtom();this.expect(11);if(this.eat(16)){e.qualifier=this.tsParseEntityName()}if(this.match(47)){e.typeParameters=this.tsParseTypeArguments()}return this.finishNode(e,"TSImportType")}tsParseEntityName(e=true){let t=this.parseIdentifier(e);while(this.eat(16)){const s=this.startNodeAtNode(t);s.left=t;s.right=this.parseIdentifier(e);t=this.finishNode(s,"TSQualifiedName")}return t}tsParseTypeReference(){const e=this.startNode();e.typeName=this.tsParseEntityName();if(!this.hasPrecedingLineBreak()&&this.match(47)){e.typeParameters=this.tsParseTypeArguments()}return this.finishNode(e,"TSTypeReference")}tsParseThisTypePredicate(e){this.next();const t=this.startNodeAtNode(e);t.parameterName=e;t.typeAnnotation=this.tsParseTypeAnnotation(false);t.asserts=false;return this.finishNode(t,"TSTypePredicate")}tsParseThisTypeNode(){const e=this.startNode();this.next();return this.finishNode(e,"TSThisType")}tsParseTypeQuery(){const e=this.startNode();this.expect(87);if(this.match(83)){e.exprName=this.tsParseImportType()}else{e.exprName=this.tsParseEntityName()}if(!this.hasPrecedingLineBreak()&&this.match(47)){e.typeParameters=this.tsParseTypeArguments()}return this.finishNode(e,"TSTypeQuery")}tsParseInOutModifiers(e){this.tsParseModifiers({modified:e,allowedModifiers:["in","out"],disallowedModifiers:["public","private","protected","readonly","declare","abstract","override"],errorTemplate:Qe.InvalidModifierOnTypeParameter})}tsParseNoneModifiers(e){this.tsParseModifiers({modified:e,allowedModifiers:[],disallowedModifiers:["in","out"],errorTemplate:Qe.InvalidModifierOnTypeParameterPositions})}tsParseTypeParameter(e=this.tsParseNoneModifiers.bind(this)){const t=this.startNode();e(t);t.name=this.tsParseTypeParameterName();t.constraint=this.tsEatThenParseType(81);t.default=this.tsEatThenParseType(29);return this.finishNode(t,"TSTypeParameter")}tsTryParseTypeParameters(e){if(this.match(47)){return this.tsParseTypeParameters(e)}}tsParseTypeParameters(e){const t=this.startNode();if(this.match(47)||this.match(138)){this.next()}else{this.unexpected()}const s={value:-1};t.params=this.tsParseBracketedList("TypeParametersOrArguments",this.tsParseTypeParameter.bind(this,e),false,true,s);if(t.params.length===0){this.raise(Qe.EmptyTypeParameters,{at:t})}if(s.value!==-1){this.addExtra(t,"trailingComma",s.value)}return this.finishNode(t,"TSTypeParameterDeclaration")}tsTryNextParseConstantContext(){if(this.lookahead().type!==75)return null;this.next();const e=this.tsParseTypeReference();if(e.typeParameters){this.raise(Qe.CannotFindName,{at:e.typeName,name:"const"})}return e}tsFillSignature(e,t){const s=e===19;const i="parameters";const r="typeAnnotation";t.typeParameters=this.tsTryParseTypeParameters();this.expect(10);t[i]=this.tsParseBindingListForSignature();if(s){t[r]=this.tsParseTypeOrTypePredicateAnnotation(e)}else if(this.match(e)){t[r]=this.tsParseTypeOrTypePredicateAnnotation(e)}}tsParseBindingListForSignature(){return this.parseBindingList(11,41).map((e=>{if(e.type!=="Identifier"&&e.type!=="RestElement"&&e.type!=="ObjectPattern"&&e.type!=="ArrayPattern"){this.raise(Qe.UnsupportedSignatureParameterKind,{at:e,type:e.type})}return e}))}tsParseTypeMemberSemicolon(){if(!this.eat(12)&&!this.isLineTerminator()){this.expect(13)}}tsParseSignatureMember(e,t){this.tsFillSignature(14,t);this.tsParseTypeMemberSemicolon();return this.finishNode(t,e)}tsIsUnambiguouslyIndexSignature(){this.next();if(tokenIsIdentifier(this.state.type)){this.next();return this.match(14)}return false}tsTryParseIndexSignature(e){if(!(this.match(0)&&this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this)))){return undefined}this.expect(0);const t=this.parseIdentifier();t.typeAnnotation=this.tsParseTypeAnnotation();this.resetEndLocation(t);this.expect(3);e.parameters=[t];const s=this.tsTryParseTypeAnnotation();if(s)e.typeAnnotation=s;this.tsParseTypeMemberSemicolon();return this.finishNode(e,"TSIndexSignature")}tsParsePropertyOrMethodSignature(e,t){if(this.eat(17))e.optional=true;const s=e;if(this.match(10)||this.match(47)){if(t){this.raise(Qe.ReadonlyForMethodSignature,{at:e})}const i=s;if(i.kind&&this.match(47)){this.raise(Qe.AccesorCannotHaveTypeParameters,{at:this.state.curPosition()})}this.tsFillSignature(14,i);this.tsParseTypeMemberSemicolon();const r="parameters";const a="typeAnnotation";if(i.kind==="get"){if(i[r].length>0){this.raise(n.BadGetterArity,{at:this.state.curPosition()});if(this.isThisParam(i[r][0])){this.raise(Qe.AccesorCannotDeclareThisParameter,{at:this.state.curPosition()})}}}else if(i.kind==="set"){if(i[r].length!==1){this.raise(n.BadSetterArity,{at:this.state.curPosition()})}else{const e=i[r][0];if(this.isThisParam(e)){this.raise(Qe.AccesorCannotDeclareThisParameter,{at:this.state.curPosition()})}if(e.type==="Identifier"&&e.optional){this.raise(Qe.SetAccesorCannotHaveOptionalParameter,{at:this.state.curPosition()})}if(e.type==="RestElement"){this.raise(Qe.SetAccesorCannotHaveRestParameter,{at:this.state.curPosition()})}}if(i[a]){this.raise(Qe.SetAccesorCannotHaveReturnType,{at:i[a]})}}else{i.kind="method"}return this.finishNode(i,"TSMethodSignature")}else{const e=s;if(t)e.readonly=true;const i=this.tsTryParseTypeAnnotation();if(i)e.typeAnnotation=i;this.tsParseTypeMemberSemicolon();return this.finishNode(e,"TSPropertySignature")}}tsParseTypeMember(){const e=this.startNode();if(this.match(10)||this.match(47)){return this.tsParseSignatureMember("TSCallSignatureDeclaration",e)}if(this.match(77)){const t=this.startNode();this.next();if(this.match(10)||this.match(47)){return this.tsParseSignatureMember("TSConstructSignatureDeclaration",e)}else{e.key=this.createIdentifier(t,"new");return this.tsParsePropertyOrMethodSignature(e,false)}}this.tsParseModifiers({modified:e,allowedModifiers:["readonly"],disallowedModifiers:["declare","abstract","private","protected","public","static","override"]});const t=this.tsTryParseIndexSignature(e);if(t){return t}this.parsePropertyName(e);if(!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.tsTokenCanFollowModifier()){e.kind=e.key.name;this.parsePropertyName(e)}return this.tsParsePropertyOrMethodSignature(e,!!e.readonly)}tsParseTypeLiteral(){const e=this.startNode();e.members=this.tsParseObjectTypeMembers();return this.finishNode(e,"TSTypeLiteral")}tsParseObjectTypeMembers(){this.expect(5);const e=this.tsParseList("TypeMembers",this.tsParseTypeMember.bind(this));this.expect(8);return e}tsIsStartOfMappedType(){this.next();if(this.eat(53)){return this.isContextual(118)}if(this.isContextual(118)){this.next()}if(!this.match(0)){return false}this.next();if(!this.tsIsIdentifier()){return false}this.next();return this.match(58)}tsParseMappedTypeParameter(){const e=this.startNode();e.name=this.tsParseTypeParameterName();e.constraint=this.tsExpectThenParseType(58);return this.finishNode(e,"TSTypeParameter")}tsParseMappedType(){const e=this.startNode();this.expect(5);if(this.match(53)){e.readonly=this.state.value;this.next();this.expectContextual(118)}else if(this.eatContextual(118)){e.readonly=true}this.expect(0);e.typeParameter=this.tsParseMappedTypeParameter();e.nameType=this.eatContextual(93)?this.tsParseType():null;this.expect(3);if(this.match(53)){e.optional=this.state.value;this.next();this.expect(17)}else if(this.eat(17)){e.optional=true}e.typeAnnotation=this.tsTryParseType();this.semicolon();this.expect(8);return this.finishNode(e,"TSMappedType")}tsParseTupleType(){const e=this.startNode();e.elementTypes=this.tsParseBracketedList("TupleElementTypes",this.tsParseTupleElementType.bind(this),true,false);let t=false;let s=null;e.elementTypes.forEach((e=>{var i;let{type:r}=e;if(t&&r!=="TSRestType"&&r!=="TSOptionalType"&&!(r==="TSNamedTupleMember"&&e.optional)){this.raise(Qe.OptionalTypeBeforeRequired,{at:e})}t=t||r==="TSNamedTupleMember"&&e.optional||r==="TSOptionalType";if(r==="TSRestType"){e=e.typeAnnotation;r=e.type}const a=r==="TSNamedTupleMember";s=(i=s)!=null?i:a;if(s!==a){this.raise(Qe.MixedLabeledAndUnlabeledElements,{at:e})}}));return this.finishNode(e,"TSTupleType")}tsParseTupleElementType(){const{start:e,startLoc:t}=this.state;const s=this.eat(21);let i=this.tsParseType();const r=this.eat(17);const a=this.eat(14);if(a){const e=this.startNodeAtNode(i);e.optional=r;if(i.type==="TSTypeReference"&&!i.typeParameters&&i.typeName.type==="Identifier"){e.label=i.typeName}else{this.raise(Qe.InvalidTupleMemberLabel,{at:i});e.label=i}e.elementType=this.tsParseType();i=this.finishNode(e,"TSNamedTupleMember")}else if(r){const e=this.startNodeAtNode(i);e.typeAnnotation=i;i=this.finishNode(e,"TSOptionalType")}if(s){const s=this.startNodeAt(e,t);s.typeAnnotation=i;i=this.finishNode(s,"TSRestType")}return i}tsParseParenthesizedType(){const e=this.startNode();this.expect(10);e.typeAnnotation=this.tsParseType();this.expect(11);return this.finishNode(e,"TSParenthesizedType")}tsParseFunctionOrConstructorType(e,t){const s=this.startNode();if(e==="TSConstructorType"){s.abstract=!!t;if(t)this.next();this.next()}this.tsInAllowConditionalTypesContext((()=>this.tsFillSignature(19,s)));return this.finishNode(s,e)}tsParseLiteralTypeNode(){const e=this.startNode();e.literal=(()=>{switch(this.state.type){case 130:case 131:case 129:case 85:case 86:return this.parseExprAtom();default:throw this.unexpected()}})();return this.finishNode(e,"TSLiteralType")}tsParseTemplateLiteralType(){const e=this.startNode();e.literal=this.parseTemplate(false);return this.finishNode(e,"TSLiteralType")}parseTemplateSubstitution(){if(this.state.inType)return this.tsParseType();return super.parseTemplateSubstitution()}tsParseThisTypeOrThisTypePredicate(){const e=this.tsParseThisTypeNode();if(this.isContextual(113)&&!this.hasPrecedingLineBreak()){return this.tsParseThisTypePredicate(e)}else{return e}}tsParseNonArrayType(){switch(this.state.type){case 129:case 130:case 131:case 85:case 86:return this.tsParseLiteralTypeNode();case 53:if(this.state.value==="-"){const e=this.startNode();const t=this.lookahead();if(t.type!==130&&t.type!==131){throw this.unexpected()}e.literal=this.parseMaybeUnary();return this.finishNode(e,"TSLiteralType")}break;case 78:return this.tsParseThisTypeOrThisTypePredicate();case 87:return this.tsParseTypeQuery();case 83:return this.tsParseImportType();case 5:return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this))?this.tsParseMappedType():this.tsParseTypeLiteral();case 0:return this.tsParseTupleType();case 10:return this.tsParseParenthesizedType();case 25:case 24:return this.tsParseTemplateLiteralType();default:{const{type:e}=this.state;if(tokenIsIdentifier(e)||e===88||e===84){const t=e===88?"TSVoidKeyword":e===84?"TSNullKeyword":keywordTypeFromName(this.state.value);if(t!==undefined&&this.lookaheadCharCode()!==46){const e=this.startNode();this.next();return this.finishNode(e,t)}return this.tsParseTypeReference()}}}throw this.unexpected()}tsParseArrayTypeOrHigher(){let e=this.tsParseNonArrayType();while(!this.hasPrecedingLineBreak()&&this.eat(0)){if(this.match(3)){const t=this.startNodeAtNode(e);t.elementType=e;this.expect(3);e=this.finishNode(t,"TSArrayType")}else{const t=this.startNodeAtNode(e);t.objectType=e;t.indexType=this.tsParseType();this.expect(3);e=this.finishNode(t,"TSIndexedAccessType")}}return e}tsParseTypeOperator(){const e=this.startNode();const t=this.state.value;this.next();e.operator=t;e.typeAnnotation=this.tsParseTypeOperatorOrHigher();if(t==="readonly"){this.tsCheckTypeAnnotationForReadOnly(e)}return this.finishNode(e,"TSTypeOperator")}tsCheckTypeAnnotationForReadOnly(e){switch(e.typeAnnotation.type){case"TSTupleType":case"TSArrayType":return;default:this.raise(Qe.UnexpectedReadonly,{at:e})}}tsParseInferType(){const e=this.startNode();this.expectContextual(112);const t=this.startNode();t.name=this.tsParseTypeParameterName();t.constraint=this.tsTryParse((()=>this.tsParseConstraintForInferType()));e.typeParameter=this.finishNode(t,"TSTypeParameter");return this.finishNode(e,"TSInferType")}tsParseConstraintForInferType(){if(this.eat(81)){const e=this.tsInDisallowConditionalTypesContext((()=>this.tsParseType()));if(this.state.inDisallowConditionalTypesContext||!this.match(17)){return e}}}tsParseTypeOperatorOrHigher(){const e=tokenIsTSTypeOperator(this.state.type)&&!this.state.containsEsc;return e?this.tsParseTypeOperator():this.isContextual(112)?this.tsParseInferType():this.tsInAllowConditionalTypesContext((()=>this.tsParseArrayTypeOrHigher()))}tsParseUnionOrIntersectionType(e,t,s){const i=this.startNode();const r=this.eat(s);const a=[];do{a.push(t())}while(this.eat(s));if(a.length===1&&!r){return a[0]}i.types=a;return this.finishNode(i,e)}tsParseIntersectionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSIntersectionType",this.tsParseTypeOperatorOrHigher.bind(this),45)}tsParseUnionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSUnionType",this.tsParseIntersectionTypeOrHigher.bind(this),43)}tsIsStartOfFunctionType(){if(this.match(47)){return true}return this.match(10)&&this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this))}tsSkipParameterStart(){if(tokenIsIdentifier(this.state.type)||this.match(78)){this.next();return true}if(this.match(5)){const{errors:e}=this.state;const t=e.length;try{this.parseObjectLike(8,true);return e.length===t}catch(e){return false}}if(this.match(0)){this.next();const{errors:e}=this.state;const t=e.length;try{this.parseBindingList(3,93,true);return e.length===t}catch(e){return false}}return false}tsIsUnambiguouslyStartOfFunctionType(){this.next();if(this.match(11)||this.match(21)){return true}if(this.tsSkipParameterStart()){if(this.match(14)||this.match(12)||this.match(17)||this.match(29)){return true}if(this.match(11)){this.next();if(this.match(19)){return true}}}return false}tsParseTypeOrTypePredicateAnnotation(e){return this.tsInType((()=>{const t=this.startNode();this.expect(e);const s=this.startNode();const i=!!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));if(i&&this.match(78)){let e=this.tsParseThisTypeOrThisTypePredicate();if(e.type==="TSThisType"){s.parameterName=e;s.asserts=true;s.typeAnnotation=null;e=this.finishNode(s,"TSTypePredicate")}else{this.resetStartLocationFromNode(e,s);e.asserts=true}t.typeAnnotation=e;return this.finishNode(t,"TSTypeAnnotation")}const r=this.tsIsIdentifier()&&this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this));if(!r){if(!i){return this.tsParseTypeAnnotation(false,t)}s.parameterName=this.parseIdentifier();s.asserts=i;s.typeAnnotation=null;t.typeAnnotation=this.finishNode(s,"TSTypePredicate");return this.finishNode(t,"TSTypeAnnotation")}const a=this.tsParseTypeAnnotation(false);s.parameterName=r;s.typeAnnotation=a;s.asserts=i;t.typeAnnotation=this.finishNode(s,"TSTypePredicate");return this.finishNode(t,"TSTypeAnnotation")}))}tsTryParseTypeOrTypePredicateAnnotation(){return this.match(14)?this.tsParseTypeOrTypePredicateAnnotation(14):undefined}tsTryParseTypeAnnotation(){return this.match(14)?this.tsParseTypeAnnotation():undefined}tsTryParseType(){return this.tsEatThenParseType(14)}tsParseTypePredicatePrefix(){const e=this.parseIdentifier();if(this.isContextual(113)&&!this.hasPrecedingLineBreak()){this.next();return e}}tsParseTypePredicateAsserts(){if(this.state.type!==106){return false}const e=this.state.containsEsc;this.next();if(!tokenIsIdentifier(this.state.type)&&!this.match(78)){return false}if(e){this.raise(n.InvalidEscapedReservedWord,{at:this.state.lastTokStartLoc,reservedWord:"asserts"})}return true}tsParseTypeAnnotation(e=true,t=this.startNode()){this.tsInType((()=>{if(e)this.expect(14);t.typeAnnotation=this.tsParseType()}));return this.finishNode(t,"TSTypeAnnotation")}tsParseType(){assert(this.state.inType);const e=this.tsParseNonConditionalType();if(this.state.inDisallowConditionalTypesContext||this.hasPrecedingLineBreak()||!this.eat(81)){return e}const t=this.startNodeAtNode(e);t.checkType=e;t.extendsType=this.tsInDisallowConditionalTypesContext((()=>this.tsParseNonConditionalType()));this.expect(17);t.trueType=this.tsInAllowConditionalTypesContext((()=>this.tsParseType()));this.expect(14);t.falseType=this.tsInAllowConditionalTypesContext((()=>this.tsParseType()));return this.finishNode(t,"TSConditionalType")}isAbstractConstructorSignature(){return this.isContextual(120)&&this.lookahead().type===77}tsParseNonConditionalType(){if(this.tsIsStartOfFunctionType()){return this.tsParseFunctionOrConstructorType("TSFunctionType")}if(this.match(77)){return this.tsParseFunctionOrConstructorType("TSConstructorType")}else if(this.isAbstractConstructorSignature()){return this.tsParseFunctionOrConstructorType("TSConstructorType",true)}return this.tsParseUnionTypeOrHigher()}tsParseTypeAssertion(){if(this.getPluginOption("typescript","disallowAmbiguousJSXLike")){this.raise(Qe.ReservedTypeAssertion,{at:this.state.startLoc})}const e=this.startNode();const t=this.tsTryNextParseConstantContext();e.typeAnnotation=t||this.tsNextThenParseType();this.expect(48);e.expression=this.parseMaybeUnary();return this.finishNode(e,"TSTypeAssertion")}tsParseHeritageClause(e){const t=this.state.startLoc;const s=this.tsParseDelimitedList("HeritageClauseElement",(()=>{const e=this.startNode();e.expression=this.tsParseEntityName();if(this.match(47)){e.typeParameters=this.tsParseTypeArguments()}return this.finishNode(e,"TSExpressionWithTypeArguments")}));if(!s.length){this.raise(Qe.EmptyHeritageClauseType,{at:t,token:e})}return s}tsParseInterfaceDeclaration(e,t={}){if(this.hasFollowingLineBreak())return null;this.expectContextual(125);if(t.declare)e.declare=true;if(tokenIsIdentifier(this.state.type)){e.id=this.parseIdentifier();this.checkIdentifier(e.id,oe)}else{e.id=null;this.raise(Qe.MissingInterfaceName,{at:this.state.startLoc})}e.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutModifiers.bind(this));if(this.eat(81)){e.extends=this.tsParseHeritageClause("extends")}const s=this.startNode();s.body=this.tsInType(this.tsParseObjectTypeMembers.bind(this));e.body=this.finishNode(s,"TSInterfaceBody");return this.finishNode(e,"TSInterfaceDeclaration")}tsParseTypeAliasDeclaration(e){e.id=this.parseIdentifier();this.checkIdentifier(e.id,he);e.typeAnnotation=this.tsInType((()=>{e.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutModifiers.bind(this));this.expect(29);if(this.isContextual(111)&&this.lookahead().type!==16){const e=this.startNode();this.next();return this.finishNode(e,"TSIntrinsicKeyword")}return this.tsParseType()}));this.semicolon();return this.finishNode(e,"TSTypeAliasDeclaration")}tsInNoContext(e){const t=this.state.context;this.state.context=[t[0]];try{return e()}finally{this.state.context=t}}tsInType(e){const t=this.state.inType;this.state.inType=true;try{return e()}finally{this.state.inType=t}}tsInDisallowConditionalTypesContext(e){const t=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=true;try{return e()}finally{this.state.inDisallowConditionalTypesContext=t}}tsInAllowConditionalTypesContext(e){const t=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=false;try{return e()}finally{this.state.inDisallowConditionalTypesContext=t}}tsEatThenParseType(e){return!this.match(e)?undefined:this.tsNextThenParseType()}tsExpectThenParseType(e){return this.tsDoThenParseType((()=>this.expect(e)))}tsNextThenParseType(){return this.tsDoThenParseType((()=>this.next()))}tsDoThenParseType(e){return this.tsInType((()=>{e();return this.tsParseType()}))}tsParseEnumMember(){const e=this.startNode();e.id=this.match(129)?this.parseExprAtom():this.parseIdentifier(true);if(this.eat(29)){e.initializer=this.parseMaybeAssignAllowIn()}return this.finishNode(e,"TSEnumMember")}tsParseEnumDeclaration(e,t={}){if(t.const)e.const=true;if(t.declare)e.declare=true;this.expectContextual(122);e.id=this.parseIdentifier();this.checkIdentifier(e.id,e.const?de:ce);this.expect(5);e.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this));this.expect(8);return this.finishNode(e,"TSEnumDeclaration")}tsParseModuleBlock(){const e=this.startNode();this.scope.enter(F);this.expect(5);this.parseBlockOrModuleBlockBody(e.body=[],undefined,true,8);this.scope.exit();return this.finishNode(e,"TSModuleBlock")}tsParseModuleOrNamespaceDeclaration(e,t=false){e.id=this.parseIdentifier();if(!t){this.checkIdentifier(e.id,fe)}if(this.eat(16)){const t=this.startNode();this.tsParseModuleOrNamespaceDeclaration(t,true);e.body=t}else{this.scope.enter(V);this.prodParam.enter(_e);e.body=this.tsParseModuleBlock();this.prodParam.exit();this.scope.exit()}return this.finishNode(e,"TSModuleDeclaration")}tsParseAmbientExternalModuleDeclaration(e){if(this.isContextual(109)){e.global=true;e.id=this.parseIdentifier()}else if(this.match(129)){e.id=this.parseExprAtom()}else{this.unexpected()}if(this.match(5)){this.scope.enter(V);this.prodParam.enter(_e);e.body=this.tsParseModuleBlock();this.prodParam.exit();this.scope.exit()}else{this.semicolon()}return this.finishNode(e,"TSModuleDeclaration")}tsParseImportEqualsDeclaration(e,t){e.isExport=t||false;e.id=this.parseIdentifier();this.checkIdentifier(e.id,re);this.expect(29);const s=this.tsParseModuleReference();if(e.importKind==="type"&&s.type!=="TSExternalModuleReference"){this.raise(Qe.ImportAliasHasImportType,{at:s})}e.moduleReference=s;this.semicolon();return this.finishNode(e,"TSImportEqualsDeclaration")}tsIsExternalModuleReference(){return this.isContextual(116)&&this.lookaheadCharCode()===40}tsParseModuleReference(){return this.tsIsExternalModuleReference()?this.tsParseExternalModuleReference():this.tsParseEntityName(false)}tsParseExternalModuleReference(){const e=this.startNode();this.expectContextual(116);this.expect(10);if(!this.match(129)){throw this.unexpected()}e.expression=this.parseExprAtom();this.expect(11);return this.finishNode(e,"TSExternalModuleReference")}tsLookAhead(e){const t=this.state.clone();const s=e();this.state=t;return s}tsTryParseAndCatch(e){const t=this.tryParse((t=>e()||t()));if(t.aborted||!t.node)return undefined;if(t.error)this.state=t.failState;return t.node}tsTryParse(e){const t=this.state.clone();const s=e();if(s!==undefined&&s!==false){return s}else{this.state=t;return undefined}}tsTryParseDeclare(e){if(this.isLineTerminator()){return}let t=this.state.type;let s;if(this.isContextual(99)){t=74;s="let"}return this.tsInAmbientContext((()=>{if(t===68){e.declare=true;return this.parseFunctionStatement(e,false,true)}if(t===80){e.declare=true;return this.parseClass(e,true,false)}if(t===122){return this.tsParseEnumDeclaration(e,{declare:true})}if(t===109){return this.tsParseAmbientExternalModuleDeclaration(e)}if(t===75||t===74){if(!this.match(75)||!this.isLookaheadContextual("enum")){e.declare=true;return this.parseVarStatement(e,s||this.state.value,true)}this.expect(75);return this.tsParseEnumDeclaration(e,{const:true,declare:true})}if(t===125){const t=this.tsParseInterfaceDeclaration(e,{declare:true});if(t)return t}if(tokenIsIdentifier(t)){return this.tsParseDeclaration(e,this.state.value,true)}}))}tsTryParseExportDeclaration(){return this.tsParseDeclaration(this.startNode(),this.state.value,true)}tsParseExpressionStatement(e,t){switch(t.name){case"declare":{const t=this.tsTryParseDeclare(e);if(t){t.declare=true;return t}break}case"global":if(this.match(5)){this.scope.enter(V);this.prodParam.enter(_e);const s=e;s.global=true;s.id=t;s.body=this.tsParseModuleBlock();this.scope.exit();this.prodParam.exit();return this.finishNode(s,"TSModuleDeclaration")}break;default:return this.tsParseDeclaration(e,t.name,false)}}tsParseDeclaration(e,t,s){switch(t){case"abstract":if(this.tsCheckLineTerminator(s)&&(this.match(80)||tokenIsIdentifier(this.state.type))){return this.tsParseAbstractDeclaration(e)}break;case"module":if(this.tsCheckLineTerminator(s)){if(this.match(129)){return this.tsParseAmbientExternalModuleDeclaration(e)}else if(tokenIsIdentifier(this.state.type)){return this.tsParseModuleOrNamespaceDeclaration(e)}}break;case"namespace":if(this.tsCheckLineTerminator(s)&&tokenIsIdentifier(this.state.type)){return this.tsParseModuleOrNamespaceDeclaration(e)}break;case"type":if(this.tsCheckLineTerminator(s)&&tokenIsIdentifier(this.state.type)){return this.tsParseTypeAliasDeclaration(e)}break}}tsCheckLineTerminator(e){if(e){if(this.hasFollowingLineBreak())return false;this.next();return true}return!this.isLineTerminator()}tsTryParseGenericAsyncArrowFunction(e,t){if(!this.match(47)){return undefined}const s=this.state.maybeInArrowParameters;this.state.maybeInArrowParameters=true;const i=this.tsTryParseAndCatch((()=>{const s=this.startNodeAt(e,t);s.typeParameters=this.tsParseTypeParameters();super.parseFunctionParams(s);s.returnType=this.tsTryParseTypeOrTypePredicateAnnotation();this.expect(19);return s}));this.state.maybeInArrowParameters=s;if(!i){return undefined}return this.parseArrowExpression(i,null,true)}tsParseTypeArgumentsInExpression(){if(this.reScan_lt()!==47){return undefined}return this.tsParseTypeArguments()}tsParseTypeArguments(){const e=this.startNode();e.params=this.tsInType((()=>this.tsInNoContext((()=>{this.expect(47);return this.tsParseDelimitedList("TypeParametersOrArguments",this.tsParseType.bind(this))}))));if(e.params.length===0){this.raise(Qe.EmptyTypeArguments,{at:e})}this.expect(48);return this.finishNode(e,"TSTypeParameterInstantiation")}tsIsDeclarationStart(){return tokenIsTSDeclarationStart(this.state.type)}isExportDefaultSpecifier(){if(this.tsIsDeclarationStart())return false;return super.isExportDefaultSpecifier()}parseAssignableListItem(e,t){const s=this.state.start;const i=this.state.startLoc;let r;let a=false;let n=false;if(e!==undefined){const t={};this.tsParseModifiers({modified:t,allowedModifiers:["public","private","protected","override","readonly"]});r=t.accessibility;n=t.override;a=t.readonly;if(e===false&&(r||a||n)){this.raise(Qe.UnexpectedParameterModifier,{at:i})}}const o=this.parseMaybeDefault();this.parseAssignableListItemTypes(o);const h=this.parseMaybeDefault(o.start,o.loc.start,o);if(r||a||n){const e=this.startNodeAt(s,i);if(t.length){e.decorators=t}if(r)e.accessibility=r;if(a)e.readonly=a;if(n)e.override=n;if(h.type!=="Identifier"&&h.type!=="AssignmentPattern"){this.raise(Qe.UnsupportedParameterPropertyKind,{at:e})}e.parameter=h;return this.finishNode(e,"TSParameterProperty")}if(t.length){o.decorators=t}return h}isSimpleParameter(e){return e.type==="TSParameterProperty"&&super.isSimpleParameter(e.parameter)||super.isSimpleParameter(e)}parseFunctionBodyAndFinish(e,t,s=false){if(this.match(14)){e.returnType=this.tsParseTypeOrTypePredicateAnnotation(14)}const i=t==="FunctionDeclaration"?"TSDeclareFunction":t==="ClassMethod"||t==="ClassPrivateMethod"?"TSDeclareMethod":undefined;if(i&&!this.match(5)&&this.isLineTerminator()){this.finishNode(e,i);return}if(i==="TSDeclareFunction"&&this.state.isAmbientContext){this.raise(Qe.DeclareFunctionHasImplementation,{at:e});if(e.declare){super.parseFunctionBodyAndFinish(e,i,s);return}}super.parseFunctionBodyAndFinish(e,t,s)}registerFunctionStatementId(e){if(!e.body&&e.id){this.checkIdentifier(e.id,pe)}else{super.registerFunctionStatementId(...arguments)}}tsCheckForInvalidTypeCasts(e){e.forEach((e=>{if((e==null?void 0:e.type)==="TSTypeCastExpression"){this.raise(Qe.UnexpectedTypeAnnotation,{at:e.typeAnnotation})}}))}toReferencedList(e,t){this.tsCheckForInvalidTypeCasts(e);return e}parseArrayLike(...e){const t=super.parseArrayLike(...e);if(t.type==="ArrayExpression"){this.tsCheckForInvalidTypeCasts(t.elements)}return t}parseSubscript(e,t,s,i,r){if(!this.hasPrecedingLineBreak()&&this.match(35)){this.state.canStartJSXElement=false;this.next();const i=this.startNodeAt(t,s);i.expression=e;return this.finishNode(i,"TSNonNullExpression")}let a=false;if(this.match(18)&&this.lookaheadCharCode()===60){if(i){r.stop=true;return e}r.optionalChainMember=a=true;this.next()}if(this.match(47)||this.match(51)){let n;const o=this.tsTryParseAndCatch((()=>{if(!i&&this.atPossibleAsyncArrow(e)){const e=this.tsTryParseGenericAsyncArrowFunction(t,s);if(e){return e}}const o=this.tsParseTypeArgumentsInExpression();if(!o)throw this.unexpected();if(a&&!this.match(10)){n=this.state.curPosition();throw this.unexpected()}if(tokenIsTemplate(this.state.type)){const i=this.parseTaggedTemplateExpression(e,t,s,r);i.typeParameters=o;return i}if(!i&&this.eat(10)){const i=this.startNodeAt(t,s);i.callee=e;i.arguments=this.parseCallExpressionArguments(11,false);this.tsCheckForInvalidTypeCasts(i.arguments);i.typeParameters=o;if(r.optionalChainMember){i.optional=a}return this.finishCallExpression(i,r.optionalChainMember)}if(tsTokenCanStartExpression(this.state.type)&&this.state.type!==10){throw this.unexpected()}const h=this.startNodeAt(t,s);h.expression=e;h.typeParameters=o;return this.finishNode(h,"TSInstantiationExpression")}));if(n){this.unexpected(n,10)}if(o)return o}return super.parseSubscript(e,t,s,i,r)}parseNewCallee(e){var t;super.parseNewCallee(e);const{callee:s}=e;if(s.type==="TSInstantiationExpression"&&!((t=s.extra)!=null&&t.parenthesized)){e.typeParameters=s.typeParameters;e.callee=s.expression}}parseExprOp(e,t,s,i){if(tokenOperatorPrecedence(58)>i&&!this.hasPrecedingLineBreak()&&this.isContextual(93)){const r=this.startNodeAt(t,s);r.expression=e;const a=this.tsTryNextParseConstantContext();if(a){r.typeAnnotation=a}else{r.typeAnnotation=this.tsNextThenParseType()}this.finishNode(r,"TSAsExpression");this.reScan_lt_gt();return this.parseExprOp(r,t,s,i)}return super.parseExprOp(e,t,s,i)}checkReservedWord(e,t,s,i){if(!this.state.isAmbientContext){super.checkReservedWord(e,t,s,i)}}checkDuplicateExports(){}parseImport(e){e.importKind="value";if(tokenIsIdentifier(this.state.type)||this.match(55)||this.match(5)){let t=this.lookahead();if(this.isContextual(126)&&t.type!==12&&t.type!==97&&t.type!==29){e.importKind="type";this.next();t=this.lookahead()}if(tokenIsIdentifier(this.state.type)&&t.type===29){return this.tsParseImportEqualsDeclaration(e)}}const t=super.parseImport(e);if(t.importKind==="type"&&t.specifiers.length>1&&t.specifiers[0].type==="ImportDefaultSpecifier"){this.raise(Qe.TypeImportCannotSpecifyDefaultAndNamed,{at:t})}return t}parseExport(e){if(this.match(83)){this.next();if(this.isContextual(126)&&this.lookaheadCharCode()!==61){e.importKind="type";this.next()}else{e.importKind="value"}return this.tsParseImportEqualsDeclaration(e,true)}else if(this.eat(29)){const t=e;t.expression=this.parseExpression();this.semicolon();return this.finishNode(t,"TSExportAssignment")}else if(this.eatContextual(93)){const t=e;this.expectContextual(124);t.id=this.parseIdentifier();this.semicolon();return this.finishNode(t,"TSNamespaceExportDeclaration")}else{if(this.isContextual(126)&&this.lookahead().type===5){this.next();e.exportKind="type"}else{e.exportKind="value"}return super.parseExport(e)}}isAbstractClass(){return this.isContextual(120)&&this.lookahead().type===80}parseExportDefaultExpression(){if(this.isAbstractClass()){const e=this.startNode();this.next();e.abstract=true;this.parseClass(e,true,true);return e}if(this.match(125)){const e=this.tsParseInterfaceDeclaration(this.startNode());if(e)return e}return super.parseExportDefaultExpression()}parseVarStatement(e,t,s=false){const{isAmbientContext:i}=this.state;const r=super.parseVarStatement(e,t,s||i);if(!i)return r;for(const{id:e,init:s}of r.declarations){if(!s)continue;if(t!=="const"||!!e.typeAnnotation){this.raise(Qe.InitializerNotAllowedInAmbientContext,{at:s})}else if(s.type!=="StringLiteral"&&s.type!=="BooleanLiteral"&&s.type!=="NumericLiteral"&&s.type!=="BigIntLiteral"&&(s.type!=="TemplateLiteral"||s.expressions.length>0)&&!isPossiblyLiteralEnum(s)){this.raise(Qe.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference,{at:s})}}return r}parseStatementContent(e,t){if(this.match(75)&&this.isLookaheadContextual("enum")){const e=this.startNode();this.expect(75);return this.tsParseEnumDeclaration(e,{const:true})}if(this.isContextual(122)){return this.tsParseEnumDeclaration(this.startNode())}if(this.isContextual(125)){const e=this.tsParseInterfaceDeclaration(this.startNode());if(e)return e}return super.parseStatementContent(e,t)}parseAccessModifier(){return this.tsParseModifier(["public","protected","private"])}tsHasSomeModifiers(e,t){return t.some((t=>{if(tsIsAccessModifier(t)){return e.accessibility===t}return!!e[t]}))}tsIsStartOfStaticBlocks(){return this.isContextual(104)&&this.lookaheadCharCode()===123}parseClassMember(e,t,s){const i=["declare","private","public","protected","override","abstract","readonly","static"];this.tsParseModifiers({modified:t,allowedModifiers:i,disallowedModifiers:["in","out"],stopOnStartOfClassStaticBlock:true,errorTemplate:Qe.InvalidModifierOnTypeParameterPositions});const callParseClassMemberWithIsStatic=()=>{if(this.tsIsStartOfStaticBlocks()){this.next();this.next();if(this.tsHasSomeModifiers(t,i)){this.raise(Qe.StaticBlockCannotHaveModifier,{at:this.state.curPosition()})}this.parseClassStaticBlock(e,t)}else{this.parseClassMemberWithIsStatic(e,t,s,!!t.static)}};if(t.declare){this.tsInAmbientContext(callParseClassMemberWithIsStatic)}else{callParseClassMemberWithIsStatic()}}parseClassMemberWithIsStatic(e,t,s,i){const r=this.tsTryParseIndexSignature(t);if(r){e.body.push(r);if(t.abstract){this.raise(Qe.IndexSignatureHasAbstract,{at:t})}if(t.accessibility){this.raise(Qe.IndexSignatureHasAccessibility,{at:t,modifier:t.accessibility})}if(t.declare){this.raise(Qe.IndexSignatureHasDeclare,{at:t})}if(t.override){this.raise(Qe.IndexSignatureHasOverride,{at:t})}return}if(!this.state.inAbstractClass&&t.abstract){this.raise(Qe.NonAbstractClassHasAbstractMethod,{at:t})}if(t.override){if(!s.hadSuperClass){this.raise(Qe.OverrideNotInSubClass,{at:t})}}super.parseClassMemberWithIsStatic(e,t,s,i)}parsePostMemberNameModifiers(e){const t=this.eat(17);if(t)e.optional=true;if(e.readonly&&this.match(10)){this.raise(Qe.ClassMethodHasReadonly,{at:e})}if(e.declare&&this.match(10)){this.raise(Qe.ClassMethodHasDeclare,{at:e})}}parseExpressionStatement(e,t){const s=t.type==="Identifier"?this.tsParseExpressionStatement(e,t):undefined;return s||super.parseExpressionStatement(e,t)}shouldParseExportDeclaration(){if(this.tsIsDeclarationStart())return true;return super.shouldParseExportDeclaration()}parseConditional(e,t,s,i){if(!this.state.maybeInArrowParameters||!this.match(17)){return super.parseConditional(e,t,s,i)}const r=this.tryParse((()=>super.parseConditional(e,t,s)));if(!r.node){if(r.error){super.setOptionalParametersError(i,r.error)}return e}if(r.error)this.state=r.failState;return r.node}parseParenItem(e,t,s){e=super.parseParenItem(e,t,s);if(this.eat(17)){e.optional=true;this.resetEndLocation(e)}if(this.match(14)){const i=this.startNodeAt(t,s);i.expression=e;i.typeAnnotation=this.tsParseTypeAnnotation();return this.finishNode(i,"TSTypeCastExpression")}return e}parseExportDeclaration(e){if(!this.state.isAmbientContext&&this.isContextual(121)){return this.tsInAmbientContext((()=>this.parseExportDeclaration(e)))}const t=this.state.start;const s=this.state.startLoc;const i=this.eatContextual(121);if(i&&(this.isContextual(121)||!this.shouldParseExportDeclaration())){throw this.raise(Qe.ExpectedAmbientAfterExportDeclare,{at:this.state.startLoc})}const r=tokenIsIdentifier(this.state.type);const a=r&&this.tsTryParseExportDeclaration()||super.parseExportDeclaration(e);if(!a)return null;if(a.type==="TSInterfaceDeclaration"||a.type==="TSTypeAliasDeclaration"||i){e.exportKind="type"}if(i){this.resetStartLocation(a,t,s);a.declare=true}return a}parseClassId(e,t,s){if((!t||s)&&this.isContextual(110)){return}super.parseClassId(e,t,s,e.declare?pe:ie);const i=this.tsTryParseTypeParameters(this.tsParseInOutModifiers.bind(this));if(i)e.typeParameters=i}parseClassPropertyAnnotation(e){if(!e.optional&&this.eat(35)){e.definite=true}const t=this.tsTryParseTypeAnnotation();if(t)e.typeAnnotation=t}parseClassProperty(e){this.parseClassPropertyAnnotation(e);if(this.state.isAmbientContext&&this.match(29)){this.raise(Qe.DeclareClassFieldHasInitializer,{at:this.state.startLoc})}if(e.abstract&&this.match(29)){const{key:t}=e;this.raise(Qe.AbstractPropertyHasInitializer,{at:this.state.startLoc,propertyName:t.type==="Identifier"&&!e.computed?t.name:`[${this.input.slice(t.start,t.end)}]`})}return super.parseClassProperty(e)}parseClassPrivateProperty(e){if(e.abstract){this.raise(Qe.PrivateElementHasAbstract,{at:e})}if(e.accessibility){this.raise(Qe.PrivateElementHasAccessibility,{at:e,modifier:e.accessibility})}this.parseClassPropertyAnnotation(e);return super.parseClassPrivateProperty(e)}pushClassMethod(e,t,s,i,r,a){const n=this.tsTryParseTypeParameters();if(n&&r){this.raise(Qe.ConstructorHasTypeParameters,{at:n})}const{declare:o=false,kind:h}=t;if(o&&(h==="get"||h==="set")){this.raise(Qe.DeclareAccessor,{at:t,kind:h})}if(n)t.typeParameters=n;super.pushClassMethod(e,t,s,i,r,a)}pushClassPrivateMethod(e,t,s,i){const r=this.tsTryParseTypeParameters();if(r)t.typeParameters=r;super.pushClassPrivateMethod(e,t,s,i)}declareClassPrivateMethodInScope(e,t){if(e.type==="TSDeclareMethod")return;if(e.type==="MethodDefinition"&&!e.value.body)return;super.declareClassPrivateMethodInScope(e,t)}parseClassSuper(e){super.parseClassSuper(e);if(e.superClass&&(this.match(47)||this.match(51))){e.superTypeParameters=this.tsParseTypeArgumentsInExpression()}if(this.eatContextual(110)){e.implements=this.tsParseHeritageClause("implements")}}parseObjPropValue(e,...t){const s=this.tsTryParseTypeParameters();if(s)e.typeParameters=s;super.parseObjPropValue(e,...t)}parseFunctionParams(e,t){const s=this.tsTryParseTypeParameters();if(s)e.typeParameters=s;super.parseFunctionParams(e,t)}parseVarId(e,t){super.parseVarId(e,t);if(e.id.type==="Identifier"&&!this.hasPrecedingLineBreak()&&this.eat(35)){e.definite=true}const s=this.tsTryParseTypeAnnotation();if(s){e.id.typeAnnotation=s;this.resetEndLocation(e.id)}}parseAsyncArrowFromCallExpression(e,t){if(this.match(14)){e.returnType=this.tsParseTypeAnnotation()}return super.parseAsyncArrowFromCallExpression(e,t)}parseMaybeAssign(...e){var t,s,i,r,a,n,o;let c;let p;let l;if(this.hasPlugin("jsx")&&(this.match(138)||this.match(47))){c=this.state.clone();p=this.tryParse((()=>super.parseMaybeAssign(...e)),c);if(!p.error)return p.node;const{context:t}=this.state;const s=t[t.length-1];if(s===h.j_oTag||s===h.j_expr){t.pop()}}if(!((t=p)!=null&&t.error)&&!this.match(47)){return super.parseMaybeAssign(...e)}let u;c=c||this.state.clone();const d=this.tryParse((t=>{var s,i,r;u=this.tsParseTypeParameters();const a=super.parseMaybeAssign(...e);if(a.type!=="ArrowFunctionExpression"||(s=a.extra)!=null&&s.parenthesized){t()}if(((i=u)==null?void 0:i.params.length)!==0){this.resetStartLocationFromNode(a,u)}a.typeParameters=u;if(this.hasPlugin("jsx")&&a.typeParameters.params.length===1&&!((r=a.typeParameters.extra)!=null&&r.trailingComma)){const e=a.typeParameters.params[0];if(!e.constraint);}return a}),c);if(!d.error&&!d.aborted){if(u)this.reportReservedArrowTypeParam(u);return d.node}if(!p){assert(!this.hasPlugin("jsx"));l=this.tryParse((()=>super.parseMaybeAssign(...e)),c);if(!l.error)return l.node}if((s=p)!=null&&s.node){this.state=p.failState;return p.node}if(d.node){this.state=d.failState;if(u)this.reportReservedArrowTypeParam(u);return d.node}if((i=l)!=null&&i.node){this.state=l.failState;return l.node}if((r=p)!=null&&r.thrown)throw p.error;if(d.thrown)throw d.error;if((a=l)!=null&&a.thrown)throw l.error;throw((n=p)==null?void 0:n.error)||d.error||((o=l)==null?void 0:o.error)}reportReservedArrowTypeParam(e){var t;if(e.params.length===1&&!((t=e.extra)!=null&&t.trailingComma)&&this.getPluginOption("typescript","disallowAmbiguousJSXLike")){this.raise(Qe.ReservedArrowTypeParam,{at:e})}}parseMaybeUnary(e){if(!this.hasPlugin("jsx")&&this.match(47)){return this.tsParseTypeAssertion()}else{return super.parseMaybeUnary(e)}}parseArrow(e){if(this.match(14)){const t=this.tryParse((e=>{const t=this.tsParseTypeOrTypePredicateAnnotation(14);if(this.canInsertSemicolon()||!this.match(19))e();return t}));if(t.aborted)return;if(!t.thrown){if(t.error)this.state=t.failState;e.returnType=t.node}}return super.parseArrow(e)}parseAssignableListItemTypes(e){if(this.eat(17)){if(e.type!=="Identifier"&&!this.state.isAmbientContext&&!this.state.inType){this.raise(Qe.PatternIsOptional,{at:e})}e.optional=true}const t=this.tsTryParseTypeAnnotation();if(t)e.typeAnnotation=t;this.resetEndLocation(e);return e}isAssignable(e,t){switch(e.type){case"TSTypeCastExpression":return this.isAssignable(e.expression,t);case"TSParameterProperty":return true;default:return super.isAssignable(e,t)}}toAssignable(e,t=false){switch(e.type){case"ParenthesizedExpression":this.toAssignableParenthesizedExpression(e,t);break;case"TSAsExpression":case"TSNonNullExpression":case"TSTypeAssertion":if(t){this.expressionScope.recordArrowParemeterBindingError(Qe.UnexpectedTypeCastInParameter,{at:e})}else{this.raise(Qe.UnexpectedTypeCastInParameter,{at:e})}this.toAssignable(e.expression,t);break;case"AssignmentExpression":if(!t&&e.left.type==="TSTypeCastExpression"){e.left=this.typeCastToParameter(e.left)}default:super.toAssignable(e,t)}}toAssignableParenthesizedExpression(e,t){switch(e.expression.type){case"TSAsExpression":case"TSNonNullExpression":case"TSTypeAssertion":case"ParenthesizedExpression":this.toAssignable(e.expression,t);break;default:super.toAssignable(e,t)}}checkToRestConversion(e,t){switch(e.type){case"TSAsExpression":case"TSTypeAssertion":case"TSNonNullExpression":this.checkToRestConversion(e.expression,false);break;default:super.checkToRestConversion(e,t)}}isValidLVal(e,t,s){return getOwn$1({TSTypeCastExpression:true,TSParameterProperty:"parameter",TSNonNullExpression:"expression",TSAsExpression:(s!==le||!t)&&["expression",true],TSTypeAssertion:(s!==le||!t)&&["expression",true]},e)||super.isValidLVal(e,t,s)}parseBindingAtom(){switch(this.state.type){case 78:return this.parseIdentifier(true);default:return super.parseBindingAtom()}}parseMaybeDecoratorArguments(e){if(this.match(47)||this.match(51)){const t=this.tsParseTypeArgumentsInExpression();if(this.match(10)){const s=super.parseMaybeDecoratorArguments(e);s.typeParameters=t;return s}this.unexpected(null,10)}return super.parseMaybeDecoratorArguments(e)}checkCommaAfterRest(e){if(this.state.isAmbientContext&&this.match(12)&&this.lookaheadCharCode()===e){this.next();return false}else{return super.checkCommaAfterRest(e)}}isClassMethod(){return this.match(47)||super.isClassMethod()}isClassProperty(){return this.match(35)||this.match(14)||super.isClassProperty()}parseMaybeDefault(...e){const t=super.parseMaybeDefault(...e);if(t.type==="AssignmentPattern"&&t.typeAnnotation&&t.right.start<t.typeAnnotation.start){this.raise(Qe.TypeAnnotationAfterAssign,{at:t.typeAnnotation})}return t}getTokenFromCode(e){if(this.state.inType){if(e===62){return this.finishOp(48,1)}if(e===60){return this.finishOp(47,1)}}return super.getTokenFromCode(e)}reScan_lt_gt(){const{type:e}=this.state;if(e===47){this.state.pos-=1;this.readToken_lt()}else if(e===48){this.state.pos-=1;this.readToken_gt()}}reScan_lt(){const{type:e}=this.state;if(e===51){this.state.pos-=2;this.finishOp(47,1);return 47}return e}toAssignableList(e){for(let t=0;t<e.length;t++){const s=e[t];if((s==null?void 0:s.type)==="TSTypeCastExpression"){e[t]=this.typeCastToParameter(s)}}super.toAssignableList(...arguments)}typeCastToParameter(e){e.expression.typeAnnotation=e.typeAnnotation;this.resetEndLocation(e.expression,e.typeAnnotation.loc.end);return e.expression}shouldParseArrow(e){if(this.match(14)){return e.every((e=>this.isAssignable(e,true)))}return super.shouldParseArrow(e)}shouldParseAsyncArrow(){return this.match(14)||super.shouldParseAsyncArrow()}canHaveLeadingDecorator(){return super.canHaveLeadingDecorator()||this.isAbstractClass()}jsxParseOpeningElementAfterName(e){if(this.match(47)||this.match(51)){const t=this.tsTryParseAndCatch((()=>this.tsParseTypeArgumentsInExpression()));if(t)e.typeParameters=t}return super.jsxParseOpeningElementAfterName(e)}getGetterSetterExpectedParamCount(e){const t=super.getGetterSetterExpectedParamCount(e);const s=this.getObjectOrClassMethodParams(e);const i=s[0];const r=i&&this.isThisParam(i);return r?t+1:t}parseCatchClauseParam(){const e=super.parseCatchClauseParam();const t=this.tsTryParseTypeAnnotation();if(t){e.typeAnnotation=t;this.resetEndLocation(e)}return e}tsInAmbientContext(e){const t=this.state.isAmbientContext;this.state.isAmbientContext=true;try{return e()}finally{this.state.isAmbientContext=t}}parseClass(e,...t){const s=this.state.inAbstractClass;this.state.inAbstractClass=!!e.abstract;try{return super.parseClass(e,...t)}finally{this.state.inAbstractClass=s}}tsParseAbstractDeclaration(e){if(this.match(80)){e.abstract=true;return this.parseClass(e,true,false)}else if(this.isContextual(125)){if(!this.hasFollowingLineBreak()){e.abstract=true;this.raise(Qe.NonClassMethodPropertyHasAbstractModifer,{at:e});return this.tsParseInterfaceDeclaration(e)}}else{this.unexpected(null,80)}}parseMethod(...e){const t=super.parseMethod(...e);if(t.abstract){const e=this.hasPlugin("estree")?!!t.value.body:!!t.body;if(e){const{key:e}=t;this.raise(Qe.AbstractMethodHasImplementation,{at:t,methodName:e.type==="Identifier"&&!t.computed?e.name:`[${this.input.slice(e.start,e.end)}]`})}}return t}tsParseTypeParameterName(){const e=this.parseIdentifier();return e.name}shouldParseAsAmbientContext(){return!!this.getPluginOption("typescript","dts")}parse(){if(this.shouldParseAsAmbientContext()){this.state.isAmbientContext=true}return super.parse()}getExpression(){if(this.shouldParseAsAmbientContext()){this.state.isAmbientContext=true}return super.getExpression()}parseExportSpecifier(e,t,s,i){if(!t&&i){this.parseTypeOnlyImportExportSpecifier(e,false,s);return this.finishNode(e,"ExportSpecifier")}e.exportKind="value";return super.parseExportSpecifier(e,t,s,i)}parseImportSpecifier(e,t,s,i){if(!t&&i){this.parseTypeOnlyImportExportSpecifier(e,true,s);return this.finishNode(e,"ImportSpecifier")}e.importKind="value";return super.parseImportSpecifier(e,t,s,i)}parseTypeOnlyImportExportSpecifier(e,t,s){const i=t?"imported":"local";const r=t?"local":"exported";let a=e[i];let n;let o=false;let h=true;const c=a.loc.start;if(this.isContextual(93)){const e=this.parseIdentifier();if(this.isContextual(93)){const s=this.parseIdentifier();if(tokenIsKeywordOrIdentifier(this.state.type)){o=true;a=e;n=t?this.parseIdentifier():this.parseModuleExportName();h=false}else{n=s;h=false}}else if(tokenIsKeywordOrIdentifier(this.state.type)){h=false;n=t?this.parseIdentifier():this.parseModuleExportName()}else{o=true;a=e}}else if(tokenIsKeywordOrIdentifier(this.state.type)){o=true;if(t){a=this.parseIdentifier(true);if(!this.isContextual(93)){this.checkReservedWord(a.name,a.loc.start,true,true)}}else{a=this.parseModuleExportName()}}if(o&&s){this.raise(t?Qe.TypeModifierIsUsedInTypeImports:Qe.TypeModifierIsUsedInTypeExports,{at:c})}e[i]=a;e[r]=n;const p=t?"importKind":"exportKind";e[p]=o?"type":"value";if(h&&this.eatContextual(93)){e[r]=t?this.parseIdentifier():this.parseModuleExportName()}if(!e[r]){e[r]=cloneIdentifier(e[i])}if(t){this.checkIdentifier(e[r],re)}}};function isPossiblyLiteralEnum(e){if(e.type!=="MemberExpression")return false;const{computed:t,property:s}=e;if(t&&s.type!=="StringLiteral"&&(s.type!=="TemplateLiteral"||s.expressions.length>0)){return false}return isUncomputedMemberExpressionChain(e.object)}function isUncomputedMemberExpressionChain(e){if(e.type==="Identifier")return true;if(e.type!=="MemberExpression")return false;if(e.computed)return false;return isUncomputedMemberExpressionChain(e.object)}const Ze=ParseErrorEnum`placeholders`((e=>({ClassNameIsRequired:e("A class name is required."),UnexpectedSpace:e("Unexpected space in placeholder.")})));var placeholders=e=>class extends e{parsePlaceholder(e){if(this.match(140)){const t=this.startNode();this.next();this.assertNoSpace();t.name=super.parseIdentifier(true);this.assertNoSpace();this.expect(140);return this.finishPlaceholder(t,e)}}finishPlaceholder(e,t){const s=!!(e.expectedNode&&e.type==="Placeholder");e.expectedNode=t;return s?e:this.finishNode(e,"Placeholder")}getTokenFromCode(e){if(e===37&&this.input.charCodeAt(this.state.pos+1)===37){return this.finishOp(140,2)}return super.getTokenFromCode(...arguments)}parseExprAtom(){return this.parsePlaceholder("Expression")||super.parseExprAtom(...arguments)}parseIdentifier(){return this.parsePlaceholder("Identifier")||super.parseIdentifier(...arguments)}checkReservedWord(e){if(e!==undefined)super.checkReservedWord(...arguments)}parseBindingAtom(){return this.parsePlaceholder("Pattern")||super.parseBindingAtom(...arguments)}isValidLVal(e,...t){return e==="Placeholder"||super.isValidLVal(e,...t)}toAssignable(e){if(e&&e.type==="Placeholder"&&e.expectedNode==="Expression"){e.expectedNode="Pattern"}else{super.toAssignable(...arguments)}}isLet(e){if(super.isLet(e)){return true}if(!this.isContextual(99)){return false}if(e)return false;const t=this.lookahead();if(t.type===140){return true}return false}verifyBreakContinue(e){if(e.label&&e.label.type==="Placeholder")return;super.verifyBreakContinue(...arguments)}parseExpressionStatement(e,t){if(t.type!=="Placeholder"||t.extra&&t.extra.parenthesized){return super.parseExpressionStatement(...arguments)}if(this.match(14)){const s=e;s.label=this.finishPlaceholder(t,"Identifier");this.next();s.body=this.parseStatement("label");return this.finishNode(s,"LabeledStatement")}this.semicolon();e.name=t.name;return this.finishPlaceholder(e,"Statement")}parseBlock(){return this.parsePlaceholder("BlockStatement")||super.parseBlock(...arguments)}parseFunctionId(){return this.parsePlaceholder("Identifier")||super.parseFunctionId(...arguments)}parseClass(e,t,s){const i=t?"ClassDeclaration":"ClassExpression";this.next();this.takeDecorators(e);const r=this.state.strict;const a=this.parsePlaceholder("Identifier");if(a){if(this.match(81)||this.match(140)||this.match(5)){e.id=a}else if(s||!t){e.id=null;e.body=this.finishPlaceholder(a,"ClassBody");return this.finishNode(e,i)}else{throw this.raise(Ze.ClassNameIsRequired,{at:this.state.startLoc})}}else{this.parseClassId(e,t,s)}this.parseClassSuper(e);e.body=this.parsePlaceholder("ClassBody")||this.parseClassBody(!!e.superClass,r);return this.finishNode(e,i)}parseExport(e){const t=this.parsePlaceholder("Identifier");if(!t)return super.parseExport(...arguments);if(!this.isContextual(97)&&!this.match(12)){e.specifiers=[];e.source=null;e.declaration=this.finishPlaceholder(t,"Declaration");return this.finishNode(e,"ExportNamedDeclaration")}this.expectPlugin("exportDefaultFrom");const s=this.startNode();s.exported=t;e.specifiers=[this.finishNode(s,"ExportDefaultSpecifier")];return super.parseExport(e)}isExportDefaultSpecifier(){if(this.match(65)){const e=this.nextTokenStart();if(this.isUnparsedContextual(e,"from")){if(this.input.startsWith(tokenLabelName(140),this.nextTokenStartSince(e+4))){return true}}}return super.isExportDefaultSpecifier()}maybeParseExportDefaultSpecifier(e){if(e.specifiers&&e.specifiers.length>0){return true}return super.maybeParseExportDefaultSpecifier(...arguments)}checkExport(e){const{specifiers:t}=e;if(t!=null&&t.length){e.specifiers=t.filter((e=>e.exported.type==="Placeholder"))}super.checkExport(e);e.specifiers=t}parseImport(e){const t=this.parsePlaceholder("Identifier");if(!t)return super.parseImport(...arguments);e.specifiers=[];if(!this.isContextual(97)&&!this.match(12)){e.source=this.finishPlaceholder(t,"StringLiteral");this.semicolon();return this.finishNode(e,"ImportDeclaration")}const s=this.startNodeAtNode(t);s.local=t;this.finishNode(s,"ImportDefaultSpecifier");e.specifiers.push(s);if(this.eat(12)){const t=this.maybeParseStarImportSpecifier(e);if(!t)this.parseNamedImportSpecifiers(e)}this.expectContextual(97);e.source=this.parseImportSource();this.semicolon();return this.finishNode(e,"ImportDeclaration")}parseImportSource(){return this.parsePlaceholder("StringLiteral")||super.parseImportSource(...arguments)}assertNoSpace(){if(this.state.start>this.state.lastTokEndLoc.index){this.raise(Ze.UnexpectedSpace,{at:this.state.lastTokEndLoc})}}};var v8intrinsic=e=>class extends e{parseV8Intrinsic(){if(this.match(54)){const e=this.state.startLoc;const t=this.startNode();this.next();if(tokenIsIdentifier(this.state.type)){const e=this.parseIdentifierName(this.state.start);const s=this.createIdentifier(t,e);s.type="V8IntrinsicIdentifier";if(this.match(10)){return s}}this.unexpected(e)}}parseExprAtom(){return this.parseV8Intrinsic()||super.parseExprAtom(...arguments)}};function hasPlugin(e,t){const[s,i]=typeof t==="string"?[t,{}]:t;const r=Object.keys(i);const a=r.length===0;return e.some((e=>{if(typeof e==="string"){return a&&e===s}else{const[t,a]=e;if(t!==s){return false}for(const e of r){if(a[e]!==i[e]){return false}}return true}}))}function getPluginOption(e,t,s){const i=e.find((e=>{if(Array.isArray(e)){return e[0]===t}else{return e===t}}));if(i&&Array.isArray(i)){return i[1][s]}return null}const et=["minimal","fsharp","hack","smart"];const tt=["^^","@@","^","%","#"];const st=["hash","bar"];function validatePlugins(e){if(hasPlugin(e,"decorators")){if(hasPlugin(e,"decorators-legacy")){throw new Error("Cannot use the decorators and decorators-legacy plugin together")}const t=getPluginOption(e,"decorators","decoratorsBeforeExport");if(t==null){throw new Error("The 'decorators' plugin requires a 'decoratorsBeforeExport' option,"+" whose value must be a boolean. If you are migrating from"+" Babylon/Babel 6 or want to use the old decorators proposal, you"+" should use the 'decorators-legacy' plugin instead of 'decorators'.")}else if(typeof t!=="boolean"){throw new Error("'decoratorsBeforeExport' must be a boolean.")}}if(hasPlugin(e,"flow")&&hasPlugin(e,"typescript")){throw new Error("Cannot combine flow and typescript plugins.")}if(hasPlugin(e,"placeholders")&&hasPlugin(e,"v8intrinsic")){throw new Error("Cannot combine placeholders and v8intrinsic plugins.")}if(hasPlugin(e,"pipelineOperator")){const t=getPluginOption(e,"pipelineOperator","proposal");if(!et.includes(t)){const e=et.map((e=>`"${e}"`)).join(", ");throw new Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${e}.`)}const s=hasPlugin(e,["recordAndTuple",{syntaxType:"hash"}]);if(t==="hack"){if(hasPlugin(e,"placeholders")){throw new Error("Cannot combine placeholders plugin and Hack-style pipes.")}if(hasPlugin(e,"v8intrinsic")){throw new Error("Cannot combine v8intrinsic plugin and Hack-style pipes.")}const t=getPluginOption(e,"pipelineOperator","topicToken");if(!tt.includes(t)){const e=tt.map((e=>`"${e}"`)).join(", ");throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${e}.`)}if(t==="#"&&s){throw new Error('Plugin conflict between `["pipelineOperator", { proposal: "hack", topicToken: "#" }]` and `["recordAndtuple", { syntaxType: "hash"}]`.')}}else if(t==="smart"&&s){throw new Error('Plugin conflict between `["pipelineOperator", { proposal: "smart" }]` and `["recordAndtuple", { syntaxType: "hash"}]`.')}}if(hasPlugin(e,"moduleAttributes")){{if(hasPlugin(e,"importAssertions")){throw new Error("Cannot combine importAssertions and moduleAttributes plugins.")}const t=getPluginOption(e,"moduleAttributes","version");if(t!=="may-2020"){throw new Error("The 'moduleAttributes' plugin requires a 'version' option,"+" representing the last proposal update. Currently, the"+" only supported value is 'may-2020'.")}}}if(hasPlugin(e,"recordAndTuple")&&!st.includes(getPluginOption(e,"recordAndTuple","syntaxType"))){throw new Error("'recordAndTuple' requires 'syntaxType' option whose value should be one of: "+st.map((e=>`'${e}'`)).join(", "))}if(hasPlugin(e,"asyncDoExpressions")&&!hasPlugin(e,"doExpressions")){const e=new Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.");e.missingPlugins="doExpressions";throw e}}const it={estree:estree,jsx:jsx,flow:flow,typescript:typescript,v8intrinsic:v8intrinsic,placeholders:placeholders};const rt=Object.keys(it);const at={sourceType:"script",sourceFilename:undefined,startColumn:0,startLine:1,allowAwaitOutsideFunction:false,allowReturnOutsideFunction:false,allowImportExportEverywhere:false,allowSuperOutsideMethod:false,allowUndeclaredExports:false,plugins:[],strictMode:null,ranges:false,tokens:false,createParenthesizedExpressions:false,errorRecovery:false,attachComment:true};function getOptions(e){const t={};for(const s of Object.keys(at)){t[s]=e&&e[s]!=null?e[s]:at[s]}return t}const getOwn=(e,t)=>Object.hasOwnProperty.call(e,t)&&e[t];const unwrapParenthesizedExpression=e=>e.type==="ParenthesizedExpression"?unwrapParenthesizedExpression(e.expression):e;class LValParser extends NodeUtils{toAssignable(e,t=false){var s,i;let r=undefined;if(e.type==="ParenthesizedExpression"||(s=e.extra)!=null&&s.parenthesized){r=unwrapParenthesizedExpression(e);if(t){if(r.type==="Identifier"){this.expressionScope.recordArrowParemeterBindingError(n.InvalidParenthesizedAssignment,{at:e})}else if(r.type!=="MemberExpression"){this.raise(n.InvalidParenthesizedAssignment,{at:e})}}else{this.raise(n.InvalidParenthesizedAssignment,{at:e})}}switch(e.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern";for(let s=0,i=e.properties.length,r=i-1;s<i;s++){var a;const i=e.properties[s];const o=s===r;this.toAssignableObjectExpressionProp(i,o,t);if(o&&i.type==="RestElement"&&(a=e.extra)!=null&&a.trailingCommaLoc){this.raise(n.RestTrailingComma,{at:e.extra.trailingCommaLoc})}}break;case"ObjectProperty":{const{key:s,value:i}=e;if(this.isPrivateName(s)){this.classScope.usePrivateName(this.getPrivateNameSV(s),s.loc.start)}this.toAssignable(i,t);break}case"SpreadElement":{throw new Error("Internal @babel/parser error (this is a bug, please report it)."+" SpreadElement should be converted by .toAssignable's caller.")}case"ArrayExpression":e.type="ArrayPattern";this.toAssignableList(e.elements,(i=e.extra)==null?void 0:i.trailingCommaLoc,t);break;case"AssignmentExpression":if(e.operator!=="="){this.raise(n.MissingEqInAssignment,{at:e.left.loc.end})}e.type="AssignmentPattern";delete e.operator;this.toAssignable(e.left,t);break;case"ParenthesizedExpression":this.toAssignable(r,t);break}}toAssignableObjectExpressionProp(e,t,s){if(e.type==="ObjectMethod"){this.raise(e.kind==="get"||e.kind==="set"?n.PatternHasAccessor:n.PatternHasMethod,{at:e.key})}else if(e.type==="SpreadElement"){e.type="RestElement";const i=e.argument;this.checkToRestConversion(i,false);this.toAssignable(i,s);if(!t){this.raise(n.RestTrailingComma,{at:e})}}else{this.toAssignable(e,s)}}toAssignableList(e,t,s){const i=e.length-1;for(let r=0;r<=i;r++){const a=e[r];if(!a)continue;if(a.type==="SpreadElement"){a.type="RestElement";const e=a.argument;this.checkToRestConversion(e,true);this.toAssignable(e,s)}else{this.toAssignable(a,s)}if(a.type==="RestElement"){if(r<i){this.raise(n.RestTrailingComma,{at:a})}else if(t){this.raise(n.RestTrailingComma,{at:t})}}}}isAssignable(e,t){switch(e.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":return true;case"ObjectExpression":{const t=e.properties.length-1;return e.properties.every(((e,s)=>e.type!=="ObjectMethod"&&(s===t||e.type!=="SpreadElement")&&this.isAssignable(e)))}case"ObjectProperty":return this.isAssignable(e.value);case"SpreadElement":return this.isAssignable(e.argument);case"ArrayExpression":return e.elements.every((e=>e===null||this.isAssignable(e)));case"AssignmentExpression":return e.operator==="=";case"ParenthesizedExpression":return this.isAssignable(e.expression);case"MemberExpression":case"OptionalMemberExpression":return!t;default:return false}}toReferencedList(e,t){return e}toReferencedListDeep(e,t){this.toReferencedList(e,t);for(const t of e){if((t==null?void 0:t.type)==="ArrayExpression"){this.toReferencedListDeep(t.elements)}}}parseSpread(e,t){const s=this.startNode();this.next();s.argument=this.parseMaybeAssignAllowIn(e,undefined,t);return this.finishNode(s,"SpreadElement")}parseRestBinding(){const e=this.startNode();this.next();e.argument=this.parseBindingAtom();return this.finishNode(e,"RestElement")}parseBindingAtom(){switch(this.state.type){case 0:{const e=this.startNode();this.next();e.elements=this.parseBindingList(3,93,true);return this.finishNode(e,"ArrayPattern")}case 5:return this.parseObjectLike(8,true)}return this.parseIdentifier()}parseBindingList(e,t,s,i){const r=[];let a=true;while(!this.eat(e)){if(a){a=false}else{this.expect(12)}if(s&&this.match(12)){r.push(null)}else if(this.eat(e)){break}else if(this.match(21)){r.push(this.parseAssignableListItemTypes(this.parseRestBinding()));if(!this.checkCommaAfterRest(t)){this.expect(e);break}}else{const e=[];if(this.match(26)&&this.hasPlugin("decorators")){this.raise(n.UnsupportedParameterDecorator,{at:this.state.startLoc})}while(this.match(26)){e.push(this.parseDecorator())}r.push(this.parseAssignableListItem(i,e))}}return r}parseBindingRestProperty(e){this.next();e.argument=this.parseIdentifier();this.checkCommaAfterRest(125);return this.finishNode(e,"RestElement")}parseBindingProperty(){const e=this.startNode();const{type:t,start:s,startLoc:i}=this.state;if(t===21){return this.parseBindingRestProperty(e)}else if(t===134){this.expectPlugin("destructuringPrivate",i);this.classScope.usePrivateName(this.state.value,i);e.key=this.parsePrivateName()}else{this.parsePropertyName(e)}e.method=false;this.parseObjPropValue(e,s,i,false,false,true,false);return e}parseAssignableListItem(e,t){const s=this.parseMaybeDefault();this.parseAssignableListItemTypes(s);const i=this.parseMaybeDefault(s.start,s.loc.start,s);if(t.length){s.decorators=t}return i}parseAssignableListItemTypes(e){return e}parseMaybeDefault(e,t,s){var i,r,a;t=(i=t)!=null?i:this.state.startLoc;e=(r=e)!=null?r:this.state.start;s=(a=s)!=null?a:this.parseBindingAtom();if(!this.eat(29))return s;const n=this.startNodeAt(e,t);n.left=s;n.right=this.parseMaybeAssignAllowIn();return this.finishNode(n,"AssignmentPattern")}isValidLVal(e,t,s){return getOwn({AssignmentPattern:"left",RestElement:"argument",ObjectProperty:"value",ParenthesizedExpression:"expression",ArrayPattern:"elements",ObjectPattern:"properties"},e)}checkLVal(e,{in:t,binding:s=le,checkClashes:i=false,strictModeChanged:r=false,allowingSloppyLetBinding:a=!(s&X),hasParenthesizedAncestor:o=false}){var h;const c=e.type;if(this.isObjectMethod(e))return;if(c==="MemberExpression"){if(s!==le){this.raise(n.InvalidPropertyBindingPattern,{at:e})}return}if(e.type==="Identifier"){this.checkIdentifier(e,s,r,a);const{name:t}=e;if(i){if(i.has(t)){this.raise(n.ParamDupe,{at:e})}else{i.add(t)}}return}const p=this.isValidLVal(e.type,!(o||(h=e.extra)!=null&&h.parenthesized)&&t.type==="AssignmentExpression",s);if(p===true)return;if(p===false){const i=s===le?n.InvalidLhs:n.InvalidLhsBinding;this.raise(i,{at:e,ancestor:t.type==="UpdateExpression"?{type:"UpdateExpression",prefix:t.prefix}:{type:t.type}});return}const[l,u]=Array.isArray(p)?p:[p,c==="ParenthesizedExpression"];const d=e.type==="ArrayPattern"||e.type==="ObjectPattern"||e.type==="ParenthesizedExpression"?e:t;for(const t of[].concat(e[l])){if(t){this.checkLVal(t,{in:d,binding:s,checkClashes:i,allowingSloppyLetBinding:a,strictModeChanged:r,hasParenthesizedAncestor:u})}}}checkIdentifier(e,t,s=false,i=!(t&X)){if(this.state.strict&&(s?isStrictBindReservedWord(e.name,this.inModule):isStrictBindOnlyReservedWord(e.name))){if(t===le){this.raise(n.StrictEvalArguments,{at:e,referenceName:e.name})}else{this.raise(n.StrictEvalArgumentsBinding,{at:e,bindingName:e.name})}}if(!i&&e.name==="let"){this.raise(n.LetInLexicalBinding,{at:e})}if(!(t&le)){this.declareNameFromIdentifier(e,t)}}declareNameFromIdentifier(e,t){this.scope.declareName(e.name,t,e.loc.start)}checkToRestConversion(e,t){switch(e.type){case"ParenthesizedExpression":this.checkToRestConversion(e.expression,t);break;case"Identifier":case"MemberExpression":break;case"ArrayExpression":case"ObjectExpression":if(t)break;default:this.raise(n.InvalidRestAssignmentPattern,{at:e})}}checkCommaAfterRest(e){if(!this.match(12)){return false}this.raise(this.lookaheadCharCode()===e?n.RestTrailingComma:n.ElementAfterRest,{at:this.state.startLoc});return true}}class ExpressionParser extends LValParser{checkProto(e,t,s,i){if(e.type==="SpreadElement"||this.isObjectMethod(e)||e.computed||e.shorthand){return}const r=e.key;const a=r.type==="Identifier"?r.name:r.value;if(a==="__proto__"){if(t){this.raise(n.RecordNoProto,{at:r});return}if(s.used){if(i){if(i.doubleProtoLoc===null){i.doubleProtoLoc=r.loc.start}}else{this.raise(n.DuplicateProto,{at:r})}}s.used=true}}shouldExitDescending(e,t){return e.type==="ArrowFunctionExpression"&&e.start===t}getExpression(){this.enterInitialScopes();this.nextToken();const e=this.parseExpression();if(!this.match(135)){this.unexpected()}this.finalizeRemainingComments();e.comments=this.state.comments;e.errors=this.state.errors;if(this.options.tokens){e.tokens=this.tokens}return e}parseExpression(e,t){if(e){return this.disallowInAnd((()=>this.parseExpressionBase(t)))}return this.allowInAnd((()=>this.parseExpressionBase(t)))}parseExpressionBase(e){const t=this.state.start;const s=this.state.startLoc;const i=this.parseMaybeAssign(e);if(this.match(12)){const r=this.startNodeAt(t,s);r.expressions=[i];while(this.eat(12)){r.expressions.push(this.parseMaybeAssign(e))}this.toReferencedList(r.expressions);return this.finishNode(r,"SequenceExpression")}return i}parseMaybeAssignDisallowIn(e,t){return this.disallowInAnd((()=>this.parseMaybeAssign(e,t)))}parseMaybeAssignAllowIn(e,t){return this.allowInAnd((()=>this.parseMaybeAssign(e,t)))}setOptionalParametersError(e,t){var s;e.optionalParametersLoc=(s=t==null?void 0:t.loc)!=null?s:this.state.startLoc}parseMaybeAssign(e,t){const s=this.state.start;const i=this.state.startLoc;if(this.isContextual(105)){if(this.prodParam.hasYield){let e=this.parseYield();if(t){e=t.call(this,e,s,i)}return e}}let r;if(e){r=false}else{e=new ExpressionErrors;r=true}const{type:a}=this.state;if(a===10||tokenIsIdentifier(a)){this.state.potentialArrowAt=this.state.start}let n=this.parseMaybeConditional(e);if(t){n=t.call(this,n,s,i)}if(tokenIsAssignment(this.state.type)){const t=this.startNodeAt(s,i);const r=this.state.value;t.operator=r;if(this.match(29)){this.toAssignable(n,true);t.left=n;if(e.doubleProtoLoc!=null&&e.doubleProtoLoc.index>=s){e.doubleProtoLoc=null}if(e.shorthandAssignLoc!=null&&e.shorthandAssignLoc.index>=s){e.shorthandAssignLoc=null}if(e.privateKeyLoc!=null&&e.privateKeyLoc.index>=s){this.checkDestructuringPrivate(e);e.privateKeyLoc=null}}else{t.left=n}this.next();t.right=this.parseMaybeAssign();this.checkLVal(n,{in:this.finishNode(t,"AssignmentExpression")});return t}else if(r){this.checkExpressionErrors(e,true)}return n}parseMaybeConditional(e){const t=this.state.start;const s=this.state.startLoc;const i=this.state.potentialArrowAt;const r=this.parseExprOps(e);if(this.shouldExitDescending(r,i)){return r}return this.parseConditional(r,t,s,e)}parseConditional(e,t,s,i){if(this.eat(17)){const i=this.startNodeAt(t,s);i.test=e;i.consequent=this.parseMaybeAssignAllowIn();this.expect(14);i.alternate=this.parseMaybeAssign();return this.finishNode(i,"ConditionalExpression")}return e}parseMaybeUnaryOrPrivate(e){return this.match(134)?this.parsePrivateName():this.parseMaybeUnary(e)}parseExprOps(e){const t=this.state.start;const s=this.state.startLoc;const i=this.state.potentialArrowAt;const r=this.parseMaybeUnaryOrPrivate(e);if(this.shouldExitDescending(r,i)){return r}return this.parseExprOp(r,t,s,-1)}parseExprOp(e,t,s,i){if(this.isPrivateName(e)){const t=this.getPrivateNameSV(e);if(i>=tokenOperatorPrecedence(58)||!this.prodParam.hasIn||!this.match(58)){this.raise(n.PrivateInExpectedIn,{at:e,identifierName:t})}this.classScope.usePrivateName(t,e.loc.start)}const r=this.state.type;if(tokenIsOperator(r)&&(this.prodParam.hasIn||!this.match(58))){let a=tokenOperatorPrecedence(r);if(a>i){if(r===39){this.expectPlugin("pipelineOperator");if(this.state.inFSharpPipelineDirectBody){return e}this.checkPipelineAtInfixOperator(e,s)}const o=this.startNodeAt(t,s);o.left=e;o.operator=this.state.value;const h=r===41||r===42;const c=r===40;if(c){a=tokenOperatorPrecedence(42)}this.next();if(r===39&&this.hasPlugin(["pipelineOperator",{proposal:"minimal"}])){if(this.state.type===96&&this.prodParam.hasAwait){throw this.raise(n.UnexpectedAwaitAfterPipelineBody,{at:this.state.startLoc})}}o.right=this.parseExprOpRightExpr(r,a);this.finishNode(o,h||c?"LogicalExpression":"BinaryExpression");const p=this.state.type;if(c&&(p===41||p===42)||h&&p===40){throw this.raise(n.MixingCoalesceWithLogical,{at:this.state.startLoc})}return this.parseExprOp(o,t,s,i)}}return e}parseExprOpRightExpr(e,t){const s=this.state.start;const i=this.state.startLoc;switch(e){case 39:switch(this.getPluginOption("pipelineOperator","proposal")){case"hack":return this.withTopicBindingContext((()=>this.parseHackPipeBody()));case"smart":return this.withTopicBindingContext((()=>{if(this.prodParam.hasYield&&this.isContextual(105)){throw this.raise(n.PipeBodyIsTighter,{at:this.state.startLoc})}return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(e,t),s,i)}));case"fsharp":return this.withSoloAwaitPermittingContext((()=>this.parseFSharpPipelineBody(t)))}default:return this.parseExprOpBaseRightExpr(e,t)}}parseExprOpBaseRightExpr(e,t){const s=this.state.start;const i=this.state.startLoc;return this.parseExprOp(this.parseMaybeUnaryOrPrivate(),s,i,tokenIsRightAssociative(e)?t-1:t)}parseHackPipeBody(){var e;const{startLoc:t}=this.state;const s=this.parseMaybeAssign();const i=r.has(s.type);if(i&&!((e=s.extra)!=null&&e.parenthesized)){this.raise(n.PipeUnparenthesizedBody,{at:t,type:s.type})}if(!this.topicReferenceWasUsedInCurrentContext()){this.raise(n.PipeTopicUnused,{at:t})}return s}checkExponentialAfterUnary(e){if(this.match(57)){this.raise(n.UnexpectedTokenUnaryExponentiation,{at:e.argument})}}parseMaybeUnary(e,t){const s=this.state.start;const i=this.state.startLoc;const r=this.isContextual(96);if(r&&this.isAwaitAllowed()){this.next();const e=this.parseAwait(s,i);if(!t)this.checkExponentialAfterUnary(e);return e}const a=this.match(34);const o=this.startNode();if(tokenIsPrefix(this.state.type)){o.operator=this.state.value;o.prefix=true;if(this.match(72)){this.expectPlugin("throwExpressions")}const s=this.match(89);this.next();o.argument=this.parseMaybeUnary(null,true);this.checkExpressionErrors(e,true);if(this.state.strict&&s){const e=o.argument;if(e.type==="Identifier"){this.raise(n.StrictDelete,{at:o})}else if(this.hasPropertyAsPrivateName(e)){this.raise(n.DeletePrivateField,{at:o})}}if(!a){if(!t)this.checkExponentialAfterUnary(o);return this.finishNode(o,"UnaryExpression")}}const h=this.parseUpdate(o,a,e);if(r){const{type:e}=this.state;const t=this.hasPlugin("v8intrinsic")?tokenCanStartExpression(e):tokenCanStartExpression(e)&&!this.match(54);if(t&&!this.isAmbiguousAwait()){this.raiseOverwrite(n.AwaitNotInAsyncContext,{at:i});return this.parseAwait(s,i)}}return h}parseUpdate(e,t,s){if(t){this.checkLVal(e.argument,{in:this.finishNode(e,"UpdateExpression")});return e}const i=this.state.start;const r=this.state.startLoc;let a=this.parseExprSubscripts(s);if(this.checkExpressionErrors(s,false))return a;while(tokenIsPostfix(this.state.type)&&!this.canInsertSemicolon()){const e=this.startNodeAt(i,r);e.operator=this.state.value;e.prefix=false;e.argument=a;this.next();this.checkLVal(a,{in:a=this.finishNode(e,"UpdateExpression")})}return a}parseExprSubscripts(e){const t=this.state.start;const s=this.state.startLoc;const i=this.state.potentialArrowAt;const r=this.parseExprAtom(e);if(this.shouldExitDescending(r,i)){return r}return this.parseSubscripts(r,t,s)}parseSubscripts(e,t,s,i){const r={optionalChainMember:false,maybeAsyncArrow:this.atPossibleAsyncArrow(e),stop:false};do{e=this.parseSubscript(e,t,s,i,r);r.maybeAsyncArrow=false}while(!r.stop);return e}parseSubscript(e,t,s,i,r){const{type:a}=this.state;if(!i&&a===15){return this.parseBind(e,t,s,i,r)}else if(tokenIsTemplate(a)){return this.parseTaggedTemplateExpression(e,t,s,r)}let n=false;if(a===18){if(i&&this.lookaheadCharCode()===40){r.stop=true;return e}r.optionalChainMember=n=true;this.next()}if(!i&&this.match(10)){return this.parseCoverCallAndAsyncArrowHead(e,t,s,r,n)}else{const i=this.eat(0);if(i||n||this.eat(16)){return this.parseMember(e,t,s,r,i,n)}else{r.stop=true;return e}}}parseMember(e,t,s,i,r,a){const o=this.startNodeAt(t,s);o.object=e;o.computed=r;if(r){o.property=this.parseExpression();this.expect(3)}else if(this.match(134)){if(e.type==="Super"){this.raise(n.SuperPrivateField,{at:s})}this.classScope.usePrivateName(this.state.value,this.state.startLoc);o.property=this.parsePrivateName()}else{o.property=this.parseIdentifier(true)}if(i.optionalChainMember){o.optional=a;return this.finishNode(o,"OptionalMemberExpression")}else{return this.finishNode(o,"MemberExpression")}}parseBind(e,t,s,i,r){const a=this.startNodeAt(t,s);a.object=e;this.next();a.callee=this.parseNoCallExpr();r.stop=true;return this.parseSubscripts(this.finishNode(a,"BindExpression"),t,s,i)}parseCoverCallAndAsyncArrowHead(e,t,s,i,r){const a=this.state.maybeInArrowParameters;let n=null;this.state.maybeInArrowParameters=true;this.next();let o=this.startNodeAt(t,s);o.callee=e;const{maybeAsyncArrow:h,optionalChainMember:c}=i;if(h){this.expressionScope.enter(newAsyncArrowScope());n=new ExpressionErrors}if(c){o.optional=r}if(r){o.arguments=this.parseCallExpressionArguments(11)}else{o.arguments=this.parseCallExpressionArguments(11,e.type==="Import",e.type!=="Super",o,n)}this.finishCallExpression(o,c);if(h&&this.shouldParseAsyncArrow()&&!r){i.stop=true;this.checkDestructuringPrivate(n);this.expressionScope.validateAsPattern();this.expressionScope.exit();o=this.parseAsyncArrowFromCallExpression(this.startNodeAt(t,s),o)}else{if(h){this.checkExpressionErrors(n,true);this.expressionScope.exit()}this.toReferencedArguments(o)}this.state.maybeInArrowParameters=a;return o}toReferencedArguments(e,t){this.toReferencedListDeep(e.arguments,t)}parseTaggedTemplateExpression(e,t,s,i){const r=this.startNodeAt(t,s);r.tag=e;r.quasi=this.parseTemplate(true);if(i.optionalChainMember){this.raise(n.OptionalChainingNoTemplate,{at:s})}return this.finishNode(r,"TaggedTemplateExpression")}atPossibleAsyncArrow(e){return e.type==="Identifier"&&e.name==="async"&&this.state.lastTokEndLoc.index===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&e.start===this.state.potentialArrowAt}finishCallExpression(e,t){if(e.callee.type==="Import"){if(e.arguments.length===2){{if(!this.hasPlugin("moduleAttributes")){this.expectPlugin("importAssertions")}}}if(e.arguments.length===0||e.arguments.length>2){this.raise(n.ImportCallArity,{at:e,maxArgumentCount:this.hasPlugin("importAssertions")||this.hasPlugin("moduleAttributes")?2:1})}else{for(const t of e.arguments){if(t.type==="SpreadElement"){this.raise(n.ImportCallSpreadArgument,{at:t})}}}}return this.finishNode(e,t?"OptionalCallExpression":"CallExpression")}parseCallExpressionArguments(e,t,s,i,r){const a=[];let o=true;const h=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=false;while(!this.eat(e)){if(o){o=false}else{this.expect(12);if(this.match(e)){if(t&&!this.hasPlugin("importAssertions")&&!this.hasPlugin("moduleAttributes")){this.raise(n.ImportCallArgumentTrailingComma,{at:this.state.lastTokStartLoc})}if(i){this.addTrailingCommaExtraToNode(i)}this.next();break}}a.push(this.parseExprListItem(false,r,s))}this.state.inFSharpPipelineDirectBody=h;return a}shouldParseAsyncArrow(){return this.match(19)&&!this.canInsertSemicolon()}parseAsyncArrowFromCallExpression(e,t){var s;this.resetPreviousNodeTrailingComments(t);this.expect(19);this.parseArrowExpression(e,t.arguments,true,(s=t.extra)==null?void 0:s.trailingCommaLoc);if(t.innerComments){setInnerComments(e,t.innerComments)}if(t.callee.trailingComments){setInnerComments(e,t.callee.trailingComments)}return e}parseNoCallExpr(){const e=this.state.start;const t=this.state.startLoc;return this.parseSubscripts(this.parseExprAtom(),e,t,true)}parseExprAtom(e){let t;const{type:s}=this.state;switch(s){case 79:return this.parseSuper();case 83:t=this.startNode();this.next();if(this.match(16)){return this.parseImportMetaProperty(t)}if(!this.match(10)){this.raise(n.UnsupportedImport,{at:this.state.lastTokStartLoc})}return this.finishNode(t,"Import");case 78:t=this.startNode();this.next();return this.finishNode(t,"ThisExpression");case 90:{return this.parseDo(this.startNode(),false)}case 56:case 31:{this.readRegexp();return this.parseRegExpLiteral(this.state.value)}case 130:return this.parseNumericLiteral(this.state.value);case 131:return this.parseBigIntLiteral(this.state.value);case 132:return this.parseDecimalLiteral(this.state.value);case 129:return this.parseStringLiteral(this.state.value);case 84:return this.parseNullLiteral();case 85:return this.parseBooleanLiteral(true);case 86:return this.parseBooleanLiteral(false);case 10:{const e=this.state.potentialArrowAt===this.state.start;return this.parseParenAndDistinguishExpression(e)}case 2:case 1:{return this.parseArrayLike(this.state.type===2?4:3,false,true)}case 0:{return this.parseArrayLike(3,true,false,e)}case 6:case 7:{return this.parseObjectLike(this.state.type===6?9:8,false,true)}case 5:{return this.parseObjectLike(8,false,false,e)}case 68:return this.parseFunctionOrFunctionSent();case 26:this.parseDecorators();case 80:t=this.startNode();this.takeDecorators(t);return this.parseClass(t,false);case 77:return this.parseNewOrNewTarget();case 25:case 24:return this.parseTemplate(false);case 15:{t=this.startNode();this.next();t.object=null;const e=t.callee=this.parseNoCallExpr();if(e.type==="MemberExpression"){return this.finishNode(t,"BindExpression")}else{throw this.raise(n.UnsupportedBind,{at:e})}}case 134:{this.raise(n.PrivateInExpectedIn,{at:this.state.startLoc,identifierName:this.state.value});return this.parsePrivateName()}case 33:{return this.parseTopicReferenceThenEqualsSign(54,"%")}case 32:{return this.parseTopicReferenceThenEqualsSign(44,"^")}case 37:case 38:{return this.parseTopicReference("hack")}case 44:case 54:case 27:{const e=this.getPluginOption("pipelineOperator","proposal");if(e){return this.parseTopicReference(e)}else{throw this.unexpected()}}case 47:{const e=this.input.codePointAt(this.nextTokenStart());if(isIdentifierStart(e)||e===62){this.expectOnePlugin(["jsx","flow","typescript"]);break}else{throw this.unexpected()}}default:if(tokenIsIdentifier(s)){if(this.isContextual(123)&&this.lookaheadCharCode()===123&&!this.hasFollowingLineBreak()){return this.parseModuleExpression()}const e=this.state.potentialArrowAt===this.state.start;const t=this.state.containsEsc;const s=this.parseIdentifier();if(!t&&s.name==="async"&&!this.canInsertSemicolon()){const{type:e}=this.state;if(e===68){this.resetPreviousNodeTrailingComments(s);this.next();return this.parseFunction(this.startNodeAtNode(s),undefined,true)}else if(tokenIsIdentifier(e)){if(this.lookaheadCharCode()===61){return this.parseAsyncArrowUnaryFunction(this.startNodeAtNode(s))}else{return s}}else if(e===90){this.resetPreviousNodeTrailingComments(s);return this.parseDo(this.startNodeAtNode(s),true)}}if(e&&this.match(19)&&!this.canInsertSemicolon()){this.next();return this.parseArrowExpression(this.startNodeAtNode(s),[s],false)}return s}else{throw this.unexpected()}}}parseTopicReferenceThenEqualsSign(e,t){const s=this.getPluginOption("pipelineOperator","proposal");if(s){this.state.type=e;this.state.value=t;this.state.pos--;this.state.end--;this.state.endLoc=createPositionWithColumnOffset(this.state.endLoc,-1);return this.parseTopicReference(s)}else{throw this.unexpected()}}parseTopicReference(e){const t=this.startNode();const s=this.state.startLoc;const i=this.state.type;this.next();return this.finishTopicReference(t,s,e,i)}finishTopicReference(e,t,s,i){if(this.testTopicReferenceConfiguration(s,t,i)){const i=s==="smart"?"PipelinePrimaryTopicReference":"TopicReference";if(!this.topicReferenceIsAllowedInCurrentContext()){this.raise(s==="smart"?n.PrimaryTopicNotAllowed:n.PipeTopicUnbound,{at:t})}this.registerTopicReference();return this.finishNode(e,i)}else{throw this.raise(n.PipeTopicUnconfiguredToken,{at:t,token:tokenLabelName(i)})}}testTopicReferenceConfiguration(e,t,s){switch(e){case"hack":{return this.hasPlugin(["pipelineOperator",{topicToken:tokenLabelName(s)}])}case"smart":return s===27;default:throw this.raise(n.PipeTopicRequiresHackPipes,{at:t})}}parseAsyncArrowUnaryFunction(e){this.prodParam.enter(functionFlags(true,this.prodParam.hasYield));const t=[this.parseIdentifier()];this.prodParam.exit();if(this.hasPrecedingLineBreak()){this.raise(n.LineTerminatorBeforeArrow,{at:this.state.curPosition()})}this.expect(19);this.parseArrowExpression(e,t,true);return e}parseDo(e,t){this.expectPlugin("doExpressions");if(t){this.expectPlugin("asyncDoExpressions")}e.async=t;this.next();const s=this.state.labels;this.state.labels=[];if(t){this.prodParam.enter(He);e.body=this.parseBlock();this.prodParam.exit()}else{e.body=this.parseBlock()}this.state.labels=s;return this.finishNode(e,"DoExpression")}parseSuper(){const e=this.startNode();this.next();if(this.match(10)&&!this.scope.allowDirectSuper&&!this.options.allowSuperOutsideMethod){this.raise(n.SuperNotAllowed,{at:e})}else if(!this.scope.allowSuper&&!this.options.allowSuperOutsideMethod){this.raise(n.UnexpectedSuper,{at:e})}if(!this.match(10)&&!this.match(0)&&!this.match(16)){this.raise(n.UnsupportedSuper,{at:e})}return this.finishNode(e,"Super")}parsePrivateName(){const e=this.startNode();const t=this.startNodeAt(this.state.start+1,new Position(this.state.curLine,this.state.start+1-this.state.lineStart,this.state.start+1));const s=this.state.value;this.next();e.id=this.createIdentifier(t,s);return this.finishNode(e,"PrivateName")}parseFunctionOrFunctionSent(){const e=this.startNode();this.next();if(this.prodParam.hasYield&&this.match(16)){const t=this.createIdentifier(this.startNodeAtNode(e),"function");this.next();if(this.match(102)){this.expectPlugin("functionSent")}else if(!this.hasPlugin("functionSent")){this.unexpected()}return this.parseMetaProperty(e,t,"sent")}return this.parseFunction(e)}parseMetaProperty(e,t,s){e.meta=t;const i=this.state.containsEsc;e.property=this.parseIdentifier(true);if(e.property.name!==s||i){this.raise(n.UnsupportedMetaProperty,{at:e.property,target:t.name,onlyValidPropertyName:s})}return this.finishNode(e,"MetaProperty")}parseImportMetaProperty(e){const t=this.createIdentifier(this.startNodeAtNode(e),"import");this.next();if(this.isContextual(100)){if(!this.inModule){this.raise(n.ImportMetaOutsideModule,{at:t})}this.sawUnambiguousESM=true}return this.parseMetaProperty(e,t,"meta")}parseLiteralAtNode(e,t,s){this.addExtra(s,"rawValue",e);this.addExtra(s,"raw",this.input.slice(s.start,this.state.end));s.value=e;this.next();return this.finishNode(s,t)}parseLiteral(e,t){const s=this.startNode();return this.parseLiteralAtNode(e,t,s)}parseStringLiteral(e){return this.parseLiteral(e,"StringLiteral")}parseNumericLiteral(e){return this.parseLiteral(e,"NumericLiteral")}parseBigIntLiteral(e){return this.parseLiteral(e,"BigIntLiteral")}parseDecimalLiteral(e){return this.parseLiteral(e,"DecimalLiteral")}parseRegExpLiteral(e){const t=this.parseLiteral(e.value,"RegExpLiteral");t.pattern=e.pattern;t.flags=e.flags;return t}parseBooleanLiteral(e){const t=this.startNode();t.value=e;this.next();return this.finishNode(t,"BooleanLiteral")}parseNullLiteral(){const e=this.startNode();this.next();return this.finishNode(e,"NullLiteral")}parseParenAndDistinguishExpression(e){const t=this.state.start;const s=this.state.startLoc;let i;this.next();this.expressionScope.enter(newArrowHeadScope());const r=this.state.maybeInArrowParameters;const a=this.state.inFSharpPipelineDirectBody;this.state.maybeInArrowParameters=true;this.state.inFSharpPipelineDirectBody=false;const n=this.state.start;const o=this.state.startLoc;const h=[];const c=new ExpressionErrors;let p=true;let l;let u;while(!this.match(11)){if(p){p=false}else{this.expect(12,c.optionalParametersLoc===null?null:c.optionalParametersLoc);if(this.match(11)){u=this.state.startLoc;break}}if(this.match(21)){const e=this.state.start;const t=this.state.startLoc;l=this.state.startLoc;h.push(this.parseParenItem(this.parseRestBinding(),e,t));if(!this.checkCommaAfterRest(41)){break}}else{h.push(this.parseMaybeAssignAllowIn(c,this.parseParenItem))}}const d=this.state.lastTokEndLoc;this.expect(11);this.state.maybeInArrowParameters=r;this.state.inFSharpPipelineDirectBody=a;let f=this.startNodeAt(t,s);if(e&&this.shouldParseArrow(h)&&(f=this.parseArrow(f))){this.checkDestructuringPrivate(c);this.expressionScope.validateAsPattern();this.expressionScope.exit();this.parseArrowExpression(f,h,false);return f}this.expressionScope.exit();if(!h.length){this.unexpected(this.state.lastTokStartLoc)}if(u)this.unexpected(u);if(l)this.unexpected(l);this.checkExpressionErrors(c,true);this.toReferencedListDeep(h,true);if(h.length>1){i=this.startNodeAt(n,o);i.expressions=h;this.finishNode(i,"SequenceExpression");this.resetEndLocation(i,d)}else{i=h[0]}return this.wrapParenthesis(t,s,i)}wrapParenthesis(e,t,s){if(!this.options.createParenthesizedExpressions){this.addExtra(s,"parenthesized",true);this.addExtra(s,"parenStart",e);this.takeSurroundingComments(s,e,this.state.lastTokEndLoc.index);return s}const i=this.startNodeAt(e,t);i.expression=s;this.finishNode(i,"ParenthesizedExpression");return i}shouldParseArrow(e){return!this.canInsertSemicolon()}parseArrow(e){if(this.eat(19)){return e}}parseParenItem(e,t,s){return e}parseNewOrNewTarget(){const e=this.startNode();this.next();if(this.match(16)){const t=this.createIdentifier(this.startNodeAtNode(e),"new");this.next();const s=this.parseMetaProperty(e,t,"target");if(!this.scope.inNonArrowFunction&&!this.scope.inClass){this.raise(n.UnexpectedNewTarget,{at:s})}return s}return this.parseNew(e)}parseNew(e){this.parseNewCallee(e);if(this.eat(10)){const t=this.parseExprList(11);this.toReferencedList(t);e.arguments=t}else{e.arguments=[]}return this.finishNode(e,"NewExpression")}parseNewCallee(e){e.callee=this.parseNoCallExpr();if(e.callee.type==="Import"){this.raise(n.ImportCallNotNewExpression,{at:e.callee})}else if(this.isOptionalChain(e.callee)){this.raise(n.OptionalChainingNoNew,{at:this.state.lastTokEndLoc})}else if(this.eat(18)){this.raise(n.OptionalChainingNoNew,{at:this.state.startLoc})}}parseTemplateElement(e){const{start:t,startLoc:s,end:i,value:r}=this.state;const a=t+1;const o=this.startNodeAt(a,createPositionWithColumnOffset(s,1));if(r===null){if(!e){this.raise(n.InvalidEscapeSequenceTemplate,{at:createPositionWithColumnOffset(s,2)})}}const h=this.match(24);const c=h?-1:-2;const p=i+c;o.value={raw:this.input.slice(a,p).replace(/\r\n?/g,"\n"),cooked:r===null?null:r.slice(1,c)};o.tail=h;this.next();this.finishNode(o,"TemplateElement");this.resetEndLocation(o,createPositionWithColumnOffset(this.state.lastTokEndLoc,c));return o}parseTemplate(e){const t=this.startNode();t.expressions=[];let s=this.parseTemplateElement(e);t.quasis=[s];while(!s.tail){t.expressions.push(this.parseTemplateSubstitution());this.readTemplateContinuation();t.quasis.push(s=this.parseTemplateElement(e))}return this.finishNode(t,"TemplateLiteral")}parseTemplateSubstitution(){return this.parseExpression()}parseObjectLike(e,t,s,i){if(s){this.expectPlugin("recordAndTuple")}const r=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=false;const a=Object.create(null);let o=true;const h=this.startNode();h.properties=[];this.next();while(!this.match(e)){if(o){o=false}else{this.expect(12);if(this.match(e)){this.addTrailingCommaExtraToNode(h);break}}let r;if(t){r=this.parseBindingProperty()}else{r=this.parsePropertyDefinition(i);this.checkProto(r,s,a,i)}if(s&&!this.isObjectProperty(r)&&r.type!=="SpreadElement"){this.raise(n.InvalidRecordProperty,{at:r})}if(r.shorthand){this.addExtra(r,"shorthand",true)}h.properties.push(r)}this.next();this.state.inFSharpPipelineDirectBody=r;let c="ObjectExpression";if(t){c="ObjectPattern"}else if(s){c="RecordExpression"}return this.finishNode(h,c)}addTrailingCommaExtraToNode(e){this.addExtra(e,"trailingComma",this.state.lastTokStart);this.addExtra(e,"trailingCommaLoc",this.state.lastTokStartLoc,false)}maybeAsyncOrAccessorProp(e){return!e.computed&&e.key.type==="Identifier"&&(this.isLiteralPropertyName()||this.match(0)||this.match(55))}parsePropertyDefinition(e){let t=[];if(this.match(26)){if(this.hasPlugin("decorators")){this.raise(n.UnsupportedPropertyDecorator,{at:this.state.startLoc})}while(this.match(26)){t.push(this.parseDecorator())}}const s=this.startNode();let i=false;let r=false;let a;let o;if(this.match(21)){if(t.length)this.unexpected();return this.parseSpread()}if(t.length){s.decorators=t;t=[]}s.method=false;if(e){a=this.state.start;o=this.state.startLoc}let h=this.eat(55);this.parsePropertyNamePrefixOperator(s);const c=this.state.containsEsc;const p=this.parsePropertyName(s,e);if(!h&&!c&&this.maybeAsyncOrAccessorProp(s)){const e=p.name;if(e==="async"&&!this.hasPrecedingLineBreak()){i=true;this.resetPreviousNodeTrailingComments(p);h=this.eat(55);this.parsePropertyName(s)}if(e==="get"||e==="set"){r=true;this.resetPreviousNodeTrailingComments(p);s.kind=e;if(this.match(55)){h=true;this.raise(n.AccessorIsGenerator,{at:this.state.curPosition(),kind:e});this.next()}this.parsePropertyName(s)}}this.parseObjPropValue(s,a,o,h,i,false,r,e);return s}getGetterSetterExpectedParamCount(e){return e.kind==="get"?0:1}getObjectOrClassMethodParams(e){return e.params}checkGetterSetterParams(e){var t;const s=this.getGetterSetterExpectedParamCount(e);const i=this.getObjectOrClassMethodParams(e);if(i.length!==s){this.raise(e.kind==="get"?n.BadGetterArity:n.BadSetterArity,{at:e})}if(e.kind==="set"&&((t=i[i.length-1])==null?void 0:t.type)==="RestElement"){this.raise(n.BadSetterRestParameter,{at:e})}}parseObjectMethod(e,t,s,i,r){if(r){this.parseMethod(e,t,false,false,false,"ObjectMethod");this.checkGetterSetterParams(e);return e}if(s||t||this.match(10)){if(i)this.unexpected();e.kind="method";e.method=true;return this.parseMethod(e,t,s,false,false,"ObjectMethod")}}parseObjectProperty(e,t,s,i,r){e.shorthand=false;if(this.eat(14)){e.value=i?this.parseMaybeDefault(this.state.start,this.state.startLoc):this.parseMaybeAssignAllowIn(r);return this.finishNode(e,"ObjectProperty")}if(!e.computed&&e.key.type==="Identifier"){this.checkReservedWord(e.key.name,e.key.loc.start,true,false);if(i){e.value=this.parseMaybeDefault(t,s,cloneIdentifier(e.key))}else if(this.match(29)){const i=this.state.startLoc;if(r!=null){if(r.shorthandAssignLoc===null){r.shorthandAssignLoc=i}}else{this.raise(n.InvalidCoverInitializedName,{at:i})}e.value=this.parseMaybeDefault(t,s,cloneIdentifier(e.key))}else{e.value=cloneIdentifier(e.key)}e.shorthand=true;return this.finishNode(e,"ObjectProperty")}}parseObjPropValue(e,t,s,i,r,a,n,o){const h=this.parseObjectMethod(e,i,r,a,n)||this.parseObjectProperty(e,t,s,a,o);if(!h)this.unexpected();return h}parsePropertyName(e,t){if(this.eat(0)){e.computed=true;e.key=this.parseMaybeAssignAllowIn();this.expect(3)}else{const{type:s,value:i}=this.state;let r;if(tokenIsKeywordOrIdentifier(s)){r=this.parseIdentifier(true)}else{switch(s){case 130:r=this.parseNumericLiteral(i);break;case 129:r=this.parseStringLiteral(i);break;case 131:r=this.parseBigIntLiteral(i);break;case 132:r=this.parseDecimalLiteral(i);break;case 134:{const e=this.state.startLoc;if(t!=null){if(t.privateKeyLoc===null){t.privateKeyLoc=e}}else{this.raise(n.UnexpectedPrivateField,{at:e})}r=this.parsePrivateName();break}default:throw this.unexpected()}}e.key=r;if(s!==134){e.computed=false}}return e.key}initFunction(e,t){e.id=null;e.generator=false;e.async=!!t}parseMethod(e,t,s,i,r,a,n=false){this.initFunction(e,s);e.generator=!!t;const o=i;this.scope.enter(R|_|(n?H:0)|(r?K:0));this.prodParam.enter(functionFlags(s,e.generator));this.parseFunctionParams(e,o);this.parseFunctionBodyAndFinish(e,a,true);this.prodParam.exit();this.scope.exit();return e}parseArrayLike(e,t,s,i){if(s){this.expectPlugin("recordAndTuple")}const r=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=false;const a=this.startNode();this.next();a.elements=this.parseExprList(e,!s,i,a);this.state.inFSharpPipelineDirectBody=r;return this.finishNode(a,s?"TupleExpression":"ArrayExpression")}parseArrowExpression(e,t,s,i){this.scope.enter(R|j);let r=functionFlags(s,false);if(!this.match(5)&&this.prodParam.hasIn){r|=Ve}this.prodParam.enter(r);this.initFunction(e,s);const a=this.state.maybeInArrowParameters;if(t){this.state.maybeInArrowParameters=true;this.setArrowFunctionParameters(e,t,i)}this.state.maybeInArrowParameters=false;this.parseFunctionBody(e,true);this.prodParam.exit();this.scope.exit();this.state.maybeInArrowParameters=a;return this.finishNode(e,"ArrowFunctionExpression")}setArrowFunctionParameters(e,t,s){this.toAssignableList(t,s,false);e.params=t}parseFunctionBodyAndFinish(e,t,s=false){this.parseFunctionBody(e,false,s);this.finishNode(e,t)}parseFunctionBody(e,t,s=false){const i=t&&!this.match(5);this.expressionScope.enter(newExpressionScope());if(i){e.body=this.parseMaybeAssign();this.checkParams(e,false,t,false)}else{const i=this.state.strict;const r=this.state.labels;this.state.labels=[];this.prodParam.enter(this.prodParam.currentFlags()|ze);e.body=this.parseBlock(true,false,(r=>{const a=!this.isSimpleParamList(e.params);if(r&&a){this.raise(n.IllegalLanguageModeDirective,{at:(e.kind==="method"||e.kind==="constructor")&&!!e.key?e.key.loc.end:e})}const o=!i&&this.state.strict;this.checkParams(e,!this.state.strict&&!t&&!s&&!a,t,o);if(this.state.strict&&e.id){this.checkIdentifier(e.id,ue,o)}}));this.prodParam.exit();this.state.labels=r}this.expressionScope.exit()}isSimpleParameter(e){return e.type==="Identifier"}isSimpleParamList(e){for(let t=0,s=e.length;t<s;t++){if(!this.isSimpleParameter(e[t]))return false}return true}checkParams(e,t,s,i=true){const r=!t&&new Set;const a={type:"FormalParameters"};for(const t of e.params){this.checkLVal(t,{in:a,binding:ae,checkClashes:r,strictModeChanged:i})}}parseExprList(e,t,s,i){const r=[];let a=true;while(!this.eat(e)){if(a){a=false}else{this.expect(12);if(this.match(e)){if(i){this.addTrailingCommaExtraToNode(i)}this.next();break}}r.push(this.parseExprListItem(t,s))}return r}parseExprListItem(e,t,s){let i;if(this.match(12)){if(!e){this.raise(n.UnexpectedToken,{at:this.state.curPosition(),unexpected:","})}i=null}else if(this.match(21)){const e=this.state.start;const s=this.state.startLoc;i=this.parseParenItem(this.parseSpread(t),e,s)}else if(this.match(17)){this.expectPlugin("partialApplication");if(!s){this.raise(n.UnexpectedArgumentPlaceholder,{at:this.state.startLoc})}const e=this.startNode();this.next();i=this.finishNode(e,"ArgumentPlaceholder")}else{i=this.parseMaybeAssignAllowIn(t,this.parseParenItem)}return i}parseIdentifier(e){const t=this.startNode();const s=this.parseIdentifierName(t.start,e);return this.createIdentifier(t,s)}createIdentifier(e,t){e.name=t;e.loc.identifierName=t;return this.finishNode(e,"Identifier")}parseIdentifierName(e,t){let s;const{startLoc:i,type:r}=this.state;if(tokenIsKeywordOrIdentifier(r)){s=this.state.value}else{throw this.unexpected()}const a=tokenKeywordOrIdentifierIsKeyword(r);if(t){if(a){this.replaceToken(128)}}else{this.checkReservedWord(s,i,a,false)}this.next();return s}checkReservedWord(e,t,s,i){if(e.length>10){return}if(!canBeReservedWord(e)){return}if(e==="yield"){if(this.prodParam.hasYield){this.raise(n.YieldBindingIdentifier,{at:t});return}}else if(e==="await"){if(this.prodParam.hasAwait){this.raise(n.AwaitBindingIdentifier,{at:t});return}if(this.scope.inStaticBlock){this.raise(n.AwaitBindingIdentifierInStaticBlock,{at:t});return}this.expressionScope.recordAsyncArrowParametersError({at:t})}else if(e==="arguments"){if(this.scope.inClassAndNotInNonArrowFunction){this.raise(n.ArgumentsInClass,{at:t});return}}if(s&&isKeyword(e)){this.raise(n.UnexpectedKeyword,{at:t,keyword:e});return}const r=!this.state.strict?isReservedWord:i?isStrictBindReservedWord:isStrictReservedWord;if(r(e,this.inModule)){this.raise(n.UnexpectedReservedWord,{at:t,reservedWord:e})}}isAwaitAllowed(){if(this.prodParam.hasAwait)return true;if(this.options.allowAwaitOutsideFunction&&!this.scope.inFunction){return true}return false}parseAwait(e,t){const s=this.startNodeAt(e,t);this.expressionScope.recordParameterInitializerError(n.AwaitExpressionFormalParameter,{at:s});if(this.eat(55)){this.raise(n.ObsoleteAwaitStar,{at:s})}if(!this.scope.inFunction&&!this.options.allowAwaitOutsideFunction){if(this.isAmbiguousAwait()){this.ambiguousScriptDifferentAst=true}else{this.sawUnambiguousESM=true}}if(!this.state.soloAwait){s.argument=this.parseMaybeUnary(null,true)}return this.finishNode(s,"AwaitExpression")}isAmbiguousAwait(){if(this.hasPrecedingLineBreak())return true;const{type:e}=this.state;return e===53||e===10||e===0||tokenIsTemplate(e)||e===133||e===56||this.hasPlugin("v8intrinsic")&&e===54}parseYield(){const e=this.startNode();this.expressionScope.recordParameterInitializerError(n.YieldInParameter,{at:e});this.next();let t=false;let s=null;if(!this.hasPrecedingLineBreak()){t=this.eat(55);switch(this.state.type){case 13:case 135:case 8:case 11:case 3:case 9:case 14:case 12:if(!t)break;default:s=this.parseMaybeAssign()}}e.delegate=t;e.argument=s;return this.finishNode(e,"YieldExpression")}checkPipelineAtInfixOperator(e,t){if(this.hasPlugin(["pipelineOperator",{proposal:"smart"}])){if(e.type==="SequenceExpression"){this.raise(n.PipelineHeadSequenceExpression,{at:t})}}}parseSmartPipelineBodyInStyle(e,t,s){const i=this.startNodeAt(t,s);if(this.isSimpleReference(e)){i.callee=e;return this.finishNode(i,"PipelineBareFunction")}else{this.checkSmartPipeTopicBodyEarlyErrors(s);i.expression=e;return this.finishNode(i,"PipelineTopicExpression")}}isSimpleReference(e){switch(e.type){case"MemberExpression":return!e.computed&&this.isSimpleReference(e.object);case"Identifier":return true;default:return false}}checkSmartPipeTopicBodyEarlyErrors(e){if(this.match(19)){throw this.raise(n.PipelineBodyNoArrow,{at:this.state.startLoc})}if(!this.topicReferenceWasUsedInCurrentContext()){this.raise(n.PipelineTopicUnused,{at:e})}}withTopicBindingContext(e){const t=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:1,maxTopicIndex:null};try{return e()}finally{this.state.topicContext=t}}withSmartMixTopicForbiddingContext(e){if(this.hasPlugin(["pipelineOperator",{proposal:"smart"}])){const t=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:0,maxTopicIndex:null};try{return e()}finally{this.state.topicContext=t}}else{return e()}}withSoloAwaitPermittingContext(e){const t=this.state.soloAwait;this.state.soloAwait=true;try{return e()}finally{this.state.soloAwait=t}}allowInAnd(e){const t=this.prodParam.currentFlags();const s=Ve&~t;if(s){this.prodParam.enter(t|Ve);try{return e()}finally{this.prodParam.exit()}}return e()}disallowInAnd(e){const t=this.prodParam.currentFlags();const s=Ve&t;if(s){this.prodParam.enter(t&~Ve);try{return e()}finally{this.prodParam.exit()}}return e()}registerTopicReference(){this.state.topicContext.maxTopicIndex=0}topicReferenceIsAllowedInCurrentContext(){return this.state.topicContext.maxNumOfResolvableTopics>=1}topicReferenceWasUsedInCurrentContext(){return this.state.topicContext.maxTopicIndex!=null&&this.state.topicContext.maxTopicIndex>=0}parseFSharpPipelineBody(e){const t=this.state.start;const s=this.state.startLoc;this.state.potentialArrowAt=this.state.start;const i=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=true;const r=this.parseExprOp(this.parseMaybeUnaryOrPrivate(),t,s,e);this.state.inFSharpPipelineDirectBody=i;return r}parseModuleExpression(){this.expectPlugin("moduleBlocks");const e=this.startNode();this.next();this.eat(5);const t=this.initializeScopes(true);this.enterInitialScopes();const s=this.startNode();try{e.body=this.parseProgram(s,8,"module")}finally{t()}this.eat(8);return this.finishNode(e,"ModuleExpression")}parsePropertyNamePrefixOperator(e){}}const nt={kind:"loop"},ot={kind:"switch"};const ht=0,ct=1,pt=2,lt=4;const ut=/[\uD800-\uDFFF]/u;const dt=/in(?:stanceof)?/y;function babel7CompatTokens(e,t){for(let s=0;s<e.length;s++){const i=e[s];const{type:r}=i;if(typeof r==="number"){{if(r===134){const{loc:t,start:r,value:a,end:n}=i;const o=r+1;const h=createPositionWithColumnOffset(t.start,1);e.splice(s,1,new Token({type:getExportedToken(27),value:"#",start:r,end:o,startLoc:t.start,endLoc:h}),new Token({type:getExportedToken(128),value:a,start:o,end:n,startLoc:h,endLoc:t.end}));s++;continue}if(tokenIsTemplate(r)){const{loc:a,start:n,value:o,end:h}=i;const c=n+1;const p=createPositionWithColumnOffset(a.start,1);let l;if(t.charCodeAt(n)===96){l=new Token({type:getExportedToken(22),value:"`",start:n,end:c,startLoc:a.start,endLoc:p})}else{l=new Token({type:getExportedToken(8),value:"}",start:n,end:c,startLoc:a.start,endLoc:p})}let u,d,f,m;if(r===24){d=h-1;f=createPositionWithColumnOffset(a.end,-1);u=o===null?null:o.slice(1,-1);m=new Token({type:getExportedToken(22),value:"`",start:d,end:h,startLoc:f,endLoc:a.end})}else{d=h-2;f=createPositionWithColumnOffset(a.end,-2);u=o===null?null:o.slice(1,-2);m=new Token({type:getExportedToken(23),value:"${",start:d,end:h,startLoc:f,endLoc:a.end})}e.splice(s,1,l,new Token({type:getExportedToken(20),value:u,start:c,end:d,startLoc:p,endLoc:f}),m);s+=2;continue}}i.type=getExportedToken(r)}}return e}class StatementParser extends ExpressionParser{parseTopLevel(e,t){e.program=this.parseProgram(t);e.comments=this.state.comments;if(this.options.tokens){e.tokens=babel7CompatTokens(this.tokens,this.input)}return this.finishNode(e,"File")}parseProgram(e,t=135,s=this.options.sourceType){e.sourceType=s;e.interpreter=this.parseInterpreterDirective();this.parseBlockBody(e,true,true,t);if(this.inModule&&!this.options.allowUndeclaredExports&&this.scope.undefinedExports.size>0){for(const[e,t]of Array.from(this.scope.undefinedExports)){this.raise(n.ModuleExportUndefined,{at:t,localName:e})}}return this.finishNode(e,"Program")}stmtToDirective(e){const t=e;t.type="Directive";t.value=t.expression;delete t.expression;const s=t.value;const i=s.value;const r=this.input.slice(s.start,s.end);const a=s.value=r.slice(1,-1);this.addExtra(s,"raw",r);this.addExtra(s,"rawValue",a);this.addExtra(s,"expressionValue",i);s.type="DirectiveLiteral";return t}parseInterpreterDirective(){if(!this.match(28)){return null}const e=this.startNode();e.value=this.state.value;this.next();return this.finishNode(e,"InterpreterDirective")}isLet(e){if(!this.isContextual(99)){return false}return this.isLetKeyword(e)}isLetKeyword(e){const t=this.nextTokenStart();const s=this.codePointAtPos(t);if(s===92||s===91){return true}if(e)return false;if(s===123)return true;if(isIdentifierStart(s)){dt.lastIndex=t;if(dt.test(this.input)){const e=this.codePointAtPos(dt.lastIndex);if(!isIdentifierChar(e)&&e!==92){return false}}return true}return false}parseStatement(e,t){if(this.match(26)){this.parseDecorators(true)}return this.parseStatementContent(e,t)}parseStatementContent(e,t){let s=this.state.type;const i=this.startNode();let r;if(this.isLet(e)){s=74;r="let"}switch(s){case 60:return this.parseBreakContinueStatement(i,true);case 63:return this.parseBreakContinueStatement(i,false);case 64:return this.parseDebuggerStatement(i);case 90:return this.parseDoStatement(i);case 91:return this.parseForStatement(i);case 68:if(this.lookaheadCharCode()===46)break;if(e){if(this.state.strict){this.raise(n.StrictFunction,{at:this.state.startLoc})}else if(e!=="if"&&e!=="label"){this.raise(n.SloppyFunction,{at:this.state.startLoc})}}return this.parseFunctionStatement(i,false,!e);case 80:if(e)this.unexpected();return this.parseClass(i,true);case 69:return this.parseIfStatement(i);case 70:return this.parseReturnStatement(i);case 71:return this.parseSwitchStatement(i);case 72:return this.parseThrowStatement(i);case 73:return this.parseTryStatement(i);case 75:case 74:r=r||this.state.value;if(e&&r!=="var"){this.raise(n.UnexpectedLexicalDeclaration,{at:this.state.startLoc})}return this.parseVarStatement(i,r);case 92:return this.parseWhileStatement(i);case 76:return this.parseWithStatement(i);case 5:return this.parseBlock();case 13:return this.parseEmptyStatement(i);case 83:{const e=this.lookaheadCharCode();if(e===40||e===46){break}}case 82:{if(!this.options.allowImportExportEverywhere&&!t){this.raise(n.UnexpectedImportExport,{at:this.state.startLoc})}this.next();let e;if(s===83){e=this.parseImport(i);if(e.type==="ImportDeclaration"&&(!e.importKind||e.importKind==="value")){this.sawUnambiguousESM=true}}else{e=this.parseExport(i);if(e.type==="ExportNamedDeclaration"&&(!e.exportKind||e.exportKind==="value")||e.type==="ExportAllDeclaration"&&(!e.exportKind||e.exportKind==="value")||e.type==="ExportDefaultDeclaration"){this.sawUnambiguousESM=true}}this.assertModuleNodeAllowed(i);return e}default:{if(this.isAsyncFunction()){if(e){this.raise(n.AsyncFunctionInSingleStatementContext,{at:this.state.startLoc})}this.next();return this.parseFunctionStatement(i,true,!e)}}}const a=this.state.value;const o=this.parseExpression();if(tokenIsIdentifier(s)&&o.type==="Identifier"&&this.eat(14)){return this.parseLabeledStatement(i,a,o,e)}else{return this.parseExpressionStatement(i,o)}}assertModuleNodeAllowed(e){if(!this.options.allowImportExportEverywhere&&!this.inModule){this.raise(n.ImportOutsideModule,{at:e})}}takeDecorators(e){const t=this.state.decoratorStack[this.state.decoratorStack.length-1];if(t.length){e.decorators=t;this.resetStartLocationFromNode(e,t[0]);this.state.decoratorStack[this.state.decoratorStack.length-1]=[]}}canHaveLeadingDecorator(){return this.match(80)}parseDecorators(e){const t=this.state.decoratorStack[this.state.decoratorStack.length-1];while(this.match(26)){const e=this.parseDecorator();t.push(e)}if(this.match(82)){if(!e){this.unexpected()}if(this.hasPlugin("decorators")&&!this.getPluginOption("decorators","decoratorsBeforeExport")){this.raise(n.DecoratorExportClass,{at:this.state.startLoc})}}else if(!this.canHaveLeadingDecorator()){throw this.raise(n.UnexpectedLeadingDecorator,{at:this.state.startLoc})}}parseDecorator(){this.expectOnePlugin(["decorators-legacy","decorators"]);const e=this.startNode();this.next();if(this.hasPlugin("decorators")){this.state.decoratorStack.push([]);const t=this.state.start;const s=this.state.startLoc;let i;if(this.match(10)){const e=this.state.start;const t=this.state.startLoc;this.next();i=this.parseExpression();this.expect(11);i=this.wrapParenthesis(e,t,i)}else{i=this.parseIdentifier(false);while(this.eat(16)){const e=this.startNodeAt(t,s);e.object=i;e.property=this.parseIdentifier(true);e.computed=false;i=this.finishNode(e,"MemberExpression")}}e.expression=this.parseMaybeDecoratorArguments(i);this.state.decoratorStack.pop()}else{e.expression=this.parseExprSubscripts()}return this.finishNode(e,"Decorator")}parseMaybeDecoratorArguments(e){if(this.eat(10)){const t=this.startNodeAtNode(e);t.callee=e;t.arguments=this.parseCallExpressionArguments(11,false);this.toReferencedList(t.arguments);return this.finishNode(t,"CallExpression")}return e}parseBreakContinueStatement(e,t){this.next();if(this.isLineTerminator()){e.label=null}else{e.label=this.parseIdentifier();this.semicolon()}this.verifyBreakContinue(e,t);return this.finishNode(e,t?"BreakStatement":"ContinueStatement")}verifyBreakContinue(e,t){let s;for(s=0;s<this.state.labels.length;++s){const i=this.state.labels[s];if(e.label==null||i.name===e.label.name){if(i.kind!=null&&(t||i.kind==="loop"))break;if(e.label&&t)break}}if(s===this.state.labels.length){const s=t?"BreakStatement":"ContinueStatement";this.raise(n.IllegalBreakContinue,{at:e,type:s})}}parseDebuggerStatement(e){this.next();this.semicolon();return this.finishNode(e,"DebuggerStatement")}parseHeaderExpression(){this.expect(10);const e=this.parseExpression();this.expect(11);return e}parseDoStatement(e){this.next();this.state.labels.push(nt);e.body=this.withSmartMixTopicForbiddingContext((()=>this.parseStatement("do")));this.state.labels.pop();this.expect(92);e.test=this.parseHeaderExpression();this.eat(13);return this.finishNode(e,"DoWhileStatement")}parseForStatement(e){this.next();this.state.labels.push(nt);let t=null;if(this.isAwaitAllowed()&&this.eatContextual(96)){t=this.state.lastTokStartLoc}this.scope.enter(F);this.expect(10);if(this.match(13)){if(t!==null){this.unexpected(t)}return this.parseFor(e,null)}const s=this.isContextual(99);const i=s&&this.isLetKeyword();if(this.match(74)||this.match(75)||i){const s=this.startNode();const r=i?"let":this.state.value;this.next();this.parseVar(s,true,r);this.finishNode(s,"VariableDeclaration");if((this.match(58)||this.isContextual(101))&&s.declarations.length===1){return this.parseForIn(e,s,t)}if(t!==null){this.unexpected(t)}return this.parseFor(e,s)}const r=this.isContextual(95);const a=new ExpressionErrors;const o=this.parseExpression(true,a);const h=this.isContextual(101);if(h){if(s){this.raise(n.ForOfLet,{at:o})}if(t===null&&r&&o.type==="Identifier"){this.raise(n.ForOfAsync,{at:o})}}if(h||this.match(58)){this.checkDestructuringPrivate(a);this.toAssignable(o,true);const s=h?"ForOfStatement":"ForInStatement";this.checkLVal(o,{in:{type:s}});return this.parseForIn(e,o,t)}else{this.checkExpressionErrors(a,true)}if(t!==null){this.unexpected(t)}return this.parseFor(e,o)}parseFunctionStatement(e,t,s){this.next();return this.parseFunction(e,ct|(s?0:pt),t)}parseIfStatement(e){this.next();e.test=this.parseHeaderExpression();e.consequent=this.parseStatement("if");e.alternate=this.eat(66)?this.parseStatement("if"):null;return this.finishNode(e,"IfStatement")}parseReturnStatement(e){if(!this.prodParam.hasReturn&&!this.options.allowReturnOutsideFunction){this.raise(n.IllegalReturn,{at:this.state.startLoc})}this.next();if(this.isLineTerminator()){e.argument=null}else{e.argument=this.parseExpression();this.semicolon()}return this.finishNode(e,"ReturnStatement")}parseSwitchStatement(e){this.next();e.discriminant=this.parseHeaderExpression();const t=e.cases=[];this.expect(5);this.state.labels.push(ot);this.scope.enter(F);let s;for(let e;!this.match(8);){if(this.match(61)||this.match(65)){const i=this.match(61);if(s)this.finishNode(s,"SwitchCase");t.push(s=this.startNode());s.consequent=[];this.next();if(i){s.test=this.parseExpression()}else{if(e){this.raise(n.MultipleDefaultsInSwitch,{at:this.state.lastTokStartLoc})}e=true;s.test=null}this.expect(14)}else{if(s){s.consequent.push(this.parseStatement(null))}else{this.unexpected()}}}this.scope.exit();if(s)this.finishNode(s,"SwitchCase");this.next();this.state.labels.pop();return this.finishNode(e,"SwitchStatement")}parseThrowStatement(e){this.next();if(this.hasPrecedingLineBreak()){this.raise(n.NewlineAfterThrow,{at:this.state.lastTokEndLoc})}e.argument=this.parseExpression();this.semicolon();return this.finishNode(e,"ThrowStatement")}parseCatchClauseParam(){const e=this.parseBindingAtom();const t=e.type==="Identifier";this.scope.enter(t?U:0);this.checkLVal(e,{in:{type:"CatchClause"},binding:re,allowingSloppyLetBinding:true});return e}parseTryStatement(e){this.next();e.block=this.parseBlock();e.handler=null;if(this.match(62)){const t=this.startNode();this.next();if(this.match(10)){this.expect(10);t.param=this.parseCatchClauseParam();this.expect(11)}else{t.param=null;this.scope.enter(F)}t.body=this.withSmartMixTopicForbiddingContext((()=>this.parseBlock(false,false)));this.scope.exit();e.handler=this.finishNode(t,"CatchClause")}e.finalizer=this.eat(67)?this.parseBlock():null;if(!e.handler&&!e.finalizer){this.raise(n.NoCatchOrFinally,{at:e})}return this.finishNode(e,"TryStatement")}parseVarStatement(e,t,s=false){this.next();this.parseVar(e,false,t,s);this.semicolon();return this.finishNode(e,"VariableDeclaration")}parseWhileStatement(e){this.next();e.test=this.parseHeaderExpression();this.state.labels.push(nt);e.body=this.withSmartMixTopicForbiddingContext((()=>this.parseStatement("while")));this.state.labels.pop();return this.finishNode(e,"WhileStatement")}parseWithStatement(e){if(this.state.strict){this.raise(n.StrictWith,{at:this.state.startLoc})}this.next();e.object=this.parseHeaderExpression();e.body=this.withSmartMixTopicForbiddingContext((()=>this.parseStatement("with")));return this.finishNode(e,"WithStatement")}parseEmptyStatement(e){this.next();return this.finishNode(e,"EmptyStatement")}parseLabeledStatement(e,t,s,i){for(const e of this.state.labels){if(e.name===t){this.raise(n.LabelRedeclaration,{at:s,labelName:t})}}const r=tokenIsLoop(this.state.type)?"loop":this.match(71)?"switch":null;for(let t=this.state.labels.length-1;t>=0;t--){const s=this.state.labels[t];if(s.statementStart===e.start){s.statementStart=this.state.start;s.kind=r}else{break}}this.state.labels.push({name:t,kind:r,statementStart:this.state.start});e.body=this.parseStatement(i?i.indexOf("label")===-1?i+"label":i:"label");this.state.labels.pop();e.label=s;return this.finishNode(e,"LabeledStatement")}parseExpressionStatement(e,t){e.expression=t;this.semicolon();return this.finishNode(e,"ExpressionStatement")}parseBlock(e=false,t=true,s){const i=this.startNode();if(e){this.state.strictErrors.clear()}this.expect(5);if(t){this.scope.enter(F)}this.parseBlockBody(i,e,false,8,s);if(t){this.scope.exit()}return this.finishNode(i,"BlockStatement")}isValidDirective(e){return e.type==="ExpressionStatement"&&e.expression.type==="StringLiteral"&&!e.expression.extra.parenthesized}parseBlockBody(e,t,s,i,r){const a=e.body=[];const n=e.directives=[];this.parseBlockOrModuleBlockBody(a,t?n:undefined,s,i,r)}parseBlockOrModuleBlockBody(e,t,s,i,r){const a=this.state.strict;let n=false;let o=false;while(!this.match(i)){const i=this.parseStatement(null,s);if(t&&!o){if(this.isValidDirective(i)){const e=this.stmtToDirective(i);t.push(e);if(!n&&e.value.value==="use strict"){n=true;this.setStrict(true)}continue}o=true;this.state.strictErrors.clear()}e.push(i)}if(r){r.call(this,n)}if(!a){this.setStrict(false)}this.next()}parseFor(e,t){e.init=t;this.semicolon(false);e.test=this.match(13)?null:this.parseExpression();this.semicolon(false);e.update=this.match(11)?null:this.parseExpression();this.expect(11);e.body=this.withSmartMixTopicForbiddingContext((()=>this.parseStatement("for")));this.scope.exit();this.state.labels.pop();return this.finishNode(e,"ForStatement")}parseForIn(e,t,s){const i=this.match(58);this.next();if(i){if(s!==null)this.unexpected(s)}else{e.await=s!==null}if(t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!i||this.state.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")){this.raise(n.ForInOfLoopInitializer,{at:t,type:i?"ForInStatement":"ForOfStatement"})}if(t.type==="AssignmentPattern"){this.raise(n.InvalidLhs,{at:t,ancestor:{type:"ForStatement"}})}e.left=t;e.right=i?this.parseExpression():this.parseMaybeAssignAllowIn();this.expect(11);e.body=this.withSmartMixTopicForbiddingContext((()=>this.parseStatement("for")));this.scope.exit();this.state.labels.pop();return this.finishNode(e,i?"ForInStatement":"ForOfStatement")}parseVar(e,t,s,i=false){const r=e.declarations=[];e.kind=s;for(;;){const e=this.startNode();this.parseVarId(e,s);e.init=!this.eat(29)?null:t?this.parseMaybeAssignDisallowIn():this.parseMaybeAssignAllowIn();if(e.init===null&&!i){if(e.id.type!=="Identifier"&&!(t&&(this.match(58)||this.isContextual(101)))){this.raise(n.DeclarationMissingInitializer,{at:this.state.lastTokEndLoc,kind:"destructuring"})}else if(s==="const"&&!(this.match(58)||this.isContextual(101))){this.raise(n.DeclarationMissingInitializer,{at:this.state.lastTokEndLoc,kind:"const"})}}r.push(this.finishNode(e,"VariableDeclarator"));if(!this.eat(12))break}return e}parseVarId(e,t){e.id=this.parseBindingAtom();this.checkLVal(e.id,{in:{type:"VariableDeclarator"},binding:t==="var"?ae:re})}parseFunction(e,t=ht,s=false){const i=t&ct;const r=t&pt;const a=!!i&&!(t<);this.initFunction(e,s);if(this.match(55)&&r){this.raise(n.GeneratorInSingleStatementContext,{at:this.state.startLoc})}e.generator=this.eat(55);if(i){e.id=this.parseFunctionId(a)}const o=this.state.maybeInArrowParameters;this.state.maybeInArrowParameters=false;this.scope.enter(R);this.prodParam.enter(functionFlags(s,e.generator));if(!i){e.id=this.parseFunctionId()}this.parseFunctionParams(e,false);this.withSmartMixTopicForbiddingContext((()=>{this.parseFunctionBodyAndFinish(e,i?"FunctionDeclaration":"FunctionExpression")}));this.prodParam.exit();this.scope.exit();if(i&&!r){this.registerFunctionStatementId(e)}this.state.maybeInArrowParameters=o;return e}parseFunctionId(e){return e||tokenIsIdentifier(this.state.type)?this.parseIdentifier():null}parseFunctionParams(e,t){this.expect(10);this.expressionScope.enter(newParameterDeclarationScope());e.params=this.parseBindingList(11,41,false,t);this.expressionScope.exit()}registerFunctionStatementId(e){if(!e.id)return;this.scope.declareName(e.id.name,this.state.strict||e.generator||e.async?this.scope.treatFunctionsAsVar?ae:re:ne,e.id.loc.start)}parseClass(e,t,s){this.next();this.takeDecorators(e);const i=this.state.strict;this.state.strict=true;this.parseClassId(e,t,s);this.parseClassSuper(e);e.body=this.parseClassBody(!!e.superClass,i);return this.finishNode(e,t?"ClassDeclaration":"ClassExpression")}isClassProperty(){return this.match(29)||this.match(13)||this.match(8)}isClassMethod(){return this.match(10)}isNonstaticConstructor(e){return!e.computed&&!e.static&&(e.key.name==="constructor"||e.key.value==="constructor")}parseClassBody(e,t){this.classScope.enter();const s={hadConstructor:false,hadSuperClass:e};let i=[];const r=this.startNode();r.body=[];this.expect(5);this.withSmartMixTopicForbiddingContext((()=>{while(!this.match(8)){if(this.eat(13)){if(i.length>0){throw this.raise(n.DecoratorSemicolon,{at:this.state.lastTokEndLoc})}continue}if(this.match(26)){i.push(this.parseDecorator());continue}const e=this.startNode();if(i.length){e.decorators=i;this.resetStartLocationFromNode(e,i[0]);i=[]}this.parseClassMember(r,e,s);if(e.kind==="constructor"&&e.decorators&&e.decorators.length>0){this.raise(n.DecoratorConstructor,{at:e})}}}));this.state.strict=t;this.next();if(i.length){throw this.raise(n.TrailingDecorator,{at:this.state.startLoc})}this.classScope.exit();return this.finishNode(r,"ClassBody")}parseClassMemberFromModifier(e,t){const s=this.parseIdentifier(true);if(this.isClassMethod()){const i=t;i.kind="method";i.computed=false;i.key=s;i.static=false;this.pushClassMethod(e,i,false,false,false,false);return true}else if(this.isClassProperty()){const i=t;i.computed=false;i.key=s;i.static=false;e.body.push(this.parseClassProperty(i));return true}this.resetPreviousNodeTrailingComments(s);return false}parseClassMember(e,t,s){const i=this.isContextual(104);if(i){if(this.parseClassMemberFromModifier(e,t)){return}if(this.eat(5)){this.parseClassStaticBlock(e,t);return}}this.parseClassMemberWithIsStatic(e,t,s,i)}parseClassMemberWithIsStatic(e,t,s,i){const r=t;const a=t;const o=t;const h=t;const c=t;const p=r;const l=r;t.static=i;this.parsePropertyNamePrefixOperator(t);if(this.eat(55)){p.kind="method";const t=this.match(134);this.parseClassElementName(p);if(t){this.pushClassPrivateMethod(e,a,true,false);return}if(this.isNonstaticConstructor(r)){this.raise(n.ConstructorIsGenerator,{at:r.key})}this.pushClassMethod(e,r,true,false,false,false);return}const u=tokenIsIdentifier(this.state.type)&&!this.state.containsEsc;const d=this.match(134);const f=this.parseClassElementName(t);const m=this.state.startLoc;this.parsePostMemberNameModifiers(l);if(this.isClassMethod()){p.kind="method";if(d){this.pushClassPrivateMethod(e,a,false,false);return}const i=this.isNonstaticConstructor(r);let o=false;if(i){r.kind="constructor";if(s.hadConstructor&&!this.hasPlugin("typescript")){this.raise(n.DuplicateConstructor,{at:f})}if(i&&this.hasPlugin("typescript")&&t.override){this.raise(n.OverrideOnConstructor,{at:f})}s.hadConstructor=true;o=s.hadSuperClass}this.pushClassMethod(e,r,false,false,i,o)}else if(this.isClassProperty()){if(d){this.pushClassPrivateProperty(e,h)}else{this.pushClassProperty(e,o)}}else if(u&&f.name==="async"&&!this.isLineTerminator()){this.resetPreviousNodeTrailingComments(f);const t=this.eat(55);if(l.optional){this.unexpected(m)}p.kind="method";const s=this.match(134);this.parseClassElementName(p);this.parsePostMemberNameModifiers(l);if(s){this.pushClassPrivateMethod(e,a,t,true)}else{if(this.isNonstaticConstructor(r)){this.raise(n.ConstructorIsAsync,{at:r.key})}this.pushClassMethod(e,r,t,true,false,false)}}else if(u&&(f.name==="get"||f.name==="set")&&!(this.match(55)&&this.isLineTerminator())){this.resetPreviousNodeTrailingComments(f);p.kind=f.name;const t=this.match(134);this.parseClassElementName(r);if(t){this.pushClassPrivateMethod(e,a,false,false)}else{if(this.isNonstaticConstructor(r)){this.raise(n.ConstructorIsAccessor,{at:r.key})}this.pushClassMethod(e,r,false,false,false,false)}this.checkGetterSetterParams(r)}else if(u&&f.name==="accessor"&&!this.isLineTerminator()){this.expectPlugin("decoratorAutoAccessors");this.resetPreviousNodeTrailingComments(f);const t=this.match(134);this.parseClassElementName(o);this.pushClassAccessorProperty(e,c,t)}else if(this.isLineTerminator()){if(d){this.pushClassPrivateProperty(e,h)}else{this.pushClassProperty(e,o)}}else{this.unexpected()}}parseClassElementName(e){const{type:t,value:s}=this.state;if((t===128||t===129)&&e.static&&s==="prototype"){this.raise(n.StaticPrototype,{at:this.state.startLoc})}if(t===134){if(s==="constructor"){this.raise(n.ConstructorClassPrivateField,{at:this.state.startLoc})}const t=this.parsePrivateName();e.key=t;return t}return this.parsePropertyName(e)}parseClassStaticBlock(e,t){var s;this.scope.enter(H|z|_);const i=this.state.labels;this.state.labels=[];this.prodParam.enter(_e);const r=t.body=[];this.parseBlockOrModuleBlockBody(r,undefined,false,8);this.prodParam.exit();this.scope.exit();this.state.labels=i;e.body.push(this.finishNode(t,"StaticBlock"));if((s=t.decorators)!=null&&s.length){this.raise(n.DecoratorStaticBlock,{at:t})}}pushClassProperty(e,t){if(!t.computed&&(t.key.name==="constructor"||t.key.value==="constructor")){this.raise(n.ConstructorClassField,{at:t.key})}e.body.push(this.parseClassProperty(t))}pushClassPrivateProperty(e,t){const s=this.parseClassPrivateProperty(t);e.body.push(s);this.classScope.declarePrivateName(this.getPrivateNameSV(s.key),Ee,s.key.loc.start)}pushClassAccessorProperty(e,t,s){if(!s&&!t.computed){const e=t.key;if(e.name==="constructor"||e.value==="constructor"){this.raise(n.ConstructorClassField,{at:e})}}const i=this.parseClassAccessorProperty(t);e.body.push(i);if(s){this.classScope.declarePrivateName(this.getPrivateNameSV(i.key),Ee,i.key.loc.start)}}pushClassMethod(e,t,s,i,r,a){e.body.push(this.parseMethod(t,s,i,r,a,"ClassMethod",true))}pushClassPrivateMethod(e,t,s,i){const r=this.parseMethod(t,s,i,false,false,"ClassPrivateMethod",true);e.body.push(r);const a=r.kind==="get"?r.static?Te:we:r.kind==="set"?r.static?be:Ae:Ee;this.declareClassPrivateMethodInScope(r,a)}declareClassPrivateMethodInScope(e,t){this.classScope.declarePrivateName(this.getPrivateNameSV(e.key),t,e.key.loc.start)}parsePostMemberNameModifiers(e){}parseClassPrivateProperty(e){this.parseInitializer(e);this.semicolon();return this.finishNode(e,"ClassPrivateProperty")}parseClassProperty(e){this.parseInitializer(e);this.semicolon();return this.finishNode(e,"ClassProperty")}parseClassAccessorProperty(e){this.parseInitializer(e);this.semicolon();return this.finishNode(e,"ClassAccessorProperty")}parseInitializer(e){this.scope.enter(H|_);this.expressionScope.enter(newExpressionScope());this.prodParam.enter(_e);e.value=this.eat(29)?this.parseMaybeAssignAllowIn():null;this.expressionScope.exit();this.prodParam.exit();this.scope.exit()}parseClassId(e,t,s,i=ie){if(tokenIsIdentifier(this.state.type)){e.id=this.parseIdentifier();if(t){this.declareNameFromIdentifier(e.id,i)}}else{if(s||!t){e.id=null}else{throw this.raise(n.MissingClassName,{at:this.state.startLoc})}}}parseClassSuper(e){e.superClass=this.eat(81)?this.parseExprSubscripts():null}parseExport(e){const t=this.maybeParseExportDefaultSpecifier(e);const s=!t||this.eat(12);const i=s&&this.eatExportStar(e);const r=i&&this.maybeParseExportNamespaceSpecifier(e);const a=s&&(!r||this.eat(12));const n=t||i;if(i&&!r){if(t)this.unexpected();this.parseExportFrom(e,true);return this.finishNode(e,"ExportAllDeclaration")}const o=this.maybeParseExportNamedSpecifiers(e);if(t&&s&&!i&&!o||r&&a&&!o){throw this.unexpected(null,5)}let h;if(n||o){h=false;this.parseExportFrom(e,n)}else{h=this.maybeParseExportDeclaration(e)}if(n||o||h){this.checkExport(e,true,false,!!e.source);return this.finishNode(e,"ExportNamedDeclaration")}if(this.eat(65)){e.declaration=this.parseExportDefaultExpression();this.checkExport(e,true,true);return this.finishNode(e,"ExportDefaultDeclaration")}throw this.unexpected(null,5)}eatExportStar(e){return this.eat(55)}maybeParseExportDefaultSpecifier(e){if(this.isExportDefaultSpecifier()){this.expectPlugin("exportDefaultFrom");const t=this.startNode();t.exported=this.parseIdentifier(true);e.specifiers=[this.finishNode(t,"ExportDefaultSpecifier")];return true}return false}maybeParseExportNamespaceSpecifier(e){if(this.isContextual(93)){if(!e.specifiers)e.specifiers=[];const t=this.startNodeAt(this.state.lastTokStart,this.state.lastTokStartLoc);this.next();t.exported=this.parseModuleExportName();e.specifiers.push(this.finishNode(t,"ExportNamespaceSpecifier"));return true}return false}maybeParseExportNamedSpecifiers(e){if(this.match(5)){if(!e.specifiers)e.specifiers=[];const t=e.exportKind==="type";e.specifiers.push(...this.parseExportSpecifiers(t));e.source=null;e.declaration=null;if(this.hasPlugin("importAssertions")){e.assertions=[]}return true}return false}maybeParseExportDeclaration(e){if(this.shouldParseExportDeclaration()){e.specifiers=[];e.source=null;if(this.hasPlugin("importAssertions")){e.assertions=[]}e.declaration=this.parseExportDeclaration(e);return true}return false}isAsyncFunction(){if(!this.isContextual(95))return false;const e=this.nextTokenStart();return!Se.test(this.input.slice(this.state.pos,e))&&this.isUnparsedContextual(e,"function")}parseExportDefaultExpression(){const e=this.startNode();const t=this.isAsyncFunction();if(this.match(68)||t){this.next();if(t){this.next()}return this.parseFunction(e,ct|lt,t)}if(this.match(80)){return this.parseClass(e,true,true)}if(this.match(26)){if(this.hasPlugin("decorators")&&this.getPluginOption("decorators","decoratorsBeforeExport")){this.raise(n.DecoratorBeforeExport,{at:this.state.startLoc})}this.parseDecorators(false);return this.parseClass(e,true,true)}if(this.match(75)||this.match(74)||this.isLet()){throw this.raise(n.UnsupportedDefaultExport,{at:this.state.startLoc})}const s=this.parseMaybeAssignAllowIn();this.semicolon();return s}parseExportDeclaration(e){return this.parseStatement(null)}isExportDefaultSpecifier(){const{type:e}=this.state;if(tokenIsIdentifier(e)){if(e===95&&!this.state.containsEsc||e===99){return false}if((e===126||e===125)&&!this.state.containsEsc){const{type:e}=this.lookahead();if(tokenIsIdentifier(e)&&e!==97||e===5){this.expectOnePlugin(["flow","typescript"]);return false}}}else if(!this.match(65)){return false}const t=this.nextTokenStart();const s=this.isUnparsedContextual(t,"from");if(this.input.charCodeAt(t)===44||tokenIsIdentifier(this.state.type)&&s){return true}if(this.match(65)&&s){const e=this.input.charCodeAt(this.nextTokenStartSince(t+4));return e===34||e===39}return false}parseExportFrom(e,t){if(this.eatContextual(97)){e.source=this.parseImportSource();this.checkExport(e);const t=this.maybeParseImportAssertions();if(t){e.assertions=t}}else if(t){this.unexpected()}this.semicolon()}shouldParseExportDeclaration(){const{type:e}=this.state;if(e===26){this.expectOnePlugin(["decorators","decorators-legacy"]);if(this.hasPlugin("decorators")){if(this.getPluginOption("decorators","decoratorsBeforeExport")){throw this.raise(n.DecoratorBeforeExport,{at:this.state.startLoc})}return true}}return e===74||e===75||e===68||e===80||this.isLet()||this.isAsyncFunction()}checkExport(e,t,s,i){if(t){if(s){this.checkDuplicateExports(e,"default");if(this.hasPlugin("exportDefaultFrom")){var r;const t=e.declaration;if(t.type==="Identifier"&&t.name==="from"&&t.end-t.start===4&&!((r=t.extra)!=null&&r.parenthesized)){this.raise(n.ExportDefaultFromAsIdentifier,{at:t})}}}else if(e.specifiers&&e.specifiers.length){for(const t of e.specifiers){const{exported:e}=t;const s=e.type==="Identifier"?e.name:e.value;this.checkDuplicateExports(t,s);if(!i&&t.local){const{local:e}=t;if(e.type!=="Identifier"){this.raise(n.ExportBindingIsString,{at:t,localName:e.value,exportName:s})}else{this.checkReservedWord(e.name,e.loc.start,true,false);this.scope.checkLocalExport(e)}}}}else if(e.declaration){if(e.declaration.type==="FunctionDeclaration"||e.declaration.type==="ClassDeclaration"){const t=e.declaration.id;if(!t)throw new Error("Assertion failure");this.checkDuplicateExports(e,t.name)}else if(e.declaration.type==="VariableDeclaration"){for(const t of e.declaration.declarations){this.checkDeclaration(t.id)}}}}const a=this.state.decoratorStack[this.state.decoratorStack.length-1];if(a.length){throw this.raise(n.UnsupportedDecoratorExport,{at:e})}}checkDeclaration(e){if(e.type==="Identifier"){this.checkDuplicateExports(e,e.name)}else if(e.type==="ObjectPattern"){for(const t of e.properties){this.checkDeclaration(t)}}else if(e.type==="ArrayPattern"){for(const t of e.elements){if(t){this.checkDeclaration(t)}}}else if(e.type==="ObjectProperty"){this.checkDeclaration(e.value)}else if(e.type==="RestElement"){this.checkDeclaration(e.argument)}else if(e.type==="AssignmentPattern"){this.checkDeclaration(e.left)}}checkDuplicateExports(e,t){if(this.exportedIdentifiers.has(t)){if(t==="default"){this.raise(n.DuplicateDefaultExport,{at:e})}else{this.raise(n.DuplicateExport,{at:e,exportName:t})}}this.exportedIdentifiers.add(t)}parseExportSpecifiers(e){const t=[];let s=true;this.expect(5);while(!this.eat(8)){if(s){s=false}else{this.expect(12);if(this.eat(8))break}const i=this.isContextual(126);const r=this.match(129);const a=this.startNode();a.local=this.parseModuleExportName();t.push(this.parseExportSpecifier(a,r,e,i))}return t}parseExportSpecifier(e,t,s,i){if(this.eatContextual(93)){e.exported=this.parseModuleExportName()}else if(t){e.exported=cloneStringLiteral(e.local)}else if(!e.exported){e.exported=cloneIdentifier(e.local)}return this.finishNode(e,"ExportSpecifier")}parseModuleExportName(){if(this.match(129)){const e=this.parseStringLiteral(this.state.value);const t=e.value.match(ut);if(t){this.raise(n.ModuleExportNameHasLoneSurrogate,{at:e,surrogateCharCode:t[0].charCodeAt(0)})}return e}return this.parseIdentifier(true)}parseImport(e){e.specifiers=[];if(!this.match(129)){const t=this.maybeParseDefaultImportSpecifier(e);const s=!t||this.eat(12);const i=s&&this.maybeParseStarImportSpecifier(e);if(s&&!i)this.parseNamedImportSpecifiers(e);this.expectContextual(97)}e.source=this.parseImportSource();const t=this.maybeParseImportAssertions();if(t){e.assertions=t}else{const t=this.maybeParseModuleAttributes();if(t){e.attributes=t}}this.semicolon();return this.finishNode(e,"ImportDeclaration")}parseImportSource(){if(!this.match(129))this.unexpected();return this.parseExprAtom()}shouldParseDefaultImport(e){return tokenIsIdentifier(this.state.type)}parseImportSpecifierLocal(e,t,s){t.local=this.parseIdentifier();e.specifiers.push(this.finishImportSpecifier(t,s))}finishImportSpecifier(e,t){this.checkLVal(e.local,{in:e,binding:re});return this.finishNode(e,t)}parseAssertEntries(){const e=[];const t=new Set;do{if(this.match(8)){break}const s=this.startNode();const i=this.state.value;if(t.has(i)){this.raise(n.ModuleAttributesWithDuplicateKeys,{at:this.state.startLoc,key:i})}t.add(i);if(this.match(129)){s.key=this.parseStringLiteral(i)}else{s.key=this.parseIdentifier(true)}this.expect(14);if(!this.match(129)){throw this.raise(n.ModuleAttributeInvalidValue,{at:this.state.startLoc})}s.value=this.parseStringLiteral(this.state.value);this.finishNode(s,"ImportAttribute");e.push(s)}while(this.eat(12));return e}maybeParseModuleAttributes(){if(this.match(76)&&!this.hasPrecedingLineBreak()){this.expectPlugin("moduleAttributes");this.next()}else{if(this.hasPlugin("moduleAttributes"))return[];return null}const e=[];const t=new Set;do{const s=this.startNode();s.key=this.parseIdentifier(true);if(s.key.name!=="type"){this.raise(n.ModuleAttributeDifferentFromType,{at:s.key})}if(t.has(s.key.name)){this.raise(n.ModuleAttributesWithDuplicateKeys,{at:s.key,key:s.key.name})}t.add(s.key.name);this.expect(14);if(!this.match(129)){throw this.raise(n.ModuleAttributeInvalidValue,{at:this.state.startLoc})}s.value=this.parseStringLiteral(this.state.value);this.finishNode(s,"ImportAttribute");e.push(s)}while(this.eat(12));return e}maybeParseImportAssertions(){if(this.isContextual(94)&&!this.hasPrecedingLineBreak()){this.expectPlugin("importAssertions");this.next()}else{if(this.hasPlugin("importAssertions"))return[];return null}this.eat(5);const e=this.parseAssertEntries();this.eat(8);return e}maybeParseDefaultImportSpecifier(e){if(this.shouldParseDefaultImport(e)){this.parseImportSpecifierLocal(e,this.startNode(),"ImportDefaultSpecifier");return true}return false}maybeParseStarImportSpecifier(e){if(this.match(55)){const t=this.startNode();this.next();this.expectContextual(93);this.parseImportSpecifierLocal(e,t,"ImportNamespaceSpecifier");return true}return false}parseNamedImportSpecifiers(e){let t=true;this.expect(5);while(!this.eat(8)){if(t){t=false}else{if(this.eat(14)){throw this.raise(n.DestructureNamedImport,{at:this.state.startLoc})}this.expect(12);if(this.eat(8))break}const s=this.startNode();const i=this.match(129);const r=this.isContextual(126);s.imported=this.parseModuleExportName();const a=this.parseImportSpecifier(s,i,e.importKind==="type"||e.importKind==="typeof",r);e.specifiers.push(a)}}parseImportSpecifier(e,t,s,i){if(this.eatContextual(93)){e.local=this.parseIdentifier()}else{const{imported:s}=e;if(t){throw this.raise(n.ImportBindingIsString,{at:e,importName:s.value})}this.checkReservedWord(s.name,e.loc.start,true,true);if(!e.local){e.local=cloneIdentifier(s)}}return this.finishImportSpecifier(e,"ImportSpecifier")}isThisParam(e){return e.type==="Identifier"&&e.name==="this"}}class Parser extends StatementParser{constructor(e,t){e=getOptions(e);super(e,t);this.options=e;this.initializeScopes();this.plugins=pluginsMap(this.options.plugins);this.filename=e.sourceFilename}getScopeHandler(){return ScopeHandler}parse(){this.enterInitialScopes();const e=this.startNode();const t=this.startNode();this.nextToken();e.errors=null;this.parseTopLevel(e,t);e.errors=this.state.errors;return e}}function pluginsMap(e){const t=new Map;for(const s of e){const[e,i]=Array.isArray(s)?s:[s,{}];if(!t.has(e))t.set(e,i||{})}return t}function parse(e,t){var s;if(((s=t)==null?void 0:s.sourceType)==="unambiguous"){t=Object.assign({},t);try{t.sourceType="module";const s=getParser(t,e);const i=s.parse();if(s.sawUnambiguousESM){return i}if(s.ambiguousScriptDifferentAst){try{t.sourceType="script";return getParser(t,e).parse()}catch(e){}}else{i.program.sourceType="script"}return i}catch(s){try{t.sourceType="script";return getParser(t,e).parse()}catch(e){}throw s}}else{return getParser(t,e).parse()}}function parseExpression(e,t){const s=getParser(t,e);if(s.options.strictMode){s.state.strict=true}return s.getExpression()}function generateExportedTokenTypes(e){const t={};for(const s of Object.keys(e)){t[s]=getExportedToken(e[s])}return t}const ft=generateExportedTokenTypes(A);function getParser(e,t){let s=Parser;if(e!=null&&e.plugins){validatePlugins(e.plugins);s=getParserClass(e.plugins)}return new s(e,t)}const mt={};function getParserClass(e){const t=rt.filter((t=>hasPlugin(e,t)));const s=t.join("/");let i=mt[s];if(!i){i=Parser;for(const e of t){i=it[e](i)}mt[s]=i}return i}t.parse=parse;t.parseExpression=parseExpression;t.tokTypes=ft})();module.exports=e})();
|