@tachybase/module-cloud-component 1.3.17 → 1.3.18
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/dist/client/cloud-library-manager/CloudLibraryManager.schema.d.ts +5 -4
- package/dist/client/index.js +314 -314
- package/dist/externalVersion.js +8 -8
- package/dist/node_modules/@babel/core/lib/index.js +23 -23
- package/dist/node_modules/@babel/core/node_modules/.bin/parser +4 -4
- package/dist/node_modules/@babel/core/package.json +1 -1
- package/dist/node_modules/@babel/parser/lib/index.js +1 -1
- package/dist/node_modules/@babel/parser/package.json +1 -1
- package/dist/node_modules/@babel/parser/typings/babel-parser.d.ts +7 -3
- package/dist/node_modules/@babel/preset-env/lib/available-plugins.js +4 -0
- package/dist/node_modules/@babel/preset-env/lib/index.js +54 -35
- package/dist/node_modules/@babel/preset-env/package.json +1 -1
- package/dist/node_modules/@babel/preset-react/lib/index.js +24 -24
- package/dist/node_modules/@babel/preset-react/package.json +1 -1
- package/dist/node_modules/@babel/preset-typescript/lib/index.js +23 -23
- package/dist/node_modules/@babel/preset-typescript/package.json +1 -1
- package/dist/node_modules/@babel/traverse/lib/index.js +3 -3
- package/dist/node_modules/@babel/traverse/node_modules/.bin/parser +4 -4
- package/dist/node_modules/@babel/traverse/package.json +1 -1
- package/dist/node_modules/@hapi/topo/package.json +1 -1
- package/package.json +13 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var e={};!function(){var t=e;Object.defineProperty(t,"__esModule",{value:true});function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var s={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;s[i]=e[i]}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="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED";var i={ImportMetaOutsideModule:{message:`import.meta may appear only with 'sourceType: "module"'`,code:s},ImportOutsideModule:{message:`'import' and 'export' may appear only with 'sourceType: "module"'`,code:s}};const r={ArrayPattern:"array destructuring pattern",AssignmentExpression:"assignment expression",AssignmentPattern:"assignment expression",ArrowFunctionExpression:"arrow function expression",ConditionalExpression:"conditional expression",CatchClause:"catch clause",ForOfStatement:"for-of statement",ForInStatement:"for-in statement",ForStatement:"for-loop",FormalParameters:"function parameter list",Identifier:"identifier",ImportSpecifier:"import specifier",ImportDefaultSpecifier:"import default specifier",ImportNamespaceSpecifier:"import namespace specifier",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=e=>e.type==="UpdateExpression"?r.UpdateExpression[`${e.prefix}`]:r[e.type];var a={AccessorIsGenerator:({kind:e})=>`A ${e}ter cannot be a generator.`,ArgumentsInClass:"'arguments' is only allowed in functions and class methods.",AsyncFunctionInSingleStatementContext:"Async functions can only be declared at the top level or inside a block.",AwaitBindingIdentifier:"Can not use 'await' as identifier inside an async function.",AwaitBindingIdentifierInStaticBlock:"Can not use 'await' as identifier inside a static block.",AwaitExpressionFormalParameter:"'await' is not allowed in async function parameters.",AwaitUsingNotInAsyncContext:"'await using' is only allowed within async functions and at the top levels of modules.",AwaitNotInAsyncContext:"'await' is only allowed within async functions and at the top levels of modules.",BadGetterArity:"A 'get' accessor must not have any formal parameters.",BadSetterArity:"A 'set' accessor must have exactly one formal parameter.",BadSetterRestParameter:"A 'set' accessor function argument must not be a rest parameter.",ConstructorClassField:"Classes may not have a field named 'constructor'.",ConstructorClassPrivateField:"Classes may not have a private field named '#constructor'.",ConstructorIsAccessor:"Class constructor may not be an accessor.",ConstructorIsAsync:"Constructor can't be an async function.",ConstructorIsGenerator:"Constructor can't be a generator.",DeclarationMissingInitializer:({kind:e})=>`Missing initializer in ${e} declaration.`,DecoratorArgumentsOutsideParentheses:"Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",DecoratorBeforeExport:"Decorators must be placed *before* the 'export' keyword. Remove the 'decoratorsBeforeExport: true' option to use the 'export @decorator class {}' syntax.",DecoratorsBeforeAfterExport:"Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",DecoratorConstructor:"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",DecoratorExportClass:"Decorators must be placed *after* the 'export' keyword. Remove the 'decoratorsBeforeExport: false' option to use the '@decorator export class {}' syntax.",DecoratorSemicolon:"Decorators must not be followed by a semicolon.",DecoratorStaticBlock:"Decorators can't be used with a static block.",DeferImportRequiresNamespace:'Only `import defer * as x from "./module"` is valid.',DeletePrivateField:"Deleting a private field is not allowed.",DestructureNamedImport:"ES2015 named imports do not destructure. Use another statement for destructuring after the import.",DuplicateConstructor:"Duplicate constructor in the same class.",DuplicateDefaultExport:"Only one default export allowed per module.",DuplicateExport:({exportName:e})=>`\`${e}\` has already been exported. Exported identifiers must be unique.`,DuplicateProto:"Redefinition of __proto__ property.",DuplicateRegExpFlags:"Duplicate regular expression flag.",ElementAfterRest:"Rest element must be last element.",EscapedCharNotAnIdentifier:"Invalid Unicode escape.",ExportBindingIsString:({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:"'from' is not allowed as an identifier after 'export default'.",ForInOfLoopInitializer:({type:e})=>`'${e==="ForInStatement"?"for-in":"for-of"}' loop variable declaration may not have an initializer.`,ForInUsing:"For-in loop may not start with 'using' declaration.",ForOfAsync:"The left-hand side of a for-of loop may not be 'async'.",ForOfLet:"The left-hand side of a for-of loop may not start with 'let'.",GeneratorInSingleStatementContext:"Generators can only be declared at the top level or inside a block.",IllegalBreakContinue:({type:e})=>`Unsyntactic ${e==="BreakStatement"?"break":"continue"}.`,IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list.",IllegalReturn:"'return' outside of function.",ImportAttributesUseAssert:"The `assert` keyword in import attributes is deprecated and it has been replaced by the `with` keyword. You can enable the `deprecatedImportAssert` parser plugin to suppress this error.",ImportBindingIsString:({importName:e})=>`A string literal cannot be used as an imported binding.\n- Did you mean \`import { "${e}" as foo }\`?`,ImportCallArity:`\`import()\` requires exactly one or two arguments.`,ImportCallNotNewExpression:"Cannot use new with import(...).",ImportCallSpreadArgument:"`...` is not allowed in `import()`.",ImportJSONBindingNotDefault:"A JSON module can only be imported with `default`.",ImportReflectionHasAssertion:"`import module x` cannot have assertions.",ImportReflectionNotBinding:'Only `import module x from "./module"` is valid.',IncompatibleRegExpUVFlags:"The 'u' and 'v' regular expression flags cannot be enabled at the same time.",InvalidBigIntLiteral:"Invalid BigIntLiteral.",InvalidCodePoint:"Code point out of bounds.",InvalidCoverInitializedName:"Invalid shorthand property initializer.",InvalidDecimal:"Invalid decimal.",InvalidDigit:({radix:e})=>`Expected number in radix ${e}.`,InvalidEscapeSequence:"Bad character escape sequence.",InvalidEscapeSequenceTemplate:"Invalid escape sequence in template.",InvalidEscapedReservedWord:({reservedWord:e})=>`Escape sequence in keyword ${e}.`,InvalidIdentifier:({identifierName:e})=>`Invalid identifier ${e}.`,InvalidLhs:({ancestor:e})=>`Invalid left-hand side in ${toNodeDescription(e)}.`,InvalidLhsBinding:({ancestor:e})=>`Binding invalid left-hand side in ${toNodeDescription(e)}.`,InvalidLhsOptionalChaining:({ancestor:e})=>`Invalid optional chaining in the left-hand side of ${toNodeDescription(e)}.`,InvalidNumber:"Invalid number.",InvalidOrMissingExponent:"Floating-point numbers require a valid exponent after the 'e'.",InvalidOrUnexpectedToken:({unexpected:e})=>`Unexpected character '${e}'.`,InvalidParenthesizedAssignment:"Invalid parenthesized assignment pattern.",InvalidPrivateFieldResolution:({identifierName:e})=>`Private name #${e} is not defined.`,InvalidPropertyBindingPattern:"Binding member expression.",InvalidRecordProperty:"Only properties and spread elements are allowed in record definitions.",InvalidRestAssignmentPattern:"Invalid rest operator's argument.",LabelRedeclaration:({labelName:e})=>`Label '${e}' is already declared.`,LetInLexicalBinding:"'let' is disallowed as a lexically bound name.",LineTerminatorBeforeArrow:"No line break is allowed before '=>'.",MalformedRegExpFlags:"Invalid regular expression flag.",MissingClassName:"A class name is required.",MissingEqInAssignment:"Only '=' operator can be used for specifying default value.",MissingSemicolon:"Missing semicolon.",MissingPlugin:({missingPlugin:e})=>`This experimental syntax requires enabling the parser plugin: ${e.map((e=>JSON.stringify(e))).join(", ")}.`,MissingOneOfPlugins:({missingPlugin:e})=>`This experimental syntax requires enabling one of the following parser plugin(s): ${e.map((e=>JSON.stringify(e))).join(", ")}.`,MissingUnicodeEscape:"Expecting Unicode escape sequence \\uXXXX.",MixingCoalesceWithLogical:"Nullish coalescing operator(??) requires parens when mixing with logical operators.",ModuleAttributeDifferentFromType:"The only accepted module attribute is `type`.",ModuleAttributeInvalidValue:"Only string literals are allowed as module attribute values.",ModuleAttributesWithDuplicateKeys:({key:e})=>`Duplicate key "${e}" is not allowed in module attributes.`,ModuleExportNameHasLoneSurrogate:({surrogateCharCode:e})=>`An export name cannot include a lone surrogate, found '\\u${e.toString(16)}'.`,ModuleExportUndefined:({localName:e})=>`Export '${e}' is not defined.`,MultipleDefaultsInSwitch:"Multiple default clauses.",NewlineAfterThrow:"Illegal newline after throw.",NoCatchOrFinally:"Missing catch or finally clause.",NumberIdentifier:"Identifier directly after number.",NumericSeparatorInEscapeSequence:"Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",ObsoleteAwaitStar:"'await*' has been removed from the async functions proposal. Use Promise.all() instead.",OptionalChainingNoNew:"Constructors in/after an Optional Chain are not allowed.",OptionalChainingNoTemplate:"Tagged Template Literals are not allowed in optionalChain.",OverrideOnConstructor:"'override' modifier cannot appear on a constructor declaration.",ParamDupe:"Argument name clash.",PatternHasAccessor:"Object pattern can't contain getter or setter.",PatternHasMethod:"Object pattern can't contain methods.",PrivateInExpectedIn:({identifierName:e})=>`Private names are only allowed in property accesses (\`obj.#${e}\`) or in \`in\` expressions (\`#${e} in obj\`).`,PrivateNameRedeclaration:({identifierName:e})=>`Duplicate private name #${e}.`,RecordExpressionBarIncorrectEndSyntaxType:"Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionBarIncorrectStartSyntaxType:"Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionHashIncorrectStartSyntaxType:"Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",RecordNoProto:"'__proto__' is not allowed in Record expressions.",RestTrailingComma:"Unexpected trailing comma after rest element.",SloppyFunction:"In non-strict mode code, functions can only be declared at top level or inside a block.",SloppyFunctionAnnexB:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",SourcePhaseImportRequiresDefault:'Only `import source x from "./module"` is valid.',StaticPrototype:"Classes may not have static property named prototype.",SuperNotAllowed:"`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:"Private fields can't be accessed on super.",TrailingDecorator:"Decorators must be attached to a class element.",TupleExpressionBarIncorrectEndSyntaxType:"Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionBarIncorrectStartSyntaxType:"Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionHashIncorrectStartSyntaxType:"Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",UnexpectedArgumentPlaceholder:"Unexpected argument placeholder.",UnexpectedAwaitAfterPipelineBody:'Unexpected "await" after pipeline body; await must have parentheses in minimal proposal.',UnexpectedDigitAfterHash:"Unexpected digit after hash token.",UnexpectedImportExport:"'import' and 'export' may only appear at the top level.",UnexpectedKeyword:({keyword:e})=>`Unexpected keyword '${e}'.`,UnexpectedLeadingDecorator:"Leading decorators must be attached to a class declaration.",UnexpectedLexicalDeclaration:"Lexical declaration cannot appear in a single-statement context.",UnexpectedNewTarget:"`new.target` can only be used in functions or class properties.",UnexpectedNumericSeparator:"A numeric separator is only allowed between two digits.",UnexpectedPrivateField:"Unexpected private name.",UnexpectedReservedWord:({reservedWord:e})=>`Unexpected reserved word '${e}'.`,UnexpectedSuper:"'super' is only allowed in object methods and classes.",UnexpectedToken:({expected:e,unexpected:t})=>`Unexpected token${t?` '${t}'.`:""}${e?`, expected "${e}"`:""}`,UnexpectedTokenUnaryExponentiation:"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",UnexpectedUsingDeclaration:"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",UnsupportedBind:"Binding should be performed on object property.",UnsupportedDecoratorExport:"A decorated export must export a class declaration.",UnsupportedDefaultExport:"Only expressions, functions or classes are allowed as the `default` export.",UnsupportedImport:"`import` can only be used in `import()` or `import.meta`.",UnsupportedMetaProperty:({target:e,onlyValidPropertyName:t})=>`The only valid meta property for ${e} is ${e}.${t}.`,UnsupportedParameterDecorator:"Decorators cannot be used to decorate parameters.",UnsupportedPropertyDecorator:"Decorators cannot be used to decorate object literal properties.",UnsupportedSuper:"'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",UnterminatedComment:"Unterminated comment.",UnterminatedRegExp:"Unterminated regular expression.",UnterminatedString:"Unterminated string constant.",UnterminatedTemplate:"Unterminated template.",UsingDeclarationExport:"Using declaration cannot be exported.",UsingDeclarationHasBindingPattern:"Using declaration cannot have destructuring patterns.",VarRedeclaration:({identifierName:e})=>`Identifier '${e}' has already been declared.`,YieldBindingIdentifier:"Can not use 'yield' as identifier inside a generator.",YieldInParameter:"Yield expression is not allowed in formal parameters.",YieldNotInGeneratorFunction:"'yield' is only allowed within generator functions.",ZeroDigitNumericSeparator:"Numeric separator can not be used after leading 0."};var n={StrictDelete:"Deleting local variable in strict mode.",StrictEvalArguments:({referenceName:e})=>`Assigning to '${e}' in strict mode.`,StrictEvalArgumentsBinding:({bindingName:e})=>`Binding '${e}' in strict mode.`,StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block.",StrictNumericEscape:"The only valid numeric escape in strict mode is '\\0'.",StrictOctalLiteral:"Legacy octal literals are not allowed in strict mode.",StrictWith:"'with' in strict mode."};var o={ParseExpressionEmptyInput:"Unexpected parseExpression() input: The input is empty or contains only comments.",ParseExpressionExpectsEOF:({unexpected:e})=>`Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(e)}\`.`};const h=new Set(["ArrowFunctionExpression","AssignmentExpression","ConditionalExpression","YieldExpression"]);var l=Object.assign({PipeBodyIsTighter:"Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",PipeTopicRequiresHackPipes:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.',PipeTopicUnbound:"Topic reference is unbound; it must be inside a pipe body.",PipeTopicUnconfiguredToken:({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:"Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",PipeUnparenthesizedBody:({type:e})=>`Hack-style pipe body cannot be an unparenthesized ${toNodeDescription({type:e})}; please wrap it in parentheses.`},{PipelineBodyNoArrow:'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized.',PipelineBodySequenceExpression:"Pipeline body may not be a comma-separated sequence expression.",PipelineHeadSequenceExpression:"Pipeline head should not be a comma-separated sequence expression.",PipelineTopicUnused:"Pipeline is in topic style but does not use topic reference.",PrimaryTopicNotAllowed:"Topic reference was used in a lexical context without topic binding.",PrimaryTopicRequiresSmartPipeline:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'});const c=["message"];function defineHidden(e,t,s){Object.defineProperty(e,t,{enumerable:false,configurable:true,value:s})}function toParseErrorConstructor({toMessage:e,code:t,reasonCode:s,syntaxPlugin:i}){const r=s==="MissingPlugin"||s==="MissingOneOfPlugins";{const e={AccessorCannotDeclareThisParameter:"AccesorCannotDeclareThisParameter",AccessorCannotHaveTypeParameters:"AccesorCannotHaveTypeParameters",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference",SetAccessorCannotHaveOptionalParameter:"SetAccesorCannotHaveOptionalParameter",SetAccessorCannotHaveRestParameter:"SetAccesorCannotHaveRestParameter",SetAccessorCannotHaveReturnType:"SetAccesorCannotHaveReturnType"};if(e[s]){s=e[s]}}return function constructor(a,n){const o=new SyntaxError;o.code=t;o.reasonCode=s;o.loc=a;o.pos=a.index;o.syntaxPlugin=i;if(r){o.missingPlugin=n.missingPlugin}defineHidden(o,"clone",(function clone(e={}){var t;const{line:s,column:i,index:r}=(t=e.loc)!=null?t:a;return constructor(new Position(s,i,r),Object.assign({},n,e.details))}));defineHidden(o,"details",n);Object.defineProperty(o,"message",{configurable:true,get(){const t=`${e(n)} (${a.line}:${a.column})`;this.message=t;return t},set(e){Object.defineProperty(this,"message",{value:e,writable:true})}});return o}}function ParseErrorEnum(e,t){if(Array.isArray(e)){return t=>ParseErrorEnum(t,e[0])}const s={};for(const i of Object.keys(e)){const r=e[i];const a=typeof r==="string"?{message:()=>r}:typeof r==="function"?{message:r}:r,{message:n}=a,o=_objectWithoutPropertiesLoose(a,c);const h=typeof n==="string"?()=>n:n;s[i]=toParseErrorConstructor(Object.assign({code:"BABEL_PARSER_SYNTAX_ERROR",reasonCode:i,toMessage:h},t?{syntaxPlugin:t}:{},o))}return s}const p=Object.assign({},ParseErrorEnum(i),ParseErrorEnum(a),ParseErrorEnum(n),ParseErrorEnum(o),ParseErrorEnum`pipelineOperator`(l));function createDefaultOptions(){return{sourceType:"script",sourceFilename:undefined,startIndex:0,startColumn:0,startLine:1,allowAwaitOutsideFunction:false,allowReturnOutsideFunction:false,allowNewTargetOutsideFunction:false,allowImportExportEverywhere:false,allowSuperOutsideMethod:false,allowUndeclaredExports:false,allowYieldOutsideFunction:false,plugins:[],strictMode:null,ranges:false,tokens:false,createImportExpressions:false,createParenthesizedExpressions:false,errorRecovery:false,attachComment:true,annexB:true}}function getOptions(e){const t=createDefaultOptions();if(e==null){return t}if(e.annexB!=null&&e.annexB!==false){throw new Error("The `annexB` option can only be set to `false`.")}for(const s of Object.keys(t)){if(e[s]!=null)t[s]=e[s]}if(t.startLine===1){if(e.startIndex==null&&t.startColumn>0){t.startIndex=t.startColumn}else if(e.startColumn==null&&t.startIndex>0){t.startColumn=t.startIndex}}else if(e.startColumn==null||e.startIndex==null){if(e.startIndex!=null){throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.")}}return t}const{defineProperty:u}=Object;const toUnenumerable=(e,t)=>{if(e){u(e,t,{enumerable:false,value:e[t]})}};function toESTreeLocation(e){toUnenumerable(e.loc.start,"index");toUnenumerable(e.loc.end,"index");return e}var estree=e=>class ESTreeParserMixin extends e{parse(){const e=toESTreeLocation(super.parse());if(this.optionFlags&256){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)}estreeParseChainExpression(e,t){const s=this.startNodeAtNode(e);s.expression=e;return this.finishNodeAt(s,"ChainExpression",t)}directiveToStmt(e){const t=e.value;delete e.value;this.castNodeTo(t,"Literal");t.raw=t.extra.raw;t.value=t.extra.expressionValue;const s=this.castNodeTo(e,"ExpressionStatement");s.expression=t;s.directive=t.extra.rawValue;delete t.extra;return s}fillOptionalPropertiesForTSESLint(e){}cloneEstreeStringLiteral(e){const{start:t,end:s,loc:i,range:r,raw:a,value:n}=e;const o=Object.create(e.constructor.prototype);o.type="Literal";o.start=t;o.end=s;o.loc=i;o.range=r;o.raw=a;o.value=n;return o}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,s,i,r){super.parseBlockBody(e,t,s,i,r);const a=e.directives.map((e=>this.directiveToStmt(e)));e.body=a.concat(e.body);delete e.directives}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;return this.castNodeTo(e,"PrivateIdentifier")}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);delete o.kind;const{typeParameters:h}=e;if(h){delete e.typeParameters;o.typeParameters=h;this.resetStartLocationFromNode(o,h)}const l=this.castNodeTo(o,"FunctionExpression");e.value=l;if(a==="ClassPrivateMethod"){e.computed=false}if(a==="ObjectMethod"){if(e.kind==="method"){e.kind="init"}e.shorthand=false;return this.finishNode(e,"Property")}else{return this.finishNode(e,"MethodDefinition")}}nameIsConstructor(e){if(e.type==="Literal")return e.value==="constructor";return super.nameIsConstructor(e)}parseClassProperty(...e){const t=super.parseClassProperty(...e);{if(!this.getPluginOption("estree","classFeatures")){return t}}{this.castNodeTo(t,"PropertyDefinition")}return t}parseClassPrivateProperty(...e){const t=super.parseClassPrivateProperty(...e);{if(!this.getPluginOption("estree","classFeatures")){return t}}{this.castNodeTo(t,"PropertyDefinition")}t.computed=false;return t}parseClassAccessorProperty(e){const t=super.parseClassAccessorProperty(e);{if(!this.getPluginOption("estree","classFeatures")){return t}}if(t.abstract&&this.hasPlugin("typescript")){delete t.abstract;this.castNodeTo(t,"TSAbstractAccessorProperty")}else{this.castNodeTo(t,"AccessorProperty")}return t}parseObjectProperty(e,t,s,i){const r=super.parseObjectProperty(e,t,s,i);if(r){r.kind="init";this.castNodeTo(r,"Property")}return r}finishObjectProperty(e){e.kind="init";return this.finishNode(e,"Property")}isValidLVal(e,t,s){return e==="Property"?"value":super.isValidLVal(e,t,s)}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,t,s){if(e.type==="Property"&&(e.kind==="get"||e.kind==="set")){this.raise(p.PatternHasAccessor,e.key)}else if(e.type==="Property"&&e.method){this.raise(p.PatternHasMethod,e.key)}else{super.toAssignableObjectExpressionProp(e,t,s)}}finishCallExpression(e,t){const s=super.finishCallExpression(e,t);if(s.callee.type==="Import"){var i,r;this.castNodeTo(s,"ImportExpression");s.source=s.arguments[0];s.options=(i=s.arguments[1])!=null?i:null;s.attributes=(r=s.arguments[1])!=null?r:null;delete s.arguments;delete s.callee}else if(s.type==="OptionalCallExpression"){this.castNodeTo(s,"CallExpression")}else{s.optional=false}return s}toReferencedArguments(e){if(e.type==="ImportExpression"){return}super.toReferencedArguments(e)}parseExport(e,t){const s=this.state.lastTokStartLoc;const i=super.parseExport(e,t);switch(i.type){case"ExportAllDeclaration":i.exported=null;break;case"ExportNamedDeclaration":if(i.specifiers.length===1&&i.specifiers[0].type==="ExportNamespaceSpecifier"){this.castNodeTo(i,"ExportAllDeclaration");i.exported=i.specifiers[0].exported;delete i.specifiers}case"ExportDefaultDeclaration":{var r;const{declaration:e}=i;if((e==null?void 0:e.type)==="ClassDeclaration"&&((r=e.decorators)==null?void 0:r.length)>0&&e.start===i.start){this.resetStartLocation(i,s)}}break}return i}stopParseSubscript(e,t){const s=super.stopParseSubscript(e,t);if(t.optionalChainMember){return this.estreeParseChainExpression(s,e.loc.end)}return s}parseMember(e,t,s,i,r){const a=super.parseMember(e,t,s,i,r);if(a.type==="OptionalMemberExpression"){this.castNodeTo(a,"MemberExpression")}else{a.optional=false}return a}isOptionalMemberExpression(e){if(e.type==="ChainExpression"){return e.expression.type==="MemberExpression"}return super.isOptionalMemberExpression(e)}hasPropertyAsPrivateName(e){if(e.type==="ChainExpression"){e=e.expression}return super.hasPropertyAsPrivateName(e)}isObjectProperty(e){return e.type==="Property"&&e.kind==="init"&&!e.method}isObjectMethod(e){return e.type==="Property"&&(e.method||e.kind==="get"||e.kind==="set")}castNodeTo(e,t){const s=super.castNodeTo(e,t);this.fillOptionalPropertiesForTSESLint(s);return s}cloneIdentifier(e){const t=super.cloneIdentifier(e);this.fillOptionalPropertiesForTSESLint(t);return t}cloneStringLiteral(e){if(e.type==="Literal"){return this.cloneEstreeStringLiteral(e)}return super.cloneStringLiteral(e)}finishNodeAt(e,t,s){return toESTreeLocation(super.finishNodeAt(e,t,s))}finishNode(e,t){const s=super.finishNode(e,t);this.fillOptionalPropertiesForTSESLint(s);return s}resetStartLocation(e,t){super.resetStartLocation(e,t);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 d={brace:new TokContext("{"),j_oTag:new TokContext("<tag"),j_cTag:new TokContext("</tag"),j_expr:new TokContext("<tag>...</tag>",true)};{d.template=new TokContext("`",true)}const f=true;const m=true;const y=true;const x=true;const P=true;const g=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 T=new Map;function createKeyword(e,t={}){t.keyword=e;const s=createToken(e,t);T.set(e,s);return s}function createBinop(e,t){return createToken(e,{beforeExpr:f,binop:t})}let b=-1;const A=[];const S=[];const w=[];const I=[];const E=[];const C=[];function createToken(e,t={}){var s,i,r,a;++b;S.push(e);w.push((s=t.binop)!=null?s:-1);I.push((i=t.beforeExpr)!=null?i:false);E.push((r=t.startsExpr)!=null?r:false);C.push((a=t.prefix)!=null?a:false);A.push(new ExportedTokenType(e,t));return b}function createKeywordLike(e,t={}){var s,i,r,a;++b;T.set(e,b);S.push(e);w.push((s=t.binop)!=null?s:-1);I.push((i=t.beforeExpr)!=null?i:false);E.push((r=t.startsExpr)!=null?r:false);C.push((a=t.prefix)!=null?a:false);A.push(new ExportedTokenType("name",t));return b}const k={bracketL:createToken("[",{beforeExpr:f,startsExpr:m}),bracketHashL:createToken("#[",{beforeExpr:f,startsExpr:m}),bracketBarL:createToken("[|",{beforeExpr:f,startsExpr:m}),bracketR:createToken("]"),bracketBarR:createToken("|]"),braceL:createToken("{",{beforeExpr:f,startsExpr:m}),braceBarL:createToken("{|",{beforeExpr:f,startsExpr:m}),braceHashL:createToken("#{",{beforeExpr:f,startsExpr:m}),braceR:createToken("}"),braceBarR:createToken("|}"),parenL:createToken("(",{beforeExpr:f,startsExpr:m}),parenR:createToken(")"),comma:createToken(",",{beforeExpr:f}),semi:createToken(";",{beforeExpr:f}),colon:createToken(":",{beforeExpr:f}),doubleColon:createToken("::",{beforeExpr:f}),dot:createToken("."),question:createToken("?",{beforeExpr:f}),questionDot:createToken("?."),arrow:createToken("=>",{beforeExpr:f}),template:createToken("template"),ellipsis:createToken("...",{beforeExpr:f}),backQuote:createToken("`",{startsExpr:m}),dollarBraceL:createToken("${",{beforeExpr:f,startsExpr:m}),templateTail:createToken("...`",{startsExpr:m}),templateNonTail:createToken("...${",{beforeExpr:f,startsExpr:m}),at:createToken("@"),hash:createToken("#",{startsExpr:m}),interpreterDirective:createToken("#!..."),eq:createToken("=",{beforeExpr:f,isAssign:x}),assign:createToken("_=",{beforeExpr:f,isAssign:x}),slashAssign:createToken("_=",{beforeExpr:f,isAssign:x}),xorAssign:createToken("_=",{beforeExpr:f,isAssign:x}),moduloAssign:createToken("_=",{beforeExpr:f,isAssign:x}),incDec:createToken("++/--",{prefix:P,postfix:g,startsExpr:m}),bang:createToken("!",{beforeExpr:f,prefix:P,startsExpr:m}),tilde:createToken("~",{beforeExpr:f,prefix:P,startsExpr:m}),doubleCaret:createToken("^^",{startsExpr:m}),doubleAt:createToken("@@",{startsExpr:m}),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:f,binop:9,prefix:P,startsExpr:m}),modulo:createToken("%",{binop:10,startsExpr:m}),star:createToken("*",{binop:10}),slash:createBinop("/",10),exponent:createToken("**",{beforeExpr:f,binop:11,rightAssociative:true}),_in:createKeyword("in",{beforeExpr:f,binop:7}),_instanceof:createKeyword("instanceof",{beforeExpr:f,binop:7}),_break:createKeyword("break"),_case:createKeyword("case",{beforeExpr:f}),_catch:createKeyword("catch"),_continue:createKeyword("continue"),_debugger:createKeyword("debugger"),_default:createKeyword("default",{beforeExpr:f}),_else:createKeyword("else",{beforeExpr:f}),_finally:createKeyword("finally"),_function:createKeyword("function",{startsExpr:m}),_if:createKeyword("if"),_return:createKeyword("return",{beforeExpr:f}),_switch:createKeyword("switch"),_throw:createKeyword("throw",{beforeExpr:f,prefix:P,startsExpr:m}),_try:createKeyword("try"),_var:createKeyword("var"),_const:createKeyword("const"),_with:createKeyword("with"),_new:createKeyword("new",{beforeExpr:f,startsExpr:m}),_this:createKeyword("this",{startsExpr:m}),_super:createKeyword("super",{startsExpr:m}),_class:createKeyword("class",{startsExpr:m}),_extends:createKeyword("extends",{beforeExpr:f}),_export:createKeyword("export"),_import:createKeyword("import",{startsExpr:m}),_null:createKeyword("null",{startsExpr:m}),_true:createKeyword("true",{startsExpr:m}),_false:createKeyword("false",{startsExpr:m}),_typeof:createKeyword("typeof",{beforeExpr:f,prefix:P,startsExpr:m}),_void:createKeyword("void",{beforeExpr:f,prefix:P,startsExpr:m}),_delete:createKeyword("delete",{beforeExpr:f,prefix:P,startsExpr:m}),_do:createKeyword("do",{isLoop:y,beforeExpr:f}),_for:createKeyword("for",{isLoop:y}),_while:createKeyword("while",{isLoop:y}),_as:createKeywordLike("as",{startsExpr:m}),_assert:createKeywordLike("assert",{startsExpr:m}),_async:createKeywordLike("async",{startsExpr:m}),_await:createKeywordLike("await",{startsExpr:m}),_defer:createKeywordLike("defer",{startsExpr:m}),_from:createKeywordLike("from",{startsExpr:m}),_get:createKeywordLike("get",{startsExpr:m}),_let:createKeywordLike("let",{startsExpr:m}),_meta:createKeywordLike("meta",{startsExpr:m}),_of:createKeywordLike("of",{startsExpr:m}),_sent:createKeywordLike("sent",{startsExpr:m}),_set:createKeywordLike("set",{startsExpr:m}),_source:createKeywordLike("source",{startsExpr:m}),_static:createKeywordLike("static",{startsExpr:m}),_using:createKeywordLike("using",{startsExpr:m}),_yield:createKeywordLike("yield",{startsExpr:m}),_asserts:createKeywordLike("asserts",{startsExpr:m}),_checks:createKeywordLike("checks",{startsExpr:m}),_exports:createKeywordLike("exports",{startsExpr:m}),_global:createKeywordLike("global",{startsExpr:m}),_implements:createKeywordLike("implements",{startsExpr:m}),_intrinsic:createKeywordLike("intrinsic",{startsExpr:m}),_infer:createKeywordLike("infer",{startsExpr:m}),_is:createKeywordLike("is",{startsExpr:m}),_mixins:createKeywordLike("mixins",{startsExpr:m}),_proto:createKeywordLike("proto",{startsExpr:m}),_require:createKeywordLike("require",{startsExpr:m}),_satisfies:createKeywordLike("satisfies",{startsExpr:m}),_keyof:createKeywordLike("keyof",{startsExpr:m}),_readonly:createKeywordLike("readonly",{startsExpr:m}),_unique:createKeywordLike("unique",{startsExpr:m}),_abstract:createKeywordLike("abstract",{startsExpr:m}),_declare:createKeywordLike("declare",{startsExpr:m}),_enum:createKeywordLike("enum",{startsExpr:m}),_module:createKeywordLike("module",{startsExpr:m}),_namespace:createKeywordLike("namespace",{startsExpr:m}),_interface:createKeywordLike("interface",{startsExpr:m}),_type:createKeywordLike("type",{startsExpr:m}),_opaque:createKeywordLike("opaque",{startsExpr:m}),name:createToken("name",{startsExpr:m}),placeholder:createToken("%%",{startsExpr:true}),string:createToken("string",{startsExpr:m}),num:createToken("num",{startsExpr:m}),bigint:createToken("bigint",{startsExpr:m}),decimal:createToken("decimal",{startsExpr:m}),regexp:createToken("regexp",{startsExpr:m}),privateName:createToken("#name",{startsExpr:m}),eof:createToken("eof"),jsxName:createToken("jsxName"),jsxText:createToken("jsxText",{beforeExpr:true}),jsxTagStart:createToken("jsxTagStart",{startsExpr:true}),jsxTagEnd:createToken("jsxTagEnd")};function tokenIsIdentifier(e){return e>=93&&e<=133}function tokenKeywordOrIdentifierIsKeyword(e){return e<=92}function tokenIsKeywordOrIdentifier(e){return e>=58&&e<=133}function tokenIsLiteralPropertyName(e){return e>=58&&e<=137}function tokenComesBeforeExpression(e){return I[e]}function tokenCanStartExpression(e){return E[e]}function tokenIsAssignment(e){return e>=29&&e<=33}function tokenIsFlowInterfaceOrTypeOrOpaque(e){return e>=129&&e<=131}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 C[e]}function tokenIsTSTypeOperator(e){return e>=121&&e<=123}function tokenIsTSDeclarationStart(e){return e>=124&&e<=130}function tokenLabelName(e){return S[e]}function tokenOperatorPrecedence(e){return w[e]}function tokenIsRightAssociative(e){return e===57}function tokenIsTemplate(e){return e>=24&&e<=25}function getExportedToken(e){return A[e]}{A[8].updateContext=e=>{e.pop()};A[5].updateContext=A[7].updateContext=A[23].updateContext=e=>{e.push(d.brace)};A[22].updateContext=e=>{if(e[e.length-1]===d.template){e.pop()}else{e.push(d.template)}};A[143].updateContext=e=>{e.push(d.j_expr,d.j_oTag)}}let N="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ꟑꟑꟓꟕ-ꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let v="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・";const L=new RegExp("["+N+"]");const M=new RegExp("["+N+v+"]");N=v=null;const O=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,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,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191];const D=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,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&&L.test(String.fromCharCode(e))}return isInAstralSet(e,O)}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&&M.test(String.fromCharCode(e))}return isInAstralSet(e,O)||isInAstralSet(e,D)}const F={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 B=new Set(F.keyword);const R=new Set(F.strict);const U=new Set(F.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||R.has(e)}function isStrictBindOnlyReservedWord(e){return U.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return B.has(e)}function isIteratorStart(e,t,s){return e===64&&t===64&&isIdentifierStart(s)}const j=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 j.has(e)}class Scope{constructor(e){this.flags=0;this.names=new Map;this.firstLexicalName="";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 inTopLevel(){return(this.currentScope().flags&1)>0}get inFunction(){return(this.currentVarScopeFlags()&2)>0}get allowSuper(){return(this.currentThisScopeFlags()&16)>0}get allowDirectSuper(){return(this.currentThisScopeFlags()&32)>0}get inClass(){return(this.currentThisScopeFlags()&64)>0}get inClassAndNotInNonArrowFunction(){const e=this.currentThisScopeFlags();return(e&64)>0&&(e&2)===0}get inStaticBlock(){for(let e=this.scopeStack.length-1;;e--){const{flags:t}=this.scopeStack[e];if(t&128){return true}if(t&(643|64)){return false}}}get inNonArrowFunction(){return(this.currentThisScopeFlags()&2)>0}get inBareCaseStatement(){return(this.currentScope().flags&256)>0}get treatFunctionsAsVar(){return this.treatFunctionsAsVarInScope(this.currentScope())}createScope(e){return new Scope(e)}enter(e){this.scopeStack.push(this.createScope(e))}exit(){const e=this.scopeStack.pop();return e.flags}treatFunctionsAsVarInScope(e){return!!(e.flags&(2|128)||!this.parser.inModule&&e.flags&1)}declareName(e,t,s){let i=this.currentScope();if(t&8||t&16){this.checkRedeclarationInScope(i,e,t,s);let r=i.names.get(e)||0;if(t&16){r=r|4}else{if(!i.firstLexicalName){i.firstLexicalName=e}r=r|2}i.names.set(e,r);if(t&8){this.maybeExportDefined(i,e)}}else if(t&4){for(let r=this.scopeStack.length-1;r>=0;--r){i=this.scopeStack[r];this.checkRedeclarationInScope(i,e,t,s);i.names.set(e,(i.names.get(e)||0)|1);this.maybeExportDefined(i,e);if(i.flags&643)break}}if(this.parser.inModule&&i.flags&1){this.undefinedExports.delete(e)}}maybeExportDefined(e,t){if(this.parser.inModule&&e.flags&1){this.undefinedExports.delete(t)}}checkRedeclarationInScope(e,t,s,i){if(this.isRedeclaredInScope(e,t,s)){this.parser.raise(p.VarRedeclaration,i,{identifierName:t})}}isRedeclaredInScope(e,t,s){if(!(s&1))return false;if(s&8){return e.names.has(t)}const i=e.names.get(t);if(s&16){return(i&2)>0||!this.treatFunctionsAsVarInScope(e)&&(i&1)>0}return(i&2)>0&&!(e.flags&8&&e.firstLexicalName===t)||!this.treatFunctionsAsVarInScope(e)&&(i&4)>0}checkLocalExport(e){const{name:t}=e;const s=this.scopeStack[0];if(!s.names.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&643){return t}}}currentThisScopeFlags(){for(let e=this.scopeStack.length-1;;e--){const{flags:t}=this.scopeStack[e];if(t&(643|64)&&!(t&4)){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&2048){this.checkRedeclarationInScope(i,e,t,s);this.maybeExportDefined(i,e);i.declareFunctions.add(e);return}super.declareName(e,t,s)}isRedeclaredInScope(e,t,s){if(super.isRedeclaredInScope(e,t,s))return true;if(s&2048&&!e.declareFunctions.has(t)){const s=e.names.get(t);return(s&4)>0||(s&2)>0}return false}checkLocalExport(e){if(!this.scopeStack[0].declareFunctions.has(e.name)){super.checkLocalExport(e)}}}const _=new Set(["_","any","bool","boolean","empty","extends","false","interface","mixed","null","number","static","string","true","typeof","void"]);const K=ParseErrorEnum`flow`({AmbiguousConditionalArrow:"Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",AmbiguousDeclareModuleKind:"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:({reservedType:e})=>`Cannot overwrite reserved type ${e}.`,DeclareClassElement:"The `declare` modifier can only appear on class fields.",DeclareClassFieldInitializer:"Initializers are not allowed in fields with the `declare` modifier.",DuplicateDeclareModuleExports:"Duplicate `declare module.exports` statement.",EnumBooleanMemberNotInitialized:({memberName:e,enumName:t})=>`Boolean enum members need to be initialized. Use either \`${e} = true,\` or \`${e} = false,\` in enum \`${t}\`.`,EnumDuplicateMemberName:({memberName:e,enumName:t})=>`Enum member names need to be unique, but the name \`${e}\` has already been used before in enum \`${t}\`.`,EnumInconsistentMemberValues:({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:({invalidEnumType:e,enumName:t})=>`Enum type \`${e}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${t}\`.`,EnumInvalidExplicitTypeUnknownSupplied:({enumName:e})=>`Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${e}\`.`,EnumInvalidMemberInitializerPrimaryType:({enumName:e,memberName:t,explicitType:s})=>`Enum \`${e}\` has type \`${s}\`, so the initializer of \`${t}\` needs to be a ${s} literal.`,EnumInvalidMemberInitializerSymbolType:({enumName:e,memberName:t})=>`Symbol enum members cannot be initialized. Use \`${t},\` in enum \`${e}\`.`,EnumInvalidMemberInitializerUnknownType:({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:({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:({enumName:e,memberName:t})=>`Number enum members need to be initialized, e.g. \`${t} = 1\` in enum \`${e}\`.`,EnumStringMemberInconsistentlyInitialized:({enumName:e})=>`String enum members need to consistently either all use initializers, or use no initializers, in enum \`${e}\`.`,GetterMayNotHaveThisParam:"A getter cannot have a `this` parameter.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` or `typeof` keyword.",ImportTypeShorthandOnlyInPureImport:"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:"Explicit inexact syntax cannot appear inside an explicit exact object type.",InexactInsideNonObject:"Explicit inexact syntax cannot appear in class or interface definitions.",InexactVariance:"Explicit inexact syntax cannot have variance.",InvalidNonTypeImportInDeclareModule:"Imports within a `declare module` body must always be `import type` or `import typeof`.",MissingTypeParamDefault:"Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",NestedDeclareModule:"`declare module` cannot be used inside another `declare module`.",NestedFlowComment:"Cannot have a flow comment inside another flow comment.",PatternIsOptional:Object.assign({message:"A binding pattern parameter cannot be optional in an implementation signature."},{reasonCode:"OptionalBindingPattern"}),SetterMayNotHaveThisParam:"A setter cannot have a `this` parameter.",SpreadVariance:"Spread properties cannot have variance.",ThisParamAnnotationRequired:"A type annotation is required for the `this` parameter.",ThisParamBannedInConstructor:"Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",ThisParamMayNotBeOptional:"The `this` parameter cannot be optional.",ThisParamMustBeFirst:"The `this` parameter must be the first function parameter.",ThisParamNoDefault:"The `this` parameter may not have a default value.",TypeBeforeInitializer:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeCastInPattern:"The type cast expression is expected to be wrapped with parenthesis.",UnexpectedExplicitInexactInObject:"Explicit inexact syntax must appear at the end of an inexact object.",UnexpectedReservedType:({reservedType:e})=>`Unexpected reserved type ${e}.`,UnexpectedReservedUnderscore:"`_` is only allowed as a type argument to call or new.",UnexpectedSpaceBetweenModuloChecks:"Spaces between `%` and `checks` are not allowed here.",UnexpectedSpreadType:"Spread operator cannot appear in class or interface definitions.",UnexpectedSubtractionOperand:'Unexpected token, expected "number" or "bigint".',UnexpectedTokenAfterTypeParameter:"Expected an arrow function after this type parameter declaration.",UnexpectedTypeParameterBeforeAsyncArrowFunction:"Type parameters must come after the async keyword, e.g. instead of `<T> async () => {}`, use `async <T>() => {}`.",UnsupportedDeclareExportKind:({unsupportedExportKind:e,suggestion:t})=>`\`declare export ${e}\` is not supported. Use \`${t}\` instead.`,UnsupportedStatementInDeclareModule:"Only declares and type imports are allowed inside declare module.",UnterminatedFlowComment:"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"}const H={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 z=/\*?\s*@((?:no)?flow)\b/;var flow=e=>class FlowParserMixin extends e{constructor(...e){super(...e);this.flowPragma=undefined}getScopeHandler(){return FlowScopeHandler}shouldParseTypes(){return this.getPluginOption("flow","all")||this.flowPragma==="flow"}finishToken(e,t){if(e!==134&&e!==13&&e!==28){if(this.flowPragma===undefined){this.flowPragma=null}}super.finishToken(e,t)}addComment(e){if(this.flowPragma===undefined){const t=z.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")}}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(110);if(this.state.lastTokStartLoc.index>t.index+1){this.raise(K.UnexpectedSpaceBetweenModuloChecks,t)}if(this.eat(10)){e.value=super.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,2048,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(127)){if(this.match(16)){return this.flowParseDeclareModuleExports(e)}else{if(t){this.raise(K.NestedDeclareModule,this.state.lastTokStartLoc)}return this.flowParseDeclareModule(e)}}else if(this.isContextual(130)){return this.flowParseDeclareTypeAlias(e)}else if(this.isContextual(131)){return this.flowParseDeclareOpaqueType(e)}else if(this.isContextual(129)){return this.flowParseDeclareInterface(e)}else if(this.match(82)){return this.flowParseDeclareExportDeclaration(e,t)}else{this.unexpected()}}flowParseDeclareVariable(e){this.next();e.id=this.flowParseTypeAnnotatableIdentifier(true);this.scope.declareName(e.id.name,5,e.id.loc.start);this.semicolon();return this.finishNode(e,"DeclareVariable")}flowParseDeclareModule(e){this.scope.enter(0);if(this.match(134)){e.id=super.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(130)&&!this.match(87)){this.raise(K.InvalidNonTypeImportInDeclareModule,this.state.lastTokStartLoc)}super.parseImport(e)}else{this.expectContextual(125,K.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(K.AmbiguousDeclareModuleKind,e)}i="ES"}else if(e.type==="DeclareModuleExports"){if(r){this.raise(K.DuplicateDeclareModuleExports,e)}if(i==="ES"){this.raise(K.AmbiguousDeclareModuleKind,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(130)||this.isContextual(129))&&!t){const e=this.state.value;throw this.raise(K.UnsupportedDeclareExportKind,this.state.startLoc,{unsupportedExportKind:e,suggestion:H[e]})}if(this.match(74)||this.match(68)||this.match(80)||this.isContextual(131)){e.declaration=this.flowParseDeclare(this.startNode());e.default=false;return this.finishNode(e,"DeclareExportDeclaration")}else if(this.match(55)||this.match(5)||this.isContextual(129)||this.isContextual(130)||this.isContextual(131)){e=this.parseExport(e,null);if(e.type==="ExportNamedDeclaration"){e.default=false;delete e.exportKind;return this.castNodeTo(e,"DeclareExportDeclaration")}else{return this.castNodeTo(e,"DeclareExportAllDeclaration")}}}this.unexpected()}flowParseDeclareModuleExports(e){this.next();this.expectContextual(111);e.typeAnnotation=this.flowParseTypeAnnotation();this.semicolon();return this.finishNode(e,"DeclareModuleExports")}flowParseDeclareTypeAlias(e){this.next();const t=this.flowParseTypeAlias(e);this.castNodeTo(t,"DeclareTypeAlias");return t}flowParseDeclareOpaqueType(e){this.next();const t=this.flowParseOpaqueType(e,true);this.castNodeTo(t,"DeclareOpaqueType");return t}flowParseDeclareInterface(e){this.next();this.flowParseInterfaceish(e,false);return this.finishNode(e,"DeclareInterface")}flowParseInterfaceish(e,t){e.id=this.flowParseRestrictedIdentifier(!t,true);this.scope.declareName(e.id.name,t?17:8201,e.id.loc.start);if(this.match(47)){e.typeParameters=this.flowParseTypeParameterDeclaration()}else{e.typeParameters=null}e.extends=[];if(this.eat(81)){do{e.extends.push(this.flowParseInterfaceExtends())}while(!t&&this.eat(12))}if(t){e.implements=[];e.mixins=[];if(this.eatContextual(117)){do{e.mixins.push(this.flowParseInterfaceExtends())}while(this.eat(12))}if(this.eatContextual(113)){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,false);return this.finishNode(e,"InterfaceDeclaration")}checkNotUnderscore(e){if(e==="_"){this.raise(K.UnexpectedReservedUnderscore,this.state.startLoc)}}checkReservedType(e,t,s){if(!_.has(e))return;this.raise(s?K.AssignReservedType:K.UnexpectedReservedType,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,8201,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(130);e.id=this.flowParseRestrictedIdentifier(true,true);this.scope.declareName(e.id.name,8201,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(K.MissingTypeParamDefault,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(143)){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")}flowInTopLevelContext(e){if(this.curContext()!==d.brace){const t=this.state.context;this.state.context=[t[0]];try{return e()}finally{this.state.context=t}}else{return e()}}flowParseTypeParameterInstantiationInExpression(){if(this.reScan_lt()!==47)return;return this.flowParseTypeParameterInstantiation()}flowParseTypeParameterInstantiation(){const e=this.startNode();const t=this.state.inType;this.state.inType=true;e.params=[];this.flowInTopLevelContext((()=>{this.expect(47);const t=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=t}));this.state.inType=t;if(!this.state.inType&&this.curContext()===d.brace){this.reScan_lt_gt()}this.expect(48);return this.finishNode(e,"TypeParameterInstantiation")}flowParseTypeParameterInstantiationCallOrNew(){if(this.reScan_lt()!==47)return;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(129);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(135)||this.match(134)?super.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.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 l=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 c=this.startNode();if(i&&this.isContextual(118)){const t=this.lookahead();if(t.type!==14&&t.type!==17){this.next();a=this.state.startLoc;e=false}}if(e&&this.isContextual(106)){const e=this.lookahead();if(e.type!==14&&e.type!==17){this.next();t=true}}const p=this.flowParseVariance();if(this.eat(0)){if(a!=null){this.unexpected(a)}if(this.eat(0)){if(p){this.unexpected(p.loc.start)}n.internalSlots.push(this.flowParseObjectTypeInternalSlot(c,t))}else{n.indexers.push(this.flowParseObjectTypeIndexer(c,t,p))}}else if(this.match(10)||this.match(47)){if(a!=null){this.unexpected(a)}if(p){this.unexpected(p.loc.start)}n.callProperties.push(this.flowParseObjectTypeCallProperty(c,t))}else{let e="init";if(this.isContextual(99)||this.isContextual(104)){const t=this.lookahead();if(tokenIsLiteralPropertyName(t.type)){e=this.state.value;this.next()}}const i=this.flowParseObjectTypeProperty(c,t,a,p,e,s,r!=null?r:!h);if(i===null){l=true;o=this.state.lastTokStartLoc}else{n.properties.push(i)}}this.flowObjectTypeSemicolon();if(o&&!this.match(8)&&!this.match(9)){this.raise(K.UnexpectedExplicitInexactInObject,o)}}this.expect(o);if(s){n.inexact=l}const c=this.finishNode(n,"ObjectTypeAnnotation");this.state.inType=a;return c}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(K.InexactInsideNonObject,this.state.lastTokStartLoc)}else if(!n){this.raise(K.InexactInsideExact,this.state.lastTokStartLoc)}if(i){this.raise(K.InexactVariance,i)}return null}if(!a){this.raise(K.UnexpectedSpreadType,this.state.lastTokStartLoc)}if(s!=null){this.unexpected(s)}if(i){this.raise(K.SpreadVariance,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.loc.start));if(r==="get"||r==="set"){this.flowCheckGetterSetterParams(e)}if(!a&&e.key.name==="constructor"&&e.value.this){this.raise(K.ThisParamBannedInConstructor,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"?K.GetterMayNotHaveThisParam:K.SetterMayNotHaveThisParam,e.value.this)}if(s!==t){this.raise(e.kind==="get"?p.BadGetterArity:p.BadSetterArity,e)}if(e.kind==="set"&&e.value.rest){this.raise(p.BadSetterRestParameter,e)}}flowObjectTypeSemicolon(){if(!this.eat(13)&&!this.eat(12)&&!this.match(8)&&!this.match(9)){this.unexpected()}}flowParseQualifiedTypeIdentifier(e,t){e!=null?e:e=this.state.startLoc;let s=t||this.flowParseRestrictedIdentifier(true);while(this.eat(16)){const t=this.startNodeAt(e);t.qualification=s;t.id=this.flowParseRestrictedIdentifier(true);s=this.finishNode(t,"QualifiedTypeIdentifier")}return s}flowParseGenericType(e,t){const s=this.startNodeAt(e);s.typeParameters=null;s.id=this.flowParseQualifiedTypeIdentifier(e,t);if(this.match(47)){s.typeParameters=this.flowParseTypeParameterInstantiation()}return this.finishNode(s,"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(K.ThisParamMustBeFirst,r)}t=this.parseIdentifier(n);if(this.eat(17)){s=true;if(n){this.raise(K.ThisParamMayNotBeOptional,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.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){switch(s.name){case"any":return this.finishNode(t,"AnyTypeAnnotation");case"bool":case"boolean":return this.finishNode(t,"BooleanTypeAnnotation");case"mixed":return this.finishNode(t,"MixedTypeAnnotation");case"empty":return this.finishNode(t,"EmptyTypeAnnotation");case"number":return this.finishNode(t,"NumberTypeAnnotation");case"string":return this.finishNode(t,"StringTypeAnnotation");case"symbol":return this.finishNode(t,"SymbolTypeAnnotation");default:this.checkNotUnderscore(s.name);return this.flowParseGenericType(e,s)}}flowParsePrimaryType(){const e=this.state.startLoc;const t=this.startNode();let s;let i;let r=false;const a=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;i=this.flowParseTupleType();this.state.noAnonFunctionType=a;return i;case 47:{const e=this.startNode();e.typeParameters=this.flowParseTypeParameterDeclaration();this.expect(10);s=this.flowParseFunctionTypeParams();e.params=s.params;e.rest=s.rest;e.this=s._this;this.expect(11);this.expect(19);e.returnType=this.flowParseType();return this.finishNode(e,"FunctionTypeAnnotation")}case 10:{const e=this.startNode();this.next();if(!this.match(11)&&!this.match(21)){if(tokenIsIdentifier(this.state.type)||this.match(78)){const e=this.lookahead().type;r=e!==17&&e!==14}else{r=true}}if(r){this.state.noAnonFunctionType=false;i=this.flowParseType();this.state.noAnonFunctionType=a;if(this.state.noAnonFunctionType||!(this.match(12)||this.match(11)&&this.lookahead().type===19)){this.expect(11);return i}else{this.eat(12)}}if(i){s=this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(i)])}else{s=this.flowParseFunctionTypeParams()}e.params=s.params;e.rest=s.rest;e.this=s._this;this.expect(11);this.expect(19);e.returnType=this.flowParseType();e.typeParameters=null;return this.finishNode(e,"FunctionTypeAnnotation")}case 134:return this.parseLiteral(this.state.value,"StringLiteralTypeAnnotation");case 85:case 86:t.value=this.match(85);this.next();return this.finishNode(t,"BooleanLiteralTypeAnnotation");case 53:if(this.state.value==="-"){this.next();if(this.match(135)){return this.parseLiteralAtNode(-this.state.value,"NumberLiteralTypeAnnotation",t)}if(this.match(136)){return this.parseLiteralAtNode(-this.state.value,"BigIntLiteralTypeAnnotation",t)}throw this.raise(K.UnexpectedSubtractionOperand,this.state.startLoc)}this.unexpected();return;case 135:return this.parseLiteral(this.state.value,"NumberLiteralTypeAnnotation");case 136:return this.parseLiteral(this.state.value,"BigIntLiteralTypeAnnotation");case 88:this.next();return this.finishNode(t,"VoidTypeAnnotation");case 84:this.next();return this.finishNode(t,"NullLiteralTypeAnnotation");case 78:this.next();return this.finishNode(t,"ThisTypeAnnotation");case 55:this.next();return this.finishNode(t,"ExistsTypeAnnotation");case 87:return this.flowParseTypeofType();default:if(tokenIsKeyword(this.state.type)){const e=tokenLabelName(this.state.type);this.next();return super.createIdentifier(t,e)}else if(tokenIsIdentifier(this.state.type)){if(this.isContextual(129)){return this.flowParseInterfaceType()}return this.flowIdentToTypeAnnotation(e,t,this.parseIdentifier())}}this.unexpected()}flowParsePostfixType(){const e=this.state.startLoc;let t=this.flowParsePrimaryType();let s=false;while((this.match(0)||this.match(18))&&!this.canInsertSemicolon()){const i=this.startNodeAt(e);const r=this.eat(18);s=s||r;this.expect(0);if(!r&&this.match(3)){i.elementType=t;this.next();t=this.finishNode(i,"ArrayTypeAnnotation")}else{i.objectType=t;i.indexType=this.flowParseType();this.expect(3);if(s){i.optional=r;t=this.finishNode(i,"OptionalIndexedAccessType")}else{t=this.finishNode(i,"IndexedAccessType")}}}return t}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.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===132&&this.state.value==="_"){const e=this.state.startLoc;const t=this.parseIdentifier();return this.flowParseGenericType(e,t)}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();return this.finishNode(e,"Variance")}return e}parseFunctionBody(e,t,s=false){if(t){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}return super.parseFunctionBodyAndFinish(e,t,s)}parseStatementLike(e){if(this.state.strict&&this.isContextual(129)){const e=this.lookahead();if(tokenIsKeywordOrIdentifier(e.type)){const e=this.startNode();this.next();return this.flowParseInterface(e)}}else if(this.isContextual(126)){const e=this.startNode();this.next();return this.flowParseEnumDeclaration(e)}const t=super.parseStatementLike(e);if(this.flowPragma===undefined&&!this.isValidDirective(t)){this.flowPragma=null}return t}parseExpressionStatement(e,t,s){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,s)}shouldParseExportDeclaration(){const{type:e}=this.state;if(e===126||tokenIsFlowInterfaceOrTypeOrOpaque(e)){return!this.state.containsEsc}return super.shouldParseExportDeclaration()}isExportDefaultSpecifier(){const{type:e}=this.state;if(e===126||tokenIsFlowInterfaceOrTypeOrOpaque(e)){return this.state.containsEsc}return super.isExportDefaultSpecifier()}parseExportDefaultExpression(){if(this.isContextual(126)){const e=this.startNode();this.next();return this.flowParseEnumDeclaration(e)}return super.parseExportDefaultExpression()}parseConditional(e,t,s){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(s);return e}}this.expect(17);const i=this.state.clone();const r=this.state.noArrowAt;const a=this.startNodeAt(t);let{consequent:n,failed:o}=this.tryParseConditionalConsequent();let[h,l]=this.getArrowLikeExpressions(n);if(o||l.length>0){const e=[...r];if(l.length>0){this.state=i;this.state.noArrowAt=e;for(let t=0;t<l.length;t++){e.push(l[t].start)}({consequent:n,failed:o}=this.tryParseConditionalConsequent());[h,l]=this.getArrowLikeExpressions(n)}if(o&&h.length>1){this.raise(K.AmbiguousConditionalArrow,i.startLoc)}if(o&&h.length===1){this.state=i;e.push(h[0].start);this.state.noArrowAt=e;({consequent:n,failed:o}=this.tryParseConditionalConsequent())}}this.getArrowLikeExpressions(n,true);this.state.noArrowAt=r;this.expect(14);a.test=e;a.consequent=n;a.alternate=this.forwardNoArrowParamsConversionAt(a,(()=>this.parseMaybeAssign(undefined,undefined)));return this.finishNode(a,"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"&&e.body.type!=="BlockStatement"){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(2|4);super.checkParams(e,false,true);this.scope.exit()}forwardNoArrowParamsConversionAt(e,t){let s;if(this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(e.start))){this.state.noArrowParamsConversionAt.push(this.state.start);s=t();this.state.noArrowParamsConversionAt.pop()}else{s=t()}return s}parseParenItem(e,t){const s=super.parseParenItem(e,t);if(this.eat(17)){s.optional=true;this.resetEndLocation(e)}if(this.match(14)){const e=this.startNodeAt(t);e.expression=s;e.typeAnnotation=this.flowParseTypeAnnotation();return this.finishNode(e,"TypeCastExpression")}return s}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)}parseExportDeclaration(e){if(this.isContextual(130)){e.exportKind="type";const t=this.startNode();this.next();if(this.match(5)){e.specifiers=this.parseExportSpecifiers(true);super.parseExportFrom(e);return null}else{return this.flowParseTypeAlias(t)}}else if(this.isContextual(131)){e.exportKind="type";const t=this.startNode();this.next();return this.flowParseOpaqueType(t,false)}else if(this.isContextual(129)){e.exportKind="type";const t=this.startNode();this.next();return this.flowParseInterface(t)}else if(this.isContextual(126)){e.exportKind="value";const t=this.startNode();this.next();return this.flowParseEnumDeclaration(t)}else{return super.parseExportDeclaration(e)}}eatExportStar(e){if(super.eatExportStar(e))return true;if(this.isContextual(130)&&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(125)){if(super.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(K.DeclareClassElement,i)}else if(t.value){this.raise(K.DeclareClassFieldInitializer,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(p.InvalidIdentifier,this.state.curPosition(),{identifierName:t})}this.finishToken(132,t)}getTokenFromCode(e){const t=this.input.charCodeAt(this.state.pos+1);if(e===123&&t===124){this.finishOp(6,2)}else if(this.state.inType&&(e===62||e===60)){this.finishOp(e===62?48:47,1)}else if(this.state.inType&&e===63){if(t===46){this.finishOp(18,2)}else{this.finishOp(17,1)}}else if(isIteratorStart(e,t,this.input.charCodeAt(this.state.pos+2))){this.state.pos+=2;this.readIterator()}else{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(e,t)}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(K.TypeCastInPattern,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,s){return e==="TypeCastExpression"||super.isValidLVal(e,t,s)}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(K.ThisParamBannedInConstructor,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(K.ThisParamBannedInConstructor,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)||this.match(51))){{e.superTypeParameters=this.flowParseTypeParameterInstantiationInExpression()}}if(this.isContextual(113)){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(K.GetterMayNotHaveThisParam,s)}else if(this.isThisParam(s)){this.raise(K.SetterMayNotHaveThisParam,s)}}}parsePropertyNamePrefixOperator(e){e.variance=this.flowParseVariance()}parseObjPropValue(e,t,s,i,r,a,n){if(e.variance){this.unexpected(e.variance.loc.start)}delete e.variance;let o;if(this.match(47)&&!a){o=this.flowParseTypeParameterDeclaration();if(!this.match(10))this.unexpected()}const h=super.parseObjPropValue(e,t,s,i,r,a,n);if(o){(h.value||h).typeParameters=o}return h}parseFunctionParamType(e){if(this.eat(17)){if(e.type!=="Identifier"){this.raise(K.PatternIsOptional,e)}if(this.isThisParam(e)){this.raise(K.ThisParamMayNotBeOptional,e)}e.optional=true}if(this.match(14)){e.typeAnnotation=this.flowParseTypeAnnotation()}else if(this.isThisParam(e)){this.raise(K.ThisParamAnnotationRequired,e)}if(this.match(29)&&this.isThisParam(e)){this.raise(K.ThisParamNoDefault,e)}this.resetEndLocation(e);return e}parseMaybeDefault(e,t){const s=super.parseMaybeDefault(e,t);if(s.type==="AssignmentPattern"&&s.typeAnnotation&&s.right.start<s.typeAnnotation.start){this.raise(K.TypeBeforeInitializer,s.typeAnnotation)}return s}checkImportReflection(e){super.checkImportReflection(e);if(e.module&&e.importKind!=="value"){this.raise(K.ImportReflectionHasImportType,e.specifiers[0].loc.start)}}parseImportSpecifierLocal(e,t,s){t.local=hasTypeImportKind(e)?this.flowParseRestrictedIdentifier(true,true):this.parseIdentifier();e.specifiers.push(this.finishImportSpecifier(t,s))}isPotentialImportPhase(e){if(super.isPotentialImportPhase(e))return true;if(this.isContextual(130)){if(!e)return true;const t=this.lookaheadCharCode();return t===123||t===42}return!e&&this.isContextual(87)}applyImportPhase(e,t,s,i){super.applyImportPhase(e,t,s,i);if(t){if(!s&&this.match(65)){return}e.exportKind=s==="type"?s:"value"}else{if(s==="type"&&this.match(55))this.unexpected();e.importKind=s==="type"||s==="typeof"?s:"value"}}parseImportSpecifier(e,t,s,i,r){const a=e.imported;let n=null;if(a.type==="Identifier"){if(a.name==="type"){n="type"}else if(a.name==="typeof"){n="typeof"}}let o=false;if(this.isContextual(93)&&!this.isLookaheadContextual("as")){const t=this.parseIdentifier(true);if(n!==null&&!tokenIsKeywordOrIdentifier(this.state.type)){e.imported=t;e.importKind=n;e.local=this.cloneIdentifier(t)}else{e.imported=a;e.importKind=null;e.local=this.parseIdentifier()}}else{if(n!==null&&tokenIsKeywordOrIdentifier(this.state.type)){e.imported=this.parseIdentifier(true);e.importKind=n}else{if(t){throw this.raise(p.ImportBindingIsString,e,{importName:a.value})}e.imported=a;e.importKind=null}if(this.eatContextual(93)){e.local=this.parseIdentifier()}else{o=true;e.local=this.cloneIdentifier(e.imported)}}const h=hasTypeImportKind(e);if(s&&h){this.raise(K.ImportTypeShorthandOnlyInPureImport,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(143)||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===d.j_oTag||a===d.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(K.UnexpectedTypeParameterBeforeAsyncArrowFunction,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(K.UnexpectedTokenAfterTypeParameter,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.includes(this.offsetToSourcePos(e.start))){e.params=t}else{super.setArrowFunctionParameters(e,t)}}checkParams(e,t,s,i=true){if(s&&this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(e.start))){return}for(let t=0;t<e.params.length;t++){if(this.isThisParam(e.params[t])&&t>0){this.raise(K.ThisParamMustBeFirst,e.params[t])}}super.checkParams(e,t,s,i)}parseParenAndDistinguishExpression(e){return super.parseParenAndDistinguishExpression(e&&!this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)))}parseSubscripts(e,t,s){if(e.type==="Identifier"&&e.name==="async"&&this.state.noArrowAt.includes(t.index)){this.next();const s=this.startNodeAt(t);s.callee=e;s.arguments=super.parseCallExpressionArguments(11);e=this.finishNode(s,"CallExpression")}else if(e.type==="Identifier"&&e.name==="async"&&this.match(47)){const i=this.state.clone();const r=this.tryParse((e=>this.parseAsyncArrowWithTypeParameters(t)||e()),i);if(!r.error&&!r.aborted)return r.node;const a=this.tryParse((()=>super.parseSubscripts(e,t,s)),i);if(a.node&&!a.error)return a.node;if(r.node){this.state=r.failState;return r.node}if(a.node){this.state=a.failState;return a.node}throw r.error||a.error}return super.parseSubscripts(e,t,s)}parseSubscript(e,t,s,i){if(this.match(18)&&this.isLookaheadToken_lt()){i.optionalChainMember=true;if(s){i.stop=true;return e}this.next();const r=this.startNodeAt(t);r.callee=e;r.typeArguments=this.flowParseTypeParameterInstantiationInExpression();this.expect(10);r.arguments=this.parseCallExpressionArguments(11);r.optional=true;return this.finishCallExpression(r,true)}else if(!s&&this.shouldParseTypes()&&(this.match(47)||this.match(51))){const s=this.startNodeAt(t);s.callee=e;const r=this.tryParse((()=>{s.typeArguments=this.flowParseTypeParameterInstantiationCallOrNew();this.expect(10);s.arguments=super.parseCallExpressionArguments(11);if(i.optionalChainMember){s.optional=false}return this.finishCallExpression(s,i.optionalChainMember)}));if(r.node){if(r.error)this.state=r.failState;return r.node}}return super.parseSubscript(e,t,s,i)}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){const t=this.startNodeAt(e);this.parseFunctionParams(t,false);if(!this.parseArrow(t))return;return super.parseArrowExpression(t,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(K.UnterminatedFlowComment,this.state.curPosition())}return s}skipBlockComment(){if(this.hasPlugin("flowComments")&&this.skipFlowComment()){if(this.state.hasFlowComment){throw this.raise(K.NestedFlowComment,this.state.startLoc)}this.hasFlowCommentCompletion();const e=this.skipFlowComment();if(e){this.state.pos+=e;this.state.hasFlowComment=true}return}return super.skipBlockComment(this.state.hasFlowComment?"*-/":"*/")}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(p.UnterminatedComment,this.state.curPosition())}}flowEnumErrorBooleanMemberNotInitialized(e,{enumName:t,memberName:s}){this.raise(K.EnumBooleanMemberNotInitialized,e,{memberName:s,enumName:t})}flowEnumErrorInvalidMemberInitializer(e,t){return this.raise(!t.explicitType?K.EnumInvalidMemberInitializerUnknownType:t.explicitType==="symbol"?K.EnumInvalidMemberInitializerSymbolType:K.EnumInvalidMemberInitializerPrimaryType,e,t)}flowEnumErrorNumberMemberNotInitialized(e,t){this.raise(K.EnumNumberMemberNotInitialized,e,t)}flowEnumErrorStringMemberInconsistentlyInitialized(e,t){this.raise(K.EnumStringMemberInconsistentlyInitialized,e,t)}flowEnumMemberInit(){const e=this.state.startLoc;const endOfInit=()=>this.match(12)||this.match(8);switch(this.state.type){case 135:{const t=this.parseNumericLiteral(this.state.value);if(endOfInit()){return{type:"number",loc:t.loc.start,value:t}}return{type:"invalid",loc:e}}case 134:{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(K.EnumInvalidMemberName,n,{memberName:h,suggestion:h[0].toUpperCase()+h.slice(1),enumName:e})}if(s.has(h)){this.raise(K.EnumDuplicateMemberName,n,{memberName:h,enumName:e})}s.add(h);const l={enumName:e,explicitType:t,memberName:h};a.id=n;switch(o.type){case"boolean":{this.flowEnumCheckExplicitTypeMismatch(o.loc,l,"boolean");a.init=o.value;i.booleanMembers.push(this.finishNode(a,"EnumBooleanMember"));break}case"number":{this.flowEnumCheckExplicitTypeMismatch(o.loc,l,"number");a.init=o.value;i.numberMembers.push(this.finishNode(a,"EnumNumberMember"));break}case"string":{this.flowEnumCheckExplicitTypeMismatch(o.loc,l,"string");a.init=o.value;i.stringMembers.push(this.finishNode(a,"EnumStringMember"));break}case"invalid":{throw this.flowEnumErrorInvalidMemberInitializer(o.loc,l)}case"none":{switch(t){case"boolean":this.flowEnumErrorBooleanMemberNotInitialized(o.loc,l);break;case"number":this.flowEnumErrorNumberMemberNotInitialized(o.loc,l);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.flowEnumErrorStringMemberInconsistentlyInitialized(t,{enumName:s})}return t}else{for(const e of t){this.flowEnumErrorStringMemberInconsistentlyInitialized(e,{enumName:s})}return e}}flowEnumParseExplicitType({enumName:e}){if(!this.eatContextual(102))return null;if(!tokenIsIdentifier(this.state.type)){throw this.raise(K.EnumInvalidExplicitTypeUnknownSupplied,this.state.startLoc,{enumName:e})}const{value:t}=this.state;this.next();if(t!=="boolean"&&t!=="number"&&t!=="string"&&t!=="symbol"){this.raise(K.EnumInvalidExplicitType,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(K.EnumInconsistentMemberValues,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")}jsxParseOpeningElementAfterName(e){if(this.shouldParseTypes()){if(this.match(47)||this.match(51)){e.typeArguments=this.flowParseTypeParameterInstantiationInExpression()}}return super.jsxParseOpeningElementAfterName(e)}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}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}maybeUnwrapTypeCastExpression(e){return e.type==="TypeCastExpression"?e.expression:e}};const V={__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 q=/\r\n|[\r\n\u2028\u2029]/;const $=new RegExp(q.source,"g");function isNewLine(e){switch(e){case 10:case 13:case 8232:case 8233:return true;default:return false}}function hasNewLine(e,t,s){for(let i=t;i<s;i++){if(isNewLine(e.charCodeAt(i))){return true}}return false}const W=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;const J=/(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;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}}const X=ParseErrorEnum`jsx`({AttributeIsEmpty:"JSX attributes must only be assigned a non-empty expression.",MissingClosingTagElement:({openingTagName:e})=>`Expected corresponding JSX closing tag for <${e}>.`,MissingClosingTagFragment:"Expected corresponding JSX closing tag for <>.",UnexpectedSequenceExpression:"Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",UnexpectedToken:({unexpected:e,HTMLEntity:t})=>`Unexpected token \`${e}\`. Did you mean \`${t}\` or \`{'${e}'}\`?`,UnsupportedJsxValue:"JSX value should be either an expression or a quoted JSX text.",UnterminatedJsxContent:"Unterminated JSX contents.",UnwrappedAdjacentJSXElements:"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 JSXParserMixin extends e{jsxReadToken(){let e="";let t=this.state.pos;for(;;){if(this.state.pos>=this.length){throw this.raise(X.UnterminatedJsxContent,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;this.finishToken(143)}else{super.getTokenFromCode(s)}return}e+=this.input.slice(t,this.state.pos);this.finishToken(142,e);return;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(p.UnterminatedString,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++);this.finishToken(134,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=V[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);this.finishToken(141,this.input.slice(t,this.state.pos))}jsxParseIdentifier(){const e=this.startNode();if(this.match(141)){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.startLoc;const t=this.jsxParseIdentifier();if(!this.eat(14))return t;const s=this.startNodeAt(e);s.namespace=t;s.name=this.jsxParseIdentifier();return this.finishNode(s,"JSXNamespacedName")}jsxParseElementName(){const e=this.state.startLoc;let t=this.jsxParseNamespacedName();if(t.type==="JSXNamespacedName"){return t}while(this.eat(16)){const s=this.startNodeAt(e);s.object=t;s.property=this.jsxParseIdentifier();t=this.finishNode(s,"JSXMemberExpression")}return t}jsxParseAttributeValue(){let e;switch(this.state.type){case 5:e=this.startNode();this.setContext(d.brace);this.next();e=this.jsxParseExpressionContainer(e,d.j_oTag);if(e.expression.type==="JSXEmptyExpression"){this.raise(X.AttributeIsEmpty,e)}return e;case 143:case 134:return this.parseExprAtom();default:throw this.raise(X.UnsupportedJsxValue,this.state.startLoc)}}jsxParseEmptyExpression(){const e=this.startNodeAt(this.state.lastTokEndLoc);return this.finishNodeAt(e,"JSXEmptyExpression",this.state.startLoc)}jsxParseSpreadChild(e){this.next();e.expression=this.parseExpression();this.setContext(d.j_expr);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(d.brace);this.next();this.expect(21);e.argument=this.parseMaybeAssignAllowIn();this.setContext(d.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){const t=this.startNodeAt(e);if(this.eat(144)){return this.finishNode(t,"JSXOpeningFragment")}t.name=this.jsxParseElementName();return this.jsxParseOpeningElementAfterName(t)}jsxParseOpeningElementAfterName(e){const t=[];while(!this.match(56)&&!this.match(144)){t.push(this.jsxParseAttribute())}e.attributes=t;e.selfClosing=this.eat(56);this.expect(144);return this.finishNode(e,"JSXOpeningElement")}jsxParseClosingElementAt(e){const t=this.startNodeAt(e);if(this.eat(144)){return this.finishNode(t,"JSXClosingFragment")}t.name=this.jsxParseElementName();this.expect(144);return this.finishNode(t,"JSXClosingElement")}jsxParseElementAt(e){const t=this.startNodeAt(e);const s=[];const i=this.jsxParseOpeningElementAt(e);let r=null;if(!i.selfClosing){e:for(;;){switch(this.state.type){case 143:e=this.state.startLoc;this.next();if(this.eat(56)){r=this.jsxParseClosingElementAt(e);break e}s.push(this.jsxParseElementAt(e));break;case 142:s.push(this.parseLiteral(this.state.value,"JSXText"));break;case 5:{const e=this.startNode();this.setContext(d.brace);this.next();if(this.match(21)){s.push(this.jsxParseSpreadChild(e))}else{s.push(this.jsxParseExpressionContainer(e,d.j_expr))}break}default:this.unexpected()}}if(isFragment(i)&&!isFragment(r)&&r!==null){this.raise(X.MissingClosingTagFragment,r)}else if(!isFragment(i)&&isFragment(r)){this.raise(X.MissingClosingTagElement,r,{openingTagName:getQualifiedJSXName(i.name)})}else if(!isFragment(i)&&!isFragment(r)){if(getQualifiedJSXName(r.name)!==getQualifiedJSXName(i.name)){this.raise(X.MissingClosingTagElement,r,{openingTagName:getQualifiedJSXName(i.name)})}}}if(isFragment(i)){t.openingFragment=i;t.closingFragment=r}else{t.openingElement=i;t.closingElement=r}t.children=s;if(this.match(47)){throw this.raise(X.UnwrappedAdjacentJSXElements,this.state.startLoc)}return isFragment(i)?this.finishNode(t,"JSXFragment"):this.finishNode(t,"JSXElement")}jsxParseElement(){const e=this.state.startLoc;this.next();return this.jsxParseElementAt(e)}setContext(e){const{context:t}=this.state;t[t.length-1]=e}parseExprAtom(e){if(this.match(143)){return this.jsxParseElement()}else if(this.match(47)&&this.input.charCodeAt(this.state.pos)!==33){this.replaceToken(143);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===d.j_expr){this.jsxReadToken();return}if(t===d.j_oTag||t===d.j_cTag){if(isIdentifierStart(e)){this.jsxReadWord();return}if(e===62){++this.state.pos;this.finishToken(144);return}if((e===34||e===39)&&t===d.j_oTag){this.jsxReadString(e);return}}if(e===60&&this.state.canStartJSXElement&&this.input.charCodeAt(this.state.pos+1)!==33){++this.state.pos;this.finishToken(143);return}super.getTokenFromCode(e)}updateContext(e){const{context:t,type:s}=this.state;if(s===56&&e===143){t.splice(-2,2,d.j_cTag);this.state.canStartJSXElement=false}else if(s===143){t.push(d.j_oTag)}else if(s===144){const s=t[t.length-1];if(s===d.j_oTag&&e===56||s===d.j_cTag){t.pop();this.state.canStartJSXElement=t[t.length-1]===d.j_expr}else{this.setContext(d.j_expr);this.state.canStartJSXElement=true}}else{this.state.canStartJSXElement=tokenComesBeforeExpression(s)}}};class TypeScriptScope extends Scope{constructor(...e){super(...e);this.tsNames=new Map}}class TypeScriptScopeHandler extends ScopeHandler{constructor(...e){super(...e);this.importsStack=[]}createScope(e){this.importsStack.push(new Set);return new TypeScriptScope(e)}enter(e){if(e===512){this.importsStack.push(new Set)}super.enter(e)}exit(){const e=super.exit();if(e===512){this.importsStack.pop()}return e}hasImport(e,t){const s=this.importsStack.length;if(this.importsStack[s-1].has(e)){return true}if(!t&&s>1){for(let t=0;t<s-1;t++){if(this.importsStack[t].has(e))return true}}return false}declareName(e,t,s){if(t&4096){if(this.hasImport(e,true)){this.parser.raise(p.VarRedeclaration,s,{identifierName:e})}this.importsStack[this.importsStack.length-1].add(e);return}const i=this.currentScope();let r=i.tsNames.get(e)||0;if(t&1024){this.maybeExportDefined(i,e);i.tsNames.set(e,r|16);return}super.declareName(e,t,s);if(t&2){if(!(t&1)){this.checkRedeclarationInScope(i,e,t,s);this.maybeExportDefined(i,e)}r=r|1}if(t&256){r=r|2}if(t&512){r=r|4}if(t&128){r=r|8}if(r)i.tsNames.set(e,r)}isRedeclaredInScope(e,t,s){const i=e.tsNames.get(t);if((i&2)>0){if(s&256){const e=!!(s&512);const t=(i&4)>0;return e!==t}return true}if(s&128&&(i&8)>0){if(e.names.get(t)&2){return!!(s&1)}else{return false}}if(s&2&&(i&1)>0){return true}return super.isRedeclaredInScope(e,t,s)}checkLocalExport(e){const{name:t}=e;if(this.hasImport(t))return;const s=this.scopeStack.length;for(let e=s-1;e>=0;e--){const s=this.scopeStack[e];const i=s.tsNames.get(t);if((i&1)>0||(i&16)>0){return}}super.checkLocalExport(e)}}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()&2)>0}get hasYield(){return(this.currentFlags()&1)>0}get hasReturn(){return(this.currentFlags()&4)>0}get hasIn(){return(this.currentFlags()&8)>0}}function functionFlags(e,t){return(e?2:0)|(t?1:0)}class BaseParser{constructor(){this.sawUnambiguousESM=false;this.ambiguousScriptDifferentAst=false}sourceToOffsetPos(e){return e+this.startIndex}offsetToSourcePos(e){return e-this.startIndex}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;const{commentsLen:t}=this.state;if(this.comments.length!==t){this.comments.length=t}this.comments.push(e);this.state.commentsLen++}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){var t;const{comments:s}=e;if(e.leadingNode!==null||e.trailingNode!==null){if(e.leadingNode!==null){setTrailingComments(e.leadingNode,s)}if(e.trailingNode!==null){setLeadingComments(e.trailingNode,s)}}else{const{containingNode:i,start:r}=e;if(this.input.charCodeAt(this.offsetToSourcePos(r)-1)===44){switch(i.type){case"ObjectExpression":case"ObjectPattern":case"RecordExpression":adjustInnerComments(i,i.properties,e);break;case"CallExpression":case"OptionalCallExpression":adjustInnerComments(i,i.arguments,e);break;case"ImportExpression":adjustInnerComments(i,[i.source,(t=i.options)!=null?t:null],e);break;case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"ObjectMethod":case"ClassMethod":case"ClassPrivateMethod":adjustInnerComments(i,i.params,e);break;case"ArrayExpression":case"ArrayPattern":case"TupleExpression":adjustInnerComments(i,i.elements,e);break;case"ExportNamedDeclaration":case"ImportDeclaration":adjustInnerComments(i,i.specifiers,e);break;case"TSEnumDeclaration":{adjustInnerComments(i,i.members,e)}break;case"TSEnumBody":adjustInnerComments(i,i.members,e);break;default:{setInnerComments(i,s)}}}else{setInnerComments(i,s)}}}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}}}}class State{constructor(){this.flags=1024;this.startIndex=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.topicContext={maxNumOfResolvableTopics:0,maxTopicIndex:null};this.labels=[];this.commentsLen=0;this.commentStack=[];this.pos=0;this.type=140;this.value=null;this.start=0;this.end=0;this.lastTokEndLoc=null;this.lastTokStartLoc=null;this.context=[d.brace];this.firstInvalidTemplateEscapePos=null;this.strictErrors=new Map;this.tokensLength=0}get strict(){return(this.flags&1)>0}set strict(e){if(e)this.flags|=1;else this.flags&=-2}init({strictMode:e,sourceType:t,startIndex:s,startLine:i,startColumn:r}){this.strict=e===false?false:e===true?true:t==="module";this.startIndex=s;this.curLine=i;this.lineStart=-r;this.startLoc=this.endLoc=new Position(i,r,s)}get maybeInArrowParameters(){return(this.flags&2)>0}set maybeInArrowParameters(e){if(e)this.flags|=2;else this.flags&=-3}get inType(){return(this.flags&4)>0}set inType(e){if(e)this.flags|=4;else this.flags&=-5}get noAnonFunctionType(){return(this.flags&8)>0}set noAnonFunctionType(e){if(e)this.flags|=8;else this.flags&=-9}get hasFlowComment(){return(this.flags&16)>0}set hasFlowComment(e){if(e)this.flags|=16;else this.flags&=-17}get isAmbientContext(){return(this.flags&32)>0}set isAmbientContext(e){if(e)this.flags|=32;else this.flags&=-33}get inAbstractClass(){return(this.flags&64)>0}set inAbstractClass(e){if(e)this.flags|=64;else this.flags&=-65}get inDisallowConditionalTypesContext(){return(this.flags&128)>0}set inDisallowConditionalTypesContext(e){if(e)this.flags|=128;else this.flags&=-129}get soloAwait(){return(this.flags&256)>0}set soloAwait(e){if(e)this.flags|=256;else this.flags&=-257}get inFSharpPipelineDirectBody(){return(this.flags&512)>0}set inFSharpPipelineDirectBody(e){if(e)this.flags|=512;else this.flags&=-513}get canStartJSXElement(){return(this.flags&1024)>0}set canStartJSXElement(e){if(e)this.flags|=1024;else this.flags&=-1025}get containsEsc(){return(this.flags&2048)>0}set containsEsc(e){if(e)this.flags|=2048;else this.flags&=-2049}get hasTopLevelAwait(){return(this.flags&4096)>0}set hasTopLevelAwait(e){if(e)this.flags|=4096;else this.flags&=-4097}curPosition(){return new Position(this.curLine,this.pos-this.lineStart,this.pos+this.startIndex)}clone(){const e=new State;e.flags=this.flags;e.startIndex=this.startIndex;e.curLine=this.curLine;e.lineStart=this.lineStart;e.startLoc=this.startLoc;e.endLoc=this.endLoc;e.errors=this.errors.slice();e.potentialArrowAt=this.potentialArrowAt;e.noArrowAt=this.noArrowAt.slice();e.noArrowParamsConversionAt=this.noArrowParamsConversionAt.slice();e.topicContext=this.topicContext;e.labels=this.labels.slice();e.commentsLen=this.commentsLen;e.commentStack=this.commentStack.slice();e.pos=this.pos;e.type=this.type;e.value=this.value;e.start=this.start;e.end=this.end;e.lastTokEndLoc=this.lastTokEndLoc;e.lastTokStartLoc=this.lastTokStartLoc;e.context=this.context.slice();e.firstInvalidTemplateEscapePos=this.firstInvalidTemplateEscapePos;e.strictErrors=this.strictErrors;e.tokensLength=this.tokensLength;return e}}var G=function isDigit(e){return e>=48&&e<=57};const Y={decBinOct:new Set([46,66,69,79,95,98,101,111]),hex:new Set([46,88,95,120])};const Q={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};function readStringContents(e,t,s,i,r,a){const n=s;const o=i;const h=r;let l="";let c=null;let p=s;const{length:u}=t;for(;;){if(s>=u){a.unterminated(n,o,h);l+=t.slice(p,s);break}const d=t.charCodeAt(s);if(isStringEnd(e,d,t,s)){l+=t.slice(p,s);break}if(d===92){l+=t.slice(p,s);const n=readEscapedChar(t,s,i,r,e==="template",a);if(n.ch===null&&!c){c={pos:s,lineStart:i,curLine:r}}else{l+=n.ch}({pos:s,lineStart:i,curLine:r}=n);p=s}else if(d===8232||d===8233){++s;++r;i=s}else if(d===10||d===13){if(e==="template"){l+=t.slice(p,s)+"\n";++s;if(d===13&&t.charCodeAt(s)===10){++s}++r;p=i=s}else{a.unterminated(n,o,h)}}else{++s}}return{pos:s,str:l,firstInvalidLoc:c,lineStart:i,curLine:r,containsInvalid:!!c}}function isStringEnd(e,t,s,i){if(e==="template"){return t===96||t===36&&s.charCodeAt(i+1)===123}return t===(e==="double"?34:39)}function readEscapedChar(e,t,s,i,r,a){const n=!r;t++;const res=e=>({pos:t,ch:e,lineStart:s,curLine:i});const o=e.charCodeAt(t++);switch(o){case 110:return res("\n");case 114:return res("\r");case 120:{let r;({code:r,pos:t}=readHexChar(e,t,s,i,2,false,n,a));return res(r===null?null:String.fromCharCode(r))}case 117:{let r;({code:r,pos:t}=readCodePoint(e,t,s,i,n,a));return res(r===null?null:String.fromCodePoint(r))}case 116:return res("\t");case 98:return res("\b");case 118:return res("\v");case 102:return res("\f");case 13:if(e.charCodeAt(t)===10){++t}case 10:s=t;++i;case 8232:case 8233:return res("");case 56:case 57:if(r){return res(null)}else{a.strictNumericEscape(t-1,s,i)}default:if(o>=48&&o<=55){const n=t-1;const o=/^[0-7]+/.exec(e.slice(n,t+2));let h=o[0];let l=parseInt(h,8);if(l>255){h=h.slice(0,-1);l=parseInt(h,8)}t+=h.length-1;const c=e.charCodeAt(t);if(h!=="0"||c===56||c===57){if(r){return res(null)}else{a.strictNumericEscape(n,s,i)}}return res(String.fromCharCode(l))}return res(String.fromCharCode(o))}}function readHexChar(e,t,s,i,r,a,n,o){const h=t;let l;({n:l,pos:t}=readInt(e,t,s,i,16,r,a,false,o,!n));if(l===null){if(n){o.invalidEscapeSequence(h,s,i)}else{t=h-1}}return{code:l,pos:t}}function readInt(e,t,s,i,r,a,n,o,h,l){const c=t;const p=r===16?Y.hex:Y.decBinOct;const u=r===16?Q.hex:r===10?Q.dec:r===8?Q.oct:Q.bin;let d=false;let f=0;for(let c=0,m=a==null?Infinity:a;c<m;++c){const a=e.charCodeAt(t);let c;if(a===95&&o!=="bail"){const r=e.charCodeAt(t-1);const a=e.charCodeAt(t+1);if(!o){if(l)return{n:null,pos:t};h.numericSeparatorInEscapeSequence(t,s,i)}else if(Number.isNaN(a)||!u(a)||p.has(r)||p.has(a)){if(l)return{n:null,pos:t};h.unexpectedNumericSeparator(t,s,i)}++t;continue}if(a>=97){c=a-97+10}else if(a>=65){c=a-65+10}else if(G(a)){c=a-48}else{c=Infinity}if(c>=r){if(c<=9&&l){return{n:null,pos:t}}else if(c<=9&&h.invalidDigit(t,s,i,r)){c=0}else if(n){c=0;d=true}else{break}}++t;f=f*r+c}if(t===c||a!=null&&t-c!==a||d){return{n:null,pos:t}}return{n:f,pos:t}}function readCodePoint(e,t,s,i,r,a){const n=e.charCodeAt(t);let o;if(n===123){++t;({code:o,pos:t}=readHexChar(e,t,s,i,e.indexOf("}",t)-t,true,r,a));++t;if(o!==null&&o>1114111){if(r){a.invalidCodePoint(t,s,i)}else{return{code:null,pos:t}}}}else{({code:o,pos:t}=readHexChar(e,t,s,i,4,false,r,a))}return{code:o,pos:t}}function buildPosition(e,t,s){return new Position(s,e-t,e)}const Z=new Set([103,109,115,105,121,117,100,118]);class Token{constructor(e){const t=e.startIndex||0;this.type=e.type;this.value=e.value;this.start=t+e.start;this.end=t+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.errorHandlers_readInt={invalidDigit:(e,t,s,i)=>{if(!(this.optionFlags&2048))return false;this.raise(p.InvalidDigit,buildPosition(e,t,s),{radix:i});return true},numericSeparatorInEscapeSequence:this.errorBuilder(p.NumericSeparatorInEscapeSequence),unexpectedNumericSeparator:this.errorBuilder(p.UnexpectedNumericSeparator)};this.errorHandlers_readCodePoint=Object.assign({},this.errorHandlers_readInt,{invalidEscapeSequence:this.errorBuilder(p.InvalidEscapeSequence),invalidCodePoint:this.errorBuilder(p.InvalidCodePoint)});this.errorHandlers_readStringContents_string=Object.assign({},this.errorHandlers_readCodePoint,{strictNumericEscape:(e,t,s)=>{this.recordStrictModeErrors(p.StrictNumericEscape,buildPosition(e,t,s))},unterminated:(e,t,s)=>{throw this.raise(p.UnterminatedString,buildPosition(e-1,t,s))}});this.errorHandlers_readStringContents_template=Object.assign({},this.errorHandlers_readCodePoint,{strictNumericEscape:this.errorBuilder(p.StrictNumericEscape),unterminated:(e,t,s)=>{throw this.raise(p.UnterminatedTemplate,buildPosition(e,t,s))}});this.state=new State;this.state.init(e);this.input=t;this.length=t.length;this.comments=[];this.isLookahead=false}pushToken(e){this.tokens.length=this.state.tokensLength;this.tokens.push(e);++this.state.tokensLength}next(){this.checkKeywordEscapes();if(this.optionFlags&256){this.pushToken(new Token(this.state))}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){W.lastIndex=e;return W.test(this.input)?W.lastIndex:e}lookaheadCharCode(){return this.lookaheadCharCodeSince(this.state.pos)}lookaheadCharCodeSince(e){return this.input.charCodeAt(this.nextTokenStartSince(e))}nextTokenInLineStart(){return this.nextTokenInLineStartSince(this.state.pos)}nextTokenInLineStartSince(e){J.lastIndex=e;return J.test(this.input)?J.lastIndex:e}lookaheadInLineCharCode(){return this.input.charCodeAt(this.nextTokenInLineStart())}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,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(140);return}this.getTokenFromCode(this.codePointAtPos(this.state.pos))}skipBlockComment(e){let t;if(!this.isLookahead)t=this.state.curPosition();const s=this.state.pos;const i=this.input.indexOf(e,s+2);if(i===-1){throw this.raise(p.UnterminatedComment,this.state.curPosition())}this.state.pos=i+e.length;$.lastIndex=s+2;while($.test(this.input)&&$.lastIndex<=i){++this.state.curLine;this.state.lineStart=$.lastIndex}if(this.isLookahead)return;const r={type:"CommentBlock",value:this.input.slice(s+2,i),start:this.sourceToOffsetPos(s),end:this.sourceToOffsetPos(i+e.length),loc:new SourceLocation(t,this.state.curPosition())};if(this.optionFlags&256)this.pushToken(r);return r}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:this.sourceToOffsetPos(t),end:this.sourceToOffsetPos(r),loc:new SourceLocation(s,this.state.curPosition())};if(this.optionFlags&256)this.pushToken(n);return n}skipSpace(){const e=this.state.pos;const t=this.optionFlags&4096?[]:null;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);t==null||t.push(e)}break}case 47:{const e=this.skipLineComment(2);if(e!==undefined){this.addComment(e);t==null||t.push(e)}break}default:break e}break;default:if(isWhitespace(s)){++this.state.pos}else if(s===45&&!this.inModule&&this.optionFlags&8192){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);t==null||t.push(e)}}else{break e}}else if(s===60&&!this.inModule&&this.optionFlags&8192){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);t==null||t.push(e)}}else{break e}}else{break e}}}if((t==null?void 0:t.length)>0){const s=this.state.pos;const i={start:this.sourceToOffsetPos(e),end:this.sourceToOffsetPos(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(p.UnexpectedDigitAfterHash,this.state.curPosition())}if(t===123||t===91&&this.hasPlugin("recordAndTuple")){this.expectPlugin("recordAndTuple");if(this.getPluginOption("recordAndTuple","syntaxType")==="bar"){throw this.raise(t===123?p.RecordExpressionHashIncorrectStartSyntaxType:p.TupleExpressionHashIncorrectStartSyntaxType,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(139,this.readWord1(t))}else if(t===92){++this.state.pos;this.finishToken(139,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(p.RecordExpressionBarIncorrectEndSyntaxType,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(p.TupleExpressionBarIncorrectEndSyntaxType,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){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(p.TupleExpressionBarIncorrectStartSyntaxType,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(p.RecordExpressionBarIncorrectStartSyntaxType,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(p.InvalidOrUnexpectedToken,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(p.UnterminatedRegExp,createPositionWithColumnOffset(e,1))}const t=this.input.charCodeAt(r);if(isNewLine(t)){throw this.raise(p.UnterminatedRegExp,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 n="";const nextPos=()=>createPositionWithColumnOffset(e,r+2-t);while(r<this.length){const e=this.codePointAtPos(r);const t=String.fromCharCode(e);if(Z.has(e)){if(e===118){if(n.includes("u")){this.raise(p.IncompatibleRegExpUVFlags,nextPos())}}else if(e===117){if(n.includes("v")){this.raise(p.IncompatibleRegExpUVFlags,nextPos())}}if(n.includes(t)){this.raise(p.DuplicateRegExpFlags,nextPos())}}else if(isIdentifierChar(e)||e===92){this.raise(p.MalformedRegExpFlags,nextPos())}else{break}++r;n+=t}this.state.pos=r;this.finishToken(138,{pattern:a,flags:n})}readInt(e,t,s=false,i=true){const{n:r,pos:a}=readInt(this.input,this.state.pos,this.state.lineStart,this.state.curLine,e,t,s,i,this.errorHandlers_readInt,false);this.state.pos=a;return r}readRadixNumber(e){const t=this.state.pos;const s=this.state.curPosition();let i=false;this.state.pos+=2;const r=this.readInt(e);if(r==null){this.raise(p.InvalidDigit,createPositionWithColumnOffset(s,2),{radix:e})}const a=this.input.charCodeAt(this.state.pos);if(a===110){++this.state.pos;i=true}else if(a===109){throw this.raise(p.InvalidDecimal,s)}if(isIdentifierStart(this.codePointAtPos(this.state.pos))){throw this.raise(p.NumberIdentifier,this.state.curPosition())}if(i){const e=this.input.slice(t,this.state.pos).replace(/[_n]/g,"");this.finishToken(136,e);return}this.finishToken(135,r)}readNumber(e){const t=this.state.pos;const s=this.state.curPosition();let i=false;let r=false;let a=false;let n=false;if(!e&&this.readInt(10)===null){this.raise(p.InvalidNumber,this.state.curPosition())}const o=this.state.pos-t>=2&&this.input.charCodeAt(t)===48;if(o){const e=this.input.slice(t,this.state.pos);this.recordStrictModeErrors(p.StrictOctalLiteral,s);if(!this.state.strict){const t=e.indexOf("_");if(t>0){this.raise(p.ZeroDigitNumericSeparator,createPositionWithColumnOffset(s,t))}}n=o&&!/[89]/.test(e)}let h=this.input.charCodeAt(this.state.pos);if(h===46&&!n){++this.state.pos;this.readInt(10);i=true;h=this.input.charCodeAt(this.state.pos)}if((h===69||h===101)&&!n){h=this.input.charCodeAt(++this.state.pos);if(h===43||h===45){++this.state.pos}if(this.readInt(10)===null){this.raise(p.InvalidOrMissingExponent,s)}i=true;a=true;h=this.input.charCodeAt(this.state.pos)}if(h===110){if(i||o){this.raise(p.InvalidBigIntLiteral,s)}++this.state.pos;r=true}if(h===109){this.expectPlugin("decimal",this.state.curPosition());if(a||o){this.raise(p.InvalidDecimal,s)}++this.state.pos;var l=true}if(isIdentifierStart(this.codePointAtPos(this.state.pos))){throw this.raise(p.NumberIdentifier,this.state.curPosition())}const c=this.input.slice(t,this.state.pos).replace(/[_mn]/g,"");if(r){this.finishToken(136,c);return}if(l){this.finishToken(137,c);return}const u=n?parseInt(c,8):parseFloat(c);this.finishToken(135,u)}readCodePoint(e){const{code:t,pos:s}=readCodePoint(this.input,this.state.pos,this.state.lineStart,this.state.curLine,e,this.errorHandlers_readCodePoint);this.state.pos=s;return t}readString(e){const{str:t,pos:s,curLine:i,lineStart:r}=readStringContents(e===34?"double":"single",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_string);this.state.pos=s+1;this.state.lineStart=r;this.state.curLine=i;this.finishToken(134,t)}readTemplateContinuation(){if(!this.match(8)){this.unexpected(null,8)}this.state.pos--;this.readTemplateToken()}readTemplateToken(){const e=this.input[this.state.pos];const{str:t,firstInvalidLoc:s,pos:i,curLine:r,lineStart:a}=readStringContents("template",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_template);this.state.pos=i+1;this.state.lineStart=a;this.state.curLine=r;if(s){this.state.firstInvalidTemplateEscapePos=new Position(s.curLine,s.pos-s.lineStart,this.sourceToOffsetPos(s.pos))}if(this.input.codePointAt(i)===96){this.finishToken(24,s?null:e+t+"`")}else{this.state.pos++;this.finishToken(25,s?null:e+t+"${")}}recordStrictModeErrors(e,t){const s=t.index;if(this.state.strict&&!this.state.strictErrors.has(s)){this.raise(e,t)}else{this.state.strictErrors.set(s,[e,t])}}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(p.MissingUnicodeEscape,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(p.EscapedCharNotAnIdentifier,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=T.get(t);if(s!==undefined){this.finishToken(s,tokenLabelName(s))}else{this.finishToken(132,t)}}checkKeywordEscapes(){const{type:e}=this.state;if(tokenIsKeyword(e)&&this.state.containsEsc){this.raise(p.InvalidEscapedReservedWord,this.state.startLoc,{reservedWord:tokenLabelName(e)})}}raise(e,t,s={}){const i=t instanceof Position?t:t.loc.start;const r=e(i,s);if(!(this.optionFlags&2048))throw r;if(!this.isLookahead)this.state.errors.push(r);return r}raiseOverwrite(e,t,s={}){const i=t instanceof Position?t:t.loc.start;const r=i.index;const a=this.state.errors;for(let t=a.length-1;t>=0;t--){const n=a[t];if(n.loc.index===r){return a[t]=e(i,s)}if(n.loc.index<r)break}return this.raise(e,t,s)}updateContext(e){}unexpected(e,t){throw this.raise(p.UnexpectedToken,e!=null?e:this.state.startLoc,{expected:t?tokenLabelName(t):null})}expectPlugin(e,t){if(this.hasPlugin(e)){return true}throw this.raise(p.MissingPlugin,t!=null?t:this.state.startLoc,{missingPlugin:[e]})}expectOnePlugin(e){if(!e.some((e=>this.hasPlugin(e)))){throw this.raise(p.MissingOneOfPlugins,this.state.startLoc,{missingPlugin:e})}}errorBuilder(e){return(t,s,i)=>{this.raise(e,buildPosition(t,s,i))}}}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(p.InvalidPrivateFieldResolution,i,{identifierName:s})}}}declarePrivateName(e,t,s){const{privateNames:i,loneAccessors:r,undefinedPrivateNames:a}=this.current();let n=i.has(e);if(t&3){const s=n&&r.get(e);if(s){const i=s&4;const a=t&4;const o=s&3;const h=t&3;n=o===h||i!==a;if(!n)r.delete(e)}else if(!n){r.set(e,t)}}if(n){this.parser.raise(p.PrivateNameRedeclaration,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(p.InvalidPrivateFieldResolution,t,{identifierName:e})}}}class ExpressionScope{constructor(e=0){this.type=e}canBeArrowParameterDeclaration(){return this.type===2||this.type===1}isCertainlyParameterDeclaration(){return this.type===3}}class ArrowHeadParsingScope extends ExpressionScope{constructor(e){super(e);this.declarationErrors=new Map}recordDeclarationError(e,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,t){const s=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)}recordArrowParameterBindingError(e,t){const{stack:s}=this;const i=s[s.length-1];const r=t.loc.start;if(i.isCertainlyParameterDeclaration()){this.parser.raise(e,r)}else if(i.canBeArrowParameterDeclaration()){i.recordDeclarationError(e,r)}else{return}}recordAsyncArrowParametersError(e){const{stack:t}=this;let s=t.length-1;let i=t[s];while(i.canBeArrowParameterDeclaration()){if(i.type===2){i.recordDeclarationError(p.AwaitBindingIdentifier,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,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(3)}function newArrowHeadScope(){return new ArrowHeadParsingScope(1)}function newAsyncArrowScope(){return new ArrowHeadParsingScope(2)}function newExpressionScope(){return new ExpressionScope}class UtilParser extends Tokenizer{addExtra(e,t,s,i=true){if(!e)return;let{extra:r}=e;if(r==null){r={};e.extra=r}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,this.state.startLoc)}this.unexpected(null,e)}}canInsertSemicolon(){return this.match(140)||this.match(8)||this.hasPrecedingLineBreak()}hasPrecedingLineBreak(){return hasNewLine(this.input,this.offsetToSourcePos(this.state.lastTokEndLoc.index),this.state.start)}hasFollowingLineBreak(){return hasNewLine(this.input,this.state.end,this.nextTokenStart())}isLineTerminator(){return this.eat(13)||this.canInsertSemicolon()}semicolon(e=true){if(e?this.isLineTerminator():this.eat(13))return;this.raise(p.MissingSemicolon,this.state.lastTokEndLoc)}expect(e,t){if(!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 n=!!s||!!i||!!a||!!r;if(!t){return n}if(s!=null){this.raise(p.InvalidCoverInitializedName,s)}if(i!=null){this.raise(p.DuplicateProto,i)}if(r!=null){this.raise(p.UnexpectedPrivateField,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)}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=0;if(this.inModule){e|=2}if(this.optionFlags&32){e|=1}this.scope.enter(1);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?void 0:e.optionFlags)&128)this.range=[t,0];if(e!=null&&e.filename)this.loc.filename=e.filename}}const ee=Node.prototype;{ee.__clone=function(){const e=new Node(undefined,this.start,this.loc.start);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}}class NodeUtils extends UtilParser{startNode(){const e=this.state.startLoc;return new Node(this,e.index,e)}startNodeAt(e){return new Node(this,e.index,e)}startNodeAtNode(e){return this.startNodeAt(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.optionFlags&128)e.range[1]=s.index;if(this.optionFlags&4096){this.processComment(e)}return e}resetStartLocation(e,t){e.start=t.index;e.loc.start=t;if(this.optionFlags&128)e.range[0]=t.index}resetEndLocation(e,t=this.state.lastTokEndLoc){e.end=t.index;e.loc.end=t;if(this.optionFlags&128)e.range[1]=t.index}resetStartLocationFromNode(e,t){this.resetStartLocation(e,t.loc.start)}castNodeTo(e,t){e.type=t;return e}cloneIdentifier(e){const{type:t,start:s,end:i,loc:r,range:a,name:n}=e;const o=Object.create(ee);o.type=t;o.start=s;o.end=i;o.loc=r;o.range=a;o.name=n;if(e.extra)o.extra=e.extra;return o}cloneStringLiteral(e){const{type:t,start:s,end:i,loc:r,range:a,extra:n}=e;const o=Object.create(ee);o.type=t;o.start=s;o.end=i;o.loc=r;o.range=a;o.extra=n;o.value=e.value;return o}}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.recordArrowParameterBindingError(p.InvalidParenthesizedAssignment,e)}else if(r.type!=="MemberExpression"&&!this.isOptionalMemberExpression(r)){this.raise(p.InvalidParenthesizedAssignment,e)}}else{this.raise(p.InvalidParenthesizedAssignment,e)}}switch(e.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":this.castNodeTo(e,"ObjectPattern");for(let s=0,i=e.properties.length,r=i-1;s<i;s++){var a;const i=e.properties[s];const n=s===r;this.toAssignableObjectExpressionProp(i,n,t);if(n&&i.type==="RestElement"&&(a=e.extra)!=null&&a.trailingCommaLoc){this.raise(p.RestTrailingComma,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":this.castNodeTo(e,"ArrayPattern");this.toAssignableList(e.elements,(i=e.extra)==null?void 0:i.trailingCommaLoc,t);break;case"AssignmentExpression":if(e.operator!=="="){this.raise(p.MissingEqInAssignment,e.left.loc.end)}this.castNodeTo(e,"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"?p.PatternHasAccessor:p.PatternHasMethod,e.key)}else if(e.type==="SpreadElement"){this.castNodeTo(e,"RestElement");const i=e.argument;this.checkToRestConversion(i,false);this.toAssignable(i,s);if(!t){this.raise(p.RestTrailingComma,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;this.toAssignableListItem(e,r,s);if(a.type==="RestElement"){if(r<i){this.raise(p.RestTrailingComma,a)}else if(t){this.raise(p.RestTrailingComma,t)}}}}toAssignableListItem(e,t,s){const i=e[t];if(i.type==="SpreadElement"){this.castNodeTo(i,"RestElement");const e=i.argument;this.checkToRestConversion(e,true);this.toAssignable(e,s)}else{this.toAssignable(i,s)}}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){const t=this.startNode();this.next();t.argument=this.parseMaybeAssignAllowIn(e,undefined);return this.finishNode(t,"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,1);return this.finishNode(e,"ArrayPattern")}case 5:return this.parseObjectLike(8,true)}return this.parseIdentifier()}parseBindingList(e,t,s){const i=s&1;const r=[];let a=true;while(!this.eat(e)){if(a){a=false}else{this.expect(12)}if(i&&this.match(12)){r.push(null)}else if(this.eat(e)){break}else if(this.match(21)){let i=this.parseRestBinding();if(this.hasPlugin("flow")||s&2){i=this.parseFunctionParamType(i)}r.push(i);if(!this.checkCommaAfterRest(t)){this.expect(e);break}}else{const e=[];if(s&2){if(this.match(26)&&this.hasPlugin("decorators")){this.raise(p.UnsupportedParameterDecorator,this.state.startLoc)}while(this.match(26)){e.push(this.parseDecorator())}}r.push(this.parseBindingElement(s,e))}}return r}parseBindingRestProperty(e){this.next();e.argument=this.parseIdentifier();this.checkCommaAfterRest(125);return this.finishNode(e,"RestElement")}parseBindingProperty(){const{type:e,startLoc:t}=this.state;if(e===21){return this.parseBindingRestProperty(this.startNode())}const s=this.startNode();if(e===139){this.expectPlugin("destructuringPrivate",t);this.classScope.usePrivateName(this.state.value,t);s.key=this.parsePrivateName()}else{this.parsePropertyName(s)}s.method=false;return this.parseObjPropValue(s,t,false,false,true,false)}parseBindingElement(e,t){const s=this.parseMaybeDefault();if(this.hasPlugin("flow")||e&2){this.parseFunctionParamType(s)}if(t.length){s.decorators=t;this.resetStartLocationFromNode(s,t[0])}const i=this.parseMaybeDefault(s.loc.start,s);return i}parseFunctionParamType(e){return e}parseMaybeDefault(e,t){e!=null?e:e=this.state.startLoc;t=t!=null?t:this.parseBindingAtom();if(!this.eat(29))return t;const s=this.startNodeAt(e);s.left=t;s.right=this.parseMaybeAssignAllowIn();return this.finishNode(s,"AssignmentPattern")}isValidLVal(e,t,s){switch(e){case"AssignmentPattern":return"left";case"RestElement":return"argument";case"ObjectProperty":return"value";case"ParenthesizedExpression":return"expression";case"ArrayPattern":return"elements";case"ObjectPattern":return"properties"}return false}isOptionalMemberExpression(e){return e.type==="OptionalMemberExpression"}checkLVal(e,t,s=64,i=false,r=false,a=false){var n;const o=e.type;if(this.isObjectMethod(e))return;const h=this.isOptionalMemberExpression(e);if(h||o==="MemberExpression"){if(h){this.expectPlugin("optionalChainingAssign",e.loc.start);if(t.type!=="AssignmentExpression"){this.raise(p.InvalidLhsOptionalChaining,e,{ancestor:t})}}if(s!==64){this.raise(p.InvalidPropertyBindingPattern,e)}return}if(o==="Identifier"){this.checkIdentifier(e,s,r);const{name:t}=e;if(i){if(i.has(t)){this.raise(p.ParamDupe,e)}else{i.add(t)}}return}const l=this.isValidLVal(o,!(a||(n=e.extra)!=null&&n.parenthesized)&&t.type==="AssignmentExpression",s);if(l===true)return;if(l===false){const i=s===64?p.InvalidLhs:p.InvalidLhsBinding;this.raise(i,e,{ancestor:t});return}let c,u;if(typeof l==="string"){c=l;u=o==="ParenthesizedExpression"}else{[c,u]=l}const d=o==="ArrayPattern"||o==="ObjectPattern"?{type:o}:t;const f=e[c];if(Array.isArray(f)){for(const e of f){if(e){this.checkLVal(e,d,s,i,r,u)}}}else if(f){this.checkLVal(f,d,s,i,r,u)}}checkIdentifier(e,t,s=false){if(this.state.strict&&(s?isStrictBindReservedWord(e.name,this.inModule):isStrictBindOnlyReservedWord(e.name))){if(t===64){this.raise(p.StrictEvalArguments,e,{referenceName:e.name})}else{this.raise(p.StrictEvalArgumentsBinding,e,{bindingName:e.name})}}if(t&8192&&e.name==="let"){this.raise(p.LetInLexicalBinding,e)}if(!(t&64)){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(p.InvalidRestAssignmentPattern,e)}}checkCommaAfterRest(e){if(!this.match(12)){return false}this.raise(this.lookaheadCharCode()===e?p.RestTrailingComma:p.ElementAfterRest,this.state.startLoc);return true}}function nonNull(e){if(e==null){throw new Error(`Unexpected ${e} value.`)}return e}function assert(e){if(!e){throw new Error("Assert fail")}}const te=ParseErrorEnum`typescript`({AbstractMethodHasImplementation:({methodName:e})=>`Method '${e}' cannot have an implementation because it is marked abstract.`,AbstractPropertyHasInitializer:({propertyName:e})=>`Property '${e}' cannot have an initializer because it is marked abstract.`,AccessorCannotBeOptional:"An 'accessor' property cannot be declared optional.",AccessorCannotDeclareThisParameter:"'get' and 'set' accessors cannot declare 'this' parameters.",AccessorCannotHaveTypeParameters:"An accessor cannot have type parameters.",ClassMethodHasDeclare:"Class methods cannot have the 'declare' modifier.",ClassMethodHasReadonly:"Class methods cannot have the 'readonly' modifier.",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",ConstructorHasTypeParameters:"Type parameters cannot appear on a constructor declaration.",DeclareAccessor:({kind:e})=>`'declare' is not allowed in ${e}ters.`,DeclareClassFieldHasInitializer:"Initializers are not allowed in ambient contexts.",DeclareFunctionHasImplementation:"An implementation cannot be declared in ambient contexts.",DuplicateAccessibilityModifier:({modifier:e})=>`Accessibility modifier already seen: '${e}'.`,DuplicateModifier:({modifier:e})=>`Duplicate modifier: '${e}'.`,EmptyHeritageClauseType:({token:e})=>`'${e}' list cannot be empty.`,EmptyTypeArguments:"Type argument list cannot be empty.",EmptyTypeParameters:"Type parameter list cannot be empty.",ExpectedAmbientAfterExportDeclare:"'export declare' must be followed by an ambient declaration.",ImportAliasHasImportType:"An import alias can not use 'import type'.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` modifier",IncompatibleModifiers:({modifiers:e})=>`'${e[0]}' modifier cannot be used with '${e[1]}' modifier.`,IndexSignatureHasAbstract:"Index signatures cannot have the 'abstract' modifier.",IndexSignatureHasAccessibility:({modifier:e})=>`Index signatures cannot have an accessibility modifier ('${e}').`,IndexSignatureHasDeclare:"Index signatures cannot have the 'declare' modifier.",IndexSignatureHasOverride:"'override' modifier cannot appear on an index signature.",IndexSignatureHasStatic:"Index signatures cannot have the 'static' modifier.",InitializerNotAllowedInAmbientContext:"Initializers are not allowed in ambient contexts.",InvalidHeritageClauseType:({token:e})=>`'${e}' list can only include identifiers or qualified-names with optional type arguments.`,InvalidModifierOnAwaitUsingDeclaration:e=>`'${e}' modifier cannot appear on an await using declaration.`,InvalidModifierOnTypeMember:({modifier:e})=>`'${e}' modifier cannot appear on a type member.`,InvalidModifierOnTypeParameter:({modifier:e})=>`'${e}' modifier cannot appear on a type parameter.`,InvalidModifierOnTypeParameterPositions:({modifier:e})=>`'${e}' modifier can only appear on a type parameter of a class, interface or type alias.`,InvalidModifierOnUsingDeclaration:e=>`'${e}' modifier cannot appear on a using declaration.`,InvalidModifiersOrder:({orderedModifiers:e})=>`'${e[0]}' modifier must precede '${e[1]}' modifier.`,InvalidPropertyAccessAfterInstantiationExpression:"Invalid property access after an instantiation expression. "+"You can either wrap the instantiation expression in parentheses, or delete the type arguments.",InvalidTupleMemberLabel:"Tuple members must be labeled with a simple identifier.",MissingInterfaceName:"'interface' declarations must be followed by an identifier.",NonAbstractClassHasAbstractMethod:"Abstract methods can only appear within an abstract class.",NonClassMethodPropertyHasAbstractModifier:"'abstract' modifier can only appear on a class, method, or property declaration.",OptionalTypeBeforeRequired:"A required element cannot follow an optional element.",OverrideNotInSubClass:"This member cannot have an 'override' modifier because its containing class does not extend another class.",PatternIsOptional:"A binding pattern parameter cannot be optional in an implementation signature.",PrivateElementHasAbstract:"Private elements cannot have the 'abstract' modifier.",PrivateElementHasAccessibility:({modifier:e})=>`Private elements cannot have an accessibility modifier ('${e}').`,ReadonlyForMethodSignature:"'readonly' modifier can only appear on a property declaration or index signature.",ReservedArrowTypeParam:"This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.",ReservedTypeAssertion:"This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",SetAccessorCannotHaveOptionalParameter:"A 'set' accessor cannot have an optional parameter.",SetAccessorCannotHaveRestParameter:"A 'set' accessor cannot have rest parameter.",SetAccessorCannotHaveReturnType:"A 'set' accessor cannot have a return type annotation.",SingleTypeParameterWithoutTrailingComma:({typeParameterName:e})=>`Single type parameter ${e} should have a trailing comma. Example usage: <${e},>.`,StaticBlockCannotHaveModifier:"Static class blocks cannot have any modifier.",TupleOptionalAfterType:"A labeled tuple optional element must be declared using a question mark after the name and before the colon (`name?: type`), rather than after the type (`name: type?`).",TypeAnnotationAfterAssign:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeImportCannotSpecifyDefaultAndNamed:"A type-only import can specify a default import or named bindings, but not both.",TypeModifierIsUsedInTypeExports:"The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",TypeModifierIsUsedInTypeImports:"The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",UnexpectedParameterModifier:"A parameter property is only allowed in a constructor implementation.",UnexpectedReadonly:"'readonly' type modifier is only permitted on array and tuple literal types.",UnexpectedTypeAnnotation:"Did not expect a type annotation here.",UnexpectedTypeCastInParameter:"Unexpected type cast in parameter position.",UnsupportedImportTypeArgument:"Argument in a type import must be a string literal.",UnsupportedParameterPropertyKind:"A parameter property may not be declared using a binding pattern.",UnsupportedSignatureParameterKind:({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 TypeScriptParserMixin extends e{constructor(...e){super(...e);this.tsParseInOutModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:["in","out"],disallowedModifiers:["const","public","private","protected","readonly","declare","abstract","override"],errorTemplate:te.InvalidModifierOnTypeParameter});this.tsParseConstModifier=this.tsParseModifiers.bind(this,{allowedModifiers:["const"],disallowedModifiers:["in","out"],errorTemplate:te.InvalidModifierOnTypeParameterPositions});this.tsParseInOutConstModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:["in","out","const"],disallowedModifiers:["public","private","protected","readonly","declare","abstract","override"],errorTemplate:te.InvalidModifierOnTypeParameter})}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(139)||this.isLiteralPropertyName()}tsNextTokenOnSameLineAndCanFollowModifier(){this.next();if(this.hasPrecedingLineBreak()){return false}return this.tsTokenCanFollowModifier()}tsNextTokenCanFollowModifier(){if(this.match(106)){this.next();return this.tsTokenCanFollowModifier()}return this.tsNextTokenOnSameLineAndCanFollowModifier()}tsParseModifier(e,t,s){if(!tokenIsIdentifier(this.state.type)&&this.state.type!==58&&this.state.type!==75){return undefined}const i=this.state.value;if(e.includes(i)){if(s&&this.match(106)){return undefined}if(t&&this.tsIsStartOfStaticBlocks()){return undefined}if(this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this))){return i}}return undefined}tsParseModifiers({allowedModifiers:e,disallowedModifiers:t,stopOnStartOfClassStaticBlock:s,errorTemplate:i=te.InvalidModifierOnTypeMember},r){const enforceOrder=(e,t,s,i)=>{if(t===s&&r[i]){this.raise(te.InvalidModifiersOrder,e,{orderedModifiers:[s,i]})}};const incompatible=(e,t,s,i)=>{if(r[s]&&t===i||r[i]&&t===s){this.raise(te.IncompatibleModifiers,e,{modifiers:[s,i]})}};for(;;){const{startLoc:a}=this.state;const n=this.tsParseModifier(e.concat(t!=null?t:[]),s,r.static);if(!n)break;if(tsIsAccessModifier(n)){if(r.accessibility){this.raise(te.DuplicateAccessibilityModifier,a,{modifier:n})}else{enforceOrder(a,n,n,"override");enforceOrder(a,n,n,"static");enforceOrder(a,n,n,"readonly");r.accessibility=n}}else if(tsIsVarianceAnnotations(n)){if(r[n]){this.raise(te.DuplicateModifier,a,{modifier:n})}r[n]=true;enforceOrder(a,n,"in","out")}else{if(hasOwnProperty.call(r,n)){this.raise(te.DuplicateModifier,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")}r[n]=true}if(t!=null&&t.includes(n)){this.raise(i,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)}}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.lastTokStartLoc.index;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(134)){this.raise(te.UnsupportedImportTypeArgument,this.state.startLoc);{e.argument=super.parseExprAtom()}}else{{e.argument=this.parseStringLiteral(this.state.value)}}if(this.eat(12)){e.options=this.tsParseImportTypeOptions()}else{e.options=null}this.expect(11);if(this.eat(16)){e.qualifier=this.tsParseEntityName(1|2)}if(this.match(47)){{e.typeParameters=this.tsParseTypeArguments()}}return this.finishNode(e,"TSImportType")}tsParseImportTypeOptions(){const e=this.startNode();this.expect(5);const t=this.startNode();if(this.isContextual(76)){t.method=false;t.key=this.parseIdentifier(true);t.computed=false;t.shorthand=false}else{this.unexpected(null,76)}this.expect(14);t.value=this.tsParseImportTypeWithPropertyValue();e.properties=[this.finishObjectProperty(t)];this.expect(8);return this.finishNode(e,"ObjectExpression")}tsParseImportTypeWithPropertyValue(){const e=this.startNode();const t=[];this.expect(5);while(!this.match(8)){const e=this.state.type;if(tokenIsIdentifier(e)||e===134){t.push(super.parsePropertyDefinition(null))}else{this.unexpected()}this.eat(12)}e.properties=t;this.next();return this.finishNode(e,"ObjectExpression")}tsParseEntityName(e){let t;if(e&1&&this.match(78)){if(e&2){t=this.parseIdentifier(true)}else{const e=this.startNode();this.next();t=this.finishNode(e,"ThisExpression")}}else{t=this.parseIdentifier(!!(e&1))}while(this.eat(16)){const s=this.startNodeAtNode(t);s.left=t;s.right=this.parseIdentifier(!!(e&1));t=this.finishNode(s,"TSQualifiedName")}return t}tsParseTypeReference(){const e=this.startNode();e.typeName=this.tsParseEntityName(1);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(1|2)}}if(!this.hasPrecedingLineBreak()&&this.match(47)){{e.typeParameters=this.tsParseTypeArguments()}}return this.finishNode(e,"TSTypeQuery")}tsParseTypeParameter(e){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(143)){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(te.EmptyTypeParameters,t)}if(s.value!==-1){this.addExtra(t,"trailingComma",s.value)}return this.finishNode(t,"TSTypeParameterDeclaration")}tsFillSignature(e,t){const s=e===19;const i="parameters";const r="typeAnnotation";t.typeParameters=this.tsTryParseTypeParameters(this.tsParseConstModifier);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(){const e=super.parseBindingList(11,41,2);for(const t of e){const{type:e}=t;if(e==="AssignmentPattern"||e==="TSParameterProperty"){this.raise(te.UnsupportedSignatureParameterKind,t,{type:e})}}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}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;if(this.match(10)||this.match(47)){if(t){this.raise(te.ReadonlyForMethodSignature,e)}const s=e;if(s.kind&&this.match(47)){this.raise(te.AccessorCannotHaveTypeParameters,this.state.curPosition())}this.tsFillSignature(14,s);this.tsParseTypeMemberSemicolon();const i="parameters";const r="typeAnnotation";if(s.kind==="get"){if(s[i].length>0){this.raise(p.BadGetterArity,this.state.curPosition());if(this.isThisParam(s[i][0])){this.raise(te.AccessorCannotDeclareThisParameter,this.state.curPosition())}}}else if(s.kind==="set"){if(s[i].length!==1){this.raise(p.BadSetterArity,this.state.curPosition())}else{const e=s[i][0];if(this.isThisParam(e)){this.raise(te.AccessorCannotDeclareThisParameter,this.state.curPosition())}if(e.type==="Identifier"&&e.optional){this.raise(te.SetAccessorCannotHaveOptionalParameter,this.state.curPosition())}if(e.type==="RestElement"){this.raise(te.SetAccessorCannotHaveRestParameter,this.state.curPosition())}}if(s[r]){this.raise(te.SetAccessorCannotHaveReturnType,s[r])}}else{s.kind="method"}return this.finishNode(s,"TSMethodSignature")}else{const s=e;if(t)s.readonly=true;const i=this.tsTryParseTypeAnnotation();if(i)s.typeAnnotation=i;this.tsParseTypeMemberSemicolon();return this.finishNode(s,"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({allowedModifiers:["readonly"],disallowedModifiers:["declare","abstract","private","protected","public","static","override"]},e);const t=this.tsTryParseIndexSignature(e);if(t){return t}super.parsePropertyName(e);if(!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.tsTokenCanFollowModifier()){e.kind=e.key.name;super.parsePropertyName(e);if(!this.match(10)&&!this.match(47)){this.unexpected(null,10)}}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(122)}if(this.isContextual(122)){this.next()}if(!this.match(0)){return false}this.next();if(!this.tsIsIdentifier()){return false}this.next();return this.match(58)}tsParseMappedType(){const e=this.startNode();this.expect(5);if(this.match(53)){e.readonly=this.state.value;this.next();this.expectContextual(122)}else if(this.eatContextual(122)){e.readonly=true}this.expect(0);{const t=this.startNode();t.name=this.tsParseTypeParameterName();t.constraint=this.tsExpectThenParseType(58);e.typeParameter=this.finishNode(t,"TSTypeParameter")}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;e.elementTypes.forEach((e=>{const{type:s}=e;if(t&&s!=="TSRestType"&&s!=="TSOptionalType"&&!(s==="TSNamedTupleMember"&&e.optional)){this.raise(te.OptionalTypeBeforeRequired,e)}t||(t=s==="TSNamedTupleMember"&&e.optional||s==="TSOptionalType")}));return this.finishNode(e,"TSTupleType")}tsParseTupleElementType(){const e=this.state.startLoc;const t=this.eat(21);const{startLoc:s}=this.state;let i;let r;let a;let n;const o=tokenIsKeywordOrIdentifier(this.state.type);const h=o?this.lookaheadCharCode():null;if(h===58){i=true;a=false;r=this.parseIdentifier(true);this.expect(14);n=this.tsParseType()}else if(h===63){a=true;const e=this.state.value;const t=this.tsParseNonArrayType();if(this.lookaheadCharCode()===58){i=true;r=this.createIdentifier(this.startNodeAt(s),e);this.expect(17);this.expect(14);n=this.tsParseType()}else{i=false;n=t;this.expect(17)}}else{n=this.tsParseType();a=this.eat(17);i=this.eat(14)}if(i){let e;if(r){e=this.startNodeAt(s);e.optional=a;e.label=r;e.elementType=n;if(this.eat(17)){e.optional=true;this.raise(te.TupleOptionalAfterType,this.state.lastTokStartLoc)}}else{e=this.startNodeAt(s);e.optional=a;this.raise(te.InvalidTupleMemberLabel,n);e.label=n;e.elementType=this.tsParseType()}n=this.finishNode(e,"TSNamedTupleMember")}else if(a){const e=this.startNodeAt(s);e.typeAnnotation=n;n=this.finishNode(e,"TSOptionalType")}if(t){const t=this.startNodeAt(e);t.typeAnnotation=n;n=this.finishNode(t,"TSRestType")}return n}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();switch(this.state.type){case 135:case 136:case 134:case 85:case 86:e.literal=super.parseExprAtom();break;default:this.unexpected()}return this.finishNode(e,"TSLiteralType")}tsParseTemplateLiteralType(){{const e=this.startNode();e.literal=super.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(116)&&!this.hasPrecedingLineBreak()){return this.tsParseThisTypePredicate(e)}else{return e}}tsParseNonArrayType(){switch(this.state.type){case 134:case 135:case 136:case 85:case 86:return this.tsParseLiteralTypeNode();case 53:if(this.state.value==="-"){const e=this.startNode();const t=this.lookahead();if(t.type!==135&&t.type!==136){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()}}}this.unexpected()}tsParseArrayTypeOrHigher(){const{startLoc:e}=this.state;let t=this.tsParseNonArrayType();while(!this.hasPrecedingLineBreak()&&this.eat(0)){if(this.match(3)){const s=this.startNodeAt(e);s.elementType=t;this.expect(3);t=this.finishNode(s,"TSArrayType")}else{const s=this.startNodeAt(e);s.objectType=t;s.indexType=this.tsParseType();this.expect(3);t=this.finishNode(s,"TSIndexedAccessType")}}return t}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(te.UnexpectedReadonly,e)}}tsParseInferType(){const e=this.startNode();this.expectContextual(115);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(115)?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{super.parseBindingList(3,93,1);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(){if(this.match(14)){return this.tsParseTypeOrTypePredicateAnnotation(14)}}tsTryParseTypeAnnotation(){if(this.match(14)){return this.tsParseTypeAnnotation()}}tsTryParseType(){return this.tsEatThenParseType(14)}tsParseTypePredicatePrefix(){const e=this.parseIdentifier();if(this.isContextual(116)&&!this.hasPrecedingLineBreak()){this.next();return e}}tsParseTypePredicateAsserts(){if(this.state.type!==109){return false}const e=this.state.containsEsc;this.next();if(!tokenIsIdentifier(this.state.type)&&!this.match(78)){return false}if(e){this.raise(p.InvalidEscapedReservedWord,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(124)&&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(te.ReservedTypeAssertion,this.state.startLoc)}const e=this.startNode();e.typeAnnotation=this.tsInType((()=>{this.next();return this.match(75)?this.tsParseTypeReference():this.tsParseType()}));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(1|2);if(this.match(47)){e.typeParameters=this.tsParseTypeArguments()}return this.finishNode(e,"TSExpressionWithTypeArguments")}}));if(!s.length){this.raise(te.EmptyHeritageClauseType,t,{token:e})}return s}tsParseInterfaceDeclaration(e,t={}){if(this.hasFollowingLineBreak())return null;this.expectContextual(129);if(t.declare)e.declare=true;if(tokenIsIdentifier(this.state.type)){e.id=this.parseIdentifier();this.checkIdentifier(e.id,130)}else{e.id=null;this.raise(te.MissingInterfaceName,this.state.startLoc)}e.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);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,2);e.typeAnnotation=this.tsInType((()=>{e.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutModifiers);this.expect(29);if(this.isContextual(114)&&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")}tsInTopLevelContext(e){if(this.curContext()!==d.brace){const t=this.state.context;this.state.context=[t[0]];try{return e()}finally{this.state.context=t}}else{return e()}}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){if(this.match(e)){return this.tsNextThenParseType()}}tsExpectThenParseType(e){return this.tsInType((()=>{this.expect(e);return this.tsParseType()}))}tsNextThenParseType(){return this.tsInType((()=>{this.next();return this.tsParseType()}))}tsParseEnumMember(){const e=this.startNode();e.id=this.match(134)?super.parseStringLiteral(this.state.value):this.parseIdentifier(true);if(this.eat(29)){e.initializer=super.parseMaybeAssignAllowIn()}return this.finishNode(e,"TSEnumMember")}tsParseEnumDeclaration(e,t={}){if(t.const)e.const=true;if(t.declare)e.declare=true;this.expectContextual(126);e.id=this.parseIdentifier();this.checkIdentifier(e.id,e.const?8971:8459);{this.expect(5);e.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this));this.expect(8)}return this.finishNode(e,"TSEnumDeclaration")}tsParseEnumBody(){const e=this.startNode();this.expect(5);e.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this));this.expect(8);return this.finishNode(e,"TSEnumBody")}tsParseModuleBlock(){const e=this.startNode();this.scope.enter(0);this.expect(5);super.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,1024)}if(this.eat(16)){const t=this.startNode();this.tsParseModuleOrNamespaceDeclaration(t,true);e.body=t}else{this.scope.enter(512);this.prodParam.enter(0);e.body=this.tsParseModuleBlock();this.prodParam.exit();this.scope.exit()}return this.finishNode(e,"TSModuleDeclaration")}tsParseAmbientExternalModuleDeclaration(e){if(this.isContextual(112)){e.kind="global";{e.global=true}e.id=this.parseIdentifier()}else if(this.match(134)){e.kind="module";e.id=super.parseStringLiteral(this.state.value)}else{this.unexpected()}if(this.match(5)){this.scope.enter(512);this.prodParam.enter(0);e.body=this.tsParseModuleBlock();this.prodParam.exit();this.scope.exit()}else{this.semicolon()}return this.finishNode(e,"TSModuleDeclaration")}tsParseImportEqualsDeclaration(e,t,s){{e.isExport=s||false}e.id=t||this.parseIdentifier();this.checkIdentifier(e.id,4096);this.expect(29);const i=this.tsParseModuleReference();if(e.importKind==="type"&&i.type!=="TSExternalModuleReference"){this.raise(te.ImportAliasHasImportType,i)}e.moduleReference=i;this.semicolon();return this.finishNode(e,"TSImportEqualsDeclaration")}tsIsExternalModuleReference(){return this.isContextual(119)&&this.lookaheadCharCode()===40}tsParseModuleReference(){return this.tsIsExternalModuleReference()?this.tsParseExternalModuleReference():this.tsParseEntityName(0)}tsParseExternalModuleReference(){const e=this.startNode();this.expectContextual(119);this.expect(10);if(!this.match(134)){this.unexpected()}e.expression=super.parseExprAtom();this.expect(11);this.sawUnambiguousESM=true;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;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}this.state=t}tsTryParseDeclare(e){if(this.isLineTerminator()){return}const t=this.state.type;return this.tsInAmbientContext((()=>{switch(t){case 68:e.declare=true;return super.parseFunctionStatement(e,false,false);case 80:e.declare=true;return this.parseClass(e,true,false);case 126:return this.tsParseEnumDeclaration(e,{declare:true});case 112:return this.tsParseAmbientExternalModuleDeclaration(e);case 100:if(this.state.containsEsc){return}case 75:case 74:if(!this.match(75)||!this.isLookaheadContextual("enum")){e.declare=true;return this.parseVarStatement(e,this.state.value,true)}this.expect(75);return this.tsParseEnumDeclaration(e,{const:true,declare:true});case 107:if(this.hasPlugin("explicitResourceManagement")&&this.isUsing()){this.raise(te.InvalidModifierOnUsingDeclaration,this.state.startLoc,"declare");e.declare=true;return this.parseVarStatement(e,"using",true)}break;case 96:if(this.hasPlugin("explicitResourceManagement")&&this.isAwaitUsing()){this.raise(te.InvalidModifierOnAwaitUsingDeclaration,this.state.startLoc,"declare");e.declare=true;this.next();return this.parseVarStatement(e,"await using",true)}break;case 129:{const t=this.tsParseInterfaceDeclaration(e,{declare:true});if(t)return t}default:if(tokenIsIdentifier(t)){return this.tsParseDeclaration(e,this.state.value,true,null)}}}))}tsTryParseExportDeclaration(){return this.tsParseDeclaration(this.startNode(),this.state.value,true,null)}tsParseExpressionStatement(e,t,s){switch(t.name){case"declare":{const t=this.tsTryParseDeclare(e);if(t){t.declare=true}return t}case"global":if(this.match(5)){this.scope.enter(512);this.prodParam.enter(0);const s=e;s.kind="global";{e.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,s)}}tsParseDeclaration(e,t,s,i){switch(t){case"abstract":if(this.tsCheckLineTerminator(s)&&(this.match(80)||tokenIsIdentifier(this.state.type))){return this.tsParseAbstractDeclaration(e,i)}break;case"module":if(this.tsCheckLineTerminator(s)){if(this.match(134)){return this.tsParseAmbientExternalModuleDeclaration(e)}else if(tokenIsIdentifier(this.state.type)){e.kind="module";return this.tsParseModuleOrNamespaceDeclaration(e)}}break;case"namespace":if(this.tsCheckLineTerminator(s)&&tokenIsIdentifier(this.state.type)){e.kind="namespace";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){if(!this.match(47))return;const t=this.state.maybeInArrowParameters;this.state.maybeInArrowParameters=true;const s=this.tsTryParseAndCatch((()=>{const t=this.startNodeAt(e);t.typeParameters=this.tsParseTypeParameters(this.tsParseConstModifier);super.parseFunctionParams(t);t.returnType=this.tsTryParseTypeOrTypePredicateAnnotation();this.expect(19);return t}));this.state.maybeInArrowParameters=t;if(!s)return;return super.parseArrowExpression(s,null,true)}tsParseTypeArgumentsInExpression(){if(this.reScan_lt()!==47)return;return this.tsParseTypeArguments()}tsParseTypeArguments(){const e=this.startNode();e.params=this.tsInType((()=>this.tsInTopLevelContext((()=>{this.expect(47);return this.tsParseDelimitedList("TypeParametersOrArguments",this.tsParseType.bind(this))}))));if(e.params.length===0){this.raise(te.EmptyTypeArguments,e)}else if(!this.state.inType&&this.curContext()===d.brace){this.reScan_lt_gt()}this.expect(48);return this.finishNode(e,"TSTypeParameterInstantiation")}tsIsDeclarationStart(){return tokenIsTSDeclarationStart(this.state.type)}isExportDefaultSpecifier(){if(this.tsIsDeclarationStart())return false;return super.isExportDefaultSpecifier()}parseBindingElement(e,t){const s=t.length?t[0].loc.start:this.state.startLoc;const i={};this.tsParseModifiers({allowedModifiers:["public","private","protected","override","readonly"]},i);const r=i.accessibility;const a=i.override;const n=i.readonly;if(!(e&4)&&(r||n||a)){this.raise(te.UnexpectedParameterModifier,s)}const o=this.parseMaybeDefault();if(e&2){this.parseFunctionParamType(o)}const h=this.parseMaybeDefault(o.loc.start,o);if(r||n||a){const e=this.startNodeAt(s);if(t.length){e.decorators=t}if(r)e.accessibility=r;if(n)e.readonly=n;if(a)e.override=a;if(h.type!=="Identifier"&&h.type!=="AssignmentPattern"){this.raise(te.UnsupportedParameterPropertyKind,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)}tsDisallowOptionalPattern(e){for(const t of e.params){if(t.type!=="Identifier"&&t.optional&&!this.state.isAmbientContext){this.raise(te.PatternIsOptional,t)}}}setArrowFunctionParameters(e,t,s){super.setArrowFunctionParameters(e,t,s);this.tsDisallowOptionalPattern(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()){return this.finishNode(e,i)}if(i==="TSDeclareFunction"&&this.state.isAmbientContext){this.raise(te.DeclareFunctionHasImplementation,e);if(e.declare){return super.parseFunctionBodyAndFinish(e,i,s)}}this.tsDisallowOptionalPattern(e);return super.parseFunctionBodyAndFinish(e,t,s)}registerFunctionStatementId(e){if(!e.body&&e.id){this.checkIdentifier(e.id,1024)}else{super.registerFunctionStatementId(e)}}tsCheckForInvalidTypeCasts(e){e.forEach((e=>{if((e==null?void 0:e.type)==="TSTypeCastExpression"){this.raise(te.UnexpectedTypeAnnotation,e.typeAnnotation)}}))}toReferencedList(e,t){this.tsCheckForInvalidTypeCasts(e);return e}parseArrayLike(e,t,s,i){const r=super.parseArrayLike(e,t,s,i);if(r.type==="ArrayExpression"){this.tsCheckForInvalidTypeCasts(r.elements)}return r}parseSubscript(e,t,s,i){if(!this.hasPrecedingLineBreak()&&this.match(35)){this.state.canStartJSXElement=false;this.next();const s=this.startNodeAt(t);s.expression=e;return this.finishNode(s,"TSNonNullExpression")}let r=false;if(this.match(18)&&this.lookaheadCharCode()===60){if(s){i.stop=true;return e}i.optionalChainMember=r=true;this.next()}if(this.match(47)||this.match(51)){let a;const n=this.tsTryParseAndCatch((()=>{if(!s&&this.atPossibleAsyncArrow(e)){const e=this.tsTryParseGenericAsyncArrowFunction(t);if(e){return e}}const n=this.tsParseTypeArgumentsInExpression();if(!n)return;if(r&&!this.match(10)){a=this.state.curPosition();return}if(tokenIsTemplate(this.state.type)){const s=super.parseTaggedTemplateExpression(e,t,i);{s.typeParameters=n}return s}if(!s&&this.eat(10)){const s=this.startNodeAt(t);s.callee=e;s.arguments=this.parseCallExpressionArguments(11);this.tsCheckForInvalidTypeCasts(s.arguments);{s.typeParameters=n}if(i.optionalChainMember){s.optional=r}return this.finishCallExpression(s,i.optionalChainMember)}const o=this.state.type;if(o===48||o===52||o!==10&&tokenCanStartExpression(o)&&!this.hasPrecedingLineBreak()){return}const h=this.startNodeAt(t);h.expression=e;{h.typeParameters=n}return this.finishNode(h,"TSInstantiationExpression")}));if(a){this.unexpected(a,10)}if(n){if(n.type==="TSInstantiationExpression"){if(this.match(16)||this.match(18)&&this.lookaheadCharCode()!==40){this.raise(te.InvalidPropertyAccessAfterInstantiationExpression,this.state.startLoc)}if(!this.match(16)&&!this.match(18)){n.expression=super.stopParseSubscript(e,i)}}return n}}return super.parseSubscript(e,t,s,i)}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){let i;if(tokenOperatorPrecedence(58)>s&&!this.hasPrecedingLineBreak()&&(this.isContextual(93)||(i=this.isContextual(120)))){const r=this.startNodeAt(t);r.expression=e;r.typeAnnotation=this.tsInType((()=>{this.next();if(this.match(75)){if(i){this.raise(p.UnexpectedKeyword,this.state.startLoc,{keyword:"const"})}return this.tsParseTypeReference()}return this.tsParseType()}));this.finishNode(r,i?"TSSatisfiesExpression":"TSAsExpression");this.reScan_lt_gt();return this.parseExprOp(r,t,s)}return super.parseExprOp(e,t,s)}checkReservedWord(e,t,s,i){if(!this.state.isAmbientContext){super.checkReservedWord(e,t,s,i)}}checkImportReflection(e){super.checkImportReflection(e);if(e.module&&e.importKind!=="value"){this.raise(te.ImportReflectionHasImportType,e.specifiers[0].loc.start)}}checkDuplicateExports(){}isPotentialImportPhase(e){if(super.isPotentialImportPhase(e))return true;if(this.isContextual(130)){const t=this.lookaheadCharCode();return e?t===123||t===42:t!==61}return!e&&this.isContextual(87)}applyImportPhase(e,t,s,i){super.applyImportPhase(e,t,s,i);if(t){e.exportKind=s==="type"?"type":"value"}else{e.importKind=s==="type"||s==="typeof"?s:"value"}}parseImport(e){if(this.match(134)){e.importKind="value";return super.parseImport(e)}let t;if(tokenIsIdentifier(this.state.type)&&this.lookaheadCharCode()===61){e.importKind="value";return this.tsParseImportEqualsDeclaration(e)}else if(this.isContextual(130)){const s=this.parseMaybeImportPhase(e,false);if(this.lookaheadCharCode()===61){return this.tsParseImportEqualsDeclaration(e,s)}else{t=super.parseImportSpecifiersAndAfter(e,s)}}else{t=super.parseImport(e)}if(t.importKind==="type"&&t.specifiers.length>1&&t.specifiers[0].type==="ImportDefaultSpecifier"){this.raise(te.TypeImportCannotSpecifyDefaultAndNamed,t)}return t}parseExport(e,t){if(this.match(83)){const t=e;this.next();let s=null;if(this.isContextual(130)&&this.isPotentialImportPhase(false)){s=this.parseMaybeImportPhase(t,false)}else{t.importKind="value"}const i=this.tsParseImportEqualsDeclaration(t,s,true);{return i}}else if(this.eat(29)){const t=e;t.expression=super.parseExpression();this.semicolon();this.sawUnambiguousESM=true;return this.finishNode(t,"TSExportAssignment")}else if(this.eatContextual(93)){const t=e;this.expectContextual(128);t.id=this.parseIdentifier();this.semicolon();return this.finishNode(t,"TSNamespaceExportDeclaration")}else{return super.parseExport(e,t)}}isAbstractClass(){return this.isContextual(124)&&this.lookahead().type===80}parseExportDefaultExpression(){if(this.isAbstractClass()){const e=this.startNode();this.next();e.abstract=true;return this.parseClass(e,true,true)}if(this.match(129)){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==="var"||t==="let"||!!e.typeAnnotation){this.raise(te.InitializerNotAllowedInAmbientContext,s)}else if(!isValidAmbientConstInitializer(s,this.hasPlugin("estree"))){this.raise(te.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference,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(126)){return this.tsParseEnumDeclaration(this.startNode())}if(this.isContextual(129)){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(106)&&this.lookaheadCharCode()===123}parseClassMember(e,t,s){const i=["declare","private","public","protected","override","abstract","readonly","static"];this.tsParseModifiers({allowedModifiers:i,disallowedModifiers:["in","out"],stopOnStartOfClassStaticBlock:true,errorTemplate:te.InvalidModifierOnTypeParameterPositions},t);const callParseClassMemberWithIsStatic=()=>{if(this.tsIsStartOfStaticBlocks()){this.next();this.next();if(this.tsHasSomeModifiers(t,i)){this.raise(te.StaticBlockCannotHaveModifier,this.state.curPosition())}super.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(te.IndexSignatureHasAbstract,t)}if(t.accessibility){this.raise(te.IndexSignatureHasAccessibility,t,{modifier:t.accessibility})}if(t.declare){this.raise(te.IndexSignatureHasDeclare,t)}if(t.override){this.raise(te.IndexSignatureHasOverride,t)}return}if(!this.state.inAbstractClass&&t.abstract){this.raise(te.NonAbstractClassHasAbstractMethod,t)}if(t.override){if(!s.hadSuperClass){this.raise(te.OverrideNotInSubClass,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(te.ClassMethodHasReadonly,e)}if(e.declare&&this.match(10)){this.raise(te.ClassMethodHasDeclare,e)}}parseExpressionStatement(e,t,s){const i=t.type==="Identifier"?this.tsParseExpressionStatement(e,t,s):undefined;return i||super.parseExpressionStatement(e,t,s)}shouldParseExportDeclaration(){if(this.tsIsDeclarationStart())return true;return super.shouldParseExportDeclaration()}parseConditional(e,t,s){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(s);return e}}return super.parseConditional(e,t,s)}parseParenItem(e,t){const s=super.parseParenItem(e,t);if(this.eat(17)){s.optional=true;this.resetEndLocation(e)}if(this.match(14)){const s=this.startNodeAt(t);s.expression=e;s.typeAnnotation=this.tsParseTypeAnnotation();return this.finishNode(s,"TSTypeCastExpression")}return e}parseExportDeclaration(e){if(!this.state.isAmbientContext&&this.isContextual(125)){return this.tsInAmbientContext((()=>this.parseExportDeclaration(e)))}const t=this.state.startLoc;const s=this.eatContextual(125);if(s&&(this.isContextual(125)||!this.shouldParseExportDeclaration())){throw this.raise(te.ExpectedAmbientAfterExportDeclare,this.state.startLoc)}const i=tokenIsIdentifier(this.state.type);const r=i&&this.tsTryParseExportDeclaration()||super.parseExportDeclaration(e);if(!r)return null;if(r.type==="TSInterfaceDeclaration"||r.type==="TSTypeAliasDeclaration"||s){e.exportKind="type"}if(s&&r.type!=="TSImportEqualsDeclaration"){this.resetStartLocation(r,t);r.declare=true}return r}parseClassId(e,t,s,i){if((!t||s)&&this.isContextual(113)){return}super.parseClassId(e,t,s,e.declare?1024:8331);const r=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);if(r)e.typeParameters=r}parseClassPropertyAnnotation(e){if(!e.optional){if(this.eat(35)){e.definite=true}else if(this.eat(17)){e.optional=true}}const t=this.tsTryParseTypeAnnotation();if(t)e.typeAnnotation=t}parseClassProperty(e){this.parseClassPropertyAnnotation(e);if(this.state.isAmbientContext&&!(e.readonly&&!e.typeAnnotation)&&this.match(29)){this.raise(te.DeclareClassFieldHasInitializer,this.state.startLoc)}if(e.abstract&&this.match(29)){const{key:t}=e;this.raise(te.AbstractPropertyHasInitializer,this.state.startLoc,{propertyName:t.type==="Identifier"&&!e.computed?t.name:`[${this.input.slice(this.offsetToSourcePos(t.start),this.offsetToSourcePos(t.end))}]`})}return super.parseClassProperty(e)}parseClassPrivateProperty(e){if(e.abstract){this.raise(te.PrivateElementHasAbstract,e)}if(e.accessibility){this.raise(te.PrivateElementHasAccessibility,e,{modifier:e.accessibility})}this.parseClassPropertyAnnotation(e);return super.parseClassPrivateProperty(e)}parseClassAccessorProperty(e){this.parseClassPropertyAnnotation(e);if(e.optional){this.raise(te.AccessorCannotBeOptional,e)}return super.parseClassAccessorProperty(e)}pushClassMethod(e,t,s,i,r,a){const n=this.tsTryParseTypeParameters(this.tsParseConstModifier);if(n&&r){this.raise(te.ConstructorHasTypeParameters,n)}const{declare:o=false,kind:h}=t;if(o&&(h==="get"||h==="set")){this.raise(te.DeclareAccessor,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(this.tsParseConstModifier);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==null){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(113)){e.implements=this.tsParseHeritageClause("implements")}}parseObjPropValue(e,t,s,i,r,a,n){const o=this.tsTryParseTypeParameters(this.tsParseConstModifier);if(o)e.typeParameters=o;return super.parseObjPropValue(e,t,s,i,r,a,n)}parseFunctionParams(e,t){const s=this.tsTryParseTypeParameters(this.tsParseConstModifier);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,t){var s,i,r,a,n;let o;let h;let l;if(this.hasPlugin("jsx")&&(this.match(143)||this.match(47))){o=this.state.clone();h=this.tryParse((()=>super.parseMaybeAssign(e,t)),o);if(!h.error)return h.node;const{context:s}=this.state;const i=s[s.length-1];if(i===d.j_oTag||i===d.j_expr){s.pop()}}if(!((s=h)!=null&&s.error)&&!this.match(47)){return super.parseMaybeAssign(e,t)}if(!o||o===this.state)o=this.state.clone();let c;const p=this.tryParse((s=>{var i,r;c=this.tsParseTypeParameters(this.tsParseConstModifier);const a=super.parseMaybeAssign(e,t);if(a.type!=="ArrowFunctionExpression"||(i=a.extra)!=null&&i.parenthesized){s()}if(((r=c)==null?void 0:r.params.length)!==0){this.resetStartLocationFromNode(a,c)}a.typeParameters=c;return a}),o);if(!p.error&&!p.aborted){if(c)this.reportReservedArrowTypeParam(c);return p.node}if(!h){assert(!this.hasPlugin("jsx"));l=this.tryParse((()=>super.parseMaybeAssign(e,t)),o);if(!l.error)return l.node}if((i=h)!=null&&i.node){this.state=h.failState;return h.node}if(p.node){this.state=p.failState;if(c)this.reportReservedArrowTypeParam(c);return p.node}if((r=l)!=null&&r.node){this.state=l.failState;return l.node}throw((a=h)==null?void 0:a.error)||p.error||((n=l)==null?void 0:n.error)}reportReservedArrowTypeParam(e){var t;if(e.params.length===1&&!e.params[0].constraint&&!((t=e.extra)!=null&&t.trailingComma)&&this.getPluginOption("typescript","disallowAmbiguousJSXLike")){this.raise(te.ReservedArrowTypeParam,e)}}parseMaybeUnary(e,t){if(!this.hasPlugin("jsx")&&this.match(47)){return this.tsParseTypeAssertion()}return super.parseMaybeUnary(e,t)}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)}parseFunctionParamType(e){if(this.eat(17)){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"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":if(t){this.expressionScope.recordArrowParameterBindingError(te.UnexpectedTypeCastInParameter,e)}else{this.raise(te.UnexpectedTypeCastInParameter,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"TSSatisfiesExpression":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"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":this.checkToRestConversion(e.expression,false);break;default:super.checkToRestConversion(e,t)}}isValidLVal(e,t,s){switch(e){case"TSTypeCastExpression":return true;case"TSParameterProperty":return"parameter";case"TSNonNullExpression":return"expression";case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":return(s!==64||!t)&&["expression",true];default:return super.isValidLVal(e,t,s)}}parseBindingAtom(){if(this.state.type===78){return this.parseIdentifier(true)}return super.parseBindingAtom()}parseMaybeDecoratorArguments(e,t){if(this.match(47)||this.match(51)){const s=this.tsParseTypeArgumentsInExpression();if(this.match(10)){const i=super.parseMaybeDecoratorArguments(e,t);{i.typeParameters=s}return i}this.unexpected(null,10)}return super.parseMaybeDecoratorArguments(e,t)}checkCommaAfterRest(e){if(this.state.isAmbientContext&&this.match(12)&&this.lookaheadCharCode()===e){this.next();return false}return super.checkCommaAfterRest(e)}isClassMethod(){return this.match(47)||super.isClassMethod()}isClassProperty(){return this.match(35)||this.match(14)||super.isClassProperty()}parseMaybeDefault(e,t){const s=super.parseMaybeDefault(e,t);if(s.type==="AssignmentPattern"&&s.typeAnnotation&&s.right.start<s.typeAnnotation.start){this.raise(te.TypeAnnotationAfterAssign,s.typeAnnotation)}return s}getTokenFromCode(e){if(this.state.inType){if(e===62){this.finishOp(48,1);return}if(e===60){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}toAssignableListItem(e,t,s){const i=e[t];if(i.type==="TSTypeCastExpression"){e[t]=this.typeCastToParameter(i)}super.toAssignableListItem(e,t,s)}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{isAmbientContext:t,strict:s}=this.state;this.state.isAmbientContext=true;this.state.strict=false;try{return e()}finally{this.state.isAmbientContext=t;this.state.strict=s}}parseClass(e,t,s){const i=this.state.inAbstractClass;this.state.inAbstractClass=!!e.abstract;try{return super.parseClass(e,t,s)}finally{this.state.inAbstractClass=i}}tsParseAbstractDeclaration(e,t){if(this.match(80)){e.abstract=true;return this.maybeTakeDecorators(t,this.parseClass(e,true,false))}else if(this.isContextual(129)){if(!this.hasFollowingLineBreak()){e.abstract=true;this.raise(te.NonClassMethodPropertyHasAbstractModifier,e);return this.tsParseInterfaceDeclaration(e)}}else{this.unexpected(null,80)}}parseMethod(e,t,s,i,r,a,n){const o=super.parseMethod(e,t,s,i,r,a,n);if(o.abstract||o.type==="TSAbstractMethodDefinition"){const e=this.hasPlugin("estree");const t=e?o.value:o;if(t.body){const{key:e}=o;this.raise(te.AbstractMethodHasImplementation,o,{methodName:e.type==="Identifier"&&!o.computed?e.name:`[${this.input.slice(this.offsetToSourcePos(e.start),this.offsetToSourcePos(e.end))}]`})}}return o}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,r){if(!t&&i){this.parseTypeOnlyImportExportSpecifier(e,true,s);return this.finishNode(e,"ImportSpecifier")}e.importKind="value";return super.parseImportSpecifier(e,t,s,i,s?4098:4096)}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 l=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?te.TypeModifierIsUsedInTypeImports:te.TypeModifierIsUsedInTypeExports,l)}e[i]=a;e[r]=n;const c=t?"importKind":"exportKind";e[c]=o?"type":"value";if(h&&this.eatContextual(93)){e[r]=t?this.parseIdentifier():this.parseModuleExportName()}if(!e[r]){e[r]=this.cloneIdentifier(e[i])}if(t){this.checkIdentifier(e[r],o?4098:4096)}}fillOptionalPropertiesForTSESLint(e){var t,s,i,r,a,n,o,h,l,c,p,u,d,f,m,y,x,P,g,T,b,A,S,w,I,E,C,k,N,v,L,M,O,D,F,B,R,U,j,_,K,H,z,V,q,$;switch(e.type){case"ExpressionStatement":(t=e.directive)!=null?t:e.directive=undefined;return;case"RestElement":e.value=undefined;case"Identifier":case"ArrayPattern":case"AssignmentPattern":case"ObjectPattern":(s=e.decorators)!=null?s:e.decorators=[];(i=e.optional)!=null?i:e.optional=false;(r=e.typeAnnotation)!=null?r:e.typeAnnotation=undefined;return;case"TSParameterProperty":(a=e.accessibility)!=null?a:e.accessibility=undefined;(n=e.decorators)!=null?n:e.decorators=[];(o=e.override)!=null?o:e.override=false;(h=e.readonly)!=null?h:e.readonly=false;(l=e.static)!=null?l:e.static=false;return;case"TSEmptyBodyFunctionExpression":e.body=null;case"TSDeclareFunction":case"FunctionDeclaration":case"FunctionExpression":case"ClassMethod":case"ClassPrivateMethod":(c=e.declare)!=null?c:e.declare=false;(p=e.returnType)!=null?p:e.returnType=undefined;(u=e.typeParameters)!=null?u:e.typeParameters=undefined;return;case"Property":(d=e.optional)!=null?d:e.optional=false;return;case"TSMethodSignature":case"TSPropertySignature":(f=e.optional)!=null?f:e.optional=false;case"TSIndexSignature":(m=e.accessibility)!=null?m:e.accessibility=undefined;(y=e.readonly)!=null?y:e.readonly=false;(x=e.static)!=null?x:e.static=false;return;case"TSAbstractPropertyDefinition":case"PropertyDefinition":case"TSAbstractAccessorProperty":case"AccessorProperty":(P=e.declare)!=null?P:e.declare=false;(g=e.definite)!=null?g:e.definite=false;(T=e.readonly)!=null?T:e.readonly=false;(b=e.typeAnnotation)!=null?b:e.typeAnnotation=undefined;case"TSAbstractMethodDefinition":case"MethodDefinition":(A=e.accessibility)!=null?A:e.accessibility=undefined;(S=e.decorators)!=null?S:e.decorators=[];(w=e.override)!=null?w:e.override=false;(I=e.optional)!=null?I:e.optional=false;return;case"ClassExpression":(E=e.id)!=null?E:e.id=null;case"ClassDeclaration":(C=e.abstract)!=null?C:e.abstract=false;(k=e.declare)!=null?k:e.declare=false;(N=e.decorators)!=null?N:e.decorators=[];(v=e.implements)!=null?v:e.implements=[];(L=e.superTypeArguments)!=null?L:e.superTypeArguments=undefined;(M=e.typeParameters)!=null?M:e.typeParameters=undefined;return;case"TSTypeAliasDeclaration":case"VariableDeclaration":(O=e.declare)!=null?O:e.declare=false;return;case"VariableDeclarator":(D=e.definite)!=null?D:e.definite=false;return;case"TSEnumDeclaration":(F=e.const)!=null?F:e.const=false;(B=e.declare)!=null?B:e.declare=false;return;case"TSEnumMember":(R=e.computed)!=null?R:e.computed=false;return;case"TSImportType":(U=e.qualifier)!=null?U:e.qualifier=null;(j=e.options)!=null?j:e.options=null;return;case"TSInterfaceDeclaration":(_=e.declare)!=null?_:e.declare=false;(K=e.extends)!=null?K:e.extends=[];return;case"TSModuleDeclaration":(H=e.declare)!=null?H:e.declare=false;(z=e.global)!=null?z:e.global=e.kind==="global";return;case"TSTypeParameter":(V=e.const)!=null?V:e.const=false;(q=e.in)!=null?q:e.in=false;($=e.out)!=null?$:e.out=false;return}}};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 isValidAmbientConstInitializer(e,t){var s;const{type:i}=e;if((s=e.extra)!=null&&s.parenthesized){return false}if(t){if(i==="Literal"){const{value:t}=e;if(typeof t==="string"||typeof t==="boolean"){return true}}}else{if(i==="StringLiteral"||i==="BooleanLiteral"){return true}}if(isNumber(e,t)||isNegativeNumber(e,t)){return true}if(i==="TemplateLiteral"&&e.expressions.length===0){return true}if(isPossiblyLiteralEnum(e)){return true}return false}function isNumber(e,t){if(t){return e.type==="Literal"&&(typeof e.value==="number"||"bigint"in e)}return e.type==="NumericLiteral"||e.type==="BigIntLiteral"}function isNegativeNumber(e,t){if(e.type==="UnaryExpression"){const{operator:s,argument:i}=e;if(s==="-"&&isNumber(i,t)){return true}}return false}function isUncomputedMemberExpressionChain(e){if(e.type==="Identifier")return true;if(e.type!=="MemberExpression"||e.computed){return false}return isUncomputedMemberExpressionChain(e.object)}const se=ParseErrorEnum`placeholders`({ClassNameIsRequired:"A class name is required.",UnexpectedSpace:"Unexpected space in placeholder."});var placeholders=e=>class PlaceholdersParserMixin extends e{parsePlaceholder(e){if(this.match(133)){const t=this.startNode();this.next();this.assertNoSpace();t.name=super.parseIdentifier(true);this.assertNoSpace();this.expect(133);return this.finishPlaceholder(t,e)}}finishPlaceholder(e,t){let s=e;if(!s.expectedNode||!s.type){s=this.finishNode(s,"Placeholder")}s.expectedNode=t;return s}getTokenFromCode(e){if(e===37&&this.input.charCodeAt(this.state.pos+1)===37){this.finishOp(133,2)}else{super.getTokenFromCode(e)}}parseExprAtom(e){return this.parsePlaceholder("Expression")||super.parseExprAtom(e)}parseIdentifier(e){return this.parsePlaceholder("Identifier")||super.parseIdentifier(e)}checkReservedWord(e,t,s,i){if(e!==undefined){super.checkReservedWord(e,t,s,i)}}cloneIdentifier(e){const t=super.cloneIdentifier(e);if(t.type==="Placeholder"){t.expectedNode=e.expectedNode}return t}cloneStringLiteral(e){if(e.type==="Placeholder"){return this.cloneIdentifier(e)}return super.cloneStringLiteral(e)}parseBindingAtom(){return this.parsePlaceholder("Pattern")||super.parseBindingAtom()}isValidLVal(e,t,s){return e==="Placeholder"||super.isValidLVal(e,t,s)}toAssignable(e,t){if(e&&e.type==="Placeholder"&&e.expectedNode==="Expression"){e.expectedNode="Pattern"}else{super.toAssignable(e,t)}}chStartsBindingIdentifier(e,t){if(super.chStartsBindingIdentifier(e,t)){return true}const s=this.lookahead();if(s.type===133){return true}return false}verifyBreakContinue(e,t){if(e.label&&e.label.type==="Placeholder")return;super.verifyBreakContinue(e,t)}parseExpressionStatement(e,t){var s;if(t.type!=="Placeholder"||(s=t.extra)!=null&&s.parenthesized){return super.parseExpressionStatement(e,t)}if(this.match(14)){const s=e;s.label=this.finishPlaceholder(t,"Identifier");this.next();s.body=super.parseStatementOrSloppyAnnexBFunctionDeclaration();return this.finishNode(s,"LabeledStatement")}this.semicolon();const i=e;i.name=t.name;return this.finishPlaceholder(i,"Statement")}parseBlock(e,t,s){return this.parsePlaceholder("BlockStatement")||super.parseBlock(e,t,s)}parseFunctionId(e){return this.parsePlaceholder("Identifier")||super.parseFunctionId(e)}parseClass(e,t,s){const i=t?"ClassDeclaration":"ClassExpression";this.next();const r=this.state.strict;const a=this.parsePlaceholder("Identifier");if(a){if(this.match(81)||this.match(133)||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(se.ClassNameIsRequired,this.state.startLoc)}}else{this.parseClassId(e,t,s)}super.parseClassSuper(e);e.body=this.parsePlaceholder("ClassBody")||super.parseClassBody(!!e.superClass,r);return this.finishNode(e,i)}parseExport(e,t){const s=this.parsePlaceholder("Identifier");if(!s)return super.parseExport(e,t);const i=e;if(!this.isContextual(98)&&!this.match(12)){i.specifiers=[];i.source=null;i.declaration=this.finishPlaceholder(s,"Declaration");return this.finishNode(i,"ExportNamedDeclaration")}this.expectPlugin("exportDefaultFrom");const r=this.startNode();r.exported=s;i.specifiers=[this.finishNode(r,"ExportDefaultSpecifier")];return super.parseExport(i,t)}isExportDefaultSpecifier(){if(this.match(65)){const e=this.nextTokenStart();if(this.isUnparsedContextual(e,"from")){if(this.input.startsWith(tokenLabelName(133),this.nextTokenStartSince(e+4))){return true}}}return super.isExportDefaultSpecifier()}maybeParseExportDefaultSpecifier(e,t){var s;if((s=e.specifiers)!=null&&s.length){return true}return super.maybeParseExportDefaultSpecifier(e,t)}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(e);e.specifiers=[];if(!this.isContextual(98)&&!this.match(12)){e.source=this.finishPlaceholder(t,"StringLiteral");this.semicolon();return this.finishNode(e,"ImportDeclaration")}const s=this.startNodeAtNode(t);s.local=t;e.specifiers.push(this.finishNode(s,"ImportDefaultSpecifier"));if(this.eat(12)){const t=this.maybeParseStarImportSpecifier(e);if(!t)this.parseNamedImportSpecifiers(e)}this.expectContextual(98);e.source=this.parseImportSource();this.semicolon();return this.finishNode(e,"ImportDeclaration")}parseImportSource(){return this.parsePlaceholder("StringLiteral")||super.parseImportSource()}assertNoSpace(){if(this.state.start>this.offsetToSourcePos(this.state.lastTokEndLoc.index)){this.raise(se.UnexpectedSpace,this.state.lastTokEndLoc)}}};var v8intrinsic=e=>class V8IntrinsicMixin 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();const s=this.createIdentifier(t,e);this.castNodeTo(s,"V8IntrinsicIdentifier");if(this.match(10)){return s}}this.unexpected(e)}}parseExprAtom(e){return this.parseV8Intrinsic()||super.parseExprAtom(e)}};const ie=["minimal","fsharp","hack","smart"];const re=["^^","@@","^","%","#"];function validatePlugins(e){if(e.has("decorators")){if(e.has("decorators-legacy")){throw new Error("Cannot use the decorators and decorators-legacy plugin together")}const t=e.get("decorators").decoratorsBeforeExport;if(t!=null&&typeof t!=="boolean"){throw new Error("'decoratorsBeforeExport' must be a boolean, if specified.")}const s=e.get("decorators").allowCallParenthesized;if(s!=null&&typeof s!=="boolean"){throw new Error("'allowCallParenthesized' must be a boolean.")}}if(e.has("flow")&&e.has("typescript")){throw new Error("Cannot combine flow and typescript plugins.")}if(e.has("placeholders")&&e.has("v8intrinsic")){throw new Error("Cannot combine placeholders and v8intrinsic plugins.")}if(e.has("pipelineOperator")){var t;const i=e.get("pipelineOperator").proposal;if(!ie.includes(i)){const e=ie.map((e=>`"${e}"`)).join(", ");throw new Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${e}.`)}if(i==="hack"){if(e.has("placeholders")){throw new Error("Cannot combine placeholders plugin and Hack-style pipes.")}if(e.has("v8intrinsic")){throw new Error("Cannot combine v8intrinsic plugin and Hack-style pipes.")}const t=e.get("pipelineOperator").topicToken;if(!re.includes(t)){const e=re.map((e=>`"${e}"`)).join(", ");throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${e}.`)}{var s;if(t==="#"&&((s=e.get("recordAndTuple"))==null?void 0:s.syntaxType)==="hash"){throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "hack", topicToken: "#" }]\` and \`${JSON.stringify(["recordAndTuple",e.get("recordAndTuple")])}\`.`)}}}else if(i==="smart"&&((t=e.get("recordAndTuple"))==null?void 0:t.syntaxType)==="hash"){throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "smart" }]\` and \`${JSON.stringify(["recordAndTuple",e.get("recordAndTuple")])}\`.`)}}if(e.has("moduleAttributes")){{if(e.has("deprecatedImportAssert")||e.has("importAssertions")){throw new Error("Cannot combine importAssertions, deprecatedImportAssert and moduleAttributes plugins.")}const t=e.get("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(e.has("importAssertions")){if(e.has("deprecatedImportAssert")){throw new Error("Cannot combine importAssertions and deprecatedImportAssert plugins.")}}if(!e.has("deprecatedImportAssert")&&e.has("importAttributes")&&e.get("importAttributes").deprecatedAssertSyntax){{e.set("deprecatedImportAssert",{})}}if(e.has("recordAndTuple")){{const t=e.get("recordAndTuple").syntaxType;if(t!=null){const e=["hash","bar"];if(!e.includes(t)){throw new Error("The 'syntaxType' option of the 'recordAndTuple' plugin must be one of: "+e.map((e=>`'${e}'`)).join(", "))}}}}if(e.has("asyncDoExpressions")&&!e.has("doExpressions")){const e=new Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.");e.missingPlugins="doExpressions";throw e}if(e.has("optionalChainingAssign")&&e.get("optionalChainingAssign").version!=="2023-07"){throw new Error("The 'optionalChainingAssign' plugin requires a 'version' option,"+" representing the last proposal update. Currently, the"+" only supported value is '2023-07'.")}}const ae={estree:estree,jsx:jsx,flow:flow,typescript:typescript,v8intrinsic:v8intrinsic,placeholders:placeholders};const ne=Object.keys(ae);class ExpressionParser extends LValParser{checkProto(e,t,s,i){if(e.type==="SpreadElement"||this.isObjectMethod(e)||e.computed||e.shorthand){return s}const r=e.key;const a=r.type==="Identifier"?r.name:r.value;if(a==="__proto__"){if(t){this.raise(p.RecordNoProto,r);return true}if(s){if(i){if(i.doubleProtoLoc===null){i.doubleProtoLoc=r.loc.start}}else{this.raise(p.DuplicateProto,r)}}return true}return s}shouldExitDescending(e,t){return e.type==="ArrowFunctionExpression"&&this.offsetToSourcePos(e.start)===t}getExpression(){this.enterInitialScopes();this.nextToken();if(this.match(140)){throw this.raise(p.ParseExpressionEmptyInput,this.state.startLoc)}const e=this.parseExpression();if(!this.match(140)){throw this.raise(p.ParseExpressionExpectsEOF,this.state.startLoc,{unexpected:this.input.codePointAt(this.state.start)})}this.finalizeRemainingComments();e.comments=this.comments;e.errors=this.state.errors;if(this.optionFlags&256){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.startLoc;const s=this.parseMaybeAssign(e);if(this.match(12)){const i=this.startNodeAt(t);i.expressions=[s];while(this.eat(12)){i.expressions.push(this.parseMaybeAssign(e))}this.toReferencedList(i.expressions);return this.finishNode(i,"SequenceExpression")}return s}parseMaybeAssignDisallowIn(e,t){return this.disallowInAnd((()=>this.parseMaybeAssign(e,t)))}parseMaybeAssignAllowIn(e,t){return this.allowInAnd((()=>this.parseMaybeAssign(e,t)))}setOptionalParametersError(e){e.optionalParametersLoc=this.state.startLoc}parseMaybeAssign(e,t){const s=this.state.startLoc;const i=this.isContextual(108);if(i){if(this.prodParam.hasYield){this.next();let e=this.parseYield(s);if(t){e=t.call(this,e,s)}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)}if(tokenIsAssignment(this.state.type)){const t=this.startNodeAt(s);const i=this.state.value;t.operator=i;if(this.match(29)){this.toAssignable(n,true);t.left=n;const i=s.index;if(e.doubleProtoLoc!=null&&e.doubleProtoLoc.index>=i){e.doubleProtoLoc=null}if(e.shorthandAssignLoc!=null&&e.shorthandAssignLoc.index>=i){e.shorthandAssignLoc=null}if(e.privateKeyLoc!=null&&e.privateKeyLoc.index>=i){this.checkDestructuringPrivate(e);e.privateKeyLoc=null}}else{t.left=n}this.next();t.right=this.parseMaybeAssign();this.checkLVal(n,this.finishNode(t,"AssignmentExpression"));return t}else if(r){this.checkExpressionErrors(e,true)}if(i){const{type:e}=this.state;const t=this.hasPlugin("v8intrinsic")?tokenCanStartExpression(e):tokenCanStartExpression(e)&&!this.match(54);if(t&&!this.isAmbiguousPrefixOrIdentifier()){this.raiseOverwrite(p.YieldNotInGeneratorFunction,s);return this.parseYield(s)}}return n}parseMaybeConditional(e){const t=this.state.startLoc;const s=this.state.potentialArrowAt;const i=this.parseExprOps(e);if(this.shouldExitDescending(i,s)){return i}return this.parseConditional(i,t,e)}parseConditional(e,t,s){if(this.eat(17)){const s=this.startNodeAt(t);s.test=e;s.consequent=this.parseMaybeAssignAllowIn();this.expect(14);s.alternate=this.parseMaybeAssign();return this.finishNode(s,"ConditionalExpression")}return e}parseMaybeUnaryOrPrivate(e){return this.match(139)?this.parsePrivateName():this.parseMaybeUnary(e)}parseExprOps(e){const t=this.state.startLoc;const s=this.state.potentialArrowAt;const i=this.parseMaybeUnaryOrPrivate(e);if(this.shouldExitDescending(i,s)){return i}return this.parseExprOp(i,t,-1)}parseExprOp(e,t,s){if(this.isPrivateName(e)){const t=this.getPrivateNameSV(e);if(s>=tokenOperatorPrecedence(58)||!this.prodParam.hasIn||!this.match(58)){this.raise(p.PrivateInExpectedIn,e,{identifierName:t})}this.classScope.usePrivateName(t,e.loc.start)}const i=this.state.type;if(tokenIsOperator(i)&&(this.prodParam.hasIn||!this.match(58))){let r=tokenOperatorPrecedence(i);if(r>s){if(i===39){this.expectPlugin("pipelineOperator");if(this.state.inFSharpPipelineDirectBody){return e}this.checkPipelineAtInfixOperator(e,t)}const a=this.startNodeAt(t);a.left=e;a.operator=this.state.value;const n=i===41||i===42;const o=i===40;if(o){r=tokenOperatorPrecedence(42)}this.next();if(i===39&&this.hasPlugin(["pipelineOperator",{proposal:"minimal"}])){if(this.state.type===96&&this.prodParam.hasAwait){throw this.raise(p.UnexpectedAwaitAfterPipelineBody,this.state.startLoc)}}a.right=this.parseExprOpRightExpr(i,r);const h=this.finishNode(a,n||o?"LogicalExpression":"BinaryExpression");const l=this.state.type;if(o&&(l===41||l===42)||n&&l===40){throw this.raise(p.MixingCoalesceWithLogical,this.state.startLoc)}return this.parseExprOp(h,t,s)}}return e}parseExprOpRightExpr(e,t){const s=this.state.startLoc;switch(e){case 39:switch(this.getPluginOption("pipelineOperator","proposal")){case"hack":return this.withTopicBindingContext((()=>this.parseHackPipeBody()));case"fsharp":return this.withSoloAwaitPermittingContext((()=>this.parseFSharpPipelineBody(t)))}if(this.getPluginOption("pipelineOperator","proposal")==="smart"){return this.withTopicBindingContext((()=>{if(this.prodParam.hasYield&&this.isContextual(108)){throw this.raise(p.PipeBodyIsTighter,this.state.startLoc)}return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(e,t),s)}))}default:return this.parseExprOpBaseRightExpr(e,t)}}parseExprOpBaseRightExpr(e,t){const s=this.state.startLoc;return this.parseExprOp(this.parseMaybeUnaryOrPrivate(),s,tokenIsRightAssociative(e)?t-1:t)}parseHackPipeBody(){var e;const{startLoc:t}=this.state;const s=this.parseMaybeAssign();const i=h.has(s.type);if(i&&!((e=s.extra)!=null&&e.parenthesized)){this.raise(p.PipeUnparenthesizedBody,t,{type:s.type})}if(!this.topicReferenceWasUsedInCurrentContext()){this.raise(p.PipeTopicUnused,t)}return s}checkExponentialAfterUnary(e){if(this.match(57)){this.raise(p.UnexpectedTokenUnaryExponentiation,e.argument)}}parseMaybeUnary(e,t){const s=this.state.startLoc;const i=this.isContextual(96);if(i&&this.recordAwaitIfAllowed()){this.next();const e=this.parseAwait(s);if(!t)this.checkExponentialAfterUnary(e);return e}const r=this.match(34);const a=this.startNode();if(tokenIsPrefix(this.state.type)){a.operator=this.state.value;a.prefix=true;if(this.match(72)){this.expectPlugin("throwExpressions")}const s=this.match(89);this.next();a.argument=this.parseMaybeUnary(null,true);this.checkExpressionErrors(e,true);if(this.state.strict&&s){const e=a.argument;if(e.type==="Identifier"){this.raise(p.StrictDelete,a)}else if(this.hasPropertyAsPrivateName(e)){this.raise(p.DeletePrivateField,a)}}if(!r){if(!t){this.checkExponentialAfterUnary(a)}return this.finishNode(a,"UnaryExpression")}}const n=this.parseUpdate(a,r,e);if(i){const{type:e}=this.state;const t=this.hasPlugin("v8intrinsic")?tokenCanStartExpression(e):tokenCanStartExpression(e)&&!this.match(54);if(t&&!this.isAmbiguousPrefixOrIdentifier()){this.raiseOverwrite(p.AwaitNotInAsyncContext,s);return this.parseAwait(s)}}return n}parseUpdate(e,t,s){if(t){const t=e;this.checkLVal(t.argument,this.finishNode(t,"UpdateExpression"));return e}const i=this.state.startLoc;let r=this.parseExprSubscripts(s);if(this.checkExpressionErrors(s,false))return r;while(tokenIsPostfix(this.state.type)&&!this.canInsertSemicolon()){const e=this.startNodeAt(i);e.operator=this.state.value;e.prefix=false;e.argument=r;this.next();this.checkLVal(r,r=this.finishNode(e,"UpdateExpression"))}return r}parseExprSubscripts(e){const t=this.state.startLoc;const s=this.state.potentialArrowAt;const i=this.parseExprAtom(e);if(this.shouldExitDescending(i,s)){return i}return this.parseSubscripts(i,t)}parseSubscripts(e,t,s){const i={optionalChainMember:false,maybeAsyncArrow:this.atPossibleAsyncArrow(e),stop:false};do{e=this.parseSubscript(e,t,s,i);i.maybeAsyncArrow=false}while(!i.stop);return e}parseSubscript(e,t,s,i){const{type:r}=this.state;if(!s&&r===15){return this.parseBind(e,t,s,i)}else if(tokenIsTemplate(r)){return this.parseTaggedTemplateExpression(e,t,i)}let a=false;if(r===18){if(s){this.raise(p.OptionalChainingNoNew,this.state.startLoc);if(this.lookaheadCharCode()===40){return this.stopParseSubscript(e,i)}}i.optionalChainMember=a=true;this.next()}if(!s&&this.match(10)){return this.parseCoverCallAndAsyncArrowHead(e,t,i,a)}else{const s=this.eat(0);if(s||a||this.eat(16)){return this.parseMember(e,t,i,s,a)}else{return this.stopParseSubscript(e,i)}}}stopParseSubscript(e,t){t.stop=true;return e}parseMember(e,t,s,i,r){const a=this.startNodeAt(t);a.object=e;a.computed=i;if(i){a.property=this.parseExpression();this.expect(3)}else if(this.match(139)){if(e.type==="Super"){this.raise(p.SuperPrivateField,t)}this.classScope.usePrivateName(this.state.value,this.state.startLoc);a.property=this.parsePrivateName()}else{a.property=this.parseIdentifier(true)}if(s.optionalChainMember){a.optional=r;return this.finishNode(a,"OptionalMemberExpression")}else{return this.finishNode(a,"MemberExpression")}}parseBind(e,t,s,i){const r=this.startNodeAt(t);r.object=e;this.next();r.callee=this.parseNoCallExpr();i.stop=true;return this.parseSubscripts(this.finishNode(r,"BindExpression"),t,s)}parseCoverCallAndAsyncArrowHead(e,t,s,i){const r=this.state.maybeInArrowParameters;let a=null;this.state.maybeInArrowParameters=true;this.next();const n=this.startNodeAt(t);n.callee=e;const{maybeAsyncArrow:o,optionalChainMember:h}=s;if(o){this.expressionScope.enter(newAsyncArrowScope());a=new ExpressionErrors}if(h){n.optional=i}if(i){n.arguments=this.parseCallExpressionArguments(11)}else{n.arguments=this.parseCallExpressionArguments(11,e.type!=="Super",n,a)}let l=this.finishCallExpression(n,h);if(o&&this.shouldParseAsyncArrow()&&!i){s.stop=true;this.checkDestructuringPrivate(a);this.expressionScope.validateAsPattern();this.expressionScope.exit();l=this.parseAsyncArrowFromCallExpression(this.startNodeAt(t),l)}else{if(o){this.checkExpressionErrors(a,true);this.expressionScope.exit()}this.toReferencedArguments(l)}this.state.maybeInArrowParameters=r;return l}toReferencedArguments(e,t){this.toReferencedListDeep(e.arguments,t)}parseTaggedTemplateExpression(e,t,s){const i=this.startNodeAt(t);i.tag=e;i.quasi=this.parseTemplate(true);if(s.optionalChainMember){this.raise(p.OptionalChainingNoTemplate,t)}return this.finishNode(i,"TaggedTemplateExpression")}atPossibleAsyncArrow(e){return e.type==="Identifier"&&e.name==="async"&&this.state.lastTokEndLoc.index===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.offsetToSourcePos(e.start)===this.state.potentialArrowAt}finishCallExpression(e,t){if(e.callee.type==="Import"){if(e.arguments.length===0||e.arguments.length>2){this.raise(p.ImportCallArity,e)}else{for(const t of e.arguments){if(t.type==="SpreadElement"){this.raise(p.ImportCallSpreadArgument,t)}}}}return this.finishNode(e,t?"OptionalCallExpression":"CallExpression")}parseCallExpressionArguments(e,t,s,i){const r=[];let a=true;const n=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=false;while(!this.eat(e)){if(a){a=false}else{this.expect(12);if(this.match(e)){if(s){this.addTrailingCommaExtraToNode(s)}this.next();break}}r.push(this.parseExprListItem(false,i,t))}this.state.inFSharpPipelineDirectBody=n;return r}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.startLoc;return this.parseSubscripts(this.parseExprAtom(),e,true)}parseExprAtom(e){let t;let s=null;const{type:i}=this.state;switch(i){case 79:return this.parseSuper();case 83:t=this.startNode();this.next();if(this.match(16)){return this.parseImportMetaPropertyOrPhaseCall(t)}if(this.match(10)){if(this.optionFlags&512){return this.parseImportCall(t)}else{return this.finishNode(t,"Import")}}else{this.raise(p.UnsupportedImport,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 135:return this.parseNumericLiteral(this.state.value);case 136:return this.parseBigIntLiteral(this.state.value);case 134: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 0:{return this.parseArrayLike(3,true,false,e)}case 5:{return this.parseObjectLike(8,false,false,e)}case 68:return this.parseFunctionOrFunctionSent();case 26:s=this.parseDecorators();case 80:return this.parseClass(this.maybeTakeDecorators(s,this.startNode()),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(p.UnsupportedBind,e)}}case 139:{this.raise(p.PrivateInExpectedIn,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)}this.unexpected();break}case 47:{const e=this.input.codePointAt(this.nextTokenStart());if(isIdentifierStart(e)||e===62){this.expectOnePlugin(["jsx","flow","typescript"])}else{this.unexpected()}break}default:{if(i===137){return this.parseDecimalLiteral(this.state.value)}else if(i===2||i===1){return this.parseArrayLike(this.state.type===2?4:3,false,true)}else if(i===6||i===7){return this.parseObjectLike(this.state.type===6?9:8,false,true)}}if(tokenIsIdentifier(i)){if(this.isContextual(127)&&this.lookaheadInLineCharCode()===123){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.parseAsyncFunctionExpression(this.startNodeAtNode(s))}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{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{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)){if(s==="hack"){if(!this.topicReferenceIsAllowedInCurrentContext()){this.raise(p.PipeTopicUnbound,t)}this.registerTopicReference();return this.finishNode(e,"TopicReference")}else{if(!this.topicReferenceIsAllowedInCurrentContext()){this.raise(p.PrimaryTopicNotAllowed,t)}this.registerTopicReference();return this.finishNode(e,"PipelinePrimaryTopicReference")}}else{throw this.raise(p.PipeTopicUnconfiguredToken,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(p.PipeTopicRequiresHackPipes,t)}}parseAsyncArrowUnaryFunction(e){this.prodParam.enter(functionFlags(true,this.prodParam.hasYield));const t=[this.parseIdentifier()];this.prodParam.exit();if(this.hasPrecedingLineBreak()){this.raise(p.LineTerminatorBeforeArrow,this.state.curPosition())}this.expect(19);return this.parseArrowExpression(e,t,true)}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(2);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.optionFlags&16)){this.raise(p.SuperNotAllowed,e)}else if(!this.scope.allowSuper&&!(this.optionFlags&16)){this.raise(p.UnexpectedSuper,e)}if(!this.match(10)&&!this.match(0)&&!this.match(16)){this.raise(p.UnsupportedSuper,e)}return this.finishNode(e,"Super")}parsePrivateName(){const e=this.startNode();const t=this.startNodeAt(createPositionWithColumnOffset(this.state.startLoc,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(103)){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(p.UnsupportedMetaProperty,e.property,{target:t.name,onlyValidPropertyName:s})}return this.finishNode(e,"MetaProperty")}parseImportMetaPropertyOrPhaseCall(e){this.next();if(this.isContextual(105)||this.isContextual(97)){const t=this.isContextual(105);this.expectPlugin(t?"sourcePhaseImports":"deferredImportEvaluation");this.next();e.phase=t?"source":"defer";return this.parseImportCall(e)}else{const t=this.createIdentifierAt(this.startNodeAtNode(e),"import",this.state.lastTokStartLoc);if(this.isContextual(101)){if(!this.inModule){this.raise(p.ImportMetaOutsideModule,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(this.offsetToSourcePos(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.startNode();this.addExtra(t,"raw",this.input.slice(this.offsetToSourcePos(t.start),this.state.end));t.pattern=e.pattern;t.flags=e.flags;this.next();return this.finishNode(t,"RegExpLiteral")}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.startLoc;let s;this.next();this.expressionScope.enter(newArrowHeadScope());const i=this.state.maybeInArrowParameters;const r=this.state.inFSharpPipelineDirectBody;this.state.maybeInArrowParameters=true;this.state.inFSharpPipelineDirectBody=false;const a=this.state.startLoc;const n=[];const o=new ExpressionErrors;let h=true;let l;let c;while(!this.match(11)){if(h){h=false}else{this.expect(12,o.optionalParametersLoc===null?null:o.optionalParametersLoc);if(this.match(11)){c=this.state.startLoc;break}}if(this.match(21)){const e=this.state.startLoc;l=this.state.startLoc;n.push(this.parseParenItem(this.parseRestBinding(),e));if(!this.checkCommaAfterRest(41)){break}}else{n.push(this.parseMaybeAssignAllowIn(o,this.parseParenItem))}}const p=this.state.lastTokEndLoc;this.expect(11);this.state.maybeInArrowParameters=i;this.state.inFSharpPipelineDirectBody=r;let u=this.startNodeAt(t);if(e&&this.shouldParseArrow(n)&&(u=this.parseArrow(u))){this.checkDestructuringPrivate(o);this.expressionScope.validateAsPattern();this.expressionScope.exit();this.parseArrowExpression(u,n,false);return u}this.expressionScope.exit();if(!n.length){this.unexpected(this.state.lastTokStartLoc)}if(c)this.unexpected(c);if(l)this.unexpected(l);this.checkExpressionErrors(o,true);this.toReferencedListDeep(n,true);if(n.length>1){s=this.startNodeAt(a);s.expressions=n;this.finishNode(s,"SequenceExpression");this.resetEndLocation(s,p)}else{s=n[0]}return this.wrapParenthesis(t,s)}wrapParenthesis(e,t){if(!(this.optionFlags&1024)){this.addExtra(t,"parenthesized",true);this.addExtra(t,"parenStart",e.index);this.takeSurroundingComments(t,e.index,this.state.lastTokEndLoc.index);return t}const s=this.startNodeAt(e);s.expression=t;return this.finishNode(s,"ParenthesizedExpression")}shouldParseArrow(e){return!this.canInsertSemicolon()}parseArrow(e){if(this.eat(19)){return e}}parseParenItem(e,t){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.optionFlags&4)){this.raise(p.UnexpectedNewTarget,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){const t=this.match(83);const s=this.parseNoCallExpr();e.callee=s;if(t&&(s.type==="Import"||s.type==="ImportExpression")){this.raise(p.ImportCallNotNewExpression,s)}}parseTemplateElement(e){const{start:t,startLoc:s,end:i,value:r}=this.state;const a=t+1;const n=this.startNodeAt(createPositionWithColumnOffset(s,1));if(r===null){if(!e){this.raise(p.InvalidEscapeSequenceTemplate,createPositionWithColumnOffset(this.state.firstInvalidTemplateEscapePos,1))}}const o=this.match(24);const h=o?-1:-2;const l=i+h;n.value={raw:this.input.slice(a,l).replace(/\r\n?/g,"\n"),cooked:r===null?null:r.slice(1,h)};n.tail=o;this.next();const c=this.finishNode(n,"TemplateElement");this.resetEndLocation(c,createPositionWithColumnOffset(this.state.lastTokEndLoc,h));return c}parseTemplate(e){const t=this.startNode();let s=this.parseTemplateElement(e);const i=[s];const r=[];while(!s.tail){r.push(this.parseTemplateSubstitution());this.readTemplateContinuation();i.push(s=this.parseTemplateElement(e))}t.expressions=r;t.quasis=i;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;let a=false;let n=true;const o=this.startNode();o.properties=[];this.next();while(!this.match(e)){if(n){n=false}else{this.expect(12);if(this.match(e)){this.addTrailingCommaExtraToNode(o);break}}let r;if(t){r=this.parseBindingProperty()}else{r=this.parsePropertyDefinition(i);a=this.checkProto(r,s,a,i)}if(s&&!this.isObjectProperty(r)&&r.type!=="SpreadElement"){this.raise(p.InvalidRecordProperty,r)}{if(r.shorthand){this.addExtra(r,"shorthand",true)}}o.properties.push(r)}this.next();this.state.inFSharpPipelineDirectBody=r;let h="ObjectExpression";if(t){h="ObjectPattern"}else if(s){h="RecordExpression"}return this.finishNode(o,h)}addTrailingCommaExtraToNode(e){this.addExtra(e,"trailingComma",this.state.lastTokStartLoc.index);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(p.UnsupportedPropertyDecorator,this.state.startLoc)}while(this.match(26)){t.push(this.parseDecorator())}}const s=this.startNode();let i=false;let r=false;let a;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.startLoc}let n=this.eat(55);this.parsePropertyNamePrefixOperator(s);const o=this.state.containsEsc;this.parsePropertyName(s,e);if(!n&&!o&&this.maybeAsyncOrAccessorProp(s)){const{key:e}=s;const t=e.name;if(t==="async"&&!this.hasPrecedingLineBreak()){i=true;this.resetPreviousNodeTrailingComments(e);n=this.eat(55);this.parsePropertyName(s)}if(t==="get"||t==="set"){r=true;this.resetPreviousNodeTrailingComments(e);s.kind=t;if(this.match(55)){n=true;this.raise(p.AccessorIsGenerator,this.state.curPosition(),{kind:t});this.next()}this.parsePropertyName(s)}}return this.parseObjPropValue(s,a,n,i,false,r,e)}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"?p.BadGetterArity:p.BadSetterArity,e)}if(e.kind==="set"&&((t=i[i.length-1])==null?void 0:t.type)==="RestElement"){this.raise(p.BadSetterRestParameter,e)}}parseObjectMethod(e,t,s,i,r){if(r){const s=this.parseMethod(e,t,false,false,false,"ObjectMethod");this.checkGetterSetterParams(s);return s}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){e.shorthand=false;if(this.eat(14)){e.value=s?this.parseMaybeDefault(this.state.startLoc):this.parseMaybeAssignAllowIn(i);return this.finishObjectProperty(e)}if(!e.computed&&e.key.type==="Identifier"){this.checkReservedWord(e.key.name,e.key.loc.start,true,false);if(s){e.value=this.parseMaybeDefault(t,this.cloneIdentifier(e.key))}else if(this.match(29)){const s=this.state.startLoc;if(i!=null){if(i.shorthandAssignLoc===null){i.shorthandAssignLoc=s}}else{this.raise(p.InvalidCoverInitializedName,s)}e.value=this.parseMaybeDefault(t,this.cloneIdentifier(e.key))}else{e.value=this.cloneIdentifier(e.key)}e.shorthand=true;return this.finishObjectProperty(e)}}finishObjectProperty(e){return this.finishNode(e,"ObjectProperty")}parseObjPropValue(e,t,s,i,r,a,n){const o=this.parseObjectMethod(e,s,i,r,a)||this.parseObjectProperty(e,t,r,n);if(!o)this.unexpected();return o}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 135:r=this.parseNumericLiteral(i);break;case 134:r=this.parseStringLiteral(i);break;case 136:r=this.parseBigIntLiteral(i);break;case 139:{const e=this.state.startLoc;if(t!=null){if(t.privateKeyLoc===null){t.privateKeyLoc=e}}else{this.raise(p.UnexpectedPrivateField,e)}r=this.parsePrivateName();break}default:if(s===137){r=this.parseDecimalLiteral(i);break}this.unexpected()}}e.key=r;if(s!==139){e.computed=false}}}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;this.scope.enter(2|16|(n?64:0)|(r?32:0));this.prodParam.enter(functionFlags(s,e.generator));this.parseFunctionParams(e,i);const o=this.parseFunctionBodyAndFinish(e,a,true);this.prodParam.exit();this.scope.exit();return o}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(2|4);let r=functionFlags(s,false);if(!this.match(5)&&this.prodParam.hasIn){r|=8}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);return 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()|4);e.body=this.parseBlock(true,false,(r=>{const a=!this.isSimpleParamList(e.params);if(r&&a){this.raise(p.IllegalLanguageModeDirective,(e.kind==="method"||e.kind==="constructor")&&!!e.key?e.key.loc.end:e)}const n=!i&&this.state.strict;this.checkParams(e,!this.state.strict&&!t&&!s&&!a,t,n);if(this.state.strict&&e.id){this.checkIdentifier(e.id,65,n)}}));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,a,5,r,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(p.UnexpectedToken,this.state.curPosition(),{unexpected:","})}i=null}else if(this.match(21)){const e=this.state.startLoc;i=this.parseParenItem(this.parseSpread(t),e)}else if(this.match(17)){this.expectPlugin("partialApplication");if(!s){this.raise(p.UnexpectedArgumentPlaceholder,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(e);return this.createIdentifier(t,s)}createIdentifier(e,t){e.name=t;e.loc.identifierName=t;return this.finishNode(e,"Identifier")}createIdentifierAt(e,t,s){e.name=t;e.loc.identifierName=t;return this.finishNodeAt(e,"Identifier",s)}parseIdentifierName(e){let t;const{startLoc:s,type:i}=this.state;if(tokenIsKeywordOrIdentifier(i)){t=this.state.value}else{this.unexpected()}const r=tokenKeywordOrIdentifierIsKeyword(i);if(e){if(r){this.replaceToken(132)}}else{this.checkReservedWord(t,s,r,false)}this.next();return t}checkReservedWord(e,t,s,i){if(e.length>10){return}if(!canBeReservedWord(e)){return}if(s&&isKeyword(e)){this.raise(p.UnexpectedKeyword,t,{keyword:e});return}const r=!this.state.strict?isReservedWord:i?isStrictBindReservedWord:isStrictReservedWord;if(r(e,this.inModule)){this.raise(p.UnexpectedReservedWord,t,{reservedWord:e});return}else if(e==="yield"){if(this.prodParam.hasYield){this.raise(p.YieldBindingIdentifier,t);return}}else if(e==="await"){if(this.prodParam.hasAwait){this.raise(p.AwaitBindingIdentifier,t);return}if(this.scope.inStaticBlock){this.raise(p.AwaitBindingIdentifierInStaticBlock,t);return}this.expressionScope.recordAsyncArrowParametersError(t)}else if(e==="arguments"){if(this.scope.inClassAndNotInNonArrowFunction){this.raise(p.ArgumentsInClass,t);return}}}recordAwaitIfAllowed(){const e=this.prodParam.hasAwait||this.optionFlags&1&&!this.scope.inFunction;if(e&&!this.scope.inFunction){this.state.hasTopLevelAwait=true}return e}parseAwait(e){const t=this.startNodeAt(e);this.expressionScope.recordParameterInitializerError(p.AwaitExpressionFormalParameter,t);if(this.eat(55)){this.raise(p.ObsoleteAwaitStar,t)}if(!this.scope.inFunction&&!(this.optionFlags&1)){if(this.isAmbiguousPrefixOrIdentifier()){this.ambiguousScriptDifferentAst=true}else{this.sawUnambiguousESM=true}}if(!this.state.soloAwait){t.argument=this.parseMaybeUnary(null,true)}return this.finishNode(t,"AwaitExpression")}isAmbiguousPrefixOrIdentifier(){if(this.hasPrecedingLineBreak())return true;const{type:e}=this.state;return e===53||e===10||e===0||tokenIsTemplate(e)||e===102&&!this.state.containsEsc||e===138||e===56||this.hasPlugin("v8intrinsic")&&e===54}parseYield(e){const t=this.startNodeAt(e);this.expressionScope.recordParameterInitializerError(p.YieldInParameter,t);let s=false;let i=null;if(!this.hasPrecedingLineBreak()){s=this.eat(55);switch(this.state.type){case 13:case 140:case 8:case 11:case 3:case 9:case 14:case 12:if(!s)break;default:i=this.parseMaybeAssign()}}t.delegate=s;t.argument=i;return this.finishNode(t,"YieldExpression")}parseImportCall(e){this.next();e.source=this.parseMaybeAssignAllowIn();e.options=null;if(this.eat(12)){if(!this.match(11)){e.options=this.parseMaybeAssignAllowIn();if(this.eat(12)){this.addTrailingCommaExtraToNode(e.options);if(!this.match(11)){do{this.parseMaybeAssignAllowIn()}while(this.eat(12)&&!this.match(11));this.raise(p.ImportCallArity,e)}}}else{this.addTrailingCommaExtraToNode(e.source)}}this.expect(11);return this.finishNode(e,"ImportExpression")}checkPipelineAtInfixOperator(e,t){if(this.hasPlugin(["pipelineOperator",{proposal:"smart"}])){if(e.type==="SequenceExpression"){this.raise(p.PipelineHeadSequenceExpression,t)}}}parseSmartPipelineBodyInStyle(e,t){if(this.isSimpleReference(e)){const s=this.startNodeAt(t);s.callee=e;return this.finishNode(s,"PipelineBareFunction")}else{const s=this.startNodeAt(t);this.checkSmartPipeTopicBodyEarlyErrors(t);s.expression=e;return this.finishNode(s,"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(p.PipelineBodyNoArrow,this.state.startLoc)}if(!this.topicReferenceWasUsedInCurrentContext()){this.raise(p.PipelineTopicUnused,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=8&~t;if(s){this.prodParam.enter(t|8);try{return e()}finally{this.prodParam.exit()}}return e()}disallowInAnd(e){const t=this.prodParam.currentFlags();const s=8&t;if(s){this.prodParam.enter(t&~8);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.startLoc;this.state.potentialArrowAt=this.state.start;const s=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=true;const i=this.parseExprOp(this.parseMaybeUnaryOrPrivate(),t,e);this.state.inFSharpPipelineDirectBody=s;return i}parseModuleExpression(){this.expectPlugin("moduleBlocks");const e=this.startNode();this.next();if(!this.match(5)){this.unexpected(null,5)}const t=this.startNodeAt(this.state.endLoc);this.next();const s=this.initializeScopes(true);this.enterInitialScopes();try{e.body=this.parseProgram(t,8,"module")}finally{s()}return this.finishNode(e,"ModuleExpression")}parsePropertyNamePrefixOperator(e){}}const oe={kind:1},he={kind:2};const le=/[\uD800-\uDFFF]/u;const ce=/in(?:stanceof)?/y;function babel7CompatTokens(e,t,s){for(let i=0;i<e.length;i++){const r=e[i];const{type:a}=r;if(typeof a==="number"){{if(a===139){const{loc:t,start:s,value:a,end:n}=r;const o=s+1;const h=createPositionWithColumnOffset(t.start,1);e.splice(i,1,new Token({type:getExportedToken(27),value:"#",start:s,end:o,startLoc:t.start,endLoc:h}),new Token({type:getExportedToken(132),value:a,start:o,end:n,startLoc:h,endLoc:t.end}));i++;continue}if(tokenIsTemplate(a)){const{loc:n,start:o,value:h,end:l}=r;const c=o+1;const p=createPositionWithColumnOffset(n.start,1);let u;if(t.charCodeAt(o-s)===96){u=new Token({type:getExportedToken(22),value:"`",start:o,end:c,startLoc:n.start,endLoc:p})}else{u=new Token({type:getExportedToken(8),value:"}",start:o,end:c,startLoc:n.start,endLoc:p})}let d,f,m,y;if(a===24){f=l-1;m=createPositionWithColumnOffset(n.end,-1);d=h===null?null:h.slice(1,-1);y=new Token({type:getExportedToken(22),value:"`",start:f,end:l,startLoc:m,endLoc:n.end})}else{f=l-2;m=createPositionWithColumnOffset(n.end,-2);d=h===null?null:h.slice(1,-2);y=new Token({type:getExportedToken(23),value:"${",start:f,end:l,startLoc:m,endLoc:n.end})}e.splice(i,1,u,new Token({type:getExportedToken(20),value:d,start:c,end:f,startLoc:p,endLoc:m}),y);i+=2;continue}}r.type=getExportedToken(a)}}return e}class StatementParser extends ExpressionParser{parseTopLevel(e,t){e.program=this.parseProgram(t);e.comments=this.comments;if(this.optionFlags&256){e.tokens=babel7CompatTokens(this.tokens,this.input,this.startIndex)}return this.finishNode(e,"File")}parseProgram(e,t=140,s=this.options.sourceType){e.sourceType=s;e.interpreter=this.parseInterpreterDirective();this.parseBlockBody(e,true,true,t);if(this.inModule){if(!(this.optionFlags&64)&&this.scope.undefinedExports.size>0){for(const[e,t]of Array.from(this.scope.undefinedExports)){this.raise(p.ModuleExportUndefined,t,{localName:e})}}this.addExtra(e,"topLevelAwait",this.state.hasTopLevelAwait)}let i;if(t===140){i=this.finishNode(e,"Program")}else{i=this.finishNodeAt(e,"Program",createPositionWithColumnOffset(this.state.startLoc,-1))}return i}stmtToDirective(e){const t=this.castNodeTo(e,"Directive");const s=this.castNodeTo(e.expression,"DirectiveLiteral");const i=s.value;const r=this.input.slice(this.offsetToSourcePos(s.start),this.offsetToSourcePos(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);t.value=s;delete e.expression;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(){if(!this.isContextual(100)){return false}return this.hasFollowingBindingAtom()}isUsing(){if(!this.isContextual(107)){return false}const e=this.nextTokenInLineStart();const t=this.codePointAtPos(e);return this.chStartsBindingIdentifier(t,e)}isAwaitUsing(){if(!this.isContextual(96)){return false}let e=this.nextTokenInLineStart();if(this.isUnparsedContextual(e,"using")){e=this.nextTokenInLineStartSince(e+5);const t=this.codePointAtPos(e);if(this.chStartsBindingIdentifier(t,e)){this.expectPlugin("explicitResourceManagement");return true}}return false}chStartsBindingIdentifier(e,t){if(isIdentifierStart(e)){ce.lastIndex=t;if(ce.test(this.input)){const e=this.codePointAtPos(ce.lastIndex);if(!isIdentifierChar(e)&&e!==92){return false}}return true}else if(e===92){return true}else{return false}}chStartsBindingPattern(e){return e===91||e===123}hasFollowingBindingAtom(){const e=this.nextTokenStart();const t=this.codePointAtPos(e);return this.chStartsBindingPattern(t)||this.chStartsBindingIdentifier(t,e)}hasInLineFollowingBindingIdentifierOrBrace(){const e=this.nextTokenInLineStart();const t=this.codePointAtPos(e);return t===123||this.chStartsBindingIdentifier(t,e)}allowsForUsing(){const{type:e,containsEsc:t,end:s}=this.lookahead();if(e===102&&!t){const e=this.lookaheadCharCodeSince(s);if(e!==61&&e!==58&&e!==59){return false}}if(tokenIsIdentifier(e)&&!this.hasFollowingLineBreak()){this.expectPlugin("explicitResourceManagement");return true}return false}allowsUsing(){return(this.scope.inModule||!this.scope.inTopLevel)&&!this.scope.inBareCaseStatement}parseModuleItem(){return this.parseStatementLike(1|2|4|8)}parseStatementListItem(){return this.parseStatementLike(2|4|(!this.options.annexB||this.state.strict?0:8))}parseStatementOrSloppyAnnexBFunctionDeclaration(e=false){let t=0;if(this.options.annexB&&!this.state.strict){t|=4;if(e){t|=8}}return this.parseStatementLike(t)}parseStatement(){return this.parseStatementLike(0)}parseStatementLike(e){let t=null;if(this.match(26)){t=this.parseDecorators(true)}return this.parseStatementContent(e,t)}parseStatementContent(e,t){const s=this.state.type;const i=this.startNode();const r=!!(e&2);const a=!!(e&4);const n=e&1;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.parseDoWhileStatement(i);case 91:return this.parseForStatement(i);case 68:if(this.lookaheadCharCode()===46)break;if(!a){this.raise(this.state.strict?p.StrictFunction:this.options.annexB?p.SloppyFunctionAnnexB:p.SloppyFunction,this.state.startLoc)}return this.parseFunctionStatement(i,false,!r&&a);case 80:if(!r)this.unexpected();return this.parseClass(this.maybeTakeDecorators(t,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 96:if(this.isAwaitUsing()){if(!this.allowsUsing()){this.raise(p.UnexpectedUsingDeclaration,i)}else if(!r){this.raise(p.UnexpectedLexicalDeclaration,i)}else if(!this.recordAwaitIfAllowed()){this.raise(p.AwaitUsingNotInAsyncContext,i)}this.next();return this.parseVarStatement(i,"await using")}break;case 107:if(this.state.containsEsc||!this.hasInLineFollowingBindingIdentifierOrBrace()){break}this.expectPlugin("explicitResourceManagement");if(!this.allowsUsing()){this.raise(p.UnexpectedUsingDeclaration,this.state.startLoc)}else if(!r){this.raise(p.UnexpectedLexicalDeclaration,this.state.startLoc)}return this.parseVarStatement(i,"using");case 100:{if(this.state.containsEsc){break}const e=this.nextTokenStart();const t=this.codePointAtPos(e);if(t!==91){if(!r&&this.hasFollowingLineBreak())break;if(!this.chStartsBindingIdentifier(t,e)&&t!==123){break}}}case 75:{if(!r){this.raise(p.UnexpectedLexicalDeclaration,this.state.startLoc)}}case 74:{const e=this.state.value;return this.parseVarStatement(i,e)}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.optionFlags&8)&&!n){this.raise(p.UnexpectedImportExport,this.state.startLoc)}this.next();let e;if(s===83){e=this.parseImport(i)}else{e=this.parseExport(i,t)}this.assertModuleNodeAllowed(e);return e}default:{if(this.isAsyncFunction()){if(!r){this.raise(p.AsyncFunctionInSingleStatementContext,this.state.startLoc)}this.next();return this.parseFunctionStatement(i,true,!r&&a)}}}const o=this.state.value;const h=this.parseExpression();if(tokenIsIdentifier(s)&&h.type==="Identifier"&&this.eat(14)){return this.parseLabeledStatement(i,o,h,e)}else{return this.parseExpressionStatement(i,h,t)}}assertModuleNodeAllowed(e){if(!(this.optionFlags&8)&&!this.inModule){this.raise(p.ImportOutsideModule,e)}}decoratorsEnabledBeforeExport(){if(this.hasPlugin("decorators-legacy"))return true;return this.hasPlugin("decorators")&&this.getPluginOption("decorators","decoratorsBeforeExport")!==false}maybeTakeDecorators(e,t,s){if(e){var i;if((i=t.decorators)!=null&&i.length){if(typeof this.getPluginOption("decorators","decoratorsBeforeExport")!=="boolean"){this.raise(p.DecoratorsBeforeAfterExport,t.decorators[0])}t.decorators.unshift(...e)}else{t.decorators=e}this.resetStartLocationFromNode(t,e[0]);if(s)this.resetStartLocationFromNode(s,t)}return t}canHaveLeadingDecorator(){return this.match(80)}parseDecorators(e){const t=[];do{t.push(this.parseDecorator())}while(this.match(26));if(this.match(82)){if(!e){this.unexpected()}if(!this.decoratorsEnabledBeforeExport()){this.raise(p.DecoratorExportClass,this.state.startLoc)}}else if(!this.canHaveLeadingDecorator()){throw this.raise(p.UnexpectedLeadingDecorator,this.state.startLoc)}return t}parseDecorator(){this.expectOnePlugin(["decorators","decorators-legacy"]);const e=this.startNode();this.next();if(this.hasPlugin("decorators")){const t=this.state.startLoc;let s;if(this.match(10)){const t=this.state.startLoc;this.next();s=this.parseExpression();this.expect(11);s=this.wrapParenthesis(t,s);const i=this.state.startLoc;e.expression=this.parseMaybeDecoratorArguments(s,t);if(this.getPluginOption("decorators","allowCallParenthesized")===false&&e.expression!==s){this.raise(p.DecoratorArgumentsOutsideParentheses,i)}}else{s=this.parseIdentifier(false);while(this.eat(16)){const e=this.startNodeAt(t);e.object=s;if(this.match(139)){this.classScope.usePrivateName(this.state.value,this.state.startLoc);e.property=this.parsePrivateName()}else{e.property=this.parseIdentifier(true)}e.computed=false;s=this.finishNode(e,"MemberExpression")}e.expression=this.parseMaybeDecoratorArguments(s,t)}}else{e.expression=this.parseExprSubscripts()}return this.finishNode(e,"Decorator")}parseMaybeDecoratorArguments(e,t){if(this.eat(10)){const s=this.startNodeAt(t);s.callee=e;s.arguments=this.parseCallExpressionArguments(11);this.toReferencedList(s.arguments);return this.finishNode(s,"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===1)){break}if(e.label&&t)break}}if(s===this.state.labels.length){const s=t?"BreakStatement":"ContinueStatement";this.raise(p.IllegalBreakContinue,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}parseDoWhileStatement(e){this.next();this.state.labels.push(oe);e.body=this.withSmartMixTopicForbiddingContext((()=>this.parseStatement()));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(oe);let t=null;if(this.isContextual(96)&&this.recordAwaitIfAllowed()){t=this.state.startLoc;this.next()}this.scope.enter(0);this.expect(10);if(this.match(13)){if(t!==null){this.unexpected(t)}return this.parseFor(e,null)}const s=this.isContextual(100);{const i=this.isAwaitUsing();const r=i||this.isContextual(107)&&this.allowsForUsing();const a=s&&this.hasFollowingBindingAtom()||r;if(this.match(74)||this.match(75)||a){const s=this.startNode();let a;if(i){a="await using";if(!this.recordAwaitIfAllowed()){this.raise(p.AwaitUsingNotInAsyncContext,this.state.startLoc)}this.next()}else{a=this.state.value}this.next();this.parseVar(s,true,a);const n=this.finishNode(s,"VariableDeclaration");const o=this.match(58);if(o&&r){this.raise(p.ForInUsing,n)}if((o||this.isContextual(102))&&n.declarations.length===1){return this.parseForIn(e,n,t)}if(t!==null){this.unexpected(t)}return this.parseFor(e,n)}}const i=this.isContextual(95);const r=new ExpressionErrors;const a=this.parseExpression(true,r);const n=this.isContextual(102);if(n){if(s){this.raise(p.ForOfLet,a)}if(t===null&&i&&a.type==="Identifier"){this.raise(p.ForOfAsync,a)}}if(n||this.match(58)){this.checkDestructuringPrivate(r);this.toAssignable(a,true);const s=n?"ForOfStatement":"ForInStatement";this.checkLVal(a,{type:s});return this.parseForIn(e,a,t)}else{this.checkExpressionErrors(r,true)}if(t!==null){this.unexpected(t)}return this.parseFor(e,a)}parseFunctionStatement(e,t,s){this.next();return this.parseFunction(e,1|(s?2:0)|(t?8:0))}parseIfStatement(e){this.next();e.test=this.parseHeaderExpression();e.consequent=this.parseStatementOrSloppyAnnexBFunctionDeclaration();e.alternate=this.eat(66)?this.parseStatementOrSloppyAnnexBFunctionDeclaration():null;return this.finishNode(e,"IfStatement")}parseReturnStatement(e){if(!this.prodParam.hasReturn&&!(this.optionFlags&2)){this.raise(p.IllegalReturn,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(he);this.scope.enter(256);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(p.MultipleDefaultsInSwitch,this.state.lastTokStartLoc)}e=true;s.test=null}this.expect(14)}else{if(s){s.consequent.push(this.parseStatementListItem())}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(p.NewlineAfterThrow,this.state.lastTokEndLoc)}e.argument=this.parseExpression();this.semicolon();return this.finishNode(e,"ThrowStatement")}parseCatchClauseParam(){const e=this.parseBindingAtom();this.scope.enter(this.options.annexB&&e.type==="Identifier"?8:0);this.checkLVal(e,{type:"CatchClause"},9);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(0)}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(p.NoCatchOrFinally,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(oe);e.body=this.withSmartMixTopicForbiddingContext((()=>this.parseStatement()));this.state.labels.pop();return this.finishNode(e,"WhileStatement")}parseWithStatement(e){if(this.state.strict){this.raise(p.StrictWith,this.state.startLoc)}this.next();e.object=this.parseHeaderExpression();e.body=this.withSmartMixTopicForbiddingContext((()=>this.parseStatement()));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(p.LabelRedeclaration,s,{labelName:t})}}const r=tokenIsLoop(this.state.type)?1:this.match(71)?2: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.sourceToOffsetPos(this.state.start);s.kind=r}else{break}}this.state.labels.push({name:t,kind:r,statementStart:this.sourceToOffsetPos(this.state.start)});e.body=i&8?this.parseStatementOrSloppyAnnexBFunctionDeclaration(true):this.parseStatement();this.state.labels.pop();e.label=s;return this.finishNode(e,"LabeledStatement")}parseExpressionStatement(e,t,s){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(0)}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=s?this.parseModuleItem():this.parseStatementListItem();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)}r==null||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()));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.options.annexB||this.state.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")){this.raise(p.ForInOfLoopInitializer,t,{type:i?"ForInStatement":"ForOfStatement"})}if(t.type==="AssignmentPattern"){this.raise(p.InvalidLhs,t,{ancestor:{type:"ForStatement"}})}e.left=t;e.right=i?this.parseExpression():this.parseMaybeAssignAllowIn();this.expect(11);e.body=this.withSmartMixTopicForbiddingContext((()=>this.parseStatement()));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(102)))){this.raise(p.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:"destructuring"})}else if((s==="const"||s==="using"||s==="await using")&&!(this.match(58)||this.isContextual(102))){this.raise(p.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:s})}}r.push(this.finishNode(e,"VariableDeclarator"));if(!this.eat(12))break}return e}parseVarId(e,t){const s=this.parseBindingAtom();if(t==="using"||t==="await using"){if(s.type==="ArrayPattern"||s.type==="ObjectPattern"){this.raise(p.UsingDeclarationHasBindingPattern,s.loc.start)}}this.checkLVal(s,{type:"VariableDeclarator"},t==="var"?5:8201);e.id=s}parseAsyncFunctionExpression(e){return this.parseFunction(e,8)}parseFunction(e,t=0){const s=t&2;const i=!!(t&1);const r=i&&!(t&4);const a=!!(t&8);this.initFunction(e,a);if(this.match(55)){if(s){this.raise(p.GeneratorInSingleStatementContext,this.state.startLoc)}this.next();e.generator=true}if(i){e.id=this.parseFunctionId(r)}const n=this.state.maybeInArrowParameters;this.state.maybeInArrowParameters=false;this.scope.enter(2);this.prodParam.enter(functionFlags(a,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&&!s){this.registerFunctionStatementId(e)}this.state.maybeInArrowParameters=n;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,2|(t?4:0));this.expressionScope.exit()}registerFunctionStatementId(e){if(!e.id)return;this.scope.declareName(e.id.name,!this.options.annexB||this.state.strict||e.generator||e.async?this.scope.treatFunctionsAsVar?5:8201:17,e.id.loc.start)}parseClass(e,t,s){this.next();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)}nameIsConstructor(e){return e.type==="Identifier"&&e.name==="constructor"||e.type==="StringLiteral"&&e.value==="constructor"}isNonstaticConstructor(e){return!e.computed&&!e.static&&this.nameIsConstructor(e.key)}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(p.DecoratorSemicolon,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(p.DecoratorConstructor,e)}}}));this.state.strict=t;this.next();if(i.length){throw this.raise(p.TrailingDecorator,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(106);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 n=t;const o=t;const h=t;const l=r;const c=r;t.static=i;this.parsePropertyNamePrefixOperator(t);if(this.eat(55)){l.kind="method";const t=this.match(139);this.parseClassElementName(l);this.parsePostMemberNameModifiers(l);if(t){this.pushClassPrivateMethod(e,a,true,false);return}if(this.isNonstaticConstructor(r)){this.raise(p.ConstructorIsGenerator,r.key)}this.pushClassMethod(e,r,true,false,false,false);return}const u=!this.state.containsEsc&&tokenIsIdentifier(this.state.type);const d=this.parseClassElementName(t);const f=u?d.name:null;const m=this.isPrivateName(d);const y=this.state.startLoc;this.parsePostMemberNameModifiers(c);if(this.isClassMethod()){l.kind="method";if(m){this.pushClassPrivateMethod(e,a,false,false);return}const i=this.isNonstaticConstructor(r);let n=false;if(i){r.kind="constructor";if(s.hadConstructor&&!this.hasPlugin("typescript")){this.raise(p.DuplicateConstructor,d)}if(i&&this.hasPlugin("typescript")&&t.override){this.raise(p.OverrideOnConstructor,d)}s.hadConstructor=true;n=s.hadSuperClass}this.pushClassMethod(e,r,false,false,i,n)}else if(this.isClassProperty()){if(m){this.pushClassPrivateProperty(e,o)}else{this.pushClassProperty(e,n)}}else if(f==="async"&&!this.isLineTerminator()){this.resetPreviousNodeTrailingComments(d);const t=this.eat(55);if(c.optional){this.unexpected(y)}l.kind="method";const s=this.match(139);this.parseClassElementName(l);this.parsePostMemberNameModifiers(c);if(s){this.pushClassPrivateMethod(e,a,t,true)}else{if(this.isNonstaticConstructor(r)){this.raise(p.ConstructorIsAsync,r.key)}this.pushClassMethod(e,r,t,true,false,false)}}else if((f==="get"||f==="set")&&!(this.match(55)&&this.isLineTerminator())){this.resetPreviousNodeTrailingComments(d);l.kind=f;const t=this.match(139);this.parseClassElementName(r);if(t){this.pushClassPrivateMethod(e,a,false,false)}else{if(this.isNonstaticConstructor(r)){this.raise(p.ConstructorIsAccessor,r.key)}this.pushClassMethod(e,r,false,false,false,false)}this.checkGetterSetterParams(r)}else if(f==="accessor"&&!this.isLineTerminator()){this.expectPlugin("decoratorAutoAccessors");this.resetPreviousNodeTrailingComments(d);const t=this.match(139);this.parseClassElementName(n);this.pushClassAccessorProperty(e,h,t)}else if(this.isLineTerminator()){if(m){this.pushClassPrivateProperty(e,o)}else{this.pushClassProperty(e,n)}}else{this.unexpected()}}parseClassElementName(e){const{type:t,value:s}=this.state;if((t===132||t===134)&&e.static&&s==="prototype"){this.raise(p.StaticPrototype,this.state.startLoc)}if(t===139){if(s==="constructor"){this.raise(p.ConstructorClassPrivateField,this.state.startLoc)}const t=this.parsePrivateName();e.key=t;return t}this.parsePropertyName(e);return e.key}parseClassStaticBlock(e,t){var s;this.scope.enter(64|128|16);const i=this.state.labels;this.state.labels=[];this.prodParam.enter(0);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(p.DecoratorStaticBlock,t)}}pushClassProperty(e,t){if(!t.computed&&this.nameIsConstructor(t.key)){this.raise(p.ConstructorClassField,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),0,s.key.loc.start)}pushClassAccessorProperty(e,t,s){if(!s&&!t.computed&&this.nameIsConstructor(t.key)){this.raise(p.ConstructorClassField,t.key)}const i=this.parseClassAccessorProperty(t);e.body.push(i);if(s){this.classScope.declarePrivateName(this.getPrivateNameSV(i.key),0,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?6:2:r.kind==="set"?r.static?5:1:0;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(64|16);this.expressionScope.enter(newExpressionScope());this.prodParam.enter(0);e.value=this.eat(29)?this.parseMaybeAssignAllowIn():null;this.expressionScope.exit();this.prodParam.exit();this.scope.exit()}parseClassId(e,t,s,i=8331){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(p.MissingClassName,this.state.startLoc)}}}parseClassSuper(e){e.superClass=this.eat(81)?this.parseExprSubscripts():null}parseExport(e,t){const s=this.parseMaybeImportPhase(e,true);const i=this.maybeParseExportDefaultSpecifier(e,s);const r=!i||this.eat(12);const a=r&&this.eatExportStar(e);const n=a&&this.maybeParseExportNamespaceSpecifier(e);const o=r&&(!n||this.eat(12));const h=i||a;if(a&&!n){if(i)this.unexpected();if(t){throw this.raise(p.UnsupportedDecoratorExport,e)}this.parseExportFrom(e,true);this.sawUnambiguousESM=true;return this.finishNode(e,"ExportAllDeclaration")}const l=this.maybeParseExportNamedSpecifiers(e);if(i&&r&&!a&&!l){this.unexpected(null,5)}if(n&&o){this.unexpected(null,98)}let c;if(h||l){c=false;if(t){throw this.raise(p.UnsupportedDecoratorExport,e)}this.parseExportFrom(e,h)}else{c=this.maybeParseExportDeclaration(e)}if(h||l||c){var u;const s=e;this.checkExport(s,true,false,!!s.source);if(((u=s.declaration)==null?void 0:u.type)==="ClassDeclaration"){this.maybeTakeDecorators(t,s.declaration,s)}else if(t){throw this.raise(p.UnsupportedDecoratorExport,e)}this.sawUnambiguousESM=true;return this.finishNode(s,"ExportNamedDeclaration")}if(this.eat(65)){const s=e;const i=this.parseExportDefaultExpression();s.declaration=i;if(i.type==="ClassDeclaration"){this.maybeTakeDecorators(t,i,s)}else if(t){throw this.raise(p.UnsupportedDecoratorExport,e)}this.checkExport(s,true,true);this.sawUnambiguousESM=true;return this.finishNode(s,"ExportDefaultDeclaration")}this.unexpected(null,5)}eatExportStar(e){return this.eat(55)}maybeParseExportDefaultSpecifier(e,t){if(t||this.isExportDefaultSpecifier()){this.expectPlugin("exportDefaultFrom",t==null?void 0:t.loc.start);const s=t||this.parseIdentifier(true);const i=this.startNodeAtNode(s);i.exported=s;e.specifiers=[this.finishNode(i,"ExportDefaultSpecifier")];return true}return false}maybeParseExportNamespaceSpecifier(e){if(this.isContextual(93)){var t,s;(s=(t=e).specifiers)!=null?s:t.specifiers=[];const i=this.startNodeAt(this.state.lastTokStartLoc);this.next();i.exported=this.parseModuleExportName();e.specifiers.push(this.finishNode(i,"ExportNamespaceSpecifier"));return true}return false}maybeParseExportNamedSpecifiers(e){if(this.match(5)){const t=e;if(!t.specifiers)t.specifiers=[];const s=t.exportKind==="type";t.specifiers.push(...this.parseExportSpecifiers(s));t.source=null;if(this.hasPlugin("importAssertions")){t.assertions=[]}else{t.attributes=[]}t.declaration=null;return true}return false}maybeParseExportDeclaration(e){if(this.shouldParseExportDeclaration()){e.specifiers=[];e.source=null;if(this.hasPlugin("importAssertions")){e.assertions=[]}else{e.attributes=[]}e.declaration=this.parseExportDeclaration(e);return true}return false}isAsyncFunction(){if(!this.isContextual(95))return false;const e=this.nextTokenInLineStart();return this.isUnparsedContextual(e,"function")}parseExportDefaultExpression(){const e=this.startNode();if(this.match(68)){this.next();return this.parseFunction(e,1|4)}else if(this.isAsyncFunction()){this.next();this.next();return this.parseFunction(e,1|4|8)}if(this.match(80)){return this.parseClass(e,true,true)}if(this.match(26)){if(this.hasPlugin("decorators")&&this.getPluginOption("decorators","decoratorsBeforeExport")===true){this.raise(p.DecoratorBeforeExport,this.state.startLoc)}return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(false),this.startNode()),true,true)}if(this.match(75)||this.match(74)||this.isLet()||this.hasPlugin("explicitResourceManagement")&&(this.isUsing()||this.isAwaitUsing())){throw this.raise(p.UnsupportedDefaultExport,this.state.startLoc)}const t=this.parseMaybeAssignAllowIn();this.semicolon();return t}parseExportDeclaration(e){if(this.match(80)){const e=this.parseClass(this.startNode(),true,false);return e}return this.parseStatementListItem()}isExportDefaultSpecifier(){const{type:e}=this.state;if(tokenIsIdentifier(e)){if(e===95&&!this.state.containsEsc||e===100){return false}if((e===130||e===129)&&!this.state.containsEsc){const{type:e}=this.lookahead();if(tokenIsIdentifier(e)&&e!==98||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(98)){e.source=this.parseImportSource();this.checkExport(e);this.maybeParseImportAttributes(e);this.checkJSONModuleImport(e)}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")===true){this.raise(p.DecoratorBeforeExport,this.state.startLoc)}return true}}if(this.hasPlugin("explicitResourceManagement")){if(this.isUsing()){this.raise(p.UsingDeclarationExport,this.state.startLoc);return true}if(this.isAwaitUsing()){this.raise(p.UsingDeclarationExport,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){var r;if(s){this.checkDuplicateExports(e,"default");if(this.hasPlugin("exportDefaultFrom")){var a;const t=e.declaration;if(t.type==="Identifier"&&t.name==="from"&&t.end-t.start===4&&!((a=t.extra)!=null&&a.parenthesized)){this.raise(p.ExportDefaultFromAsIdentifier,t)}}}else if((r=e.specifiers)!=null&&r.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(p.ExportBindingIsString,t,{localName:e.value,exportName:s})}else{this.checkReservedWord(e.name,e.loc.start,true,false);this.scope.checkLocalExport(e)}}}}else if(e.declaration){const t=e.declaration;if(t.type==="FunctionDeclaration"||t.type==="ClassDeclaration"){const{id:s}=t;if(!s)throw new Error("Assertion failure");this.checkDuplicateExports(e,s.name)}else if(t.type==="VariableDeclaration"){for(const e of t.declarations){this.checkDeclaration(e.id)}}}}}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(p.DuplicateDefaultExport,e)}else{this.raise(p.DuplicateExport,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(130);const r=this.match(134);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=this.cloneStringLiteral(e.local)}else if(!e.exported){e.exported=this.cloneIdentifier(e.local)}return this.finishNode(e,"ExportSpecifier")}parseModuleExportName(){if(this.match(134)){const e=this.parseStringLiteral(this.state.value);const t=le.exec(e.value);if(t){this.raise(p.ModuleExportNameHasLoneSurrogate,e,{surrogateCharCode:t[0].charCodeAt(0)})}return e}return this.parseIdentifier(true)}isJSONModuleImport(e){if(e.assertions!=null){return e.assertions.some((({key:e,value:t})=>t.value==="json"&&(e.type==="Identifier"?e.name==="type":e.value==="type")))}return false}checkImportReflection(e){const{specifiers:t}=e;const s=t.length===1?t[0].type:null;if(e.phase==="source"){if(s!=="ImportDefaultSpecifier"){this.raise(p.SourcePhaseImportRequiresDefault,t[0].loc.start)}}else if(e.phase==="defer"){if(s!=="ImportNamespaceSpecifier"){this.raise(p.DeferImportRequiresNamespace,t[0].loc.start)}}else if(e.module){var i;if(s!=="ImportDefaultSpecifier"){this.raise(p.ImportReflectionNotBinding,t[0].loc.start)}if(((i=e.assertions)==null?void 0:i.length)>0){this.raise(p.ImportReflectionHasAssertion,t[0].loc.start)}}}checkJSONModuleImport(e){if(this.isJSONModuleImport(e)&&e.type!=="ExportAllDeclaration"){const{specifiers:t}=e;if(t!=null){const e=t.find((e=>{let t;if(e.type==="ExportSpecifier"){t=e.local}else if(e.type==="ImportSpecifier"){t=e.imported}if(t!==undefined){return t.type==="Identifier"?t.name!=="default":t.value!=="default"}}));if(e!==undefined){this.raise(p.ImportJSONBindingNotDefault,e.loc.start)}}}}isPotentialImportPhase(e){if(e)return false;return this.isContextual(105)||this.isContextual(97)||this.isContextual(127)}applyImportPhase(e,t,s,i){if(t){return}if(s==="module"){this.expectPlugin("importReflection",i);e.module=true}else if(this.hasPlugin("importReflection")){e.module=false}if(s==="source"){this.expectPlugin("sourcePhaseImports",i);e.phase="source"}else if(s==="defer"){this.expectPlugin("deferredImportEvaluation",i);e.phase="defer"}else if(this.hasPlugin("sourcePhaseImports")){e.phase=null}}parseMaybeImportPhase(e,t){if(!this.isPotentialImportPhase(t)){this.applyImportPhase(e,t,null);return null}const s=this.startNode();const i=this.parseIdentifierName(true);const{type:r}=this.state;const a=tokenIsKeywordOrIdentifier(r)?r!==98||this.lookaheadCharCode()===102:r!==12;if(a){this.applyImportPhase(e,t,i,s.loc.start);return null}else{this.applyImportPhase(e,t,null);return this.createIdentifier(s,i)}}isPrecedingIdImportPhase(e){const{type:t}=this.state;return tokenIsIdentifier(t)?t!==98||this.lookaheadCharCode()===102:t!==12}parseImport(e){if(this.match(134)){return this.parseImportSourceAndAttributes(e)}return this.parseImportSpecifiersAndAfter(e,this.parseMaybeImportPhase(e,false))}parseImportSpecifiersAndAfter(e,t){e.specifiers=[];const s=this.maybeParseDefaultImportSpecifier(e,t);const i=!s||this.eat(12);const r=i&&this.maybeParseStarImportSpecifier(e);if(i&&!r)this.parseNamedImportSpecifiers(e);this.expectContextual(98);return this.parseImportSourceAndAttributes(e)}parseImportSourceAndAttributes(e){var t;(t=e.specifiers)!=null?t:e.specifiers=[];e.source=this.parseImportSource();this.maybeParseImportAttributes(e);this.checkImportReflection(e);this.checkJSONModuleImport(e);this.semicolon();this.sawUnambiguousESM=true;return this.finishNode(e,"ImportDeclaration")}parseImportSource(){if(!this.match(134))this.unexpected();return this.parseExprAtom()}parseImportSpecifierLocal(e,t,s){t.local=this.parseIdentifier();e.specifiers.push(this.finishImportSpecifier(t,s))}finishImportSpecifier(e,t,s=8201){this.checkLVal(e.local,{type:t},s);return this.finishNode(e,t)}parseImportAttributes(){this.expect(5);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(p.ModuleAttributesWithDuplicateKeys,this.state.startLoc,{key:i})}t.add(i);if(this.match(134)){s.key=this.parseStringLiteral(i)}else{s.key=this.parseIdentifier(true)}this.expect(14);if(!this.match(134)){throw this.raise(p.ModuleAttributeInvalidValue,this.state.startLoc)}s.value=this.parseStringLiteral(this.state.value);e.push(this.finishNode(s,"ImportAttribute"))}while(this.eat(12));this.expect(8);return e}parseModuleAttributes(){const e=[];const t=new Set;do{const s=this.startNode();s.key=this.parseIdentifier(true);if(s.key.name!=="type"){this.raise(p.ModuleAttributeDifferentFromType,s.key)}if(t.has(s.key.name)){this.raise(p.ModuleAttributesWithDuplicateKeys,s.key,{key:s.key.name})}t.add(s.key.name);this.expect(14);if(!this.match(134)){throw this.raise(p.ModuleAttributeInvalidValue,this.state.startLoc)}s.value=this.parseStringLiteral(this.state.value);e.push(this.finishNode(s,"ImportAttribute"))}while(this.eat(12));return e}maybeParseImportAttributes(e){let t;{var s=false}if(this.match(76)){if(this.hasPrecedingLineBreak()&&this.lookaheadCharCode()===40){return}this.next();if(this.hasPlugin("moduleAttributes")){t=this.parseModuleAttributes();this.addExtra(e,"deprecatedWithLegacySyntax",true)}else{t=this.parseImportAttributes()}{s=true}}else if(this.isContextual(94)&&!this.hasPrecedingLineBreak()){if(!this.hasPlugin("deprecatedImportAssert")&&!this.hasPlugin("importAssertions")){this.raise(p.ImportAttributesUseAssert,this.state.startLoc)}if(!this.hasPlugin("importAssertions")){this.addExtra(e,"deprecatedAssertSyntax",true)}this.next();t=this.parseImportAttributes()}else{t=[]}if(!s&&this.hasPlugin("importAssertions")){e.assertions=t}else{e.attributes=t}}maybeParseDefaultImportSpecifier(e,t){if(t){const s=this.startNodeAtNode(t);s.local=t;e.specifiers.push(this.finishImportSpecifier(s,"ImportDefaultSpecifier"));return true}else if(tokenIsKeywordOrIdentifier(this.state.type)){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(p.DestructureNamedImport,this.state.startLoc)}this.expect(12);if(this.eat(8))break}const s=this.startNode();const i=this.match(134);const r=this.isContextual(130);s.imported=this.parseModuleExportName();const a=this.parseImportSpecifier(s,i,e.importKind==="type"||e.importKind==="typeof",r,undefined);e.specifiers.push(a)}}parseImportSpecifier(e,t,s,i,r){if(this.eatContextual(93)){e.local=this.parseIdentifier()}else{const{imported:s}=e;if(t){throw this.raise(p.ImportBindingIsString,e,{importName:s.value})}this.checkReservedWord(s.name,e.loc.start,true,true);if(!e.local){e.local=this.cloneIdentifier(s)}}return this.finishImportSpecifier(e,"ImportSpecifier",r)}isThisParam(e){return e.type==="Identifier"&&e.name==="this"}}class Parser extends StatementParser{constructor(e,t,s){e=getOptions(e);super(e,t);this.options=e;this.initializeScopes();this.plugins=s;this.filename=e.sourceFilename;this.startIndex=e.startIndex;let i=0;if(e.allowAwaitOutsideFunction){i|=1}if(e.allowReturnOutsideFunction){i|=2}if(e.allowImportExportEverywhere){i|=8}if(e.allowSuperOutsideMethod){i|=16}if(e.allowUndeclaredExports){i|=64}if(e.allowNewTargetOutsideFunction){i|=4}if(e.allowYieldOutsideFunction){i|=32}if(e.ranges){i|=128}if(e.tokens){i|=256}if(e.createImportExpressions){i|=512}if(e.createParenthesizedExpressions){i|=1024}if(e.errorRecovery){i|=2048}if(e.attachComment){i|=4096}if(e.annexB){i|=8192}this.optionFlags=i}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;e.comments.length=this.state.commentsLen;return e}}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 pe=generateExportedTokenTypes(k);function getParser(e,t){let s=Parser;const i=new Map;if(e!=null&&e.plugins){for(const t of e.plugins){let e,s;if(typeof t==="string"){e=t}else{[e,s]=t}if(!i.has(e)){i.set(e,s||{})}}validatePlugins(i);s=getParserClass(i)}return new s(e,t,i)}const ue=new Map;function getParserClass(e){const t=[];for(const s of ne){if(e.has(s)){t.push(s)}}const s=t.join("|");let i=ue.get(s);if(!i){i=Parser;for(const e of t){i=ae[e](i)}ue.set(s,i)}return i}t.parse=parse;t.parseExpression=parseExpression;t.tokTypes=pe}();module.exports=e})();
|
|
1
|
+
(function(){"use strict";if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var e={};!function(){var t=e;Object.defineProperty(t,"__esModule",{value:true});function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var s={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;s[i]=e[i]}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="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED";var i={ImportMetaOutsideModule:{message:`import.meta may appear only with 'sourceType: "module"'`,code:s},ImportOutsideModule:{message:`'import' and 'export' may appear only with 'sourceType: "module"'`,code:s}};const r={ArrayPattern:"array destructuring pattern",AssignmentExpression:"assignment expression",AssignmentPattern:"assignment expression",ArrowFunctionExpression:"arrow function expression",ConditionalExpression:"conditional expression",CatchClause:"catch clause",ForOfStatement:"for-of statement",ForInStatement:"for-in statement",ForStatement:"for-loop",FormalParameters:"function parameter list",Identifier:"identifier",ImportSpecifier:"import specifier",ImportDefaultSpecifier:"import default specifier",ImportNamespaceSpecifier:"import namespace specifier",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=e=>e.type==="UpdateExpression"?r.UpdateExpression[`${e.prefix}`]:r[e.type];var a={AccessorIsGenerator:({kind:e})=>`A ${e}ter cannot be a generator.`,ArgumentsInClass:"'arguments' is only allowed in functions and class methods.",AsyncFunctionInSingleStatementContext:"Async functions can only be declared at the top level or inside a block.",AwaitBindingIdentifier:"Can not use 'await' as identifier inside an async function.",AwaitBindingIdentifierInStaticBlock:"Can not use 'await' as identifier inside a static block.",AwaitExpressionFormalParameter:"'await' is not allowed in async function parameters.",AwaitUsingNotInAsyncContext:"'await using' is only allowed within async functions and at the top levels of modules.",AwaitNotInAsyncContext:"'await' is only allowed within async functions and at the top levels of modules.",BadGetterArity:"A 'get' accessor must not have any formal parameters.",BadSetterArity:"A 'set' accessor must have exactly one formal parameter.",BadSetterRestParameter:"A 'set' accessor function argument must not be a rest parameter.",ConstructorClassField:"Classes may not have a field named 'constructor'.",ConstructorClassPrivateField:"Classes may not have a private field named '#constructor'.",ConstructorIsAccessor:"Class constructor may not be an accessor.",ConstructorIsAsync:"Constructor can't be an async function.",ConstructorIsGenerator:"Constructor can't be a generator.",DeclarationMissingInitializer:({kind:e})=>`Missing initializer in ${e} declaration.`,DecoratorArgumentsOutsideParentheses:"Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",DecoratorBeforeExport:"Decorators must be placed *before* the 'export' keyword. Remove the 'decoratorsBeforeExport: true' option to use the 'export @decorator class {}' syntax.",DecoratorsBeforeAfterExport:"Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",DecoratorConstructor:"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",DecoratorExportClass:"Decorators must be placed *after* the 'export' keyword. Remove the 'decoratorsBeforeExport: false' option to use the '@decorator export class {}' syntax.",DecoratorSemicolon:"Decorators must not be followed by a semicolon.",DecoratorStaticBlock:"Decorators can't be used with a static block.",DeferImportRequiresNamespace:'Only `import defer * as x from "./module"` is valid.',DeletePrivateField:"Deleting a private field is not allowed.",DestructureNamedImport:"ES2015 named imports do not destructure. Use another statement for destructuring after the import.",DuplicateConstructor:"Duplicate constructor in the same class.",DuplicateDefaultExport:"Only one default export allowed per module.",DuplicateExport:({exportName:e})=>`\`${e}\` has already been exported. Exported identifiers must be unique.`,DuplicateProto:"Redefinition of __proto__ property.",DuplicateRegExpFlags:"Duplicate regular expression flag.",ElementAfterRest:"Rest element must be last element.",EscapedCharNotAnIdentifier:"Invalid Unicode escape.",ExportBindingIsString:({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:"'from' is not allowed as an identifier after 'export default'.",ForInOfLoopInitializer:({type:e})=>`'${e==="ForInStatement"?"for-in":"for-of"}' loop variable declaration may not have an initializer.`,ForInUsing:"For-in loop may not start with 'using' declaration.",ForOfAsync:"The left-hand side of a for-of loop may not be 'async'.",ForOfLet:"The left-hand side of a for-of loop may not start with 'let'.",GeneratorInSingleStatementContext:"Generators can only be declared at the top level or inside a block.",IllegalBreakContinue:({type:e})=>`Unsyntactic ${e==="BreakStatement"?"break":"continue"}.`,IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list.",IllegalReturn:"'return' outside of function.",ImportAttributesUseAssert:"The `assert` keyword in import attributes is deprecated and it has been replaced by the `with` keyword. You can enable the `deprecatedImportAssert` parser plugin to suppress this error.",ImportBindingIsString:({importName:e})=>`A string literal cannot be used as an imported binding.\n- Did you mean \`import { "${e}" as foo }\`?`,ImportCallArity:`\`import()\` requires exactly one or two arguments.`,ImportCallNotNewExpression:"Cannot use new with import(...).",ImportCallSpreadArgument:"`...` is not allowed in `import()`.",ImportJSONBindingNotDefault:"A JSON module can only be imported with `default`.",ImportReflectionHasAssertion:"`import module x` cannot have assertions.",ImportReflectionNotBinding:'Only `import module x from "./module"` is valid.',IncompatibleRegExpUVFlags:"The 'u' and 'v' regular expression flags cannot be enabled at the same time.",InvalidBigIntLiteral:"Invalid BigIntLiteral.",InvalidCodePoint:"Code point out of bounds.",InvalidCoverDiscardElement:"'void' must be followed by an expression when not used in a binding position.",InvalidCoverInitializedName:"Invalid shorthand property initializer.",InvalidDecimal:"Invalid decimal.",InvalidDigit:({radix:e})=>`Expected number in radix ${e}.`,InvalidEscapeSequence:"Bad character escape sequence.",InvalidEscapeSequenceTemplate:"Invalid escape sequence in template.",InvalidEscapedReservedWord:({reservedWord:e})=>`Escape sequence in keyword ${e}.`,InvalidIdentifier:({identifierName:e})=>`Invalid identifier ${e}.`,InvalidLhs:({ancestor:e})=>`Invalid left-hand side in ${toNodeDescription(e)}.`,InvalidLhsBinding:({ancestor:e})=>`Binding invalid left-hand side in ${toNodeDescription(e)}.`,InvalidLhsOptionalChaining:({ancestor:e})=>`Invalid optional chaining in the left-hand side of ${toNodeDescription(e)}.`,InvalidNumber:"Invalid number.",InvalidOrMissingExponent:"Floating-point numbers require a valid exponent after the 'e'.",InvalidOrUnexpectedToken:({unexpected:e})=>`Unexpected character '${e}'.`,InvalidParenthesizedAssignment:"Invalid parenthesized assignment pattern.",InvalidPrivateFieldResolution:({identifierName:e})=>`Private name #${e} is not defined.`,InvalidPropertyBindingPattern:"Binding member expression.",InvalidRecordProperty:"Only properties and spread elements are allowed in record definitions.",InvalidRestAssignmentPattern:"Invalid rest operator's argument.",LabelRedeclaration:({labelName:e})=>`Label '${e}' is already declared.`,LetInLexicalBinding:"'let' is disallowed as a lexically bound name.",LineTerminatorBeforeArrow:"No line break is allowed before '=>'.",MalformedRegExpFlags:"Invalid regular expression flag.",MissingClassName:"A class name is required.",MissingEqInAssignment:"Only '=' operator can be used for specifying default value.",MissingSemicolon:"Missing semicolon.",MissingPlugin:({missingPlugin:e})=>`This experimental syntax requires enabling the parser plugin: ${e.map((e=>JSON.stringify(e))).join(", ")}.`,MissingOneOfPlugins:({missingPlugin:e})=>`This experimental syntax requires enabling one of the following parser plugin(s): ${e.map((e=>JSON.stringify(e))).join(", ")}.`,MissingUnicodeEscape:"Expecting Unicode escape sequence \\uXXXX.",MixingCoalesceWithLogical:"Nullish coalescing operator(??) requires parens when mixing with logical operators.",ModuleAttributeDifferentFromType:"The only accepted module attribute is `type`.",ModuleAttributeInvalidValue:"Only string literals are allowed as module attribute values.",ModuleAttributesWithDuplicateKeys:({key:e})=>`Duplicate key "${e}" is not allowed in module attributes.`,ModuleExportNameHasLoneSurrogate:({surrogateCharCode:e})=>`An export name cannot include a lone surrogate, found '\\u${e.toString(16)}'.`,ModuleExportUndefined:({localName:e})=>`Export '${e}' is not defined.`,MultipleDefaultsInSwitch:"Multiple default clauses.",NewlineAfterThrow:"Illegal newline after throw.",NoCatchOrFinally:"Missing catch or finally clause.",NumberIdentifier:"Identifier directly after number.",NumericSeparatorInEscapeSequence:"Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",ObsoleteAwaitStar:"'await*' has been removed from the async functions proposal. Use Promise.all() instead.",OptionalChainingNoNew:"Constructors in/after an Optional Chain are not allowed.",OptionalChainingNoTemplate:"Tagged Template Literals are not allowed in optionalChain.",OverrideOnConstructor:"'override' modifier cannot appear on a constructor declaration.",ParamDupe:"Argument name clash.",PatternHasAccessor:"Object pattern can't contain getter or setter.",PatternHasMethod:"Object pattern can't contain methods.",PrivateInExpectedIn:({identifierName:e})=>`Private names are only allowed in property accesses (\`obj.#${e}\`) or in \`in\` expressions (\`#${e} in obj\`).`,PrivateNameRedeclaration:({identifierName:e})=>`Duplicate private name #${e}.`,RecordExpressionBarIncorrectEndSyntaxType:"Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionBarIncorrectStartSyntaxType:"Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionHashIncorrectStartSyntaxType:"Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",RecordNoProto:"'__proto__' is not allowed in Record expressions.",RestTrailingComma:"Unexpected trailing comma after rest element.",SloppyFunction:"In non-strict mode code, functions can only be declared at top level or inside a block.",SloppyFunctionAnnexB:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",SourcePhaseImportRequiresDefault:'Only `import source x from "./module"` is valid.',StaticPrototype:"Classes may not have static property named prototype.",SuperNotAllowed:"`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:"Private fields can't be accessed on super.",TrailingDecorator:"Decorators must be attached to a class element.",TupleExpressionBarIncorrectEndSyntaxType:"Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionBarIncorrectStartSyntaxType:"Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionHashIncorrectStartSyntaxType:"Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",UnexpectedArgumentPlaceholder:"Unexpected argument placeholder.",UnexpectedAwaitAfterPipelineBody:'Unexpected "await" after pipeline body; await must have parentheses in minimal proposal.',UnexpectedDigitAfterHash:"Unexpected digit after hash token.",UnexpectedImportExport:"'import' and 'export' may only appear at the top level.",UnexpectedKeyword:({keyword:e})=>`Unexpected keyword '${e}'.`,UnexpectedLeadingDecorator:"Leading decorators must be attached to a class declaration.",UnexpectedLexicalDeclaration:"Lexical declaration cannot appear in a single-statement context.",UnexpectedNewTarget:"`new.target` can only be used in functions or class properties.",UnexpectedNumericSeparator:"A numeric separator is only allowed between two digits.",UnexpectedPrivateField:"Unexpected private name.",UnexpectedReservedWord:({reservedWord:e})=>`Unexpected reserved word '${e}'.`,UnexpectedSuper:"'super' is only allowed in object methods and classes.",UnexpectedToken:({expected:e,unexpected:t})=>`Unexpected token${t?` '${t}'.`:""}${e?`, expected "${e}"`:""}`,UnexpectedTokenUnaryExponentiation:"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",UnexpectedUsingDeclaration:"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",UnexpectedVoidPattern:"Unexpected void binding.",UnsupportedBind:"Binding should be performed on object property.",UnsupportedDecoratorExport:"A decorated export must export a class declaration.",UnsupportedDefaultExport:"Only expressions, functions or classes are allowed as the `default` export.",UnsupportedImport:"`import` can only be used in `import()` or `import.meta`.",UnsupportedMetaProperty:({target:e,onlyValidPropertyName:t})=>`The only valid meta property for ${e} is ${e}.${t}.`,UnsupportedParameterDecorator:"Decorators cannot be used to decorate parameters.",UnsupportedPropertyDecorator:"Decorators cannot be used to decorate object literal properties.",UnsupportedSuper:"'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",UnterminatedComment:"Unterminated comment.",UnterminatedRegExp:"Unterminated regular expression.",UnterminatedString:"Unterminated string constant.",UnterminatedTemplate:"Unterminated template.",UsingDeclarationExport:"Using declaration cannot be exported.",UsingDeclarationHasBindingPattern:"Using declaration cannot have destructuring patterns.",VarRedeclaration:({identifierName:e})=>`Identifier '${e}' has already been declared.`,VoidPatternCatchClauseParam:"A void binding can not be the catch clause parameter. Use `try { ... } catch { ... }` if you want to discard the caught error.",VoidPatternInitializer:"A void binding may not have an initializer.",YieldBindingIdentifier:"Can not use 'yield' as identifier inside a generator.",YieldInParameter:"Yield expression is not allowed in formal parameters.",YieldNotInGeneratorFunction:"'yield' is only allowed within generator functions.",ZeroDigitNumericSeparator:"Numeric separator can not be used after leading 0."};var n={StrictDelete:"Deleting local variable in strict mode.",StrictEvalArguments:({referenceName:e})=>`Assigning to '${e}' in strict mode.`,StrictEvalArgumentsBinding:({bindingName:e})=>`Binding '${e}' in strict mode.`,StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block.",StrictNumericEscape:"The only valid numeric escape in strict mode is '\\0'.",StrictOctalLiteral:"Legacy octal literals are not allowed in strict mode.",StrictWith:"'with' in strict mode."};var o={ParseExpressionEmptyInput:"Unexpected parseExpression() input: The input is empty or contains only comments.",ParseExpressionExpectsEOF:({unexpected:e})=>`Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(e)}\`.`};const h=new Set(["ArrowFunctionExpression","AssignmentExpression","ConditionalExpression","YieldExpression"]);var l=Object.assign({PipeBodyIsTighter:"Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",PipeTopicRequiresHackPipes:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.',PipeTopicUnbound:"Topic reference is unbound; it must be inside a pipe body.",PipeTopicUnconfiguredToken:({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:"Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",PipeUnparenthesizedBody:({type:e})=>`Hack-style pipe body cannot be an unparenthesized ${toNodeDescription({type:e})}; please wrap it in parentheses.`},{PipelineBodyNoArrow:'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized.',PipelineBodySequenceExpression:"Pipeline body may not be a comma-separated sequence expression.",PipelineHeadSequenceExpression:"Pipeline head should not be a comma-separated sequence expression.",PipelineTopicUnused:"Pipeline is in topic style but does not use topic reference.",PrimaryTopicNotAllowed:"Topic reference was used in a lexical context without topic binding.",PrimaryTopicRequiresSmartPipeline:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'});const c=["message"];function defineHidden(e,t,s){Object.defineProperty(e,t,{enumerable:false,configurable:true,value:s})}function toParseErrorConstructor({toMessage:e,code:t,reasonCode:s,syntaxPlugin:i}){const r=s==="MissingPlugin"||s==="MissingOneOfPlugins";{const e={AccessorCannotDeclareThisParameter:"AccesorCannotDeclareThisParameter",AccessorCannotHaveTypeParameters:"AccesorCannotHaveTypeParameters",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference",SetAccessorCannotHaveOptionalParameter:"SetAccesorCannotHaveOptionalParameter",SetAccessorCannotHaveRestParameter:"SetAccesorCannotHaveRestParameter",SetAccessorCannotHaveReturnType:"SetAccesorCannotHaveReturnType"};if(e[s]){s=e[s]}}return function constructor(a,n){const o=new SyntaxError;o.code=t;o.reasonCode=s;o.loc=a;o.pos=a.index;o.syntaxPlugin=i;if(r){o.missingPlugin=n.missingPlugin}defineHidden(o,"clone",(function clone(e={}){var t;const{line:s,column:i,index:r}=(t=e.loc)!=null?t:a;return constructor(new Position(s,i,r),Object.assign({},n,e.details))}));defineHidden(o,"details",n);Object.defineProperty(o,"message",{configurable:true,get(){const t=`${e(n)} (${a.line}:${a.column})`;this.message=t;return t},set(e){Object.defineProperty(this,"message",{value:e,writable:true})}});return o}}function ParseErrorEnum(e,t){if(Array.isArray(e)){return t=>ParseErrorEnum(t,e[0])}const s={};for(const i of Object.keys(e)){const r=e[i];const a=typeof r==="string"?{message:()=>r}:typeof r==="function"?{message:r}:r,{message:n}=a,o=_objectWithoutPropertiesLoose(a,c);const h=typeof n==="string"?()=>n:n;s[i]=toParseErrorConstructor(Object.assign({code:"BABEL_PARSER_SYNTAX_ERROR",reasonCode:i,toMessage:h},t?{syntaxPlugin:t}:{},o))}return s}const p=Object.assign({},ParseErrorEnum(i),ParseErrorEnum(a),ParseErrorEnum(n),ParseErrorEnum(o),ParseErrorEnum`pipelineOperator`(l));function createDefaultOptions(){return{sourceType:"script",sourceFilename:undefined,startIndex:0,startColumn:0,startLine:1,allowAwaitOutsideFunction:false,allowReturnOutsideFunction:false,allowNewTargetOutsideFunction:false,allowImportExportEverywhere:false,allowSuperOutsideMethod:false,allowUndeclaredExports:false,allowYieldOutsideFunction:false,plugins:[],strictMode:null,ranges:false,tokens:false,createImportExpressions:false,createParenthesizedExpressions:false,errorRecovery:false,attachComment:true,annexB:true}}function getOptions(e){const t=createDefaultOptions();if(e==null){return t}if(e.annexB!=null&&e.annexB!==false){throw new Error("The `annexB` option can only be set to `false`.")}for(const s of Object.keys(t)){if(e[s]!=null)t[s]=e[s]}if(t.startLine===1){if(e.startIndex==null&&t.startColumn>0){t.startIndex=t.startColumn}else if(e.startColumn==null&&t.startIndex>0){t.startColumn=t.startIndex}}else if(e.startColumn==null||e.startIndex==null){if(e.startIndex!=null){throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.")}}if(t.sourceType==="commonjs"){if(e.allowAwaitOutsideFunction!=null){throw new Error("The `allowAwaitOutsideFunction` option cannot be used with `sourceType: 'commonjs'`.")}if(e.allowReturnOutsideFunction!=null){throw new Error("`sourceType: 'commonjs'` implies `allowReturnOutsideFunction: true`, please remove the `allowReturnOutsideFunction` option or use `sourceType: 'script'`.")}if(e.allowNewTargetOutsideFunction!=null){throw new Error("`sourceType: 'commonjs'` implies `allowNewTargetOutsideFunction: true`, please remove the `allowNewTargetOutsideFunction` option or use `sourceType: 'script'`.")}}return t}const{defineProperty:u}=Object;const toUnenumerable=(e,t)=>{if(e){u(e,t,{enumerable:false,value:e[t]})}};function toESTreeLocation(e){toUnenumerable(e.loc.start,"index");toUnenumerable(e.loc.end,"index");return e}var estree=e=>class ESTreeParserMixin extends e{parse(){const e=toESTreeLocation(super.parse());if(this.optionFlags&256){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)}estreeParseChainExpression(e,t){const s=this.startNodeAtNode(e);s.expression=e;return this.finishNodeAt(s,"ChainExpression",t)}directiveToStmt(e){const t=e.value;delete e.value;this.castNodeTo(t,"Literal");t.raw=t.extra.raw;t.value=t.extra.expressionValue;const s=this.castNodeTo(e,"ExpressionStatement");s.expression=t;s.directive=t.extra.rawValue;delete t.extra;return s}fillOptionalPropertiesForTSESLint(e){}cloneEstreeStringLiteral(e){const{start:t,end:s,loc:i,range:r,raw:a,value:n}=e;const o=Object.create(e.constructor.prototype);o.type="Literal";o.start=t;o.end=s;o.loc=i;o.range=r;o.raw=a;o.value=n;return o}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,s,i,r){super.parseBlockBody(e,t,s,i,r);const a=e.directives.map((e=>this.directiveToStmt(e)));e.body=a.concat(e.body);delete e.directives}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;return this.castNodeTo(e,"PrivateIdentifier")}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);delete o.kind;const{typeParameters:h}=e;if(h){delete e.typeParameters;o.typeParameters=h;this.resetStartLocationFromNode(o,h)}const l=this.castNodeTo(o,"FunctionExpression");e.value=l;if(a==="ClassPrivateMethod"){e.computed=false}if(a==="ObjectMethod"){if(e.kind==="method"){e.kind="init"}e.shorthand=false;return this.finishNode(e,"Property")}else{return this.finishNode(e,"MethodDefinition")}}nameIsConstructor(e){if(e.type==="Literal")return e.value==="constructor";return super.nameIsConstructor(e)}parseClassProperty(...e){const t=super.parseClassProperty(...e);{if(!this.getPluginOption("estree","classFeatures")){return t}}{this.castNodeTo(t,"PropertyDefinition")}return t}parseClassPrivateProperty(...e){const t=super.parseClassPrivateProperty(...e);{if(!this.getPluginOption("estree","classFeatures")){return t}}{this.castNodeTo(t,"PropertyDefinition")}t.computed=false;return t}parseClassAccessorProperty(e){const t=super.parseClassAccessorProperty(e);{if(!this.getPluginOption("estree","classFeatures")){return t}}if(t.abstract&&this.hasPlugin("typescript")){delete t.abstract;this.castNodeTo(t,"TSAbstractAccessorProperty")}else{this.castNodeTo(t,"AccessorProperty")}return t}parseObjectProperty(e,t,s,i){const r=super.parseObjectProperty(e,t,s,i);if(r){r.kind="init";this.castNodeTo(r,"Property")}return r}finishObjectProperty(e){e.kind="init";return this.finishNode(e,"Property")}isValidLVal(e,t,s){return e==="Property"?"value":super.isValidLVal(e,t,s)}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,t,s){if(e.type==="Property"&&(e.kind==="get"||e.kind==="set")){this.raise(p.PatternHasAccessor,e.key)}else if(e.type==="Property"&&e.method){this.raise(p.PatternHasMethod,e.key)}else{super.toAssignableObjectExpressionProp(e,t,s)}}finishCallExpression(e,t){const s=super.finishCallExpression(e,t);if(s.callee.type==="Import"){var i,r;this.castNodeTo(s,"ImportExpression");s.source=s.arguments[0];s.options=(i=s.arguments[1])!=null?i:null;s.attributes=(r=s.arguments[1])!=null?r:null;delete s.arguments;delete s.callee}else if(s.type==="OptionalCallExpression"){this.castNodeTo(s,"CallExpression")}else{s.optional=false}return s}toReferencedArguments(e){if(e.type==="ImportExpression"){return}super.toReferencedArguments(e)}parseExport(e,t){const s=this.state.lastTokStartLoc;const i=super.parseExport(e,t);switch(i.type){case"ExportAllDeclaration":i.exported=null;break;case"ExportNamedDeclaration":if(i.specifiers.length===1&&i.specifiers[0].type==="ExportNamespaceSpecifier"){this.castNodeTo(i,"ExportAllDeclaration");i.exported=i.specifiers[0].exported;delete i.specifiers}case"ExportDefaultDeclaration":{var r;const{declaration:e}=i;if((e==null?void 0:e.type)==="ClassDeclaration"&&((r=e.decorators)==null?void 0:r.length)>0&&e.start===i.start){this.resetStartLocation(i,s)}}break}return i}stopParseSubscript(e,t){const s=super.stopParseSubscript(e,t);if(t.optionalChainMember){return this.estreeParseChainExpression(s,e.loc.end)}return s}parseMember(e,t,s,i,r){const a=super.parseMember(e,t,s,i,r);if(a.type==="OptionalMemberExpression"){this.castNodeTo(a,"MemberExpression")}else{a.optional=false}return a}isOptionalMemberExpression(e){if(e.type==="ChainExpression"){return e.expression.type==="MemberExpression"}return super.isOptionalMemberExpression(e)}hasPropertyAsPrivateName(e){if(e.type==="ChainExpression"){e=e.expression}return super.hasPropertyAsPrivateName(e)}isObjectProperty(e){return e.type==="Property"&&e.kind==="init"&&!e.method}isObjectMethod(e){return e.type==="Property"&&(e.method||e.kind==="get"||e.kind==="set")}castNodeTo(e,t){const s=super.castNodeTo(e,t);this.fillOptionalPropertiesForTSESLint(s);return s}cloneIdentifier(e){const t=super.cloneIdentifier(e);this.fillOptionalPropertiesForTSESLint(t);return t}cloneStringLiteral(e){if(e.type==="Literal"){return this.cloneEstreeStringLiteral(e)}return super.cloneStringLiteral(e)}finishNodeAt(e,t,s){return toESTreeLocation(super.finishNodeAt(e,t,s))}finishNode(e,t){const s=super.finishNode(e,t);this.fillOptionalPropertiesForTSESLint(s);return s}resetStartLocation(e,t){super.resetStartLocation(e,t);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 d={brace:new TokContext("{"),j_oTag:new TokContext("<tag"),j_cTag:new TokContext("</tag"),j_expr:new TokContext("<tag>...</tag>",true)};{d.template=new TokContext("`",true)}const f=true;const m=true;const y=true;const x=true;const P=true;const g=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 T=new Map;function createKeyword(e,t={}){t.keyword=e;const s=createToken(e,t);T.set(e,s);return s}function createBinop(e,t){return createToken(e,{beforeExpr:f,binop:t})}let b=-1;const A=[];const w=[];const S=[];const I=[];const E=[];const C=[];function createToken(e,t={}){var s,i,r,a;++b;w.push(e);S.push((s=t.binop)!=null?s:-1);I.push((i=t.beforeExpr)!=null?i:false);E.push((r=t.startsExpr)!=null?r:false);C.push((a=t.prefix)!=null?a:false);A.push(new ExportedTokenType(e,t));return b}function createKeywordLike(e,t={}){var s,i,r,a;++b;T.set(e,b);w.push(e);S.push((s=t.binop)!=null?s:-1);I.push((i=t.beforeExpr)!=null?i:false);E.push((r=t.startsExpr)!=null?r:false);C.push((a=t.prefix)!=null?a:false);A.push(new ExportedTokenType("name",t));return b}const k={bracketL:createToken("[",{beforeExpr:f,startsExpr:m}),bracketHashL:createToken("#[",{beforeExpr:f,startsExpr:m}),bracketBarL:createToken("[|",{beforeExpr:f,startsExpr:m}),bracketR:createToken("]"),bracketBarR:createToken("|]"),braceL:createToken("{",{beforeExpr:f,startsExpr:m}),braceBarL:createToken("{|",{beforeExpr:f,startsExpr:m}),braceHashL:createToken("#{",{beforeExpr:f,startsExpr:m}),braceR:createToken("}"),braceBarR:createToken("|}"),parenL:createToken("(",{beforeExpr:f,startsExpr:m}),parenR:createToken(")"),comma:createToken(",",{beforeExpr:f}),semi:createToken(";",{beforeExpr:f}),colon:createToken(":",{beforeExpr:f}),doubleColon:createToken("::",{beforeExpr:f}),dot:createToken("."),question:createToken("?",{beforeExpr:f}),questionDot:createToken("?."),arrow:createToken("=>",{beforeExpr:f}),template:createToken("template"),ellipsis:createToken("...",{beforeExpr:f}),backQuote:createToken("`",{startsExpr:m}),dollarBraceL:createToken("${",{beforeExpr:f,startsExpr:m}),templateTail:createToken("...`",{startsExpr:m}),templateNonTail:createToken("...${",{beforeExpr:f,startsExpr:m}),at:createToken("@"),hash:createToken("#",{startsExpr:m}),interpreterDirective:createToken("#!..."),eq:createToken("=",{beforeExpr:f,isAssign:x}),assign:createToken("_=",{beforeExpr:f,isAssign:x}),slashAssign:createToken("_=",{beforeExpr:f,isAssign:x}),xorAssign:createToken("_=",{beforeExpr:f,isAssign:x}),moduloAssign:createToken("_=",{beforeExpr:f,isAssign:x}),incDec:createToken("++/--",{prefix:P,postfix:g,startsExpr:m}),bang:createToken("!",{beforeExpr:f,prefix:P,startsExpr:m}),tilde:createToken("~",{beforeExpr:f,prefix:P,startsExpr:m}),doubleCaret:createToken("^^",{startsExpr:m}),doubleAt:createToken("@@",{startsExpr:m}),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:f,binop:9,prefix:P,startsExpr:m}),modulo:createToken("%",{binop:10,startsExpr:m}),star:createToken("*",{binop:10}),slash:createBinop("/",10),exponent:createToken("**",{beforeExpr:f,binop:11,rightAssociative:true}),_in:createKeyword("in",{beforeExpr:f,binop:7}),_instanceof:createKeyword("instanceof",{beforeExpr:f,binop:7}),_break:createKeyword("break"),_case:createKeyword("case",{beforeExpr:f}),_catch:createKeyword("catch"),_continue:createKeyword("continue"),_debugger:createKeyword("debugger"),_default:createKeyword("default",{beforeExpr:f}),_else:createKeyword("else",{beforeExpr:f}),_finally:createKeyword("finally"),_function:createKeyword("function",{startsExpr:m}),_if:createKeyword("if"),_return:createKeyword("return",{beforeExpr:f}),_switch:createKeyword("switch"),_throw:createKeyword("throw",{beforeExpr:f,prefix:P,startsExpr:m}),_try:createKeyword("try"),_var:createKeyword("var"),_const:createKeyword("const"),_with:createKeyword("with"),_new:createKeyword("new",{beforeExpr:f,startsExpr:m}),_this:createKeyword("this",{startsExpr:m}),_super:createKeyword("super",{startsExpr:m}),_class:createKeyword("class",{startsExpr:m}),_extends:createKeyword("extends",{beforeExpr:f}),_export:createKeyword("export"),_import:createKeyword("import",{startsExpr:m}),_null:createKeyword("null",{startsExpr:m}),_true:createKeyword("true",{startsExpr:m}),_false:createKeyword("false",{startsExpr:m}),_typeof:createKeyword("typeof",{beforeExpr:f,prefix:P,startsExpr:m}),_void:createKeyword("void",{beforeExpr:f,prefix:P,startsExpr:m}),_delete:createKeyword("delete",{beforeExpr:f,prefix:P,startsExpr:m}),_do:createKeyword("do",{isLoop:y,beforeExpr:f}),_for:createKeyword("for",{isLoop:y}),_while:createKeyword("while",{isLoop:y}),_as:createKeywordLike("as",{startsExpr:m}),_assert:createKeywordLike("assert",{startsExpr:m}),_async:createKeywordLike("async",{startsExpr:m}),_await:createKeywordLike("await",{startsExpr:m}),_defer:createKeywordLike("defer",{startsExpr:m}),_from:createKeywordLike("from",{startsExpr:m}),_get:createKeywordLike("get",{startsExpr:m}),_let:createKeywordLike("let",{startsExpr:m}),_meta:createKeywordLike("meta",{startsExpr:m}),_of:createKeywordLike("of",{startsExpr:m}),_sent:createKeywordLike("sent",{startsExpr:m}),_set:createKeywordLike("set",{startsExpr:m}),_source:createKeywordLike("source",{startsExpr:m}),_static:createKeywordLike("static",{startsExpr:m}),_using:createKeywordLike("using",{startsExpr:m}),_yield:createKeywordLike("yield",{startsExpr:m}),_asserts:createKeywordLike("asserts",{startsExpr:m}),_checks:createKeywordLike("checks",{startsExpr:m}),_exports:createKeywordLike("exports",{startsExpr:m}),_global:createKeywordLike("global",{startsExpr:m}),_implements:createKeywordLike("implements",{startsExpr:m}),_intrinsic:createKeywordLike("intrinsic",{startsExpr:m}),_infer:createKeywordLike("infer",{startsExpr:m}),_is:createKeywordLike("is",{startsExpr:m}),_mixins:createKeywordLike("mixins",{startsExpr:m}),_proto:createKeywordLike("proto",{startsExpr:m}),_require:createKeywordLike("require",{startsExpr:m}),_satisfies:createKeywordLike("satisfies",{startsExpr:m}),_keyof:createKeywordLike("keyof",{startsExpr:m}),_readonly:createKeywordLike("readonly",{startsExpr:m}),_unique:createKeywordLike("unique",{startsExpr:m}),_abstract:createKeywordLike("abstract",{startsExpr:m}),_declare:createKeywordLike("declare",{startsExpr:m}),_enum:createKeywordLike("enum",{startsExpr:m}),_module:createKeywordLike("module",{startsExpr:m}),_namespace:createKeywordLike("namespace",{startsExpr:m}),_interface:createKeywordLike("interface",{startsExpr:m}),_type:createKeywordLike("type",{startsExpr:m}),_opaque:createKeywordLike("opaque",{startsExpr:m}),name:createToken("name",{startsExpr:m}),placeholder:createToken("%%",{startsExpr:m}),string:createToken("string",{startsExpr:m}),num:createToken("num",{startsExpr:m}),bigint:createToken("bigint",{startsExpr:m}),decimal:createToken("decimal",{startsExpr:m}),regexp:createToken("regexp",{startsExpr:m}),privateName:createToken("#name",{startsExpr:m}),eof:createToken("eof"),jsxName:createToken("jsxName"),jsxText:createToken("jsxText",{beforeExpr:f}),jsxTagStart:createToken("jsxTagStart",{startsExpr:m}),jsxTagEnd:createToken("jsxTagEnd")};function tokenIsIdentifier(e){return e>=93&&e<=133}function tokenKeywordOrIdentifierIsKeyword(e){return e<=92}function tokenIsKeywordOrIdentifier(e){return e>=58&&e<=133}function tokenIsLiteralPropertyName(e){return e>=58&&e<=137}function tokenComesBeforeExpression(e){return I[e]}function tokenCanStartExpression(e){return E[e]}function tokenIsAssignment(e){return e>=29&&e<=33}function tokenIsFlowInterfaceOrTypeOrOpaque(e){return e>=129&&e<=131}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 C[e]}function tokenIsTSTypeOperator(e){return e>=121&&e<=123}function tokenIsTSDeclarationStart(e){return e>=124&&e<=130}function tokenLabelName(e){return w[e]}function tokenOperatorPrecedence(e){return S[e]}function tokenIsRightAssociative(e){return e===57}function tokenIsTemplate(e){return e>=24&&e<=25}function getExportedToken(e){return A[e]}{A[8].updateContext=e=>{e.pop()};A[5].updateContext=A[7].updateContext=A[23].updateContext=e=>{e.push(d.brace)};A[22].updateContext=e=>{if(e[e.length-1]===d.template){e.pop()}else{e.push(d.template)}};A[143].updateContext=e=>{e.push(d.j_expr,d.j_oTag)}}let N="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-Ꟑꟑꟓꟕ-ꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";let v="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・";const L=new RegExp("["+N+"]");const M=new RegExp("["+N+v+"]");N=v=null;const O=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,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,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191];const D=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,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&&L.test(String.fromCharCode(e))}return isInAstralSet(e,O)}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&&M.test(String.fromCharCode(e))}return isInAstralSet(e,O)||isInAstralSet(e,D)}const F={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 B=new Set(F.keyword);const R=new Set(F.strict);const U=new Set(F.strictBind);function isReservedWord(e,t){return t&&e==="await"||e==="enum"}function isStrictReservedWord(e,t){return isReservedWord(e,t)||R.has(e)}function isStrictBindOnlyReservedWord(e){return U.has(e)}function isStrictBindReservedWord(e,t){return isStrictReservedWord(e,t)||isStrictBindOnlyReservedWord(e)}function isKeyword(e){return B.has(e)}function isIteratorStart(e,t,s){return e===64&&t===64&&isIdentifierStart(s)}const j=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 j.has(e)}class Scope{constructor(e){this.flags=0;this.names=new Map;this.firstLexicalName="";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 inTopLevel(){return(this.currentScope().flags&1)>0}get inFunction(){return(this.currentVarScopeFlags()&2)>0}get allowSuper(){return(this.currentThisScopeFlags()&16)>0}get allowDirectSuper(){return(this.currentThisScopeFlags()&32)>0}get allowNewTarget(){return(this.currentThisScopeFlags()&512)>0}get inClass(){return(this.currentThisScopeFlags()&64)>0}get inClassAndNotInNonArrowFunction(){const e=this.currentThisScopeFlags();return(e&64)>0&&(e&2)===0}get inStaticBlock(){for(let e=this.scopeStack.length-1;;e--){const{flags:t}=this.scopeStack[e];if(t&128){return true}if(t&(1667|64)){return false}}}get inNonArrowFunction(){return(this.currentThisScopeFlags()&2)>0}get inBareCaseStatement(){return(this.currentScope().flags&256)>0}get treatFunctionsAsVar(){return this.treatFunctionsAsVarInScope(this.currentScope())}createScope(e){return new Scope(e)}enter(e){this.scopeStack.push(this.createScope(e))}exit(){const e=this.scopeStack.pop();return e.flags}treatFunctionsAsVarInScope(e){return!!(e.flags&(2|128)||!this.parser.inModule&&e.flags&1)}declareName(e,t,s){let i=this.currentScope();if(t&8||t&16){this.checkRedeclarationInScope(i,e,t,s);let r=i.names.get(e)||0;if(t&16){r=r|4}else{if(!i.firstLexicalName){i.firstLexicalName=e}r=r|2}i.names.set(e,r);if(t&8){this.maybeExportDefined(i,e)}}else if(t&4){for(let r=this.scopeStack.length-1;r>=0;--r){i=this.scopeStack[r];this.checkRedeclarationInScope(i,e,t,s);i.names.set(e,(i.names.get(e)||0)|1);this.maybeExportDefined(i,e);if(i.flags&1667)break}}if(this.parser.inModule&&i.flags&1){this.undefinedExports.delete(e)}}maybeExportDefined(e,t){if(this.parser.inModule&&e.flags&1){this.undefinedExports.delete(t)}}checkRedeclarationInScope(e,t,s,i){if(this.isRedeclaredInScope(e,t,s)){this.parser.raise(p.VarRedeclaration,i,{identifierName:t})}}isRedeclaredInScope(e,t,s){if(!(s&1))return false;if(s&8){return e.names.has(t)}const i=e.names.get(t);if(s&16){return(i&2)>0||!this.treatFunctionsAsVarInScope(e)&&(i&1)>0}return(i&2)>0&&!(e.flags&8&&e.firstLexicalName===t)||!this.treatFunctionsAsVarInScope(e)&&(i&4)>0}checkLocalExport(e){const{name:t}=e;const s=this.scopeStack[0];if(!s.names.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&1667){return t}}}currentThisScopeFlags(){for(let e=this.scopeStack.length-1;;e--){const{flags:t}=this.scopeStack[e];if(t&(1667|64)&&!(t&4)){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&2048){this.checkRedeclarationInScope(i,e,t,s);this.maybeExportDefined(i,e);i.declareFunctions.add(e);return}super.declareName(e,t,s)}isRedeclaredInScope(e,t,s){if(super.isRedeclaredInScope(e,t,s))return true;if(s&2048&&!e.declareFunctions.has(t)){const s=e.names.get(t);return(s&4)>0||(s&2)>0}return false}checkLocalExport(e){if(!this.scopeStack[0].declareFunctions.has(e.name)){super.checkLocalExport(e)}}}const _=new Set(["_","any","bool","boolean","empty","extends","false","interface","mixed","null","number","static","string","true","typeof","void"]);const K=ParseErrorEnum`flow`({AmbiguousConditionalArrow:"Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",AmbiguousDeclareModuleKind:"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:({reservedType:e})=>`Cannot overwrite reserved type ${e}.`,DeclareClassElement:"The `declare` modifier can only appear on class fields.",DeclareClassFieldInitializer:"Initializers are not allowed in fields with the `declare` modifier.",DuplicateDeclareModuleExports:"Duplicate `declare module.exports` statement.",EnumBooleanMemberNotInitialized:({memberName:e,enumName:t})=>`Boolean enum members need to be initialized. Use either \`${e} = true,\` or \`${e} = false,\` in enum \`${t}\`.`,EnumDuplicateMemberName:({memberName:e,enumName:t})=>`Enum member names need to be unique, but the name \`${e}\` has already been used before in enum \`${t}\`.`,EnumInconsistentMemberValues:({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:({invalidEnumType:e,enumName:t})=>`Enum type \`${e}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${t}\`.`,EnumInvalidExplicitTypeUnknownSupplied:({enumName:e})=>`Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${e}\`.`,EnumInvalidMemberInitializerPrimaryType:({enumName:e,memberName:t,explicitType:s})=>`Enum \`${e}\` has type \`${s}\`, so the initializer of \`${t}\` needs to be a ${s} literal.`,EnumInvalidMemberInitializerSymbolType:({enumName:e,memberName:t})=>`Symbol enum members cannot be initialized. Use \`${t},\` in enum \`${e}\`.`,EnumInvalidMemberInitializerUnknownType:({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:({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:({enumName:e,memberName:t})=>`Number enum members need to be initialized, e.g. \`${t} = 1\` in enum \`${e}\`.`,EnumStringMemberInconsistentlyInitialized:({enumName:e})=>`String enum members need to consistently either all use initializers, or use no initializers, in enum \`${e}\`.`,GetterMayNotHaveThisParam:"A getter cannot have a `this` parameter.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` or `typeof` keyword.",ImportTypeShorthandOnlyInPureImport:"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:"Explicit inexact syntax cannot appear inside an explicit exact object type.",InexactInsideNonObject:"Explicit inexact syntax cannot appear in class or interface definitions.",InexactVariance:"Explicit inexact syntax cannot have variance.",InvalidNonTypeImportInDeclareModule:"Imports within a `declare module` body must always be `import type` or `import typeof`.",MissingTypeParamDefault:"Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",NestedDeclareModule:"`declare module` cannot be used inside another `declare module`.",NestedFlowComment:"Cannot have a flow comment inside another flow comment.",PatternIsOptional:Object.assign({message:"A binding pattern parameter cannot be optional in an implementation signature."},{reasonCode:"OptionalBindingPattern"}),SetterMayNotHaveThisParam:"A setter cannot have a `this` parameter.",SpreadVariance:"Spread properties cannot have variance.",ThisParamAnnotationRequired:"A type annotation is required for the `this` parameter.",ThisParamBannedInConstructor:"Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",ThisParamMayNotBeOptional:"The `this` parameter cannot be optional.",ThisParamMustBeFirst:"The `this` parameter must be the first function parameter.",ThisParamNoDefault:"The `this` parameter may not have a default value.",TypeBeforeInitializer:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeCastInPattern:"The type cast expression is expected to be wrapped with parenthesis.",UnexpectedExplicitInexactInObject:"Explicit inexact syntax must appear at the end of an inexact object.",UnexpectedReservedType:({reservedType:e})=>`Unexpected reserved type ${e}.`,UnexpectedReservedUnderscore:"`_` is only allowed as a type argument to call or new.",UnexpectedSpaceBetweenModuloChecks:"Spaces between `%` and `checks` are not allowed here.",UnexpectedSpreadType:"Spread operator cannot appear in class or interface definitions.",UnexpectedSubtractionOperand:'Unexpected token, expected "number" or "bigint".',UnexpectedTokenAfterTypeParameter:"Expected an arrow function after this type parameter declaration.",UnexpectedTypeParameterBeforeAsyncArrowFunction:"Type parameters must come after the async keyword, e.g. instead of `<T> async () => {}`, use `async <T>() => {}`.",UnsupportedDeclareExportKind:({unsupportedExportKind:e,suggestion:t})=>`\`declare export ${e}\` is not supported. Use \`${t}\` instead.`,UnsupportedStatementInDeclareModule:"Only declares and type imports are allowed inside declare module.",UnterminatedFlowComment:"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"}const H={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 V=/\*?\s*@((?:no)?flow)\b/;var flow=e=>class FlowParserMixin extends e{constructor(...e){super(...e);this.flowPragma=undefined}getScopeHandler(){return FlowScopeHandler}shouldParseTypes(){return this.getPluginOption("flow","all")||this.flowPragma==="flow"}finishToken(e,t){if(e!==134&&e!==13&&e!==28){if(this.flowPragma===undefined){this.flowPragma=null}}super.finishToken(e,t)}addComment(e){if(this.flowPragma===undefined){const t=V.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")}}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(110);if(this.state.lastTokStartLoc.index>t.index+1){this.raise(K.UnexpectedSpaceBetweenModuloChecks,t)}if(this.eat(10)){e.value=super.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,2048,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(127)){if(this.match(16)){return this.flowParseDeclareModuleExports(e)}else{if(t){this.raise(K.NestedDeclareModule,this.state.lastTokStartLoc)}return this.flowParseDeclareModule(e)}}else if(this.isContextual(130)){return this.flowParseDeclareTypeAlias(e)}else if(this.isContextual(131)){return this.flowParseDeclareOpaqueType(e)}else if(this.isContextual(129)){return this.flowParseDeclareInterface(e)}else if(this.match(82)){return this.flowParseDeclareExportDeclaration(e,t)}else{this.unexpected()}}flowParseDeclareVariable(e){this.next();e.id=this.flowParseTypeAnnotatableIdentifier(true);this.scope.declareName(e.id.name,5,e.id.loc.start);this.semicolon();return this.finishNode(e,"DeclareVariable")}flowParseDeclareModule(e){this.scope.enter(0);if(this.match(134)){e.id=super.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(130)&&!this.match(87)){this.raise(K.InvalidNonTypeImportInDeclareModule,this.state.lastTokStartLoc)}super.parseImport(e)}else{this.expectContextual(125,K.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(K.AmbiguousDeclareModuleKind,e)}i="ES"}else if(e.type==="DeclareModuleExports"){if(r){this.raise(K.DuplicateDeclareModuleExports,e)}if(i==="ES"){this.raise(K.AmbiguousDeclareModuleKind,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(130)||this.isContextual(129))&&!t){const e=this.state.value;throw this.raise(K.UnsupportedDeclareExportKind,this.state.startLoc,{unsupportedExportKind:e,suggestion:H[e]})}if(this.match(74)||this.match(68)||this.match(80)||this.isContextual(131)){e.declaration=this.flowParseDeclare(this.startNode());e.default=false;return this.finishNode(e,"DeclareExportDeclaration")}else if(this.match(55)||this.match(5)||this.isContextual(129)||this.isContextual(130)||this.isContextual(131)){e=this.parseExport(e,null);if(e.type==="ExportNamedDeclaration"){e.default=false;delete e.exportKind;return this.castNodeTo(e,"DeclareExportDeclaration")}else{return this.castNodeTo(e,"DeclareExportAllDeclaration")}}}this.unexpected()}flowParseDeclareModuleExports(e){this.next();this.expectContextual(111);e.typeAnnotation=this.flowParseTypeAnnotation();this.semicolon();return this.finishNode(e,"DeclareModuleExports")}flowParseDeclareTypeAlias(e){this.next();const t=this.flowParseTypeAlias(e);this.castNodeTo(t,"DeclareTypeAlias");return t}flowParseDeclareOpaqueType(e){this.next();const t=this.flowParseOpaqueType(e,true);this.castNodeTo(t,"DeclareOpaqueType");return t}flowParseDeclareInterface(e){this.next();this.flowParseInterfaceish(e,false);return this.finishNode(e,"DeclareInterface")}flowParseInterfaceish(e,t){e.id=this.flowParseRestrictedIdentifier(!t,true);this.scope.declareName(e.id.name,t?17:8201,e.id.loc.start);if(this.match(47)){e.typeParameters=this.flowParseTypeParameterDeclaration()}else{e.typeParameters=null}e.extends=[];if(this.eat(81)){do{e.extends.push(this.flowParseInterfaceExtends())}while(!t&&this.eat(12))}if(t){e.implements=[];e.mixins=[];if(this.eatContextual(117)){do{e.mixins.push(this.flowParseInterfaceExtends())}while(this.eat(12))}if(this.eatContextual(113)){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,false);return this.finishNode(e,"InterfaceDeclaration")}checkNotUnderscore(e){if(e==="_"){this.raise(K.UnexpectedReservedUnderscore,this.state.startLoc)}}checkReservedType(e,t,s){if(!_.has(e))return;this.raise(s?K.AssignReservedType:K.UnexpectedReservedType,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,8201,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(130);e.id=this.flowParseRestrictedIdentifier(true,true);this.scope.declareName(e.id.name,8201,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(K.MissingTypeParamDefault,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(143)){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")}flowInTopLevelContext(e){if(this.curContext()!==d.brace){const t=this.state.context;this.state.context=[t[0]];try{return e()}finally{this.state.context=t}}else{return e()}}flowParseTypeParameterInstantiationInExpression(){if(this.reScan_lt()!==47)return;return this.flowParseTypeParameterInstantiation()}flowParseTypeParameterInstantiation(){const e=this.startNode();const t=this.state.inType;this.state.inType=true;e.params=[];this.flowInTopLevelContext((()=>{this.expect(47);const t=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=t}));this.state.inType=t;if(!this.state.inType&&this.curContext()===d.brace){this.reScan_lt_gt()}this.expect(48);return this.finishNode(e,"TypeParameterInstantiation")}flowParseTypeParameterInstantiationCallOrNew(){if(this.reScan_lt()!==47)return;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(129);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(135)||this.match(134)?super.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.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 l=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 c=this.startNode();if(i&&this.isContextual(118)){const t=this.lookahead();if(t.type!==14&&t.type!==17){this.next();a=this.state.startLoc;e=false}}if(e&&this.isContextual(106)){const e=this.lookahead();if(e.type!==14&&e.type!==17){this.next();t=true}}const p=this.flowParseVariance();if(this.eat(0)){if(a!=null){this.unexpected(a)}if(this.eat(0)){if(p){this.unexpected(p.loc.start)}n.internalSlots.push(this.flowParseObjectTypeInternalSlot(c,t))}else{n.indexers.push(this.flowParseObjectTypeIndexer(c,t,p))}}else if(this.match(10)||this.match(47)){if(a!=null){this.unexpected(a)}if(p){this.unexpected(p.loc.start)}n.callProperties.push(this.flowParseObjectTypeCallProperty(c,t))}else{let e="init";if(this.isContextual(99)||this.isContextual(104)){const t=this.lookahead();if(tokenIsLiteralPropertyName(t.type)){e=this.state.value;this.next()}}const i=this.flowParseObjectTypeProperty(c,t,a,p,e,s,r!=null?r:!h);if(i===null){l=true;o=this.state.lastTokStartLoc}else{n.properties.push(i)}}this.flowObjectTypeSemicolon();if(o&&!this.match(8)&&!this.match(9)){this.raise(K.UnexpectedExplicitInexactInObject,o)}}this.expect(o);if(s){n.inexact=l}const c=this.finishNode(n,"ObjectTypeAnnotation");this.state.inType=a;return c}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(K.InexactInsideNonObject,this.state.lastTokStartLoc)}else if(!n){this.raise(K.InexactInsideExact,this.state.lastTokStartLoc)}if(i){this.raise(K.InexactVariance,i)}return null}if(!a){this.raise(K.UnexpectedSpreadType,this.state.lastTokStartLoc)}if(s!=null){this.unexpected(s)}if(i){this.raise(K.SpreadVariance,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.loc.start));if(r==="get"||r==="set"){this.flowCheckGetterSetterParams(e)}if(!a&&e.key.name==="constructor"&&e.value.this){this.raise(K.ThisParamBannedInConstructor,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"?K.GetterMayNotHaveThisParam:K.SetterMayNotHaveThisParam,e.value.this)}if(s!==t){this.raise(e.kind==="get"?p.BadGetterArity:p.BadSetterArity,e)}if(e.kind==="set"&&e.value.rest){this.raise(p.BadSetterRestParameter,e)}}flowObjectTypeSemicolon(){if(!this.eat(13)&&!this.eat(12)&&!this.match(8)&&!this.match(9)){this.unexpected()}}flowParseQualifiedTypeIdentifier(e,t){e!=null?e:e=this.state.startLoc;let s=t||this.flowParseRestrictedIdentifier(true);while(this.eat(16)){const t=this.startNodeAt(e);t.qualification=s;t.id=this.flowParseRestrictedIdentifier(true);s=this.finishNode(t,"QualifiedTypeIdentifier")}return s}flowParseGenericType(e,t){const s=this.startNodeAt(e);s.typeParameters=null;s.id=this.flowParseQualifiedTypeIdentifier(e,t);if(this.match(47)){s.typeParameters=this.flowParseTypeParameterInstantiation()}return this.finishNode(s,"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(K.ThisParamMustBeFirst,r)}t=this.parseIdentifier(n);if(this.eat(17)){s=true;if(n){this.raise(K.ThisParamMayNotBeOptional,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.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){switch(s.name){case"any":return this.finishNode(t,"AnyTypeAnnotation");case"bool":case"boolean":return this.finishNode(t,"BooleanTypeAnnotation");case"mixed":return this.finishNode(t,"MixedTypeAnnotation");case"empty":return this.finishNode(t,"EmptyTypeAnnotation");case"number":return this.finishNode(t,"NumberTypeAnnotation");case"string":return this.finishNode(t,"StringTypeAnnotation");case"symbol":return this.finishNode(t,"SymbolTypeAnnotation");default:this.checkNotUnderscore(s.name);return this.flowParseGenericType(e,s)}}flowParsePrimaryType(){const e=this.state.startLoc;const t=this.startNode();let s;let i;let r=false;const a=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;i=this.flowParseTupleType();this.state.noAnonFunctionType=a;return i;case 47:{const e=this.startNode();e.typeParameters=this.flowParseTypeParameterDeclaration();this.expect(10);s=this.flowParseFunctionTypeParams();e.params=s.params;e.rest=s.rest;e.this=s._this;this.expect(11);this.expect(19);e.returnType=this.flowParseType();return this.finishNode(e,"FunctionTypeAnnotation")}case 10:{const e=this.startNode();this.next();if(!this.match(11)&&!this.match(21)){if(tokenIsIdentifier(this.state.type)||this.match(78)){const e=this.lookahead().type;r=e!==17&&e!==14}else{r=true}}if(r){this.state.noAnonFunctionType=false;i=this.flowParseType();this.state.noAnonFunctionType=a;if(this.state.noAnonFunctionType||!(this.match(12)||this.match(11)&&this.lookahead().type===19)){this.expect(11);return i}else{this.eat(12)}}if(i){s=this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(i)])}else{s=this.flowParseFunctionTypeParams()}e.params=s.params;e.rest=s.rest;e.this=s._this;this.expect(11);this.expect(19);e.returnType=this.flowParseType();e.typeParameters=null;return this.finishNode(e,"FunctionTypeAnnotation")}case 134:return this.parseLiteral(this.state.value,"StringLiteralTypeAnnotation");case 85:case 86:t.value=this.match(85);this.next();return this.finishNode(t,"BooleanLiteralTypeAnnotation");case 53:if(this.state.value==="-"){this.next();if(this.match(135)){return this.parseLiteralAtNode(-this.state.value,"NumberLiteralTypeAnnotation",t)}if(this.match(136)){return this.parseLiteralAtNode(-this.state.value,"BigIntLiteralTypeAnnotation",t)}throw this.raise(K.UnexpectedSubtractionOperand,this.state.startLoc)}this.unexpected();return;case 135:return this.parseLiteral(this.state.value,"NumberLiteralTypeAnnotation");case 136:return this.parseLiteral(this.state.value,"BigIntLiteralTypeAnnotation");case 88:this.next();return this.finishNode(t,"VoidTypeAnnotation");case 84:this.next();return this.finishNode(t,"NullLiteralTypeAnnotation");case 78:this.next();return this.finishNode(t,"ThisTypeAnnotation");case 55:this.next();return this.finishNode(t,"ExistsTypeAnnotation");case 87:return this.flowParseTypeofType();default:if(tokenIsKeyword(this.state.type)){const e=tokenLabelName(this.state.type);this.next();return super.createIdentifier(t,e)}else if(tokenIsIdentifier(this.state.type)){if(this.isContextual(129)){return this.flowParseInterfaceType()}return this.flowIdentToTypeAnnotation(e,t,this.parseIdentifier())}}this.unexpected()}flowParsePostfixType(){const e=this.state.startLoc;let t=this.flowParsePrimaryType();let s=false;while((this.match(0)||this.match(18))&&!this.canInsertSemicolon()){const i=this.startNodeAt(e);const r=this.eat(18);s=s||r;this.expect(0);if(!r&&this.match(3)){i.elementType=t;this.next();t=this.finishNode(i,"ArrayTypeAnnotation")}else{i.objectType=t;i.indexType=this.flowParseType();this.expect(3);if(s){i.optional=r;t=this.finishNode(i,"OptionalIndexedAccessType")}else{t=this.finishNode(i,"IndexedAccessType")}}}return t}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.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===132&&this.state.value==="_"){const e=this.state.startLoc;const t=this.parseIdentifier();return this.flowParseGenericType(e,t)}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();return this.finishNode(e,"Variance")}return e}parseFunctionBody(e,t,s=false){if(t){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}return super.parseFunctionBodyAndFinish(e,t,s)}parseStatementLike(e){if(this.state.strict&&this.isContextual(129)){const e=this.lookahead();if(tokenIsKeywordOrIdentifier(e.type)){const e=this.startNode();this.next();return this.flowParseInterface(e)}}else if(this.isContextual(126)){const e=this.startNode();this.next();return this.flowParseEnumDeclaration(e)}const t=super.parseStatementLike(e);if(this.flowPragma===undefined&&!this.isValidDirective(t)){this.flowPragma=null}return t}parseExpressionStatement(e,t,s){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,s)}shouldParseExportDeclaration(){const{type:e}=this.state;if(e===126||tokenIsFlowInterfaceOrTypeOrOpaque(e)){return!this.state.containsEsc}return super.shouldParseExportDeclaration()}isExportDefaultSpecifier(){const{type:e}=this.state;if(e===126||tokenIsFlowInterfaceOrTypeOrOpaque(e)){return this.state.containsEsc}return super.isExportDefaultSpecifier()}parseExportDefaultExpression(){if(this.isContextual(126)){const e=this.startNode();this.next();return this.flowParseEnumDeclaration(e)}return super.parseExportDefaultExpression()}parseConditional(e,t,s){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(s);return e}}this.expect(17);const i=this.state.clone();const r=this.state.noArrowAt;const a=this.startNodeAt(t);let{consequent:n,failed:o}=this.tryParseConditionalConsequent();let[h,l]=this.getArrowLikeExpressions(n);if(o||l.length>0){const e=[...r];if(l.length>0){this.state=i;this.state.noArrowAt=e;for(let t=0;t<l.length;t++){e.push(l[t].start)}({consequent:n,failed:o}=this.tryParseConditionalConsequent());[h,l]=this.getArrowLikeExpressions(n)}if(o&&h.length>1){this.raise(K.AmbiguousConditionalArrow,i.startLoc)}if(o&&h.length===1){this.state=i;e.push(h[0].start);this.state.noArrowAt=e;({consequent:n,failed:o}=this.tryParseConditionalConsequent())}}this.getArrowLikeExpressions(n,true);this.state.noArrowAt=r;this.expect(14);a.test=e;a.consequent=n;a.alternate=this.forwardNoArrowParamsConversionAt(a,(()=>this.parseMaybeAssign(undefined,undefined)));return this.finishNode(a,"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"&&e.body.type!=="BlockStatement"){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(514|4);super.checkParams(e,false,true);this.scope.exit()}forwardNoArrowParamsConversionAt(e,t){let s;if(this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(e.start))){this.state.noArrowParamsConversionAt.push(this.state.start);s=t();this.state.noArrowParamsConversionAt.pop()}else{s=t()}return s}parseParenItem(e,t){const s=super.parseParenItem(e,t);if(this.eat(17)){s.optional=true;this.resetEndLocation(e)}if(this.match(14)){const e=this.startNodeAt(t);e.expression=s;e.typeAnnotation=this.flowParseTypeAnnotation();return this.finishNode(e,"TypeCastExpression")}return s}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)}parseExportDeclaration(e){if(this.isContextual(130)){e.exportKind="type";const t=this.startNode();this.next();if(this.match(5)){e.specifiers=this.parseExportSpecifiers(true);super.parseExportFrom(e);return null}else{return this.flowParseTypeAlias(t)}}else if(this.isContextual(131)){e.exportKind="type";const t=this.startNode();this.next();return this.flowParseOpaqueType(t,false)}else if(this.isContextual(129)){e.exportKind="type";const t=this.startNode();this.next();return this.flowParseInterface(t)}else if(this.isContextual(126)){e.exportKind="value";const t=this.startNode();this.next();return this.flowParseEnumDeclaration(t)}else{return super.parseExportDeclaration(e)}}eatExportStar(e){if(super.eatExportStar(e))return true;if(this.isContextual(130)&&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(125)){if(super.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(K.DeclareClassElement,i)}else if(t.value){this.raise(K.DeclareClassFieldInitializer,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(p.InvalidIdentifier,this.state.curPosition(),{identifierName:t})}this.finishToken(132,t)}getTokenFromCode(e){const t=this.input.charCodeAt(this.state.pos+1);if(e===123&&t===124){this.finishOp(6,2)}else if(this.state.inType&&(e===62||e===60)){this.finishOp(e===62?48:47,1)}else if(this.state.inType&&e===63){if(t===46){this.finishOp(18,2)}else{this.finishOp(17,1)}}else if(isIteratorStart(e,t,this.input.charCodeAt(this.state.pos+2))){this.state.pos+=2;this.readIterator()}else{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(e,t)}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(K.TypeCastInPattern,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,s){return e==="TypeCastExpression"||super.isValidLVal(e,t,s)}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(K.ThisParamBannedInConstructor,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(K.ThisParamBannedInConstructor,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)||this.match(51))){{e.superTypeParameters=this.flowParseTypeParameterInstantiationInExpression()}}if(this.isContextual(113)){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(K.GetterMayNotHaveThisParam,s)}else if(this.isThisParam(s)){this.raise(K.SetterMayNotHaveThisParam,s)}}}parsePropertyNamePrefixOperator(e){e.variance=this.flowParseVariance()}parseObjPropValue(e,t,s,i,r,a,n){if(e.variance){this.unexpected(e.variance.loc.start)}delete e.variance;let o;if(this.match(47)&&!a){o=this.flowParseTypeParameterDeclaration();if(!this.match(10))this.unexpected()}const h=super.parseObjPropValue(e,t,s,i,r,a,n);if(o){(h.value||h).typeParameters=o}return h}parseFunctionParamType(e){if(this.eat(17)){if(e.type!=="Identifier"){this.raise(K.PatternIsOptional,e)}if(this.isThisParam(e)){this.raise(K.ThisParamMayNotBeOptional,e)}e.optional=true}if(this.match(14)){e.typeAnnotation=this.flowParseTypeAnnotation()}else if(this.isThisParam(e)){this.raise(K.ThisParamAnnotationRequired,e)}if(this.match(29)&&this.isThisParam(e)){this.raise(K.ThisParamNoDefault,e)}this.resetEndLocation(e);return e}parseMaybeDefault(e,t){const s=super.parseMaybeDefault(e,t);if(s.type==="AssignmentPattern"&&s.typeAnnotation&&s.right.start<s.typeAnnotation.start){this.raise(K.TypeBeforeInitializer,s.typeAnnotation)}return s}checkImportReflection(e){super.checkImportReflection(e);if(e.module&&e.importKind!=="value"){this.raise(K.ImportReflectionHasImportType,e.specifiers[0].loc.start)}}parseImportSpecifierLocal(e,t,s){t.local=hasTypeImportKind(e)?this.flowParseRestrictedIdentifier(true,true):this.parseIdentifier();e.specifiers.push(this.finishImportSpecifier(t,s))}isPotentialImportPhase(e){if(super.isPotentialImportPhase(e))return true;if(this.isContextual(130)){if(!e)return true;const t=this.lookaheadCharCode();return t===123||t===42}return!e&&this.isContextual(87)}applyImportPhase(e,t,s,i){super.applyImportPhase(e,t,s,i);if(t){if(!s&&this.match(65)){return}e.exportKind=s==="type"?s:"value"}else{if(s==="type"&&this.match(55))this.unexpected();e.importKind=s==="type"||s==="typeof"?s:"value"}}parseImportSpecifier(e,t,s,i,r){const a=e.imported;let n=null;if(a.type==="Identifier"){if(a.name==="type"){n="type"}else if(a.name==="typeof"){n="typeof"}}let o=false;if(this.isContextual(93)&&!this.isLookaheadContextual("as")){const t=this.parseIdentifier(true);if(n!==null&&!tokenIsKeywordOrIdentifier(this.state.type)){e.imported=t;e.importKind=n;e.local=this.cloneIdentifier(t)}else{e.imported=a;e.importKind=null;e.local=this.parseIdentifier()}}else{if(n!==null&&tokenIsKeywordOrIdentifier(this.state.type)){e.imported=this.parseIdentifier(true);e.importKind=n}else{if(t){throw this.raise(p.ImportBindingIsString,e,{importName:a.value})}e.imported=a;e.importKind=null}if(this.eatContextual(93)){e.local=this.parseIdentifier()}else{o=true;e.local=this.cloneIdentifier(e.imported)}}const h=hasTypeImportKind(e);if(s&&h){this.raise(K.ImportTypeShorthandOnlyInPureImport,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(143)||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===d.j_oTag||a===d.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(K.UnexpectedTypeParameterBeforeAsyncArrowFunction,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(K.UnexpectedTokenAfterTypeParameter,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.includes(this.offsetToSourcePos(e.start))){e.params=t}else{super.setArrowFunctionParameters(e,t)}}checkParams(e,t,s,i=true){if(s&&this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(e.start))){return}for(let t=0;t<e.params.length;t++){if(this.isThisParam(e.params[t])&&t>0){this.raise(K.ThisParamMustBeFirst,e.params[t])}}super.checkParams(e,t,s,i)}parseParenAndDistinguishExpression(e){return super.parseParenAndDistinguishExpression(e&&!this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)))}parseSubscripts(e,t,s){if(e.type==="Identifier"&&e.name==="async"&&this.state.noArrowAt.includes(t.index)){this.next();const s=this.startNodeAt(t);s.callee=e;s.arguments=super.parseCallExpressionArguments();e=this.finishNode(s,"CallExpression")}else if(e.type==="Identifier"&&e.name==="async"&&this.match(47)){const i=this.state.clone();const r=this.tryParse((e=>this.parseAsyncArrowWithTypeParameters(t)||e()),i);if(!r.error&&!r.aborted)return r.node;const a=this.tryParse((()=>super.parseSubscripts(e,t,s)),i);if(a.node&&!a.error)return a.node;if(r.node){this.state=r.failState;return r.node}if(a.node){this.state=a.failState;return a.node}throw r.error||a.error}return super.parseSubscripts(e,t,s)}parseSubscript(e,t,s,i){if(this.match(18)&&this.isLookaheadToken_lt()){i.optionalChainMember=true;if(s){i.stop=true;return e}this.next();const r=this.startNodeAt(t);r.callee=e;r.typeArguments=this.flowParseTypeParameterInstantiationInExpression();this.expect(10);r.arguments=this.parseCallExpressionArguments();r.optional=true;return this.finishCallExpression(r,true)}else if(!s&&this.shouldParseTypes()&&(this.match(47)||this.match(51))){const s=this.startNodeAt(t);s.callee=e;const r=this.tryParse((()=>{s.typeArguments=this.flowParseTypeParameterInstantiationCallOrNew();this.expect(10);s.arguments=super.parseCallExpressionArguments();if(i.optionalChainMember){s.optional=false}return this.finishCallExpression(s,i.optionalChainMember)}));if(r.node){if(r.error)this.state=r.failState;return r.node}}return super.parseSubscript(e,t,s,i)}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){const t=this.startNodeAt(e);this.parseFunctionParams(t,false);if(!this.parseArrow(t))return;return super.parseArrowExpression(t,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(K.UnterminatedFlowComment,this.state.curPosition())}return s}skipBlockComment(){if(this.hasPlugin("flowComments")&&this.skipFlowComment()){if(this.state.hasFlowComment){throw this.raise(K.NestedFlowComment,this.state.startLoc)}this.hasFlowCommentCompletion();const e=this.skipFlowComment();if(e){this.state.pos+=e;this.state.hasFlowComment=true}return}return super.skipBlockComment(this.state.hasFlowComment?"*-/":"*/")}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(p.UnterminatedComment,this.state.curPosition())}}flowEnumErrorBooleanMemberNotInitialized(e,{enumName:t,memberName:s}){this.raise(K.EnumBooleanMemberNotInitialized,e,{memberName:s,enumName:t})}flowEnumErrorInvalidMemberInitializer(e,t){return this.raise(!t.explicitType?K.EnumInvalidMemberInitializerUnknownType:t.explicitType==="symbol"?K.EnumInvalidMemberInitializerSymbolType:K.EnumInvalidMemberInitializerPrimaryType,e,t)}flowEnumErrorNumberMemberNotInitialized(e,t){this.raise(K.EnumNumberMemberNotInitialized,e,t)}flowEnumErrorStringMemberInconsistentlyInitialized(e,t){this.raise(K.EnumStringMemberInconsistentlyInitialized,e,t)}flowEnumMemberInit(){const e=this.state.startLoc;const endOfInit=()=>this.match(12)||this.match(8);switch(this.state.type){case 135:{const t=this.parseNumericLiteral(this.state.value);if(endOfInit()){return{type:"number",loc:t.loc.start,value:t}}return{type:"invalid",loc:e}}case 134:{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(K.EnumInvalidMemberName,n,{memberName:h,suggestion:h[0].toUpperCase()+h.slice(1),enumName:e})}if(s.has(h)){this.raise(K.EnumDuplicateMemberName,n,{memberName:h,enumName:e})}s.add(h);const l={enumName:e,explicitType:t,memberName:h};a.id=n;switch(o.type){case"boolean":{this.flowEnumCheckExplicitTypeMismatch(o.loc,l,"boolean");a.init=o.value;i.booleanMembers.push(this.finishNode(a,"EnumBooleanMember"));break}case"number":{this.flowEnumCheckExplicitTypeMismatch(o.loc,l,"number");a.init=o.value;i.numberMembers.push(this.finishNode(a,"EnumNumberMember"));break}case"string":{this.flowEnumCheckExplicitTypeMismatch(o.loc,l,"string");a.init=o.value;i.stringMembers.push(this.finishNode(a,"EnumStringMember"));break}case"invalid":{throw this.flowEnumErrorInvalidMemberInitializer(o.loc,l)}case"none":{switch(t){case"boolean":this.flowEnumErrorBooleanMemberNotInitialized(o.loc,l);break;case"number":this.flowEnumErrorNumberMemberNotInitialized(o.loc,l);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.flowEnumErrorStringMemberInconsistentlyInitialized(t,{enumName:s})}return t}else{for(const e of t){this.flowEnumErrorStringMemberInconsistentlyInitialized(e,{enumName:s})}return e}}flowEnumParseExplicitType({enumName:e}){if(!this.eatContextual(102))return null;if(!tokenIsIdentifier(this.state.type)){throw this.raise(K.EnumInvalidExplicitTypeUnknownSupplied,this.state.startLoc,{enumName:e})}const{value:t}=this.state;this.next();if(t!=="boolean"&&t!=="number"&&t!=="string"&&t!=="symbol"){this.raise(K.EnumInvalidExplicitType,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(K.EnumInconsistentMemberValues,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")}jsxParseOpeningElementAfterName(e){if(this.shouldParseTypes()){if(this.match(47)||this.match(51)){e.typeArguments=this.flowParseTypeParameterInstantiationInExpression()}}return super.jsxParseOpeningElementAfterName(e)}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}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}maybeUnwrapTypeCastExpression(e){return e.type==="TypeCastExpression"?e.expression:e}};const z={__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 q=/\r\n|[\r\n\u2028\u2029]/;const $=new RegExp(q.source,"g");function isNewLine(e){switch(e){case 10:case 13:case 8232:case 8233:return true;default:return false}}function hasNewLine(e,t,s){for(let i=t;i<s;i++){if(isNewLine(e.charCodeAt(i))){return true}}return false}const W=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;const J=/(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;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}}const X=ParseErrorEnum`jsx`({AttributeIsEmpty:"JSX attributes must only be assigned a non-empty expression.",MissingClosingTagElement:({openingTagName:e})=>`Expected corresponding JSX closing tag for <${e}>.`,MissingClosingTagFragment:"Expected corresponding JSX closing tag for <>.",UnexpectedSequenceExpression:"Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",UnexpectedToken:({unexpected:e,HTMLEntity:t})=>`Unexpected token \`${e}\`. Did you mean \`${t}\` or \`{'${e}'}\`?`,UnsupportedJsxValue:"JSX value should be either an expression or a quoted JSX text.",UnterminatedJsxContent:"Unterminated JSX contents.",UnwrappedAdjacentJSXElements:"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 JSXParserMixin extends e{jsxReadToken(){let e="";let t=this.state.pos;for(;;){if(this.state.pos>=this.length){throw this.raise(X.UnterminatedJsxContent,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;this.finishToken(143)}else{super.getTokenFromCode(s)}return}e+=this.input.slice(t,this.state.pos);this.finishToken(142,e);return;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(p.UnterminatedString,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++);this.finishToken(134,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=z[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);this.finishToken(141,this.input.slice(t,this.state.pos))}jsxParseIdentifier(){const e=this.startNode();if(this.match(141)){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.startLoc;const t=this.jsxParseIdentifier();if(!this.eat(14))return t;const s=this.startNodeAt(e);s.namespace=t;s.name=this.jsxParseIdentifier();return this.finishNode(s,"JSXNamespacedName")}jsxParseElementName(){const e=this.state.startLoc;let t=this.jsxParseNamespacedName();if(t.type==="JSXNamespacedName"){return t}while(this.eat(16)){const s=this.startNodeAt(e);s.object=t;s.property=this.jsxParseIdentifier();t=this.finishNode(s,"JSXMemberExpression")}return t}jsxParseAttributeValue(){let e;switch(this.state.type){case 5:e=this.startNode();this.setContext(d.brace);this.next();e=this.jsxParseExpressionContainer(e,d.j_oTag);if(e.expression.type==="JSXEmptyExpression"){this.raise(X.AttributeIsEmpty,e)}return e;case 143:case 134:return this.parseExprAtom();default:throw this.raise(X.UnsupportedJsxValue,this.state.startLoc)}}jsxParseEmptyExpression(){const e=this.startNodeAt(this.state.lastTokEndLoc);return this.finishNodeAt(e,"JSXEmptyExpression",this.state.startLoc)}jsxParseSpreadChild(e){this.next();e.expression=this.parseExpression();this.setContext(d.j_expr);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(d.brace);this.next();this.expect(21);e.argument=this.parseMaybeAssignAllowIn();this.setContext(d.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){const t=this.startNodeAt(e);if(this.eat(144)){return this.finishNode(t,"JSXOpeningFragment")}t.name=this.jsxParseElementName();return this.jsxParseOpeningElementAfterName(t)}jsxParseOpeningElementAfterName(e){const t=[];while(!this.match(56)&&!this.match(144)){t.push(this.jsxParseAttribute())}e.attributes=t;e.selfClosing=this.eat(56);this.expect(144);return this.finishNode(e,"JSXOpeningElement")}jsxParseClosingElementAt(e){const t=this.startNodeAt(e);if(this.eat(144)){return this.finishNode(t,"JSXClosingFragment")}t.name=this.jsxParseElementName();this.expect(144);return this.finishNode(t,"JSXClosingElement")}jsxParseElementAt(e){const t=this.startNodeAt(e);const s=[];const i=this.jsxParseOpeningElementAt(e);let r=null;if(!i.selfClosing){e:for(;;){switch(this.state.type){case 143:e=this.state.startLoc;this.next();if(this.eat(56)){r=this.jsxParseClosingElementAt(e);break e}s.push(this.jsxParseElementAt(e));break;case 142:s.push(this.parseLiteral(this.state.value,"JSXText"));break;case 5:{const e=this.startNode();this.setContext(d.brace);this.next();if(this.match(21)){s.push(this.jsxParseSpreadChild(e))}else{s.push(this.jsxParseExpressionContainer(e,d.j_expr))}break}default:this.unexpected()}}if(isFragment(i)&&!isFragment(r)&&r!==null){this.raise(X.MissingClosingTagFragment,r)}else if(!isFragment(i)&&isFragment(r)){this.raise(X.MissingClosingTagElement,r,{openingTagName:getQualifiedJSXName(i.name)})}else if(!isFragment(i)&&!isFragment(r)){if(getQualifiedJSXName(r.name)!==getQualifiedJSXName(i.name)){this.raise(X.MissingClosingTagElement,r,{openingTagName:getQualifiedJSXName(i.name)})}}}if(isFragment(i)){t.openingFragment=i;t.closingFragment=r}else{t.openingElement=i;t.closingElement=r}t.children=s;if(this.match(47)){throw this.raise(X.UnwrappedAdjacentJSXElements,this.state.startLoc)}return isFragment(i)?this.finishNode(t,"JSXFragment"):this.finishNode(t,"JSXElement")}jsxParseElement(){const e=this.state.startLoc;this.next();return this.jsxParseElementAt(e)}setContext(e){const{context:t}=this.state;t[t.length-1]=e}parseExprAtom(e){if(this.match(143)){return this.jsxParseElement()}else if(this.match(47)&&this.input.charCodeAt(this.state.pos)!==33){this.replaceToken(143);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===d.j_expr){this.jsxReadToken();return}if(t===d.j_oTag||t===d.j_cTag){if(isIdentifierStart(e)){this.jsxReadWord();return}if(e===62){++this.state.pos;this.finishToken(144);return}if((e===34||e===39)&&t===d.j_oTag){this.jsxReadString(e);return}}if(e===60&&this.state.canStartJSXElement&&this.input.charCodeAt(this.state.pos+1)!==33){++this.state.pos;this.finishToken(143);return}super.getTokenFromCode(e)}updateContext(e){const{context:t,type:s}=this.state;if(s===56&&e===143){t.splice(-2,2,d.j_cTag);this.state.canStartJSXElement=false}else if(s===143){t.push(d.j_oTag)}else if(s===144){const s=t[t.length-1];if(s===d.j_oTag&&e===56||s===d.j_cTag){t.pop();this.state.canStartJSXElement=t[t.length-1]===d.j_expr}else{this.setContext(d.j_expr);this.state.canStartJSXElement=true}}else{this.state.canStartJSXElement=tokenComesBeforeExpression(s)}}};class TypeScriptScope extends Scope{constructor(...e){super(...e);this.tsNames=new Map}}class TypeScriptScopeHandler extends ScopeHandler{constructor(...e){super(...e);this.importsStack=[]}createScope(e){this.importsStack.push(new Set);return new TypeScriptScope(e)}enter(e){if(e===1024){this.importsStack.push(new Set)}super.enter(e)}exit(){const e=super.exit();if(e===1024){this.importsStack.pop()}return e}hasImport(e,t){const s=this.importsStack.length;if(this.importsStack[s-1].has(e)){return true}if(!t&&s>1){for(let t=0;t<s-1;t++){if(this.importsStack[t].has(e))return true}}return false}declareName(e,t,s){if(t&4096){if(this.hasImport(e,true)){this.parser.raise(p.VarRedeclaration,s,{identifierName:e})}this.importsStack[this.importsStack.length-1].add(e);return}const i=this.currentScope();let r=i.tsNames.get(e)||0;if(t&1024){this.maybeExportDefined(i,e);i.tsNames.set(e,r|16);return}super.declareName(e,t,s);if(t&2){if(!(t&1)){this.checkRedeclarationInScope(i,e,t,s);this.maybeExportDefined(i,e)}r=r|1}if(t&256){r=r|2}if(t&512){r=r|4}if(t&128){r=r|8}if(r)i.tsNames.set(e,r)}isRedeclaredInScope(e,t,s){const i=e.tsNames.get(t);if((i&2)>0){if(s&256){const e=!!(s&512);const t=(i&4)>0;return e!==t}return true}if(s&128&&(i&8)>0){if(e.names.get(t)&2){return!!(s&1)}else{return false}}if(s&2&&(i&1)>0){return true}return super.isRedeclaredInScope(e,t,s)}checkLocalExport(e){const{name:t}=e;if(this.hasImport(t))return;const s=this.scopeStack.length;for(let e=s-1;e>=0;e--){const s=this.scopeStack[e];const i=s.tsNames.get(t);if((i&1)>0||(i&16)>0){return}}super.checkLocalExport(e)}}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()&2)>0}get hasYield(){return(this.currentFlags()&1)>0}get hasReturn(){return(this.currentFlags()&4)>0}get hasIn(){return(this.currentFlags()&8)>0}}function functionFlags(e,t){return(e?2:0)|(t?1:0)}class BaseParser{constructor(){this.sawUnambiguousESM=false;this.ambiguousScriptDifferentAst=false}sourceToOffsetPos(e){return e+this.startIndex}offsetToSourcePos(e){return e-this.startIndex}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;const{commentsLen:t}=this.state;if(this.comments.length!==t){this.comments.length=t}this.comments.push(e);this.state.commentsLen++}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){var t;const{comments:s}=e;if(e.leadingNode!==null||e.trailingNode!==null){if(e.leadingNode!==null){setTrailingComments(e.leadingNode,s)}if(e.trailingNode!==null){setLeadingComments(e.trailingNode,s)}}else{const{containingNode:i,start:r}=e;if(this.input.charCodeAt(this.offsetToSourcePos(r)-1)===44){switch(i.type){case"ObjectExpression":case"ObjectPattern":case"RecordExpression":adjustInnerComments(i,i.properties,e);break;case"CallExpression":case"OptionalCallExpression":adjustInnerComments(i,i.arguments,e);break;case"ImportExpression":adjustInnerComments(i,[i.source,(t=i.options)!=null?t:null],e);break;case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"ObjectMethod":case"ClassMethod":case"ClassPrivateMethod":adjustInnerComments(i,i.params,e);break;case"ArrayExpression":case"ArrayPattern":case"TupleExpression":adjustInnerComments(i,i.elements,e);break;case"ExportNamedDeclaration":case"ImportDeclaration":adjustInnerComments(i,i.specifiers,e);break;case"TSEnumDeclaration":{adjustInnerComments(i,i.members,e)}break;case"TSEnumBody":adjustInnerComments(i,i.members,e);break;default:{setInnerComments(i,s)}}}else{setInnerComments(i,s)}}}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}}}}class State{constructor(){this.flags=1024;this.startIndex=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.topicContext={maxNumOfResolvableTopics:0,maxTopicIndex:null};this.labels=[];this.commentsLen=0;this.commentStack=[];this.pos=0;this.type=140;this.value=null;this.start=0;this.end=0;this.lastTokEndLoc=null;this.lastTokStartLoc=null;this.context=[d.brace];this.firstInvalidTemplateEscapePos=null;this.strictErrors=new Map;this.tokensLength=0}get strict(){return(this.flags&1)>0}set strict(e){if(e)this.flags|=1;else this.flags&=-2}init({strictMode:e,sourceType:t,startIndex:s,startLine:i,startColumn:r}){this.strict=e===false?false:e===true?true:t==="module";this.startIndex=s;this.curLine=i;this.lineStart=-r;this.startLoc=this.endLoc=new Position(i,r,s)}get maybeInArrowParameters(){return(this.flags&2)>0}set maybeInArrowParameters(e){if(e)this.flags|=2;else this.flags&=-3}get inType(){return(this.flags&4)>0}set inType(e){if(e)this.flags|=4;else this.flags&=-5}get noAnonFunctionType(){return(this.flags&8)>0}set noAnonFunctionType(e){if(e)this.flags|=8;else this.flags&=-9}get hasFlowComment(){return(this.flags&16)>0}set hasFlowComment(e){if(e)this.flags|=16;else this.flags&=-17}get isAmbientContext(){return(this.flags&32)>0}set isAmbientContext(e){if(e)this.flags|=32;else this.flags&=-33}get inAbstractClass(){return(this.flags&64)>0}set inAbstractClass(e){if(e)this.flags|=64;else this.flags&=-65}get inDisallowConditionalTypesContext(){return(this.flags&128)>0}set inDisallowConditionalTypesContext(e){if(e)this.flags|=128;else this.flags&=-129}get soloAwait(){return(this.flags&256)>0}set soloAwait(e){if(e)this.flags|=256;else this.flags&=-257}get inFSharpPipelineDirectBody(){return(this.flags&512)>0}set inFSharpPipelineDirectBody(e){if(e)this.flags|=512;else this.flags&=-513}get canStartJSXElement(){return(this.flags&1024)>0}set canStartJSXElement(e){if(e)this.flags|=1024;else this.flags&=-1025}get containsEsc(){return(this.flags&2048)>0}set containsEsc(e){if(e)this.flags|=2048;else this.flags&=-2049}get hasTopLevelAwait(){return(this.flags&4096)>0}set hasTopLevelAwait(e){if(e)this.flags|=4096;else this.flags&=-4097}curPosition(){return new Position(this.curLine,this.pos-this.lineStart,this.pos+this.startIndex)}clone(){const e=new State;e.flags=this.flags;e.startIndex=this.startIndex;e.curLine=this.curLine;e.lineStart=this.lineStart;e.startLoc=this.startLoc;e.endLoc=this.endLoc;e.errors=this.errors.slice();e.potentialArrowAt=this.potentialArrowAt;e.noArrowAt=this.noArrowAt.slice();e.noArrowParamsConversionAt=this.noArrowParamsConversionAt.slice();e.topicContext=this.topicContext;e.labels=this.labels.slice();e.commentsLen=this.commentsLen;e.commentStack=this.commentStack.slice();e.pos=this.pos;e.type=this.type;e.value=this.value;e.start=this.start;e.end=this.end;e.lastTokEndLoc=this.lastTokEndLoc;e.lastTokStartLoc=this.lastTokStartLoc;e.context=this.context.slice();e.firstInvalidTemplateEscapePos=this.firstInvalidTemplateEscapePos;e.strictErrors=this.strictErrors;e.tokensLength=this.tokensLength;return e}}var G=function isDigit(e){return e>=48&&e<=57};const Y={decBinOct:new Set([46,66,69,79,95,98,101,111]),hex:new Set([46,88,95,120])};const Q={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};function readStringContents(e,t,s,i,r,a){const n=s;const o=i;const h=r;let l="";let c=null;let p=s;const{length:u}=t;for(;;){if(s>=u){a.unterminated(n,o,h);l+=t.slice(p,s);break}const d=t.charCodeAt(s);if(isStringEnd(e,d,t,s)){l+=t.slice(p,s);break}if(d===92){l+=t.slice(p,s);const n=readEscapedChar(t,s,i,r,e==="template",a);if(n.ch===null&&!c){c={pos:s,lineStart:i,curLine:r}}else{l+=n.ch}({pos:s,lineStart:i,curLine:r}=n);p=s}else if(d===8232||d===8233){++s;++r;i=s}else if(d===10||d===13){if(e==="template"){l+=t.slice(p,s)+"\n";++s;if(d===13&&t.charCodeAt(s)===10){++s}++r;p=i=s}else{a.unterminated(n,o,h)}}else{++s}}return{pos:s,str:l,firstInvalidLoc:c,lineStart:i,curLine:r,containsInvalid:!!c}}function isStringEnd(e,t,s,i){if(e==="template"){return t===96||t===36&&s.charCodeAt(i+1)===123}return t===(e==="double"?34:39)}function readEscapedChar(e,t,s,i,r,a){const n=!r;t++;const res=e=>({pos:t,ch:e,lineStart:s,curLine:i});const o=e.charCodeAt(t++);switch(o){case 110:return res("\n");case 114:return res("\r");case 120:{let r;({code:r,pos:t}=readHexChar(e,t,s,i,2,false,n,a));return res(r===null?null:String.fromCharCode(r))}case 117:{let r;({code:r,pos:t}=readCodePoint(e,t,s,i,n,a));return res(r===null?null:String.fromCodePoint(r))}case 116:return res("\t");case 98:return res("\b");case 118:return res("\v");case 102:return res("\f");case 13:if(e.charCodeAt(t)===10){++t}case 10:s=t;++i;case 8232:case 8233:return res("");case 56:case 57:if(r){return res(null)}else{a.strictNumericEscape(t-1,s,i)}default:if(o>=48&&o<=55){const n=t-1;const o=/^[0-7]+/.exec(e.slice(n,t+2));let h=o[0];let l=parseInt(h,8);if(l>255){h=h.slice(0,-1);l=parseInt(h,8)}t+=h.length-1;const c=e.charCodeAt(t);if(h!=="0"||c===56||c===57){if(r){return res(null)}else{a.strictNumericEscape(n,s,i)}}return res(String.fromCharCode(l))}return res(String.fromCharCode(o))}}function readHexChar(e,t,s,i,r,a,n,o){const h=t;let l;({n:l,pos:t}=readInt(e,t,s,i,16,r,a,false,o,!n));if(l===null){if(n){o.invalidEscapeSequence(h,s,i)}else{t=h-1}}return{code:l,pos:t}}function readInt(e,t,s,i,r,a,n,o,h,l){const c=t;const p=r===16?Y.hex:Y.decBinOct;const u=r===16?Q.hex:r===10?Q.dec:r===8?Q.oct:Q.bin;let d=false;let f=0;for(let c=0,m=a==null?Infinity:a;c<m;++c){const a=e.charCodeAt(t);let c;if(a===95&&o!=="bail"){const r=e.charCodeAt(t-1);const a=e.charCodeAt(t+1);if(!o){if(l)return{n:null,pos:t};h.numericSeparatorInEscapeSequence(t,s,i)}else if(Number.isNaN(a)||!u(a)||p.has(r)||p.has(a)){if(l)return{n:null,pos:t};h.unexpectedNumericSeparator(t,s,i)}++t;continue}if(a>=97){c=a-97+10}else if(a>=65){c=a-65+10}else if(G(a)){c=a-48}else{c=Infinity}if(c>=r){if(c<=9&&l){return{n:null,pos:t}}else if(c<=9&&h.invalidDigit(t,s,i,r)){c=0}else if(n){c=0;d=true}else{break}}++t;f=f*r+c}if(t===c||a!=null&&t-c!==a||d){return{n:null,pos:t}}return{n:f,pos:t}}function readCodePoint(e,t,s,i,r,a){const n=e.charCodeAt(t);let o;if(n===123){++t;({code:o,pos:t}=readHexChar(e,t,s,i,e.indexOf("}",t)-t,true,r,a));++t;if(o!==null&&o>1114111){if(r){a.invalidCodePoint(t,s,i)}else{return{code:null,pos:t}}}}else{({code:o,pos:t}=readHexChar(e,t,s,i,4,false,r,a))}return{code:o,pos:t}}function buildPosition(e,t,s){return new Position(s,e-t,e)}const Z=new Set([103,109,115,105,121,117,100,118]);class Token{constructor(e){const t=e.startIndex||0;this.type=e.type;this.value=e.value;this.start=t+e.start;this.end=t+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.errorHandlers_readInt={invalidDigit:(e,t,s,i)=>{if(!(this.optionFlags&2048))return false;this.raise(p.InvalidDigit,buildPosition(e,t,s),{radix:i});return true},numericSeparatorInEscapeSequence:this.errorBuilder(p.NumericSeparatorInEscapeSequence),unexpectedNumericSeparator:this.errorBuilder(p.UnexpectedNumericSeparator)};this.errorHandlers_readCodePoint=Object.assign({},this.errorHandlers_readInt,{invalidEscapeSequence:this.errorBuilder(p.InvalidEscapeSequence),invalidCodePoint:this.errorBuilder(p.InvalidCodePoint)});this.errorHandlers_readStringContents_string=Object.assign({},this.errorHandlers_readCodePoint,{strictNumericEscape:(e,t,s)=>{this.recordStrictModeErrors(p.StrictNumericEscape,buildPosition(e,t,s))},unterminated:(e,t,s)=>{throw this.raise(p.UnterminatedString,buildPosition(e-1,t,s))}});this.errorHandlers_readStringContents_template=Object.assign({},this.errorHandlers_readCodePoint,{strictNumericEscape:this.errorBuilder(p.StrictNumericEscape),unterminated:(e,t,s)=>{throw this.raise(p.UnterminatedTemplate,buildPosition(e,t,s))}});this.state=new State;this.state.init(e);this.input=t;this.length=t.length;this.comments=[];this.isLookahead=false}pushToken(e){this.tokens.length=this.state.tokensLength;this.tokens.push(e);++this.state.tokensLength}next(){this.checkKeywordEscapes();if(this.optionFlags&256){this.pushToken(new Token(this.state))}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){W.lastIndex=e;return W.test(this.input)?W.lastIndex:e}lookaheadCharCode(){return this.lookaheadCharCodeSince(this.state.pos)}lookaheadCharCodeSince(e){return this.input.charCodeAt(this.nextTokenStartSince(e))}nextTokenInLineStart(){return this.nextTokenInLineStartSince(this.state.pos)}nextTokenInLineStartSince(e){J.lastIndex=e;return J.test(this.input)?J.lastIndex:e}lookaheadInLineCharCode(){return this.input.charCodeAt(this.nextTokenInLineStart())}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,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(140);return}this.getTokenFromCode(this.codePointAtPos(this.state.pos))}skipBlockComment(e){let t;if(!this.isLookahead)t=this.state.curPosition();const s=this.state.pos;const i=this.input.indexOf(e,s+2);if(i===-1){throw this.raise(p.UnterminatedComment,this.state.curPosition())}this.state.pos=i+e.length;$.lastIndex=s+2;while($.test(this.input)&&$.lastIndex<=i){++this.state.curLine;this.state.lineStart=$.lastIndex}if(this.isLookahead)return;const r={type:"CommentBlock",value:this.input.slice(s+2,i),start:this.sourceToOffsetPos(s),end:this.sourceToOffsetPos(i+e.length),loc:new SourceLocation(t,this.state.curPosition())};if(this.optionFlags&256)this.pushToken(r);return r}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:this.sourceToOffsetPos(t),end:this.sourceToOffsetPos(r),loc:new SourceLocation(s,this.state.curPosition())};if(this.optionFlags&256)this.pushToken(n);return n}skipSpace(){const e=this.state.pos;const t=this.optionFlags&4096?[]:null;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);t==null||t.push(e)}break}case 47:{const e=this.skipLineComment(2);if(e!==undefined){this.addComment(e);t==null||t.push(e)}break}default:break e}break;default:if(isWhitespace(s)){++this.state.pos}else if(s===45&&!this.inModule&&this.optionFlags&8192){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);t==null||t.push(e)}}else{break e}}else if(s===60&&!this.inModule&&this.optionFlags&8192){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);t==null||t.push(e)}}else{break e}}else{break e}}}if((t==null?void 0:t.length)>0){const s=this.state.pos;const i={start:this.sourceToOffsetPos(e),end:this.sourceToOffsetPos(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(p.UnexpectedDigitAfterHash,this.state.curPosition())}if(t===123||t===91&&this.hasPlugin("recordAndTuple")){this.expectPlugin("recordAndTuple");if(this.getPluginOption("recordAndTuple","syntaxType")==="bar"){throw this.raise(t===123?p.RecordExpressionHashIncorrectStartSyntaxType:p.TupleExpressionHashIncorrectStartSyntaxType,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(139,this.readWord1(t))}else if(t===92){++this.state.pos;this.finishToken(139,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(p.RecordExpressionBarIncorrectEndSyntaxType,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(p.TupleExpressionBarIncorrectEndSyntaxType,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){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(p.TupleExpressionBarIncorrectStartSyntaxType,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(p.RecordExpressionBarIncorrectStartSyntaxType,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(p.InvalidOrUnexpectedToken,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(p.UnterminatedRegExp,createPositionWithColumnOffset(e,1))}const t=this.input.charCodeAt(r);if(isNewLine(t)){throw this.raise(p.UnterminatedRegExp,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 n="";const nextPos=()=>createPositionWithColumnOffset(e,r+2-t);while(r<this.length){const e=this.codePointAtPos(r);const t=String.fromCharCode(e);if(Z.has(e)){if(e===118){if(n.includes("u")){this.raise(p.IncompatibleRegExpUVFlags,nextPos())}}else if(e===117){if(n.includes("v")){this.raise(p.IncompatibleRegExpUVFlags,nextPos())}}if(n.includes(t)){this.raise(p.DuplicateRegExpFlags,nextPos())}}else if(isIdentifierChar(e)||e===92){this.raise(p.MalformedRegExpFlags,nextPos())}else{break}++r;n+=t}this.state.pos=r;this.finishToken(138,{pattern:a,flags:n})}readInt(e,t,s=false,i=true){const{n:r,pos:a}=readInt(this.input,this.state.pos,this.state.lineStart,this.state.curLine,e,t,s,i,this.errorHandlers_readInt,false);this.state.pos=a;return r}readRadixNumber(e){const t=this.state.pos;const s=this.state.curPosition();let i=false;this.state.pos+=2;const r=this.readInt(e);if(r==null){this.raise(p.InvalidDigit,createPositionWithColumnOffset(s,2),{radix:e})}const a=this.input.charCodeAt(this.state.pos);if(a===110){++this.state.pos;i=true}else if(a===109){throw this.raise(p.InvalidDecimal,s)}if(isIdentifierStart(this.codePointAtPos(this.state.pos))){throw this.raise(p.NumberIdentifier,this.state.curPosition())}if(i){const e=this.input.slice(t,this.state.pos).replace(/[_n]/g,"");this.finishToken(136,e);return}this.finishToken(135,r)}readNumber(e){const t=this.state.pos;const s=this.state.curPosition();let i=false;let r=false;let a=false;let n=false;if(!e&&this.readInt(10)===null){this.raise(p.InvalidNumber,this.state.curPosition())}const o=this.state.pos-t>=2&&this.input.charCodeAt(t)===48;if(o){const e=this.input.slice(t,this.state.pos);this.recordStrictModeErrors(p.StrictOctalLiteral,s);if(!this.state.strict){const t=e.indexOf("_");if(t>0){this.raise(p.ZeroDigitNumericSeparator,createPositionWithColumnOffset(s,t))}}n=o&&!/[89]/.test(e)}let h=this.input.charCodeAt(this.state.pos);if(h===46&&!n){++this.state.pos;this.readInt(10);i=true;h=this.input.charCodeAt(this.state.pos)}if((h===69||h===101)&&!n){h=this.input.charCodeAt(++this.state.pos);if(h===43||h===45){++this.state.pos}if(this.readInt(10)===null){this.raise(p.InvalidOrMissingExponent,s)}i=true;a=true;h=this.input.charCodeAt(this.state.pos)}if(h===110){if(i||o){this.raise(p.InvalidBigIntLiteral,s)}++this.state.pos;r=true}if(h===109){this.expectPlugin("decimal",this.state.curPosition());if(a||o){this.raise(p.InvalidDecimal,s)}++this.state.pos;var l=true}if(isIdentifierStart(this.codePointAtPos(this.state.pos))){throw this.raise(p.NumberIdentifier,this.state.curPosition())}const c=this.input.slice(t,this.state.pos).replace(/[_mn]/g,"");if(r){this.finishToken(136,c);return}if(l){this.finishToken(137,c);return}const u=n?parseInt(c,8):parseFloat(c);this.finishToken(135,u)}readCodePoint(e){const{code:t,pos:s}=readCodePoint(this.input,this.state.pos,this.state.lineStart,this.state.curLine,e,this.errorHandlers_readCodePoint);this.state.pos=s;return t}readString(e){const{str:t,pos:s,curLine:i,lineStart:r}=readStringContents(e===34?"double":"single",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_string);this.state.pos=s+1;this.state.lineStart=r;this.state.curLine=i;this.finishToken(134,t)}readTemplateContinuation(){if(!this.match(8)){this.unexpected(null,8)}this.state.pos--;this.readTemplateToken()}readTemplateToken(){const e=this.input[this.state.pos];const{str:t,firstInvalidLoc:s,pos:i,curLine:r,lineStart:a}=readStringContents("template",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_template);this.state.pos=i+1;this.state.lineStart=a;this.state.curLine=r;if(s){this.state.firstInvalidTemplateEscapePos=new Position(s.curLine,s.pos-s.lineStart,this.sourceToOffsetPos(s.pos))}if(this.input.codePointAt(i)===96){this.finishToken(24,s?null:e+t+"`")}else{this.state.pos++;this.finishToken(25,s?null:e+t+"${")}}recordStrictModeErrors(e,t){const s=t.index;if(this.state.strict&&!this.state.strictErrors.has(s)){this.raise(e,t)}else{this.state.strictErrors.set(s,[e,t])}}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(p.MissingUnicodeEscape,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(p.EscapedCharNotAnIdentifier,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=T.get(t);if(s!==undefined){this.finishToken(s,tokenLabelName(s))}else{this.finishToken(132,t)}}checkKeywordEscapes(){const{type:e}=this.state;if(tokenIsKeyword(e)&&this.state.containsEsc){this.raise(p.InvalidEscapedReservedWord,this.state.startLoc,{reservedWord:tokenLabelName(e)})}}raise(e,t,s={}){const i=t instanceof Position?t:t.loc.start;const r=e(i,s);if(!(this.optionFlags&2048))throw r;if(!this.isLookahead)this.state.errors.push(r);return r}raiseOverwrite(e,t,s={}){const i=t instanceof Position?t:t.loc.start;const r=i.index;const a=this.state.errors;for(let t=a.length-1;t>=0;t--){const n=a[t];if(n.loc.index===r){return a[t]=e(i,s)}if(n.loc.index<r)break}return this.raise(e,t,s)}updateContext(e){}unexpected(e,t){throw this.raise(p.UnexpectedToken,e!=null?e:this.state.startLoc,{expected:t?tokenLabelName(t):null})}expectPlugin(e,t){if(this.hasPlugin(e)){return true}throw this.raise(p.MissingPlugin,t!=null?t:this.state.startLoc,{missingPlugin:[e]})}expectOnePlugin(e){if(!e.some((e=>this.hasPlugin(e)))){throw this.raise(p.MissingOneOfPlugins,this.state.startLoc,{missingPlugin:e})}}errorBuilder(e){return(t,s,i)=>{this.raise(e,buildPosition(t,s,i))}}}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(p.InvalidPrivateFieldResolution,i,{identifierName:s})}}}declarePrivateName(e,t,s){const{privateNames:i,loneAccessors:r,undefinedPrivateNames:a}=this.current();let n=i.has(e);if(t&3){const s=n&&r.get(e);if(s){const i=s&4;const a=t&4;const o=s&3;const h=t&3;n=o===h||i!==a;if(!n)r.delete(e)}else if(!n){r.set(e,t)}}if(n){this.parser.raise(p.PrivateNameRedeclaration,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(p.InvalidPrivateFieldResolution,t,{identifierName:e})}}}class ExpressionScope{constructor(e=0){this.type=e}canBeArrowParameterDeclaration(){return this.type===2||this.type===1}isCertainlyParameterDeclaration(){return this.type===3}}class ArrowHeadParsingScope extends ExpressionScope{constructor(e){super(e);this.declarationErrors=new Map}recordDeclarationError(e,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,t){const s=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)}recordArrowParameterBindingError(e,t){const{stack:s}=this;const i=s[s.length-1];const r=t.loc.start;if(i.isCertainlyParameterDeclaration()){this.parser.raise(e,r)}else if(i.canBeArrowParameterDeclaration()){i.recordDeclarationError(e,r)}else{return}}recordAsyncArrowParametersError(e){const{stack:t}=this;let s=t.length-1;let i=t[s];while(i.canBeArrowParameterDeclaration()){if(i.type===2){i.recordDeclarationError(p.AwaitBindingIdentifier,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,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(3)}function newArrowHeadScope(){return new ArrowHeadParsingScope(1)}function newAsyncArrowScope(){return new ArrowHeadParsingScope(2)}function newExpressionScope(){return new ExpressionScope}class UtilParser extends Tokenizer{addExtra(e,t,s,i=true){if(!e)return;let{extra:r}=e;if(r==null){r={};e.extra=r}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){if(this.input.startsWith(t,e)){const s=this.input.charCodeAt(e+t.length);return!(isIdentifierChar(s)||(s&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,this.state.startLoc)}this.unexpected(null,e)}}canInsertSemicolon(){return this.match(140)||this.match(8)||this.hasPrecedingLineBreak()}hasPrecedingLineBreak(){return hasNewLine(this.input,this.offsetToSourcePos(this.state.lastTokEndLoc.index),this.state.start)}hasFollowingLineBreak(){return hasNewLine(this.input,this.state.end,this.nextTokenStart())}isLineTerminator(){return this.eat(13)||this.canInsertSemicolon()}semicolon(e=true){if(e?this.isLineTerminator():this.eat(13))return;this.raise(p.MissingSemicolon,this.state.lastTokEndLoc)}expect(e,t){if(!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,voidPatternLoc:n}=e;const o=!!s||!!i||!!a||!!r||!!n;if(!t){return o}if(s!=null){this.raise(p.InvalidCoverInitializedName,s)}if(i!=null){this.raise(p.DuplicateProto,i)}if(r!=null){this.raise(p.UnexpectedPrivateField,r)}if(a!=null){this.unexpected(a)}if(n!=null){this.raise(p.InvalidCoverDiscardElement,n)}}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)}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=0;if(this.inModule||this.optionFlags&1){e|=2}if(this.optionFlags&32){e|=1}const t=!this.inModule&&this.options.sourceType==="commonjs";if(t||this.optionFlags&2){e|=4}this.prodParam.enter(e);let s=t?514:1;if(this.optionFlags&4){s|=512}this.scope.enter(s)}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;this.voidPatternLoc=null}}class Node{constructor(e,t,s){this.type="";this.start=t;this.end=0;this.loc=new SourceLocation(s);if((e==null?void 0:e.optionFlags)&128)this.range=[t,0];if(e!=null&&e.filename)this.loc.filename=e.filename}}const ee=Node.prototype;{ee.__clone=function(){const e=new Node(undefined,this.start,this.loc.start);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}}class NodeUtils extends UtilParser{startNode(){const e=this.state.startLoc;return new Node(this,e.index,e)}startNodeAt(e){return new Node(this,e.index,e)}startNodeAtNode(e){return this.startNodeAt(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.optionFlags&128)e.range[1]=s.index;if(this.optionFlags&4096){this.processComment(e)}return e}resetStartLocation(e,t){e.start=t.index;e.loc.start=t;if(this.optionFlags&128)e.range[0]=t.index}resetEndLocation(e,t=this.state.lastTokEndLoc){e.end=t.index;e.loc.end=t;if(this.optionFlags&128)e.range[1]=t.index}resetStartLocationFromNode(e,t){this.resetStartLocation(e,t.loc.start)}castNodeTo(e,t){e.type=t;return e}cloneIdentifier(e){const{type:t,start:s,end:i,loc:r,range:a,name:n}=e;const o=Object.create(ee);o.type=t;o.start=s;o.end=i;o.loc=r;o.range=a;o.name=n;if(e.extra)o.extra=e.extra;return o}cloneStringLiteral(e){const{type:t,start:s,end:i,loc:r,range:a,extra:n}=e;const o=Object.create(ee);o.type=t;o.start=s;o.end=i;o.loc=r;o.range=a;o.extra=n;o.value=e.value;return o}}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.recordArrowParameterBindingError(p.InvalidParenthesizedAssignment,e)}else if(r.type!=="MemberExpression"&&!this.isOptionalMemberExpression(r)){this.raise(p.InvalidParenthesizedAssignment,e)}}else{this.raise(p.InvalidParenthesizedAssignment,e)}}switch(e.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":case"VoidPattern":break;case"ObjectExpression":this.castNodeTo(e,"ObjectPattern");for(let s=0,i=e.properties.length,r=i-1;s<i;s++){var a;const i=e.properties[s];const n=s===r;this.toAssignableObjectExpressionProp(i,n,t);if(n&&i.type==="RestElement"&&(a=e.extra)!=null&&a.trailingCommaLoc){this.raise(p.RestTrailingComma,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":this.castNodeTo(e,"ArrayPattern");this.toAssignableList(e.elements,(i=e.extra)==null?void 0:i.trailingCommaLoc,t);break;case"AssignmentExpression":if(e.operator!=="="){this.raise(p.MissingEqInAssignment,e.left.loc.end)}this.castNodeTo(e,"AssignmentPattern");delete e.operator;if(e.left.type==="VoidPattern"){this.raise(p.VoidPatternInitializer,e.left)}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"?p.PatternHasAccessor:p.PatternHasMethod,e.key)}else if(e.type==="SpreadElement"){this.castNodeTo(e,"RestElement");const i=e.argument;this.checkToRestConversion(i,false);this.toAssignable(i,s);if(!t){this.raise(p.RestTrailingComma,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;this.toAssignableListItem(e,r,s);if(a.type==="RestElement"){if(r<i){this.raise(p.RestTrailingComma,a)}else if(t){this.raise(p.RestTrailingComma,t)}}}}toAssignableListItem(e,t,s){const i=e[t];if(i.type==="SpreadElement"){this.castNodeTo(i,"RestElement");const e=i.argument;this.checkToRestConversion(e,true);this.toAssignable(e,s)}else{this.toAssignable(i,s)}}isAssignable(e,t){switch(e.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":case"VoidPattern":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){const t=this.startNode();this.next();t.argument=this.parseMaybeAssignAllowIn(e,undefined);return this.finishNode(t,"SpreadElement")}parseRestBinding(){const e=this.startNode();this.next();const t=this.parseBindingAtom();if(t.type==="VoidPattern"){this.raise(p.UnexpectedVoidPattern,t)}e.argument=t;return this.finishNode(e,"RestElement")}parseBindingAtom(){switch(this.state.type){case 0:{const e=this.startNode();this.next();e.elements=this.parseBindingList(3,93,1);return this.finishNode(e,"ArrayPattern")}case 5:return this.parseObjectLike(8,true);case 88:return this.parseVoidPattern(null)}return this.parseIdentifier()}parseBindingList(e,t,s){const i=s&1;const r=[];let a=true;while(!this.eat(e)){if(a){a=false}else{this.expect(12)}if(i&&this.match(12)){r.push(null)}else if(this.eat(e)){break}else if(this.match(21)){let i=this.parseRestBinding();if(this.hasPlugin("flow")||s&2){i=this.parseFunctionParamType(i)}r.push(i);if(!this.checkCommaAfterRest(t)){this.expect(e);break}}else{const e=[];if(s&2){if(this.match(26)&&this.hasPlugin("decorators")){this.raise(p.UnsupportedParameterDecorator,this.state.startLoc)}while(this.match(26)){e.push(this.parseDecorator())}}r.push(this.parseBindingElement(s,e))}}return r}parseBindingRestProperty(e){this.next();if(this.hasPlugin("discardBinding")&&this.match(88)){e.argument=this.parseVoidPattern(null);this.raise(p.UnexpectedVoidPattern,e.argument)}else{e.argument=this.parseIdentifier()}this.checkCommaAfterRest(125);return this.finishNode(e,"RestElement")}parseBindingProperty(){const{type:e,startLoc:t}=this.state;if(e===21){return this.parseBindingRestProperty(this.startNode())}const s=this.startNode();if(e===139){this.expectPlugin("destructuringPrivate",t);this.classScope.usePrivateName(this.state.value,t);s.key=this.parsePrivateName()}else{this.parsePropertyName(s)}s.method=false;return this.parseObjPropValue(s,t,false,false,true,false)}parseBindingElement(e,t){const s=this.parseMaybeDefault();if(this.hasPlugin("flow")||e&2){this.parseFunctionParamType(s)}if(t.length){s.decorators=t;this.resetStartLocationFromNode(s,t[0])}const i=this.parseMaybeDefault(s.loc.start,s);return i}parseFunctionParamType(e){return e}parseMaybeDefault(e,t){e!=null?e:e=this.state.startLoc;t=t!=null?t:this.parseBindingAtom();if(!this.eat(29))return t;const s=this.startNodeAt(e);if(t.type==="VoidPattern"){this.raise(p.VoidPatternInitializer,t)}s.left=t;s.right=this.parseMaybeAssignAllowIn();return this.finishNode(s,"AssignmentPattern")}isValidLVal(e,t,s){switch(e){case"AssignmentPattern":return"left";case"RestElement":return"argument";case"ObjectProperty":return"value";case"ParenthesizedExpression":return"expression";case"ArrayPattern":return"elements";case"ObjectPattern":return"properties";case"VoidPattern":return true}return false}isOptionalMemberExpression(e){return e.type==="OptionalMemberExpression"}checkLVal(e,t,s=64,i=false,r=false,a=false){var n;const o=e.type;if(this.isObjectMethod(e))return;const h=this.isOptionalMemberExpression(e);if(h||o==="MemberExpression"){if(h){this.expectPlugin("optionalChainingAssign",e.loc.start);if(t.type!=="AssignmentExpression"){this.raise(p.InvalidLhsOptionalChaining,e,{ancestor:t})}}if(s!==64){this.raise(p.InvalidPropertyBindingPattern,e)}return}if(o==="Identifier"){this.checkIdentifier(e,s,r);const{name:t}=e;if(i){if(i.has(t)){this.raise(p.ParamDupe,e)}else{i.add(t)}}return}else if(o==="VoidPattern"&&t.type==="CatchClause"){this.raise(p.VoidPatternCatchClauseParam,e)}const l=this.isValidLVal(o,!(a||(n=e.extra)!=null&&n.parenthesized)&&t.type==="AssignmentExpression",s);if(l===true)return;if(l===false){const i=s===64?p.InvalidLhs:p.InvalidLhsBinding;this.raise(i,e,{ancestor:t});return}let c,u;if(typeof l==="string"){c=l;u=o==="ParenthesizedExpression"}else{[c,u]=l}const d=o==="ArrayPattern"||o==="ObjectPattern"?{type:o}:t;const f=e[c];if(Array.isArray(f)){for(const e of f){if(e){this.checkLVal(e,d,s,i,r,u)}}}else if(f){this.checkLVal(f,d,s,i,r,u)}}checkIdentifier(e,t,s=false){if(this.state.strict&&(s?isStrictBindReservedWord(e.name,this.inModule):isStrictBindOnlyReservedWord(e.name))){if(t===64){this.raise(p.StrictEvalArguments,e,{referenceName:e.name})}else{this.raise(p.StrictEvalArgumentsBinding,e,{bindingName:e.name})}}if(t&8192&&e.name==="let"){this.raise(p.LetInLexicalBinding,e)}if(!(t&64)){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(p.InvalidRestAssignmentPattern,e)}}checkCommaAfterRest(e){if(!this.match(12)){return false}this.raise(this.lookaheadCharCode()===e?p.RestTrailingComma:p.ElementAfterRest,this.state.startLoc);return true}}function nonNull(e){if(e==null){throw new Error(`Unexpected ${e} value.`)}return e}function assert(e){if(!e){throw new Error("Assert fail")}}const te=ParseErrorEnum`typescript`({AbstractMethodHasImplementation:({methodName:e})=>`Method '${e}' cannot have an implementation because it is marked abstract.`,AbstractPropertyHasInitializer:({propertyName:e})=>`Property '${e}' cannot have an initializer because it is marked abstract.`,AccessorCannotBeOptional:"An 'accessor' property cannot be declared optional.",AccessorCannotDeclareThisParameter:"'get' and 'set' accessors cannot declare 'this' parameters.",AccessorCannotHaveTypeParameters:"An accessor cannot have type parameters.",ClassMethodHasDeclare:"Class methods cannot have the 'declare' modifier.",ClassMethodHasReadonly:"Class methods cannot have the 'readonly' modifier.",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",ConstructorHasTypeParameters:"Type parameters cannot appear on a constructor declaration.",DeclareAccessor:({kind:e})=>`'declare' is not allowed in ${e}ters.`,DeclareClassFieldHasInitializer:"Initializers are not allowed in ambient contexts.",DeclareFunctionHasImplementation:"An implementation cannot be declared in ambient contexts.",DuplicateAccessibilityModifier:({modifier:e})=>`Accessibility modifier already seen: '${e}'.`,DuplicateModifier:({modifier:e})=>`Duplicate modifier: '${e}'.`,EmptyHeritageClauseType:({token:e})=>`'${e}' list cannot be empty.`,EmptyTypeArguments:"Type argument list cannot be empty.",EmptyTypeParameters:"Type parameter list cannot be empty.",ExpectedAmbientAfterExportDeclare:"'export declare' must be followed by an ambient declaration.",ImportAliasHasImportType:"An import alias can not use 'import type'.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` modifier",IncompatibleModifiers:({modifiers:e})=>`'${e[0]}' modifier cannot be used with '${e[1]}' modifier.`,IndexSignatureHasAbstract:"Index signatures cannot have the 'abstract' modifier.",IndexSignatureHasAccessibility:({modifier:e})=>`Index signatures cannot have an accessibility modifier ('${e}').`,IndexSignatureHasDeclare:"Index signatures cannot have the 'declare' modifier.",IndexSignatureHasOverride:"'override' modifier cannot appear on an index signature.",IndexSignatureHasStatic:"Index signatures cannot have the 'static' modifier.",InitializerNotAllowedInAmbientContext:"Initializers are not allowed in ambient contexts.",InvalidHeritageClauseType:({token:e})=>`'${e}' list can only include identifiers or qualified-names with optional type arguments.`,InvalidModifierOnAwaitUsingDeclaration:e=>`'${e}' modifier cannot appear on an await using declaration.`,InvalidModifierOnTypeMember:({modifier:e})=>`'${e}' modifier cannot appear on a type member.`,InvalidModifierOnTypeParameter:({modifier:e})=>`'${e}' modifier cannot appear on a type parameter.`,InvalidModifierOnTypeParameterPositions:({modifier:e})=>`'${e}' modifier can only appear on a type parameter of a class, interface or type alias.`,InvalidModifierOnUsingDeclaration:e=>`'${e}' modifier cannot appear on a using declaration.`,InvalidModifiersOrder:({orderedModifiers:e})=>`'${e[0]}' modifier must precede '${e[1]}' modifier.`,InvalidPropertyAccessAfterInstantiationExpression:"Invalid property access after an instantiation expression. "+"You can either wrap the instantiation expression in parentheses, or delete the type arguments.",InvalidTupleMemberLabel:"Tuple members must be labeled with a simple identifier.",MissingInterfaceName:"'interface' declarations must be followed by an identifier.",NonAbstractClassHasAbstractMethod:"Abstract methods can only appear within an abstract class.",NonClassMethodPropertyHasAbstractModifier:"'abstract' modifier can only appear on a class, method, or property declaration.",OptionalTypeBeforeRequired:"A required element cannot follow an optional element.",OverrideNotInSubClass:"This member cannot have an 'override' modifier because its containing class does not extend another class.",PatternIsOptional:"A binding pattern parameter cannot be optional in an implementation signature.",PrivateElementHasAbstract:"Private elements cannot have the 'abstract' modifier.",PrivateElementHasAccessibility:({modifier:e})=>`Private elements cannot have an accessibility modifier ('${e}').`,ReadonlyForMethodSignature:"'readonly' modifier can only appear on a property declaration or index signature.",ReservedArrowTypeParam:"This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.",ReservedTypeAssertion:"This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",SetAccessorCannotHaveOptionalParameter:"A 'set' accessor cannot have an optional parameter.",SetAccessorCannotHaveRestParameter:"A 'set' accessor cannot have rest parameter.",SetAccessorCannotHaveReturnType:"A 'set' accessor cannot have a return type annotation.",SingleTypeParameterWithoutTrailingComma:({typeParameterName:e})=>`Single type parameter ${e} should have a trailing comma. Example usage: <${e},>.`,StaticBlockCannotHaveModifier:"Static class blocks cannot have any modifier.",TupleOptionalAfterType:"A labeled tuple optional element must be declared using a question mark after the name and before the colon (`name?: type`), rather than after the type (`name: type?`).",TypeAnnotationAfterAssign:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeImportCannotSpecifyDefaultAndNamed:"A type-only import can specify a default import or named bindings, but not both.",TypeModifierIsUsedInTypeExports:"The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",TypeModifierIsUsedInTypeImports:"The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",UnexpectedParameterModifier:"A parameter property is only allowed in a constructor implementation.",UnexpectedReadonly:"'readonly' type modifier is only permitted on array and tuple literal types.",UnexpectedTypeAnnotation:"Did not expect a type annotation here.",UnexpectedTypeCastInParameter:"Unexpected type cast in parameter position.",UnsupportedImportTypeArgument:"Argument in a type import must be a string literal.",UnsupportedParameterPropertyKind:"A parameter property may not be declared using a binding pattern.",UnsupportedSignatureParameterKind:({type:e})=>`Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${e}.`,UsingDeclarationInAmbientContext:e=>`'${e}' declarations are not allowed in ambient contexts.`});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 TypeScriptParserMixin extends e{constructor(...e){super(...e);this.tsParseInOutModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:["in","out"],disallowedModifiers:["const","public","private","protected","readonly","declare","abstract","override"],errorTemplate:te.InvalidModifierOnTypeParameter});this.tsParseConstModifier=this.tsParseModifiers.bind(this,{allowedModifiers:["const"],disallowedModifiers:["in","out"],errorTemplate:te.InvalidModifierOnTypeParameterPositions});this.tsParseInOutConstModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:["in","out","const"],disallowedModifiers:["public","private","protected","readonly","declare","abstract","override"],errorTemplate:te.InvalidModifierOnTypeParameter})}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(139)||this.isLiteralPropertyName()}tsNextTokenOnSameLineAndCanFollowModifier(){this.next();if(this.hasPrecedingLineBreak()){return false}return this.tsTokenCanFollowModifier()}tsNextTokenCanFollowModifier(){if(this.match(106)){this.next();return this.tsTokenCanFollowModifier()}return this.tsNextTokenOnSameLineAndCanFollowModifier()}tsParseModifier(e,t,s){if(!tokenIsIdentifier(this.state.type)&&this.state.type!==58&&this.state.type!==75){return undefined}const i=this.state.value;if(e.includes(i)){if(s&&this.match(106)){return undefined}if(t&&this.tsIsStartOfStaticBlocks()){return undefined}if(this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this))){return i}}return undefined}tsParseModifiers({allowedModifiers:e,disallowedModifiers:t,stopOnStartOfClassStaticBlock:s,errorTemplate:i=te.InvalidModifierOnTypeMember},r){const enforceOrder=(e,t,s,i)=>{if(t===s&&r[i]){this.raise(te.InvalidModifiersOrder,e,{orderedModifiers:[s,i]})}};const incompatible=(e,t,s,i)=>{if(r[s]&&t===i||r[i]&&t===s){this.raise(te.IncompatibleModifiers,e,{modifiers:[s,i]})}};for(;;){const{startLoc:a}=this.state;const n=this.tsParseModifier(e.concat(t!=null?t:[]),s,r.static);if(!n)break;if(tsIsAccessModifier(n)){if(r.accessibility){this.raise(te.DuplicateAccessibilityModifier,a,{modifier:n})}else{enforceOrder(a,n,n,"override");enforceOrder(a,n,n,"static");enforceOrder(a,n,n,"readonly");r.accessibility=n}}else if(tsIsVarianceAnnotations(n)){if(r[n]){this.raise(te.DuplicateModifier,a,{modifier:n})}r[n]=true;enforceOrder(a,n,"in","out")}else{if(hasOwnProperty.call(r,n)){this.raise(te.DuplicateModifier,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")}r[n]=true}if(t!=null&&t.includes(n)){this.raise(i,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)}}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.lastTokStartLoc.index;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(134)){this.raise(te.UnsupportedImportTypeArgument,this.state.startLoc);{e.argument=super.parseExprAtom()}}else{{e.argument=this.parseStringLiteral(this.state.value)}}if(this.eat(12)){e.options=this.tsParseImportTypeOptions()}else{e.options=null}this.expect(11);if(this.eat(16)){e.qualifier=this.tsParseEntityName(1|2)}if(this.match(47)){{e.typeParameters=this.tsParseTypeArguments()}}return this.finishNode(e,"TSImportType")}tsParseImportTypeOptions(){const e=this.startNode();this.expect(5);const t=this.startNode();if(this.isContextual(76)){t.method=false;t.key=this.parseIdentifier(true);t.computed=false;t.shorthand=false}else{this.unexpected(null,76)}this.expect(14);t.value=this.tsParseImportTypeWithPropertyValue();e.properties=[this.finishObjectProperty(t)];this.expect(8);return this.finishNode(e,"ObjectExpression")}tsParseImportTypeWithPropertyValue(){const e=this.startNode();const t=[];this.expect(5);while(!this.match(8)){const e=this.state.type;if(tokenIsIdentifier(e)||e===134){t.push(super.parsePropertyDefinition(null))}else{this.unexpected()}this.eat(12)}e.properties=t;this.next();return this.finishNode(e,"ObjectExpression")}tsParseEntityName(e){let t;if(e&1&&this.match(78)){if(e&2){t=this.parseIdentifier(true)}else{const e=this.startNode();this.next();t=this.finishNode(e,"ThisExpression")}}else{t=this.parseIdentifier(!!(e&1))}while(this.eat(16)){const s=this.startNodeAtNode(t);s.left=t;s.right=this.parseIdentifier(!!(e&1));t=this.finishNode(s,"TSQualifiedName")}return t}tsParseTypeReference(){const e=this.startNode();e.typeName=this.tsParseEntityName(1);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(1|2)}}if(!this.hasPrecedingLineBreak()&&this.match(47)){{e.typeParameters=this.tsParseTypeArguments()}}return this.finishNode(e,"TSTypeQuery")}tsParseTypeParameter(e){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(143)){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(te.EmptyTypeParameters,t)}if(s.value!==-1){this.addExtra(t,"trailingComma",s.value)}return this.finishNode(t,"TSTypeParameterDeclaration")}tsFillSignature(e,t){const s=e===19;const i="parameters";const r="typeAnnotation";t.typeParameters=this.tsTryParseTypeParameters(this.tsParseConstModifier);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(){const e=super.parseBindingList(11,41,2);for(const t of e){const{type:e}=t;if(e==="AssignmentPattern"||e==="TSParameterProperty"){this.raise(te.UnsupportedSignatureParameterKind,t,{type:e})}}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}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;if(this.match(10)||this.match(47)){if(t){this.raise(te.ReadonlyForMethodSignature,e)}const s=e;if(s.kind&&this.match(47)){this.raise(te.AccessorCannotHaveTypeParameters,this.state.curPosition())}this.tsFillSignature(14,s);this.tsParseTypeMemberSemicolon();const i="parameters";const r="typeAnnotation";if(s.kind==="get"){if(s[i].length>0){this.raise(p.BadGetterArity,this.state.curPosition());if(this.isThisParam(s[i][0])){this.raise(te.AccessorCannotDeclareThisParameter,this.state.curPosition())}}}else if(s.kind==="set"){if(s[i].length!==1){this.raise(p.BadSetterArity,this.state.curPosition())}else{const e=s[i][0];if(this.isThisParam(e)){this.raise(te.AccessorCannotDeclareThisParameter,this.state.curPosition())}if(e.type==="Identifier"&&e.optional){this.raise(te.SetAccessorCannotHaveOptionalParameter,this.state.curPosition())}if(e.type==="RestElement"){this.raise(te.SetAccessorCannotHaveRestParameter,this.state.curPosition())}}if(s[r]){this.raise(te.SetAccessorCannotHaveReturnType,s[r])}}else{s.kind="method"}return this.finishNode(s,"TSMethodSignature")}else{const s=e;if(t)s.readonly=true;const i=this.tsTryParseTypeAnnotation();if(i)s.typeAnnotation=i;this.tsParseTypeMemberSemicolon();return this.finishNode(s,"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({allowedModifiers:["readonly"],disallowedModifiers:["declare","abstract","private","protected","public","static","override"]},e);const t=this.tsTryParseIndexSignature(e);if(t){return t}super.parsePropertyName(e);if(!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.tsTokenCanFollowModifier()){e.kind=e.key.name;super.parsePropertyName(e);if(!this.match(10)&&!this.match(47)){this.unexpected(null,10)}}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(122)}if(this.isContextual(122)){this.next()}if(!this.match(0)){return false}this.next();if(!this.tsIsIdentifier()){return false}this.next();return this.match(58)}tsParseMappedType(){const e=this.startNode();this.expect(5);if(this.match(53)){e.readonly=this.state.value;this.next();this.expectContextual(122)}else if(this.eatContextual(122)){e.readonly=true}this.expect(0);{const t=this.startNode();t.name=this.tsParseTypeParameterName();t.constraint=this.tsExpectThenParseType(58);e.typeParameter=this.finishNode(t,"TSTypeParameter")}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;e.elementTypes.forEach((e=>{const{type:s}=e;if(t&&s!=="TSRestType"&&s!=="TSOptionalType"&&!(s==="TSNamedTupleMember"&&e.optional)){this.raise(te.OptionalTypeBeforeRequired,e)}t||(t=s==="TSNamedTupleMember"&&e.optional||s==="TSOptionalType")}));return this.finishNode(e,"TSTupleType")}tsParseTupleElementType(){const e=this.state.startLoc;const t=this.eat(21);const{startLoc:s}=this.state;let i;let r;let a;let n;const o=tokenIsKeywordOrIdentifier(this.state.type);const h=o?this.lookaheadCharCode():null;if(h===58){i=true;a=false;r=this.parseIdentifier(true);this.expect(14);n=this.tsParseType()}else if(h===63){a=true;const e=this.state.value;const t=this.tsParseNonArrayType();if(this.lookaheadCharCode()===58){i=true;r=this.createIdentifier(this.startNodeAt(s),e);this.expect(17);this.expect(14);n=this.tsParseType()}else{i=false;n=t;this.expect(17)}}else{n=this.tsParseType();a=this.eat(17);i=this.eat(14)}if(i){let e;if(r){e=this.startNodeAt(s);e.optional=a;e.label=r;e.elementType=n;if(this.eat(17)){e.optional=true;this.raise(te.TupleOptionalAfterType,this.state.lastTokStartLoc)}}else{e=this.startNodeAt(s);e.optional=a;this.raise(te.InvalidTupleMemberLabel,n);e.label=n;e.elementType=this.tsParseType()}n=this.finishNode(e,"TSNamedTupleMember")}else if(a){const e=this.startNodeAt(s);e.typeAnnotation=n;n=this.finishNode(e,"TSOptionalType")}if(t){const t=this.startNodeAt(e);t.typeAnnotation=n;n=this.finishNode(t,"TSRestType")}return n}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();switch(this.state.type){case 135:case 136:case 134:case 85:case 86:e.literal=super.parseExprAtom();break;default:this.unexpected()}return this.finishNode(e,"TSLiteralType")}tsParseTemplateLiteralType(){{const e=this.startNode();e.literal=super.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(116)&&!this.hasPrecedingLineBreak()){return this.tsParseThisTypePredicate(e)}else{return e}}tsParseNonArrayType(){switch(this.state.type){case 134:case 135:case 136:case 85:case 86:return this.tsParseLiteralTypeNode();case 53:if(this.state.value==="-"){const e=this.startNode();const t=this.lookahead();if(t.type!==135&&t.type!==136){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()}}}this.unexpected()}tsParseArrayTypeOrHigher(){const{startLoc:e}=this.state;let t=this.tsParseNonArrayType();while(!this.hasPrecedingLineBreak()&&this.eat(0)){if(this.match(3)){const s=this.startNodeAt(e);s.elementType=t;this.expect(3);t=this.finishNode(s,"TSArrayType")}else{const s=this.startNodeAt(e);s.objectType=t;s.indexType=this.tsParseType();this.expect(3);t=this.finishNode(s,"TSIndexedAccessType")}}return t}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(te.UnexpectedReadonly,e)}}tsParseInferType(){const e=this.startNode();this.expectContextual(115);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(115)?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{super.parseBindingList(3,93,1);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(){if(this.match(14)){return this.tsParseTypeOrTypePredicateAnnotation(14)}}tsTryParseTypeAnnotation(){if(this.match(14)){return this.tsParseTypeAnnotation()}}tsTryParseType(){return this.tsEatThenParseType(14)}tsParseTypePredicatePrefix(){const e=this.parseIdentifier();if(this.isContextual(116)&&!this.hasPrecedingLineBreak()){this.next();return e}}tsParseTypePredicateAsserts(){if(this.state.type!==109){return false}const e=this.state.containsEsc;this.next();if(!tokenIsIdentifier(this.state.type)&&!this.match(78)){return false}if(e){this.raise(p.InvalidEscapedReservedWord,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(124)&&this.isLookaheadContextual("new")}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(te.ReservedTypeAssertion,this.state.startLoc)}const e=this.startNode();e.typeAnnotation=this.tsInType((()=>{this.next();return this.match(75)?this.tsParseTypeReference():this.tsParseType()}));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(1|2);if(this.match(47)){e.typeParameters=this.tsParseTypeArguments()}return this.finishNode(e,"TSExpressionWithTypeArguments")}}));if(!s.length){this.raise(te.EmptyHeritageClauseType,t,{token:e})}return s}tsParseInterfaceDeclaration(e,t={}){if(this.hasFollowingLineBreak())return null;this.expectContextual(129);if(t.declare)e.declare=true;if(tokenIsIdentifier(this.state.type)){e.id=this.parseIdentifier();this.checkIdentifier(e.id,130)}else{e.id=null;this.raise(te.MissingInterfaceName,this.state.startLoc)}e.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);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,2);e.typeAnnotation=this.tsInType((()=>{e.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutModifiers);this.expect(29);if(this.isContextual(114)&&this.lookaheadCharCode()!==46){const e=this.startNode();this.next();return this.finishNode(e,"TSIntrinsicKeyword")}return this.tsParseType()}));this.semicolon();return this.finishNode(e,"TSTypeAliasDeclaration")}tsInTopLevelContext(e){if(this.curContext()!==d.brace){const t=this.state.context;this.state.context=[t[0]];try{return e()}finally{this.state.context=t}}else{return e()}}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){if(this.match(e)){return this.tsNextThenParseType()}}tsExpectThenParseType(e){return this.tsInType((()=>{this.expect(e);return this.tsParseType()}))}tsNextThenParseType(){return this.tsInType((()=>{this.next();return this.tsParseType()}))}tsParseEnumMember(){const e=this.startNode();e.id=this.match(134)?super.parseStringLiteral(this.state.value):this.parseIdentifier(true);if(this.eat(29)){e.initializer=super.parseMaybeAssignAllowIn()}return this.finishNode(e,"TSEnumMember")}tsParseEnumDeclaration(e,t={}){if(t.const)e.const=true;if(t.declare)e.declare=true;this.expectContextual(126);e.id=this.parseIdentifier();this.checkIdentifier(e.id,e.const?8971:8459);{this.expect(5);e.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this));this.expect(8)}return this.finishNode(e,"TSEnumDeclaration")}tsParseEnumBody(){const e=this.startNode();this.expect(5);e.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this));this.expect(8);return this.finishNode(e,"TSEnumBody")}tsParseModuleBlock(){const e=this.startNode();this.scope.enter(0);this.expect(5);super.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,1024)}if(this.eat(16)){const t=this.startNode();this.tsParseModuleOrNamespaceDeclaration(t,true);e.body=t}else{this.scope.enter(1024);this.prodParam.enter(0);e.body=this.tsParseModuleBlock();this.prodParam.exit();this.scope.exit()}return this.finishNode(e,"TSModuleDeclaration")}tsParseAmbientExternalModuleDeclaration(e){if(this.isContextual(112)){e.kind="global";{e.global=true}e.id=this.parseIdentifier()}else if(this.match(134)){e.kind="module";e.id=super.parseStringLiteral(this.state.value)}else{this.unexpected()}if(this.match(5)){this.scope.enter(1024);this.prodParam.enter(0);e.body=this.tsParseModuleBlock();this.prodParam.exit();this.scope.exit()}else{this.semicolon()}return this.finishNode(e,"TSModuleDeclaration")}tsParseImportEqualsDeclaration(e,t,s){{e.isExport=s||false}e.id=t||this.parseIdentifier();this.checkIdentifier(e.id,4096);this.expect(29);const i=this.tsParseModuleReference();if(e.importKind==="type"&&i.type!=="TSExternalModuleReference"){this.raise(te.ImportAliasHasImportType,i)}e.moduleReference=i;this.semicolon();return this.finishNode(e,"TSImportEqualsDeclaration")}tsIsExternalModuleReference(){return this.isContextual(119)&&this.lookaheadCharCode()===40}tsParseModuleReference(){return this.tsIsExternalModuleReference()?this.tsParseExternalModuleReference():this.tsParseEntityName(0)}tsParseExternalModuleReference(){const e=this.startNode();this.expectContextual(119);this.expect(10);if(!this.match(134)){this.unexpected()}e.expression=super.parseExprAtom();this.expect(11);this.sawUnambiguousESM=true;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;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}this.state=t}tsTryParseDeclare(e){if(this.isLineTerminator()){return}const t=this.state.type;return this.tsInAmbientContext((()=>{switch(t){case 68:e.declare=true;return super.parseFunctionStatement(e,false,false);case 80:e.declare=true;return this.parseClass(e,true,false);case 126:return this.tsParseEnumDeclaration(e,{declare:true});case 112:return this.tsParseAmbientExternalModuleDeclaration(e);case 100:if(this.state.containsEsc){return}case 75:case 74:if(!this.match(75)||!this.isLookaheadContextual("enum")){e.declare=true;return this.parseVarStatement(e,this.state.value,true)}this.expect(75);return this.tsParseEnumDeclaration(e,{const:true,declare:true});case 107:if(this.isUsing()){this.raise(te.InvalidModifierOnUsingDeclaration,this.state.startLoc,"declare");e.declare=true;return this.parseVarStatement(e,"using",true)}break;case 96:if(this.isAwaitUsing()){this.raise(te.InvalidModifierOnAwaitUsingDeclaration,this.state.startLoc,"declare");e.declare=true;this.next();return this.parseVarStatement(e,"await using",true)}break;case 129:{const t=this.tsParseInterfaceDeclaration(e,{declare:true});if(t)return t}default:if(tokenIsIdentifier(t)){return this.tsParseDeclaration(e,this.state.value,true,null)}}}))}tsTryParseExportDeclaration(){return this.tsParseDeclaration(this.startNode(),this.state.value,true,null)}tsParseExpressionStatement(e,t,s){switch(t.name){case"declare":{const t=this.tsTryParseDeclare(e);if(t){t.declare=true}return t}case"global":if(this.match(5)){this.scope.enter(1024);this.prodParam.enter(0);const s=e;s.kind="global";{e.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,s)}}tsParseDeclaration(e,t,s,i){switch(t){case"abstract":if(this.tsCheckLineTerminator(s)&&(this.match(80)||tokenIsIdentifier(this.state.type))){return this.tsParseAbstractDeclaration(e,i)}break;case"module":if(this.tsCheckLineTerminator(s)){if(this.match(134)){return this.tsParseAmbientExternalModuleDeclaration(e)}else if(tokenIsIdentifier(this.state.type)){e.kind="module";return this.tsParseModuleOrNamespaceDeclaration(e)}}break;case"namespace":if(this.tsCheckLineTerminator(s)&&tokenIsIdentifier(this.state.type)){e.kind="namespace";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){if(!this.match(47))return;const t=this.state.maybeInArrowParameters;this.state.maybeInArrowParameters=true;const s=this.tsTryParseAndCatch((()=>{const t=this.startNodeAt(e);t.typeParameters=this.tsParseTypeParameters(this.tsParseConstModifier);super.parseFunctionParams(t);t.returnType=this.tsTryParseTypeOrTypePredicateAnnotation();this.expect(19);return t}));this.state.maybeInArrowParameters=t;if(!s)return;return super.parseArrowExpression(s,null,true)}tsParseTypeArgumentsInExpression(){if(this.reScan_lt()!==47)return;return this.tsParseTypeArguments()}tsParseTypeArguments(){const e=this.startNode();e.params=this.tsInType((()=>this.tsInTopLevelContext((()=>{this.expect(47);return this.tsParseDelimitedList("TypeParametersOrArguments",this.tsParseType.bind(this))}))));if(e.params.length===0){this.raise(te.EmptyTypeArguments,e)}else if(!this.state.inType&&this.curContext()===d.brace){this.reScan_lt_gt()}this.expect(48);return this.finishNode(e,"TSTypeParameterInstantiation")}tsIsDeclarationStart(){return tokenIsTSDeclarationStart(this.state.type)}isExportDefaultSpecifier(){if(this.tsIsDeclarationStart())return false;return super.isExportDefaultSpecifier()}parseBindingElement(e,t){const s=t.length?t[0].loc.start:this.state.startLoc;const i={};this.tsParseModifiers({allowedModifiers:["public","private","protected","override","readonly"]},i);const r=i.accessibility;const a=i.override;const n=i.readonly;if(!(e&4)&&(r||n||a)){this.raise(te.UnexpectedParameterModifier,s)}const o=this.parseMaybeDefault();if(e&2){this.parseFunctionParamType(o)}const h=this.parseMaybeDefault(o.loc.start,o);if(r||n||a){const e=this.startNodeAt(s);if(t.length){e.decorators=t}if(r)e.accessibility=r;if(n)e.readonly=n;if(a)e.override=a;if(h.type!=="Identifier"&&h.type!=="AssignmentPattern"){this.raise(te.UnsupportedParameterPropertyKind,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)}tsDisallowOptionalPattern(e){for(const t of e.params){if(t.type!=="Identifier"&&t.optional&&!this.state.isAmbientContext){this.raise(te.PatternIsOptional,t)}}}setArrowFunctionParameters(e,t,s){super.setArrowFunctionParameters(e,t,s);this.tsDisallowOptionalPattern(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()){return this.finishNode(e,i)}if(i==="TSDeclareFunction"&&this.state.isAmbientContext){this.raise(te.DeclareFunctionHasImplementation,e);if(e.declare){return super.parseFunctionBodyAndFinish(e,i,s)}}this.tsDisallowOptionalPattern(e);return super.parseFunctionBodyAndFinish(e,t,s)}registerFunctionStatementId(e){if(!e.body&&e.id){this.checkIdentifier(e.id,1024)}else{super.registerFunctionStatementId(e)}}tsCheckForInvalidTypeCasts(e){e.forEach((e=>{if((e==null?void 0:e.type)==="TSTypeCastExpression"){this.raise(te.UnexpectedTypeAnnotation,e.typeAnnotation)}}))}toReferencedList(e,t){this.tsCheckForInvalidTypeCasts(e);return e}parseArrayLike(e,t,s,i){const r=super.parseArrayLike(e,t,s,i);if(r.type==="ArrayExpression"){this.tsCheckForInvalidTypeCasts(r.elements)}return r}parseSubscript(e,t,s,i){if(!this.hasPrecedingLineBreak()&&this.match(35)){this.state.canStartJSXElement=false;this.next();const s=this.startNodeAt(t);s.expression=e;return this.finishNode(s,"TSNonNullExpression")}let r=false;if(this.match(18)&&this.lookaheadCharCode()===60){if(s){i.stop=true;return e}i.optionalChainMember=r=true;this.next()}if(this.match(47)||this.match(51)){let a;const n=this.tsTryParseAndCatch((()=>{if(!s&&this.atPossibleAsyncArrow(e)){const e=this.tsTryParseGenericAsyncArrowFunction(t);if(e){return e}}const n=this.tsParseTypeArgumentsInExpression();if(!n)return;if(r&&!this.match(10)){a=this.state.curPosition();return}if(tokenIsTemplate(this.state.type)){const s=super.parseTaggedTemplateExpression(e,t,i);{s.typeParameters=n}return s}if(!s&&this.eat(10)){const s=this.startNodeAt(t);s.callee=e;s.arguments=this.parseCallExpressionArguments();this.tsCheckForInvalidTypeCasts(s.arguments);{s.typeParameters=n}if(i.optionalChainMember){s.optional=r}return this.finishCallExpression(s,i.optionalChainMember)}const o=this.state.type;if(o===48||o===52||o!==10&&tokenCanStartExpression(o)&&!this.hasPrecedingLineBreak()){return}const h=this.startNodeAt(t);h.expression=e;{h.typeParameters=n}return this.finishNode(h,"TSInstantiationExpression")}));if(a){this.unexpected(a,10)}if(n){if(n.type==="TSInstantiationExpression"){if(this.match(16)||this.match(18)&&this.lookaheadCharCode()!==40){this.raise(te.InvalidPropertyAccessAfterInstantiationExpression,this.state.startLoc)}if(!this.match(16)&&!this.match(18)){n.expression=super.stopParseSubscript(e,i)}}return n}}return super.parseSubscript(e,t,s,i)}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){let i;if(tokenOperatorPrecedence(58)>s&&!this.hasPrecedingLineBreak()&&(this.isContextual(93)||(i=this.isContextual(120)))){const r=this.startNodeAt(t);r.expression=e;r.typeAnnotation=this.tsInType((()=>{this.next();if(this.match(75)){if(i){this.raise(p.UnexpectedKeyword,this.state.startLoc,{keyword:"const"})}return this.tsParseTypeReference()}return this.tsParseType()}));this.finishNode(r,i?"TSSatisfiesExpression":"TSAsExpression");this.reScan_lt_gt();return this.parseExprOp(r,t,s)}return super.parseExprOp(e,t,s)}checkReservedWord(e,t,s,i){if(!this.state.isAmbientContext){super.checkReservedWord(e,t,s,i)}}checkImportReflection(e){super.checkImportReflection(e);if(e.module&&e.importKind!=="value"){this.raise(te.ImportReflectionHasImportType,e.specifiers[0].loc.start)}}checkDuplicateExports(){}isPotentialImportPhase(e){if(super.isPotentialImportPhase(e))return true;if(this.isContextual(130)){const t=this.lookaheadCharCode();return e?t===123||t===42:t!==61}return!e&&this.isContextual(87)}applyImportPhase(e,t,s,i){super.applyImportPhase(e,t,s,i);if(t){e.exportKind=s==="type"?"type":"value"}else{e.importKind=s==="type"||s==="typeof"?s:"value"}}parseImport(e){if(this.match(134)){e.importKind="value";return super.parseImport(e)}let t;if(tokenIsIdentifier(this.state.type)&&this.lookaheadCharCode()===61){e.importKind="value";return this.tsParseImportEqualsDeclaration(e)}else if(this.isContextual(130)){const s=this.parseMaybeImportPhase(e,false);if(this.lookaheadCharCode()===61){return this.tsParseImportEqualsDeclaration(e,s)}else{t=super.parseImportSpecifiersAndAfter(e,s)}}else{t=super.parseImport(e)}if(t.importKind==="type"&&t.specifiers.length>1&&t.specifiers[0].type==="ImportDefaultSpecifier"){this.raise(te.TypeImportCannotSpecifyDefaultAndNamed,t)}return t}parseExport(e,t){if(this.match(83)){const t=e;this.next();let s=null;if(this.isContextual(130)&&this.isPotentialImportPhase(false)){s=this.parseMaybeImportPhase(t,false)}else{t.importKind="value"}const i=this.tsParseImportEqualsDeclaration(t,s,true);{return i}}else if(this.eat(29)){const t=e;t.expression=super.parseExpression();this.semicolon();this.sawUnambiguousESM=true;return this.finishNode(t,"TSExportAssignment")}else if(this.eatContextual(93)){const t=e;this.expectContextual(128);t.id=this.parseIdentifier();this.semicolon();return this.finishNode(t,"TSNamespaceExportDeclaration")}else{return super.parseExport(e,t)}}isAbstractClass(){return this.isContextual(124)&&this.isLookaheadContextual("class")}parseExportDefaultExpression(){if(this.isAbstractClass()){const e=this.startNode();this.next();e.abstract=true;return this.parseClass(e,true,true)}if(this.match(129)){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;if(!e.declare&&(t==="using"||t==="await using")){this.raiseOverwrite(te.UsingDeclarationInAmbientContext,e,t);return r}for(const{id:e,init:s}of r.declarations){if(!s)continue;if(t==="var"||t==="let"||!!e.typeAnnotation){this.raise(te.InitializerNotAllowedInAmbientContext,s)}else if(!isValidAmbientConstInitializer(s,this.hasPlugin("estree"))){this.raise(te.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference,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(126)){return this.tsParseEnumDeclaration(this.startNode())}if(this.isContextual(129)){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(106)&&this.lookaheadCharCode()===123}parseClassMember(e,t,s){const i=["declare","private","public","protected","override","abstract","readonly","static"];this.tsParseModifiers({allowedModifiers:i,disallowedModifiers:["in","out"],stopOnStartOfClassStaticBlock:true,errorTemplate:te.InvalidModifierOnTypeParameterPositions},t);const callParseClassMemberWithIsStatic=()=>{if(this.tsIsStartOfStaticBlocks()){this.next();this.next();if(this.tsHasSomeModifiers(t,i)){this.raise(te.StaticBlockCannotHaveModifier,this.state.curPosition())}super.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(te.IndexSignatureHasAbstract,t)}if(t.accessibility){this.raise(te.IndexSignatureHasAccessibility,t,{modifier:t.accessibility})}if(t.declare){this.raise(te.IndexSignatureHasDeclare,t)}if(t.override){this.raise(te.IndexSignatureHasOverride,t)}return}if(!this.state.inAbstractClass&&t.abstract){this.raise(te.NonAbstractClassHasAbstractMethod,t)}if(t.override){if(!s.hadSuperClass){this.raise(te.OverrideNotInSubClass,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(te.ClassMethodHasReadonly,e)}if(e.declare&&this.match(10)){this.raise(te.ClassMethodHasDeclare,e)}}parseExpressionStatement(e,t,s){const i=t.type==="Identifier"?this.tsParseExpressionStatement(e,t,s):undefined;return i||super.parseExpressionStatement(e,t,s)}shouldParseExportDeclaration(){if(this.tsIsDeclarationStart())return true;return super.shouldParseExportDeclaration()}parseConditional(e,t,s){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(s);return e}}return super.parseConditional(e,t,s)}parseParenItem(e,t){const s=super.parseParenItem(e,t);if(this.eat(17)){s.optional=true;this.resetEndLocation(e)}if(this.match(14)){const s=this.startNodeAt(t);s.expression=e;s.typeAnnotation=this.tsParseTypeAnnotation();return this.finishNode(s,"TSTypeCastExpression")}return e}parseExportDeclaration(e){if(!this.state.isAmbientContext&&this.isContextual(125)){return this.tsInAmbientContext((()=>this.parseExportDeclaration(e)))}const t=this.state.startLoc;const s=this.eatContextual(125);if(s&&(this.isContextual(125)||!this.shouldParseExportDeclaration())){throw this.raise(te.ExpectedAmbientAfterExportDeclare,this.state.startLoc)}const i=tokenIsIdentifier(this.state.type);const r=i&&this.tsTryParseExportDeclaration()||super.parseExportDeclaration(e);if(!r)return null;if(r.type==="TSInterfaceDeclaration"||r.type==="TSTypeAliasDeclaration"||s){e.exportKind="type"}if(s&&r.type!=="TSImportEqualsDeclaration"){this.resetStartLocation(r,t);r.declare=true}return r}parseClassId(e,t,s,i){if((!t||s)&&this.isContextual(113)){return}super.parseClassId(e,t,s,e.declare?1024:8331);const r=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);if(r)e.typeParameters=r}parseClassPropertyAnnotation(e){if(!e.optional){if(this.eat(35)){e.definite=true}else if(this.eat(17)){e.optional=true}}const t=this.tsTryParseTypeAnnotation();if(t)e.typeAnnotation=t}parseClassProperty(e){this.parseClassPropertyAnnotation(e);if(this.state.isAmbientContext&&!(e.readonly&&!e.typeAnnotation)&&this.match(29)){this.raise(te.DeclareClassFieldHasInitializer,this.state.startLoc)}if(e.abstract&&this.match(29)){const{key:t}=e;this.raise(te.AbstractPropertyHasInitializer,this.state.startLoc,{propertyName:t.type==="Identifier"&&!e.computed?t.name:`[${this.input.slice(this.offsetToSourcePos(t.start),this.offsetToSourcePos(t.end))}]`})}return super.parseClassProperty(e)}parseClassPrivateProperty(e){if(e.abstract){this.raise(te.PrivateElementHasAbstract,e)}if(e.accessibility){this.raise(te.PrivateElementHasAccessibility,e,{modifier:e.accessibility})}this.parseClassPropertyAnnotation(e);return super.parseClassPrivateProperty(e)}parseClassAccessorProperty(e){this.parseClassPropertyAnnotation(e);if(e.optional){this.raise(te.AccessorCannotBeOptional,e)}return super.parseClassAccessorProperty(e)}pushClassMethod(e,t,s,i,r,a){const n=this.tsTryParseTypeParameters(this.tsParseConstModifier);if(n&&r){this.raise(te.ConstructorHasTypeParameters,n)}const{declare:o=false,kind:h}=t;if(o&&(h==="get"||h==="set")){this.raise(te.DeclareAccessor,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(this.tsParseConstModifier);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==null){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(113)){e.implements=this.tsParseHeritageClause("implements")}}parseObjPropValue(e,t,s,i,r,a,n){const o=this.tsTryParseTypeParameters(this.tsParseConstModifier);if(o)e.typeParameters=o;return super.parseObjPropValue(e,t,s,i,r,a,n)}parseFunctionParams(e,t){const s=this.tsTryParseTypeParameters(this.tsParseConstModifier);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,t){var s,i,r,a,n;let o;let h;let l;if(this.hasPlugin("jsx")&&(this.match(143)||this.match(47))){o=this.state.clone();h=this.tryParse((()=>super.parseMaybeAssign(e,t)),o);if(!h.error)return h.node;const{context:s}=this.state;const i=s[s.length-1];if(i===d.j_oTag||i===d.j_expr){s.pop()}}if(!((s=h)!=null&&s.error)&&!this.match(47)){return super.parseMaybeAssign(e,t)}if(!o||o===this.state)o=this.state.clone();let c;const p=this.tryParse((s=>{var i,r;c=this.tsParseTypeParameters(this.tsParseConstModifier);const a=super.parseMaybeAssign(e,t);if(a.type!=="ArrowFunctionExpression"||(i=a.extra)!=null&&i.parenthesized){s()}if(((r=c)==null?void 0:r.params.length)!==0){this.resetStartLocationFromNode(a,c)}a.typeParameters=c;return a}),o);if(!p.error&&!p.aborted){if(c)this.reportReservedArrowTypeParam(c);return p.node}if(!h){assert(!this.hasPlugin("jsx"));l=this.tryParse((()=>super.parseMaybeAssign(e,t)),o);if(!l.error)return l.node}if((i=h)!=null&&i.node){this.state=h.failState;return h.node}if(p.node){this.state=p.failState;if(c)this.reportReservedArrowTypeParam(c);return p.node}if((r=l)!=null&&r.node){this.state=l.failState;return l.node}throw((a=h)==null?void 0:a.error)||p.error||((n=l)==null?void 0:n.error)}reportReservedArrowTypeParam(e){var t;if(e.params.length===1&&!e.params[0].constraint&&!((t=e.extra)!=null&&t.trailingComma)&&this.getPluginOption("typescript","disallowAmbiguousJSXLike")){this.raise(te.ReservedArrowTypeParam,e)}}parseMaybeUnary(e,t){if(!this.hasPlugin("jsx")&&this.match(47)){return this.tsParseTypeAssertion()}return super.parseMaybeUnary(e,t)}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)}parseFunctionParamType(e){if(this.eat(17)){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"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":if(t){this.expressionScope.recordArrowParameterBindingError(te.UnexpectedTypeCastInParameter,e)}else{this.raise(te.UnexpectedTypeCastInParameter,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"TSSatisfiesExpression":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"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":this.checkToRestConversion(e.expression,false);break;default:super.checkToRestConversion(e,t)}}isValidLVal(e,t,s){switch(e){case"TSTypeCastExpression":return true;case"TSParameterProperty":return"parameter";case"TSNonNullExpression":return"expression";case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":return(s!==64||!t)&&["expression",true];default:return super.isValidLVal(e,t,s)}}parseBindingAtom(){if(this.state.type===78){return this.parseIdentifier(true)}return super.parseBindingAtom()}parseMaybeDecoratorArguments(e,t){if(this.match(47)||this.match(51)){const s=this.tsParseTypeArgumentsInExpression();if(this.match(10)){const i=super.parseMaybeDecoratorArguments(e,t);{i.typeParameters=s}return i}this.unexpected(null,10)}return super.parseMaybeDecoratorArguments(e,t)}checkCommaAfterRest(e){if(this.state.isAmbientContext&&this.match(12)&&this.lookaheadCharCode()===e){this.next();return false}return super.checkCommaAfterRest(e)}isClassMethod(){return this.match(47)||super.isClassMethod()}isClassProperty(){return this.match(35)||this.match(14)||super.isClassProperty()}parseMaybeDefault(e,t){const s=super.parseMaybeDefault(e,t);if(s.type==="AssignmentPattern"&&s.typeAnnotation&&s.right.start<s.typeAnnotation.start){this.raise(te.TypeAnnotationAfterAssign,s.typeAnnotation)}return s}getTokenFromCode(e){if(this.state.inType){if(e===62){this.finishOp(48,1);return}if(e===60){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}toAssignableListItem(e,t,s){const i=e[t];if(i.type==="TSTypeCastExpression"){e[t]=this.typeCastToParameter(i)}super.toAssignableListItem(e,t,s)}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{isAmbientContext:t,strict:s}=this.state;this.state.isAmbientContext=true;this.state.strict=false;try{return e()}finally{this.state.isAmbientContext=t;this.state.strict=s}}parseClass(e,t,s){const i=this.state.inAbstractClass;this.state.inAbstractClass=!!e.abstract;try{return super.parseClass(e,t,s)}finally{this.state.inAbstractClass=i}}tsParseAbstractDeclaration(e,t){if(this.match(80)){e.abstract=true;return this.maybeTakeDecorators(t,this.parseClass(e,true,false))}else if(this.isContextual(129)){if(!this.hasFollowingLineBreak()){e.abstract=true;this.raise(te.NonClassMethodPropertyHasAbstractModifier,e);return this.tsParseInterfaceDeclaration(e)}}else{this.unexpected(null,80)}}parseMethod(e,t,s,i,r,a,n){const o=super.parseMethod(e,t,s,i,r,a,n);if(o.abstract||o.type==="TSAbstractMethodDefinition"){const e=this.hasPlugin("estree");const t=e?o.value:o;if(t.body){const{key:e}=o;this.raise(te.AbstractMethodHasImplementation,o,{methodName:e.type==="Identifier"&&!o.computed?e.name:`[${this.input.slice(this.offsetToSourcePos(e.start),this.offsetToSourcePos(e.end))}]`})}}return o}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,r){if(!t&&i){this.parseTypeOnlyImportExportSpecifier(e,true,s);return this.finishNode(e,"ImportSpecifier")}e.importKind="value";return super.parseImportSpecifier(e,t,s,i,s?4098:4096)}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 l=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?te.TypeModifierIsUsedInTypeImports:te.TypeModifierIsUsedInTypeExports,l)}e[i]=a;e[r]=n;const c=t?"importKind":"exportKind";e[c]=o?"type":"value";if(h&&this.eatContextual(93)){e[r]=t?this.parseIdentifier():this.parseModuleExportName()}if(!e[r]){e[r]=this.cloneIdentifier(e[i])}if(t){this.checkIdentifier(e[r],o?4098:4096)}}fillOptionalPropertiesForTSESLint(e){var t,s,i,r,a,n,o,h,l,c,p,u,d,f,m,y,x,P,g,T,b,A,w,S,I,E,C,k,N,v,L,M,O,D,F,B,R,U,j,_,K,H,V,z,q,$;switch(e.type){case"ExpressionStatement":(t=e.directive)!=null?t:e.directive=undefined;return;case"RestElement":e.value=undefined;case"Identifier":case"ArrayPattern":case"AssignmentPattern":case"ObjectPattern":(s=e.decorators)!=null?s:e.decorators=[];(i=e.optional)!=null?i:e.optional=false;(r=e.typeAnnotation)!=null?r:e.typeAnnotation=undefined;return;case"TSParameterProperty":(a=e.accessibility)!=null?a:e.accessibility=undefined;(n=e.decorators)!=null?n:e.decorators=[];(o=e.override)!=null?o:e.override=false;(h=e.readonly)!=null?h:e.readonly=false;(l=e.static)!=null?l:e.static=false;return;case"TSEmptyBodyFunctionExpression":e.body=null;case"TSDeclareFunction":case"FunctionDeclaration":case"FunctionExpression":case"ClassMethod":case"ClassPrivateMethod":(c=e.declare)!=null?c:e.declare=false;(p=e.returnType)!=null?p:e.returnType=undefined;(u=e.typeParameters)!=null?u:e.typeParameters=undefined;return;case"Property":(d=e.optional)!=null?d:e.optional=false;return;case"TSMethodSignature":case"TSPropertySignature":(f=e.optional)!=null?f:e.optional=false;case"TSIndexSignature":(m=e.accessibility)!=null?m:e.accessibility=undefined;(y=e.readonly)!=null?y:e.readonly=false;(x=e.static)!=null?x:e.static=false;return;case"TSAbstractPropertyDefinition":case"PropertyDefinition":case"TSAbstractAccessorProperty":case"AccessorProperty":(P=e.declare)!=null?P:e.declare=false;(g=e.definite)!=null?g:e.definite=false;(T=e.readonly)!=null?T:e.readonly=false;(b=e.typeAnnotation)!=null?b:e.typeAnnotation=undefined;case"TSAbstractMethodDefinition":case"MethodDefinition":(A=e.accessibility)!=null?A:e.accessibility=undefined;(w=e.decorators)!=null?w:e.decorators=[];(S=e.override)!=null?S:e.override=false;(I=e.optional)!=null?I:e.optional=false;return;case"ClassExpression":(E=e.id)!=null?E:e.id=null;case"ClassDeclaration":(C=e.abstract)!=null?C:e.abstract=false;(k=e.declare)!=null?k:e.declare=false;(N=e.decorators)!=null?N:e.decorators=[];(v=e.implements)!=null?v:e.implements=[];(L=e.superTypeArguments)!=null?L:e.superTypeArguments=undefined;(M=e.typeParameters)!=null?M:e.typeParameters=undefined;return;case"TSTypeAliasDeclaration":case"VariableDeclaration":(O=e.declare)!=null?O:e.declare=false;return;case"VariableDeclarator":(D=e.definite)!=null?D:e.definite=false;return;case"TSEnumDeclaration":(F=e.const)!=null?F:e.const=false;(B=e.declare)!=null?B:e.declare=false;return;case"TSEnumMember":(R=e.computed)!=null?R:e.computed=false;return;case"TSImportType":(U=e.qualifier)!=null?U:e.qualifier=null;(j=e.options)!=null?j:e.options=null;return;case"TSInterfaceDeclaration":(_=e.declare)!=null?_:e.declare=false;(K=e.extends)!=null?K:e.extends=[];return;case"TSModuleDeclaration":(H=e.declare)!=null?H:e.declare=false;(V=e.global)!=null?V:e.global=e.kind==="global";return;case"TSTypeParameter":(z=e.const)!=null?z:e.const=false;(q=e.in)!=null?q:e.in=false;($=e.out)!=null?$:e.out=false;return}}};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 isValidAmbientConstInitializer(e,t){var s;const{type:i}=e;if((s=e.extra)!=null&&s.parenthesized){return false}if(t){if(i==="Literal"){const{value:t}=e;if(typeof t==="string"||typeof t==="boolean"){return true}}}else{if(i==="StringLiteral"||i==="BooleanLiteral"){return true}}if(isNumber(e,t)||isNegativeNumber(e,t)){return true}if(i==="TemplateLiteral"&&e.expressions.length===0){return true}if(isPossiblyLiteralEnum(e)){return true}return false}function isNumber(e,t){if(t){return e.type==="Literal"&&(typeof e.value==="number"||"bigint"in e)}return e.type==="NumericLiteral"||e.type==="BigIntLiteral"}function isNegativeNumber(e,t){if(e.type==="UnaryExpression"){const{operator:s,argument:i}=e;if(s==="-"&&isNumber(i,t)){return true}}return false}function isUncomputedMemberExpressionChain(e){if(e.type==="Identifier")return true;if(e.type!=="MemberExpression"||e.computed){return false}return isUncomputedMemberExpressionChain(e.object)}const se=ParseErrorEnum`placeholders`({ClassNameIsRequired:"A class name is required.",UnexpectedSpace:"Unexpected space in placeholder."});var placeholders=e=>class PlaceholdersParserMixin extends e{parsePlaceholder(e){if(this.match(133)){const t=this.startNode();this.next();this.assertNoSpace();t.name=super.parseIdentifier(true);this.assertNoSpace();this.expect(133);return this.finishPlaceholder(t,e)}}finishPlaceholder(e,t){let s=e;if(!s.expectedNode||!s.type){s=this.finishNode(s,"Placeholder")}s.expectedNode=t;return s}getTokenFromCode(e){if(e===37&&this.input.charCodeAt(this.state.pos+1)===37){this.finishOp(133,2)}else{super.getTokenFromCode(e)}}parseExprAtom(e){return this.parsePlaceholder("Expression")||super.parseExprAtom(e)}parseIdentifier(e){return this.parsePlaceholder("Identifier")||super.parseIdentifier(e)}checkReservedWord(e,t,s,i){if(e!==undefined){super.checkReservedWord(e,t,s,i)}}cloneIdentifier(e){const t=super.cloneIdentifier(e);if(t.type==="Placeholder"){t.expectedNode=e.expectedNode}return t}cloneStringLiteral(e){if(e.type==="Placeholder"){return this.cloneIdentifier(e)}return super.cloneStringLiteral(e)}parseBindingAtom(){return this.parsePlaceholder("Pattern")||super.parseBindingAtom()}isValidLVal(e,t,s){return e==="Placeholder"||super.isValidLVal(e,t,s)}toAssignable(e,t){if(e&&e.type==="Placeholder"&&e.expectedNode==="Expression"){e.expectedNode="Pattern"}else{super.toAssignable(e,t)}}chStartsBindingIdentifier(e,t){if(super.chStartsBindingIdentifier(e,t)){return true}const s=this.nextTokenStart();if(this.input.charCodeAt(s)===37&&this.input.charCodeAt(s+1)===37){return true}return false}verifyBreakContinue(e,t){if(e.label&&e.label.type==="Placeholder")return;super.verifyBreakContinue(e,t)}parseExpressionStatement(e,t){var s;if(t.type!=="Placeholder"||(s=t.extra)!=null&&s.parenthesized){return super.parseExpressionStatement(e,t)}if(this.match(14)){const s=e;s.label=this.finishPlaceholder(t,"Identifier");this.next();s.body=super.parseStatementOrSloppyAnnexBFunctionDeclaration();return this.finishNode(s,"LabeledStatement")}this.semicolon();const i=e;i.name=t.name;return this.finishPlaceholder(i,"Statement")}parseBlock(e,t,s){return this.parsePlaceholder("BlockStatement")||super.parseBlock(e,t,s)}parseFunctionId(e){return this.parsePlaceholder("Identifier")||super.parseFunctionId(e)}parseClass(e,t,s){const i=t?"ClassDeclaration":"ClassExpression";this.next();const r=this.state.strict;const a=this.parsePlaceholder("Identifier");if(a){if(this.match(81)||this.match(133)||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(se.ClassNameIsRequired,this.state.startLoc)}}else{this.parseClassId(e,t,s)}super.parseClassSuper(e);e.body=this.parsePlaceholder("ClassBody")||super.parseClassBody(!!e.superClass,r);return this.finishNode(e,i)}parseExport(e,t){const s=this.parsePlaceholder("Identifier");if(!s)return super.parseExport(e,t);const i=e;if(!this.isContextual(98)&&!this.match(12)){i.specifiers=[];i.source=null;i.declaration=this.finishPlaceholder(s,"Declaration");return this.finishNode(i,"ExportNamedDeclaration")}this.expectPlugin("exportDefaultFrom");const r=this.startNode();r.exported=s;i.specifiers=[this.finishNode(r,"ExportDefaultSpecifier")];return super.parseExport(i,t)}isExportDefaultSpecifier(){if(this.match(65)){const e=this.nextTokenStart();if(this.isUnparsedContextual(e,"from")){if(this.input.startsWith(tokenLabelName(133),this.nextTokenStartSince(e+4))){return true}}}return super.isExportDefaultSpecifier()}maybeParseExportDefaultSpecifier(e,t){var s;if((s=e.specifiers)!=null&&s.length){return true}return super.maybeParseExportDefaultSpecifier(e,t)}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(e);e.specifiers=[];if(!this.isContextual(98)&&!this.match(12)){e.source=this.finishPlaceholder(t,"StringLiteral");this.semicolon();return this.finishNode(e,"ImportDeclaration")}const s=this.startNodeAtNode(t);s.local=t;e.specifiers.push(this.finishNode(s,"ImportDefaultSpecifier"));if(this.eat(12)){const t=this.maybeParseStarImportSpecifier(e);if(!t)this.parseNamedImportSpecifiers(e)}this.expectContextual(98);e.source=this.parseImportSource();this.semicolon();return this.finishNode(e,"ImportDeclaration")}parseImportSource(){return this.parsePlaceholder("StringLiteral")||super.parseImportSource()}assertNoSpace(){if(this.state.start>this.offsetToSourcePos(this.state.lastTokEndLoc.index)){this.raise(se.UnexpectedSpace,this.state.lastTokEndLoc)}}};var v8intrinsic=e=>class V8IntrinsicMixin 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();const s=this.createIdentifier(t,e);this.castNodeTo(s,"V8IntrinsicIdentifier");if(this.match(10)){return s}}this.unexpected(e)}}parseExprAtom(e){return this.parseV8Intrinsic()||super.parseExprAtom(e)}};const ie=["minimal","fsharp","hack","smart"];const re=["^^","@@","^","%","#"];function validatePlugins(e){if(e.has("decorators")){if(e.has("decorators-legacy")){throw new Error("Cannot use the decorators and decorators-legacy plugin together")}const t=e.get("decorators").decoratorsBeforeExport;if(t!=null&&typeof t!=="boolean"){throw new Error("'decoratorsBeforeExport' must be a boolean, if specified.")}const s=e.get("decorators").allowCallParenthesized;if(s!=null&&typeof s!=="boolean"){throw new Error("'allowCallParenthesized' must be a boolean.")}}if(e.has("flow")&&e.has("typescript")){throw new Error("Cannot combine flow and typescript plugins.")}if(e.has("placeholders")&&e.has("v8intrinsic")){throw new Error("Cannot combine placeholders and v8intrinsic plugins.")}if(e.has("pipelineOperator")){var t;const i=e.get("pipelineOperator").proposal;if(!ie.includes(i)){const e=ie.map((e=>`"${e}"`)).join(", ");throw new Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${e}.`)}if(i==="hack"){if(e.has("placeholders")){throw new Error("Cannot combine placeholders plugin and Hack-style pipes.")}if(e.has("v8intrinsic")){throw new Error("Cannot combine v8intrinsic plugin and Hack-style pipes.")}const t=e.get("pipelineOperator").topicToken;if(!re.includes(t)){const e=re.map((e=>`"${e}"`)).join(", ");throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${e}.`)}{var s;if(t==="#"&&((s=e.get("recordAndTuple"))==null?void 0:s.syntaxType)==="hash"){throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "hack", topicToken: "#" }]\` and \`${JSON.stringify(["recordAndTuple",e.get("recordAndTuple")])}\`.`)}}}else if(i==="smart"&&((t=e.get("recordAndTuple"))==null?void 0:t.syntaxType)==="hash"){throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "smart" }]\` and \`${JSON.stringify(["recordAndTuple",e.get("recordAndTuple")])}\`.`)}}if(e.has("moduleAttributes")){{if(e.has("deprecatedImportAssert")||e.has("importAssertions")){throw new Error("Cannot combine importAssertions, deprecatedImportAssert and moduleAttributes plugins.")}const t=e.get("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(e.has("importAssertions")){if(e.has("deprecatedImportAssert")){throw new Error("Cannot combine importAssertions and deprecatedImportAssert plugins.")}}if(!e.has("deprecatedImportAssert")&&e.has("importAttributes")&&e.get("importAttributes").deprecatedAssertSyntax){{e.set("deprecatedImportAssert",{})}}if(e.has("recordAndTuple")){{const t=e.get("recordAndTuple").syntaxType;if(t!=null){const e=["hash","bar"];if(!e.includes(t)){throw new Error("The 'syntaxType' option of the 'recordAndTuple' plugin must be one of: "+e.map((e=>`'${e}'`)).join(", "))}}}}if(e.has("asyncDoExpressions")&&!e.has("doExpressions")){const e=new Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.");e.missingPlugins="doExpressions";throw e}if(e.has("optionalChainingAssign")&&e.get("optionalChainingAssign").version!=="2023-07"){throw new Error("The 'optionalChainingAssign' plugin requires a 'version' option,"+" representing the last proposal update. Currently, the"+" only supported value is '2023-07'.")}if(e.has("discardBinding")&&e.get("discardBinding").syntaxType!=="void"){throw new Error("The 'discardBinding' plugin requires a 'syntaxType' option. Currently the only supported value is 'void'.")}}const ae={estree:estree,jsx:jsx,flow:flow,typescript:typescript,v8intrinsic:v8intrinsic,placeholders:placeholders};const ne=Object.keys(ae);class ExpressionParser extends LValParser{checkProto(e,t,s,i){if(e.type==="SpreadElement"||this.isObjectMethod(e)||e.computed||e.shorthand){return s}const r=e.key;const a=r.type==="Identifier"?r.name:r.value;if(a==="__proto__"){if(t){this.raise(p.RecordNoProto,r);return true}if(s){if(i){if(i.doubleProtoLoc===null){i.doubleProtoLoc=r.loc.start}}else{this.raise(p.DuplicateProto,r)}}return true}return s}shouldExitDescending(e,t){return e.type==="ArrowFunctionExpression"&&this.offsetToSourcePos(e.start)===t}getExpression(){this.enterInitialScopes();this.nextToken();if(this.match(140)){throw this.raise(p.ParseExpressionEmptyInput,this.state.startLoc)}const e=this.parseExpression();if(!this.match(140)){throw this.raise(p.ParseExpressionExpectsEOF,this.state.startLoc,{unexpected:this.input.codePointAt(this.state.start)})}this.finalizeRemainingComments();e.comments=this.comments;e.errors=this.state.errors;if(this.optionFlags&256){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.startLoc;const s=this.parseMaybeAssign(e);if(this.match(12)){const i=this.startNodeAt(t);i.expressions=[s];while(this.eat(12)){i.expressions.push(this.parseMaybeAssign(e))}this.toReferencedList(i.expressions);return this.finishNode(i,"SequenceExpression")}return s}parseMaybeAssignDisallowIn(e,t){return this.disallowInAnd((()=>this.parseMaybeAssign(e,t)))}parseMaybeAssignAllowIn(e,t){return this.allowInAnd((()=>this.parseMaybeAssign(e,t)))}setOptionalParametersError(e){e.optionalParametersLoc=this.state.startLoc}parseMaybeAssign(e,t){const s=this.state.startLoc;const i=this.isContextual(108);if(i){if(this.prodParam.hasYield){this.next();let e=this.parseYield(s);if(t){e=t.call(this,e,s)}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)}if(tokenIsAssignment(this.state.type)){const t=this.startNodeAt(s);const i=this.state.value;t.operator=i;if(this.match(29)){this.toAssignable(n,true);t.left=n;const i=s.index;if(e.doubleProtoLoc!=null&&e.doubleProtoLoc.index>=i){e.doubleProtoLoc=null}if(e.shorthandAssignLoc!=null&&e.shorthandAssignLoc.index>=i){e.shorthandAssignLoc=null}if(e.privateKeyLoc!=null&&e.privateKeyLoc.index>=i){this.checkDestructuringPrivate(e);e.privateKeyLoc=null}if(e.voidPatternLoc!=null&&e.voidPatternLoc.index>=i){e.voidPatternLoc=null}}else{t.left=n}this.next();t.right=this.parseMaybeAssign();this.checkLVal(n,this.finishNode(t,"AssignmentExpression"));return t}else if(r){this.checkExpressionErrors(e,true)}if(i){const{type:e}=this.state;const t=this.hasPlugin("v8intrinsic")?tokenCanStartExpression(e):tokenCanStartExpression(e)&&!this.match(54);if(t&&!this.isAmbiguousPrefixOrIdentifier()){this.raiseOverwrite(p.YieldNotInGeneratorFunction,s);return this.parseYield(s)}}return n}parseMaybeConditional(e){const t=this.state.startLoc;const s=this.state.potentialArrowAt;const i=this.parseExprOps(e);if(this.shouldExitDescending(i,s)){return i}return this.parseConditional(i,t,e)}parseConditional(e,t,s){if(this.eat(17)){const s=this.startNodeAt(t);s.test=e;s.consequent=this.parseMaybeAssignAllowIn();this.expect(14);s.alternate=this.parseMaybeAssign();return this.finishNode(s,"ConditionalExpression")}return e}parseMaybeUnaryOrPrivate(e){return this.match(139)?this.parsePrivateName():this.parseMaybeUnary(e)}parseExprOps(e){const t=this.state.startLoc;const s=this.state.potentialArrowAt;const i=this.parseMaybeUnaryOrPrivate(e);if(this.shouldExitDescending(i,s)){return i}return this.parseExprOp(i,t,-1)}parseExprOp(e,t,s){if(this.isPrivateName(e)){const t=this.getPrivateNameSV(e);if(s>=tokenOperatorPrecedence(58)||!this.prodParam.hasIn||!this.match(58)){this.raise(p.PrivateInExpectedIn,e,{identifierName:t})}this.classScope.usePrivateName(t,e.loc.start)}const i=this.state.type;if(tokenIsOperator(i)&&(this.prodParam.hasIn||!this.match(58))){let r=tokenOperatorPrecedence(i);if(r>s){if(i===39){this.expectPlugin("pipelineOperator");if(this.state.inFSharpPipelineDirectBody){return e}this.checkPipelineAtInfixOperator(e,t)}const a=this.startNodeAt(t);a.left=e;a.operator=this.state.value;const n=i===41||i===42;const o=i===40;if(o){r=tokenOperatorPrecedence(42)}this.next();if(i===39&&this.hasPlugin(["pipelineOperator",{proposal:"minimal"}])){if(this.state.type===96&&this.prodParam.hasAwait){throw this.raise(p.UnexpectedAwaitAfterPipelineBody,this.state.startLoc)}}a.right=this.parseExprOpRightExpr(i,r);const h=this.finishNode(a,n||o?"LogicalExpression":"BinaryExpression");const l=this.state.type;if(o&&(l===41||l===42)||n&&l===40){throw this.raise(p.MixingCoalesceWithLogical,this.state.startLoc)}return this.parseExprOp(h,t,s)}}return e}parseExprOpRightExpr(e,t){const s=this.state.startLoc;switch(e){case 39:switch(this.getPluginOption("pipelineOperator","proposal")){case"hack":return this.withTopicBindingContext((()=>this.parseHackPipeBody()));case"fsharp":return this.withSoloAwaitPermittingContext((()=>this.parseFSharpPipelineBody(t)))}if(this.getPluginOption("pipelineOperator","proposal")==="smart"){return this.withTopicBindingContext((()=>{if(this.prodParam.hasYield&&this.isContextual(108)){throw this.raise(p.PipeBodyIsTighter,this.state.startLoc)}return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(e,t),s)}))}default:return this.parseExprOpBaseRightExpr(e,t)}}parseExprOpBaseRightExpr(e,t){const s=this.state.startLoc;return this.parseExprOp(this.parseMaybeUnaryOrPrivate(),s,tokenIsRightAssociative(e)?t-1:t)}parseHackPipeBody(){var e;const{startLoc:t}=this.state;const s=this.parseMaybeAssign();const i=h.has(s.type);if(i&&!((e=s.extra)!=null&&e.parenthesized)){this.raise(p.PipeUnparenthesizedBody,t,{type:s.type})}if(!this.topicReferenceWasUsedInCurrentContext()){this.raise(p.PipeTopicUnused,t)}return s}checkExponentialAfterUnary(e){if(this.match(57)){this.raise(p.UnexpectedTokenUnaryExponentiation,e.argument)}}parseMaybeUnary(e,t){const s=this.state.startLoc;const i=this.isContextual(96);if(i&&this.recordAwaitIfAllowed()){this.next();const e=this.parseAwait(s);if(!t)this.checkExponentialAfterUnary(e);return e}const r=this.match(34);const a=this.startNode();if(tokenIsPrefix(this.state.type)){a.operator=this.state.value;a.prefix=true;if(this.match(72)){this.expectPlugin("throwExpressions")}const s=this.match(89);this.next();a.argument=this.parseMaybeUnary(null,true);this.checkExpressionErrors(e,true);if(this.state.strict&&s){const e=a.argument;if(e.type==="Identifier"){this.raise(p.StrictDelete,a)}else if(this.hasPropertyAsPrivateName(e)){this.raise(p.DeletePrivateField,a)}}if(!r){if(!t){this.checkExponentialAfterUnary(a)}return this.finishNode(a,"UnaryExpression")}}const n=this.parseUpdate(a,r,e);if(i){const{type:e}=this.state;const t=this.hasPlugin("v8intrinsic")?tokenCanStartExpression(e):tokenCanStartExpression(e)&&!this.match(54);if(t&&!this.isAmbiguousPrefixOrIdentifier()){this.raiseOverwrite(p.AwaitNotInAsyncContext,s);return this.parseAwait(s)}}return n}parseUpdate(e,t,s){if(t){const t=e;this.checkLVal(t.argument,this.finishNode(t,"UpdateExpression"));return e}const i=this.state.startLoc;let r=this.parseExprSubscripts(s);if(this.checkExpressionErrors(s,false))return r;while(tokenIsPostfix(this.state.type)&&!this.canInsertSemicolon()){const e=this.startNodeAt(i);e.operator=this.state.value;e.prefix=false;e.argument=r;this.next();this.checkLVal(r,r=this.finishNode(e,"UpdateExpression"))}return r}parseExprSubscripts(e){const t=this.state.startLoc;const s=this.state.potentialArrowAt;const i=this.parseExprAtom(e);if(this.shouldExitDescending(i,s)){return i}return this.parseSubscripts(i,t)}parseSubscripts(e,t,s){const i={optionalChainMember:false,maybeAsyncArrow:this.atPossibleAsyncArrow(e),stop:false};do{e=this.parseSubscript(e,t,s,i);i.maybeAsyncArrow=false}while(!i.stop);return e}parseSubscript(e,t,s,i){const{type:r}=this.state;if(!s&&r===15){return this.parseBind(e,t,s,i)}else if(tokenIsTemplate(r)){return this.parseTaggedTemplateExpression(e,t,i)}let a=false;if(r===18){if(s){this.raise(p.OptionalChainingNoNew,this.state.startLoc);if(this.lookaheadCharCode()===40){return this.stopParseSubscript(e,i)}}i.optionalChainMember=a=true;this.next()}if(!s&&this.match(10)){return this.parseCoverCallAndAsyncArrowHead(e,t,i,a)}else{const s=this.eat(0);if(s||a||this.eat(16)){return this.parseMember(e,t,i,s,a)}else{return this.stopParseSubscript(e,i)}}}stopParseSubscript(e,t){t.stop=true;return e}parseMember(e,t,s,i,r){const a=this.startNodeAt(t);a.object=e;a.computed=i;if(i){a.property=this.parseExpression();this.expect(3)}else if(this.match(139)){if(e.type==="Super"){this.raise(p.SuperPrivateField,t)}this.classScope.usePrivateName(this.state.value,this.state.startLoc);a.property=this.parsePrivateName()}else{a.property=this.parseIdentifier(true)}if(s.optionalChainMember){a.optional=r;return this.finishNode(a,"OptionalMemberExpression")}else{return this.finishNode(a,"MemberExpression")}}parseBind(e,t,s,i){const r=this.startNodeAt(t);r.object=e;this.next();r.callee=this.parseNoCallExpr();i.stop=true;return this.parseSubscripts(this.finishNode(r,"BindExpression"),t,s)}parseCoverCallAndAsyncArrowHead(e,t,s,i){const r=this.state.maybeInArrowParameters;let a=null;this.state.maybeInArrowParameters=true;this.next();const n=this.startNodeAt(t);n.callee=e;const{maybeAsyncArrow:o,optionalChainMember:h}=s;if(o){this.expressionScope.enter(newAsyncArrowScope());a=new ExpressionErrors}if(h){n.optional=i}if(i){n.arguments=this.parseCallExpressionArguments()}else{n.arguments=this.parseCallExpressionArguments(e.type!=="Super",n,a)}let l=this.finishCallExpression(n,h);if(o&&this.shouldParseAsyncArrow()&&!i){s.stop=true;this.checkDestructuringPrivate(a);this.expressionScope.validateAsPattern();this.expressionScope.exit();l=this.parseAsyncArrowFromCallExpression(this.startNodeAt(t),l)}else{if(o){this.checkExpressionErrors(a,true);this.expressionScope.exit()}this.toReferencedArguments(l)}this.state.maybeInArrowParameters=r;return l}toReferencedArguments(e,t){this.toReferencedListDeep(e.arguments,t)}parseTaggedTemplateExpression(e,t,s){const i=this.startNodeAt(t);i.tag=e;i.quasi=this.parseTemplate(true);if(s.optionalChainMember){this.raise(p.OptionalChainingNoTemplate,t)}return this.finishNode(i,"TaggedTemplateExpression")}atPossibleAsyncArrow(e){return e.type==="Identifier"&&e.name==="async"&&this.state.lastTokEndLoc.index===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.offsetToSourcePos(e.start)===this.state.potentialArrowAt}finishCallExpression(e,t){if(e.callee.type==="Import"){if(e.arguments.length===0||e.arguments.length>2){this.raise(p.ImportCallArity,e)}else{for(const t of e.arguments){if(t.type==="SpreadElement"){this.raise(p.ImportCallSpreadArgument,t)}}}}return this.finishNode(e,t?"OptionalCallExpression":"CallExpression")}parseCallExpressionArguments(e,t,s){const i=[];let r=true;const a=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=false;while(!this.eat(11)){if(r){r=false}else{this.expect(12);if(this.match(11)){if(t){this.addTrailingCommaExtraToNode(t)}this.next();break}}i.push(this.parseExprListItem(11,false,s,e))}this.state.inFSharpPipelineDirectBody=a;return i}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.startLoc;return this.parseSubscripts(this.parseExprAtom(),e,true)}parseExprAtom(e){let t;let s=null;const{type:i}=this.state;switch(i){case 79:return this.parseSuper();case 83:t=this.startNode();this.next();if(this.match(16)){return this.parseImportMetaPropertyOrPhaseCall(t)}if(this.match(10)){if(this.optionFlags&512){return this.parseImportCall(t)}else{return this.finishNode(t,"Import")}}else{this.raise(p.UnsupportedImport,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 135:return this.parseNumericLiteral(this.state.value);case 136:return this.parseBigIntLiteral(this.state.value);case 134: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 0:{return this.parseArrayLike(3,true,false,e)}case 5:{return this.parseObjectLike(8,false,false,e)}case 68:return this.parseFunctionOrFunctionSent();case 26:s=this.parseDecorators();case 80:return this.parseClass(this.maybeTakeDecorators(s,this.startNode()),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(p.UnsupportedBind,e)}}case 139:{this.raise(p.PrivateInExpectedIn,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)}this.unexpected();break}case 47:{const e=this.input.codePointAt(this.nextTokenStart());if(isIdentifierStart(e)||e===62){this.expectOnePlugin(["jsx","flow","typescript"])}else{this.unexpected()}break}default:{if(i===137){return this.parseDecimalLiteral(this.state.value)}else if(i===2||i===1){return this.parseArrayLike(this.state.type===2?4:3,false,true)}else if(i===6||i===7){return this.parseObjectLike(this.state.type===6?9:8,false,true)}}if(tokenIsIdentifier(i)){if(this.isContextual(127)&&this.lookaheadInLineCharCode()===123){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.parseAsyncFunctionExpression(this.startNodeAtNode(s))}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{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{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)){if(s==="hack"){if(!this.topicReferenceIsAllowedInCurrentContext()){this.raise(p.PipeTopicUnbound,t)}this.registerTopicReference();return this.finishNode(e,"TopicReference")}else{if(!this.topicReferenceIsAllowedInCurrentContext()){this.raise(p.PrimaryTopicNotAllowed,t)}this.registerTopicReference();return this.finishNode(e,"PipelinePrimaryTopicReference")}}else{throw this.raise(p.PipeTopicUnconfiguredToken,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(p.PipeTopicRequiresHackPipes,t)}}parseAsyncArrowUnaryFunction(e){this.prodParam.enter(functionFlags(true,this.prodParam.hasYield));const t=[this.parseIdentifier()];this.prodParam.exit();if(this.hasPrecedingLineBreak()){this.raise(p.LineTerminatorBeforeArrow,this.state.curPosition())}this.expect(19);return this.parseArrowExpression(e,t,true)}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(2);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.optionFlags&16)){this.raise(p.SuperNotAllowed,e)}else if(!this.scope.allowSuper&&!(this.optionFlags&16)){this.raise(p.UnexpectedSuper,e)}if(!this.match(10)&&!this.match(0)&&!this.match(16)){this.raise(p.UnsupportedSuper,e)}return this.finishNode(e,"Super")}parsePrivateName(){const e=this.startNode();const t=this.startNodeAt(createPositionWithColumnOffset(this.state.startLoc,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(103)){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(p.UnsupportedMetaProperty,e.property,{target:t.name,onlyValidPropertyName:s})}return this.finishNode(e,"MetaProperty")}parseImportMetaPropertyOrPhaseCall(e){this.next();if(this.isContextual(105)||this.isContextual(97)){const t=this.isContextual(105);this.expectPlugin(t?"sourcePhaseImports":"deferredImportEvaluation");this.next();e.phase=t?"source":"defer";return this.parseImportCall(e)}else{const t=this.createIdentifierAt(this.startNodeAtNode(e),"import",this.state.lastTokStartLoc);if(this.isContextual(101)){if(!this.inModule){this.raise(p.ImportMetaOutsideModule,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(this.offsetToSourcePos(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.startNode();this.addExtra(t,"raw",this.input.slice(this.offsetToSourcePos(t.start),this.state.end));t.pattern=e.pattern;t.flags=e.flags;this.next();return this.finishNode(t,"RegExpLiteral")}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.startLoc;let s;this.next();this.expressionScope.enter(newArrowHeadScope());const i=this.state.maybeInArrowParameters;const r=this.state.inFSharpPipelineDirectBody;this.state.maybeInArrowParameters=true;this.state.inFSharpPipelineDirectBody=false;const a=this.state.startLoc;const n=[];const o=new ExpressionErrors;let h=true;let l;let c;while(!this.match(11)){if(h){h=false}else{this.expect(12,o.optionalParametersLoc===null?null:o.optionalParametersLoc);if(this.match(11)){c=this.state.startLoc;break}}if(this.match(21)){const e=this.state.startLoc;l=this.state.startLoc;n.push(this.parseParenItem(this.parseRestBinding(),e));if(!this.checkCommaAfterRest(41)){break}}else{n.push(this.parseMaybeAssignAllowInOrVoidPattern(11,o,this.parseParenItem))}}const p=this.state.lastTokEndLoc;this.expect(11);this.state.maybeInArrowParameters=i;this.state.inFSharpPipelineDirectBody=r;let u=this.startNodeAt(t);if(e&&this.shouldParseArrow(n)&&(u=this.parseArrow(u))){this.checkDestructuringPrivate(o);this.expressionScope.validateAsPattern();this.expressionScope.exit();this.parseArrowExpression(u,n,false);return u}this.expressionScope.exit();if(!n.length){this.unexpected(this.state.lastTokStartLoc)}if(c)this.unexpected(c);if(l)this.unexpected(l);this.checkExpressionErrors(o,true);this.toReferencedListDeep(n,true);if(n.length>1){s=this.startNodeAt(a);s.expressions=n;this.finishNode(s,"SequenceExpression");this.resetEndLocation(s,p)}else{s=n[0]}return this.wrapParenthesis(t,s)}wrapParenthesis(e,t){if(!(this.optionFlags&1024)){this.addExtra(t,"parenthesized",true);this.addExtra(t,"parenStart",e.index);this.takeSurroundingComments(t,e.index,this.state.lastTokEndLoc.index);return t}const s=this.startNodeAt(e);s.expression=t;return this.finishNode(s,"ParenthesizedExpression")}shouldParseArrow(e){return!this.canInsertSemicolon()}parseArrow(e){if(this.eat(19)){return e}}parseParenItem(e,t){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.allowNewTarget){this.raise(p.UnexpectedNewTarget,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){const t=this.match(83);const s=this.parseNoCallExpr();e.callee=s;if(t&&(s.type==="Import"||s.type==="ImportExpression")){this.raise(p.ImportCallNotNewExpression,s)}}parseTemplateElement(e){const{start:t,startLoc:s,end:i,value:r}=this.state;const a=t+1;const n=this.startNodeAt(createPositionWithColumnOffset(s,1));if(r===null){if(!e){this.raise(p.InvalidEscapeSequenceTemplate,createPositionWithColumnOffset(this.state.firstInvalidTemplateEscapePos,1))}}const o=this.match(24);const h=o?-1:-2;const l=i+h;n.value={raw:this.input.slice(a,l).replace(/\r\n?/g,"\n"),cooked:r===null?null:r.slice(1,h)};n.tail=o;this.next();const c=this.finishNode(n,"TemplateElement");this.resetEndLocation(c,createPositionWithColumnOffset(this.state.lastTokEndLoc,h));return c}parseTemplate(e){const t=this.startNode();let s=this.parseTemplateElement(e);const i=[s];const r=[];while(!s.tail){r.push(this.parseTemplateSubstitution());this.readTemplateContinuation();i.push(s=this.parseTemplateElement(e))}t.expressions=r;t.quasis=i;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;let a=false;let n=true;const o=this.startNode();o.properties=[];this.next();while(!this.match(e)){if(n){n=false}else{this.expect(12);if(this.match(e)){this.addTrailingCommaExtraToNode(o);break}}let r;if(t){r=this.parseBindingProperty()}else{r=this.parsePropertyDefinition(i);a=this.checkProto(r,s,a,i)}if(s&&!this.isObjectProperty(r)&&r.type!=="SpreadElement"){this.raise(p.InvalidRecordProperty,r)}{if(r.shorthand){this.addExtra(r,"shorthand",true)}}o.properties.push(r)}this.next();this.state.inFSharpPipelineDirectBody=r;let h="ObjectExpression";if(t){h="ObjectPattern"}else if(s){h="RecordExpression"}return this.finishNode(o,h)}addTrailingCommaExtraToNode(e){this.addExtra(e,"trailingComma",this.state.lastTokStartLoc.index);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(p.UnsupportedPropertyDecorator,this.state.startLoc)}while(this.match(26)){t.push(this.parseDecorator())}}const s=this.startNode();let i=false;let r=false;let a;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.startLoc}let n=this.eat(55);this.parsePropertyNamePrefixOperator(s);const o=this.state.containsEsc;this.parsePropertyName(s,e);if(!n&&!o&&this.maybeAsyncOrAccessorProp(s)){const{key:e}=s;const t=e.name;if(t==="async"&&!this.hasPrecedingLineBreak()){i=true;this.resetPreviousNodeTrailingComments(e);n=this.eat(55);this.parsePropertyName(s)}if(t==="get"||t==="set"){r=true;this.resetPreviousNodeTrailingComments(e);s.kind=t;if(this.match(55)){n=true;this.raise(p.AccessorIsGenerator,this.state.curPosition(),{kind:t});this.next()}this.parsePropertyName(s)}}return this.parseObjPropValue(s,a,n,i,false,r,e)}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"?p.BadGetterArity:p.BadSetterArity,e)}if(e.kind==="set"&&((t=i[i.length-1])==null?void 0:t.type)==="RestElement"){this.raise(p.BadSetterRestParameter,e)}}parseObjectMethod(e,t,s,i,r){if(r){const s=this.parseMethod(e,t,false,false,false,"ObjectMethod");this.checkGetterSetterParams(s);return s}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){e.shorthand=false;if(this.eat(14)){e.value=s?this.parseMaybeDefault(this.state.startLoc):this.parseMaybeAssignAllowInOrVoidPattern(8,i);return this.finishObjectProperty(e)}if(!e.computed&&e.key.type==="Identifier"){this.checkReservedWord(e.key.name,e.key.loc.start,true,false);if(s){e.value=this.parseMaybeDefault(t,this.cloneIdentifier(e.key))}else if(this.match(29)){const s=this.state.startLoc;if(i!=null){if(i.shorthandAssignLoc===null){i.shorthandAssignLoc=s}}else{this.raise(p.InvalidCoverInitializedName,s)}e.value=this.parseMaybeDefault(t,this.cloneIdentifier(e.key))}else{e.value=this.cloneIdentifier(e.key)}e.shorthand=true;return this.finishObjectProperty(e)}}finishObjectProperty(e){return this.finishNode(e,"ObjectProperty")}parseObjPropValue(e,t,s,i,r,a,n){const o=this.parseObjectMethod(e,s,i,r,a)||this.parseObjectProperty(e,t,r,n);if(!o)this.unexpected();return o}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 135:r=this.parseNumericLiteral(i);break;case 134:r=this.parseStringLiteral(i);break;case 136:r=this.parseBigIntLiteral(i);break;case 139:{const e=this.state.startLoc;if(t!=null){if(t.privateKeyLoc===null){t.privateKeyLoc=e}}else{this.raise(p.UnexpectedPrivateField,e)}r=this.parsePrivateName();break}default:if(s===137){r=this.parseDecimalLiteral(i);break}this.unexpected()}}e.key=r;if(s!==139){e.computed=false}}}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;this.scope.enter(514|16|(n?576:0)|(r?32:0));this.prodParam.enter(functionFlags(s,e.generator));this.parseFunctionParams(e,i);const o=this.parseFunctionBodyAndFinish(e,a,true);this.prodParam.exit();this.scope.exit();return o}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(514|4);let r=functionFlags(s,false);if(!this.match(5)&&this.prodParam.hasIn){r|=8}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);return 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()|4);e.body=this.parseBlock(true,false,(r=>{const a=!this.isSimpleParamList(e.params);if(r&&a){this.raise(p.IllegalLanguageModeDirective,(e.kind==="method"||e.kind==="constructor")&&!!e.key?e.key.loc.end:e)}const n=!i&&this.state.strict;this.checkParams(e,!this.state.strict&&!t&&!s&&!a,t,n);if(this.state.strict&&e.id){this.checkIdentifier(e.id,65,n)}}));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,a,5,r,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(e,t,s))}return r}parseExprListItem(e,t,s,i){let r;if(this.match(12)){if(!t){this.raise(p.UnexpectedToken,this.state.curPosition(),{unexpected:","})}r=null}else if(this.match(21)){const e=this.state.startLoc;r=this.parseParenItem(this.parseSpread(s),e)}else if(this.match(17)){this.expectPlugin("partialApplication");if(!i){this.raise(p.UnexpectedArgumentPlaceholder,this.state.startLoc)}const e=this.startNode();this.next();r=this.finishNode(e,"ArgumentPlaceholder")}else{r=this.parseMaybeAssignAllowInOrVoidPattern(e,s,this.parseParenItem)}return r}parseIdentifier(e){const t=this.startNode();const s=this.parseIdentifierName(e);return this.createIdentifier(t,s)}createIdentifier(e,t){e.name=t;e.loc.identifierName=t;return this.finishNode(e,"Identifier")}createIdentifierAt(e,t,s){e.name=t;e.loc.identifierName=t;return this.finishNodeAt(e,"Identifier",s)}parseIdentifierName(e){let t;const{startLoc:s,type:i}=this.state;if(tokenIsKeywordOrIdentifier(i)){t=this.state.value}else{this.unexpected()}const r=tokenKeywordOrIdentifierIsKeyword(i);if(e){if(r){this.replaceToken(132)}}else{this.checkReservedWord(t,s,r,false)}this.next();return t}checkReservedWord(e,t,s,i){if(e.length>10){return}if(!canBeReservedWord(e)){return}if(s&&isKeyword(e)){this.raise(p.UnexpectedKeyword,t,{keyword:e});return}const r=!this.state.strict?isReservedWord:i?isStrictBindReservedWord:isStrictReservedWord;if(r(e,this.inModule)){this.raise(p.UnexpectedReservedWord,t,{reservedWord:e});return}else if(e==="yield"){if(this.prodParam.hasYield){this.raise(p.YieldBindingIdentifier,t);return}}else if(e==="await"){if(this.prodParam.hasAwait){this.raise(p.AwaitBindingIdentifier,t);return}if(this.scope.inStaticBlock){this.raise(p.AwaitBindingIdentifierInStaticBlock,t);return}this.expressionScope.recordAsyncArrowParametersError(t)}else if(e==="arguments"){if(this.scope.inClassAndNotInNonArrowFunction){this.raise(p.ArgumentsInClass,t);return}}}recordAwaitIfAllowed(){const e=this.prodParam.hasAwait;if(e&&!this.scope.inFunction){this.state.hasTopLevelAwait=true}return e}parseAwait(e){const t=this.startNodeAt(e);this.expressionScope.recordParameterInitializerError(p.AwaitExpressionFormalParameter,t);if(this.eat(55)){this.raise(p.ObsoleteAwaitStar,t)}if(!this.scope.inFunction&&!(this.optionFlags&1)){if(this.isAmbiguousPrefixOrIdentifier()){this.ambiguousScriptDifferentAst=true}else{this.sawUnambiguousESM=true}}if(!this.state.soloAwait){t.argument=this.parseMaybeUnary(null,true)}return this.finishNode(t,"AwaitExpression")}isAmbiguousPrefixOrIdentifier(){if(this.hasPrecedingLineBreak())return true;const{type:e}=this.state;return e===53||e===10||e===0||tokenIsTemplate(e)||e===102&&!this.state.containsEsc||e===138||e===56||this.hasPlugin("v8intrinsic")&&e===54}parseYield(e){const t=this.startNodeAt(e);this.expressionScope.recordParameterInitializerError(p.YieldInParameter,t);let s=false;let i=null;if(!this.hasPrecedingLineBreak()){s=this.eat(55);switch(this.state.type){case 13:case 140:case 8:case 11:case 3:case 9:case 14:case 12:if(!s)break;default:i=this.parseMaybeAssign()}}t.delegate=s;t.argument=i;return this.finishNode(t,"YieldExpression")}parseImportCall(e){this.next();e.source=this.parseMaybeAssignAllowIn();e.options=null;if(this.eat(12)){if(!this.match(11)){e.options=this.parseMaybeAssignAllowIn();if(this.eat(12)){this.addTrailingCommaExtraToNode(e.options);if(!this.match(11)){do{this.parseMaybeAssignAllowIn()}while(this.eat(12)&&!this.match(11));this.raise(p.ImportCallArity,e)}}}else{this.addTrailingCommaExtraToNode(e.source)}}this.expect(11);return this.finishNode(e,"ImportExpression")}checkPipelineAtInfixOperator(e,t){if(this.hasPlugin(["pipelineOperator",{proposal:"smart"}])){if(e.type==="SequenceExpression"){this.raise(p.PipelineHeadSequenceExpression,t)}}}parseSmartPipelineBodyInStyle(e,t){if(this.isSimpleReference(e)){const s=this.startNodeAt(t);s.callee=e;return this.finishNode(s,"PipelineBareFunction")}else{const s=this.startNodeAt(t);this.checkSmartPipeTopicBodyEarlyErrors(t);s.expression=e;return this.finishNode(s,"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(p.PipelineBodyNoArrow,this.state.startLoc)}if(!this.topicReferenceWasUsedInCurrentContext()){this.raise(p.PipelineTopicUnused,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=8&~t;if(s){this.prodParam.enter(t|8);try{return e()}finally{this.prodParam.exit()}}return e()}disallowInAnd(e){const t=this.prodParam.currentFlags();const s=8&t;if(s){this.prodParam.enter(t&~8);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.startLoc;this.state.potentialArrowAt=this.state.start;const s=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=true;const i=this.parseExprOp(this.parseMaybeUnaryOrPrivate(),t,e);this.state.inFSharpPipelineDirectBody=s;return i}parseModuleExpression(){this.expectPlugin("moduleBlocks");const e=this.startNode();this.next();if(!this.match(5)){this.unexpected(null,5)}const t=this.startNodeAt(this.state.endLoc);this.next();const s=this.initializeScopes(true);this.enterInitialScopes();try{e.body=this.parseProgram(t,8,"module")}finally{s()}return this.finishNode(e,"ModuleExpression")}parseVoidPattern(e){this.expectPlugin("discardBinding");const t=this.startNode();if(e!=null){e.voidPatternLoc=this.state.startLoc}this.next();return this.finishNode(t,"VoidPattern")}parseMaybeAssignAllowInOrVoidPattern(e,t,s){if(t!=null&&this.match(88)){const s=this.lookaheadCharCode();if(s===44||s===(e===3?93:e===8?125:41)||s===61){return this.parseMaybeDefault(this.state.startLoc,this.parseVoidPattern(t))}}return this.parseMaybeAssignAllowIn(t,s)}parsePropertyNamePrefixOperator(e){}}const oe={kind:1},he={kind:2};const le=/[\uD800-\uDFFF]/u;const ce=/in(?:stanceof)?/y;function babel7CompatTokens(e,t,s){for(let i=0;i<e.length;i++){const r=e[i];const{type:a}=r;if(typeof a==="number"){{if(a===139){const{loc:t,start:s,value:a,end:n}=r;const o=s+1;const h=createPositionWithColumnOffset(t.start,1);e.splice(i,1,new Token({type:getExportedToken(27),value:"#",start:s,end:o,startLoc:t.start,endLoc:h}),new Token({type:getExportedToken(132),value:a,start:o,end:n,startLoc:h,endLoc:t.end}));i++;continue}if(tokenIsTemplate(a)){const{loc:n,start:o,value:h,end:l}=r;const c=o+1;const p=createPositionWithColumnOffset(n.start,1);let u;if(t.charCodeAt(o-s)===96){u=new Token({type:getExportedToken(22),value:"`",start:o,end:c,startLoc:n.start,endLoc:p})}else{u=new Token({type:getExportedToken(8),value:"}",start:o,end:c,startLoc:n.start,endLoc:p})}let d,f,m,y;if(a===24){f=l-1;m=createPositionWithColumnOffset(n.end,-1);d=h===null?null:h.slice(1,-1);y=new Token({type:getExportedToken(22),value:"`",start:f,end:l,startLoc:m,endLoc:n.end})}else{f=l-2;m=createPositionWithColumnOffset(n.end,-2);d=h===null?null:h.slice(1,-2);y=new Token({type:getExportedToken(23),value:"${",start:f,end:l,startLoc:m,endLoc:n.end})}e.splice(i,1,u,new Token({type:getExportedToken(20),value:d,start:c,end:f,startLoc:p,endLoc:m}),y);i+=2;continue}}r.type=getExportedToken(a)}}return e}class StatementParser extends ExpressionParser{parseTopLevel(e,t){e.program=this.parseProgram(t,140,this.options.sourceType==="module"?"module":"script");e.comments=this.comments;if(this.optionFlags&256){e.tokens=babel7CompatTokens(this.tokens,this.input,this.startIndex)}return this.finishNode(e,"File")}parseProgram(e,t,s){e.sourceType=s;e.interpreter=this.parseInterpreterDirective();this.parseBlockBody(e,true,true,t);if(this.inModule){if(!(this.optionFlags&64)&&this.scope.undefinedExports.size>0){for(const[e,t]of Array.from(this.scope.undefinedExports)){this.raise(p.ModuleExportUndefined,t,{localName:e})}}this.addExtra(e,"topLevelAwait",this.state.hasTopLevelAwait)}let i;if(t===140){i=this.finishNode(e,"Program")}else{i=this.finishNodeAt(e,"Program",createPositionWithColumnOffset(this.state.startLoc,-1))}return i}stmtToDirective(e){const t=this.castNodeTo(e,"Directive");const s=this.castNodeTo(e.expression,"DirectiveLiteral");const i=s.value;const r=this.input.slice(this.offsetToSourcePos(s.start),this.offsetToSourcePos(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);t.value=s;delete e.expression;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(){if(!this.isContextual(100)){return false}return this.hasFollowingBindingAtom()}isUsing(){if(!this.isContextual(107)){return false}const e=this.nextTokenInLineStart();const t=this.codePointAtPos(e);return this.chStartsBindingIdentifier(t,e)}isForUsing(){if(!this.isContextual(107)){return false}const e=this.nextTokenInLineStart();const t=this.codePointAtPos(e);if(this.isUnparsedContextual(e,"of")){const t=this.lookaheadCharCodeSince(e+2);if(t!==61&&t!==58&&t!==59){return false}}if(this.chStartsBindingIdentifier(t,e)||this.isUnparsedContextual(e,"void")){return true}return false}isAwaitUsing(){if(!this.isContextual(96)){return false}let e=this.nextTokenInLineStart();if(this.isUnparsedContextual(e,"using")){e=this.nextTokenInLineStartSince(e+5);const t=this.codePointAtPos(e);if(this.chStartsBindingIdentifier(t,e)){return true}}return false}chStartsBindingIdentifier(e,t){if(isIdentifierStart(e)){ce.lastIndex=t;if(ce.test(this.input)){const e=this.codePointAtPos(ce.lastIndex);if(!isIdentifierChar(e)&&e!==92){return false}}return true}else if(e===92){return true}else{return false}}chStartsBindingPattern(e){return e===91||e===123}hasFollowingBindingAtom(){const e=this.nextTokenStart();const t=this.codePointAtPos(e);return this.chStartsBindingPattern(t)||this.chStartsBindingIdentifier(t,e)}hasInLineFollowingBindingIdentifierOrBrace(){const e=this.nextTokenInLineStart();const t=this.codePointAtPos(e);return t===123||this.chStartsBindingIdentifier(t,e)}allowsUsing(){return(this.scope.inModule||!this.scope.inTopLevel)&&!this.scope.inBareCaseStatement}parseModuleItem(){return this.parseStatementLike(1|2|4|8)}parseStatementListItem(){return this.parseStatementLike(2|4|(!this.options.annexB||this.state.strict?0:8))}parseStatementOrSloppyAnnexBFunctionDeclaration(e=false){let t=0;if(this.options.annexB&&!this.state.strict){t|=4;if(e){t|=8}}return this.parseStatementLike(t)}parseStatement(){return this.parseStatementLike(0)}parseStatementLike(e){let t=null;if(this.match(26)){t=this.parseDecorators(true)}return this.parseStatementContent(e,t)}parseStatementContent(e,t){const s=this.state.type;const i=this.startNode();const r=!!(e&2);const a=!!(e&4);const n=e&1;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.parseDoWhileStatement(i);case 91:return this.parseForStatement(i);case 68:if(this.lookaheadCharCode()===46)break;if(!a){this.raise(this.state.strict?p.StrictFunction:this.options.annexB?p.SloppyFunctionAnnexB:p.SloppyFunction,this.state.startLoc)}return this.parseFunctionStatement(i,false,!r&&a);case 80:if(!r)this.unexpected();return this.parseClass(this.maybeTakeDecorators(t,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 96:if(this.isAwaitUsing()){if(!this.allowsUsing()){this.raise(p.UnexpectedUsingDeclaration,i)}else if(!r){this.raise(p.UnexpectedLexicalDeclaration,i)}else if(!this.recordAwaitIfAllowed()){this.raise(p.AwaitUsingNotInAsyncContext,i)}this.next();return this.parseVarStatement(i,"await using")}break;case 107:if(this.state.containsEsc||!this.hasInLineFollowingBindingIdentifierOrBrace()){break}if(!this.allowsUsing()){this.raise(p.UnexpectedUsingDeclaration,this.state.startLoc)}else if(!r){this.raise(p.UnexpectedLexicalDeclaration,this.state.startLoc)}return this.parseVarStatement(i,"using");case 100:{if(this.state.containsEsc){break}const e=this.nextTokenStart();const t=this.codePointAtPos(e);if(t!==91){if(!r&&this.hasFollowingLineBreak())break;if(!this.chStartsBindingIdentifier(t,e)&&t!==123){break}}}case 75:{if(!r){this.raise(p.UnexpectedLexicalDeclaration,this.state.startLoc)}}case 74:{const e=this.state.value;return this.parseVarStatement(i,e)}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.optionFlags&8)&&!n){this.raise(p.UnexpectedImportExport,this.state.startLoc)}this.next();let e;if(s===83){e=this.parseImport(i)}else{e=this.parseExport(i,t)}this.assertModuleNodeAllowed(e);return e}default:{if(this.isAsyncFunction()){if(!r){this.raise(p.AsyncFunctionInSingleStatementContext,this.state.startLoc)}this.next();return this.parseFunctionStatement(i,true,!r&&a)}}}const o=this.state.value;const h=this.parseExpression();if(tokenIsIdentifier(s)&&h.type==="Identifier"&&this.eat(14)){return this.parseLabeledStatement(i,o,h,e)}else{return this.parseExpressionStatement(i,h,t)}}assertModuleNodeAllowed(e){if(!(this.optionFlags&8)&&!this.inModule){this.raise(p.ImportOutsideModule,e)}}decoratorsEnabledBeforeExport(){if(this.hasPlugin("decorators-legacy"))return true;return this.hasPlugin("decorators")&&this.getPluginOption("decorators","decoratorsBeforeExport")!==false}maybeTakeDecorators(e,t,s){if(e){var i;if((i=t.decorators)!=null&&i.length){if(typeof this.getPluginOption("decorators","decoratorsBeforeExport")!=="boolean"){this.raise(p.DecoratorsBeforeAfterExport,t.decorators[0])}t.decorators.unshift(...e)}else{t.decorators=e}this.resetStartLocationFromNode(t,e[0]);if(s)this.resetStartLocationFromNode(s,t)}return t}canHaveLeadingDecorator(){return this.match(80)}parseDecorators(e){const t=[];do{t.push(this.parseDecorator())}while(this.match(26));if(this.match(82)){if(!e){this.unexpected()}if(!this.decoratorsEnabledBeforeExport()){this.raise(p.DecoratorExportClass,this.state.startLoc)}}else if(!this.canHaveLeadingDecorator()){throw this.raise(p.UnexpectedLeadingDecorator,this.state.startLoc)}return t}parseDecorator(){this.expectOnePlugin(["decorators","decorators-legacy"]);const e=this.startNode();this.next();if(this.hasPlugin("decorators")){const t=this.state.startLoc;let s;if(this.match(10)){const t=this.state.startLoc;this.next();s=this.parseExpression();this.expect(11);s=this.wrapParenthesis(t,s);const i=this.state.startLoc;e.expression=this.parseMaybeDecoratorArguments(s,t);if(this.getPluginOption("decorators","allowCallParenthesized")===false&&e.expression!==s){this.raise(p.DecoratorArgumentsOutsideParentheses,i)}}else{s=this.parseIdentifier(false);while(this.eat(16)){const e=this.startNodeAt(t);e.object=s;if(this.match(139)){this.classScope.usePrivateName(this.state.value,this.state.startLoc);e.property=this.parsePrivateName()}else{e.property=this.parseIdentifier(true)}e.computed=false;s=this.finishNode(e,"MemberExpression")}e.expression=this.parseMaybeDecoratorArguments(s,t)}}else{e.expression=this.parseExprSubscripts()}return this.finishNode(e,"Decorator")}parseMaybeDecoratorArguments(e,t){if(this.eat(10)){const s=this.startNodeAt(t);s.callee=e;s.arguments=this.parseCallExpressionArguments();this.toReferencedList(s.arguments);return this.finishNode(s,"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===1)){break}if(e.label&&t)break}}if(s===this.state.labels.length){const s=t?"BreakStatement":"ContinueStatement";this.raise(p.IllegalBreakContinue,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}parseDoWhileStatement(e){this.next();this.state.labels.push(oe);e.body=this.withSmartMixTopicForbiddingContext((()=>this.parseStatement()));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(oe);let t=null;if(this.isContextual(96)&&this.recordAwaitIfAllowed()){t=this.state.startLoc;this.next()}this.scope.enter(0);this.expect(10);if(this.match(13)){if(t!==null){this.unexpected(t)}return this.parseFor(e,null)}const s=this.isContextual(100);{const i=this.isAwaitUsing();const r=i||this.isForUsing();const a=s&&this.hasFollowingBindingAtom()||r;if(this.match(74)||this.match(75)||a){const s=this.startNode();let a;if(i){a="await using";if(!this.recordAwaitIfAllowed()){this.raise(p.AwaitUsingNotInAsyncContext,this.state.startLoc)}this.next()}else{a=this.state.value}this.next();this.parseVar(s,true,a);const n=this.finishNode(s,"VariableDeclaration");const o=this.match(58);if(o&&r){this.raise(p.ForInUsing,n)}if((o||this.isContextual(102))&&n.declarations.length===1){return this.parseForIn(e,n,t)}if(t!==null){this.unexpected(t)}return this.parseFor(e,n)}}const i=this.isContextual(95);const r=new ExpressionErrors;const a=this.parseExpression(true,r);const n=this.isContextual(102);if(n){if(s){this.raise(p.ForOfLet,a)}if(t===null&&i&&a.type==="Identifier"){this.raise(p.ForOfAsync,a)}}if(n||this.match(58)){this.checkDestructuringPrivate(r);this.toAssignable(a,true);const s=n?"ForOfStatement":"ForInStatement";this.checkLVal(a,{type:s});return this.parseForIn(e,a,t)}else{this.checkExpressionErrors(r,true)}if(t!==null){this.unexpected(t)}return this.parseFor(e,a)}parseFunctionStatement(e,t,s){this.next();return this.parseFunction(e,1|(s?2:0)|(t?8:0))}parseIfStatement(e){this.next();e.test=this.parseHeaderExpression();e.consequent=this.parseStatementOrSloppyAnnexBFunctionDeclaration();e.alternate=this.eat(66)?this.parseStatementOrSloppyAnnexBFunctionDeclaration():null;return this.finishNode(e,"IfStatement")}parseReturnStatement(e){if(!this.prodParam.hasReturn){this.raise(p.IllegalReturn,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(he);this.scope.enter(256);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(p.MultipleDefaultsInSwitch,this.state.lastTokStartLoc)}e=true;s.test=null}this.expect(14)}else{if(s){s.consequent.push(this.parseStatementListItem())}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(p.NewlineAfterThrow,this.state.lastTokEndLoc)}e.argument=this.parseExpression();this.semicolon();return this.finishNode(e,"ThrowStatement")}parseCatchClauseParam(){const e=this.parseBindingAtom();this.scope.enter(this.options.annexB&&e.type==="Identifier"?8:0);this.checkLVal(e,{type:"CatchClause"},9);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(0)}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(p.NoCatchOrFinally,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(oe);e.body=this.withSmartMixTopicForbiddingContext((()=>this.parseStatement()));this.state.labels.pop();return this.finishNode(e,"WhileStatement")}parseWithStatement(e){if(this.state.strict){this.raise(p.StrictWith,this.state.startLoc)}this.next();e.object=this.parseHeaderExpression();e.body=this.withSmartMixTopicForbiddingContext((()=>this.parseStatement()));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(p.LabelRedeclaration,s,{labelName:t})}}const r=tokenIsLoop(this.state.type)?1:this.match(71)?2: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.sourceToOffsetPos(this.state.start);s.kind=r}else{break}}this.state.labels.push({name:t,kind:r,statementStart:this.sourceToOffsetPos(this.state.start)});e.body=i&8?this.parseStatementOrSloppyAnnexBFunctionDeclaration(true):this.parseStatement();this.state.labels.pop();e.label=s;return this.finishNode(e,"LabeledStatement")}parseExpressionStatement(e,t,s){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(0)}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=s?this.parseModuleItem():this.parseStatementListItem();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)}r==null||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()));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.options.annexB||this.state.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")){this.raise(p.ForInOfLoopInitializer,t,{type:i?"ForInStatement":"ForOfStatement"})}if(t.type==="AssignmentPattern"){this.raise(p.InvalidLhs,t,{ancestor:{type:"ForStatement"}})}e.left=t;e.right=i?this.parseExpression():this.parseMaybeAssignAllowIn();this.expect(11);e.body=this.withSmartMixTopicForbiddingContext((()=>this.parseStatement()));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(102)))){this.raise(p.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:"destructuring"})}else if((s==="const"||s==="using"||s==="await using")&&!(this.match(58)||this.isContextual(102))){this.raise(p.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:s})}}r.push(this.finishNode(e,"VariableDeclarator"));if(!this.eat(12))break}return e}parseVarId(e,t){const s=this.parseBindingAtom();if(t==="using"||t==="await using"){if(s.type==="ArrayPattern"||s.type==="ObjectPattern"){this.raise(p.UsingDeclarationHasBindingPattern,s.loc.start)}}else{if(s.type==="VoidPattern"){this.raise(p.UnexpectedVoidPattern,s.loc.start)}}this.checkLVal(s,{type:"VariableDeclarator"},t==="var"?5:8201);e.id=s}parseAsyncFunctionExpression(e){return this.parseFunction(e,8)}parseFunction(e,t=0){const s=t&2;const i=!!(t&1);const r=i&&!(t&4);const a=!!(t&8);this.initFunction(e,a);if(this.match(55)){if(s){this.raise(p.GeneratorInSingleStatementContext,this.state.startLoc)}this.next();e.generator=true}if(i){e.id=this.parseFunctionId(r)}const n=this.state.maybeInArrowParameters;this.state.maybeInArrowParameters=false;this.scope.enter(514);this.prodParam.enter(functionFlags(a,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&&!s){this.registerFunctionStatementId(e)}this.state.maybeInArrowParameters=n;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,2|(t?4:0));this.expressionScope.exit()}registerFunctionStatementId(e){if(!e.id)return;this.scope.declareName(e.id.name,!this.options.annexB||this.state.strict||e.generator||e.async?this.scope.treatFunctionsAsVar?5:8201:17,e.id.loc.start)}parseClass(e,t,s){this.next();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)}nameIsConstructor(e){return e.type==="Identifier"&&e.name==="constructor"||e.type==="StringLiteral"&&e.value==="constructor"}isNonstaticConstructor(e){return!e.computed&&!e.static&&this.nameIsConstructor(e.key)}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(p.DecoratorSemicolon,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(p.DecoratorConstructor,e)}}}));this.state.strict=t;this.next();if(i.length){throw this.raise(p.TrailingDecorator,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(106);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 n=t;const o=t;const h=t;const l=r;const c=r;t.static=i;this.parsePropertyNamePrefixOperator(t);if(this.eat(55)){l.kind="method";const t=this.match(139);this.parseClassElementName(l);this.parsePostMemberNameModifiers(l);if(t){this.pushClassPrivateMethod(e,a,true,false);return}if(this.isNonstaticConstructor(r)){this.raise(p.ConstructorIsGenerator,r.key)}this.pushClassMethod(e,r,true,false,false,false);return}const u=!this.state.containsEsc&&tokenIsIdentifier(this.state.type);const d=this.parseClassElementName(t);const f=u?d.name:null;const m=this.isPrivateName(d);const y=this.state.startLoc;this.parsePostMemberNameModifiers(c);if(this.isClassMethod()){l.kind="method";if(m){this.pushClassPrivateMethod(e,a,false,false);return}const i=this.isNonstaticConstructor(r);let n=false;if(i){r.kind="constructor";if(s.hadConstructor&&!this.hasPlugin("typescript")){this.raise(p.DuplicateConstructor,d)}if(i&&this.hasPlugin("typescript")&&t.override){this.raise(p.OverrideOnConstructor,d)}s.hadConstructor=true;n=s.hadSuperClass}this.pushClassMethod(e,r,false,false,i,n)}else if(this.isClassProperty()){if(m){this.pushClassPrivateProperty(e,o)}else{this.pushClassProperty(e,n)}}else if(f==="async"&&!this.isLineTerminator()){this.resetPreviousNodeTrailingComments(d);const t=this.eat(55);if(c.optional){this.unexpected(y)}l.kind="method";const s=this.match(139);this.parseClassElementName(l);this.parsePostMemberNameModifiers(c);if(s){this.pushClassPrivateMethod(e,a,t,true)}else{if(this.isNonstaticConstructor(r)){this.raise(p.ConstructorIsAsync,r.key)}this.pushClassMethod(e,r,t,true,false,false)}}else if((f==="get"||f==="set")&&!(this.match(55)&&this.isLineTerminator())){this.resetPreviousNodeTrailingComments(d);l.kind=f;const t=this.match(139);this.parseClassElementName(r);if(t){this.pushClassPrivateMethod(e,a,false,false)}else{if(this.isNonstaticConstructor(r)){this.raise(p.ConstructorIsAccessor,r.key)}this.pushClassMethod(e,r,false,false,false,false)}this.checkGetterSetterParams(r)}else if(f==="accessor"&&!this.isLineTerminator()){this.expectPlugin("decoratorAutoAccessors");this.resetPreviousNodeTrailingComments(d);const t=this.match(139);this.parseClassElementName(n);this.pushClassAccessorProperty(e,h,t)}else if(this.isLineTerminator()){if(m){this.pushClassPrivateProperty(e,o)}else{this.pushClassProperty(e,n)}}else{this.unexpected()}}parseClassElementName(e){const{type:t,value:s}=this.state;if((t===132||t===134)&&e.static&&s==="prototype"){this.raise(p.StaticPrototype,this.state.startLoc)}if(t===139){if(s==="constructor"){this.raise(p.ConstructorClassPrivateField,this.state.startLoc)}const t=this.parsePrivateName();e.key=t;return t}this.parsePropertyName(e);return e.key}parseClassStaticBlock(e,t){var s;this.scope.enter(576|128|16);const i=this.state.labels;this.state.labels=[];this.prodParam.enter(0);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(p.DecoratorStaticBlock,t)}}pushClassProperty(e,t){if(!t.computed&&this.nameIsConstructor(t.key)){this.raise(p.ConstructorClassField,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),0,s.key.loc.start)}pushClassAccessorProperty(e,t,s){if(!s&&!t.computed&&this.nameIsConstructor(t.key)){this.raise(p.ConstructorClassField,t.key)}const i=this.parseClassAccessorProperty(t);e.body.push(i);if(s){this.classScope.declarePrivateName(this.getPrivateNameSV(i.key),0,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?6:2:r.kind==="set"?r.static?5:1:0;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(576|16);this.expressionScope.enter(newExpressionScope());this.prodParam.enter(0);e.value=this.eat(29)?this.parseMaybeAssignAllowIn():null;this.expressionScope.exit();this.prodParam.exit();this.scope.exit()}parseClassId(e,t,s,i=8331){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(p.MissingClassName,this.state.startLoc)}}}parseClassSuper(e){e.superClass=this.eat(81)?this.parseExprSubscripts():null}parseExport(e,t){const s=this.parseMaybeImportPhase(e,true);const i=this.maybeParseExportDefaultSpecifier(e,s);const r=!i||this.eat(12);const a=r&&this.eatExportStar(e);const n=a&&this.maybeParseExportNamespaceSpecifier(e);const o=r&&(!n||this.eat(12));const h=i||a;if(a&&!n){if(i)this.unexpected();if(t){throw this.raise(p.UnsupportedDecoratorExport,e)}this.parseExportFrom(e,true);this.sawUnambiguousESM=true;return this.finishNode(e,"ExportAllDeclaration")}const l=this.maybeParseExportNamedSpecifiers(e);if(i&&r&&!a&&!l){this.unexpected(null,5)}if(n&&o){this.unexpected(null,98)}let c;if(h||l){c=false;if(t){throw this.raise(p.UnsupportedDecoratorExport,e)}this.parseExportFrom(e,h)}else{c=this.maybeParseExportDeclaration(e)}if(h||l||c){var u;const s=e;this.checkExport(s,true,false,!!s.source);if(((u=s.declaration)==null?void 0:u.type)==="ClassDeclaration"){this.maybeTakeDecorators(t,s.declaration,s)}else if(t){throw this.raise(p.UnsupportedDecoratorExport,e)}this.sawUnambiguousESM=true;return this.finishNode(s,"ExportNamedDeclaration")}if(this.eat(65)){const s=e;const i=this.parseExportDefaultExpression();s.declaration=i;if(i.type==="ClassDeclaration"){this.maybeTakeDecorators(t,i,s)}else if(t){throw this.raise(p.UnsupportedDecoratorExport,e)}this.checkExport(s,true,true);this.sawUnambiguousESM=true;return this.finishNode(s,"ExportDefaultDeclaration")}this.unexpected(null,5)}eatExportStar(e){return this.eat(55)}maybeParseExportDefaultSpecifier(e,t){if(t||this.isExportDefaultSpecifier()){this.expectPlugin("exportDefaultFrom",t==null?void 0:t.loc.start);const s=t||this.parseIdentifier(true);const i=this.startNodeAtNode(s);i.exported=s;e.specifiers=[this.finishNode(i,"ExportDefaultSpecifier")];return true}return false}maybeParseExportNamespaceSpecifier(e){if(this.isContextual(93)){var t,s;(s=(t=e).specifiers)!=null?s:t.specifiers=[];const i=this.startNodeAt(this.state.lastTokStartLoc);this.next();i.exported=this.parseModuleExportName();e.specifiers.push(this.finishNode(i,"ExportNamespaceSpecifier"));return true}return false}maybeParseExportNamedSpecifiers(e){if(this.match(5)){const t=e;if(!t.specifiers)t.specifiers=[];const s=t.exportKind==="type";t.specifiers.push(...this.parseExportSpecifiers(s));t.source=null;if(this.hasPlugin("importAssertions")){t.assertions=[]}else{t.attributes=[]}t.declaration=null;return true}return false}maybeParseExportDeclaration(e){if(this.shouldParseExportDeclaration()){e.specifiers=[];e.source=null;if(this.hasPlugin("importAssertions")){e.assertions=[]}else{e.attributes=[]}e.declaration=this.parseExportDeclaration(e);return true}return false}isAsyncFunction(){if(!this.isContextual(95))return false;const e=this.nextTokenInLineStart();return this.isUnparsedContextual(e,"function")}parseExportDefaultExpression(){const e=this.startNode();if(this.match(68)){this.next();return this.parseFunction(e,1|4)}else if(this.isAsyncFunction()){this.next();this.next();return this.parseFunction(e,1|4|8)}if(this.match(80)){return this.parseClass(e,true,true)}if(this.match(26)){if(this.hasPlugin("decorators")&&this.getPluginOption("decorators","decoratorsBeforeExport")===true){this.raise(p.DecoratorBeforeExport,this.state.startLoc)}return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(false),this.startNode()),true,true)}if(this.match(75)||this.match(74)||this.isLet()||this.isUsing()||this.isAwaitUsing()){throw this.raise(p.UnsupportedDefaultExport,this.state.startLoc)}const t=this.parseMaybeAssignAllowIn();this.semicolon();return t}parseExportDeclaration(e){if(this.match(80)){const e=this.parseClass(this.startNode(),true,false);return e}return this.parseStatementListItem()}isExportDefaultSpecifier(){const{type:e}=this.state;if(tokenIsIdentifier(e)){if(e===95&&!this.state.containsEsc||e===100){return false}if((e===130||e===129)&&!this.state.containsEsc){const e=this.nextTokenStart();const t=this.input.charCodeAt(e);if(t===123||this.chStartsBindingIdentifier(t,e)&&!this.input.startsWith("from",e)){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(98)){e.source=this.parseImportSource();this.checkExport(e);this.maybeParseImportAttributes(e);this.checkJSONModuleImport(e)}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")===true){this.raise(p.DecoratorBeforeExport,this.state.startLoc)}return true}}if(this.isUsing()){this.raise(p.UsingDeclarationExport,this.state.startLoc);return true}if(this.isAwaitUsing()){this.raise(p.UsingDeclarationExport,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){var r;if(s){this.checkDuplicateExports(e,"default");if(this.hasPlugin("exportDefaultFrom")){var a;const t=e.declaration;if(t.type==="Identifier"&&t.name==="from"&&t.end-t.start===4&&!((a=t.extra)!=null&&a.parenthesized)){this.raise(p.ExportDefaultFromAsIdentifier,t)}}}else if((r=e.specifiers)!=null&&r.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(p.ExportBindingIsString,t,{localName:e.value,exportName:s})}else{this.checkReservedWord(e.name,e.loc.start,true,false);this.scope.checkLocalExport(e)}}}}else if(e.declaration){const t=e.declaration;if(t.type==="FunctionDeclaration"||t.type==="ClassDeclaration"){const{id:s}=t;if(!s)throw new Error("Assertion failure");this.checkDuplicateExports(e,s.name)}else if(t.type==="VariableDeclaration"){for(const e of t.declarations){this.checkDeclaration(e.id)}}}}}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(p.DuplicateDefaultExport,e)}else{this.raise(p.DuplicateExport,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(130);const r=this.match(134);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=this.cloneStringLiteral(e.local)}else if(!e.exported){e.exported=this.cloneIdentifier(e.local)}return this.finishNode(e,"ExportSpecifier")}parseModuleExportName(){if(this.match(134)){const e=this.parseStringLiteral(this.state.value);const t=le.exec(e.value);if(t){this.raise(p.ModuleExportNameHasLoneSurrogate,e,{surrogateCharCode:t[0].charCodeAt(0)})}return e}return this.parseIdentifier(true)}isJSONModuleImport(e){if(e.assertions!=null){return e.assertions.some((({key:e,value:t})=>t.value==="json"&&(e.type==="Identifier"?e.name==="type":e.value==="type")))}return false}checkImportReflection(e){const{specifiers:t}=e;const s=t.length===1?t[0].type:null;if(e.phase==="source"){if(s!=="ImportDefaultSpecifier"){this.raise(p.SourcePhaseImportRequiresDefault,t[0].loc.start)}}else if(e.phase==="defer"){if(s!=="ImportNamespaceSpecifier"){this.raise(p.DeferImportRequiresNamespace,t[0].loc.start)}}else if(e.module){var i;if(s!=="ImportDefaultSpecifier"){this.raise(p.ImportReflectionNotBinding,t[0].loc.start)}if(((i=e.assertions)==null?void 0:i.length)>0){this.raise(p.ImportReflectionHasAssertion,t[0].loc.start)}}}checkJSONModuleImport(e){if(this.isJSONModuleImport(e)&&e.type!=="ExportAllDeclaration"){const{specifiers:t}=e;if(t!=null){const e=t.find((e=>{let t;if(e.type==="ExportSpecifier"){t=e.local}else if(e.type==="ImportSpecifier"){t=e.imported}if(t!==undefined){return t.type==="Identifier"?t.name!=="default":t.value!=="default"}}));if(e!==undefined){this.raise(p.ImportJSONBindingNotDefault,e.loc.start)}}}}isPotentialImportPhase(e){if(e)return false;return this.isContextual(105)||this.isContextual(97)||this.isContextual(127)}applyImportPhase(e,t,s,i){if(t){return}if(s==="module"){this.expectPlugin("importReflection",i);e.module=true}else if(this.hasPlugin("importReflection")){e.module=false}if(s==="source"){this.expectPlugin("sourcePhaseImports",i);e.phase="source"}else if(s==="defer"){this.expectPlugin("deferredImportEvaluation",i);e.phase="defer"}else if(this.hasPlugin("sourcePhaseImports")){e.phase=null}}parseMaybeImportPhase(e,t){if(!this.isPotentialImportPhase(t)){this.applyImportPhase(e,t,null);return null}const s=this.startNode();const i=this.parseIdentifierName(true);const{type:r}=this.state;const a=tokenIsKeywordOrIdentifier(r)?r!==98||this.lookaheadCharCode()===102:r!==12;if(a){this.applyImportPhase(e,t,i,s.loc.start);return null}else{this.applyImportPhase(e,t,null);return this.createIdentifier(s,i)}}isPrecedingIdImportPhase(e){const{type:t}=this.state;return tokenIsIdentifier(t)?t!==98||this.lookaheadCharCode()===102:t!==12}parseImport(e){if(this.match(134)){return this.parseImportSourceAndAttributes(e)}return this.parseImportSpecifiersAndAfter(e,this.parseMaybeImportPhase(e,false))}parseImportSpecifiersAndAfter(e,t){e.specifiers=[];const s=this.maybeParseDefaultImportSpecifier(e,t);const i=!s||this.eat(12);const r=i&&this.maybeParseStarImportSpecifier(e);if(i&&!r)this.parseNamedImportSpecifiers(e);this.expectContextual(98);return this.parseImportSourceAndAttributes(e)}parseImportSourceAndAttributes(e){var t;(t=e.specifiers)!=null?t:e.specifiers=[];e.source=this.parseImportSource();this.maybeParseImportAttributes(e);this.checkImportReflection(e);this.checkJSONModuleImport(e);this.semicolon();this.sawUnambiguousESM=true;return this.finishNode(e,"ImportDeclaration")}parseImportSource(){if(!this.match(134))this.unexpected();return this.parseExprAtom()}parseImportSpecifierLocal(e,t,s){t.local=this.parseIdentifier();e.specifiers.push(this.finishImportSpecifier(t,s))}finishImportSpecifier(e,t,s=8201){this.checkLVal(e.local,{type:t},s);return this.finishNode(e,t)}parseImportAttributes(){this.expect(5);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(p.ModuleAttributesWithDuplicateKeys,this.state.startLoc,{key:i})}t.add(i);if(this.match(134)){s.key=this.parseStringLiteral(i)}else{s.key=this.parseIdentifier(true)}this.expect(14);if(!this.match(134)){throw this.raise(p.ModuleAttributeInvalidValue,this.state.startLoc)}s.value=this.parseStringLiteral(this.state.value);e.push(this.finishNode(s,"ImportAttribute"))}while(this.eat(12));this.expect(8);return e}parseModuleAttributes(){const e=[];const t=new Set;do{const s=this.startNode();s.key=this.parseIdentifier(true);if(s.key.name!=="type"){this.raise(p.ModuleAttributeDifferentFromType,s.key)}if(t.has(s.key.name)){this.raise(p.ModuleAttributesWithDuplicateKeys,s.key,{key:s.key.name})}t.add(s.key.name);this.expect(14);if(!this.match(134)){throw this.raise(p.ModuleAttributeInvalidValue,this.state.startLoc)}s.value=this.parseStringLiteral(this.state.value);e.push(this.finishNode(s,"ImportAttribute"))}while(this.eat(12));return e}maybeParseImportAttributes(e){let t;{var s=false}if(this.match(76)){if(this.hasPrecedingLineBreak()&&this.lookaheadCharCode()===40){return}this.next();if(this.hasPlugin("moduleAttributes")){t=this.parseModuleAttributes();this.addExtra(e,"deprecatedWithLegacySyntax",true)}else{t=this.parseImportAttributes()}{s=true}}else if(this.isContextual(94)&&!this.hasPrecedingLineBreak()){if(!this.hasPlugin("deprecatedImportAssert")&&!this.hasPlugin("importAssertions")){this.raise(p.ImportAttributesUseAssert,this.state.startLoc)}if(!this.hasPlugin("importAssertions")){this.addExtra(e,"deprecatedAssertSyntax",true)}this.next();t=this.parseImportAttributes()}else{t=[]}if(!s&&this.hasPlugin("importAssertions")){e.assertions=t}else{e.attributes=t}}maybeParseDefaultImportSpecifier(e,t){if(t){const s=this.startNodeAtNode(t);s.local=t;e.specifiers.push(this.finishImportSpecifier(s,"ImportDefaultSpecifier"));return true}else if(tokenIsKeywordOrIdentifier(this.state.type)){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(p.DestructureNamedImport,this.state.startLoc)}this.expect(12);if(this.eat(8))break}const s=this.startNode();const i=this.match(134);const r=this.isContextual(130);s.imported=this.parseModuleExportName();const a=this.parseImportSpecifier(s,i,e.importKind==="type"||e.importKind==="typeof",r,undefined);e.specifiers.push(a)}}parseImportSpecifier(e,t,s,i,r){if(this.eatContextual(93)){e.local=this.parseIdentifier()}else{const{imported:s}=e;if(t){throw this.raise(p.ImportBindingIsString,e,{importName:s.value})}this.checkReservedWord(s.name,e.loc.start,true,true);if(!e.local){e.local=this.cloneIdentifier(s)}}return this.finishImportSpecifier(e,"ImportSpecifier",r)}isThisParam(e){return e.type==="Identifier"&&e.name==="this"}}class Parser extends StatementParser{constructor(e,t,s){e=getOptions(e);super(e,t);this.options=e;this.initializeScopes();this.plugins=s;this.filename=e.sourceFilename;this.startIndex=e.startIndex;let i=0;if(e.allowAwaitOutsideFunction){i|=1}if(e.allowReturnOutsideFunction){i|=2}if(e.allowImportExportEverywhere){i|=8}if(e.allowSuperOutsideMethod){i|=16}if(e.allowUndeclaredExports){i|=64}if(e.allowNewTargetOutsideFunction){i|=4}if(e.allowYieldOutsideFunction){i|=32}if(e.ranges){i|=128}if(e.tokens){i|=256}if(e.createImportExpressions){i|=512}if(e.createParenthesizedExpressions){i|=1024}if(e.errorRecovery){i|=2048}if(e.attachComment){i|=4096}if(e.annexB){i|=8192}this.optionFlags=i}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;e.comments.length=this.state.commentsLen;return e}}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 pe=generateExportedTokenTypes(k);function getParser(e,t){let s=Parser;const i=new Map;if(e!=null&&e.plugins){for(const t of e.plugins){let e,s;if(typeof t==="string"){e=t}else{[e,s]=t}if(!i.has(e)){i.set(e,s||{})}}validatePlugins(i);s=getParserClass(i)}return new s(e,t,i)}const ue=new Map;function getParserClass(e){const t=[];for(const s of ne){if(e.has(s)){t.push(s)}}const s=t.join("|");let i=ue.get(s);if(!i){i=Parser;for(const e of t){i=ae[e](i)}ue.set(s,i)}return i}t.parse=parse;t.parseExpression=parseExpression;t.tokTypes=pe}();module.exports=e})();
|