@knapsack/app
Version:
Build Design Systems on top of knapsack, by Basalt
2 lines • 219 kB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([["vendors~custom-page-KXWAf~pattern-view-page-WE7TE~05943200"],{"../node_modules/@babel/parser/lib/index.js":function(t,e,s){Object.defineProperty(e,"__esModule",{value:!0});const i=!0;class TokenType{constructor(t,e={}){this.label=t,this.keyword=e.keyword,this.beforeExpr=!!e.beforeExpr,this.startsExpr=!!e.startsExpr,this.rightAssociative=!!e.rightAssociative,this.isLoop=!!e.isLoop,this.isAssign=!!e.isAssign,this.prefix=!!e.prefix,this.postfix=!!e.postfix,this.binop=null!=e.binop?e.binop:null,this.updateContext=null}}const r=new Map;function createKeyword(t,e={}){e.keyword=t;const s=new TokenType(t,e);return r.set(t,s),s}function createBinop(t,e){return new TokenType(t,{beforeExpr:i,binop:e})}const a={num:new TokenType("num",{startsExpr:!0}),bigint:new TokenType("bigint",{startsExpr:!0}),regexp:new TokenType("regexp",{startsExpr:!0}),string:new TokenType("string",{startsExpr:!0}),name:new TokenType("name",{startsExpr:!0}),eof:new TokenType("eof"),bracketL:new TokenType("[",{beforeExpr:i,startsExpr:!0}),bracketR:new TokenType("]"),braceL:new TokenType("{",{beforeExpr:i,startsExpr:!0}),braceBarL:new TokenType("{|",{beforeExpr:i,startsExpr:!0}),braceR:new TokenType("}"),braceBarR:new TokenType("|}"),parenL:new TokenType("(",{beforeExpr:i,startsExpr:!0}),parenR:new TokenType(")"),comma:new TokenType(",",{beforeExpr:i}),semi:new TokenType(";",{beforeExpr:i}),colon:new TokenType(":",{beforeExpr:i}),doubleColon:new TokenType("::",{beforeExpr:i}),dot:new TokenType("."),question:new TokenType("?",{beforeExpr:i}),questionDot:new TokenType("?."),arrow:new TokenType("=>",{beforeExpr:i}),template:new TokenType("template"),ellipsis:new TokenType("...",{beforeExpr:i}),backQuote:new TokenType("`",{startsExpr:!0}),dollarBraceL:new TokenType("${",{beforeExpr:i,startsExpr:!0}),at:new TokenType("@"),hash:new TokenType("#",{startsExpr:!0}),interpreterDirective:new TokenType("#!..."),eq:new TokenType("=",{beforeExpr:i,isAssign:!0}),assign:new TokenType("_=",{beforeExpr:i,isAssign:!0}),incDec:new TokenType("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),bang:new TokenType("!",{beforeExpr:i,prefix:!0,startsExpr:!0}),tilde:new TokenType("~",{beforeExpr:i,prefix:!0,startsExpr:!0}),pipeline:createBinop("|>",0),nullishCoalescing:createBinop("??",1),logicalOR:createBinop("||",2),logicalAND:createBinop("&&",3),bitwiseOR:createBinop("|",4),bitwiseXOR:createBinop("^",5),bitwiseAND:createBinop("&",6),equality:createBinop("==/!=/===/!==",7),relational:createBinop("</>/<=/>=",8),bitShift:createBinop("<</>>/>>>",9),plusMin:new TokenType("+/-",{beforeExpr:i,binop:10,prefix:!0,startsExpr:!0}),modulo:new TokenType("%",{beforeExpr:i,binop:11,startsExpr:!0}),star:createBinop("*",11),slash:createBinop("/",11),exponent:new TokenType("**",{beforeExpr:i,binop:12,rightAssociative:!0}),_break:createKeyword("break"),_case:createKeyword("case",{beforeExpr:i}),_catch:createKeyword("catch"),_continue:createKeyword("continue"),_debugger:createKeyword("debugger"),_default:createKeyword("default",{beforeExpr:i}),_do:createKeyword("do",{isLoop:!0,beforeExpr:i}),_else:createKeyword("else",{beforeExpr:i}),_finally:createKeyword("finally"),_for:createKeyword("for",{isLoop:!0}),_function:createKeyword("function",{startsExpr:!0}),_if:createKeyword("if"),_return:createKeyword("return",{beforeExpr:i}),_switch:createKeyword("switch"),_throw:createKeyword("throw",{beforeExpr:i,prefix:!0,startsExpr:!0}),_try:createKeyword("try"),_var:createKeyword("var"),_const:createKeyword("const"),_while:createKeyword("while",{isLoop:!0}),_with:createKeyword("with"),_new:createKeyword("new",{beforeExpr:i,startsExpr:!0}),_this:createKeyword("this",{startsExpr:!0}),_super:createKeyword("super",{startsExpr:!0}),_class:createKeyword("class",{startsExpr:!0}),_extends:createKeyword("extends",{beforeExpr:i}),_export:createKeyword("export"),_import:createKeyword("import",{startsExpr:!0}),_null:createKeyword("null",{startsExpr:!0}),_true:createKeyword("true",{startsExpr:!0}),_false:createKeyword("false",{startsExpr:!0}),_in:createKeyword("in",{beforeExpr:i,binop:8}),_instanceof:createKeyword("instanceof",{beforeExpr:i,binop:8}),_typeof:createKeyword("typeof",{beforeExpr:i,prefix:!0,startsExpr:!0}),_void:createKeyword("void",{beforeExpr:i,prefix:!0,startsExpr:!0}),_delete:createKeyword("delete",{beforeExpr:i,prefix:!0,startsExpr:!0})},n=0,o=1,h=2,p=4,c=8,l=16,u=32,d=64,m=128,f=256,y=o|h|512;function functionFlags(t,e){return h|(t?p:0)|(e?c:0)}const x=1,P=2,g=4,b=8,T=16,w=128,A=256,E=512,k=1024,C=x|P|b|w,N=0|x|b|0,S=0|x|g|0,v=0|x|T|0,I=0|P|w,L=0|P,M=x|P|b|A,D=0|k,O=64,R=64|x,_=M|E,F=0|k;function isSimpleProperty(t){return null!=t&&"Property"===t.type&&"init"===t.kind&&!1===t.method}const B=/\r\n?|[\n\u2028\u2029]/,j=new RegExp(B.source,"g");function isNewLine(t){switch(t){case 10:case 13:case 8232:case 8233:return!0;default:return!1}}const q=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;function isWhitespace(t){switch(t){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}}class TokContext{constructor(t,e,s,i){this.token=t,this.isExpr=!!e,this.preserveSpace=!!s,this.override=i}}const U={braceStatement:new TokContext("{",!1),braceExpression:new TokContext("{",!0),templateQuasi:new TokContext("${",!1),parenStatement:new TokContext("(",!1),parenExpression:new TokContext("(",!0),template:new TokContext("`",!0,!0,t=>t.readTmplToken()),functionExpression:new TokContext("function",!0),functionStatement:new TokContext("function",!1)};a.parenR.updateContext=a.braceR.updateContext=function(){if(1===this.state.context.length)return void(this.state.exprAllowed=!0);let t=this.state.context.pop();t===U.braceStatement&&"function"===this.curContext().token&&(t=this.state.context.pop()),this.state.exprAllowed=!t.isExpr},a.name.updateContext=function(t){let e=!1;t!==a.dot&&("of"===this.state.value&&!this.state.exprAllowed||"yield"===this.state.value&&this.scope.inGenerator)&&(e=!0),this.state.exprAllowed=e,this.state.isIterator&&(this.state.isIterator=!1)},a.braceL.updateContext=function(t){this.state.context.push(this.braceIsBlock(t)?U.braceStatement:U.braceExpression),this.state.exprAllowed=!0},a.dollarBraceL.updateContext=function(){this.state.context.push(U.templateQuasi),this.state.exprAllowed=!0},a.parenL.updateContext=function(t){const e=t===a._if||t===a._for||t===a._with||t===a._while;this.state.context.push(e?U.parenStatement:U.parenExpression),this.state.exprAllowed=!0},a.incDec.updateContext=function(){},a._function.updateContext=a._class.updateContext=function(t){!t.beforeExpr||t===a.semi||t===a._else||t===a._return&&B.test(this.input.slice(this.state.lastTokEnd,this.state.start))||(t===a.colon||t===a.braceL)&&this.curContext()===U.b_stat?this.state.context.push(U.functionStatement):this.state.context.push(U.functionExpression),this.state.exprAllowed=!1},a.backQuote.updateContext=function(){this.curContext()===U.template?this.state.context.pop():this.state.context.push(U.template),this.state.exprAllowed=!1};const V=["eval","arguments"],K=new Set(["implements","interface","let","package","private","protected","public","static","yield"]),z=new Set(V),isReservedWord=(t,e)=>e&&"await"===t||"enum"===t;function isStrictReservedWord(t,e){return isReservedWord(t,e)||K.has(t)}function isStrictBindOnlyReservedWord(t){return z.has(t)}function isStrictBindReservedWord(t,e){return isStrictReservedWord(t,e)||isStrictBindOnlyReservedWord(t)}const $=/^in(stanceof)?$/;let W="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࢽऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿯ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-Ᶎꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭧꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",X="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_";const J=new RegExp("["+W+"]"),H=new RegExp("["+W+X+"]");W=X=null;const Q=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,477,28,11,0,9,21,155,22,13,52,76,44,33,24,27,35,30,0,12,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,0,33,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,0,161,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,270,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,754,9486,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,15,7472,3104,541],G=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,525,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,4,9,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,232,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,792487,239];function isInAstralSet(t,e){let s=65536;for(let i=0,r=e.length;i<r;i+=2){if((s+=e[i])>t)return!1;if((s+=e[i+1])>=t)return!0}return!1}function isIdentifierStart(t){return t<65?36===t:t<=90||(t<97?95===t:t<=122||(t<=65535?t>=170&&J.test(String.fromCharCode(t)):isInAstralSet(t,Q)))}function isIdentifierChar(t){return t<48?36===t:t<58||!(t<65)&&(t<=90||(t<97?95===t:t<=122||(t<=65535?t>=170&&H.test(String.fromCharCode(t)):isInAstralSet(t,Q)||isInAstralSet(t,G))))}const Y=new Set(["_","any","bool","boolean","empty","extends","false","interface","mixed","null","number","static","string","true","typeof","void"]);function hasTypeImportKind(t){return"type"===t.importKind||"typeof"===t.importKind}function isMaybeDefaultImport(t){return(t.type===a.name||!!t.type.keyword)&&"from"!==t.value}const Z={const:"declare export var",let:"declare export var",type:"export type",interface:"export interface"};const tt=/\*?\s*@((?:no)?flow)\b/;const et={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:"♦"},st=/^[\da-fA-F]+$/,it=/^\d+$/;function isFragment(t){return!!t&&("JSXOpeningFragment"===t.type||"JSXClosingFragment"===t.type)}function getQualifiedJSXName(t){if("JSXIdentifier"===t.type)return t.name;if("JSXNamespacedName"===t.type)return t.namespace.name+":"+t.name.name;if("JSXMemberExpression"===t.type)return getQualifiedJSXName(t.object)+"."+getQualifiedJSXName(t.property);throw new Error("Node had unexpected type: "+t.type)}U.j_oTag=new TokContext("<tag",!1),U.j_cTag=new TokContext("</tag",!1),U.j_expr=new TokContext("<tag>...</tag>",!0,!0),a.jsxName=new TokenType("jsxName"),a.jsxText=new TokenType("jsxText",{beforeExpr:!0}),a.jsxTagStart=new TokenType("jsxTagStart",{startsExpr:!0}),a.jsxTagEnd=new TokenType("jsxTagEnd"),a.jsxTagStart.updateContext=function(){this.state.context.push(U.j_expr),this.state.context.push(U.j_oTag),this.state.exprAllowed=!1},a.jsxTagEnd.updateContext=function(t){const e=this.state.context.pop();e===U.j_oTag&&t===a.slash||e===U.j_cTag?(this.state.context.pop(),this.state.exprAllowed=this.curContext()===U.j_expr):this.state.exprAllowed=!0};class Scope{constructor(t){this.var=[],this.lexical=[],this.functions=[],this.flags=t}}class ScopeHandler{constructor(t,e){this.scopeStack=[],this.undefinedExports=new Map,this.raise=t,this.inModule=e}get inFunction(){return(this.currentVarScope().flags&h)>0}get inGenerator(){return(this.currentVarScope().flags&c)>0}get inAsync(){return(this.currentVarScope().flags&p)>0}get allowSuper(){return(this.currentThisScope().flags&d)>0}get allowDirectSuper(){return(this.currentThisScope().flags&m)>0}get inNonArrowFunction(){return(this.currentThisScope().flags&h)>0}get treatFunctionsAsVar(){return this.treatFunctionsAsVarInScope(this.currentScope())}createScope(t){return new Scope(t)}enter(t){this.scopeStack.push(this.createScope(t))}exit(){this.scopeStack.pop()}treatFunctionsAsVarInScope(t){return!!(t.flags&h||!this.inModule&&t.flags&o)}declareName(t,e,s){let i=this.currentScope();if(e&b||e&T)this.checkRedeclarationInScope(i,t,e,s),e&T?i.functions.push(t):i.lexical.push(t),e&b&&this.maybeExportDefined(i,t);else if(e&g)for(let r=this.scopeStack.length-1;r>=0&&(i=this.scopeStack[r],this.checkRedeclarationInScope(i,t,e,s),i.var.push(t),this.maybeExportDefined(i,t),!(i.flags&y));--r);this.inModule&&i.flags&o&&this.undefinedExports.delete(t)}maybeExportDefined(t,e){this.inModule&&t.flags&o&&this.undefinedExports.delete(e)}checkRedeclarationInScope(t,e,s,i){this.isRedeclaredInScope(t,e,s)&&this.raise(i,`Identifier '${e}' has already been declared`)}isRedeclaredInScope(t,e,s){return!!(s&x)&&(s&b?t.lexical.indexOf(e)>-1||t.functions.indexOf(e)>-1||t.var.indexOf(e)>-1:s&T?t.lexical.indexOf(e)>-1||!this.treatFunctionsAsVarInScope(t)&&t.var.indexOf(e)>-1:t.lexical.indexOf(e)>-1&&!(t.flags&u&&t.lexical[0]===e)||!this.treatFunctionsAsVarInScope(t)&&t.functions.indexOf(e)>-1)}checkLocalExport(t){-1===this.scopeStack[0].lexical.indexOf(t.name)&&-1===this.scopeStack[0].var.indexOf(t.name)&&-1===this.scopeStack[0].functions.indexOf(t.name)&&this.undefinedExports.set(t.name,t.start)}currentScope(){return this.scopeStack[this.scopeStack.length-1]}currentVarScope(){for(let t=this.scopeStack.length-1;;t--){const e=this.scopeStack[t];if(e.flags&y)return e}}currentThisScope(){for(let t=this.scopeStack.length-1;;t--){const e=this.scopeStack[t];if((e.flags&y||e.flags&f)&&!(e.flags&l))return e}}}class TypeScriptScope extends Scope{constructor(...t){super(...t),this.types=[],this.enums=[],this.constEnums=[],this.classes=[],this.exportOnlyBindings=[]}}class TypeScriptScopeHandler extends ScopeHandler{createScope(t){return new TypeScriptScope(t)}declareName(t,e,s){const i=this.currentScope();if(e&k)return this.maybeExportDefined(i,t),void i.exportOnlyBindings.push(t);super.declareName(...arguments),e&P&&(e&x||(this.checkRedeclarationInScope(i,t,e,s),this.maybeExportDefined(i,t)),i.types.push(t)),e&A&&i.enums.push(t),e&E&&i.constEnums.push(t),e&w&&i.classes.push(t)}isRedeclaredInScope(t,e,s){if(t.enums.indexOf(e)>-1){if(s&A){return!!(s&E)!==t.constEnums.indexOf(e)>-1}return!0}return s&w&&t.classes.indexOf(e)>-1?t.lexical.indexOf(e)>-1&&!!(s&x):!!(s&P&&t.types.indexOf(e)>-1)||super.isRedeclaredInScope(...arguments)}checkLocalExport(t){-1===this.scopeStack[0].types.indexOf(t.name)&&-1===this.scopeStack[0].exportOnlyBindings.indexOf(t.name)&&super.checkLocalExport(t)}}function nonNull(t){if(null==t)throw new Error(`Unexpected ${t} value.`);return t}function assert(t){if(!t)throw new Error("Assert fail")}a.placeholder=new TokenType("%%",{startsExpr:!0});function hasPlugin(t,e){return t.some(t=>Array.isArray(t)?t[0]===e:t===e)}function getPluginOption(t,e,s){const i=t.find(t=>Array.isArray(t)?t[0]===e:t===e);return i&&Array.isArray(i)?i[1][s]:null}const rt=["minimal","smart","fsharp"];const at={estree:t=>(class extends t{estreeParseRegExpLiteral({pattern:t,flags:e}){let s=null;try{s=new RegExp(t,e)}catch(t){}const i=this.estreeParseLiteral(s);return i.regex={pattern:t,flags:e},i}estreeParseLiteral(t){return this.parseLiteral(t,"Literal")}directiveToStmt(t){const e=t.value,s=this.startNodeAt(t.start,t.loc.start),i=this.startNodeAt(e.start,e.loc.start);return i.value=e.value,i.raw=e.extra.raw,s.expression=this.finishNodeAt(i,"Literal",e.end,e.loc.end),s.directive=e.extra.raw.slice(1,-1),this.finishNodeAt(s,"ExpressionStatement",t.end,t.loc.end)}initFunction(t,e){super.initFunction(t,e),t.expression=!1}checkDeclaration(t){isSimpleProperty(t)?this.checkDeclaration(t.value):super.checkDeclaration(t)}checkGetterSetterParams(t){const e=t,s="get"===e.kind?0:1,i=e.start;e.value.params.length!==s?"get"===e.kind?this.raise(i,"getter must not have any formal parameters"):this.raise(i,"setter must have exactly one formal parameter"):"set"===e.kind&&"RestElement"===e.value.params[0].type&&this.raise(i,"setter function argument must not be a rest parameter")}checkLVal(t,e=O,s,i,r){switch(t.type){case"ObjectPattern":t.properties.forEach(t=>{this.checkLVal("Property"===t.type?t.value:t,e,s,"object destructuring pattern",r)});break;default:super.checkLVal(t,e,s,i,r)}}checkDuplicatedProto(t,e){if("SpreadElement"===t.type||t.computed||t.method||t.shorthand)return;const s=t.key;"__proto__"===("Identifier"===s.type?s.name:String(s.value))&&"init"===t.kind&&(e.used&&!e.start&&(e.start=s.start),e.used=!0)}isStrictBody(t){if("BlockStatement"===t.body.type&&t.body.body.length>0)for(let e=0,s=t.body.body;e<s.length;e++){const t=s[e];if("ExpressionStatement"!==t.type||"Literal"!==t.expression.type)break;if("use strict"===t.expression.value)return!0}return!1}isValidDirective(t){return!("ExpressionStatement"!==t.type||"Literal"!==t.expression.type||"string"!=typeof t.expression.value||t.expression.extra&&t.expression.extra.parenthesized)}stmtToDirective(t){const e=super.stmtToDirective(t),s=t.expression.value;return e.value.value=s,e}parseBlockBody(t,e,s,i){super.parseBlockBody(t,e,s,i);const r=t.directives.map(t=>this.directiveToStmt(t));t.body=r.concat(t.body),delete t.directives}pushClassMethod(t,e,s,i,r,a){this.parseMethod(e,s,i,r,a,"ClassMethod",!0),e.typeParameters&&(e.value.typeParameters=e.typeParameters,delete e.typeParameters),t.body.push(e)}parseExprAtom(t){switch(this.state.type){case a.regexp:return this.estreeParseRegExpLiteral(this.state.value);case a.num:case a.string:return this.estreeParseLiteral(this.state.value);case a._null:return this.estreeParseLiteral(null);case a._true:return this.estreeParseLiteral(!0);case a._false:return this.estreeParseLiteral(!1);default:return super.parseExprAtom(t)}}parseLiteral(t,e,s,i){const r=super.parseLiteral(t,e,s,i);return r.raw=r.extra.raw,delete r.extra,r}parseFunctionBody(t,e,s=!1){super.parseFunctionBody(t,e,s),t.expression="BlockStatement"!==t.body.type}parseMethod(t,e,s,i,r,a,n=!1){let o=this.startNode();return o.kind=t.kind,(o=super.parseMethod(o,e,s,i,r,a,n)).type="FunctionExpression",delete o.kind,t.value=o,a="ClassMethod"===a?"MethodDefinition":a,this.finishNode(t,a)}parseObjectMethod(t,e,s,i,r){const a=super.parseObjectMethod(t,e,s,i,r);return a&&(a.type="Property","method"===a.kind&&(a.kind="init"),a.shorthand=!1),a}parseObjectProperty(t,e,s,i,r){const a=super.parseObjectProperty(t,e,s,i,r);return a&&(a.kind="init",a.type="Property"),a}toAssignable(t,e,s){return isSimpleProperty(t)?(this.toAssignable(t.value,e,s),t):super.toAssignable(t,e,s)}toAssignableObjectExpressionProp(t,e,s){if("get"===t.kind||"set"===t.kind)throw this.raise(t.key.start,"Object pattern can't contain getter or setter");if(t.method)throw this.raise(t.key.start,"Object pattern can't contain methods");super.toAssignableObjectExpressionProp(t,e,s)}}),jsx:t=>(class extends t{jsxReadToken(){let t="",e=this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(this.state.start,"Unterminated JSX contents");const s=this.input.charCodeAt(this.state.pos);switch(s){case 60:case 123:return this.state.pos===this.state.start?60===s&&this.state.exprAllowed?(++this.state.pos,this.finishToken(a.jsxTagStart)):super.getTokenFromCode(s):(t+=this.input.slice(e,this.state.pos),this.finishToken(a.jsxText,t));case 38:t+=this.input.slice(e,this.state.pos),t+=this.jsxReadEntity(),e=this.state.pos;break;default:isNewLine(s)?(t+=this.input.slice(e,this.state.pos),t+=this.jsxReadNewLine(!0),e=this.state.pos):++this.state.pos}}}jsxReadNewLine(t){const e=this.input.charCodeAt(this.state.pos);let s;return++this.state.pos,13===e&&10===this.input.charCodeAt(this.state.pos)?(++this.state.pos,s=t?"\n":"\r\n"):s=String.fromCharCode(e),++this.state.curLine,this.state.lineStart=this.state.pos,s}jsxReadString(t){let e="",s=++this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(this.state.start,"Unterminated string constant");const i=this.input.charCodeAt(this.state.pos);if(i===t)break;38===i?(e+=this.input.slice(s,this.state.pos),e+=this.jsxReadEntity(),s=this.state.pos):isNewLine(i)?(e+=this.input.slice(s,this.state.pos),e+=this.jsxReadNewLine(!1),s=this.state.pos):++this.state.pos}return e+=this.input.slice(s,this.state.pos++),this.finishToken(a.string,e)}jsxReadEntity(){let t,e="",s=0,i=this.input[this.state.pos];const r=++this.state.pos;for(;this.state.pos<this.length&&s++<10;){if(";"===(i=this.input[this.state.pos++])){"#"===e[0]?"x"===e[1]?(e=e.substr(2),st.test(e)&&(t=String.fromCodePoint(parseInt(e,16)))):(e=e.substr(1),it.test(e)&&(t=String.fromCodePoint(parseInt(e,10)))):t=et[e];break}e+=i}return t||(this.state.pos=r,"&")}jsxReadWord(){let t;const e=this.state.pos;do{t=this.input.charCodeAt(++this.state.pos)}while(isIdentifierChar(t)||45===t);return this.finishToken(a.jsxName,this.input.slice(e,this.state.pos))}jsxParseIdentifier(){const t=this.startNode();return this.match(a.jsxName)?t.name=this.state.value:this.state.type.keyword?t.name=this.state.type.keyword:this.unexpected(),this.next(),this.finishNode(t,"JSXIdentifier")}jsxParseNamespacedName(){const t=this.state.start,e=this.state.startLoc,s=this.jsxParseIdentifier();if(!this.eat(a.colon))return s;const i=this.startNodeAt(t,e);return i.namespace=s,i.name=this.jsxParseIdentifier(),this.finishNode(i,"JSXNamespacedName")}jsxParseElementName(){const t=this.state.start,e=this.state.startLoc;let s=this.jsxParseNamespacedName();if("JSXNamespacedName"===s.type)return s;for(;this.eat(a.dot);){const i=this.startNodeAt(t,e);i.object=s,i.property=this.jsxParseIdentifier(),s=this.finishNode(i,"JSXMemberExpression")}return s}jsxParseAttributeValue(){let t;switch(this.state.type){case a.braceL:return t=this.startNode(),this.next(),"JSXEmptyExpression"===(t=this.jsxParseExpressionContainer(t)).expression.type&&this.raise(t.start,"JSX attributes must only be assigned a non-empty expression"),t;case a.jsxTagStart:case a.string:return this.parseExprAtom();default:throw this.raise(this.state.start,"JSX value should be either an expression or a quoted JSX text")}}jsxParseEmptyExpression(){const t=this.startNodeAt(this.state.lastTokEnd,this.state.lastTokEndLoc);return this.finishNodeAt(t,"JSXEmptyExpression",this.state.start,this.state.startLoc)}jsxParseSpreadChild(t){return this.next(),t.expression=this.parseExpression(),this.expect(a.braceR),this.finishNode(t,"JSXSpreadChild")}jsxParseExpressionContainer(t){return this.match(a.braceR)?t.expression=this.jsxParseEmptyExpression():t.expression=this.parseExpression(),this.expect(a.braceR),this.finishNode(t,"JSXExpressionContainer")}jsxParseAttribute(){const t=this.startNode();return this.eat(a.braceL)?(this.expect(a.ellipsis),t.argument=this.parseMaybeAssign(),this.expect(a.braceR),this.finishNode(t,"JSXSpreadAttribute")):(t.name=this.jsxParseNamespacedName(),t.value=this.eat(a.eq)?this.jsxParseAttributeValue():null,this.finishNode(t,"JSXAttribute"))}jsxParseOpeningElementAt(t,e){const s=this.startNodeAt(t,e);return this.match(a.jsxTagEnd)?(this.expect(a.jsxTagEnd),this.finishNode(s,"JSXOpeningFragment")):(s.name=this.jsxParseElementName(),this.jsxParseOpeningElementAfterName(s))}jsxParseOpeningElementAfterName(t){const e=[];for(;!this.match(a.slash)&&!this.match(a.jsxTagEnd);)e.push(this.jsxParseAttribute());return t.attributes=e,t.selfClosing=this.eat(a.slash),this.expect(a.jsxTagEnd),this.finishNode(t,"JSXOpeningElement")}jsxParseClosingElementAt(t,e){const s=this.startNodeAt(t,e);return this.match(a.jsxTagEnd)?(this.expect(a.jsxTagEnd),this.finishNode(s,"JSXClosingFragment")):(s.name=this.jsxParseElementName(),this.expect(a.jsxTagEnd),this.finishNode(s,"JSXClosingElement"))}jsxParseElementAt(t,e){const s=this.startNodeAt(t,e),i=[],r=this.jsxParseOpeningElementAt(t,e);let n=null;if(!r.selfClosing){t:for(;;)switch(this.state.type){case a.jsxTagStart:if(t=this.state.start,e=this.state.startLoc,this.next(),this.eat(a.slash)){n=this.jsxParseClosingElementAt(t,e);break t}i.push(this.jsxParseElementAt(t,e));break;case a.jsxText:i.push(this.parseExprAtom());break;case a.braceL:{const t=this.startNode();this.next(),this.match(a.ellipsis)?i.push(this.jsxParseSpreadChild(t)):i.push(this.jsxParseExpressionContainer(t));break}default:throw this.unexpected()}isFragment(r)&&!isFragment(n)?this.raise(n.start,"Expected corresponding JSX closing tag for <>"):!isFragment(r)&&isFragment(n)?this.raise(n.start,"Expected corresponding JSX closing tag for <"+getQualifiedJSXName(r.name)+">"):isFragment(r)||isFragment(n)||getQualifiedJSXName(n.name)!==getQualifiedJSXName(r.name)&&this.raise(n.start,"Expected corresponding JSX closing tag for <"+getQualifiedJSXName(r.name)+">")}if(isFragment(r)?(s.openingFragment=r,s.closingFragment=n):(s.openingElement=r,s.closingElement=n),s.children=i,this.isRelational("<"))throw this.raise(this.state.start,"Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?");return isFragment(r)?this.finishNode(s,"JSXFragment"):this.finishNode(s,"JSXElement")}jsxParseElement(){const t=this.state.start,e=this.state.startLoc;return this.next(),this.jsxParseElementAt(t,e)}parseExprAtom(t){return this.match(a.jsxText)?this.parseLiteral(this.state.value,"JSXText"):this.match(a.jsxTagStart)?this.jsxParseElement():this.isRelational("<")&&33!==this.input.charCodeAt(this.state.pos)?(this.finishToken(a.jsxTagStart),this.jsxParseElement()):super.parseExprAtom(t)}getTokenFromCode(t){if(this.state.inPropertyName)return super.getTokenFromCode(t);const e=this.curContext();if(e===U.j_expr)return this.jsxReadToken();if(e===U.j_oTag||e===U.j_cTag){if(isIdentifierStart(t))return this.jsxReadWord();if(62===t)return++this.state.pos,this.finishToken(a.jsxTagEnd);if((34===t||39===t)&&e===U.j_oTag)return this.jsxReadString(t)}return 60===t&&this.state.exprAllowed&&33!==this.input.charCodeAt(this.state.pos+1)?(++this.state.pos,this.finishToken(a.jsxTagStart)):super.getTokenFromCode(t)}updateContext(t){if(this.match(a.braceL)){const e=this.curContext();e===U.j_oTag?this.state.context.push(U.braceExpression):e===U.j_expr?this.state.context.push(U.templateQuasi):super.updateContext(t),this.state.exprAllowed=!0}else{if(!this.match(a.slash)||t!==a.jsxTagStart)return super.updateContext(t);this.state.context.length-=2,this.state.context.push(U.j_cTag),this.state.exprAllowed=!1}}}),flow:t=>(class extends t{constructor(t,e){super(t,e),this.flowPragma=void 0}shouldParseTypes(){return this.getPluginOption("flow","all")||"flow"===this.flowPragma}shouldParseEnums(){return!!this.getPluginOption("flow","enums")}finishToken(t,e){return t!==a.string&&t!==a.semi&&t!==a.interpreterDirective&&void 0===this.flowPragma&&(this.flowPragma=null),super.finishToken(t,e)}addComment(t){if(void 0===this.flowPragma){const e=tt.exec(t.value);if(e)if("flow"===e[1])this.flowPragma="flow";else{if("noflow"!==e[1])throw new Error("Unexpected flow pragma");this.flowPragma="noflow"}else;}return super.addComment(t)}flowParseTypeInitialiser(t){const e=this.state.inType;this.state.inType=!0,this.expect(t||a.colon);const s=this.flowParseType();return this.state.inType=e,s}flowParsePredicate(){const t=this.startNode(),e=this.state.startLoc,s=this.state.start;this.expect(a.modulo);const i=this.state.startLoc;return this.expectContextual("checks"),e.line===i.line&&e.column===i.column-1||this.raise(s,"Spaces between ´%´ and ´checks´ are not allowed here."),this.eat(a.parenL)?(t.value=this.parseExpression(),this.expect(a.parenR),this.finishNode(t,"DeclaredPredicate")):this.finishNode(t,"InferredPredicate")}flowParseTypeAndPredicateInitialiser(){const t=this.state.inType;this.state.inType=!0,this.expect(a.colon);let e=null,s=null;return this.match(a.modulo)?(this.state.inType=t,s=this.flowParsePredicate()):(e=this.flowParseType(),this.state.inType=t,this.match(a.modulo)&&(s=this.flowParsePredicate())),[e,s]}flowParseDeclareClass(t){return this.next(),this.flowParseInterfaceish(t,!0),this.finishNode(t,"DeclareClass")}flowParseDeclareFunction(t){this.next();const e=t.id=this.parseIdentifier(),s=this.startNode(),i=this.startNode();this.isRelational("<")?s.typeParameters=this.flowParseTypeParameterDeclaration():s.typeParameters=null,this.expect(a.parenL);const r=this.flowParseFunctionTypeParams();return s.params=r.params,s.rest=r.rest,this.expect(a.parenR),[s.returnType,t.predicate]=this.flowParseTypeAndPredicateInitialiser(),i.typeAnnotation=this.finishNode(s,"FunctionTypeAnnotation"),e.typeAnnotation=this.finishNode(i,"TypeAnnotation"),this.resetEndLocation(e),this.semicolon(),this.finishNode(t,"DeclareFunction")}flowParseDeclare(t,e){if(this.match(a._class))return this.flowParseDeclareClass(t);if(this.match(a._function))return this.flowParseDeclareFunction(t);if(this.match(a._var))return this.flowParseDeclareVariable(t);if(this.eatContextual("module"))return this.match(a.dot)?this.flowParseDeclareModuleExports(t):(e&&this.raise(this.state.lastTokStart,"`declare module` cannot be used inside another `declare module`"),this.flowParseDeclareModule(t));if(this.isContextual("type"))return this.flowParseDeclareTypeAlias(t);if(this.isContextual("opaque"))return this.flowParseDeclareOpaqueType(t);if(this.isContextual("interface"))return this.flowParseDeclareInterface(t);if(this.match(a._export))return this.flowParseDeclareExportDeclaration(t,e);throw this.unexpected()}flowParseDeclareVariable(t){return this.next(),t.id=this.flowParseTypeAnnotatableIdentifier(!0),this.scope.declareName(t.id.name,S,t.id.start),this.semicolon(),this.finishNode(t,"DeclareVariable")}flowParseDeclareModule(t){this.scope.enter(n),this.match(a.string)?t.id=this.parseExprAtom():t.id=this.parseIdentifier();const e=t.body=this.startNode(),s=e.body=[];for(this.expect(a.braceL);!this.match(a.braceR);){let t=this.startNode();this.match(a._import)?(this.next(),this.isContextual("type")||this.match(a._typeof)||this.raise(this.state.lastTokStart,"Imports within a `declare module` body must always be `import type` or `import typeof`"),this.parseImport(t)):(this.expectContextual("declare","Only declares and type imports are allowed inside declare module"),t=this.flowParseDeclare(t,!0)),s.push(t)}this.scope.exit(),this.expect(a.braceR),this.finishNode(e,"BlockStatement");let i=null,r=!1;const o="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";return s.forEach(t=>{!function isEsModuleType(t){return"DeclareExportAllDeclaration"===t.type||"DeclareExportDeclaration"===t.type&&(!t.declaration||"TypeAlias"!==t.declaration.type&&"InterfaceDeclaration"!==t.declaration.type)}(t)?"DeclareModuleExports"===t.type&&(r&&this.raise(t.start,"Duplicate `declare module.exports` statement"),"ES"===i&&this.raise(t.start,o),i="CommonJS",r=!0):("CommonJS"===i&&this.raise(t.start,o),i="ES")}),t.kind=i||"CommonJS",this.finishNode(t,"DeclareModule")}flowParseDeclareExportDeclaration(t,e){if(this.expect(a._export),this.eat(a._default))return this.match(a._function)||this.match(a._class)?t.declaration=this.flowParseDeclare(this.startNode()):(t.declaration=this.flowParseType(),this.semicolon()),t.default=!0,this.finishNode(t,"DeclareExportDeclaration");if(this.match(a._const)||this.isLet()||(this.isContextual("type")||this.isContextual("interface"))&&!e){const t=this.state.value,e=Z[t];this.unexpected(this.state.start,`\`declare export ${t}\` is not supported. Use \`${e}\` instead`)}if(this.match(a._var)||this.match(a._function)||this.match(a._class)||this.isContextual("opaque"))return t.declaration=this.flowParseDeclare(this.startNode()),t.default=!1,this.finishNode(t,"DeclareExportDeclaration");if(this.match(a.star)||this.match(a.braceL)||this.isContextual("interface")||this.isContextual("type")||this.isContextual("opaque"))return"ExportNamedDeclaration"===(t=this.parseExport(t)).type&&(t.type="ExportDeclaration",t.default=!1,delete t.exportKind),t.type="Declare"+t.type,t;throw this.unexpected()}flowParseDeclareModuleExports(t){return this.next(),this.expectContextual("exports"),t.typeAnnotation=this.flowParseTypeAnnotation(),this.semicolon(),this.finishNode(t,"DeclareModuleExports")}flowParseDeclareTypeAlias(t){return this.next(),this.flowParseTypeAlias(t),t.type="DeclareTypeAlias",t}flowParseDeclareOpaqueType(t){return this.next(),this.flowParseOpaqueType(t,!0),t.type="DeclareOpaqueType",t}flowParseDeclareInterface(t){return this.next(),this.flowParseInterfaceish(t),this.finishNode(t,"DeclareInterface")}flowParseInterfaceish(t,e=!1){if(t.id=this.flowParseRestrictedIdentifier(!e,!0),this.scope.declareName(t.id.name,e?v:N,t.id.start),this.isRelational("<")?t.typeParameters=this.flowParseTypeParameterDeclaration():t.typeParameters=null,t.extends=[],t.implements=[],t.mixins=[],this.eat(a._extends))do{t.extends.push(this.flowParseInterfaceExtends())}while(!e&&this.eat(a.comma));if(this.isContextual("mixins")){this.next();do{t.mixins.push(this.flowParseInterfaceExtends())}while(this.eat(a.comma))}if(this.isContextual("implements")){this.next();do{t.implements.push(this.flowParseInterfaceExtends())}while(this.eat(a.comma))}t.body=this.flowParseObjectType({allowStatic:e,allowExact:!1,allowSpread:!1,allowProto:e,allowInexact:!1})}flowParseInterfaceExtends(){const t=this.startNode();return t.id=this.flowParseQualifiedTypeIdentifier(),this.isRelational("<")?t.typeParameters=this.flowParseTypeParameterInstantiation():t.typeParameters=null,this.finishNode(t,"InterfaceExtends")}flowParseInterface(t){return this.flowParseInterfaceish(t),this.finishNode(t,"InterfaceDeclaration")}checkNotUnderscore(t){"_"===t&&this.raise(this.state.start,"`_` is only allowed as a type argument to call or new")}checkReservedType(t,e,s){Y.has(t)&&(s?this.raise(e,`Cannot overwrite reserved type ${t}`):this.raise(e,`Unexpected reserved type ${t}`))}flowParseRestrictedIdentifier(t,e){return this.checkReservedType(this.state.value,this.state.start,e),this.parseIdentifier(t)}flowParseTypeAlias(t){return t.id=this.flowParseRestrictedIdentifier(!1,!0),this.scope.declareName(t.id.name,N,t.id.start),this.isRelational("<")?t.typeParameters=this.flowParseTypeParameterDeclaration():t.typeParameters=null,t.right=this.flowParseTypeInitialiser(a.eq),this.semicolon(),this.finishNode(t,"TypeAlias")}flowParseOpaqueType(t,e){return this.expectContextual("type"),t.id=this.flowParseRestrictedIdentifier(!0,!0),this.scope.declareName(t.id.name,N,t.id.start),this.isRelational("<")?t.typeParameters=this.flowParseTypeParameterDeclaration():t.typeParameters=null,t.supertype=null,this.match(a.colon)&&(t.supertype=this.flowParseTypeInitialiser(a.colon)),t.impltype=null,e||(t.impltype=this.flowParseTypeInitialiser(a.eq)),this.semicolon(),this.finishNode(t,"OpaqueType")}flowParseTypeParameter(t=!1){const e=this.state.start,s=this.startNode(),i=this.flowParseVariance(),r=this.flowParseTypeAnnotatableIdentifier();return s.name=r.name,s.variance=i,s.bound=r.typeAnnotation,this.match(a.eq)?(this.eat(a.eq),s.default=this.flowParseType()):t&&this.raise(e,"Type parameter declaration needs a default, since a preceding type parameter declaration has a default."),this.finishNode(s,"TypeParameter")}flowParseTypeParameterDeclaration(){const t=this.state.inType,e=this.startNode();e.params=[],this.state.inType=!0,this.isRelational("<")||this.match(a.jsxTagStart)?this.next():this.unexpected();let s=!1;do{const t=this.flowParseTypeParameter(s);e.params.push(t),t.default&&(s=!0),this.isRelational(">")||this.expect(a.comma)}while(!this.isRelational(">"));return this.expectRelational(">"),this.state.inType=t,this.finishNode(e,"TypeParameterDeclaration")}flowParseTypeParameterInstantiation(){const t=this.startNode(),e=this.state.inType;t.params=[],this.state.inType=!0,this.expectRelational("<");const s=this.state.noAnonFunctionType;for(this.state.noAnonFunctionType=!1;!this.isRelational(">");)t.params.push(this.flowParseType()),this.isRelational(">")||this.expect(a.comma);return this.state.noAnonFunctionType=s,this.expectRelational(">"),this.state.inType=e,this.finishNode(t,"TypeParameterInstantiation")}flowParseTypeParameterInstantiationCallOrNew(){const t=this.startNode(),e=this.state.inType;for(t.params=[],this.state.inType=!0,this.expectRelational("<");!this.isRelational(">");)t.params.push(this.flowParseTypeOrImplicitInstantiation()),this.isRelational(">")||this.expect(a.comma);return this.expectRelational(">"),this.state.inType=e,this.finishNode(t,"TypeParameterInstantiation")}flowParseInterfaceType(){const t=this.startNode();if(this.expectContextual("interface"),t.extends=[],this.eat(a._extends))do{t.extends.push(this.flowParseInterfaceExtends())}while(this.eat(a.comma));return t.body=this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!1,allowProto:!1,allowInexact:!1}),this.finishNode(t,"InterfaceTypeAnnotation")}flowParseObjectPropertyKey(){return this.match(a.num)||this.match(a.string)?this.parseExprAtom():this.parseIdentifier(!0)}flowParseObjectTypeIndexer(t,e,s){return t.static=e,this.lookahead().type===a.colon?(t.id=this.flowParseObjectPropertyKey(),t.key=this.flowParseTypeInitialiser()):(t.id=null,t.key=this.flowParseType()),this.expect(a.bracketR),t.value=this.flowParseTypeInitialiser(),t.variance=s,this.finishNode(t,"ObjectTypeIndexer")}flowParseObjectTypeInternalSlot(t,e){return t.static=e,t.id=this.flowParseObjectPropertyKey(),this.expect(a.bracketR),this.expect(a.bracketR),this.isRelational("<")||this.match(a.parenL)?(t.method=!0,t.optional=!1,t.value=this.flowParseObjectTypeMethodish(this.startNodeAt(t.start,t.loc.start))):(t.method=!1,this.eat(a.question)&&(t.optional=!0),t.value=this.flowParseTypeInitialiser()),this.finishNode(t,"ObjectTypeInternalSlot")}flowParseObjectTypeMethodish(t){for(t.params=[],t.rest=null,t.typeParameters=null,this.isRelational("<")&&(t.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(a.parenL);!this.match(a.parenR)&&!this.match(a.ellipsis);)t.params.push(this.flowParseFunctionTypeParam()),this.match(a.parenR)||this.expect(a.comma);return this.eat(a.ellipsis)&&(t.rest=this.flowParseFunctionTypeParam()),this.expect(a.parenR),t.returnType=this.flowParseTypeInitialiser(),this.finishNode(t,"FunctionTypeAnnotation")}flowParseObjectTypeCallProperty(t,e){const s=this.startNode();return t.static=e,t.value=this.flowParseObjectTypeMethodish(s),this.finishNode(t,"ObjectTypeCallProperty")}flowParseObjectType({allowStatic:t,allowExact:e,allowSpread:s,allowProto:i,allowInexact:r}){const n=this.state.inType;this.state.inType=!0;const o=this.startNode();let h,p;o.callProperties=[],o.properties=[],o.indexers=[],o.internalSlots=[];let c=!1;for(e&&this.match(a.braceBarL)?(this.expect(a.braceBarL),h=a.braceBarR,p=!0):(this.expect(a.braceL),h=a.braceR,p=!1),o.exact=p;!this.match(h);){let e=!1,n=null,h=null;const u=this.startNode();if(i&&this.isContextual("proto")){const e=this.lookahead();e.type!==a.colon&&e.type!==a.question&&(this.next(),n=this.state.start,t=!1)}if(t&&this.isContextual("static")){const t=this.lookahead();t.type!==a.colon&&t.type!==a.question&&(this.next(),e=!0)}const d=this.flowParseVariance();if(this.eat(a.bracketL))null!=n&&this.unexpected(n),this.eat(a.bracketL)?(d&&this.unexpected(d.start),o.internalSlots.push(this.flowParseObjectTypeInternalSlot(u,e))):o.indexers.push(this.flowParseObjectTypeIndexer(u,e,d));else if(this.match(a.parenL)||this.isRelational("<"))null!=n&&this.unexpected(n),d&&this.unexpected(d.start),o.callProperties.push(this.flowParseObjectTypeCallProperty(u,e));else{var l;let t="init";if(this.isContextual("get")||this.isContextual("set")){const e=this.lookahead();e.type!==a.name&&e.type!==a.string&&e.type!==a.num||(t=this.state.value,this.next())}const i=this.flowParseObjectTypeProperty(u,e,n,d,t,s,null!=(l=r)?l:!p);null===i?(c=!0,h=this.state.lastTokStart):o.properties.push(i)}this.flowObjectTypeSemicolon(),!h||this.match(a.braceR)||this.match(a.braceBarR)||this.raise(h,"Explicit inexact syntax must appear at the end of an inexact object")}this.expect(h),s&&(o.inexact=c);const u=this.finishNode(o,"ObjectTypeAnnotation");return this.state.inType=n,u}flowParseObjectTypeProperty(t,e,s,i,r,n,o){if(this.eat(a.ellipsis)){return this.match(a.comma)||this.match(a.semi)||this.match(a.braceR)||this.match(a.braceBarR)?(n?o||this.raise(this.state.lastTokStart,"Explicit inexact syntax cannot appear inside an explicit exact object type"):this.raise(this.state.lastTokStart,"Explicit inexact syntax cannot appear in class or interface definitions"),i&&this.raise(i.start,"Explicit inexact syntax cannot have variance"),null):(n||this.raise(this.state.lastTokStart,"Spread operator cannot appear in class or interface definitions"),null!=s&&this.unexpected(s),i&&this.raise(i.start,"Spread properties cannot have variance"),t.argument=this.flowParseType(),this.finishNode(t,"ObjectTypeSpreadProperty"))}{t.key=this.flowParseObjectPropertyKey(),t.static=e,t.proto=null!=s,t.kind=r;let n=!1;return this.isRelational("<")||this.match(a.parenL)?(t.method=!0,null!=s&&this.unexpected(s),i&&this.unexpected(i.start),t.value=this.flowParseObjectTypeMethodish(this.startNodeAt(t.start,t.loc.start)),"get"!==r&&"set"!==r||this.flowCheckGetterSetterParams(t)):("init"!==r&&this.unexpected(),t.method=!1,this.eat(a.question)&&(n=!0),t.value=this.flowParseTypeInitialiser(),t.variance=i),t.optional=n,this.finishNode(t,"ObjectTypeProperty")}}flowCheckGetterSetterParams(t){const e="get"===t.kind?0:1,s=t.start;t.value.params.length+(t.value.rest?1:0)!==e&&("get"===t.kind?this.raise(s,"getter must not have any formal parameters"):this.raise(s,"setter must have exactly one formal parameter")),"set"===t.kind&&t.value.rest&&this.raise(s,"setter function argument must not be a rest parameter")}flowObjectTypeSemicolon(){this.eat(a.semi)||this.eat(a.comma)||this.match(a.braceR)||this.match(a.braceBarR)||this.unexpected()}flowParseQualifiedTypeIdentifier(t,e,s){t=t||this.state.start,e=e||this.state.startLoc;let i=s||this.flowParseRestrictedIdentifier(!0);for(;this.eat(a.dot);){const s=this.startNodeAt(t,e);s.qualification=i,s.id=this.flowParseRestrictedIdentifier(!0),i=this.finishNode(s,"QualifiedTypeIdentifier")}return i}flowParseGenericType(t,e,s){const i=this.startNodeAt(t,e);return i.typeParameters=null,i.id=this.flowParseQualifiedTypeIdentifier(t,e,s),this.isRelational("<")&&(i.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(i,"GenericTypeAnnotation")}flowParseTypeofType(){const t=this.startNode();return this.expect(a._typeof),t.argument=this.flowParsePrimaryType(),this.finishNode(t,"TypeofTypeAnnotation")}flowParseTupleType(){const t=this.startNode();for(t.types=[],this.expect(a.bracketL);this.state.pos<this.length&&!this.match(a.bracketR)&&(t.types.push(this.flowParseType()),!this.match(a.bracketR));)this.expect(a.comma);return this.expect(a.bracketR),this.finishNode(t,"TupleTypeAnnotation")}flowParseFunctionTypeParam(){let t=null,e=!1,s=null;const i=this.startNode(),r=this.lookahead();return r.type===a.colon||r.type===a.question?(t=this.parseIdentifier(),this.eat(a.question)&&(e=!0),s=this.flowParseTypeInitialiser()):s=this.flowParseType(),i.name=t,i.optional=e,i.typeAnnotation=s,this.finishNode(i,"FunctionTypeParam")}reinterpretTypeAsFunctionTypeParam(t){const e=this.startNodeAt(t.start,t.loc.start);return e.name=null,e.optional=!1,e.typeAnnotation=t,this.finishNode(e,"FunctionTypeParam")}flowParseFunctionTypeParams(t=[]){let e=null;for(;!this.match(a.parenR)&&!this.match(a.ellipsis);)t.push(this.flowParseFunctionTypeParam()),this.match(a.parenR)||this.expect(a.comma);return this.eat(a.ellipsis)&&(e=this.flowParseFunctionTypeParam()),{params:t,rest:e}}flowIdentToTypeAnnotation(t,e,s,i){switch(i.name){case"any":return this.finishNode(s,"AnyTypeAnnotation");case"bool":case"boolean":return this.finishNode(s,"BooleanTypeAnnotation");case"mixed":return this.finishNode(s,"MixedTypeAnnotation");case"empty":return this.finishNode(s,"EmptyTypeAnnotation");case"number":return this.finishNode(s,"NumberTypeAnnotation");case"string":return this.finishNode(s,"StringTypeAnnotation");default:return this.checkNotUnderscore(i.name),this.flowParseGenericType(t,e,i)}}flowParsePrimaryType(){const t=this.state.start,e=this.state.startLoc,s=this.startNode();let i,r,n=!1;const o=this.state.noAnonFunctionType;switch(this.state.type){case a.name:return this.isContextual("interface")?this.flowParseInterfaceType():this.flowIdentToTypeAnnotation(t,e,s,this.parseIdentifier());case a.braceL:return this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!0,allowProto:!1,allowInexact:!0});case a.braceBarL:return this.flowParseObjectType({allowStatic:!1,allowExact:!0,allowSpread:!0,allowProto:!1,allowInexact:!1});case a.bracketL:return this.state.noAnonFunctionType=!1,r=this.flowParseTupleType(),this.state.noAnonFunctionType=o,r;case a.relational:if("<"===this.state.value)return s.typeParameters=this.flowParseTypeParameterDeclaration(),this.expect(a.parenL),i=this.flowParseFunctionTypeParams(),s.params=i.params,s.rest=i.rest,this.expect(a.parenR),this.expect(a.arrow),s.returnType=this.flowParseType(),this.finishNode(s,"FunctionTypeAnnotation");break;case a.parenL:if(this.next(),!this.match(a.parenR)&&!this.match(a.ellipsis))if(this.match(a.name)){const t=this.lookahead().type;n=t!==a.question&&t!==a.colon}else n=!0;if(n){if(this.state.noAnonFunctionType=!1,r=this.flowParseType(),this.state.noAnonFunctionType=o,this.state.noAnonFunctionType||!(this.match(a.comma)||this.match(a.parenR)&&this.lookahead().type===a.arrow))return this.expect(a.parenR),r;this.eat(a.comma)}return i=r?this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(r)]):this.flowParseFunctionTypeParams(),s.params=i.params,s.rest=i.rest,this.expect(a.parenR),this.expect(a.arrow),s.returnType=this.flowParseType(),s.typeParameters=null,this.finishNode(s,"FunctionTypeAnnotation");case a.string:return this.parseLiteral(this.state.value,"StringLiteralTypeAnnotation");case a._true:case a._false:return s.value=this.match(a._true),this.next(),this.finishNode(s,"BooleanLiteralTypeAnnotation");case a.plusMin:if("-"===this.state.value){if(this.next(),this.match(a.num))return this.parseLiteral(-this.state.value,"NumberLiteralTypeAnnotation",s.start,s.loc.start);if(this.match(a.bigint))return this.parseLiteral(-this.state.value,"BigIntLiteralTypeAnnotation",s.start,s.loc.start);throw this.raise(this.state.start,'Unexpected token, expected "number" or "bigint"')}this.unexpected();case a.num:return this.parseLiteral(this.state.value,"NumberLiteralTypeAnnotation");case a.bigint:return this.parseLiteral(this.state.value,"BigIntLiteralTypeAnnotation");case a._void:return this.next(),this.finishNode(s,"VoidTypeAnnotation");case a._null:return this.next(),this.finishNode(s,"NullLiteralTypeAnnotation");case a._this:return this.next(),this.finishNode(s,"ThisTypeAnnotation");case a.star:return this.next(),this.finishNode(s,"ExistsTypeAnnotation");default:if("typeof"===this.state.type.keyword)return this.flowParseTypeofType();if(this.state.type.keyword){const t=this.state.type.label;return this.next(),super.createIdentifier(s,t)}}throw this.unexpected()}flowParsePostfixType(){const t=this.state.start,e=this.state.startLoc;let s=this.flowParsePrimaryType();for(;this.match(a.bracketL)&&!this.canInsertSemicolon();){const i=this.startNodeAt(t,e);i.elementType=s,this.expect(a.bracketL),this.expect(a.bracketR),s=this.finishNode(i,"ArrayTypeAnnotation")}return s}flowParsePrefixType(){const t=this.startNode();return this.eat(a.question)?(t.typeAnnotation=this.flowParsePrefixType(),this.finishNode(t,"NullableTypeAnnotation")):this.flowParsePostfixType()}flowParseAnonFunctionWithoutParens(){const t=this.flowParsePrefixType();if(!this.state.noAnonFunctionType&&this.eat(a.arrow)){const e=this.startNodeAt(t.start,t.loc.start);return e.params=[this.reinterpretTypeAsFunctionTypeParam(t)],e.rest=null,e.returnType=this.flowParseType(),e.typeParameters=null,this.finishNode(e,"FunctionTypeAnnotation")}return t}flowParseIntersectionType(){const t=this.startNode();this.eat(a.bitwiseAND);const e=this.flowParseAnonFunctionWithoutParens();for(t.types=[e];this.eat(a.bitwiseAND);)t.types.push(this.flowParseAnonFunctionWithoutParens());return 1===t.types.length?e:this.finishNode(t,"IntersectionTypeAnnotation")}flowParseUnionType(){const t=this.startNode();this.eat(a.bitwiseOR);const e=this.flowParseIntersectionType();for(t.types=[e];this.eat(a.bitwiseOR);)t.types.push(this.flowParseIntersectionType());return 1===t.types.length?e:this.finishNode(t,"UnionTypeAnnotation")}flowParseType(){const t=this.state.inType;this.state.inType=!0;const e=this.flowParseUnionType();return this.state.inType=t,this.state.exprAllowed=this.state.exprAllowed||this.state.noAnonFunctionType,e}flowParseTypeOrImplicitInstantiation(){if(this.state.type===a.name&&"_"===this.state.value){const t=this.state.start,e=this.state.startLoc,s=this.parseIdentifier();return this.flowParseGenericType(t,e,s)}return this.flowParseType()}flowParseTypeAnnotation(){const t=this.startNode();return t.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(t,"TypeAnnotation")}flowParseTypeAnnotatableIdentifier(t){const e=t?this.parseIdentifier():this.flowParseRestrictedIdentifier();return this.match(a.colon)&&(e.typeAnnotation=this.flowParseTypeAnnotation(),this.resetEndLocation(e)),e}typeCastToParameter(t){return t.expression.typeAnnotation=t.typeAnnotation,this.resetEndLocation(t.expression,t.typeAnnotation.end,t.typeAnnotation.loc.end),t.expression}flowParseVariance(){let t=null;return this.match(a.plusMin)&&(t=this.startNode(),"+"===this.state.value?t.kind="plus":t.kind="minus",this.next(),this.finishNode(t,"Variance")),t}parseFunctionBody(t,e,s=!1){return e?this.forwardNoArrowParamsConversionAt(t,()=>super.parseFunctionBody(t,!0,s)):super.parseFunctionBody(t,!1,s)}parseFunctionBodyAndFinish(t,e,s=!1){if(this.match(a.colon)){const e=this.startNode();[e.typeAnnotation,t.predicate]=this.flowParseTypeAndPredicateInitialiser(),t.returnType=e.typeAnnotation?this.finishNode(e,"TypeAnnotation"):null}super.parseFunctionBodyAndFinish(t,e,s)}parseStatement(t,e){if(this.state.strict&&this.match(a.name)&&"interface"===this.state.value){const t=this.startNode();return this.next(),this.flowParseInterface(t)}if(this.shouldParseEnums()&&this.isContextual("enum")){const t=this.startNode();return this.next(),this.flowParseEnumDeclaration(t)}{const s=super.parseStatement(t,e);return void 0!==this.flowPragma||this.isValidDirective(s)||(this.flowPragma=null),s}}parseExpressionStatement(t,e){if("Identifier"===e.type)if("declare"===e.name){if(this.match(a._class)||this.match(a.name)||this.match(a._function)||this.match(a._var)||this.match(a._export))return this.flowParseDeclare(t)}else if(this.match(a.name)){if("interface"===e.name)return this.flowParseInterface(t);if("type"===e.name)return this.flowParseTypeAlias(t);if("opaque"===e.name)return this.flowParseOpaqueType(t,!1)}return super.parseExpressionStatement(t,e)}shouldParseExportDeclaration(){return this.isContextual("type")||this.isContextual("interface")||this.isContextual("opaque")||this.shouldParseEnums()&&this.isContextual("enum")||super.shouldParseExportDeclaration()}isExportDefaultSpecifier(){return(!this.match(a.name)||!("type"===this.state.value||"interface"===this.state.value||"opaque"===this.state.value||this.shouldParseEnums()&&"enum"===this.state.value))&&super.isExportDefaultSpecifier()}parseExportDefaultExpression(){if(this.shouldParseEnums()&&this.isContextual("enum")){const t=this.startNode();return this.next(),this.flowParseEnumDeclaration(t)}return super.parseExportDefaultExpression()}parseConditional(t,e,s,i,r){if(!this.match(a.question))return t;if(r){const a=this.tryParse(()=>super.parseConditional(t,e,s,i));return a.node?(a.error&&(this.state=a.failState),a.node):(r.start=a.error.pos||this.state.start,t)}this.expect(a.question);const n=this.state.clone(),o=this.state.noArrowAt,h=this.startNodeAt(s,i);let{consequent:p,failed:c}=this.tryParseConditionalConsequent(),[l,u]=this.getArrowLikeExpressions(p);if(c||u.length>0){const t=[...o];if(u.length>0){this.state=n,this.state.noArrowAt=t;for(let e=0;e<u.length;e++)t.push(u[e].start);({consequent:p,failed:c}=this.tryParseConditionalConsequent()),[l,u]=this.getArrowLikeExpressions(p)}c&&l.length>1&&this.raise(n.start,"Ambiguous expression: wrap the arrow functions in parentheses to disambiguate."),c&&1===l.length&&(this.state=n,this.state.noArrowAt=t.concat(l[0].start),({consequent:p,failed:c}=this.tryParseConditionalConsequent()))}return this.getArrowLikeExpressions(p,!0),this.state.noArrowAt=o,this.expect(a.colon),h.test=t,h.consequent=p,h.alternate=this.forwardNoArrowParamsConversionAt(h,()=>this.parseMaybeAssign(e,void 0,void 0,void 0)),this.finishNode(h,"ConditionalExpression")}tryParseConditionalConsequent(){this.state.noArrowParamsConversionAt.push(this.state.start);const t=this.parseMaybeAssign(),e=!this.match(a.colon);return this.state.noArrowParamsConversionAt.pop(),{consequent:t,failed:e}}getArrowLikeExpressions(t,e){const s=[t],i=[];for(;0!==s.length;){const t=s.pop();"ArrowFunctionExpression"===t.type?(t.typeParameters||!t.returnType?this.finishArrowValidation(t):i.push(t),s.push(t.body)):"ConditionalExpression"===t.type&&(s.push(t.consequent),s.push(t.alternate))}return e?(i.forEach(t=>this.finishArrowValidation(t)),[i,[]]):function partition(t,e){const s=[],i=[];for(let r=0;r<t.length;r++)(e(t[r],r,t)?s:i).push(t[r]);return[s,i]}(i,t=>t.params.every(t=>this.isAssignable(t,!0)))}finishArrowValidation(t){var e;this.toAssignableList(t.params,!0,"arrow function parameters",null==(e=t.extra)?void 0:e.trailingComma),this.scope.enter(functionFlags(!1,!1)|l),super.checkParams(t,!1,!0),this.scope.exit()}forwardNoArrowParamsConversionAt(t,e){let s;return-1!==this.state.noArrowParamsConversionAt.indexOf(t.start)?(this.state.noArrowParamsConversionAt.push(this.state.start),s=e(),this.state.noArrowParamsConversionAt.pop()):s=e(),s}parseParenItem(t,e,s){if(t=super.parseParenItem(t,e,s),this.eat(a.question)&&(t.optional=!0,this.resetEndLocation(t)),this.match(a.colon)){const i=this.startNodeAt(e,s);return i.expression=t,i.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(i,"TypeCastExpression")}return t}assertModuleNodeAllowed(t){"ImportDeclaration"===t.type&&("type"===t.importKind||"typeof"===t.importKind)||"ExportNamedDeclaration"===t.type&&"type"===t.exportKind||"ExportAllDeclaration"===t.type&&"type"===t.exportKind||super.assertModuleNodeAllowed(t)}parseExport(t){const e=super.parseExport(t);return"ExportNamedDeclaration"!==e.type&&"ExportAllDeclaration"!==e.type||(e.exportKind=e.exportKind||"value"),e}parseExportDeclaration(t){if(this.isContextual("type")){t.exportKind="type";const e=this.startNode();return this.next(),this.match(a.braceL)?(t.specifiers=this.parseExportSpecifiers(),this.parseExportFrom(t),null):this.flowParseTypeAlias(e)}if(this.isContextual("opaque")){t.exportKind="type";const e=this.startNode();return this.next(),this.flowParseOpaqueType(e,!1)}if(this.isContextual("interface")){t.exportKind="type";const e=this.startNode();return this.next(),this.flowParseInterface(e)}if(this.shouldParseEnums()&&this.isContextual("enum")){t.exportKind="value";const e=this.startNode();return this.next(),this.flowParseEnumDeclaration(e)}return super.parseExportDeclaration(t)}eatExportStar(t){return!!super.eatExportStar(...arguments)||!(!this.isContextual("type")||this.lookahead().type!==a.star)&&(t.exportKind="type",this.next(),this.next(),!0)}maybeParseExportNamespaceSpecifier(t){const e=this.state.start,s=super.maybeParseExportNamespaceSpecifier(t);return s&&"type"===t.exportKind&&this.unexpected(e),s}parseClassId(t,e,s){super.parseClassId(t,e,s),this.isRelational("<")&&(t.typeParameters=this.flowParseTypeParameterDeclaration())}getTokenFromCode(t){const e=this.input.charCodeAt(this.state.pos+1);return 123===t&&124===e?this.finishOp(a.braceBarL,2):!this.state.inType||62!==t&&60!==t?function isIteratorStart(t,e){return 64===t&&64===e}(t,e)?(this.state.isIterator=!0,super.readWord()):super.getTokenFromCode(t):this.finishOp(a.relational,1)}isAssignable(t,e){switch(t.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":return!0;case"ObjectExpression":{const e=t.properties.length-1;return t.properties.every((t,s)=>"ObjectMethod"!==t.type&&(s===e||"SpreadElement"===t.type)&&this.isAssignable(t))}case"ObjectProperty":return this.isAssignable(t.value);case"SpreadElement":return this.isAssignable(t.argument);case"ArrayExpression":return t.elements.every(t=>this.isAssignable(t));case"AssignmentExpression":return"="===t.operator;case"ParenthesizedExpression":case"TypeCastExpression":return this.isAssignable(t.expression);case"MemberExpression":case"OptionalMemberExpression":return!e;default:return!1}}toAssignable(t,e,s){return"TypeCastExpression"===t.type?super.toAssignable(this.typeCastToParameter(t),e,s):super.toAssignable(t,e,s)}toAssignableList(t,e,s,i){for(let e=0;e<t.length;e++){const s=t[e];s&&"TypeCastExpression"===s.type&&(t[e]=this.typeCastToParameter(s))}return super.toAssignableList(t,e,s,i)}toReferencedList(t,e){for(let s=0;s<t.length;s++){const i=t[s];!i||"TypeCastExpression"!==i.type||i.extra&&i.extra.parenthesized||!(t.length>1)&&e||this.raise(i.typeAnnotation.start,"The type cast expression is expected to be wrapped with parenthesis")}return t}checkLVal(t,e=O,s,i){if("TypeCastExpression"!==t.type)return super.checkLVal(t,e,s,i)}parseClassProperty(t){return this.match(a.colon)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassProperty(t)}parseClassPrivateProperty(t){return this.match(a.colon)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassPrivateProperty(t)}isClassMethod(){return this.isRelational("<")||super.isClassMethod()}isClassProperty(){return this.match(a.colon)||super.isClassProperty()}isNonstaticConstructor(t){return!this.match(a.colon)&&super.isNonstaticConstructor(t)}pushClassMethod(t,e,s,i,r,a){e.variance&&this.unexpected(e.variance.start),delete e.variance,this.isRelational("<")&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassMethod(t,e,s,i,r,a)}pushClassPrivateMethod(t,e,s,i){e.variance&&this.unexpected(e.variance.start),delete e.variance,this.isRelational("<")&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassPrivateMethod(t,e,s,i)}parseClassSuper(t){if(super.parseClassSuper(t),t.superClass&&this.isRelational("<")&&(t.superTypeParameters=this.flowParseTypeParameterInstantiation()),this.isContextual("implements")){this.next();const e=t.implements=[];do{const t=this.startNode();t.id=this.flowParseRestrictedIdentifier(!0),this.isRelational("<")?t.typeParameters=this.flowParseTypeParameterInstantiation():t.typeParameters=null,e.push(this.finishNode(t,"ClassImplements"))}while(this.eat(a.comma))}}parsePropertyName(t){const e=this.flowParseVariance(),s=super.parsePropertyName(t);return t.variance=e,s}parseObjPropValue(t,e,s,i,r,n,o,h){let p;t.variance&&this.unexpected(t.variance.start),delete t.variance,this.isRelational("<")&&(p=this.flowParseTypeParameterDeclaration(),this.match(a.parenL)||this.unexpected()),super.parseObjPropValue(t,e,s,i,r,n,o,h),p&&((t.value||t).typeParameters=p)}parseAssignableListItemTypes(t){return this.eat(a.question)&&("Identifier"!==t.type&&this.raise(t.start,"A binding pattern parameter cannot be optional in an implementation signature."),t.optional=!0),this.match(a.colon)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),this.resetEndLocation(t),t}parseMaybeDefault(t,e,s){const i=super.parseMaybeDefault(t,e,s);return"AssignmentPattern"===i.type&&i.typeAnnotation&&i.right.start<i.typeAnnotation.start&&this.raise(i.typeAnnotation.start,"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`"),i}shouldParseDefaultImport(t){return hasTypeImportKind(t)?isMaybeDefaultImport(this.state):super.shouldParseDefaultImport(t)}parseImportSpecifierLocal(t,e,s,i){e.local=hasTypeImportKind(t)?this.flowParseRestrictedIdentifier(!0,!0):this.parseIdentifier(),this.checkLVal(e.local,N,void 0,i),t.specifiers.push(this.finishNode(e,s))}maybeParseDefaultImportSpecifier(t){t.importKind="value";let e=null;if(this.match(a._typeof)?e="typeof":this.isContextual("type")&&(e="type"),e){const s=this.lookahead();"type"===e&&s.type===a.star&&this.unexpected(s.start),(isMaybeDefaultImport(s)||s.type===a.braceL||s.type===a.star)&&(this.next(),t.importKind=e)}return super.maybeParseDefaultImportSpecifier(t)}parseImportSpecifier(t){const e=this.startNode(),s=this.state.start,i=this.parseIdentifier(!0);let r=null;"type"===i.name?r="type":"typeof"===i.name&&(r="typeof");let n=!1;if(this.isContextual("as")&&!this.isLookaheadContextual("as")){const t=this.parseIdentifier(!0);null===r||this.match(a.name)||this.state.type.keyword?(e.imported=i,e.importKind=null,e.local=this.parseIdentifier()):(e.imported=t,e.importKind=r,e.local=t.__clone())}else null!==r&&(this.match(a.name)||this.state.type.keyword)?(e.imported=this.parseIdentifier(!0),e.importKind=r,this.eatContextual("as")?e.local=this.parseIdentifier():(n=!0,e.local=e.imported.__clone())):(n=!0,e.imported=i,e.importKind=null,e.local=e.imported.__clone());const o=hasTypeImportKind(t),h=hasTypeImportKind(e);o&&h&&this.raise(s,"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"),(o||h)&&this.checkReservedType(e.local.name,e.local.start,!0),!n||o||h||this.checkReservedWord(e.local.name,e.start,!0,!0),this.checkLVal(e.local,N,void 0,"import specifier"),t.specifiers.push(this.finishNode(e,"ImportSpecifier"))}parseFunctionParams(t,e){const s=t.kind;"get"!==s&&"set"!==s&&this.isRelational("<")&&(t.typeParameters=this.flowParseTypeParameterDeclaration()),super.parseFunctionParams(t,e)}parseVarId(t,e){super.parseVarId(t,e),this.match(a.colon)&&(t.id.typeAnnotation=this.flowParseTypeAnnotation(),this.resetEndLocation(t.id))}parseAsyncArrowFromCallExpression(t,e){if(this.match(a.colon)){const e=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0,t.returnType=this.flowParseTypeAnnotation(),this.state.noAnonFunctionType=e}return super.parseAsyncArrowFromCallExpression(t,e)}shouldParseAsyncArrow(){return this.match(a.colon)||super.shouldParseAsyncArrow()}parseMaybeAssign(t,e,s,i){let r,n=null;if(this.hasPlugin("jsx")&&(this.match(a.jsxTagStart)||this.isRelational("<"))){if(n=this.state.clone(),!(r=this.tryParse(()=>super.parseMaybeAssign(t,e,s,i),n)).error)return r.node;const{context:a}=this.state;a[a.length-1]===U.j_oTag?a.length-=2:a[a.length-1]===U.j_expr&&(a.length-=1)}if(r&&r.error||this.isRelational("<")){let a;n=n||this.state.clone();const o=this.tryParse(()=>{a=this.flowParseTypeParameterDeclaration();const r=this.forwardNoArrowParamsConversionAt(a,()=>super.parseMaybeAssign(t,e,s,i));return r.typeParameters=a,this.resetStartLocationFromNode(r,a),r},n),h=o.node&&"ArrowFunctionExpression"===o.node.type?o.node:null;if(!o.error&&h)return h;if(r&&r.node)return this.state=r.failState,r.node;if(h)return this.state=o.failState,h;if(r&&r.thrown)throw r.error;if(o.thrown)throw o.error;throw this.raise(a.start,"Expected an arrow function after this type parameter declaration")}return super.parseMaybeAssign(t,e,s,i)}parseArrow(t){if(this.match(a.colon)){const e=this.tryParse(()=>{const e=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0;const s=this.startNode();return[s.typeAnnotation,t.predicate]=this.flowParseTypeAndPredicateInitialiser(),this.state.noAnonFunctionType=e,this.canInsertSemicolon()&&this.unexpected(),this.match(a.arrow)||this.unexpected(),s});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(){return this.match(a.colon)||super.shouldParseArrow()}setArrowFunctionParameters(t,e){-1!==this.state.noArrowParamsConversionAt.indexOf(t.start)?t.params=e:super.setArrowFunctionParameters(t,e)}checkParams(t,e,s){if(!s||-1===this.state.noArrowParamsConversionAt.indexOf(t.start))return super.checkParams(...arguments)}parseParenAndDistinguishExpression(t){return super.parseParenAndDistinguishExpression(t&&-1===this.state.noArrowAt.indexOf(this.state.start))}parseSubscripts(t,e,s,i){if("Identifier"===t.type&&"async"===t.name&&-1!==this.state.noArrowAt.indexOf(e)){this.next();const i=this.startNodeAt(e,s);i.callee=t,i.arguments=this.parseCallExpressionArguments(a.parenR,!1),t=this.finishNode(i,"CallExpression")}else if("Identifier"===t.type&&"async"===t.name&&this.isRelational("<")){const r=this.state.clone(),a=this.tryParse(t=>this.parseAsyncArrowWithTypeParameters(e,s)||t(),r);if(!a.error&&!a.aborted)return a.node;const n=this.tryParse(()=>super.parseSubscripts(t,e,s,i),r);if(n.node&&!n.error)return n.node;if(a.node)return this.state=a.failState,a.node;if(n.node)return this.state=n.failState,n.node;throw a.error||n.error}return super.parseSubscripts(t,e,s,i)}parseSubscript(t,e,s,i,r){if(this.match(a.questionDot)&&this.isLookaheadRelational("<")){if(this.expectPlugin("optionalChaining"),r.optionalChainMember=!0,i)return r.stop=!0,t;this.next();const n=this.startNodeAt(e,s);return n.callee=t,n.typeArguments=this.flowParseTypeParameterInstantiation(),this.expect(a.parenL),n.arguments=this.parseCallExpressionArguments(a.parenR,!1),n.optional=!0,this.finishCallExpression(n,!0)}if(!i&&this.shouldParseTypes()&&this.isRelational("<")){const i=this.startNodeAt(e,s);i.callee=t;const n=this.tryParse(()=>(i.typeArguments=this.flowParseTypeParameterInstantiationCallOrNew(),this.expect(a.parenL),i.arguments=this.parseCallExpressionArguments(a.parenR,!1),r.optionalChainMember&&(i.optional=!1),this.finishCallExpression(i,r.optionalChainMember)));if(n.node)return n.error&&(this.state=n.failState),n.node}return super.parseSubscript(t,e,s,i,r)}parseNewArguments(t){let e=null;this.shouldParseTypes()&&this.isRelational("<")&&(e=this.tryParse(()=>this.flowParseTypeParameterInstantiationCallOrNew()).node),t.typeArguments=e,super.parseNewArguments(t)}parseAsyncArrowWithTypeParameters(t,e){const s=this.startNodeAt(t,e);if(this.parseFunctionParams(s),this.parseArrow(s))return this.parseArrowExpression(s,void 0,!0)}readToken_mult_modulo(t){const e=this.input.charCodeAt(this.state.pos+1);if(42===t&&47===e&&this.state.hasFlowComment)return this.state.hasFlowComment=!1,this.state.pos+=2,void this.nextToken();super.readToken_mult_modulo(t)}readToken_pipe_amp(t){const e=this.input.charCodeAt(this.state.pos+1);124!==t||125!==e?super.readToken_pipe_amp(t):this.finishOp(a.braceBarR,2)}parseTopLevel(t,e){const s=super.parseTopLevel(t,e);return this.state.hasFlowComment&&this.raise(this.state.pos,"Unterminated flow-comment"),s}skipBlockComment(){if(this.hasPlugin("flowComments")&&this.skipFlowComment())return this.state.hasFlowComment&&this.unexpected(null,"Cannot have a flow comment inside another flow comment"),this.hasFlowCommentCompletion(),this.state.pos+=this.skipFlowComment(),void(this.state.hasFlowComment=!0);if(this.state.hasFlowComment){const t=this.input.indexOf("*-/",this.state.pos+=2);if(-1===t)throw this.raise(this.state.pos-2,"Unterminated comment");this.state.pos=t+3}else super.skipBlockComment()}skipFlowComment(){const{pos:t}=this.state;let e=2;for(;[32,9].includes(this.input.charCodeAt(t+e));)e++;const s=this.input.charCodeAt(e+t),i=this.input.charCodeAt(e+t+1);return 58===s&&58===i?e+2:"flow-include"===this.input.slice(e+t,e+t+12)?e+12:58===s&&58!==i&&e}hasFlowCommentCompletion(){if(-1===this.input.indexOf("*/",this.state.pos))throw this.raise(this.state.pos,"Unterminated comment")}flowEnumErrorBooleanMemberNotInitialized(t,{enumName:e,memberName:s}){this.raise(t,`Boolean enum members need to be initialized. Use either \`${s} = true,\` `+`or \`${s} = false,\` in enum \`${e}\`.`)}flowEnumErrorInvalidMemberName(t,{enumName:e,memberName:s}){const i=s[0].toUpperCase()+s.slice(1);this.raise(t,"Enum member names cannot start with lowercase 'a' through 'z'. Instead of using "+`\`${s}\`, consider using \`${i}\`, in enum \`${e}\`.`)}flowEnumErrorDuplicateMemberName(t,{enumName:e,memberName:s}){this.raise(t,`Enum member names need to be unique, but the name \`${s}\` has already been used `+`before in enum \`${e}\`.`)}flowEnumErrorInconsistentMemberValues(t,{enumName:e}){this.raise(t,`Enum \`${e}\` has inconsistent member initializers. Either use no initializers, or `+"consistently use literals (either booleans, numbers, or strings) for all member initializers.")}flowEnumErrorInvalidExplicitType(t,{enumName:e,suppliedType:s}){const i="Use one of `boolean`, `number`, `string`, or `symbol` in "+`enum \`${e}\`.`,r=null===s?`Supplied enum type is not valid. ${i}`:`Enum type \`${s}\` is not valid. ${i}`;return this.raise(t,r)}flowEnumErrorInvalidMemberInitializer(t,{enumName:e,explicitType:s,memberName:i}){let r=null;switch(s){case"boolean":case"number":case"string":r=`Enum \`${e}\` has type \`${s}\`, so the initializer of `+`\`${i}\` needs to be a ${s} literal.`;break;case"symbol":r=`Symbol enum members cannot be initialized. Use \`${i},\` in `+`enum \`${e}\`.`;break;default:r=`The enum member initializer for \`${i}\` needs to be a literal (either `+`a boolean, number, or string) in enum \`${e}\`.`}return this.raise(t,r)}flowEnumErrorNumberMemberNotInitialized(t,{enumName:e,memberName:s}){this.raise(t,`Number enum members need to be initialized, e.g. \`${s} = 1\` in enum \`${e}\`.`)}flowEnumErrorStringMemberInconsistentlyInitailized(t,{enumName:e}){this.raise(t,"String enum members need to consistently either all use initializers, or use no initializers, "+`in enum \`${e}\`.`)}flowEnumMemberInit(){const t=this.state.start,endOfInit=()=>this.match(a.comma)||this.match(a.braceR);switch(this.state.type){case a.num:{const e=this.parseLiteral(this.state.value,"NumericLiteral");return endOfInit()?{type:"number",pos:e.start,value:e}:{type:"invalid",pos:t}}case a.string:{const e=this.parseLiteral(this.state.value,"StringLiteral");return endOfInit()?{type:"string",pos:e.start,value:e}:{type:"invalid",pos:t}}case a._true:case a._false:{const e=this.parseBooleanLiteral();return endOfInit()?{type:"boolean",pos:e.start,value:e}:{type:"invalid",pos:t}}default:return{type:"invalid",pos:t}}}flowEnumMemberRaw(){const t=this.state.start;return{id:this.parseIdentifier(!0),init:this.eat(a.eq)?this.flowEnumMemberInit():{type:"none",pos:t}}}flowEnumCheckExplicitTypeMismatch(t,e,s){const{explicitType:i}=e;null!==i&&i!==s&&this.flowEnumErrorInvalidMemberInitializer(t,e)}flowEnumMembers({enumName:t,explicitType:e}){const s=new Set,i={booleanMembers:[],numberMembers:[],stringMembers:[],defaultedMembers:[]};for(;!this.match(a.braceR);){const r=this.startNode(),{id:n,init:o}=this.flowEnumMemberRaw(),h=n.name;if(""===h)continue;/^[a-z]/.test(h)&&this.flowEnumErrorInvalidMemberName(n.start,{enumName:t,memberName:h}),s.has(h)&&this.flowEnumErrorDuplicateMemberName(n.start,{enumName:t,memberName:h}),s.add(h);const p={enumName:t,explicitType:e,memberName:h};switch(r.id=n,o.type){case"boolean":this.flowEnumCheckExplicitTypeMismatch(o.pos,p,"boolean"),r.init=o.value,i.booleanMembers.push(this.finishNode(r,"EnumBooleanMember"));break;case"number":this.flowEnumCheckExplicitTypeMismatch(o.pos,p,"number"),r.init=o.value,i.numberMembers.push(this.finishNode(r,"EnumNumberMember"));break;case"string":this.flowEnumCheckExplicitTypeMismatch(o.pos,p,"string"),r.init=o.value,i.stringMembers.push(this.finishNode(r,"EnumStringMember"));break;case"invalid":throw this.flowEnumErrorInvalidMemberInitializer(o.pos,p);case"none":switch(e){case"boolean":this.flowEnumErrorBooleanMemberNotInitialized(o.pos,p);break;case"number":this.flowEnumErrorNumberMemberNotInitialized(o.pos,p);break;default:i.defaultedMembers.push(this.finishNode(r,"EnumDefaultedMember"))}}this.match(a.braceR)||this.expect(a.comma)}return i}flowEnumStringMembers(t,e,{enumName:s}){if(0===t.length)return e;if(0===e.length)return t;if(e.length>t.length){for(let e=0;e<t.length;e++){const i=t[e];this.flowEnumErrorStringMemberInconsistentlyInitailized(i.start,{enumName:s})}return e}for(let t=0;t<e.length;t++){const i=e[t];this.flowEnumErrorStringMemberInconsistentlyInitailized(i.start,{enumName:s})}return t}flowEnumParseExplicitType({enumName:t}){if(this.eatContextual("of")){if(!this.match(a.name))throw this.flowEnumErrorInvalidExplicitType(this.state.start,{enumName:t,suppliedType:null});const{value:e}=this.state;return this.next(),"boolean"!==e&&"number"!==e&&"string"!==e&&"symbol"!==e&&this.flowEnumErrorInvalidExplicitType(this.state.start,{enumName:t,suppliedType:e}),e}return null}flowEnumBody(t,{enumName:e,nameLoc:s}){const i=this.flowEnumParseExplicitType({enumName:e});this.expect(a.braceL);const r=this.flowEnumMembers({enumName:e,explicitType:i});switch(i){case"boolean":return t.explicitType=!0,t.members=r.booleanMembers,this.expect(a.braceR),this.finishNode(t,"EnumBooleanBody");case"number":return t.explicitType=!0,t.members=r.numberMembers,this.expect(a.braceR),this.finishNode(t,"EnumNumberBody");case"string":return t.explicitType=!0,t.members=this.flowEnumStringMembers(r.stringMembers,r.defaultedMembers,{enumName:e}),this.expect(a.braceR),this.finishNode(t,"EnumStringBody");case"symbol":return t.members=r.defaultedMembers,this.expect(a.braceR),this.finishNode(t,"EnumSymbolBody");default:{const empty=()=>(t.members=[],this.expect(a.braceR),this.finishNode(t,"EnumStringBody"));t.explicitType=!1;const i=r.booleanMembers.length,n=r.numberMembers.length,o=r.stringMembers.length,h=r.defaultedMembers.length;if(i||n||o||h){if(i||n){if(!n&&!o&&i>=h){for(let t=0,s=r.defaultedMembers;t<s.length;t++){const i=s[t];this.flowEnumErrorBooleanMemberNotInitialized(i.start,{enumName:e,memberName:i.id.name})}return t.members=r.booleanMembers,this.expect(a.braceR),this.finishNode(t,"EnumBooleanBody")}if(!i&&!o&&n>=h){for(let t=0,s=r.defaultedMembers;t<s.length;t++){const i=s[t];this.flowEnumErrorNumberMemberNotInitialized(i.start,{enumName:e,memberName:i.id.name})}return t.members=r.numberMembers,this.expect(a.braceR),this.finishNode(t,"EnumNumberBody")}return this.flowEnumErrorInconsistentMemberValues(s,{enumName:e}),empty()}return t.members=this.flowEnumStringMembers(r.stringMembers,r.defaultedMembers,{enumName:e}),this.expect(a.braceR),this.finishNode(t,"EnumStringBody")}return empty()}}}flowParseEnumDeclaration(t){const e=this.parseIdentifier();return t.id=e,t.body=this.flowEnumBody(this.startNode(),{enumName:e.name,nameLoc:e.start}),this.finishNode(t,"EnumDeclaration")}}),typescript:t=>(class extends t{getScopeHandler(){return TypeScriptScopeHandler}tsIsIdentifier(){return this.match(a.name)}tsNextTokenCanFollowModifier(){return this.next(),!(this.hasPrecedingLineBreak()||this.match(a.parenL)||this.match(a.parenR)||this.match(a.colon)||this.match(a.eq)||this.match(a.question)||this.match(a.bang))}tsParseModifier(t){if(!this.match(a.name))return;const e=this.state.value;return-1!==t.indexOf(e)&&this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this))?e:void 0}tsParseModifiers(t){const e=Object.create(null);for(;;){const s=this.state.start,i=this.tsParseModifier(t);if(!i)break;Object.hasOwnProperty.call(e,i)&&this.raise(s,`Duplicate modifier: '${i}'`),e[i]=!0}return e}tsIsListTerminator(t){switch(t){case"EnumMembers":case"TypeMembers":return this.match(a.braceR);case"HeritageClauseElement":return this.match(a.braceL);case"TupleElementTypes":return this.match(a.bracketR);case"TypeParametersOrArguments":return this.isRelational(">")}throw new Error("Unreachable")}tsParseList(t,e){const s=[];for(;!this.tsIsListTerminator(t);)s.push(e());return s}tsParseDelimitedList(t,e){return nonNull(this.tsParseDelimitedListWorker(t,e,!0))}tsParseDelimitedListWorker(t,e,s){const i=[];for(;!this.tsIsListTerminator(t);){const r=e();if(null==r)return;if(i.push(r),!this.eat(a.comma)){if(this.tsIsListTerminator(t))break;return void(s&&this.expect(a.comma))}}return i}tsParseBracketedList(t,e,s,i){i||(s?this.expect(a.bracketL):this.expectRelational("<"));const r=this.tsParseDelimitedList(t,e);return s?this.expect(a.bracketR):this.expectRelational(">"),r}tsParseImportType(){const t=this.startNode();return this.expect(a._import),this.expect(a.parenL),this.match(a.string)||this.raise(this.state.start,"Argument in a type import must be a string literal"),t.argument=this.parseExprAtom(),this.expect(a.parenR),this.eat(a.dot)&&(t.qualifier=this.tsParseEntityName(!0)),this.isRelational("<")&&(t.typeParameters=this.tsParseTypeArguments()),this.finishNode(t,"TSImportType")}tsParseEntityName(t){let e=this.parseIdentifier();for(;this.eat(a.dot);){const s=this.startNodeAtNode(e);s.left=e,s.right=this.parseIdentifier(t),e=this.finishNode(s,"TSQualifiedName")}return e}tsParseTypeReference(){const t=this.startNode();return t.typeName=this.tsParseEntityName(!1),!this.hasPrecedingLineBreak()&&this.isRelational("<")&&(t.typeParameters=this.tsParseTypeArguments()),this.finishNode(t,"TSTypeReference")}tsParseThisTypePredicate(t){this.next();const e=this.startNodeAtNode(t);return e.parameterName=t,e.typeAnnotation=this.tsParseTypeAnnotation(!1),this.finishNode(e,"TSTypePredicate")}tsParseThisTypeNode(){const t=this.startNode();return this.next(),this.finishNode(t,"TSThisType")}tsParseTypeQuery(){const t=this.startNode();return this.expect(a._typeof),this.match(a._import)?t.exprName=this.tsParseImportType():t.exprName=this.tsParseEntityName(!0),this.finishNode(t,"TSTypeQuery")}tsParseTypeParameter(){const t=this.startNode();return t.name=this.parseIdentifierName(t.start),t.constraint=this.tsEatThenParseType(a._extends),t.default=this.tsEatThenParseType(a.eq),this.finishNode(t,"TSTypeParameter")}tsTryParseTypeParameters(){if(this.isRelational("<"))return this.tsParseTypeParameters()}tsParseTypeParameters(){const t=this.startNode();return this.isRelational("<")||this.match(a.jsxTagStart)?this.next():this.unexpected(),t.params=this.tsParseBracketedList("TypeParametersOrArguments",this.tsParseTypeParameter.bind(this),!1,!0),this.finishNode(t,"TSTypeParameterDeclaration")}tsTryNextParseConstantContext(){return this.lookahead().type===a._const?(this.next(),this.tsParseTypeReference()):null}tsFillSignature(t,e){const s=t===a.arrow;e.typeParameters=this.tsTryParseTypeParameters(),this.expect(a.parenL),e.parameters=this.tsParseBindingListForSignature(),s?e.typeAnnotation=this.tsParseTypeOrTypePredicateAnnotation(t):this.match(t)&&(e.typeAnnotation=this.tsParseTypeOrTypePredicateAnnotation(t))}tsParseBindingListForSignature(){return this.parseBindingList(a.parenR,41).map(t=>("Identifier"!==t.type&&"RestElement"!==t.type&&"ObjectPattern"!==t.type&&"ArrayPattern"!==t.type&&this.raise(t.start,"Name in a signature must be an Identifier, ObjectPattern or ArrayPattern,"+`instead got ${t.type}`),t))}tsParseTypeMemberSemicolon(){this.eat(a.comma)||this.semicolon()}tsParseSignatureMember(t,e){return this.tsFillSignature(a.colon,e),this.tsParseTypeMemberSemicolon(),this.finishNode(e,t)}tsIsUnambiguouslyIndexSignature(){return this.next(),this.eat(a.name)&&this.match(a.colon)}tsTryParseIndexSignature(t){if(!this.match(a.bracketL)||!this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this)))return;this.expect(a.bracketL);const e=this.parseIdentifier();e.typeAnnotation=this.tsParseTypeAnnotation(),this.resetEndLocation(e),this.expect(a.bracketR),t.parameters=[e];const s=this.tsTryParseTypeAnnotation();return s&&(t.typeAnnotation=s),this.tsParseTypeMemberSemicolon(),this.finishNode(t,"TSIndexSignature")}tsParsePropertyOrMethodSignature(t,e){this.eat(a.question)&&(t.optional=!0);const s=t;if(e||!this.match(a.parenL)&&!this.isRelational("<")){const t=s;e&&(t.readonly=!0);const i=this.tsTryParseTypeAnnotation();return i&&(t.typeAnnotation=i),this.tsParseTypeMemberSemicolon(),this.finishNode(t,"TSPropertySignature")}{const t=s;return this.tsFillSignature(a.colon,t),this.tsParseTypeMemberSemicolon(),this.finishNode(t,"TSMethodSignature")}}tsParseTypeMember(){const t=this.startNode();if(this.match(a.parenL)||this.isRelational("<"))return this.tsParseSignatureMember("TSCallSignatureDeclaration",t);if(this.match(a._new)){const e=this.startNode();return this.next(),this.match(a.parenL)||this.isRelational("<")?this.tsParseSignatureMember("TSConstructSignatureDeclaration",t):(t.key=this.createIdentifier(e,"new"),this.tsParsePropertyOrMethodSignature(t,!1))}const e=!!this.tsParseModifier(["readonly"]),s=this.tsTryParseIndexSignature(t);return s?(e&&(t.readonly=!0),s):(this.parsePropertyName(t),this.tsParsePropertyOrMethodSignature(t,e))}tsParseTypeLiteral(){const t=this.startNode();return t.members=this.tsParseObjectTypeMembers(),this.finishNode(t,"TSTypeLiteral")}tsParseObjectTypeMembers(){this.expect(a.braceL);const t=this.tsParseList("TypeMembers",this.tsParseTypeMember.bind(this));return this.expect(a.braceR),t}tsIsStartOfMappedType(){return this.next(),this.eat(a.plusMin)?this.isContextual("readonly"):(this.isContextual("readonly")&&this.next(),!!this.match(a.bracketL)&&(this.next(),!!this.tsIsIdentifier()&&(this.next(),this.match(a._in))))}tsParseMappedTypeParameter(){const t=this.startNode();return t.name=this.parseIdentifierName(t.start),t.constraint=this.tsExpectThenParseType(a._in),this.finishNode(t,"TSTypeParameter")}tsParseMappedType(){const t=this.startNode();return this.expect(a.braceL),this.match(a.plusMin)?(t.readonly=this.state.value,this.next(),this.expectContextual("readonly")):this.eatContextual("readonly")&&(t.readonly=!0),this.expect(a.bracketL),t.typeParameter=this.tsParseMappedTypeParameter(),this.expect(a.bracketR),this.match(a.plusMin)?(t.optional=this.state.value,this.next(),this.expect(a.question)):this.eat(a.question)&&(t.optional=!0),t.typeAnnotation=this.tsTryParseType(),this.semicolon(),this.expect(a.braceR),this.finishNode(t,"TSMappedType")}tsParseTupleType(){const t=this.startNode();t.elementTypes=this.tsParseBracketedList("TupleElementTypes",this.tsParseTupleElementType.bind(this),!0,!1);let e=!1;return t.elementTypes.forEach(t=>{"TSOptionalType"===t.type?e=!0:e&&"TSRestType"!==t.type&&this.raise(t.start,"A required element cannot follow an optional element.")}),this.finishNode(t,"TSTupleType")}tsParseTupleElementType(){if(this.match(a.ellipsis)){const t=this.startNode();return this.next(),t.typeAnnotation=this.tsParseType(),this.checkCommaAfterRest(93),this.finishNode(t,"TSRestType")}const t=this.tsParseType();if(this.eat(a.question)){const e=this.startNodeAtNode(t);return e.typeAnnotation=t,this.finishNode(e,"TSOptionalType")}return t}tsParseParenthesizedType(){const t=this.startNode();return this.expect(a.parenL),t.typeAnnotation=this.tsParseType(),this.expect(a.parenR),this.finishNode(t,"TSParenthesizedType")}tsParseFunctionOrConstructorType(t){const e=this.startNode();return"TSConstructorType"===t&&this.expect(a._new),this.tsFillSignature(a.arrow,e),this.finishNode(e,t)}tsParseLiteralTypeNode(){const t=this.startNode();return t.literal=(()=>{switch(this.state.type){case a.num:case a.string:case a._true:case a._false:return this.parseExprAtom();default:throw this.unexpected()}})(),this.finishNode(t,"TSLiteralType")}tsParseTemplateLiteralType(){const t=this.startNode(),e=this.parseTemplate(!1);return e.expressions.length>0&&this.raise(e.expressions[0].start,"Template literal types cannot have any substitution"),t.literal=e,this.finishNode(t,"TSLiteralType")}tsParseThisTypeOrThisTypePredicate(){const t=this.tsParseThisTypeNode();return this.isContextual("is")&&!this.hasPrecedingLineBreak()?this.tsParseThisTypePredicate(t):t}tsParseNonArrayType(){switch(this.state.type){case a.name:case a._void:case a._null:{const t=this.match(a._void)?"TSVoidKeyword":this.match(a._null)?"TSNullKeyword":function keywordTypeFromName(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.state.value);if(void 0!==t&&46!==this.lookaheadCharCode()){const e=this.startNode();return this.next(),this.finishNode(e,t)}return this.tsParseTypeReference()}case a.string:case a.num:case a._true:case a._false:return this.tsParseLiteralTypeNode();case a.plusMin:if("-"===this.state.value){const t=this.startNode();if(this.lookahead().type!==a.num)throw this.unexpected();return t.literal=this.parseMaybeUnary(),this.finishNode(t,"TSLiteralType")}break;case a._this:return this.tsParseThisTypeOrThisTypePredicate();case a._typeof:return this.tsParseTypeQuery();case a._import:return this.tsParseImportType();case a.braceL:return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this))?this.tsParseMappedType():this.tsParseTypeLiteral();case a.bracketL:return this.tsParseTupleType();case a.parenL:return this.tsParseParenthesizedType();case a.backQuote:return this.tsParseTemplateLiteralType()}throw this.unexpected()}tsParseArrayTypeOrHigher(){let t=this.tsParseNonArrayType();for(;!this.hasPrecedingLineBreak()&&this.eat(a.bracketL);)if(this.match(a.bracketR)){const e=this.startNodeAtNode(t);e.elementType=t,this.expect(a.bracketR),t=this.finishNode(e,"TSArrayType")}else{const e=this.startNodeAtNode(t);e.objectType=t,e.indexType=this.tsParseType(),this.expect(a.bracketR),t=this.finishNode(e,"TSIndexedAccessType")}return t}tsParseTypeOperator(t){const e=this.startNode();return this.expectContextual(t),e.operator=t,e.typeAnnotation=this.tsParseTypeOperatorOrHigher(),"readonly"===t&&this.tsCheckTypeAnnotationForReadOnly(e),this.finishNode(e,"TSTypeOperator")}tsCheckTypeAnnotationForReadOnly(t){switch(t.typeAnnotation.type){case"TSTupleType":case"TSArrayType":return;default:this.raise(t.start,"'readonly' type modifier is only permitted on array and tuple literal types.")}}tsParseInferType(){const t=this.startNode();this.expectContextual("infer");const e=this.startNode();return e.name=this.parseIdentifierName(e.start),t.typeParameter=this.finishNode(e,"TSTypeParameter"),this.finishNode(t,"TSInferType")}tsParseTypeOperatorOrHigher(){const t=["keyof","unique","readonly"].find(t=>this.isContextual(t));return t?this.tsParseTypeOperator(t):this.isContextual("infer")?this.tsParseInferType():this.tsParseArrayTypeOrHigher()}tsParseUnionOrIntersectionType(t,e,s){this.eat(s);let i=e();if(this.match(s)){const r=[i];for(;this.eat(s);)r.push(e());const a=this.startNodeAtNode(i);a.types=r,i=this.finishNode(a,t)}return i}tsParseIntersectionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSIntersectionType",this.tsParseTypeOperatorOrHigher.bind(this),a.bitwiseAND)}tsParseUnionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSUnionType",this.tsParseIntersectionTypeOrHigher.bind(this),a.bitwiseOR)}tsIsStartOfFunctionType(){return!!this.isRelational("<")||this.match(a.parenL)&&this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this))}tsSkipParameterStart(){if(this.match(a.name)||this.match(a._this))return this.next(),!0;if(this.match(a.braceL)){let t=1;for(this.next();t>0;)this.match(a.braceL)?++t:this.match(a.braceR)&&--t,this.next();return!0}if(this.match(a.bracketL)){let t=1;for(this.next();t>0;)this.match(a.bracketL)?++t:this.match(a.bracketR)&&--t,this.next();return!0}return!1}tsIsUnambiguouslyStartOfFunctionType(){if(this.next(),this.match(a.parenR)||this.match(a.ellipsis))return!0;if(this.tsSkipParameterStart()){if(this.match(a.colon)||this.match(a.comma)||this.match(a.question)||this.match(a.eq))return!0;if(this.match(a.parenR)&&(this.next(),this.match(a.arrow)))return!0}return!1}tsParseTypeOrTypePredicateAnnotation(t){return this.tsInType(()=>{const e=this.startNode();this.expect(t);const s=this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));if(s&&this.match(a._this)){let t=this.tsParseThisTypeOrThisTypePredicate();if("TSThisType"===t.type){const s=this.startNodeAtNode(e);s.parameterName=t,s.asserts=!0,t=this.finishNode(s,"TSTypePredicate")}else t.asserts=!0;return e.typeAnnotation=t,this.finishNode(e,"TSTypeAnnotation")}const i=this.tsIsIdentifier()&&this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this));if(!i){if(!s)return this.tsParseTypeAnnotation(!1,e);const t=this.startNodeAtNode(e);return t.parameterName=this.parseIdentifier(),t.asserts=s,e.typeAnnotation=this.finishNode(t,"TSTypePredicate"),this.finishNode(e,"TSTypeAnnotation")}const r=this.tsParseTypeAnnotation(!1),n=this.startNodeAtNode(e);return n.parameterName=i,n.typeAnnotation=r,n.asserts=s,e.typeAnnotation=this.finishNode(n,"TSTypePredicate"),this.finishNode(e,"TSTypeAnnotation")})}tsTryParseTypeOrTypePredicateAnnotation(){return this.match(a.colon)?this.tsParseTypeOrTypePredicateAnnotation(a.colon):void 0}tsTryParseTypeAnnotation(){return this.match(a.colon)?this.tsParseTypeAnnotation():void 0}tsTryParseType(){return this.tsEatThenParseType(a.colon)}tsParseTypePredicatePrefix(){const t=this.parseIdentifier();if(this.isContextual("is")&&!this.hasPrecedingLineBreak())return this.next(),t}tsParseTypePredicateAsserts(){if(!this.match(a.name)||"asserts"!==this.state.value||this.hasPrecedingLineBreak())return!1;const t=this.state.containsEsc;return this.next(),!(!this.match(a.name)&&!this.match(a._this))&&(t&&this.raise(this.state.lastTokStart,"Escape sequence in keyword asserts"),!0)}tsParseTypeAnnotation(t=!0,e=this.startNode()){return this.tsInType(()=>{t&&this.expect(a.colon),e.typeAnnotation=this.tsParseType()}),this.finishNode(e,"TSTypeAnnotation")}tsParseType(){assert(this.state.inType);const t=this.tsParseNonConditionalType();if(this.hasPrecedingLineBreak()||!this.eat(a._extends))return t;const e=this.startNodeAtNode(t);return e.checkType=t,e.extendsType=this.tsParseNonConditionalType(),this.expect(a.question),e.trueType=this.tsParseType(),this.expect(a.colon),e.falseType=this.tsParseType(),this.finishNode(e,"TSConditionalType")}tsParseNonConditionalType(){return this.tsIsStartOfFunctionType()?this.tsParseFunctionOrConstructorType("TSFunctionType"):this.match(a._new)?this.tsParseFunctionOrConstructorType("TSConstructorType"):this.tsParseUnionTypeOrHigher()}tsParseTypeAssertion(){const t=this.startNode(),e=this.tsTryNextParseConstantContext();return t.typeAnnotation=e||this.tsNextThenParseType(),this.expectRelational(">"),t.expression=this.parseMaybeUnary(),this.finishNode(t,"TSTypeAssertion")}tsParseHeritageClause(t){const e=this.state.start,s=this.tsParseDelimitedList("HeritageClauseElement",this.tsParseExpressionWithTypeArguments.bind(this));return s.length||this.raise(e,`'${t}' list cannot be empty.`),s}tsParseExpressionWithTypeArguments(){const t=this.startNode();return t.expression=this.tsParseEntityName(!1),this.isRelational("<")&&(t.typeParameters=this.tsParseTypeArguments()),this.finishNode(t,"TSExpressionWithTypeArguments")}tsParseInterfaceDeclaration(t){t.id=this.parseIdentifier(),this.checkLVal(t.id,I,void 0,"typescript interface declaration"),t.typeParameters=this.tsTryParseTypeParameters(),this.eat(a._extends)&&(t.extends=this.tsParseHeritageClause("extends"));const e=this.startNode();return e.body=this.tsInType(this.tsParseObjectTypeMembers.bind(this)),t.body=this.finishNode(e,"TSInterfaceBody"),this.finishNode(t,"TSInterfaceDeclaration")}tsParseTypeAliasDeclaration(t){return t.id=this.parseIdentifier(),this.checkLVal(t.id,L,void 0,"typescript type alias"),t.typeParameters=this.tsTryParseTypeParameters(),t.typeAnnotation=this.tsExpectThenParseType(a.eq),this.semicolon(),this.finishNode(t,"TSTypeAliasDeclaration")}tsInNoContext(t){const e=this.state.context;this.state.context=[e[0]];try{return t()}finally{this.state.context=e}}tsInType(t){const e=this.state.inType;this.state.inType=!0;try{return t()}finally{this.state.inType=e}}tsEatThenParseType(t){return this.match(t)?this.tsNextThenParseType():void 0}tsExpectThenParseType(t){return this.tsDoThenParseType(()=>this.expect(t))}tsNextThenParseType(){return this.tsDoThenParseType(()=>this.next())}tsDoThenParseType(t){return this.tsInType(()=>(t(),this.tsParseType()))}tsParseEnumMember(){const t=this.startNode();return t.id=this.match(a.string)?this.parseExprAtom():this.parseIdentifier(!0),this.eat(a.eq)&&(t.initializer=this.parseMaybeAssign()),this.finishNode(t,"TSEnumMember")}tsParseEnumDeclaration(t,e){return e&&(t.const=!0),t.id=this.parseIdentifier(),this.checkLVal(t.id,e?_:M,void 0,"typescript enum declaration"),this.expect(a.braceL),t.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this)),this.expect(a.braceR),this.finishNode(t,"TSEnumDeclaration")}tsParseModuleBlock(){const t=this.startNode();return this.scope.enter(n),this.expect(a.braceL),this.parseBlockOrModuleBlockBody(t.body=[],void 0,!0,a.braceR),this.scope.exit(),this.finishNode(t,"TSModuleBlock")}tsParseModuleOrNamespaceDeclaration(t,e=!1){if(t.id=this.parseIdentifier(),e||this.checkLVal(t.id,F,null,"module or namespace declaration"),this.eat(a.dot)){const e=this.startNode();this.tsParseModuleOrNamespaceDeclaration(e,!0),t.body=e}else this.scope.enter(512),t.body=this.tsParseModuleBlock(),this.scope.exit();return this.finishNode(t,"TSModuleDeclaration")}tsParseAmbientExternalModuleDeclaration(t){return this.isContextual("global")?(t.global=!0,t.id=this.parseIdentifier()):this.match(a.string)?t.id=this.parseExprAtom():this.unexpected(),this.match(a.braceL)?(this.scope.enter(512),t.body=this.tsParseModuleBlock(),this.scope.exit()):this.semicolon(),this.finishNode(t,"TSModuleDeclaration")}tsParseImportEqualsDeclaration(t,e){return t.isExport=e||!1,t.id=this.parseIdentifier(),this.checkLVal(t.id,N,void 0,"import equals declaration"),this.expect(a.eq),t.moduleReference=this.tsParseModuleReference(),this.semicolon(),this.finishNode(t,"TSImportEqualsDeclaration")}tsIsExternalModuleReference(){return this.isContextual("require")&&40===this.lookaheadCharCode()}tsParseModuleReference(){return this.tsIsExternalModuleReference()?this.tsParseExternalModuleReference():this.tsParseEntityName(!1)}tsParseExternalModuleReference(){const t=this.startNode();if(this.expectContextual("require"),this.expect(a.parenL),!this.match(a.string))throw this.unexpected();return t.expression=this.parseExprAtom(),this.expect(a.parenR),this.finishNode(t,"TSExternalModuleReference")}tsLookAhead(t){const e=this.state.clone(),s=t();return this.state=e,s}tsTryParseAndCatch(t){const e=this.tryParse(e=>t()||e());if(!e.aborted&&e.node)return e.error&&(this.state=e.failState),e.node}tsTryParse(t){const e=this.state.clone(),s=t();return void 0!==s&&!1!==s?s:void(this.state=e)}tsTryParseDeclare(t){if(this.isLineTerminator())return;let e,s=this.state.type;switch(this.isContextual("let")&&(s=a._var,e="let"),s){case a._function:return this.parseFunctionStatement(t,!1,!0);case a._class:return t.declare=!0,this.parseClass(t,!0,!1);case a._const:if(this.match(a._const)&&this.isLookaheadContextual("enum"))return this.expect(a._const),this.expectContextual("enum"),this.tsParseEnumDeclaration(t,!0);case a._var:return e=e||this.state.value,this.parseVarStatement(t,e);case a.name:{const e=this.state.value;return"global"===e?this.tsParseAmbientExternalModuleDeclaration(t):this.tsParseDeclaration(t,e,!0)}}}tsTryParseExportDeclaration(){return this.tsParseDeclaration(this.startNode(),this.state.value,!0)}tsParseExpressionStatement(t,e){switch(e.name){case"declare":{const e=this.tsTryParseDeclare(t);if(e)return e.declare=!0,e;break}case"global":if(this.match(a.braceL)){this.scope.enter(512);const s=t;return s.global=!0,s.id=e,s.body=this.tsParseModuleBlock(),this.scope.exit(),this.finishNode(s,"TSModuleDeclaration")}break;default:return this.tsParseDeclaration(t,e.name,!1)}}tsParseDeclaration(t,e,s){switch(e){case"abstract":if(this.tsCheckLineTerminatorAndMatch(a._class,s)){const e=t;return e.abstract=!0,s&&(this.next(),this.match(a._class)||this.unexpected(null,a._class)),this.parseClass(e,!0,!1)}break;case"enum":if(s||this.match(a.name))return s&&this.next(),this.tsParseEnumDeclaration(t,!1);break;case"interface":if(this.tsCheckLineTerminatorAndMatch(a.name,s))return s&&this.next(),this.tsParseInterfaceDeclaration(t);break;case"module":if(s&&this.next(),this.match(a.string))return this.tsParseAmbientExternalModuleDeclaration(t);if(this.tsCheckLineTerminatorAndMatch(a.name,s))return this.tsParseModuleOrNamespaceDeclaration(t);break;case"namespace":if(this.tsCheckLineTerminatorAndMatch(a.name,s))return s&&this.next(),this.tsParseModuleOrNamespaceDeclaration(t);break;case"type":if(this.tsCheckLineTerminatorAndMatch(a.name,s))return s&&this.next(),this.tsParseTypeAliasDeclaration(t)}}tsCheckLineTerminatorAndMatch(t,e){return(e||this.match(t))&&!this.isLineTerminator()}tsTryParseGenericAsyncArrowFunction(t,e){if(!this.isRelational("<"))return;const s=this.tsTryParseAndCatch(()=>{const s=this.startNodeAt(t,e);return s.typeParameters=this.tsParseTypeParameters(),super.parseFunctionParams(s),s.returnType=this.tsTryParseTypeOrTypePredicateAnnotation(),this.expect(a.arrow),s});return s?this.parseArrowExpression(s,null,!0):void 0}tsParseTypeArguments(){const t=this.startNode();return t.params=this.tsInType(()=>this.tsInNoContext(()=>(this.expectRelational("<"),this.tsParseDelimitedList("TypeParametersOrArguments",this.tsParseType.bind(this))))),this.state.exprAllowed=!1,this.expectRelational(">"),this.finishNode(t,"TSTypeParameterInstantiation")}tsIsDeclarationStart(){if(this.match(a.name))switch(this.state.value){case"abstract":case"declare":case"enum":case"interface":case"module":case"namespace":case"type":return!0}return!1}isExportDefaultSpecifier(){return!this.tsIsDeclarationStart()&&super.isExportDefaultSpecifier()}parseAssignableListItem(t,e){const s=this.state.start,i=this.state.startLoc;let r,a=!1;t&&(r=this.parseAccessModifier(),a=!!this.tsParseModifier(["readonly"]));const n=this.parseMaybeDefault();this.parseAssignableListItemTypes(n);const o=this.parseMaybeDefault(n.start,n.loc.start,n);if(r||a){const t=this.startNodeAt(s,i);return e.length&&(t.decorators=e),r&&(t.accessibility=r),a&&(t.readonly=a),"Identifier"!==o.type&&"AssignmentPattern"!==o.type&&this.raise(t.start,"A parameter property may not be declared using a binding pattern."),t.parameter=o,this.finishNode(t,"TSParameterProperty")}return e.length&&(n.decorators=e),o}parseFunctionBodyAndFinish(t,e,s=!1){this.match(a.colon)&&(t.returnType=this.tsParseTypeOrTypePredicateAnnotation(a.colon));const i="FunctionDeclaration"===e?"TSDeclareFunction":"ClassMethod"===e?"TSDeclareMethod":void 0;i&&!this.match(a.braceL)&&this.isLineTerminator()?this.finishNode(t,i):super.parseFunctionBodyAndFinish(t,e,s)}registerFunctionStatementId(t){!t.body&&t.id?this.checkLVal(t.id,D,null,"function name"):super.registerFunctionStatementId(...arguments)}parseSubscript(t,e,s,i,r){if(!this.hasPrecedingLineBreak()&&this.match(a.bang)){this.state.exprAllowed=!1,this.next();const i=this.startNodeAt(e,s);return i.expression=t,this.finishNode(i,"TSNonNullExpression")}if(this.isRelational("<")){const n=this.tsTryParseAndCatch(()=>{if(!i&&this.atPossibleAsync(t)){const t=this.tsTryParseGenericAsyncArrowFunction(e,s);if(t)return t}const n=this.startNodeAt(e,s);n.callee=t;const o=this.tsParseTypeArguments();if(o){if(!i&&this.eat(a.parenL))return n.arguments=this.parseCallExpressionArguments(a.parenR,!1),n.typeParameters=o,this.finishCallExpression(n,r.optionalChainMember);if(this.match(a.backQuote))return this.parseTaggedTemplateExpression(e,s,t,r,o)}this.unexpected()});if(n)return n}return super.parseSubscript(t,e,s,i,r)}parseNewArguments(t){if(this.isRelational("<")){const e=this.tsTryParseAndCatch(()=>{const t=this.tsParseTypeArguments();return this.match(a.parenL)||this.unexpected(),t});e&&(t.typeParameters=e)}super.parseNewArguments(t)}parseExprOp(t,e,s,i,r){if(nonNull(a._in.binop)>i&&!this.hasPrecedingLineBreak()&&this.isContextual("as")){const a=this.startNodeAt(e,s);a.expression=t;const n=this.tsTryNextParseConstantContext();return a.typeAnnotation=n||this.tsNextThenParseType(),this.finishNode(a,"TSAsExpression"),this.parseExprOp(a,e,s,i,r)}return super.parseExprOp(t,e,s,i,r)}checkReservedWord(t,e,s,i){}checkDuplicateExports(){}parseImport(t){return this.match(a.name)&&this.lookahead().type===a.eq?this.tsParseImportEqualsDeclaration(t):super.parseImport(t)}parseExport(t){if(this.match(a._import))return this.expect(a._import),this.tsParseImportEqualsDeclaration(t,!0);if(this.eat(a.eq)){const e=t;return e.expression=this.parseExpression(),this.semicolon(),this.finishNode(e,"TSExportAssignment")}if(this.eatContextual("as")){const e=t;return this.expectContextual("namespace"),e.id=this.parseIdentifier(),this.semicolon(),this.finishNode(e,"TSNamespaceExportDeclaration")}return super.parseExport(t)}isAbstractClass(){return this.isContextual("abstract")&&this.lookahead().type===a._class}parseExportDefaultExpression(){if(this.isAbstractClass()){const t=this.startNode();return this.next(),this.parseClass(t,!0,!0),t.abstract=!0,t}if("interface"===this.state.value){const t=this.tsParseDeclaration(this.startNode(),this.state.value,!0);if(t)return t}return super.parseExportDefaultExpression()}parseStatementContent(t,e){if(this.state.type===a._const){const t=this.lookahead();if(t.type===a.name&&"enum"===t.value){const t=this.startNode();return this.expect(a._const),this.expectContextual("enum"),this.tsParseEnumDeclaration(t,!0)}}return super.parseStatementContent(t,e)}parseAccessModifier(){return this.tsParseModifier(["public","protected","private"])}parseClassMember(t,e,s,i){const r=this.parseAccessModifier();r&&(e.accessibility=r),super.parseClassMember(t,e,s,i)}parseClassMemberWithIsStatic(t,e,s,i,r){const a=this.tsParseModifiers(["abstract","readonly","declare"]);Object.assign(e,a);const n=this.tsTryParseIndexSignature(e);if(n)return t.body.push(n),a.abstract&&this.raise(e.start,"Index signatures cannot have the 'abstract' modifier"),i&&this.raise(e.start,"Index signatures cannot have the 'static' modifier"),void(e.accessibility&&this.raise(e.start,`Index signatures cannot have an accessibility modifier ('${e.accessibility}')`));super.parseClassMemberWithIsStatic(t,e,s,i,r)}parsePostMemberNameModifiers(t){this.eat(a.question)&&(t.optional=!0),t.readonly&&this.match(a.parenL)&&this.raise(t.start,"Class methods cannot have the 'readonly' modifier"),t.declare&&this.match(a.parenL)&&this.raise(t.start,"Class methods cannot have the 'declare' modifier")}parseExpressionStatement(t,e){return("Identifier"===e.type?this.tsParseExpressionStatement(t,e):void 0)||super.parseExpressionStatement(t,e)}shouldParseExportDeclaration(){return!!this.tsIsDeclarationStart()||super.shouldParseExportDeclaration()}parseConditional(t,e,s,i,r){if(!r||!this.match(a.question))return super.parseConditional(t,e,s,i,r);const n=this.tryParse(()=>super.parseConditional(t,e,s,i));return n.node?(n.error&&(this.state=n.failState),n.node):(r.start=n.error.pos||this.state.start,t)}parseParenItem(t,e,s){if(t=super.parseParenItem(t,e,s),this.eat(a.question)&&(t.optional=!0,this.resetEndLocation(t)),this.match(a.colon)){const i=this.startNodeAt(e,s);return i.expression=t,i.typeAnnotation=this.tsParseTypeAnnotation(),this.finishNode(i,"TSTypeCastExpression")}return t}parseExportDeclaration(t){const e=this.state.start,s=this.state.startLoc,i=this.eatContextual("declare");let r;return this.match(a.name)&&(r=this.tsTryParseExportDeclaration()),r||(r=super.parseExportDeclaration(t)),r&&i&&(this.resetStartLocation(r,e,s),r.declare=!0),r}parseClassId(t,e,s){if((!e||s)&&this.isContextual("implements"))return;super.parseClassId(t,e,s,t.declare?D:C);const i=this.tsTryParseTypeParameters();i&&(t.typeParameters=i)}parseClassPropertyAnnotation(t){!t.optional&&this.eat(a.bang)&&(t.definite=!0);const e=this.tsTryParseTypeAnnotation();e&&(t.typeAnnotation=e)}parseClassProperty(t){return this.parseClassPropertyAnnotation(t),t.declare&&this.match(a.equal)&&this.raise(this.state.start,"'declare' class fields cannot have an initializer"),super.parseClassProperty(t)}parseClassPrivateProperty(t){return t.abstract&&this.raise(t.start,"Private elements cannot have the 'abstract' modifier."),t.accessibility&&this.raise(t.start,`Private elements cannot have an accessibility modifier ('${t.accessibility}')`),this.parseClassPropertyAnnotation(t),super.parseClassPrivateProperty(t)}pushClassMethod(t,e,s,i,r,a){const n=this.tsTryParseTypeParameters();n&&(e.typeParameters=n),super.pushClassMethod(t,e,s,i,r,a)}pushClassPrivateMethod(t,e,s,i){const r=this.tsTryParseTypeParameters();r&&(e.typeParameters=r),super.pushClassPrivateMethod(t,e,s,i)}parseClassSuper(t){super.parseClassSuper(t),t.superClass&&this.isRelational("<")&&(t.superTypeParameters=this.tsParseTypeArguments()),this.eatContextual("implements")&&(t.implements=this.tsParseHeritageClause("implements"))}parseObjPropValue(t,...e){const s=this.tsTryParseTypeParameters();s&&(t.typeParameters=s),super.parseObjPropValue(t,...e)}parseFunctionParams(t,e){const s=this.tsTryParseTypeParameters();s&&(t.typeParameters=s),super.parseFunctionParams(t,e)}parseVarId(t,e){super.parseVarId(t,e),"Identifier"===t.id.type&&this.eat(a.bang)&&(t.definite=!0);const s=this.tsTryParseTypeAnnotation();s&&(t.id.typeAnnotation=s,this.resetEndLocation(t.id))}parseAsyncArrowFromCallExpression(t,e){return this.match(a.colon)&&(t.returnType=this.tsParseTypeAnnotation()),super.parseAsyncArrowFromCallExpression(t,e)}parseMaybeAssign(...t){let e,s,i,r;if(this.match(a.jsxTagStart)){if(e=this.state.clone(),!(s=this.tryParse(()=>super.parseMaybeAssign(...t),e)).error)return s.node;const{context:i}=this.state;i[i.length-1]===U.j_oTag?i.length-=2:i[i.length-1]===U.j_expr&&(i.length-=1)}if(!(s&&s.error||this.isRelational("<")))return super.parseMaybeAssign(...t);e=e||this.state.clone();const n=this.tryParse(e=>{r=this.tsParseTypeParameters();const s=super.parseMaybeAssign(...t);return("ArrowFunctionExpression"!==s.type||s.extra&&s.extra.parenthesized)&&e(),r&&0!==r.params.length&&this.resetStartLocationFromNode(s,r),s.typeParameters=r,s},e);if(!n.error&&!n.aborted)return n.node;if(!s&&(assert(!this.hasPlugin("jsx")),!(i=this.tryParse(()=>super.parseMaybeAssign(...t),e)).error))return i.node;if(s&&s.node)return this.state=s.failState,s.node;if(n.node)return this.state=n.failState,n.node;if(i&&i.node)return this.state=i.failState,i.node;if(s&&s.thrown)throw s.error;if(n.thrown)throw n.error;if(i&&i.thrown)throw i.error;throw s&&s.error||n.error||i&&i.error}parseMaybeUnary(t){return!this.hasPlugin("jsx")&&this.isRelational("<")?this.tsParseTypeAssertion():super.parseMaybeUnary(t)}parseArrow(t){if(this.match(a.colon)){const e=this.tryParse(t=>{const e=this.tsParseTypeOrTypePredicateAnnotation(a.colon);return!this.canInsertSemicolon()&&this.match(a.arrow)||t(),e});if(e.aborted)return;e.thrown||(e.error&&(this.state=e.failState),t.returnType=e.node)}return super.parseArrow(t)}parseAssignableListItemTypes(t){this.eat(a.question)&&("Identifier"!==t.type&&this.raise(t.start,"A binding pattern parameter cannot be optional in an implementation signature."),t.optional=!0);const e=this.tsTryParseTypeAnnotation();return e&&(t.typeAnnotation=e),this.resetEndLocation(t),t}toAssignable(t,e,s){switch(t.type){case"TSTypeCastExpression":return super.toAssignable(this.typeCastToParameter(t),e,s);case"TSParameterProperty":return super.toAssignable(t,e,s);case"TSAsExpression":case"TSNonNullExpression":case"TSTypeAssertion":return t.expression=this.toAssignable(t.expression,e,s),t;default:return super.toAssignable(t,e,s)}}checkLVal(t,e=O,s,i){switch(t.type){case"TSTypeCastExpression":return;case"TSParameterProperty":return void this.checkLVal(t.parameter,e,s,"parameter property");case"TSAsExpression":case"TSNonNullExpression":case"TSTypeAssertion":return void this.checkLVal(t.expression,e,s,i);default:return void super.checkLVal(t,e,s,i)}}parseBindingAtom(){switch(this.state.type){case a._this:return this.parseIdentifier(!0);default:return super.parseBindingAtom()}}parseMaybeDecoratorArguments(t){if(this.isRelational("<")){const e=this.tsParseTypeArguments();if(this.match(a.parenL)){const s=super.parseMaybeDecoratorArguments(t);return s.typeParameters=e,s}this.unexpected(this.state.start,a.parenL)}return super.parseMaybeDecoratorArguments(t)}isClassMethod(){return this.isRelational("<")||super.isClassMethod()}isClassProperty(){return this.match(a.bang)||this.match(a.colon)||super.isClassProperty()}parseMaybeDefault(...t){const e=super.parseMaybeDefault(...t);return"AssignmentPattern"===e.type&&e.typeAnnotation&&e.right.start<e.typeAnnotation.start&&this.raise(e.typeAnnotation.start,"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`"),e}getTokenFromCode(t){return!this.state.inType||62!==t&&60!==t?super.getTokenFromCode(t):this.finishOp(a.relational,1)}toAssignableList(t,e){for(let s=0;s<t.length;s++){const i=t[s];if(i)switch(i.type){case"TSTypeCastExpression":t[s]=this.typeCastToParameter(i);break;case"TSAsExpression":case"TSTypeAssertion":e?this.raise(i.start,"Unexpected type cast in parameter position."):t[s]=this.typeCastToParameter(i)}}return super.toAssignableList(...arguments)}typeCastToParameter(t){return t.expression.typeAnnotation=t.typeAnnotation,this.resetEndLocation(t.expression,t.typeAnnotation.end,t.typeAnnotation.loc.end),t.expression}toReferencedList(t,e){for(let e=0;e<t.length;e++){const s=t[e];s&&s._exprListItem&&"TsTypeCastExpression"===s.type&&this.raise(s.start,"Did not expect a type annotation here.")}return t}shouldParseArrow(){return this.match(a.colon)||super.shouldParseArrow()}shouldParseAsyncArrow(){return this.match(a.colon)||super.shouldParseAsyncArrow()}canHaveLeadingDecorator(){return super.canHaveLeadingDecorator()||this.isAbstractClass()}jsxParseOpeningElementAfterName(t){if(this.isRelational("<")){const e=this.tsTryParseAndCatch(()=>this.tsParseTypeArguments());e&&(t.typeParameters=e)}return super.jsxParseOpeningElementAfterName(t)}getGetterSetterExpectedParamCount(t){const e=super.getGetterSetterExpectedParamCount(t),s=t.params[0];return s&&"Identifier"===s.type&&"this"===s.name?e+1:e}}),v8intrinsic:t=>(class extends t{parseV8Intrinsic(){if(this.match(a.modulo)){const t=this.state.start,e=this.startNode();if(this.eat(a.modulo),this.match(a.name)){const t=this.parseIdentifierName(this.state.start),s=this.createIdentifier(e,t);if(s.type="V8IntrinsicIdentifier",this.match(a.parenL))return s}this.unexpected(t)}}parseExprAtom(){return this.parseV8Intrinsic()||super.parseExprAtom(...arguments)}}),placeholders:t=>(class extends t{parsePlaceholder(t){if(this.match(a.placeholder)){const e=this.startNode();return this.next(),this.assertNoSpace("Unexpected space in placeholder."),e.name=super.parseIdentifier(!0),this.assertNoSpace("Unexpected space in placeholder."),this.expect(a.placeholder),this.finishPlaceholder(e,t)}}finishPlaceholder(t,e){const s=!(!t.expectedNode||"Placeholder"!==t.type);return t.expectedNode=e,s?t:this.finishNode(t,"Placeholder")}getTokenFromCode(t){return 37===t&&37===this.input.charCodeAt(this.state.pos+1)?this.finishOp(a.placeholder,2):super.getTokenFromCode(...arguments)}parseExprAtom(){return this.parsePlaceholder("Expression")||super.parseExprAtom(...arguments)}parseIdentifier(){return this.parsePlaceholder("Identifier")||super.parseIdentifier(...arguments)}checkReservedWord(t){void 0!==t&&super.checkReservedWord(...arguments)}parseBindingAtom(){return this.parsePlaceholder("Pattern")||super.parseBindingAtom(...arguments)}checkLVal(t){"Placeholder"!==t.type&&super.checkLVal(...arguments)}toAssignable(t){return t&&"Placeholder"===t.type&&"Expression"===t.expectedNode?(t.expectedNode="Pattern",t):super.toAssignable(...arguments)}verifyBreakContinue(t){t.label&&"Placeholder"===t.label.type||super.verifyBreakContinue(...arguments)}parseExpressionStatement(t,e){if("Placeholder"!==e.type||e.extra&&e.extra.parenthesized)return super.parseExpressionStatement(...arguments);if(this.match(a.colon)){const s=t;return s.label=this.finishPlaceholder(e,"Identifier"),this.next(),s.body=this.parseStatement("label"),this.finishNode(s,"LabeledStatement")}return this.semicolon(),t.name=e.name,this.finishPlaceholder(t,"Statement")}parseBlock(){return this.parsePlaceholder("BlockStatement")||super.parseBlock(...arguments)}parseFunctionId(){return this.parsePlaceholder("Identifier")||super.parseFunctionId(...arguments)}parseClass(t,e,s){const i=e?"ClassDeclaration":"ClassExpression";this.next(),this.takeDecorators(t);const r=this.parsePlaceholder("Identifier");if(r)if(this.match(a._extends)||this.match(a.placeholder)||this.match(a.braceL))t.id=r;else{if(s||!e)return t.id=null,t.body=this.finishPlaceholder(r,"ClassBody"),this.finishNode(t,i);this.unexpected(null,"A class name is required")}else this.parseClassId(t,e,s);return this.parseClassSuper(t),t.body=this.parsePlaceholder("ClassBody")||this.parseClassBody(!!t.superClass),this.finishNode(t,i)}parseExport(t){const e=this.parsePlaceholder("Identifier");if(!e)return super.parseExport(...arguments);if(!this.isContextual("from")&&!this.match(a.comma))return t.specifiers=[],t.source=null,t.declaration=this.finishPlaceholder(e,"Declaration"),this.finishNode(t,"ExportNamedDeclaration");this.expectPlugin("exportDefaultFrom");const s=this.startNode();return s.exported=e,t.specifiers=[this.finishNode(s,"ExportDefaultSpecifier")],super.parseExport(t)}maybeParseExportDefaultSpecifier(t){return!!(t.specifiers&&t.specifiers.length>0)||super.maybeParseExportDefaultSpecifier(...arguments)}checkExport(t){const{specifiers:e}=t;e&&e.length&&(t.specifiers=e.filter(t=>"Placeholder"===t.exported.type)),super.checkExport(t),t.specifiers=e}parseImport(t){const e=this.parsePlaceholder("Identifier");if(!e)return super.parseImport(...arguments);if(t.specifiers=[],!this.isContextual("from")&&!this.match(a.comma))return t.source=this.finishPlaceholder(e,"StringLiteral"),this.semicolon(),this.finishNode(t,"ImportDeclaration");const s=this.startNodeAtNode(e);if(s.local=e,this.finishNode(s,"ImportDefaultSpecifier"),t.specifiers.push(s),this.eat(a.comma)){this.maybeParseStarImportSpecifier(t)||this.parseNamedImportSpecifiers(t)}return this.expectContextual("from"),t.source=this.parseImportSource(),this.semicolon(),this.finishNode(t,"ImportDeclaration")}parseImportSource(){return this.parsePlaceholder("StringLiteral")||super.parseImportSource(...arguments)}})},nt=Object.keys(at),ot={sourceType:"script",sourceFilename:void 0,startLine:1,allowAwaitOutsideFunction:!1,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowSuperOutsideMethod:!1,allowUndeclaredExports:!1,plugins:[],strictMode:null,ranges:!1,tokens:!1,createParenthesizedExpressions:!1,errorRecovery:!1};class Position{constructor(t,e){this.line=t,this.column=e}}class SourceLocation{constructor(t,e){this.start=t,this.end=e}}class BaseParser{constructor(){this.sawUnambiguousESM=!1,this.ambiguousScriptDifferentAst=!1}hasPlugin(t){return this.plugins.has(t)}getPluginOption(t,e){if(this.hasPlugin(t))return this.plugins.get(t)[e]}}function last(t){return t[t.length-1]}class CommentsParser extends BaseParser{addComment(t){this.filename&&(t.loc.filename=this.filename),this.state.trailingComments.push(t),this.state.leadingComments.push(t)}adjustCommentsAfterTrailingComma(t,e,s){if(0===this.state.leadingComments.length)return;let i=null,r=e.length;for(;null===i&&r>0;)i=e[--r];if(null===i)return;for(let t=0;t<this.state.leadingComments.length;t++)this.state.leadingComments[t].end<this.state.commentPreviousNode.end&&(this.state.leadingComments.splice(t,1),t--);const a=[];for(let e=0;e<this.state.leadingComments.length;e++){const i=this.state.leadingComments[e];i.end<t.end?(a.push(i),s||(this.state.leadingComments.splice(e,1),e--)):(void 0===t.trailingComments&&(t.trailingComments=[]),t.trailingComments.push(i))}s&&(this.state.leadingComments=[]),a.length>0?i.trailingComments=a:void 0!==i.trailingComments&&(i.trailingComments=[])}processComment(t){if("Program"===t.type&&t.body.length>0)return;const e=this.state.commentStack;let s,i,r,a,n;if(this.state.trailingComments.length>0)this.state.trailingComments[0].start>=t.end?(r=this.state.trailingComments,this.state.trailingComments=[]):this.state.trailingComments.length=0;else if(e.length>0){const s=last(e);s.trailingComments&&s.trailingComments[0].start>=t.end&&(r=s.trailingComments,delete s.trailingComments)}for(e.length>0&&last(e).start>=t.start&&(s=e.pop());e.length>0&&last(e).start>=t.start;)i=e.pop();if(!i&&s&&(i=s),s)switch(t.type){case"ObjectExpression":this.adjustCommentsAfterTrailingComma(t,t.properties);break;case"ObjectPattern":this.adjustCommentsAfterTrailingComma(t,t.properties,!0);break;case"CallExpression":this.adjustCommentsAfterTrailingComma(t,t.arguments);break;case"ArrayExpression":this.adjustCommentsAfterTrailingComma(t,t.elements);break;case"ArrayPattern":this.adjustCommentsAfterTrailingComma(t,t.elements,!0)}else this.state.commentPreviousNode&&("ImportSpecifier"===this.state.commentPreviousNode.type&&"ImportSpecifier"!==t.type||"ExportSpecifier"===this.state.commentPreviousNode.type&&"ExportSpecifier"!==t.type)&&this.adjustCommentsAfterTrailingComma(t,[this.state.commentPreviousNode],!0);if(i){if(i.leadingComments)if(i!==t&&i.leadingComments.length>0&&last(i.leadingComments).end<=t.start)t.leadingComments=i.leadingComments,delete i.leadingComments;else for(a=i.leadingComments.length-2;a>=0;--a)if(i.leadingComments[a].end<=t.start){t.leadingComments=i.leadingComments.splice(0,a+1);break}}else if(this.state.leadingComments.length>0)if(last(this.state.leadingComments).end<=t.start){if(this.state.commentPreviousNode)for(n=0;n<this.state.leadingComments.length;n++)this.state.leadingComments[n].end<this.state.commentPreviousNode.end&&(this.state.leadingComments.splice(n,1),n--);this.state.leadingComments.length>0&&(t.leadingComments=this.state.leadingComments,this.state.leadingComments=[])}else{for(a=0;a<this.state.leadingComments.length&&!(this.state.leadingComments[a].end>t.start);a++);const e=this.state.leadingComments.slice(0,a);e.length&&(t.leadingComments=e),0===(r=this.state.leadingComments.slice(a)).length&&(r=null)}this.state.commentPreviousNode=t,r&&(r.length&&r[0].start>=t.start&&last(r).end<=t.end?t.innerComments=r:t.trailingComments=r),e.push(t)}}class LocationParser extends CommentsParser{getLocationForPosition(t){let e;return e=t===this.state.start?this.state.startLoc:t===this.state.lastTokStart?this.state.lastTokStartLoc:t===this.state.end?this.state.endLoc:t===this.state.lastTokEnd?this.state.lastTokEndLoc:function getLineInfo(t,e){let s,i=1,r=0;for(j.lastIndex=0;(s=j.exec(t))&&s.index<e;)i++,r=j.lastIndex;return new Position(i,e-r)}(this.input,t)}raise(t,e,{missingPluginNames:s,code:i}={}){const r=this.getLocationForPosition(t);e+=` (${r.line}:${r.column})`;const a=new SyntaxError(e);if(a.pos=t,a.loc=r,s&&(a.missingPlugin=s),void 0!==i&&(a.code=i),this.options.errorRecovery)return this.isLookahead||this.state.errors.push(a),a;throw a}}class State{constructor(){this.errors=[],this.potentialArrowAt=-1,this.noArrowAt=[],this.noArrowParamsConversionAt=[],this.inParameters=!1,this.maybeInArrowParameters=!1,this.inPipeline=!1,this.inType=!1,this.noAnonFunctionType=!1,this.inPropertyName=!1,this.inClassProperty=!1,this.hasFlowComment=!1,this.isIterator=!1,this.topicContext={maxNumOfResolvableTopics:0,maxTopicIndex:null},this.soloAwait=!1,this.inFSharpPipelineDirectBody=!1,this.classLevel=0,this.labels=[],this.decoratorStack=[[]],this.yieldPos=-1,this.awaitPos=-1,this.tokens=[],this.comments=[],this.trailingComments=[],this.leadingComments=[],this.commentStack=[],this.commentPreviousNode=null,this.pos=0,this.lineStart=0,this.type=a.eof,this.value=null,this.start=0,this.end=0,this.lastTokEndLoc=null,this.lastTokStartLoc=null,this.lastTokStart=0,this.lastTokEnd=0,this.context=[U.braceStatement],this.exprAllowed=!0,this.containsEsc=!1,this.containsOctal=!1,this.octalPosition=null,this.exportedIdentifiers=[],this.invalidTemplateEscapePosition=null}init(t){this.strict=!1!==t.strictMode&&"module"===t.sourceType,this.curLine=t.startLine,this.startLoc=this.endLoc=this.curPosition()}curPosition(){return new Position(this.curLine,this.pos-this.lineStart)}clone(t){const e=new State,s=Object.keys(this);for(let i=0,r=s.length;i<r;i++){const r=s[i];let a=this[r];!t&&Array.isArray(a)&&(a=a.slice()),e[r]=a}return e}}var ht=function isDigit(t){return t>=48&&t<=57};const pt=new Set(["g","m","s","i","y","u"]),ct={decBinOct:[46,66,69,79,95,98,101,111],hex:[46,88,95,120]},lt={bin:[48,49]};lt.oct=[...lt.bin,50,51,52,53,54,55],lt.dec=[...lt.oct,56,57],lt.hex=[...lt.dec,65,66,67,68,69,70,97,98,99,100,101,102];class Token{constructor(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,this.loc=new SourceLocation(t.startLoc,t.endLoc)}}class Tokenizer extends LocationParser{constructor(t,e){super(),this.state=new State,this.state.init(t),this.input=e,this.length=e.length,this.isLookahead=!1}next(){this.isLookahead||(this.checkKeywordEscapes(),this.options.tokens&&this.state.tokens.push(new Token(this.state))),this.state.lastTokEnd=this.state.end,this.state.lastTokStart=this.state.start,this.state.lastTokEndLoc=this.state.endLoc,this.state.lastTokStartLoc=this.state.startLoc,this.nextToken()}eat(t){return!!this.match(t)&&(this.next(),!0)}match(t){return this.state.type===t}lookahead(){const t=this.state;this.state=t.clone(!0),this.isLookahead=!0,this.next(),this.isLookahead=!1;const e=this.state;return this.state=t,e}nextTokenStart(){const t=this.state.pos;return q.lastIndex=t,t+q.exec(this.input)[0].length}lookaheadCharCode(){return this.input.charCodeAt(this.nextTokenStart())}setStrict(t){if(this.state.strict=t,this.match(a.num)||this.match(a.string)){for(this.state.pos=this.state.start;this.state.pos<this.state.lineStart;)this.state.lineStart=this.input.lastIndexOf("\n",this.state.lineStart-2)+1,--this.state.curLine;this.nextToken()}}curContext(){return this.state.context[this.state.context.length-1]}nextToken(){const t=this.curContext();t&&t.preserveSpace||this.skipSpace(),this.state.containsOctal=!1,this.state.octalPosition=null,this.state.start=this.state.pos,this.state.startLoc=this.state.curPosition(),this.state.pos>=this.length?this.finishToken(a.eof):t.override?t.override(this):this.getTokenFromCode(this.input.codePointAt(this.state.pos))}pushComment(t,e,s,i,r,a){const n={type:t?"CommentBlock":"CommentLine",value:e,start:s,end:i,loc:new SourceLocation(r,a)};this.options.tokens&&this.state.tokens.push(n),this.state.comments.push(n),this.addComment(n)}skipBlockComment(){const t=this.state.curPosition(),e=this.state.pos,s=this.input.indexOf("*/",this.state.pos+2);if(-1===s)throw this.raise(e,"Unterminated comment");let i;for(this.state.pos=s+2,j.lastIndex=e;(i=j.exec(this.input))&&i.index<this.state.pos;)++this.state.curLine,this.state.lineStart=i.index+i[0].length;this.isLookahead||this.pushComment(!0,this.input.slice(e+2,s),e,this.state.pos,t,this.state.curPosition())}skipLineComment(t){const e=this.state.pos,s=this.state.curPosition();let i=this.input.charCodeAt(this.state.pos+=t);if(this.state.pos<this.length)for(;!isNewLine(i)&&++this.state.pos<this.length;)i=this.input.charCodeAt(this.state.pos);this.isLookahead||this.pushComment(!1,this.input.slice(e+t,this.state.pos),e,this.state.pos,s,this.state.curPosition())}skipSpace(){t:for(;this.state.pos<this.length;){const t=this.input.charCodeAt(this.state.pos);switch(t){case 32:case 160:case 9:++this.state.pos;break;case 13:10===this.input.charCodeAt(this.state.pos+1)&&++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:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break t}break;default:if(!isWhitespace(t))break t;++this.state.pos}}}finishToken(t,e){this.state.end=this.state.pos,this.state.endLoc=this.state.curPosition();const s=this.state.type;this.state.type=t,this.state.value=e,this.isLookahead||this.updateContext(s)}readToken_numberSign(){if(0===this.state.pos&&this.readToken_interpreter())return;const t=this.state.pos+1,e=this.input.charCodeAt(t);if(e>=48&&e<=57)throw this.raise(this.state.pos,"Unexpected digit after hash token");if((this.hasPlugin("classPrivateProperties")||this.hasPlugin("classPrivateMethods"))&&this.state.classLevel>0)return++this.state.pos,void this.finishToken(a.hash);if("smart"!==this.getPluginOption("pipelineOperator","proposal"))throw this.raise(this.state.pos,"Unexpected character '#'");this.finishOp(a.hash,1)}readToken_dot(){const t=this.input.charCodeAt(this.state.pos+1);t>=48&&t<=57?this.readNumber(!0):46===t&&46===this.input.charCodeAt(this.state.pos+2)?(this.state.pos+=3,this.finishToken(a.ellipsis)):(++this.state.pos,this.finishToken(a.dot))}readToken_slash(){if(this.state.exprAllowed&&!this.state.inType)return++this.state.pos,void this.readRegexp();61===this.input.charCodeAt(this.state.pos+1)?this.finishOp(a.assign,2):this.finishOp(a.slash,1)}readToken_interpreter(){if(0!==this.state.pos||this.length<2)return!1;const t=this.state.pos;this.state.pos+=1;let e=this.input.charCodeAt(this.state.pos);if(33!==e)return!1;for(;!isNewLine(e)&&++this.state.pos<this.length;)e=this.input.charCodeAt(this.state.pos);const s=this.input.slice(t+2,this.state.pos);return this.finishToken(a.interpreterDirective,s),!0}readToken_mult_modulo(t){let e=42===t?a.star:a.modulo,s=1,i=this.input.charCodeAt(this.state.pos+1);const r=this.state.exprAllowed;42===t&&42===i&&(s++,i=this.input.charCodeAt(this.state.pos+2),e=a.exponent),61!==i||r||(s++,e=a.assign),this.finishOp(e,s)}readToken_pipe_amp(t){const e=this.input.charCodeAt(this.state.pos+1);e!==t?124!==t||62!==e?61!==e?this.finishOp(124===t?a.bitwiseOR:a.bitwiseAND,1):this.finishOp(a.assign,2):this.finishOp(a.pipeline,2):61===this.input.charCodeAt(this.state.pos+2)?this.finishOp(a.assign,3):this.finishOp(124===t?a.logicalOR:a.logicalAND,2)}readToken_caret(){61===this.input.charCodeAt(this.state.pos+1)?this.finishOp(a.assign,2):this.finishOp(a.bitwiseXOR,1)}readToken_plus_min(t){const e=this.input.charCodeAt(this.state.pos+1);if(e===t)return 45!==e||this.inModule||62!==this.input.charCodeAt(this.state.pos+2)||0!==this.state.lastTokEnd&&!B.test(this.input.slice(this.state.lastTokEnd,this.state.pos))?void this.finishOp(a.incDec,2):(this.skipLineComment(3),this.skipSpace(),void this.nextToken());61===e?this.finishOp(a.assign,2):this.finishOp(a.plusMin,1)}readToken_lt_gt(t){const e=this.input.charCodeAt(this.state.pos+1);let s=1;return e===t?(s=62===t&&62===this.input.charCodeAt(this.state.pos+2)?3:2,61===this.input.charCodeAt(this.state.pos+s)?void this.finishOp(a.assign,s+1):void this.finishOp(a.bitShift,s)):33!==e||60!==t||this.inModule||45!==this.input.charCodeAt(this.state.pos+2)||45!==this.input.charCodeAt(this.state.pos+3)?(61===e&&(s=2),void this.finishOp(a.relational,s)):(this.skipLineComment(4),this.skipSpace(),void this.nextToken())}readToken_eq_excl(t){const e=this.input.charCodeAt(this.state.pos+1);if(61!==e)return 61===t&&62===e?(this.state.pos+=2,void this.finishToken(a.arrow)):void this.finishOp(61===t?a.eq:a.bang,1);this.finishOp(a.equality,61===this.input.charCodeAt(this.state.pos+2)?3:2)}readToken_question(){const t=this.input.charCodeAt(this.state.pos+1),e=this.input.charCodeAt(this.state.pos+2);63!==t||this.state.inType?46!==t||e>=48&&e<=57?(++this.state.pos,this.finishToken(a.question)):(this.state.pos+=2,this.finishToken(a.questionDot)):61===e?this.finishOp(a.assign,3):this.finishOp(a.nullishCoalescing,2)}getTokenFromCode(t){switch(t){case 46:return void this.readToken_dot();case 40:return++this.state.pos,void this.finishToken(a.parenL);case 41:return++this.state.pos,void this.finishToken(a.parenR);case 59:return++this.state.pos,void this.finishToken(a.semi);case 44:return++this.state.pos,void this.finishToken(a.comma);case 91:return++this.state.pos,void this.finishToken(a.bracketL);case 93:return++this.state.pos,void this.finishToken(a.bracketR);case 123:return++this.state.pos,void this.finishToken(a.braceL);case 125:return++this.state.pos,void this.finishToken(a.braceR);case 58:return void(this.hasPlugin("functionBind")&&58===this.input.charCodeAt(this.state.pos+1)?this.finishOp(a.doubleColon,2):(++this.state.pos,this.finishToken(a.colon)));case 63:return void this.readToken_question();case 96:return++this.state.pos,void this.finishToken(a.backQuote);case 48:{const t=this.input.charCodeAt(this.state.pos+1);if(120===t||88===t)return void this.readRadixNumber(16);if(111===t||79===t)return void this.readRadixNumber(8);if(98===t||66===t)return void this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return void this.readNumber(!1);case 34:case 39:return void this.readString(t);case 47:return void this.readToken_slash();case 37:case 42:return void this.readToken_mult_modulo(t);case 124:case 38:return void this.readToken_pipe_amp(t);case 94:return void this.readToken_caret();case 43:case 45:return void this.readToken_plus_min(t);case 60:case 62:return void this.readToken_lt_gt(t);case 61:case 33:return void this.readToken_eq_excl(t);case 126:return void this.finishOp(a.tilde,1);case 64:return++this.state.pos,void this.finishToken(a.at);case 35:return void this.readToken_numberSign();case 92:return void this.readWord();default:if(isIdentifierStart(t))return void this.readWord()}throw this.raise(this.state.pos,`Unexpected character '${String.fromCodePoint(t)}'`)}finishOp(t,e){const s=this.input.slice(this.state.pos,this.state.pos+e);this.state.pos+=e,this.finishToken(t,s)}readRegexp(){const t=this.state.pos;let e,s;for(;;){if(this.state.pos>=this.length)throw this.raise(t,"Unterminated regular expression");const i=this.input.charAt(this.state.pos);if(B.test(i))throw this.raise(t,"Unterminated regular expression");if(e)e=!1;else{if("["===i)s=!0;else if("]"===i&&s)s=!1;else if("/"===i&&!s)break;e="\\"===i}++this.state.pos}const i=this.input.slice(t,this.state.pos);++this.state.pos;let r="";for(;this.state.pos<this.length;){const t=this.input[this.state.pos],e=this.input.codePointAt(this.state.pos);if(pt.has(t))r.indexOf(t)>-1&&this.raise(this.state.pos+1,"Duplicate regular expression flag");else{if(!isIdentifierChar(e)&&92!==e)break;this.raise(this.state.pos+1,"Invalid regular expression flag")}++this.state.pos,r+=t}this.finishToken(a.regexp,{pattern:i,flags:r})}readInt(t,e,s,i=!0){const r=this.state.pos,a=16===t?ct.hex:ct.decBinOct,n=16===t?lt.hex:10===t?lt.dec:8===t?lt.oct:lt.bin;let o=!1,h=0;for(let r=0,p=null==e?1/0:e;r<p;++r){const e=this.input.charCodeAt(this.state.pos);let p;if(this.hasPlugin("numericSeparator")&&95===e){const t=this.input.charCodeAt(this.state.pos-1),e=this.input.charCodeAt(this.state.pos+1);-1===n.indexOf(e)?this.raise(this.state.pos,"A numeric separator is only allowed between two digits"):(a.indexOf(t)>-1||a.indexOf(e)>-1||Number.isNaN(e))&&this.raise(this.state.pos,"A numeric separator is only allowed between two digits"),i||this.raise(this.state.pos,"Numeric separators are not allowed inside unicode escape sequences or hex escape sequences"),++this.state.pos}else{if((p=e>=97?e-97+10:e>=65?e-65+10:ht(e)?e-48:1/0)>=t)if(this.options.errorRecovery&&p<=9)p=0,this.raise(this.state.start+r+2,"Expected number in radix "+t);else{if(!s)break;p=0,o=!0}++this.state.pos,h=h*t+p}}return this.state.pos===r||null!=e&&this.state.pos-r!==e||o?null:h}readRadixNumber(t){const e=this.state.pos;let s=!1;this.state.pos+=2;const i=this.readInt(t);if(null==i&&this.raise(this.state.start+2,"Expected number in radix "+t),this.hasPlugin("bigInt")&&110===this.input.charCodeAt(this.state.pos)&&(++this.state.pos,s=!0),isIdentifierStart(this.input.codePointAt(this.state.pos)))throw this.raise(this.state.pos,"Identifier directly after number");if(s){const t=this.input.slice(e,this.state.pos).replace(/[_n]/g,"");this.finishToken(a.bigint,t)}else this.finishToken(a.num,i)}readNumber(t){const e=this.state.pos;let s=!1,i=!1,r=!1;t||null!==this.readInt(10)||this.raise(e,"Invalid number");let n=this.state.pos-e>=2&&48===this.input.charCodeAt(e);n&&(this.state.strict&&this.raise(e,"Legacy octal literals are not allowed in strict mode"),/[89]/.test(this.input.slice(e,this.state.pos))&&(n=!1,r=!0));let o=this.input.charCodeAt(this.state.pos);if(46!==o||n||(++this.state.pos,this.readInt(10),s=!0,o=this.input.charCodeAt(this.state.pos)),69!==o&&101!==o||n||(43!==(o=this.input.charCodeAt(++this.state.pos))&&45!==o||++this.state.pos,null===this.readInt(10)&&this.raise(e,"Invalid number"),s=!0,o=this.input.charCodeAt(this.state.pos)),this.hasPlugin("numericSeparator")&&(n||r)){const t=this.input.slice(e,this.state.pos).indexOf("_");t>0&&this.raise(t+e,"Numeric separator can not be used after leading 0")}if(this.hasPlugin("bigInt")&&110===o&&((s||n||r)&&this.raise(e,"Invalid BigIntLiteral"),++this.state.pos,i=!0),isIdentifierStart(this.input.codePointAt(this.state.pos)))throw this.raise(this.state.pos,"Identifier directly after number");const h=this.input.slice(e,this.state.pos).replace(/[_n]/g,"");if(i)return void this.finishToken(a.bigint,h);const p=n?parseInt(h,8):parseFloat(h);this.finishToken(a.num,p)}readCodePoint(t){let e;if(123===this.input.charCodeAt(this.state.pos)){const s=++this.state.pos;if(e=this.readHexChar(this.input.indexOf("}",this.state.pos)-this.state.pos,!0,t),++this.state.pos,null===e)--this.state.invalidTemplateEscapePosition;else if(e>1114111){if(!t)return this.state.invalidTemplateEscapePosition=s-2,null;this.raise(s,"Code point out of bounds")}}else e=this.readHexChar(4,!1,t);return e}readString(t){let e="",s=++this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(this.state.start,"Unterminated string constant");const i=this.input.charCodeAt(this.state.pos);if(i===t)break;if(92===i)e+=this.input.slice(s,this.state.pos),e+=this.readEscapedChar(!1),s=this.state.pos;else if(8232===i||8233===i)++this.state.pos,++this.state.curLine;else{if(isNewLine(i))throw this.raise(this.state.start,"Unterminated string constant");++this.state.pos}}e+=this.input.slice(s,this.state.pos++),this.finishToken(a.string,e)}readTmplToken(){let t="",e=this.state.pos,s=!1;for(;;){if(this.state.pos>=this.length)throw this.raise(this.state.start,"Unterminated template");const i=this.input.charCodeAt(this.state.pos);if(96===i||36===i&&123===this.input.charCodeAt(this.state.pos+1))return this.state.pos===this.state.start&&this.match(a.template)?36===i?(this.state.pos+=2,void this.finishToken(a.dollarBraceL)):(++this.state.pos,void this.finishToken(a.backQuote)):(t+=this.input.slice(e,this.state.pos),void this.finishToken(a.template,s?null:t));if(92===i){t+=this.input.slice(e,this.state.pos);const i=this.readEscapedChar(!0);null===i?s=!0:t+=i,e=this.state.pos}else if(isNewLine(i)){switch(t+=this.input.slice(e,this.state.pos),++this.state.pos,i){case 13:10===this.input.charCodeAt(this.state.pos)&&++this.state.pos;case 10:t+="\n";break;default:t+=String.fromCharCode(i)}++this.state.curLine,this.state.lineStart=this.state.pos,e=this.state.pos}else++this.state.pos}}readEscapedChar(t){const e=!t,s=this.input.charCodeAt(++this.state.pos);switch(++this.state.pos,s){case 110:return"\n";case 114:return"\r";case 120:{const t=this.readHexChar(2,!1,e);return null===t?null:String.fromCharCode(t)}case 117:{const t=this.readCodePoint(e);return null===t?null:String.fromCodePoint(t)}case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.state.pos)&&++this.state.pos;case 10:this.state.lineStart=this.state.pos,++this.state.curLine;case 8232:case 8233:return"";case 56:case 57:if(t){const t=this.state.pos-1;return this.state.invalidTemplateEscapePosition=t,null}default:if(s>=48&&s<=55){const e=this.state.pos-1;let s=this.input.substr(this.state.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(s,8);i>255&&(s=s.slice(0,-1),i=parseInt(s,8)),this.state.pos+=s.length-1;const r=this.input.charCodeAt(this.state.pos);if("0"!==s||56===r||57===r){if(t)return this.state.invalidTemplateEscapePosition=e,null;this.state.strict?this.raise(e,"Octal literal in strict mode"):this.state.containsOctal||(this.state.containsOctal=!0,this.state.octalPosition=e)}return String.fromCharCode(i)}return String.fromCharCode(s)}}readHexChar(t,e,s){const i=this.state.pos,r=this.readInt(16,t,e,!1);return null===r&&(s?this.raise(i,"Bad character escape sequence"):(this.state.pos=i-1,this.state.invalidTemplateEscapePosition=i-1)),r}readWord1(){let t="";this.state.containsEsc=!1;const e=this.state.pos;let s=this.state.pos;for(;this.state.pos<this.length;){const i=this.input.codePointAt(this.state.pos);if(isIdentifierChar(i))this.state.pos+=i<=65535?1:2;else if(this.state.isIterator&&64===i)++this.state.pos;else{if(92!==i)break;{this.state.containsEsc=!0,t+=this.input.slice(s,this.state.pos);const i=this.state.pos,r=this.state.pos===e?isIdentifierStart:isIdentifierChar;if(117!==this.input.charCodeAt(++this.state.pos)){this.raise(this.state.pos,"Expecting Unicode escape sequence \\uXXXX");continue}++this.state.pos;const a=this.readCodePoint(!0);null!==a&&(r(a)||this.raise(i,"Invalid Unicode escape"),t+=String.fromCodePoint(a)),s=this.state.pos}}}return t+this.input.slice(s,this.state.pos)}isIterator(t){return"@@iterator"===t||"@@asyncIterator"===t}readWord(){const t=this.readWord1(),e=r.get(t)||a.name;!this.state.isIterator||this.isIterator(t)&&this.state.inType||this.raise(this.state.pos,`Invalid identifier ${t}`),this.finishToken(e,t)}checkKeywordEscapes(){const t=this.state.type.keyword;t&&this.state.containsEsc&&this.raise(this.state.start,`Escape sequence in keyword ${t}`)}braceIsBlock(t){const e=this.curContext();return e===U.functionExpression||e===U.functionStatement||(t!==a.colon||e!==U.braceStatement&&e!==U.braceExpression?t===a._return||t===a.name&&this.state.exprAllowed?B.test(this.input.slice(this.state.lastTokEnd,this.state.start)):t===a._else||t===a.semi||t===a.eof||t===a.parenR||t===a.arrow||(t===a.braceL?e===U.braceStatement:t!==a._var&&t!==a._const&&t!==a.name&&(t===a.relational||!this.state.exprAllowed)):!e.isExpr)}updateContext(t){const e=this.state.type;let s;!e.keyword||t!==a.dot&&t!==a.questionDot?(s=e.updateContext)?s.call(this,t):this.state.exprAllowed=e.beforeExpr:this.state.exprAllowed=!1}}const ut=/^('|")((?:\\?.)*?)\1/;class UtilParser extends Tokenizer{addExtra(t,e,s){if(!t)return;(t.extra=t.extra||{})[e]=s}isRelational(t){return this.match(a.relational)&&this.state.value===t}isLookaheadRelational(t){const e=this.nextTokenStart();if(this.input.charAt(e)===t){if(e+1===this.input.length)return!0;const s=this.input.charCodeAt(e+1);return s!==t.charCodeAt(0)&&61!==s}return!1}expectRelational(t){this.isRelational(t)?this.next():this.unexpected(null,a.relational)}eatRelational(t){return!!this.isRelational(t)&&(this.next(),!0)}isContextual(t){return this.match(a.name)&&this.state.value===t&&!this.state.containsEsc}isUnparsedContextual(t,e){const s=t+e.length;return this.input.slice(t,s)===e&&(s===this.input.length||!isIdentifierChar(this.input.charCodeAt(s)))}isLookaheadContextual(t){const e=this.nextTokenStart();return this.isUnparsedContextual(e,t)}eatContextual(t){return this.isContextual(t)&&this.eat(a.name)}expectContextual(t,e){this.eatContextual(t)||this.unexpected(null,e)}canInsertSemicolon(){return this.match(a.eof)||this.match(a.braceR)||this.hasPrecedingLineBreak()}hasPrecedingLineBreak(){return B.test(this.input.slice(this.state.lastTokEnd,this.state.start))}isLineTerminator(){return this.eat(a.semi)||this.canInsertSemicolon()}semicolon(){this.isLineTerminator()||this.unexpected(null,a.semi)}expect(t,e){this.eat(t)||this.unexpected(e,t)}assertNoSpace(t="Unexpected space."){this.state.start>this.state.lastTokEnd&&this.raise(this.state.lastTokEnd,t)}unexpected(t,e="Unexpected token"){throw"string"!=typeof e&&(e=`Unexpected token, expected "${e.label}"`),this.raise(null!=t?t:this.state.start,e)}expectPlugin(t,e){if(!this.hasPlugin(t))throw this.raise(null!=e?e:this.state.start,`This experimental syntax requires enabling the parser plugin: '${t}'`,{missingPluginNames:[t]});return!0}expectOnePlugin(t,e){if(!t.some(t=>this.hasPlugin(t)))throw this.raise(null!=e?e:this.state.start,`This experimental syntax requires enabling one of the following parser plugin(s): '${t.join(", ")}'`,{missingPluginNames:t})}checkYieldAwaitInDefaultParams(){-1!==this.state.yieldPos&&(-1===this.state.awaitPos||this.state.yieldPos<this.state.awaitPos)&&this.raise(this.state.yieldPos,"Yield cannot be used as name inside a generator function"),-1!==this.state.awaitPos&&this.raise(this.state.awaitPos,"Await cannot be used as name inside an async function")}strictDirective(t){for(;;){q.lastIndex=t,t+=q.exec(this.input)[0].length;const e=ut.exec(this.input.slice(t));if(!e)break;if("use strict"===e[2])return!0;t+=e[0].length,q.lastIndex=t,t+=q.exec(this.input)[0].length,";"===this.input[t]&&t++}return!1}tryParse(t,e=this.state.clone()){const s={node:null};try{const i=t((t=null)=>{throw s.node=t,s});if(this.state.errors.length>e.errors.length){const t=this.state;return this.state=e,{node:i,error:t.errors[e.errors.length],thrown:!1,aborted:!1,failState:t}}return{node:i,error:null,thrown:!1,aborted:!1,failState:null}}catch(t){const i=this.state;if(this.state=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}}}class Node{constructor(t,e,s){this.type="",this.start=e,this.end=0,this.loc=new SourceLocation(s),t&&t.options.ranges&&(this.range=[e,0]),t&&t.filename&&(this.loc.filename=t.filename)}__clone(){const t=new Node,e=Object.keys(this);for(let s=0,i=e.length;s<i;s++){const i=e[s];"leadingComments"!==i&&"trailingComments"!==i&&"innerComments"!==i&&(t[i]=this[i])}return t}}class NodeUtils extends UtilParser{startNode(){return new Node(this,this.state.start,this.state.startLoc)}startNodeAt(t,e){return new Node(this,t,e)}startNodeAtNode(t){return this.startNodeAt(t.start,t.loc.start)}finishNode(t,e){return this.finishNodeAt(t,e,this.state.lastTokEnd,this.state.lastTokEndLoc)}finishNodeAt(t,e,s,i){return t.type=e,t.end=s,t.loc.end=i,this.options.ranges&&(t.range[1]=s),this.processComment(t),t}resetStartLocation(t,e,s){t.start=e,t.loc.start=s,this.options.ranges&&(t.range[0]=e)}resetEndLocation(t,e=this.state.lastTokEnd,s=this.state.lastTokEndLoc){t.end=e,t.loc.end=s,this.options.ranges&&(t.range[1]=e)}resetStartLocationFromNode(t,e){this.resetStartLocation(t,e.start,e.loc.start)}}class LValParser extends NodeUtils{toAssignable(t,e,s){var i;if(t)switch(t.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":break;case"ObjectExpression":t.type="ObjectPattern";for(let s=0,i=t.properties.length,a=i-1;s<i;s++){var r;const i=t.properties[s],n=s===a;this.toAssignableObjectExpressionProp(i,e,n),n&&"RestElement"===i.type&&(null==(r=t.extra)?void 0:r.trailingComma)&&this.raiseRestNotLast(t.extra.trailingComma)}break;case"ObjectProperty":this.toAssignable(t.value,e,s);break;case"SpreadElement":{this.checkToRestConversion(t),t.type="RestElement";const i=t.argument;this.toAssignable(i,e,s);break}case"ArrayExpression":t.type="ArrayPattern",this.toAssignableList(t.elements,e,s,null==(i=t.extra)?void 0:i.trailingComma);break;case"AssignmentExpression":"="!==t.operator&&this.raise(t.left.end,"Only '=' operator can be used for specifying default value."),t.type="AssignmentPattern",delete t.operator,this.toAssignable(t.left,e,s);break;case"ParenthesizedExpression":t.expression=this.toAssignable(t.expression,e,s);break;case"MemberExpression":if(!e)break}return t}toAssignableObjectExpressionProp(t,e,s){if("ObjectMethod"===t.type){const e="get"===t.kind||"set"===t.kind?"Object pattern can't contain getter or setter":"Object pattern can't contain methods";this.raise(t.key.start,e)}else"SpreadElement"!==t.type||s?this.toAssignable(t,e,"object destructuring pattern"):this.raiseRestNotLast(t.start)}toAssignableList(t,e,s,i){let r=t.length;if(r){const a=t[r-1];if(a&&"RestElement"===a.type)--r;else if(a&&"SpreadElement"===a.type){a.type="RestElement";const t=a.argument;this.toAssignable(t,e,s),"Identifier"!==t.type&&"MemberExpression"!==t.type&&"ArrayPattern"!==t.type&&"ObjectPattern"!==t.type&&this.unexpected(t.start),i&&this.raiseTrailingCommaAfterRest(i),--r}}for(let i=0;i<r;i++){const r=t[i];r&&(this.toAssignable(r,e,s),"RestElement"===r.type&&this.raiseRestNotLast(r.start))}return t}toReferencedList(t,e){return t}toReferencedListDeep(t,e){this.toReferencedList(t,e);for(let e=0;e<t.length;e++){const s=t[e];s&&"ArrayExpression"===s.type&&this.toReferencedListDeep(s.elements)}return t}parseSpread(t,e){const s=this.startNode();return this.next(),s.argument=this.parseMaybeAssign(!1,t,void 0,e),this.finishNode(s,"SpreadElement")}parseRestBinding(){const t=this.startNode();return this.next(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")}parseBindingAtom(){switch(this.state.type){case a.bracketL:{const t=this.startNode();return this.next(),t.elements=this.parseBindingList(a.bracketR,93,!0),this.finishNode(t,"ArrayPattern")}case a.braceL:return this.parseObj(!0)}return this.parseIdentifier()}parseBindingList(t,e,s,i){const r=[];let n=!0;for(;!this.eat(t);)if(n?n=!1:this.expect(a.comma),s&&this.match(a.comma))r.push(null);else{if(this.eat(t))break;if(this.match(a.ellipsis)){r.push(this.parseAssignableListItemTypes(this.parseRestBinding())),this.checkCommaAfterRest(e),this.expect(t);break}{const t=[];for(this.match(a.at)&&this.hasPlugin("decorators")&&this.raise(this.state.start,"Stage 2 decorators cannot be used to decorate parameters");this.match(a.at);)t.push(this.parseDecorator());r.push(this.parseAssignableListItem(i,t))}}return r}parseAssignableListItem(t,e){const s=this.parseMaybeDefault();this.parseAssignableListItemTypes(s);const i=this.parseMaybeDefault(s.start,s.loc.start,s);return e.length&&(s.decorators=e),i}parseAssignableListItemTypes(t){return t}parseMaybeDefault(t,e,s){if(e=e||this.state.startLoc,t=t||this.state.start,s=s||this.parseBindingAtom(),!this.eat(a.eq))return s;const i=this.startNodeAt(t,e);return i.left=s,i.right=this.parseMaybeAssign(),this.finishNode(i,"AssignmentPattern")}checkLVal(t,e=O,s,i,r,a=!1){switch(t.type){case"Identifier":if(this.state.strict&&(a?isStrictBindReservedWord(t.name,this.inModule):isStrictBindOnlyReservedWord(t.name))&&this.raise(t.start,`${e===O?"Assigning to":"Binding"} '${t.name}' in strict mode`),s){const e=`_${t.name}`;s[e]?this.raise(t.start,"Argument name clash"):s[e]=!0}r&&"let"===t.name&&this.raise(t.start,"'let' is not allowed to be used as a name in 'let' or 'const' declarations."),e&O||this.scope.declareName(t.name,e,t.start);break;case"MemberExpression":e!==O&&this.raise(t.start,"Binding member expression");break;case"ObjectPattern":for(let i=0,a=t.properties;i<a.length;i++){let t=a[i];if("ObjectProperty"===t.type)t=t.value;else if("ObjectMethod"===t.type)continue;this.checkLVal(t,e,s,"object destructuring pattern",r)}break;case"ArrayPattern":for(let i=0,a=t.elements;i<a.length;i++){const t=a[i];t&&this.checkLVal(t,e,s,"array destructuring pattern",r)}break;case"AssignmentPattern":this.checkLVal(t.left,e,s,"assignment pattern");break;case"RestElement":this.checkLVal(t.argument,e,s,"rest element");break;case"ParenthesizedExpression":this.checkLVal(t.expression,e,s,"parenthesized expression");break;default:{const s=(e===O?"Invalid":"Binding invalid")+" left-hand side"+(i?" in "+i:"expression");this.raise(t.start,s)}}}checkToRestConversion(t){"Identifier"!==t.argument.type&&"MemberExpression"!==t.argument.type&&this.raise(t.argument.start,"Invalid rest operator's argument")}checkCommaAfterRest(t){this.match(a.comma)&&(this.lookaheadCharCode()===t?this.raiseTrailingCommaAfterRest(this.state.start):this.raiseRestNotLast(this.state.start))}raiseRestNotLast(t){throw this.raise(t,"Rest element must be last element")}raiseTrailingCommaAfterRest(t){this.raise(t,"Unexpected trailing comma after rest element")}}const unwrapParenthesizedExpression=t=>"ParenthesizedExpression"===t.type?unwrapParenthesizedExpression(t.expression):t;class ExpressionParser extends LValParser{checkDuplicatedProto(t,e){if("SpreadElement"===t.type||t.computed||t.kind||t.shorthand)return;const s=t.key;"__proto__"===("Identifier"===s.type?s.name:String(s.value))&&(e.used&&!e.start&&(e.start=s.start),e.used=!0)}getExpression(){this.scope.enter(o),this.nextToken();const t=this.parseExpression();return this.match(a.eof)||this.unexpected(),t.comments=this.state.comments,t.errors=this.state.errors,t}parseExpression(t,e){const s=this.state.start,i=this.state.startLoc,r=this.parseMaybeAssign(t,e);if(this.match(a.comma)){const n=this.startNodeAt(s,i);for(n.expressions=[r];this.eat(a.comma);)n.expressions.push(this.parseMaybeAssign(t,e));return this.toReferencedList(n.expressions),this.finishNode(n,"SequenceExpression")}return r}parseMaybeAssign(t,e,s,i){const r=this.state.start,n=this.state.startLoc;if(this.isContextual("yield")){if(this.scope.inGenerator){let e=this.parseYield(t);return s&&(e=s.call(this,e,r,n)),e}this.state.exprAllowed=!1}let o;e?o=!1:(e={start:0},o=!0),(this.match(a.parenL)||this.match(a.name))&&(this.state.potentialArrowAt=this.state.start);let h=this.parseMaybeConditional(t,e,i);if(s&&(h=s.call(this,h,r,n)),this.state.type.isAssign){const s=this.startNodeAt(r,n),i=this.state.value;s.operator=i,"??="===i&&(this.expectPlugin("nullishCoalescingOperator"),this.expectPlugin("logicalAssignment")),"||="!==i&&"&&="!==i||this.expectPlugin("logicalAssignment"),s.left=this.match(a.eq)?this.toAssignable(h,void 0,"assignment expression"):h,e.start>=s.left.start&&(e.start=0),this.checkLVal(h,void 0,void 0,"assignment expression");const o=unwrapParenthesizedExpression(h);let p;return"ObjectPattern"===o.type?p="`({a}) = 0` use `({a} = 0)`":"ArrayPattern"===o.type&&(p="`([a]) = 0` use `([a] = 0)`"),p&&(h.extra&&h.extra.parenthesized||"ParenthesizedExpression"===h.type)&&this.raise(o.start,`You're trying to assign to a parenthesized expression, eg. instead of ${p}`),this.next(),s.right=this.parseMaybeAssign(t),this.finishNode(s,"AssignmentExpression")}return o&&e.start&&this.unexpected(e.start),h}parseMaybeConditional(t,e,s){const i=this.state.start,r=this.state.startLoc,a=this.state.potentialArrowAt,n=this.parseExprOps(t,e);return"ArrowFunctionExpression"===n.type&&n.start===a?n:e&&e.start?n:this.parseConditional(n,t,i,r,s)}parseConditional(t,e,s,i,r){if(this.eat(a.question)){const r=this.startNodeAt(s,i);return r.test=t,r.consequent=this.parseMaybeAssign(),this.expect(a.colon),r.alternate=this.parseMaybeAssign(e),this.finishNode(r,"ConditionalExpression")}return t}parseExprOps(t,e){const s=this.state.start,i=this.state.startLoc,r=this.state.potentialArrowAt,a=this.parseMaybeUnary(e);return"ArrowFunctionExpression"===a.type&&a.start===r?a:e&&e.start?a:this.parseExprOp(a,s,i,-1,t)}parseExprOp(t,e,s,i,r){const n=this.state.type.binop;if(!(null==n||r&&this.match(a._in))&&n>i){const o=this.state.value;if("|>"===o&&this.state.inFSharpPipelineDirectBody)return t;const h=this.startNodeAt(e,s);h.left=t,h.operator=o,"**"!==o||"UnaryExpression"!==t.type||!this.options.createParenthesizedExpressions&&t.extra&&t.extra.parenthesized||this.raise(t.argument.start,"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.");const p=this.state.type;if(p===a.pipeline?(this.expectPlugin("pipelineOperator"),this.state.inPipeline=!0,this.checkPipelineAtInfixOperator(t,e)):p===a.nullishCoalescing&&this.expectPlugin("nullishCoalescingOperator"),this.next(),p===a.pipeline&&"minimal"===this.getPluginOption("pipelineOperator","proposal")&&this.match(a.name)&&"await"===this.state.value&&this.scope.inAsync)throw this.raise(this.state.start,'Unexpected "await" after pipeline body; await must have parentheses in minimal proposal');if(h.right=this.parseExprOpRightExpr(p,n,r),p===a.nullishCoalescing){if(!("LogicalExpression"!==t.type||"??"===t.operator||t.extra&&t.extra.parenthesized))throw this.raise(t.start,"Nullish coalescing operator(??) requires parens when mixing with logical operators");if(!("LogicalExpression"!==h.right.type||"??"===h.right.operator||h.right.extra&&h.right.extra.parenthesized))throw this.raise(h.right.start,"Nullish coalescing operator(??) requires parens when mixing with logical operators")}return this.finishNode(h,p===a.logicalOR||p===a.logicalAND||p===a.nullishCoalescing?"LogicalExpression":"BinaryExpression"),this.parseExprOp(h,e,s,i,r)}return t}parseExprOpRightExpr(t,e,s){const i=this.state.start,r=this.state.startLoc;switch(t){case a.pipeline:switch(this.getPluginOption("pipelineOperator","proposal")){case"smart":return this.withTopicPermittingContext(()=>this.parseSmartPipelineBody(this.parseExprOpBaseRightExpr(t,e,s),i,r));case"fsharp":return this.withSoloAwaitPermittingContext(()=>this.parseFSharpPipelineBody(e,s))}default:return this.parseExprOpBaseRightExpr(t,e,s)}}parseExprOpBaseRightExpr(t,e,s){const i=this.state.start,r=this.state.startLoc;return this.parseExprOp(this.parseMaybeUnary(),i,r,t.rightAssociative?e-1:e,s)}parseMaybeUnary(t){if(this.isContextual("await")&&this.isAwaitAllowed())return this.parseAwait();if(this.state.type.prefix){const e=this.startNode(),s=this.match(a.incDec);if(e.operator=this.state.value,e.prefix=!0,"throw"===e.operator&&this.expectPlugin("throwExpressions"),this.next(),e.argument=this.parseMaybeUnary(),t&&t.start&&this.unexpected(t.start),s)this.checkLVal(e.argument,void 0,void 0,"prefix operation");else if(this.state.strict&&"delete"===e.operator){const t=e.argument;"Identifier"===t.type?this.raise(e.start,"Deleting local variable in strict mode"):"MemberExpression"===t.type&&"PrivateName"===t.property.type&&this.raise(e.start,"Deleting a private field is not allowed")}return this.finishNode(e,s?"UpdateExpression":"UnaryExpression")}const e=this.state.start,s=this.state.startLoc;let i=this.parseExprSubscripts(t);if(t&&t.start)return i;for(;this.state.type.postfix&&!this.canInsertSemicolon();){const t=this.startNodeAt(e,s);t.operator=this.state.value,t.prefix=!1,t.argument=i,this.checkLVal(i,void 0,void 0,"postfix operation"),this.next(),i=this.finishNode(t,"UpdateExpression")}return i}parseExprSubscripts(t){const e=this.state.start,s=this.state.startLoc,i=this.state.potentialArrowAt,r=this.parseExprAtom(t);return"ArrowFunctionExpression"===r.type&&r.start===i?r:t&&t.start?r:this.parseSubscripts(r,e,s)}parseSubscripts(t,e,s,i){const r={optionalChainMember:!1,maybeAsyncArrow:this.atPossibleAsync(t),stop:!1};do{t=this.parseSubscript(t,e,s,i,r),r.maybeAsyncArrow=!1}while(!r.stop);return t}parseSubscript(t,e,s,i,r){if(!i&&this.eat(a.doubleColon)){const a=this.startNodeAt(e,s);return a.object=t,a.callee=this.parseNoCallExpr(),r.stop=!0,this.parseSubscripts(this.finishNode(a,"BindExpression"),e,s,i)}if(this.match(a.questionDot)){if(this.expectPlugin("optionalChaining"),r.optionalChainMember=!0,i&&40===this.lookaheadCharCode())return r.stop=!0,t;this.next();const n=this.startNodeAt(e,s);return this.eat(a.bracketL)?(n.object=t,n.property=this.parseExpression(),n.computed=!0,n.optional=!0,this.expect(a.bracketR),this.finishNode(n,"OptionalMemberExpression")):this.eat(a.parenL)?(n.callee=t,n.arguments=this.parseCallExpressionArguments(a.parenR,!1),n.optional=!0,this.finishCallExpression(n,!0)):(n.object=t,n.property=this.parseIdentifier(!0),n.computed=!1,n.optional=!0,this.finishNode(n,"OptionalMemberExpression"))}if(this.eat(a.dot)){const i=this.startNodeAt(e,s);return i.object=t,i.property=this.parseMaybePrivateName(),i.computed=!1,"PrivateName"===i.property.type&&"Super"===i.object.type&&this.raise(e,"Private fields can't be accessed on super"),r.optionalChainMember?(i.optional=!1,this.finishNode(i,"OptionalMemberExpression")):this.finishNode(i,"MemberExpression")}if(this.eat(a.bracketL)){const i=this.startNodeAt(e,s);return i.object=t,i.property=this.parseExpression(),i.computed=!0,this.expect(a.bracketR),r.optionalChainMember?(i.optional=!1,this.finishNode(i,"OptionalMemberExpression")):this.finishNode(i,"MemberExpression")}if(!i&&this.match(a.parenL)){const i=this.state.maybeInArrowParameters,n=this.state.yieldPos,o=this.state.awaitPos;this.state.maybeInArrowParameters=!0,this.state.yieldPos=-1,this.state.awaitPos=-1,this.next();let h=this.startNodeAt(e,s);return h.callee=t,h.arguments=this.parseCallExpressionArguments(a.parenR,r.maybeAsyncArrow,"Import"===t.type,"Super"!==t.type,h),this.finishCallExpression(h,r.optionalChainMember),r.maybeAsyncArrow&&this.shouldParseAsyncArrow()?(r.stop=!0,h=this.parseAsyncArrowFromCallExpression(this.startNodeAt(e,s),h),this.checkYieldAwaitInDefaultParams(),this.state.yieldPos=n,this.state.awaitPos=o):(this.toReferencedListDeep(h.arguments),-1!==n&&(this.state.yieldPos=n),(this.isAwaitAllowed()||i)&&-1===o||(this.state.awaitPos=o)),this.state.maybeInArrowParameters=i,h}return this.match(a.backQuote)?this.parseTaggedTemplateExpression(e,s,t,r):(r.stop=!0,t)}parseTaggedTemplateExpression(t,e,s,i,r){const a=this.startNodeAt(t,e);return a.tag=s,a.quasi=this.parseTemplate(!0),r&&(a.typeParameters=r),i.optionalChainMember&&this.raise(t,"Tagged Template Literals are not allowed in optionalChain"),this.finishNode(a,"TaggedTemplateExpression")}atPossibleAsync(t){return"Identifier"===t.type&&"async"===t.name&&this.state.lastTokEnd===t.end&&!this.canInsertSemicolon()&&"async"===this.input.slice(t.start,t.end)}finishCallExpression(t,e){if("Import"===t.callee.type)if(1!==t.arguments.length)this.raise(t.start,"import() requires exactly one argument");else{const e=t.arguments[0];e&&"SpreadElement"===e.type&&this.raise(e.start,"... is not allowed in import()")}return this.finishNode(t,e?"OptionalCallExpression":"CallExpression")}parseCallExpressionArguments(t,e,s,i,r){const n=[];let o,h=!0;const p=this.state.inFSharpPipelineDirectBody;for(this.state.inFSharpPipelineDirectBody=!1;!this.eat(t);){if(h)h=!1;else if(this.expect(a.comma),this.match(t)){s&&this.raise(this.state.lastTokStart,"Trailing comma is disallowed inside import(...) arguments"),r&&this.addExtra(r,"trailingComma",this.state.lastTokStart),this.next();break}this.match(a.parenL)&&!o&&(o=this.state.start),n.push(this.parseExprListItem(!1,e?{start:0}:void 0,e?{start:0}:void 0,i))}return e&&o&&this.shouldParseAsyncArrow()&&this.unexpected(),this.state.inFSharpPipelineDirectBody=p,n}shouldParseAsyncArrow(){return this.match(a.arrow)&&!this.canInsertSemicolon()}parseAsyncArrowFromCallExpression(t,e){var s;return this.expect(a.arrow),this.parseArrowExpression(t,e.arguments,!0,null==(s=e.extra)?void 0:s.trailingComma),t}parseNoCallExpr(){const t=this.state.start,e=this.state.startLoc;return this.parseSubscripts(this.parseExprAtom(),t,e,!0)}parseExprAtom(t){this.state.type===a.slash&&this.readRegexp();const e=this.state.potentialArrowAt===this.state.start;let s;switch(this.state.type){case a._super:return s=this.startNode(),this.next(),!this.match(a.parenL)||this.scope.allowDirectSuper||this.options.allowSuperOutsideMethod?this.scope.allowSuper||this.options.allowSuperOutsideMethod||this.raise(s.start,"super is only allowed in object methods and classes"):this.raise(s.start,"super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?"),this.match(a.parenL)||this.match(a.bracketL)||this.match(a.dot)||this.raise(s.start,"super can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop])"),this.finishNode(s,"Super");case a._import:return s=this.startNode(),this.next(),this.match(a.dot)?this.parseImportMetaProperty(s):(this.expectPlugin("dynamicImport",s.start),this.match(a.parenL)||this.unexpected(null,a.parenL),this.finishNode(s,"Import"));case a._this:return s=this.startNode(),this.next(),this.finishNode(s,"ThisExpression");case a.name:{s=this.startNode();const t=this.state.containsEsc,i=this.parseIdentifier();if(!t&&"async"===i.name&&this.match(a._function)&&!this.canInsertSemicolon())return this.next(),this.parseFunction(s,void 0,!0);if(e&&!t&&"async"===i.name&&this.match(a.name)&&!this.canInsertSemicolon()){const t=[this.parseIdentifier()];return this.expect(a.arrow),this.parseArrowExpression(s,t,!0),s}return e&&this.match(a.arrow)&&!this.canInsertSemicolon()?(this.next(),this.parseArrowExpression(s,[i],!1),s):i}case a._do:{this.expectPlugin("doExpressions");const t=this.startNode();this.next();const e=this.state.labels;return this.state.labels=[],t.body=this.parseBlock(),this.state.labels=e,this.finishNode(t,"DoExpression")}case a.regexp:{const t=this.state.value;return(s=this.parseLiteral(t.value,"RegExpLiteral")).pattern=t.pattern,s.flags=t.flags,s}case a.num:return this.parseLiteral(this.state.value,"NumericLiteral");case a.bigint:return this.parseLiteral(this.state.value,"BigIntLiteral");case a.string:return this.parseLiteral(this.state.value,"StringLiteral");case a._null:return s=this.startNode(),this.next(),this.finishNode(s,"NullLiteral");case a._true:case a._false:return this.parseBooleanLiteral();case a.parenL:return this.parseParenAndDistinguishExpression(e);case a.bracketL:{const e=this.state.inFSharpPipelineDirectBody;return this.state.inFSharpPipelineDirectBody=!1,s=this.startNode(),this.next(),s.elements=this.parseExprList(a.bracketR,!0,t,s),this.state.maybeInArrowParameters||this.toReferencedList(s.elements),this.state.inFSharpPipelineDirectBody=e,this.finishNode(s,"ArrayExpression")}case a.braceL:{const e=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!1;const s=this.parseObj(!1,t);return this.state.inFSharpPipelineDirectBody=e,s}case a._function:return this.parseFunctionExpression();case a.at:this.parseDecorators();case a._class:return s=this.startNode(),this.takeDecorators(s),this.parseClass(s,!1);case a._new:return this.parseNew();case a.backQuote:return this.parseTemplate(!1);case a.doubleColon:{s=this.startNode(),this.next(),s.object=null;const t=s.callee=this.parseNoCallExpr();if("MemberExpression"===t.type)return this.finishNode(s,"BindExpression");throw this.raise(t.start,"Binding should be performed on object property.")}case a.hash:if(this.state.inPipeline)return s=this.startNode(),"smart"!==this.getPluginOption("pipelineOperator","proposal")&&this.raise(s.start,"Primary Topic Reference found but pipelineOperator not passed 'smart' for 'proposal' option."),this.next(),this.primaryTopicReferenceIsAllowedInCurrentTopicContext()||this.raise(s.start,"Topic reference was used in a lexical context without topic binding"),this.registerTopicReference(),this.finishNode(s,"PipelinePrimaryTopicReference");default:throw this.unexpected()}}parseBooleanLiteral(){const t=this.startNode();return t.value=this.match(a._true),this.next(),this.finishNode(t,"BooleanLiteral")}parseMaybePrivateName(){if(this.match(a.hash)){this.expectOnePlugin(["classPrivateProperties","classPrivateMethods"]);const t=this.startNode();return this.next(),this.assertNoSpace("Unexpected space between # and identifier"),t.id=this.parseIdentifier(!0),this.finishNode(t,"PrivateName")}return this.parseIdentifier(!0)}parseFunctionExpression(){const t=this.startNode();let e=this.startNode();return this.next(),e=this.createIdentifier(e,"function"),this.scope.inGenerator&&this.eat(a.dot)?this.parseMetaProperty(t,e,"sent"):this.parseFunction(t)}parseMetaProperty(t,e,s){t.meta=e,"function"===e.name&&"sent"===s&&(this.isContextual(s)?this.expectPlugin("functionSent"):this.hasPlugin("functionSent")||this.unexpected());const i=this.state.containsEsc;return t.property=this.parseIdentifier(!0),(t.property.name!==s||i)&&this.raise(t.property.start,`The only valid meta property for ${e.name} is ${e.name}.${s}`),this.finishNode(t,"MetaProperty")}parseImportMetaProperty(t){const e=this.createIdentifier(this.startNodeAtNode(t),"import");return this.expect(a.dot),this.isContextual("meta")?(this.expectPlugin("importMeta"),this.inModule||this.raise(e.start,"import.meta may appear only with 'sourceType: \"module\"'",{code:"BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED"}),this.sawUnambiguousESM=!0):this.hasPlugin("importMeta")||this.raise(e.start,"Dynamic imports require a parameter: import('a.js')"),this.parseMetaProperty(t,e,"meta")}parseLiteral(t,e,s,i){s=s||this.state.start,i=i||this.state.startLoc;const r=this.startNodeAt(s,i);return this.addExtra(r,"rawValue",t),this.addExtra(r,"raw",this.input.slice(s,this.state.end)),r.value=t,this.next(),this.finishNode(r,e)}parseParenAndDistinguishExpression(t){const e=this.state.start,s=this.state.startLoc;let i;this.expect(a.parenL);const r=this.state.maybeInArrowParameters,n=this.state.yieldPos,o=this.state.awaitPos,h=this.state.inFSharpPipelineDirectBody;this.state.maybeInArrowParameters=!0,this.state.yieldPos=-1,this.state.awaitPos=-1,this.state.inFSharpPipelineDirectBody=!1;const p=this.state.start,c=this.state.startLoc,l=[],u={start:0},d={start:0};let m,f,y=!0;for(;!this.match(a.parenR);){if(y)y=!1;else if(this.expect(a.comma,d.start||null),this.match(a.parenR)){f=this.state.start;break}if(this.match(a.ellipsis)){const t=this.state.start,e=this.state.startLoc;m=this.state.start,l.push(this.parseParenItem(this.parseRestBinding(),t,e)),this.checkCommaAfterRest(41);break}l.push(this.parseMaybeAssign(!1,u,this.parseParenItem,d))}const x=this.state.start,P=this.state.startLoc;this.expect(a.parenR),this.state.maybeInArrowParameters=r,this.state.inFSharpPipelineDirectBody=h;let g=this.startNodeAt(e,s);if(t&&this.shouldParseArrow()&&(g=this.parseArrow(g))){this.checkYieldAwaitInDefaultParams(),this.state.yieldPos=n,this.state.awaitPos=o;for(let t=0;t<l.length;t++){const e=l[t];e.extra&&e.extra.parenthesized&&this.unexpected(e.extra.parenStart)}return this.parseArrowExpression(g,l,!1),g}if(-1!==n&&(this.state.yieldPos=n),-1!==o&&(this.state.awaitPos=o),l.length||this.unexpected(this.state.lastTokStart),f&&this.unexpected(f),m&&this.unexpected(m),u.start&&this.unexpected(u.start),d.start&&this.unexpected(d.start),this.toReferencedListDeep(l,!0),l.length>1?((i=this.startNodeAt(p,c)).expressions=l,this.finishNodeAt(i,"SequenceExpression",x,P)):i=l[0],!this.options.createParenthesizedExpressions)return this.addExtra(i,"parenthesized",!0),this.addExtra(i,"parenStart",e),i;const b=this.startNodeAt(e,s);return b.expression=i,this.finishNode(b,"ParenthesizedExpression"),b}shouldParseArrow(){return!this.canInsertSemicolon()}parseArrow(t){if(this.eat(a.arrow))return t}parseParenItem(t,e,s){return t}parseNew(){const t=this.startNode();let e=this.startNode();if(this.next(),e=this.createIdentifier(e,"new"),this.eat(a.dot)){const s=this.parseMetaProperty(t,e,"target");if(!this.scope.inNonArrowFunction&&!this.state.inClassProperty){let t="new.target can only be used in functions";this.hasPlugin("classProperties")&&(t+=" or class properties"),this.raise(s.start,t)}return s}return t.callee=this.parseNoCallExpr(),"Import"===t.callee.type?this.raise(t.callee.start,"Cannot use new with import(...)"):"OptionalMemberExpression"===t.callee.type||"OptionalCallExpression"===t.callee.type?this.raise(this.state.lastTokEnd,"constructors in/after an Optional Chain are not allowed"):this.eat(a.questionDot)&&this.raise(this.state.start,"constructors in/after an Optional Chain are not allowed"),this.parseNewArguments(t),this.finishNode(t,"NewExpression")}parseNewArguments(t){if(this.eat(a.parenL)){const e=this.parseExprList(a.parenR);this.toReferencedList(e),t.arguments=e}else t.arguments=[]}parseTemplateElement(t){const e=this.startNode();return null===this.state.value&&(t?this.state.invalidTemplateEscapePosition=null:this.raise(this.state.invalidTemplateEscapePosition||0,"Invalid escape sequence in template")),e.value={raw:this.input.slice(this.state.start,this.state.end).replace(/\r\n?/g,"\n"),cooked:this.state.value},this.next(),e.tail=this.match(a.backQuote),this.finishNode(e,"TemplateElement")}parseTemplate(t){const e=this.startNode();this.next(),e.expressions=[];let s=this.parseTemplateElement(t);for(e.quasis=[s];!s.tail;)this.expect(a.dollarBraceL),e.expressions.push(this.parseExpression()),this.expect(a.braceR),e.quasis.push(s=this.parseTemplateElement(t));return this.next(),this.finishNode(e,"TemplateLiteral")}parseObj(t,e){const s=Object.create(null);let i=!0;const r=this.startNode();for(r.properties=[],this.next();!this.eat(a.braceR);){if(i)i=!1;else if(this.expect(a.comma),this.match(a.braceR)){this.addExtra(r,"trailingComma",this.state.lastTokStart),this.next();break}const n=this.parseObjectMember(t,e);t||this.checkDuplicatedProto(n,s),n.shorthand&&this.addExtra(n,"shorthand",!0),r.properties.push(n)}return this.match(a.eq)||void 0===s.start||this.raise(s.start,"Redefinition of __proto__ property"),this.finishNode(r,t?"ObjectPattern":"ObjectExpression")}isAsyncProp(t){return!t.computed&&"Identifier"===t.key.type&&"async"===t.key.name&&(this.match(a.name)||this.match(a.num)||this.match(a.string)||this.match(a.bracketL)||this.state.type.keyword||this.match(a.star))&&!this.hasPrecedingLineBreak()}parseObjectMember(t,e){let s=[];if(this.match(a.at))for(this.hasPlugin("decorators")&&this.raise(this.state.start,"Stage 2 decorators disallow object literal property decorators");this.match(a.at);)s.push(this.parseDecorator());const i=this.startNode();let r,n,o=!1,h=!1;if(this.match(a.ellipsis))return s.length&&this.unexpected(),t?(this.next(),i.argument=this.parseIdentifier(),this.checkCommaAfterRest(125),this.finishNode(i,"RestElement")):this.parseSpread();s.length&&(i.decorators=s,s=[]),i.method=!1,(t||e)&&(r=this.state.start,n=this.state.startLoc),t||(o=this.eat(a.star));const p=this.state.containsEsc;return this.parsePropertyName(i),t||p||o||!this.isAsyncProp(i)?h=!1:(h=!0,o=this.eat(a.star),this.parsePropertyName(i)),this.parseObjPropValue(i,r,n,o,h,t,e,p),i}isGetterOrSetterMethod(t,e){return!e&&!t.computed&&"Identifier"===t.key.type&&("get"===t.key.name||"set"===t.key.name)&&(this.match(a.string)||this.match(a.num)||this.match(a.bracketL)||this.match(a.name)||!!this.state.type.keyword)}getGetterSetterExpectedParamCount(t){return"get"===t.kind?0:1}checkGetterSetterParams(t){const e=this.getGetterSetterExpectedParamCount(t),s=t.start;t.params.length!==e&&("get"===t.kind?this.raise(s,"getter must not have any formal parameters"):this.raise(s,"setter must have exactly one formal parameter")),"set"===t.kind&&"RestElement"===t.params[t.params.length-1].type&&this.raise(s,"setter function argument must not be a rest parameter")}parseObjectMethod(t,e,s,i,r){return s||e||this.match(a.parenL)?(i&&this.unexpected(),t.kind="method",t.method=!0,this.parseMethod(t,e,s,!1,!1,"ObjectMethod")):!r&&this.isGetterOrSetterMethod(t,i)?((e||s)&&this.unexpected(),t.kind=t.key.name,this.parsePropertyName(t),this.parseMethod(t,!1,!1,!1,!1,"ObjectMethod"),this.checkGetterSetterParams(t),t):void 0}parseObjectProperty(t,e,s,i,r){return t.shorthand=!1,this.eat(a.colon)?(t.value=i?this.parseMaybeDefault(this.state.start,this.state.startLoc):this.parseMaybeAssign(!1,r),this.finishNode(t,"ObjectProperty")):t.computed||"Identifier"!==t.key.type?void 0:(this.checkReservedWord(t.key.name,t.key.start,!0,!0),i?t.value=this.parseMaybeDefault(e,s,t.key.__clone()):this.match(a.eq)&&r?(r.start||(r.start=this.state.start),t.value=this.parseMaybeDefault(e,s,t.key.__clone())):t.value=t.key.__clone(),t.shorthand=!0,this.finishNode(t,"ObjectProperty"))}parseObjPropValue(t,e,s,i,r,a,n,o){const h=this.parseObjectMethod(t,i,r,a,o)||this.parseObjectProperty(t,e,s,a,n);return h||this.unexpected(),h}parsePropertyName(t){if(this.eat(a.bracketL))t.computed=!0,t.key=this.parseMaybeAssign(),this.expect(a.bracketR);else{const e=this.state.inPropertyName;this.state.inPropertyName=!0,t.key=this.match(a.num)||this.match(a.string)?this.parseExprAtom():this.parseMaybePrivateName(),"PrivateName"!==t.key.type&&(t.computed=!1),this.state.inPropertyName=e}return t.key}initFunction(t,e){t.id=null,t.generator=!1,t.async=!!e}parseMethod(t,e,s,i,r,a,n=!1){const o=this.state.yieldPos,h=this.state.awaitPos;this.state.yieldPos=-1,this.state.awaitPos=-1,this.initFunction(t,s),t.generator=!!e;const p=i;return this.scope.enter(functionFlags(s,t.generator)|d|(n?f:0)|(r?m:0)),this.parseFunctionParams(t,p),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBodyAndFinish(t,a,!0),this.scope.exit(),this.state.yieldPos=o,this.state.awaitPos=h,t}parseArrowExpression(t,e,s,i){this.scope.enter(functionFlags(s,!1)|l),this.initFunction(t,s);const r=this.state.maybeInArrowParameters,a=this.state.yieldPos,n=this.state.awaitPos;return this.state.maybeInArrowParameters=!1,this.state.yieldPos=-1,this.state.awaitPos=-1,e&&this.setArrowFunctionParameters(t,e,i),this.parseFunctionBody(t,!0),this.scope.exit(),this.state.maybeInArrowParameters=r,this.state.yieldPos=a,this.state.awaitPos=n,this.finishNode(t,"ArrowFunctionExpression")}setArrowFunctionParameters(t,e,s){t.params=this.toAssignableList(e,!0,"arrow function parameters",s)}isStrictBody(t){if("BlockStatement"===t.body.type&&t.body.directives.length)for(let e=0,s=t.body.directives;e<s.length;e++){if("use strict"===s[e].value.value)return!0}return!1}parseFunctionBodyAndFinish(t,e,s=!1){this.parseFunctionBody(t,!1,s),this.finishNode(t,e)}parseFunctionBody(t,e,s=!1){const i=e&&!this.match(a.braceL),r=this.state.strict;let n=!1;const o=this.state.inParameters;if(this.state.inParameters=!1,i)t.body=this.parseMaybeAssign(),this.checkParams(t,!1,e,!1);else{const i=!this.isSimpleParamList(t.params);if((!r||i)&&(n=this.strictDirective(this.state.end))&&i){const e="method"!==t.kind&&"constructor"!==t.kind||!t.key?t.start:t.key.end;this.raise(e,"Illegal 'use strict' directive in function with non-simple parameter list")}const a=this.state.labels;this.state.labels=[],n&&(this.state.strict=!0),this.checkParams(t,!(r||n||e||s||i),e,!r&&n),t.body=this.parseBlock(!0,!1),this.state.labels=a}this.state.inParameters=o,this.state.strict&&t.id&&this.checkLVal(t.id,R,void 0,"function name",void 0,!r&&n),this.state.strict=r}isSimpleParamList(t){for(let e=0,s=t.length;e<s;e++)if("Identifier"!==t[e].type)return!1;return!0}checkParams(t,e,s,i=!0){const r=Object.create(null);for(let s=0;s<t.params.length;s++)this.checkLVal(t.params[s],S,e?null:r,"function parameter list",void 0,i)}parseExprList(t,e,s,i){const r=[];let n=!0;for(;!this.eat(t);){if(n)n=!1;else if(this.expect(a.comma),this.match(t)){i&&this.addExtra(i,"trailingComma",this.state.lastTokStart),this.next();break}r.push(this.parseExprListItem(e,s))}return r}parseExprListItem(t,e,s,i){let r;if(t&&this.match(a.comma))r=null;else if(this.match(a.ellipsis)){const t=this.state.start,i=this.state.startLoc;r=this.parseParenItem(this.parseSpread(e,s),t,i)}else if(this.match(a.question)){this.expectPlugin("partialApplication"),i||this.raise(this.state.start,"Unexpected argument placeholder");const t=this.startNode();this.next(),r=this.finishNode(t,"ArgumentPlaceholder")}else r=this.parseMaybeAssign(!1,e,this.parseParenItem,s);return r}parseIdentifier(t){const e=this.startNode(),s=this.parseIdentifierName(e.start,t);return this.createIdentifier(e,s)}createIdentifier(t,e){return t.name=e,t.loc.identifierName=e,this.finishNode(t,"Identifier")}parseIdentifierName(t,e){let s;if(this.match(a.name))s=this.state.value;else{if(!this.state.type.keyword)throw this.unexpected();"class"!==(s=this.state.type.keyword)&&"function"!==s||this.state.lastTokEnd===this.state.lastTokStart+1&&46===this.input.charCodeAt(this.state.lastTokStart)||this.state.context.pop()}return e?this.state.type=a.name:this.checkReservedWord(s,this.state.start,!!this.state.type.keyword,!1),this.next(),s}checkReservedWord(t,e,s,i){if(this.scope.inGenerator&&"yield"===t)return void this.raise(e,"Can not use 'yield' as identifier inside a generator");if("await"===t){if(this.scope.inAsync)return void this.raise(e,"Can not use 'await' as identifier inside an async function");-1===this.state.awaitPos&&(this.state.maybeInArrowParameters||this.isAwaitAllowed())&&(this.state.awaitPos=this.state.start)}if(this.state.inClassProperty&&"arguments"===t)return void this.raise(e,"'arguments' is not allowed in class field initializer");if(s&&function isKeyword(t){return r.has(t)}(t))return void this.raise(e,`Unexpected keyword '${t}'`);(this.state.strict?i?isStrictBindReservedWord:isStrictReservedWord:isReservedWord)(t,this.inModule)&&(this.scope.inAsync||"await"!==t?this.raise(e,`Unexpected reserved word '${t}'`):this.raise(e,"Can not use keyword 'await' outside an async function"))}isAwaitAllowed(){return this.scope.inFunction?this.scope.inAsync:!!this.options.allowAwaitOutsideFunction||!!this.hasPlugin("topLevelAwait")&&this.inModule}parseAwait(){const t=this.startNode();return this.next(),this.state.inParameters?this.raise(t.start,"await is not allowed in async function parameters"):-1===this.state.awaitPos&&(this.state.awaitPos=t.start),this.eat(a.star)&&this.raise(t.start,"await* has been removed from the async functions proposal. Use Promise.all() instead."),this.scope.inFunction||this.options.allowAwaitOutsideFunction||(this.hasPrecedingLineBreak()||this.match(a.plusMin)||this.match(a.parenL)||this.match(a.bracketL)||this.match(a.backQuote)||this.match(a.regexp)||this.match(a.slash)||this.hasPlugin("v8intrinsic")&&this.match(a.modulo)?this.ambiguousScriptDifferentAst=!0:this.sawUnambiguousESM=!0),this.state.soloAwait||(t.argument=this.parseMaybeUnary()),this.finishNode(t,"AwaitExpression")}parseYield(t){const e=this.startNode();return this.state.inParameters?this.raise(e.start,"yield is not allowed in generator parameters"):-1===this.state.yieldPos&&(this.state.yieldPos=e.start),this.next(),this.match(a.semi)||!this.match(a.star)&&!this.state.type.startsExpr||this.hasPrecedingLineBreak()?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(a.star),e.argument=this.parseMaybeAssign(t)),this.finishNode(e,"YieldExpression")}checkPipelineAtInfixOperator(t,e){"smart"===this.getPluginOption("pipelineOperator","proposal")&&"SequenceExpression"===t.type&&this.raise(e,"Pipeline head should not be a comma-separated sequence expression")}parseSmartPipelineBody(t,e,s){const i=this.checkSmartPipelineBodyStyle(t);return this.checkSmartPipelineBodyEarlyErrors(t,i,e),this.parseSmartPipelineBodyInStyle(t,i,e,s)}checkSmartPipelineBodyEarlyErrors(t,e,s){if(this.match(a.arrow))throw this.raise(this.state.start,'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized');"PipelineTopicExpression"===e&&"SequenceExpression"===t.type&&this.raise(s,"Pipeline body may not be a comma-separated sequence expression")}parseSmartPipelineBodyInStyle(t,e,s,i){const r=this.startNodeAt(s,i);switch(e){case"PipelineBareFunction":r.callee=t;break;case"PipelineBareConstructor":r.callee=t.callee;break;case"PipelineBareAwaitedFunction":r.callee=t.argument;break;case"PipelineTopicExpression":this.topicReferenceWasUsedInCurrentTopicContext()||this.raise(s,"Pipeline is in topic style but does not use topic reference"),r.expression=t;break;default:throw new Error(`Internal @babel/parser error: Unknown pipeline style (${e})`)}return this.finishNode(r,e)}checkSmartPipelineBodyStyle(t){return t.type,this.isSimpleReference(t)?"PipelineBareFunction":"PipelineTopicExpression"}isSimpleReference(t){switch(t.type){case"MemberExpression":return!t.computed&&this.isSimpleReference(t.object);case"Identifier":return!0;default:return!1}}withTopicPermittingContext(t){const e=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:1,maxTopicIndex:null};try{return t()}finally{this.state.topicContext=e}}withTopicForbiddingContext(t){const e=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:0,maxTopicIndex:null};try{return t()}finally{this.state.topicContext=e}}withSoloAwaitPermittingContext(t){const e=this.state.soloAwait;this.state.soloAwait=!0;try{return t()}finally{this.state.soloAwait=e}}registerTopicReference(){this.state.topicContext.maxTopicIndex=0}primaryTopicReferenceIsAllowedInCurrentTopicContext(){return this.state.topicContext.maxNumOfResolvableTopics>=1}topicReferenceWasUsedInCurrentTopicContext(){return null!=this.state.topicContext.maxTopicIndex&&this.state.topicContext.maxTopicIndex>=0}parseFSharpPipelineBody(t,e){const s=this.state.start,i=this.state.startLoc;this.state.potentialArrowAt=this.state.start;const r=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!0;const a=this.parseExprOp(this.parseMaybeUnary(),s,i,t,e);return this.state.inFSharpPipelineDirectBody=r,a}}const dt={kind:"loop"},mt={kind:"switch"},ft=0,yt=1,xt=2,Pt=4;class StatementParser extends ExpressionParser{parseTopLevel(t,e){if(e.sourceType=this.options.sourceType,e.interpreter=this.parseInterpreterDirective(),this.parseBlockBody(e,!0,!0,a.eof),this.inModule&&!this.options.allowUndeclaredExports&&this.scope.undefinedExports.size>0)for(let t=0,e=Array.from(this.scope.undefinedExports);t<e.length;t++){const[s]=e[t],i=this.scope.undefinedExports.get(s);this.raise(i,`Export '${s}' is not defined`)}return t.program=this.finishNode(e,"Program"),t.comments=this.state.comments,this.options.tokens&&(t.tokens=this.state.tokens),this.finishNode(t,"File")}stmtToDirective(t){const e=t.expression,s=this.startNodeAt(e.start,e.loc.start),i=this.startNodeAt(t.start,t.loc.start),r=this.input.slice(e.start,e.end),a=s.value=r.slice(1,-1);return this.addExtra(s,"raw",r),this.addExtra(s,"rawValue",a),i.value=this.finishNodeAt(s,"DirectiveLiteral",e.end,e.loc.end),this.finishNodeAt(i,"Directive",t.end,t.loc.end)}parseInterpreterDirective(){if(!this.match(a.interpreterDirective))return null;const t=this.startNode();return t.value=this.state.value,this.next(),this.finishNode(t,"InterpreterDirective")}isLet(t){if(!this.isContextual("let"))return!1;const e=this.nextTokenStart(),s=this.input.charCodeAt(e);if(91===s)return!0;if(t)return!1;if(123===s)return!0;if(isIdentifierStart(s)){let t=e+1;for(;isIdentifierChar(this.input.charCodeAt(t));)++t;const s=this.input.slice(e,t);if(!$.test(s))return!0}return!1}parseStatement(t,e){return this.match(a.at)&&this.parseDecorators(!0),this.parseStatementContent(t,e)}parseStatementContent(t,e){let s=this.state.type;const i=this.startNode();let r;switch(this.isLet(t)&&(s=a._var,r="let"),s){case a._break:case a._continue:return this.parseBreakContinueStatement(i,s.keyword);case a._debugger:return this.parseDebuggerStatement(i);case a._do:return this.parseDoStatement(i);case a._for:return this.parseForStatement(i);case a._function:if(46===this.lookaheadCharCode())break;return t&&(this.state.strict?this.raise(this.state.start,"In strict mode code, functions can only be declared at top level or inside a block"):"if"!==t&&"label"!==t&&this.raise(this.state.start,"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement")),this.parseFunctionStatement(i,!1,!t);case a._class:return t&&this.unexpected(),this.parseClass(i,!0);case a._if:return this.parseIfStatement(i);case a._return:return this.parseReturnStatement(i);case a._switch:return this.parseSwitchStatement(i);case a._throw:return this.parseThrowStatement(i);case a._try:return this.parseTryStatement(i);case a._const:case a._var:return r=r||this.state.value,t&&"var"!==r&&this.raise(this.state.start,"Lexical declaration cannot appear in a single-statement context"),this.parseVarStatement(i,r);case a._while:return this.parseWhileStatement(i);case a._with:return this.parseWithStatement(i);case a.braceL:return this.parseBlock();case a.semi:return this.parseEmptyStatement(i);case a._export:case a._import:{const t=this.lookaheadCharCode();if(40===t||46===t)break;let r;return this.options.allowImportExportEverywhere||e||this.raise(this.state.start,"'import' and 'export' may only appear at the top level"),this.next(),s===a._import?"ImportDeclaration"!==(r=this.parseImport(i)).type||r.importKind&&"value"!==r.importKind||(this.sawUnambiguousESM=!0):("ExportNamedDeclaration"!==(r=this.parseExport(i)).type||r.exportKind&&"value"!==r.exportKind)&&("ExportAllDeclaration"!==r.type||r.exportKind&&"value"!==r.exportKind)&&"ExportDefaultDeclaration"!==r.type||(this.sawUnambiguousESM=!0),this.assertModuleNodeAllowed(i),r}default:if(this.isAsyncFunction())return t&&this.raise(this.state.start,"Async functions can only be declared at the top level or inside a block"),this.next(),this.parseFunctionStatement(i,!0,!t)}const n=this.state.value,o=this.parseExpression();return s===a.name&&"Identifier"===o.type&&this.eat(a.colon)?this.parseLabeledStatement(i,n,o,t):this.parseExpressionStatement(i,o)}assertModuleNodeAllowed(t){this.options.allowImportExportEverywhere||this.inModule||this.raise(t.start,"'import' and 'export' may appear only with 'sourceType: \"module\"'",{code:"BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED"})}takeDecorators(t){const e=this.state.decoratorStack[this.state.decoratorStack.length-1];e.length&&(t.decorators=e,this.resetStartLocationFromNode(t,e[0]),this.state.decoratorStack[this.state.decoratorStack.length-1]=[])}canHaveLeadingDecorator(){return this.match(a._class)}parseDecorators(t){const e=this.state.decoratorStack[this.state.decoratorStack.length-1];for(;this.match(a.at);){const t=this.parseDecorator();e.push(t)}if(this.match(a._export))t||this.unexpected(),this.hasPlugin("decorators")&&!this.getPluginOption("decorators","decoratorsBeforeExport")&&this.raise(this.state.start,"Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead.");else if(!this.canHaveLeadingDecorator())throw this.raise(this.state.start,"Leading decorators must be attached to a class declaration")}parseDecorator(){this.expectOnePlugin(["decorators-legacy","decorators"]);const t=this.startNode();if(this.next(),this.hasPlugin("decorators")){this.state.decoratorStack.push([]);const e=this.state.start,s=this.state.startLoc;let i;if(this.eat(a.parenL))i=this.parseExpression(),this.expect(a.parenR);else for(i=this.parseIdentifier(!1);this.eat(a.dot);){const t=this.startNodeAt(e,s);t.object=i,t.property=this.parseIdentifier(!0),t.computed=!1,i=this.finishNode(t,"MemberExpression")}t.expression=this.parseMaybeDecoratorArguments(i),this.state.decoratorStack.pop()}else t.expression=this.parseExprSubscripts();return this.finishNode(t,"Decorator")}parseMaybeDecoratorArguments(t){if(this.eat(a.parenL)){const e=this.startNodeAtNode(t);return e.callee=t,e.arguments=this.parseCallExpressionArguments(a.parenR,!1),this.toReferencedList(e.arguments),this.finishNode(e,"CallExpression")}return t}parseBreakContinueStatement(t,e){const s="break"===e;return this.next(),this.isLineTerminator()?t.label=null:(t.label=this.parseIdentifier(),this.semicolon()),this.verifyBreakContinue(t,e),this.finishNode(t,s?"BreakStatement":"ContinueStatement")}verifyBreakContinue(t,e){const s="break"===e;let i;for(i=0;i<this.state.labels.length;++i){const e=this.state.labels[i];if(null==t.label||e.name===t.label.name){if(null!=e.kind&&(s||"loop"===e.kind))break;if(t.label&&s)break}}i===this.state.labels.length&&this.raise(t.start,"Unsyntactic "+e)}parseDebuggerStatement(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")}parseHeaderExpression(){this.expect(a.parenL);const t=this.parseExpression();return this.expect(a.parenR),t}parseDoStatement(t){return this.next(),this.state.labels.push(dt),t.body=this.withTopicForbiddingContext(()=>this.parseStatement("do")),this.state.labels.pop(),this.expect(a._while),t.test=this.parseHeaderExpression(),this.eat(a.semi),this.finishNode(t,"DoWhileStatement")}parseForStatement(t){this.next(),this.state.labels.push(dt);let e=-1;if(this.isAwaitAllowed()&&this.eatContextual("await")&&(e=this.state.lastTokStart),this.scope.enter(n),this.expect(a.parenL),this.match(a.semi))return e>-1&&this.unexpected(e),this.parseFor(t,null);const s=this.isLet();if(this.match(a._var)||this.match(a._const)||s){const i=this.startNode(),r=s?"let":this.state.value;return this.next(),this.parseVar(i,!0,r),this.finishNode(i,"VariableDeclaration"),(this.match(a._in)||this.isContextual("of"))&&1===i.declarations.length?this.parseForIn(t,i,e):(e>-1&&this.unexpected(e),this.parseFor(t,i))}const i={start:0},r=this.parseExpression(!0,i);if(this.match(a._in)||this.isContextual("of")){const s=this.isContextual("of")?"for-of statement":"for-in statement";return this.toAssignable(r,void 0,s),this.checkLVal(r,void 0,void 0,s),this.parseForIn(t,r,e)}return i.start&&this.unexpected(i.start),e>-1&&this.unexpected(e),this.parseFor(t,r)}parseFunctionStatement(t,e,s){return this.next(),this.parseFunction(t,yt|(s?0:xt),e)}parseIfStatement(t){return this.next(),t.test=this.parseHeaderExpression(),t.consequent=this.parseStatement("if"),t.alternate=this.eat(a._else)?this.parseStatement("if"):null,this.finishNode(t,"IfStatement")}parseReturnStatement(t){return this.scope.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.state.start,"'return' outside of function"),this.next(),this.isLineTerminator()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")}parseSwitchStatement(t){this.next(),t.discriminant=this.parseHeaderExpression();const e=t.cases=[];let s,i;for(this.expect(a.braceL),this.state.labels.push(mt),this.scope.enter(n);!this.match(a.braceR);)if(this.match(a._case)||this.match(a._default)){const t=this.match(a._case);s&&this.finishNode(s,"SwitchCase"),e.push(s=this.startNode()),s.consequent=[],this.next(),t?s.test=this.parseExpression():(i&&this.raise(this.state.lastTokStart,"Multiple default clauses"),i=!0,s.test=null),this.expect(a.colon)}else s?s.consequent.push(this.parseStatement(null)):this.unexpected();return this.scope.exit(),s&&this.finishNode(s,"SwitchCase"),this.next(),this.state.labels.pop(),this.finishNode(t,"SwitchStatement")}parseThrowStatement(t){return this.next(),B.test(this.input.slice(this.state.lastTokEnd,this.state.start))&&this.raise(this.state.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")}parseTryStatement(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.match(a._catch)){const e=this.startNode();if(this.next(),this.match(a.parenL)){this.expect(a.parenL),e.param=this.parseBindingAtom();const t="Identifier"===e.param.type;this.scope.enter(t?u:0),this.checkLVal(e.param,N,null,"catch clause"),this.expect(a.parenR)}else e.param=null,this.scope.enter(n);e.body=this.withTopicForbiddingContext(()=>this.parseBlock(!1,!1)),this.scope.exit(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat(a._finally)?this.parseBlock():null,t.handler||t.finalizer||this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")}parseVarStatement(t,e){return this.next(),this.parseVar(t,!1,e),this.semicolon(),this.finishNode(t,"VariableDeclaration")}parseWhileStatement(t){return this.next(),t.test=this.parseHeaderExpression(),this.state.labels.push(dt),t.body=this.withTopicForbiddingContext(()=>this.parseStatement("while")),this.state.labels.pop(),this.finishNode(t,"WhileStatement")}parseWithStatement(t){return this.state.strict&&this.raise(this.state.start,"'with' in strict mode"),this.next(),t.object=this.parseHeaderExpression(),t.body=this.withTopicForbiddingContext(()=>this.parseStatement("with")),this.finishNode(t,"WithStatement")}parseEmptyStatement(t){return this.next(),this.finishNode(t,"EmptyStatement")}parseLabeledStatement(t,e,s,i){for(let t=0,i=this.state.labels;t<i.length;t++){i[t].name===e&&this.raise(s.start,`Label '${e}' is already declared`)}const r=this.state.type.isLoop?"loop":this.match(a._switch)?"switch":null;for(let e=this.state.labels.length-1;e>=0;e--){const s=this.state.labels[e];if(s.statementStart!==t.start)break;s.statementStart=this.state.start,s.kind=r}return this.state.labels.push({name:e,kind:r,statementStart:this.state.start}),t.body=this.parseStatement(i?-1===i.indexOf("label")?i+"label":i:"label"),this.state.labels.pop(),t.label=s,this.finishNode(t,"LabeledStatement")}parseExpressionStatement(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")}parseBlock(t=!1,e=!0){const s=this.startNode();return this.expect(a.braceL),e&&this.scope.enter(n),this.parseBlockBody(s,t,!1,a.braceR),e&&this.scope.exit(),this.finishNode(s,"BlockStatement")}isValidDirective(t){return"ExpressionStatement"===t.type&&"StringLiteral"===t.expression.type&&!t.expression.extra.parenthesized}parseBlockBody(t,e,s,i){const r=t.body=[],a=t.directives=[];this.parseBlockOrModuleBlockBody(r,e?a:void 0,s,i)}parseBlockOrModuleBlockBody(t,e,s,i){let r,a,n=!1;for(;!this.eat(i);){n||!this.state.containsOctal||a||(a=this.state.octalPosition);const i=this.parseStatement(null,s);if(e&&!n&&this.isValidDirective(i)){const t=this.stmtToDirective(i);e.push(t),void 0===r&&"use strict"===t.value.value&&(r=this.state.strict,this.setStrict(!0),a&&this.raise(a,"Octal literal in strict mode"))}else n=!0,t.push(i)}!1===r&&this.setStrict(!1)}parseFor(t,e){return t.init=e,this.expect(a.semi),t.test=this.match(a.semi)?null:this.parseExpression(),this.expect(a.semi),t.update=this.match(a.parenR)?null:this.parseExpression(),this.expect(a.parenR),t.body=this.withTopicForbiddingContext(()=>this.parseStatement("for")),this.scope.exit(),this.state.labels.pop(),this.finishNode(t,"ForStatement")}parseForIn(t,e,s){const i=this.match(a._in);return this.next(),i?s>-1&&this.unexpected(s):t.await=s>-1,"VariableDeclaration"!==e.type||null==e.declarations[0].init||i&&!this.state.strict&&"var"===e.kind&&"Identifier"===e.declarations[0].id.type?"AssignmentPattern"===e.type&&this.raise(e.start,"Invalid left-hand side in for-loop"):this.raise(e.start,`${i?"for-in":"for-of"} loop variable declaration may not have an initializer`),t.left=e,t.right=i?this.parseExpression():this.parseMaybeAssign(),this.expect(a.parenR),t.body=this.withTopicForbiddingContext(()=>this.parseStatement("for")),this.scope.exit(),this.state.labels.pop(),this.finishNode(t,i?"ForInStatement":"ForOfStatement")}parseVar(t,e,s){const i=t.declarations=[],r=this.hasPlugin("typescript");for(t.kind=s;;){const t=this.startNode();if(this.parseVarId(t,s),this.eat(a.eq)?t.init=this.parseMaybeAssign(e):("const"!==s||this.match(a._in)||this.isContextual("of")?"Identifier"===t.id.type||e&&(this.match(a._in)||this.isContextual("of"))||this.raise(this.state.lastTokEnd,"Complex binding patterns require an initialization value"):r||this.unexpected(),t.init=null),i.push(this.finishNode(t,"VariableDeclarator")),!this.eat(a.comma))break}return t}parseVarId(t,e){t.id=this.parseBindingAtom(),this.checkLVal(t.id,"var"===e?S:N,void 0,"variable declaration","var"!==e)}parseFunction(t,e=ft,s=!1){const i=e&yt,r=e&xt,n=!(!i||e&Pt);this.initFunction(t,s),this.match(a.star)&&r&&this.raise(this.state.start,"Generators can only be declared at the top level or inside a block"),t.generator=this.eat(a.star),i&&(t.id=this.parseFunctionId(n));const o=this.state.maybeInArrowParameters,h=this.state.inClassProperty,p=this.state.yieldPos,c=this.state.awaitPos;return this.state.maybeInArrowParameters=!1,this.state.inClassProperty=!1,this.state.yieldPos=-1,this.state.awaitPos=-1,this.scope.enter(functionFlags(t.async,t.generator)),i||(t.id=this.parseFunctionId()),this.parseFunctionParams(t),this.withTopicForbiddingContext(()=>{this.parseFunctionBodyAndFinish(t,i?"FunctionDeclaration":"FunctionExpression")}),this.scope.exit(),i&&!r&&this.registerFunctionStatementId(t),this.state.maybeInArrowParameters=o,this.state.inClassProperty=h,this.state.yieldPos=p,this.state.awaitPos=c,t}parseFunctionId(t){return t||this.match(a.name)?this.parseIdentifier():null}parseFunctionParams(t,e){const s=this.state.inParameters;this.state.inParameters=!0,this.expect(a.parenL),t.params=this.parseBindingList(a.parenR,41,!1,e),this.state.inParameters=s,this.checkYieldAwaitInDefaultParams()}registerFunctionStatementId(t){t.id&&this.scope.declareName(t.id.name,this.state.strict||t.generator||t.async?this.scope.treatFunctionsAsVar?S:N:v,t.id.start)}parseClass(t,e,s){this.next(),this.takeDecorators(t);const i=this.state.strict;return this.state.strict=!0,this.parseClassId(t,e,s),this.parseClassSuper(t),t.body=this.parseClassBody(!!t.superClass),this.state.strict=i,this.finishNode(t,e?"ClassDeclaration":"ClassExpression")}isClassProperty(){return this.match(a.eq)||this.match(a.semi)||this.match(a.braceR)}isClassMethod(){return this.match(a.parenL)}isNonstaticConstructor(t){return!(t.computed||t.static||"constructor"!==t.key.name&&"constructor"!==t.key.value)}parseClassBody(t){this.state.classLevel++;const e={hadConstructor:!1};let s=[];const i=this.startNode();if(i.body=[],this.expect(a.braceL),this.withTopicForbiddingContext(()=>{for(;!this.eat(a.braceR);){if(this.eat(a.semi)){if(s.length>0)throw this.raise(this.state.lastTokEnd,"Decorators must not be followed by a semicolon");continue}if(this.match(a.at)){s.push(this.parseDecorator());continue}const r=this.startNode();s.length&&(r.decorators=s,this.resetStartLocationFromNode(r,s[0]),s=[]),this.parseClassMember(i,r,e,t),"constructor"===r.kind&&r.decorators&&r.decorators.length>0&&this.raise(r.start,"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?")}}),s.length)throw this.raise(this.state.start,"You have trailing decorators with no method");return this.state.classLevel--,this.finishNode(i,"ClassBody")}parseClassMember(t,e,s,i){let r=!1;const n=this.state.containsEsc;if(this.match(a.name)&&"static"===this.state.value){const s=this.parseIdentifier(!0);if(this.isClassMethod()){const i=e;return i.kind="method",i.computed=!1,i.key=s,i.static=!1,void this.pushClassMethod(t,i,!1,!1,!1,!1)}if(this.isClassProperty()){const i=e;return i.computed=!1,i.key=s,i.static=!1,void t.body.push(this.parseClassProperty(i))}if(n)throw this.unexpected();r=!0}this.parseClassMemberWithIsStatic(t,e,s,r,i)}parseClassMemberWithIsStatic(t,e,s,i,r){const n=e,o=e,h=e,p=e,c=n,l=n;if(e.static=i,this.eat(a.star))return c.kind="method",this.parseClassPropertyName(c),"PrivateName"===c.key.type?void this.pushClassPrivateMethod(t,o,!0,!1):(this.isNonstaticConstructor(n)&&this.raise(n.key.start,"Constructor can't be a generator"),void this.pushClassMethod(t,n,!0,!1,!1,!1));const u=this.state.containsEsc,d=this.parseClassPropertyName(e),m="PrivateName"===d.type,f="Identifier"===d.type,y=this.state.start;if(this.parsePostMemberNameModifiers(l),this.isClassMethod()){if(c.kind="method",m)return void this.pushClassPrivateMethod(t,o,!1,!1);const e=this.isNonstaticConstructor(n);let i=!1;e&&(n.kind="constructor",s.hadConstructor&&!this.hasPlugin("typescript")&&this.raise(d.start,"Duplicate constructor in the same class"),s.hadConstructor=!0,i=r),this.pushClassMethod(t,n,!1,!1,e,i)}else if(this.isClassProperty())m?this.pushClassPrivateProperty(t,p):this.pushClassProperty(t,h);else if(!f||"async"!==d.name||u||this.isLineTerminator())!f||"get"!==d.name&&"set"!==d.name||u||this.match(a.star)&&this.isLineTerminator()?this.isLineTerminator()?m?this.pushClassPrivateProperty(t,p):this.pushClassProperty(t,h):this.unexpected():(c.kind=d.name,this.parseClassPropertyName(n),"PrivateName"===c.key.type?this.pushClassPrivateMethod(t,o,!1,!1):(this.isNonstaticConstructor(n)&&this.raise(n.key.start,"Constructor can't have get/set modifier"),this.pushClassMethod(t,n,!1,!1,!1,!1)),this.checkGetterSetterParams(n));else{const e=this.eat(a.star);l.optional&&this.unexpected(y),c.kind="method",this.parseClassPropertyName(c),this.parsePostMemberNameModifiers(l),"PrivateName"===c.key.type?this.pushClassPrivateMethod(t,o,e,!0):(this.isNonstaticConstructor(n)&&this.raise(n.key.start,"Constructor can't be an async function"),this.pushClassMethod(t,n,e,!0,!1,!1))}}parseClassPropertyName(t){const e=this.parsePropertyName(t);return t.computed||!t.static||"prototype"!==e.name&&"prototype"!==e.value||this.raise(e.start,"Classes may not have static property named prototype"),"PrivateName"===e.type&&"constructor"===e.id.name&&this.raise(e.start,"Classes may not have a private field named '#constructor'"),e}pushClassProperty(t,e){e.computed||"constructor"!==e.key.name&&"constructor"!==e.key.value||this.raise(e.key.start,"Classes may not have a field named 'constructor'"),t.body.push(this.parseClassProperty(e))}pushClassPrivateProperty(t,e){this.expectPlugin("classPrivateProperties",e.key.start),t.body.push(this.parseClassPrivateProperty(e))}pushClassMethod(t,e,s,i,r,a){t.body.push(this.parseMethod(e,s,i,r,a,"ClassMethod",!0))}pushClassPrivateMethod(t,e,s,i){this.expectPlugin("classPrivateMethods",e.key.start),t.body.push(this.parseMethod(e,s,i,!1,!1,"ClassPrivateMethod",!0))}parsePostMemberNameModifiers(t){}parseAccessModifier(){}parseClassPrivateProperty(t){return this.state.inClassProperty=!0,this.scope.enter(f|d),t.value=this.eat(a.eq)?this.parseMaybeAssign():null,this.semicolon(),this.state.inClassProperty=!1,this.scope.exit(),this.finishNode(t,"ClassPrivateProperty")}parseClassProperty(t){return t.typeAnnotation||this.expectPlugin("classProperties"),this.state.inClassProperty=!0,this.scope.enter(f|d),this.match(a.eq)?(this.expectPlugin("classProperties"),this.next(),t.value=this.parseMaybeAssign()):t.value=null,this.semicolon(),this.state.inClassProperty=!1,this.scope.exit(),this.finishNode(t,"ClassProperty")}parseClassId(t,e,s,i=C){this.match(a.name)?(t.id=this.parseIdentifier(),e&&this.checkLVal(t.id,i,void 0,"class name")):s||!e?t.id=null:this.unexpected(null,"A class name is required")}parseClassSuper(t){t.superClass=this.eat(a._extends)?this.parseExprSubscripts():null}parseExport(t){const e=this.maybeParseExportDefaultSpecifier(t),s=!e||this.eat(a.comma),i=s&&this.eatExportStar(t),r=i&&this.maybeParseExportNamespaceSpecifier(t),n=s&&(!r||this.eat(a.comma)),o=e||i;if(i&&!r)return e&&this.unexpected(),this.parseExportFrom(t,!0),this.finishNode(t,"ExportAllDeclaration");const h=this.maybeParseExportNamedSpecifiers(t);if(e&&s&&!i&&!h||r&&n&&!h)throw this.unexpected(null,a.braceL);let p;if(o||h?(p=!1,this.parseExportFrom(t,o)):p=this.maybeParseExportDeclaration(t),o||h||p)return this.checkExport(t,!0,!1,!!t.source),this.finishNode(t,"ExportNamedDeclaration");if(this.eat(a._default))return t.declaration=this.parseExportDefaultExpression(),this.checkExport(t,!0,!0),this.finishNode(t,"ExportDefaultDeclaration");throw this.unexpected(null,a.braceL)}eatExportStar(t){return this.eat(a.star)}maybeParseExportDefaultSpecifier(t){if(this.isExportDefaultSpecifier()){this.expectPlugin("exportDefaultFrom");const e=this.startNode();return e.exported=this.parseIdentifier(!0),t.specifiers=[this.finishNode(e,"ExportDefaultSpecifier")],!0}return!1}maybeParseExportNamespaceSpecifier(t){if(this.isContextual("as")){t.specifiers||(t.specifiers=[]);const e=this.startNodeAt(this.state.lastTokStart,this.state.lastTokStartLoc);return this.next(),e.exported=this.parseIdentifier(!0),t.specifiers.push(this.finishNode(e,"ExportNamespaceSpecifier")),!0}return!1}maybeParseExportNamedSpecifiers(t){return!!this.match(a.braceL)&&(t.specifiers||(t.specifiers=[]),t.specifiers.push(...this.parseExportSpecifiers()),t.source=null,t.declaration=null,!0)}maybeParseExportDeclaration(t){if(this.shouldParseExportDeclaration()){if(this.isContextual("async")){const t=this.nextTokenStart();this.isUnparsedContextual(t,"function")||this.unexpected(t,'Unexpected token, expected "function"')}return t.specifiers=[],t.source=null,t.declaration=this.parseExportDeclaration(t),!0}return!1}isAsyncFunction(){if(!this.isContextual("async"))return!1;const t=this.nextTokenStart();return!B.test(this.input.slice(this.state.pos,t))&&this.isUnparsedContextual(t,"function")}parseExportDefaultExpression(){const t=this.startNode(),e=this.isAsyncFunction();if(this.match(a._function)||e)return this.next(),e&&this.next(),this.parseFunction(t,yt|Pt,e);if(this.match(a._class))return this.parseClass(t,!0,!0);if(this.match(a.at))return this.hasPlugin("decorators")&&this.getPluginOption("decorators","decoratorsBeforeExport")&&this.raise(this.state.start,"Decorators must be placed *before* the 'export' keyword. You can set the 'decoratorsBeforeExport' option to false to use the 'export @decorator class {}' syntax"),this.parseDecorators(!1),this.parseClass(t,!0,!0);if(this.match(a._const)||this.match(a._var)||this.isLet())throw this.raise(this.state.start,"Only expressions, functions or classes are allowed as the `default` export.");{const t=this.parseMaybeAssign();return this.semicolon(),t}}parseExportDeclaration(t){return this.parseStatement(null)}isExportDefaultSpecifier(){if(this.match(a.name))return"async"!==this.state.value&&"let"!==this.state.value;if(!this.match(a._default))return!1;const t=this.nextTokenStart();return 44===this.input.charCodeAt(t)||this.isUnparsedContextual(t,"from")}parseExportFrom(t,e){this.eatContextual("from")?(t.source=this.parseImportSource(),this.checkExport(t)):e?this.unexpected():t.source=null,this.semicolon()}shouldParseExportDeclaration(){if(this.match(a.at)&&(this.expectOnePlugin(["decorators","decorators-legacy"]),this.hasPlugin("decorators"))){if(!this.getPluginOption("decorators","decoratorsBeforeExport"))return!0;this.unexpected(this.state.start,"Decorators must be placed *before* the 'export' keyword. You can set the 'decoratorsBeforeExport' option to false to use the 'export @decorator class {}' syntax")}return"var"===this.state.type.keyword||"const"===this.state.type.keyword||"function"===this.state.type.keyword||"class"===this.state.type.keyword||this.isLet()||this.isAsyncFunction()}checkExport(t,e,s,i){if(e)if(s)this.checkDuplicateExports(t,"default");else if(t.specifiers&&t.specifiers.length)for(let e=0,s=t.specifiers;e<s.length;e++){const t=s[e];this.checkDuplicateExports(t,t.exported.name),!i&&t.local&&(this.checkReservedWord(t.local.name,t.local.start,!0,!1),this.scope.checkLocalExport(t.local))}else if(t.declaration)if("FunctionDeclaration"===t.declaration.type||"ClassDeclaration"===t.declaration.type){const e=t.declaration.id;if(!e)throw new Error("Assertion failure");this.checkDuplicateExports(t,e.name)}else if("VariableDeclaration"===t.declaration.type)for(let e=0,s=t.declaration.declarations;e<s.length;e++){const t=s[e];this.checkDeclaration(t.id)}if(this.state.decoratorStack[this.state.decoratorStack.length-1].length){const e=t.declaration&&("ClassDeclaration"===t.declaration.type||"ClassExpression"===t.declaration.type);if(!t.declaration||!e)throw this.raise(t.start,"You can only use decorators on an export when exporting a class");this.takeDecorators(t.declaration)}}checkDeclaration(t){if("Identifier"===t.type)this.checkDuplicateExports(t,t.name);else if("ObjectPattern"===t.type)for(let e=0,s=t.properties;e<s.length;e++){const t=s[e];this.checkDeclaration(t)}else if("ArrayPattern"===t.type)for(let e=0,s=t.elements;e<s.length;e++){const t=s[e];t&&this.checkDeclaration(t)}else"ObjectProperty"===t.type?this.checkDeclaration(t.value):"RestElement"===t.type?this.checkDeclaration(t.argument):"AssignmentPattern"===t.type&&this.checkDeclaration(t.left)}checkDuplicateExports(t,e){this.state.exportedIdentifiers.indexOf(e)>-1&&this.raise(t.start,"default"===e?"Only one default export allowed per module.":`\`${e}\` has already been exported. Exported identifiers must be unique.`),this.state.exportedIdentifiers.push(e)}parseExportSpecifiers(){const t=[];let e=!0;for(this.expect(a.braceL);!this.eat(a.braceR);){if(e)e=!1;else if(this.expect(a.comma),this.eat(a.braceR))break;const s=this.startNode();s.local=this.parseIdentifier(!0),s.exported=this.eatContextual("as")?this.parseIdentifier(!0):s.local.__clone(),t.push(this.finishNode(s,"ExportSpecifier"))}return t}parseImport(t){if(t.specifiers=[],!this.match(a.string)){const e=!this.maybeParseDefaultImportSpecifier(t)||this.eat(a.comma),s=e&&this.maybeParseStarImportSpecifier(t);e&&!s&&this.parseNamedImportSpecifiers(t),this.expectContextual("from")}return t.source=this.parseImportSource(),this.semicolon(),this.finishNode(t,"ImportDeclaration")}parseImportSource(){return this.match(a.string)||this.unexpected(),this.parseExprAtom()}shouldParseDefaultImport(t){return this.match(a.name)}parseImportSpecifierLocal(t,e,s,i){e.local=this.parseIdentifier(),this.checkLVal(e.local,N,void 0,i),t.specifiers.push(this.finishNode(e,s))}maybeParseDefaultImportSpecifier(t){return!!this.shouldParseDefaultImport(t)&&(this.parseImportSpecifierLocal(t,this.startNode(),"ImportDefaultSpecifier","default import specifier"),!0)}maybeParseStarImportSpecifier(t){if(this.match(a.star)){const e=this.startNode();return this.next(),this.expectContextual("as"),this.parseImportSpecifierLocal(t,e,"ImportNamespaceSpecifier","import namespace specifier"),!0}return!1}parseNamedImportSpecifiers(t){let e=!0;for(this.expect(a.braceL);!this.eat(a.braceR);){if(e)e=!1;else{if(this.eat(a.colon))throw this.raise(this.state.start,"ES2015 named imports do not destructure. Use another statement for destructuring after the import.");if(this.expect(a.comma),this.eat(a.braceR))break}this.parseImportSpecifier(t)}}parseImportSpecifier(t){const e=this.startNode();e.imported=this.parseIdentifier(!0),this.eatContextual("as")?e.local=this.parseIdentifier():(this.checkReservedWord(e.imported.name,e.start,!0,!0),e.local=e.imported.__clone()),this.checkLVal(e.local,N,void 0,"import specifier"),t.specifiers.push(this.finishNode(e,"ImportSpecifier"))}}class Parser extends StatementParser{constructor(t,e){super(t=function getOptions(t){const e={};for(let s=0,i=Object.keys(ot);s<i.length;s++){const r=i[s];e[r]=t&&null!=t[r]?t[r]:ot[r]}return e}(t),e);const s=this.getScopeHandler();this.options=t,this.inModule="module"===this.options.sourceType,this.scope=new s(this.raise.bind(this),this.inModule),this.plugins=function pluginsMap(t){const e=new Map;for(let s=0;s<t.length;s++){const i=t[s],[r,a]=Array.isArray(i)?i:[i,{}];e.has(r)||e.set(r,a||{})}return e}(this.options.plugins),this.filename=t.sourceFilename}getScopeHandler(){return ScopeHandler}parse(){this.scope.enter(o);const t=this.startNode(),e=this.startNode();return this.nextToken(),t.errors=null,this.parseTopLevel(t,e),t.errors=this.state.errors,t}}function getParser(t,e){let s=Parser;return t&&t.plugins&&(!function validatePlugins(t){if(hasPlugin(t,"decorators")){if(hasPlugin(t,"decorators-legacy"))throw new Error("Cannot use the decorators and decorators-legacy plugin together");const e=getPluginOption(t,"decorators","decoratorsBeforeExport");if(null==e)throw new Error("The 'decorators' plugin requires a 'decoratorsBeforeExport' option, whose value must be a boolean. If you are migrating from Babylon/Babel 6 or want to use the old decorators proposal, you should use the 'decorators-legacy' plugin instead of 'decorators'.");if("boolean"!=typeof e)throw new Error("'decoratorsBeforeExport' must be a boolean.")}if(hasPlugin(t,"flow")&&hasPlugin(t,"typescript"))throw new Error("Cannot combine flow and typescript plugins.");if(hasPlugin(t,"placeholders")&&hasPlugin(t,"v8intrinsic"))throw new Error("Cannot combine placeholders and v8intrinsic plugins.");if(hasPlugin(t,"pipelineOperator")&&!rt.includes(getPluginOption(t,"pipelineOperator","proposal")))throw new Error("'pipelineOperator' requires 'proposal' option whose value should be one of: "+rt.map(t=>`'${t}'`).join(", "))}(t.plugins),s=function getParserClass(t){const e=nt.filter(e=>hasPlugin(t,e)),s=e.join("/");let i=gt[s];if(!i){i=Parser;for(let t=0;t<e.length;t++){const s=e[t];i=at[s](i)}gt[s]=i}return i}(t.plugins)),new s(t,e)}const gt={};e.parse=function parse(t,e){if(!e||"unambiguous"!==e.sourceType)return getParser(e,t).parse();e=Object.assign({},e);try{e.sourceType="module";const s=getParser(e,t),i=s.parse();if(s.sawUnambiguousESM)return i;if(s.ambiguousScriptDifferentAst)try{return e.sourceType="script",getParser(e,t).parse()}catch(t){}else i.program.sourceType="script";return i}catch(s){try{return e.sourceType="script",getParser(e,t).parse()}catch(t){}throw s}},e.parseExpression=function parseExpression(t,e){const s=getParser(e,t);return s.options.strictMode&&(s.state.strict=!0),s.getExpression()},e.tokTypes=a}}]);
//# sourceMappingURL=vendors~custom-page-KXWAf~pattern-view-page-WE7TE~05943200.chunk.eaa5497fb7f7db0479e3.js.map