@maincode-ai/matilda-code 0.19.8 → 0.19.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chunks/{agent-2NBSL6Q2.js → agent-HKORTAHR.js} +1 -1
- package/chunks/{agent-headless-AXEWDJRM.js → agent-headless-F7NN2K2V.js} +1 -1
- package/chunks/askUserQuestion-MFLZ7MGJ.js +25 -0
- package/chunks/{chunk-HDVKP4RM.js → chunk-2GMJHSBF.js} +1 -1
- package/chunks/{chunk-WN7W7S2V.js → chunk-GN7ECS3T.js} +1 -1
- package/chunks/{chunk-HUPUKBVY.js → chunk-H5PGSQP2.js} +3 -3
- package/chunks/{chunk-WIDV26MB.js → chunk-LNTXZVVL.js} +1 -1
- package/chunks/{chunk-ILO32IXN.js → chunk-PKETH5KK.js} +2 -2
- package/chunks/{chunk-OJTERV74.js → chunk-TDVEFJRU.js} +1 -1
- package/chunks/{computer-use-7PIVVKPK.js → computer-use-BBMGDR5Q.js} +1 -1
- package/chunks/{contextCommand-SO4X2MS6.js → contextCommand-HGBI6TH7.js} +1 -1
- package/chunks/{edit-B5KZGY7B.js → edit-RF2YFGIO.js} +1 -1
- package/chunks/{enter-worktree-RRN3GMRW.js → enter-worktree-VQHP27VO.js} +1 -1
- package/chunks/{enterPlanMode-ZPXWNPYM.js → enterPlanMode-6FANAN7K.js} +1 -1
- package/chunks/{exit-worktree-HND5ZVDQ.js → exit-worktree-JNQ5QJ3V.js} +1 -1
- package/chunks/{exitPlanMode-K7HACJ6K.js → exitPlanMode-VTB3FQTP.js} +1 -1
- package/chunks/{geminiContentGenerator-ZE6UPRAE.js → geminiContentGenerator-UJMSJR23.js} +1 -1
- package/chunks/{glob-PXQT4CHI.js → glob-A3AI5R62.js} +1 -1
- package/chunks/{grep-B2OXQK7Q.js → grep-IH2T7KTD.js} +1 -1
- package/chunks/{matildaAgentContentGenerator-Q43QK5GQ.js → matildaAgentContentGenerator-QKMXPB2A.js} +1 -1
- package/chunks/{matildaContentGenerator-MTZC3PAG.js → matildaContentGenerator-O2TF3IDJ.js} +1 -1
- package/chunks/{monitor-6AWWXDIL.js → monitor-4DTQSZEC.js} +1 -1
- package/chunks/{notebook-edit-7BJPP7ZB.js → notebook-edit-CZRTFD7U.js} +1 -1
- package/chunks/{openaiContentGenerator-JX2JAR3V.js → openaiContentGenerator-AZI4WQN4.js} +1 -1
- package/chunks/{ripGrep-G3IY6ZWZ.js → ripGrep-BZMM5FLN.js} +1 -1
- package/chunks/{scheduler-FFE43QWC.js → scheduler-5LM4YZEI.js} +1 -1
- package/chunks/{serve-RXBWGIMV.js → serve-7IPJHK45.js} +1 -1
- package/chunks/{shell-4HTE526K.js → shell-5O45TMEX.js} +1 -1
- package/chunks/{src-F4LDZDLP.js → src-6MF6HV7Q.js} +1 -1
- package/chunks/{team-create-VWJKHFTR.js → team-create-TRYOTUXF.js} +1 -1
- package/chunks/{web-search-FEZM3B3R.js → web-search-6RI3HXMN.js} +1 -1
- package/chunks/{workflow-GNYDTGHJ.js → workflow-TTK6ZMKW.js} +2 -2
- package/chunks/{write-file-2PLDMI5M.js → write-file-HOM26KX6.js} +1 -1
- package/cli.js +7 -7
- package/package.json +2 -2
- package/chunks/askUserQuestion-V5YLTC4J.js +0 -25
|
@@ -7,7 +7,7 @@ import{a as U,d as at}from"./chunk-4F4DA5UI.js";import{a as ot,b as it,e as Ie,n
|
|
|
7
7
|
`)||""}function Pe(t,e,n=!0){return e.responseParsingOptions?.taggedThinkingTags?e.taggedThinkingParser?e.taggedThinkingParser.parse(t,n):ut(t):t?[{text:t}]:[]}function an(t,e){let n=t.choices?.[0],o=new B;if(n){let i=[];if(!e.responseParsingOptions?.taggedThinkingTags){let r=n.message.reasoning_content??n.message.reasoning;r&&i.push({text:r,thought:!0})}if(n.message.content&&i.push(...Pe(n.message.content,e)),n.message.tool_calls){for(let r of n.message.tool_calls)if(r.function){let a={};r.function.arguments&&(a=ot(r.function.arguments,{})),i.push({functionCall:{id:r.id,name:r.function.name,args:a}})}}o.candidates=[{content:{parts:i,role:"model"},finishReason:vt(n.finish_reason||"stop"),index:0,safetyRatings:[]}]}else o.candidates=[];return o.responseId=t.id,o.createTime=t.created?t.created.toString():new Date().getTime().toString(),o.modelVersion=e.model,o.promptFeedback={safetyRatings:[]},t.usage&&(o.usageMetadata=Tt(t.usage)),o}function sn(t,e){let n=t.choices?.[0],o=new B,i=e.toolCallParser;if(!i)throw new Error("convertOpenAIChunkToGemini requires requestContext.toolCallParser \u2014 attach a fresh StreamingToolCallParser at stream start.");if(n){let r=[];if(!e.responseParsingOptions?.taggedThinkingTags){let d=n.delta?.reasoning_content??n.delta?.reasoning;if(d){let c=gt(d,e.reasoningDeltaState??={emittedText:"",emittedLength:0,cumulativeMode:!1});c&&r.push({text:c,thought:!0})}}if(typeof n.delta?.content=="string"){let d=gt(n.delta.content,e.textDeltaState??={emittedText:"",emittedLength:0,cumulativeMode:!1});(d||n.finish_reason)&&r.push(...Pe(d,e,!!n.finish_reason))}else n.finish_reason&&r.push(...Pe("",e,!0));if(n.delta?.tool_calls)for(let d of n.delta.tool_calls){let c=d.index??0;d.function?.arguments?i.addChunk(c,d.function.arguments,d.id,d.function.name):i.addChunk(c,"",d.id,d.function?.name)}let a=!1;if(n.finish_reason){a=i.hasIncompleteToolCalls();let d=i.getCompletedToolCalls();for(let c of d)c.name&&r.push({functionCall:{id:c.id||`call_${Date.now()}_${Math.random().toString(36).substring(2,9)}`,name:c.name,args:c.args}})}let s=a&&n.finish_reason!=="length"?"length":n.finish_reason,l={content:{parts:r,role:"model"},index:0,safetyRatings:[]};s&&(l.finishReason=vt(s)),o.candidates=[l]}else o.candidates=[];return o.responseId=t.id,o.createTime=t.created?t.created.toString():new Date().getTime().toString(),o.modelVersion=e.model,o.promptFeedback={safetyRatings:[]},t.usage&&(o.usageMetadata=Tt(t.usage)),o}function vt(t){return t?{stop:A.STOP,length:A.MAX_TOKENS,content_filter:A.SAFETY,function_call:A.STOP,tool_calls:A.STOP}[t]||A.FINISH_REASON_UNSPECIFIED:A.FINISH_REASON_UNSPECIFIED}function ln(t){if(!t)return"stop";switch(t){case A.STOP:return"stop";case A.MAX_TOKENS:return"length";case A.SAFETY:case A.RECITATION:case A.BLOCKLIST:case A.PROHIBITED_CONTENT:case A.SPII:case A.IMAGE_SAFETY:case A.IMAGE_RECITATION:case A.IMAGE_PROHIBITED_CONTENT:case A.IMAGE_OTHER:return"content_filter";case A.NO_IMAGE:return"stop";default:return"stop"}}function Re(t){return t.role==="assistant"&&"tool_calls"in t&&Array.isArray(t.tool_calls)&&t.tool_calls.length>0}function mt(t){if(t.role!=="user"||!("content"in t)||!Array.isArray(t.content))return!1;let e=t.content[0];return e?.type==="text"&&e.text===yt}function dn(t){let e=[],n=new Map,o=new Map,i=new Map,r=new Set,a=new Set;for(let s=0;s<t.length;s+=1){let l=t[s];if(Re(l)){let d=[],c=new Set;for(let C of l.tool_calls){let y=C.id;!y||a.has(y)||c.has(y)||(c.add(y),d.push(C))}let g=new Set,u=[],m=[],h=!1;for(let C=s+1;C<t.length;C+=1){let y=t[C];if(y.role==="tool"&&"tool_call_id"in y){if(!y.tool_call_id){h=!1;continue}c.has(y.tool_call_id)&&!g.has(y.tool_call_id)?(g.add(y.tool_call_id),u.push(C),h=!0):h=!1;continue}if(mt(y)){h&&m.push(C);continue}if(!(y.role==="assistant"&&!Re(y)))break}let p=d.filter(C=>g.has(C.id));for(let C of p)a.add(C.id);n.set(s,p),o.set(s,u),i.set(s,m)}}for(let s=0;s<t.length;s+=1){if(r.has(s))continue;let l=t[s];if(Re(l)){let d=l.reasoning_content,c=n.get(s)??[];if(c.length>0){let g={...l};g.tool_calls=c,e.push(g);for(let u of o.get(s)??[]){let m=t[u];m&&(e.push(m),r.add(u))}for(let u of i.get(s)??[]){let m=t[u];m&&(e.push(m),r.add(u))}}else if(typeof l.content=="string"&&l.content.trim()||d){let g={...l};delete g.tool_calls,e.push(g)}else w.debug(`cleanOrphanedToolCalls: dropping assistant with ${l.tool_calls.length} orphaned tool call(s) and no text/reasoning content`)}else l.role==="tool"&&"tool_call_id"in l?w.debug(`cleanOrphanedToolCalls: dropping orphaned tool response ${l.tool_call_id||"<empty>"}`):mt(l)?w.debug("cleanOrphanedToolCalls: dropping orphaned split tool media message"):e.push(l)}return e}function Ct(t){let e=[];for(let n of t){if(n.role==="assistant"&&e.length>0){let o=e[e.length-1];if(o.role==="assistant"){let i="tool_calls"in o?o.tool_calls||[]:[],r="tool_calls"in n?n.tool_calls||[]:[],a=o.content,s=n.content,l=Array.isArray(a)||Array.isArray(s),d;if(l){let g=Array.isArray(a)?a:typeof a=="string"&&a?[{type:"text",text:a}]:[],u=Array.isArray(s)?s:typeof s=="string"&&s?[{type:"text",text:s}]:[];d=[...g,...u]}else d=[typeof a=="string"?a:"",typeof s=="string"?s:""].filter(Boolean).join("")||null;let c=[...i,...r];o.content=d||null,c.length>0&&(o.tool_calls=c);continue}}e.push(n)}return e}var ne={convertGeminiToolParametersToOpenAI:At,convertGeminiToolsToOpenAI:Yt,convertGeminiRequestToOpenAI:Xt,convertGeminiResponseToOpenAI:Zt,convertOpenAIResponseToGemini:an,convertOpenAIChunkToGemini:sn};f();import*as _ from"node:path";import{promises as re}from"node:fs";f();f();import cn from"crypto";var ie=new Uint8Array(256),oe=ie.length;function Ee(){return oe>ie.length-16&&(cn.randomFillSync(ie),oe=0),ie.slice(oe,oe+=16)}f();var M=[];for(let t=0;t<256;++t)M.push((t+256).toString(16).slice(1));function _t(t,e=0){return M[t[e+0]]+M[t[e+1]]+M[t[e+2]]+M[t[e+3]]+"-"+M[t[e+4]]+M[t[e+5]]+"-"+M[t[e+6]]+M[t[e+7]]+"-"+M[t[e+8]]+M[t[e+9]]+"-"+M[t[e+10]]+M[t[e+11]]+M[t[e+12]]+M[t[e+13]]+M[t[e+14]]+M[t[e+15]]}f();f();import un from"crypto";var Oe={randomUUID:un.randomUUID};function pn(t,e,n){if(Oe.randomUUID&&!e&&!t)return Oe.randomUUID();t=t||{};let o=t.random||(t.rng||Ee)();if(o[6]=o[6]&15|64,o[8]=o[8]&63|128,e){n=n||0;for(let i=0;i<16;++i)e[n+i]=o[i];return e}return _t(o)}var Ue=pn;import*as E from"os";var ae=b("OPENAI_LOGGER"),gn="########",fn=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function hn(t,e){let n=e||process.cwd();if(!t)return _.join(n,"logs","openai");let o=t;return t==="~"||t.startsWith("~/")?o=_.join(E.homedir(),t.slice(1)):_.isAbsolute(t)||(o=_.resolve(n,t)),_.normalize(o)}function xt(t){return t&&t.replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||void 0}function mn(t){let e=t.split("#");if(e.length!==3)return;let[,n,o]=e;if(!(!n||!o||!/^\d+$/.test(o)))return`subagent-${n}`}function Cn(t){if(t)return K(t)?xt(t):xt(mn(t))}function yn(t){if(!t)return;let e=t.indexOf(gn);if(e>0)return t.slice(0,e);if(fn.test(t))return t;let n=t.split("#");if(n.length>=3&&n[0])return n[0]}function Tn(t){let e=t?.trim(),n=yn(e);return!e&&!n?null:{...e?{promptId:e}:{},...n?{sessionId:n}:{}}}var V=class{logDir;initialized=!1;constructor(e,n){this.logDir=hn(e,n)}async initialize(){if(!this.initialized)try{await re.mkdir(this.logDir,{recursive:!0}),this.initialized=!0}catch(e){throw ae.error("Failed to initialize OpenAI logger:",e),new Error(`Failed to initialize OpenAI logger: ${e}`)}}async logInteraction(e,n,o,i){this.initialized||await this.initialize();let r=new Date().toISOString().replace(/:/g,"-"),a=Ue().slice(0,8),s=Cn(i),l=s?`openai-${r}-${a}-${s}.json`:`openai-${r}-${a}.json`,d=_.join(this.logDir,l),c={timestamp:new Date().toISOString(),request:e,response:n||null,error:o?{message:o.message,stack:o.stack}:null,context:Tn(i),system:{hostname:E.hostname(),platform:E.platform(),release:E.release(),nodeVersion:process.version}};try{return await re.writeFile(d,JSON.stringify(c,null,2),"utf-8"),d}catch(g){throw ae.error("Failed to write OpenAI log file:",g),new Error(`Failed to write OpenAI log file: ${g}`)}}async getLogFiles(e){this.initialized||await this.initialize();try{let o=(await re.readdir(this.logDir)).filter(i=>i.startsWith("openai-")&&i.endsWith(".json")).map(i=>_.join(this.logDir,i)).sort().reverse();return e?o.slice(0,e):o}catch(n){return n.code==="ENOENT"?[]:(ae.error("Failed to read OpenAI log directory:",n),[])}}async readLogFile(e){try{let n=await re.readFile(e,"utf-8");return JSON.parse(n)}catch(n){throw ae.error(`Failed to read log file ${e}:`,n),new Error(`Failed to read log file: ${n}`)}}},Uo=new V;f();var se="$runtime|";function Go(t){let e=t;for(;e.startsWith(se);){let n=e.split("|").slice(2).join("|");if(!n)break;e=n}return e}f();var le=["samplingParams","timeout","maxRetries","retryErrorCodes","enableCacheControl","schemaCompliance","reasoning","contextWindowSize","customHeaders","extra_body","modalities","splitToolMedia","matildaAgentSdk","matildaAgentPurpose","matildaAgentResponseMode","openAIRequestProfile"],bt=["model","apiKey","apiKeyEnvKey","baseUrl"],de=[...bt,...le],$o={openai:{apiKey:["OPENAI_API_KEY"],baseUrl:["OPENAI_BASE_URL"],model:["OPENAI_MODEL","MATILDA_MODEL"]},anthropic:{apiKey:["ANTHROPIC_API_KEY"],baseUrl:["ANTHROPIC_BASE_URL"],model:["ANTHROPIC_MODEL"]},gemini:{apiKey:["GEMINI_API_KEY"],baseUrl:[],model:["GEMINI_MODEL"]},"vertex-ai":{apiKey:["GOOGLE_API_KEY"],baseUrl:[],model:["GOOGLE_MODEL"]},"matilda-oauth":{apiKey:[],baseUrl:[],model:[]}},zo={openai:at,"matilda-oauth":U},ce=[{id:"coder-model",name:"coder-model",description:"Matilda 3.6 Plus \u2014 efficient hybrid model with leading coding performance",capabilities:{vision:!0}}],jo=ce.map(t=>t.id);f();f();f();f();Bt();f();import{AsyncLocalStorage as An}from"node:async_hooks";var It=new An;f();function kt(t){let e=t.candidates?.[0]?.content?.parts;return!e||e.length===0?!1:e.some(Mn)}function Mn(t){if(t===null||typeof t!="object")return!1;let e=t;return typeof e.text=="string"&&e.text.length>0||e.functionCall!==void 0||e.inlineData!==void 0||e.executableCode!==void 0||e.thought===!0}function wt(){let t=rt.getStore();return{attempt:t?.attempt??1,requestSetupMs:t?.requestSetupMs,retryTotalDelayMs:t?.retryTotalDelayMs}}var D=b("LOGGING_CONTENT_GENERATOR"),Sn=4096,Rt="...[truncated]",vn=Sn-Rt.length,J=class{constructor(e,n,o){this.wrapped=e;this.config=n;this.modalities=o.modalities,this.splitToolMedia=o.splitToolMedia,this.generatorAuthType=o.authType,o.enableOpenAILogging&&(this.openaiLogger=new V(o.openAILoggingDir,n.getWorkingDir()),this.schemaCompliance=o.schemaCompliance)}openaiLogger;schemaCompliance;modalities;splitToolMedia;generatorAuthType;getWrapped(){return this.wrapped}logApiRequest(e,n,o){let i=JSON.stringify(e);Xe(this.config,new et(n,o,i,P.getStore()))}_logApiResponse(e,n,o,i,r,a){Qe(this.config,new nt(e,o,n,i,this.generatorAuthType,r,a,P.getStore()))}_logApiError(e,n,o,i,r){let a=qe(o),s=H(o),l=o?.requestID||o?.request_id||e,d=j(o);Ze(this.config,new tt({responseId:l,model:i,durationMs:n,promptId:r,authType:this.generatorAuthType,errorMessage:a,errorType:s,statusCode:d,subagentName:P.getStore()}))}safelyLogApiError(e,n,o,i,r){try{this._logApiError(e,n,o,i,r)}catch(a){D.warn("Failed to log API error:",a)}}safelyLogApiResponse(e,n,o,i,r,a){try{this._logApiResponse(e,n,o,i,r,a)}catch(s){D.warn("Failed to log API response:",s)}}async generateContent(e,n){let o=wt(),i=be(e.model,n);try{i.setAttribute("llm_request.stream",!1)}catch{}let r=Se.setSpan(k.active(),i),a=Date.now(),s=K(n),l=this.startCaptureSession();try{Ie.recordGenerateContentRequest(e,{stream:!1,source:"generateContent"}),s||(ve(this.config,i,e.config?.systemInstruction),_e(this.config,i,e.config?.tools));let d=await k.with(r,async()=>{s||this.logApiRequest(this.toContents(e.contents),e.model,n);let c=await l.wrap(()=>this.wrapped.generateContent(e,n)),g=Date.now()-a,u=s?void 0:this.extractResponseText(c);s||xe(this.config,i,u),this.safelyLogApiResponse(c.responseId??"",g,c.modelVersion||e.model,n,c.usageMetadata,u);try{await this.safelyLogOpenAIInteraction(await l.resolve(e),c,void 0,n)}catch(m){D.warn("Failed to log OpenAI interaction:",m)}return c});return F(i,{success:!0,inputTokens:d.usageMetadata?.promptTokenCount,outputTokens:d.usageMetadata?.candidatesTokenCount,cachedInputTokens:d.usageMetadata?.cachedContentTokenCount,durationMs:Date.now()-a,responseId:d.responseId||void 0,finishReason:d.candidates?.[0]?.finishReason||void 0,thoughtsTokenCount:d.usageMetadata?.thoughtsTokenCount,subagentName:P.getStore()||void 0,...o}),d}catch(d){let c=Date.now()-a,g=e.config?.abortSignal?.aborted??!1;throw F(i,{success:!1,durationMs:c,error:g?ee:Q,errorType:H(d),errorStatusCode:j(d),subagentName:P.getStore()||void 0,...o}),await k.with(r,async()=>{this.safelyLogApiError("",c,d,e.model,n);try{await this.safelyLogOpenAIInteraction(await l.resolve(e),void 0,d,n)}catch(u){D.warn("Failed to log OpenAI interaction:",u)}}),d}}async generateContentStream(e,n){let o=wt(),i=be(e.model,n);try{i.setAttribute("llm_request.stream",!0)}catch{}let r=Se.setSpan(k.active(),i),a=Date.now(),s=K(n),l=this.startCaptureSession(),d;try{Ie.recordGenerateContentRequest(e,{stream:!0,source:"generateContentStream"}),s||(ve(this.config,i,e.config?.systemInstruction),_e(this.config,i,e.config?.tools)),d=await k.with(r,async()=>(s||this.logApiRequest(this.toContents(e.contents),e.model,n),l.wrap(()=>this.wrapped.generateContentStream(e,n))))}catch(g){let u=Date.now()-a;k.with(r,()=>this.safelyLogApiError("",u,g,e.model,n));let m=e.config?.abortSignal?.aborted??!1;F(i,{success:!1,durationMs:u,error:m?ee:Q,errorType:H(g),errorStatusCode:j(g),subagentName:P.getStore()||void 0,...o});try{await this.safelyLogOpenAIInteraction(await l.resolve(e),void 0,g,n)}catch(h){D.warn("Failed to log OpenAI interaction:",h)}throw g}let c;if(this.openaiLogger)try{c=await l.resolve(e)}catch(g){D.warn("Failed to resolve OpenAI request:",g)}return k.with(r,()=>this.loggingStreamWrapper(d,a,n,e.model,c,i,r,e.config?.abortSignal,o))}startCaptureSession(){let e,n=!this.openaiLogger;return{wrap:o=>n?o():It.run(i=>{e=i},o),resolve:async o=>this.openaiLogger?e??await this.buildOpenAIRequestForLogging(o):void 0}}async*loggingStreamWrapper(e,n,o,i,r,a,s,l,d){let c=K(o),g=!c||!!this.openaiLogger,u=[],m="",h="",p,C=!1,y,T,S=P.getStore(),R,z=!1,X=v=>s?k.with(s,v):v(),Ht=5*6e4,I,We=a?()=>{z||(I!==void 0&&clearTimeout(I),I=setTimeout(()=>{try{a.setAttribute("stream.timed_out",!0)}catch{}F(a,{success:!1,durationMs:Date.now()-n,error:"Stream span timed out (idle)",responseId:m||void 0,subagentName:S||void 0,...d}),z=!0},Ht),I.unref())}:void 0;We?.();try{for await(let x of e){!m&&x.responseId&&(m=x.responseId),!h&&x.modelVersion&&(h=x.modelVersion),g&&u.push(x),x.usageMetadata&&(p=x.usageMetadata);let Je=x.candidates?.[0];Je?.finishReason&&(y=Je.finishReason),R===void 0&&kt(x)&&(R=Date.now()-n),We?.(),yield x}I!==void 0&&(clearTimeout(I),I=void 0);let v=Date.now()-n,Z=g?this.consolidateGeminiResponsesForLogging(u):void 0,Ve=c?void 0:this.extractResponseText(Z);z||(X(()=>this.safelyLogApiResponse(m,v,h||i,o,p,Ve)),!c&&a&&xe(this.config,a,Ve),await X(()=>this.safelyLogOpenAIInteraction(r,Z,void 0,o)))}catch(v){if(C=!0,T=v,!z){let Z=Date.now()-n;X(()=>this.safelyLogApiError(m,Z,v,h||i,o)),await X(()=>this.safelyLogOpenAIInteraction(r,void 0,v,o))}throw v}finally{if(I!==void 0&&clearTimeout(I),a&&!z){let v=l?.aborted??!1;F(a,{success:!C,inputTokens:p?.promptTokenCount,outputTokens:p?.candidatesTokenCount,cachedInputTokens:p?.cachedContentTokenCount,ttftMs:R,durationMs:Date.now()-n,error:C?v?ee:Q:void 0,responseId:m||void 0,finishReason:y,thoughtsTokenCount:p?.thoughtsTokenCount,subagentName:S||void 0,errorType:T?H(T):void 0,errorStatusCode:T?j(T):void 0,...d})}}}async buildOpenAIRequestForLogging(e){if(!this.openaiLogger)return;let n=this.createLoggingRequestContext(e.model),o=ne.convertGeminiRequestToOpenAI(e,n,{cleanOrphanToolCalls:!1}),i={model:e.model,messages:o};return e.config?.tools&&(i.tools=await ne.convertGeminiToolsToOpenAI(e.config.tools,this.schemaCompliance??"auto")),e.config?.temperature!==void 0&&(i.temperature=e.config.temperature),e.config?.topP!==void 0&&(i.top_p=e.config.topP),e.config?.maxOutputTokens!==void 0&&(i.max_tokens=e.config.maxOutputTokens),e.config?.presencePenalty!==void 0&&(i.presence_penalty=e.config.presencePenalty),e.config?.frequencyPenalty!==void 0&&(i.frequency_penalty=e.config.frequencyPenalty),i}createLoggingRequestContext(e){return{model:e,modalities:this.modalities??{},splitToolMedia:this.splitToolMedia??!0,startTime:0}}async logOpenAIInteraction(e,n,o,i){if(!this.openaiLogger||!e)return;let r=n?this.convertGeminiResponseToOpenAIForLogging(n,e):void 0;await this.openaiLogger.logInteraction(e,r,o instanceof Error?o:o?new Error(String(o)):void 0,i)}async safelyLogOpenAIInteraction(e,n,o,i){try{await this.logOpenAIInteraction(e,n,o,i)}catch(r){D.warn("Failed to log OpenAI interaction:",r)}}convertGeminiResponseToOpenAIForLogging(e,n){return ne.convertGeminiResponseToOpenAI(e,this.createLoggingRequestContext(n.model))}consolidateGeminiResponsesForLogging(e){if(e.length===0)return;let n=new B,o=[],i=new Map,r,a;for(let d of e){d.usageMetadata&&(a=d.usageMetadata);let c=d.candidates?.[0];c?.finishReason&&(r=c.finishReason);let g=c?.content?.parts??[];for(let u of g){if(typeof u=="string"){o.push({text:u});continue}if("text"in u){u.text&&o.push({text:u.text,...u.thought?{thought:!0}:{},...u.thoughtSignature?{thoughtSignature:u.thoughtSignature}:{}});continue}if("functionCall"in u&&u.functionCall){let m=u.functionCall.id||u.functionCall.name||"tool_call",h=i.get(m),p={functionCall:u.functionCall};h!==void 0?o[h]=p:(i.set(m,o.length),o.push(p));continue}if("functionResponse"in u&&u.functionResponse){o.push({functionResponse:u.functionResponse});continue}o.push(u)}}let s=e[e.length-1],l=s.candidates?.[0];return n.responseId=s.responseId,n.createTime=s.createTime,n.modelVersion=s.modelVersion,n.promptFeedback=s.promptFeedback,n.usageMetadata=a,n.candidates=[{content:{role:l?.content?.role||"model",parts:o},...r?{finishReason:r}:{},index:0,safetyRatings:l?.safetyRatings||[]}],n}extractResponseText(e){let n=e?.candidates?.[0]?.content?.parts;if(!n?.length)return;let o="",i=!1,r=!1,a=s=>{if(i=!0,r)return;let l=vn-o.length;if(s.length<=l){o+=s;return}o+=s.slice(0,Math.max(0,l)),r=!0};for(let s of n){if(typeof s=="string"){a(s);continue}"text"in s&&typeof s.text=="string"&&!("thought"in s&&s.thought)&&a(s.text)}if(i)return r?`${o}${Rt}`:o}async countTokens(e){return this.wrapped.countTokens(e)}async embedContent(e){return this.wrapped.embedContent(e)}useSummarizedThinking(){return this.wrapped.useSummarizedThinking()}toContents(e){return Array.isArray(e)?e.map(n=>this.toContent(n)):[this.toContent(e)]}toContent(e){return Array.isArray(e)?{role:"user",parts:this.toParts(e)}:typeof e=="string"?{role:"user",parts:[{text:e}]}:"parts"in e?{...e,parts:e.parts?this.toParts(e.parts.filter(n=>n!=null)):[]}:{role:"user",parts:[this.toPart(e)]}}toParts(e){return e.map(n=>this.toPart(n))}toPart(e){if(typeof e=="string")return{text:e};if("thought"in e&&e.thought){let n=`[Thought: ${e.thought}]`,o={...e};if(delete o.thought,"functionCall"in o||"functionResponse"in o||"inlineData"in o||"fileData"in o)return o;let r=o.text,a=r?String(r):"",s=a?`${a}
|
|
8
8
|
${n}`:n;return{...o,text:s}}return e}};f();function Pt(t){switch(t){case"openai":return"OPENAI_API_KEY";case"anthropic":return"ANTHROPIC_API_KEY";case"gemini":return"GEMINI_API_KEY";case"vertex-ai":return"GOOGLE_API_KEY";default:return"API_KEY"}}function Et(t){switch(t){case"openai":return"OPENAI_MODEL";case"anthropic":return"ANTHROPIC_MODEL";case"gemini":return"GEMINI_MODEL";case"vertex-ai":return"GOOGLE_MODEL";default:return"MODEL"}}var O=class extends Error{constructor(e){super(e),this.name=new.target.name,Object.setPrototypeOf(this,new.target.prototype)}},ue=class extends O{code="STRICT_MISSING_CREDENTIALS";constructor(e,n,o){let i=e||"(unknown)",r=n||"(unknown)";super(`Missing credentials for modelProviders model '${r}'. `+(o?`Current configured envKey: '${o}'. Set that environment variable, or update modelProviders.${i}[].envKey.`:`Configure modelProviders.${i}[].envKey and set that environment variable.`))}},pe=class extends O{code="STRICT_MISSING_MODEL_ID";constructor(e){super(`Missing model id for strict modelProviders resolution (authType: ${e}).`)}},ge=class extends O{code="MISSING_API_KEY";constructor(e){super(`Missing API key for ${e.authType} auth. Current model: '${e.model||"(unknown)"}', baseUrl: '${e.baseUrl||"(default)"}'. Provide an API key via settings (security.auth.apiKey), or set the environment variable '${e.envKey}'.`)}},fe=class extends O{code="MISSING_MODEL";constructor(e){super(`Missing model for ${e.authType} auth. Set the environment variable '${e.envKey}'.`)}},he=class extends O{code="MISSING_BASE_URL";constructor(e){super(`Missing baseUrl for modelProviders model '${e.model||"(unknown)"}'. Configure modelProviders.${e.authType||"(unknown)"}[].baseUrl.`)}},me=class extends O{code="MISSING_ANTHROPIC_BASE_URL_ENV";constructor(){super("ANTHROPIC_BASE_URL environment variable not found.")}};f();import xn from"node:process";f();var Ot={image:!0,pdf:!0,audio:!0,video:!0},_n=[[/^gemini-3/,Ot],[/^gemini-/,Ot],[/^gpt-5/,{image:!0}],[/^gpt-/,{image:!0}],[/^o\d/,{image:!0}],[/^claude-/,{image:!0,pdf:!0}],[/^matilda3\.5-plus/,{image:!0,video:!0}],[/^matilda3\.6-plus/,{image:!0,video:!0}],[/^matilda3\.7-plus/,{image:!0,video:!0}],[/^coder-model$/,{image:!0,video:!0}],[/^matilda-vl-/,{image:!0,video:!0}],[/^matilda3-vl-/,{image:!0,video:!0}],[/^matilda-code$/,{}],[/^matilda3-coder-/,{}],[/^matilda3\.6-35b/,{image:!0,video:!0}],[/^matilda/,{}],[/^deepseek/,{}],[/^glm-4\.5v/,{image:!0}],[/^glm-5(?:-|$)/,{}],[/^glm-/,{}],[/^minimax-m3/i,{image:!0,video:!0}],[/^minimax-/,{}],[/^kimi-k2\.5/,{image:!0,video:!0}],[/^kimi-/,{}],[/^doubao-seed(ance|ream)/,{}],[/^doubao-seed/,{image:!0}],[/^doubao-.*(vision|vl)/,{image:!0}],[/^doubao/,{}]];function q(t){let e=st(t);for(let[n,o]of _n)if(n.test(e))return{...o};return{}}f();var Ut=class t{modelRegistry;currentAuthType;_generationConfig;generationConfigSources;strictModelProviderSelection=!1;requireCachedMatildaCredentialsOnce=!1;hasManualCredentials=!1;onModelChange;authTypeWasExplicitlyProvided;runtimeModelSnapshots=new Map;activeRuntimeModelSnapshotId;static deepClone(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(o=>t.deepClone(o));let n={};for(let o of Object.keys(e))n[o]=t.deepClone(e[o]);return n}constructor(e={}){this.modelRegistry=new Ce(e.modelProvidersConfig),this.onModelChange=e.onModelChange,this._generationConfig={...e.generationConfig||{}},this.generationConfigSources=e.generationConfigSources||{},this.authTypeWasExplicitlyProvided=e.initialAuthType!==void 0,this.currentAuthType=e.initialAuthType}createStateSnapshotForRollback(){return{currentAuthType:this.currentAuthType,generationConfig:t.deepClone(this._generationConfig),generationConfigSources:t.deepClone(this.generationConfigSources),strictModelProviderSelection:this.strictModelProviderSelection,requireCachedMatildaCredentialsOnce:this.requireCachedMatildaCredentialsOnce,hasManualCredentials:this.hasManualCredentials,activeRuntimeModelSnapshotId:this.activeRuntimeModelSnapshotId}}rollbackToStateSnapshot(e){this.currentAuthType=e.currentAuthType,this._generationConfig=e.generationConfig,this.generationConfigSources=e.generationConfigSources,this.strictModelProviderSelection=e.strictModelProviderSelection,this.requireCachedMatildaCredentialsOnce=e.requireCachedMatildaCredentialsOnce,this.hasManualCredentials=e.hasManualCredentials,this.activeRuntimeModelSnapshotId=e.activeRuntimeModelSnapshotId}getModel(){return this._generationConfig.model||U}getCurrentAuthType(){return this.currentAuthType}wasAuthTypeExplicitlyProvided(){return this.authTypeWasExplicitlyProvided}getAvailableModels(){return this.currentAuthType?this.modelRegistry.getModelsForAuthType(this.currentAuthType):[]}getAvailableModelsForAuthType(e){return this.modelRegistry.getModelsForAuthType(e)}getAllConfiguredModels(e){let n=e&&e.length>0?e:Object.values(G),o=new Set,i=[];for(let l of n)o.has(l)||(o.add(l),i.push(l));let r=[];i.includes("matilda-oauth")&&r.push("matilda-oauth");for(let l of i)l!=="matilda-oauth"&&r.push(l);let a=this.getRuntimeModelOption(),s=[];for(let l of r)a&&a.authType===l&&s.push(a),s.push(...this.modelRegistry.getModelsForAuthType(l));return s}hasModel(e,n){return this.modelRegistry.hasModel(e,n)}getResolvedModel(e,n){return this.modelRegistry.getModel(e,n)}getModelDisplayName(e){return/^matilda-code/i.test(e.trim())?"Matilda":this.currentAuthType?this.modelRegistry.getModel(this.currentAuthType,e)?.name??e:e}async setModel(e,n){if(this.currentAuthType==="matilda-oauth"&&e===U){this.strictModelProviderSelection=!1,this._generationConfig.model=e,this.generationConfigSources.model={kind:"programmatic",detail:n?.reason||"setModel"},this.onModelChange&&await this.onModelChange("matilda-oauth",!1);return}if(this.currentAuthType&&this.modelRegistry.hasModel(this.currentAuthType,e)){await this.switchModel(this.currentAuthType,e);return}let o=this.createStateSnapshotForRollback();try{this.strictModelProviderSelection=!1,this._generationConfig.model=e,this.generationConfigSources.model={kind:"programmatic",detail:n?.reason||"setModel"},this.applyRawModelDerivedDefaults(e),this.onModelChange&&this.currentAuthType&&await this.onModelChange(this.currentAuthType,!0)}catch(i){throw this.rollbackToStateSnapshot(o),i}}applyRawModelDerivedDefaults(e){this.shouldUpdateModelDerivedDefault("modalities")&&(this._generationConfig.modalities=q(e),this.generationConfigSources.modalities={kind:"computed",detail:"auto-detected from model"}),this.shouldUpdateModelDerivedDefault("contextWindowSize")&&(this._generationConfig.contextWindowSize=W(e,"input"),this.generationConfigSources.contextWindowSize={kind:"computed",detail:"auto-detected from model"})}shouldUpdateModelDerivedDefault(e){let n=this.generationConfigSources[e];return n===void 0||n.kind==="computed"||n.kind==="default"||n.kind==="modelProviders"||n.kind==="programmatic"||n.kind==="unknown"}async switchModel(e,n,o){let i=this.extractRuntimeModelSnapshotId(n);if(i){await this.switchToRuntimeModel(i);return}let r=this.createStateSnapshotForRollback();e==="matilda-oauth"&&o?.requireCachedCredentials&&(this.requireCachedMatildaCredentialsOnce=!0);try{let a=e!==this.currentAuthType;this.currentAuthType=e;let s=this.modelRegistry.getModel(e,n,o?.baseUrl);if(!s)throw new Error(`Model '${n}' not found for authType '${e}'`);let l=r.generationConfig.model||"",d=!a&&l?this.modelRegistry.getModel(e,l,r.generationConfig.baseUrl)??this.modelRegistry.getModel(e,l):void 0,c=e!=="matilda-oauth"&&!a&&!!r.generationConfig.apiKey&&!!s.envKey&&d?.envKey===s.envKey&&d.baseUrl===s.baseUrl,g=c?r.generationConfig.apiKey:void 0,u=c?r.generationConfigSources.apiKey:void 0;this.applyResolvedModelDefaults(s),!this._generationConfig.apiKey&&g&&(this._generationConfig.apiKey=g,u&&(this.generationConfigSources.apiKey=t.deepClone(u))),this.activeRuntimeModelSnapshotId=void 0;let m=a?!0:this.checkRequiresRefresh(l);this.onModelChange&&await this.onModelChange(e,m)}catch(a){throw this.rollbackToStateSnapshot(r),a}}buildRuntimeModelSnapshotId(e,n){return`${se}${e}|${n}`}extractRuntimeModelSnapshotId(e){if(e.startsWith(se))return this.runtimeModelSnapshots.has(e)?e:void 0;if(this.runtimeModelSnapshots.has(e))return e}getGenerationConfig(){return this._generationConfig}getGenerationConfigSources(){return this.generationConfigSources}mergeSettingsGenerationConfig(e){if(e)for(let n of le)!(n in this._generationConfig)&&n in e&&(this._generationConfig[n]=e[n],this.generationConfigSources[n]={kind:"settings",detail:`model.generationConfig.${n}`})}updateCredentials(e,n){(e.apiKey||e.baseUrl||e.model)&&(this.hasManualCredentials=!0,this.clearProviderSourcedConfig()),e.apiKey&&(this._generationConfig.apiKey=e.apiKey,this.generationConfigSources.apiKey={kind:"programmatic",detail:"updateCredentials"}),e.baseUrl&&(this._generationConfig.baseUrl=e.baseUrl,this.generationConfigSources.baseUrl={kind:"programmatic",detail:"updateCredentials"}),e.model&&(this._generationConfig.model=e.model,this.generationConfigSources.model={kind:"programmatic",detail:"updateCredentials"}),this.strictModelProviderSelection=!1,this._generationConfig.apiKeyEnvKey=void 0,n&&this.mergeSettingsGenerationConfig(n),this.syncRuntimeModelSnapshotWithCredentials()}syncRuntimeModelSnapshotWithCredentials(){let e=this.currentAuthType,{model:n,apiKey:o,baseUrl:i}=this._generationConfig;if(!(!n||!e||!o||!i)&&!this.modelRegistry.hasModel(e,n,i))if(this.activeRuntimeModelSnapshotId&&this.runtimeModelSnapshots.has(this.activeRuntimeModelSnapshotId)){let r=this.runtimeModelSnapshots.get(this.activeRuntimeModelSnapshotId);r.apiKey=o,r.baseUrl=i,r.modelId=n;let a=this.buildRuntimeModelSnapshotId(r.authType,r.modelId);a!==r.id&&(this.runtimeModelSnapshots.delete(r.id),r.id=a,this.runtimeModelSnapshots.set(a,r),this.activeRuntimeModelSnapshotId=a),r.createdAt=Date.now()}else this.detectAndCaptureRuntimeModel()}clearProviderSourcedConfig(){for(let e of de)this.generationConfigSources[e]?.kind==="modelProviders"&&(delete this._generationConfig[e],delete this.generationConfigSources[e])}isStrictModelProviderSelection(){return this.strictModelProviderSelection}resetStrictModelProviderSelection(){this.strictModelProviderSelection=!1}consumeRequireCachedCredentialsFlag(){let e=this.requireCachedMatildaCredentialsOnce;return this.requireCachedMatildaCredentialsOnce=!1,e}applyResolvedModelDefaults(e){if(this.strictModelProviderSelection=!0,this.hasManualCredentials=!1,this._generationConfig.model=e.id,this.generationConfigSources.model={kind:"modelProviders",authType:e.authType,modelId:e.id,detail:"model.id"},this.currentAuthType==="matilda-oauth"?(this._generationConfig.apiKey="MATILDA_OAUTH_DYNAMIC_TOKEN",this.generationConfigSources.apiKey={kind:"computed",detail:"Matilda OAuth placeholder token"},this._generationConfig.apiKeyEnvKey=void 0,delete this.generationConfigSources.apiKeyEnvKey):(this._generationConfig.apiKey=void 0,this._generationConfig.apiKeyEnvKey=void 0),e.envKey!==void 0){let o=xn.env[e.envKey];o&&(this._generationConfig.apiKey=o,this.generationConfigSources.apiKey={kind:"env",envKey:e.envKey,via:{kind:"modelProviders",authType:e.authType,modelId:e.id,detail:"envKey"}}),this._generationConfig.apiKeyEnvKey=e.envKey,this.generationConfigSources.apiKeyEnvKey={kind:"modelProviders",authType:e.authType,modelId:e.id,detail:"envKey"}}this._generationConfig.baseUrl=e.baseUrl,this.generationConfigSources.baseUrl={kind:"modelProviders",authType:e.authType,modelId:e.id,detail:"baseUrl"};let n=e.generationConfig;for(let o of le)this._generationConfig[o]=n[o],this.generationConfigSources[o]={kind:"modelProviders",authType:e.authType,modelId:e.id,detail:`generationConfig.${o}`};n.contextWindowSize===void 0&&(this._generationConfig.contextWindowSize=W(e.id,"input"),this.generationConfigSources.contextWindowSize={kind:"computed",detail:"auto-detected from model"}),n.modalities===void 0&&(this._generationConfig.modalities=q(e.id),this.generationConfigSources.modalities={kind:"computed",detail:"auto-detected from model"})}checkRequiresRefresh(e){let n=this.currentAuthType;if(!n)return!0;if(n==="matilda-oauth")return!1;let o=this.modelRegistry.getModel(n,this._generationConfig.model||"",this._generationConfig.baseUrl||void 0),i=this.modelRegistry.getModel(n,e);return!i||!o||i.envKey!==o.envKey||i.baseUrl!==o.baseUrl}syncAfterAuthRefresh(e,n){this.strictModelProviderSelection=!1;let o=this.currentAuthType;this.currentAuthType=e;let i=this.generationConfigSources.baseUrl?.kind==="modelProviders"?this._generationConfig.baseUrl:void 0,r=n?this.modelRegistry.getModel(e,n,i)??this.modelRegistry.getModel(e,n):void 0;if(r){let m=this.generationConfigSources.baseUrl?.kind==="modelProviders"&&(this._generationConfig.apiKeyEnvKey!==r.envKey||this._generationConfig.baseUrl!==r.baseUrl),h=o===e&&this._generationConfig.model===n&&!m,p=h?this._generationConfig.apiKey:void 0,C=h&&this.generationConfigSources.apiKey?{...this.generationConfigSources.apiKey}:void 0,y=this.generationConfigSources.baseUrl,T=h&&!!this._generationConfig.baseUrl&&(y?.kind==="cli"||y?.kind==="env"||y?.kind==="settings"),S=T?this._generationConfig.baseUrl:void 0,R=T&&y?{...y}:void 0;this.applyResolvedModelDefaults(r),h&&!this._generationConfig.apiKey&&p&&(this._generationConfig.apiKey=p,C&&(this.generationConfigSources.apiKey=C)),S&&(this._generationConfig.baseUrl=S,R&&(this.generationConfigSources.baseUrl=R)),this.strictModelProviderSelection=!0,this.activeRuntimeModelSnapshotId=void 0;return}let a=this.generationConfigSources.apiKey,s=this.generationConfigSources.baseUrl,l=this._generationConfig.apiKey&&a?.kind!=="modelProviders"||this._generationConfig.baseUrl&&s?.kind!=="modelProviders";if(!(o!==e)&&(n===void 0||!this.modelRegistry.hasModel(e,n))&&(this.hasManualCredentials||l)){n&&(this._generationConfig.model=n,this.generationConfigSources.model||(this.generationConfigSources.model={kind:"programmatic",detail:"auth refresh (preserved credentials)"}));return}let g=this.modelRegistry.getDefaultModelForAuthType(e);if(g){this.applyResolvedModelDefaults(g),this.activeRuntimeModelSnapshotId=void 0;return}n&&(this._generationConfig.model=n,this.generationConfigSources.model||(this.generationConfigSources.model={kind:"programmatic",detail:"auth refresh (no default model)"}))}setOnModelChange(e){this.onModelChange=e}detectAndCaptureRuntimeModel(){let{model:e,apiKey:n,baseUrl:o,apiKeyEnvKey:i,...r}=this._generationConfig,a=this.currentAuthType;if(!e||!a)return;if(this.modelRegistry.hasModel(a,e,o)){this.clearRuntimeModelSnapshotForAuthType(a);return}if(!(this._generationConfig.apiKey&&this._generationConfig.baseUrl))return;let l=this.buildRuntimeModelSnapshotId(a,e),d={id:l,authType:a,modelId:e,apiKey:n,baseUrl:o,apiKeyEnvKey:i,generationConfig:r,sources:{...this.generationConfigSources},createdAt:Date.now()};return this.runtimeModelSnapshots.set(l,d),this.activeRuntimeModelSnapshotId=l,this.cleanupOldRuntimeModelSnapshots(),l}getActiveRuntimeModelSnapshot(){if(this.activeRuntimeModelSnapshotId)return this.runtimeModelSnapshots.get(this.activeRuntimeModelSnapshotId)}getActiveRuntimeModelSnapshotId(){return this.activeRuntimeModelSnapshotId}async switchToRuntimeModel(e){let n=this.runtimeModelSnapshots.get(e);if(!n)throw new Error(`Runtime model snapshot '${e}' not found`);let o=this.createStateSnapshotForRollback();try{let i=n.authType!==this.currentAuthType;this.currentAuthType=n.authType,this.activeRuntimeModelSnapshotId=e,this.strictModelProviderSelection=!1,this.hasManualCredentials=!0,this._generationConfig.model=n.modelId,this.generationConfigSources.model={kind:"programmatic",detail:"runtimeModelSwitch"},n.apiKey&&(this._generationConfig.apiKey=n.apiKey,this.generationConfigSources.apiKey=n.sources.apiKey||{kind:"programmatic",detail:"runtimeModelSwitch"}),n.baseUrl&&(this._generationConfig.baseUrl=n.baseUrl,this.generationConfigSources.baseUrl=n.sources.baseUrl||{kind:"programmatic",detail:"runtimeModelSwitch"}),n.apiKeyEnvKey&&(this._generationConfig.apiKeyEnvKey=n.apiKeyEnvKey),n.generationConfig&&Object.assign(this._generationConfig,n.generationConfig);let r=i;this.onModelChange&&await this.onModelChange(n.authType,r)}catch(i){throw this.rollbackToStateSnapshot(o),i}}getRuntimeModelOption(){let e=this.getActiveRuntimeModelSnapshot();if(e)return{id:e.modelId,label:e.modelId,authType:e.authType,isVision:!1,contextWindowSize:e.generationConfig?.contextWindowSize,isRuntimeModel:!0,runtimeSnapshotId:e.id}}clearRuntimeModelSnapshotForAuthType(e){for(let[n,o]of this.runtimeModelSnapshots.entries())o.authType===e&&(this.runtimeModelSnapshots.delete(n),this.activeRuntimeModelSnapshotId===n&&(this.activeRuntimeModelSnapshotId=void 0))}cleanupOldRuntimeModelSnapshots(){let e=new Map;for(let n of this.runtimeModelSnapshots.values()){let o=e.get(n.authType);(!o||n.createdAt>o.createdAt)&&e.set(n.authType,n)}this.runtimeModelSnapshots.clear();for(let n of e.values())this.runtimeModelSnapshots.set(n.id,n);this.activeRuntimeModelSnapshotId&&!this.runtimeModelSnapshots.has(this.activeRuntimeModelSnapshotId)&&(this.activeRuntimeModelSnapshotId=void 0)}reloadModelProvidersConfig(e){this.modelRegistry.reloadModels(e)}};f();import{readFileSync as zn}from"node:fs";import{join as jn}from"node:path";f();f();import{randomBytes as bn,createHash as In}from"node:crypto";function Lt(t){return t==="localhost"||t==="127.0.0.1"||t==="::1"||t==="[::1]"}function Le(){let t=bn(32).toString("base64url"),e=In("sha256").update(t).digest("base64url");return{codeVerifier:t,codeChallenge:e}}function Y(t,e){return{accessToken:t.access_token,refreshToken:t.refresh_token??e?.refreshToken,expiresAt:Date.now()+(t.expires_in??3600)*1e3,idToken:t.id_token??e?.idToken}}async function De(t){let e=t.replace(/\/+$/,""),n=new URL("/.well-known/oauth-authorization-server",e);if(n.protocol!=="https:"&&!Lt(n.hostname))throw new Error(`Refusing OAuth discovery over insecure transport: ${n.origin}`);let o=await fetch(n,{headers:{accept:"application/json"}});if(!o.ok)throw new Error(`OAuth discovery failed (${o.status}) for ${n.origin}`);let i=await o.json();if(!i.issuer||!i.authorization_endpoint||!i.token_endpoint)throw new Error(`OAuth discovery document missing required fields for ${n.origin}`);return{issuer:i.issuer,authorization_endpoint:i.authorization_endpoint,token_endpoint:i.token_endpoint,device_authorization_endpoint:i.device_authorization_endpoint}}f();import{promises as ye,openSync as kn,closeSync as wn,unlinkSync as Dt,statSync as Rn}from"node:fs";import{dirname as Pn}from"node:path";var En=1e4,On=3e4,Un=50;function Ge(t){let e=async()=>{try{let i=await ye.readFile(t,"utf8"),r=JSON.parse(i);return r&&typeof r=="object"?r:{}}catch(i){if(i.code==="ENOENT")return{};throw i}},n=async i=>{await ye.mkdir(Pn(t),{recursive:!0}),await ye.writeFile(t,JSON.stringify(i,null,2),{mode:384}),await ye.chmod(t,384).catch(()=>{})};return{store:{async get(i){return(await e())[i]??null},async set(i,r){let a=await e();a[i]=r,await n(a)},async remove(i){let r=await e();i in r&&(delete r[i],await n(r))}},lock:Ln(`${t}.lock`)}}function Ln(t){let e=Promise.resolve();return n=>{let o=e.then(async()=>{await Dn(t);try{return await n()}finally{Gn(t)}});return e=o.then(()=>{},()=>{}),o}}async function Dn(t){let e=Date.now()+En;for(;;)try{wn(kn(t,"wx"));return}catch(n){if(n.code!=="EEXIST")throw n;try{if(Date.now()-Rn(t).mtimeMs>On){Dt(t);continue}}catch{continue}if(Date.now()>e)throw new Error(`Timed out acquiring credential lock at ${t}`);await Nn(Un)}}function Gn(t){try{Dt(t)}catch{}}function Nn(t){return new Promise(e=>setTimeout(e,t))}f();var $=class extends Error{code="invalid_grant";constructor(e="Refresh token is no longer valid \u2014 sign in again."){super(e),this.name="InvalidGrantError"}};function Ne(t){let e=t.storageKey??"default",n=t.fetchImpl??fetch,o=t.expirySkewMs??6e4,i=null,r=async()=>{let l=await t.store.get(e);if(!l)return null;try{let d=JSON.parse(l);return d.accessToken?d:null}catch{return null}},a=l=>l.expiresAt-Date.now()>o,s=l=>t.lock(async()=>{let d=await r()??l;if(d.accessToken!==l.accessToken&&a(d))return d.accessToken;if(!d.refreshToken)throw new $("No refresh token available \u2014 sign in again.");let c=await n(t.tokenEndpoint,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",client_id:t.clientId,refresh_token:d.refreshToken})});if(!c.ok){let m=await c.text().catch(()=>"");throw c.status>=400&&c.status<500&&Kn(m)==="invalid_grant"?(await t.store.remove(e),new $):new Error(`Token refresh failed (${c.status})`)}let g=await c.json(),u=Y(g,d);return await t.store.set(e,JSON.stringify(u)),u.accessToken});return{async getAccessToken(l){let d=await r();if(!d)throw new $("Not signed in.");return!l?.forceRefresh&&a(d)?d.accessToken:(i||(i=s(d).finally(()=>{i=null})),i)}}}function Kn(t){try{return JSON.parse(t).error}catch{return}}f();import{createServer as Fn}from"node:http";import{randomBytes as $n}from"node:crypto";async function Ke(t){if(t.transport.kind!=="loopback")throw new Error(`Unsupported login transport: ${t.transport.kind}`);if(t.signal?.aborted)throw new Error("Login aborted");let e=h=>t.onEvent?.(h),{codeVerifier:n,codeChallenge:o}=Le(),i=$n(16).toString("hex"),r=t.timeoutMs??5*60*1e3,a=t.transport.successRedirect;e({type:"state",status:"idle"});let s,l,d=new Promise((h,p)=>{s=h,l=p});d.catch(()=>{});let c=Fn((h,p)=>{let C=new URL(h.url??"/","http://127.0.0.1");if(C.pathname!=="/callback"){p.writeHead(404).end();return}let y=C.searchParams.get("error"),T=C.searchParams.get("state"),S=C.searchParams.get("code");if(y){Gt(p,a,()=>l(new Error(`OAuth error: ${y}`)));return}if(T!==i){p.writeHead(400).end("State mismatch"),l(new Error("OAuth state mismatch"));return}if(!S){p.writeHead(400).end("Missing authorization code");return}Gt(p,a,()=>s(S))}),g=await new Promise((h,p)=>{c.once("error",p),c.listen(t.transport.port??0,"127.0.0.1",()=>{h(c.address().port)})}),u=setTimeout(()=>l(new Error("Login timed out \u2014 no callback received")),r),m=()=>l(new Error("Login aborted"));t.signal?.addEventListener("abort",m,{once:!0});try{let h=`http://127.0.0.1:${g}/callback`,p=new URL(t.metadata.authorization_endpoint);p.searchParams.set("client_id",t.clientId),p.searchParams.set("response_type","code"),p.searchParams.set("redirect_uri",h),p.searchParams.set("code_challenge",o),p.searchParams.set("code_challenge_method","S256"),p.searchParams.set("state",i),p.searchParams.set("scope",t.scope??"openid offline_access");let C=p.toString();e({type:"authorize_url",url:C}),e({type:"state",status:"awaiting_user"}),t.openBrowser&&await t.openBrowser(C);let y=await d;e({type:"state",status:"exchanging"});let T=await fetch(t.metadata.token_endpoint,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",client_id:t.clientId,code:y,code_verifier:n,redirect_uri:h})});if(!T.ok){let R=await T.text().catch(()=>"");throw new Error(`Token exchange failed (${T.status}): ${R}`)}let S=Y(await T.json());return e({type:"state",status:"authenticated"}),S}catch(h){throw e({type:"state",status:"error"}),h}finally{clearTimeout(u),t.signal?.removeEventListener("abort",m),c.close()}}function Gt(t,e,n){t.writeHead(302,{location:e}).end(n)}var Fe="matilda-code",Te="MATILDA_API_KEY",Hn="openid profile email offline_access matilda:code",Ae="matilda";function $e(t){return t.trim().replace(/\/+$/,"").replace(/\/api\/v1(?:\/code)?$/i,"")}function Nt(){return jn(Ye.getGlobalMatildaDir(),"matilda-auth.json")}function ze(){return Ge(Nt())}function Bn(t){if(!t)return{};try{let e=t.split(".")[1],n=Buffer.from(e.replace(/-/g,"+").replace(/_/g,"/"),"base64").toString("utf8"),o=JSON.parse(n);return{sub:o.sub,email:o.email,name:o.name}}catch{return{}}}function Wn(t,e){let n=Bn(t.idToken);return{accessToken:t.accessToken,accessTokenExpiresAt:t.expiresAt,refreshToken:t.refreshToken??"",userId:n.sub,email:n.email,displayName:n.name,baseUrl:e}}async function Kt(t){try{return await De(t)}catch{return{issuer:t,authorization_endpoint:`${t}/api/auth/oauth/authorize`,token_endpoint:`${t}/api/auth/oauth/token`,device_authorization_endpoint:`${t}/api/auth/oauth/device/code`}}}function N(){try{let t=zn(Nt(),"utf8"),n=JSON.parse(t)[Ae];if(!n)return null;let o=JSON.parse(n);return typeof o?.accessToken=="string"&&typeof o?.baseUrl=="string"?o:null}catch{return null}}async function Vn(t){await ze().store.set(Ae,JSON.stringify(t)),process.env[Te]=t.accessToken}async function Jn(){await ze().store.remove(Ae),delete process.env[Te]}function dr(){let t=N();return t?{authenticated:!0,userId:t.userId,email:t.email,displayName:t.displayName,baseUrl:t.baseUrl,accessTokenExpiresAt:t.accessTokenExpiresAt}:{authenticated:!1}}async function cr(t){let e=N();if(e?.accessToken){let n=$e(e.baseUrl);await fetch(`${n}/api/auth/logout`,{method:"POST",headers:{authorization:`Bearer ${e.accessToken}`,"content-type":"application/json"},body:JSON.stringify(e.refreshToken?{refreshToken:e.refreshToken}:{}),signal:t?.signal??AbortSignal.timeout(5e3)}).catch(()=>{})}await Jn()}async function je(t){let e=N();if(!e||t?.baseUrl&&e.baseUrl!==t.baseUrl)return t?.fallbackAccessToken??process.env[Te]??"";let n=$e(e.baseUrl),o=await Kt(n),{store:i,lock:r}=ze(),s=await qn(i,r,o.token_endpoint,e.baseUrl,t?.signal).getAccessToken({forceRefresh:t?.forceRefresh});return process.env[Te]=s,s}async function ur(){await je();let t=N();if(!t)throw new Error("No Matilda credentials to refresh \u2014 sign in again.");return t}function qn(t,e,n,o,i){return Ne({tokenEndpoint:n,clientId:Fe,store:{get:async s=>{let l=JSON.parse(await t.get(s)??"{}");if(!l.accessToken)return null;let d={accessToken:l.accessToken,refreshToken:l.refreshToken,expiresAt:l.accessTokenExpiresAt};return JSON.stringify(d)},set:async(s,l)=>{let d=JSON.parse(l),c=JSON.parse(await t.get(s)??"{}"),g={...c,accessToken:d.accessToken,accessTokenExpiresAt:d.expiresAt,refreshToken:d.refreshToken??c.refreshToken??"",baseUrl:c.baseUrl??o};await t.set(s,JSON.stringify(g))},remove:s=>t.remove(s)},storageKey:Ae,lock:e,fetchImpl:(s,l)=>fetch(s,{...l,signal:i}),expirySkewMs:3e5})}async function pr(t){let e=$e(t.baseUrl),n=await Kt(e),o="",i=s=>Ke({metadata:n,clientId:Fe,scope:s,transport:{kind:"loopback",successRedirect:`${e}/api/auth/oauth/success?client_id=${encodeURIComponent(Fe)}`},signal:t.signal,onEvent:l=>{l.type==="authorize_url"&&(o=l.url,t.onAuthorizeUrl?.(l.url))},openBrowser:async l=>{if(t.openBrowser===!1||process.env.MATILDA_AUTH_SKIP_BROWSER==="1")return;let{default:d}=await import("./open-QQ7FWG4A.js");await d(l).catch(()=>{})}}),r;try{r=await i(Hn)}catch(s){if(s instanceof Error&&s.message.includes("invalid_scope"))r=await i("openid offline_access");else throw s}let a=Wn(r,t.baseUrl);return await Vn(a),{...a,authorizeUrl:o}}var G=(r=>(r.USE_OPENAI="openai",r.MATILDA_OAUTH="matilda-oauth",r.USE_GEMINI="gemini",r.USE_VERTEX_AI="vertex-ai",r.USE_ANTHROPIC="anthropic",r))(G||{}),Yn="MATILDA_AGENT_SDK",Me="MATILDA_API_KEY";function Xn(t){if(t.apiKey||t.apiKeyEnvKey!==Me)return;let e=N();e?.accessToken&&(t.apiKey=e.accessToken,process.env[Me]=e.accessToken)}async function Zn(t){if(t.apiKeyEnvKey!==Me)return;let e=N();if(!e?.accessToken)return;let n=await je({baseUrl:t.baseUrl,fallbackAccessToken:e.accessToken});n&&(t.apiKey=n,process.env[Me]=n)}function Qn(t){return t.matildaAgentSdk===!0||process.env[Yn]==="1"}function He(t,e,n){t[e]=n}function eo(t,e){return t?.[e]}function to(t,e,n,o,i){let r={...o||{}},a=i?.strictModelProvider===!0,s={...n||{},authType:e,proxy:t?.getProxy()};He(r,"authType",{kind:"computed",detail:"provided by caller"}),t?.getProxy()&&He(r,"proxy",{kind:"computed",detail:"Config.getProxy()"});let l=c=>eo(o,c)??{kind:"unknown"};for(let c of de)n&&c in n&&!r[c]&&He(r,c,l(c));Xn(s);let d=$t(s,a);if(!d.valid)throw new Error(d.errors.map(c=>c.message).join(`
|
|
9
9
|
`));return{config:s,sources:r}}function $t(t,e=!1){let n=[];if(t.authType==="matilda-oauth")return{valid:!0,errors:[]};if(!t.apiKey)if(e)n.push(new ue(t.authType,t.model,t.apiKeyEnvKey));else{let o=t.apiKeyEnvKey||Pt(t.authType);n.push(new ge({authType:t.authType,model:t.model,baseUrl:t.baseUrl,envKey:o}))}if(!t.model)if(e)n.push(new pe(t.authType));else{let o=Et(t.authType);n.push(new fe({authType:t.authType,envKey:o}))}return t.authType==="anthropic"&&!t.baseUrl&&(e?n.push(new he({authType:t.authType,model:t.model})):t.authType==="anthropic"&&n.push(new me)),{valid:n.length===0,errors:n}}function Tr(t,e,n){return to(t,e,n).config}function Ft(t){let e=t;for(;e instanceof Error;){if("code"in e&&e.code==="ERR_MODULE_NOT_FOUND")return e;e=e.cause}}async function Ar(t,e,n){await Zn(t);let o=$t(t,!1);if(!o.valid)throw new Error(o.errors.map(a=>a.message).join(`
|
|
10
|
-
`));let i=t.authType;if(!i)throw new Error("ContentGeneratorConfig must have an authType");let r;try{if(i==="openai")if(Qn(t)){let{createMatildaAgentContentGenerator:a}=await import("./matildaAgentContentGenerator-
|
|
10
|
+
`));let i=t.authType;if(!i)throw new Error("ContentGeneratorConfig must have an authType");let r;try{if(i==="openai")if(Qn(t)){let{createMatildaAgentContentGenerator:a}=await import("./matildaAgentContentGenerator-QKMXPB2A.js");r=a(t,e)}else{let{createOpenAIContentGenerator:a}=await import("./openaiContentGenerator-AZI4WQN4.js");r=a(t,e)}else if(i==="matilda-oauth"){let{getMatildaOAuthClient:a}=await import("./matildaOAuth2-2IUZAZEO.js"),{MatildaContentGenerator:s}=await import("./matildaContentGenerator-O2TF3IDJ.js");try{let l=await a(e,n?{requireCachedCredentials:!0}:void 0);r=new s(l,t,e)}catch(l){throw Ft(l)?l:new Error(l instanceof Error?l.message:String(l))}}else if(i==="anthropic"){let{createAnthropicContentGenerator:a}=await import("./anthropicContentGenerator-DKMAJXYA.js");r=a(t,e)}else if(i==="gemini"||i==="vertex-ai"){let{createGeminiContentGenerator:a}=await import("./geminiContentGenerator-UJMSJR23.js");r=a(t,e)}else throw new Error(`Error creating contentGenerator: Unsupported authType: ${i}`)}catch(a){let s=Ft(a);throw s?new Error(`Matilda was updated in the background and needs to be restarted.
|
|
11
11
|
Please exit and restart Matilda to use the '${i}' provider.`,{cause:s}):a}return new J(r,e,t)}var Be=b("MODEL_REGISTRY");function zt(t){if(Object.values(G).includes(t))return t}function no(t){return/^minimax-m3/i.test(t.trim().toLowerCase())}function jt(t,e){return e?`${t}\0${e}`:t}var Ce=class{modelsByAuthType;getDefaultBaseUrl(e){switch(e){case"matilda-oauth":return"DYNAMIC_MATILDA_OAUTH_BASE_URL";case"openai":return lt;default:return""}}constructor(e){if(this.modelsByAuthType=new Map,this.registerAuthTypeModels("matilda-oauth",ce),e)for(let[n,o]of Object.entries(e)){let i=zt(n);if(!i){Be.warn(`Invalid authType key "${n}" in modelProviders config. Expected one of: ${Object.values(G).join(", ")}. Skipping.`);continue}i!=="matilda-oauth"&&this.registerAuthTypeModels(i,o)}}registerAuthTypeModels(e,n){let o=new Map;for(let i of n){let r=jt(i.id,i.baseUrl);if(o.has(r)){Be.warn(`Duplicate model id "${i.id}"${i.baseUrl?` with baseUrl "${i.baseUrl}"`:""} for authType "${e}". Using the first registered config.`);continue}let a=this.resolveModelConfig(i,e);o.set(r,a)}this.modelsByAuthType.set(e,o)}getModelsForAuthType(e){let n=this.modelsByAuthType.get(e);return n?Array.from(n.values()).map(o=>({id:o.id,label:o.name,description:o.description,capabilities:o.capabilities,authType:o.authType,isVision:o.capabilities?.vision??!1,contextWindowSize:o.generationConfig.contextWindowSize??W(o.id),modalities:o.generationConfig.modalities,baseUrl:o.baseUrl,envKey:o.envKey})):[]}getModel(e,n,o){let i=this.modelsByAuthType.get(e);if(!i)return;if(o)return i.get(jt(n,o));let r=i.get(n);if(r)return r;for(let a of i.values())if(a.id===n)return a}hasModel(e,n,o){return this.getModel(e,n,o)!==void 0}getDefaultModelForAuthType(e){if(e==="matilda-oauth")return this.getModel(e,U);let n=this.modelsByAuthType.get(e);if(!(!n||n.size===0))return Array.from(n.values())[0]}resolveModelConfig(e,n){this.validateModelConfig(e,n);let o={...e.generationConfig??{}};return(o.modalities===void 0||no(e.id))&&(o.modalities=q(e.id)),{...e,authType:n,name:e.name||e.id,baseUrl:e.baseUrl||this.getDefaultBaseUrl(n),generationConfig:o,capabilities:e.capabilities||{}}}validateModelConfig(e,n){if(!e.id)throw new Error(`Model config in authType '${n}' missing required field: id`)}reloadModels(e){for(let n of this.modelsByAuthType.keys())n!=="matilda-oauth"&&this.modelsByAuthType.delete(n);if(e)for(let[n,o]of Object.entries(e)){let i=zt(n);if(!i){Be.warn(`Invalid authType key "${n}" in modelProviders config. Expected one of: ${Object.values(G).join(", ")}. Skipping.`);continue}i!=="matilda-oauth"&&this.registerAuthTypeModels(i,o)}}};export{we as a,ne as b,It as c,hn as d,V as e,Uo as f,q as g,se as h,Go as i,le as j,$o as k,zo as l,ce as m,jo as n,jt as o,Ce as p,Ut as q,Nt as r,N as s,Vn as t,Jn as u,dr as v,cr as w,je as x,ur as y,pr as z,G as A,to as B,$t as C,Tr as D,Ar as E};
|
|
12
12
|
/**
|
|
13
13
|
* @license
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{b as xe,f as br,g as mn,i as gn,l as xr}from"./chunk-
|
|
3
|
+
import{b as xe,f as br,g as mn,i as gn,l as xr}from"./chunk-2GMJHSBF.js";import{Ee as ln,L as an,M as un,Re as cn,lj as hn,mj as fn,nj as pn,ti as tl,xh as dn}from"./chunk-H5PGSQP2.js";import{i as on}from"./chunk-LNTXZVVL.js";import{da as sn}from"./chunk-CFBZKYFB.js";import{e as nn}from"./chunk-IOCF4XSR.js";import{L as K,Y as be,c as ae,j as It,s as Pe}from"./chunk-QWBNNEV2.js";import{b}from"./chunk-GZPNIYVZ.js";import{a as ot,d as R,f as He}from"./chunk-OWGSC52X.js";var Ir=R((Fp,Xn)=>{"use strict";b();var Fr=Symbol("singleComment"),zn=Symbol("multiComment"),bl=()=>"",xl=(t,e,r)=>t.slice(e,r).replace(/\S/g," "),vl=(t,e)=>{let r=e-1,i=0;for(;t[r]==="\\";)r-=1,i+=1;return!!(i%2)};Xn.exports=(t,e={})=>{if(typeof t!="string")throw new TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof t}\``);let r=e.whitespace===!1?bl:xl,i=!1,n=!1,l=0,a="";for(let f=0;f<t.length;f++){let p=t[f],m=t[f+1];if(!n&&p==='"'&&(vl(t,f)||(i=!i)),!i){if(!n&&p+m==="//")a+=t.slice(l,f),l=f,n=Fr,f++;else if(n===Fr&&p+m===`\r
|
|
4
4
|
`){f++,n=!1,a+=r(t,l,f),l=f;continue}else if(n===Fr&&p===`
|
|
5
5
|
`)n=!1,a+=r(t,l,f),l=f;else if(!n&&p+m==="/*"){a+=t.slice(l,f),l=f,n=zn,f++;continue}else if(n===zn&&p+m==="*/"){f++,n=!1,a+=r(t,l,f+1),l=f+1;continue}}}return a+(n?r(t.slice(l)):t.slice(l))}});var cs=R((dt,$r)=>{b();(function(e,r){typeof dt=="object"&&typeof $r=="object"?$r.exports=r():typeof define=="function"&&define.amd?define([],r):typeof dt=="object"?dt.esprima=r():e.esprima=r()})(dt,function(){return function(t){var e={};function r(i){if(e[i])return e[i].exports;var n=e[i]={exports:{},id:i,loaded:!1};return t[i].call(n.exports,n,n.exports,r),n.loaded=!0,n.exports}return r.m=t,r.c=e,r.p="",r(0)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=r(1),n=r(3),l=r(8),a=r(15);function f(d,s,o){var u=null,c=function(O,j){o&&o(O,j),u&&u.visit(O,j)},y=typeof o=="function"?c:null,S=!1;if(s){S=typeof s.comment=="boolean"&&s.comment;var D=typeof s.attachComment=="boolean"&&s.attachComment;(S||D)&&(u=new i.CommentHandler,u.attach=D,s.comment=!0,y=c)}var E=!1;s&&typeof s.sourceType=="string"&&(E=s.sourceType==="module");var C;s&&typeof s.jsx=="boolean"&&s.jsx?C=new n.JSXParser(d,s,y):C=new l.Parser(d,s,y);var T=E?C.parseModule():C.parseScript(),I=T;return S&&u&&(I.comments=u.comments),C.config.tokens&&(I.tokens=C.tokens),C.config.tolerant&&(I.errors=C.errorHandler.errors),I}e.parse=f;function p(d,s,o){var u=s||{};return u.sourceType="module",f(d,u,o)}e.parseModule=p;function m(d,s,o){var u=s||{};return u.sourceType="script",f(d,u,o)}e.parseScript=m;function h(d,s,o){var u=new a.Tokenizer(d,s),c;c=[];try{for(;;){var y=u.getNextToken();if(!y)break;o&&(y=o(y)),c.push(y)}}catch(S){u.errorHandler.tolerate(S)}return u.errorHandler.tolerant&&(c.errors=u.errors()),c}e.tokenize=h;var g=r(2);e.Syntax=g.Syntax,e.version="4.0.1"},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=r(2),n=function(){function l(){this.attach=!1,this.comments=[],this.stack=[],this.leading=[],this.trailing=[]}return l.prototype.insertInnerComments=function(a,f){if(a.type===i.Syntax.BlockStatement&&a.body.length===0){for(var p=[],m=this.leading.length-1;m>=0;--m){var h=this.leading[m];f.end.offset>=h.start&&(p.unshift(h.comment),this.leading.splice(m,1),this.trailing.splice(m,1))}p.length&&(a.innerComments=p)}},l.prototype.findTrailingComments=function(a){var f=[];if(this.trailing.length>0){for(var p=this.trailing.length-1;p>=0;--p){var m=this.trailing[p];m.start>=a.end.offset&&f.unshift(m.comment)}return this.trailing.length=0,f}var h=this.stack[this.stack.length-1];if(h&&h.node.trailingComments){var g=h.node.trailingComments[0];g&&g.range[0]>=a.end.offset&&(f=h.node.trailingComments,delete h.node.trailingComments)}return f},l.prototype.findLeadingComments=function(a){for(var f=[],p;this.stack.length>0;){var m=this.stack[this.stack.length-1];if(m&&m.start>=a.start.offset)p=m.node,this.stack.pop();else break}if(p){for(var h=p.leadingComments?p.leadingComments.length:0,g=h-1;g>=0;--g){var d=p.leadingComments[g];d.range[1]<=a.start.offset&&(f.unshift(d),p.leadingComments.splice(g,1))}return p.leadingComments&&p.leadingComments.length===0&&delete p.leadingComments,f}for(var g=this.leading.length-1;g>=0;--g){var m=this.leading[g];m.start<=a.start.offset&&(f.unshift(m.comment),this.leading.splice(g,1))}return f},l.prototype.visitNode=function(a,f){if(!(a.type===i.Syntax.Program&&a.body.length>0)){this.insertInnerComments(a,f);var p=this.findTrailingComments(f),m=this.findLeadingComments(f);m.length>0&&(a.leadingComments=m),p.length>0&&(a.trailingComments=p),this.stack.push({node:a,start:f.start.offset})}},l.prototype.visitComment=function(a,f){var p=a.type[0]==="L"?"Line":"Block",m={type:p,value:a.value};if(a.range&&(m.range=a.range),a.loc&&(m.loc=a.loc),this.comments.push(m),this.attach){var h={comment:{type:p,value:a.value,range:[f.start.offset,f.end.offset]},start:f.start.offset};a.loc&&(h.comment.loc=a.loc),a.type=p,this.leading.push(h),this.trailing.push(h)}},l.prototype.visit=function(a,f){a.type==="LineComment"?this.visitComment(a,f):a.type==="BlockComment"?this.visitComment(a,f):this.attach&&this.visitNode(a,f)},l}();e.CommentHandler=n},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Syntax={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForOfStatement:"ForOfStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"}},function(t,e,r){"use strict";var i=this&&this.__extends||function(){var s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,u){o.__proto__=u}||function(o,u){for(var c in u)u.hasOwnProperty(c)&&(o[c]=u[c])};return function(o,u){s(o,u);function c(){this.constructor=o}o.prototype=u===null?Object.create(u):(c.prototype=u.prototype,new c)}}();Object.defineProperty(e,"__esModule",{value:!0});var n=r(4),l=r(5),a=r(6),f=r(7),p=r(8),m=r(13),h=r(14);m.TokenName[100]="JSXIdentifier",m.TokenName[101]="JSXText";function g(s){var o;switch(s.type){case a.JSXSyntax.JSXIdentifier:var u=s;o=u.name;break;case a.JSXSyntax.JSXNamespacedName:var c=s;o=g(c.namespace)+":"+g(c.name);break;case a.JSXSyntax.JSXMemberExpression:var y=s;o=g(y.object)+"."+g(y.property);break;default:break}return o}var d=function(s){i(o,s);function o(u,c,y){return s.call(this,u,c,y)||this}return o.prototype.parsePrimaryExpression=function(){return this.match("<")?this.parseJSXRoot():s.prototype.parsePrimaryExpression.call(this)},o.prototype.startJSX=function(){this.scanner.index=this.startMarker.index,this.scanner.lineNumber=this.startMarker.line,this.scanner.lineStart=this.startMarker.index-this.startMarker.column},o.prototype.finishJSX=function(){this.nextToken()},o.prototype.reenterJSX=function(){this.startJSX(),this.expectJSX("}"),this.config.tokens&&this.tokens.pop()},o.prototype.createJSXNode=function(){return this.collectComments(),{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},o.prototype.createJSXChildNode=function(){return{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},o.prototype.scanXHTMLEntity=function(u){for(var c="&",y=!0,S=!1,D=!1,E=!1;!this.scanner.eof()&&y&&!S;){var C=this.scanner.source[this.scanner.index];if(C===u)break;if(S=C===";",c+=C,++this.scanner.index,!S)switch(c.length){case 2:D=C==="#";break;case 3:D&&(E=C==="x",y=E||n.Character.isDecimalDigit(C.charCodeAt(0)),D=D&&!E);break;default:y=y&&!(D&&!n.Character.isDecimalDigit(C.charCodeAt(0))),y=y&&!(E&&!n.Character.isHexDigit(C.charCodeAt(0)));break}}if(y&&S&&c.length>2){var T=c.substr(1,c.length-2);D&&T.length>1?c=String.fromCharCode(parseInt(T.substr(1),10)):E&&T.length>2?c=String.fromCharCode(parseInt("0"+T.substr(1),16)):!D&&!E&&h.XHTMLEntities[T]&&(c=h.XHTMLEntities[T])}return c},o.prototype.lexJSX=function(){var u=this.scanner.source.charCodeAt(this.scanner.index);if(u===60||u===62||u===47||u===58||u===61||u===123||u===125){var c=this.scanner.source[this.scanner.index++];return{type:7,value:c,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index-1,end:this.scanner.index}}if(u===34||u===39){for(var y=this.scanner.index,S=this.scanner.source[this.scanner.index++],D="";!this.scanner.eof();){var E=this.scanner.source[this.scanner.index++];if(E===S)break;E==="&"?D+=this.scanXHTMLEntity(S):D+=E}return{type:8,value:D,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:y,end:this.scanner.index}}if(u===46){var C=this.scanner.source.charCodeAt(this.scanner.index+1),T=this.scanner.source.charCodeAt(this.scanner.index+2),c=C===46&&T===46?"...":".",y=this.scanner.index;return this.scanner.index+=c.length,{type:7,value:c,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:y,end:this.scanner.index}}if(u===96)return{type:10,value:"",lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index,end:this.scanner.index};if(n.Character.isIdentifierStart(u)&&u!==92){var y=this.scanner.index;for(++this.scanner.index;!this.scanner.eof();){var E=this.scanner.source.charCodeAt(this.scanner.index);if(n.Character.isIdentifierPart(E)&&E!==92)++this.scanner.index;else if(E===45)++this.scanner.index;else break}var I=this.scanner.source.slice(y,this.scanner.index);return{type:100,value:I,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:y,end:this.scanner.index}}return this.scanner.lex()},o.prototype.nextJSXToken=function(){this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;var u=this.lexJSX();return this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.config.tokens&&this.tokens.push(this.convertToken(u)),u},o.prototype.nextJSXText=function(){this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;for(var u=this.scanner.index,c="";!this.scanner.eof();){var y=this.scanner.source[this.scanner.index];if(y==="{"||y==="<")break;++this.scanner.index,c+=y,n.Character.isLineTerminator(y.charCodeAt(0))&&(++this.scanner.lineNumber,y==="\r"&&this.scanner.source[this.scanner.index]===`
|
|
6
6
|
`&&++this.scanner.index,this.scanner.lineStart=this.scanner.index)}this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart;var S={type:101,value:c,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:u,end:this.scanner.index};return c.length>0&&this.config.tokens&&this.tokens.push(this.convertToken(S)),S},o.prototype.peekJSXToken=function(){var u=this.scanner.saveState();this.scanner.scanComments();var c=this.lexJSX();return this.scanner.restoreState(u),c},o.prototype.expectJSX=function(u){var c=this.nextJSXToken();(c.type!==7||c.value!==u)&&this.throwUnexpectedToken(c)},o.prototype.matchJSX=function(u){var c=this.peekJSXToken();return c.type===7&&c.value===u},o.prototype.parseJSXIdentifier=function(){var u=this.createJSXNode(),c=this.nextJSXToken();return c.type!==100&&this.throwUnexpectedToken(c),this.finalize(u,new l.JSXIdentifier(c.value))},o.prototype.parseJSXElementName=function(){var u=this.createJSXNode(),c=this.parseJSXIdentifier();if(this.matchJSX(":")){var y=c;this.expectJSX(":");var S=this.parseJSXIdentifier();c=this.finalize(u,new l.JSXNamespacedName(y,S))}else if(this.matchJSX("."))for(;this.matchJSX(".");){var D=c;this.expectJSX(".");var E=this.parseJSXIdentifier();c=this.finalize(u,new l.JSXMemberExpression(D,E))}return c},o.prototype.parseJSXAttributeName=function(){var u=this.createJSXNode(),c,y=this.parseJSXIdentifier();if(this.matchJSX(":")){var S=y;this.expectJSX(":");var D=this.parseJSXIdentifier();c=this.finalize(u,new l.JSXNamespacedName(S,D))}else c=y;return c},o.prototype.parseJSXStringLiteralAttribute=function(){var u=this.createJSXNode(),c=this.nextJSXToken();c.type!==8&&this.throwUnexpectedToken(c);var y=this.getTokenRaw(c);return this.finalize(u,new f.Literal(c.value,y))},o.prototype.parseJSXExpressionAttribute=function(){var u=this.createJSXNode();this.expectJSX("{"),this.finishJSX(),this.match("}")&&this.tolerateError("JSX attributes must only be assigned a non-empty expression");var c=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(u,new l.JSXExpressionContainer(c))},o.prototype.parseJSXAttributeValue=function(){return this.matchJSX("{")?this.parseJSXExpressionAttribute():this.matchJSX("<")?this.parseJSXElement():this.parseJSXStringLiteralAttribute()},o.prototype.parseJSXNameValueAttribute=function(){var u=this.createJSXNode(),c=this.parseJSXAttributeName(),y=null;return this.matchJSX("=")&&(this.expectJSX("="),y=this.parseJSXAttributeValue()),this.finalize(u,new l.JSXAttribute(c,y))},o.prototype.parseJSXSpreadAttribute=function(){var u=this.createJSXNode();this.expectJSX("{"),this.expectJSX("..."),this.finishJSX();var c=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(u,new l.JSXSpreadAttribute(c))},o.prototype.parseJSXAttributes=function(){for(var u=[];!this.matchJSX("/")&&!this.matchJSX(">");){var c=this.matchJSX("{")?this.parseJSXSpreadAttribute():this.parseJSXNameValueAttribute();u.push(c)}return u},o.prototype.parseJSXOpeningElement=function(){var u=this.createJSXNode();this.expectJSX("<");var c=this.parseJSXElementName(),y=this.parseJSXAttributes(),S=this.matchJSX("/");return S&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(u,new l.JSXOpeningElement(c,S,y))},o.prototype.parseJSXBoundaryElement=function(){var u=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX("/")){this.expectJSX("/");var c=this.parseJSXElementName();return this.expectJSX(">"),this.finalize(u,new l.JSXClosingElement(c))}var y=this.parseJSXElementName(),S=this.parseJSXAttributes(),D=this.matchJSX("/");return D&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(u,new l.JSXOpeningElement(y,D,S))},o.prototype.parseJSXEmptyExpression=function(){var u=this.createJSXChildNode();return this.collectComments(),this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.finalize(u,new l.JSXEmptyExpression)},o.prototype.parseJSXExpressionContainer=function(){var u=this.createJSXNode();this.expectJSX("{");var c;return this.matchJSX("}")?(c=this.parseJSXEmptyExpression(),this.expectJSX("}")):(this.finishJSX(),c=this.parseAssignmentExpression(),this.reenterJSX()),this.finalize(u,new l.JSXExpressionContainer(c))},o.prototype.parseJSXChildren=function(){for(var u=[];!this.scanner.eof();){var c=this.createJSXChildNode(),y=this.nextJSXText();if(y.start<y.end){var S=this.getTokenRaw(y),D=this.finalize(c,new l.JSXText(y.value,S));u.push(D)}if(this.scanner.source[this.scanner.index]==="{"){var E=this.parseJSXExpressionContainer();u.push(E)}else break}return u},o.prototype.parseComplexJSXElement=function(u){for(var c=[];!this.scanner.eof();){u.children=u.children.concat(this.parseJSXChildren());var y=this.createJSXChildNode(),S=this.parseJSXBoundaryElement();if(S.type===a.JSXSyntax.JSXOpeningElement){var D=S;if(D.selfClosing){var E=this.finalize(y,new l.JSXElement(D,[],null));u.children.push(E)}else c.push(u),u={node:y,opening:D,closing:null,children:[]}}if(S.type===a.JSXSyntax.JSXClosingElement){u.closing=S;var C=g(u.opening.name),T=g(u.closing.name);if(C!==T&&this.tolerateError("Expected corresponding JSX closing tag for %0",C),c.length>0){var E=this.finalize(u.node,new l.JSXElement(u.opening,u.children,u.closing));u=c[c.length-1],u.children.push(E),c.pop()}else break}}return u},o.prototype.parseJSXElement=function(){var u=this.createJSXNode(),c=this.parseJSXOpeningElement(),y=[],S=null;if(!c.selfClosing){var D=this.parseComplexJSXElement({node:u,opening:c,closing:S,children:y});y=D.children,S=D.closing}return this.finalize(u,new l.JSXElement(c,y,S))},o.prototype.parseJSXRoot=function(){this.config.tokens&&this.tokens.pop(),this.startJSX();var u=this.parseJSXElement();return this.finishJSX(),u},o.prototype.isStartOfExpression=function(){return s.prototype.isStartOfExpression.call(this)||this.match("<")},o}(p.Parser);e.JSXParser=d},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/};e.Character={fromCodePoint:function(i){return i<65536?String.fromCharCode(i):String.fromCharCode(55296+(i-65536>>10))+String.fromCharCode(56320+(i-65536&1023))},isWhiteSpace:function(i){return i===32||i===9||i===11||i===12||i===160||i>=5760&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(i)>=0},isLineTerminator:function(i){return i===10||i===13||i===8232||i===8233},isIdentifierStart:function(i){return i===36||i===95||i>=65&&i<=90||i>=97&&i<=122||i===92||i>=128&&r.NonAsciiIdentifierStart.test(e.Character.fromCodePoint(i))},isIdentifierPart:function(i){return i===36||i===95||i>=65&&i<=90||i>=97&&i<=122||i>=48&&i<=57||i===92||i>=128&&r.NonAsciiIdentifierPart.test(e.Character.fromCodePoint(i))},isDecimalDigit:function(i){return i>=48&&i<=57},isHexDigit:function(i){return i>=48&&i<=57||i>=65&&i<=70||i>=97&&i<=102},isOctalDigit:function(i){return i>=48&&i<=55}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=r(6),n=function(){function u(c){this.type=i.JSXSyntax.JSXClosingElement,this.name=c}return u}();e.JSXClosingElement=n;var l=function(){function u(c,y,S){this.type=i.JSXSyntax.JSXElement,this.openingElement=c,this.children=y,this.closingElement=S}return u}();e.JSXElement=l;var a=function(){function u(){this.type=i.JSXSyntax.JSXEmptyExpression}return u}();e.JSXEmptyExpression=a;var f=function(){function u(c){this.type=i.JSXSyntax.JSXExpressionContainer,this.expression=c}return u}();e.JSXExpressionContainer=f;var p=function(){function u(c){this.type=i.JSXSyntax.JSXIdentifier,this.name=c}return u}();e.JSXIdentifier=p;var m=function(){function u(c,y){this.type=i.JSXSyntax.JSXMemberExpression,this.object=c,this.property=y}return u}();e.JSXMemberExpression=m;var h=function(){function u(c,y){this.type=i.JSXSyntax.JSXAttribute,this.name=c,this.value=y}return u}();e.JSXAttribute=h;var g=function(){function u(c,y){this.type=i.JSXSyntax.JSXNamespacedName,this.namespace=c,this.name=y}return u}();e.JSXNamespacedName=g;var d=function(){function u(c,y,S){this.type=i.JSXSyntax.JSXOpeningElement,this.name=c,this.selfClosing=y,this.attributes=S}return u}();e.JSXOpeningElement=d;var s=function(){function u(c){this.type=i.JSXSyntax.JSXSpreadAttribute,this.argument=c}return u}();e.JSXSpreadAttribute=s;var o=function(){function u(c,y){this.type=i.JSXSyntax.JSXText,this.value=c,this.raw=y}return u}();e.JSXText=o},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.JSXSyntax={JSXAttribute:"JSXAttribute",JSXClosingElement:"JSXClosingElement",JSXElement:"JSXElement",JSXEmptyExpression:"JSXEmptyExpression",JSXExpressionContainer:"JSXExpressionContainer",JSXIdentifier:"JSXIdentifier",JSXMemberExpression:"JSXMemberExpression",JSXNamespacedName:"JSXNamespacedName",JSXOpeningElement:"JSXOpeningElement",JSXSpreadAttribute:"JSXSpreadAttribute",JSXText:"JSXText"}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=r(2),n=function(){function x(v){this.type=i.Syntax.ArrayExpression,this.elements=v}return x}();e.ArrayExpression=n;var l=function(){function x(v){this.type=i.Syntax.ArrayPattern,this.elements=v}return x}();e.ArrayPattern=l;var a=function(){function x(v,A,M){this.type=i.Syntax.ArrowFunctionExpression,this.id=null,this.params=v,this.body=A,this.generator=!1,this.expression=M,this.async=!1}return x}();e.ArrowFunctionExpression=a;var f=function(){function x(v,A,M){this.type=i.Syntax.AssignmentExpression,this.operator=v,this.left=A,this.right=M}return x}();e.AssignmentExpression=f;var p=function(){function x(v,A){this.type=i.Syntax.AssignmentPattern,this.left=v,this.right=A}return x}();e.AssignmentPattern=p;var m=function(){function x(v,A,M){this.type=i.Syntax.ArrowFunctionExpression,this.id=null,this.params=v,this.body=A,this.generator=!1,this.expression=M,this.async=!0}return x}();e.AsyncArrowFunctionExpression=m;var h=function(){function x(v,A,M){this.type=i.Syntax.FunctionDeclaration,this.id=v,this.params=A,this.body=M,this.generator=!1,this.expression=!1,this.async=!0}return x}();e.AsyncFunctionDeclaration=h;var g=function(){function x(v,A,M){this.type=i.Syntax.FunctionExpression,this.id=v,this.params=A,this.body=M,this.generator=!1,this.expression=!1,this.async=!0}return x}();e.AsyncFunctionExpression=g;var d=function(){function x(v){this.type=i.Syntax.AwaitExpression,this.argument=v}return x}();e.AwaitExpression=d;var s=function(){function x(v,A,M){var Z=v==="||"||v==="&&";this.type=Z?i.Syntax.LogicalExpression:i.Syntax.BinaryExpression,this.operator=v,this.left=A,this.right=M}return x}();e.BinaryExpression=s;var o=function(){function x(v){this.type=i.Syntax.BlockStatement,this.body=v}return x}();e.BlockStatement=o;var u=function(){function x(v){this.type=i.Syntax.BreakStatement,this.label=v}return x}();e.BreakStatement=u;var c=function(){function x(v,A){this.type=i.Syntax.CallExpression,this.callee=v,this.arguments=A}return x}();e.CallExpression=c;var y=function(){function x(v,A){this.type=i.Syntax.CatchClause,this.param=v,this.body=A}return x}();e.CatchClause=y;var S=function(){function x(v){this.type=i.Syntax.ClassBody,this.body=v}return x}();e.ClassBody=S;var D=function(){function x(v,A,M){this.type=i.Syntax.ClassDeclaration,this.id=v,this.superClass=A,this.body=M}return x}();e.ClassDeclaration=D;var E=function(){function x(v,A,M){this.type=i.Syntax.ClassExpression,this.id=v,this.superClass=A,this.body=M}return x}();e.ClassExpression=E;var C=function(){function x(v,A){this.type=i.Syntax.MemberExpression,this.computed=!0,this.object=v,this.property=A}return x}();e.ComputedMemberExpression=C;var T=function(){function x(v,A,M){this.type=i.Syntax.ConditionalExpression,this.test=v,this.consequent=A,this.alternate=M}return x}();e.ConditionalExpression=T;var I=function(){function x(v){this.type=i.Syntax.ContinueStatement,this.label=v}return x}();e.ContinueStatement=I;var O=function(){function x(){this.type=i.Syntax.DebuggerStatement}return x}();e.DebuggerStatement=O;var j=function(){function x(v,A){this.type=i.Syntax.ExpressionStatement,this.expression=v,this.directive=A}return x}();e.Directive=j;var $=function(){function x(v,A){this.type=i.Syntax.DoWhileStatement,this.body=v,this.test=A}return x}();e.DoWhileStatement=$;var z=function(){function x(){this.type=i.Syntax.EmptyStatement}return x}();e.EmptyStatement=z;var Se=function(){function x(v){this.type=i.Syntax.ExportAllDeclaration,this.source=v}return x}();e.ExportAllDeclaration=Se;var $e=function(){function x(v){this.type=i.Syntax.ExportDefaultDeclaration,this.declaration=v}return x}();e.ExportDefaultDeclaration=$e;var pr=function(){function x(v,A,M){this.type=i.Syntax.ExportNamedDeclaration,this.declaration=v,this.specifiers=A,this.source=M}return x}();e.ExportNamedDeclaration=pr;var mr=function(){function x(v,A){this.type=i.Syntax.ExportSpecifier,this.exported=A,this.local=v}return x}();e.ExportSpecifier=mr;var q=function(){function x(v){this.type=i.Syntax.ExpressionStatement,this.expression=v}return x}();e.ExpressionStatement=q;var Re=function(){function x(v,A,M){this.type=i.Syntax.ForInStatement,this.left=v,this.right=A,this.body=M,this.each=!1}return x}();e.ForInStatement=Re;var Le=function(){function x(v,A,M){this.type=i.Syntax.ForOfStatement,this.left=v,this.right=A,this.body=M}return x}();e.ForOfStatement=Le;var fe=function(){function x(v,A,M,Z){this.type=i.Syntax.ForStatement,this.init=v,this.test=A,this.update=M,this.body=Z}return x}();e.ForStatement=fe;var qe=function(){function x(v,A,M,Z){this.type=i.Syntax.FunctionDeclaration,this.id=v,this.params=A,this.body=M,this.generator=Z,this.expression=!1,this.async=!1}return x}();e.FunctionDeclaration=qe;var pe=function(){function x(v,A,M,Z){this.type=i.Syntax.FunctionExpression,this.id=v,this.params=A,this.body=M,this.generator=Z,this.expression=!1,this.async=!1}return x}();e.FunctionExpression=pe;var Et=function(){function x(v){this.type=i.Syntax.Identifier,this.name=v}return x}();e.Identifier=Et;var Ct=function(){function x(v,A,M){this.type=i.Syntax.IfStatement,this.test=v,this.consequent=A,this.alternate=M}return x}();e.IfStatement=Ct;var At=function(){function x(v,A){this.type=i.Syntax.ImportDeclaration,this.specifiers=v,this.source=A}return x}();e.ImportDeclaration=At;var ie=function(){function x(v){this.type=i.Syntax.ImportDefaultSpecifier,this.local=v}return x}();e.ImportDefaultSpecifier=ie;var wt=function(){function x(v){this.type=i.Syntax.ImportNamespaceSpecifier,this.local=v}return x}();e.ImportNamespaceSpecifier=wt;var it=function(){function x(v,A){this.type=i.Syntax.ImportSpecifier,this.local=v,this.imported=A}return x}();e.ImportSpecifier=it;var kt=function(){function x(v,A){this.type=i.Syntax.LabeledStatement,this.label=v,this.body=A}return x}();e.LabeledStatement=kt;var Tt=function(){function x(v,A){this.type=i.Syntax.Literal,this.value=v,this.raw=A}return x}();e.Literal=Tt;var Ft=function(){function x(v,A){this.type=i.Syntax.MetaProperty,this.meta=v,this.property=A}return x}();e.MetaProperty=Ft;var nt=function(){function x(v,A,M,Z,Sr){this.type=i.Syntax.MethodDefinition,this.key=v,this.computed=A,this.value=M,this.kind=Z,this.static=Sr}return x}();e.MethodDefinition=nt;var st=function(){function x(v){this.type=i.Syntax.Program,this.body=v,this.sourceType="module"}return x}();e.Module=st;var se=function(){function x(v,A){this.type=i.Syntax.NewExpression,this.callee=v,this.arguments=A}return x}();e.NewExpression=se;var oe=function(){function x(v){this.type=i.Syntax.ObjectExpression,this.properties=v}return x}();e.ObjectExpression=oe;var ne=function(){function x(v){this.type=i.Syntax.ObjectPattern,this.properties=v}return x}();e.ObjectPattern=ne;var gr=function(){function x(v,A,M,Z,Sr,el){this.type=i.Syntax.Property,this.key=A,this.computed=M,this.value=Z,this.kind=v,this.method=Sr,this.shorthand=el}return x}();e.Property=gr;var yr=function(){function x(v,A,M,Z){this.type=i.Syntax.Literal,this.value=v,this.raw=A,this.regex={pattern:M,flags:Z}}return x}();e.RegexLiteral=yr;var Lu=function(){function x(v){this.type=i.Syntax.RestElement,this.argument=v}return x}();e.RestElement=Lu;var Pu=function(){function x(v){this.type=i.Syntax.ReturnStatement,this.argument=v}return x}();e.ReturnStatement=Pu;var Mu=function(){function x(v){this.type=i.Syntax.Program,this.body=v,this.sourceType="script"}return x}();e.Script=Mu;var Nu=function(){function x(v){this.type=i.Syntax.SequenceExpression,this.expressions=v}return x}();e.SequenceExpression=Nu;var Ou=function(){function x(v){this.type=i.Syntax.SpreadElement,this.argument=v}return x}();e.SpreadElement=Ou;var Bu=function(){function x(v,A){this.type=i.Syntax.MemberExpression,this.computed=!1,this.object=v,this.property=A}return x}();e.StaticMemberExpression=Bu;var _u=function(){function x(){this.type=i.Syntax.Super}return x}();e.Super=_u;var Uu=function(){function x(v,A){this.type=i.Syntax.SwitchCase,this.test=v,this.consequent=A}return x}();e.SwitchCase=Uu;var ju=function(){function x(v,A){this.type=i.Syntax.SwitchStatement,this.discriminant=v,this.cases=A}return x}();e.SwitchStatement=ju;var Gu=function(){function x(v,A){this.type=i.Syntax.TaggedTemplateExpression,this.tag=v,this.quasi=A}return x}();e.TaggedTemplateExpression=Gu;var $u=function(){function x(v,A){this.type=i.Syntax.TemplateElement,this.value=v,this.tail=A}return x}();e.TemplateElement=$u;var qu=function(){function x(v,A){this.type=i.Syntax.TemplateLiteral,this.quasis=v,this.expressions=A}return x}();e.TemplateLiteral=qu;var Hu=function(){function x(){this.type=i.Syntax.ThisExpression}return x}();e.ThisExpression=Hu;var Wu=function(){function x(v){this.type=i.Syntax.ThrowStatement,this.argument=v}return x}();e.ThrowStatement=Wu;var zu=function(){function x(v,A,M){this.type=i.Syntax.TryStatement,this.block=v,this.handler=A,this.finalizer=M}return x}();e.TryStatement=zu;var Xu=function(){function x(v,A){this.type=i.Syntax.UnaryExpression,this.operator=v,this.argument=A,this.prefix=!0}return x}();e.UnaryExpression=Xu;var Ju=function(){function x(v,A,M){this.type=i.Syntax.UpdateExpression,this.operator=v,this.argument=A,this.prefix=M}return x}();e.UpdateExpression=Ju;var Vu=function(){function x(v,A){this.type=i.Syntax.VariableDeclaration,this.declarations=v,this.kind=A}return x}();e.VariableDeclaration=Vu;var Ku=function(){function x(v,A){this.type=i.Syntax.VariableDeclarator,this.id=v,this.init=A}return x}();e.VariableDeclarator=Ku;var Yu=function(){function x(v,A){this.type=i.Syntax.WhileStatement,this.test=v,this.body=A}return x}();e.WhileStatement=Yu;var Qu=function(){function x(v,A){this.type=i.Syntax.WithStatement,this.object=v,this.body=A}return x}();e.WithStatement=Qu;var Zu=function(){function x(v,A){this.type=i.Syntax.YieldExpression,this.argument=v,this.delegate=A}return x}();e.YieldExpression=Zu},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=r(9),n=r(10),l=r(11),a=r(7),f=r(12),p=r(2),m=r(13),h="ArrowParameterPlaceHolder",g=function(){function d(s,o,u){o===void 0&&(o={}),this.config={range:typeof o.range=="boolean"&&o.range,loc:typeof o.loc=="boolean"&&o.loc,source:null,tokens:typeof o.tokens=="boolean"&&o.tokens,comment:typeof o.comment=="boolean"&&o.comment,tolerant:typeof o.tolerant=="boolean"&&o.tolerant},this.config.loc&&o.source&&o.source!==null&&(this.config.source=String(o.source)),this.delegate=u,this.errorHandler=new n.ErrorHandler,this.errorHandler.tolerant=this.config.tolerant,this.scanner=new f.Scanner(s,this.errorHandler),this.scanner.trackComment=this.config.comment,this.operatorPrecedence={")":0,";":0,",":0,"=":0,"]":0,"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":11,"/":11,"%":11},this.lookahead={type:2,value:"",lineNumber:this.scanner.lineNumber,lineStart:0,start:0,end:0},this.hasLineTerminator=!1,this.context={isModule:!1,await:!1,allowIn:!0,allowStrictDirective:!0,allowYield:!0,firstCoverInitializedNameError:null,isAssignmentTarget:!1,isBindingElement:!1,inFunctionBody:!1,inIteration:!1,inSwitch:!1,labelSet:{},strict:!1},this.tokens=[],this.startMarker={index:0,line:this.scanner.lineNumber,column:0},this.lastMarker={index:0,line:this.scanner.lineNumber,column:0},this.nextToken(),this.lastMarker={index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}return d.prototype.throwError=function(s){for(var o=[],u=1;u<arguments.length;u++)o[u-1]=arguments[u];var c=Array.prototype.slice.call(arguments,1),y=s.replace(/%(\d)/g,function(C,T){return i.assert(T<c.length,"Message reference must be in range"),c[T]}),S=this.lastMarker.index,D=this.lastMarker.line,E=this.lastMarker.column+1;throw this.errorHandler.createError(S,D,E,y)},d.prototype.tolerateError=function(s){for(var o=[],u=1;u<arguments.length;u++)o[u-1]=arguments[u];var c=Array.prototype.slice.call(arguments,1),y=s.replace(/%(\d)/g,function(C,T){return i.assert(T<c.length,"Message reference must be in range"),c[T]}),S=this.lastMarker.index,D=this.scanner.lineNumber,E=this.lastMarker.column+1;this.errorHandler.tolerateError(S,D,E,y)},d.prototype.unexpectedTokenError=function(s,o){var u=o||l.Messages.UnexpectedToken,c;if(s?(o||(u=s.type===2?l.Messages.UnexpectedEOS:s.type===3?l.Messages.UnexpectedIdentifier:s.type===6?l.Messages.UnexpectedNumber:s.type===8?l.Messages.UnexpectedString:s.type===10?l.Messages.UnexpectedTemplate:l.Messages.UnexpectedToken,s.type===4&&(this.scanner.isFutureReservedWord(s.value)?u=l.Messages.UnexpectedReserved:this.context.strict&&this.scanner.isStrictModeReservedWord(s.value)&&(u=l.Messages.StrictReservedWord))),c=s.value):c="ILLEGAL",u=u.replace("%0",c),s&&typeof s.lineNumber=="number"){var y=s.start,S=s.lineNumber,D=this.lastMarker.index-this.lastMarker.column,E=s.start-D+1;return this.errorHandler.createError(y,S,E,u)}else{var y=this.lastMarker.index,S=this.lastMarker.line,E=this.lastMarker.column+1;return this.errorHandler.createError(y,S,E,u)}},d.prototype.throwUnexpectedToken=function(s,o){throw this.unexpectedTokenError(s,o)},d.prototype.tolerateUnexpectedToken=function(s,o){this.errorHandler.tolerate(this.unexpectedTokenError(s,o))},d.prototype.collectComments=function(){if(!this.config.comment)this.scanner.scanComments();else{var s=this.scanner.scanComments();if(s.length>0&&this.delegate)for(var o=0;o<s.length;++o){var u=s[o],c=void 0;c={type:u.multiLine?"BlockComment":"LineComment",value:this.scanner.source.slice(u.slice[0],u.slice[1])},this.config.range&&(c.range=u.range),this.config.loc&&(c.loc=u.loc);var y={start:{line:u.loc.start.line,column:u.loc.start.column,offset:u.range[0]},end:{line:u.loc.end.line,column:u.loc.end.column,offset:u.range[1]}};this.delegate(c,y)}}},d.prototype.getTokenRaw=function(s){return this.scanner.source.slice(s.start,s.end)},d.prototype.convertToken=function(s){var o={type:m.TokenName[s.type],value:this.getTokenRaw(s)};if(this.config.range&&(o.range=[s.start,s.end]),this.config.loc&&(o.loc={start:{line:this.startMarker.line,column:this.startMarker.column},end:{line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}),s.type===9){var u=s.pattern,c=s.flags;o.regex={pattern:u,flags:c}}return o},d.prototype.nextToken=function(){var s=this.lookahead;this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.collectComments(),this.scanner.index!==this.startMarker.index&&(this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart);var o=this.scanner.lex();return this.hasLineTerminator=s.lineNumber!==o.lineNumber,o&&this.context.strict&&o.type===3&&this.scanner.isStrictModeReservedWord(o.value)&&(o.type=4),this.lookahead=o,this.config.tokens&&o.type!==2&&this.tokens.push(this.convertToken(o)),s},d.prototype.nextRegexToken=function(){this.collectComments();var s=this.scanner.scanRegExp();return this.config.tokens&&(this.tokens.pop(),this.tokens.push(this.convertToken(s))),this.lookahead=s,this.nextToken(),s},d.prototype.createNode=function(){return{index:this.startMarker.index,line:this.startMarker.line,column:this.startMarker.column}},d.prototype.startNode=function(s,o){o===void 0&&(o=0);var u=s.start-s.lineStart,c=s.lineNumber;return u<0&&(u+=o,c--),{index:s.start,line:c,column:u}},d.prototype.finalize=function(s,o){if(this.config.range&&(o.range=[s.index,this.lastMarker.index]),this.config.loc&&(o.loc={start:{line:s.line,column:s.column},end:{line:this.lastMarker.line,column:this.lastMarker.column}},this.config.source&&(o.loc.source=this.config.source)),this.delegate){var u={start:{line:s.line,column:s.column,offset:s.index},end:{line:this.lastMarker.line,column:this.lastMarker.column,offset:this.lastMarker.index}};this.delegate(o,u)}return o},d.prototype.expect=function(s){var o=this.nextToken();(o.type!==7||o.value!==s)&&this.throwUnexpectedToken(o)},d.prototype.expectCommaSeparator=function(){if(this.config.tolerant){var s=this.lookahead;s.type===7&&s.value===","?this.nextToken():s.type===7&&s.value===";"?(this.nextToken(),this.tolerateUnexpectedToken(s)):this.tolerateUnexpectedToken(s,l.Messages.UnexpectedToken)}else this.expect(",")},d.prototype.expectKeyword=function(s){var o=this.nextToken();(o.type!==4||o.value!==s)&&this.throwUnexpectedToken(o)},d.prototype.match=function(s){return this.lookahead.type===7&&this.lookahead.value===s},d.prototype.matchKeyword=function(s){return this.lookahead.type===4&&this.lookahead.value===s},d.prototype.matchContextualKeyword=function(s){return this.lookahead.type===3&&this.lookahead.value===s},d.prototype.matchAssign=function(){if(this.lookahead.type!==7)return!1;var s=this.lookahead.value;return s==="="||s==="*="||s==="**="||s==="/="||s==="%="||s==="+="||s==="-="||s==="<<="||s===">>="||s===">>>="||s==="&="||s==="^="||s==="|="},d.prototype.isolateCoverGrammar=function(s){var o=this.context.isBindingElement,u=this.context.isAssignmentTarget,c=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var y=s.call(this);return this.context.firstCoverInitializedNameError!==null&&this.throwUnexpectedToken(this.context.firstCoverInitializedNameError),this.context.isBindingElement=o,this.context.isAssignmentTarget=u,this.context.firstCoverInitializedNameError=c,y},d.prototype.inheritCoverGrammar=function(s){var o=this.context.isBindingElement,u=this.context.isAssignmentTarget,c=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var y=s.call(this);return this.context.isBindingElement=this.context.isBindingElement&&o,this.context.isAssignmentTarget=this.context.isAssignmentTarget&&u,this.context.firstCoverInitializedNameError=c||this.context.firstCoverInitializedNameError,y},d.prototype.consumeSemicolon=function(){this.match(";")?this.nextToken():this.hasLineTerminator||(this.lookahead.type!==2&&!this.match("}")&&this.throwUnexpectedToken(this.lookahead),this.lastMarker.index=this.startMarker.index,this.lastMarker.line=this.startMarker.line,this.lastMarker.column=this.startMarker.column)},d.prototype.parsePrimaryExpression=function(){var s=this.createNode(),o,u,c;switch(this.lookahead.type){case 3:(this.context.isModule||this.context.await)&&this.lookahead.value==="await"&&this.tolerateUnexpectedToken(this.lookahead),o=this.matchAsyncFunction()?this.parseFunctionExpression():this.finalize(s,new a.Identifier(this.nextToken().value));break;case 6:case 8:this.context.strict&&this.lookahead.octal&&this.tolerateUnexpectedToken(this.lookahead,l.Messages.StrictOctalLiteral),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,u=this.nextToken(),c=this.getTokenRaw(u),o=this.finalize(s,new a.Literal(u.value,c));break;case 1:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,u=this.nextToken(),c=this.getTokenRaw(u),o=this.finalize(s,new a.Literal(u.value==="true",c));break;case 5:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,u=this.nextToken(),c=this.getTokenRaw(u),o=this.finalize(s,new a.Literal(null,c));break;case 10:o=this.parseTemplateLiteral();break;case 7:switch(this.lookahead.value){case"(":this.context.isBindingElement=!1,o=this.inheritCoverGrammar(this.parseGroupExpression);break;case"[":o=this.inheritCoverGrammar(this.parseArrayInitializer);break;case"{":o=this.inheritCoverGrammar(this.parseObjectInitializer);break;case"/":case"/=":this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.scanner.index=this.startMarker.index,u=this.nextRegexToken(),c=this.getTokenRaw(u),o=this.finalize(s,new a.RegexLiteral(u.regex,c,u.pattern,u.flags));break;default:o=this.throwUnexpectedToken(this.nextToken())}break;case 4:!this.context.strict&&this.context.allowYield&&this.matchKeyword("yield")?o=this.parseIdentifierName():!this.context.strict&&this.matchKeyword("let")?o=this.finalize(s,new a.Identifier(this.nextToken().value)):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.matchKeyword("function")?o=this.parseFunctionExpression():this.matchKeyword("this")?(this.nextToken(),o=this.finalize(s,new a.ThisExpression)):this.matchKeyword("class")?o=this.parseClassExpression():o=this.throwUnexpectedToken(this.nextToken()));break;default:o=this.throwUnexpectedToken(this.nextToken())}return o},d.prototype.parseSpreadElement=function(){var s=this.createNode();this.expect("...");var o=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.finalize(s,new a.SpreadElement(o))},d.prototype.parseArrayInitializer=function(){var s=this.createNode(),o=[];for(this.expect("[");!this.match("]");)if(this.match(","))this.nextToken(),o.push(null);else if(this.match("...")){var u=this.parseSpreadElement();this.match("]")||(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.expect(",")),o.push(u)}else o.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.match("]")||this.expect(",");return this.expect("]"),this.finalize(s,new a.ArrayExpression(o))},d.prototype.parsePropertyMethod=function(s){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var o=this.context.strict,u=this.context.allowStrictDirective;this.context.allowStrictDirective=s.simple;var c=this.isolateCoverGrammar(this.parseFunctionSourceElements);return this.context.strict&&s.firstRestricted&&this.tolerateUnexpectedToken(s.firstRestricted,s.message),this.context.strict&&s.stricted&&this.tolerateUnexpectedToken(s.stricted,s.message),this.context.strict=o,this.context.allowStrictDirective=u,c},d.prototype.parsePropertyMethodFunction=function(){var s=!1,o=this.createNode(),u=this.context.allowYield;this.context.allowYield=!0;var c=this.parseFormalParameters(),y=this.parsePropertyMethod(c);return this.context.allowYield=u,this.finalize(o,new a.FunctionExpression(null,c.params,y,s))},d.prototype.parsePropertyMethodAsyncFunction=function(){var s=this.createNode(),o=this.context.allowYield,u=this.context.await;this.context.allowYield=!1,this.context.await=!0;var c=this.parseFormalParameters(),y=this.parsePropertyMethod(c);return this.context.allowYield=o,this.context.await=u,this.finalize(s,new a.AsyncFunctionExpression(null,c.params,y))},d.prototype.parseObjectPropertyKey=function(){var s=this.createNode(),o=this.nextToken(),u;switch(o.type){case 8:case 6:this.context.strict&&o.octal&&this.tolerateUnexpectedToken(o,l.Messages.StrictOctalLiteral);var c=this.getTokenRaw(o);u=this.finalize(s,new a.Literal(o.value,c));break;case 3:case 1:case 5:case 4:u=this.finalize(s,new a.Identifier(o.value));break;case 7:o.value==="["?(u=this.isolateCoverGrammar(this.parseAssignmentExpression),this.expect("]")):u=this.throwUnexpectedToken(o);break;default:u=this.throwUnexpectedToken(o)}return u},d.prototype.isPropertyKey=function(s,o){return s.type===p.Syntax.Identifier&&s.name===o||s.type===p.Syntax.Literal&&s.value===o},d.prototype.parseObjectProperty=function(s){var o=this.createNode(),u=this.lookahead,c,y=null,S=null,D=!1,E=!1,C=!1,T=!1;if(u.type===3){var I=u.value;this.nextToken(),D=this.match("["),T=!this.hasLineTerminator&&I==="async"&&!this.match(":")&&!this.match("(")&&!this.match("*")&&!this.match(","),y=T?this.parseObjectPropertyKey():this.finalize(o,new a.Identifier(I))}else this.match("*")?this.nextToken():(D=this.match("["),y=this.parseObjectPropertyKey());var O=this.qualifiedPropertyName(this.lookahead);if(u.type===3&&!T&&u.value==="get"&&O)c="get",D=this.match("["),y=this.parseObjectPropertyKey(),this.context.allowYield=!1,S=this.parseGetterMethod();else if(u.type===3&&!T&&u.value==="set"&&O)c="set",D=this.match("["),y=this.parseObjectPropertyKey(),S=this.parseSetterMethod();else if(u.type===7&&u.value==="*"&&O)c="init",D=this.match("["),y=this.parseObjectPropertyKey(),S=this.parseGeneratorMethod(),E=!0;else if(y||this.throwUnexpectedToken(this.lookahead),c="init",this.match(":")&&!T)!D&&this.isPropertyKey(y,"__proto__")&&(s.value&&this.tolerateError(l.Messages.DuplicateProtoProperty),s.value=!0),this.nextToken(),S=this.inheritCoverGrammar(this.parseAssignmentExpression);else if(this.match("("))S=T?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),E=!0;else if(u.type===3){var I=this.finalize(o,new a.Identifier(u.value));if(this.match("=")){this.context.firstCoverInitializedNameError=this.lookahead,this.nextToken(),C=!0;var j=this.isolateCoverGrammar(this.parseAssignmentExpression);S=this.finalize(o,new a.AssignmentPattern(I,j))}else C=!0,S=I}else this.throwUnexpectedToken(this.nextToken());return this.finalize(o,new a.Property(c,y,D,S,E,C))},d.prototype.parseObjectInitializer=function(){var s=this.createNode();this.expect("{");for(var o=[],u={value:!1};!this.match("}");)o.push(this.parseObjectProperty(u)),this.match("}")||this.expectCommaSeparator();return this.expect("}"),this.finalize(s,new a.ObjectExpression(o))},d.prototype.parseTemplateHead=function(){i.assert(this.lookahead.head,"Template literal must start with a template head");var s=this.createNode(),o=this.nextToken(),u=o.value,c=o.cooked;return this.finalize(s,new a.TemplateElement({raw:u,cooked:c},o.tail))},d.prototype.parseTemplateElement=function(){this.lookahead.type!==10&&this.throwUnexpectedToken();var s=this.createNode(),o=this.nextToken(),u=o.value,c=o.cooked;return this.finalize(s,new a.TemplateElement({raw:u,cooked:c},o.tail))},d.prototype.parseTemplateLiteral=function(){var s=this.createNode(),o=[],u=[],c=this.parseTemplateHead();for(u.push(c);!c.tail;)o.push(this.parseExpression()),c=this.parseTemplateElement(),u.push(c);return this.finalize(s,new a.TemplateLiteral(u,o))},d.prototype.reinterpretExpressionAsPattern=function(s){switch(s.type){case p.Syntax.Identifier:case p.Syntax.MemberExpression:case p.Syntax.RestElement:case p.Syntax.AssignmentPattern:break;case p.Syntax.SpreadElement:s.type=p.Syntax.RestElement,this.reinterpretExpressionAsPattern(s.argument);break;case p.Syntax.ArrayExpression:s.type=p.Syntax.ArrayPattern;for(var o=0;o<s.elements.length;o++)s.elements[o]!==null&&this.reinterpretExpressionAsPattern(s.elements[o]);break;case p.Syntax.ObjectExpression:s.type=p.Syntax.ObjectPattern;for(var o=0;o<s.properties.length;o++)this.reinterpretExpressionAsPattern(s.properties[o].value);break;case p.Syntax.AssignmentExpression:s.type=p.Syntax.AssignmentPattern,delete s.operator,this.reinterpretExpressionAsPattern(s.left);break;default:break}},d.prototype.parseGroupExpression=function(){var s;if(this.expect("("),this.match(")"))this.nextToken(),this.match("=>")||this.expect("=>"),s={type:h,params:[],async:!1};else{var o=this.lookahead,u=[];if(this.match("..."))s=this.parseRestElement(u),this.expect(")"),this.match("=>")||this.expect("=>"),s={type:h,params:[s],async:!1};else{var c=!1;if(this.context.isBindingElement=!0,s=this.inheritCoverGrammar(this.parseAssignmentExpression),this.match(",")){var y=[];for(this.context.isAssignmentTarget=!1,y.push(s);this.lookahead.type!==2&&this.match(",");){if(this.nextToken(),this.match(")")){this.nextToken();for(var S=0;S<y.length;S++)this.reinterpretExpressionAsPattern(y[S]);c=!0,s={type:h,params:y,async:!1}}else if(this.match("...")){this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),y.push(this.parseRestElement(u)),this.expect(")"),this.match("=>")||this.expect("=>"),this.context.isBindingElement=!1;for(var S=0;S<y.length;S++)this.reinterpretExpressionAsPattern(y[S]);c=!0,s={type:h,params:y,async:!1}}else y.push(this.inheritCoverGrammar(this.parseAssignmentExpression));if(c)break}c||(s=this.finalize(this.startNode(o),new a.SequenceExpression(y)))}if(!c){if(this.expect(")"),this.match("=>")&&(s.type===p.Syntax.Identifier&&s.name==="yield"&&(c=!0,s={type:h,params:[s],async:!1}),!c)){if(this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),s.type===p.Syntax.SequenceExpression)for(var S=0;S<s.expressions.length;S++)this.reinterpretExpressionAsPattern(s.expressions[S]);else this.reinterpretExpressionAsPattern(s);var D=s.type===p.Syntax.SequenceExpression?s.expressions:[s];s={type:h,params:D,async:!1}}this.context.isBindingElement=!1}}}return s},d.prototype.parseArguments=function(){this.expect("(");var s=[];if(!this.match(")"))for(;;){var o=this.match("...")?this.parseSpreadElement():this.isolateCoverGrammar(this.parseAssignmentExpression);if(s.push(o),this.match(")")||(this.expectCommaSeparator(),this.match(")")))break}return this.expect(")"),s},d.prototype.isIdentifierName=function(s){return s.type===3||s.type===4||s.type===1||s.type===5},d.prototype.parseIdentifierName=function(){var s=this.createNode(),o=this.nextToken();return this.isIdentifierName(o)||this.throwUnexpectedToken(o),this.finalize(s,new a.Identifier(o.value))},d.prototype.parseNewExpression=function(){var s=this.createNode(),o=this.parseIdentifierName();i.assert(o.name==="new","New expression must start with `new`");var u;if(this.match("."))if(this.nextToken(),this.lookahead.type===3&&this.context.inFunctionBody&&this.lookahead.value==="target"){var c=this.parseIdentifierName();u=new a.MetaProperty(o,c)}else this.throwUnexpectedToken(this.lookahead);else{var y=this.isolateCoverGrammar(this.parseLeftHandSideExpression),S=this.match("(")?this.parseArguments():[];u=new a.NewExpression(y,S),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return this.finalize(s,u)},d.prototype.parseAsyncArgument=function(){var s=this.parseAssignmentExpression();return this.context.firstCoverInitializedNameError=null,s},d.prototype.parseAsyncArguments=function(){this.expect("(");var s=[];if(!this.match(")"))for(;;){var o=this.match("...")?this.parseSpreadElement():this.isolateCoverGrammar(this.parseAsyncArgument);if(s.push(o),this.match(")")||(this.expectCommaSeparator(),this.match(")")))break}return this.expect(")"),s},d.prototype.parseLeftHandSideExpressionAllowCall=function(){var s=this.lookahead,o=this.matchContextualKeyword("async"),u=this.context.allowIn;this.context.allowIn=!0;var c;for(this.matchKeyword("super")&&this.context.inFunctionBody?(c=this.createNode(),this.nextToken(),c=this.finalize(c,new a.Super),!this.match("(")&&!this.match(".")&&!this.match("[")&&this.throwUnexpectedToken(this.lookahead)):c=this.inheritCoverGrammar(this.matchKeyword("new")?this.parseNewExpression:this.parsePrimaryExpression);;)if(this.match(".")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!0,this.expect(".");var y=this.parseIdentifierName();c=this.finalize(this.startNode(s),new a.StaticMemberExpression(c,y))}else if(this.match("(")){var S=o&&s.lineNumber===this.lookahead.lineNumber;this.context.isBindingElement=!1,this.context.isAssignmentTarget=!1;var D=S?this.parseAsyncArguments():this.parseArguments();if(c=this.finalize(this.startNode(s),new a.CallExpression(c,D)),S&&this.match("=>")){for(var E=0;E<D.length;++E)this.reinterpretExpressionAsPattern(D[E]);c={type:h,params:D,async:!0}}}else if(this.match("[")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!0,this.expect("[");var y=this.isolateCoverGrammar(this.parseExpression);this.expect("]"),c=this.finalize(this.startNode(s),new a.ComputedMemberExpression(c,y))}else if(this.lookahead.type===10&&this.lookahead.head){var C=this.parseTemplateLiteral();c=this.finalize(this.startNode(s),new a.TaggedTemplateExpression(c,C))}else break;return this.context.allowIn=u,c},d.prototype.parseSuper=function(){var s=this.createNode();return this.expectKeyword("super"),!this.match("[")&&!this.match(".")&&this.throwUnexpectedToken(this.lookahead),this.finalize(s,new a.Super)},d.prototype.parseLeftHandSideExpression=function(){i.assert(this.context.allowIn,"callee of new expression always allow in keyword.");for(var s=this.startNode(this.lookahead),o=this.matchKeyword("super")&&this.context.inFunctionBody?this.parseSuper():this.inheritCoverGrammar(this.matchKeyword("new")?this.parseNewExpression:this.parsePrimaryExpression);;)if(this.match("[")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!0,this.expect("[");var u=this.isolateCoverGrammar(this.parseExpression);this.expect("]"),o=this.finalize(s,new a.ComputedMemberExpression(o,u))}else if(this.match(".")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!0,this.expect(".");var u=this.parseIdentifierName();o=this.finalize(s,new a.StaticMemberExpression(o,u))}else if(this.lookahead.type===10&&this.lookahead.head){var c=this.parseTemplateLiteral();o=this.finalize(s,new a.TaggedTemplateExpression(o,c))}else break;return o},d.prototype.parseUpdateExpression=function(){var s,o=this.lookahead;if(this.match("++")||this.match("--")){var u=this.startNode(o),c=this.nextToken();s=this.inheritCoverGrammar(this.parseUnaryExpression),this.context.strict&&s.type===p.Syntax.Identifier&&this.scanner.isRestrictedWord(s.name)&&this.tolerateError(l.Messages.StrictLHSPrefix),this.context.isAssignmentTarget||this.tolerateError(l.Messages.InvalidLHSInAssignment);var y=!0;s=this.finalize(u,new a.UpdateExpression(c.value,s,y)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}else if(s=this.inheritCoverGrammar(this.parseLeftHandSideExpressionAllowCall),!this.hasLineTerminator&&this.lookahead.type===7&&(this.match("++")||this.match("--"))){this.context.strict&&s.type===p.Syntax.Identifier&&this.scanner.isRestrictedWord(s.name)&&this.tolerateError(l.Messages.StrictLHSPostfix),this.context.isAssignmentTarget||this.tolerateError(l.Messages.InvalidLHSInAssignment),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var S=this.nextToken().value,y=!1;s=this.finalize(this.startNode(o),new a.UpdateExpression(S,s,y))}return s},d.prototype.parseAwaitExpression=function(){var s=this.createNode();this.nextToken();var o=this.parseUnaryExpression();return this.finalize(s,new a.AwaitExpression(o))},d.prototype.parseUnaryExpression=function(){var s;if(this.match("+")||this.match("-")||this.match("~")||this.match("!")||this.matchKeyword("delete")||this.matchKeyword("void")||this.matchKeyword("typeof")){var o=this.startNode(this.lookahead),u=this.nextToken();s=this.inheritCoverGrammar(this.parseUnaryExpression),s=this.finalize(o,new a.UnaryExpression(u.value,s)),this.context.strict&&s.operator==="delete"&&s.argument.type===p.Syntax.Identifier&&this.tolerateError(l.Messages.StrictDelete),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}else this.context.await&&this.matchContextualKeyword("await")?s=this.parseAwaitExpression():s=this.parseUpdateExpression();return s},d.prototype.parseExponentiationExpression=function(){var s=this.lookahead,o=this.inheritCoverGrammar(this.parseUnaryExpression);if(o.type!==p.Syntax.UnaryExpression&&this.match("**")){this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var u=o,c=this.isolateCoverGrammar(this.parseExponentiationExpression);o=this.finalize(this.startNode(s),new a.BinaryExpression("**",u,c))}return o},d.prototype.binaryPrecedence=function(s){var o=s.value,u;return s.type===7?u=this.operatorPrecedence[o]||0:s.type===4?u=o==="instanceof"||this.context.allowIn&&o==="in"?7:0:u=0,u},d.prototype.parseBinaryExpression=function(){var s=this.lookahead,o=this.inheritCoverGrammar(this.parseExponentiationExpression),u=this.lookahead,c=this.binaryPrecedence(u);if(c>0){this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;for(var y=[s,this.lookahead],S=o,D=this.isolateCoverGrammar(this.parseExponentiationExpression),E=[S,u.value,D],C=[c];c=this.binaryPrecedence(this.lookahead),!(c<=0);){for(;E.length>2&&c<=C[C.length-1];){D=E.pop();var T=E.pop();C.pop(),S=E.pop(),y.pop();var I=this.startNode(y[y.length-1]);E.push(this.finalize(I,new a.BinaryExpression(T,S,D)))}E.push(this.nextToken().value),C.push(c),y.push(this.lookahead),E.push(this.isolateCoverGrammar(this.parseExponentiationExpression))}var O=E.length-1;o=E[O];for(var j=y.pop();O>1;){var $=y.pop(),z=j&&j.lineStart,I=this.startNode($,z),T=E[O-1];o=this.finalize(I,new a.BinaryExpression(T,E[O-2],o)),O-=2,j=$}}return o},d.prototype.parseConditionalExpression=function(){var s=this.lookahead,o=this.inheritCoverGrammar(this.parseBinaryExpression);if(this.match("?")){this.nextToken();var u=this.context.allowIn;this.context.allowIn=!0;var c=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowIn=u,this.expect(":");var y=this.isolateCoverGrammar(this.parseAssignmentExpression);o=this.finalize(this.startNode(s),new a.ConditionalExpression(o,c,y)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return o},d.prototype.checkPatternParam=function(s,o){switch(o.type){case p.Syntax.Identifier:this.validateParam(s,o,o.name);break;case p.Syntax.RestElement:this.checkPatternParam(s,o.argument);break;case p.Syntax.AssignmentPattern:this.checkPatternParam(s,o.left);break;case p.Syntax.ArrayPattern:for(var u=0;u<o.elements.length;u++)o.elements[u]!==null&&this.checkPatternParam(s,o.elements[u]);break;case p.Syntax.ObjectPattern:for(var u=0;u<o.properties.length;u++)this.checkPatternParam(s,o.properties[u].value);break;default:break}s.simple=s.simple&&o instanceof a.Identifier},d.prototype.reinterpretAsCoverFormalsList=function(s){var o=[s],u,c=!1;switch(s.type){case p.Syntax.Identifier:break;case h:o=s.params,c=s.async;break;default:return null}u={simple:!0,paramSet:{}};for(var y=0;y<o.length;++y){var S=o[y];S.type===p.Syntax.AssignmentPattern?S.right.type===p.Syntax.YieldExpression&&(S.right.argument&&this.throwUnexpectedToken(this.lookahead),S.right.type=p.Syntax.Identifier,S.right.name="yield",delete S.right.argument,delete S.right.delegate):c&&S.type===p.Syntax.Identifier&&S.name==="await"&&this.throwUnexpectedToken(this.lookahead),this.checkPatternParam(u,S),o[y]=S}if(this.context.strict||!this.context.allowYield)for(var y=0;y<o.length;++y){var S=o[y];S.type===p.Syntax.YieldExpression&&this.throwUnexpectedToken(this.lookahead)}if(u.message===l.Messages.StrictParamDupe){var D=this.context.strict?u.stricted:u.firstRestricted;this.throwUnexpectedToken(D,u.message)}return{simple:u.simple,params:o,stricted:u.stricted,firstRestricted:u.firstRestricted,message:u.message}},d.prototype.parseAssignmentExpression=function(){var s;if(!this.context.allowYield&&this.matchKeyword("yield"))s=this.parseYieldExpression();else{var o=this.lookahead,u=o;if(s=this.parseConditionalExpression(),u.type===3&&u.lineNumber===this.lookahead.lineNumber&&u.value==="async"&&(this.lookahead.type===3||this.matchKeyword("yield"))){var c=this.parsePrimaryExpression();this.reinterpretExpressionAsPattern(c),s={type:h,params:[c],async:!0}}if(s.type===h||this.match("=>")){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var y=s.async,S=this.reinterpretAsCoverFormalsList(s);if(S){this.hasLineTerminator&&this.tolerateUnexpectedToken(this.lookahead),this.context.firstCoverInitializedNameError=null;var D=this.context.strict,E=this.context.allowStrictDirective;this.context.allowStrictDirective=S.simple;var C=this.context.allowYield,T=this.context.await;this.context.allowYield=!0,this.context.await=y;var I=this.startNode(o);this.expect("=>");var O=void 0;if(this.match("{")){var j=this.context.allowIn;this.context.allowIn=!0,O=this.parseFunctionSourceElements(),this.context.allowIn=j}else O=this.isolateCoverGrammar(this.parseAssignmentExpression);var $=O.type!==p.Syntax.BlockStatement;this.context.strict&&S.firstRestricted&&this.throwUnexpectedToken(S.firstRestricted,S.message),this.context.strict&&S.stricted&&this.tolerateUnexpectedToken(S.stricted,S.message),s=y?this.finalize(I,new a.AsyncArrowFunctionExpression(S.params,O,$)):this.finalize(I,new a.ArrowFunctionExpression(S.params,O,$)),this.context.strict=D,this.context.allowStrictDirective=E,this.context.allowYield=C,this.context.await=T}}else if(this.matchAssign()){if(this.context.isAssignmentTarget||this.tolerateError(l.Messages.InvalidLHSInAssignment),this.context.strict&&s.type===p.Syntax.Identifier){var z=s;this.scanner.isRestrictedWord(z.name)&&this.tolerateUnexpectedToken(u,l.Messages.StrictLHSAssignment),this.scanner.isStrictModeReservedWord(z.name)&&this.tolerateUnexpectedToken(u,l.Messages.StrictReservedWord)}this.match("=")?this.reinterpretExpressionAsPattern(s):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1),u=this.nextToken();var Se=u.value,$e=this.isolateCoverGrammar(this.parseAssignmentExpression);s=this.finalize(this.startNode(o),new a.AssignmentExpression(Se,s,$e)),this.context.firstCoverInitializedNameError=null}}return s},d.prototype.parseExpression=function(){var s=this.lookahead,o=this.isolateCoverGrammar(this.parseAssignmentExpression);if(this.match(",")){var u=[];for(u.push(o);this.lookahead.type!==2&&this.match(",");)this.nextToken(),u.push(this.isolateCoverGrammar(this.parseAssignmentExpression));o=this.finalize(this.startNode(s),new a.SequenceExpression(u))}return o},d.prototype.parseStatementListItem=function(){var s;if(this.context.isAssignmentTarget=!0,this.context.isBindingElement=!0,this.lookahead.type===4)switch(this.lookahead.value){case"export":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,l.Messages.IllegalExportDeclaration),s=this.parseExportDeclaration();break;case"import":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,l.Messages.IllegalImportDeclaration),s=this.parseImportDeclaration();break;case"const":s=this.parseLexicalDeclaration({inFor:!1});break;case"function":s=this.parseFunctionDeclaration();break;case"class":s=this.parseClassDeclaration();break;case"let":s=this.isLexicalDeclaration()?this.parseLexicalDeclaration({inFor:!1}):this.parseStatement();break;default:s=this.parseStatement();break}else s=this.parseStatement();return s},d.prototype.parseBlock=function(){var s=this.createNode();this.expect("{");for(var o=[];!this.match("}");)o.push(this.parseStatementListItem());return this.expect("}"),this.finalize(s,new a.BlockStatement(o))},d.prototype.parseLexicalBinding=function(s,o){var u=this.createNode(),c=[],y=this.parsePattern(c,s);this.context.strict&&y.type===p.Syntax.Identifier&&this.scanner.isRestrictedWord(y.name)&&this.tolerateError(l.Messages.StrictVarName);var S=null;return s==="const"?!this.matchKeyword("in")&&!this.matchContextualKeyword("of")&&(this.match("=")?(this.nextToken(),S=this.isolateCoverGrammar(this.parseAssignmentExpression)):this.throwError(l.Messages.DeclarationMissingInitializer,"const")):(!o.inFor&&y.type!==p.Syntax.Identifier||this.match("="))&&(this.expect("="),S=this.isolateCoverGrammar(this.parseAssignmentExpression)),this.finalize(u,new a.VariableDeclarator(y,S))},d.prototype.parseBindingList=function(s,o){for(var u=[this.parseLexicalBinding(s,o)];this.match(",");)this.nextToken(),u.push(this.parseLexicalBinding(s,o));return u},d.prototype.isLexicalDeclaration=function(){var s=this.scanner.saveState();this.scanner.scanComments();var o=this.scanner.lex();return this.scanner.restoreState(s),o.type===3||o.type===7&&o.value==="["||o.type===7&&o.value==="{"||o.type===4&&o.value==="let"||o.type===4&&o.value==="yield"},d.prototype.parseLexicalDeclaration=function(s){var o=this.createNode(),u=this.nextToken().value;i.assert(u==="let"||u==="const","Lexical declaration must be either let or const");var c=this.parseBindingList(u,s);return this.consumeSemicolon(),this.finalize(o,new a.VariableDeclaration(c,u))},d.prototype.parseBindingRestElement=function(s,o){var u=this.createNode();this.expect("...");var c=this.parsePattern(s,o);return this.finalize(u,new a.RestElement(c))},d.prototype.parseArrayPattern=function(s,o){var u=this.createNode();this.expect("[");for(var c=[];!this.match("]");)if(this.match(","))this.nextToken(),c.push(null);else{if(this.match("...")){c.push(this.parseBindingRestElement(s,o));break}else c.push(this.parsePatternWithDefault(s,o));this.match("]")||this.expect(",")}return this.expect("]"),this.finalize(u,new a.ArrayPattern(c))},d.prototype.parsePropertyPattern=function(s,o){var u=this.createNode(),c=!1,y=!1,S=!1,D,E;if(this.lookahead.type===3){var C=this.lookahead;D=this.parseVariableIdentifier();var T=this.finalize(u,new a.Identifier(C.value));if(this.match("=")){s.push(C),y=!0,this.nextToken();var I=this.parseAssignmentExpression();E=this.finalize(this.startNode(C),new a.AssignmentPattern(T,I))}else this.match(":")?(this.expect(":"),E=this.parsePatternWithDefault(s,o)):(s.push(C),y=!0,E=T)}else c=this.match("["),D=this.parseObjectPropertyKey(),this.expect(":"),E=this.parsePatternWithDefault(s,o);return this.finalize(u,new a.Property("init",D,c,E,S,y))},d.prototype.parseObjectPattern=function(s,o){var u=this.createNode(),c=[];for(this.expect("{");!this.match("}");)c.push(this.parsePropertyPattern(s,o)),this.match("}")||this.expect(",");return this.expect("}"),this.finalize(u,new a.ObjectPattern(c))},d.prototype.parsePattern=function(s,o){var u;return this.match("[")?u=this.parseArrayPattern(s,o):this.match("{")?u=this.parseObjectPattern(s,o):(this.matchKeyword("let")&&(o==="const"||o==="let")&&this.tolerateUnexpectedToken(this.lookahead,l.Messages.LetInLexicalBinding),s.push(this.lookahead),u=this.parseVariableIdentifier(o)),u},d.prototype.parsePatternWithDefault=function(s,o){var u=this.lookahead,c=this.parsePattern(s,o);if(this.match("=")){this.nextToken();var y=this.context.allowYield;this.context.allowYield=!0;var S=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowYield=y,c=this.finalize(this.startNode(u),new a.AssignmentPattern(c,S))}return c},d.prototype.parseVariableIdentifier=function(s){var o=this.createNode(),u=this.nextToken();return u.type===4&&u.value==="yield"?this.context.strict?this.tolerateUnexpectedToken(u,l.Messages.StrictReservedWord):this.context.allowYield||this.throwUnexpectedToken(u):u.type!==3?this.context.strict&&u.type===4&&this.scanner.isStrictModeReservedWord(u.value)?this.tolerateUnexpectedToken(u,l.Messages.StrictReservedWord):(this.context.strict||u.value!=="let"||s!=="var")&&this.throwUnexpectedToken(u):(this.context.isModule||this.context.await)&&u.type===3&&u.value==="await"&&this.tolerateUnexpectedToken(u),this.finalize(o,new a.Identifier(u.value))},d.prototype.parseVariableDeclaration=function(s){var o=this.createNode(),u=[],c=this.parsePattern(u,"var");this.context.strict&&c.type===p.Syntax.Identifier&&this.scanner.isRestrictedWord(c.name)&&this.tolerateError(l.Messages.StrictVarName);var y=null;return this.match("=")?(this.nextToken(),y=this.isolateCoverGrammar(this.parseAssignmentExpression)):c.type!==p.Syntax.Identifier&&!s.inFor&&this.expect("="),this.finalize(o,new a.VariableDeclarator(c,y))},d.prototype.parseVariableDeclarationList=function(s){var o={inFor:s.inFor},u=[];for(u.push(this.parseVariableDeclaration(o));this.match(",");)this.nextToken(),u.push(this.parseVariableDeclaration(o));return u},d.prototype.parseVariableStatement=function(){var s=this.createNode();this.expectKeyword("var");var o=this.parseVariableDeclarationList({inFor:!1});return this.consumeSemicolon(),this.finalize(s,new a.VariableDeclaration(o,"var"))},d.prototype.parseEmptyStatement=function(){var s=this.createNode();return this.expect(";"),this.finalize(s,new a.EmptyStatement)},d.prototype.parseExpressionStatement=function(){var s=this.createNode(),o=this.parseExpression();return this.consumeSemicolon(),this.finalize(s,new a.ExpressionStatement(o))},d.prototype.parseIfClause=function(){return this.context.strict&&this.matchKeyword("function")&&this.tolerateError(l.Messages.StrictFunction),this.parseStatement()},d.prototype.parseIfStatement=function(){var s=this.createNode(),o,u=null;this.expectKeyword("if"),this.expect("(");var c=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),o=this.finalize(this.createNode(),new a.EmptyStatement)):(this.expect(")"),o=this.parseIfClause(),this.matchKeyword("else")&&(this.nextToken(),u=this.parseIfClause())),this.finalize(s,new a.IfStatement(c,o,u))},d.prototype.parseDoWhileStatement=function(){var s=this.createNode();this.expectKeyword("do");var o=this.context.inIteration;this.context.inIteration=!0;var u=this.parseStatement();this.context.inIteration=o,this.expectKeyword("while"),this.expect("(");var c=this.parseExpression();return!this.match(")")&&this.config.tolerant?this.tolerateUnexpectedToken(this.nextToken()):(this.expect(")"),this.match(";")&&this.nextToken()),this.finalize(s,new a.DoWhileStatement(u,c))},d.prototype.parseWhileStatement=function(){var s=this.createNode(),o;this.expectKeyword("while"),this.expect("(");var u=this.parseExpression();if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),o=this.finalize(this.createNode(),new a.EmptyStatement);else{this.expect(")");var c=this.context.inIteration;this.context.inIteration=!0,o=this.parseStatement(),this.context.inIteration=c}return this.finalize(s,new a.WhileStatement(u,o))},d.prototype.parseForStatement=function(){var s=null,o=null,u=null,c=!0,y,S,D=this.createNode();if(this.expectKeyword("for"),this.expect("("),this.match(";"))this.nextToken();else if(this.matchKeyword("var")){s=this.createNode(),this.nextToken();var E=this.context.allowIn;this.context.allowIn=!1;var C=this.parseVariableDeclarationList({inFor:!0});if(this.context.allowIn=E,C.length===1&&this.matchKeyword("in")){var T=C[0];T.init&&(T.id.type===p.Syntax.ArrayPattern||T.id.type===p.Syntax.ObjectPattern||this.context.strict)&&this.tolerateError(l.Messages.ForInOfLoopInitializer,"for-in"),s=this.finalize(s,new a.VariableDeclaration(C,"var")),this.nextToken(),y=s,S=this.parseExpression(),s=null}else C.length===1&&C[0].init===null&&this.matchContextualKeyword("of")?(s=this.finalize(s,new a.VariableDeclaration(C,"var")),this.nextToken(),y=s,S=this.parseAssignmentExpression(),s=null,c=!1):(s=this.finalize(s,new a.VariableDeclaration(C,"var")),this.expect(";"))}else if(this.matchKeyword("const")||this.matchKeyword("let")){s=this.createNode();var I=this.nextToken().value;if(!this.context.strict&&this.lookahead.value==="in")s=this.finalize(s,new a.Identifier(I)),this.nextToken(),y=s,S=this.parseExpression(),s=null;else{var E=this.context.allowIn;this.context.allowIn=!1;var C=this.parseBindingList(I,{inFor:!0});this.context.allowIn=E,C.length===1&&C[0].init===null&&this.matchKeyword("in")?(s=this.finalize(s,new a.VariableDeclaration(C,I)),this.nextToken(),y=s,S=this.parseExpression(),s=null):C.length===1&&C[0].init===null&&this.matchContextualKeyword("of")?(s=this.finalize(s,new a.VariableDeclaration(C,I)),this.nextToken(),y=s,S=this.parseAssignmentExpression(),s=null,c=!1):(this.consumeSemicolon(),s=this.finalize(s,new a.VariableDeclaration(C,I)))}}else{var O=this.lookahead,E=this.context.allowIn;if(this.context.allowIn=!1,s=this.inheritCoverGrammar(this.parseAssignmentExpression),this.context.allowIn=E,this.matchKeyword("in"))(!this.context.isAssignmentTarget||s.type===p.Syntax.AssignmentExpression)&&this.tolerateError(l.Messages.InvalidLHSInForIn),this.nextToken(),this.reinterpretExpressionAsPattern(s),y=s,S=this.parseExpression(),s=null;else if(this.matchContextualKeyword("of"))(!this.context.isAssignmentTarget||s.type===p.Syntax.AssignmentExpression)&&this.tolerateError(l.Messages.InvalidLHSInForLoop),this.nextToken(),this.reinterpretExpressionAsPattern(s),y=s,S=this.parseAssignmentExpression(),s=null,c=!1;else{if(this.match(",")){for(var j=[s];this.match(",");)this.nextToken(),j.push(this.isolateCoverGrammar(this.parseAssignmentExpression));s=this.finalize(this.startNode(O),new a.SequenceExpression(j))}this.expect(";")}}typeof y>"u"&&(this.match(";")||(o=this.parseExpression()),this.expect(";"),this.match(")")||(u=this.parseExpression()));var $;if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),$=this.finalize(this.createNode(),new a.EmptyStatement);else{this.expect(")");var z=this.context.inIteration;this.context.inIteration=!0,$=this.isolateCoverGrammar(this.parseStatement),this.context.inIteration=z}return typeof y>"u"?this.finalize(D,new a.ForStatement(s,o,u,$)):c?this.finalize(D,new a.ForInStatement(y,S,$)):this.finalize(D,new a.ForOfStatement(y,S,$))},d.prototype.parseContinueStatement=function(){var s=this.createNode();this.expectKeyword("continue");var o=null;if(this.lookahead.type===3&&!this.hasLineTerminator){var u=this.parseVariableIdentifier();o=u;var c="$"+u.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,c)||this.throwError(l.Messages.UnknownLabel,u.name)}return this.consumeSemicolon(),o===null&&!this.context.inIteration&&this.throwError(l.Messages.IllegalContinue),this.finalize(s,new a.ContinueStatement(o))},d.prototype.parseBreakStatement=function(){var s=this.createNode();this.expectKeyword("break");var o=null;if(this.lookahead.type===3&&!this.hasLineTerminator){var u=this.parseVariableIdentifier(),c="$"+u.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,c)||this.throwError(l.Messages.UnknownLabel,u.name),o=u}return this.consumeSemicolon(),o===null&&!this.context.inIteration&&!this.context.inSwitch&&this.throwError(l.Messages.IllegalBreak),this.finalize(s,new a.BreakStatement(o))},d.prototype.parseReturnStatement=function(){this.context.inFunctionBody||this.tolerateError(l.Messages.IllegalReturn);var s=this.createNode();this.expectKeyword("return");var o=!this.match(";")&&!this.match("}")&&!this.hasLineTerminator&&this.lookahead.type!==2||this.lookahead.type===8||this.lookahead.type===10,u=o?this.parseExpression():null;return this.consumeSemicolon(),this.finalize(s,new a.ReturnStatement(u))},d.prototype.parseWithStatement=function(){this.context.strict&&this.tolerateError(l.Messages.StrictModeWith);var s=this.createNode(),o;this.expectKeyword("with"),this.expect("(");var u=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),o=this.finalize(this.createNode(),new a.EmptyStatement)):(this.expect(")"),o=this.parseStatement()),this.finalize(s,new a.WithStatement(u,o))},d.prototype.parseSwitchCase=function(){var s=this.createNode(),o;this.matchKeyword("default")?(this.nextToken(),o=null):(this.expectKeyword("case"),o=this.parseExpression()),this.expect(":");for(var u=[];!(this.match("}")||this.matchKeyword("default")||this.matchKeyword("case"));)u.push(this.parseStatementListItem());return this.finalize(s,new a.SwitchCase(o,u))},d.prototype.parseSwitchStatement=function(){var s=this.createNode();this.expectKeyword("switch"),this.expect("(");var o=this.parseExpression();this.expect(")");var u=this.context.inSwitch;this.context.inSwitch=!0;var c=[],y=!1;for(this.expect("{");!this.match("}");){var S=this.parseSwitchCase();S.test===null&&(y&&this.throwError(l.Messages.MultipleDefaultsInSwitch),y=!0),c.push(S)}return this.expect("}"),this.context.inSwitch=u,this.finalize(s,new a.SwitchStatement(o,c))},d.prototype.parseLabelledStatement=function(){var s=this.createNode(),o=this.parseExpression(),u;if(o.type===p.Syntax.Identifier&&this.match(":")){this.nextToken();var c=o,y="$"+c.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,y)&&this.throwError(l.Messages.Redeclaration,"Label",c.name),this.context.labelSet[y]=!0;var S=void 0;if(this.matchKeyword("class"))this.tolerateUnexpectedToken(this.lookahead),S=this.parseClassDeclaration();else if(this.matchKeyword("function")){var D=this.lookahead,E=this.parseFunctionDeclaration();this.context.strict?this.tolerateUnexpectedToken(D,l.Messages.StrictFunction):E.generator&&this.tolerateUnexpectedToken(D,l.Messages.GeneratorInLegacyContext),S=E}else S=this.parseStatement();delete this.context.labelSet[y],u=new a.LabeledStatement(c,S)}else this.consumeSemicolon(),u=new a.ExpressionStatement(o);return this.finalize(s,u)},d.prototype.parseThrowStatement=function(){var s=this.createNode();this.expectKeyword("throw"),this.hasLineTerminator&&this.throwError(l.Messages.NewlineAfterThrow);var o=this.parseExpression();return this.consumeSemicolon(),this.finalize(s,new a.ThrowStatement(o))},d.prototype.parseCatchClause=function(){var s=this.createNode();this.expectKeyword("catch"),this.expect("("),this.match(")")&&this.throwUnexpectedToken(this.lookahead);for(var o=[],u=this.parsePattern(o),c={},y=0;y<o.length;y++){var S="$"+o[y].value;Object.prototype.hasOwnProperty.call(c,S)&&this.tolerateError(l.Messages.DuplicateBinding,o[y].value),c[S]=!0}this.context.strict&&u.type===p.Syntax.Identifier&&this.scanner.isRestrictedWord(u.name)&&this.tolerateError(l.Messages.StrictCatchVariable),this.expect(")");var D=this.parseBlock();return this.finalize(s,new a.CatchClause(u,D))},d.prototype.parseFinallyClause=function(){return this.expectKeyword("finally"),this.parseBlock()},d.prototype.parseTryStatement=function(){var s=this.createNode();this.expectKeyword("try");var o=this.parseBlock(),u=this.matchKeyword("catch")?this.parseCatchClause():null,c=this.matchKeyword("finally")?this.parseFinallyClause():null;return!u&&!c&&this.throwError(l.Messages.NoCatchOrFinally),this.finalize(s,new a.TryStatement(o,u,c))},d.prototype.parseDebuggerStatement=function(){var s=this.createNode();return this.expectKeyword("debugger"),this.consumeSemicolon(),this.finalize(s,new a.DebuggerStatement)},d.prototype.parseStatement=function(){var s;switch(this.lookahead.type){case 1:case 5:case 6:case 8:case 10:case 9:s=this.parseExpressionStatement();break;case 7:var o=this.lookahead.value;o==="{"?s=this.parseBlock():o==="("?s=this.parseExpressionStatement():o===";"?s=this.parseEmptyStatement():s=this.parseExpressionStatement();break;case 3:s=this.matchAsyncFunction()?this.parseFunctionDeclaration():this.parseLabelledStatement();break;case 4:switch(this.lookahead.value){case"break":s=this.parseBreakStatement();break;case"continue":s=this.parseContinueStatement();break;case"debugger":s=this.parseDebuggerStatement();break;case"do":s=this.parseDoWhileStatement();break;case"for":s=this.parseForStatement();break;case"function":s=this.parseFunctionDeclaration();break;case"if":s=this.parseIfStatement();break;case"return":s=this.parseReturnStatement();break;case"switch":s=this.parseSwitchStatement();break;case"throw":s=this.parseThrowStatement();break;case"try":s=this.parseTryStatement();break;case"var":s=this.parseVariableStatement();break;case"while":s=this.parseWhileStatement();break;case"with":s=this.parseWithStatement();break;default:s=this.parseExpressionStatement();break}break;default:s=this.throwUnexpectedToken(this.lookahead)}return s},d.prototype.parseFunctionSourceElements=function(){var s=this.createNode();this.expect("{");var o=this.parseDirectivePrologues(),u=this.context.labelSet,c=this.context.inIteration,y=this.context.inSwitch,S=this.context.inFunctionBody;for(this.context.labelSet={},this.context.inIteration=!1,this.context.inSwitch=!1,this.context.inFunctionBody=!0;this.lookahead.type!==2&&!this.match("}");)o.push(this.parseStatementListItem());return this.expect("}"),this.context.labelSet=u,this.context.inIteration=c,this.context.inSwitch=y,this.context.inFunctionBody=S,this.finalize(s,new a.BlockStatement(o))},d.prototype.validateParam=function(s,o,u){var c="$"+u;this.context.strict?(this.scanner.isRestrictedWord(u)&&(s.stricted=o,s.message=l.Messages.StrictParamName),Object.prototype.hasOwnProperty.call(s.paramSet,c)&&(s.stricted=o,s.message=l.Messages.StrictParamDupe)):s.firstRestricted||(this.scanner.isRestrictedWord(u)?(s.firstRestricted=o,s.message=l.Messages.StrictParamName):this.scanner.isStrictModeReservedWord(u)?(s.firstRestricted=o,s.message=l.Messages.StrictReservedWord):Object.prototype.hasOwnProperty.call(s.paramSet,c)&&(s.stricted=o,s.message=l.Messages.StrictParamDupe)),typeof Object.defineProperty=="function"?Object.defineProperty(s.paramSet,c,{value:!0,enumerable:!0,writable:!0,configurable:!0}):s.paramSet[c]=!0},d.prototype.parseRestElement=function(s){var o=this.createNode();this.expect("...");var u=this.parsePattern(s);return this.match("=")&&this.throwError(l.Messages.DefaultRestParameter),this.match(")")||this.throwError(l.Messages.ParameterAfterRestParameter),this.finalize(o,new a.RestElement(u))},d.prototype.parseFormalParameter=function(s){for(var o=[],u=this.match("...")?this.parseRestElement(o):this.parsePatternWithDefault(o),c=0;c<o.length;c++)this.validateParam(s,o[c],o[c].value);s.simple=s.simple&&u instanceof a.Identifier,s.params.push(u)},d.prototype.parseFormalParameters=function(s){var o;if(o={simple:!0,params:[],firstRestricted:s},this.expect("("),!this.match(")"))for(o.paramSet={};this.lookahead.type!==2&&(this.parseFormalParameter(o),!(this.match(")")||(this.expect(","),this.match(")")))););return this.expect(")"),{simple:o.simple,params:o.params,stricted:o.stricted,firstRestricted:o.firstRestricted,message:o.message}},d.prototype.matchAsyncFunction=function(){var s=this.matchContextualKeyword("async");if(s){var o=this.scanner.saveState();this.scanner.scanComments();var u=this.scanner.lex();this.scanner.restoreState(o),s=o.lineNumber===u.lineNumber&&u.type===4&&u.value==="function"}return s},d.prototype.parseFunctionDeclaration=function(s){var o=this.createNode(),u=this.matchContextualKeyword("async");u&&this.nextToken(),this.expectKeyword("function");var c=u?!1:this.match("*");c&&this.nextToken();var y,S=null,D=null;if(!s||!this.match("(")){var E=this.lookahead;S=this.parseVariableIdentifier(),this.context.strict?this.scanner.isRestrictedWord(E.value)&&this.tolerateUnexpectedToken(E,l.Messages.StrictFunctionName):this.scanner.isRestrictedWord(E.value)?(D=E,y=l.Messages.StrictFunctionName):this.scanner.isStrictModeReservedWord(E.value)&&(D=E,y=l.Messages.StrictReservedWord)}var C=this.context.await,T=this.context.allowYield;this.context.await=u,this.context.allowYield=!c;var I=this.parseFormalParameters(D),O=I.params,j=I.stricted;D=I.firstRestricted,I.message&&(y=I.message);var $=this.context.strict,z=this.context.allowStrictDirective;this.context.allowStrictDirective=I.simple;var Se=this.parseFunctionSourceElements();return this.context.strict&&D&&this.throwUnexpectedToken(D,y),this.context.strict&&j&&this.tolerateUnexpectedToken(j,y),this.context.strict=$,this.context.allowStrictDirective=z,this.context.await=C,this.context.allowYield=T,u?this.finalize(o,new a.AsyncFunctionDeclaration(S,O,Se)):this.finalize(o,new a.FunctionDeclaration(S,O,Se,c))},d.prototype.parseFunctionExpression=function(){var s=this.createNode(),o=this.matchContextualKeyword("async");o&&this.nextToken(),this.expectKeyword("function");var u=o?!1:this.match("*");u&&this.nextToken();var c,y=null,S,D=this.context.await,E=this.context.allowYield;if(this.context.await=o,this.context.allowYield=!u,!this.match("(")){var C=this.lookahead;y=!this.context.strict&&!u&&this.matchKeyword("yield")?this.parseIdentifierName():this.parseVariableIdentifier(),this.context.strict?this.scanner.isRestrictedWord(C.value)&&this.tolerateUnexpectedToken(C,l.Messages.StrictFunctionName):this.scanner.isRestrictedWord(C.value)?(S=C,c=l.Messages.StrictFunctionName):this.scanner.isStrictModeReservedWord(C.value)&&(S=C,c=l.Messages.StrictReservedWord)}var T=this.parseFormalParameters(S),I=T.params,O=T.stricted;S=T.firstRestricted,T.message&&(c=T.message);var j=this.context.strict,$=this.context.allowStrictDirective;this.context.allowStrictDirective=T.simple;var z=this.parseFunctionSourceElements();return this.context.strict&&S&&this.throwUnexpectedToken(S,c),this.context.strict&&O&&this.tolerateUnexpectedToken(O,c),this.context.strict=j,this.context.allowStrictDirective=$,this.context.await=D,this.context.allowYield=E,o?this.finalize(s,new a.AsyncFunctionExpression(y,I,z)):this.finalize(s,new a.FunctionExpression(y,I,z,u))},d.prototype.parseDirective=function(){var s=this.lookahead,o=this.createNode(),u=this.parseExpression(),c=u.type===p.Syntax.Literal?this.getTokenRaw(s).slice(1,-1):null;return this.consumeSemicolon(),this.finalize(o,c?new a.Directive(u,c):new a.ExpressionStatement(u))},d.prototype.parseDirectivePrologues=function(){for(var s=null,o=[];;){var u=this.lookahead;if(u.type!==8)break;var c=this.parseDirective();o.push(c);var y=c.directive;if(typeof y!="string")break;y==="use strict"?(this.context.strict=!0,s&&this.tolerateUnexpectedToken(s,l.Messages.StrictOctalLiteral),this.context.allowStrictDirective||this.tolerateUnexpectedToken(u,l.Messages.IllegalLanguageModeDirective)):!s&&u.octal&&(s=u)}return o},d.prototype.qualifiedPropertyName=function(s){switch(s.type){case 3:case 8:case 1:case 5:case 6:case 4:return!0;case 7:return s.value==="[";default:break}return!1},d.prototype.parseGetterMethod=function(){var s=this.createNode(),o=!1,u=this.context.allowYield;this.context.allowYield=!o;var c=this.parseFormalParameters();c.params.length>0&&this.tolerateError(l.Messages.BadGetterArity);var y=this.parsePropertyMethod(c);return this.context.allowYield=u,this.finalize(s,new a.FunctionExpression(null,c.params,y,o))},d.prototype.parseSetterMethod=function(){var s=this.createNode(),o=!1,u=this.context.allowYield;this.context.allowYield=!o;var c=this.parseFormalParameters();c.params.length!==1?this.tolerateError(l.Messages.BadSetterArity):c.params[0]instanceof a.RestElement&&this.tolerateError(l.Messages.BadSetterRestParameter);var y=this.parsePropertyMethod(c);return this.context.allowYield=u,this.finalize(s,new a.FunctionExpression(null,c.params,y,o))},d.prototype.parseGeneratorMethod=function(){var s=this.createNode(),o=!0,u=this.context.allowYield;this.context.allowYield=!0;var c=this.parseFormalParameters();this.context.allowYield=!1;var y=this.parsePropertyMethod(c);return this.context.allowYield=u,this.finalize(s,new a.FunctionExpression(null,c.params,y,o))},d.prototype.isStartOfExpression=function(){var s=!0,o=this.lookahead.value;switch(this.lookahead.type){case 7:s=o==="["||o==="("||o==="{"||o==="+"||o==="-"||o==="!"||o==="~"||o==="++"||o==="--"||o==="/"||o==="/=";break;case 4:s=o==="class"||o==="delete"||o==="function"||o==="let"||o==="new"||o==="super"||o==="this"||o==="typeof"||o==="void"||o==="yield";break;default:break}return s},d.prototype.parseYieldExpression=function(){var s=this.createNode();this.expectKeyword("yield");var o=null,u=!1;if(!this.hasLineTerminator){var c=this.context.allowYield;this.context.allowYield=!1,u=this.match("*"),u?(this.nextToken(),o=this.parseAssignmentExpression()):this.isStartOfExpression()&&(o=this.parseAssignmentExpression()),this.context.allowYield=c}return this.finalize(s,new a.YieldExpression(o,u))},d.prototype.parseClassElement=function(s){var o=this.lookahead,u=this.createNode(),c="",y=null,S=null,D=!1,E=!1,C=!1,T=!1;if(this.match("*"))this.nextToken();else{D=this.match("["),y=this.parseObjectPropertyKey();var I=y;if(I.name==="static"&&(this.qualifiedPropertyName(this.lookahead)||this.match("*"))&&(o=this.lookahead,C=!0,D=this.match("["),this.match("*")?this.nextToken():y=this.parseObjectPropertyKey()),o.type===3&&!this.hasLineTerminator&&o.value==="async"){var O=this.lookahead.value;O!==":"&&O!=="("&&O!=="*"&&(T=!0,o=this.lookahead,y=this.parseObjectPropertyKey(),o.type===3&&o.value==="constructor"&&this.tolerateUnexpectedToken(o,l.Messages.ConstructorIsAsync))}}var j=this.qualifiedPropertyName(this.lookahead);return o.type===3?o.value==="get"&&j?(c="get",D=this.match("["),y=this.parseObjectPropertyKey(),this.context.allowYield=!1,S=this.parseGetterMethod()):o.value==="set"&&j&&(c="set",D=this.match("["),y=this.parseObjectPropertyKey(),S=this.parseSetterMethod()):o.type===7&&o.value==="*"&&j&&(c="init",D=this.match("["),y=this.parseObjectPropertyKey(),S=this.parseGeneratorMethod(),E=!0),!c&&y&&this.match("(")&&(c="init",S=T?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),E=!0),c||this.throwUnexpectedToken(this.lookahead),c==="init"&&(c="method"),D||(C&&this.isPropertyKey(y,"prototype")&&this.throwUnexpectedToken(o,l.Messages.StaticPrototype),!C&&this.isPropertyKey(y,"constructor")&&((c!=="method"||!E||S&&S.generator)&&this.throwUnexpectedToken(o,l.Messages.ConstructorSpecialMethod),s.value?this.throwUnexpectedToken(o,l.Messages.DuplicateConstructor):s.value=!0,c="constructor")),this.finalize(u,new a.MethodDefinition(y,D,S,c,C))},d.prototype.parseClassElementList=function(){var s=[],o={value:!1};for(this.expect("{");!this.match("}");)this.match(";")?this.nextToken():s.push(this.parseClassElement(o));return this.expect("}"),s},d.prototype.parseClassBody=function(){var s=this.createNode(),o=this.parseClassElementList();return this.finalize(s,new a.ClassBody(o))},d.prototype.parseClassDeclaration=function(s){var o=this.createNode(),u=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var c=s&&this.lookahead.type!==3?null:this.parseVariableIdentifier(),y=null;this.matchKeyword("extends")&&(this.nextToken(),y=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var S=this.parseClassBody();return this.context.strict=u,this.finalize(o,new a.ClassDeclaration(c,y,S))},d.prototype.parseClassExpression=function(){var s=this.createNode(),o=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var u=this.lookahead.type===3?this.parseVariableIdentifier():null,c=null;this.matchKeyword("extends")&&(this.nextToken(),c=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var y=this.parseClassBody();return this.context.strict=o,this.finalize(s,new a.ClassExpression(u,c,y))},d.prototype.parseModule=function(){this.context.strict=!0,this.context.isModule=!0,this.scanner.isModule=!0;for(var s=this.createNode(),o=this.parseDirectivePrologues();this.lookahead.type!==2;)o.push(this.parseStatementListItem());return this.finalize(s,new a.Module(o))},d.prototype.parseScript=function(){for(var s=this.createNode(),o=this.parseDirectivePrologues();this.lookahead.type!==2;)o.push(this.parseStatementListItem());return this.finalize(s,new a.Script(o))},d.prototype.parseModuleSpecifier=function(){var s=this.createNode();this.lookahead.type!==8&&this.throwError(l.Messages.InvalidModuleSpecifier);var o=this.nextToken(),u=this.getTokenRaw(o);return this.finalize(s,new a.Literal(o.value,u))},d.prototype.parseImportSpecifier=function(){var s=this.createNode(),o,u;return this.lookahead.type===3?(o=this.parseVariableIdentifier(),u=o,this.matchContextualKeyword("as")&&(this.nextToken(),u=this.parseVariableIdentifier())):(o=this.parseIdentifierName(),u=o,this.matchContextualKeyword("as")?(this.nextToken(),u=this.parseVariableIdentifier()):this.throwUnexpectedToken(this.nextToken())),this.finalize(s,new a.ImportSpecifier(u,o))},d.prototype.parseNamedImports=function(){this.expect("{");for(var s=[];!this.match("}");)s.push(this.parseImportSpecifier()),this.match("}")||this.expect(",");return this.expect("}"),s},d.prototype.parseImportDefaultSpecifier=function(){var s=this.createNode(),o=this.parseIdentifierName();return this.finalize(s,new a.ImportDefaultSpecifier(o))},d.prototype.parseImportNamespaceSpecifier=function(){var s=this.createNode();this.expect("*"),this.matchContextualKeyword("as")||this.throwError(l.Messages.NoAsAfterImportNamespace),this.nextToken();var o=this.parseIdentifierName();return this.finalize(s,new a.ImportNamespaceSpecifier(o))},d.prototype.parseImportDeclaration=function(){this.context.inFunctionBody&&this.throwError(l.Messages.IllegalImportDeclaration);var s=this.createNode();this.expectKeyword("import");var o,u=[];if(this.lookahead.type===8)o=this.parseModuleSpecifier();else{if(this.match("{")?u=u.concat(this.parseNamedImports()):this.match("*")?u.push(this.parseImportNamespaceSpecifier()):this.isIdentifierName(this.lookahead)&&!this.matchKeyword("default")?(u.push(this.parseImportDefaultSpecifier()),this.match(",")&&(this.nextToken(),this.match("*")?u.push(this.parseImportNamespaceSpecifier()):this.match("{")?u=u.concat(this.parseNamedImports()):this.throwUnexpectedToken(this.lookahead))):this.throwUnexpectedToken(this.nextToken()),!this.matchContextualKeyword("from")){var c=this.lookahead.value?l.Messages.UnexpectedToken:l.Messages.MissingFromClause;this.throwError(c,this.lookahead.value)}this.nextToken(),o=this.parseModuleSpecifier()}return this.consumeSemicolon(),this.finalize(s,new a.ImportDeclaration(u,o))},d.prototype.parseExportSpecifier=function(){var s=this.createNode(),o=this.parseIdentifierName(),u=o;return this.matchContextualKeyword("as")&&(this.nextToken(),u=this.parseIdentifierName()),this.finalize(s,new a.ExportSpecifier(o,u))},d.prototype.parseExportDeclaration=function(){this.context.inFunctionBody&&this.throwError(l.Messages.IllegalExportDeclaration);var s=this.createNode();this.expectKeyword("export");var o;if(this.matchKeyword("default"))if(this.nextToken(),this.matchKeyword("function")){var u=this.parseFunctionDeclaration(!0);o=this.finalize(s,new a.ExportDefaultDeclaration(u))}else if(this.matchKeyword("class")){var u=this.parseClassDeclaration(!0);o=this.finalize(s,new a.ExportDefaultDeclaration(u))}else if(this.matchContextualKeyword("async")){var u=this.matchAsyncFunction()?this.parseFunctionDeclaration(!0):this.parseAssignmentExpression();o=this.finalize(s,new a.ExportDefaultDeclaration(u))}else{this.matchContextualKeyword("from")&&this.throwError(l.Messages.UnexpectedToken,this.lookahead.value);var u=this.match("{")?this.parseObjectInitializer():this.match("[")?this.parseArrayInitializer():this.parseAssignmentExpression();this.consumeSemicolon(),o=this.finalize(s,new a.ExportDefaultDeclaration(u))}else if(this.match("*")){if(this.nextToken(),!this.matchContextualKeyword("from")){var c=this.lookahead.value?l.Messages.UnexpectedToken:l.Messages.MissingFromClause;this.throwError(c,this.lookahead.value)}this.nextToken();var y=this.parseModuleSpecifier();this.consumeSemicolon(),o=this.finalize(s,new a.ExportAllDeclaration(y))}else if(this.lookahead.type===4){var u=void 0;switch(this.lookahead.value){case"let":case"const":u=this.parseLexicalDeclaration({inFor:!1});break;case"var":case"class":case"function":u=this.parseStatementListItem();break;default:this.throwUnexpectedToken(this.lookahead)}o=this.finalize(s,new a.ExportNamedDeclaration(u,[],null))}else if(this.matchAsyncFunction()){var u=this.parseFunctionDeclaration();o=this.finalize(s,new a.ExportNamedDeclaration(u,[],null))}else{var S=[],D=null,E=!1;for(this.expect("{");!this.match("}");)E=E||this.matchKeyword("default"),S.push(this.parseExportSpecifier()),this.match("}")||this.expect(",");if(this.expect("}"),this.matchContextualKeyword("from"))this.nextToken(),D=this.parseModuleSpecifier(),this.consumeSemicolon();else if(E){var c=this.lookahead.value?l.Messages.UnexpectedToken:l.Messages.MissingFromClause;this.throwError(c,this.lookahead.value)}else this.consumeSemicolon();o=this.finalize(s,new a.ExportNamedDeclaration(null,S,D))}return o},d}();e.Parser=g},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});function r(i,n){if(!i)throw new Error("ASSERT: "+n)}e.assert=r},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function i(){this.errors=[],this.tolerant=!1}return i.prototype.recordError=function(n){this.errors.push(n)},i.prototype.tolerate=function(n){if(this.tolerant)this.recordError(n);else throw n},i.prototype.constructError=function(n,l){var a=new Error(n);try{throw a}catch(f){Object.create&&Object.defineProperty&&(a=Object.create(f),Object.defineProperty(a,"column",{value:l}))}return a},i.prototype.createError=function(n,l,a,f){var p="Line "+l+": "+f,m=this.constructError(p,a);return m.index=n,m.lineNumber=l,m.description=f,m},i.prototype.throwError=function(n,l,a,f){throw this.createError(n,l,a,f)},i.prototype.tolerateError=function(n,l,a,f){var p=this.createError(n,l,a,f);if(this.tolerant)this.recordError(p);else throw p},i}();e.ErrorHandler=r},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Messages={BadGetterArity:"Getter must not have any formal parameters",BadSetterArity:"Setter must have exactly one formal parameter",BadSetterRestParameter:"Setter function argument must not be a rest parameter",ConstructorIsAsync:"Class constructor may not be an async method",ConstructorSpecialMethod:"Class constructor may not be an accessor",DeclarationMissingInitializer:"Missing initializer in %0 declaration",DefaultRestParameter:"Unexpected token =",DuplicateBinding:"Duplicate binding %0",DuplicateConstructor:"A class may only have one constructor",DuplicateProtoProperty:"Duplicate __proto__ fields are not allowed in object literals",ForInOfLoopInitializer:"%0 loop variable declaration may not have an initializer",GeneratorInLegacyContext:"Generator declarations are not allowed in legacy contexts",IllegalBreak:"Illegal break statement",IllegalContinue:"Illegal continue statement",IllegalExportDeclaration:"Unexpected token",IllegalImportDeclaration:"Unexpected token",IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list",IllegalReturn:"Illegal return statement",InvalidEscapedReservedWord:"Keyword must not contain escaped characters",InvalidHexEscapeSequence:"Invalid hexadecimal escape sequence",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",InvalidLHSInForLoop:"Invalid left-hand side in for-loop",InvalidModuleSpecifier:"Unexpected token",InvalidRegExp:"Invalid regular expression",LetInLexicalBinding:"let is disallowed as a lexically bound name",MissingFromClause:"Unexpected token",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NewlineAfterThrow:"Illegal newline after throw",NoAsAfterImportNamespace:"Unexpected token",NoCatchOrFinally:"Missing catch or finally after try",ParameterAfterRestParameter:"Rest parameter must be last formal parameter",Redeclaration:"%0 '%1' has already been declared",StaticPrototype:"Classes may not have static property named prototype",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictModeWith:"Strict mode code may not include a with statement",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictReservedWord:"Use of future reserved word in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",TemplateOctalLiteral:"Octal literals are not allowed in template strings.",UnexpectedEOS:"Unexpected end of input",UnexpectedIdentifier:"Unexpected identifier",UnexpectedNumber:"Unexpected number",UnexpectedReserved:"Unexpected reserved word",UnexpectedString:"Unexpected string",UnexpectedTemplate:"Unexpected quasi %0",UnexpectedToken:"Unexpected token %0",UnexpectedTokenIllegal:"Unexpected token ILLEGAL",UnknownLabel:"Undefined label '%0'",UnterminatedRegExp:"Invalid regular expression: missing /"}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=r(9),n=r(4),l=r(11);function a(m){return"0123456789abcdef".indexOf(m.toLowerCase())}function f(m){return"01234567".indexOf(m)}var p=function(){function m(h,g){this.source=h,this.errorHandler=g,this.trackComment=!1,this.isModule=!1,this.length=h.length,this.index=0,this.lineNumber=h.length>0?1:0,this.lineStart=0,this.curlyStack=[]}return m.prototype.saveState=function(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart}},m.prototype.restoreState=function(h){this.index=h.index,this.lineNumber=h.lineNumber,this.lineStart=h.lineStart},m.prototype.eof=function(){return this.index>=this.length},m.prototype.throwUnexpectedToken=function(h){return h===void 0&&(h=l.Messages.UnexpectedTokenIllegal),this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,h)},m.prototype.tolerateUnexpectedToken=function(h){h===void 0&&(h=l.Messages.UnexpectedTokenIllegal),this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,h)},m.prototype.skipSingleLineComment=function(h){var g=[],d,s;for(this.trackComment&&(g=[],d=this.index-h,s={start:{line:this.lineNumber,column:this.index-this.lineStart-h},end:{}});!this.eof();){var o=this.source.charCodeAt(this.index);if(++this.index,n.Character.isLineTerminator(o)){if(this.trackComment){s.end={line:this.lineNumber,column:this.index-this.lineStart-1};var u={multiLine:!1,slice:[d+h,this.index-1],range:[d,this.index-1],loc:s};g.push(u)}return o===13&&this.source.charCodeAt(this.index)===10&&++this.index,++this.lineNumber,this.lineStart=this.index,g}}if(this.trackComment){s.end={line:this.lineNumber,column:this.index-this.lineStart};var u={multiLine:!1,slice:[d+h,this.index],range:[d,this.index],loc:s};g.push(u)}return g},m.prototype.skipMultiLineComment=function(){var h=[],g,d;for(this.trackComment&&(h=[],g=this.index-2,d={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{}});!this.eof();){var s=this.source.charCodeAt(this.index);if(n.Character.isLineTerminator(s))s===13&&this.source.charCodeAt(this.index+1)===10&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(s===42){if(this.source.charCodeAt(this.index+1)===47){if(this.index+=2,this.trackComment){d.end={line:this.lineNumber,column:this.index-this.lineStart};var o={multiLine:!0,slice:[g+2,this.index-2],range:[g,this.index],loc:d};h.push(o)}return h}++this.index}else++this.index}if(this.trackComment){d.end={line:this.lineNumber,column:this.index-this.lineStart};var o={multiLine:!0,slice:[g+2,this.index],range:[g,this.index],loc:d};h.push(o)}return this.tolerateUnexpectedToken(),h},m.prototype.scanComments=function(){var h;this.trackComment&&(h=[]);for(var g=this.index===0;!this.eof();){var d=this.source.charCodeAt(this.index);if(n.Character.isWhiteSpace(d))++this.index;else if(n.Character.isLineTerminator(d))++this.index,d===13&&this.source.charCodeAt(this.index)===10&&++this.index,++this.lineNumber,this.lineStart=this.index,g=!0;else if(d===47)if(d=this.source.charCodeAt(this.index+1),d===47){this.index+=2;var s=this.skipSingleLineComment(2);this.trackComment&&(h=h.concat(s)),g=!0}else if(d===42){this.index+=2;var s=this.skipMultiLineComment();this.trackComment&&(h=h.concat(s))}else break;else if(g&&d===45)if(this.source.charCodeAt(this.index+1)===45&&this.source.charCodeAt(this.index+2)===62){this.index+=3;var s=this.skipSingleLineComment(3);this.trackComment&&(h=h.concat(s))}else break;else if(d===60&&!this.isModule)if(this.source.slice(this.index+1,this.index+4)==="!--"){this.index+=4;var s=this.skipSingleLineComment(4);this.trackComment&&(h=h.concat(s))}else break;else break}return h},m.prototype.isFutureReservedWord=function(h){switch(h){case"enum":case"export":case"import":case"super":return!0;default:return!1}},m.prototype.isStrictModeReservedWord=function(h){switch(h){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}},m.prototype.isRestrictedWord=function(h){return h==="eval"||h==="arguments"},m.prototype.isKeyword=function(h){switch(h.length){case 2:return h==="if"||h==="in"||h==="do";case 3:return h==="var"||h==="for"||h==="new"||h==="try"||h==="let";case 4:return h==="this"||h==="else"||h==="case"||h==="void"||h==="with"||h==="enum";case 5:return h==="while"||h==="break"||h==="catch"||h==="throw"||h==="const"||h==="yield"||h==="class"||h==="super";case 6:return h==="return"||h==="typeof"||h==="delete"||h==="switch"||h==="export"||h==="import";case 7:return h==="default"||h==="finally"||h==="extends";case 8:return h==="function"||h==="continue"||h==="debugger";case 10:return h==="instanceof";default:return!1}},m.prototype.codePointAt=function(h){var g=this.source.charCodeAt(h);if(g>=55296&&g<=56319){var d=this.source.charCodeAt(h+1);if(d>=56320&&d<=57343){var s=g;g=(s-55296)*1024+d-56320+65536}}return g},m.prototype.scanHexEscape=function(h){for(var g=h==="u"?4:2,d=0,s=0;s<g;++s)if(!this.eof()&&n.Character.isHexDigit(this.source.charCodeAt(this.index)))d=d*16+a(this.source[this.index++]);else return null;return String.fromCharCode(d)},m.prototype.scanUnicodeCodePointEscape=function(){var h=this.source[this.index],g=0;for(h==="}"&&this.throwUnexpectedToken();!this.eof()&&(h=this.source[this.index++],!!n.Character.isHexDigit(h.charCodeAt(0)));)g=g*16+a(h);return(g>1114111||h!=="}")&&this.throwUnexpectedToken(),n.Character.fromCodePoint(g)},m.prototype.getIdentifier=function(){for(var h=this.index++;!this.eof();){var g=this.source.charCodeAt(this.index);if(g===92)return this.index=h,this.getComplexIdentifier();if(g>=55296&&g<57343)return this.index=h,this.getComplexIdentifier();if(n.Character.isIdentifierPart(g))++this.index;else break}return this.source.slice(h,this.index)},m.prototype.getComplexIdentifier=function(){var h=this.codePointAt(this.index),g=n.Character.fromCodePoint(h);this.index+=g.length;var d;for(h===92&&(this.source.charCodeAt(this.index)!==117&&this.throwUnexpectedToken(),++this.index,this.source[this.index]==="{"?(++this.index,d=this.scanUnicodeCodePointEscape()):(d=this.scanHexEscape("u"),(d===null||d==="\\"||!n.Character.isIdentifierStart(d.charCodeAt(0)))&&this.throwUnexpectedToken()),g=d);!this.eof()&&(h=this.codePointAt(this.index),!!n.Character.isIdentifierPart(h));)d=n.Character.fromCodePoint(h),g+=d,this.index+=d.length,h===92&&(g=g.substr(0,g.length-1),this.source.charCodeAt(this.index)!==117&&this.throwUnexpectedToken(),++this.index,this.source[this.index]==="{"?(++this.index,d=this.scanUnicodeCodePointEscape()):(d=this.scanHexEscape("u"),(d===null||d==="\\"||!n.Character.isIdentifierPart(d.charCodeAt(0)))&&this.throwUnexpectedToken()),g+=d);return g},m.prototype.octalToDecimal=function(h){var g=h!=="0",d=f(h);return!this.eof()&&n.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(g=!0,d=d*8+f(this.source[this.index++]),"0123".indexOf(h)>=0&&!this.eof()&&n.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(d=d*8+f(this.source[this.index++]))),{code:d,octal:g}},m.prototype.scanIdentifier=function(){var h,g=this.index,d=this.source.charCodeAt(g)===92?this.getComplexIdentifier():this.getIdentifier();if(d.length===1?h=3:this.isKeyword(d)?h=4:d==="null"?h=5:d==="true"||d==="false"?h=1:h=3,h!==3&&g+d.length!==this.index){var s=this.index;this.index=g,this.tolerateUnexpectedToken(l.Messages.InvalidEscapedReservedWord),this.index=s}return{type:h,value:d,lineNumber:this.lineNumber,lineStart:this.lineStart,start:g,end:this.index}},m.prototype.scanPunctuator=function(){var h=this.index,g=this.source[this.index];switch(g){case"(":case"{":g==="{"&&this.curlyStack.push("{"),++this.index;break;case".":++this.index,this.source[this.index]==="."&&this.source[this.index+1]==="."&&(this.index+=2,g="...");break;case"}":++this.index,this.curlyStack.pop();break;case")":case";":case",":case"[":case"]":case":":case"?":case"~":++this.index;break;default:g=this.source.substr(this.index,4),g===">>>="?this.index+=4:(g=g.substr(0,3),g==="==="||g==="!=="||g===">>>"||g==="<<="||g===">>="||g==="**="?this.index+=3:(g=g.substr(0,2),g==="&&"||g==="||"||g==="=="||g==="!="||g==="+="||g==="-="||g==="*="||g==="/="||g==="++"||g==="--"||g==="<<"||g===">>"||g==="&="||g==="|="||g==="^="||g==="%="||g==="<="||g===">="||g==="=>"||g==="**"?this.index+=2:(g=this.source[this.index],"<>=!+-*%&|^/".indexOf(g)>=0&&++this.index)))}return this.index===h&&this.throwUnexpectedToken(),{type:7,value:g,lineNumber:this.lineNumber,lineStart:this.lineStart,start:h,end:this.index}},m.prototype.scanHexLiteral=function(h){for(var g="";!this.eof()&&n.Character.isHexDigit(this.source.charCodeAt(this.index));)g+=this.source[this.index++];return g.length===0&&this.throwUnexpectedToken(),n.Character.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:6,value:parseInt("0x"+g,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:h,end:this.index}},m.prototype.scanBinaryLiteral=function(h){for(var g="",d;!this.eof()&&(d=this.source[this.index],!(d!=="0"&&d!=="1"));)g+=this.source[this.index++];return g.length===0&&this.throwUnexpectedToken(),this.eof()||(d=this.source.charCodeAt(this.index),(n.Character.isIdentifierStart(d)||n.Character.isDecimalDigit(d))&&this.throwUnexpectedToken()),{type:6,value:parseInt(g,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:h,end:this.index}},m.prototype.scanOctalLiteral=function(h,g){var d="",s=!1;for(n.Character.isOctalDigit(h.charCodeAt(0))?(s=!0,d="0"+this.source[this.index++]):++this.index;!this.eof()&&n.Character.isOctalDigit(this.source.charCodeAt(this.index));)d+=this.source[this.index++];return!s&&d.length===0&&this.throwUnexpectedToken(),(n.Character.isIdentifierStart(this.source.charCodeAt(this.index))||n.Character.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:6,value:parseInt(d,8),octal:s,lineNumber:this.lineNumber,lineStart:this.lineStart,start:g,end:this.index}},m.prototype.isImplicitOctalLiteral=function(){for(var h=this.index+1;h<this.length;++h){var g=this.source[h];if(g==="8"||g==="9")return!1;if(!n.Character.isOctalDigit(g.charCodeAt(0)))return!0}return!0},m.prototype.scanNumericLiteral=function(){var h=this.index,g=this.source[h];i.assert(n.Character.isDecimalDigit(g.charCodeAt(0))||g===".","Numeric literal must start with a decimal digit or a decimal point");var d="";if(g!=="."){if(d=this.source[this.index++],g=this.source[this.index],d==="0"){if(g==="x"||g==="X")return++this.index,this.scanHexLiteral(h);if(g==="b"||g==="B")return++this.index,this.scanBinaryLiteral(h);if(g==="o"||g==="O")return this.scanOctalLiteral(g,h);if(g&&n.Character.isOctalDigit(g.charCodeAt(0))&&this.isImplicitOctalLiteral())return this.scanOctalLiteral(g,h)}for(;n.Character.isDecimalDigit(this.source.charCodeAt(this.index));)d+=this.source[this.index++];g=this.source[this.index]}if(g==="."){for(d+=this.source[this.index++];n.Character.isDecimalDigit(this.source.charCodeAt(this.index));)d+=this.source[this.index++];g=this.source[this.index]}if(g==="e"||g==="E")if(d+=this.source[this.index++],g=this.source[this.index],(g==="+"||g==="-")&&(d+=this.source[this.index++]),n.Character.isDecimalDigit(this.source.charCodeAt(this.index)))for(;n.Character.isDecimalDigit(this.source.charCodeAt(this.index));)d+=this.source[this.index++];else this.throwUnexpectedToken();return n.Character.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:6,value:parseFloat(d),lineNumber:this.lineNumber,lineStart:this.lineStart,start:h,end:this.index}},m.prototype.scanStringLiteral=function(){var h=this.index,g=this.source[h];i.assert(g==="'"||g==='"',"String literal must starts with a quote"),++this.index;for(var d=!1,s="";!this.eof();){var o=this.source[this.index++];if(o===g){g="";break}else if(o==="\\")if(o=this.source[this.index++],!o||!n.Character.isLineTerminator(o.charCodeAt(0)))switch(o){case"u":if(this.source[this.index]==="{")++this.index,s+=this.scanUnicodeCodePointEscape();else{var u=this.scanHexEscape(o);u===null&&this.throwUnexpectedToken(),s+=u}break;case"x":var c=this.scanHexEscape(o);c===null&&this.throwUnexpectedToken(l.Messages.InvalidHexEscapeSequence),s+=c;break;case"n":s+=`
|
|
@@ -40,7 +40,7 @@ Please fix the configuration file(s) and try again.`)}let mr=[...n?[n]:[],...D.m
|
|
|
40
40
|
`,e-1);return{line:r===-1?0:t.slice(0,r+1).match(/\n/g).length,column:e-r-1}}function Pi(t,e,{oneBased:r=!1}={}){if(typeof t!="string")throw new TypeError("Text parameter should be a string");if(!Number.isInteger(e))throw new TypeError("Index parameter should be an integer");if(e<0||e>t.length)throw new RangeError("Index out of bounds");let i=Qd(t,e);return r?{line:i.line+1,column:i.column+1}:i}var Zd=t=>`\\u{${t.codePointAt(0).toString(16)}}`,Mi=class t extends Error{name="JSONError";fileName;#i;#s;#t;#f;#A;constructor(e){if(typeof e=="string")super(),this.#t=e;else{let{jsonParseError:r,fileName:i,input:n}=e;super(void 0,{cause:r}),this.#i=n,this.#s=r,this.fileName=i}Error.captureStackTrace?.(this,t)}get message(){this.#t??=`${th(this.#s.message)}${this.#i===""?" while parsing empty string":""}`;let{codeFrame:e}=this;return`${this.#t}${this.fileName?` in ${this.fileName}`:""}${e?`
|
|
41
41
|
|
|
42
42
|
${e}
|
|
43
|
-
`:""}`}set message(e){this.#t=e}#w(e){if(!this.#s)return;let r=this.#i,i=eh(r,this.#s.message);if(i)return(0,aa.codeFrameColumns)(r,{start:i},{highlightCode:e})}get codeFrame(){return this.#f??=this.#w(!0),this.#f}get rawCodeFrame(){return this.#A??=this.#w(!1),this.#A}},eh=(t,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:i,line:n,column:l}=r.groups;return n&&l?{line:Number(n),column:Number(l)}:Pi(t,Number(i),{oneBased:!0})},th=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,i)=>`"${i}"(${Zd(i)})`);function Ni(t,e,r){typeof e=="string"&&(r=e,e=void 0);try{return JSON.parse(t,e)}catch(i){throw new Mi({jsonParseError:i,fileName:r,input:t})}}var Eu=He(vu(),1);b();import{fileURLToPath as wf}from"node:url";function Du(t){return t instanceof URL?wf(t):t}var Ff=t=>Tf.resolve(Du(t)??".","package.json"),If=(t,e)=>{let r=typeof t=="string"?Ni(t):t;return e&&(0,Eu.default)(r),r};async function Cu({cwd:t,normalize:e=!0}={}){let r=await kf.readFile(Ff(t),"utf8");return If(r,e)}async function Au(t){let e=await Oo("package.json",t);if(e)return{packageJson:await Cu({...t,cwd:Rf.dirname(e)}),path:e}}import{fileURLToPath as Lf}from"node:url";import Pf from"node:path";var Mf=Lf(import.meta.url),Nf=Pf.dirname(Mf),hr;async function wu(){if(hr)return hr;let t=await Au({cwd:Nf});if(t)return hr=t.packageJson,hr}async function ku(){let t=await wu();return"0.19.
|
|
43
|
+
`:""}`}set message(e){this.#t=e}#w(e){if(!this.#s)return;let r=this.#i,i=eh(r,this.#s.message);if(i)return(0,aa.codeFrameColumns)(r,{start:i},{highlightCode:e})}get codeFrame(){return this.#f??=this.#w(!0),this.#f}get rawCodeFrame(){return this.#A??=this.#w(!1),this.#A}},eh=(t,e)=>{let r=e.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);if(!r)return;let{index:i,line:n,column:l}=r.groups;return n&&l?{line:Number(n),column:Number(l)}:Pi(t,Number(i),{oneBased:!0})},th=t=>t.replace(/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,(e,r,i)=>`"${i}"(${Zd(i)})`);function Ni(t,e,r){typeof e=="string"&&(r=e,e=void 0);try{return JSON.parse(t,e)}catch(i){throw new Mi({jsonParseError:i,fileName:r,input:t})}}var Eu=He(vu(),1);b();import{fileURLToPath as wf}from"node:url";function Du(t){return t instanceof URL?wf(t):t}var Ff=t=>Tf.resolve(Du(t)??".","package.json"),If=(t,e)=>{let r=typeof t=="string"?Ni(t):t;return e&&(0,Eu.default)(r),r};async function Cu({cwd:t,normalize:e=!0}={}){let r=await kf.readFile(Ff(t),"utf8");return If(r,e)}async function Au(t){let e=await Oo("package.json",t);if(e)return{packageJson:await Cu({...t,cwd:Rf.dirname(e)}),path:e}}import{fileURLToPath as Lf}from"node:url";import Pf from"node:path";var Mf=Lf(import.meta.url),Nf=Pf.dirname(Mf),hr;async function wu(){if(hr)return hr;let t=await Au({cwd:Nf});if(t)return hr=t.packageJson,hr}async function ku(){let t=await wu();return"0.19.9"}b();function Uy(t,e){let r=e??Yn(t),i=t.forScope(r),n=null,l=null;return{getValue(a){return Ee(t.merged,a)},setValue(a,f){for(let p of a.split("."))if(p==="__proto__"||p==="constructor"||p==="prototype")throw new Error(`Refusing to write settings key with reserved segment: ${a}`);t.setValue(r,a,f)},getModelProviders(){return t.merged.modelProviders??{}},persist(){},backup(){as(i.path),n=structuredClone(i.settings),l=structuredClone(i.originalSettings)},restore(){us(i.path)||console.error(`[loadedSettingsAdapter] On-disk rollback of ${i.path} failed; in-memory state was restored but the file may be inconsistent. Re-run /auth or inspect the file directly to recover.`),n!==null&&(i.settings=n),l!==null&&(i.originalSettings=l),t.recomputeMerged()},cleanupBackup(){ls(i.path),n=null,l=null}}}b();var Tu=t=>{let e=t/1073741824;return t<1048576?`${(t/1024).toFixed(1)} KB`:t<1073741824?`${(t/1048576).toFixed(1)} MB`:`${e.toFixed(2)} GB`},$y=t=>{let r=Date.now()-t,i=Math.floor(r/1e3),n=Math.floor(i/60),l=Math.floor(n/60),a=Math.floor(l/24),f=Math.floor(a/7),p=Math.floor(a/30);return p>0?p===1?"1 month ago":`${p} months ago`:f>0?f===1?"1 week ago":`${f} weeks ago`:a>0?a===1?"1 day ago":`${a} days ago`:l>0?l===1?"1 hour ago":`${l} hours ago`:n>0?n===1?"1 minute ago":`${n} minutes ago`:"just now"},qy=t=>t<1e3?`${t}`:t<1e4?`${(t/1e3).toFixed(1)}k`:`${Math.floor(t/1e3)}k`,Hy=(t,e)=>{if(t<=0)return"0s";if(t<1e3)return`${Math.round(t)}ms`;let r=t/1e3;if(r<60){let f=r.toFixed(1);return e?.hideTrailingZeros&&f.endsWith(".0")?`${f.slice(0,-2)}s`:`${f}s`}let i=Math.floor(r/3600),n=Math.floor(r%3600/60),l=Math.floor(r%60),a=[];return i>0&&a.push(`${i}h`),n>0&&a.push(`${n}m`),l>0&&a.push(`${l}s`),a.length===0?i>0?`${i}h`:n>0?`${n}m`:`${l}s`:a.join(" ")};b();var Xy="craft/drainMidTurnQueue";b();import rt from"node:process";import Of from"node:os";import{execFile as Bf}from"node:child_process";b();var fr="9d5261d0d";var Fu=be("STATUS"),_f=5e3;function Iu(t){return new Promise(e=>{Bf(t,["--version"],{timeout:_f,encoding:"utf-8"},(r,i)=>{if(r){e("unknown");return}e(typeof i=="string"?i.trim():"unknown")})})}async function Uf(){return Iu("npm")}async function oS(){return Iu("git")}async function jf(t){if(!t.services.config?.getIdeMode())return"";try{return(await cn.getInstance())?.getDetectedIdeDisplayName()??""}catch{return""}}function Ru(t=!1){let e=rt.env.SANDBOX;return!e||e==="sandbox-exec"?e==="sandbox-exec"?`sandbox-exec (${rt.env.SEATBELT_PROFILE||"unknown"})`:"no sandbox":t?e.replace(/^matilda-(?:code-)?/,""):e}async function Gf(t){let e=rt.platform,r=rt.arch,i=Of.release(),n=rt.version,l=await Uf(),a=Ru(),f=t.services.config?.getModelDisplayName()||"Unknown",p=await ku(),m=t.services.config?.getAuthType()||"",h=await jf(t),g=t.services.config?.getSessionId()||"unknown",d=t.services.config?.getProxy();return{cliVersion:p,osPlatform:e,osArch:r,osRelease:i,nodeVersion:n,npmVersion:l,sandboxEnv:a,modelVersion:f,selectedAuthType:m,ideClient:h,sessionId:g,proxy:d}}async function aS(t){let e=await Gf(t),r=Tu(rt.memoryUsage().rss),i=Ru(!0),n=e.selectedAuthType==="openai"||e.selectedAuthType==="anthropic"?t.services.config?.getContentGeneratorConfig():void 0,l=n?.baseUrl,a=n?.apiKeyEnvKey,f=fr&&!["N/A"].includes(fr)?fr:void 0,p=t.services.settings?.merged?.fastModel||void 0,m=$f(t);return{...e,sandboxEnv:i,memoryUsage:r,baseUrl:l,apiKeyEnvKey:a,gitCommit:f,fastModel:p,lspStatus:m}}function $f(t){try{let e=t.services.config?.getLspStatusSnapshot?.();return e?(t.services.config?.getDebugMode?.()&&Fu.debug("LSP status snapshot for /status:",e),qf(e)):void 0}catch(e){t.services.config?.getDebugMode?.()&&Fu.debug("Unable to read LSP status snapshot for /status:",e);return}}function qf(t){if(!t.enabled)return"disabled";if(t.initializationError)return`enabled, initialization failed: ${t.initializationError}`;if(t.statusUnavailable)return"enabled, status unavailable";if(t.configuredServers===0)return"enabled, no servers configured";let e=[t.failedServers>0?`${t.failedServers} failed`:"",t.inProgressServers>0?`${t.inProgressServers} starting`:"",t.notStartedServers>0?`${t.notStartedServers} not started`:""].filter(Boolean),r=e.length>0?` (${e.join(", ")})`:"";return`enabled, ${t.readyServers}/${t.configuredServers} ready${r}`}export{Ir as a,Lp as b,Pp as c,G as d,N as e,Bp as f,Ne as g,_p as h,Up as i,Lr as j,Pr as k,Il as l,Ll as m,Nr as n,Yn as o,nm as p,hl as q,kr as r,Hn as s,Tr as t,Sl as u,Ap as v,wp as w,ns as x,Ol as y,Br as z,ze as A,Ee as B,ts as C,hm as D,ct as E,fm as F,pm as G,mm as H,gm as I,ym as J,Sm as K,Og as L,Bg as M,Ei as N,Ci as O,Qn as P,_g as Q,Ug as R,vd as S,Ed as T,jg as U,Cd as V,Gg as W,Oi as X,Bi as Y,da as Z,fa as _,ya as $,xa as aa,$i as ba,Ca as ca,wa as da,wu as ea,ku as fa,Uy as ga,Hf as ha,vr as ia,yn as ja,Yf as ka,Er as la,tp as ma,rp as na,xn as oa,vn as pa,Dn as qa,En as ra,Cn as sa,An as ta,wn as ua,kn as va,Tn as wa,Fn as xa,In as ya,Rn as za,Ln as Aa,Pn as Ba,Mn as Ca,Nn as Da,On as Ea,Bn as Fa,_n as Ga,Un as Ha,jn as Ia,Gn as Ja,$n as Ka,Me as La,op as Ma,Cr as Na,Ar as Oa,wr as Pa,ap as Qa,up as Ra,sl as Sa,lp as Ta,cp as Ua,dp as Va,hp as Wa,fp as Xa,pp as Ya,mp as Za,ol as _a,gp as $a,yp as ab,Xy as bb,Tu as cb,$y as db,qy as eb,Hy as fb,Uf as gb,oS as hb,aS as ib};
|
|
44
44
|
/**
|
|
45
45
|
* @license
|
|
46
46
|
* Copyright 2025 Matilda Team
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{l as k}from"./chunk-
|
|
3
|
+
import{l as k}from"./chunk-2GMJHSBF.js";import{bb as It,hb as St}from"./chunk-H5PGSQP2.js";import{c as Tt}from"./chunk-MNGFXISD.js";import{h as Ct}from"./chunk-XYA3SFGC.js";import{Cc as ht,h as nt}from"./chunk-CFBZKYFB.js";import{p as st}from"./chunk-5U3A6KMU.js";import{b as C}from"./chunk-GZPNIYVZ.js";import{d as gt,f as Bt}from"./chunk-OWGSC52X.js";var Mt=gt(i=>{"use strict";C();var at=Symbol.for("react.transitional.element"),$t=Symbol.for("react.portal"),Gt=Symbol.for("react.fragment"),jt=Symbol.for("react.strict_mode"),Wt=Symbol.for("react.profiler"),qt=Symbol.for("react.consumer"),Ft=Symbol.for("react.context"),Yt=Symbol.for("react.forward_ref"),Kt=Symbol.for("react.suspense"),Jt=Symbol.for("react.memo"),kt=Symbol.for("react.lazy"),zt=Symbol.for("react.activity"),xt=Symbol.iterator;function Qt(t){return t===null||typeof t!="object"?null:(t=xt&&t[xt]||t["@@iterator"],typeof t=="function"?t:null)}var Rt={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},vt=Object.assign,Et={};function v(t,e,s){this.props=t,this.context=e,this.refs=Et,this.updater=s||Rt}v.prototype.isReactComponent={};v.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};v.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function At(){}At.prototype=v.prototype;function ut(t,e,s){this.props=t,this.context=e,this.refs=Et,this.updater=s||Rt}var mt=ut.prototype=new At;mt.constructor=ut;vt(mt,v.prototype);mt.isPureReactComponent=!0;var bt=Array.isArray;function it(){}var p={H:null,A:null,T:null,S:null},wt=Object.prototype.hasOwnProperty;function lt(t,e,s){var o=s.ref;return{$$typeof:at,type:t,key:e,ref:o!==void 0?o:null,props:s}}function Vt(t,e){return lt(t.type,e,t.props)}function pt(t){return typeof t=="object"&&t!==null&&t.$$typeof===at}function Xt(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(s){return e[s]})}var _t=/\/+/g;function rt(t,e){return typeof t=="object"&&t!==null&&t.key!=null?Xt(""+t.key):e.toString(36)}function Zt(t){switch(t.status){case"fulfilled":return t.value;case"rejected":throw t.reason;default:switch(typeof t.status=="string"?t.then(it,it):(t.status="pending",t.then(function(e){t.status==="pending"&&(t.status="fulfilled",t.value=e)},function(e){t.status==="pending"&&(t.status="rejected",t.reason=e)})),t.status){case"fulfilled":return t.value;case"rejected":throw t.reason}}throw t}function R(t,e,s,o,n){var a=typeof t;(a==="undefined"||a==="boolean")&&(t=null);var m=!1;if(t===null)m=!0;else switch(a){case"bigint":case"string":case"number":m=!0;break;case"object":switch(t.$$typeof){case at:case $t:m=!0;break;case kt:return m=t._init,R(m(t._payload),e,s,o,n)}}if(m)return n=n(t),m=o===""?"."+rt(t,0):o,bt(n)?(s="",m!=null&&(s=m.replace(_t,"$&/")+"/"),R(n,e,s,"",function(g){return g})):n!=null&&(pt(n)&&(n=Vt(n,s+(n.key==null||t&&t.key===n.key?"":(""+n.key).replace(_t,"$&/")+"/")+m)),e.push(n)),1;m=0;var d=o===""?".":o+":";if(bt(t))for(var c=0;c<t.length;c++)o=t[c],a=d+rt(o,c),m+=R(o,e,s,a,n);else if(c=Qt(t),typeof c=="function")for(t=c.call(t),c=0;!(o=t.next()).done;)o=o.value,a=d+rt(o,c++),m+=R(o,e,s,a,n);else if(a==="object"){if(typeof t.then=="function")return R(Zt(t),e,s,o,n);throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.")}return m}function B(t,e,s){if(t==null)return t;var o=[],n=0;return R(t,o,"","",function(a){return e.call(s,a,n++)}),o}function te(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(s){(t._status===0||t._status===-1)&&(t._status=1,t._result=s)},function(s){(t._status===0||t._status===-1)&&(t._status=2,t._result=s)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var Ht=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},ee={map:B,forEach:function(t,e,s){B(t,function(){e.apply(this,arguments)},s)},count:function(t){var e=0;return B(t,function(){e++}),e},toArray:function(t){return B(t,function(e){return e})||[]},only:function(t){if(!pt(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};i.Activity=zt;i.Children=ee;i.Component=v;i.Fragment=Gt;i.Profiler=Wt;i.PureComponent=ut;i.StrictMode=jt;i.Suspense=Kt;i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=p;i.__COMPILER_RUNTIME={__proto__:null,c:function(t){return p.H.useMemoCache(t)}};i.cache=function(t){return function(){return t.apply(null,arguments)}};i.cacheSignal=function(){return null};i.cloneElement=function(t,e,s){if(t==null)throw Error("The argument must be a React element, but you passed "+t+".");var o=vt({},t.props),n=t.key;if(e!=null)for(a in e.key!==void 0&&(n=""+e.key),e)!wt.call(e,a)||a==="key"||a==="__self"||a==="__source"||a==="ref"&&e.ref===void 0||(o[a]=e[a]);var a=arguments.length-2;if(a===1)o.children=s;else if(1<a){for(var m=Array(a),d=0;d<a;d++)m[d]=arguments[d+2];o.children=m}return lt(t.type,n,o)};i.createContext=function(t){return t={$$typeof:Ft,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null},t.Provider=t,t.Consumer={$$typeof:qt,_context:t},t};i.createElement=function(t,e,s){var o,n={},a=null;if(e!=null)for(o in e.key!==void 0&&(a=""+e.key),e)wt.call(e,o)&&o!=="key"&&o!=="__self"&&o!=="__source"&&(n[o]=e[o]);var m=arguments.length-2;if(m===1)n.children=s;else if(1<m){for(var d=Array(m),c=0;c<m;c++)d[c]=arguments[c+2];n.children=d}if(t&&t.defaultProps)for(o in m=t.defaultProps,m)n[o]===void 0&&(n[o]=m[o]);return lt(t,a,n)};i.createRef=function(){return{current:null}};i.forwardRef=function(t){return{$$typeof:Yt,render:t}};i.isValidElement=pt;i.lazy=function(t){return{$$typeof:kt,_payload:{_status:-1,_result:t},_init:te}};i.memo=function(t,e){return{$$typeof:Jt,type:t,compare:e===void 0?null:e}};i.startTransition=function(t){var e=p.T,s={};p.T=s;try{var o=t(),n=p.S;n!==null&&n(s,o),typeof o=="object"&&o!==null&&typeof o.then=="function"&&o.then(it,Ht)}catch(a){Ht(a)}finally{e!==null&&s.types!==null&&(e.types=s.types),p.T=e}};i.unstable_useCacheRefresh=function(){return p.H.useCacheRefresh()};i.use=function(t){return p.H.use(t)};i.useActionState=function(t,e,s){return p.H.useActionState(t,e,s)};i.useCallback=function(t,e){return p.H.useCallback(t,e)};i.useContext=function(t){return p.H.useContext(t)};i.useDebugValue=function(){};i.useDeferredValue=function(t,e){return p.H.useDeferredValue(t,e)};i.useEffect=function(t,e){return p.H.useEffect(t,e)};i.useEffectEvent=function(t){return p.H.useEffectEvent(t)};i.useId=function(){return p.H.useId()};i.useImperativeHandle=function(t,e,s){return p.H.useImperativeHandle(t,e,s)};i.useInsertionEffect=function(t,e){return p.H.useInsertionEffect(t,e)};i.useLayoutEffect=function(t,e){return p.H.useLayoutEffect(t,e)};i.useMemo=function(t,e){return p.H.useMemo(t,e)};i.useOptimistic=function(t,e){return p.H.useOptimistic(t,e)};i.useReducer=function(t,e,s){return p.H.useReducer(t,e,s)};i.useRef=function(t){return p.H.useRef(t)};i.useState=function(t){return p.H.useState(t)};i.useSyncExternalStore=function(t,e,s){return p.H.useSyncExternalStore(t,e,s)};i.useTransition=function(){return p.H.useTransition()};i.version="19.2.4"});var Dt=gt((de,Pt)=>{"use strict";C();Pt.exports=Mt()});C();C();C();var fe=Bt(Dt(),1);var oe=["achieved","aborted","failed"];function ge(t){return oe.includes(t)}function ne(t,e){return t>=e.hard?"hard":t>=e.auto?"auto":t>=e.warn?"warn":"safe"}function T(t){if(!t||t.length===0)return 0;let e=0,s=0;for(let o=0;o<t.length;o++)t.charCodeAt(o)<128?e++:s++;return Math.ceil(e/4+s*1.5)}function se(t){if(!t||t.trim().length===0)return[];let e=[],s=/--- Context from: (.+?) ---\n([\s\S]*?)--- End of Context from: \1 ---/g,o;for(;(o=s.exec(t))!==null;){let n=o[1],a=o[2];e.push({path:n,tokens:T(a)})}return e.length===0&&t.trim().length>0&&e.push({path:k("memory"),tokens:T(t)}),e}async function re(t,e){let s=t.getModelDisplayName()||"unknown",o=t.getContentGeneratorConfig(),n=o.contextWindowSize??131072,a=nt.getLastPromptTokenCount(),m=nt.getLastCachedContentTokenCount(),d=It(void 0,s),c=T(d),g=t.getToolRegistry(),M=g?g.getAllTools():[],r=g?g.getFunctionDeclarations():[],P=JSON.stringify(r),_=T(P),H=[],x=[];for(let u of M){if(u.shouldDefer&&!u.alwaysLoad&&!g?.isDeferredToolRevealed(u.name))continue;let h=JSON.stringify(u.schema),S=T(h);u instanceof ht?x.push({name:`${u.serverName}__${u.serverToolName||u.name}`,tokens:S}):u.name!==st.SKILL&&H.push({name:u.name,tokens:S})}let l=t.getUserMemory(),y=se(l),$=y.reduce((u,h)=>u+h.tokens,0),E=M.find(u=>u.name===st.SKILL),G=E?T(JSON.stringify(E.schema)):0,Nt=E&&"getLoadedSkillNames"in E?E.getLoadedSkillNames():new Set,dt=t.getSkillManager(),Ut=dt?await dt.listSkills():[],D=0,j=Ut.map(u=>{let h=T(`<skill>
|
|
4
4
|
<name>
|
|
5
5
|
${u.name}
|
|
6
6
|
</name>
|