UNPKG

acorn-typescript

Version:
1 lines 105 kB
var t=require("acorn");function e(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(s){if("default"!==s){var i=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:function(){return t[s]}})}}),e.default=t,e}var s=/*#__PURE__*/e(t);function i(t,e){for(var s=0;s<e.length;s++){var i=e[s];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,"symbol"==typeof(r=function(t,e){if("object"!=typeof t||null===t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var i=s.call(t,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(i.key))?r:String(r),i)}var r}function r(){return r=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(t[i]=s[i])}return t},r.apply(this,arguments)}function a(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,n(t,e)}function n(t,e){return n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},n(t,e)}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var s=0,i=new Array(e);s<e;s++)i[s]=t[s];return i}function h(t,e){var s="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(s)return(s=s.call(t)).next.bind(s);if(Array.isArray(t)||(s=function(t,e){if(t){if("string"==typeof t)return o(t,e);var s=Object.prototype.toString.call(t).slice(8,-1);return"Object"===s&&t.constructor&&(s=t.constructor.name),"Map"===s||"Set"===s?Array.from(t):"Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?o(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){s&&(t=s);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var p=!0;function c(e,s){return void 0===s&&(s={}),new t.TokenType("name",s)}var l=new WeakMap,u=1024,d=new RegExp("(?:[^\\S\\n\\r\\u2028\\u2029]|\\/\\/.*|\\/\\*.*?\\*\\/)*","y"),m=new RegExp("(?=("+d.source+"))\\1"+/(?=[\n\r\u2028\u2029]|\/\*(?!.*?\*\/)|$)/.source,"y"),y=function(){this.shorthandAssign=void 0,this.trailingComma=void 0,this.parenthesizedAssign=void 0,this.parenthesizedBind=void 0,this.doubleProto=void 0,this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};function f(t,e){var s=e.key.name,i=t[s],r="true";return"MethodDefinition"!==e.type||"get"!==e.kind&&"set"!==e.kind||(r=(e.static?"s":"i")+e.kind),"iget"===i&&"iset"===r||"iset"===i&&"iget"===r||"sget"===i&&"sset"===r||"sset"===i&&"sget"===r?(t[s]="true",!1):!!i||(t[s]=r,!1)}function x(t,e){var s=t.key;return!t.computed&&("Identifier"===s.type&&s.name===e||"Literal"===s.type&&s.value===e)}var T={AbstractMethodHasImplementation:function(t){return"Method '"+t.methodName+"' cannot have an implementation because it is marked abstract."},AbstractPropertyHasInitializer:function(t){return"Property '"+t.propertyName+"' cannot have an initializer because it is marked abstract."},AccesorCannotDeclareThisParameter:"'get' and 'set' accessors cannot declare 'this' parameters.",AccesorCannotHaveTypeParameters:"An accessor cannot have type parameters.",CannotFindName:function(t){return"Cannot find name '"+t.name+"'."},ClassMethodHasDeclare:"Class methods cannot have the 'declare' modifier.",ClassMethodHasReadonly:"Class methods cannot have the 'readonly' modifier.",ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference:"A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",ConstructorHasTypeParameters:"Type parameters cannot appear on a constructor declaration.",DeclareAccessor:function(t){return"'declare' is not allowed in "+t.kind+"ters."},DeclareClassFieldHasInitializer:"Initializers are not allowed in ambient contexts.",DeclareFunctionHasImplementation:"An implementation cannot be declared in ambient contexts.",DuplicateAccessibilityModifier:function(){return"Accessibility modifier already seen."},DuplicateModifier:function(t){return"Duplicate modifier: '"+t.modifier+"'."},EmptyHeritageClauseType:function(t){return"'"+t.token+"' list cannot be empty."},EmptyTypeArguments:"Type argument list cannot be empty.",EmptyTypeParameters:"Type parameter list cannot be empty.",ExpectedAmbientAfterExportDeclare:"'export declare' must be followed by an ambient declaration.",ImportAliasHasImportType:"An import alias can not use 'import type'.",IncompatibleModifiers:function(t){var e=t.modifiers;return"'"+e[0]+"' modifier cannot be used with '"+e[1]+"' modifier."},IndexSignatureHasAbstract:"Index signatures cannot have the 'abstract' modifier.",IndexSignatureHasAccessibility:function(t){return"Index signatures cannot have an accessibility modifier ('"+t.modifier+"')."},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.",InvalidModifierOnTypeMember:function(t){return"'"+t.modifier+"' modifier cannot appear on a type member."},InvalidModifierOnTypeParameter:function(t){return"'"+t.modifier+"' modifier cannot appear on a type parameter."},InvalidModifierOnTypeParameterPositions:function(t){return"'"+t.modifier+"' modifier can only appear on a type parameter of a class, interface or type alias."},InvalidModifiersOrder:function(t){var e=t.orderedModifiers;return"'"+e[0]+"' modifier must precede '"+e[1]+"' modifier."},InvalidPropertyAccessAfterInstantiationExpression:"Invalid property access after an instantiation expression. You can either wrap the instantiation expression in parentheses, or delete the type arguments.",InvalidTupleMemberLabel:"Tuple members must be labeled with a simple identifier.",MissingInterfaceName:"'interface' declarations must be followed by an identifier.",MixedLabeledAndUnlabeledElements:"Tuple members must all have names or all not have names.",NonAbstractClassHasAbstractMethod:"Abstract methods can only appear within an abstract class.",NonClassMethodPropertyHasAbstractModifer:"'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:function(t){return"Private elements cannot have an accessibility modifier ('"+t.modifier+"')."},PrivateMethodsHasAccessibility:function(t){return"Private methods cannot have an accessibility modifier ('"+t.modifier+"')."},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.",SetAccesorCannotHaveOptionalParameter:"A 'set' accessor cannot have an optional parameter.",SetAccesorCannotHaveRestParameter:"A 'set' accessor cannot have rest parameter.",SetAccesorCannotHaveReturnType:"A 'set' accessor cannot have a return type annotation.",SingleTypeParameterWithoutTrailingComma:function(t){var e=t.typeParameterName;return"Single type parameter "+e+" should have a trailing comma. Example usage: <"+e+",>."},StaticBlockCannotHaveModifier:"Static class blocks cannot have any modifier.",TypeAnnotationAfterAssign:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeImportCannotSpecifyDefaultAndNamed:"A type-only import can specify a default import or named bindings, but not both.",TypeModifierIsUsedInTypeExports:"The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",TypeModifierIsUsedInTypeImports:"The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",UnexpectedParameterModifier:"A parameter property is only allowed in a constructor implementation.",UnexpectedReadonly:"'readonly' type modifier is only permitted on array and tuple literal types.",GenericsEndWithComma:"Trailing comma is not allowed at the end of generics.",UnexpectedTypeAnnotation:"Did not expect a type annotation here.",UnexpectedTypeCastInParameter:"Unexpected type cast in parameter position.",UnsupportedImportTypeArgument:"Argument in a type import must be a string literal.",UnsupportedParameterPropertyKind:"A parameter property may not be declared using a binding pattern.",UnsupportedSignatureParameterKind:function(t){return"Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got "+t.type+"."},LetInLexicalBinding:"'let' is not allowed to be used as a name in 'let' or 'const' declarations."},v={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"},P=/^[\da-fA-F]+$/,b=/^\d+$/;function g(t){return t?"JSXIdentifier"===t.type?t.name:"JSXNamespacedName"===t.type?t.namespace.name+":"+t.name.name:"JSXMemberExpression"===t.type?g(t.object)+"."+g(t.property):void 0:t}var A=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;function S(t){if(!t)throw new Error("Assert fail")}function k(t){return"accessor"===t}function C(t){return"in"===t||"out"===t}function E(t,e){return 2|(t?4:0)|(e?8:0)}function I(t){if("MemberExpression"!==t.type)return!1;var e=t.property;return(!t.computed||!("TemplateLiteral"!==e.type||e.expressions.length>0))&&N(t.object)}function N(t){return"Identifier"===t.type||"MemberExpression"===t.type&&!t.computed&&N(t.object)}function w(t){return"private"===t||"public"===t||"protected"===t}function L(e){var n=e||{},o=n.dts,d=void 0!==o&&o,N=n.allowSatisfies,L=void 0!==N&&N;return function(n){var o=n.acorn||s,N=function(e){var s=l.get(e.Parser.acorn||e);if(!s){var i={assert:c(0,{startsExpr:p}),asserts:c(0,{startsExpr:p}),global:c(0,{startsExpr:p}),keyof:c(0,{startsExpr:p}),readonly:c(0,{startsExpr:p}),unique:c(0,{startsExpr:p}),abstract:c(0,{startsExpr:p}),declare:c(0,{startsExpr:p}),enum:c(0,{startsExpr:p}),module:c(0,{startsExpr:p}),namespace:c(0,{startsExpr:p}),interface:c(0,{startsExpr:p}),type:c(0,{startsExpr:p})},a={at:new t.TokenType("@"),jsxName:new t.TokenType("jsxName"),jsxText:new t.TokenType("jsxText",{beforeExpr:!0}),jsxTagStart:new t.TokenType("jsxTagStart",{startsExpr:!0}),jsxTagEnd:new t.TokenType("jsxTagEnd")},n={tc_oTag:new t.TokContext("<tag",!1,!1),tc_cTag:new t.TokContext("</tag",!1,!1),tc_expr:new t.TokContext("<tag>...</tag>",!0,!0)},o=new RegExp("^(?:"+Object.keys(i).join("|")+")$");a.jsxTagStart.updateContext=function(){this.context.push(n.tc_expr),this.context.push(n.tc_oTag),this.exprAllowed=!1},a.jsxTagEnd.updateContext=function(e){var s=this.context.pop();s===n.tc_oTag&&e===t.tokTypes.slash||s===n.tc_cTag?(this.context.pop(),this.exprAllowed=this.curContext()===n.tc_expr):this.exprAllowed=!0},s={tokTypes:r({},i,a),tokContexts:r({},n),keywordsRegExp:o,tokenIsLiteralPropertyName:function(e){return[t.tokTypes.name,t.tokTypes.string,t.tokTypes.num].concat(Object.values(t.keywordTypes),Object.values(i)).includes(e)},tokenIsKeywordOrIdentifier:function(e){return[t.tokTypes.name].concat(Object.values(t.keywordTypes),Object.values(i)).includes(e)},tokenIsIdentifier:function(e){return[].concat(Object.values(i),[t.tokTypes.name]).includes(e)},tokenIsTSDeclarationStart:function(t){return[i.abstract,i.declare,i.enum,i.module,i.namespace,i.interface,i.type].includes(t)},tokenIsTSTypeOperator:function(t){return[i.keyof,i.readonly,i.unique].includes(t)},tokenIsTemplate:function(e){return e===t.tokTypes.invalidTemplate}}}return s}(o),M=o.tokTypes,O=o.keywordTypes,D=o.isIdentifierStart,_=o.lineBreak,R=o.isNewLine,j=o.tokContexts,F=o.isIdentifierChar,B=N.tokTypes,H=N.tokContexts,q=N.keywordsRegExp,U=N.tokenIsLiteralPropertyName,V=N.tokenIsTemplate,K=N.tokenIsTSDeclarationStart,z=N.tokenIsIdentifier,J=N.tokenIsKeywordOrIdentifier,X=N.tokenIsTSTypeOperator;function W(t,e,s){void 0===s&&(s=t.length);for(var i=e;i<s;i++){var r=t.charCodeAt(i);if(R(r))return i<s-1&&13===r&&10===t.charCodeAt(i+1)?i+2:i+1}return-1}n=function(t,e,s){var i=s.tokTypes,r=e.tokTypes;/*#__PURE__*/return function(t){function e(){return t.apply(this,arguments)||this}a(e,t);var s=e.prototype;return s.takeDecorators=function(t){var e=this.decoratorStack[this.decoratorStack.length-1];e.length&&(t.decorators=e,this.resetStartLocationFromNode(t,e[0]),this.decoratorStack[this.decoratorStack.length-1]=[])},s.parseDecorators=function(t){for(var e=this.decoratorStack[this.decoratorStack.length-1];this.match(r.at);){var s=this.parseDecorator();e.push(s)}this.match(i._export)?t||this.unexpected():this.canHaveLeadingDecorator()||this.raise(this.start,"Leading decorators must be attached to a class declaration.")},s.parseDecorator=function(){var t=this.startNode();this.next(),this.decoratorStack.push([]);var e,s=this.start,r=this.startLoc;if(this.match(i.parenL)){var a=this.start,n=this.startLoc;if(this.next(),e=this.parseExpression(),this.expect(i.parenR),this.options.preserveParens){var o=this.startNodeAt(a,n);o.expression=e,e=this.finishNode(o,"ParenthesizedExpression")}}else for(e=this.parseIdent(!1);this.eat(i.dot);){var h=this.startNodeAt(s,r);h.object=e,h.property=this.parseIdent(!0),h.computed=!1,e=this.finishNode(h,"MemberExpression")}return t.expression=this.parseMaybeDecoratorArguments(e),this.decoratorStack.pop(),this.finishNode(t,"Decorator")},s.parseMaybeDecoratorArguments=function(t){if(this.eat(i.parenL)){var e=this.startNodeAtNode(t);return e.callee=t,e.arguments=this.parseExprList(i.parenR,!1),this.finishNode(e,"CallExpression")}return t},e}(t)}(n,N,o),n=function(t,e,s,i){var r=t.tokTypes,n=e.tokTypes,o=t.isNewLine,h=t.isIdentifierChar,p=Object.assign({allowNamespaces:!0,allowNamespacedObjects:!0},i||{});/*#__PURE__*/return function(t){function e(){return t.apply(this,arguments)||this}a(e,t);var s=e.prototype;return s.jsx_readToken=function(){for(var t="",e=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated JSX contents");var s=this.input.charCodeAt(this.pos);switch(s){case 60:case 123:return this.pos===this.start?60===s&&this.exprAllowed?(++this.pos,this.finishToken(n.jsxTagStart)):this.getTokenFromCode(s):(t+=this.input.slice(e,this.pos),this.finishToken(n.jsxText,t));case 38:t+=this.input.slice(e,this.pos),t+=this.jsx_readEntity(),e=this.pos;break;case 62:case 125:this.raise(this.pos,"Unexpected token `"+this.input[this.pos]+"`. Did you mean `"+(62===s?"&gt;":"&rbrace;")+'` or `{"'+this.input[this.pos]+'"}`?');default:o(s)?(t+=this.input.slice(e,this.pos),t+=this.jsx_readNewLine(!0),e=this.pos):++this.pos}}},s.jsx_readNewLine=function(t){var e,s=this.input.charCodeAt(this.pos);return++this.pos,13===s&&10===this.input.charCodeAt(this.pos)?(++this.pos,e=t?"\n":"\r\n"):e=String.fromCharCode(s),this.options.locations&&(++this.curLine,this.lineStart=this.pos),e},s.jsx_readString=function(t){for(var e="",s=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var i=this.input.charCodeAt(this.pos);if(i===t)break;38===i?(e+=this.input.slice(s,this.pos),e+=this.jsx_readEntity(),s=this.pos):o(i)?(e+=this.input.slice(s,this.pos),e+=this.jsx_readNewLine(!1),s=this.pos):++this.pos}return e+=this.input.slice(s,this.pos++),this.finishToken(r.string,e)},s.jsx_readEntity=function(){var t,e="",s=0,i=this.input[this.pos];"&"!==i&&this.raise(this.pos,"Entity must start with an ampersand");for(var r=++this.pos;this.pos<this.input.length&&s++<10;){if(";"===(i=this.input[this.pos++])){"#"===e[0]?"x"===e[1]?(e=e.substr(2),P.test(e)&&(t=String.fromCharCode(parseInt(e,16)))):(e=e.substr(1),b.test(e)&&(t=String.fromCharCode(parseInt(e,10)))):t=v[e];break}e+=i}return t||(this.pos=r,"&")},s.jsx_readWord=function(){var t,e=this.pos;do{t=this.input.charCodeAt(++this.pos)}while(h(t)||45===t);return this.finishToken(n.jsxName,this.input.slice(e,this.pos))},s.jsx_parseIdentifier=function(){var t=this.startNode();return this.type===n.jsxName?t.name=this.value:this.type.keyword?t.name=this.type.keyword:this.unexpected(),this.next(),this.finishNode(t,"JSXIdentifier")},s.jsx_parseNamespacedName=function(){var t=this.start,e=this.startLoc,s=this.jsx_parseIdentifier();if(!p.allowNamespaces||!this.eat(r.colon))return s;var i=this.startNodeAt(t,e);return i.namespace=s,i.name=this.jsx_parseIdentifier(),this.finishNode(i,"JSXNamespacedName")},s.jsx_parseElementName=function(){if(this.type===n.jsxTagEnd)return"";var t=this.start,e=this.startLoc,s=this.jsx_parseNamespacedName();for(this.type!==r.dot||"JSXNamespacedName"!==s.type||p.allowNamespacedObjects||this.unexpected();this.eat(r.dot);){var i=this.startNodeAt(t,e);i.object=s,i.property=this.jsx_parseIdentifier(),s=this.finishNode(i,"JSXMemberExpression")}return s},s.jsx_parseAttributeValue=function(){switch(this.type){case r.braceL:var t=this.jsx_parseExpressionContainer();return"JSXEmptyExpression"===t.expression.type&&this.raise(t.start,"JSX attributes must only be assigned a non-empty expression"),t;case n.jsxTagStart:case r.string:return this.parseExprAtom();default:this.raise(this.start,"JSX value should be either an expression or a quoted JSX text")}},s.jsx_parseEmptyExpression=function(){var t=this.startNodeAt(this.lastTokEnd,this.lastTokEndLoc);return this.finishNodeAt(t,"JSXEmptyExpression",this.start,this.startLoc)},s.jsx_parseExpressionContainer=function(){var t=this.startNode();return this.next(),t.expression=this.type===r.braceR?this.jsx_parseEmptyExpression():this.parseExpression(),this.expect(r.braceR),this.finishNode(t,"JSXExpressionContainer")},s.jsx_parseAttribute=function(){var t=this.startNode();return this.eat(r.braceL)?(this.expect(r.ellipsis),t.argument=this.parseMaybeAssign(),this.expect(r.braceR),this.finishNode(t,"JSXSpreadAttribute")):(t.name=this.jsx_parseNamespacedName(),t.value=this.eat(r.eq)?this.jsx_parseAttributeValue():null,this.finishNode(t,"JSXAttribute"))},s.jsx_parseOpeningElementAt=function(t,e){var s=this.startNodeAt(t,e);s.attributes=[];var i=this.jsx_parseElementName();for(i&&(s.name=i);this.type!==r.slash&&this.type!==n.jsxTagEnd;)s.attributes.push(this.jsx_parseAttribute());return s.selfClosing=this.eat(r.slash),this.expect(n.jsxTagEnd),this.finishNode(s,i?"JSXOpeningElement":"JSXOpeningFragment")},s.jsx_parseClosingElementAt=function(t,e){var s=this.startNodeAt(t,e),i=this.jsx_parseElementName();return i&&(s.name=i),this.expect(n.jsxTagEnd),this.finishNode(s,i?"JSXClosingElement":"JSXClosingFragment")},s.jsx_parseElementAt=function(t,e){var s=this.startNodeAt(t,e),i=[],a=this.jsx_parseOpeningElementAt(t,e),o=null;if(!a.selfClosing){t:for(;;)switch(this.type){case n.jsxTagStart:if(t=this.start,e=this.startLoc,this.next(),this.eat(r.slash)){o=this.jsx_parseClosingElementAt(t,e);break t}i.push(this.jsx_parseElementAt(t,e));break;case n.jsxText:i.push(this.parseExprAtom());break;case r.braceL:i.push(this.jsx_parseExpressionContainer());break;default:this.unexpected()}g(o.name)!==g(a.name)&&this.raise(o.start,"Expected corresponding JSX closing tag for <"+g(a.name)+">")}var h=a.name?"Element":"Fragment";return s["opening"+h]=a,s["closing"+h]=o,s.children=i,this.type===r.relational&&"<"===this.value&&this.raise(this.start,"Adjacent JSX elements must be wrapped in an enclosing tag"),this.finishNode(s,"JSX"+h)},s.jsx_parseText=function(){var t=this.parseLiteral(this.value);return t.type="JSXText",t},s.jsx_parseElement=function(){var t=this.start,e=this.startLoc;return this.next(),this.jsx_parseElementAt(t,e)},e}(s)}(o,N,n,null==e?void 0:e.jsx),n=function(t,e,s){var i=e.tokTypes,r=s.tokTypes;/*#__PURE__*/return function(t){function e(){return t.apply(this,arguments)||this}a(e,t);var s=e.prototype;return s.parseMaybeImportAttributes=function(t){if(this.type===r._with||this.type===i.assert){this.next();var e=this.parseImportAttributes();e&&(t.attributes=e)}},s.parseImportAttributes=function(){this.expect(r.braceL);var t=this.parseWithEntries();return this.expect(r.braceR),t},s.parseWithEntries=function(){var t=[],e=new Set;do{if(this.type===r.braceR)break;var s,i=this.startNode();s=this.type===r.string?this.parseLiteral(this.value):this.parseIdent(!0),this.next(),i.key=s,e.has(i.key.name)&&this.raise(this.pos,"Duplicated key in attributes"),e.add(i.key.name),this.type!==r.string&&this.raise(this.pos,"Only string is supported as an attribute value"),i.value=this.parseLiteral(this.value),t.push(this.finishNode(i,"ImportAttribute"))}while(this.eat(r.comma));return t},e}(t)}(n,N,o);var Y=/*#__PURE__*/function(t){function e(e,s,i){var r;return(r=t.call(this,e,s,i)||this).preValue=null,r.preToken=null,r.isLookahead=!1,r.isAmbientContext=!1,r.inAbstractClass=!1,r.inType=!1,r.inDisallowConditionalTypesContext=!1,r.maybeInArrowParameters=!1,r.shouldParseArrowReturnType=void 0,r.shouldParseAsyncArrowReturnType=void 0,r.decoratorStack=[[]],r.importsStack=[[]],r.importOrExportOuterKind=void 0,r.tsParseConstModifier=r.tsParseModifiers.bind(function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(r),{allowedModifiers:["const"],disallowedModifiers:["in","out"],errorTemplate:T.InvalidModifierOnTypeParameterPositions}),r}a(e,t);var s,r,n,p=e.prototype;return p.getTokenFromCodeInType=function(e){return 62===e||60===e?this.finishOp(M.relational,1):t.prototype.getTokenFromCode.call(this,e)},p.readToken=function(e){if(!this.inType){var s=this.curContext();if(s===H.tc_expr)return this.jsx_readToken();if(s===H.tc_oTag||s===H.tc_cTag){if(D(e))return this.jsx_readWord();if(62==e)return++this.pos,this.finishToken(B.jsxTagEnd);if((34===e||39===e)&&s==H.tc_oTag)return this.jsx_readString(e)}if(60===e&&this.exprAllowed&&33!==this.input.charCodeAt(this.pos+1))return++this.pos,this.finishToken(B.jsxTagStart)}return t.prototype.readToken.call(this,e)},p.getTokenFromCode=function(e){return this.inType?this.getTokenFromCodeInType(e):64===e?(++this.pos,this.finishToken(B.at)):t.prototype.getTokenFromCode.call(this,e)},p.isAbstractClass=function(){return this.ts_isContextual(B.abstract)&&this.lookahead().type===M._class},p.finishNode=function(e,s){return""!==e.type&&0!==e.end?e:t.prototype.finishNode.call(this,e,s)},p.tryParse=function(t,e){void 0===e&&(e=this.cloneCurLookaheadState());var s={node:null};try{return{node:t(function(t){throw void 0===t&&(t=null),s.node=t,s}),error:null,thrown:!1,aborted:!1,failState:null}}catch(t){var i=this.getCurLookaheadState();if(this.setLookaheadState(e),t instanceof SyntaxError)return{node:null,error:t,thrown:!0,aborted:!1,failState:i};if(t===s)return{node:s.node,error:null,thrown:!1,aborted:!0,failState:i};throw t}},p.setOptionalParametersError=function(t,e){var s;t.optionalParametersLoc=null!=(s=null==e?void 0:e.loc)?s:this.startLoc},p.reScan_lt_gt=function(){this.type===M.relational&&(this.pos-=1,this.readToken_lt_gt(this.fullCharCodeAtPos()))},p.reScan_lt=function(){var t=this.type;return t===M.bitShift?(this.pos-=2,this.finishOp(M.relational,1),M.relational):t},p.resetEndLocation=function(t,e){void 0===e&&(e=this.lastTokEndLoc),t.end=e.column,t.loc.end=e,this.options.ranges&&(t.range[1]=e.column)},p.startNodeAtNode=function(e){return t.prototype.startNodeAt.call(this,e.start,e.loc.start)},p.nextTokenStart=function(){return this.nextTokenStartSince(this.pos)},p.tsHasSomeModifiers=function(t,e){return e.some(function(e){return w(e)?t.accessibility===e:!!t[e]})},p.tsIsStartOfStaticBlocks=function(){return this.isContextual("static")&&123===this.lookaheadCharCode()},p.tsCheckForInvalidTypeCasts=function(t){var e=this;t.forEach(function(t){"TSTypeCastExpression"===(null==t?void 0:t.type)&&e.raise(t.typeAnnotation.start,T.UnexpectedTypeAnnotation)})},p.atPossibleAsyncArrow=function(t){return"Identifier"===t.type&&"async"===t.name&&this.lastTokEndLoc.column===t.end&&!this.canInsertSemicolon()&&t.end-t.start==5&&t.start===this.potentialArrowAt},p.tsIsIdentifier=function(){return z(this.type)},p.tsTryParseTypeOrTypePredicateAnnotation=function(){return this.match(M.colon)?this.tsParseTypeOrTypePredicateAnnotation(M.colon):void 0},p.tsTryParseGenericAsyncArrowFunction=function(e,s,i){var r=this;if(this.tsMatchLeftRelational()){var a=this.maybeInArrowParameters;this.maybeInArrowParameters=!0;var n=this.tsTryParseAndCatch(function(){var i=r.startNodeAt(e,s);return i.typeParameters=r.tsParseTypeParameters(),t.prototype.parseFunctionParams.call(r,i),i.returnType=r.tsTryParseTypeOrTypePredicateAnnotation(),r.expect(M.arrow),i});if(this.maybeInArrowParameters=a,n)return t.prototype.parseArrowExpression.call(this,n,null,!0,i)}},p.tsParseTypeArgumentsInExpression=function(){if(this.reScan_lt()===M.relational)return this.tsParseTypeArguments()},p.tsInNoContext=function(t){var e=this.context;this.context=[e[0]];try{return t()}finally{this.context=e}},p.tsTryParseTypeAnnotation=function(){return this.match(M.colon)?this.tsParseTypeAnnotation():void 0},p.isUnparsedContextual=function(t,e){var s=t+e.length;if(this.input.slice(t,s)===e){var i=this.input.charCodeAt(s);return!(F(i)||55296==(64512&i))}return!1},p.isAbstractConstructorSignature=function(){return this.ts_isContextual(B.abstract)&&this.lookahead().type===M._new},p.nextTokenStartSince=function(t){return A.lastIndex=t,A.test(this.input)?A.lastIndex:t},p.lookaheadCharCode=function(){return this.input.charCodeAt(this.nextTokenStart())},p.compareLookaheadState=function(t,e){for(var s=0,i=Object.keys(t);s<i.length;s++){var r=i[s];if(t[r]!==e[r])return!1}return!0},p.createLookaheadState=function(){this.value=null,this.context=[this.curContext()]},p.getCurLookaheadState=function(){return{endLoc:this.endLoc,lastTokEnd:this.lastTokEnd,lastTokStart:this.lastTokStart,lastTokStartLoc:this.lastTokStartLoc,pos:this.pos,value:this.value,type:this.type,start:this.start,end:this.end,context:this.context,startLoc:this.startLoc,lastTokEndLoc:this.lastTokEndLoc,curLine:this.curLine,lineStart:this.lineStart,curPosition:this.curPosition,containsEsc:this.containsEsc}},p.cloneCurLookaheadState=function(){return{pos:this.pos,value:this.value,type:this.type,start:this.start,end:this.end,context:this.context&&this.context.slice(),startLoc:this.startLoc,lastTokEndLoc:this.lastTokEndLoc,endLoc:this.endLoc,lastTokEnd:this.lastTokEnd,lastTokStart:this.lastTokStart,lastTokStartLoc:this.lastTokStartLoc,curLine:this.curLine,lineStart:this.lineStart,curPosition:this.curPosition,containsEsc:this.containsEsc}},p.setLookaheadState=function(t){this.pos=t.pos,this.value=t.value,this.endLoc=t.endLoc,this.lastTokEnd=t.lastTokEnd,this.lastTokStart=t.lastTokStart,this.lastTokStartLoc=t.lastTokStartLoc,this.type=t.type,this.start=t.start,this.end=t.end,this.context=t.context,this.startLoc=t.startLoc,this.lastTokEndLoc=t.lastTokEndLoc,this.curLine=t.curLine,this.lineStart=t.lineStart,this.curPosition=t.curPosition,this.containsEsc=t.containsEsc},p.tsLookAhead=function(t){var e=this.getCurLookaheadState(),s=t();return this.setLookaheadState(e),s},p.lookahead=function(t){var e=this.getCurLookaheadState();if(this.createLookaheadState(),this.isLookahead=!0,void 0!==t)for(var s=0;s<t;s++)this.nextToken();else this.nextToken();this.isLookahead=!1;var i=this.getCurLookaheadState();return this.setLookaheadState(e),i},p.readWord=function(){var t=this.readWord1(),e=M.name;return this.keywords.test(t)?e=O[t]:new RegExp(q).test(t)&&(e=B[t]),this.finishToken(e,t)},p.skipBlockComment=function(){var t;this.isLookahead||(t=this.options.onComment&&this.curPosition());var e=this.pos,s=this.input.indexOf("*/",this.pos+=2);if(-1===s&&this.raise(this.pos-2,"Unterminated comment"),this.pos=s+2,this.options.locations)for(var i,r=e;(i=W(this.input,r,this.pos))>-1;)++this.curLine,r=this.lineStart=i;this.isLookahead||this.options.onComment&&this.options.onComment(!0,this.input.slice(e+2,s),e,this.pos,t,this.curPosition())},p.skipLineComment=function(t){var e,s=this.pos;this.isLookahead||(e=this.options.onComment&&this.curPosition());for(var i=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&!R(i);)i=this.input.charCodeAt(++this.pos);this.isLookahead||this.options.onComment&&this.options.onComment(!1,this.input.slice(s+t,this.pos),s,this.pos,e,this.curPosition())},p.finishToken=function(t,e){this.preValue=this.value,this.preToken=this.type,this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var s=this.type;this.type=t,this.value=e,this.isLookahead||this.updateContext(s)},p.resetStartLocation=function(t,e,s){t.start=e,t.loc.start=s,this.options.ranges&&(t.range[0]=e)},p.isLineTerminator=function(){return this.eat(M.semi)||t.prototype.canInsertSemicolon.call(this)},p.hasFollowingLineBreak=function(){return m.lastIndex=this.end,m.test(this.input)},p.addExtra=function(t,e,s,i){if(void 0===i&&(i=!0),t){var r=t.extra=t.extra||{};i?r[e]=s:Object.defineProperty(r,e,{enumerable:i,value:s})}},p.isLiteralPropertyName=function(){return U(this.type)},p.hasPrecedingLineBreak=function(){return _.test(this.input.slice(this.lastTokEndLoc.index,this.start))},p.createIdentifier=function(t,e){return t.name=e,this.finishNode(t,"Identifier")},p.resetStartLocationFromNode=function(t,e){this.resetStartLocation(t,e.start,e.loc.start)},p.isThisParam=function(t){return"Identifier"===t.type&&"this"===t.name},p.isLookaheadContextual=function(t){var e=this.nextTokenStart();return this.isUnparsedContextual(e,t)},p.ts_type_isContextual=function(t,e){return t===e&&!this.containsEsc},p.ts_isContextual=function(t){return this.type===t&&!this.containsEsc},p.ts_isContextualWithState=function(t,e){return t.type===e&&!t.containsEsc},p.isContextualWithState=function(t,e){return e.type===M.name&&e.value===t&&!e.containsEsc},p.tsIsStartOfMappedType=function(){return this.next(),this.eat(M.plusMin)?this.ts_isContextual(B.readonly):(this.ts_isContextual(B.readonly)&&this.next(),!!this.match(M.bracketL)&&(this.next(),!!this.tsIsIdentifier()&&(this.next(),this.match(M._in))))},p.tsInDisallowConditionalTypesContext=function(t){var e=this.inDisallowConditionalTypesContext;this.inDisallowConditionalTypesContext=!0;try{return t()}finally{this.inDisallowConditionalTypesContext=e}},p.tsTryParseType=function(){return this.tsEatThenParseType(M.colon)},p.match=function(t){return this.type===t},p.matchJsx=function(t){return this.type===N.tokTypes[t]},p.ts_eatWithState=function(t,e,s){if(t===s.type){for(var i=0;i<e;i++)this.next();return!0}return!1},p.ts_eatContextualWithState=function(t,e,s){if(q.test(t)){if(this.ts_isContextualWithState(s,B[t])){for(var i=0;i<e;i++)this.next();return!0}return!1}if(!this.isContextualWithState(t,s))return!1;for(var r=0;r<e;r++)this.next();return!0},p.canHaveLeadingDecorator=function(){return this.match(M._class)},p.eatContextual=function(e){return q.test(e)?!!this.ts_isContextual(B[e])&&(this.next(),!0):t.prototype.eatContextual.call(this,e)},p.tsIsExternalModuleReference=function(){return this.isContextual("require")&&40===this.lookaheadCharCode()},p.tsParseExternalModuleReference=function(){var t=this.startNode();return this.expectContextual("require"),this.expect(M.parenL),this.match(M.string)||this.unexpected(),t.expression=this.parseExprAtom(),this.expect(M.parenR),this.finishNode(t,"TSExternalModuleReference")},p.tsParseEntityName=function(t){void 0===t&&(t=!0);for(var e=this.parseIdent(t);this.eat(M.dot);){var s=this.startNodeAtNode(e);s.left=e,s.right=this.parseIdent(t),e=this.finishNode(s,"TSQualifiedName")}return e},p.tsParseEnumMember=function(){var t=this.startNode();return t.id=this.match(M.string)?this.parseLiteral(this.value):this.parseIdent(!0),this.eat(M.eq)&&(t.initializer=this.parseMaybeAssign()),this.finishNode(t,"TSEnumMember")},p.tsParseEnumDeclaration=function(t,e){return void 0===e&&(e={}),e.const&&(t.const=!0),e.declare&&(t.declare=!0),this.expectContextual("enum"),t.id=this.parseIdent(),this.checkLValSimple(t.id),this.expect(M.braceL),t.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this)),this.expect(M.braceR),this.finishNode(t,"TSEnumDeclaration")},p.tsParseModuleBlock=function(){var e=this.startNode();for(t.prototype.enterScope.call(this,512),this.expect(M.braceL),e.body=[];this.type!==M.braceR;){var s=this.parseStatement(null,!0);e.body.push(s)}return this.next(),t.prototype.exitScope.call(this),this.finishNode(e,"TSModuleBlock")},p.tsParseAmbientExternalModuleDeclaration=function(e){return this.ts_isContextual(B.global)?(e.global=!0,e.id=this.parseIdent()):this.match(M.string)?e.id=this.parseLiteral(this.value):this.unexpected(),this.match(M.braceL)?(t.prototype.enterScope.call(this,u),e.body=this.tsParseModuleBlock(),t.prototype.exitScope.call(this)):t.prototype.semicolon.call(this),this.finishNode(e,"TSModuleDeclaration")},p.tsTryParseDeclare=function(t){var e=this;if(!this.isLineTerminator()){var s,i=this.type;return this.isContextual("let")&&(i=M._var,s="let"),this.tsInAmbientContext(function(){if(i===M._function)return t.declare=!0,e.parseFunctionStatement(t,!1,!0);if(i===M._class)return t.declare=!0,e.parseClass(t,!0);if(i===B.enum)return e.tsParseEnumDeclaration(t,{declare:!0});if(i===B.global)return e.tsParseAmbientExternalModuleDeclaration(t);if(i===M._const||i===M._var)return e.match(M._const)&&e.isLookaheadContextual("enum")?(e.expect(M._const),e.tsParseEnumDeclaration(t,{const:!0,declare:!0})):(t.declare=!0,e.parseVarStatement(t,s||e.value,!0));if(i===B.interface){var r=e.tsParseInterfaceDeclaration(t,{declare:!0});if(r)return r}return z(i)?e.tsParseDeclaration(t,e.value,!0):void 0})}},p.tsIsListTerminator=function(t){switch(t){case"EnumMembers":case"TypeMembers":return this.match(M.braceR);case"HeritageClauseElement":return this.match(M.braceL);case"TupleElementTypes":return this.match(M.bracketR);case"TypeParametersOrArguments":return this.tsMatchRightRelational()}},p.tsParseDelimitedListWorker=function(t,e,s,i){for(var r=[],a=-1;!this.tsIsListTerminator(t);){a=-1;var n=e();if(null==n)return;if(r.push(n),!this.eat(M.comma)){if(this.tsIsListTerminator(t))break;return void(s&&this.expect(M.comma))}a=this.lastTokStart}return i&&(i.value=a),r},p.tsParseDelimitedList=function(t,e,s){return function(t){if(null==t)throw new Error("Unexpected "+t+" value.");return t}(this.tsParseDelimitedListWorker(t,e,!0,s))},p.tsParseBracketedList=function(t,e,s,i,r){i||this.expect(s?M.bracketL:M.relational);var a=this.tsParseDelimitedList(t,e,r);return this.expect(s?M.bracketR:M.relational),a},p.tsParseTypeParameterName=function(){return this.parseIdent().name},p.tsEatThenParseType=function(t){return this.match(t)?this.tsNextThenParseType():void 0},p.tsExpectThenParseType=function(t){var e=this;return this.tsDoThenParseType(function(){return e.expect(t)})},p.tsNextThenParseType=function(){var t=this;return this.tsDoThenParseType(function(){return t.next()})},p.tsDoThenParseType=function(t){var e=this;return this.tsInType(function(){return t(),e.tsParseType()})},p.tsSkipParameterStart=function(){if(z(this.type)||this.match(M._this))return this.next(),!0;if(this.match(M.braceL))try{return this.parseObj(!0),!0}catch(t){return!1}if(this.match(M.bracketL)){this.next();try{return this.parseBindingList(M.bracketR,!0,!0),!0}catch(t){return!1}}return!1},p.tsIsUnambiguouslyStartOfFunctionType=function(){if(this.next(),this.match(M.parenR)||this.match(M.ellipsis))return!0;if(this.tsSkipParameterStart()){if(this.match(M.colon)||this.match(M.comma)||this.match(M.question)||this.match(M.eq))return!0;if(this.match(M.parenR)&&(this.next(),this.match(M.arrow)))return!0}return!1},p.tsIsStartOfFunctionType=function(){return!!this.tsMatchLeftRelational()||this.match(M.parenL)&&this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this))},p.tsInAllowConditionalTypesContext=function(t){var e=this.inDisallowConditionalTypesContext;this.inDisallowConditionalTypesContext=!1;try{return t()}finally{this.inDisallowConditionalTypesContext=e}},p.tsParseBindingListForSignature=function(){var e=this;return t.prototype.parseBindingList.call(this,M.parenR,!0,!0).map(function(t){return"Identifier"!==t.type&&"RestElement"!==t.type&&"ObjectPattern"!==t.type&&"ArrayPattern"!==t.type&&e.raise(t.start,T.UnsupportedSignatureParameterKind(t.type)),t})},p.tsParseTypePredicateAsserts=function(){if(this.type!==B.asserts)return!1;var t=this.containsEsc;return this.next(),!(!z(this.type)&&!this.match(M._this)||(t&&this.raise(this.lastTokStart,"Escape sequence in keyword asserts"),0))},p.tsParseThisTypeNode=function(){var t=this.startNode();return this.next(),this.finishNode(t,"TSThisType")},p.tsParseTypeAnnotation=function(t,e){var s=this;return void 0===t&&(t=!0),void 0===e&&(e=this.startNode()),this.tsInType(function(){t&&s.expect(M.colon),e.typeAnnotation=s.tsParseType()}),this.finishNode(e,"TSTypeAnnotation")},p.tsParseThisTypePredicate=function(t){this.next();var e=this.startNodeAtNode(t);return e.parameterName=t,e.typeAnnotation=this.tsParseTypeAnnotation(!1),e.asserts=!1,this.finishNode(e,"TSTypePredicate")},p.tsParseThisTypeOrThisTypePredicate=function(){var t=this.tsParseThisTypeNode();return this.isContextual("is")&&!this.hasPrecedingLineBreak()?this.tsParseThisTypePredicate(t):t},p.tsParseTypePredicatePrefix=function(){var t=this.parseIdent();if(this.isContextual("is")&&!this.hasPrecedingLineBreak())return this.next(),t},p.tsParseTypeOrTypePredicateAnnotation=function(t){var e=this;return this.tsInType(function(){var s=e.startNode();e.expect(t);var i=e.startNode(),r=!!e.tsTryParse(e.tsParseTypePredicateAsserts.bind(e));if(r&&e.match(M._this)){var a=e.tsParseThisTypeOrThisTypePredicate();return"TSThisType"===a.type?(i.parameterName=a,i.asserts=!0,i.typeAnnotation=null,a=e.finishNode(i,"TSTypePredicate")):(e.resetStartLocationFromNode(a,i),a.asserts=!0),s.typeAnnotation=a,e.finishNode(s,"TSTypeAnnotation")}var n=e.tsIsIdentifier()&&e.tsTryParse(e.tsParseTypePredicatePrefix.bind(e));if(!n)return r?(i.parameterName=e.parseIdent(),i.asserts=r,i.typeAnnotation=null,s.typeAnnotation=e.finishNode(i,"TSTypePredicate"),e.finishNode(s,"TSTypeAnnotation")):e.tsParseTypeAnnotation(!1,s);var o=e.tsParseTypeAnnotation(!1);return i.parameterName=n,i.typeAnnotation=o,i.asserts=r,s.typeAnnotation=e.finishNode(i,"TSTypePredicate"),e.finishNode(s,"TSTypeAnnotation")})},p.tsFillSignature=function(t,e){var s=t===M.arrow;e.typeParameters=this.tsTryParseTypeParameters(),this.expect(M.parenL),e.parameters=this.tsParseBindingListForSignature(),(s||this.match(t))&&(e.typeAnnotation=this.tsParseTypeOrTypePredicateAnnotation(t))},p.tsTryNextParseConstantContext=function(){if(this.lookahead().type!==M._const)return null;this.next();var t=this.tsParseTypeReference();return t.typeParameters&&this.raise(t.typeName.start,T.CannotFindName({name:"const"})),t},p.tsParseFunctionOrConstructorType=function(t,e){var s=this,i=this.startNode();return"TSConstructorType"===t&&(i.abstract=!!e,e&&this.next(),this.next()),this.tsInAllowConditionalTypesContext(function(){return s.tsFillSignature(M.arrow,i)}),this.finishNode(i,t)},p.tsParseUnionOrIntersectionType=function(t,e,s){var i=this.startNode(),r=this.eat(s),a=[];do{a.push(e())}while(this.eat(s));return 1!==a.length||r?(i.types=a,this.finishNode(i,t)):a[0]},p.tsCheckTypeAnnotationForReadOnly=function(t){switch(t.typeAnnotation.type){case"TSTupleType":case"TSArrayType":return;default:this.raise(t.start,T.UnexpectedReadonly)}},p.tsParseTypeOperator=function(){var t=this.startNode(),e=this.value;return this.next(),t.operator=e,t.typeAnnotation=this.tsParseTypeOperatorOrHigher(),"readonly"===e&&this.tsCheckTypeAnnotationForReadOnly(t),this.finishNode(t,"TSTypeOperator")},p.tsParseConstraintForInferType=function(){var t=this;if(this.eat(M._extends)){var e=this.tsInDisallowConditionalTypesContext(function(){return t.tsParseType()});if(this.inDisallowConditionalTypesContext||!this.match(M.question))return e}},p.tsParseInferType=function(){var t=this,e=this.startNode();this.expectContextual("infer");var s=this.startNode();return s.name=this.tsParseTypeParameterName(),s.constraint=this.tsTryParse(function(){return t.tsParseConstraintForInferType()}),e.typeParameter=this.finishNode(s,"TSTypeParameter"),this.finishNode(e,"TSInferType")},p.tsParseLiteralTypeNode=function(){var t=this,e=this.startNode();return e.literal=function(){switch(t.type){case M.num:case M.string:case M._true:case M._false:return t.parseExprAtom();default:t.unexpected()}}(),this.finishNode(e,"TSLiteralType")},p.tsParseImportType=function(){var t=this.startNode();return this.expect(M._import),this.expect(M.parenL),this.match(M.string)||this.raise(this.start,T.UnsupportedImportTypeArgument),t.argument=this.parseExprAtom(),this.expect(M.parenR),this.eat(M.dot)&&(t.qualifier=this.tsParseEntityName()),this.tsMatchLeftRelational()&&(t.typeParameters=this.tsParseTypeArguments()),this.finishNode(t,"TSImportType")},p.tsParseTypeQuery=function(){var t=this.startNode();return this.expect(M._typeof),t.exprName=this.match(M._import)?this.tsParseImportType():this.tsParseEntityName(),!this.hasPrecedingLineBreak()&&this.tsMatchLeftRelational()&&(t.typeParameters=this.tsParseTypeArguments()),this.finishNode(t,"TSTypeQuery")},p.tsParseMappedTypeParameter=function(){var t=this.startNode();return t.name=this.tsParseTypeParameterName(),t.constraint=this.tsExpectThenParseType(M._in),this.finishNode(t,"TSTypeParameter")},p.tsParseMappedType=function(){var t=this.startNode();return this.expect(M.braceL),this.match(M.plusMin)?(t.readonly=this.value,this.next(),this.expectContextual("readonly")):this.eatContextual("readonly")&&(t.readonly=!0),this.expect(M.bracketL),t.typeParameter=this.tsParseMappedTypeParameter(),t.nameType=this.eatContextual("as")?this.tsParseType():null,this.expect(M.bracketR),this.match(M.plusMin)?(t.optional=this.value,this.next(),this.expect(M.question)):this.eat(M.question)&&(t.optional=!0),t.typeAnnotation=this.tsTryParseType(),this.semicolon(),this.expect(M.braceR),this.finishNode(t,"TSMappedType")},p.tsParseTypeLiteral=function(){var t=this.startNode();return t.members=this.tsParseObjectTypeMembers(),this.finishNode(t,"TSTypeLiteral")},p.tsParseTupleElementType=function(){var t=this.startLoc,e=this.start,s=this.eat(M.ellipsis),i=this.tsParseType(),r=this.eat(M.question);if(this.eat(M.colon)){var a=this.startNodeAtNode(i);a.optional=r,"TSTypeReference"!==i.type||i.typeParameters||"Identifier"!==i.typeName.type?(this.raise(i.start,T.InvalidTupleMemberLabel),a.label=i):a.label=i.typeName,a.elementType=this.tsParseType(),i=this.finishNode(a,"TSNamedTupleMember")}else if(r){var n=this.startNodeAtNode(i);n.typeAnnotation=i,i=this.finishNode(n,"TSOptionalType")}if(s){var o=this.startNodeAt(e,t);o.typeAnnotation=i,i=this.finishNode(o,"TSRestType")}return i},p.tsParseTupleType=function(){var t=this,e=this.startNode();e.elementTypes=this.tsParseBracketedList("TupleElementTypes",this.tsParseTupleElementType.bind(this),!0,!1);var s=!1,i=null;return e.elementTypes.forEach(function(e){var r=e.type;!s||"TSRestType"===r||"TSOptionalType"===r||"TSNamedTupleMember"===r&&e.optional||t.raise(e.start,T.OptionalTypeBeforeRequired),s||(s="TSNamedTupleMember"===r&&e.optional||"TSOptionalType"===r);var a=r;"TSRestType"===r&&(a=(e=e.typeAnnotation).type);var n="TSNamedTupleMember"===a;null!=i||(i=n),i!==n&&t.raise(e.start,T.MixedLabeledAndUnlabeledElements)}),this.finishNode(e,"TSTupleType")},p.tsParseTemplateLiteralType=function(){var t=this.startNode();return t.literal=this.parseTemplate({isTagged:!1}),this.finishNode(t,"TSLiteralType")},p.tsParseTypeReference=function(){var t=this.startNode();return t.typeName=this.tsParseEntityName(),!this.hasPrecedingLineBreak()&&this.tsMatchLeftRelational()&&(t.typeParameters=this.tsParseTypeArguments()),this.finishNode(t,"TSTypeReference")},p.tsMatchLeftRelational=function(){return this.match(M.relational)&&"<"===this.value},p.tsMatchRightRelational=function(){return this.match(M.relational)&&">"===this.value},p.tsParseParenthesizedType=function(){var t=this.startNode();return this.expect(M.parenL),t.typeAnnotation=this.tsParseType(),this.expect(M.parenR),this.finishNode(t,"TSParenthesizedType")},p.tsParseNonArrayType=function(){switch(this.type){case M.string:case M.num:case M._true:case M._false:return this.tsParseLiteralTypeNode();case M.plusMin:if("-"===this.value){var t=this.startNode();return this.lookahead().type!==M.num&&this.unexpected(),t.literal=this.parseMaybeUnary(),this.finishNode(t,"TSLiteralType")}break;case M._this:return this.tsParseThisTypeOrThisTypePredicate();case M._typeof:return this.tsParseTypeQuery();case M._import:return this.tsParseImportType();case M.braceL:return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this))?this.tsParseMappedType():this.tsParseTypeLiteral();case M.bracketL:return this.tsParseTupleType();case M.parenL:return this.tsParseParenthesizedType();case M.backQuote:case M.dollarBraceL:return this.tsParseTemplateLiteralType();default:var e=this.type;if(z(e)||e===M._void||e===M._null){var s=e===M._void?"TSVoidKeyword":e===M._null?"TSNullKeyword":function(t){switch(t){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}}(this.value);if(void 0!==s&&46!==this.lookaheadCharCode()){var i=this.startNode();return this.next(),this.finishNode(i,s)}return this.tsParseTypeReference()}}this.unexpected()},p.tsParseArrayTypeOrHigher=function(){for(var t=this.tsParseNonArrayType();!this.hasPrecedingLineBreak()&&this.eat(M.bracketL);)if(this.match(M.bracketR)){var e=this.startNodeAtNode(t);e.elementType=t,this.expect(M.bracketR),t=this.finishNode(e,"TSArrayType")}else{var s=this.startNodeAtNode(t);s.objectType=t,s.indexType=this.tsParseType(),this.expect(M.bracketR),t=this.finishNode(s,"TSIndexedAccessType")}return t},p.tsParseTypeOperatorOrHigher=function(){var t=this;return X(this.type)&&!this.containsEsc?this.tsParseTypeOperator():this.isContextual("infer")?this.tsParseInferType():this.tsInAllowConditionalTypesContext(function(){return t.tsParseArrayTypeOrHigher()})},p.tsParseIntersectionTypeOrHigher=function(){return this.tsParseUnionOrIntersectionType("TSIntersectionType",this.tsParseTypeOperatorOrHigher.bind(this),M.bitwiseAND)},p.tsParseUnionTypeOrHigher=function(){return this.tsParseUnionOrIntersectionType("TSUnionType",this.tsParseIntersectionTypeOrHigher.bind(this),M.bitwiseOR)},p.tsParseNonConditionalType=function(){return this.tsIsStartOfFunctionType()?this.tsParseFunctionOrConstructorType("TSFunctionType"):this.match(M._new)?this.tsParseFunctionOrConstructorType("TSConstructorType"):this.isAbstractConstructorSignature()?this.tsParseFunctionOrConstructorType("TSConstructorType",!0):this.tsParseUnionTypeOrHigher()},p.tsParseType=function(){var t=this;S(this.inType);var e=this.tsParseNonConditionalType();if(this.i