@meiti/healer 0.4.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/reglas.mjs ADDED
@@ -0,0 +1,17 @@
1
+ // healer-reglas fuente:e6704ca87654d10c — generado por scripts/empaquetar-integraciones.mjs desde src/chequeos. No editar a mano.
2
+ import gt from"node:fs";import V from"node:path";var We=new Set([".js",".mjs",".cjs",".jsx",".ts",".tsx",".mts",".cts"]),Xe=new Set(["node_modules",".git","dist","build","out","coverage",".next",".nuxt",".svelte-kit","vendor",".venv","venv","__pycache__",".cache",".turbo","public"]),Je=2e6,Ge=4e7,Ye=4e3;function ie(n,s){let t=[],e=0,i=0,r=a=>{let o;try{o=gt.readdirSync(a,{withFileTypes:!0})}catch{return}for(let h of o){if(h.isSymbolicLink())continue;let l=V.join(a,h.name);if(h.isDirectory()){!Xe.has(h.name)&&!h.name.startsWith(".")&&r(l);continue}if(s&&!s(V.relative(n,l).split(V.sep).join("/"))||!We.has(V.extname(h.name))||/\.min\.(c|m)?js$/.test(h.name)||h.name.endsWith(".d.ts"))continue;let p=0;try{p=gt.statSync(l).size}catch{continue}if(p>Je||e+p>Ge||t.length>=Ye){i++;continue}let u;try{u=gt.readFileSync(l,"utf8")}catch{continue}/^\/\/[^\n]*(generado por|generated by|@generated)/i.test(u)||u.length>2e4&&u.length/(u.split(`
3
+ `).length||1)>1e3||(t.push({ruta:V.relative(n,l).split(V.sep).join("/"),texto:u}),e+=p)}};return r(n),{archivos:t,omitidos:i}}var L=(n,s)=>n.slice(0,s).split(`
4
+ `).length;var Ze=/\[\s*((?:(['"])[A-Za-z0-9_./:@-]{1,40}\2\s*,\s*){2,}(['"])[A-Za-z0-9_./:@-]{1,40}\3)\s*,?\s*\]/g,Qe=/(['"])([A-Za-z0-9_./:@-]{1,40})\1/g,re={id:"lists-out-of-sync",titulo:"Two hand-written lists that are almost the same: one of them probably fell behind",origen:"Healer y MEITI 2026-11-26: Cerebras afuera del entrenamiento, PanelConexionesSeguras afuera de un chequeo, examen/ afuera de las estad\xEDsticas.",revisar(n){let s=[];for(let i of n)for(let r of i.texto.matchAll(Ze)){let a=new Set([...r[1].matchAll(Qe)].map(o=>o[2]));a.size>=3&&s.push({archivo:i.ruta,linea:L(i.texto,r.index??0),items:a})}let t=[],e=new Set;for(let i=0;i<s.length;i++)for(let r=i+1;r<s.length;r++){let a=s[i],o=s[r];if(a.archivo===o.archivo&&Math.abs(a.linea-o.linea)<30)continue;let h=[...a.items].filter(P=>o.items.has(P)),l=[...a.items].filter(P=>!o.items.has(P)),p=[...o.items].filter(P=>!a.items.has(P)),u=l.length+p.length;if(h.length<3||u===0||u>2||h.length/(h.length+u)<.6)continue;let f=[...a.items,"|",...o.items].sort().join(",");if(e.has(f))continue;e.add(f);let y=(P,E)=>P.length?`${P.map(N=>`"${N}"`).join(", ")} only in ${E.archivo}:${E.linea}`:"";t.push({archivo:o.archivo,linea:o.linea,severidad:"warning",tambien:{archivo:a.archivo,linea:a.linea},mensaje:`This list is almost the same as the one in ${a.archivo}:${a.linea} (${h.length} items in common), but ${[y(l,a),y(p,o)].filter(Boolean).join("; ")}. If they are meant to be the same list, one fell behind: keep it in one place. If they differ on purpose, say why next to either of them with a comment: healer-ignore: lists-out-of-sync <reason>.`})}return t}};var k=class{constructor(s,t,e){this.line=void 0,this.column=void 0,e!==void 0&&(this.index=void 0),this.line=s,this.column=t,e!==void 0&&(this.index=e)}},J=class{start;end;filename;identifierName;constructor(s,t){this.start=s,this.end=t}};function D(n,s){let{line:t,column:e,index:i}=n;return new k(t,e+s,i+s)}var ae="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED",ts={ImportMetaOutsideModule:{message:`import.meta may appear only with 'sourceType: "module"'`,code:ae},ImportOutsideModule:{message:`'import' and 'export' may appear only with 'sourceType: "module"'`,code:ae}},ne={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"},ct=n=>n.type==="UpdateExpression"?ne.UpdateExpression[`${n.prefix}`]:ne[n.type],es={AccessorIsGenerator:({kind:n})=>`A ${n}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:n})=>`Missing initializer in ${n} declaration.`,DecoratorArgumentsOutsideParentheses:"Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",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 { ... }'?",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:n})=>`\`${n}\` 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:n,exportName:s})=>`A string literal cannot be used as an exported binding without \`from\`.
5
+ - Did you mean \`export { '${n}' as '${s}' } from 'some-module'\`?`,ExportDefaultFromAsIdentifier:"'from' is not allowed as an identifier after 'export default'.",ForInOfLoopInitializer:({type:n})=>`'${n==="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:n})=>`Unsyntactic ${n==="BreakStatement"?"break":"continue"}.`,IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list.",IllegalReturn:"'return' outside of function.",ImportBindingIsString:({importName:n})=>`A string literal cannot be used as an imported binding.
6
+ - Did you mean \`import { "${n}" as foo }\`?`,ImportCallArity:({phase:n})=>`\`import${n?`.${n}`:""}()\` requires exactly one or two arguments.`,ImportCallNotNewExpression:({phase:n})=>`Cannot use new with import${n?`.${n}`:""}().`,ImportCallSpreadArgument:({phase:n})=>`\`...\` is not allowed in \`import${n?`.${n}`:""}()\`.`,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.",InvalidDigit:({radix:n})=>`Expected number in radix ${n}.`,InvalidEscapeSequence:"Bad character escape sequence.",InvalidEscapeSequenceTemplate:"Invalid escape sequence in template.",InvalidEscapedReservedWord:({reservedWord:n})=>`Escape sequence in keyword ${n}.`,InvalidIdentifier:({identifierName:n})=>`Invalid identifier ${n}.`,InvalidLhs:({ancestor:n})=>`Invalid left-hand side in ${ct(n)}.`,InvalidLhsBinding:({ancestor:n})=>`Binding invalid left-hand side in ${ct(n)}.`,InvalidLhsOptionalChaining:({ancestor:n})=>`Invalid optional chaining in the left-hand side of ${ct(n)}.`,InvalidNumber:"Invalid number.",InvalidOrMissingExponent:"Floating-point numbers require a valid exponent after the 'e'.",InvalidOrUnexpectedToken:({unexpected:n})=>`Unexpected character '${n}'.`,InvalidParenthesizedAssignment:"Invalid parenthesized assignment pattern.",InvalidPrivateFieldResolution:({identifierName:n})=>`Private name #${n} is not defined.`,InvalidPropertyBindingPattern:"Binding member expression.",InvalidRestAssignmentPattern:"Invalid rest operator's argument.",LabelRedeclaration:({labelName:n})=>`Label '${n}' 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:n})=>`This experimental syntax requires enabling the parser plugin: ${n.map(s=>JSON.stringify(s)).join(", ")}.`,MissingOneOfPlugins:({missingPlugin:n})=>`This experimental syntax requires enabling one of the following parser plugin(s): ${n.map(s=>JSON.stringify(s)).join(", ")}.`,MissingUnicodeEscape:"Expecting Unicode escape sequence \\uXXXX.",MixingCoalesceWithLogical:"Nullish coalescing operator(??) requires parens when mixing with logical operators.",ModuleAttributeInvalidValue:"Only string literals are allowed as module attribute values.",ModuleAttributesWithDuplicateKeys:({key:n})=>`Duplicate key "${n}" is not allowed in module attributes.`,ModuleExportNameHasLoneSurrogate:({surrogateCharCode:n})=>`An export name cannot include a lone surrogate, found '\\u${n.toString(16)}'.`,ModuleExportUndefined:({localName:n})=>`Export '${n}' 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:n})=>`Private names are only allowed in property accesses (\`obj.#${n}\`) or in \`in\` expressions (\`#${n} in obj\`).`,PrivateNameRedeclaration:({identifierName:n})=>`Duplicate private name #${n}.`,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.",SuperCallNotNewExpression:"Cannot use new with super(...).",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.",UnexpectedArgumentPlaceholder:"Unexpected argument placeholder.",UnexpectedDigitAfterHash:"Unexpected digit after hash token.",UnexpectedImportExport:"'import' and 'export' may only appear at the top level.",UnexpectedKeyword:({keyword:n})=>`Unexpected keyword '${n}'.`,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:n})=>`Unexpected reserved word '${n}'.`,UnexpectedSuper:"'super' is only allowed in object methods and classes.",UnexpectedToken:({expected:n,unexpected:s})=>`Unexpected token${s?` '${s}'.`:""}${n?`, expected "${n}"`:""}`,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.",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:n,onlyValidPropertyName:s})=>`The only valid meta property for ${n} is ${n}.${s}.`,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:n})=>`Identifier '${n}' 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."},ss={StrictDelete:"Deleting local variable in strict mode.",StrictEvalArguments:({referenceName:n})=>`Assigning to '${n}' in strict mode.`,StrictEvalArgumentsBinding:({bindingName:n})=>`Binding '${n}' 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."},is={ParseExpressionEmptyInput:"Unexpected parseExpression() input: The input is empty or contains only comments.",ParseExpressionExpectsEOF:({unexpected:n})=>`Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(n)}\`.`},rs=new Set(["ArrowFunctionExpression","AssignmentExpression","ConditionalExpression","YieldExpression"]),as={PipeTopicRequiresHackPipes:'Topic references are only supported when using the `"proposal": "hack"` version of the pipeline proposal.',PipeTopicUnbound:"Topic reference is unbound; it must be inside a pipe body.",PipeTopicUnconfiguredToken:({token:n})=>`Invalid topic token ${n}. In order to use ${n} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${n}" }.`,PipeTopicUnused:"Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",PipeUnparenthesizedBody:({type:n})=>`Hack-style pipe body cannot be an unparenthesized ${ct({type:n})}; please wrap it in parentheses.`,PipelineUnparenthesized:"Cannot mix binary operator with solo-await F#-style pipeline. Please wrap the pipeline in parentheses."},ns={UnsupportedBind:"Binding should be performed on object property.",UnsupportedBindRHS:"The right-hand side of binding can not be super or import."};function oe(n,s,t){Object.defineProperty(n,s,{enumerable:!1,configurable:!0,value:t})}function os({toMessage:n,code:s,reasonCode:t,syntaxPlugin:e}){let i=t==="MissingPlugin"||t==="MissingOneOfPlugins";return function r(a,o,h){let l=new SyntaxError;return l.code=s,l.reasonCode=t,l.loc=a,l.pos=o,l.syntaxPlugin=e,i&&(l.missingPlugin=h.missingPlugin),oe(l,"clone",function(u={}){let{line:f,column:y,index:P=o}=u.loc??a;return r(new k(f,y),P,{...h,...u.details})}),oe(l,"details",h),Object.defineProperty(l,"message",{configurable:!0,get(){let p=`${n(h)} (${a.line}:${a.column})`;return this.message=p,p},set(p){Object.defineProperty(this,"message",{value:p,writable:!0})}}),l}}function M(n,s){if(Array.isArray(n))return e=>M(e,n[0]);let t={};for(let e of Object.keys(n)){let i=n[e],{message:r,...a}=typeof i=="string"?{message:()=>i}:typeof i=="function"?{message:i}:i,o=typeof r=="string"?()=>r:r;t[e]=os({code:"BABEL_PARSER_SYNTAX_ERROR",reasonCode:e,toMessage:o,...s?{syntaxPlugin:s}:{},...a})}return t}var c={...M(ts),...M(es),...M(ss),...M(is),...M`pipelineOperator`(as),...M`functionBind`(ns)};function hs(){return{sourceType:"script",sourceFilename:void 0,startIndex:0,startColumn:0,startLine:1,allowAwaitOutsideFunction:!1,allowReturnOutsideFunction:!1,allowNewTargetOutsideFunction:!1,allowImportExportEverywhere:!1,allowSuperOutsideMethod:!1,allowUndeclaredExports:!1,allowYieldOutsideFunction:!1,plugins:[],strictMode:void 0,ranges:!1,locations:!0,tokens:!1,createImportExpressions:!0,createParenthesizedExpressions:!1,errorRecovery:!1,attachComment:!0,annexB:!0}}function ls(n){let s=hs();if(n==null)return s;if(n.annexB!=null&&n.annexB!==!1)throw new Error("The `annexB` option can only be set to `false`.");for(let t of Object.keys(s))n[t]!=null&&(s[t]=n[t]);if(s.startLine===1)n.startIndex==null&&s.startColumn>0?s.startIndex=s.startColumn:n.startColumn==null&&s.startIndex>0&&(s.startColumn=s.startIndex);else if(n.startColumn==null||n.startIndex==null)throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");if(s.sourceType==="commonjs"){if(n.allowAwaitOutsideFunction!=null)throw new Error("The `allowAwaitOutsideFunction` option cannot be used with `sourceType: 'commonjs'`.");if(n.allowReturnOutsideFunction!=null)throw new Error("`sourceType: 'commonjs'` implies `allowReturnOutsideFunction: true`, please remove the `allowReturnOutsideFunction` option or use `sourceType: 'script'`.");if(n.allowNewTargetOutsideFunction!=null)throw new Error("`sourceType: 'commonjs'` implies `allowNewTargetOutsideFunction: true`, please remove the `allowNewTargetOutsideFunction` option or use `sourceType: 'script'`.")}return s}function q(n){let{start:s,end:t}=n.loc;return n.loc.start=new k(s.line,s.column),n.loc.end=new k(t.line,t.column),n}var cs=n=>class extends n{createPosition(t){return new k(t.line,t.column)}parse(){let t=super.parse();return this.optionFlags&512&&(t.tokens=t.tokens.map(q)),q(t)}parseRegExpLiteral({pattern:t,flags:e}){let i=null;try{i=new RegExp(t,e)}catch{}let r=this.estreeParseLiteral(i);return r.regex={pattern:t,flags:e},r}parseBigIntLiteral(t){let e;try{e=BigInt(t)}catch{e=null}let i=this.estreeParseLiteral(e);return i.bigint=String(i.value||t),i}estreeParseLiteral(t){return this.parseLiteral(t,"Literal")}parseStringLiteral(t){return this.estreeParseLiteral(t)}parseNumericLiteral(t){return this.estreeParseLiteral(t)}parseNullLiteral(){return this.estreeParseLiteral(null)}parseBooleanLiteral(t){return this.estreeParseLiteral(t)}estreeParseChainExpression(t,e){let i=this.startNodeAtNode(t);return i.expression=t,this.finishNodeAtNode(i,"ChainExpression",e)}directiveToStmt(t){let e=t.value;delete t.value,this.castNodeTo(e,"Literal"),e.raw=e.extra.raw,e.value=e.extra.expressionValue;let i=this.castNodeTo(t,"ExpressionStatement");return i.expression=e,i.directive=e.extra.rawValue,delete e.extra,i}fillOptionalPropertiesForTSESLint(t){}cloneEstreeStringLiteral(t){let{start:e,end:i,loc:r,range:a,raw:o,value:h}=t,l=Object.create(t.constructor.prototype);return l.type="Literal",l.start=e,l.end=i,l.loc=r,l.range=a,l.raw=o,l.value=h,l}initFunction(t,e){super.initFunction(t,e),t.expression=!1}checkDeclaration(t){t!=null&&this.isObjectProperty(t)?this.checkDeclaration(t.value):super.checkDeclaration(t)}getObjectOrClassMethodParams(t){return t.value.params}isValidDirective(t){return t.type==="ExpressionStatement"&&t.expression.type==="Literal"&&typeof t.expression.value=="string"&&!t.expression.extra?.parenthesized}parseBlockBody(t,e,i,r,a){super.parseBlockBody(t,e,i,r,a);let o=t.directives.map(h=>this.directiveToStmt(h));t.body=o.concat(t.body),delete t.directives}parsePrivateName(){let t=super.parsePrivateName();return this.convertPrivateNameToPrivateIdentifier(t)}convertPrivateNameToPrivateIdentifier(t){let e=super.getPrivateNameSV(t);return delete t.id,t.name=e,this.castNodeTo(t,"PrivateIdentifier")}isPrivateName(t){return t.type==="PrivateIdentifier"}getPrivateNameSV(t){return t.name}parseLiteral(t,e){let i=super.parseLiteral(t,e);return i.raw=i.extra.raw,delete i.extra,i}parseFunctionBody(t,e,i=!1){super.parseFunctionBody(t,e,i),t.expression=t.body.type!=="BlockStatement"}parseMethod(t,e,i,r,a,o,h=!1){let l=this.startNode();l.kind=t.kind,l=super.parseMethod(l,e,i,r,a,o,h),delete l.kind;let{typeParameters:p}=t;p&&(delete t.typeParameters,l.typeParameters=p,this.resetStartLocationFromNode(l,p));let u=this.castNodeTo(l,this.hasPlugin("typescript")&&!l.body?"TSEmptyBodyFunctionExpression":"FunctionExpression");return t.value=u,o==="ClassPrivateMethod"&&(t.computed=!1),this.hasPlugin("typescript")&&t.abstract?(delete t.abstract,this.finishNode(t,"TSAbstractMethodDefinition")):o==="ObjectMethod"?(t.kind==="method"&&(t.kind="init"),t.shorthand=!1,this.finishNode(t,"Property")):this.finishNode(t,"MethodDefinition")}nameIsConstructor(t){return t.type==="Literal"?t.value==="constructor":super.nameIsConstructor(t)}parseClassProperty(...t){let e=super.parseClassProperty(...t);return e.abstract&&this.hasPlugin("typescript")?(delete e.abstract,this.castNodeTo(e,"TSAbstractPropertyDefinition")):this.castNodeTo(e,"PropertyDefinition"),e}parseClassPrivateProperty(...t){let e=super.parseClassPrivateProperty(...t);return e.abstract&&this.hasPlugin("typescript")?this.castNodeTo(e,"TSAbstractPropertyDefinition"):this.castNodeTo(e,"PropertyDefinition"),e.computed=!1,e}parseClassAccessorProperty(t){let e=super.parseClassAccessorProperty(t);return e.abstract&&this.hasPlugin("typescript")?(delete e.abstract,this.castNodeTo(e,"TSAbstractAccessorProperty")):this.castNodeTo(e,"AccessorProperty"),e}parseObjectProperty(t,e,i,r){let a=super.parseObjectProperty(t,e,i,r);return a&&(a.kind="init",this.castNodeTo(a,"Property")),a}finishObjectProperty(t){return t.kind="init",this.finishNode(t,"Property")}isValidLVal(t,e,i,r){return t==="Property"?"value":super.isValidLVal(t,e,i,r)}isAssignable(t,e){return t!=null&&this.isObjectProperty(t)?this.isAssignable(t.value,e):super.isAssignable(t,e)}toAssignable(t,e=!1){if(t!=null&&this.isObjectProperty(t)){let{key:i,value:r}=t;this.isPrivateName(i)&&this.classScope.usePrivateName(this.getPrivateNameSV(i),i.start),this.toAssignable(r,e)}else super.toAssignable(t,e)}toAssignableObjectExpressionProp(t,e,i){t.type==="Property"&&(t.kind==="get"||t.kind==="set")?this.raise(c.PatternHasAccessor,t.key):t.type==="Property"&&t.method?this.raise(c.PatternHasMethod,t.key):super.toAssignableObjectExpressionProp(t,e,i)}finishCallExpression(t,e){let i=super.finishCallExpression(t,e);return i.callee.type==="Import"?(this.castNodeTo(i,"ImportExpression"),i.source=i.arguments[0],i.options=i.arguments[1]??null,delete i.arguments,delete i.callee):i.type==="OptionalCallExpression"?this.castNodeTo(i,"CallExpression"):i.optional=!1,i}parseExport(t,e){let i=this.state.lastTokStartLoc,r=super.parseExport(t,e);switch(r.type){case"ExportAllDeclaration":r.exported=null;break;case"ExportNamedDeclaration":r.specifiers.length===1&&r.specifiers[0].type==="ExportNamespaceSpecifier"&&(this.castNodeTo(r,"ExportAllDeclaration"),r.exported=r.specifiers[0].exported,delete r.specifiers);case"ExportDefaultDeclaration":{let{declaration:a}=r;a?.type==="ClassDeclaration"&&a.decorators?.length>0&&a.start===r.start&&this.resetStartLocation(r,i)}break}return r}stopParseSubscript(t,e){let i=super.stopParseSubscript(t,e);return e.optionalChainMember?this.estreeParseChainExpression(i,t):i}parseMember(t,e,i,r,a){let o=super.parseMember(t,e,i,r,a);return o.type==="OptionalMemberExpression"?this.castNodeTo(o,"MemberExpression"):o.optional=!1,o}isOptionalMemberExpression(t){return t.type==="ChainExpression"?t.expression.type==="MemberExpression":super.isOptionalMemberExpression(t)}hasPropertyAsPrivateName(t){return t.type==="ChainExpression"&&(t=t.expression),super.hasPropertyAsPrivateName(t)}isObjectProperty(t){return t.type==="Property"&&t.kind==="init"&&!t.method}isObjectMethod(t){return t.type==="Property"&&(t.method||t.kind==="get"||t.kind==="set")}castNodeTo(t,e){let i=super.castNodeTo(t,e);return this.fillOptionalPropertiesForTSESLint(i),i}cloneIdentifier(t){let e=super.cloneIdentifier(t);return this.fillOptionalPropertiesForTSESLint(e),e}cloneStringLiteral(t){return t.type==="Literal"?this.cloneEstreeStringLiteral(t):super.cloneStringLiteral(t)}finishNodeAt(t,e,i){return q(super.finishNodeAt(t,e,i))}finishNodeAtNode(t,e,i){return q(super.finishNodeAtNode(t,e,i))}finishNode(t,e){let i=super.finishNode(t,e);return this.fillOptionalPropertiesForTSESLint(i),i}resetStartLocation(t,e){super.resetStartLocation(t,e),q(t)}resetEndLocation(t,e=this.state.lastTokEndLoc){super.resetEndLocation(t,e),q(t)}},A=!0,m=!0,Pt=!0,Z=!0,R=!0,ps=!0,ft=class{label;keyword;beforeExpr;startsExpr;rightAssociative;isLoop;isAssign;prefix;postfix;binop;constructor(s,t={}){this.label=s,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}},Xt=new Map;function b(n,s={}){s.keyword=n;let t=g(n,s);return Xt.set(n,t),t}function v(n,s){return g(n,{beforeExpr:A,binop:s})}var et=-1,Jt=[],Gt=[],Yt=[],Zt=[],Qt=[],te=[];function g(n,s={}){return++et,Gt.push(n),Yt.push(s.binop??-1),Zt.push(s.beforeExpr??!1),Qt.push(s.startsExpr??!1),te.push(s.prefix??!1),Jt.push(new ft(n,s)),et}function T(n,s={}){return++et,Xt.set(n,et),Gt.push(n),Yt.push(s.binop??-1),Zt.push(s.beforeExpr??!1),Qt.push(s.startsExpr??!1),te.push(s.prefix??!1),Jt.push(new ft("name",s)),et}var us={bracketL:g("[",{beforeExpr:A,startsExpr:m}),bracketR:g("]"),braceL:g("{",{beforeExpr:A,startsExpr:m}),braceBarL:g("{|",{beforeExpr:A,startsExpr:m}),braceR:g("}"),braceBarR:g("|}"),parenL:g("(",{beforeExpr:A,startsExpr:m}),parenR:g(")"),comma:g(",",{beforeExpr:A}),semi:g(";",{beforeExpr:A}),colon:g(":",{beforeExpr:A}),doubleColon:g("::",{beforeExpr:A}),dot:g("."),question:g("?",{beforeExpr:A}),questionDot:g("?."),arrow:g("=>",{beforeExpr:A}),template:g("template"),ellipsis:g("...",{beforeExpr:A}),backQuote:g("`",{startsExpr:m}),dollarBraceL:g("${",{beforeExpr:A,startsExpr:m}),templateTail:g("...`",{startsExpr:m}),templateNonTail:g("...${",{beforeExpr:A,startsExpr:m}),at:g("@"),hash:g("#",{startsExpr:m}),interpreterDirective:g("#!..."),eq:g("=",{beforeExpr:A,isAssign:Z}),assign:g("_=",{beforeExpr:A,isAssign:Z}),slashAssign:g("_=",{beforeExpr:A,isAssign:Z}),xorAssign:g("_=",{beforeExpr:A,isAssign:Z}),moduloAssign:g("_=",{beforeExpr:A,isAssign:Z}),incDec:g("++/--",{prefix:R,postfix:ps,startsExpr:m}),bang:g("!",{beforeExpr:A,prefix:R,startsExpr:m}),tilde:g("~",{beforeExpr:A,prefix:R,startsExpr:m}),doubleCaret:g("^^",{startsExpr:m}),doubleAt:g("@@",{startsExpr:m}),pipeline:v("|>",0),nullishCoalescing:v("??",1),logicalOR:v("||",1),logicalAND:v("&&",2),bitwiseOR:v("|",3),bitwiseXOR:v("^",4),bitwiseAND:v("&",5),equality:v("==/!=/===/!==",6),lt:v("</>/<=/>=",7),gt:v("</>/<=/>=",7),relational:v("</>/<=/>=",7),bitShift:v("<</>>/>>>",8),bitShiftL:v("<</>>/>>>",8),bitShiftR:v("<</>>/>>>",8),plusMin:g("+/-",{beforeExpr:A,binop:9,prefix:R,startsExpr:m}),modulo:g("%",{binop:10,startsExpr:m}),star:g("*",{binop:10}),slash:v("/",10),exponent:g("**",{beforeExpr:A,binop:11,rightAssociative:!0}),_in:b("in",{beforeExpr:A,binop:7}),_instanceof:b("instanceof",{beforeExpr:A,binop:7}),_break:b("break"),_case:b("case",{beforeExpr:A}),_catch:b("catch"),_continue:b("continue"),_debugger:b("debugger"),_default:b("default",{beforeExpr:A}),_else:b("else",{beforeExpr:A}),_finally:b("finally"),_function:b("function",{startsExpr:m}),_if:b("if"),_return:b("return",{beforeExpr:A}),_switch:b("switch"),_throw:b("throw",{beforeExpr:A,prefix:R,startsExpr:m}),_try:b("try"),_var:b("var"),_const:b("const"),_with:b("with"),_new:b("new",{beforeExpr:A,startsExpr:m}),_this:b("this",{startsExpr:m}),_super:b("super",{startsExpr:m}),_class:b("class",{startsExpr:m}),_extends:b("extends",{beforeExpr:A}),_export:b("export"),_import:b("import",{startsExpr:m}),_null:b("null",{startsExpr:m}),_true:b("true",{startsExpr:m}),_false:b("false",{startsExpr:m}),_typeof:b("typeof",{beforeExpr:A,prefix:R,startsExpr:m}),_void:b("void",{beforeExpr:A,prefix:R,startsExpr:m}),_delete:b("delete",{beforeExpr:A,prefix:R,startsExpr:m}),_do:b("do",{isLoop:Pt,beforeExpr:A}),_for:b("for",{isLoop:Pt}),_while:b("while",{isLoop:Pt}),_as:T("as",{startsExpr:m}),_assert:T("assert",{startsExpr:m}),_async:T("async",{startsExpr:m}),_await:T("await",{startsExpr:m}),_defer:T("defer",{startsExpr:m}),_from:T("from",{startsExpr:m}),_get:T("get",{startsExpr:m}),_let:T("let",{startsExpr:m}),_meta:T("meta",{startsExpr:m}),_of:T("of",{startsExpr:m}),_sent:T("sent",{startsExpr:m}),_set:T("set",{startsExpr:m}),_source:T("source",{startsExpr:m}),_static:T("static",{startsExpr:m}),_using:T("using",{startsExpr:m}),_yield:T("yield",{startsExpr:m}),_asserts:T("asserts",{startsExpr:m}),_checks:T("checks",{startsExpr:m}),_exports:T("exports",{startsExpr:m}),_global:T("global",{startsExpr:m}),_implements:T("implements",{startsExpr:m}),_intrinsic:T("intrinsic",{startsExpr:m}),_infer:T("infer",{startsExpr:m}),_is:T("is",{startsExpr:m}),_mixins:T("mixins",{startsExpr:m}),_proto:T("proto",{startsExpr:m}),_require:T("require",{startsExpr:m}),_satisfies:T("satisfies",{startsExpr:m}),_keyof:T("keyof",{startsExpr:m}),_readonly:T("readonly",{startsExpr:m}),_unique:T("unique",{startsExpr:m}),_abstract:T("abstract",{startsExpr:m}),_declare:T("declare",{startsExpr:m}),_enum:T("enum",{startsExpr:m}),_module:T("module",{startsExpr:m}),_namespace:T("namespace",{startsExpr:m}),_interface:T("interface",{startsExpr:m}),_type:T("type",{startsExpr:m}),_opaque:T("opaque",{startsExpr:m}),name:g("name",{startsExpr:m}),placeholder:g("%%",{startsExpr:m}),string:g("string",{startsExpr:m}),num:g("num",{startsExpr:m}),bigint:g("bigint",{startsExpr:m}),regexp:g("regexp",{startsExpr:m}),privateName:g("#name",{startsExpr:m}),eof:g("eof"),jsxName:g("jsxName"),jsxText:g("jsxText",{beforeExpr:A}),jsxTagStart:g("jsxTagStart",{startsExpr:m}),jsxTagEnd:g("jsxTagEnd")};function S(n){return n>=89&&n<=129}function fs(n){return n<=88}function O(n){return n>=54&&n<=129}function Se(n){return n>=54&&n<=132}function ds(n){return Zt[n]}function tt(n){return Qt[n]}function ms(n){return n>=25&&n<=29}function he(n){return n>=125&&n<=127}function ys(n){return n>=86&&n<=88}function ee(n){return n>=54&&n<=88}function le(n){return n>=35&&n<=55}function xs(n){return n===30}function gs(n){return te[n]}function Ps(n){return n>=117&&n<=119}function Ts(n){return n>=120&&n<=126}function j(n){return Gt[n]}function pt(n){return Yt[n]}function As(n){return n===53}function wt(n){return n>=20&&n<=21}function Ce(n){return Jt[n]}var H=class{constructor(s,t){this.token=s,this.preserveSpace=!!t}token;preserveSpace},w={brace:new H("{"),j_oTag:new H("<tag"),j_cTag:new H("</tag"),j_expr:new H("<tag>...</tag>",!0)},ce=/[\p{ID_Start}\u088f\u0c5c\u0cdc\ua7ce\ua7cf\ua7d2\ua7d4\ua7f1]/u,pe=/[\p{ID_Continue}\u088f\u0c5c\u0cdc\ua7ce\ua7cf\ua7d2\ua7d4\ua7f1\u1acf-\u1add\u1ae0-\u1aeb]/u,we=[2368,25,1388,2,3817,43,20677,24,3,24,287,4,6146,7,1290,21,98,114,22734,30,2,2,2,1,2,6,3,4,10,1,53307,5,5987,11,21763,4297],bs=[3834,1,3173,7,633,9,51450,0,3,0,8,1,6,0];function It(n,s){let t=65536;for(let e=0,i=s.length;e<i;e+=2){if(t+=s[e],t>n)return!1;if(t+=s[e+1],t>=n)return!0}return!1}function F(n){return n<65?n===36:n<=90?!0:n<97?n===95:n<=122?!0:n<=65535?n>=170&&ce.test(String.fromCharCode(n)):!isNaN(n)&&n<=1114111&&(ce.test(String.fromCodePoint(n))||It(n,we))}function $(n){return n<48?n===36:n<58?!0:n<65?!1:n<=90?!0:n<97?n===95:n<=122?!0:n<=65535?n>=170&&pe.test(String.fromCharCode(n)):!isNaN(n)&&n<=1114111&&(pe.test(String.fromCodePoint(n))||It(n,we)||It(n,bs))}var se={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"]},Ss=new Set(se.keyword),Cs=new Set(se.strict),ws=new Set(se.strictBind);function Ie(n,s){return s&&n==="await"||n==="enum"}function Ee(n,s){return Ie(n,s)||Cs.has(n)}function Ne(n){return ws.has(n)}function ke(n,s){return Ee(n,s)||Ne(n)}function Is(n){return Ss.has(n)}function Es(n,s,t){return n===64&&s===64&&F(t)}var Ns=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 ks(n){return Ns.has(n)}var st=class{flags=0;names=new Map;firstLexicalName="";constructor(s){this.flags=s}},it=class{parser;scopeStack=[];inModule;undefinedExports=new Map;constructor(s,t){this.parser=s,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(){let s=this.currentThisScopeFlags();return(s&64)>0&&(s&2)===0}get inStaticBlock(){for(let s=this.scopeStack.length-1;;s--){let{flags:t}=this.scopeStack[s];if(t&128)return!0;if(t&3779)return!1}}get inNonArrowFunction(){return(this.currentThisScopeFlags()&2)>0}get inBareCaseStatement(){return(this.currentScope().flags&256)>0}get treatFunctionsAsVar(){return this.treatFunctionsAsVarInScope(this.currentScope())}createScope(s){return new st(s)}enter(s){this.scopeStack.push(this.createScope(s))}exit(){return this.scopeStack.pop().flags}treatFunctionsAsVarInScope(s){return!!(s.flags&130||!this.parser.inModule&&s.flags&1)}declareName(s,t,e){let i=this.currentScope();if(t&8||t&16){this.checkRedeclarationInScope(i,s,t,e);let r=i.names.get(s)||0;t&16?r=r|4:(i.firstLexicalName||(i.firstLexicalName=s),r=r|2),i.names.set(s,r),t&8&&this.maybeExportDefined(i,s)}else if(t&4)for(let r=this.scopeStack.length-1;r>=0&&(i=this.scopeStack[r],this.checkRedeclarationInScope(i,s,t,e),i.names.set(s,(i.names.get(s)||0)|1),this.maybeExportDefined(i,s),!(i.flags&3715));--r);this.parser.inModule&&i.flags&1&&this.undefinedExports.delete(s)}maybeExportDefined(s,t){this.parser.inModule&&s.flags&1&&this.undefinedExports.delete(t)}checkRedeclarationInScope(s,t,e,i){this.isRedeclaredInScope(s,t,e)&&this.parser.raise(c.VarRedeclaration,i,{identifierName:t})}isRedeclaredInScope(s,t,e){if(!(e&1))return!1;if(e&8)return s.names.has(t);let i=s.names.get(t)||0;return e&16?(i&2)>0||!this.treatFunctionsAsVarInScope(s)&&(i&1)>0:(i&2)>0&&!(s.flags&8&&s.firstLexicalName===t)||!this.treatFunctionsAsVarInScope(s)&&(i&4)>0}checkLocalExport(s){let{name:t}=s;this.scopeStack[0].names.has(t)||this.undefinedExports.set(t,s.start)}currentScope(){return this.scopeStack[this.scopeStack.length-1]}currentVarScopeFlags(){for(let s=this.scopeStack.length-1;;s--){let{flags:t}=this.scopeStack[s];if(t&3715)return t}}currentThisScopeFlags(){for(let s=this.scopeStack.length-1;;s--){let{flags:t}=this.scopeStack[s];if(t&3779&&!(t&4))return t}}},Et=class extends st{declareFunctions=new Set},Nt=class extends it{createScope(s){return new Et(s)}declareName(s,t,e){let i=this.currentScope();if(t&2048){this.checkRedeclarationInScope(i,s,t,e),this.maybeExportDefined(i,s),i.declareFunctions.add(s);return}super.declareName(s,t,e)}isRedeclaredInScope(s,t,e){if(super.isRedeclaredInScope(s,t,e))return!0;if(e&2048&&!s.declareFunctions.has(t)){let i=s.names.get(t);return(i&4)>0||(i&2)>0}return!1}checkLocalExport(s){this.scopeStack[0].declareFunctions.has(s.name)||super.checkLocalExport(s)}},vs=new Set(["_","any","bool","boolean","empty","extends","false","interface","mixed","null","number","static","string","true","typeof","void"]),Ls={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:n})=>`Cannot overwrite reserved type ${n}.`,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:n,enumName:s})=>`Boolean enum members need to be initialized. Use either \`${n} = true,\` or \`${n} = false,\` in enum \`${s}\`.`,EnumDuplicateMemberName:({memberName:n,enumName:s})=>`Enum member names need to be unique, but the name \`${n}\` has already been used before in enum \`${s}\`.`,EnumInconsistentMemberValues:({enumName:n})=>`Enum \`${n}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`,EnumInvalidExplicitType:({invalidEnumType:n,enumName:s})=>`Enum type \`${n}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${s}\`.`,EnumInvalidExplicitTypeUnknownSupplied:({enumName:n})=>`Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${n}\`.`,EnumInvalidMemberInitializerPrimaryType:({enumName:n,memberName:s,explicitType:t})=>`Enum \`${n}\` has type \`${t}\`, so the initializer of \`${s}\` needs to be a ${t} literal.`,EnumInvalidMemberInitializerSymbolType:({enumName:n,memberName:s})=>`Symbol enum members cannot be initialized. Use \`${s},\` in enum \`${n}\`.`,EnumInvalidMemberInitializerUnknownType:({enumName:n,memberName:s})=>`The enum member initializer for \`${s}\` needs to be a literal (either a boolean, number, or string) in enum \`${n}\`.`,EnumInvalidMemberName:({enumName:n,memberName:s,suggestion:t})=>`Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${s}\`, consider using \`${t}\`, in enum \`${n}\`.`,EnumNumberMemberNotInitialized:({enumName:n,memberName:s})=>`Number enum members need to be initialized, e.g. \`${s} = 1\` in enum \`${n}\`.`,EnumStringMemberInconsistentlyInitialized:({enumName:n})=>`String enum members need to consistently either all use initializers, or use no initializers, in enum \`${n}\`.`,GetterMayNotHaveThisParam:"A getter cannot have a `this` parameter.",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:{message:"A binding pattern parameter cannot be optional in an implementation signature."},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:n})=>`Unexpected reserved type ${n}.`,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:n,suggestion:s})=>`\`declare export ${n}\` is not supported. Use \`${s}\` instead.`,UnsupportedStatementInDeclareModule:"Only declares and type imports are allowed inside declare module.",UnterminatedFlowComment:"Unterminated flow-comment."},x=M`flow`(Ls);function Ds(n){return n.type==="DeclareExportAllDeclaration"||n.type==="DeclareExportDeclaration"&&(!n.declaration||n.declaration.type!=="TypeAlias"&&n.declaration.type!=="InterfaceDeclaration")}function ue(n){return n.importKind==="type"||n.importKind==="typeof"}var Ms={const:"declare export var",let:"declare export var",type:"export type",interface:"export interface"};function Os(n,s){let t=[],e=[];for(let i=0;i<n.length;i++)(s(n[i],i,n)?t:e).push(n[i]);return[t,e]}var Fs=/\*?\s*@((?:no)?flow)\b/,Bs=n=>class extends n{flowPragma=void 0;getScopeHandler(){return Nt}shouldParseTypes(){return this.getPluginOption("flow","all")||this.flowPragma==="flow"}finishToken(t,e){t!==130&&t!==9&&t!==24&&this.flowPragma===void 0&&(this.flowPragma=null),super.finishToken(t,e)}addComment(t){if(this.flowPragma===void 0){let e=Fs.exec(t.value);if(e)if(e[1]==="flow")this.flowPragma="flow";else if(e[1]==="noflow")this.flowPragma="noflow";else throw new Error("Unexpected flow pragma")}super.addComment(t)}flowParseTypeInitialiser(t){let e=this.state.inType;this.state.inType=!0,this.expect(t||10);let i=this.flowParseType();return this.state.inType=e,i}flowParsePredicate(){let t=this.startNode(),e=this.state.startLoc;return this.next(),this.expectContextual(106),this.state.lastTokStartLoc.index>e.index+1&&this.raise(x.UnexpectedSpaceBetweenModuloChecks,e),this.eat(6)?(t.value=super.parseExpression(),this.expect(7),this.finishNode(t,"DeclaredPredicate")):this.finishNode(t,"InferredPredicate")}flowParseTypeAndPredicateInitialiser(t){let e=this.state.inType;this.state.inType=!0,this.expect(10);let i=null,r=null;return t&&this.match(50)?(this.state.inType=e,r=this.flowParsePredicate()):(i=this.flowParseType(),this.state.inType=e,this.match(50)&&(r=this.flowParsePredicate())),[i,r]}flowParseDeclareClass(t){return this.next(),this.flowParseInterfaceish(t,!0),this.finishNode(t,"DeclareClass")}flowParseDeclareFunction(t){this.next();let e=t.id=this.parseIdentifier(),i=this.startNode(),r=this.startNode();this.match(43)?i.typeParameters=this.flowParseTypeParameterDeclaration():i.typeParameters=null,this.expect(6);let a=this.flowParseFunctionTypeParams();return i.params=a.params,i.rest=a.rest,i.this=a._this,this.expect(7),[i.returnType,t.predicate]=this.flowParseTypeAndPredicateInitialiser(!1),r.typeAnnotation=this.finishNode(i,"FunctionTypeAnnotation"),e.typeAnnotation=this.finishNode(r,"TypeAnnotation"),this.resetEndLocation(e),this.semicolon(),this.scope.declareName(t.id.name,2048,t.id.start),this.finishNode(t,"DeclareFunction")}flowParseDeclare(t,e){if(this.match(76))return this.flowParseDeclareClass(t);if(this.match(64))return this.flowParseDeclareFunction(t);if(this.match(70))return this.flowParseDeclareVariable(t);if(this.eatContextual(123))return this.match(12)?this.flowParseDeclareModuleExports(t):(e&&this.raise(x.NestedDeclareModule,this.state.lastTokStartLoc),this.flowParseDeclareModule(t));if(this.isContextual(126))return this.flowParseDeclareTypeAlias(t);if(this.isContextual(127))return this.flowParseDeclareOpaqueType(t);if(this.isContextual(125))return this.flowParseDeclareInterface(t);if(this.match(78))return this.flowParseDeclareExportDeclaration(t,e);throw this.unexpected()}flowParseDeclareVariable(t){return this.next(),t.id=this.flowParseTypeAnnotatableIdentifier(),this.scope.declareName(t.id.name,5,t.id.start),this.semicolon(),this.finishNode(t,"DeclareVariable")}flowParseDeclareModule(t){this.scope.enter(0),this.match(130)?t.id=super.parseExprAtom():t.id=this.parseIdentifier();let e=this.startNode(),i=e.body=[];for(this.expect(2);!this.match(4);){let o=this.startNode();this.match(79)?(this.next(),!this.isContextual(126)&&!this.match(83)&&this.raise(x.InvalidNonTypeImportInDeclareModule,this.state.lastTokStartLoc),i.push(super.parseImport(o))):(this.expectContextual(121,x.UnsupportedStatementInDeclareModule),i.push(this.flowParseDeclare(o,!0)))}this.scope.exit(),this.expect(4),t.body=this.finishNode(e,"BlockStatement");let r=null,a=!1;return i.forEach(o=>{Ds(o)?(r==="CommonJS"&&this.raise(x.AmbiguousDeclareModuleKind,o),r="ES"):o.type==="DeclareModuleExports"&&(a&&this.raise(x.DuplicateDeclareModuleExports,o),r==="ES"&&this.raise(x.AmbiguousDeclareModuleKind,o),r="CommonJS",a=!0)}),t.kind=r||"CommonJS",this.finishNode(t,"DeclareModule")}flowParseDeclareExportDeclaration(t,e){if(this.expect(78),this.eat(61))return this.match(64)||this.match(76)?t.declaration=this.flowParseDeclare(this.startNode()):(t.declaration=this.flowParseType(),this.semicolon()),t.default=!0,this.finishNode(t,"DeclareExportDeclaration");if(this.match(71)||this.isLet()||(this.isContextual(126)||this.isContextual(125))&&!e){let i=this.state.value;throw this.raise(x.UnsupportedDeclareExportKind,this.state.startLoc,{unsupportedExportKind:i,suggestion:Ms[i]})}if(this.match(70)||this.match(64)||this.match(76)||this.isContextual(127))return t.declaration=this.flowParseDeclare(this.startNode()),t.default=!1,this.finishNode(t,"DeclareExportDeclaration");if(this.match(51)||this.match(2)||this.isContextual(125)||this.isContextual(126)||this.isContextual(127)){let i=this.parseExport(t,null);return i.type==="ExportNamedDeclaration"?(i.default=!1,delete i.exportKind,this.castNodeTo(i,"DeclareExportDeclaration")):this.castNodeTo(i,"DeclareExportAllDeclaration")}throw this.unexpected()}flowParseDeclareModuleExports(t){return this.next(),this.expectContextual(107),t.typeAnnotation=this.flowParseTypeAnnotation(),this.semicolon(),this.finishNode(t,"DeclareModuleExports")}flowParseDeclareTypeAlias(t){this.next();let e=this.flowParseTypeAlias(t);return this.castNodeTo(e,"DeclareTypeAlias"),e}flowParseDeclareOpaqueType(t){return this.next(),this.flowParseOpaqueType(t,!0)}flowParseDeclareInterface(t){return this.next(),this.flowParseInterfaceish(t,!1),this.finishNode(t,"DeclareInterface")}flowParseInterfaceish(t,e){if(t.id=this.flowParseRestrictedIdentifier(!e,!0),this.scope.declareName(t.id.name,e?17:8201,t.id.start),this.match(43)?t.typeParameters=this.flowParseTypeParameterDeclaration():t.typeParameters=null,t.extends=[],this.eat(77))do t.extends.push(this.flowParseInterfaceExtends());while(!e&&this.eat(8));if(e){let i=[],r=[];if(this.eatContextual(113))do r.push(this.flowParseInterfaceExtends());while(this.eat(8));if(this.eatContextual(109))do i.push(this.flowParseClassImplements());while(this.eat(8));t.implements=i,t.mixins=r}t.body=this.flowParseObjectType({allowStatic:e,allowExact:!1,allowSpread:!1,allowProto:e,allowInexact:!1})}flowParseInterfaceExtends(){let t=this.startNode();return t.id=this.flowParseQualifiedTypeIdentifier(),this.match(43)?t.typeParameters=this.flowParseTypeParameterInstantiation():t.typeParameters=null,this.finishNode(t,"InterfaceExtends")}flowParseInterface(t){return this.flowParseInterfaceish(t,!1),this.finishNode(t,"InterfaceDeclaration")}checkNotUnderscore(t){t==="_"&&this.raise(x.UnexpectedReservedUnderscore,this.state.startLoc)}checkReservedType(t,e,i){vs.has(t)&&this.raise(i?x.AssignReservedType:x.UnexpectedReservedType,e,{reservedType:t})}flowParseRestrictedIdentifierName(t,e){return this.checkReservedType(this.state.value,this.state.startLoc,e),this.parseIdentifierName(t)}flowParseRestrictedIdentifier(t,e){let i=this.startNode(),r=this.flowParseRestrictedIdentifierName(t,e);return this.createIdentifier(i,r)}flowParseTypeAlias(t){return t.id=this.flowParseRestrictedIdentifier(!1,!0),this.scope.declareName(t.id.name,8201,t.id.start),this.match(43)?t.typeParameters=this.flowParseTypeParameterDeclaration():t.typeParameters=null,t.right=this.flowParseTypeInitialiser(25),this.semicolon(),this.finishNode(t,"TypeAlias")}flowParseOpaqueType(t,e){return this.expectContextual(126),t.id=this.flowParseRestrictedIdentifier(!0,!0),this.scope.declareName(t.id.name,8201,t.id.start),this.match(43)?t.typeParameters=this.flowParseTypeParameterDeclaration():t.typeParameters=null,t.supertype=null,this.match(10)&&(t.supertype=this.flowParseTypeInitialiser(10)),t.impltype=null,e||(t.impltype=this.flowParseTypeInitialiser(25)),this.semicolon(),this.finishNode(t,e?"DeclareOpaqueType":"OpaqueType")}flowParseTypeParameterBound(){if(this.match(10)||this.isContextual(77)){let t=this.startNode();return this.next(),t.typeAnnotation=this.flowParseType(),this.finishNode(t,"TypeAnnotation")}}flowParseTypeParameter(t=!1){let e=this.state.startLoc,i=this.startNode(),r=this.flowParseVariance();return i.name=this.flowParseRestrictedIdentifierName(),i.variance=r,i.bound=this.flowParseTypeParameterBound(),this.match(25)?(this.eat(25),i.default=this.flowParseType()):t&&this.raise(x.MissingTypeParamDefault,e),this.finishNode(i,"TypeParameter")}flowParseTypeParameterDeclaration(){let t=this.state.inType,e=this.startNode();e.params=[],this.state.inType=!0,this.match(43)||this.match(138)?this.next():this.unexpected();let i=!1;do{let r=this.flowParseTypeParameter(i);e.params.push(r),r.default&&(i=!0),this.match(44)||this.expect(8)}while(!this.match(44));return this.expect(44),this.state.inType=t,this.finishNode(e,"TypeParameterDeclaration")}flowInTopLevelContext(t){if(this.curContext()!==w.brace){let e=this.state.context;this.state.context=[e[0]];try{return t()}finally{this.state.context=e}}else return t()}flowParseTypeParameterInstantiationInExpression(){if(this.reScan_lt()===43)return this.flowParseTypeParameterInstantiation()}flowParseTypeParameterInstantiation(){let t=this.startNode(),e=this.state.inType;return this.state.inType=!0,t.params=[],this.flowInTopLevelContext(()=>{this.expect(43);let i=this.state.noAnonFunctionType;for(this.state.noAnonFunctionType=!1;!this.match(44);)t.params.push(this.flowParseType()),this.match(44)||this.expect(8);this.state.noAnonFunctionType=i}),this.state.inType=e,!this.state.inType&&this.curContext()===w.brace&&this.reScan_lt_gt(),this.expect(44),this.finishNode(t,"TypeParameterInstantiation")}flowParseTypeParameterInstantiationCallOrNew(){if(this.reScan_lt()!==43)return null;let t=this.startNode(),e=this.state.inType;for(t.params=[],this.state.inType=!0,this.expect(43);!this.match(44);)t.params.push(this.flowParseTypeOrImplicitInstantiation()),this.match(44)||this.expect(8);return this.expect(44),this.state.inType=e,this.finishNode(t,"TypeParameterInstantiation")}flowParseInterfaceType(){let t=this.startNode();if(this.expectContextual(125),t.extends=[],this.eat(77))do t.extends.push(this.flowParseInterfaceExtends());while(this.eat(8));return t.body=this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!1,allowProto:!1,allowInexact:!1}),this.finishNode(t,"InterfaceTypeAnnotation")}flowParseObjectPropertyKey(){return this.match(131)||this.match(130)?super.parseExprAtom():this.parseIdentifier(!0)}flowParseObjectTypeIndexer(t,e,i){return t.static=e,this.lookahead().type===10?(t.id=this.parseIdentifier(!0),t.key=this.flowParseTypeInitialiser()):(t.id=null,t.key=this.flowParseType()),this.expect(1),t.value=this.flowParseTypeInitialiser(),t.variance=i,this.finishNode(t,"ObjectTypeIndexer")}flowParseObjectTypeInternalSlot(t,e){return t.static=e,t.id=this.parseIdentifier(!0),this.expect(1),this.expect(1),this.match(43)||this.match(6)?(t.method=!0,t.optional=!1,t.value=this.flowParseObjectTypeMethodish(this.startNodeAtNode(t))):(t.method=!1,this.eat(13)&&(t.optional=!0),t.value=this.flowParseTypeInitialiser()),this.finishNode(t,"ObjectTypeInternalSlot")}flowParseObjectTypeMethodish(t){for(t.params=[],t.rest=null,t.typeParameters=null,t.this=null,this.match(43)&&(t.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(6),this.match(74)&&(t.this=this.flowParseFunctionTypeParam(!0),t.this.name=null,this.match(7)||this.expect(8));!this.match(7)&&!this.match(17);)t.params.push(this.flowParseFunctionTypeParam(!1)),this.match(7)||this.expect(8);return this.eat(17)&&(t.rest=this.flowParseFunctionTypeParam(!1)),this.expect(7),t.returnType=this.flowParseTypeInitialiser(),this.finishNode(t,"FunctionTypeAnnotation")}flowParseObjectTypeCallProperty(t,e){let i=this.startNode();return t.static=e,t.value=this.flowParseObjectTypeMethodish(i),this.finishNode(t,"ObjectTypeCallProperty")}flowParseObjectType({allowStatic:t,allowExact:e,allowSpread:i,allowProto:r,allowInexact:a}){let o=this.state.inType;this.state.inType=!0;let h=this.startNode();h.callProperties=[],h.properties=[],h.indexers=[],h.internalSlots=[];let l,p,u=!1;for(e&&this.match(3)?(this.expect(3),l=5,p=!0):(this.expect(2),l=4,p=!1),h.exact=p;!this.match(l);){let y=!1,P=null,E=null,N=this.startNode();if(r&&this.isContextual(114)){let I=this.lookahead();I.type!==10&&I.type!==13&&(this.next(),P=this.state.startLoc,t=!1)}if(t&&this.isContextual(102)){let I=this.lookahead();I.type!==10&&I.type!==13&&(this.next(),y=!0)}let C=this.flowParseVariance();if(this.eat(0))P!=null&&this.unexpected(P),this.eat(0)?(C&&this.unexpected(C.start),h.internalSlots.push(this.flowParseObjectTypeInternalSlot(N,y))):h.indexers.push(this.flowParseObjectTypeIndexer(N,y,C));else if(this.match(6)||this.match(43))P!=null&&this.unexpected(P),C&&this.unexpected(C.start),h.callProperties.push(this.flowParseObjectTypeCallProperty(N,y));else{let I="init";if(this.isContextual(95)||this.isContextual(100)){let Y=this.lookahead();Se(Y.type)&&(I=this.state.value,this.next())}let at=this.flowParseObjectTypeProperty(N,y,P,C,I,i,a??!p);at===null?(u=!0,E=this.state.lastTokStartLoc):h.properties.push(at)}this.flowObjectTypeSemicolon(),E&&!this.match(4)&&!this.match(5)&&this.raise(x.UnexpectedExplicitInexactInObject,E)}this.expect(l),i&&(h.inexact=u);let f=this.finishNode(h,"ObjectTypeAnnotation");return this.state.inType=o,f}flowParseObjectTypeProperty(t,e,i,r,a,o,h){if(this.eat(17))return this.match(8)||this.match(9)||this.match(4)||this.match(5)?(o?h||this.raise(x.InexactInsideExact,this.state.lastTokStartLoc):this.raise(x.InexactInsideNonObject,this.state.lastTokStartLoc),r&&this.raise(x.InexactVariance,r),null):(o||this.raise(x.UnexpectedSpreadType,this.state.lastTokStartLoc),i!=null&&this.unexpected(i),r&&this.raise(x.SpreadVariance,r),t.argument=this.flowParseType(),this.finishNode(t,"ObjectTypeSpreadProperty"));{t.key=this.flowParseObjectPropertyKey(),t.static=e,t.proto=i!=null,t.kind=a;let l=!1;return this.match(43)||this.match(6)?(t.method=!0,i!=null&&this.unexpected(i),r&&this.unexpected(r.start),t.value=this.flowParseObjectTypeMethodish(this.startNodeAtNode(t)),a==="get"||a==="set"?this.flowCheckGetterSetterParams(t):!e&&!o&&t.key.name==="constructor"&&t.value.this&&this.raise(x.ThisParamBannedInConstructor,t.value.this)):(a!=="init"&&this.unexpected(),t.method=!1,this.eat(13)&&(l=!0),t.value=this.flowParseTypeInitialiser(),t.variance=r),t.optional=l,this.finishNode(t,"ObjectTypeProperty")}}flowCheckGetterSetterParams(t){let e=t.kind==="get"?0:1,i=t.value,r=i.params.length+(i.rest?1:0);i.this&&this.raise(t.kind==="get"?x.GetterMayNotHaveThisParam:x.SetterMayNotHaveThisParam,i.this),r!==e&&this.raise(t.kind==="get"?c.BadGetterArity:c.BadSetterArity,t),t.kind==="set"&&i.rest&&this.raise(c.BadSetterRestParameter,t)}flowObjectTypeSemicolon(){!this.eat(9)&&!this.eat(8)&&!this.match(4)&&!this.match(5)&&this.unexpected()}flowParseQualifiedTypeIdentifier(t,e){t??=this.state.startLoc;let i=e||this.flowParseRestrictedIdentifier(!0);for(;this.eat(12);){let r=this.startNodeAt(t);r.qualification=i,r.id=this.flowParseRestrictedIdentifier(!0),i=this.finishNode(r,"QualifiedTypeIdentifier")}return i}flowParseGenericType(t,e){let i=this.startNodeAt(t);return i.typeParameters=null,i.id=this.flowParseQualifiedTypeIdentifier(t,e),this.match(43)&&(i.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(i,"GenericTypeAnnotation")}flowParseTypeofType(){let t=this.startNode();return this.expect(83),t.argument=this.flowParsePrimaryType(),this.finishNode(t,"TypeofTypeAnnotation")}flowParseTupleType(){let t=this.startNode();for(t.types=[],this.expect(0);this.state.pos<this.length&&!this.match(1)&&(t.types.push(this.flowParseType()),!this.match(1));)this.expect(8);return this.expect(1),this.finishNode(t,"TupleTypeAnnotation")}flowParseFunctionTypeParam(t){let e=null,i=!1,r,a=this.startNode(),o=this.lookahead(),h=this.state.type===74;return o.type===10||o.type===13?(h&&!t&&this.raise(x.ThisParamMustBeFirst,a),e=this.parseIdentifier(h),this.eat(13)&&(i=!0,h&&this.raise(x.ThisParamMayNotBeOptional,a)),r=this.flowParseTypeInitialiser()):r=this.flowParseType(),a.name=e,a.optional=i,a.typeAnnotation=r,this.finishNode(a,"FunctionTypeParam")}reinterpretTypeAsFunctionTypeParam(t){let e=this.startNodeAtNode(t);return e.name=null,e.optional=!1,e.typeAnnotation=t,this.finishNode(e,"FunctionTypeParam")}flowParseFunctionTypeParams(t=[]){let e=null,i=null;for(this.match(74)&&(i=this.flowParseFunctionTypeParam(!0),i.name=null,this.match(7)||this.expect(8));!this.match(7)&&!this.match(17);)t.push(this.flowParseFunctionTypeParam(!1)),this.match(7)||this.expect(8);return this.eat(17)&&(e=this.flowParseFunctionTypeParam(!1)),{params:t,rest:e,_this:i}}flowIdentToTypeAnnotation(t,e,i){switch(i.name){case"any":return this.finishNode(e,"AnyTypeAnnotation");case"bool":case"boolean":return this.finishNode(e,"BooleanTypeAnnotation");case"mixed":return this.finishNode(e,"MixedTypeAnnotation");case"empty":return this.finishNode(e,"EmptyTypeAnnotation");case"number":return this.finishNode(e,"NumberTypeAnnotation");case"string":return this.finishNode(e,"StringTypeAnnotation");case"symbol":return this.finishNode(e,"SymbolTypeAnnotation");default:return this.checkNotUnderscore(i.name),this.flowParseGenericType(t,i)}}flowParsePrimaryType(){let t=this.state.startLoc,e=this.startNode(),i,r,a=!1,o=this.state.noAnonFunctionType;switch(this.state.type){case 2:return this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!0,allowProto:!1,allowInexact:!0});case 3:return this.flowParseObjectType({allowStatic:!1,allowExact:!0,allowSpread:!0,allowProto:!1,allowInexact:!1});case 0:return this.state.noAnonFunctionType=!1,r=this.flowParseTupleType(),this.state.noAnonFunctionType=o,r;case 43:{let h=this.startNode();return h.typeParameters=this.flowParseTypeParameterDeclaration(),this.expect(6),i=this.flowParseFunctionTypeParams(),h.params=i.params,h.rest=i.rest,h.this=i._this,this.expect(7),this.expect(15),h.returnType=this.flowParseType(),this.finishNode(h,"FunctionTypeAnnotation")}case 6:{let h=this.startNode();if(this.next(),!this.match(7)&&!this.match(17))if(S(this.state.type)||this.match(74)){let l=this.lookahead().type;a=l!==13&&l!==10}else a=!0;if(a){if(this.state.noAnonFunctionType=!1,r=this.flowParseType(),this.state.noAnonFunctionType=o,this.state.noAnonFunctionType||!(this.match(8)||this.match(7)&&this.lookahead().type===15))return this.expect(7),r;this.eat(8)}return r?i=this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(r)]):i=this.flowParseFunctionTypeParams(),h.params=i.params,h.rest=i.rest,h.this=i._this,this.expect(7),this.expect(15),h.returnType=this.flowParseType(),h.typeParameters=null,this.finishNode(h,"FunctionTypeAnnotation")}case 130:return this.parseLiteral(this.state.value,"StringLiteralTypeAnnotation");case 81:case 82:return e.value=this.match(81),this.next(),this.finishNode(e,"BooleanLiteralTypeAnnotation");case 49:if(this.state.value==="-"){if(this.next(),this.match(131))return this.parseLiteralAtNode(-this.state.value,"NumberLiteralTypeAnnotation",e);if(this.match(132))return this.parseLiteralAtNode(-this.state.value,"BigIntLiteralTypeAnnotation",e);throw this.raise(x.UnexpectedSubtractionOperand,this.state.startLoc)}throw this.unexpected();case 131:return this.parseLiteral(this.state.value,"NumberLiteralTypeAnnotation");case 132:return this.parseLiteral(this.state.value,"BigIntLiteralTypeAnnotation");case 84:return this.next(),this.finishNode(e,"VoidTypeAnnotation");case 80:return this.next(),this.finishNode(e,"NullLiteralTypeAnnotation");case 74:return this.next(),this.finishNode(e,"ThisTypeAnnotation");case 51:return this.next(),this.finishNode(e,"ExistsTypeAnnotation");case 83:return this.flowParseTypeofType();default:if(ee(this.state.type)){let h=j(this.state.type);return this.next(),super.createIdentifier(e,h)}else if(S(this.state.type))return this.isContextual(125)?this.flowParseInterfaceType():this.flowIdentToTypeAnnotation(t,e,this.parseIdentifier())}throw this.unexpected()}flowParsePostfixType(){let t=this.state.startLoc,e=this.flowParsePrimaryType(),i=!1;for(;(this.match(0)||this.match(14))&&!this.canInsertSemicolon();){let r=this.startNodeAt(t),a=this.eat(14);i=i||a,this.expect(0),!a&&this.match(1)?(r.elementType=e,this.next(),e=this.finishNode(r,"ArrayTypeAnnotation")):(r.objectType=e,r.indexType=this.flowParseType(),this.expect(1),i?(r.optional=a,e=this.finishNode(r,"OptionalIndexedAccessType")):e=this.finishNode(r,"IndexedAccessType"))}return e}flowParsePrefixType(){let t=this.startNode();return this.eat(13)?(t.typeAnnotation=this.flowParsePrefixType(),this.finishNode(t,"NullableTypeAnnotation")):this.flowParsePostfixType()}flowParseAnonFunctionWithoutParens(){let t=this.flowParsePrefixType();if(!this.state.noAnonFunctionType&&this.eat(15)){let e=this.startNodeAtNode(t);return e.params=[this.reinterpretTypeAsFunctionTypeParam(t)],e.rest=null,e.this=null,e.returnType=this.flowParseType(),e.typeParameters=null,this.finishNode(e,"FunctionTypeAnnotation")}return t}flowParseIntersectionType(){let t=this.startNode();this.eat(41);let e=this.flowParseAnonFunctionWithoutParens();for(t.types=[e];this.eat(41);)t.types.push(this.flowParseAnonFunctionWithoutParens());return t.types.length===1?e:this.finishNode(t,"IntersectionTypeAnnotation")}flowParseUnionType(){let t=this.startNode();this.eat(39);let e=this.flowParseIntersectionType();for(t.types=[e];this.eat(39);)t.types.push(this.flowParseIntersectionType());return t.types.length===1?e:this.finishNode(t,"UnionTypeAnnotation")}flowParseType(){let t=this.state.inType;this.state.inType=!0;let e=this.flowParseUnionType();return this.state.inType=t,e}flowParseTypeOrImplicitInstantiation(){if(this.state.type===128&&this.state.value==="_"){let t=this.state.startLoc,e=this.parseIdentifier();return this.flowParseGenericType(t,e)}else return this.flowParseType()}flowParseTypeAnnotation(){let t=this.startNode();return t.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(t,"TypeAnnotation")}flowParseTypeAnnotatableIdentifier(){let t=this.startNode(),e=this.parseIdentifierName();return this.match(10)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),this.createIdentifier(t,e)}typeCastToParameter(t){return t.expression.typeAnnotation=t.typeAnnotation,this.resetEndLocationFromNode(t.expression,t.typeAnnotation),t.expression}flowParseVariance(){let t=null;return this.match(49)?(t=this.startNode(),this.state.value==="+"?t.kind="plus":t.kind="minus",this.next(),this.finishNode(t,"Variance")):t}parseFunctionBody(t,e,i=!1){if(e){this.forwardNoArrowParamsConversionAt(t,()=>super.parseFunctionBody(t,!0,i));return}super.parseFunctionBody(t,!1,i)}parseFunctionBodyAndFinish(t,e,i=!1){if(this.match(10)){let r=this.startNode();e==="FunctionDeclaration"||e==="FunctionExpression"||e==="ArrowFunctionExpression"?[r.typeAnnotation,t.predicate]=this.flowParseTypeAndPredicateInitialiser(!0):r.typeAnnotation=this.flowParseTypeInitialiser(),t.returnType=r.typeAnnotation?this.finishNode(r,"TypeAnnotation"):null}return super.parseFunctionBodyAndFinish(t,e,i)}parseStatementLike(t){if(this.state.strict&&this.isContextual(125)){let i=this.lookahead();if(O(i.type)){let r=this.startNode();return this.next(),this.flowParseInterface(r)}}else if(this.isContextual(122)){let i=this.startNode();return this.next(),this.flowParseEnumDeclaration(i)}let e=super.parseStatementLike(t);return this.flowPragma===void 0&&!this.isValidDirective(e)&&(this.flowPragma=null),e}parseExpressionStatement(t,e,i){if(e.type==="Identifier"){if(e.name==="declare"){if(this.match(76)||S(this.state.type)||this.match(64)||this.match(70)||this.match(78))return this.flowParseDeclare(t)}else if(S(this.state.type)){if(e.name==="interface")return this.flowParseInterface(t);if(e.name==="type")return this.flowParseTypeAlias(t);if(e.name==="opaque")return this.flowParseOpaqueType(t,!1)}}return super.parseExpressionStatement(t,e,i)}shouldParseExportDeclaration(){let{type:t}=this.state;return t===122||he(t)?!this.state.containsEsc:super.shouldParseExportDeclaration()}isExportDefaultSpecifier(){let{type:t}=this.state;return t===122||he(t)?this.state.containsEsc:super.isExportDefaultSpecifier()}parseExportDefaultExpression(){if(this.isContextual(122)){let t=this.startNode();return this.next(),this.flowParseEnumDeclaration(t)}return super.parseExportDefaultExpression()}parseConditional(t,e,i){if(!this.match(13))return t;if(i!=null){let y=this.lookaheadCharCode();if(y===44||y===61||y===58||y===41)return this.setOptionalParametersError(i),t}this.expect(13);let r=this.state.clone(),a=this.state.noArrowAt,o=this.startNodeAt(e),{consequent:h,failed:l}=this.tryParseConditionalConsequent(),p=this.getArrowLikeExpressions(h),u=p[0],f=p[1];if(l||f.length>0){let y=[...a];if(f.length>0){this.state=r,this.state.noArrowAt=y;for(let P=0;P<f.length;P++)y.push(f[P].start);({consequent:h,failed:l}=this.tryParseConditionalConsequent()),[u]=this.getArrowLikeExpressions(h)}l&&u.length>1&&this.raise(x.AmbiguousConditionalArrow,r.startLoc),l&&u.length===1&&(this.state=r,y.push(u[0].start),this.state.noArrowAt=y,{consequent:h}=this.tryParseConditionalConsequent())}return this.getArrowLikeExpressions(h,!0),this.state.noArrowAt=a,this.expect(10),o.test=t,o.consequent=h,o.alternate=this.forwardNoArrowParamsConversionAt(o,()=>this.parseMaybeAssign(void 0,void 0)),this.finishNode(o,"ConditionalExpression")}tryParseConditionalConsequent(){this.state.noArrowParamsConversionAt.push(this.state.start);let t=this.parseMaybeAssignAllowIn(),e=!this.match(10);return this.state.noArrowParamsConversionAt.pop(),{consequent:t,failed:e}}getArrowLikeExpressions(t,e){let i=[t],r=[];for(;i.length!==0;){let a=i.pop();a.type==="ArrowFunctionExpression"&&a.body.type!=="BlockStatement"?(a.typeParameters||!a.returnType?this.finishArrowValidation(a):r.push(a),i.push(a.body)):a.type==="ConditionalExpression"&&(i.push(a.consequent),i.push(a.alternate))}return e?(r.forEach(a=>this.finishArrowValidation(a)),[r,[]]):Os(r,a=>a.params.every(o=>this.isAssignable(o,!0)))}finishArrowValidation(t){this.toAssignableList(t.params,t.extra?.trailingCommaLoc,!1),this.scope.enter(518),super.checkParams(t,!1,!0),this.scope.exit()}forwardNoArrowParamsConversionAt(t,e){let i;return this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(t.start))?(this.state.noArrowParamsConversionAt.push(this.state.start),i=e(),this.state.noArrowParamsConversionAt.pop()):i=e(),i}parseParenItem(t,e){let i=super.parseParenItem(t,e);if(this.eat(13)&&(i.optional=!0,this.resetEndLocation(t)),this.match(10)){let r=this.startNodeAt(e);return r.expression=i,r.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(r,"TypeCastExpression")}return i}assertModuleNodeAllowed(t){t.type==="ImportDeclaration"&&(t.importKind==="type"||t.importKind==="typeof")||t.type==="ExportNamedDeclaration"&&t.exportKind==="type"||t.type==="ExportAllDeclaration"&&t.exportKind==="type"||super.assertModuleNodeAllowed(t)}parseExportDeclaration(t){if(this.isContextual(126)){t.exportKind="type";let e=this.startNode();return this.next(),this.match(2)?(t.specifiers=this.parseExportSpecifiers(!0),super.parseExportFrom(t),null):this.flowParseTypeAlias(e)}else if(this.isContextual(127)){t.exportKind="type";let e=this.startNode();return this.next(),this.flowParseOpaqueType(e,!1)}else if(this.isContextual(125)){t.exportKind="type";let e=this.startNode();return this.next(),this.flowParseInterface(e)}else if(this.isContextual(122)){t.exportKind="value";let e=this.startNode();return this.next(),this.flowParseEnumDeclaration(e)}else return super.parseExportDeclaration(t)}eatExportStar(t){return super.eatExportStar(t)?!0:this.isContextual(126)&&this.lookahead().type===51?(t.exportKind="type",this.next(),this.next(),!0):!1}maybeParseExportNamespaceSpecifier(t){let{startLoc:e}=this.state,i=super.maybeParseExportNamespaceSpecifier(t);return i&&t.exportKind==="type"&&this.unexpected(e),i}parseClassId(t,e,i){if((!e||i)&&this.isContextual(109)){t.id=null;return}super.parseClassId(t,e,i),this.match(43)&&(t.typeParameters=this.flowParseTypeParameterDeclaration())}parseClassMember(t,e,i){let{startLoc:r}=this.state;if(this.isContextual(121)){if(super.parseClassMemberFromModifier(t,e))return;e.declare=!0}super.parseClassMember(t,e,i),e.declare&&(e.type!=="ClassProperty"&&e.type!=="ClassPrivateProperty"&&e.type!=="PropertyDefinition"?this.raise(x.DeclareClassElement,r):e.value&&this.raise(x.DeclareClassFieldInitializer,e.value))}isIterator(t){return t==="iterator"||t==="asyncIterator"}readIterator(){let t=super.readWord1(),e="@@"+t;(!this.isIterator(t)||!this.state.inType)&&this.raise(c.InvalidIdentifier,this.state.curPosition(),{identifierName:e}),this.finishToken(128,e)}getTokenFromCode(t){let e=this.input.charCodeAt(this.state.pos+1);t===123&&e===124?this.finishOp(3,2):this.state.inType&&(t===62||t===60)?this.finishOp(t===62?44:43,1):this.state.inType&&t===63?e===46?this.finishOp(14,2):this.finishOp(13,1):Es(t,e,this.input.charCodeAt(this.state.pos+2))?(this.state.pos+=2,this.readIterator()):super.getTokenFromCode(t)}isAssignable(t,e){return t.type==="TypeCastExpression"?this.isAssignable(t.expression,e):super.isAssignable(t,e)}toAssignable(t,e=!1){!e&&t.type==="AssignmentExpression"&&t.left.type==="TypeCastExpression"&&(t.left=this.typeCastToParameter(t.left)),super.toAssignable(t,e)}toAssignableListItem(t,e,i){let r=t[e];r.type==="TypeCastExpression"&&(t[e]=this.typeCastToParameter(r)),super.toAssignableListItem(t,e,i)}toReferencedList(t,e){for(let i=0;i<t.length;i++){let r=t[i];r?.type==="TypeCastExpression"&&!r.extra?.parenthesized&&(t.length>1||!e)&&this.raise(x.TypeCastInPattern,r.typeAnnotation)}return t}parseArrayLike(t,e){let i=super.parseArrayLike(t,e);return i.type==="ArrayExpression"&&this.toReferencedList(i.elements),i}isValidLVal(t,e,i,r){return t==="TypeCastExpression"||super.isValidLVal(t,e,i,r)}parseClassProperty(t){return this.match(10)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassProperty(t)}parseClassPrivateProperty(t){return this.match(10)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassPrivateProperty(t)}isClassMethod(){return this.match(43)||super.isClassMethod()}isClassProperty(){return this.match(10)||super.isClassProperty()}isNonstaticConstructor(t){return!this.match(10)&&super.isNonstaticConstructor(t)}pushClassMethod(t,e,i,r,a,o){if(e.variance&&this.unexpected(e.variance.start),delete e.variance,this.match(43)&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassMethod(t,e,i,r,a,o),e.params&&a){let h=e.params;h.length>0&&this.isThisParam(h[0])&&this.raise(x.ThisParamBannedInConstructor,e)}else if(e.type==="MethodDefinition"&&a&&e.value.params){let h=e.value.params;h.length>0&&this.isThisParam(h[0])&&this.raise(x.ThisParamBannedInConstructor,e)}}pushClassPrivateMethod(t,e,i,r){e.variance&&this.unexpected(e.variance.start),delete e.variance,this.match(43)&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassPrivateMethod(t,e,i,r)}flowParseClassImplements(){let t=this.startNode();return t.id=this.flowParseRestrictedIdentifier(!0),this.match(43)?t.typeParameters=this.flowParseTypeParameterInstantiation():t.typeParameters=null,this.finishNode(t,"ClassImplements")}parseClassSuper(t){if(super.parseClassSuper(t),t.superClass&&(this.match(43)||this.match(47))&&(t.superTypeArguments=this.flowParseTypeParameterInstantiationInExpression()),this.eatContextual(109)){let e=t.implements=[];do e.push(this.flowParseClassImplements());while(this.eat(8))}}checkGetterSetterParams(t){super.checkGetterSetterParams(t);let e=this.getObjectOrClassMethodParams(t);if(e.length>0){let i=e[0];this.isThisParam(i)&&t.kind==="get"?this.raise(x.GetterMayNotHaveThisParam,i):this.isThisParam(i)&&this.raise(x.SetterMayNotHaveThisParam,i)}}parsePropertyNamePrefixOperator(t){t.variance=this.flowParseVariance()}parseObjPropValue(t,e,i,r,a,o,h){t.variance&&this.unexpected(t.variance.start),delete t.variance;let l;this.match(43)&&!o&&(l=this.flowParseTypeParameterDeclaration(),this.match(6)||this.unexpected());let p=super.parseObjPropValue(t,e,i,r,a,o,h);return l&&((p.value||p).typeParameters=l),p}parseFunctionParamType(t){return this.eat(13)&&(t.type!=="Identifier"&&this.raise(x.PatternIsOptional,t),this.isThisParam(t)&&this.raise(x.ThisParamMayNotBeOptional,t),t.optional=!0),this.match(10)?t.typeAnnotation=this.flowParseTypeAnnotation():this.isThisParam(t)&&this.raise(x.ThisParamAnnotationRequired,t),this.match(25)&&this.isThisParam(t)&&this.raise(x.ThisParamNoDefault,t),this.resetEndLocation(t),t}parseMaybeDefault(t,e){let i=super.parseMaybeDefault(t,e);return i.type==="AssignmentPattern"&&i.typeAnnotation&&i.right.start<i.typeAnnotation.start&&this.raise(x.TypeBeforeInitializer,i.typeAnnotation),i}parseImportSpecifierLocal(t,e,i){e.local=ue(t)?this.flowParseRestrictedIdentifier(!0,!0):this.parseIdentifier(),t.specifiers.push(this.finishImportSpecifier(e,i))}isPotentialImportPhase(t){if(super.isPotentialImportPhase(t))return!0;if(this.isContextual(126)){if(!t)return!0;let e=this.lookaheadCharCode();return e===123||e===42}return!t&&this.isContextual(83)}applyImportPhase(t,e,i,r){if(super.applyImportPhase(t,e,i,r),e){if(!i&&this.match(61))return;t.exportKind=i==="type"?i:"value"}else i==="type"&&this.match(51)&&this.unexpected(),t.importKind=i==="type"||i==="typeof"?i:"value"}parseImportSpecifier(t,e,i,r,a){let o=t.imported,h=null;o.type==="Identifier"&&(o.name==="type"?h="type":o.name==="typeof"&&(h="typeof"));let l=!1;if(this.isContextual(89)&&!this.isLookaheadContextual("as")){let u=this.parseIdentifier(!0);h!==null&&!O(this.state.type)?(t.imported=u,t.importKind=h,t.local=this.cloneIdentifier(u)):(t.imported=o,t.importKind=null,t.local=this.parseIdentifier())}else{if(h!==null&&O(this.state.type))t.imported=this.parseIdentifier(!0),t.importKind=h;else{if(e)throw this.raise(c.ImportBindingIsString,t,{importName:o.value});t.imported=o,t.importKind=null}this.eatContextual(89)?t.local=this.parseIdentifier():(l=!0,t.local=this.cloneIdentifier(t.imported))}let p=ue(t);return i&&p&&this.raise(x.ImportTypeShorthandOnlyInPureImport,t),(i||p)&&this.checkReservedType(t.local.name,t.local.start,!0),l&&!i&&!p&&this.checkReservedWord(t.local.name,t.start,!0,!0),this.finishImportSpecifier(t,"ImportSpecifier")}parseBindingAtom(){return this.state.type===74?this.parseIdentifier(!0):super.parseBindingAtom()}parseFunctionParams(t,e){let i=t.kind;i!=="get"&&i!=="set"&&this.match(43)&&(t.typeParameters=this.flowParseTypeParameterDeclaration()),super.parseFunctionParams(t,e)}parseVarId(t,e){super.parseVarId(t,e),this.match(10)&&(t.id.typeAnnotation=this.flowParseTypeAnnotation(),this.resetEndLocation(t.id))}parseAsyncArrowFromCallExpression(t,e){if(this.match(10)){let i=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0,t.returnType=this.flowParseTypeAnnotation(),this.state.noAnonFunctionType=i}return super.parseAsyncArrowFromCallExpression(t,e)}shouldParseAsyncArrow(){return this.match(10)||super.shouldParseAsyncArrow()}parseMaybeAssign(t,e){let i=null,r;if(this.hasPlugin("jsx")&&(this.match(138)||this.match(43))){if(i=this.state.clone(),r=this.tryParse(()=>super.parseMaybeAssign(t,e),i),!r.error)return r.node;let{context:a}=this.state,o=a[a.length-1];(o===w.j_oTag||o===w.j_expr)&&a.pop()}if(r?.error||this.match(43)){i=i||this.state.clone();let a,o=this.tryParse(l=>{a=this.flowParseTypeParameterDeclaration();let p=this.forwardNoArrowParamsConversionAt(a,()=>{let f=super.parseMaybeAssign(t,e);return this.resetStartLocationFromNode(f,a),f});p.extra?.parenthesized&&l();let u=this.maybeUnwrapTypeCastExpression(p);return u.type!=="ArrowFunctionExpression"&&l(),u.typeParameters=a,this.resetStartLocationFromNode(u,a),p},i),h=null;if(o.node&&this.maybeUnwrapTypeCastExpression(o.node).type==="ArrowFunctionExpression"){if(!o.error&&!o.aborted)return o.node.async&&this.raise(x.UnexpectedTypeParameterBeforeAsyncArrowFunction,a),o.node;h=o.node}if(r?.node)return this.state=r.failState,r.node;if(h)return this.state=o.failState,h;throw r?.thrown?r.error:o.thrown?o.error:this.raise(x.UnexpectedTokenAfterTypeParameter,a)}return super.parseMaybeAssign(t,e)}parseArrow(t){if(this.match(10)){let e=this.tryParse(()=>{let i=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0;let r=this.startNode();return[r.typeAnnotation,t.predicate]=this.flowParseTypeAndPredicateInitialiser(!0),this.state.noAnonFunctionType=i,this.canInsertSemicolon()&&this.unexpected(),this.match(15)||this.unexpected(),r});if(e.thrown)return null;e.error&&(this.state=e.failState),t.returnType=e.node.typeAnnotation?this.finishNode(e.node,"TypeAnnotation"):null}return super.parseArrow(t)}shouldParseArrow(t){return this.match(10)||super.shouldParseArrow(t)}setArrowFunctionParameters(t,e){this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(t.start))?t.params=e:super.setArrowFunctionParameters(t,e)}checkParams(t,e,i,r=!0){if(!(i&&this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(t.start)))){for(let a=0;a<t.params.length;a++)this.isThisParam(t.params[a])&&a>0&&this.raise(x.ThisParamMustBeFirst,t.params[a]);super.checkParams(t,e,i,r)}}parseParenAndDistinguishExpression(t){return super.parseParenAndDistinguishExpression(t&&!this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)))}parseSubscripts(t,e,i){if(t.type==="Identifier"&&t.name==="async"&&this.state.noArrowAt.includes(e.index)){this.next();let r=this.startNodeAt(e);r.callee=t,r.arguments=super.parseCallExpressionArguments(),t=this.finishNode(r,"CallExpression")}else if(t.type==="Identifier"&&t.name==="async"&&this.match(43)){let r=this.state.clone(),a=this.tryParse(h=>this.parseAsyncArrowWithTypeParameters(e)||h(),r);if(!a.error&&!a.aborted)return a.node;let o=this.tryParse(()=>super.parseSubscripts(t,e,i),r);if(o.node&&!o.error)return o.node;if(a.node)return this.state=a.failState,a.node;if(o.node)return this.state=o.failState,o.node;throw a.error||o.error}return super.parseSubscripts(t,e,i)}parseSubscript(t,e,i,r){if(this.match(14)&&this.isLookaheadToken_lt()){if(r.optionalChainMember=!0,i)return r.stop=!0,t;this.next();let a=this.startNodeAt(e);return a.callee=t,a.typeArguments=this.flowParseTypeParameterInstantiationInExpression(),this.expect(6),a.arguments=this.parseCallExpressionArguments(),a.optional=!0,this.finishCallExpression(a,!0)}else if(!i&&this.shouldParseTypes()&&(this.match(43)||this.match(47))){let a=this.startNodeAt(e);a.callee=t;let o=this.tryParse(()=>(a.typeArguments=this.flowParseTypeParameterInstantiationCallOrNew(),this.expect(6),a.arguments=super.parseCallExpressionArguments(),r.optionalChainMember&&(a.optional=!1),this.finishCallExpression(a,r.optionalChainMember)));if(o.node)return o.error&&(this.state=o.failState),o.node}return super.parseSubscript(t,e,i,r)}parseNewCallee(t){super.parseNewCallee(t);let e=null;this.shouldParseTypes()&&this.match(43)&&(e=this.tryParse(()=>this.flowParseTypeParameterInstantiationCallOrNew()).node),t.typeArguments=e}parseAsyncArrowWithTypeParameters(t){let e=this.startNodeAt(t);if(this.parseFunctionParams(e,!1),!!this.parseArrow(e))return super.parseArrowExpression(e,void 0,!0)}readToken_mult_modulo(t){let e=this.input.charCodeAt(this.state.pos+1);if(t===42&&e===47&&this.state.hasFlowComment){this.state.hasFlowComment=!1,this.state.pos+=2,this.nextToken();return}super.readToken_mult_modulo(t)}readToken_pipe_amp(t){let e=this.input.charCodeAt(this.state.pos+1);if(t===124&&e===125){this.finishOp(5,2);return}super.readToken_pipe_amp(t)}parseTopLevel(t,e){let i=super.parseTopLevel(t,e);return this.state.hasFlowComment&&this.raise(x.UnterminatedFlowComment,this.state.curPosition()),i}skipBlockComment(){if(this.hasPlugin("flowComments")&&this.skipFlowComment()){if(this.state.hasFlowComment)throw this.raise(x.NestedFlowComment,this.state.startLoc);this.hasFlowCommentCompletion();let t=this.skipFlowComment();t&&(this.state.pos+=t,this.state.hasFlowComment=!0);return}return super.skipBlockComment(this.state.hasFlowComment?"*-/":"*/")}skipFlowComment(){let{pos:t}=this.state,e=2;for(;[32,9].includes(this.input.charCodeAt(t+e));)e++;let i=this.input.charCodeAt(e+t),r=this.input.charCodeAt(e+t+1);return i===58&&r===58?e+2:this.input.slice(e+t,e+t+12)==="flow-include"?e+12:i===58&&r!==58?e:!1}hasFlowCommentCompletion(){if(this.input.indexOf("*/",this.state.pos)===-1)throw this.raise(c.UnterminatedComment,this.state.curPosition())}flowEnumErrorBooleanMemberNotInitialized(t,e){this.raise(x.EnumBooleanMemberNotInitialized,t,e)}flowEnumErrorInvalidMemberInitializer(t,e){return this.raise(e.explicitType?e.explicitType==="symbol"?x.EnumInvalidMemberInitializerSymbolType:x.EnumInvalidMemberInitializerPrimaryType:x.EnumInvalidMemberInitializerUnknownType,t,e)}flowEnumErrorNumberMemberNotInitialized(t,e){this.raise(x.EnumNumberMemberNotInitialized,t,e)}flowEnumErrorStringMemberInconsistentlyInitialized(t,e){this.raise(x.EnumStringMemberInconsistentlyInitialized,t,e)}flowEnumMemberInit(){let t=this.state.startLoc,e=()=>this.match(8)||this.match(4);switch(this.state.type){case 131:{let i=this.parseNumericLiteral(this.state.value);if(e())return{type:"number",loc:i.start,value:i};break}case 130:{let i=this.parseStringLiteral(this.state.value);if(e())return{type:"string",loc:i.start,value:i};break}case 81:case 82:{let i=this.parseBooleanLiteral(this.match(81));if(e())return{type:"boolean",loc:i.start,value:i}}}return{type:"invalid",loc:t}}flowEnumMemberRaw(){let t=this.state.startLoc,e=this.parseIdentifier(!0),i=this.eat(25)?this.flowEnumMemberInit():{type:"none",loc:t};return{id:e,init:i}}flowEnumCheckExplicitTypeMismatch(t,e,i){let{explicitType:r}=e;r!==null&&r!==i&&this.flowEnumErrorInvalidMemberInitializer(t,e)}flowEnumMembers({enumName:t,explicitType:e}){let i=new Set,r={booleanMembers:[],numberMembers:[],stringMembers:[],defaultedMembers:[]},a=!1;for(;!this.match(4);){if(this.eat(17)){a=!0;break}let o=this.startNode(),{id:h,init:l}=this.flowEnumMemberRaw(),p=h.name;if(p==="")continue;/^[a-z]/.test(p)&&this.raise(x.EnumInvalidMemberName,h,{memberName:p,suggestion:p[0].toUpperCase()+p.slice(1),enumName:t}),i.has(p)&&this.raise(x.EnumDuplicateMemberName,h,{memberName:p,enumName:t}),i.add(p);let u={enumName:t,explicitType:e,memberName:p};switch(o.id=h,l.type){case"boolean":{this.flowEnumCheckExplicitTypeMismatch(l.loc,u,"boolean"),o.init=l.value,r.booleanMembers.push(this.finishNode(o,"EnumBooleanMember"));break}case"number":{this.flowEnumCheckExplicitTypeMismatch(l.loc,u,"number"),o.init=l.value,r.numberMembers.push(this.finishNode(o,"EnumNumberMember"));break}case"string":{this.flowEnumCheckExplicitTypeMismatch(l.loc,u,"string"),o.init=l.value,r.stringMembers.push(this.finishNode(o,"EnumStringMember"));break}case"invalid":throw this.flowEnumErrorInvalidMemberInitializer(l.loc,u);case"none":switch(e){case"boolean":this.flowEnumErrorBooleanMemberNotInitialized(l.loc,u);break;case"number":this.flowEnumErrorNumberMemberNotInitialized(l.loc,u);break;default:r.defaultedMembers.push(this.finishNode(o,"EnumDefaultedMember"))}}this.match(4)||this.expect(8)}return{members:r,hasUnknownMembers:a}}flowEnumStringMembers(t,e,{enumName:i}){if(t.length===0)return e;if(e.length===0)return t;if(e.length>t.length){for(let r of t)this.flowEnumErrorStringMemberInconsistentlyInitialized(r,{enumName:i});return e}else{for(let r of e)this.flowEnumErrorStringMemberInconsistentlyInitialized(r,{enumName:i});return t}}flowEnumParseExplicitType({enumName:t}){if(!this.eatContextual(98))return null;if(!S(this.state.type))throw this.raise(x.EnumInvalidExplicitTypeUnknownSupplied,this.state.startLoc,{enumName:t});let{value:e}=this.state;return this.next(),e!=="boolean"&&e!=="number"&&e!=="string"&&e!=="symbol"&&this.raise(x.EnumInvalidExplicitType,this.state.startLoc,{enumName:t,invalidEnumType:e}),e}flowEnumBody(t,e){let i=e.name,r=e.start,a=this.flowEnumParseExplicitType({enumName:i});this.expect(2);let{members:o,hasUnknownMembers:h}=this.flowEnumMembers({enumName:i,explicitType:a});switch(t.hasUnknownMembers=h,a){case"boolean":return t.explicitType=!0,t.members=o.booleanMembers,this.expect(4),this.finishNode(t,"EnumBooleanBody");case"number":return t.explicitType=!0,t.members=o.numberMembers,this.expect(4),this.finishNode(t,"EnumNumberBody");case"string":return t.explicitType=!0,t.members=this.flowEnumStringMembers(o.stringMembers,o.defaultedMembers,{enumName:i}),this.expect(4),this.finishNode(t,"EnumStringBody");case"symbol":return t.members=o.defaultedMembers,this.expect(4),this.finishNode(t,"EnumSymbolBody");default:{let l=()=>(t.members=[],this.expect(4),this.finishNode(t,"EnumStringBody"));t.explicitType=!1;let p=o.booleanMembers.length,u=o.numberMembers.length,f=o.stringMembers.length,y=o.defaultedMembers.length;if(!p&&!u&&!f&&!y)return l();if(!p&&!u)return t.members=this.flowEnumStringMembers(o.stringMembers,o.defaultedMembers,{enumName:i}),this.expect(4),this.finishNode(t,"EnumStringBody");if(!u&&!f&&p>=y){for(let P of o.defaultedMembers)this.flowEnumErrorBooleanMemberNotInitialized(P.start,{enumName:i,memberName:P.id.name});return t.members=o.booleanMembers,this.expect(4),this.finishNode(t,"EnumBooleanBody")}else if(!p&&!f&&u>=y){for(let P of o.defaultedMembers)this.flowEnumErrorNumberMemberNotInitialized(P.start,{enumName:i,memberName:P.id.name});return t.members=o.numberMembers,this.expect(4),this.finishNode(t,"EnumNumberBody")}else return this.raise(x.EnumInconsistentMemberValues,r,{enumName:i}),l()}}}flowParseEnumDeclaration(t){let e=this.parseIdentifier();return t.id=e,t.body=this.flowEnumBody(this.startNode(),e),this.finishNode(t,"EnumDeclaration")}jsxParseOpeningElementAfterName(t){return this.shouldParseTypes()&&(this.match(43)||this.match(47))&&(t.typeArguments=this.flowParseTypeParameterInstantiationInExpression()),super.jsxParseOpeningElementAfterName(t)}isLookaheadToken_lt(){let t=this.nextTokenStart();if(this.input.charCodeAt(t)===60){let e=this.input.charCodeAt(t+1);return e!==60&&e!==61}return!1}reScan_lt_gt(){let{type:t}=this.state;t===43?(this.state.pos-=1,this.readToken_lt()):t===44&&(this.state.pos-=1,this.readToken_gt())}reScan_lt(){let{type:t}=this.state;return t===47?(this.state.pos-=2,this.finishOp(43,1),43):t}maybeUnwrapTypeCastExpression(t){return t.type==="TypeCastExpression"?t.expression:t}},Rs={__proto__:null,quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",fnof:"\u0192",circ:"\u02C6",tilde:"\u02DC",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",bull:"\u2022",hellip:"\u2026",permil:"\u2030",prime:"\u2032",Prime:"\u2033",lsaquo:"\u2039",rsaquo:"\u203A",oline:"\u203E",frasl:"\u2044",euro:"\u20AC",image:"\u2111",weierp:"\u2118",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666"},Us=/\r\n|[\r\n\u2028\u2029]/,nt=new RegExp(Us.source,"g");function W(n){switch(n){case 10:case 13:case 8232:case 8233:return!0;default:return!1}}function fe(n,s,t){for(let e=s;e<t;e++)if(W(n.charCodeAt(e)))return!0;return!1}var Tt=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,At=/(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;function _s(n){switch(n){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!0;default:return!1}}var js={AttributeIsEmpty:"JSX attributes must only be assigned a non-empty expression.",MissingClosingTagElement:({openingTagName:n})=>`Expected corresponding JSX closing tag for <${n}>.`,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:n,HTMLEntity:s})=>`Unexpected token \`${n}\`. Did you mean \`${s}\` or \`{'${n}'}\`?`,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 <>...</>?"},B=M`jsx`(js);function U(n){return n?n.type==="JSXOpeningFragment"||n.type==="JSXClosingFragment":!1}function K(n){if(n.type==="JSXIdentifier")return n.name;if(n.type==="JSXNamespacedName")return n.namespace.name+":"+n.name.name;if(n.type==="JSXMemberExpression")return K(n.object)+"."+K(n.property);throw new Error("Node had unexpected type: "+n.type)}var zs=n=>class extends n{jsxReadToken(){let t="",e=this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(B.UnterminatedJsxContent,this.state.startLoc);let i=this.input.charCodeAt(this.state.pos);switch(i){case 60:case 123:if(this.state.pos===this.state.start){i===60&&this.state.canStartJSXElement?(++this.state.pos,this.finishToken(138)):super.getTokenFromCode(i);return}t+=this.input.slice(e,this.state.pos),this.finishToken(137,t);return;case 38:t+=this.input.slice(e,this.state.pos),t+=this.jsxReadEntity(),e=this.state.pos;break;case 62:case 125:this.raise(B.UnexpectedToken,this.state.curPosition(),{unexpected:this.input[this.state.pos],HTMLEntity:i===125?"&rbrace;":"&gt;"});default:W(i)?(t+=this.input.slice(e,this.state.pos),t+=this.jsxReadNewLine(!0),e=this.state.pos):++this.state.pos}}}jsxReadNewLine(t){let e=this.input.charCodeAt(this.state.pos),i;return++this.state.pos,e===13&&this.input.charCodeAt(this.state.pos)===10?(++this.state.pos,i=t?`
7
+ `:`\r
8
+ `):i=String.fromCharCode(e),++this.state.curLine,this.state.lineStart=this.state.pos,i}jsxReadString(t){let e="",i=++this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(c.UnterminatedString,this.state.startLoc);let r=this.input.charCodeAt(this.state.pos);if(r===t)break;r===38?(e+=this.input.slice(i,this.state.pos),e+=this.jsxReadEntity(),i=this.state.pos):W(r)?(e+=this.input.slice(i,this.state.pos),e+=this.jsxReadNewLine(!1),i=this.state.pos):++this.state.pos}e+=this.input.slice(i,this.state.pos++),this.finishToken(130,e)}jsxReadEntity(){let t=++this.state.pos;if(this.codePointAtPos(this.state.pos)===35){++this.state.pos;let e=10;this.codePointAtPos(this.state.pos)===120&&(e=16,++this.state.pos);let i=this.readInt(e,void 0,!1,"bail");if(i!==null&&this.codePointAtPos(this.state.pos)===59)return++this.state.pos,String.fromCodePoint(i)}else{let e=0,i=!1;for(;e++<10&&this.state.pos<this.length&&!(i=this.codePointAtPos(this.state.pos)===59);)++this.state.pos;if(i){let r=this.input.slice(t,this.state.pos),a=Rs[r];if(++this.state.pos,a)return a}}return this.state.pos=t,"&"}jsxReadWord(){let t,e=this.state.pos;do t=this.input.charCodeAt(++this.state.pos);while($(t)||t===45);this.finishToken(136,this.input.slice(e,this.state.pos))}jsxParseIdentifier(){let t=this.startNode();return this.match(136)?t.name=this.state.value:ee(this.state.type)?t.name=j(this.state.type):this.unexpected(),this.next(),this.finishNode(t,"JSXIdentifier")}jsxParseNamespacedName(){let t=this.state.startLoc,e=this.jsxParseIdentifier();if(!this.eat(10))return e;let i=this.startNodeAt(t);return i.namespace=e,i.name=this.jsxParseIdentifier(),this.finishNode(i,"JSXNamespacedName")}jsxParseElementName(){let t=this.state.startLoc,e=this.jsxParseNamespacedName();if(e.type==="JSXNamespacedName")return e;for(;this.eat(12);){let i=this.startNodeAt(t);i.object=e,i.property=this.jsxParseIdentifier(),e=this.finishNode(i,"JSXMemberExpression")}return e}jsxParseAttributeValue(){let t;switch(this.state.type){case 2:return t=this.startNode(),this.setContext(w.brace),this.next(),t=this.jsxParseExpressionContainer(t,w.j_oTag),t.expression.type==="JSXEmptyExpression"&&this.raise(B.AttributeIsEmpty,t),t;case 138:case 130:return this.parseExprAtom();default:throw this.raise(B.UnsupportedJsxValue,this.state.startLoc)}}jsxParseEmptyExpression(){let t=this.startNodeAt(this.state.lastTokEndLoc);return this.finishNodeAt(t,"JSXEmptyExpression",this.state.startLoc)}jsxParseSpreadChild(t){return this.next(),t.expression=this.parseExpression(),this.setContext(w.j_expr),this.state.canStartJSXElement=!0,this.expect(4),this.finishNode(t,"JSXSpreadChild")}jsxParseExpressionContainer(t,e){if(this.match(4))t.expression=this.jsxParseEmptyExpression();else{let i=this.parseExpression();i.type==="SequenceExpression"&&!i.extra?.parenthesized&&this.raise(B.UnexpectedSequenceExpression,i.expressions[1]),t.expression=i}return this.setContext(e),this.state.canStartJSXElement=!0,this.expect(4),this.finishNode(t,"JSXExpressionContainer")}jsxParseAttribute(){if(this.match(2)){let e=this.startNode();return this.setContext(w.brace),this.next(),this.expect(17),e.argument=this.parseMaybeAssignAllowIn(),this.setContext(w.j_oTag),this.state.canStartJSXElement=!0,this.expect(4),this.finishNode(e,"JSXSpreadAttribute")}let t=this.startNode();return t.name=this.jsxParseNamespacedName(),t.value=this.eat(25)?this.jsxParseAttributeValue():null,this.finishNode(t,"JSXAttribute")}jsxParseOpeningElementAt(t){if(this.eat(139)){let i=this.startNodeAt(t);return this.finishNode(i,"JSXOpeningFragment")}let e=this.startNodeAt(t);return e.name=this.jsxParseElementName(),this.jsxParseOpeningElementAfterName(e)}jsxParseOpeningElementAfterName(t){let e=[];for(;!this.match(52)&&!this.match(139);)e.push(this.jsxParseAttribute());return t.attributes=e,t.selfClosing=this.eat(52),this.expect(139),this.finishNode(t,"JSXOpeningElement")}jsxParseClosingElementAt(t){if(this.eat(139)){let i=this.startNodeAt(t);return this.finishNode(i,"JSXClosingFragment")}let e=this.startNodeAt(t);return e.name=this.jsxParseElementName(),this.expect(139),this.finishNode(e,"JSXClosingElement")}jsxParseElementAt(t){let e=this.startNodeAt(t),i=[],r=this.jsxParseOpeningElementAt(t),a=null;if(!r.selfClosing){t:for(;;)switch(this.state.type){case 138:if(t=this.state.startLoc,this.next(),this.eat(52)){this.setLoc(t),a=this.jsxParseClosingElementAt(t);break t}i.push(this.jsxParseElementAt(t));break;case 137:i.push(this.parseLiteral(this.state.value,"JSXText"));break;case 2:{let o=this.startNode();this.setContext(w.brace),this.next(),this.match(17)?i.push(this.jsxParseSpreadChild(o)):i.push(this.jsxParseExpressionContainer(o,w.j_expr));break}default:this.unexpected()}U(r)&&!U(a)&&a!==null?this.raise(B.MissingClosingTagFragment,a):!U(r)&&U(a)?this.raise(B.MissingClosingTagElement,a,{openingTagName:K(r.name)}):!U(r)&&!U(a)&&K(a.name)!==K(r.name)&&this.raise(B.MissingClosingTagElement,a,{openingTagName:K(r.name)})}if(U(r)?(e.openingFragment=r,e.closingFragment=a):(e.openingElement=r,e.closingElement=a),e.children=i,this.match(43))throw this.raise(B.UnwrappedAdjacentJSXElements,this.state.startLoc);return U(r)?this.finishNode(e,"JSXFragment"):this.finishNode(e,"JSXElement")}jsxParseElement(){let t=this.state.startLoc;return this.next(),this.jsxParseElementAt(t)}setContext(t){let{context:e}=this.state;e[e.length-1]=t}parseExprAtom(t){return this.match(138)?this.jsxParseElement():this.match(43)&&this.input.charCodeAt(this.state.pos)!==33?(this.replaceToken(138),this.jsxParseElement()):super.parseExprAtom(t)}skipSpace(){this.curContext().preserveSpace||super.skipSpace()}getTokenFromCode(t){let e=this.curContext();if(e===w.j_expr){this.jsxReadToken();return}if(e===w.j_oTag||e===w.j_cTag){if(F(t)){this.jsxReadWord();return}if(t===62){++this.state.pos,this.finishToken(139);return}if((t===34||t===39)&&e===w.j_oTag){this.jsxReadString(t);return}}if(t===60&&this.state.canStartJSXElement&&this.input.charCodeAt(this.state.pos+1)!==33){++this.state.pos,this.finishToken(138);return}super.getTokenFromCode(t)}updateContext(t){let{context:e,type:i}=this.state;if(i===52&&t===138)e.splice(-2,2,w.j_cTag),this.state.canStartJSXElement=!1;else if(i===138)e.push(w.j_oTag);else if(i===139){let r=e[e.length-1];r===w.j_oTag&&t===52||r===w.j_cTag?(e.pop(),this.state.canStartJSXElement=e[e.length-1]===w.j_expr):(this.setContext(w.j_expr),this.state.canStartJSXElement=!0)}else this.state.canStartJSXElement=ds(i)}},kt=class extends st{tsNames=new Map},vt=class extends it{get inTSNamespace(){let s=this.scopeStack;return s.length>=2&&s[s.length-1].flags===0&&(s[s.length-2].flags&2048)>0}importsStack=[];createScope(s){return this.importsStack.push(new Set),new kt(s)}enter(s){s&3072&&this.importsStack.push(new Set),super.enter(s)}exit(){let s=super.exit();return s&3072&&this.importsStack.pop(),s}hasImport(s,t){let e=this.importsStack.length;if(this.importsStack[e-1].has(s))return!0;if(!t&&e>1){for(let i=0;i<e-1;i++)if(this.importsStack[i].has(s))return!0}return!1}declareName(s,t,e){if(t&4096){this.hasImport(s,!0)&&this.parser.raise(c.VarRedeclaration,e,{identifierName:s}),this.importsStack[this.importsStack.length-1].add(s);return}let i=this.currentScope(),r=i.tsNames.get(s)||0;if(t&1024){this.maybeExportDefined(i,s),i.tsNames.set(s,r|16);return}super.declareName(s,t,e),t&2&&(t&1||(this.checkRedeclarationInScope(i,s,t,e),this.maybeExportDefined(i,s)),r=r|1),t&256&&(r=r|2),t&512&&(r=r|4),t&128&&(r=r|8),r&&i.tsNames.set(s,r)}isRedeclaredInScope(s,t,e){let i=s.tsNames.get(t);if((i&2)>0){if(e&256){let r=(e&512)>0,a=(i&4)>0;return r!==a}return!0}return e&128&&(i&8)>0?s.names.get(t)&2?!!(e&1):!1:e&2&&(i&1)>0?!0:super.isRedeclaredInScope(s,t,e)}checkLocalExport(s){let{name:t}=s;if(this.hasImport(t))return;let e=this.scopeStack.length;for(let i=e-1;i>=0;i--){let a=this.scopeStack[i].tsNames.get(t);if((a&1)>0||(a&16)>0)return}super.checkLocalExport(s)}},Lt=class{sawUnambiguousESM=!1;ambiguousScriptDifferentAst=!1;sourceToOffsetPos(s){return s+this.startIndex}offsetToSourcePos(s){return s-this.startIndex}hasPlugin(s){if(typeof s=="string")return this.plugins.has(s);{let[t,e]=s;if(!this.hasPlugin(t))return!1;let i=this.plugins.get(t);for(let r of Object.keys(e))if(i?.[r]!==e[r])return!1;return!0}}getPluginOption(s,t){return this.plugins.get(s)?.[t]}};function ve(n,s){n.trailingComments===void 0?n.trailingComments=s:n.trailingComments.unshift(...s)}function $s(n,s){n.leadingComments===void 0?n.leadingComments=s:n.leadingComments.unshift(...s)}function rt(n,s){n.innerComments===void 0?n.innerComments=s:n.innerComments.unshift(...s)}function _(n,s,t){let e=null,i=s.length;for(;e===null&&i>0;)e=s[--i];e===null||e.start>t.start?rt(n,t.comments):ve(e,t.comments)}var Dt=class extends Lt{addComment(s){this.filename&&(s.loc.filename=this.filename);let{commentsLen:t}=this.state;this.comments.length!==t&&(this.comments.length=t),this.comments.push(s),this.state.commentsLen++}processComment(s){let{commentStack:t}=this.state,e=t.length;if(e===0)return;let i=e-1,r=t[i];r.start===s.end&&(r.leadingNode=s,i--);let a=s.start;for(;i>=0;i--){let o=t[i],h=o.end;if(h>a)o.containingNode=s,this.finalizeComment(o),t.splice(i,1);else{h===a&&(o.trailingNode=s);break}}}finalizeComment(s){let{comments:t}=s;if(s.leadingNode!==null||s.trailingNode!==null)s.leadingNode!==null&&ve(s.leadingNode,t),s.trailingNode!==null&&$s(s.trailingNode,t);else{let e=s.containingNode,i=s.start;if(this.input.charCodeAt(this.offsetToSourcePos(i)-1)===44)switch(e.type){case"ObjectExpression":case"ObjectPattern":_(e,e.properties,s);break;case"CallExpression":case"NewExpression":case"OptionalCallExpression":_(e,e.arguments,s);break;case"ImportExpression":_(e,[e.source,e.options??null],s);break;case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"ObjectMethod":case"ClassMethod":case"ClassPrivateMethod":case"TSTypeParameterDeclaration":_(e,e.params,s);break;case"ArrayExpression":case"ArrayPattern":_(e,e.elements,s);break;case"ExportNamedDeclaration":case"ImportDeclaration":_(e,e.specifiers,s);break;case"TSEnumBody":_(e,e.members,s);break;case"TSInterfaceBody":_(e,e.body,s);break;default:rt(e,t)}else rt(e,t)}}finalizeRemainingComments(){let{commentStack:s}=this.state;for(let t=s.length-1;t>=0;t--)this.finalizeComment(s[t]);this.state.commentStack=[]}resetPreviousNodeTrailingComments(s){let{commentStack:t}=this.state,{length:e}=t;if(e===0)return;let i=t[e-1];i.leadingNode===s&&(i.leadingNode=null)}takeSurroundingComments(s,t,e){let{commentStack:i}=this.state,r=i.length;if(r===0)return;let a=r-1;for(;a>=0;a--){let o=i[a],h=o.end;if(o.start===e)o.leadingNode=s;else if(h===t)o.trailingNode=s;else if(h<t)break}}},Mt=class n{flags=2048;get strict(){return(this.flags&1)>0}set strict(s){s?this.flags|=1:this.flags&=-2}startIndex;curLine;lineStart;startLoc;endLoc;init({strictMode:s,sourceType:t,startIndex:e,startLine:i,startColumn:r}){this.strict=s===!1?!1:s===!0?!0:t==="module",this.startIndex=e,this.curLine=i,this.lineStart=-r,this.startLoc=this.endLoc=new k(i,r,e)}errors=[];noArrowAt=[];noArrowParamsConversionAt=[];get canStartArrow(){return(this.flags&2)>0}set canStartArrow(s){s?this.flags|=2:this.flags&=-3}get inType(){return(this.flags&4)>0}set inType(s){s?this.flags|=4:this.flags&=-5}get noAnonFunctionType(){return(this.flags&8)>0}set noAnonFunctionType(s){s?this.flags|=8:this.flags&=-9}get hasFlowComment(){return(this.flags&16)>0}set hasFlowComment(s){s?this.flags|=16:this.flags&=-17}get isAmbientContext(){return(this.flags&32)>0}set isAmbientContext(s){s?this.flags|=32:this.flags&=-33}get inAbstractClass(){return(this.flags&64)>0}set inAbstractClass(s){s?this.flags|=64:this.flags&=-65}get inDisallowConditionalTypesContext(){return(this.flags&128)>0}set inDisallowConditionalTypesContext(s){s?this.flags|=128:this.flags&=-129}get inConditionalConsequent(){return(this.flags&256)>0}set inConditionalConsequent(s){s?this.flags|=256:this.flags&=-257}get inHackPipelineBody(){return(this.flags&512)>0}set inHackPipelineBody(s){s?this.flags|=512:this.flags&=-513}get seenTopicReference(){return(this.flags&1024)>0}set seenTopicReference(s){s?this.flags|=1024:this.flags&=-1025}labels=[];commentsLen=0;commentStack=[];pos=0;type=135;value=null;start=0;end=0;lastTokEndLoc=null;lastTokStartLoc=null;context=[w.brace];get canStartJSXElement(){return(this.flags&2048)>0}set canStartJSXElement(s){s?this.flags|=2048:this.flags&=-2049}get containsEsc(){return(this.flags&4096)>0}set containsEsc(s){s?this.flags|=4096:this.flags&=-4097}firstInvalidTemplateEscapePos=null;get hasTopLevelAwait(){return(this.flags&8192)>0}set hasTopLevelAwait(s){s?this.flags|=8192:this.flags&=-8193}strictErrors=new Map;tokensLength=0;curPosition(){return new k(this.curLine,this.pos-this.lineStart,this.pos+this.startIndex)}clone(){let s=new n;return s.flags=this.flags,s.startIndex=this.startIndex,s.curLine=this.curLine,s.lineStart=this.lineStart,s.startLoc=this.startLoc,s.endLoc=this.endLoc,s.errors=this.errors.slice(),s.noArrowAt=this.noArrowAt.slice(),s.noArrowParamsConversionAt=this.noArrowParamsConversionAt.slice(),s.labels=this.labels.slice(),s.commentsLen=this.commentsLen,s.commentStack=this.commentStack.slice(),s.pos=this.pos,s.type=this.type,s.value=this.value,s.start=this.start,s.end=this.end,s.lastTokEndLoc=this.lastTokEndLoc,s.lastTokStartLoc=this.lastTokStartLoc,s.context=this.context.slice(),s.firstInvalidTemplateEscapePos=this.firstInvalidTemplateEscapePos,s.strictErrors=this.strictErrors,s.tokensLength=this.tokensLength,s}},Vs=function(s){return s>=48&&s<=57},de={decBinOct:new Set([46,66,69,79,95,98,101,111]),hex:new Set([46,88,95,120])},ot={bin:n=>n===48||n===49,oct:n=>n>=48&&n<=55,dec:n=>n>=48&&n<=57,hex:n=>n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102};function me(n,s,t,e,i,r){let a=t,o=e,h=i,l="",p=null,u=t,{length:f}=s;for(;;){if(t>=f){r.unterminated(a,o,h),l+=s.slice(u,t);break}let y=s.charCodeAt(t);if(qs(n,y,s,t)){l+=s.slice(u,t);break}if(y===92){l+=s.slice(u,t);let P=Hs(s,t,e,i,n==="template",r);P.ch===null&&!p?p={pos:t,lineStart:e,curLine:i}:l+=P.ch,{pos:t,lineStart:e,curLine:i}=P,u=t}else y===8232||y===8233?(++t,++i,e=t):y===10||y===13?n==="template"?(l+=s.slice(u,t)+`
9
+ `,++t,y===13&&s.charCodeAt(t)===10&&++t,++i,u=e=t):r.unterminated(a,o,h):++t}return{pos:t,str:l,firstInvalidLoc:p,lineStart:e,curLine:i}}function qs(n,s,t,e){return n==="template"?s===96||s===36&&t.charCodeAt(e+1)===123:s===(n==="double"?34:39)}function Hs(n,s,t,e,i,r){let a=!i;s++;let o=l=>({pos:s,ch:l,lineStart:t,curLine:e}),h=n.charCodeAt(s++);switch(h){case 110:return o(`
10
+ `);case 114:return o("\r");case 120:{let l;return{code:l,pos:s}=Ot(n,s,t,e,2,!1,a,r),o(l===null?null:String.fromCharCode(l))}case 117:{let l;return{code:l,pos:s}=De(n,s,t,e,a,r),o(l===null?null:String.fromCodePoint(l))}case 116:return o(" ");case 98:return o("\b");case 118:return o("\v");case 102:return o("\f");case 13:n.charCodeAt(s)===10&&++s;case 10:t=s,++e;case 8232:case 8233:return o("");case 56:case 57:if(i)return o(null);r.strictNumericEscape(s-1,t,e);default:if(h>=48&&h<=55){let l=s-1,u=/^[0-7]+/.exec(n.slice(l,s+2))[0],f=parseInt(u,8);f>255&&(u=u.slice(0,-1),f=parseInt(u,8)),s+=u.length-1;let y=n.charCodeAt(s);if(u!=="0"||y===56||y===57){if(i)return o(null);r.strictNumericEscape(l,t,e)}return o(String.fromCharCode(f))}return o(String.fromCharCode(h))}}function Ot(n,s,t,e,i,r,a,o){let h=s,l;return{n:l,pos:s}=Le(n,s,t,e,16,i,r,!1,o,!a),l===null&&(a?o.invalidEscapeSequence(h,t,e):s=h-1),{code:l,pos:s}}function Le(n,s,t,e,i,r,a,o,h,l){let p=s,u=i===16?de.hex:de.decBinOct,f=i===16?ot.hex:i===10?ot.dec:i===8?ot.oct:ot.bin,y=!1,P=0;for(let E=0,N=r??1/0;E<N;++E){let C=n.charCodeAt(s),I;if(C===95&&o!=="bail"){let at=n.charCodeAt(s-1),Y=n.charCodeAt(s+1);if(o){if(Number.isNaN(Y)||!f(Y)||u.has(at)||u.has(Y)){if(l)return{n:null,pos:s};h.unexpectedNumericSeparator(s,t,e)}}else{if(l)return{n:null,pos:s};h.numericSeparatorInEscapeSequence(s,t,e)}++s;continue}if(C>=97?I=C-97+10:C>=65?I=C-65+10:Vs(C)?I=C-48:I=1/0,I>=i){if(I<=9&&l)return{n:null,pos:s};if(I<=9&&h.invalidDigit(s,t,e,i))I=0;else if(a)I=0,y=!0;else break}++s,P=P*i+I}return s===p||r!=null&&s-p!==r||y?{n:null,pos:s}:{n:P,pos:s}}function De(n,s,t,e,i,r){let a=n.charCodeAt(s),o;if(a===123){if(++s,{code:o,pos:s}=Ot(n,s,t,e,n.indexOf("}",s)-s,!0,i,r),++s,o!==null&&o>1114111)if(i)r.invalidCodePoint(s,t,e);else return{code:null,pos:s}}else({code:o,pos:s}=Ot(n,s,t,e,4,!1,i,r));return{code:o,pos:s}}function Q(n,s,t){return new k(t,n-s,n)}var Ks=new Set([103,109,115,105,121,117,100,118]),Ft=class{constructor(s){let t=s.startIndex||0;this.type=s.type,this.value=s.value,this.start=t+s.start,this.end=t+s.end,this.loc=new J(s.startLoc,s.endLoc)}},ht,Bt=class extends Dt{isLookahead;tokens=[];constructor(s,t){super(),this.state=new Mt,this.state.init(s),this.input=t,this.length=t.length,this.comments=[],this.isLookahead=!1,(!ht||ht.length<(this.length+1)*2)&&(ht=new Uint32Array((this.length+1)*2)),this.locData=ht}setLoc(s){let t=this.offsetToSourcePos(s.index);this.locData[t*2]=s.line,this.locData[t*2+1]=s.column}getLoc(s){let t=this.offsetToSourcePos(s);return new k(this.locData[t*2],this.locData[t*2+1],s)}pushToken(s){this.tokens.length=this.state.tokensLength,this.tokens.push(s),++this.state.tokensLength}next(){this.checkKeywordEscapes(),this.optionFlags&512&&this.pushToken(new Ft(this.state)),this.state.lastTokEndLoc=this.state.endLoc,this.state.lastTokStartLoc=this.state.startLoc,this.nextToken()}eat(s){return this.match(s)?(this.next(),!0):!1}match(s){return this.state.type===s}createLookaheadState(s){return{pos:s.pos,value:null,type:s.type,start:s.start,end:s.end,context:[this.curContext()],inType:s.inType,startLoc:s.startLoc,lastTokEndLoc:s.lastTokEndLoc,curLine:s.curLine,lineStart:s.lineStart,curPosition:s.curPosition}}lookahead(){let s=this.state;this.state=this.createLookaheadState(s),this.isLookahead=!0,this.nextToken(),this.isLookahead=!1;let t=this.state;return this.state=s,t}nextTokenStart(){return this.nextTokenStartSince(this.state.pos)}nextTokenStartSince(s){return Tt.lastIndex=s,Tt.test(this.input)?Tt.lastIndex:s}lookaheadCharCode(){return this.lookaheadCharCodeSince(this.state.pos)}lookaheadCharCodeSince(s){return this.input.charCodeAt(this.nextTokenStartSince(s))}nextTokenInLineStart(){return this.nextTokenInLineStartSince(this.state.pos)}nextTokenInLineStartSince(s){return At.lastIndex=s,At.test(this.input)?At.lastIndex:s}lookaheadInLineCharCode(){return this.input.charCodeAt(this.nextTokenInLineStart())}codePointAtPos(s){let t=this.input.charCodeAt(s);if((t&64512)===55296&&++s<this.input.length){let e=this.input.charCodeAt(s);(e&64512)===56320&&(t=65536+((t&1023)<<10)+(e&1023))}return t}setStrict(s){this.state.strict=s,s&&(this.state.strictErrors.forEach(([t,e])=>this.raise(t,e)),this.state.strictErrors.clear())}curContext(){return this.state.context[this.state.context.length-1]}nextToken(){if(this.skipSpace(),this.state.start=this.state.pos,this.isLookahead||(this.state.startLoc=this.state.curPosition()),this.state.pos>=this.length){this.finishToken(135);return}this.getTokenFromCode(this.codePointAtPos(this.state.pos))}skipBlockComment(s){let t;this.isLookahead||(t=this.state.curPosition());let e=this.state.pos,i=this.input.indexOf(s,e+2);if(i===-1)throw this.raise(c.UnterminatedComment,this.state.curPosition());for(this.state.pos=i+s.length,nt.lastIndex=e+2;nt.test(this.input)&&nt.lastIndex<=i;)++this.state.curLine,this.state.lineStart=nt.lastIndex;if(this.isLookahead)return;let r={type:"CommentBlock",value:this.input.slice(e+2,i),start:this.sourceToOffsetPos(e),end:this.sourceToOffsetPos(i+s.length),loc:new J(t,this.state.curPosition())};return this.optionFlags&512&&this.pushToken(r),r}skipLineComment(s){let t=this.state.pos,e;this.isLookahead||(e=this.state.curPosition());let i=this.input.charCodeAt(this.state.pos+=s);if(this.state.pos<this.length)for(;!W(i)&&++this.state.pos<this.length;)i=this.input.charCodeAt(this.state.pos);if(this.isLookahead)return;let r=this.state.pos,o={type:"CommentLine",value:this.input.slice(t+s,r),start:this.sourceToOffsetPos(t),end:this.sourceToOffsetPos(r),loc:new J(e,this.state.curPosition())};return this.optionFlags&512&&this.pushToken(o),o}skipSpace(){let s=this.state.pos,t=this.optionFlags&8192?[]:null;t:for(;this.state.pos<this.length;){let e=this.input.charCodeAt(this.state.pos);switch(e){case 32:case 160:case 9:++this.state.pos;break;case 13: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:{let i=this.skipBlockComment("*/");i!==void 0&&(this.addComment(i),t?.push(i));break}case 47:{let i=this.skipLineComment(2);i!==void 0&&(this.addComment(i),t?.push(i));break}default:break t}break;default:if(_s(e))++this.state.pos;else if(e===45&&!this.inModule&&this.optionFlags&16384){let i=this.state.pos;if(this.input.charCodeAt(i+1)===45&&this.input.charCodeAt(i+2)===62&&(s===0||this.state.lineStart>s)){let r=this.skipLineComment(3);r!==void 0&&(this.addComment(r),t?.push(r))}else break t}else if(e===60&&!this.inModule&&this.optionFlags&16384){let i=this.state.pos;if(this.input.charCodeAt(i+1)===33&&this.input.charCodeAt(i+2)===45&&this.input.charCodeAt(i+3)===45){let r=this.skipLineComment(4);r!==void 0&&(this.addComment(r),t?.push(r))}else break t}else break t}}if(t?.length>0){let e=this.state.pos,i={start:this.sourceToOffsetPos(s),end:this.sourceToOffsetPos(e),comments:t,leadingNode:null,trailingNode:null,containingNode:null};this.state.commentStack.push(i)}}finishToken(s,t){this.state.end=this.state.pos,this.state.endLoc=this.state.curPosition();let e=this.state.type;this.state.type=s,this.state.value=t,this.isLookahead||this.updateContext(e)}replaceToken(s){this.state.type=s,this.updateContext()}readToken_numberSign(){if(this.state.pos===0&&this.readToken_interpreter())return;let s=this.state.pos+1,t=this.codePointAtPos(s);if(t>=48&&t<=57)throw this.raise(c.UnexpectedDigitAfterHash,this.state.curPosition());F(t)?(++this.state.pos,this.finishToken(134,this.readWord1(t))):t===92?(++this.state.pos,this.finishToken(134,this.readWord1())):this.finishOp(23,1)}readToken_dot(){let s=this.input.charCodeAt(this.state.pos+1);if(s>=48&&s<=57){this.readNumber(!0);return}s===46&&this.input.charCodeAt(this.state.pos+2)===46?(this.state.pos+=3,this.finishToken(17)):(++this.state.pos,this.finishToken(12))}readToken_slash(){this.input.charCodeAt(this.state.pos+1)===61?this.finishOp(27,2):this.finishOp(52,1)}readToken_interpreter(){if(this.state.pos!==0||this.length<2)return!1;let s=this.input.charCodeAt(this.state.pos+1);if(s!==33)return!1;let t=this.state.pos;for(this.state.pos+=1;!W(s)&&++this.state.pos<this.length;)s=this.input.charCodeAt(this.state.pos);let e=this.input.slice(t+2,this.state.pos);return this.finishToken(24,e),!0}readToken_mult_modulo(s){let t=s===42?51:50,e=1,i=this.input.charCodeAt(this.state.pos+1);s===42&&i===42&&(e++,i=this.input.charCodeAt(this.state.pos+2),t=53),i===61&&!this.state.inType&&(e++,t=s===37?29:26),this.finishOp(t,e)}readToken_pipe_amp(s){let t=this.input.charCodeAt(this.state.pos+1);if(t===s){this.input.charCodeAt(this.state.pos+2)===61?this.finishOp(26,3):this.finishOp(s===124?37:38,2);return}if(s===124&&t===62){this.finishOp(35,2);return}if(t===61){this.finishOp(26,2);return}this.finishOp(s===124?39:41,1)}readToken_caret(){let s=this.input.charCodeAt(this.state.pos+1);s===61&&!this.state.inType?this.finishOp(28,2):s===94&&this.hasPlugin(["pipelineOperator",{proposal:"hack",topicToken:"^^"}])?(this.finishOp(33,2),this.input.codePointAt(this.state.pos)===94&&this.unexpected()):this.finishOp(40,1)}readToken_atSign(){this.input.charCodeAt(this.state.pos+1)===64&&this.hasPlugin(["pipelineOperator",{proposal:"hack",topicToken:"@@"}])?this.finishOp(34,2):this.finishOp(22,1)}readToken_plus_min(s){let t=this.input.charCodeAt(this.state.pos+1);if(t===s){this.finishOp(30,2);return}t===61?this.finishOp(26,2):this.finishOp(49,1)}readToken_lt(){let{pos:s}=this.state,t=this.input.charCodeAt(s+1);if(t===60){if(this.input.charCodeAt(s+2)===61){this.finishOp(26,3);return}this.finishOp(47,2);return}if(t===61){this.finishOp(45,2);return}this.finishOp(43,1)}readToken_gt(){let{pos:s}=this.state,t=this.input.charCodeAt(s+1);if(t===62){let e=this.input.charCodeAt(s+2)===62?3:2;if(this.input.charCodeAt(s+e)===61){this.finishOp(26,e+1);return}this.finishOp(48,e);return}if(t===61){this.finishOp(45,2);return}this.finishOp(44,1)}readToken_eq_excl(s){let t=this.input.charCodeAt(this.state.pos+1);if(t===61){this.finishOp(42,this.input.charCodeAt(this.state.pos+2)===61?3:2);return}if(s===61&&t===62){this.state.pos+=2,this.finishToken(15);return}this.finishOp(s===61?25:31,1)}readToken_question(){let s=this.input.charCodeAt(this.state.pos+1),t=this.input.charCodeAt(this.state.pos+2);s===63?t===61?this.finishOp(26,3):this.finishOp(36,2):s===46&&!(t>=48&&t<=57)?(this.state.pos+=2,this.finishToken(14)):(++this.state.pos,this.finishToken(13))}getTokenFromCode(s){switch(s){case 46:this.readToken_dot();return;case 40:++this.state.pos,this.finishToken(6);return;case 41:++this.state.pos,this.finishToken(7);return;case 59:++this.state.pos,this.finishToken(9);return;case 44:++this.state.pos,this.finishToken(8);return;case 91:++this.state.pos,this.finishToken(0);return;case 93:++this.state.pos,this.finishToken(1);return;case 123:++this.state.pos,this.finishToken(2);return;case 125:++this.state.pos,this.finishToken(4);return;case 58:this.hasPlugin("functionBind")&&this.input.charCodeAt(this.state.pos+1)===58?this.finishOp(11,2):(++this.state.pos,this.finishToken(10));return;case 63:this.readToken_question();return;case 96:this.readTemplateToken();return;case 48:{let t=this.input.charCodeAt(this.state.pos+1);if(t===120||t===88){this.readRadixNumber(16);return}if(t===111||t===79){this.readRadixNumber(8);return}if(t===98||t===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(!1);return;case 34:case 39:this.readString(s);return;case 47:this.readToken_slash();return;case 37:case 42:this.readToken_mult_modulo(s);return;case 124:case 38:this.readToken_pipe_amp(s);return;case 94:this.readToken_caret();return;case 43:case 45:this.readToken_plus_min(s);return;case 60:this.readToken_lt();return;case 62:this.readToken_gt();return;case 61:case 33:this.readToken_eq_excl(s);return;case 126:this.finishOp(32,1);return;case 64:this.readToken_atSign();return;case 35:this.readToken_numberSign();return;case 92:this.readWord();return;default:if(F(s)){this.readWord(s);return}}throw this.raise(c.InvalidOrUnexpectedToken,this.state.curPosition(),{unexpected:String.fromCodePoint(s)})}finishOp(s,t){let e=this.input.slice(this.state.pos,this.state.pos+t);this.state.pos+=t,this.finishToken(s,e)}readRegexp(){let s=this.state.startLoc,t=this.state.start+1,e,i,{pos:r}=this.state;for(;;++r){if(r>=this.length)throw this.raise(c.UnterminatedRegExp,D(s,1));let l=this.input.charCodeAt(r);if(W(l))throw this.raise(c.UnterminatedRegExp,D(s,1));if(e)e=!1;else{if(l===91)i=!0;else if(l===93&&i)i=!1;else if(l===47&&!i)break;e=l===92}}let a=this.input.slice(t,r);++r;let o="",h=()=>D(s,r+2-t);for(;r<this.length;){let l=this.codePointAtPos(r),p=String.fromCharCode(l);if(Ks.has(l))l===118?o.includes("u")&&this.raise(c.IncompatibleRegExpUVFlags,h()):l===117&&o.includes("v")&&this.raise(c.IncompatibleRegExpUVFlags,h()),o.includes(p)&&this.raise(c.DuplicateRegExpFlags,h());else if($(l)||l===92)this.raise(c.MalformedRegExpFlags,h());else break;++r,o+=p}this.state.pos=r,this.finishToken(133,{pattern:a,flags:o})}readInt(s,t,e=!1,i=!0){let{n:r,pos:a}=Le(this.input,this.state.pos,this.state.lineStart,this.state.curLine,s,t,e,i,this.errorHandlers_readInt,!1);return this.state.pos=a,r}readRadixNumber(s){let t=this.state.pos,e=this.state.curPosition(),i=!1;this.state.pos+=2;let r=this.readInt(s);if(r==null&&this.raise(c.InvalidDigit,D(e,2),{radix:s}),this.input.charCodeAt(this.state.pos)===110&&(++this.state.pos,i=!0),F(this.codePointAtPos(this.state.pos)))throw this.raise(c.NumberIdentifier,this.state.curPosition());if(i){let o=this.input.slice(t,this.state.pos).replace(/[_n]/g,"");this.finishToken(132,o);return}this.finishToken(131,r)}readNumber(s){let t=this.state.pos,e=this.state.curPosition(),i=!1,r=!1,a=!1;!s&&this.readInt(10)===null&&this.raise(c.InvalidNumber,this.state.curPosition());let o=this.state.pos-t>=2&&this.input.charCodeAt(t)===48;if(o){let u=this.input.slice(t,this.state.pos);if(this.recordStrictModeErrors(c.StrictOctalLiteral,e),!this.state.strict){let f=u.indexOf("_");f>0&&this.raise(c.ZeroDigitNumericSeparator,D(e,f))}a=o&&!/[89]/.test(u)}let h=this.input.charCodeAt(this.state.pos);h===46&&!a&&(++this.state.pos,this.readInt(10),i=!0,h=this.input.charCodeAt(this.state.pos)),(h===69||h===101)&&!a&&(h=this.input.charCodeAt(++this.state.pos),(h===43||h===45)&&++this.state.pos,this.readInt(10)===null&&this.raise(c.InvalidOrMissingExponent,e),i=!0,h=this.input.charCodeAt(this.state.pos));let l=this.input.slice(t,this.state.pos).replaceAll("_","");if(h===110&&((i||o)&&this.raise(c.InvalidBigIntLiteral,e),++this.state.pos,r=!0),F(this.codePointAtPos(this.state.pos)))throw this.raise(c.NumberIdentifier,this.state.curPosition());if(r){this.finishToken(132,l);return}let p=a?parseInt(l,8):parseFloat(l);this.finishToken(131,p)}readCodePoint(s){let{code:t,pos:e}=De(this.input,this.state.pos,this.state.lineStart,this.state.curLine,s,this.errorHandlers_readCodePoint);return this.state.pos=e,t}readString(s){let{str:t,pos:e,curLine:i,lineStart:r}=me(s===34?"double":"single",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_string);this.state.pos=e+1,this.state.lineStart=r,this.state.curLine=i,this.finishToken(130,t)}readTemplateContinuation(){this.match(4)||this.unexpected(null,4),this.state.pos--,this.readTemplateToken()}readTemplateToken(){let s=this.input[this.state.pos],{str:t,firstInvalidLoc:e,pos:i,curLine:r,lineStart:a}=me("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,e&&(this.state.firstInvalidTemplateEscapePos=new k(e.curLine,e.pos-e.lineStart,this.sourceToOffsetPos(e.pos))),this.input.codePointAt(i)===96?this.finishToken(20,e?null:s+t+"`"):(this.state.pos++,this.finishToken(21,e?null:s+t+"${"))}recordStrictModeErrors(s,t){let e=t.index;this.state.strict&&!this.state.strictErrors.has(e)?this.raise(s,t):this.state.strictErrors.set(e,[s,t])}readWord1(s){this.state.containsEsc=!1;let t="",e=this.state.pos,i=this.state.pos;for(s!==void 0&&(this.state.pos+=s<=65535?1:2);this.state.pos<this.length;){let r=this.codePointAtPos(this.state.pos);if($(r))this.state.pos+=r<=65535?1:2;else if(r===92){this.state.containsEsc=!0,t+=this.input.slice(i,this.state.pos);let a=this.state.curPosition(),o=this.state.pos===e?F:$;if(this.input.charCodeAt(++this.state.pos)!==117){this.raise(c.MissingUnicodeEscape,this.state.curPosition()),i=this.state.pos-1;continue}++this.state.pos;let h=this.readCodePoint(!0);h!==null&&(o(h)||this.raise(c.EscapedCharNotAnIdentifier,a),t+=String.fromCodePoint(h)),i=this.state.pos}else break}return t+this.input.slice(i,this.state.pos)}readWord(s){let t=this.readWord1(s),e=Xt.get(t);e!==void 0?this.finishToken(e,j(e)):this.finishToken(128,t)}checkKeywordEscapes(){let{type:s}=this.state;ee(s)&&this.state.containsEsc&&this.raise(c.InvalidEscapedReservedWord,this.state.startLoc,{reservedWord:j(s)})}raise(s,t,e={}){let i=t instanceof k?t:typeof t=="number"?this.getLoc(t):this.optionFlags&256?t.loc.start:this.getLoc(t.start),r=t instanceof k?i.index:typeof t=="number"?t:t.start,a=s(i,r,e);if(!(this.optionFlags&4096))throw a;return this.isLookahead||this.state.errors.push(a),a}raiseOverwrite(s,t,e={}){let i=t instanceof k?t:this.optionFlags&256?t.loc.start:this.getLoc(t.start),r=t instanceof k?i.index:t.start,a=this.state.errors;for(let o=a.length-1;o>=0;o--){let h=a[o];if(h.pos===r)return a[o]=s(i,r,e);if(h.pos<r)break}return this.raise(s,i,e)}updateContext(s){}unexpected(s,t){throw this.raise(c.UnexpectedToken,s??this.state.startLoc,{expected:t?j(t):null})}expectPlugin(s,t){if(this.hasPlugin(s))return!0;throw this.raise(c.MissingPlugin,t??this.state.startLoc,{missingPlugin:[s]})}expectOnePlugin(s){if(!s.some(t=>this.hasPlugin(t)))throw this.raise(c.MissingOneOfPlugins,this.state.startLoc,{missingPlugin:s})}errorBuilder(s){return(t,e,i)=>{this.raise(s,Q(t,e,i))}}errorHandlers_readInt={invalidDigit:(s,t,e,i)=>this.optionFlags&4096?(this.raise(c.InvalidDigit,Q(s,t,e),{radix:i}),!0):!1,numericSeparatorInEscapeSequence:this.errorBuilder(c.NumericSeparatorInEscapeSequence),unexpectedNumericSeparator:this.errorBuilder(c.UnexpectedNumericSeparator)};errorHandlers_readCodePoint={...this.errorHandlers_readInt,invalidEscapeSequence:this.errorBuilder(c.InvalidEscapeSequence),invalidCodePoint:this.errorBuilder(c.InvalidCodePoint)};errorHandlers_readStringContents_string={...this.errorHandlers_readCodePoint,strictNumericEscape:(s,t,e)=>{this.recordStrictModeErrors(c.StrictNumericEscape,Q(s,t,e))},unterminated:(s,t,e)=>{throw this.raise(c.UnterminatedString,Q(s-1,t,e))}};errorHandlers_readStringContents_template={...this.errorHandlers_readCodePoint,strictNumericEscape:this.errorBuilder(c.StrictNumericEscape),unterminated:(s,t,e)=>{throw this.raise(c.UnterminatedTemplate,Q(s,t,e))}}},Rt=class{privateNames=new Set;loneAccessors=new Map;undefinedPrivateNames=new Map},Ut=class{parser;stack=[];constructor(s){this.parser=s}current(){return this.stack[this.stack.length-1]}enter(){this.stack.push(new Rt)}exit(){let s=this.stack.pop(),t=this.current();for(let[e,i]of Array.from(s.undefinedPrivateNames))t?t.undefinedPrivateNames.has(e)||t.undefinedPrivateNames.set(e,i):this.parser.raise(c.InvalidPrivateFieldResolution,i,{identifierName:e})}declarePrivateName(s,t,e){let{privateNames:i,loneAccessors:r,undefinedPrivateNames:a}=this.current(),o=i.has(s);if(t&3){let h=o&&r.get(s);if(h){let l=h&4,p=t&4,u=h&3,f=t&3;o=u===f||l!==p,o||r.delete(s)}else o||r.set(s,t)}o&&this.parser.raise(c.PrivateNameRedeclaration,e,{identifierName:s}),i.add(s),a.delete(s)}usePrivateName(s,t){let e;for(e of this.stack)if(e.privateNames.has(s))return;e?e.undefinedPrivateNames.set(s,t):this.parser.raise(c.InvalidPrivateFieldResolution,t,{identifierName:s})}},G=class{constructor(s=0){this.type=s}canBeArrowParameterDeclaration(){return this.type===2||this.type===1}isCertainlyParameterDeclaration(){return this.type===3}},dt=class extends G{declarationErrors=new Map;constructor(s){super(s)}recordDeclarationError(s,t){this.declarationErrors.set(t,s)}clearDeclarationError(s){this.declarationErrors.delete(s)}iterateErrors(s){this.declarationErrors.forEach(s)}},_t=class{parser;stack=[new G];constructor(s){this.parser=s}enter(s){this.stack.push(s)}exit(){this.stack.pop()}recordParameterInitializerError(s,t){let{stack:e}=this,i=e.length-1,r=e[i];for(;!r.isCertainlyParameterDeclaration();){if(r.canBeArrowParameterDeclaration())r.recordDeclarationError(s,t);else return;r=e[--i]}this.parser.raise(s,t)}recordArrowParameterBindingError(s,t){let{stack:e}=this,i=e[e.length-1],r=t.start;if(i.isCertainlyParameterDeclaration())this.parser.raise(s,r);else if(i.canBeArrowParameterDeclaration())i.recordDeclarationError(s,r);else return}recordAsyncArrowParametersError(s){let{stack:t}=this,e=t.length-1,i=t[e];for(;i.canBeArrowParameterDeclaration();)i.type===2&&i.recordDeclarationError(c.AwaitBindingIdentifier,s),i=t[--e]}validateAsPattern(){let{stack:s}=this,t=s[s.length-1];t.canBeArrowParameterDeclaration()&&t.iterateErrors((e,i)=>{this.parser.raise(e,i);let r=s.length-2,a=s[r];for(;a.canBeArrowParameterDeclaration();)a.clearDeclarationError(i),a=s[--r]})}};function Ws(){return new G(3)}function Xs(){return new dt(1)}function Js(){return new dt(2)}function Me(){return new G}var jt=class{stacks=[];enter(s){this.stacks.push(s)}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}get inFSharpPipelineDirectBody(){return(this.currentFlags()&16)===0}};function ut(n,s){return(n?2:0)|(s?1:0)}var zt=class extends Bt{addExtra(s,t,e,i=!0){if(!s)return;let{extra:r}=s;r==null&&(r={},s.extra=r),i?r[t]=e:Object.defineProperty(r,t,{enumerable:i,value:e})}isContextual(s){return this.state.type===s&&!this.state.containsEsc}isUnparsedContextual(s,t){if(this.input.startsWith(t,s)){let e=this.input.charCodeAt(s+t.length);return!($(e)||(e&64512)===55296)}return!1}isLookaheadContextual(s){let t=this.nextTokenStart();return this.isUnparsedContextual(t,s)}eatContextual(s){return this.isContextual(s)?(this.next(),!0):!1}expectContextual(s,t){if(!this.eatContextual(s)){if(t!=null)throw this.raise(t,this.state.startLoc);this.unexpected(null,s)}}canInsertSemicolon(){return this.match(135)||this.match(4)||this.hasPrecedingLineBreak()}hasPrecedingLineBreak(){return fe(this.input,this.offsetToSourcePos(this.state.lastTokEndLoc.index),this.state.start)}hasFollowingLineBreak(){return fe(this.input,this.state.end,this.nextTokenStart())}isLineTerminator(){return this.eat(9)||this.canInsertSemicolon()}semicolon(s=!0){(s?this.isLineTerminator():this.eat(9))||this.raise(c.MissingSemicolon,this.state.lastTokEndLoc)}expect(s,t){this.eat(s)||this.unexpected(t,s)}tryParse(s,t=this.state.clone()){let e={node:null};try{let i=s((r=null)=>{throw e.node=r,e});if(this.state.errors.length>t.errors.length){let r=this.state;return this.state=t,this.state.tokensLength=r.tokensLength,{node:i,error:r.errors[t.errors.length],thrown:!1,aborted:!1,failState:r}}return{node:i,error:null,thrown:!1,aborted:!1,failState:null}}catch(i){let r=this.state;if(this.state=t,i instanceof SyntaxError)return{node:null,error:i,thrown:!0,aborted:!1,failState:r};if(i===e)return{node:e.node,error:null,thrown:!1,aborted:!0,failState:r};throw i}}checkExpressionErrors(s,t){if(!s)return!1;let{shorthandAssignLoc:e,doubleProtoLoc:i,privateKeyLoc:r,optionalParametersLoc:a,voidPatternLoc:o}=s,h=!!e||!!i||!!a||!!r||!!o;if(!t)return h;e!=null&&this.raise(c.InvalidCoverInitializedName,e),i!=null&&this.raise(c.DuplicateProto,i),r!=null&&this.raise(c.UnexpectedPrivateField,r),a!=null&&this.unexpected(a),o!=null&&this.raise(c.InvalidCoverDiscardElement,o)}isLiteralPropertyName(){return Se(this.state.type)}isPrivateName(s){return s.type==="PrivateName"}getPrivateNameSV(s){return s.id.name}hasPropertyAsPrivateName(s){return(s.type==="MemberExpression"||s.type==="OptionalMemberExpression")&&this.isPrivateName(s.property)}isObjectProperty(s){return s.type==="ObjectProperty"}isObjectMethod(s){return s.type==="ObjectMethod"}initializeScopes(s=this.options.sourceType==="module"){let t=this.state.labels;this.state.labels=[];let e=this.exportedIdentifiers;this.exportedIdentifiers=new Set;let i=this.inModule;this.inModule=s;let r=this.scope,a=this.getScopeHandler();this.scope=new a(this,s);let o=this.prodParam;this.prodParam=new jt;let h=this.classScope;this.classScope=new Ut(this);let l=this.expressionScope;return this.expressionScope=new _t(this),()=>{this.state.labels=t,this.exportedIdentifiers=e,this.inModule=i,this.scope=r,this.prodParam=o,this.classScope=h,this.expressionScope=l}}enterInitialScopes(){let s=0;(this.inModule||this.optionFlags&1)&&(s|=2),this.optionFlags&32&&(s|=1);let t=!this.inModule&&this.options.sourceType==="commonjs";(t||this.optionFlags&2)&&(s|=4),this.prodParam.enter(s);let e=t?514:1;this.optionFlags&4&&(e|=512),this.optionFlags&16&&(e|=48),this.scope.enter(e)}checkDestructuringPrivate(s){let{privateKeyLoc:t}=s;t!==null&&this.expectPlugin("destructuringPrivate",t)}},X=class{shorthandAssignLoc=null;doubleProtoLoc=null;privateKeyLoc=null;optionalParametersLoc=null;voidPatternLoc=null},z=class{constructor(s,t,e,i){this.start=e,this.end=0,i!==void 0&&(this.loc=new J(i)),s&128&&(this.range=[e,0]),i!==void 0&&t&&(this.loc.filename=t)}type=""},ye=z.prototype,$t=class extends zt{createPosition(s){return s}startNode(){let{startLoc:s}=this.state;return this.setLoc(s),this.startNodeAt(s)}startNodeAt(s){let{optionFlags:t,filename:e}=this;return t&256?new z(t,e,s.index,this.createPosition(s)):new z(t,e,s.index)}startNodeAtNode(s){let{optionFlags:t,filename:e}=this;return t&256?new z(t,e,s.start,s.loc.start):new z(t,e,s.start)}finishNode(s,t){return this.finishNodeAt(s,t,this.state.lastTokEndLoc)}finishNodeAt(s,t,e){s.type=t,s.end=e.index;let{optionFlags:i}=this;return i&256&&(s.loc.end=this.createPosition(e)),i&128&&(s.range[1]=e.index),i&8192&&this.processComment(s),s}finishNodeAtNode(s,t,e){s.type=t,s.end=e.end;let{optionFlags:i}=this;return i&256&&(s.loc.end=e.loc.end),i&128&&(s.range[1]=s.end),i&8192&&this.processComment(s),s}resetStartLocation(s,t){s.start=t.index;let{optionFlags:e}=this;e&256&&(s.loc.start=this.createPosition(t)),e&128&&(s.range[0]=t.index)}resetEndLocation(s,t=this.state.lastTokEndLoc){s.end=t.index;let{optionFlags:e}=this;e&256&&(s.loc.end=this.createPosition(t)),e&128&&(s.range[1]=t.index)}resetStartLocationFromNode(s,t){s.start=t.start;let{optionFlags:e}=this;e&256&&(s.loc.start=t.loc.start),e&128&&(s.range[0]=t.start)}resetEndLocationFromNode(s,t){s.end=t.end;let{optionFlags:e}=this;e&256&&(s.loc.end=t.loc.end),e&128&&(s.range[1]=t.end)}castNodeTo(s,t){return s.type=t,s}cloneIdentifier(s){let{type:t,start:e,end:i,loc:r,range:a,name:o}=s,h=Object.create(ye);return h.type=t,h.start=e,h.end=i,h.loc=r,h.range=a,h.name=o,s.extra&&(h.extra=s.extra),h}cloneStringLiteral(s){let{type:t,start:e,end:i,loc:r,range:a,extra:o}=s,h=Object.create(ye);return h.type=t,h.start=e,h.end=i,h.loc=r,h.range=a,h.extra=o,h.value=s.value,h}},Vt=n=>n.type==="ParenthesizedExpression"?Vt(n.expression):n,qt=class extends $t{toAssignable(s,t=!1){let e;switch((s.type==="ParenthesizedExpression"||s.extra?.parenthesized)&&(e=Vt(s),t?e.type==="Identifier"?this.expressionScope.recordArrowParameterBindingError(c.InvalidParenthesizedAssignment,s):e.type!=="CallExpression"&&e.type!=="MemberExpression"&&!this.isOptionalMemberExpression(e)&&this.raise(c.InvalidParenthesizedAssignment,s):this.raise(c.InvalidParenthesizedAssignment,s)),s.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":case"VoidPattern":break;case"ObjectExpression":this.castNodeTo(s,"ObjectPattern");for(let i=0,r=s.properties.length,a=r-1;i<r;i++){let o=s.properties[i],h=i===a;this.toAssignableObjectExpressionProp(o,h,t),h&&o.type==="RestElement"&&s.extra?.trailingCommaLoc&&this.raise(c.RestTrailingComma,s.extra.trailingCommaLoc)}break;case"ObjectProperty":{let{key:i,value:r}=s;this.isPrivateName(i)&&this.classScope.usePrivateName(this.getPrivateNameSV(i),i.start),this.toAssignable(r,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(s,"ArrayPattern"),this.toAssignableList(s.elements,s.extra?.trailingCommaLoc,t);break;case"AssignmentExpression":s.operator!=="="&&this.raise(c.MissingEqInAssignment,this.optionFlags&256?s.left.loc.end:s.left),this.castNodeTo(s,"AssignmentPattern"),delete s.operator,s.left.type==="VoidPattern"&&this.raise(c.VoidPatternInitializer,s.left),this.toAssignable(s.left,t);break;case"ParenthesizedExpression":this.toAssignable(e,t);break}}toAssignableObjectExpressionProp(s,t,e){if(s.type==="ObjectMethod")this.raise(s.kind==="get"||s.kind==="set"?c.PatternHasAccessor:c.PatternHasMethod,s.key);else if(s.type==="SpreadElement"){this.castNodeTo(s,"RestElement");let i=s.argument;this.checkToRestConversion(i,!1),this.toAssignable(i,e),t||this.raise(c.RestTrailingComma,s)}else this.toAssignable(s,e)}toAssignableList(s,t,e){let i=s.length-1;for(let r=0;r<=i;r++){let a=s[r];a&&(this.toAssignableListItem(s,r,e),a.type==="RestElement"&&(r<i?this.raise(c.RestTrailingComma,a):t&&this.raise(c.RestTrailingComma,t)))}}toAssignableListItem(s,t,e){let i=s[t];if(i.type==="SpreadElement"){this.castNodeTo(i,"RestElement");let r=i.argument;this.checkToRestConversion(r,!0),this.toAssignable(r,e)}else this.toAssignable(i,e)}isAssignable(s,t){switch(s.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":case"VoidPattern":return!0;case"ObjectExpression":{let e=s.properties.length-1;return s.properties.every((i,r)=>i.type!=="ObjectMethod"&&(r===e||i.type!=="SpreadElement")&&this.isAssignable(i))}case"ObjectProperty":return this.isAssignable(s.value);case"SpreadElement":return this.isAssignable(s.argument);case"ArrayExpression":return s.elements.every(e=>e===null||this.isAssignable(e));case"AssignmentExpression":return s.operator==="=";case"ParenthesizedExpression":return this.isAssignable(s.expression);case"MemberExpression":case"OptionalMemberExpression":return!t;default:return!1}}toReferencedList(s,t){return s}parseSpread(s){let t=this.startNode();return this.next(),t.argument=this.parseMaybeAssignAllowIn(s,void 0),this.finishNode(t,"SpreadElement")}parseRestBinding(){let s=this.startNode();this.next();let t=this.parseBindingAtom();return t.type==="VoidPattern"&&this.raise(c.UnexpectedVoidPattern,t),s.argument=t,this.finishNode(s,"RestElement")}parseBindingAtom(){switch(this.state.type){case 0:{let s=this.startNode();return this.next(),s.elements=this.parseBindingList(1,93,1),this.finishNode(s,"ArrayPattern")}case 2:return this.parseObjectLike(4,!0);case 84:return this.parseVoidPattern(null)}return this.parseIdentifier()}parseBindingList(s,t,e){let i=e&1,r=[],a=!0;for(;!this.eat(s);)if(a?a=!1:this.expect(8),i&&this.match(8))r.push(null);else{if(this.eat(s))break;if(this.match(17)){let o=this.parseRestBinding();if(e&2&&(o=this.parseFunctionParamType(o)),r.push(o),!this.checkCommaAfterRest(t)){this.expect(s);break}}else{let o=[];if(e&2)for(this.match(22)&&this.hasPlugin("decorators")&&this.raise(c.UnsupportedParameterDecorator,this.state.startLoc);this.match(22);)o.push(this.parseDecorator());r.push(this.parseBindingElement(e,o))}}return r}parseBindingRestProperty(s){return this.next(),this.hasPlugin("discardBinding")&&this.match(84)?(s.argument=this.parseVoidPattern(null),this.raise(c.UnexpectedVoidPattern,s.argument)):s.argument=this.parseIdentifier(),this.checkCommaAfterRest(125),this.finishNode(s,"RestElement")}parseBindingProperty(){let{type:s,startLoc:t}=this.state;if(s===17)return this.parseBindingRestProperty(this.startNode());let e=this.startNode();return s===134?(this.expectPlugin("destructuringPrivate",t),this.classScope.usePrivateName(this.state.value,t),e.key=this.parsePrivateName()):this.parsePropertyName(e),e.method=!1,this.parseObjPropValue(e,t,!1,!1,!0,!1)}parseBindingElement(s,t){let{startLoc:e}=this.state,i=this.parseMaybeDefault();return s&2&&this.parseFunctionParamType(i),t.length&&(i.decorators=t,this.resetStartLocationFromNode(i,t[0])),this.parseMaybeDefault(e,i)}parseFunctionParamType(s){return s}parseMaybeDefault(s,t){if(s??=this.state.startLoc,t=t??this.parseBindingAtom(),!this.eat(25))return t;let e=this.startNodeAt(s);return t.type==="VoidPattern"&&this.raise(c.VoidPatternInitializer,t),e.left=t,e.right=this.parseMaybeAssignAllowIn(),this.finishNode(e,"AssignmentPattern")}isValidLVal(s,t,e,i){switch(s){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!0;case"CallExpression":if(!t&&!this.state.strict&&this.optionFlags&16384)return!0}return!1}isOptionalMemberExpression(s){return s.type==="OptionalMemberExpression"}checkLVal(s,t,e=64,i=!1,r=!1,a=!1,o=!1){let h=s.type;if(this.isObjectMethod(s))return;let l=this.isOptionalMemberExpression(s);if(l||h==="MemberExpression"){l&&(this.expectPlugin("optionalChainingAssign",s.start),t.type!=="AssignmentExpression"&&this.raise(c.InvalidLhsOptionalChaining,s,{ancestor:t})),e!==64&&this.raise(c.InvalidPropertyBindingPattern,s);return}if(h==="Identifier"){this.checkIdentifier(s,e,r);let{name:N}=s;i&&(i.has(N)?this.raise(c.ParamDupe,s):i.add(N));return}else h==="VoidPattern"&&t.type==="CatchClause"&&this.raise(c.VoidPatternCatchClauseParam,s);let p=Vt(s);o||=p.type==="CallExpression"&&(p.callee.type==="Import"||p.callee.type==="Super");let u=this.isValidLVal(h,o,!(a||s.extra?.parenthesized)&&t.type==="AssignmentExpression",e);if(u===!0)return;if(u===!1){let N=e===64?c.InvalidLhs:c.InvalidLhsBinding;this.raise(N,s,{ancestor:t});return}let f,y;typeof u=="string"?(f=u,y=h==="ParenthesizedExpression"):[f,y]=u;let P=h==="ArrayPattern"||h==="ObjectPattern"?{type:h}:t,E=s[f];if(Array.isArray(E))for(let N of E)N&&this.checkLVal(N,P,e,i,r,y,!0);else E&&this.checkLVal(E,P,e,i,r,y,o)}checkIdentifier(s,t,e=!1){this.state.strict&&(e?ke(s.name,this.inModule):Ne(s.name))&&(t===64?this.raise(c.StrictEvalArguments,s,{referenceName:s.name}):this.raise(c.StrictEvalArgumentsBinding,s,{bindingName:s.name})),t&8192&&s.name==="let"&&this.raise(c.LetInLexicalBinding,s),t&64||this.declareNameFromIdentifier(s,t)}declareNameFromIdentifier(s,t){this.scope.declareName(s.name,t,s.start)}checkToRestConversion(s,t){switch(s.type){case"ParenthesizedExpression":this.checkToRestConversion(s.expression,t);break;case"Identifier":case"MemberExpression":break;case"ArrayExpression":case"ObjectExpression":if(t)break;default:this.raise(c.InvalidRestAssignmentPattern,s)}}checkCommaAfterRest(s){return this.match(8)?(this.raise(this.lookaheadCharCode()===s?c.RestTrailingComma:c.ElementAfterRest,this.state.startLoc),!0):!1}},Ht=class extends qt{checkProto(s,t,e){if(s.type==="SpreadElement"||this.isObjectMethod(s)||s.computed||s.shorthand)return t;let i=s.key;return(i.type==="Identifier"?i.name:i.value)==="__proto__"?(t&&(e?e.doubleProtoLoc===null&&(e.doubleProtoLoc=this.getLoc(i.start)):this.raise(c.DuplicateProto,i)),!0):t}shouldExitDescending(s){return s.type==="ArrowFunctionExpression"&&!s.extra?.parenthesized}getExpression(){if(this.enterInitialScopes(),this.nextToken(),this.match(135))throw this.raise(c.ParseExpressionEmptyInput,this.state.startLoc);let s=this.parseExpression();if(!this.match(135))throw this.raise(c.ParseExpressionExpectsEOF,this.state.startLoc,{unexpected:this.input.codePointAt(this.state.start)});return this.finalizeRemainingComments(),s.comments=this.comments,s.errors=this.state.errors,this.optionFlags&512&&(s.tokens=Oe(this.tokens)),s}parseExpression(s,t){return s?this.disallowInAnd(()=>this.parseExpressionBase(t)):this.allowInAnd(()=>this.parseExpressionBase(t))}parseExpressionBase(s){let t=this.state.startLoc,e=this.parseMaybeAssign(s);if(this.match(8)){let i=this.startNodeAt(t);for(i.expressions=[e];this.eat(8);)i.expressions.push(this.parseMaybeAssign(s));return this.toReferencedList(i.expressions),this.finishNode(i,"SequenceExpression")}return e}parseMaybeAssignDisallowIn(s,t){return this.disallowInAnd(()=>this.parseMaybeAssign(s,t))}parseMaybeAssignAllowIn(s,t){return this.allowInAnd(()=>this.parseMaybeAssign(s,t))}setOptionalParametersError(s){s.optionalParametersLoc=this.state.startLoc}parseMaybeAssign(s,t){let e=this.state.startLoc,i=this.isContextual(104);if(i&&this.prodParam.hasYield){this.next();let o=this.parseYield(e);return t&&(o=t.call(this,o,e)),o}let r;s?r=!1:(s=new X,r=!0),this.state.canStartArrow=!0;let a=this.parseMaybeConditional(s);if(t&&(a=t.call(this,a,e)),ms(this.state.type)){let o=this.startNodeAt(e),h=this.state.value;if(o.operator=h,this.match(25)){this.toAssignable(a,!0),o.left=a;let l=e.index;s.doubleProtoLoc!=null&&s.doubleProtoLoc.index>=l&&(s.doubleProtoLoc=null),s.shorthandAssignLoc!=null&&s.shorthandAssignLoc.index>=l&&(s.shorthandAssignLoc=null),s.privateKeyLoc!=null&&s.privateKeyLoc.index>=l&&(this.checkDestructuringPrivate(s),s.privateKeyLoc=null),s.voidPatternLoc!=null&&s.voidPatternLoc.index>=l&&(s.voidPatternLoc=null)}else o.left=a;return this.next(),o.right=this.parseMaybeAssign(),this.checkLVal(a,this.finishNode(o,"AssignmentExpression"),void 0,void 0,void 0,void 0,h==="||="||h==="&&="||h==="??="),o}else r&&this.checkExpressionErrors(s,!0);if(i){let{type:o}=this.state;if((this.hasPlugin("v8intrinsic")?tt(o):tt(o)&&!this.match(50))&&!this.isAmbiguousPrefixOrIdentifier())return this.raiseOverwrite(c.YieldNotInGeneratorFunction,e),this.parseYield(e)}return a}parseMaybeConditional(s){let t=this.state.startLoc,e=this.parseExprOps(s);return this.shouldExitDescending(e)?e:this.parseConditional(e,t,s)}parseConditional(s,t,e){if(this.eat(13)){let i=this.startNodeAt(t);return i.test=s,i.consequent=this.parseMaybeAssignAllowIn(),this.expect(10),i.alternate=this.parseMaybeAssign(),this.finishNode(i,"ConditionalExpression")}return s}parseMaybeUnaryOrPrivate(s){return this.match(134)?this.parsePrivateName():this.parseMaybeUnary(s)}parseExprOps(s){let t=this.state.startLoc,e=this.parseMaybeUnaryOrPrivate(s);return this.shouldExitDescending(e)?e:(this.state.canStartArrow=!1,this.parseExprOp(e,t,-1))}parseExprOp(s,t,e){if(this.isPrivateName(s)){let r=this.getPrivateNameSV(s);(e>=pt(54)||!this.prodParam.hasIn||!this.match(54))&&this.raise(c.PrivateInExpectedIn,t,{identifierName:r}),this.classScope.usePrivateName(r,t)}let i=this.state.type;if(le(i)&&(this.prodParam.hasIn||!this.match(54))){let r=pt(i);if(r>e){if(i===35&&(this.expectPlugin("pipelineOperator"),this.prodParam.inFSharpPipelineDirectBody))return s;let a=this.startNodeAt(t);a.left=s,a.operator=this.state.value;let o=i===37||i===38,h=i===36;h&&(r=pt(38)),this.next(),a.right=this.parseExprOpRightExpr(i,r);let l=this.finishNode(a,o||h?"LogicalExpression":"BinaryExpression"),p=this.state.type;if(h&&(p===37||p===38)||o&&p===36)throw this.raise(c.MixingCoalesceWithLogical,this.state.startLoc);return this.parseExprOp(l,t,e)}}return s}parseExprOpRightExpr(s,t){switch(s){case 35:switch(this.getPluginOption("pipelineOperator","proposal")){case"hack":return this.withTopicBindingContext(()=>this.parseHackPipeBody());case"fsharp":return this.parseFSharpPipelineBody(t)}default:return this.parseExprOpBaseRightExpr(s,t)}}parseExprOpBaseRightExpr(s,t){let e=this.state.startLoc;return this.parseExprOp(this.parseMaybeUnaryOrPrivate(),e,As(s)?t-1:t)}parseHackPipeBody(){let{startLoc:s}=this.state,t=this.parseMaybeAssign();return rs.has(t.type)&&!t.extra?.parenthesized&&this.raise(c.PipeUnparenthesizedBody,s,{type:t.type}),this.topicReferenceWasUsedInCurrentContext()||this.raise(c.PipeTopicUnused,s),t}checkExponentialAfterUnary(s){this.match(53)&&this.raise(c.UnexpectedTokenUnaryExponentiation,s.argument)}parseMaybeUnary(s,t){let e=this.state.startLoc,i=this.isContextual(92);if(i&&this.recordAwaitIfAllowed()){this.next();let h=this.parseAwait(e);return t||this.checkExponentialAfterUnary(h),h}let r=this.match(30),a=this.startNode();if(gs(this.state.type)){a.operator=this.state.value,a.prefix=!0,this.state.canStartArrow=!1,this.match(68)&&this.expectPlugin("throwExpressions");let h=this.match(85);if(this.next(),a.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(s,!0),this.state.strict&&h){let l=a.argument;l.type==="Identifier"?this.raise(c.StrictDelete,a):this.hasPropertyAsPrivateName(l)&&this.raise(c.DeletePrivateField,a)}if(!r)return t||this.checkExponentialAfterUnary(a),this.finishNode(a,"UnaryExpression")}let o=this.parseUpdate(a,r,s);if(i){let{type:h}=this.state;if((this.hasPlugin("v8intrinsic")?tt(h):tt(h)&&!this.match(50))&&!this.isAmbiguousPrefixOrIdentifier())return this.raiseOverwrite(c.AwaitNotInAsyncContext,e),this.parseAwait(e)}return o}parseUpdate(s,t,e){if(t){let a=this.finishNode(s,"UpdateExpression");return this.checkLVal(a.argument,a),a}let i=this.state.startLoc,r=this.parseExprSubscripts(e);if(this.checkExpressionErrors(e,!1))return r;for(;xs(this.state.type)&&!this.canInsertSemicolon();){let a=this.startNodeAt(i);a.operator=this.state.value,a.prefix=!1,a.argument=r,this.next(),this.checkLVal(r,r=this.finishNode(a,"UpdateExpression"))}return r}parseExprSubscripts(s){let t=this.state.startLoc;this.setLoc(t);let e=this.parseExprAtom(s);return this.shouldExitDescending(e)?e:this.parseSubscripts(e,t)}parseSubscripts(s,t,e){let i={optionalChainMember:!1,maybeAsyncArrow:this.atPossibleAsyncArrow(s),stop:!1};do s=this.parseSubscript(s,t,e,i),i.maybeAsyncArrow=!1;while(!i.stop);return s}parseSubscript(s,t,e,i){let{type:r}=this.state;if(!e&&r===11)return this.parseBind(s,t,i);if(wt(r))return this.parseTaggedTemplateExpression(s,t,i);let a=!1;if(r===14){if(e&&(this.raise(c.OptionalChainingNoNew,this.state.startLoc),this.lookaheadCharCode()===40))return this.stopParseSubscript(s,i);i.optionalChainMember=a=!0,this.next()}if(!e&&this.match(6))return this.parseCoverCallAndAsyncArrowHead(s,t,i,a);{let o=this.eat(0);return o||a||this.eat(12)?this.parseMember(s,t,i,o,a):this.stopParseSubscript(s,i)}}stopParseSubscript(s,t){return t.stop=!0,s}parseMember(s,t,e,i,r){let a=this.startNodeAt(t);return a.object=s,a.computed=i,i?(a.property=this.parseExpression(),this.expect(1)):this.match(134)?(s.type==="Super"&&this.raise(c.SuperPrivateField,t),this.classScope.usePrivateName(this.state.value,this.state.startLoc),a.property=this.parsePrivateName()):a.property=this.parseIdentifier(!0),e.optionalChainMember?(a.optional=r,this.finishNode(a,"OptionalMemberExpression")):this.finishNode(a,"MemberExpression")}parseBind(s,t,e){let i=this.startNodeAt(t);i.object=s,this.next();let r=this.match(79),a=this.parseNoCallExpr();if(a.type==="Super"||r&&a.type==="ImportExpression"||a.type==="Import")throw this.raise(c.UnsupportedBindRHS,a);return i.callee=a,e.stop=!0,this.parseSubscripts(this.finishNode(i,"BindExpression"),t,!1)}parseCoverCallAndAsyncArrowHead(s,t,e,i){let r=null;this.next();let a=this.startNodeAt(t);a.callee=s;let{maybeAsyncArrow:o,optionalChainMember:h}=e;o&&(this.expressionScope.enter(Js()),r=new X),h&&(a.optional=i),i?a.arguments=this.parseCallExpressionArguments():a.arguments=this.parseCallExpressionArguments(s.type!=="Super",a,r);let l=this.finishCallExpression(a,h);return o&&this.shouldParseAsyncArrow()&&!i?(e.stop=!0,this.checkDestructuringPrivate(r),this.expressionScope.validateAsPattern(),this.expressionScope.exit(),l=this.parseAsyncArrowFromCallExpression(this.startNodeAt(t),l)):(o&&(this.checkExpressionErrors(r,!0),this.expressionScope.exit()),this.toReferencedList(a.arguments)),l}parseTaggedTemplateExpression(s,t,e){let i=this.startNodeAt(t);return i.tag=s,i.quasi=this.parseTemplate(!0),e.optionalChainMember&&this.raise(c.OptionalChainingNoTemplate,t),this.finishNode(i,"TaggedTemplateExpression")}atPossibleAsyncArrow(s){return s.type==="Identifier"&&s.name==="async"&&this.state.lastTokEndLoc.index===s.end&&!this.canInsertSemicolon()&&s.end-s.start===5&&this.state.canStartArrow}finishCallExpression(s,t){if(s.callee.type==="Import")if(s.arguments.length===0||s.arguments.length>2)this.raise(c.ImportCallArity,s);else for(let e of s.arguments)e.type==="SpreadElement"&&this.raise(c.ImportCallSpreadArgument,e);return this.finishNode(s,t?"OptionalCallExpression":"CallExpression")}parseCallExpressionArguments(s,t,e){let i=[],r=!0;for(;!this.eat(7);){if(r)r=!1;else if(this.expect(8),this.match(7)){t&&this.addTrailingCommaExtraToNode(t),this.next();break}i.push(this.parseExprListItem(7,!1,e,s))}return i}shouldParseAsyncArrow(){return this.match(15)&&!this.canInsertSemicolon()}parseAsyncArrowFromCallExpression(s,t){return this.resetPreviousNodeTrailingComments(t),this.expect(15),this.parseArrowExpression(s,t.arguments,!0,t.extra?.trailingCommaLoc),t.innerComments&&rt(s,t.innerComments),t.callee.trailingComments&&rt(s,t.callee.trailingComments),s}parseNoCallExpr(){let s=this.state.startLoc;return this.parseSubscripts(this.parseExprAtom(),s,!0)}parseExprAtom(s){let t,e=null,{type:i}=this.state;switch(i){case 75:return this.parseSuper();case 79:return t=this.startNode(),this.next(),this.match(12)?this.parseImportMetaPropertyOrPhaseCall(t):this.match(6)?this.optionFlags&1024?this.parseImportCall(t):this.finishNode(t,"Import"):(this.raise(c.UnsupportedImport,this.state.lastTokStartLoc),this.finishNode(t,"Import"));case 74:return t=this.startNode(),this.next(),this.finishNode(t,"ThisExpression");case 86:return this.parseDo(this.startNode(),!1);case 52:case 27:return this.readRegexp(),this.parseRegExpLiteral(this.state.value);case 131:return this.parseNumericLiteral(this.state.value);case 132:return this.parseBigIntLiteral(this.state.value);case 130:return this.parseStringLiteral(this.state.value);case 80:return this.parseNullLiteral();case 81:return this.parseBooleanLiteral(!0);case 82:return this.parseBooleanLiteral(!1);case 6:return this.parseParenAndDistinguishExpression(this.state.canStartArrow);case 0:return this.parseArrayLike(1,s);case 2:return this.parseObjectLike(4,!1,s);case 64:return this.parseFunctionOrFunctionSent();case 22:e=this.parseDecorators();case 76:return this.parseClass(this.maybeTakeDecorators(e,this.startNode()),!1);case 73:return this.parseNewOrNewTarget();case 21:case 20:return this.parseTemplate(!1);case 11:{t=this.startNode(),this.next(),t.object=null;let r=t.callee=this.parseNoCallExpr();if(r.type==="MemberExpression")return this.finishNode(t,"BindExpression");throw this.raise(c.UnsupportedBind,r)}case 134:return this.raise(c.PrivateInExpectedIn,this.state.startLoc,{identifierName:this.state.value}),this.parsePrivateName();case 29:return this.parseTopicReferenceThenEqualsSign(50,"%");case 28:return this.parseTopicReferenceThenEqualsSign(40,"^");case 33:case 34:return this.parseTopicReference("hack");case 40:case 50:case 23:{let r=this.getPluginOption("pipelineOperator","proposal");if(r)return this.parseTopicReference(r);throw this.unexpected()}case 43:{let r=this.input.codePointAt(this.nextTokenStart());throw F(r)||r===62?this.expectOnePlugin(["jsx","flow","typescript"]):this.unexpected()}default:if(S(i)){if(this.isContextual(123)&&this.lookaheadInLineCharCode()===123)return this.parseModuleExpression();let{canStartArrow:r,containsEsc:a}=this.state,o=this.parseIdentifier();if(!a&&o.name==="async"&&!this.canInsertSemicolon()){let{type:h}=this.state;if(h===64)return this.resetPreviousNodeTrailingComments(o),this.next(),this.parseAsyncFunctionExpression(this.startNodeAtNode(o));if(S(h))return r&&this.lookaheadCharCode()===61?this.parseAsyncArrowUnaryFunction(this.startNodeAtNode(o)):o;if(h===86)return this.resetPreviousNodeTrailingComments(o),this.parseDo(this.startNodeAtNode(o),!0)}return r&&this.match(15)&&!this.canInsertSemicolon()?(this.next(),this.parseArrowExpression(this.startNodeAtNode(o),[o],!1)):o}else throw this.unexpected()}}parseTopicReferenceThenEqualsSign(s,t){let e=this.getPluginOption("pipelineOperator","proposal");if(e)return this.state.type=s,this.state.value=t,this.state.pos--,this.state.end--,this.state.endLoc=D(this.state.endLoc,-1),this.parseTopicReference(e);throw this.unexpected()}parseTopicReference(s){let t=this.startNode(),e=this.state.startLoc,i=this.state.type;return this.next(),this.finishTopicReference(t,e,s,i)}finishTopicReference(s,t,e,i){if(this.testTopicReferenceConfiguration(e,t,i))return this.topicReferenceIsAllowedInCurrentContext()||this.raise(c.PipeTopicUnbound,t),this.registerTopicReference(),this.finishNode(s,"TopicReference");throw this.raise(c.PipeTopicUnconfiguredToken,t,{token:j(i)})}testTopicReferenceConfiguration(s,t,e){if(s==="hack")return this.hasPlugin(["pipelineOperator",{topicToken:j(e)}]);throw this.raise(c.PipeTopicRequiresHackPipes,t)}parseAsyncArrowUnaryFunction(s){this.prodParam.enter(ut(!0,this.prodParam.hasYield));let t=[this.parseIdentifier()];return this.prodParam.exit(),this.hasPrecedingLineBreak()&&this.raise(c.LineTerminatorBeforeArrow,this.state.curPosition()),this.expect(15),this.parseArrowExpression(s,t,!0)}parseDo(s,t){this.expectPlugin("doExpressions"),t&&this.expectPlugin("asyncDoExpressions"),s.async=t,this.next();let e=this.state.labels;return this.state.labels=[],t?(this.prodParam.enter(2),s.body=this.parseBlock(),this.prodParam.exit()):s.body=this.parseBlock(),this.state.labels=e,this.finishNode(s,"DoExpression")}parseSuper(){let s=this.startNode();return this.next(),this.match(6)&&!this.scope.allowDirectSuper?this.raise(c.SuperNotAllowed,s):this.scope.allowSuper||this.raise(c.UnexpectedSuper,s),!this.match(6)&&!this.match(0)&&!this.match(12)&&this.raise(c.UnsupportedSuper,s),this.finishNode(s,"Super")}parsePrivateName(){let s=this.startNode(),t=this.startNodeAt(D(this.state.startLoc,1)),e=this.state.value;return this.next(),s.id=this.createIdentifier(t,e),this.finishNode(s,"PrivateName")}parseFunctionOrFunctionSent(){let s=this.startNode();if(this.next(),this.prodParam.hasYield&&this.match(12)){let t=this.createIdentifier(this.startNodeAtNode(s),"function");return this.next(),this.match(99)?this.expectPlugin("functionSent"):this.hasPlugin("functionSent")||this.unexpected(),this.parseMetaProperty(s,t,"sent")}return this.parseFunction(s)}parseMetaProperty(s,t,e){s.meta=t;let i=this.state.containsEsc;return s.property=this.parseIdentifier(!0),(s.property.name!==e||i)&&this.raise(c.UnsupportedMetaProperty,s.property,{target:t.name,onlyValidPropertyName:e}),this.finishNode(s,"MetaProperty")}parseImportMetaPropertyOrPhaseCall(s){if(this.next(),this.isContextual(101)||this.isContextual(93)){let t=this.isContextual(101);return this.expectPlugin(t?"sourcePhaseImports":"deferredImportEvaluation"),this.next(),s.phase=t?"source":"defer",this.parseImportCall(s)}else{let t=this.createIdentifierAt(this.startNodeAtNode(s),"import",this.state.lastTokStartLoc);return this.isContextual(97)&&(this.inModule||this.raise(c.ImportMetaOutsideModule,t),this.sawUnambiguousESM=!0),this.parseMetaProperty(s,t,"meta")}}parseLiteralAtNode(s,t,e){return this.addExtra(e,"rawValue",s),this.addExtra(e,"raw",this.input.slice(this.offsetToSourcePos(e.start),this.state.end)),e.value=s,this.next(),this.finishNode(e,t)}parseLiteral(s,t){let e=this.startNode();return this.parseLiteralAtNode(s,t,e)}parseStringLiteral(s){return this.parseLiteral(s,"StringLiteral")}parseNumericLiteral(s){return this.parseLiteral(s,"NumericLiteral")}parseBigIntLiteral(s){let t;try{t=BigInt(s)}catch{t=null}return this.parseLiteral(t,"BigIntLiteral")}parseRegExpLiteral(s){let t=this.startNode();return this.addExtra(t,"raw",this.input.slice(this.offsetToSourcePos(t.start),this.state.end)),t.pattern=s.pattern,t.flags=s.flags,this.next(),this.finishNode(t,"RegExpLiteral")}parseBooleanLiteral(s){let t=this.startNode();return t.value=s,this.next(),this.finishNode(t,"BooleanLiteral")}parseNullLiteral(){let s=this.startNode();return this.next(),this.finishNode(s,"NullLiteral")}parseParenAndDistinguishExpression(s){let t=this.state.startLoc,e;this.next(),this.expressionScope.enter(Xs());let i=this.state.startLoc,r=[],a=new X,o=!0,h,l;for(;!this.match(7);){if(o)o=!1;else if(this.expect(8,a.optionalParametersLoc===null?null:a.optionalParametersLoc),this.match(7)){l=this.state.startLoc;break}if(this.match(17)){let f=this.state.startLoc;if(h=this.state.startLoc,r.push(this.parseParenItem(this.parseRestBinding(),f)),!this.checkCommaAfterRest(41))break}else r.push(this.parseMaybeAssignAllowInOrVoidPattern(7,a,this.parseParenItem))}let p=this.state.lastTokEndLoc;this.expect(7);let u=this.startNodeAt(t);return s&&this.shouldParseArrow(r)&&(u=this.parseArrow(u))?(this.checkDestructuringPrivate(a),this.expressionScope.validateAsPattern(),this.expressionScope.exit(),this.parseArrowExpression(u,r,!1),u):(this.expressionScope.exit(),r.length||this.unexpected(this.state.lastTokStartLoc),l&&this.unexpected(l),h&&this.unexpected(h),this.checkExpressionErrors(a,!0),this.toReferencedList(r,!0),r.length>1?(e=this.startNodeAt(i),e.expressions=r,this.finishNode(e,"SequenceExpression"),this.resetEndLocation(e,p)):e=r[0],this.wrapParenthesis(t,e))}wrapParenthesis(s,t){if(!(this.optionFlags&2048))return this.addExtra(t,"parenthesized",!0),this.addExtra(t,"parenStart",s.index),this.takeSurroundingComments(t,s.index,this.state.lastTokEndLoc.index),t;let e=this.startNodeAt(s);return e.expression=t,this.finishNode(e,"ParenthesizedExpression")}shouldParseArrow(s){return!this.canInsertSemicolon()}parseArrow(s){if(this.eat(15))return s}parseParenItem(s,t){return s}parseNewOrNewTarget(){let s=this.startNode();if(this.next(),this.match(12)){let t=this.createIdentifier(this.startNodeAtNode(s),"new");this.next();let e=this.parseMetaProperty(s,t,"target");return this.scope.allowNewTarget||this.raise(c.UnexpectedNewTarget,e),e}return this.parseNew(s)}parseNew(s){if(this.parseNewCallee(s),this.eat(6)){let t=this.parseExprList(7);this.toReferencedList(t),s.arguments=t}else s.arguments=[];return this.finishNode(s,"NewExpression")}parseNewCallee(s){let t=this.match(79),e=this.parseNoCallExpr();s.callee=e,t&&e.type==="ImportExpression"&&this.raise(c.ImportCallNotNewExpression,e,e),e.type==="Import"&&this.raise(c.ImportCallNotNewExpression,e),e.type==="Super"&&this.raise(c.SuperCallNotNewExpression,e)}parseTemplateElement(s){let{start:t,startLoc:e,end:i,value:r}=this.state,a=t+1,o=this.startNodeAt(D(e,1));r===null&&(s||this.raise(c.InvalidEscapeSequenceTemplate,D(this.state.firstInvalidTemplateEscapePos,1)));let h=this.match(20),l=h?-1:-2,p=i+l;o.value={raw:this.input.slice(a,p).replace(/\r\n?/g,`
11
+ `),cooked:r===null?null:r.slice(1,l)},o.tail=h,this.next();let u=this.finishNode(o,"TemplateElement");return this.resetEndLocation(u,D(this.state.lastTokEndLoc,l)),u}parseTemplate(s){let t=this.startNode(),e=this.parseTemplateElement(s),i=[e],r=[];for(;!e.tail;)r.push(this.parseTemplateSubstitution()),this.readTemplateContinuation(),i.push(e=this.parseTemplateElement(s));return t.expressions=r,t.quasis=i,this.finishNode(t,"TemplateLiteral")}parseTemplateSubstitution(){return this.parseExpression()}parseObjectLike(s,t,e){let i=!1,r=!0,a=this.startNode();for(a.properties=[],this.next();!this.match(s);){if(r)r=!1;else if(this.expect(8),this.match(s)){this.addTrailingCommaExtraToNode(a);break}let h;t?h=this.parseBindingProperty():(h=this.parsePropertyDefinition(e),i=this.checkProto(h,i,e)),a.properties.push(h)}this.next();let o=t?"ObjectPattern":"ObjectExpression";return this.finishNode(a,o)}addTrailingCommaExtraToNode(s){this.addExtra(s,"trailingComma",this.state.lastTokStartLoc.index),this.addExtra(s,"trailingCommaLoc",this.state.lastTokStartLoc,!1)}maybeAsyncOrAccessorProp(s){return!s.computed&&s.key.type==="Identifier"&&(this.isLiteralPropertyName()||this.match(0)||this.match(51))}parsePropertyDefinition(s){let t=[];if(this.match(22))for(this.hasPlugin("decorators")&&this.raise(c.UnsupportedPropertyDecorator,this.state.startLoc);this.match(22);)t.push(this.parseDecorator());let e=this.startNode(),i=!1,r=!1,a;if(this.match(17))return t.length&&this.unexpected(),this.parseSpread();t.length&&(e.decorators=t),e.method=!1,s&&(a=this.state.startLoc);let o=this.eat(51);this.parsePropertyNamePrefixOperator(e);let h=this.state.containsEsc;if(this.parsePropertyName(e,s),!o&&!h&&this.maybeAsyncOrAccessorProp(e)){let{key:l}=e,p=l.name;p==="async"&&!this.hasPrecedingLineBreak()&&(i=!0,this.resetPreviousNodeTrailingComments(l),o=this.eat(51),this.parsePropertyName(e)),(p==="get"||p==="set")&&(r=!0,this.resetPreviousNodeTrailingComments(l),e.kind=p,this.match(51)&&(o=!0,this.raise(c.AccessorIsGenerator,this.state.curPosition(),{kind:p}),this.next()),this.parsePropertyName(e))}return this.parseObjPropValue(e,a,o,i,!1,r,s)}getGetterSetterExpectedParamCount(s){return s.kind==="get"?0:1}getObjectOrClassMethodParams(s){return s.params}checkGetterSetterParams(s){let t=this.getGetterSetterExpectedParamCount(s),e=this.getObjectOrClassMethodParams(s);e.length!==t&&this.raise(s.kind==="get"?c.BadGetterArity:c.BadSetterArity,s),s.kind==="set"&&e[e.length-1]?.type==="RestElement"&&this.raise(c.BadSetterRestParameter,s)}parseObjectMethod(s,t,e,i,r){if(r){let a=this.parseMethod(s,t,!1,!1,!1,"ObjectMethod");return this.checkGetterSetterParams(a),a}if(e||t||this.match(6))return i&&this.unexpected(),s.kind="method",s.method=!0,this.parseMethod(s,t,e,!1,!1,"ObjectMethod")}parseObjectProperty(s,t,e,i){if(s.shorthand=!1,this.eat(10))return s.value=e?this.parseMaybeDefault(this.state.startLoc):this.parseMaybeAssignAllowInOrVoidPattern(4,i),this.finishObjectProperty(s);if(!s.computed&&s.key.type==="Identifier"){if(this.checkReservedWord(s.key.name,s.key.start,!0,!1),e)s.value=this.parseMaybeDefault(t,this.cloneIdentifier(s.key));else if(this.match(25)){let r=this.state.startLoc;i!=null?i.shorthandAssignLoc===null&&(i.shorthandAssignLoc=r):this.raise(c.InvalidCoverInitializedName,r),s.value=this.parseMaybeDefault(t,this.cloneIdentifier(s.key))}else s.value=this.cloneIdentifier(s.key);return s.shorthand=!0,this.finishObjectProperty(s)}}finishObjectProperty(s){return this.finishNode(s,"ObjectProperty")}parseObjPropValue(s,t,e,i,r,a,o){let h=this.parseObjectMethod(s,e,i,r,a)||this.parseObjectProperty(s,t,r,o);return h||this.unexpected(),h}parsePropertyName(s,t){if(this.eat(0))s.computed=!0,s.key=this.parseMaybeAssignAllowIn(),this.expect(1);else{let{type:e,value:i}=this.state,r;if(O(e))r=this.parseIdentifier(!0);else switch(e){case 131:r=this.parseNumericLiteral(i);break;case 130:r=this.parseStringLiteral(i);break;case 132:r=this.parseBigIntLiteral(i);break;case 134:{let a=this.state.startLoc;t!=null?t.privateKeyLoc===null&&(t.privateKeyLoc=a):this.raise(c.UnexpectedPrivateField,a),r=this.parsePrivateName();break}default:this.unexpected()}s.key=r,e!==134&&(s.computed=!1)}}initFunction(s,t){s.id=null,s.generator=!1,s.async=t}parseMethod(s,t,e,i,r,a,o=!1){this.initFunction(s,e),s.generator=t,this.scope.enter(530|(o?576:0)|(r?32:0)),this.prodParam.enter(ut(e,s.generator)),this.parseFunctionParams(s,i);let h=this.parseFunctionBodyAndFinish(s,a,!0);return this.prodParam.exit(),this.scope.exit(),h}parseArrayLike(s,t){let e=this.startNode();return this.next(),e.elements=this.parseExprList(s,!0,t,e),this.finishNode(e,"ArrayExpression")}parseArrowExpression(s,t,e,i){this.scope.enter(518);let r=ut(e,!1);return this.match(2)||(r|=this.prodParam.currentFlags()&24),this.prodParam.enter(r),this.initFunction(s,e),t&&this.setArrowFunctionParameters(s,t,i),this.parseFunctionBody(s,!0),this.prodParam.exit(),this.scope.exit(),this.finishNode(s,"ArrowFunctionExpression")}setArrowFunctionParameters(s,t,e){this.toAssignableList(t,e,!1),s.params=t}parseFunctionBodyAndFinish(s,t,e=!1){return this.parseFunctionBody(s,!1,e),this.finishNode(s,t)}parseFunctionBody(s,t,e=!1){let i=t&&!this.match(2);if(this.expressionScope.enter(Me()),i)s.body=this.parseMaybeAssign(),this.checkParams(s,!1,t,!1);else{let r=this.state.strict,a=this.state.labels;this.state.labels=[],this.prodParam.enter(this.prodParam.currentFlags()|4),s.body=this.parseBlock(!0,!1,o=>{let h=!this.isSimpleParamList(s.params);o&&h&&this.raise(c.IllegalLanguageModeDirective,(s.kind==="method"||s.kind==="constructor")&&s.key?this.optionFlags&256?s.key.loc.end:s.key:s);let l=!r&&this.state.strict;this.checkParams(s,!this.state.strict&&!t&&!e&&!h,t,l),this.state.strict&&s.id&&this.checkIdentifier(s.id,65,l)}),this.prodParam.exit(),this.state.labels=a}this.expressionScope.exit()}isSimpleParameter(s){return s.type==="Identifier"}isSimpleParamList(s){for(let t=0,e=s.length;t<e;t++)if(!this.isSimpleParameter(s[t]))return!1;return!0}checkParams(s,t,e,i=!0){let r=!t&&new Set,a={type:"FormalParameters"};for(let o of s.params)this.checkLVal(o,a,5,r,i)}parseExprList(s,t,e,i){let r=[],a=!0;for(;!this.eat(s);){if(a)a=!1;else if(this.expect(8),this.match(s)){i&&this.addTrailingCommaExtraToNode(i),this.next();break}r.push(this.parseExprListItem(s,t,e))}return r}parseExprListItem(s,t,e,i){let r;if(this.match(8))t||this.raise(c.UnexpectedToken,this.state.curPosition(),{unexpected:","}),r=null;else if(this.match(17)){let a=this.state.startLoc;r=this.parseParenItem(this.parseSpread(e),a)}else if(this.match(13)){this.expectPlugin("partialApplication"),i||this.raise(c.UnexpectedArgumentPlaceholder,this.state.startLoc);let a=this.startNode();this.next(),r=this.finishNode(a,"ArgumentPlaceholder")}else r=this.parseMaybeAssignAllowInOrVoidPattern(s,e,this.parseParenItem);return r}parseIdentifier(s){let t=this.startNode(),e=this.parseIdentifierName(s);return this.createIdentifier(t,e)}createIdentifier(s,t){return s.name=t,this.optionFlags&256&&(s.loc.identifierName=t),this.finishNode(s,"Identifier")}createIdentifierAt(s,t,e){return s.name=t,this.optionFlags&256&&(s.loc.identifierName=t),this.finishNodeAt(s,"Identifier",e)}parseIdentifierName(s){let t,{start:e,type:i}=this.state;O(i)?t=this.state.value:this.unexpected();let r=fs(i);return s?r&&this.replaceToken(128):this.checkReservedWord(t,this.sourceToOffsetPos(e),r,!1),this.next(),t}checkReservedWord(s,t,e,i){if(s.length>10||!ks(s))return;if(e&&Is(s)){this.raise(c.UnexpectedKeyword,t,{keyword:s});return}if((this.state.strict?i?ke:Ee:Ie)(s,this.inModule)){this.raise(c.UnexpectedReservedWord,t,{reservedWord:s});return}else if(s==="yield"){if(this.prodParam.hasYield){this.raise(c.YieldBindingIdentifier,t);return}}else if(s==="await"){if(this.prodParam.hasAwait){this.raise(c.AwaitBindingIdentifier,t);return}if(this.scope.inStaticBlock){this.raise(c.AwaitBindingIdentifierInStaticBlock,t);return}this.expressionScope.recordAsyncArrowParametersError(t)}else if(s==="arguments"&&this.scope.inClassAndNotInNonArrowFunction){this.raise(c.ArgumentsInClass,t);return}}recordAwaitIfAllowed(){let s=this.prodParam.hasAwait;return s&&!this.scope.inFunction&&(this.state.hasTopLevelAwait=!0),s}parseAwait(s,t){let e=s.index;this.setLoc(s);let i=this.startNodeAt(s);return this.expressionScope.recordParameterInitializerError(c.AwaitExpressionFormalParameter,e),this.eat(51)&&this.raise(c.ObsoleteAwaitStar,s),!this.scope.inFunction&&!(this.optionFlags&1)&&(this.isAmbiguousPrefixOrIdentifier()?this.ambiguousScriptDifferentAst=!0:this.sawUnambiguousESM=!0),t||(i.argument=this.parseMaybeUnary(null,!0)),this.finishNode(i,"AwaitExpression")}isAmbiguousPrefixOrIdentifier(){if(this.hasPrecedingLineBreak())return!0;let{type:s}=this.state;return s===49||s===6||s===0||wt(s)||s===98&&!this.state.containsEsc||s===133||s===52||this.hasPlugin("v8intrinsic")&&s===50}parseYield(s){this.setLoc(s);let t=this.startNodeAt(s);this.expressionScope.recordParameterInitializerError(c.YieldInParameter,s.index);let e=!1,i=null;if(!this.hasPrecedingLineBreak())switch(e=this.eat(51),this.state.type){case 9:case 135:case 4:case 7:case 1:case 5:case 10:case 8:if(!e)break;default:i=this.parseMaybeAssign()}return t.delegate=e,t.argument=i,this.finishNode(t,"YieldExpression")}parseImportCall(s){this.next();let t=this.parseCallExpressionArguments();if(t.length===0||t.length>2)this.raise(c.ImportCallArity,s,s);else for(let e of t)e.type==="SpreadElement"&&this.raise(c.ImportCallSpreadArgument,e,s);return s.source=t[0],s.options=t[1]??null,this.finishNode(s,"ImportExpression")}withTopicBindingContext(s){let t=this.state.inHackPipelineBody;this.state.inHackPipelineBody=!0;let e=this.state.seenTopicReference;this.state.seenTopicReference=!1;try{return s()}finally{this.state.inHackPipelineBody=t,this.state.seenTopicReference=e}}allowInAnd(s){let t=this.prodParam.currentFlags();if(24&~t){this.prodParam.enter(t|8|16);try{return s()}finally{this.prodParam.exit()}}return s()}disallowInAnd(s){let t=this.prodParam.currentFlags(),e=8&t,i=16&~t;if(e||i){this.prodParam.enter(t&-9|16);try{return s()}finally{this.prodParam.exit()}}return s()}registerTopicReference(){this.state.seenTopicReference=!0}topicReferenceIsAllowedInCurrentContext(){return this.state.inHackPipelineBody}topicReferenceWasUsedInCurrentContext(){return this.state.seenTopicReference}parseFSharpPipelineBody(s){let t=this.state.startLoc;this.prodParam.enter(this.prodParam.currentFlags()&-17);let e;if(this.isContextual(92)&&this.recordAwaitIfAllowed()){this.next(),e=this.parseAwait(t,!0);let i=this.state.type;le(i)&&i!==35&&(this.prodParam.hasIn||i!==54)&&this.raise(c.PipelineUnparenthesized,t)}else this.state.canStartArrow=!0,e=this.parseExprOp(this.parseMaybeUnaryOrPrivate(),t,s);return this.prodParam.exit(),e}parseModuleExpression(){this.expectPlugin("moduleBlocks");let s=this.startNode();this.next(),this.match(2)||this.unexpected(null,2);let t=this.startNodeAt(this.state.endLoc);this.next();let e=this.initializeScopes(!0);this.enterInitialScopes();try{s.body=this.parseProgram(t,4,"module")}finally{e()}return this.finishNode(s,"ModuleExpression")}parseVoidPattern(s){this.expectPlugin("discardBinding");let t=this.startNode();return s!=null&&(s.voidPatternLoc=this.state.startLoc),this.next(),this.finishNode(t,"VoidPattern")}parseMaybeAssignAllowInOrVoidPattern(s,t,e){if(t!=null&&this.match(84)){let i=this.lookaheadCharCode();if(i===44||i===(s===1?93:s===4?125:41)||i===61)return this.parseMaybeDefault(this.state.startLoc,this.parseVoidPattern(t))}return this.parseMaybeAssignAllowIn(t,e)}parsePropertyNamePrefixOperator(s){}},bt={kind:1},Gs={kind:2},Ys=/[\uD800-\uDFFF]/u,St=/in(?:stanceof)?/y;function Oe(n){for(let s=0;s<n.length;s++){let t=n[s],{type:e}=t;typeof e=="number"&&(t.type=Ce(e))}return n}var Kt=class extends Ht{parseTopLevel(s,t){return s.program=this.parseProgram(t,135,this.options.sourceType==="module"?"module":"script"),s.comments=this.comments,this.optionFlags&512&&(s.tokens=Oe(this.tokens)),this.finishNode(s,"File")}parseProgram(s,t,e){if(s.sourceType=e,s.interpreter=this.parseInterpreterDirective(),this.parseBlockBody(s,!0,!0,t),this.inModule){if(!(this.optionFlags&64)&&this.scope.undefinedExports.size>0)for(let[r,a]of Array.from(this.scope.undefinedExports))this.raise(c.ModuleExportUndefined,a,{localName:r});this.addExtra(s,"topLevelAwait",this.state.hasTopLevelAwait)}let i;return t===135?i=this.finishNode(s,"Program"):i=this.finishNodeAt(s,"Program",D(this.state.startLoc,-1)),i}stmtToDirective(s){let t=this.castNodeTo(s,"Directive"),e=this.castNodeTo(s.expression,"DirectiveLiteral"),i=e.value,r=this.input.slice(this.offsetToSourcePos(e.start),this.offsetToSourcePos(e.end)),a=e.value=r.slice(1,-1);return this.addExtra(e,"raw",r),this.addExtra(e,"rawValue",a),this.addExtra(e,"expressionValue",i),t.value=e,delete s.expression,t}parseInterpreterDirective(){if(!this.match(24))return null;let s=this.startNode();return s.value=this.state.value,this.next(),this.finishNode(s,"InterpreterDirective")}isLet(){return this.isContextual(96)?this.hasFollowingBindingAtom():!1}isUsing(){return this.isContextual(103)?this.nextTokenIsIdentifierOnSameLine():!1}isForUsing(){if(!this.isContextual(103))return!1;let s=this.nextTokenInLineStart(),t=this.codePointAtPos(s);if(this.isUnparsedContextual(s,"of")){let e=this.lookaheadCharCodeSince(s+2);if(e!==61&&e!==58&&e!==59)return!1}return!!(this.chStartsBindingIdentifier(t,s)||this.isUnparsedContextual(s,"void"))}nextTokenIsIdentifierOnSameLine(){let s=this.nextTokenInLineStart(),t=this.codePointAtPos(s);return this.chStartsBindingIdentifier(t,s)}isAwaitUsing(){if(!this.isContextual(92))return!1;let s=this.nextTokenInLineStart();if(this.isUnparsedContextual(s,"using")){s=this.nextTokenInLineStartSince(s+5);let t=this.codePointAtPos(s);if(this.chStartsBindingIdentifier(t,s))return!0}return!1}chStartsBindingIdentifier(s,t){if(F(s)){if(St.lastIndex=t,St.test(this.input)){let e=this.codePointAtPos(St.lastIndex);if(!$(e)&&e!==92)return!1}return!0}else return s===92}chStartsBindingPattern(s){return s===91||s===123}hasFollowingBindingAtom(){let s=this.nextTokenStart(),t=this.codePointAtPos(s);return this.chStartsBindingPattern(t)||this.chStartsBindingIdentifier(t,s)}hasInLineFollowingBindingIdentifierOrBrace(){let s=this.nextTokenInLineStart(),t=this.codePointAtPos(s);return t===123||this.chStartsBindingIdentifier(t,s)}allowsUsing(){return(this.scope.inModule||!this.scope.inTopLevel)&&!this.scope.inBareCaseStatement}parseModuleItem(){return this.parseStatementLike(15)}parseStatementListItem(){return this.parseStatementLike(6|(!this.options.annexB||this.state.strict?0:8))}parseStatementOrSloppyAnnexBFunctionDeclaration(s=!1){let t=0;return this.options.annexB&&!this.state.strict&&(t|=4,s&&(t|=8)),this.parseStatementLike(t)}parseStatement(){return this.parseStatementLike(0)}parseStatementLike(s){let t=null;return this.match(22)&&(t=this.parseDecorators(!0)),this.parseStatementContent(s,t)}parseStatementContent(s,t){let e=this.state.type,i=this.startNode(),r=!!(s&2),a=!!(s&4),o=s&1;switch(e){case 56:return this.parseBreakContinueStatement(i,!0);case 59:return this.parseBreakContinueStatement(i,!1);case 60:return this.parseDebuggerStatement(i);case 86:return this.parseDoWhileStatement(i);case 87:return this.parseForStatement(i);case 64:if(this.lookaheadCharCode()===46)break;return a||this.raise(this.state.strict?c.StrictFunction:this.options.annexB?c.SloppyFunctionAnnexB:c.SloppyFunction,this.state.startLoc),this.parseFunctionStatement(i,!1,!r&&a);case 76:return r||this.unexpected(),this.parseClass(this.maybeTakeDecorators(t,i),!0);case 65:return this.parseIfStatement(i);case 66:return this.parseReturnStatement(i);case 67:return this.parseSwitchStatement(i);case 68:return this.parseThrowStatement(i);case 69:return this.parseTryStatement(i);case 92:if(this.isAwaitUsing())return this.allowsUsing()?r?this.recordAwaitIfAllowed()||this.raise(c.AwaitUsingNotInAsyncContext,i):this.raise(c.UnexpectedLexicalDeclaration,i):this.raise(c.UnexpectedUsingDeclaration,i),this.next(),this.parseVarStatement(i,"await using");break;case 103:if(this.state.containsEsc||!this.hasInLineFollowingBindingIdentifierOrBrace())break;return this.allowsUsing()?r||this.raise(c.UnexpectedLexicalDeclaration,this.state.startLoc):this.raise(c.UnexpectedUsingDeclaration,this.state.startLoc),this.parseVarStatement(i,"using");case 96:{if(this.state.containsEsc)break;let p=this.nextTokenStart(),u=this.codePointAtPos(p);if(u!==91&&(!r&&this.hasFollowingLineBreak()||!this.chStartsBindingIdentifier(u,p)&&u!==123))break}case 71:r||this.raise(c.UnexpectedLexicalDeclaration,this.state.startLoc);case 70:{let p=this.state.value;return this.parseVarStatement(i,p)}case 88:return this.parseWhileStatement(i);case 72:return this.parseWithStatement(i);case 2:return this.parseBlock();case 9:return this.parseEmptyStatement(i);case 79:{let p=this.lookaheadCharCode();if(p===40||p===46)break}case 78:{!(this.optionFlags&8)&&!o&&this.raise(c.UnexpectedImportExport,this.state.startLoc),this.next();let p;return e===79?p=this.parseImport(i):p=this.parseExport(i,t),this.assertModuleNodeAllowed(p),p}default:if(this.isAsyncFunction())return r||this.raise(c.AsyncFunctionInSingleStatementContext,this.state.startLoc),this.next(),this.parseFunctionStatement(i,!0,!r&&a)}let h=this.state.value,l=this.parseExpression();return S(e)&&l.type==="Identifier"&&this.eat(10)?this.parseLabeledStatement(i,h,l,s):this.parseExpressionStatement(i,l,t)}assertModuleNodeAllowed(s){!(this.optionFlags&8)&&!this.inModule&&this.raise(c.ImportOutsideModule,s)}maybeTakeDecorators(s,t,e){return s&&(t.decorators?.length?(this.raise(c.DecoratorsBeforeAfterExport,t.decorators[0]),t.decorators.unshift(...s)):t.decorators=s,this.resetStartLocationFromNode(t,s[0]),e&&this.resetStartLocationFromNode(e,t)),t}canHaveLeadingDecorator(){return this.match(76)}parseDecorators(s){let t=[];do t.push(this.parseDecorator());while(this.match(22));if(this.match(78))s||this.unexpected();else if(!this.canHaveLeadingDecorator())throw this.raise(c.UnexpectedLeadingDecorator,this.state.startLoc);return t}parseDecorator(){this.expectOnePlugin(["decorators","decorators-legacy"]);let s=this.startNode();if(this.next(),this.hasPlugin("decorators")){let t=this.state.startLoc,e;if(this.match(6)){let i=this.state.startLoc;this.next(),e=this.parseExpression(),this.expect(7),e=this.wrapParenthesis(i,e);let r=this.state.startLoc;s.expression=this.parseMaybeDecoratorArguments(e,i),s.expression!==e&&this.raise(c.DecoratorArgumentsOutsideParentheses,r)}else{for(e=this.parseIdentifier(!1);this.eat(12);){let i=this.startNodeAt(t);i.object=e,this.match(134)?(this.classScope.usePrivateName(this.state.value,this.state.startLoc),i.property=this.parsePrivateName()):i.property=this.parseIdentifier(!0),i.computed=!1,e=this.finishNode(i,"MemberExpression")}s.expression=this.parseMaybeDecoratorArguments(e,t)}}else this.state.canStartArrow=!1,s.expression=this.parseExprSubscripts();return this.finishNode(s,"Decorator")}parseMaybeDecoratorArguments(s,t){if(this.eat(6)){let e=this.startNodeAt(t);return e.callee=s,e.arguments=this.parseCallExpressionArguments(),this.toReferencedList(e.arguments),this.finishNode(e,"CallExpression")}return s}parseBreakContinueStatement(s,t){return this.next(),this.isLineTerminator()?s.label=null:(s.label=this.parseIdentifier(),this.semicolon()),this.verifyBreakContinue(s,t),this.finishNode(s,t?"BreakStatement":"ContinueStatement")}verifyBreakContinue(s,t){let e;for(e=0;e<this.state.labels.length;++e){let i=this.state.labels[e];if((s.label==null||i.name===s.label.name)&&(i.kind!=null&&(t||i.kind===1)||s.label&&t))break}if(e===this.state.labels.length){let i=t?"BreakStatement":"ContinueStatement";this.raise(c.IllegalBreakContinue,s,{type:i})}}parseDebuggerStatement(s){return this.next(),this.semicolon(),this.finishNode(s,"DebuggerStatement")}parseHeaderExpression(){this.expect(6);let s=this.parseExpression();return this.expect(7),s}parseDoWhileStatement(s){return this.next(),this.state.labels.push(bt),s.body=this.parseStatement(),this.state.labels.pop(),this.expect(88),s.test=this.parseHeaderExpression(),this.eat(9),this.finishNode(s,"DoWhileStatement")}parseForStatement(s){this.next(),this.state.labels.push(bt);let t=null;if(this.isContextual(92)&&this.recordAwaitIfAllowed()&&(t=this.state.startLoc,this.next()),this.scope.enter(0),this.expect(6),this.match(9))return t!==null&&this.unexpected(t),this.parseFor(s,null);let e=this.isContextual(96);{let h=this.isAwaitUsing(),l=h||this.isForUsing(),p=e&&this.hasFollowingBindingAtom()||l;if(this.match(70)||this.match(71)||p){let u=this.startNode(),f;h?(f="await using",this.recordAwaitIfAllowed()||this.raise(c.AwaitUsingNotInAsyncContext,this.state.startLoc),this.next()):f=this.state.value,this.next(),this.parseVar(u,!0,f);let y=this.finishNode(u,"VariableDeclaration"),P=this.match(54);return P&&l&&this.raise(c.ForInUsing,y),(P||this.isContextual(98))&&y.declarations.length===1?this.parseForIn(s,y,t):(t!==null&&this.unexpected(t),this.parseFor(s,y))}}let i=this.isContextual(91),r=new X,a=this.parseExpression(!0,r),o=this.isContextual(98);if(o&&(e&&this.raise(c.ForOfLet,a),t===null&&i&&a.type==="Identifier"&&this.raise(c.ForOfAsync,a)),o||this.match(54)){this.checkDestructuringPrivate(r),this.toAssignable(a,!0);let h=o?"ForOfStatement":"ForInStatement";return this.checkLVal(a,{type:h}),this.parseForIn(s,a,t)}else this.checkExpressionErrors(r,!0);return t!==null&&this.unexpected(t),this.parseFor(s,a)}parseFunctionStatement(s,t,e){return this.next(),this.parseFunction(s,1|(e?2:0)|(t?8:0))}parseIfStatement(s){return this.next(),s.test=this.parseHeaderExpression(),s.consequent=this.parseStatementOrSloppyAnnexBFunctionDeclaration(),s.alternate=this.eat(62)?this.parseStatementOrSloppyAnnexBFunctionDeclaration():null,this.finishNode(s,"IfStatement")}parseReturnStatement(s){return this.prodParam.hasReturn||this.raise(c.IllegalReturn,this.state.startLoc),this.next(),this.isLineTerminator()?s.argument=null:(s.argument=this.parseExpression(),this.semicolon()),this.finishNode(s,"ReturnStatement")}parseSwitchStatement(s){this.next(),s.discriminant=this.parseHeaderExpression();let t=s.cases=[];this.expect(2),this.state.labels.push(Gs),this.scope.enter(256);let e;for(let i;!this.match(4);)if(this.match(57)||this.match(61)){let r=this.match(57);e&&this.finishNode(e,"SwitchCase"),t.push(e=this.startNode()),e.consequent=[],this.next(),r?e.test=this.parseExpression():(i&&this.raise(c.MultipleDefaultsInSwitch,this.state.lastTokStartLoc),i=!0,e.test=null),this.expect(10)}else e?e.consequent.push(this.parseStatementListItem()):this.unexpected();return this.scope.exit(),e&&this.finishNode(e,"SwitchCase"),this.next(),this.state.labels.pop(),this.finishNode(s,"SwitchStatement")}parseThrowStatement(s){return this.next(),this.hasPrecedingLineBreak()&&this.raise(c.NewlineAfterThrow,this.state.lastTokEndLoc),s.argument=this.parseExpression(),this.semicolon(),this.finishNode(s,"ThrowStatement")}parseCatchClauseParam(){let s=this.parseBindingAtom();return this.scope.enter(this.options.annexB&&s.type==="Identifier"?8:0),this.checkLVal(s,{type:"CatchClause"},9),s}parseTryStatement(s){if(this.next(),s.block=this.parseBlock(),s.handler=null,this.match(58)){let t=this.startNode();this.next(),this.match(6)?(this.expect(6),t.param=this.parseCatchClauseParam(),this.expect(7)):(t.param=null,this.scope.enter(0)),t.body=this.parseBlock(!1,!1),this.scope.exit(),s.handler=this.finishNode(t,"CatchClause")}return s.finalizer=this.eat(63)?this.parseBlock():null,!s.handler&&!s.finalizer&&this.raise(c.NoCatchOrFinally,s),this.finishNode(s,"TryStatement")}parseVarStatement(s,t,e=!1){return this.next(),this.parseVar(s,!1,t,e),this.semicolon(),this.finishNode(s,"VariableDeclaration")}parseWhileStatement(s){return this.next(),s.test=this.parseHeaderExpression(),this.state.labels.push(bt),s.body=this.parseStatement(),this.state.labels.pop(),this.finishNode(s,"WhileStatement")}parseWithStatement(s){return this.state.strict&&this.raise(c.StrictWith,this.state.startLoc),this.next(),s.object=this.parseHeaderExpression(),s.body=this.parseStatement(),this.finishNode(s,"WithStatement")}parseEmptyStatement(s){return this.next(),this.finishNode(s,"EmptyStatement")}parseLabeledStatement(s,t,e,i){for(let a of this.state.labels)a.name===t&&this.raise(c.LabelRedeclaration,e,{labelName:t});let r=ys(this.state.type)?1:this.match(67)?2:null;for(let a=this.state.labels.length-1;a>=0;a--){let o=this.state.labels[a];if(o.statementStart===s.start)o.statementStart=this.sourceToOffsetPos(this.state.start),o.kind=r;else break}return this.state.labels.push({name:t,kind:r,statementStart:this.sourceToOffsetPos(this.state.start)}),s.body=i&8?this.parseStatementOrSloppyAnnexBFunctionDeclaration(!0):this.parseStatement(),this.state.labels.pop(),s.label=e,this.finishNode(s,"LabeledStatement")}parseExpressionStatement(s,t,e){return s.expression=t,this.semicolon(),this.finishNode(s,"ExpressionStatement")}parseBlock(s=!1,t=!0,e){let i=this.startNode();return s&&this.state.strictErrors.clear(),this.expect(2),t&&this.scope.enter(0),this.parseBlockBody(i,s,!1,4,e),t&&this.scope.exit(),this.finishNode(i,"BlockStatement")}isValidDirective(s){return s.type==="ExpressionStatement"&&s.expression.type==="StringLiteral"&&!s.expression.extra.parenthesized}parseBlockBody(s,t,e,i,r){let a=s.body=[],o=s.directives=[];this.parseBlockOrModuleBlockBody(a,t?o:void 0,e,i,r)}parseBlockOrModuleBlockBody(s,t,e,i,r){let a=this.state.strict,o=!1,h=!1;for(;!this.match(i);){let l=e?this.parseModuleItem():this.parseStatementListItem();if(t&&!h){if(this.isValidDirective(l)){let p=this.stmtToDirective(l);t.push(p),!o&&p.value.value==="use strict"&&(o=!0,this.setStrict(!0));continue}h=!0,this.state.strictErrors.clear()}s.push(l)}r?.call(this,o),a||this.setStrict(!1),this.next()}parseFor(s,t){return s.init=t,this.semicolon(!1),s.test=this.match(9)?null:this.parseExpression(),this.semicolon(!1),s.update=this.match(7)?null:this.parseExpression(),this.expect(7),s.body=this.parseStatement(),this.scope.exit(),this.state.labels.pop(),this.finishNode(s,"ForStatement")}parseForIn(s,t,e){let i=this.match(54);return this.next(),i?e!==null&&this.unexpected(e):s.await=e!==null,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(c.ForInOfLoopInitializer,t,{type:i?"ForInStatement":"ForOfStatement"}),t.type==="AssignmentPattern"&&this.raise(c.InvalidLhs,t,{ancestor:{type:"ForStatement"}}),s.left=t,s.right=i?this.parseExpression():this.parseMaybeAssignAllowIn(),this.expect(7),s.body=this.parseStatement(),this.scope.exit(),this.state.labels.pop(),this.finishNode(s,i?"ForInStatement":"ForOfStatement")}parseVar(s,t,e,i=!1){let r=s.declarations=[];for(s.kind=e;;){let a=this.startNode();if(this.parseVarId(a,e),a.init=this.eat(25)?t?this.parseMaybeAssignDisallowIn():this.parseMaybeAssignAllowIn():null,a.init===null&&!i&&(a.id.type!=="Identifier"&&!(t&&(this.match(54)||this.isContextual(98)))?this.raise(c.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:"destructuring"}):(e==="const"||e==="using"||e==="await using")&&!(this.match(54)||this.isContextual(98))&&this.raise(c.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:e})),r.push(this.finishNode(a,"VariableDeclarator")),!this.eat(8))break}return s}parseVarId(s,t){let e=this.parseBindingAtom();t==="using"||t==="await using"?(e.type==="ArrayPattern"||e.type==="ObjectPattern")&&this.raise(c.UsingDeclarationHasBindingPattern,e):e.type==="VoidPattern"&&this.raise(c.UnexpectedVoidPattern,e),this.checkLVal(e,{type:"VariableDeclarator"},t==="var"?5:8201),s.id=e}parseAsyncFunctionExpression(s){return this.parseFunction(s,8)}parseFunction(s,t=0){let e=t&2,i=!!(t&1),r=i&&!(t&4),a=!!(t&8);return this.initFunction(s,a),this.match(51)&&(e&&this.raise(c.GeneratorInSingleStatementContext,this.state.startLoc),this.next(),s.generator=!0),i&&(s.id=this.parseFunctionId(r)),this.scope.enter(514),this.prodParam.enter(ut(a,s.generator)),i||(s.id=this.parseFunctionId()),this.parseFunctionParams(s,!1),this.parseFunctionBodyAndFinish(s,i?"FunctionDeclaration":"FunctionExpression"),this.prodParam.exit(),this.scope.exit(),i&&!e&&this.registerFunctionStatementId(s),s}parseFunctionId(s){return s||S(this.state.type)?this.parseIdentifier():null}parseFunctionParams(s,t){this.expect(6),this.expressionScope.enter(Ws()),s.params=this.parseBindingList(7,41,2|(t?4:0)),this.expressionScope.exit()}registerFunctionStatementId(s){s.id&&this.scope.declareName(s.id.name,!this.options.annexB||this.state.strict||s.generator||s.async?this.scope.treatFunctionsAsVar?5:8201:17,s.id.start)}parseClass(s,t,e){this.next();let i=this.state.strict;return this.state.strict=!0,this.parseClassId(s,t,e),this.parseClassSuper(s),s.body=this.parseClassBody(!!s.superClass,i),this.finishNode(s,t?"ClassDeclaration":"ClassExpression")}isClassProperty(){return this.match(25)||this.match(9)||this.match(4)}isClassMethod(){return this.match(6)}nameIsConstructor(s){return s.type==="Identifier"&&s.name==="constructor"||s.type==="StringLiteral"&&s.value==="constructor"}isNonstaticConstructor(s){return!s.computed&&!s.static&&this.nameIsConstructor(s.key)}parseClassBody(s,t){this.classScope.enter();let e={hadConstructor:!1,hadSuperClass:s},i=[],r=this.startNode();for(r.body=[],this.expect(2);!this.match(4);){if(this.eat(9)){if(i.length>0)throw this.raise(c.DecoratorSemicolon,this.state.lastTokEndLoc);continue}if(this.match(22)){i.push(this.parseDecorator());continue}let a=this.startNode();i.length&&(a.decorators=i,this.resetStartLocationFromNode(a,i[0]),i=[]),this.parseClassMember(r,a,e)}if(this.state.strict=t,this.next(),i.length)throw this.raise(c.TrailingDecorator,this.state.startLoc);return this.classScope.exit(),this.finishNode(r,"ClassBody")}parseClassMemberFromModifier(s,t){let e=this.parseIdentifier(!0);if(this.isClassMethod()){let i=t;return i.kind="method",i.computed=!1,i.key=e,i.static=!1,this.pushClassMethod(s,i,!1,!1,!1,!1),!0}else if(this.isClassProperty()){let i=t;return i.computed=!1,i.key=e,i.static=!1,s.body.push(this.parseClassProperty(i)),!0}return this.resetPreviousNodeTrailingComments(e),!1}parseClassMember(s,t,e){let i=this.isContextual(102);if(i){if(this.parseClassMemberFromModifier(s,t))return;if(this.eat(2)){this.parseClassStaticBlock(s,t);return}}this.parseClassMemberWithIsStatic(s,t,e,i)}parseClassMemberWithIsStatic(s,t,e,i){let r=t,a=t,o=t,h=t,l=t,p=r,u=r;if(t.static=i,this.parsePropertyNamePrefixOperator(t),this.eat(51)){p.kind="method";let C=this.match(134);if(this.parseClassElementName(p),this.parsePostMemberNameModifiers(p),C){this.pushClassPrivateMethod(s,a,!0,!1);return}this.isNonstaticConstructor(r)&&this.raise(c.ConstructorIsGenerator,r.key),this.pushClassMethod(s,r,!0,!1,!1,!1);return}let f=!this.state.containsEsc&&S(this.state.type),y=this.parseClassElementName(t),P=f?y.name:null,E=this.isPrivateName(y),N=this.state.startLoc;if(this.parsePostMemberNameModifiers(u),this.isClassMethod()){if(p.kind="method",E){this.pushClassPrivateMethod(s,a,!1,!1);return}let C=this.isNonstaticConstructor(r),I=!1;C&&(r.kind="constructor",r.decorators&&r.decorators.length>0&&this.raise(c.DecoratorConstructor,t),e.hadConstructor&&!this.hasPlugin("typescript")&&this.raise(c.DuplicateConstructor,y),C&&this.hasPlugin("typescript")&&t.override&&this.raise(c.OverrideOnConstructor,y),e.hadConstructor=!0,I=e.hadSuperClass),this.pushClassMethod(s,r,!1,!1,C,I)}else if(this.isClassProperty())E?this.pushClassPrivateProperty(s,h):this.pushClassProperty(s,o);else if(P==="async"&&!this.isLineTerminator()){this.resetPreviousNodeTrailingComments(y);let C=this.eat(51);u.optional&&this.unexpected(N),p.kind="method";let I=this.match(134);this.parseClassElementName(p),this.parsePostMemberNameModifiers(u),I?this.pushClassPrivateMethod(s,a,C,!0):(this.isNonstaticConstructor(r)&&this.raise(c.ConstructorIsAsync,r.key),this.pushClassMethod(s,r,C,!0,!1,!1))}else if((P==="get"||P==="set")&&!(this.match(51)&&this.isLineTerminator())){this.resetPreviousNodeTrailingComments(y),p.kind=P;let C=this.match(134);this.parseClassElementName(r),C?this.pushClassPrivateMethod(s,a,!1,!1):(this.isNonstaticConstructor(r)&&this.raise(c.ConstructorIsAccessor,r.key),this.pushClassMethod(s,r,!1,!1,!1,!1)),this.checkGetterSetterParams(r)}else if(P==="accessor"&&!this.isLineTerminator()){this.expectPlugin("decoratorAutoAccessors"),this.resetPreviousNodeTrailingComments(y);let C=this.match(134);this.parseClassElementName(o),this.pushClassAccessorProperty(s,l,C)}else this.isLineTerminator()?E?this.pushClassPrivateProperty(s,h):this.pushClassProperty(s,o):this.unexpected()}parseClassElementName(s){let{type:t,value:e}=this.state;if((t===128||t===130)&&s.static&&e==="prototype"&&this.raise(c.StaticPrototype,this.state.startLoc),t===134){e==="constructor"&&this.raise(c.ConstructorClassPrivateField,this.state.startLoc);let i=this.parsePrivateName();return s.key=i,i}return this.parsePropertyName(s),s.key}parseClassStaticBlock(s,t){this.scope.enter(720);let e=this.state.labels;this.state.labels=[],this.prodParam.enter(0);let i=t.body=[];this.parseBlockOrModuleBlockBody(i,void 0,!1,4),this.prodParam.exit(),this.scope.exit(),this.state.labels=e,s.body.push(this.finishNode(t,"StaticBlock")),t.decorators?.length&&this.raise(c.DecoratorStaticBlock,t)}pushClassProperty(s,t){!t.computed&&this.nameIsConstructor(t.key)&&this.raise(c.ConstructorClassField,t.key),s.body.push(this.parseClassProperty(t))}pushClassPrivateProperty(s,t){let e=this.parseClassPrivateProperty(t);s.body.push(e),this.classScope.declarePrivateName(this.getPrivateNameSV(e.key),0,e.key.start)}pushClassAccessorProperty(s,t,e){!e&&!t.computed&&this.nameIsConstructor(t.key)&&this.raise(c.ConstructorClassField,t.key);let i=this.parseClassAccessorProperty(t);s.body.push(i),e&&this.classScope.declarePrivateName(this.getPrivateNameSV(i.key),0,i.key.start)}pushClassMethod(s,t,e,i,r,a){s.body.push(this.parseMethod(t,e,i,r,a,"ClassMethod",!0))}pushClassPrivateMethod(s,t,e,i){let r=this.parseMethod(t,e,i,!1,!1,"ClassPrivateMethod",!0);s.body.push(r);let a=r.kind==="get"?r.static?6:2:r.kind==="set"?r.static?5:1:0;this.declareClassPrivateMethodInScope(r,a)}declareClassPrivateMethodInScope(s,t){this.classScope.declarePrivateName(this.getPrivateNameSV(s.key),t,s.key.start)}parsePostMemberNameModifiers(s){}parseClassPrivateProperty(s){return this.parseInitializer(s),this.semicolon(),this.finishNode(s,"ClassPrivateProperty")}parseClassProperty(s){return this.parseInitializer(s),this.semicolon(),this.finishNode(s,"ClassProperty")}parseClassAccessorProperty(s){return this.parseInitializer(s),this.semicolon(),this.finishNode(s,"ClassAccessorProperty")}parseInitializer(s){this.scope.enter(592),this.expressionScope.enter(Me()),this.prodParam.enter(0),s.value=this.eat(25)?this.parseMaybeAssignAllowIn():null,this.expressionScope.exit(),this.prodParam.exit(),this.scope.exit()}parseClassId(s,t,e,i=8331){if(S(this.state.type))s.id=this.parseIdentifier(),t&&this.declareNameFromIdentifier(s.id,i);else if(e||!t)s.id=null;else throw this.raise(c.MissingClassName,this.state.startLoc)}parseClassSuper(s){this.eat(77)?(this.state.canStartArrow=!1,s.superClass=this.parseExprSubscripts()):s.superClass=null}parseExport(s,t){let e=this.parseMaybeImportPhase(s,!0),i=this.maybeParseExportDefaultSpecifier(s,e),r=!i||this.eat(8),a=r&&this.eatExportStar(s),o=a&&this.maybeParseExportNamespaceSpecifier(s),h=r&&(!o||this.eat(8)),l=i||a;if(a&&!o){if(i&&this.unexpected(),t)throw this.raise(c.UnsupportedDecoratorExport,s);return this.parseExportFrom(s,!0),this.sawUnambiguousESM=!0,this.finishNode(s,"ExportAllDeclaration")}let p=this.maybeParseExportNamedSpecifiers(s);i&&r&&!a&&!p&&this.unexpected(null,2),o&&h&&this.unexpected(null,94);let u;if(l||p){if(u=!1,t)throw this.raise(c.UnsupportedDecoratorExport,s);this.parseExportFrom(s,l)}else u=this.maybeParseExportDeclaration(s);if(l||p||u){let f=s;if(this.checkExport(f,!0,!1,!!f.source),f.declaration?.type==="ClassDeclaration")this.maybeTakeDecorators(t,f.declaration,f);else if(t)throw this.raise(c.UnsupportedDecoratorExport,s);return this.sawUnambiguousESM=!0,this.finishNode(f,"ExportNamedDeclaration")}if(this.eat(61)){let f=s,y=this.parseExportDefaultExpression();if(f.declaration=y,y.type==="ClassDeclaration")this.maybeTakeDecorators(t,y,f);else if(t)throw this.raise(c.UnsupportedDecoratorExport,s);return this.checkExport(f,!0,!0),this.sawUnambiguousESM=!0,this.finishNode(f,"ExportDefaultDeclaration")}throw this.unexpected(null,2)}eatExportStar(s){return this.eat(51)}maybeParseExportDefaultSpecifier(s,t){if(t||this.isExportDefaultSpecifier()){this.expectPlugin("exportDefaultFrom",t?.start);let e=t||this.parseIdentifier(!0),i=this.startNodeAtNode(e);return i.exported=e,s.specifiers=[this.finishNode(i,"ExportDefaultSpecifier")],!0}return!1}maybeParseExportNamespaceSpecifier(s){if(this.isContextual(89)){s.specifiers??=[];let t=this.startNodeAt(this.state.lastTokStartLoc);return this.next(),t.exported=this.parseModuleExportName(),s.specifiers.push(this.finishNode(t,"ExportNamespaceSpecifier")),!0}return!1}maybeParseExportNamedSpecifiers(s){if(this.match(2)){let t=s;t.specifiers||(t.specifiers=[]);let e=t.exportKind==="type";return t.specifiers.push(...this.parseExportSpecifiers(e)),t.source=null,t.attributes=[],t.declaration=null,!0}return!1}maybeParseExportDeclaration(s){return this.shouldParseExportDeclaration()?(s.specifiers=[],s.source=null,s.attributes=[],s.declaration=this.parseExportDeclaration(s),!0):!1}isAsyncFunction(){if(!this.isContextual(91))return!1;let s=this.nextTokenInLineStart();return this.isUnparsedContextual(s,"function")}parseExportDefaultExpression(){let s=this.startNode();if(this.match(64))return this.next(),this.parseFunction(s,5);if(this.isAsyncFunction())return this.next(),this.next(),this.parseFunction(s,13);if(this.match(76))return this.parseClass(s,!0,!0);if(this.match(22))return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(!1),this.startNode()),!0,!0);if(this.match(71)||this.match(70)||this.isLet()||this.isUsing()||this.isAwaitUsing())throw this.raise(c.UnsupportedDefaultExport,this.state.startLoc);let t=this.parseMaybeAssignAllowIn();return this.semicolon(),t}parseExportDeclaration(s){return this.match(76)?this.parseClass(this.startNode(),!0,!1):this.parseStatementListItem()}isExportDefaultSpecifier(){let{type:s}=this.state;if(S(s)){if(s===91&&!this.state.containsEsc||s===96)return!1;if((s===126||s===125)&&!this.state.containsEsc){let i=this.nextTokenStart(),r=this.input.charCodeAt(i);if(r===123||this.chStartsBindingIdentifier(r,i)&&!this.input.startsWith("from",i))return this.expectOnePlugin(["flow","typescript"]),!1}}else if(!this.match(61))return!1;let t=this.nextTokenStart(),e=this.isUnparsedContextual(t,"from");if(this.input.charCodeAt(t)===44||S(this.state.type)&&e)return!0;if(this.match(61)&&e){let i=this.input.charCodeAt(this.nextTokenStartSince(t+4));return i===34||i===39}return!1}parseExportFrom(s,t){this.eatContextual(94)?(s.source=this.parseImportSource(),this.checkExport(s),this.maybeParseImportAttributes(s)):t&&this.unexpected(),this.semicolon()}shouldParseExportDeclaration(){let{type:s}=this.state;return s===22&&(this.expectOnePlugin(["decorators","decorators-legacy"]),this.hasPlugin("decorators"))?!0:this.isUsing()?(this.raise(c.UsingDeclarationExport,this.state.startLoc),!0):this.isAwaitUsing()?(this.raise(c.UsingDeclarationExport,this.state.startLoc),!0):s===70||s===71||s===64||s===76||this.isLet()||this.isAsyncFunction()}checkExport(s,t,e,i){if(t){if(e){if(this.checkDuplicateExports(s,"default"),this.hasPlugin("exportDefaultFrom")){let r=s.declaration;r.type==="Identifier"&&r.name==="from"&&r.end-r.start===4&&!r.extra?.parenthesized&&this.raise(c.ExportDefaultFromAsIdentifier,r)}}else if(s.specifiers?.length)for(let r of s.specifiers){let{exported:a}=r,o=a.type==="Identifier"?a.name:a.value;if(this.checkDuplicateExports(r,o),!i&&r.local){let{local:h}=r;h.type!=="Identifier"?this.raise(c.ExportBindingIsString,r,{localName:h.value,exportName:o}):(this.checkReservedWord(h.name,h.start,!0,!1),this.scope.checkLocalExport(h))}}else if(s.declaration){let r=s.declaration;if(r.type==="FunctionDeclaration"||r.type==="ClassDeclaration"){let{id:a}=r;if(!a)throw new Error("Assertion failure");this.checkDuplicateExports(s,a.name)}else if(r.type==="VariableDeclaration")for(let a of r.declarations)this.checkDeclaration(a.id)}}}checkDeclaration(s){if(s.type==="Identifier")this.checkDuplicateExports(s,s.name);else if(s.type==="ObjectPattern")for(let t of s.properties)this.checkDeclaration(t);else if(s.type==="ArrayPattern")for(let t of s.elements)t&&this.checkDeclaration(t);else s.type==="ObjectProperty"?this.checkDeclaration(s.value):s.type==="RestElement"?this.checkDeclaration(s.argument):s.type==="AssignmentPattern"&&this.checkDeclaration(s.left)}checkDuplicateExports(s,t){this.exportedIdentifiers.has(t)&&(t==="default"?this.raise(c.DuplicateDefaultExport,s):this.raise(c.DuplicateExport,s,{exportName:t})),this.exportedIdentifiers.add(t)}parseExportSpecifiers(s){let t=[],e=!0;for(this.expect(2);!this.eat(4);){if(e)e=!1;else if(this.expect(8),this.eat(4))break;let i=this.isContextual(126),r=this.match(130),a=this.startNode();a.local=this.parseModuleExportName(),t.push(this.parseExportSpecifier(a,r,s,i))}return t}parseExportSpecifier(s,t,e,i){return this.eatContextual(89)?s.exported=this.parseModuleExportName():t?s.exported=this.cloneStringLiteral(s.local):s.exported||(s.exported=this.cloneIdentifier(s.local)),this.finishNode(s,"ExportSpecifier")}parseModuleExportName(){if(this.match(130)){let s=this.parseStringLiteral(this.state.value),t=Ys.exec(s.value);return t&&this.raise(c.ModuleExportNameHasLoneSurrogate,s,{surrogateCharCode:t[0].charCodeAt(0)}),s}return this.parseIdentifier(!0)}checkImportPhase(s){let{specifiers:t}=s,e=t.length===1?t[0].type:null;s.phase==="source"?e!=="ImportDefaultSpecifier"&&this.raise(c.SourcePhaseImportRequiresDefault,t[0]):s.phase==="defer"&&e!=="ImportNamespaceSpecifier"&&this.raise(c.DeferImportRequiresNamespace,t[0])}isPotentialImportPhase(s){return s?!1:this.isContextual(101)||this.isContextual(93)}applyImportPhase(s,t,e,i){t||(e==="source"?(this.expectPlugin("sourcePhaseImports",i),s.phase="source"):e==="defer"?(this.expectPlugin("deferredImportEvaluation",i),s.phase="defer"):this.hasPlugin("sourcePhaseImports")&&(s.phase=null))}parseMaybeImportPhase(s,t){if(!this.isPotentialImportPhase(t))return this.applyImportPhase(s,t,null),null;let e=this.startNode(),i=this.parseIdentifierName(!0),{type:r}=this.state;return(O(r)?r!==94||this.lookaheadCharCode()===102:r!==8)?(this.applyImportPhase(s,t,i,e.start),null):(this.applyImportPhase(s,t,null),this.createIdentifier(e,i))}isPrecedingIdImportPhase(s){let{type:t}=this.state;return S(t)?t!==94||this.lookaheadCharCode()===102:t!==8}parseImport(s){return this.match(130)?this.parseImportSourceAndAttributes(s):this.parseImportSpecifiersAndAfter(s,this.parseMaybeImportPhase(s,!1))}parseImportSpecifiersAndAfter(s,t){s.specifiers=[];let i=!this.maybeParseDefaultImportSpecifier(s,t)||this.eat(8),r=i&&this.maybeParseStarImportSpecifier(s);return i&&!r&&this.parseNamedImportSpecifiers(s),this.expectContextual(94),this.parseImportSourceAndAttributes(s)}parseImportSourceAndAttributes(s){return s.specifiers??=[],s.source=this.parseImportSource(),this.maybeParseImportAttributes(s),this.checkImportPhase(s),this.semicolon(),this.sawUnambiguousESM=!0,this.finishNode(s,"ImportDeclaration")}parseImportSource(){return this.match(130)||this.unexpected(),this.parseExprAtom()}parseImportSpecifierLocal(s,t,e){t.local=this.parseIdentifier(),s.specifiers.push(this.finishImportSpecifier(t,e))}finishImportSpecifier(s,t,e=8201){return this.checkLVal(s.local,{type:t},e),this.finishNode(s,t)}parseImportAttributes(){this.expect(2);let s=[],t=new Set;do{if(this.match(4))break;let e=this.startNode(),i=this.state.value;if(t.has(i)&&this.raise(c.ModuleAttributesWithDuplicateKeys,this.state.startLoc,{key:i}),t.add(i),this.match(130)?e.key=this.parseStringLiteral(i):e.key=this.parseIdentifier(!0),this.expect(10),!this.match(130))throw this.raise(c.ModuleAttributeInvalidValue,this.state.startLoc);e.value=this.parseStringLiteral(this.state.value),s.push(this.finishNode(e,"ImportAttribute"))}while(this.eat(8));return this.expect(4),s}maybeParseImportAttributes(s){let t;if(this.match(72)){if(this.hasPrecedingLineBreak()&&this.lookaheadCharCode()===40)return;this.next(),t=this.parseImportAttributes()}else t=[];s.attributes=t}maybeParseDefaultImportSpecifier(s,t){if(t){let e=this.startNodeAtNode(t);return e.local=t,s.specifiers.push(this.finishImportSpecifier(e,"ImportDefaultSpecifier")),!0}else if(O(this.state.type))return this.parseImportSpecifierLocal(s,this.startNode(),"ImportDefaultSpecifier"),!0;return!1}maybeParseStarImportSpecifier(s){if(this.match(51)){let t=this.startNode();return this.next(),this.expectContextual(89),this.parseImportSpecifierLocal(s,t,"ImportNamespaceSpecifier"),!0}return!1}parseNamedImportSpecifiers(s){let t=!0;for(this.expect(2);!this.eat(4);){if(t)t=!1;else{if(this.eat(10))throw this.raise(c.DestructureNamedImport,this.state.startLoc);if(this.expect(8),this.eat(4))break}let e=this.startNode(),i=this.match(130),r=this.isContextual(126);e.imported=this.parseModuleExportName();let a=this.parseImportSpecifier(e,i,s.importKind==="type"||s.importKind==="typeof",r,void 0);s.specifiers.push(a)}}parseImportSpecifier(s,t,e,i,r){if(this.eatContextual(89))s.local=this.parseIdentifier();else{let{imported:a}=s;if(t)throw this.raise(c.ImportBindingIsString,s,{importName:a.value});this.checkReservedWord(a.name,s.start,!0,!0),s.local||(s.local=this.cloneIdentifier(a))}return this.finishImportSpecifier(s,"ImportSpecifier",r)}isThisParam(s){return s.type==="Identifier"&&s.name==="this"}},Ct=/in(?:stanceof)?|as|satisfies/y;function Zs(n){if(n==null)throw new Error(`Unexpected ${n} value.`);return n}function xe(n){if(!n)throw new Error("Assert fail")}var Qs={AbstractMethodHasImplementation:({methodName:n})=>`Method '${n}' cannot have an implementation because it is marked abstract.`,AbstractPropertyHasInitializer:({propertyName:n})=>`Property '${n}' 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.",DeclaratorDefiniteAssertionRequiresTypeAnnotation:"Declarations with definite assignment assertions must also have type annotations.",DeclaratorDefiniteAssertionWithInitializer:"Declarations with initializers cannot also have definite assignment assertions.",DeclareAccessor:({kind:n})=>`'declare' is not allowed in ${n}ters.`,DeclareClassFieldHasInitializer:"Initializers are not allowed in ambient contexts.",DeclareFunctionHasImplementation:"An implementation cannot be declared in ambient contexts.",DecoratorAbstractMethod:({kind:n})=>`Decorators can't be used with ${n.startsWith("a")?"an":"a"} ${n}.`,DuplicateAccessibilityModifier:({modifier:n})=>`Accessibility modifier already seen: '${n}'.`,DuplicateModifier:({modifier:n})=>`Duplicate modifier: '${n}'.`,EmptyHeritageClauseType:({token:n})=>`'${n}' list cannot be empty.`,EmptyNamespaceName:"Namespace must be given a name.",EmptyTypeArguments:"Type argument list cannot be empty.",EmptyTypeParameters:"Type parameter list cannot be empty.",ExpectedAmbientAfterExportDeclare:"'export declare' must be followed by an ambient declaration.",ExportAssignmentInTSNamespace:"An export assignment cannot be used in a namespace.",ExportInTSNamespace:"Export declarations are not permitted in a namespace.",ImportAliasHasImportType:"An import alias can not use 'import type'.",ImportInTSNamespace:"Import declarations in a namespace cannot reference a module.",IncompatibleModifiers:({modifiers:n})=>`'${n[0]}' modifier cannot be used with '${n[1]}' modifier.`,IndexSignatureHasAbstract:"Index signatures cannot have the 'abstract' modifier.",IndexSignatureHasAccessibility:({modifier:n})=>`Index signatures cannot have an accessibility modifier ('${n}').`,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.",InlineModuleDeclarationMustUseString:"`module ... {}` declarations must have a string name. Use `namespace ... {}` instead.",InvalidHeritageClauseType:({token:n})=>`'${n}' list can only include identifiers or qualified-names with optional type arguments.`,InvalidModifierOnAwaitUsingDeclaration:n=>`'${n}' modifier cannot appear on an await using declaration.`,InvalidModifierOnTypeMember:({modifier:n})=>`'${n}' modifier cannot appear on a type member.`,InvalidModifierOnTypeParameter:({modifier:n})=>`'${n}' modifier cannot appear on a type parameter.`,InvalidModifierOnTypeParameterPositions:({modifier:n})=>`'${n}' modifier can only appear on a type parameter of a class, interface or type alias.`,InvalidModifierOnUsingDeclaration:n=>`'${n}' modifier cannot appear on a using declaration.`,InvalidModifiersOrder:({orderedModifiers:n})=>`'${n[0]}' modifier must precede '${n[1]}' modifier.`,InvalidNamespaceName:n=>`Namespace name cannot be '${n}'.`,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.",NamespaceExportInTSNamespace:"Global module exports may only appear at top level.",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:n})=>`Private elements cannot have an accessibility modifier ('${n}').`,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:n})=>`Single type parameter ${n} should have a trailing comma. Example usage: <${n},>.`,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.",UnexpectedParameterInitializer:"A parameter initializer is only allowed in a function or constructor implementation.",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.",UnexpectedTypeDeclaration:n=>`'${n}' declarations can only be declared inside a block.`,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:n})=>`Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${n}.`,UsingDeclarationInAmbientContext:n=>`'${n}' declarations are not allowed in ambient contexts.`},d=M`typescript`(Qs);function ti(n){switch(n){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}}function ge(n){return n==="private"||n==="public"||n==="protected"}function ei(n){return n==="in"||n==="out"}function Wt(n){if(n.extra?.parenthesized)return!1;switch(n.type){case"Identifier":return!0;case"MemberExpression":return!n.computed&&Wt(n.object);case"TSInstantiationExpression":return Wt(n.expression);default:return!1}}var si=n=>class extends n{getScopeHandler(){return vt}tsIsIdentifier(){return S(this.state.type)}tsTokenCanFollowModifier(){return this.match(0)||this.match(2)||this.match(51)||this.match(17)||this.match(134)||this.isLiteralPropertyName()}tsNextTokenOnSameLineAndCanFollowModifier(){return this.next(),this.hasPrecedingLineBreak()?!1:this.tsTokenCanFollowModifier()}tsNextTokenCanFollowModifier(){return this.match(102)?(this.next(),this.tsTokenCanFollowModifier()):this.tsNextTokenOnSameLineAndCanFollowModifier()}tsParseModifier(t,e,i){if(!S(this.state.type)&&this.state.type!==54&&this.state.type!==71)return;let r=this.state.value;if(t.includes(r)){if(i&&this.match(102)||e&&this.tsIsStartOfStaticBlocks())return;if(this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this)))return r}}tsParseModifiers({allowedModifiers:t,disallowedModifiers:e,stopOnStartOfClassStaticBlock:i,errorTemplate:r=d.InvalidModifierOnTypeMember},a){let o=(l,p,u,f)=>{p===u&&a[f]&&this.raise(d.InvalidModifiersOrder,l,{orderedModifiers:[u,f]})},h=(l,p,u,f)=>{(a[u]&&p===f||a[f]&&p===u)&&this.raise(d.IncompatibleModifiers,l,{modifiers:[u,f]})};for(;;){let{startLoc:l}=this.state,p=this.tsParseModifier(t.concat(e??[]),i,a.static);if(!p)break;ge(p)?a.accessibility?this.raise(d.DuplicateAccessibilityModifier,l,{modifier:p}):(o(l,p,p,"override"),o(l,p,p,"static"),o(l,p,p,"readonly"),a.accessibility=p):ei(p)?(a[p]&&this.raise(d.DuplicateModifier,l,{modifier:p}),a[p]=!0,o(l,p,"in","out")):(Object.hasOwn(a,p)?this.raise(d.DuplicateModifier,l,{modifier:p}):(o(l,p,"static","readonly"),o(l,p,"static","override"),o(l,p,"override","readonly"),o(l,p,"abstract","override"),h(l,p,"declare","override"),h(l,p,"static","abstract")),a[p]=!0),e?.includes(p)&&this.raise(r,l,{modifier:p})}}tsIsListTerminator(t){switch(t){case"EnumMembers":case"TypeMembers":return this.match(4);case"HeritageClauseElement":return this.match(2);case"TupleElementTypes":return this.match(1);case"TypeParametersOrArguments":return this.match(44)}}tsParseList(t,e){let i=[];for(;!this.tsIsListTerminator(t);)i.push(e());return i}tsParseDelimitedList(t,e,i){return Zs(this.tsParseDelimitedListWorker(t,e,!0,i))}tsParseDelimitedListWorker(t,e,i,r){let a=[],o=-1;for(;!this.tsIsListTerminator(t);){o=-1;let h=e();if(h==null)return;if(a.push(h),this.eat(8)){o=this.state.lastTokStartLoc.index;continue}if(this.tsIsListTerminator(t))break;i&&this.expect(8);return}return r&&(r.value=o),a}tsParseBracketedList(t,e,i,r,a){r||(i?this.expect(0):this.expect(43));let o=this.tsParseDelimitedList(t,e,a);return i?this.expect(1):this.expect(44),o}tsParseImportType(){let t=this.startNode();return this.expect(79),this.expect(6),this.match(130)?t.source=this.parseStringLiteral(this.state.value):(this.raise(d.UnsupportedImportTypeArgument,this.state.startLoc),t.source=this.tsParseNonConditionalType()),this.eat(8)?t.options=this.tsParseImportTypeOptions():t.options=null,this.expect(7),this.eat(12)&&(t.qualifier=this.tsParseEntityName(3)),this.match(43)&&(t.typeArguments=this.tsParseTypeArguments()),this.finishNode(t,"TSImportType")}tsParseImportTypeOptions(){let t=this.startNode();this.expect(2);let e=this.startNode();return this.isContextual(72)?(e.method=!1,e.key=this.parseIdentifier(!0),e.computed=!1,e.shorthand=!1):this.unexpected(null,72),this.expect(10),e.value=this.tsParseImportTypeWithPropertyValue(),t.properties=[this.finishObjectProperty(e)],this.eat(8),this.expect(4),this.finishNode(t,"ObjectExpression")}tsParseImportTypeWithPropertyValue(){let t=this.startNode(),e=[];for(this.expect(2);!this.match(4);){let i=this.state.type;S(i)||i===130?e.push(super.parsePropertyDefinition(null)):this.unexpected(),this.eat(8)}return t.properties=e,this.next(),this.finishNode(t,"ObjectExpression")}tsParseEntityName(t){let e;if(t&1&&this.match(74))if(t&2)e=this.parseIdentifier(!0);else{let i=this.startNode();this.next(),e=this.finishNode(i,"ThisExpression")}else e=this.parseIdentifier(!!(t&1));for(;this.eat(12);){let i=this.startNodeAtNode(e);i.left=e,i.right=this.parseIdentifier(!!(t&1)),e=this.finishNode(i,"TSQualifiedName")}return e}tsParseTypeReference(){let t=this.startNode();return t.typeName=this.tsParseEntityName(1),!this.hasPrecedingLineBreak()&&this.match(43)&&(t.typeArguments=this.tsParseTypeArguments()),this.finishNode(t,"TSTypeReference")}tsParseThisTypePredicate(t){this.next();let e=this.startNodeAtNode(t);return e.parameterName=t,e.typeAnnotation=this.tsParseTypeAnnotation(!1),e.asserts=!1,this.finishNode(e,"TSTypePredicate")}tsParseThisTypeNode(){let t=this.startNode();return this.next(),this.finishNode(t,"TSThisType")}tsParseTypeQuery(){let t=this.startNode();return this.expect(83),this.match(79)?t.exprName=this.tsParseImportType():t.exprName=this.tsParseEntityName(1),!this.hasPrecedingLineBreak()&&this.match(43)&&(t.typeArguments=this.tsParseTypeArguments()),this.finishNode(t,"TSTypeQuery")}tsParseInOutModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:["in","out"],disallowedModifiers:["const","public","private","protected","readonly","declare","abstract","override"],errorTemplate:d.InvalidModifierOnTypeParameter});tsParseConstModifier=this.tsParseModifiers.bind(this,{allowedModifiers:["const"],disallowedModifiers:["in","out"],errorTemplate:d.InvalidModifierOnTypeParameterPositions});tsParseInOutConstModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:["in","out","const"],disallowedModifiers:["public","private","protected","readonly","declare","abstract","override"],errorTemplate:d.InvalidModifierOnTypeParameter});tsParseTypeParameter(t){let e=this.startNode();return t(e),e.name=this.tsParseTypeParameterName(),e.constraint=this.tsEatThenParseType(77),e.default=this.tsEatThenParseType(25),this.finishNode(e,"TSTypeParameter")}tsTryParseTypeParameters(t){if(this.match(43))return this.tsParseTypeParameters(t)}tsParseTypeParameters(t){let e=this.startNode();this.match(43)||this.match(138)?this.next():this.unexpected();let i={value:-1};return e.params=this.tsParseBracketedList("TypeParametersOrArguments",this.tsParseTypeParameter.bind(this,t),!1,!0,i),e.params.length===0&&this.raise(d.EmptyTypeParameters,e),i.value!==-1&&this.addExtra(e,"trailingComma",i.value),this.finishNode(e,"TSTypeParameterDeclaration")}tsFillSignature(t,e){let i=t===15,r="params",a="returnType";e.typeParameters=this.tsTryParseTypeParameters(this.tsParseConstModifier),this.expect(6),e[r]=this.tsParseBindingListForSignature(),i?e[a]=this.tsParseTypeOrTypePredicateAnnotation(t):this.match(t)&&(e[a]=this.tsParseTypeOrTypePredicateAnnotation(t))}tsParseBindingListForSignature(){let t=super.parseBindingList(7,41,2);for(let e of t){let{type:i}=e;(i==="AssignmentPattern"||i==="TSParameterProperty")&&this.raise(d.UnsupportedSignatureParameterKind,e,{type:i})}return t}tsParseTypeMemberSemicolon(){!this.eat(8)&&!this.isLineTerminator()&&this.expect(9)}tsParseSignatureMember(t,e){return this.tsFillSignature(10,e),this.tsParseTypeMemberSemicolon(),this.finishNode(e,t)}tsIsUnambiguouslyIndexSignature(){return this.next(),S(this.state.type)?(this.next(),this.match(10)):!1}tsTryParseIndexSignature(t){if(!(this.match(0)&&this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this))))return;this.expect(0);let e=this.parseIdentifier();e.typeAnnotation=this.tsParseTypeAnnotation(),this.resetEndLocation(e),this.expect(1),t.parameters=[e];let i=this.tsTryParseTypeAnnotation();return i&&(t.typeAnnotation=i),this.tsParseTypeMemberSemicolon(),this.finishNode(t,"TSIndexSignature")}tsParsePropertyOrMethodSignature(t,e){if(this.eat(13)&&(t.optional=!0),this.match(6)||this.match(43)){e&&this.raise(d.ReadonlyForMethodSignature,t);let i=t;if(i.kind&&this.match(43)&&this.raise(d.AccessorCannotHaveTypeParameters,this.state.curPosition()),this.tsFillSignature(10,i),this.tsParseTypeMemberSemicolon(),i.kind==="get")i.params.length>0&&(this.raise(c.BadGetterArity,this.state.curPosition()),this.isThisParam(i.params[0])&&this.raise(d.AccessorCannotDeclareThisParameter,this.state.curPosition()));else if(i.kind==="set"){if(i.params.length!==1)this.raise(c.BadSetterArity,this.state.curPosition());else{let r=i.params[0];this.isThisParam(r)&&this.raise(d.AccessorCannotDeclareThisParameter,this.state.curPosition()),r.type==="Identifier"&&r.optional&&this.raise(d.SetAccessorCannotHaveOptionalParameter,this.state.curPosition()),r.type==="RestElement"&&this.raise(d.SetAccessorCannotHaveRestParameter,this.state.curPosition())}i.returnType&&this.raise(d.SetAccessorCannotHaveReturnType,i.returnType)}else i.kind="method";return this.finishNode(i,"TSMethodSignature")}else{let i=t;e&&(i.readonly=!0);let r=this.tsTryParseTypeAnnotation();return r&&(i.typeAnnotation=r),this.tsParseTypeMemberSemicolon(),this.finishNode(i,"TSPropertySignature")}}tsParseTypeMember(){let t=this.startNode();if(this.match(6)||this.match(43))return this.tsParseSignatureMember("TSCallSignatureDeclaration",t);if(this.match(73)){let i=this.startNode();return this.next(),this.match(6)||this.match(43)?this.tsParseSignatureMember("TSConstructSignatureDeclaration",t):(t.key=this.createIdentifier(i,"new"),this.tsParsePropertyOrMethodSignature(t,!1))}this.tsParseModifiers({allowedModifiers:["readonly"],disallowedModifiers:["declare","abstract","private","protected","public","static","override"]},t);let e=this.tsTryParseIndexSignature(t);return e||(super.parsePropertyName(t),!t.computed&&t.key.type==="Identifier"&&(t.key.name==="get"||t.key.name==="set")&&this.tsTokenCanFollowModifier()&&(t.kind=t.key.name,super.parsePropertyName(t),!this.match(6)&&!this.match(43)&&this.unexpected(null,6)),this.tsParsePropertyOrMethodSignature(t,!!t.readonly))}tsParseTypeLiteral(){let t=this.startNode();return t.members=this.tsParseObjectTypeMembers(),this.finishNode(t,"TSTypeLiteral")}tsParseObjectTypeMembers(){this.expect(2);let t=this.tsParseList("TypeMembers",this.tsParseTypeMember.bind(this));return this.expect(4),t}tsIsStartOfMappedType(){return this.next(),this.eat(49)?this.isContextual(118):(this.isContextual(118)&&this.next(),!this.match(0)||(this.next(),!this.tsIsIdentifier())?!1:(this.next(),this.match(54)))}tsParseMappedType(){let t=this.startNode();return this.expect(2),this.match(49)?(t.readonly=this.state.value,this.next(),this.expectContextual(118)):this.eatContextual(118)&&(t.readonly=!0),this.expect(0),t.key=this.tsParseTypeParameterName(),t.constraint=this.tsExpectThenParseType(54),t.nameType=this.eatContextual(89)?this.tsParseType():null,this.expect(1),this.match(49)?(t.optional=this.state.value,this.next(),this.expect(13)):this.eat(13)&&(t.optional=!0),t.typeAnnotation=this.tsTryParseType(),this.semicolon(),this.expect(4),this.finishNode(t,"TSMappedType")}tsParseTupleType(){let t=this.startNode();t.elementTypes=this.tsParseBracketedList("TupleElementTypes",this.tsParseTupleElementType.bind(this),!0,!1);let e=!1;return t.elementTypes.forEach(i=>{let{type:r}=i;e&&r!=="TSRestType"&&r!=="TSOptionalType"&&!(r==="TSNamedTupleMember"&&i.optional)&&this.raise(d.OptionalTypeBeforeRequired,i),e||=r==="TSNamedTupleMember"&&i.optional||r==="TSOptionalType"}),this.finishNode(t,"TSTupleType")}tsParseTupleElementType(){let t=this.state.startLoc,e=this.eat(17),{startLoc:i}=this.state,r,a,o,h,p=O(this.state.type)?this.lookaheadCharCode():null;if(p===58)r=!0,o=!1,a=this.parseIdentifier(!0),this.expect(10),h=this.tsParseType();else if(p===63){o=!0;let u=this.state.value,f=this.tsParseNonArrayType();this.lookaheadCharCode()===58?(r=!0,a=this.createIdentifier(this.startNodeAt(i),u),this.expect(13),this.expect(10),h=this.tsParseType()):(r=!1,h=f,this.expect(13))}else h=this.tsParseType(),o=this.eat(13),r=this.eat(10);if(r){let u;a?(u=this.startNodeAt(i),u.optional=o,u.label=a,u.elementType=h,this.eat(13)&&(u.optional=!0,this.raise(d.TupleOptionalAfterType,this.state.lastTokStartLoc))):(u=this.startNodeAt(i),u.optional=o,this.raise(d.InvalidTupleMemberLabel,h),u.label=h,u.elementType=this.tsParseType()),h=this.finishNode(u,"TSNamedTupleMember")}else if(o){let u=this.startNodeAt(i);u.typeAnnotation=h,h=this.finishNode(u,"TSOptionalType")}if(e){let u=this.startNodeAt(t);u.typeAnnotation=h,h=this.finishNode(u,"TSRestType")}return h}tsParseParenthesizedType(){let t=this.startNode();return this.expect(6),t.typeAnnotation=this.tsParseType(),this.expect(7),this.finishNode(t,"TSParenthesizedType")}tsParseFunctionOrConstructorType(t,e){let i=this.startNode();return t==="TSConstructorType"&&(i.abstract=!!e,e&&this.next(),this.next()),this.tsInAllowConditionalTypesContext(()=>this.tsFillSignature(15,i)),this.finishNode(i,t)}tsParseLiteralTypeNode(){let t=this.startNode();switch(this.state.type){case 131:case 132:case 130:case 81:case 82:t.literal=super.parseExprAtom();break;default:this.unexpected()}return this.finishNode(t,"TSLiteralType")}tsParseTemplateLiteralType(){let t=this.state.startLoc,e=this.parseTemplateElement(!1),i=[e];if(e.tail){let r=this.startNodeAt(t),a=this.startNodeAt(t);return a.expressions=[],a.quasis=i,r.literal=this.finishNode(a,"TemplateLiteral"),this.finishNode(r,"TSLiteralType")}else{let r=[];for(;!e.tail;)r.push(this.tsParseType()),this.readTemplateContinuation(),i.push(e=this.parseTemplateElement(!1));let a=this.startNodeAt(t);return a.types=r,a.quasis=i,this.finishNode(a,"TSTemplateLiteralType")}}parseTemplateSubstitution(){return this.state.inType?this.tsParseType():super.parseTemplateSubstitution()}tsParseThisTypeOrThisTypePredicate(){let t=this.tsParseThisTypeNode();return this.isContextual(112)&&!this.hasPrecedingLineBreak()?this.tsParseThisTypePredicate(t):t}tsParseNonArrayType(){switch(this.state.type){case 130:case 131:case 132:case 81:case 82:return this.tsParseLiteralTypeNode();case 49:if(this.state.value==="-"){let t=this.startNode(),e=this.lookahead();return e.type!==131&&e.type!==132&&this.unexpected(),t.literal=this.parseMaybeUnary(),this.finishNode(t,"TSLiteralType")}break;case 74:return this.tsParseThisTypeOrThisTypePredicate();case 83:return this.tsParseTypeQuery();case 79:return this.tsParseImportType();case 2:return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this))?this.tsParseMappedType():this.tsParseTypeLiteral();case 0:return this.tsParseTupleType();case 6:if(!(this.optionFlags&2048)){let t=this.state.startLoc;this.next();let e=this.tsParseType();return this.expect(7),this.addExtra(e,"parenthesized",!0),this.addExtra(e,"parenStart",t.index),e}return this.tsParseParenthesizedType();case 21:case 20:return this.tsParseTemplateLiteralType();default:{let{type:t}=this.state;if(S(t)||t===84||t===80){let e=t===84?"TSVoidKeyword":t===80?"TSNullKeyword":ti(this.state.value);if(e!==void 0&&this.lookaheadCharCode()!==46){let i=this.startNode();return this.next(),this.finishNode(i,e)}return this.tsParseTypeReference()}}}throw this.unexpected()}tsParseArrayTypeOrHigher(){let{startLoc:t}=this.state,e=this.tsParseNonArrayType();for(;!this.hasPrecedingLineBreak()&&this.eat(0);)if(this.match(1)){let i=this.startNodeAt(t);i.elementType=e,this.expect(1),e=this.finishNode(i,"TSArrayType")}else{let i=this.startNodeAt(t);i.objectType=e,i.indexType=this.tsParseType(),this.expect(1),e=this.finishNode(i,"TSIndexedAccessType")}return e}tsParseTypeOperator(){let t=this.startNode(),e=this.state.value;return this.next(),t.operator=e,t.typeAnnotation=this.tsParseTypeOperatorOrHigher(),e==="readonly"&&this.tsCheckTypeAnnotationForReadOnly(t),this.finishNode(t,"TSTypeOperator")}tsCheckTypeAnnotationForReadOnly(t){switch(t.typeAnnotation.type){case"TSTupleType":case"TSArrayType":return;default:this.raise(d.UnexpectedReadonly,t)}}tsParseInferType(){let t=this.startNode();this.expectContextual(111);let e=this.startNode();return e.name=this.tsParseTypeParameterName(),e.constraint=this.tsTryParse(()=>this.tsParseConstraintForInferType()),t.typeParameter=this.finishNode(e,"TSTypeParameter"),this.finishNode(t,"TSInferType")}tsParseConstraintForInferType(){if(this.eat(77)){let t=this.tsInDisallowConditionalTypesContext(()=>this.tsParseType());if(this.state.inDisallowConditionalTypesContext||!this.match(13))return t}}tsParseTypeOperatorOrHigher(){return Ps(this.state.type)&&!this.state.containsEsc?this.tsParseTypeOperator():this.isContextual(111)?this.tsParseInferType():this.tsInAllowConditionalTypesContext(()=>this.tsParseArrayTypeOrHigher())}tsParseUnionOrIntersectionType(t,e,i){let r=this.startNode(),a=this.eat(i),o=[];do o.push(e());while(this.eat(i));return o.length===1&&!a?o[0]:(r.types=o,this.finishNode(r,t))}tsParseIntersectionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSIntersectionType",this.tsParseTypeOperatorOrHigher.bind(this),41)}tsParseUnionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSUnionType",this.tsParseIntersectionTypeOrHigher.bind(this),39)}tsIsStartOfFunctionType(){return this.match(43)?!0:this.match(6)&&this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this))}tsSkipParameterStart(){if(S(this.state.type)||this.match(74))return this.next(),!0;if(this.match(2)){let{errors:t}=this.state,e=t.length;try{return this.parseObjectLike(4,!0),t.length===e}catch{return!1}}if(this.match(0)){this.next();let{errors:t}=this.state,e=t.length;try{return super.parseBindingList(1,93,1),t.length===e}catch{return!1}}return!1}tsIsUnambiguouslyStartOfFunctionType(){return this.next(),!!(this.match(7)||this.match(17)||this.tsSkipParameterStart()&&(this.match(10)||this.match(8)||this.match(13)||this.match(25)||this.match(7)&&(this.next(),this.match(15))))}tsParseTypeOrTypePredicateAnnotation(t){return this.tsInType(()=>{let e=this.startNode();this.expect(t);let i=this.startNode(),r=!!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));if(r&&this.match(74)){let h=this.tsParseThisTypeOrThisTypePredicate();return h.type==="TSThisType"?(i.parameterName=h,i.asserts=!0,i.typeAnnotation=null,h=this.finishNode(i,"TSTypePredicate")):(this.resetStartLocationFromNode(h,i),h.asserts=!0),e.typeAnnotation=h,this.finishNode(e,"TSTypeAnnotation")}let a=this.tsIsIdentifier()&&this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this));if(!a)return r?(i.parameterName=this.parseIdentifier(),i.asserts=r,i.typeAnnotation=null,e.typeAnnotation=this.finishNode(i,"TSTypePredicate"),this.finishNode(e,"TSTypeAnnotation")):this.tsParseTypeAnnotation(!1,e);let o=this.tsParseTypeAnnotation(!1);return i.parameterName=a,i.typeAnnotation=o,i.asserts=r,e.typeAnnotation=this.finishNode(i,"TSTypePredicate"),this.finishNode(e,"TSTypeAnnotation")})}tsTryParseTypeOrTypePredicateAnnotation(){if(this.match(10))return this.tsParseTypeOrTypePredicateAnnotation(10)}tsTryParseTypeAnnotation(){if(this.match(10))return this.tsParseTypeAnnotation()}tsTryParseType(){return this.tsEatThenParseType(10)}tsParseTypePredicatePrefix(){let t=this.parseIdentifier();if(this.isContextual(112)&&!this.hasPrecedingLineBreak())return this.next(),t}tsParseTypePredicateAsserts(){if(this.state.type!==105)return!1;let t=this.state.containsEsc;return this.next(),!S(this.state.type)&&!this.match(74)?!1:(t&&this.raise(c.InvalidEscapedReservedWord,this.state.lastTokStartLoc,{reservedWord:"asserts"}),!0)}tsParseTypeAnnotation(t=!0,e=this.startNode()){return this.tsInType(()=>{t&&this.expect(10),e.typeAnnotation=this.tsParseType()}),this.finishNode(e,"TSTypeAnnotation")}tsParseType(){xe(this.state.inType);let t=this.tsParseNonConditionalType();if(this.state.inDisallowConditionalTypesContext||this.hasPrecedingLineBreak()||!this.eat(77))return t;let e=this.startNodeAtNode(t);return e.checkType=t,e.extendsType=this.tsInDisallowConditionalTypesContext(()=>this.tsParseNonConditionalType()),this.expect(13),e.trueType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.expect(10),e.falseType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.finishNode(e,"TSConditionalType")}isAbstractConstructorSignature(){return this.isContextual(120)&&this.isLookaheadContextual("new")}tsParseNonConditionalType(){return this.tsIsStartOfFunctionType()?this.tsParseFunctionOrConstructorType("TSFunctionType"):this.match(73)?this.tsParseFunctionOrConstructorType("TSConstructorType"):this.isAbstractConstructorSignature()?this.tsParseFunctionOrConstructorType("TSConstructorType",!0):this.tsParseUnionTypeOrHigher()}tsParseTypeAssertion(){this.getPluginOption("typescript","disallowAmbiguousJSXLike")&&this.raise(d.ReservedTypeAssertion,this.state.startLoc);let t=this.startNode();return t.typeAnnotation=this.tsInType(()=>(this.next(),this.match(71)?this.tsParseTypeReference():this.tsParseType())),this.expect(44),t.expression=this.parseMaybeUnary(),this.finishNode(t,"TSTypeAssertion")}tsParseHeritageClause(t){let e=this.state.startLoc,i=this.tsParseDelimitedList("HeritageClauseElement",()=>{let r=(this.state.canStartArrow=!1,super.parseExprSubscripts());Wt(r)||this.raise(d.InvalidHeritageClauseType,r.start,{token:t});let a=t==="extends"?"TSInterfaceHeritage":"TSClassImplements";if(r.type==="TSInstantiationExpression")return r.type=a,r;let o=this.startNodeAtNode(r);return o.expression=r,(this.match(43)||this.match(47))&&(o.typeArguments=this.tsParseTypeArgumentsInExpression()),this.finishNode(o,a)});return i.length||this.raise(d.EmptyHeritageClauseType,e,{token:t}),i}tsParseInterfaceDeclaration(t,e={}){if(this.hasFollowingLineBreak())return null;this.expectContextual(125),e.declare&&(t.declare=!0),S(this.state.type)?(t.id=this.parseIdentifier(),this.checkIdentifier(t.id,130)):(t.id=null,this.raise(d.MissingInterfaceName,this.state.startLoc)),t.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers),this.eat(77)&&(t.extends=this.tsParseHeritageClause("extends"));let i=this.startNode();return i.body=this.tsInType(this.tsParseObjectTypeMembers.bind(this)),t.body=this.finishNode(i,"TSInterfaceBody"),this.finishNode(t,"TSInterfaceDeclaration")}tsParseTypeAliasDeclaration(t){return t.id=this.parseIdentifier(),this.checkIdentifier(t.id,2),t.typeAnnotation=this.tsInType(()=>{if(t.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutModifiers),this.expect(25),this.isContextual(110)&&this.lookaheadCharCode()!==46){let e=this.startNode();return this.next(),this.finishNode(e,"TSIntrinsicKeyword")}return this.tsParseType()}),this.semicolon(),this.finishNode(t,"TSTypeAliasDeclaration")}tsInTopLevelContext(t){if(this.curContext()!==w.brace){let e=this.state.context;this.state.context=[e[0]];try{return t()}finally{this.state.context=e}}else return t()}tsInType(t){let e=this.state.inType;this.state.inType=!0;try{return t()}finally{this.state.inType=e}}tsInDisallowConditionalTypesContext(t){let e=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!0;try{return t()}finally{this.state.inDisallowConditionalTypesContext=e}}tsInAllowConditionalTypesContext(t){let e=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!1;try{return t()}finally{this.state.inDisallowConditionalTypesContext=e}}tsEatThenParseType(t){if(this.match(t))return this.tsNextThenParseType()}tsExpectThenParseType(t){return this.tsInType(()=>(this.expect(t),this.tsParseType()))}tsNextThenParseType(){return this.tsInType(()=>(this.next(),this.tsParseType()))}tsParseEnumMember(){let t=this.startNode();return t.id=this.match(130)?super.parseStringLiteral(this.state.value):this.parseIdentifier(!0),this.eat(25)&&(t.initializer=super.parseMaybeAssignAllowIn()),this.finishNode(t,"TSEnumMember")}tsParseEnumDeclaration(t,e={}){return e.const&&(t.const=!0),e.declare&&(t.declare=!0),this.expectContextual(122),t.id=this.parseIdentifier(),this.checkIdentifier(t.id,t.const?8971:8459),t.body=this.tsParseEnumBody(),this.finishNode(t,"TSEnumDeclaration")}tsParseEnumBody(){let t=this.startNode();return this.expect(2),t.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this)),this.expect(4),this.finishNode(t,"TSEnumBody")}tsParseModuleBlock(t){let e=this.startNode();return t||this.scope.enter(0),this.expect(2),super.parseBlockOrModuleBlockBody(e.body=[],void 0,!0,4),t||this.scope.exit(),this.finishNode(e,"TSModuleBlock")}tsParseNamespaceDeclaration(t){return t.id=this.tsParseEntityName(0),t.id.type==="Identifier"&&this.checkIdentifier(t.id,1024),this.scope.enter(2048),this.prodParam.enter(0),t.body=this.tsParseModuleBlock(!1),this.prodParam.exit(),this.scope.exit(),this.finishNode(t,"TSModuleDeclaration")}tsParseAmbientExternalModuleDeclaration(t){let e=this.isContextual(108);if(e)t.kind="global",t.id=this.parseIdentifier();else{t.kind="module";let{type:i,value:r}=this.state;i===130?t.id=super.parseStringLiteral(r):S(i)?(this.raise(d.InlineModuleDeclarationMustUseString,this.state.startLoc),t.id=this.tsParseEntityName(0)):i===2?this.raise(d.EmptyNamespaceName,this.state.startLoc):(this.raise(d.InvalidNamespaceName,this.state.startLoc,r),t.id=super.parseExprAtom())}return this.match(2)?(e||this.scope.enter(1024),this.prodParam.enter(0),t.body=this.tsParseModuleBlock(e),this.prodParam.exit(),e||this.scope.exit()):this.semicolon(),this.finishNode(t,"TSModuleDeclaration")}tsParseImportEqualsDeclaration(t,e){t.id=e||this.parseIdentifier(),this.checkIdentifier(t.id,4096),this.expect(25);let i=this.tsParseModuleReference();return t.importKind==="type"&&i.type!=="TSExternalModuleReference"&&this.raise(d.ImportAliasHasImportType,i),t.moduleReference=i,this.semicolon(),this.finishNode(t,"TSImportEqualsDeclaration")}tsIsExternalModuleReference(){return this.isContextual(115)&&this.lookaheadCharCode()===40}tsParseModuleReference(){return this.tsIsExternalModuleReference()?this.tsParseExternalModuleReference():this.tsParseEntityName(0)}tsParseExternalModuleReference(){let t=this.startNode();return this.expectContextual(115),this.expect(6),this.match(130)||this.unexpected(),t.expression=super.parseExprAtom(),this.expect(7),this.sawUnambiguousESM=!0,this.finishNode(t,"TSExternalModuleReference")}tsLookAhead(t){let e=this.state.clone(),i=t();return this.state=e,i}tsTryParseAndCatch(t){let e=this.tryParse(i=>t()||i());if(!(e.aborted||!e.node))return e.error&&(this.state=e.failState),e.node}tsTryParse(t){let e=this.state.clone(),i=t();if(i!==void 0&&i!==!1)return i;this.state=e}tsTryParseDeclare(t){if(this.isLineTerminator())return;let e=this.state.type;return this.tsInAmbientContext(()=>{switch(e){case 64:return t.declare=!0,super.parseFunctionStatement(t,!1,!1);case 76:return t.declare=!0,this.parseClass(t,!0,!1);case 122:return this.tsParseEnumDeclaration(t,{declare:!0});case 108:return this.tsParseAmbientExternalModuleDeclaration(t);case 96:if(this.state.containsEsc)return;case 71:case 70:return!this.match(71)||!this.isLookaheadContextual("enum")?(t.declare=!0,this.parseVarStatement(t,this.state.value,!0)):(this.expect(71),this.tsParseEnumDeclaration(t,{const:!0,declare:!0}));case 103:if(this.isUsing())return this.raise(d.InvalidModifierOnUsingDeclaration,this.state.startLoc,"declare"),t.declare=!0,this.parseVarStatement(t,"using",!0);break;case 92:if(this.isAwaitUsing())return this.raise(d.InvalidModifierOnAwaitUsingDeclaration,this.state.startLoc,"declare"),t.declare=!0,this.next(),this.parseVarStatement(t,"await using",!0);break;case 125:{let i=this.tsParseInterfaceDeclaration(t,{declare:!0});if(i)return i}default:if(S(e))return this.tsParseDeclaration(t,this.state.type,!0,null)}})}tsTryParseExportDeclaration(){return this.tsParseDeclaration(this.startNode(),this.state.type,!0,null)}tsParseDeclaration(t,e,i,r){switch(e){case 120:if(this.tsCheckLineTerminator(i)&&(this.match(76)||S(this.state.type)))return this.tsParseAbstractDeclaration(t,r);break;case 123:if(this.tsCheckLineTerminator(i))return this.tsParseAmbientExternalModuleDeclaration(t);break;case 124:if(this.tsCheckLineTerminator(i)&&S(this.state.type))return t.kind="namespace",this.tsParseNamespaceDeclaration(t);break;case 126:if(this.tsCheckLineTerminator(i)&&S(this.state.type))return this.tsParseTypeAliasDeclaration(t);break}}tsCheckLineTerminator(t){return t?this.hasFollowingLineBreak()?!1:(this.next(),!0):!this.isLineTerminator()}tsTryParseGenericAsyncArrowFunction(t){if(!this.match(43))return;let e=this.tsTryParseAndCatch(()=>{let i=this.startNodeAt(t);return i.typeParameters=this.tsParseTypeParameters(this.tsParseConstModifier),super.parseFunctionParams(i),i.returnType=this.tsTryParseTypeOrTypePredicateAnnotation(),this.expect(15),i});if(e)return super.parseArrowExpression(e,null,!0)}tsParseTypeArgumentsInExpression(){if(this.reScan_lt()===43)return this.tsParseTypeArguments()}tsParseTypeArguments(){let t=this.startNode();return t.params=this.tsInType(()=>this.tsInTopLevelContext(()=>(this.expect(43),this.tsParseDelimitedList("TypeParametersOrArguments",this.tsParseType.bind(this))))),t.params.length===0?this.raise(d.EmptyTypeArguments,t):!this.state.inType&&this.curContext()===w.brace&&this.reScan_lt_gt(),this.expect(44),this.finishNode(t,"TSTypeParameterInstantiation")}tsIsDeclarationStart(){return Ts(this.state.type)}isExportDefaultSpecifier(){return this.tsIsDeclarationStart()?!1:super.isExportDefaultSpecifier()}parseBindingElement(t,e){let i=e.length?null:this.state.startLoc,r={};this.tsParseModifiers({allowedModifiers:["public","private","protected","override","readonly"]},r);let a=r.accessibility,o=r.override,h=r.readonly;!(t&4)&&(a||h||o)&&this.raise(d.UnexpectedParameterModifier,i||e[0]);let l=this.state.startLoc,p=this.parseMaybeDefault(l);t&2&&this.parseFunctionParamType(p);let u=this.parseMaybeDefault(l,p);if(a||h||o){let f=i?this.startNodeAt(i):this.startNodeAtNode(e[0]);return e.length?f.decorators=e:this.setLoc(i),a&&(f.accessibility=a),h&&(f.readonly=h),o&&(f.override=o),u.type!=="Identifier"&&u.type!=="AssignmentPattern"&&this.raise(d.UnsupportedParameterPropertyKind,i||e[0]),f.parameter=u,this.finishNode(f,"TSParameterProperty")}return e.length&&(p.decorators=e),u}isSimpleParameter(t){return t.type==="TSParameterProperty"&&super.isSimpleParameter(t.parameter)||super.isSimpleParameter(t)}tsDisallowOptionalPattern(t){for(let e of t.params)e.type!=="Identifier"&&e.optional&&!this.state.isAmbientContext&&this.raise(d.PatternIsOptional,e)}setArrowFunctionParameters(t,e,i){super.setArrowFunctionParameters(t,e,i),this.tsDisallowOptionalPattern(t)}parseFunctionBodyAndFinish(t,e,i=!1){this.match(10)&&(t.returnType=this.tsParseTypeOrTypePredicateAnnotation(10));let r=e==="FunctionDeclaration"?"TSDeclareFunction":e==="ClassMethod"||e==="ClassPrivateMethod"?"TSDeclareMethod":void 0;if(r&&!this.match(2)&&this.isLineTerminator()){if(r==="TSDeclareMethod"&&t.kind==="constructor")for(let a of t.params)a.type==="TSParameterProperty"?this.raise(d.UnexpectedParameterModifier,a):a.type==="AssignmentPattern"&&this.raise(d.UnexpectedParameterInitializer,a);else for(let a of t.params)a.type==="AssignmentPattern"&&this.raise(d.UnexpectedParameterInitializer,a);return this.finishNode(t,r)}return r&&this.state.isAmbientContext&&(this.raise(d.DeclareFunctionHasImplementation,this.state.startLoc),r==="TSDeclareFunction"&&t.declare)?super.parseFunctionBodyAndFinish(t,r,i):(this.tsDisallowOptionalPattern(t),super.parseFunctionBodyAndFinish(t,e,i))}registerFunctionStatementId(t){!t.body&&t.id?this.checkIdentifier(t.id,1024):super.registerFunctionStatementId(t)}tsCheckForInvalidTypeCasts(t){t.forEach(e=>{e?.type==="TSTypeCastExpression"&&this.raise(d.UnexpectedTypeAnnotation,e.typeAnnotation)})}toReferencedList(t,e){return this.tsCheckForInvalidTypeCasts(t),t}parseArrayLike(t,e){let i=super.parseArrayLike(t,e);return i.type==="ArrayExpression"&&this.tsCheckForInvalidTypeCasts(i.elements),i}parseSubscript(t,e,i,r){if(!this.hasPrecedingLineBreak()&&this.match(31)){this.state.canStartJSXElement=!1,this.next();let o=this.startNodeAt(e);return o.expression=t,this.finishNode(o,"TSNonNullExpression")}let a=!1;if(this.match(14)&&this.lookaheadCharCode()===60){if(i)return r.stop=!0,t;r.optionalChainMember=a=!0,this.next()}if(this.match(43)||this.match(47)){let o,h=this.tsTryParseAndCatch(()=>{if(!i&&this.atPossibleAsyncArrow(t)){let f=this.tsTryParseGenericAsyncArrowFunction(e);if(f)return r.stop=!0,f}let l=this.tsParseTypeArgumentsInExpression();if(!l)return;if(a&&!this.match(6)){o=this.state.curPosition();return}if(wt(this.state.type)){let f=super.parseTaggedTemplateExpression(t,e,r);return f.typeArguments=l,f}if(!i&&this.eat(6)){let f=this.startNodeAt(e);return f.callee=t,f.arguments=this.parseCallExpressionArguments(),this.tsCheckForInvalidTypeCasts(f.arguments),f.typeArguments=l,r.optionalChainMember&&(f.optional=a),this.finishCallExpression(f,r.optionalChainMember)}let p=this.state.type;if(p===44||p===48||p!==6&&p!==89&&p!==116&&tt(p)&&!this.hasPrecedingLineBreak())return;let u=this.startNodeAt(e);return u.expression=t,u.typeArguments=l,this.finishNode(u,"TSInstantiationExpression")});if(o&&this.unexpected(o,6),h)return h.type==="TSInstantiationExpression"&&((this.match(12)||this.match(14)&&this.lookaheadCharCode()!==40)&&this.raise(d.InvalidPropertyAccessAfterInstantiationExpression,this.state.startLoc),!this.match(12)&&!this.match(14)&&(h.expression=super.stopParseSubscript(t,r))),h}return super.parseSubscript(t,e,i,r)}parseNewCallee(t){super.parseNewCallee(t);let{callee:e}=t;e.type==="TSInstantiationExpression"&&!e.extra?.parenthesized&&(t.typeArguments=e.typeArguments,t.callee=e.expression)}parseExprOp(t,e,i){let r;if(pt(54)>i&&!this.hasPrecedingLineBreak()&&(this.isContextual(89)||(r=this.isContextual(116)))){let a=this.startNodeAt(e);a.expression=t,a.typeAnnotation=this.tsInType(()=>(this.next(),this.match(71)?(r&&this.raise(c.UnexpectedKeyword,this.state.startLoc,{keyword:"const"}),this.tsParseTypeReference()):this.tsParseType()));let o=this.finishNode(a,r?"TSSatisfiesExpression":"TSAsExpression");return this.reScan_lt_gt(),this.parseExprOp(o,e,i)}return super.parseExprOp(t,e,i)}checkReservedWord(t,e,i,r){this.state.isAmbientContext||super.checkReservedWord(t,e,i,r)}checkDuplicateExports(){}isPotentialImportPhase(t){if(super.isPotentialImportPhase(t))return!0;if(this.isContextual(126)){let e=this.lookaheadCharCode();return t?e===123||e===42:e!==61}return!t&&this.isContextual(83)}applyImportPhase(t,e,i,r){super.applyImportPhase(t,e,i,r),e?t.exportKind=i==="type"?"type":"value":t.importKind=i==="type"||i==="typeof"?i:"value"}parseImport(t){if(this.match(130))return t.importKind="value",this.scope.inTSNamespace&&this.raise(d.ImportInTSNamespace,t),super.parseImport(t);let e;if(S(this.state.type)&&this.lookaheadCharCode()===61){t.importKind="value";let i=this.tsParseImportEqualsDeclaration(t);return this.scope.inTSNamespace&&i.moduleReference.type==="TSExternalModuleReference"&&this.raise(d.ImportInTSNamespace,t),i}else if(this.isContextual(126)){let i=this.parseMaybeImportPhase(t,!1);if(this.lookaheadCharCode()===61)return this.scope.inTSNamespace&&this.raise(d.ImportInTSNamespace,t),this.tsParseImportEqualsDeclaration(t,i);e=super.parseImportSpecifiersAndAfter(t,i)}else e=super.parseImport(t);return e.importKind==="type"&&e.specifiers.length>1&&e.specifiers[0].type==="ImportDefaultSpecifier"?this.raise(d.TypeImportCannotSpecifyDefaultAndNamed,e):this.scope.inTSNamespace&&this.raise(d.ImportInTSNamespace,e),e}parseExport(t,e){if(this.match(79)){let i=this.startNode();this.next();let r=null;this.isContextual(126)&&this.isPotentialImportPhase(!1)?r=this.parseMaybeImportPhase(i,!1):i.importKind="value";let a=this.tsParseImportEqualsDeclaration(i,r);return t.attributes=[],t.declaration=a,t.exportKind="value",t.source=null,t.specifiers=[],this.finishNode(t,"ExportNamedDeclaration")}else if(this.eat(25)){let i=t;return i.expression=super.parseExpression(),this.semicolon(),this.sawUnambiguousESM=!0,this.scope.inTSNamespace&&this.raise(d.ExportAssignmentInTSNamespace,i),this.finishNode(i,"TSExportAssignment")}else if(this.eatContextual(89)){let i=t;return this.expectContextual(124),i.id=this.parseIdentifier(),this.checkIdentifier(i.id,8201),this.semicolon(),this.scope.inTSNamespace&&this.raise(d.NamespaceExportInTSNamespace,i),this.finishNode(i,"TSNamespaceExportDeclaration")}else{let i=super.parseExport(t,e);return this.scope.inTSNamespace&&(i.type!=="ExportNamedDeclaration"||i.source||!i.declaration&&!this.state.isAmbientContext)&&this.raise(d.ExportInTSNamespace,i),i}}isAbstractClass(){return this.isContextual(120)&&this.isLookaheadContextual("class")}parseExportDefaultExpression(){if(this.isAbstractClass()){let t=this.startNode();return this.next(),t.abstract=!0,this.parseClass(t,!0,!0)}if(this.match(125)){let t=this.tsParseInterfaceDeclaration(this.startNode());if(t)return t}return super.parseExportDefaultExpression()}parseVarStatement(t,e,i=!1){let{isAmbientContext:r}=this.state,a=super.parseVarStatement(t,e,i||r);if(r&&!t.declare&&(e==="using"||e==="await using"))return this.raiseOverwrite(d.UsingDeclarationInAmbientContext,t,e),a;for(let o of a.declarations){let{id:h,init:l,definite:p}=o;p&&(l?this.raise(d.DeclaratorDefiniteAssertionWithInitializer,h):h.typeAnnotation||this.raise(d.DeclaratorDefiniteAssertionRequiresTypeAnnotation,h)),r&&l&&(e==="var"||e==="let"||h.typeAnnotation?this.raise(d.InitializerNotAllowedInAmbientContext,l):ri(l,this.hasPlugin("estree"))||this.raise(d.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference,l))}return a}parseStatementContent(t,e){let i=!!(t&2);if(!this.state.containsEsc)switch(this.state.type){case 71:{if(this.isLookaheadContextual("enum")){let r=this.startNode();return this.next(),this.tsParseEnumDeclaration(r,{const:!0})}break}case 120:case 121:{if(this.nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine()){let r=this.state.type,a=this.startNode();this.next();let o=r===121?this.tsTryParseDeclare(a):this.tsParseAbstractDeclaration(a,e);return o?(r===121&&(o.declare=!0),o):(a.expression=this.createIdentifier(this.startNodeAtNode(a),r===121?"declare":"abstract"),this.semicolon(!1),this.finishNode(a,"ExpressionStatement"))}break}case 122:return this.tsParseEnumDeclaration(this.startNode());case 108:{if(this.lookaheadCharCode()===123){let a=this.startNode();return this.tsParseAmbientExternalModuleDeclaration(a)}break}case 125:{let r=this.tsParseInterfaceDeclaration(this.startNode());if(r)return i||this.raise(d.UnexpectedTypeDeclaration,r,"interface"),r;break}case 123:{if(this.nextTokenIsStringLiteralOnSameLine()){let r=this.startNode();return this.next(),this.tsParseDeclaration(r,123,!1,e)}else if(this.nextTokenIsIdentifierOnSameLine()){this.raise(d.InlineModuleDeclarationMustUseString,this.state.startLoc);let r=this.startNode();return this.next(),this.tsParseDeclaration(r,124,!1,e)}break}case 124:{if(this.nextTokenIsIdentifierOnSameLine()){let r=this.startNode();return this.next(),this.tsParseDeclaration(r,124,!1,e)}break}case 126:{if(this.nextTokenIsIdentifierOnSameLine()){let r=this.startNode();return i||this.raise(d.UnexpectedTypeDeclaration,r,"type"),this.next(),this.tsParseTypeAliasDeclaration(r)}break}}return super.parseStatementContent(t,e)}parseAccessModifier(){return this.tsParseModifier(["public","protected","private"])}tsHasSomeModifiers(t,e){return e.some(i=>ge(i)?t.accessibility===i:!!t[i])}tsIsStartOfStaticBlocks(){return this.isContextual(102)&&this.lookaheadCharCode()===123}parseClassMember(t,e,i){let r=["declare","private","public","protected","override","abstract","readonly","static"];this.tsParseModifiers({allowedModifiers:r,disallowedModifiers:["in","out"],stopOnStartOfClassStaticBlock:!0,errorTemplate:d.InvalidModifierOnTypeParameterPositions},e);let a=()=>{this.tsIsStartOfStaticBlocks()?(this.next(),this.next(),this.tsHasSomeModifiers(e,r)&&this.raise(d.StaticBlockCannotHaveModifier,this.state.curPosition()),super.parseClassStaticBlock(t,e)):this.parseClassMemberWithIsStatic(t,e,i,!!e.static)};e.declare?this.tsInAmbientContext(a):a(),e.decorators&&e.decorators.length>0&&!this.hasPlugin("decorators-legacy")&&(e.type==="TSAbstractMethodDefinition"||e.type==="TSDeclareMethod"?this.raise(d.DecoratorAbstractMethod,e,{kind:"abstract method"}):(e.type==="ClassProperty"&&e.abstract||e.type==="ClassProperty"&&e.declare||e.type==="TSAbstractPropertyDefinition"||e.type==="PropertyDefinition"&&e.declare)&&this.raise(d.DecoratorAbstractMethod,e,{kind:e.declare?"declare field":"abstract field"}))}parseClassMemberWithIsStatic(t,e,i,r){let a=this.tsTryParseIndexSignature(e);if(a){t.body.push(a),e.abstract&&this.raise(d.IndexSignatureHasAbstract,e),e.accessibility&&this.raise(d.IndexSignatureHasAccessibility,e,{modifier:e.accessibility}),e.declare&&this.raise(d.IndexSignatureHasDeclare,e),e.override&&this.raise(d.IndexSignatureHasOverride,e);return}!this.state.inAbstractClass&&e.abstract&&this.raise(d.NonAbstractClassHasAbstractMethod,e),e.override&&(i.hadSuperClass||this.raise(d.OverrideNotInSubClass,e)),super.parseClassMemberWithIsStatic(t,e,i,r)}parsePostMemberNameModifiers(t){this.eat(13)&&(t.optional=!0),t.readonly&&this.match(6)&&this.raise(d.ClassMethodHasReadonly,t),t.declare&&this.match(6)&&this.raise(d.ClassMethodHasDeclare,t)}shouldParseExportDeclaration(){return this.tsIsDeclarationStart()?!0:super.shouldParseExportDeclaration()}parseConditional(t,e,i){if(!this.match(13))return t;if(i!=null){let o=this.lookaheadCharCode();if(o===44||o===61||o===58||o===41)return this.setOptionalParametersError(i),t}this.next();let r=this.startNodeAt(e);r.test=t;let a=this.state.inConditionalConsequent;return this.state.inConditionalConsequent=!0,r.consequent=this.parseMaybeAssignAllowIn(),this.state.inConditionalConsequent=a,this.expect(10),r.alternate=this.parseMaybeAssign(),this.finishNode(r,"ConditionalExpression")}parseParenItem(t,e){let i=super.parseParenItem(t,e);if(this.eat(13)&&(i.optional=!0,this.resetEndLocation(t)),this.match(10)){let r=this.startNodeAt(e);return r.expression=t,r.typeAnnotation=this.tsParseTypeAnnotation(),this.finishNode(r,"TSTypeCastExpression")}return t}parseExportDeclaration(t){if(!this.state.isAmbientContext&&this.isContextual(121))return this.tsInAmbientContext(()=>this.parseExportDeclaration(t));let e=this.state.startLoc,i=this.eatContextual(121);if(i&&(this.isContextual(121)||!this.shouldParseExportDeclaration()))throw this.raise(d.ExpectedAmbientAfterExportDeclare,this.state.startLoc);let a=S(this.state.type)&&this.tsTryParseExportDeclaration()||super.parseExportDeclaration(t);return a?((a.type==="TSInterfaceDeclaration"||a.type==="TSTypeAliasDeclaration"||i)&&(t.exportKind="type"),i&&a.type!=="TSImportEqualsDeclaration"&&(this.resetStartLocation(a,e),a.declare=!0),a):null}parseClassId(t,e,i,r){if((!e||i)&&this.isContextual(109)){t.id=null;return}super.parseClassId(t,e,i,t.declare?1024:8331);let a=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);a&&(t.typeParameters=a)}parseClassPropertyAnnotation(t){t.optional||(this.eat(31)?t.definite=!0:this.eat(13)&&(t.optional=!0));let e=this.tsTryParseTypeAnnotation();e&&(t.typeAnnotation=e),t.definite&&(this.match(25)?this.raise(d.DeclaratorDefiniteAssertionWithInitializer,t):e||this.raise(d.DeclaratorDefiniteAssertionRequiresTypeAnnotation,t))}parseClassProperty(t){if(this.parseClassPropertyAnnotation(t),this.state.isAmbientContext&&!(t.readonly&&!t.typeAnnotation)&&this.match(25)&&this.raise(d.DeclareClassFieldHasInitializer,this.state.startLoc),t.abstract&&this.match(25)){let{key:e}=t;this.raise(d.AbstractPropertyHasInitializer,this.state.startLoc,{propertyName:e.type==="Identifier"&&!t.computed?e.name:`[${this.input.slice(this.offsetToSourcePos(e.start),this.offsetToSourcePos(e.end))}]`})}return super.parseClassProperty(t)}parseClassPrivateProperty(t){return t.abstract&&this.raise(d.PrivateElementHasAbstract,t),t.accessibility&&this.raise(d.PrivateElementHasAccessibility,t,{modifier:t.accessibility}),this.parseClassPropertyAnnotation(t),super.parseClassPrivateProperty(t)}parseClassAccessorProperty(t){return this.parseClassPropertyAnnotation(t),t.optional&&this.raise(d.AccessorCannotBeOptional,t),super.parseClassAccessorProperty(t)}pushClassMethod(t,e,i,r,a,o){let h=this.tsTryParseTypeParameters(this.tsParseConstModifier);h&&a&&this.raise(d.ConstructorHasTypeParameters,h);let{declare:l=!1,kind:p}=e;l&&(p==="get"||p==="set")&&this.raise(d.DeclareAccessor,e,{kind:p}),h&&(e.typeParameters=h),super.pushClassMethod(t,e,i,r,a,o)}pushClassPrivateMethod(t,e,i,r){let a=this.tsTryParseTypeParameters(this.tsParseConstModifier);a&&(e.typeParameters=a),super.pushClassPrivateMethod(t,e,i,r)}declareClassPrivateMethodInScope(t,e){t.type!=="TSDeclareMethod"&&(t.type==="MethodDefinition"&&t.value.body==null||super.declareClassPrivateMethodInScope(t,e))}parseClassSuper(t){if(super.parseClassSuper(t),t.superClass)if(t.superClass.type==="TSInstantiationExpression"){let e=t.superClass,i=e.expression;this.takeSurroundingComments(i,i.start,i.end);let r=e.typeArguments;this.takeSurroundingComments(r,r.start,r.end),t.superClass=i,t.superTypeArguments=r}else(this.match(43)||this.match(47))&&(t.superTypeArguments=this.tsParseTypeArgumentsInExpression());this.eatContextual(109)&&(t.implements=this.tsParseHeritageClause("implements"))}parseObjPropValue(t,e,i,r,a,o,h){let l=this.tsTryParseTypeParameters(this.tsParseConstModifier);return l&&(t.typeParameters=l),super.parseObjPropValue(t,e,i,r,a,o,h)}parseFunctionParams(t,e){let i=this.tsTryParseTypeParameters(this.tsParseConstModifier);i&&(t.typeParameters=i),super.parseFunctionParams(t,e)}parseVarId(t,e){super.parseVarId(t,e),t.id.type==="Identifier"&&!this.hasPrecedingLineBreak()&&this.eat(31)&&(t.definite=!0);let i=this.tsTryParseTypeAnnotation();i&&(t.id.typeAnnotation=i,this.resetEndLocation(t.id))}parseAsyncArrowFromCallExpression(t,e){return this.match(10)&&(t.returnType=this.tsParseTypeAnnotation()),super.parseAsyncArrowFromCallExpression(t,e)}parseMaybeAssign(t,e){let i,r,a;if(this.hasPlugin("jsx")&&(this.match(138)||this.match(43))){if(i=this.state.clone(),r=this.tryParse(()=>super.parseMaybeAssign(t,e),i),!r.error)return r.node;let{context:l}=this.state,p=l[l.length-1];(p===w.j_oTag||p===w.j_expr)&&l.pop()}if(!r?.error&&!this.match(43))return super.parseMaybeAssign(t,e);(!i||i===this.state)&&(i=this.state.clone());let o,h=this.tryParse(l=>{o=this.tsParseTypeParameters(this.tsParseConstModifier);let p=super.parseMaybeAssign(t,e);if((p.type!=="ArrowFunctionExpression"||p.extra?.parenthesized)&&l(),o?.params.length!==0&&this.resetStartLocationFromNode(p,o),p.typeParameters=o,this.hasPlugin("jsx")&&p.typeParameters.params.length===1&&!p.typeParameters.extra?.trailingComma){let u=p.typeParameters.params[0];u.constraint||this.raise(d.SingleTypeParameterWithoutTrailingComma,this.optionFlags&256?D(u.loc.end,1):u,{typeParameterName:u.name.name})}return p},i);if(!h.error&&!h.aborted)return o&&this.reportReservedArrowTypeParam(o),h.node;if(!r&&(xe(!this.hasPlugin("jsx")),a=this.tryParse(()=>super.parseMaybeAssign(t,e),i),!a.error))return a.node;if(r?.node)return this.state=r.failState,r.node;if(h.node)return this.state=h.failState,o&&this.reportReservedArrowTypeParam(o),h.node;if(a?.node)return this.state=a.failState,a.node;throw r?.error||h.error||a?.error}reportReservedArrowTypeParam(t){t.params.length===1&&!t.params[0].constraint&&!t.extra?.trailingComma&&this.getPluginOption("typescript","disallowAmbiguousJSXLike")&&this.raise(d.ReservedArrowTypeParam,t)}parseMaybeUnary(t,e){return!this.hasPlugin("jsx")&&this.match(43)?this.tsParseTypeAssertion():super.parseMaybeUnary(t,e)}parseArrow(t){if(this.match(10)){let e=this.tryParse(i=>{let r=this.tsParseTypeOrTypePredicateAnnotation(10);return(this.canInsertSemicolon()||!this.match(15))&&i(),r});if(e.aborted)return;e.thrown||(e.error&&(this.state=e.failState),t.returnType=e.node)}return super.parseArrow(t)}parseFunctionParamType(t){this.eat(13)&&(t.optional=!0);let e=this.tsTryParseTypeAnnotation();return e&&(t.typeAnnotation=e),this.resetEndLocation(t),t}isAssignable(t,e){switch(t.type){case"TSTypeCastExpression":return this.isAssignable(t.expression,e);case"TSParameterProperty":return!0;default:return super.isAssignable(t,e)}}toAssignable(t,e=!1){switch(t.type){case"ParenthesizedExpression":this.toAssignableParenthesizedExpression(t,e);break;case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":e?this.expressionScope.recordArrowParameterBindingError(d.UnexpectedTypeCastInParameter,t):this.raise(d.UnexpectedTypeCastInParameter,t),this.toAssignable(t.expression,e);break;case"AssignmentExpression":!e&&t.left.type==="TSTypeCastExpression"&&(t.left=this.typeCastToParameter(t.left));default:super.toAssignable(t,e)}}toAssignableParenthesizedExpression(t,e){switch(t.expression.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":case"ParenthesizedExpression":this.toAssignable(t.expression,e);break;default:super.toAssignable(t,e)}}checkToRestConversion(t,e){switch(t.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":this.checkToRestConversion(t.expression,!1);break;default:super.checkToRestConversion(t,e)}}isValidLVal(t,e,i,r){switch(t){case"TSTypeCastExpression":return!0;case"TSParameterProperty":return"parameter";case"TSNonNullExpression":return"expression";case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":return(r!==64||!i)&&["expression",!0];default:return super.isValidLVal(t,e,i,r)}}parseBindingAtom(){return this.state.type===74?this.parseIdentifier(!0):super.parseBindingAtom()}parseMaybeDecoratorArguments(t,e){if(this.match(43)||this.match(47)){let i=this.tsParseTypeArgumentsInExpression();if(this.match(6)){let r=super.parseMaybeDecoratorArguments(t,e);return r.typeArguments=i,r}this.unexpected(null,6)}return super.parseMaybeDecoratorArguments(t,e)}checkCommaAfterRest(t){return this.state.isAmbientContext&&this.match(8)&&this.lookaheadCharCode()===t?(this.next(),!1):super.checkCommaAfterRest(t)}isClassMethod(){return this.match(43)||super.isClassMethod()}isClassProperty(){return this.match(31)||this.match(10)||super.isClassProperty()}parseMaybeDefault(t,e){let i=super.parseMaybeDefault(t,e);return i.type==="AssignmentPattern"&&i.typeAnnotation&&i.right.start<i.typeAnnotation.start&&this.raise(d.TypeAnnotationAfterAssign,i.typeAnnotation),i}getTokenFromCode(t){if(this.state.inType){if(t===62){this.finishOp(44,1);return}if(t===60){this.finishOp(43,1);return}}super.getTokenFromCode(t)}reScan_lt_gt(){let{type:t}=this.state;t===43?(this.state.pos-=1,this.readToken_lt()):t===44&&(this.state.pos-=1,this.readToken_gt())}reScan_lt(){let{type:t}=this.state;return t===47?(this.state.pos-=2,this.finishOp(43,1),43):t}toAssignableListItem(t,e,i){let r=t[e];r.type==="TSTypeCastExpression"&&(t[e]=this.typeCastToParameter(r)),super.toAssignableListItem(t,e,i)}typeCastToParameter(t){return t.expression.typeAnnotation=t.typeAnnotation,this.resetEndLocationFromNode(t.expression,t.typeAnnotation),t.expression}shouldParseArrow(t){return this.match(10)?t.every(e=>this.isAssignable(e,!0)):super.shouldParseArrow(t)}shouldParseAsyncArrow(){return this.match(10)?!this.state.inConditionalConsequent:super.shouldParseAsyncArrow()}parseParenAndDistinguishExpression(t){let e=this.state.inConditionalConsequent;this.state.inConditionalConsequent=!1;let i=super.parseParenAndDistinguishExpression(t);return this.state.inConditionalConsequent=e,i}canHaveLeadingDecorator(){return super.canHaveLeadingDecorator()||this.isAbstractClass()}jsxParseOpeningElementAfterName(t){if(this.match(43)||this.match(47)){let e=this.tsTryParseAndCatch(()=>this.tsParseTypeArgumentsInExpression());e&&(t.typeArguments=e)}return super.jsxParseOpeningElementAfterName(t)}getGetterSetterExpectedParamCount(t){let e=super.getGetterSetterExpectedParamCount(t),r=this.getObjectOrClassMethodParams(t)[0];return r&&this.isThisParam(r)?e+1:e}parseCatchClauseParam(){let t=super.parseCatchClauseParam(),e=this.tsTryParseTypeAnnotation();return e&&(t.typeAnnotation=e,this.resetEndLocation(t)),t}tsInAmbientContext(t){let{isAmbientContext:e,strict:i}=this.state;this.state.isAmbientContext=!0,this.state.strict=!1;try{return t()}finally{this.state.isAmbientContext=e,this.state.strict=i}}parseClass(t,e,i){let r=this.state.inAbstractClass;this.state.inAbstractClass=!!t.abstract;try{return super.parseClass(t,e,i)}finally{this.state.inAbstractClass=r}}tsParseAbstractDeclaration(t,e){if(this.match(76))return t.abstract=!0,this.maybeTakeDecorators(e,this.parseClass(t,!0,!1));if(this.isContextual(125))return this.hasFollowingLineBreak()?null:(t.abstract=!0,this.raise(d.NonClassMethodPropertyHasAbstractModifier,t),this.tsParseInterfaceDeclaration(t));throw this.unexpected(null,76)}parseMethod(t,e,i,r,a,o,h){let l=super.parseMethod(t,e,i,r,a,o,h);if((l.abstract||l.type==="TSAbstractMethodDefinition")&&(this.hasPlugin("estree")?l.value:l).body){let{key:f}=l;this.raise(d.AbstractMethodHasImplementation,l,{methodName:f.type==="Identifier"&&!l.computed?f.name:`[${this.input.slice(this.offsetToSourcePos(f.start),this.offsetToSourcePos(f.end))}]`})}return l}tsParseTypeParameterName(){return this.parseIdentifier()}shouldParseAsAmbientContext(){return!!this.getPluginOption("typescript","dts")}parse(){return this.shouldParseAsAmbientContext()&&(this.state.isAmbientContext=!0),super.parse()}getExpression(){return this.shouldParseAsAmbientContext()&&(this.state.isAmbientContext=!0),super.getExpression()}parseExportSpecifier(t,e,i,r){return!e&&r?(this.parseTypeOnlyImportExportSpecifier(t,!1,i),this.finishNode(t,"ExportSpecifier")):(t.exportKind="value",super.parseExportSpecifier(t,e,i,r))}parseImportSpecifier(t,e,i,r,a){return!e&&r?(this.parseTypeOnlyImportExportSpecifier(t,!0,i),this.finishNode(t,"ImportSpecifier")):(t.importKind="value",super.parseImportSpecifier(t,e,i,r,i?4098:4096))}parseTypeOnlyImportExportSpecifier(t,e,i){let r=e?"imported":"local",a=e?"local":"exported",o=t[r],h,l=!1,p=!0,u=o.start;if(this.isContextual(89)){let y=this.parseIdentifier();if(this.isContextual(89)){let P=this.parseIdentifier();O(this.state.type)?(l=!0,o=y,h=e?this.parseIdentifier():this.parseModuleExportName(),p=!1):(h=P,p=!1)}else O(this.state.type)?(p=!1,h=e?this.parseIdentifier():this.parseModuleExportName()):(l=!0,o=y)}else O(this.state.type)&&(l=!0,e?(o=this.parseIdentifier(!0),this.isContextual(89)||this.checkReservedWord(o.name,o.start,!0,!0)):o=this.parseModuleExportName());l&&i&&this.raise(e?d.TypeModifierIsUsedInTypeImports:d.TypeModifierIsUsedInTypeExports,u),t[r]=o,t[a]=h;let f=e?"importKind":"exportKind";t[f]=l?"type":"value",p&&this.eatContextual(89)&&(t[a]=e?this.parseIdentifier():this.parseModuleExportName()),t[a]||(t[a]=this.cloneIdentifier(t[r])),e&&this.checkIdentifier(t[a],l?4098:4096)}fillOptionalPropertiesForTSESLint(t){switch(t.type){case"ExpressionStatement":t.directive??=void 0;return;case"RestElement":t.value=void 0;case"Identifier":case"ArrayPattern":case"AssignmentPattern":case"ObjectPattern":t.decorators??=[],t.optional??=!1,t.typeAnnotation??=void 0;return;case"TSParameterProperty":t.accessibility??=void 0,t.decorators??=[],t.override??=!1,t.readonly??=!1,t.static??=!1;return;case"TSEmptyBodyFunctionExpression":t.body=null;case"TSDeclareFunction":case"FunctionDeclaration":case"FunctionExpression":case"ClassMethod":case"ClassPrivateMethod":t.declare??=!1,t.returnType??=void 0,t.typeParameters??=void 0;return;case"Property":t.optional??=!1;return;case"TSMethodSignature":case"TSPropertySignature":t.optional??=!1;case"TSIndexSignature":t.accessibility??=void 0,t.readonly??=!1,t.static??=!1;return;case"TSAbstractPropertyDefinition":case"PropertyDefinition":case"TSAbstractAccessorProperty":case"AccessorProperty":t.declare??=!1,t.definite??=!1,t.readonly??=!1,t.typeAnnotation??=void 0;case"TSAbstractMethodDefinition":case"MethodDefinition":t.accessibility??=void 0,t.decorators??=[],t.override??=!1,t.optional??=!1;return;case"ClassExpression":t.id??=null;case"ClassDeclaration":t.abstract??=!1,t.declare??=!1,t.decorators??=[],t.implements??=[],t.superTypeArguments??=void 0,t.typeParameters??=void 0;return;case"TSTypeAliasDeclaration":case"VariableDeclaration":t.declare??=!1;return;case"VariableDeclarator":t.definite??=!1;return;case"TSEnumDeclaration":t.const??=!1,t.declare??=!1;return;case"TSEnumMember":t.computed??=!1;return;case"TSImportType":t.qualifier??=null,t.options??=null,t.typeArguments??=null;return;case"TSInterfaceDeclaration":t.declare??=!1,t.extends??=[];return;case"TSMappedType":t.optional??=!1,t.readonly??=void 0;return;case"TSModuleDeclaration":t.declare??=!1,t.global??=t.kind==="global";return;case"TSTypeParameter":t.const??=!1,t.in??=!1,t.out??=!1;return}}chStartsBindingIdentifierAndNotRelationalOperator(t,e){if(F(t)){if(Ct.lastIndex=e,Ct.test(this.input)){let i=this.codePointAtPos(Ct.lastIndex);if(!$(i)&&i!==92)return!1}return!0}else return t===92}nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine(){let t=this.nextTokenInLineStart(),e=this.codePointAtPos(t);return this.chStartsBindingIdentifierAndNotRelationalOperator(e,t)}nextTokenIsStringLiteralOnSameLine(){let t=this.nextTokenInLineStart(),e=this.codePointAtPos(t);return e===34||e===39}};function ii(n){if(n.type!=="MemberExpression")return!1;let{computed:s,property:t}=n;return s&&t.type!=="StringLiteral"&&(t.type!=="TemplateLiteral"||t.expressions.length>0)?!1:Be(n.object)}function ri(n,s){let{type:t}=n;if(n.extra?.parenthesized)return!1;if(s){if(t==="Literal"){let{value:e}=n;if(typeof e=="string"||typeof e=="boolean")return!0}}else if(t==="StringLiteral"||t==="BooleanLiteral")return!0;return!!(Fe(n,s)||ai(n,s)||t==="TemplateLiteral"&&n.expressions.length===0||ii(n))}function Fe(n,s){return s?n.type==="Literal"&&(typeof n.value=="number"||"bigint"in n):n.type==="NumericLiteral"||n.type==="BigIntLiteral"}function ai(n,s){if(n.type==="UnaryExpression"){let{operator:t,argument:e}=n;if(t==="-"&&Fe(e,s))return!0}return!1}function Be(n){return n.type==="Identifier"?!0:n.type!=="MemberExpression"||n.computed?!1:Be(n.object)}var ni={ClassNameIsRequired:"A class name is required.",UnexpectedSpace:"Unexpected space in placeholder."},Pe=M`placeholders`(ni),oi=n=>class extends n{parsePlaceholder(t){if(this.match(129)){let e=this.startNode();return this.next(),this.assertNoSpace(),e.name=super.parseIdentifier(!0),this.assertNoSpace(),this.expect(129),this.finishPlaceholder(e,t)}}finishPlaceholder(t,e){let i=t;return(!i.expectedNode||!i.type)&&(i=this.finishNode(i,"Placeholder")),i.expectedNode=e,i}getTokenFromCode(t){t===37&&this.input.charCodeAt(this.state.pos+1)===37?this.finishOp(129,2):super.getTokenFromCode(t)}parseExprAtom(t){return this.parsePlaceholder("Expression")||super.parseExprAtom(t)}parseIdentifier(t){return this.parsePlaceholder("Identifier")||super.parseIdentifier(t)}checkReservedWord(t,e,i,r){t!==void 0&&super.checkReservedWord(t,e,i,r)}cloneIdentifier(t){let e=super.cloneIdentifier(t);return e.type==="Placeholder"&&(e.expectedNode=t.expectedNode),e}cloneStringLiteral(t){return t.type==="Placeholder"?this.cloneIdentifier(t):super.cloneStringLiteral(t)}parseBindingAtom(){return this.parsePlaceholder("Pattern")||super.parseBindingAtom()}isValidLVal(t,e,i,r){return t==="Placeholder"||super.isValidLVal(t,e,i,r)}toAssignable(t,e){t&&t.type==="Placeholder"&&t.expectedNode==="Expression"?t.expectedNode="Pattern":super.toAssignable(t,e)}chStartsBindingIdentifier(t,e){if(super.chStartsBindingIdentifier(t,e))return!0;let i=this.nextTokenStart();return this.input.charCodeAt(i)===37&&this.input.charCodeAt(i+1)===37}verifyBreakContinue(t,e){t.label?.type!=="Placeholder"&&super.verifyBreakContinue(t,e)}parseExpressionStatement(t,e){if(e.type!=="Placeholder"||e.extra?.parenthesized)return super.parseExpressionStatement(t,e);if(this.match(10)){let r=t;return r.label=this.finishPlaceholder(e,"Identifier"),this.next(),r.body=super.parseStatementOrSloppyAnnexBFunctionDeclaration(),this.finishNode(r,"LabeledStatement")}this.semicolon();let i=t;return i.name=e.name,this.finishPlaceholder(i,"Statement")}parseBlock(t,e,i){return this.parsePlaceholder("BlockStatement")||super.parseBlock(t,e,i)}parseFunctionId(t){return this.parsePlaceholder("Identifier")||super.parseFunctionId(t)}parseClass(t,e,i){let r=e?"ClassDeclaration":"ClassExpression";this.next();let a=this.state.strict,o=this.parsePlaceholder("Identifier");if(o)if(this.match(77)||this.match(129)||this.match(2))t.id=o;else{if(i||!e)return t.id=null,t.body=this.finishPlaceholder(o,"ClassBody"),this.finishNode(t,r);throw this.raise(Pe.ClassNameIsRequired,this.state.startLoc)}else this.parseClassId(t,e,i);return super.parseClassSuper(t),t.body=this.parsePlaceholder("ClassBody")||super.parseClassBody(!!t.superClass,a),this.finishNode(t,r)}parseExport(t,e){let i=this.parsePlaceholder("Identifier");if(!i)return super.parseExport(t,e);let r=t;if(!this.isContextual(94)&&!this.match(8))return r.specifiers=[],r.source=null,r.declaration=this.finishPlaceholder(i,"Declaration"),this.finishNode(r,"ExportNamedDeclaration");this.expectPlugin("exportDefaultFrom");let a=this.startNode();return a.exported=i,r.specifiers=[this.finishNode(a,"ExportDefaultSpecifier")],super.parseExport(r,e)}isExportDefaultSpecifier(){if(this.match(61)){let t=this.nextTokenStart();if(this.isUnparsedContextual(t,"from")&&this.input.startsWith(j(129),this.nextTokenStartSince(t+4)))return!0}return super.isExportDefaultSpecifier()}maybeParseExportDefaultSpecifier(t,e){return t.specifiers?.length?!0:super.maybeParseExportDefaultSpecifier(t,e)}checkExport(t){let{specifiers:e}=t;e?.length&&(t.specifiers=e.filter(i=>i.exported.type==="Placeholder")),super.checkExport(t),t.specifiers=e}parseImport(t){let e=this.parsePlaceholder("Identifier");if(!e)return super.parseImport(t);if(t.specifiers=[],!this.isContextual(94)&&!this.match(8))return t.source=this.finishPlaceholder(e,"StringLiteral"),this.semicolon(),this.finishNode(t,"ImportDeclaration");let i=this.startNodeAtNode(e);return i.local=e,t.specifiers.push(this.finishNode(i,"ImportDefaultSpecifier")),this.eat(8)&&(this.maybeParseStarImportSpecifier(t)||this.parseNamedImportSpecifiers(t)),this.expectContextual(94),t.source=this.parseImportSource(),this.semicolon(),this.finishNode(t,"ImportDeclaration")}parseImportSource(){return this.parsePlaceholder("StringLiteral")||super.parseImportSource()}assertNoSpace(){this.state.start>this.offsetToSourcePos(this.state.lastTokEndLoc.index)&&this.raise(Pe.UnexpectedSpace,this.state.lastTokEndLoc)}},hi=n=>class extends n{parseV8Intrinsic(){if(this.match(50)){let t=this.state.startLoc,e=this.startNode();if(this.next(),S(this.state.type)){let i=this.parseIdentifierName(),r=this.createIdentifier(e,i);if(this.castNodeTo(r,"V8IntrinsicIdentifier"),this.match(6))return r}this.unexpected(t)}}parseExprAtom(t){return this.parseV8Intrinsic()||super.parseExprAtom(t)}},Te=["fsharp","hack"],Ae=["^^","@@","^","%","#"];function li(n){if(n.has("decorators")&&n.has("decorators-legacy"))throw new Error("Cannot use the decorators and decorators-legacy plugin together");if(n.has("flow")&&n.has("typescript"))throw new Error("Cannot combine flow and typescript plugins.");if(n.has("placeholders")&&n.has("v8intrinsic"))throw new Error("Cannot combine placeholders and v8intrinsic plugins.");if(n.has("pipelineOperator")){let s=n.get("pipelineOperator").proposal;if(!Te.includes(s)){let t=Te.map(e=>`"${e}"`).join(", ");throw new Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${t}.`)}if(s==="hack"){if(n.has("placeholders"))throw new Error("Cannot combine placeholders plugin and Hack-style pipes.");if(n.has("v8intrinsic"))throw new Error("Cannot combine v8intrinsic plugin and Hack-style pipes.");let t=n.get("pipelineOperator").topicToken;if(!Ae.includes(t)){let e=Ae.map(i=>`"${i}"`).join(", ");throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${e}.`)}}}if(n.has("moduleAttributes"))throw new Error("`moduleAttributes` has been removed in Babel 8, please migrate to import attributes instead.");if(n.has("importAssertions"))throw new Error("`importAssertions` has been removed in Babel 8, please use import attributes instead.");if(n.has("deprecatedImportAssert")?console.warn("`deprecatedImportAssert` has been removed in Babel 8, please use import attributes instead."):n.has("importAttributes")&&n.get("importAttributes").deprecatedAssertSyntax&&console.warn("The 'importAttributes' plugin has been removed in Babel 8. Please migrate any usage of `assert`-style attributes to `with`."),n.has("recordAndTuple"))throw new Error("The 'recordAndTuple' plugin has been removed in Babel 8. Please remove it from your configuration.");if(n.has("asyncDoExpressions")&&!n.has("doExpressions")){let s=new Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.");throw s.missingPlugins="doExpressions",s}if(n.has("optionalChainingAssign")&&n.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(n.has("discardBinding")&&n.get("discardBinding").syntaxType!=="void")throw new Error("The 'discardBinding' plugin requires a 'syntaxType' option. Currently the only supported value is 'void'.");if(n.has("decimal"))throw new Error("The 'decimal' plugin has been removed in Babel 8. Please remove it from your configuration.");if(n.has("importReflection"))throw new Error("The 'importReflection' plugin has been removed in Babel 8. Use 'sourcePhaseImports' instead, and replace 'import module' with 'import source' in your code.")}var Re={estree:cs,jsx:zs,flow:Bs,typescript:si,v8intrinsic:hi,placeholders:oi},ci=Object.keys(Re),mt=class extends Kt{constructor(s,t,e){let i=ls(s);super(i,t),this.options=i,this.initializeScopes(),this.plugins=e,this.filename=i.sourceFilename,this.startIndex=i.startIndex;let r=0;i.allowAwaitOutsideFunction&&(r|=1),i.allowReturnOutsideFunction&&(r|=2),i.allowImportExportEverywhere&&(r|=8),i.allowSuperOutsideMethod&&(r|=16),i.allowUndeclaredExports&&(r|=64),i.allowNewTargetOutsideFunction&&(r|=4),i.allowYieldOutsideFunction&&(r|=32),i.ranges&&(r|=128),i.locations===!0&&(r|=256),i.tokens&&(r|=512),i.createImportExpressions&&(r|=1024),i.createParenthesizedExpressions&&(r|=2048),i.errorRecovery&&(r|=4096),i.attachComment&&(r|=8192),i.annexB&&(r|=16384),this.optionFlags=r}getScopeHandler(){return it}parse(){this.enterInitialScopes();let s=this.startNode(),t=this.startNode();this.nextToken(),s.errors=[];let e=this.parseTopLevel(s,t);return e.errors=this.state.errors,e.comments.length=this.state.commentsLen,e}};function Ue(n,s){if(s?.sourceType==="unambiguous"){s={...s};try{s.sourceType="module";let t=lt(s,n),e=t.parse();if(t.sawUnambiguousESM)return e;if(t.ambiguousScriptDifferentAst)try{return s.sourceType="script",lt(s,n).parse()}catch{}else e.program.sourceType="script";return e}catch(t){try{return s.sourceType="script",lt(s,n).parse()}catch{}throw t}}else return lt(s,n).parse()}function pi(n){let s={};for(let t of Object.keys(n))s[t]=Ce(n[t]);return s}var qi=pi(us);function lt(n,s){let t=mt,e=new Map;if(n?.plugins){for(let i of n.plugins){let r,a;typeof i=="string"?r=i:[r,a]=i,e.has(r)||e.set(r,a||{})}li(e),t=ui(e)}return new t(n,s,e)}var be=new Map;function ui(n){let s=[];for(let i of ci)n.has(i)&&s.push(i);let t=s.join("|"),e=be.get(t);if(!e){e=mt;for(let i of s)e=Re[i](e);be.set(t,e)}return e}var fi=1500;function yt(n){let s;try{s=Ue(n,{sourceType:"unambiguous",errorRecovery:!0,allowReturnOutsideFunction:!0,plugins:["jsx","typescript"]})}catch{return[]}let t=[],e=[s];for(;e.length;){let i=e.pop();if(!(!i||typeof i!="object")){if(Array.isArray(i)){for(let r of i)e.push(r);continue}if(i.type==="TemplateLiteral"&&typeof i.start=="number"&&i.end-i.start>=fi){t.push([i.start,i.end]);continue}for(let r in i)r!=="loc"&&r!=="leadingComments"&&r!=="trailingComments"&&i[r]&&typeof i[r]=="object"&&e.push(i[r])}}return t}var xt=(n,s)=>n.some(([t,e])=>s>t&&s<e);var di=/\b(?:app|router|api|r)\.(get|post|put|patch|delete|all)\(\s*(['"`])(\/[^'"`]*)\2/g,mi=/require\(\s*['"]express['"]\s*\)|from\s+['"]express['"]|express\.Router\(/;function yi(n,s){let t=n.split("/"),e=s.split("/");return t.length===e.length&&t.every((i,r)=>i===e[r]||i.startsWith(":")||i==="*")}var _e={id:"shadowed-route",titulo:"An Express route registered earlier takes every request of a later one",origen:"MEITI 2026-11-25, update 1ea2beac: una ruta DELETE nueva le robaba el borrado por id a todas las apps.",revisar(n){let s=[];for(let t of n){if(!mi.test(t.texto))continue;let e=yt(t.texto),i=[...t.texto.matchAll(di)].filter(r=>!xt(e,r.index??0)).map(r=>({metodo:r[1],ruta:r[3].replace(/\?.*$/,"").replace(/\/$/,"")||"/",linea:L(t.texto,r.index??0)}));for(let r=0;r<i.length;r++){let a=i[r],o=i.slice(0,r).find(h=>(h.metodo===a.metodo||h.metodo==="all")&&yi(h.ruta,a.ruta));o&&s.push({archivo:t.ruta,linea:a.linea,severidad:o.ruta===a.ruta?"error":"warning",mensaje:o.ruta===a.ruta?`${a.metodo.toUpperCase()} ${a.ruta} is registered twice (first at line ${o.linea}): Express always answers with the first one, so this one never runs.`:`${o.metodo.toUpperCase()} ${o.ruta} (line ${o.linea}) is registered first and matches every URL of ${a.metodo.toUpperCase()} ${a.ruta}: Express answers with the first match, so this route only runs if that handler calls next(). Register the specific route first.`})}}return s}};var xi=/CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?["`\[]?([A-Za-z_][A-Za-z0-9_]*)/gi,gi=/ALTER\s+TABLE\s+["`\[]?([A-Za-z_][A-Za-z0-9_]*)["`\]]?\s+ADD\s+(?:COLUMN\s+)?["`\[]?([A-Za-z_][A-Za-z0-9_]*)/gi,je={id:"alter-before-create",titulo:"ALTER TABLE ADD COLUMN runs before the CREATE TABLE of its table: new databases end up without the column",origen:"MEITI 2026-11-25 (vigilancia de Healer): las bases de cada app nueva quedaban sin 6 columnas y 2 \xEDndices.",revisar(n){let s=[];for(let t of n){if(!/ALTER\s+TABLE/i.test(t.texto)||!/CREATE\s+TABLE/i.test(t.texto))continue;let e=new Map;for(let r of t.texto.matchAll(xi)){let a=r[1].toLowerCase();e.has(a)||e.set(a,r.index??0)}let i=[...t.texto.matchAll(gi)].map(r=>({tabla:r[1].toLowerCase(),columna:r[2].toLowerCase(),pos:r.index??0}));for(let r of i){let a=e.get(r.tabla);if(a===void 0||r.pos>a||i.some(l=>l.tabla===r.tabla&&l.columna===r.columna&&l.pos>a))continue;let o=t.texto.slice(a,a+6e3),h=o.indexOf(");");new RegExp(`\\b${r.columna}\\b`,"i").test(h>0?o.slice(0,h):o)||s.push({archivo:t.ruta,linea:L(t.texto,r.pos),severidad:"error",mensaje:`ALTER TABLE ${r.tabla} ADD COLUMN ${r.columna} runs before CREATE TABLE ${r.tabla} (line ${L(t.texto,a)}), and the CREATE does not include that column. On a new database the ALTER fails (the table does not exist yet) and the table is created without ${r.columna}. Run the ALTER after the CREATE, or add the column to the CREATE.`})}}return s}};var Pi=/CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?["`\[]?([A-Za-z_][A-Za-z0-9_]*)["`\]]?\s*\(/gi,Ti=/ALTER\s+TABLE\s+["`\[]?([A-Za-z_][A-Za-z0-9_]*)["`\]]?\s+ADD\s+(?:COLUMN\s+)?["`\[]?([A-Za-z_][A-Za-z0-9_]*)["`\]]?([^;'"`]{0,200})/gi,Ai=/(?:INSERT\s+OR\s+REPLACE|REPLACE)\s+INTO\s+["`\[]?([A-Za-z_][A-Za-z0-9_]*)["`\]]?\s*\(([^)]*)\)/gi,bi=/^(PRIMARY|UNIQUE|FOREIGN|CHECK|CONSTRAINT)\b/i,ze=/DEFAULT\s*\(?\s*(CURRENT_TIMESTAMP|CURRENT_DATE|CURRENT_TIME|datetime\(|strftime\(|unixepoch\()|AUTOINCREMENT/i;function Si(n,s){let t=1,e=s,i="",r=[];for(;e<n.length&&e<s+2e4&&t>0;e++){let a=n[e];if(a==="("&&t++,a===")"&&(t--,t===0))break;a===","&&t===1?(r.push(i),i=""):i+=a}return r.push(i),r.map(a=>a.trim()).filter(a=>a&&!bi.test(a)&&!ze.test(a)).map(a=>a.split(/\s+/)[0].replace(/["`\[\]]/g,"").toLowerCase()).filter(a=>/^[a-z_][a-z0-9_]*$/.test(a))}var $e={id:"insert-or-replace-wipes-columns",titulo:"INSERT OR REPLACE deletes and re-inserts the row: the columns it does not list go back to their defaults",origen:"MEITI (core_logs identidad_robada_por_or_replace x2, upsert_on_conflict_columnas_incompletas x2): due\xF1os y fechas pisados.",revisar(n){let s=new Map;for(let e of n){for(let i of e.texto.matchAll(Pi)){let r=i[1].toLowerCase(),a=s.get(r)??new Set;for(let o of Si(e.texto,(i.index??0)+i[0].length))a.add(o);s.set(r,a)}for(let i of e.texto.matchAll(Ti))ze.test(i[3]??"")||s.get(i[1].toLowerCase())?.add(i[2].toLowerCase())}let t=[];for(let e of n)if(/REPLACE\s+INTO/i.test(e.texto))for(let i of e.texto.matchAll(Ai)){let r=i[1].toLowerCase(),a=s.get(r);if(!a||a.size<2)continue;let o=new Set(i[2].split(",").map(l=>l.trim().replace(/["`\[\]]/g,"").toLowerCase()));if([...o].some(l=>!/^[a-z_][a-z0-9_]*$/.test(l)))continue;let h=[...a].filter(l=>!o.has(l)&&l!=="rowid");h.length&&t.push({archivo:e.ruta,linea:L(e.texto,i.index??0),severidad:"warning",mensaje:`INSERT OR REPLACE INTO ${r} lists ${o.size} of its ${a.size} columns. When the row already exists it is deleted and inserted again, so ${h.slice(0,6).join(", ")}${h.length>6?` and ${h.length-6} more`:""} go back to their default values. If you meant to update, use INSERT ... ON CONFLICT DO UPDATE SET with the columns that change. If resetting them is intended, say so: healer-ignore: insert-or-replace-wipes-columns <reason>.`})}return t}};var Ci=/^\s*import\s+(?:[^'"]*?\s+from\s+)?['"]([^'"]+)['"]/gm,Ve={id:"dotenv-not-first",titulo:"Own modules are imported before dotenv: whatever they read from process.env at load time is empty",origen:"Healer 2026-11-20: el flywheel ley\xF3 una variable vac\xEDa al cargarse y no guard\xF3 nada durante 3 d\xEDas.",revisar(n){let s=[];for(let t of n){if(!t.texto.includes("dotenv"))continue;let e=[...t.texto.matchAll(Ci)].map(a=>({modulo:a[1],pos:a.index??0})),i=e.findIndex(a=>a.modulo==="dotenv/config");if(i<=0)continue;let r=e.slice(0,i).filter(a=>a.modulo.startsWith("./")||a.modulo.startsWith("../"));r.length&&s.push({archivo:t.ruta,linea:L(t.texto,e[i].pos),severidad:"warning",mensaje:`'dotenv/config' is imported after ${r.map(a=>`'${a.modulo}'`).slice(0,3).join(", ")}${r.length>3?" and others":""}. Imports run in order, so anything those modules read from process.env while loading sees it without the .env values. Import 'dotenv/config' first.`})}return s}};var wi=/\b(?:app|router|api|r)\.(get|post|put|patch|delete|all)\(\s*(['"`])(\/[^'"`]*)\2\s*,([^]*?)(?=\b(?:app|router|api|r)\.(?:get|post|put|patch|delete|all|use)\(|$)/g,Ii=/require\(\s*['"]express['"]\s*\)|from\s+['"]express['"]|express\.Router\(/,Ei=/^(verificar|exigir|requiere|require|check|ensure|auth|authorize|assert|is[A-Z]\w*Admin|solo|limite|rateLimit)/,Ni=/\.(?:status|code)\(\s*40[13]\s*\)|\bsendStatus\(\s*40[13]\s*\)/;function ki(n,s){if(s.size)return!0;let t=n.search(/(?:async\s*)?(?:\(\s*req\b|function\s*\(|\breq\s*=>)/),e=(t>=0?n.slice(t):n).split(`
12
+ `).slice(0,8).join(`
13
+ `);return Ni.test(e)||/\b\w*[Ss]esion\w*\s*\(|\b\w*[Ss]ession\w*\s*\(|\b\w*[Tt]oken\w*\s*\(/.test(e)}function vi(n){let s=new Set,t=n.search(/(?:async\s*)?(?:\(\s*req\b|function\s*\(|\breq\s*=>)/),e=t>0?n.slice(0,t):"";for(let r of e.matchAll(/\b([A-Za-z_$][\w$]*)\b/g))["async","await","function","req","res","next"].includes(r[1])||s.add(r[1]);let i=(t>=0?n.slice(t):n).split(`
14
+ `).slice(0,8).join(`
15
+ `);for(let r of i.matchAll(/\b([A-Za-z_$][\w$]*)\s*\(/g))Ei.test(r[1])&&s.add(r[1]);return s}var qe={id:"missing-guard-in-sibling-route",titulo:"Most routes of a group run a check that this route skips",origen:"MEITI, la categor\xEDa m\xE1s corroborada del ranking (regla_no_propagada_a_todos_los_puntos_de_entrada, 88 lecciones).",revisar(n){let s=[];for(let t of n){if(!Ii.test(t.texto))continue;let e=yt(t.texto),i=[...t.texto.matchAll(wi)].filter(a=>!xt(e,a.index??0)).map(a=>({metodo:a[1],ruta:a[3],linea:L(t.texto,a.index??0),grupo:a[3].split("/").slice(0,3).join("/"),guardias:vi(a[4].slice(0,4e3)),resto:a[4].slice(0,4e3)})),r=new Map;for(let a of i)a.ruta.split("/").length<3||r.set(a.grupo,[...r.get(a.grupo)??[],a]);for(let[a,o]of r){if(o.length<4)continue;let h=new Map;for(let l of o)for(let p of l.guardias)h.set(p,(h.get(p)??0)+1);for(let[l,p]of h)if(!(p===o.length||p/o.length<.75))for(let u of o.filter(f=>!f.guardias.has(l)&&!ki(f.resto,f.guardias)))s.push({archivo:t.ruta,linea:u.linea,severidad:"warning",mensaje:`${p} of the ${o.length} routes under ${a} use ${l}, but ${u.metodo.toUpperCase()} ${u.ruta} runs no check at all (no middleware, no auth call, no early 401/403). If it is public on purpose, say so next to it (healer-ignore: missing-guard-in-sibling-route <reason>); if not, it is missing the check its siblings have.`})}}return s}};var Ke=[re,_e,je,$e,Ve,qe];function He(n,s,t){if(!t)return!1;let e=n.get(t.archivo);if(!e)return!1;let i=e.slice(Math.max(0,t.linea-4),t.linea).join(`
16
+ `);return new RegExp(`healer-ignore:\\s*${s.replace(/[-]/g,"\\-")}\\b`).test(i)}function Li(n,s){let{archivos:t,omitidos:e}=ie(n,s),i=[],r={},a=[],o=new Map(t.map(h=>[h.ruta,h.texto.split(`
17
+ `)]));for(let h of Ke)try{let l=h.revisar(t).filter(p=>!He(o,h.id,p)&&!He(o,h.id,p.tambien));r[h.id]=l.length,i.push(...l.map(p=>({...p,regla:h.id})))}catch(l){r[h.id]=0,a.push(`${h.id}: ${String(l?.message||l).slice(0,200)}`)}return{hallazgos:i,por_regla:r,archivos_revisados:t.length,archivos_omitidos:e,errores:a}}export{Ke as REGLAS,Li as correrReglasPropias};