@comate/zulu 0.2.0 → 0.2.1-beta.2
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/comate-engine/node_modules/@comate/plugin-host/dist/index.js +1 -1
- package/comate-engine/node_modules/@comate/plugin-host/dist/main.js +1 -1
- package/comate-engine/node_modules/@comate/plugin-host/dist/{user-CGfO2VEw.js → user-Buhpnssj.js} +5 -5
- package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.d.ts +8 -2
- package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.js +8 -8
- package/comate-engine/node_modules/better-sqlite3/build/Release/better_sqlite3.node +0 -0
- package/comate-engine/node_modules/better-sqlite3/node_modules/.bin/prebuild-install +2 -2
- package/comate-engine/plugins/bpm/dist/index.js +5 -5
- package/comate-engine/server.js +122 -62
- package/dist/bundle/index.js +2 -2
- package/package.json +1 -1
package/dist/bundle/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{randomUUID as e}from"node:crypto";import t,{existsSync as n}from"node:fs";import i,{dirname as r,join as o}from"node:path";import{unlink as s,readFile as a,writeFile as c,mkdir as l}from"node:fs/promises";import u from"fs";import p from"path";import{EventEmitter as d}from"node:events";import{spawn as f,execSync as m,fork as h}from"node:child_process";import g from"constants";import v,{Readable as x}from"stream";import b from"util";import y from"assert";import _ from"os";import w from"http";import E from"https";import S,{URL as k}from"url";import R from"crypto";import T from"tty";import O from"zlib";import C,{EventEmitter as A}from"events";import P,{homedir as j}from"node:os";import"node:process";import{fileURLToPath as L}from"node:url";import"node:stream";import N from"net";const I=0,$=1,D=2,M="",F="\0",z=-1,B=/^(-h|--help)(?:=([0-9]+))?$/,q=/^(--[a-z]+(?:-[a-z]+)*|-[a-zA-Z]+)$/,U=/^-[a-zA-Z]{2,}$/,H=/^([^=]+)=([\s\S]*)$/,W="1"===process.env.DEBUG_CLI;class G extends Error{constructor(e){super(e),this.clipanion={type:"usage"},this.name="UsageError"}}class V extends Error{constructor(e,t){if(super(),this.input=e,this.candidates=t,this.clipanion={type:"none"},this.name="UnknownSyntaxError",0===this.candidates.length)this.message="Command not found, but we're not sure what's the alternative.";else if(this.candidates.every((e=>null!==e.reason&&e.reason===t[0].reason))){const[{reason:e}]=this.candidates;this.message=`${e}\n\n${this.candidates.map((({usage:e})=>`$ ${e}`)).join("\n")}`}else if(1===this.candidates.length){const[{usage:t}]=this.candidates;this.message=`Command not found; did you mean:\n\n$ ${t}\n${J(e)}`}else this.message=`Command not found; did you mean one of:\n\n${this.candidates.map((({usage:e},t)=>`${`${t}.`.padStart(4)} ${e}`)).join("\n")}\n\n${J(e)}`}}class K extends Error{constructor(e,t){super(),this.input=e,this.usages=t,this.clipanion={type:"none"},this.name="AmbiguousSyntaxError",this.message=`Cannot find which to pick amongst the following alternatives:\n\n${this.usages.map(((e,t)=>`${`${t}.`.padStart(4)} ${e}`)).join("\n")}\n\n${J(e)}`}}const J=e=>`While running ${e.filter((e=>e!==F)).map((e=>{const t=JSON.stringify(e);return e.match(/\s/)||0===e.length||t!==`"${e}"`?t:e})).join(" ")}`,Y=Array(80).fill("━");for(let e=0;e<=24;++e)Y[Y.length-e]=`[38;5;${232+e}m━`;const Z={header:e=>`[1m━━━ ${e}${e.length<75?` ${Y.slice(e.length+5).join("")}`:":"}[0m`,bold:e=>`[1m${e}[22m`,error:e=>`[31m[1m${e}[22m[39m`,code:e=>`[36m${e}[39m`},X={header:e=>e,bold:e=>e,error:e=>e,code:e=>e};function Q(e,{format:t,paragraphs:n}){return e=(e=(e=(e=function(e){const t=e.split("\n"),n=t.filter((e=>e.match(/\S/))),i=n.length>0?n.reduce(((e,t)=>Math.min(e,t.length-t.trimStart().length)),Number.MAX_VALUE):0;return t.map((e=>e.slice(i).trimRight())).join("\n")}(e=e.replace(/\r\n?/g,"\n"))).replace(/^\n+|\n+$/g,"")).replace(/^(\s*)-([^\n]*?)\n+/gm,"$1-$2\n\n")).replace(/\n(\n)?\n*/g,((e,t)=>t||" ")),n&&(e=e.split(/\n/).map((e=>{const t=e.match(/^\s*[*-][\t ]+(.*)/);if(!t)return e.match(/(.{1,80})(?: |$)/g).join("\n");const n=e.length-e.trimStart().length;return t[1].match(new RegExp(`(.{1,${78-n}})(?: |$)`,"g")).map(((e,t)=>" ".repeat(n)+(0===t?"- ":" ")+e)).join("\n")})).join("\n\n")),(e=(e=e.replace(/(`+)((?:.|[\n])*?)\1/g,((e,n,i)=>t.code(n+i+n)))).replace(/(\*\*)((?:.|[\n])*?)\1/g,((e,n,i)=>t.bold(n+i+n))))?`${e}\n`:""}const ee=Symbol("clipanion/isOption");function te(e){return{...e,[ee]:!0}}function ne(e,t){return void 0===e||"object"!=typeof e||null===e||Array.isArray(e)?[e,t]:[void 0,e]}function ie(e,{mergeName:t=!1}={}){const n=e.match(/^([^:]+): (.*)$/m);if(!n)return"validation failed";let[,i,r]=n;return t&&(r=r[0].toLowerCase()+r.slice(1)),r="."===i&&t?`: ${r}`:`${i.replace(/^\.(\[|$)/,"$1")}: ${r}`,r}function re(e,t){return 1===t.length?new G(`${e}${ie(t[0],{mergeName:!0})}`):new G(`${e}:\n${t.map((e=>`\n- ${ie(e)}`)).join("")}`)}function oe(e,t,n){if(void 0===n)return t;const i=[],r=[],o=e=>{const n=t;return t=e,o.bind(null,n)};if(!n(t,{errors:i,coercions:r,coercion:o}))throw re(`Invalid value for ${e}`,i);for(const[,e]of r)e();return t}class se{constructor(){this.help=!1}static Usage(e){return e}async catch(e){throw e}async validateAndExecute(){const e=this.constructor.schema;if(Array.isArray(e)){const{isDict:t,isUnknown:n,applyCascade:i}=await Promise.resolve().then((function(){return tw})),r=[],o=[];if(!i(t(n()),e)(this,{errors:r,coercions:o}))throw re("Invalid option schema",r);for(const[,e]of o)e()}else if(null!=e)throw new Error("Invalid command schema");const t=await this.execute();return void 0!==t?t:0}}function ae(e){W&&console.log(e)}se.isOption=ee,se.Default=[];const ce={candidateUsage:null,requiredOptions:[],errorMessage:null,ignoreOptions:!1,path:[],positionals:[],options:[],remainder:null,selectedIndex:z};function le(e,t){return e.nodes.push(t),e.nodes.length-1}function ue(e,t,n=!1){ae(`Running a vm on ${JSON.stringify(t)}`);let i=[{node:I,state:{candidateUsage:null,requiredOptions:[],errorMessage:null,ignoreOptions:!1,options:[],path:[],positionals:[],remainder:null,selectedIndex:null}}];!function(e,{prefix:t=""}={}){if(W){ae(`${t}Nodes are:`);for(let n=0;n<e.nodes.length;++n)ae(`${t} ${n}: ${JSON.stringify(e.nodes[n])}`)}}(e,{prefix:" "});const r=[M,...t];for(let o=0;o<r.length;++o){const s=r[o];ae(` Processing ${JSON.stringify(s)}`);const a=[];for(const{node:t,state:c}of i){ae(` Current node is ${t}`);const i=e.nodes[t];if(t===D){a.push({node:t,state:c});continue}console.assert(0===i.shortcuts.length,"Shortcuts should have been eliminated by now");const l=Object.prototype.hasOwnProperty.call(i.statics,s);if(!n||o<r.length-1||l)if(l){const e=i.statics[s];for(const{to:t,reducer:n}of e)a.push({node:t,state:void 0!==n?_e(Se,n,c,s):c}),ae(` Static transition to ${t} found`)}else ae(" No static transition found");else{let e=!1;for(const t of Object.keys(i.statics))if(t.startsWith(s)){if(s===t)for(const{to:e,reducer:n}of i.statics[t])a.push({node:e,state:void 0!==n?_e(Se,n,c,s):c}),ae(` Static transition to ${e} found`);else for(const{to:e}of i.statics[t])a.push({node:e,state:{...c,remainder:t.slice(s.length)}}),ae(` Static transition to ${e} found (partial match)`);e=!0}e||ae(" No partial static transition found")}if(s!==F)for(const[e,{to:t,reducer:n}]of i.dynamics)_e(Ee,e,c,s)&&(a.push({node:t,state:void 0!==n?_e(Se,n,c,s):c}),ae(` Dynamic transition to ${t} found (via ${e})`))}if(0===a.length&&s===F&&1===t.length)return[{node:I,state:ce}];if(0===a.length)throw new V(t,i.filter((({node:e})=>e!==D)).map((({state:e})=>({usage:e.candidateUsage,reason:null}))));if(a.every((({node:e})=>e===D)))throw new V(t,a.map((({state:e})=>({usage:e.candidateUsage,reason:e.errorMessage}))));i=fe(a)}if(i.length>0){ae(" Results:");for(const e of i)ae(` - ${e.node} -> ${JSON.stringify(e.state)}`)}else ae(" No results");return i}function pe(e,t){if(null!==t.selectedIndex)return!0;if(Object.prototype.hasOwnProperty.call(e.statics,F))for(const{to:t}of e.statics[F])if(t===$)return!0;return!1}function de(e,t){return function(e,t){const n=t.filter((e=>null!==e.selectedIndex));if(0===n.length)throw new Error;const i=n.filter((e=>e.selectedIndex===z||e.requiredOptions.every((t=>t.some((t=>e.options.find((e=>e.name===t))))))));if(0===i.length)throw new V(e,n.map((e=>({usage:e.candidateUsage,reason:null}))));let r=0;for(const e of i)e.path.length>r&&(r=e.path.length);const o=i.filter((e=>e.path.length===r)),s=e=>e.positionals.filter((({extra:e})=>!e)).length+e.options.length,a=o.map((e=>({state:e,positionalCount:s(e)})));let c=0;for(const{positionalCount:e}of a)e>c&&(c=e);const l=a.filter((({positionalCount:e})=>e===c)).map((({state:e})=>e)),u=function(e){const t=[],n=[];for(const i of e)i.selectedIndex===z?n.push(i):t.push(i);n.length>0&&t.push({...ce,path:me(...n.map((e=>e.path))),options:n.reduce(((e,t)=>e.concat(t.options)),[])});return t}(l);if(u.length>1)throw new K(e,u.map((e=>e.candidateUsage)));return u[0]}(t,ue(e,[...t,F]).map((({state:e})=>e)))}function fe(e){let t=0;for(const{state:n}of e)n.path.length>t&&(t=n.path.length);return e.filter((({state:e})=>e.path.length===t))}function me(e,t,...n){return void 0===t?Array.from(e):me(e.filter(((e,n)=>e===t[n])),...n)}function he(e){return e===$||e===D}function ge(e,t=0){return{to:he(e.to)?e.to:e.to>2?e.to+t-2:e.to+t,reducer:e.reducer}}function ve(e,t=0){const n={dynamics:[],shortcuts:[],statics:{}};for(const[i,r]of e.dynamics)n.dynamics.push([i,ge(r,t)]);for(const i of e.shortcuts)n.shortcuts.push(ge(i,t));for(const[i,r]of Object.entries(e.statics))n.statics[i]=r.map((e=>ge(e,t)));return n}function xe(e,t,n,i,r){e.nodes[t].dynamics.push([n,{to:i,reducer:r}])}function be(e,t,n,i){e.nodes[t].shortcuts.push({to:n,reducer:i})}function ye(e,t,n,i,r){(Object.prototype.hasOwnProperty.call(e.nodes[t].statics,n)?e.nodes[t].statics[n]:e.nodes[t].statics[n]=[]).push({to:i,reducer:r})}function _e(e,t,n,i){if(Array.isArray(t)){const[r,...o]=t;return e[r](n,i,...o)}return e[t](n,i)}function we(e,t){const n=Array.isArray(e)?Ee[e[0]]:Ee[e];if(void 0===n.suggest)return null;const i=Array.isArray(e)?e.slice(1):[];return n.suggest(t,...i)}const Ee={always:()=>!0,isOptionLike:(e,t)=>!e.ignoreOptions&&"-"!==t&&t.startsWith("-"),isNotOptionLike:(e,t)=>e.ignoreOptions||"-"===t||!t.startsWith("-"),isOption:(e,t,n,i)=>!e.ignoreOptions&&t===n,isBatchOption:(e,t,n)=>!e.ignoreOptions&&U.test(t)&&[...t.slice(1)].every((e=>n.includes(`-${e}`))),isBoundOption:(e,t,n,i)=>{const r=t.match(H);return!e.ignoreOptions&&!!r&&q.test(r[1])&&n.includes(r[1])&&i.filter((e=>e.names.includes(r[1]))).every((e=>e.allowBinding))},isNegatedOption:(e,t,n)=>!e.ignoreOptions&&t===`--no-${n.slice(2)}`,isHelp:(e,t)=>!e.ignoreOptions&&B.test(t),isUnsupportedOption:(e,t,n)=>!e.ignoreOptions&&t.startsWith("-")&&q.test(t)&&!n.includes(t),isInvalidOption:(e,t)=>!e.ignoreOptions&&t.startsWith("-")&&!q.test(t)};Ee.isOption.suggest=(e,t,n=!0)=>n?null:[t];const Se={setCandidateState:(e,t,n)=>({...e,...n}),setSelectedIndex:(e,t,n)=>({...e,selectedIndex:n}),pushBatch:(e,t)=>({...e,options:e.options.concat([...t.slice(1)].map((e=>({name:`-${e}`,value:!0}))))}),pushBound:(e,t)=>{const[,n,i]=t.match(H);return{...e,options:e.options.concat({name:n,value:i})}},pushPath:(e,t)=>({...e,path:e.path.concat(t)}),pushPositional:(e,t)=>({...e,positionals:e.positionals.concat({value:t,extra:!1})}),pushExtra:(e,t)=>({...e,positionals:e.positionals.concat({value:t,extra:!0})}),pushExtraNoLimits:(e,t)=>({...e,positionals:e.positionals.concat({value:t,extra:ke})}),pushTrue:(e,t,n=t)=>({...e,options:e.options.concat({name:t,value:!0})}),pushFalse:(e,t,n=t)=>({...e,options:e.options.concat({name:n,value:!1})}),pushUndefined:(e,t)=>({...e,options:e.options.concat({name:t,value:void 0})}),pushStringValue:(e,t)=>{var n;const i={...e,options:[...e.options]},r=e.options[e.options.length-1];return r.value=(null!==(n=r.value)&&void 0!==n?n:[]).concat([t]),i},setStringValue:(e,t)=>{const n={...e,options:[...e.options]};return e.options[e.options.length-1].value=t,n},inhibateOptions:e=>({...e,ignoreOptions:!0}),useHelp:(e,t,n)=>{const[,,i]=t.match(B);return void 0!==i?{...e,options:[{name:"-c",value:String(n)},{name:"-i",value:i}]}:{...e,options:[{name:"-c",value:String(n)}]}},setError:(e,t,n)=>t===F?{...e,errorMessage:`${n}.`}:{...e,errorMessage:`${n} ("${t}").`},setOptionArityError:(e,t)=>{const n=e.options[e.options.length-1];return{...e,errorMessage:`Not enough arguments to option ${n.name}.`}}},ke=Symbol();class Re{constructor(e,t){this.allOptionNames=[],this.arity={leading:[],trailing:[],extra:[],proxy:!1},this.options=[],this.paths=[],this.cliIndex=e,this.cliOpts=t}addPath(e){this.paths.push(e)}setArity({leading:e=this.arity.leading,trailing:t=this.arity.trailing,extra:n=this.arity.extra,proxy:i=this.arity.proxy}){Object.assign(this.arity,{leading:e,trailing:t,extra:n,proxy:i})}addPositional({name:e="arg",required:t=!0}={}){if(!t&&this.arity.extra===ke)throw new Error("Optional parameters cannot be declared when using .rest() or .proxy()");if(!t&&this.arity.trailing.length>0)throw new Error("Optional parameters cannot be declared after the required trailing positional arguments");t||this.arity.extra===ke?this.arity.extra!==ke&&0===this.arity.extra.length?this.arity.leading.push(e):this.arity.trailing.push(e):this.arity.extra.push(e)}addRest({name:e="arg",required:t=0}={}){if(this.arity.extra===ke)throw new Error("Infinite lists cannot be declared multiple times in the same command");if(this.arity.trailing.length>0)throw new Error("Infinite lists cannot be declared after the required trailing positional arguments");for(let n=0;n<t;++n)this.addPositional({name:e});this.arity.extra=ke}addProxy({required:e=0}={}){this.addRest({required:e}),this.arity.proxy=!0}addOption({names:e,description:t,arity:n=0,hidden:i=!1,required:r=!1,allowBinding:o=!0}){if(!o&&n>1)throw new Error("The arity cannot be higher than 1 when the option only supports the --arg=value syntax");if(!Number.isInteger(n))throw new Error(`The arity must be an integer, got ${n}`);if(n<0)throw new Error(`The arity must be positive, got ${n}`);this.allOptionNames.push(...e),this.options.push({names:e,description:t,arity:n,hidden:i,required:r,allowBinding:o})}setContext(e){this.context=e}usage({detailed:e=!0,inlineOptions:t=!0}={}){const n=[this.cliOpts.binaryName],i=[];if(this.paths.length>0&&n.push(...this.paths[0]),e){for(const{names:e,arity:r,hidden:o,description:s,required:a}of this.options){if(o)continue;const c=[];for(let e=0;e<r;++e)c.push(` #${e}`);const l=`${e.join(",")}${c.join("")}`;!t&&s?i.push({definition:l,description:s,required:a}):n.push(a?`<${l}>`:`[${l}]`)}n.push(...this.arity.leading.map((e=>`<${e}>`))),this.arity.extra===ke?n.push("..."):n.push(...this.arity.extra.map((e=>`[${e}]`))),n.push(...this.arity.trailing.map((e=>`<${e}>`)))}return{usage:n.join(" "),options:i}}compile(){if(void 0===this.context)throw new Error("Assertion failed: No context attached");const e={nodes:[{dynamics:[],shortcuts:[],statics:{}},{dynamics:[],shortcuts:[],statics:{}},{dynamics:[],shortcuts:[],statics:{}}]};let t=I;const n=this.usage().usage,i=this.options.filter((e=>e.required)).map((e=>e.names));t=le(e,{dynamics:[],shortcuts:[],statics:{}}),ye(e,I,M,t,["setCandidateState",{candidateUsage:n,requiredOptions:i}]);const r=this.arity.proxy?"always":"isNotOptionLike",o=this.paths.length>0?this.paths:[[]];for(const n of o){let i=t;if(n.length>0){const t=le(e,{dynamics:[],shortcuts:[],statics:{}});be(e,i,t),this.registerOptions(e,t),i=t}for(let t=0;t<n.length;++t){const r=le(e,{dynamics:[],shortcuts:[],statics:{}});ye(e,i,n[t],r,"pushPath"),i=r}if(this.arity.leading.length>0||!this.arity.proxy){const t=le(e,{dynamics:[],shortcuts:[],statics:{}});xe(e,i,"isHelp",t,["useHelp",this.cliIndex]),xe(e,t,"always",t,"pushExtra"),ye(e,t,F,$,["setSelectedIndex",z]),this.registerOptions(e,i)}this.arity.leading.length>0&&ye(e,i,F,D,["setError","Not enough positional arguments"]);let o=i;for(let t=0;t<this.arity.leading.length;++t){const n=le(e,{dynamics:[],shortcuts:[],statics:{}});this.arity.proxy&&t+1===this.arity.leading.length||this.registerOptions(e,n),(this.arity.trailing.length>0||t+1!==this.arity.leading.length)&&ye(e,n,F,D,["setError","Not enough positional arguments"]),xe(e,o,"isNotOptionLike",n,"pushPositional"),o=n}let s=o;if(this.arity.extra===ke||this.arity.extra.length>0){const t=le(e,{dynamics:[],shortcuts:[],statics:{}});if(be(e,o,t),this.arity.extra===ke){const n=le(e,{dynamics:[],shortcuts:[],statics:{}});this.arity.proxy||this.registerOptions(e,n),xe(e,o,r,n,"pushExtraNoLimits"),xe(e,n,r,n,"pushExtraNoLimits"),be(e,n,t)}else for(let n=0;n<this.arity.extra.length;++n){const i=le(e,{dynamics:[],shortcuts:[],statics:{}});(!this.arity.proxy||n>0)&&this.registerOptions(e,i),xe(e,s,r,i,"pushExtra"),be(e,i,t),s=i}s=t}this.arity.trailing.length>0&&ye(e,s,F,D,["setError","Not enough positional arguments"]);let a=s;for(let t=0;t<this.arity.trailing.length;++t){const n=le(e,{dynamics:[],shortcuts:[],statics:{}});this.arity.proxy||this.registerOptions(e,n),t+1<this.arity.trailing.length&&ye(e,n,F,D,["setError","Not enough positional arguments"]),xe(e,a,"isNotOptionLike",n,"pushPositional"),a=n}xe(e,a,r,D,["setError","Extraneous positional argument"]),ye(e,a,F,$,["setSelectedIndex",this.cliIndex])}return{machine:e,context:this.context}}registerOptions(e,t){xe(e,t,["isOption","--"],t,"inhibateOptions"),xe(e,t,["isBatchOption",this.allOptionNames],t,"pushBatch"),xe(e,t,["isBoundOption",this.allOptionNames,this.options],t,"pushBound"),xe(e,t,["isUnsupportedOption",this.allOptionNames],D,["setError","Unsupported option name"]),xe(e,t,["isInvalidOption"],D,["setError","Invalid option name"]);for(const n of this.options){const i=n.names.reduce(((e,t)=>t.length>e.length?t:e),"");if(0===n.arity)for(const r of n.names)xe(e,t,["isOption",r,n.hidden||r!==i],t,"pushTrue"),r.startsWith("--")&&!r.startsWith("--no-")&&xe(e,t,["isNegatedOption",r],t,["pushFalse",r]);else{let r=le(e,{dynamics:[],shortcuts:[],statics:{}});for(const o of n.names)xe(e,t,["isOption",o,n.hidden||o!==i],r,"pushUndefined");for(let t=0;t<n.arity;++t){const t=le(e,{dynamics:[],shortcuts:[],statics:{}});ye(e,r,F,D,"setOptionArityError"),xe(e,r,"isOptionLike",D,"setOptionArityError");xe(e,r,"isNotOptionLike",t,1===n.arity?"setStringValue":"pushStringValue"),r=t}be(e,r,t)}}}}class Te{constructor({binaryName:e="..."}={}){this.builders=[],this.opts={binaryName:e}}static build(e,t={}){return new Te(t).commands(e).compile()}getBuilderByIndex(e){if(!(e>=0&&e<this.builders.length))throw new Error(`Assertion failed: Out-of-bound command index (${e})`);return this.builders[e]}commands(e){for(const t of e)t(this.command());return this}command(){const e=new Re(this.builders.length,this.opts);return this.builders.push(e),e}compile(){const e=[],t=[];for(const n of this.builders){const{machine:i,context:r}=n.compile();e.push(i),t.push(r)}const n=function(e){const t={nodes:[{dynamics:[],shortcuts:[],statics:{}},{dynamics:[],shortcuts:[],statics:{}},{dynamics:[],shortcuts:[],statics:{}}]},n=[];let i=t.nodes.length;for(const r of e){n.push(i);for(let e=0;e<r.nodes.length;++e)he(e)||t.nodes.push(ve(r.nodes[e],i));i+=r.nodes.length-2}for(const e of n)be(t,I,e);return t}(e);return function(e){const t=new Set,n=i=>{if(t.has(i))return;t.add(i);const r=e.nodes[i];for(const e of Object.values(r.statics))for(const{to:t}of e)n(t);for(const[,{to:e}]of r.dynamics)n(e);for(const{to:e}of r.shortcuts)n(e);const o=new Set(r.shortcuts.map((({to:e})=>e)));for(;r.shortcuts.length>0;){const{to:t}=r.shortcuts.shift(),n=e.nodes[t];for(const[e,t]of Object.entries(n.statics)){const n=Object.prototype.hasOwnProperty.call(r.statics,e)?r.statics[e]:r.statics[e]=[];for(const e of t)n.some((({to:t})=>e.to===t))||n.push(e)}for(const[e,t]of n.dynamics)r.dynamics.some((([n,{to:i}])=>e===n&&t.to===i))||r.dynamics.push([e,t]);for(const e of n.shortcuts)o.has(e.to)||(r.shortcuts.push(e),o.add(e.to))}};n(I)}(n),{machine:n,contexts:t,process:e=>de(n,e),suggest:(e,t)=>function(e,t,n){const i=n&&t.length>0?[""]:[],r=ue(e,t,n),o=[],s=new Set,a=(t,n,i=!0)=>{let r=[n];for(;r.length>0;){const n=r;r=[];for(const o of n){const n=e.nodes[o],s=Object.keys(n.statics);for(const e of Object.keys(n.statics)){const e=s[0];for(const{to:o,reducer:s}of n.statics[e])"pushPath"===s&&(i||t.push(e),r.push(o))}}i=!1}const a=JSON.stringify(t);s.has(a)||(o.push(t),s.add(a))};for(const{node:t,state:n}of r){if(null!==n.remainder){a([n.remainder],t);continue}const r=e.nodes[t],o=pe(r,n);for(const[e,n]of Object.entries(r.statics))(o&&e!==F||!e.startsWith("-")&&n.some((({reducer:e})=>"pushPath"===e)))&&a([...i,e],t);if(o)for(const[e,{to:o}]of r.dynamics){if(o===D)continue;const r=we(e,n);if(null!==r)for(const e of r)a([...i,e],t)}}return[...o].sort()}(n,e,t)}}}let Oe;let Ce=class e extends se{constructor(e){super(),this.contexts=e,this.commands=[]}static from(t,n){const i=new e(n);i.path=t.path;for(const e of t.options)switch(e.name){case"-c":i.commands.push(Number(e.value));break;case"-i":i.index=Number(e.value)}return i}async execute(){let e=this.commands;if(void 0!==this.index&&this.index>=0&&this.index<e.length&&(e=[e[this.index]]),0===e.length)this.context.stdout.write(this.cli.usage());else if(1===e.length)this.context.stdout.write(this.cli.usage(this.contexts[e[0]].commandClass,{detailed:!0}));else if(e.length>1){this.context.stdout.write("Multiple commands match your selection:\n"),this.context.stdout.write("\n");let e=0;for(const t of this.commands)this.context.stdout.write(this.cli.usage(this.contexts[t].commandClass,{prefix:(e+++". ").padStart(5)}));this.context.stdout.write("\n"),this.context.stdout.write("Run again with -h=<index> to see the longer details of any of those commands.\n")}}};const Ae=Symbol("clipanion/errorCommand");class Pe{constructor({binaryLabel:e,binaryName:t="...",binaryVersion:n,enableCapture:i=!1,enableColors:r}={}){this.registrations=new Map,this.builder=new Te({binaryName:t}),this.binaryLabel=e,this.binaryName=t,this.binaryVersion=n,this.enableCapture=i,this.enableColors=r}static from(e,t={}){const n=new Pe(t),i=Array.isArray(e)?e:[e];for(const e of i)n.register(e);return n}register(e){var t;const n=new Map,i=new e;for(const e in i){const t=i[e];"object"==typeof t&&null!==t&&t[se.isOption]&&n.set(e,t)}const r=this.builder.command(),o=r.cliIndex,s=null!==(t=e.paths)&&void 0!==t?t:i.paths;if(void 0!==s)for(const e of s)r.addPath(e);this.registrations.set(e,{specs:n,builder:r,index:o});for(const[e,{definition:t}]of n.entries())t(r,e);r.setContext({commandClass:e})}process(e,t){const{contexts:n,process:i}=this.builder.compile(),r=i(e),o={...Pe.defaultContext,...t};if(r.selectedIndex===z){const e=Ce.from(r,n);return e.context=o,e}{const{commandClass:e}=n[r.selectedIndex],t=this.registrations.get(e);if(void 0===t)throw new Error("Assertion failed: Expected the command class to have been registered.");const i=new e;i.context=o,i.path=r.path;try{for(const[e,{transformer:n}]of t.specs.entries())i[e]=n(t.builder,e,r,o);return i}catch(e){throw e[Ae]=i,e}}}async run(e,t){var n,i;let r;const o={...Pe.defaultContext,...t},s=null!==(n=this.enableColors)&&void 0!==n?n:o.colorDepth>1;if(Array.isArray(e))try{r=this.process(e,o)}catch(e){return o.stdout.write(this.error(e,{colored:s})),1}else r=e;if(r.help)return o.stdout.write(this.usage(r,{colored:s,detailed:!0})),0;r.context=o,r.cli={binaryLabel:this.binaryLabel,binaryName:this.binaryName,binaryVersion:this.binaryVersion,enableCapture:this.enableCapture,enableColors:this.enableColors,definitions:()=>this.definitions(),error:(e,t)=>this.error(e,t),format:e=>this.format(e),process:(e,t)=>this.process(e,{...o,...t}),run:(e,t)=>this.run(e,{...o,...t}),usage:(e,t)=>this.usage(e,t)};const a=this.enableCapture&&null!==(i=function(e){let t=Oe;if(void 0===t){if(e.stdout===process.stdout&&e.stderr===process.stderr)return null;const{AsyncLocalStorage:n}=require("async_hooks");t=Oe=new n;const i=process.stdout._write;process.stdout._write=function(e,n,r){const o=t.getStore();return void 0===o?i.call(this,e,n,r):o.stdout.write(e,n,r)};const r=process.stderr._write;process.stderr._write=function(e,n,i){const o=t.getStore();return void 0===o?r.call(this,e,n,i):o.stderr.write(e,n,i)}}return n=>t.run(e,n)}(o))&&void 0!==i?i:je;let c;try{c=await a((()=>r.validateAndExecute().catch((e=>r.catch(e).then((()=>0))))))}catch(e){return o.stdout.write(this.error(e,{colored:s,command:r})),1}return c}async runExit(e,t){process.exitCode=await this.run(e,t)}suggest(e,t){const{suggest:n}=this.builder.compile();return n(e,t)}definitions({colored:e=!1}={}){const t=[];for(const[n,{index:i}]of this.registrations){if(void 0===n.usage)continue;const{usage:r}=this.getUsageByIndex(i,{detailed:!1}),{usage:o,options:s}=this.getUsageByIndex(i,{detailed:!0,inlineOptions:!1}),a=void 0!==n.usage.category?Q(n.usage.category,{format:this.format(e),paragraphs:!1}):void 0,c=void 0!==n.usage.description?Q(n.usage.description,{format:this.format(e),paragraphs:!1}):void 0,l=void 0!==n.usage.details?Q(n.usage.details,{format:this.format(e),paragraphs:!0}):void 0,u=void 0!==n.usage.examples?n.usage.examples.map((([t,n])=>[Q(t,{format:this.format(e),paragraphs:!1}),n.replace(/\$0/g,this.binaryName)])):void 0;t.push({path:r,usage:o,category:a,description:c,details:l,examples:u,options:s})}return t}usage(e=null,{colored:t,detailed:n=!1,prefix:i="$ "}={}){var r;if(null===e){for(const t of this.registrations.keys()){const n=t.paths,i=void 0!==t.usage,o=!n||0===n.length||1===n.length&&0===n[0].length||null!==(r=null==n?void 0:n.some((e=>0===e.length)))&&void 0!==r&&r;if(o){if(e){e=null;break}e=t}else if(i){e=null;continue}}e&&(n=!0)}const o=null!==e&&e instanceof se?e.constructor:e;let s="";if(o)if(n){const{description:e="",details:n="",examples:r=[]}=o.usage||{};""!==e&&(s+=Q(e,{format:this.format(t),paragraphs:!1}).replace(/^./,(e=>e.toUpperCase())),s+="\n"),(""!==n||r.length>0)&&(s+=`${this.format(t).header("Usage")}\n`,s+="\n");const{usage:a,options:c}=this.getUsageByRegistration(o,{inlineOptions:!1});if(s+=`${this.format(t).bold(i)}${a}\n`,c.length>0){s+="\n",s+=`${this.format(t).header("Options")}\n`;const e=c.reduce(((e,t)=>Math.max(e,t.definition.length)),0);s+="\n";for(const{definition:n,description:i}of c)s+=` ${this.format(t).bold(n.padEnd(e))} ${Q(i,{format:this.format(t),paragraphs:!1})}`}if(""!==n&&(s+="\n",s+=`${this.format(t).header("Details")}\n`,s+="\n",s+=Q(n,{format:this.format(t),paragraphs:!0})),r.length>0){s+="\n",s+=`${this.format(t).header("Examples")}\n`;for(const[e,n]of r)s+="\n",s+=Q(e,{format:this.format(t),paragraphs:!1}),s+=`${n.replace(/^/m,` ${this.format(t).bold(i)}`).replace(/\$0/g,this.binaryName)}\n`}}else{const{usage:e}=this.getUsageByRegistration(o);s+=`${this.format(t).bold(i)}${e}\n`}else{const e=new Map;for(const[n,{index:i}]of this.registrations.entries()){if(void 0===n.usage)continue;const r=void 0!==n.usage.category?Q(n.usage.category,{format:this.format(t),paragraphs:!1}):null;let o=e.get(r);void 0===o&&e.set(r,o=[]);const{usage:s}=this.getUsageByIndex(i);o.push({commandClass:n,usage:s})}const n=Array.from(e.keys()).sort(((e,t)=>null===e?-1:null===t?1:e.localeCompare(t,"en",{usage:"sort",caseFirst:"upper"}))),r=void 0!==this.binaryLabel,o=void 0!==this.binaryVersion;r||o?(s+=r&&o?`${this.format(t).header(`${this.binaryLabel} - ${this.binaryVersion}`)}\n\n`:r?`${this.format(t).header(`${this.binaryLabel}`)}\n`:`${this.format(t).header(`${this.binaryVersion}`)}\n`,s+=` ${this.format(t).bold(i)}${this.binaryName} <command>\n`):s+=`${this.format(t).bold(i)}${this.binaryName} <command>\n`;for(const i of n){const n=e.get(i).slice().sort(((e,t)=>e.usage.localeCompare(t.usage,"en",{usage:"sort",caseFirst:"upper"}))),r=null!==i?i.trim():"General commands";s+="\n",s+=`${this.format(t).header(`${r}`)}\n`;for(const{commandClass:e,usage:i}of n){const n=e.usage.description||"undocumented";s+="\n",s+=` ${this.format(t).bold(i)}\n`,s+=` ${Q(n,{format:this.format(t),paragraphs:!1})}`}}s+="\n",s+=Q("You can also print more details about any of these commands by calling them with the `-h,--help` flag right after the command name.",{format:this.format(t),paragraphs:!0})}return s}error(e,t){var n,{colored:i,command:r=(null!==(n=e[Ae])&&void 0!==n?n:null)}=void 0===t?{}:t;e&&"object"==typeof e&&"stack"in e||(e=new Error(`Execution failed with a non-error rejection (rejected value: ${JSON.stringify(e)})`));let o="",s=e.name.replace(/([a-z])([A-Z])/g,"$1 $2");"Error"===s&&(s="Internal Error"),o+=`${this.format(i).error(s)}: ${e.message}\n`;const a=e.clipanion;return void 0!==a?"usage"===a.type&&(o+="\n",o+=this.usage(r)):e.stack&&(o+=`${e.stack.replace(/^.*\n/,"")}\n`),o}format(e){var t;return(null!==(t=null!=e?e:this.enableColors)&&void 0!==t?t:Pe.defaultContext.colorDepth>1)?Z:X}getUsageByRegistration(e,t){const n=this.registrations.get(e);if(void 0===n)throw new Error("Assertion failed: Unregistered command");return this.getUsageByIndex(n.index,t)}getUsageByIndex(e,t){return this.builder.getBuilderByIndex(e).usage(t)}}function je(e){return e()}Pe.defaultContext={env:process.env,stdin:process.stdin,stdout:process.stdout,stderr:process.stderr,colorDepth:T&&"getColorDepth"in T.WriteStream.prototype?T.WriteStream.prototype.getColorDepth():"0"===process.env.FORCE_COLOR?1:"1"===process.env.FORCE_COLOR||void 0!==process.stdout&&process.stdout.isTTY?8:1};class Le extends se{async execute(){this.context.stdout.write(this.cli.usage())}}Le.paths=[["-h"],["--help"]];class Ne extends se{async execute(){var e;this.context.stdout.write(`${null!==(e=this.cli.binaryVersion)&&void 0!==e?e:"<unknown>"}\n`)}}function Ie(e,t,n){const[i,r]=ne(t,null!=n?n:{}),o=e.split(","),s=new Set(o);return te({definition(e){e.addOption({names:o,allowBinding:!1,arity:0,hidden:r.hidden,description:r.description,required:r.required})},transformer(e,t,n){let r=i;for(const{name:e,value:t}of n.options)s.has(e)&&(r=t);return r}})}function $e(e,...t){return"string"==typeof e?function(e,t,n){const[i,r]=ne(t,null!=n?n:{}),{arity:o=1}=r,s=e.split(","),a=new Set(s);return te({definition(e){e.addOption({names:s,arity:r.tolerateBoolean?0:o,hidden:r.hidden,description:r.description,required:r.required})},transformer(e,t,n,o){let s,c=i;void 0!==r.env&&o.env[r.env]&&(s=r.env,c=o.env[r.env]);for(const{name:e,value:t}of n.options)a.has(e)&&(s=e,c=t);return"string"==typeof c?oe(null!=s?s:t,c,r.validator):c}})}(e,...t):function(e={}){const{required:t=!0}=e;return te({definition(t,n){var i;t.addPositional({name:null!==(i=e.name)&&void 0!==i?i:n,required:e.required})},transformer(n,i,r){var o;for(let n=0;n<r.positionals.length;++n){if(r.positionals[n].extra===ke)continue;if(t&&!0===r.positionals[n].extra)continue;if(!t&&!1===r.positionals[n].extra)continue;const[s]=r.positionals.splice(n,1);return oe(null!==(o=e.name)&&void 0!==o?o:i,s.value,e.validator)}}})}(e)}function De(...e){(process.env.ENVIRONMENT||process.env.DEBUG)&&console.log(...e)}Ne.paths=[["-v"],["--version"]];function Me(e,t){try{u.accessSync(e),((e,t)=>{try{u.writeFileSync(e,t||"","utf8")}catch(e){throw new Error(`Failed to overwrite document: ${e}`)}})(e,t)}catch(n){const i=p.dirname(e);u.mkdirSync(i,{recursive:!0}),u.writeFileSync(e,t||"","utf8")}}var Fe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ze(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Be,qe,Ue={exports:{}};
|
|
1
|
+
import{randomUUID as e}from"node:crypto";import t,{existsSync as n}from"node:fs";import i,{dirname as r,join as o}from"node:path";import{unlink as s,readFile as a,writeFile as c,mkdir as l}from"node:fs/promises";import u from"fs";import p from"path";import{EventEmitter as d}from"node:events";import{spawn as f,execSync as m,fork as h}from"node:child_process";import g from"constants";import v,{Readable as x}from"stream";import b from"util";import y from"assert";import _ from"os";import w from"http";import E from"https";import S,{URL as k}from"url";import R from"crypto";import T from"tty";import O from"zlib";import C,{EventEmitter as A}from"events";import P,{homedir as j}from"node:os";import"node:process";import{fileURLToPath as L}from"node:url";import"node:stream";import N from"net";const I=0,$=1,D=2,M="",F="\0",z=-1,B=/^(-h|--help)(?:=([0-9]+))?$/,q=/^(--[a-z]+(?:-[a-z]+)*|-[a-zA-Z]+)$/,U=/^-[a-zA-Z]{2,}$/,H=/^([^=]+)=([\s\S]*)$/,W="1"===process.env.DEBUG_CLI;class G extends Error{constructor(e){super(e),this.clipanion={type:"usage"},this.name="UsageError"}}class V extends Error{constructor(e,t){if(super(),this.input=e,this.candidates=t,this.clipanion={type:"none"},this.name="UnknownSyntaxError",0===this.candidates.length)this.message="Command not found, but we're not sure what's the alternative.";else if(this.candidates.every((e=>null!==e.reason&&e.reason===t[0].reason))){const[{reason:e}]=this.candidates;this.message=`${e}\n\n${this.candidates.map((({usage:e})=>`$ ${e}`)).join("\n")}`}else if(1===this.candidates.length){const[{usage:t}]=this.candidates;this.message=`Command not found; did you mean:\n\n$ ${t}\n${J(e)}`}else this.message=`Command not found; did you mean one of:\n\n${this.candidates.map((({usage:e},t)=>`${`${t}.`.padStart(4)} ${e}`)).join("\n")}\n\n${J(e)}`}}class K extends Error{constructor(e,t){super(),this.input=e,this.usages=t,this.clipanion={type:"none"},this.name="AmbiguousSyntaxError",this.message=`Cannot find which to pick amongst the following alternatives:\n\n${this.usages.map(((e,t)=>`${`${t}.`.padStart(4)} ${e}`)).join("\n")}\n\n${J(e)}`}}const J=e=>`While running ${e.filter((e=>e!==F)).map((e=>{const t=JSON.stringify(e);return e.match(/\s/)||0===e.length||t!==`"${e}"`?t:e})).join(" ")}`,Y=Array(80).fill("━");for(let e=0;e<=24;++e)Y[Y.length-e]=`[38;5;${232+e}m━`;const Z={header:e=>`[1m━━━ ${e}${e.length<75?` ${Y.slice(e.length+5).join("")}`:":"}[0m`,bold:e=>`[1m${e}[22m`,error:e=>`[31m[1m${e}[22m[39m`,code:e=>`[36m${e}[39m`},X={header:e=>e,bold:e=>e,error:e=>e,code:e=>e};function Q(e,{format:t,paragraphs:n}){return e=(e=(e=(e=function(e){const t=e.split("\n"),n=t.filter((e=>e.match(/\S/))),i=n.length>0?n.reduce(((e,t)=>Math.min(e,t.length-t.trimStart().length)),Number.MAX_VALUE):0;return t.map((e=>e.slice(i).trimRight())).join("\n")}(e=e.replace(/\r\n?/g,"\n"))).replace(/^\n+|\n+$/g,"")).replace(/^(\s*)-([^\n]*?)\n+/gm,"$1-$2\n\n")).replace(/\n(\n)?\n*/g,((e,t)=>t||" ")),n&&(e=e.split(/\n/).map((e=>{const t=e.match(/^\s*[*-][\t ]+(.*)/);if(!t)return e.match(/(.{1,80})(?: |$)/g).join("\n");const n=e.length-e.trimStart().length;return t[1].match(new RegExp(`(.{1,${78-n}})(?: |$)`,"g")).map(((e,t)=>" ".repeat(n)+(0===t?"- ":" ")+e)).join("\n")})).join("\n\n")),(e=(e=e.replace(/(`+)((?:.|[\n])*?)\1/g,((e,n,i)=>t.code(n+i+n)))).replace(/(\*\*)((?:.|[\n])*?)\1/g,((e,n,i)=>t.bold(n+i+n))))?`${e}\n`:""}const ee=Symbol("clipanion/isOption");function te(e){return{...e,[ee]:!0}}function ne(e,t){return void 0===e||"object"!=typeof e||null===e||Array.isArray(e)?[e,t]:[void 0,e]}function ie(e,{mergeName:t=!1}={}){const n=e.match(/^([^:]+): (.*)$/m);if(!n)return"validation failed";let[,i,r]=n;return t&&(r=r[0].toLowerCase()+r.slice(1)),r="."===i&&t?`: ${r}`:`${i.replace(/^\.(\[|$)/,"$1")}: ${r}`,r}function re(e,t){return 1===t.length?new G(`${e}${ie(t[0],{mergeName:!0})}`):new G(`${e}:\n${t.map((e=>`\n- ${ie(e)}`)).join("")}`)}function oe(e,t,n){if(void 0===n)return t;const i=[],r=[],o=e=>{const n=t;return t=e,o.bind(null,n)};if(!n(t,{errors:i,coercions:r,coercion:o}))throw re(`Invalid value for ${e}`,i);for(const[,e]of r)e();return t}class se{constructor(){this.help=!1}static Usage(e){return e}async catch(e){throw e}async validateAndExecute(){const e=this.constructor.schema;if(Array.isArray(e)){const{isDict:t,isUnknown:n,applyCascade:i}=await Promise.resolve().then((function(){return ew})),r=[],o=[];if(!i(t(n()),e)(this,{errors:r,coercions:o}))throw re("Invalid option schema",r);for(const[,e]of o)e()}else if(null!=e)throw new Error("Invalid command schema");const t=await this.execute();return void 0!==t?t:0}}function ae(e){W&&console.log(e)}se.isOption=ee,se.Default=[];const ce={candidateUsage:null,requiredOptions:[],errorMessage:null,ignoreOptions:!1,path:[],positionals:[],options:[],remainder:null,selectedIndex:z};function le(e,t){return e.nodes.push(t),e.nodes.length-1}function ue(e,t,n=!1){ae(`Running a vm on ${JSON.stringify(t)}`);let i=[{node:I,state:{candidateUsage:null,requiredOptions:[],errorMessage:null,ignoreOptions:!1,options:[],path:[],positionals:[],remainder:null,selectedIndex:null}}];!function(e,{prefix:t=""}={}){if(W){ae(`${t}Nodes are:`);for(let n=0;n<e.nodes.length;++n)ae(`${t} ${n}: ${JSON.stringify(e.nodes[n])}`)}}(e,{prefix:" "});const r=[M,...t];for(let o=0;o<r.length;++o){const s=r[o];ae(` Processing ${JSON.stringify(s)}`);const a=[];for(const{node:t,state:c}of i){ae(` Current node is ${t}`);const i=e.nodes[t];if(t===D){a.push({node:t,state:c});continue}console.assert(0===i.shortcuts.length,"Shortcuts should have been eliminated by now");const l=Object.prototype.hasOwnProperty.call(i.statics,s);if(!n||o<r.length-1||l)if(l){const e=i.statics[s];for(const{to:t,reducer:n}of e)a.push({node:t,state:void 0!==n?_e(Se,n,c,s):c}),ae(` Static transition to ${t} found`)}else ae(" No static transition found");else{let e=!1;for(const t of Object.keys(i.statics))if(t.startsWith(s)){if(s===t)for(const{to:e,reducer:n}of i.statics[t])a.push({node:e,state:void 0!==n?_e(Se,n,c,s):c}),ae(` Static transition to ${e} found`);else for(const{to:e}of i.statics[t])a.push({node:e,state:{...c,remainder:t.slice(s.length)}}),ae(` Static transition to ${e} found (partial match)`);e=!0}e||ae(" No partial static transition found")}if(s!==F)for(const[e,{to:t,reducer:n}]of i.dynamics)_e(Ee,e,c,s)&&(a.push({node:t,state:void 0!==n?_e(Se,n,c,s):c}),ae(` Dynamic transition to ${t} found (via ${e})`))}if(0===a.length&&s===F&&1===t.length)return[{node:I,state:ce}];if(0===a.length)throw new V(t,i.filter((({node:e})=>e!==D)).map((({state:e})=>({usage:e.candidateUsage,reason:null}))));if(a.every((({node:e})=>e===D)))throw new V(t,a.map((({state:e})=>({usage:e.candidateUsage,reason:e.errorMessage}))));i=fe(a)}if(i.length>0){ae(" Results:");for(const e of i)ae(` - ${e.node} -> ${JSON.stringify(e.state)}`)}else ae(" No results");return i}function pe(e,t){if(null!==t.selectedIndex)return!0;if(Object.prototype.hasOwnProperty.call(e.statics,F))for(const{to:t}of e.statics[F])if(t===$)return!0;return!1}function de(e,t){return function(e,t){const n=t.filter((e=>null!==e.selectedIndex));if(0===n.length)throw new Error;const i=n.filter((e=>e.selectedIndex===z||e.requiredOptions.every((t=>t.some((t=>e.options.find((e=>e.name===t))))))));if(0===i.length)throw new V(e,n.map((e=>({usage:e.candidateUsage,reason:null}))));let r=0;for(const e of i)e.path.length>r&&(r=e.path.length);const o=i.filter((e=>e.path.length===r)),s=e=>e.positionals.filter((({extra:e})=>!e)).length+e.options.length,a=o.map((e=>({state:e,positionalCount:s(e)})));let c=0;for(const{positionalCount:e}of a)e>c&&(c=e);const l=a.filter((({positionalCount:e})=>e===c)).map((({state:e})=>e)),u=function(e){const t=[],n=[];for(const i of e)i.selectedIndex===z?n.push(i):t.push(i);n.length>0&&t.push({...ce,path:me(...n.map((e=>e.path))),options:n.reduce(((e,t)=>e.concat(t.options)),[])});return t}(l);if(u.length>1)throw new K(e,u.map((e=>e.candidateUsage)));return u[0]}(t,ue(e,[...t,F]).map((({state:e})=>e)))}function fe(e){let t=0;for(const{state:n}of e)n.path.length>t&&(t=n.path.length);return e.filter((({state:e})=>e.path.length===t))}function me(e,t,...n){return void 0===t?Array.from(e):me(e.filter(((e,n)=>e===t[n])),...n)}function he(e){return e===$||e===D}function ge(e,t=0){return{to:he(e.to)?e.to:e.to>2?e.to+t-2:e.to+t,reducer:e.reducer}}function ve(e,t=0){const n={dynamics:[],shortcuts:[],statics:{}};for(const[i,r]of e.dynamics)n.dynamics.push([i,ge(r,t)]);for(const i of e.shortcuts)n.shortcuts.push(ge(i,t));for(const[i,r]of Object.entries(e.statics))n.statics[i]=r.map((e=>ge(e,t)));return n}function xe(e,t,n,i,r){e.nodes[t].dynamics.push([n,{to:i,reducer:r}])}function be(e,t,n,i){e.nodes[t].shortcuts.push({to:n,reducer:i})}function ye(e,t,n,i,r){(Object.prototype.hasOwnProperty.call(e.nodes[t].statics,n)?e.nodes[t].statics[n]:e.nodes[t].statics[n]=[]).push({to:i,reducer:r})}function _e(e,t,n,i){if(Array.isArray(t)){const[r,...o]=t;return e[r](n,i,...o)}return e[t](n,i)}function we(e,t){const n=Array.isArray(e)?Ee[e[0]]:Ee[e];if(void 0===n.suggest)return null;const i=Array.isArray(e)?e.slice(1):[];return n.suggest(t,...i)}const Ee={always:()=>!0,isOptionLike:(e,t)=>!e.ignoreOptions&&"-"!==t&&t.startsWith("-"),isNotOptionLike:(e,t)=>e.ignoreOptions||"-"===t||!t.startsWith("-"),isOption:(e,t,n,i)=>!e.ignoreOptions&&t===n,isBatchOption:(e,t,n)=>!e.ignoreOptions&&U.test(t)&&[...t.slice(1)].every((e=>n.includes(`-${e}`))),isBoundOption:(e,t,n,i)=>{const r=t.match(H);return!e.ignoreOptions&&!!r&&q.test(r[1])&&n.includes(r[1])&&i.filter((e=>e.names.includes(r[1]))).every((e=>e.allowBinding))},isNegatedOption:(e,t,n)=>!e.ignoreOptions&&t===`--no-${n.slice(2)}`,isHelp:(e,t)=>!e.ignoreOptions&&B.test(t),isUnsupportedOption:(e,t,n)=>!e.ignoreOptions&&t.startsWith("-")&&q.test(t)&&!n.includes(t),isInvalidOption:(e,t)=>!e.ignoreOptions&&t.startsWith("-")&&!q.test(t)};Ee.isOption.suggest=(e,t,n=!0)=>n?null:[t];const Se={setCandidateState:(e,t,n)=>({...e,...n}),setSelectedIndex:(e,t,n)=>({...e,selectedIndex:n}),pushBatch:(e,t)=>({...e,options:e.options.concat([...t.slice(1)].map((e=>({name:`-${e}`,value:!0}))))}),pushBound:(e,t)=>{const[,n,i]=t.match(H);return{...e,options:e.options.concat({name:n,value:i})}},pushPath:(e,t)=>({...e,path:e.path.concat(t)}),pushPositional:(e,t)=>({...e,positionals:e.positionals.concat({value:t,extra:!1})}),pushExtra:(e,t)=>({...e,positionals:e.positionals.concat({value:t,extra:!0})}),pushExtraNoLimits:(e,t)=>({...e,positionals:e.positionals.concat({value:t,extra:ke})}),pushTrue:(e,t,n=t)=>({...e,options:e.options.concat({name:t,value:!0})}),pushFalse:(e,t,n=t)=>({...e,options:e.options.concat({name:n,value:!1})}),pushUndefined:(e,t)=>({...e,options:e.options.concat({name:t,value:void 0})}),pushStringValue:(e,t)=>{var n;const i={...e,options:[...e.options]},r=e.options[e.options.length-1];return r.value=(null!==(n=r.value)&&void 0!==n?n:[]).concat([t]),i},setStringValue:(e,t)=>{const n={...e,options:[...e.options]};return e.options[e.options.length-1].value=t,n},inhibateOptions:e=>({...e,ignoreOptions:!0}),useHelp:(e,t,n)=>{const[,,i]=t.match(B);return void 0!==i?{...e,options:[{name:"-c",value:String(n)},{name:"-i",value:i}]}:{...e,options:[{name:"-c",value:String(n)}]}},setError:(e,t,n)=>t===F?{...e,errorMessage:`${n}.`}:{...e,errorMessage:`${n} ("${t}").`},setOptionArityError:(e,t)=>{const n=e.options[e.options.length-1];return{...e,errorMessage:`Not enough arguments to option ${n.name}.`}}},ke=Symbol();class Re{constructor(e,t){this.allOptionNames=[],this.arity={leading:[],trailing:[],extra:[],proxy:!1},this.options=[],this.paths=[],this.cliIndex=e,this.cliOpts=t}addPath(e){this.paths.push(e)}setArity({leading:e=this.arity.leading,trailing:t=this.arity.trailing,extra:n=this.arity.extra,proxy:i=this.arity.proxy}){Object.assign(this.arity,{leading:e,trailing:t,extra:n,proxy:i})}addPositional({name:e="arg",required:t=!0}={}){if(!t&&this.arity.extra===ke)throw new Error("Optional parameters cannot be declared when using .rest() or .proxy()");if(!t&&this.arity.trailing.length>0)throw new Error("Optional parameters cannot be declared after the required trailing positional arguments");t||this.arity.extra===ke?this.arity.extra!==ke&&0===this.arity.extra.length?this.arity.leading.push(e):this.arity.trailing.push(e):this.arity.extra.push(e)}addRest({name:e="arg",required:t=0}={}){if(this.arity.extra===ke)throw new Error("Infinite lists cannot be declared multiple times in the same command");if(this.arity.trailing.length>0)throw new Error("Infinite lists cannot be declared after the required trailing positional arguments");for(let n=0;n<t;++n)this.addPositional({name:e});this.arity.extra=ke}addProxy({required:e=0}={}){this.addRest({required:e}),this.arity.proxy=!0}addOption({names:e,description:t,arity:n=0,hidden:i=!1,required:r=!1,allowBinding:o=!0}){if(!o&&n>1)throw new Error("The arity cannot be higher than 1 when the option only supports the --arg=value syntax");if(!Number.isInteger(n))throw new Error(`The arity must be an integer, got ${n}`);if(n<0)throw new Error(`The arity must be positive, got ${n}`);this.allOptionNames.push(...e),this.options.push({names:e,description:t,arity:n,hidden:i,required:r,allowBinding:o})}setContext(e){this.context=e}usage({detailed:e=!0,inlineOptions:t=!0}={}){const n=[this.cliOpts.binaryName],i=[];if(this.paths.length>0&&n.push(...this.paths[0]),e){for(const{names:e,arity:r,hidden:o,description:s,required:a}of this.options){if(o)continue;const c=[];for(let e=0;e<r;++e)c.push(` #${e}`);const l=`${e.join(",")}${c.join("")}`;!t&&s?i.push({definition:l,description:s,required:a}):n.push(a?`<${l}>`:`[${l}]`)}n.push(...this.arity.leading.map((e=>`<${e}>`))),this.arity.extra===ke?n.push("..."):n.push(...this.arity.extra.map((e=>`[${e}]`))),n.push(...this.arity.trailing.map((e=>`<${e}>`)))}return{usage:n.join(" "),options:i}}compile(){if(void 0===this.context)throw new Error("Assertion failed: No context attached");const e={nodes:[{dynamics:[],shortcuts:[],statics:{}},{dynamics:[],shortcuts:[],statics:{}},{dynamics:[],shortcuts:[],statics:{}}]};let t=I;const n=this.usage().usage,i=this.options.filter((e=>e.required)).map((e=>e.names));t=le(e,{dynamics:[],shortcuts:[],statics:{}}),ye(e,I,M,t,["setCandidateState",{candidateUsage:n,requiredOptions:i}]);const r=this.arity.proxy?"always":"isNotOptionLike",o=this.paths.length>0?this.paths:[[]];for(const n of o){let i=t;if(n.length>0){const t=le(e,{dynamics:[],shortcuts:[],statics:{}});be(e,i,t),this.registerOptions(e,t),i=t}for(let t=0;t<n.length;++t){const r=le(e,{dynamics:[],shortcuts:[],statics:{}});ye(e,i,n[t],r,"pushPath"),i=r}if(this.arity.leading.length>0||!this.arity.proxy){const t=le(e,{dynamics:[],shortcuts:[],statics:{}});xe(e,i,"isHelp",t,["useHelp",this.cliIndex]),xe(e,t,"always",t,"pushExtra"),ye(e,t,F,$,["setSelectedIndex",z]),this.registerOptions(e,i)}this.arity.leading.length>0&&ye(e,i,F,D,["setError","Not enough positional arguments"]);let o=i;for(let t=0;t<this.arity.leading.length;++t){const n=le(e,{dynamics:[],shortcuts:[],statics:{}});this.arity.proxy&&t+1===this.arity.leading.length||this.registerOptions(e,n),(this.arity.trailing.length>0||t+1!==this.arity.leading.length)&&ye(e,n,F,D,["setError","Not enough positional arguments"]),xe(e,o,"isNotOptionLike",n,"pushPositional"),o=n}let s=o;if(this.arity.extra===ke||this.arity.extra.length>0){const t=le(e,{dynamics:[],shortcuts:[],statics:{}});if(be(e,o,t),this.arity.extra===ke){const n=le(e,{dynamics:[],shortcuts:[],statics:{}});this.arity.proxy||this.registerOptions(e,n),xe(e,o,r,n,"pushExtraNoLimits"),xe(e,n,r,n,"pushExtraNoLimits"),be(e,n,t)}else for(let n=0;n<this.arity.extra.length;++n){const i=le(e,{dynamics:[],shortcuts:[],statics:{}});(!this.arity.proxy||n>0)&&this.registerOptions(e,i),xe(e,s,r,i,"pushExtra"),be(e,i,t),s=i}s=t}this.arity.trailing.length>0&&ye(e,s,F,D,["setError","Not enough positional arguments"]);let a=s;for(let t=0;t<this.arity.trailing.length;++t){const n=le(e,{dynamics:[],shortcuts:[],statics:{}});this.arity.proxy||this.registerOptions(e,n),t+1<this.arity.trailing.length&&ye(e,n,F,D,["setError","Not enough positional arguments"]),xe(e,a,"isNotOptionLike",n,"pushPositional"),a=n}xe(e,a,r,D,["setError","Extraneous positional argument"]),ye(e,a,F,$,["setSelectedIndex",this.cliIndex])}return{machine:e,context:this.context}}registerOptions(e,t){xe(e,t,["isOption","--"],t,"inhibateOptions"),xe(e,t,["isBatchOption",this.allOptionNames],t,"pushBatch"),xe(e,t,["isBoundOption",this.allOptionNames,this.options],t,"pushBound"),xe(e,t,["isUnsupportedOption",this.allOptionNames],D,["setError","Unsupported option name"]),xe(e,t,["isInvalidOption"],D,["setError","Invalid option name"]);for(const n of this.options){const i=n.names.reduce(((e,t)=>t.length>e.length?t:e),"");if(0===n.arity)for(const r of n.names)xe(e,t,["isOption",r,n.hidden||r!==i],t,"pushTrue"),r.startsWith("--")&&!r.startsWith("--no-")&&xe(e,t,["isNegatedOption",r],t,["pushFalse",r]);else{let r=le(e,{dynamics:[],shortcuts:[],statics:{}});for(const o of n.names)xe(e,t,["isOption",o,n.hidden||o!==i],r,"pushUndefined");for(let t=0;t<n.arity;++t){const t=le(e,{dynamics:[],shortcuts:[],statics:{}});ye(e,r,F,D,"setOptionArityError"),xe(e,r,"isOptionLike",D,"setOptionArityError");xe(e,r,"isNotOptionLike",t,1===n.arity?"setStringValue":"pushStringValue"),r=t}be(e,r,t)}}}}class Te{constructor({binaryName:e="..."}={}){this.builders=[],this.opts={binaryName:e}}static build(e,t={}){return new Te(t).commands(e).compile()}getBuilderByIndex(e){if(!(e>=0&&e<this.builders.length))throw new Error(`Assertion failed: Out-of-bound command index (${e})`);return this.builders[e]}commands(e){for(const t of e)t(this.command());return this}command(){const e=new Re(this.builders.length,this.opts);return this.builders.push(e),e}compile(){const e=[],t=[];for(const n of this.builders){const{machine:i,context:r}=n.compile();e.push(i),t.push(r)}const n=function(e){const t={nodes:[{dynamics:[],shortcuts:[],statics:{}},{dynamics:[],shortcuts:[],statics:{}},{dynamics:[],shortcuts:[],statics:{}}]},n=[];let i=t.nodes.length;for(const r of e){n.push(i);for(let e=0;e<r.nodes.length;++e)he(e)||t.nodes.push(ve(r.nodes[e],i));i+=r.nodes.length-2}for(const e of n)be(t,I,e);return t}(e);return function(e){const t=new Set,n=i=>{if(t.has(i))return;t.add(i);const r=e.nodes[i];for(const e of Object.values(r.statics))for(const{to:t}of e)n(t);for(const[,{to:e}]of r.dynamics)n(e);for(const{to:e}of r.shortcuts)n(e);const o=new Set(r.shortcuts.map((({to:e})=>e)));for(;r.shortcuts.length>0;){const{to:t}=r.shortcuts.shift(),n=e.nodes[t];for(const[e,t]of Object.entries(n.statics)){const n=Object.prototype.hasOwnProperty.call(r.statics,e)?r.statics[e]:r.statics[e]=[];for(const e of t)n.some((({to:t})=>e.to===t))||n.push(e)}for(const[e,t]of n.dynamics)r.dynamics.some((([n,{to:i}])=>e===n&&t.to===i))||r.dynamics.push([e,t]);for(const e of n.shortcuts)o.has(e.to)||(r.shortcuts.push(e),o.add(e.to))}};n(I)}(n),{machine:n,contexts:t,process:e=>de(n,e),suggest:(e,t)=>function(e,t,n){const i=n&&t.length>0?[""]:[],r=ue(e,t,n),o=[],s=new Set,a=(t,n,i=!0)=>{let r=[n];for(;r.length>0;){const n=r;r=[];for(const o of n){const n=e.nodes[o],s=Object.keys(n.statics);for(const e of Object.keys(n.statics)){const e=s[0];for(const{to:o,reducer:s}of n.statics[e])"pushPath"===s&&(i||t.push(e),r.push(o))}}i=!1}const a=JSON.stringify(t);s.has(a)||(o.push(t),s.add(a))};for(const{node:t,state:n}of r){if(null!==n.remainder){a([n.remainder],t);continue}const r=e.nodes[t],o=pe(r,n);for(const[e,n]of Object.entries(r.statics))(o&&e!==F||!e.startsWith("-")&&n.some((({reducer:e})=>"pushPath"===e)))&&a([...i,e],t);if(o)for(const[e,{to:o}]of r.dynamics){if(o===D)continue;const r=we(e,n);if(null!==r)for(const e of r)a([...i,e],t)}}return[...o].sort()}(n,e,t)}}}let Oe;let Ce=class e extends se{constructor(e){super(),this.contexts=e,this.commands=[]}static from(t,n){const i=new e(n);i.path=t.path;for(const e of t.options)switch(e.name){case"-c":i.commands.push(Number(e.value));break;case"-i":i.index=Number(e.value)}return i}async execute(){let e=this.commands;if(void 0!==this.index&&this.index>=0&&this.index<e.length&&(e=[e[this.index]]),0===e.length)this.context.stdout.write(this.cli.usage());else if(1===e.length)this.context.stdout.write(this.cli.usage(this.contexts[e[0]].commandClass,{detailed:!0}));else if(e.length>1){this.context.stdout.write("Multiple commands match your selection:\n"),this.context.stdout.write("\n");let e=0;for(const t of this.commands)this.context.stdout.write(this.cli.usage(this.contexts[t].commandClass,{prefix:(e+++". ").padStart(5)}));this.context.stdout.write("\n"),this.context.stdout.write("Run again with -h=<index> to see the longer details of any of those commands.\n")}}};const Ae=Symbol("clipanion/errorCommand");class Pe{constructor({binaryLabel:e,binaryName:t="...",binaryVersion:n,enableCapture:i=!1,enableColors:r}={}){this.registrations=new Map,this.builder=new Te({binaryName:t}),this.binaryLabel=e,this.binaryName=t,this.binaryVersion=n,this.enableCapture=i,this.enableColors=r}static from(e,t={}){const n=new Pe(t),i=Array.isArray(e)?e:[e];for(const e of i)n.register(e);return n}register(e){var t;const n=new Map,i=new e;for(const e in i){const t=i[e];"object"==typeof t&&null!==t&&t[se.isOption]&&n.set(e,t)}const r=this.builder.command(),o=r.cliIndex,s=null!==(t=e.paths)&&void 0!==t?t:i.paths;if(void 0!==s)for(const e of s)r.addPath(e);this.registrations.set(e,{specs:n,builder:r,index:o});for(const[e,{definition:t}]of n.entries())t(r,e);r.setContext({commandClass:e})}process(e,t){const{contexts:n,process:i}=this.builder.compile(),r=i(e),o={...Pe.defaultContext,...t};if(r.selectedIndex===z){const e=Ce.from(r,n);return e.context=o,e}{const{commandClass:e}=n[r.selectedIndex],t=this.registrations.get(e);if(void 0===t)throw new Error("Assertion failed: Expected the command class to have been registered.");const i=new e;i.context=o,i.path=r.path;try{for(const[e,{transformer:n}]of t.specs.entries())i[e]=n(t.builder,e,r,o);return i}catch(e){throw e[Ae]=i,e}}}async run(e,t){var n,i;let r;const o={...Pe.defaultContext,...t},s=null!==(n=this.enableColors)&&void 0!==n?n:o.colorDepth>1;if(Array.isArray(e))try{r=this.process(e,o)}catch(e){return o.stdout.write(this.error(e,{colored:s})),1}else r=e;if(r.help)return o.stdout.write(this.usage(r,{colored:s,detailed:!0})),0;r.context=o,r.cli={binaryLabel:this.binaryLabel,binaryName:this.binaryName,binaryVersion:this.binaryVersion,enableCapture:this.enableCapture,enableColors:this.enableColors,definitions:()=>this.definitions(),error:(e,t)=>this.error(e,t),format:e=>this.format(e),process:(e,t)=>this.process(e,{...o,...t}),run:(e,t)=>this.run(e,{...o,...t}),usage:(e,t)=>this.usage(e,t)};const a=this.enableCapture&&null!==(i=function(e){let t=Oe;if(void 0===t){if(e.stdout===process.stdout&&e.stderr===process.stderr)return null;const{AsyncLocalStorage:n}=require("async_hooks");t=Oe=new n;const i=process.stdout._write;process.stdout._write=function(e,n,r){const o=t.getStore();return void 0===o?i.call(this,e,n,r):o.stdout.write(e,n,r)};const r=process.stderr._write;process.stderr._write=function(e,n,i){const o=t.getStore();return void 0===o?r.call(this,e,n,i):o.stderr.write(e,n,i)}}return n=>t.run(e,n)}(o))&&void 0!==i?i:je;let c;try{c=await a((()=>r.validateAndExecute().catch((e=>r.catch(e).then((()=>0))))))}catch(e){return o.stdout.write(this.error(e,{colored:s,command:r})),1}return c}async runExit(e,t){process.exitCode=await this.run(e,t)}suggest(e,t){const{suggest:n}=this.builder.compile();return n(e,t)}definitions({colored:e=!1}={}){const t=[];for(const[n,{index:i}]of this.registrations){if(void 0===n.usage)continue;const{usage:r}=this.getUsageByIndex(i,{detailed:!1}),{usage:o,options:s}=this.getUsageByIndex(i,{detailed:!0,inlineOptions:!1}),a=void 0!==n.usage.category?Q(n.usage.category,{format:this.format(e),paragraphs:!1}):void 0,c=void 0!==n.usage.description?Q(n.usage.description,{format:this.format(e),paragraphs:!1}):void 0,l=void 0!==n.usage.details?Q(n.usage.details,{format:this.format(e),paragraphs:!0}):void 0,u=void 0!==n.usage.examples?n.usage.examples.map((([t,n])=>[Q(t,{format:this.format(e),paragraphs:!1}),n.replace(/\$0/g,this.binaryName)])):void 0;t.push({path:r,usage:o,category:a,description:c,details:l,examples:u,options:s})}return t}usage(e=null,{colored:t,detailed:n=!1,prefix:i="$ "}={}){var r;if(null===e){for(const t of this.registrations.keys()){const n=t.paths,i=void 0!==t.usage,o=!n||0===n.length||1===n.length&&0===n[0].length||null!==(r=null==n?void 0:n.some((e=>0===e.length)))&&void 0!==r&&r;if(o){if(e){e=null;break}e=t}else if(i){e=null;continue}}e&&(n=!0)}const o=null!==e&&e instanceof se?e.constructor:e;let s="";if(o)if(n){const{description:e="",details:n="",examples:r=[]}=o.usage||{};""!==e&&(s+=Q(e,{format:this.format(t),paragraphs:!1}).replace(/^./,(e=>e.toUpperCase())),s+="\n"),(""!==n||r.length>0)&&(s+=`${this.format(t).header("Usage")}\n`,s+="\n");const{usage:a,options:c}=this.getUsageByRegistration(o,{inlineOptions:!1});if(s+=`${this.format(t).bold(i)}${a}\n`,c.length>0){s+="\n",s+=`${this.format(t).header("Options")}\n`;const e=c.reduce(((e,t)=>Math.max(e,t.definition.length)),0);s+="\n";for(const{definition:n,description:i}of c)s+=` ${this.format(t).bold(n.padEnd(e))} ${Q(i,{format:this.format(t),paragraphs:!1})}`}if(""!==n&&(s+="\n",s+=`${this.format(t).header("Details")}\n`,s+="\n",s+=Q(n,{format:this.format(t),paragraphs:!0})),r.length>0){s+="\n",s+=`${this.format(t).header("Examples")}\n`;for(const[e,n]of r)s+="\n",s+=Q(e,{format:this.format(t),paragraphs:!1}),s+=`${n.replace(/^/m,` ${this.format(t).bold(i)}`).replace(/\$0/g,this.binaryName)}\n`}}else{const{usage:e}=this.getUsageByRegistration(o);s+=`${this.format(t).bold(i)}${e}\n`}else{const e=new Map;for(const[n,{index:i}]of this.registrations.entries()){if(void 0===n.usage)continue;const r=void 0!==n.usage.category?Q(n.usage.category,{format:this.format(t),paragraphs:!1}):null;let o=e.get(r);void 0===o&&e.set(r,o=[]);const{usage:s}=this.getUsageByIndex(i);o.push({commandClass:n,usage:s})}const n=Array.from(e.keys()).sort(((e,t)=>null===e?-1:null===t?1:e.localeCompare(t,"en",{usage:"sort",caseFirst:"upper"}))),r=void 0!==this.binaryLabel,o=void 0!==this.binaryVersion;r||o?(s+=r&&o?`${this.format(t).header(`${this.binaryLabel} - ${this.binaryVersion}`)}\n\n`:r?`${this.format(t).header(`${this.binaryLabel}`)}\n`:`${this.format(t).header(`${this.binaryVersion}`)}\n`,s+=` ${this.format(t).bold(i)}${this.binaryName} <command>\n`):s+=`${this.format(t).bold(i)}${this.binaryName} <command>\n`;for(const i of n){const n=e.get(i).slice().sort(((e,t)=>e.usage.localeCompare(t.usage,"en",{usage:"sort",caseFirst:"upper"}))),r=null!==i?i.trim():"General commands";s+="\n",s+=`${this.format(t).header(`${r}`)}\n`;for(const{commandClass:e,usage:i}of n){const n=e.usage.description||"undocumented";s+="\n",s+=` ${this.format(t).bold(i)}\n`,s+=` ${Q(n,{format:this.format(t),paragraphs:!1})}`}}s+="\n",s+=Q("You can also print more details about any of these commands by calling them with the `-h,--help` flag right after the command name.",{format:this.format(t),paragraphs:!0})}return s}error(e,t){var n,{colored:i,command:r=(null!==(n=e[Ae])&&void 0!==n?n:null)}=void 0===t?{}:t;e&&"object"==typeof e&&"stack"in e||(e=new Error(`Execution failed with a non-error rejection (rejected value: ${JSON.stringify(e)})`));let o="",s=e.name.replace(/([a-z])([A-Z])/g,"$1 $2");"Error"===s&&(s="Internal Error"),o+=`${this.format(i).error(s)}: ${e.message}\n`;const a=e.clipanion;return void 0!==a?"usage"===a.type&&(o+="\n",o+=this.usage(r)):e.stack&&(o+=`${e.stack.replace(/^.*\n/,"")}\n`),o}format(e){var t;return(null!==(t=null!=e?e:this.enableColors)&&void 0!==t?t:Pe.defaultContext.colorDepth>1)?Z:X}getUsageByRegistration(e,t){const n=this.registrations.get(e);if(void 0===n)throw new Error("Assertion failed: Unregistered command");return this.getUsageByIndex(n.index,t)}getUsageByIndex(e,t){return this.builder.getBuilderByIndex(e).usage(t)}}function je(e){return e()}Pe.defaultContext={env:process.env,stdin:process.stdin,stdout:process.stdout,stderr:process.stderr,colorDepth:T&&"getColorDepth"in T.WriteStream.prototype?T.WriteStream.prototype.getColorDepth():"0"===process.env.FORCE_COLOR?1:"1"===process.env.FORCE_COLOR||void 0!==process.stdout&&process.stdout.isTTY?8:1};class Le extends se{async execute(){this.context.stdout.write(this.cli.usage())}}Le.paths=[["-h"],["--help"]];class Ne extends se{async execute(){var e;this.context.stdout.write(`${null!==(e=this.cli.binaryVersion)&&void 0!==e?e:"<unknown>"}\n`)}}function Ie(e,t,n){const[i,r]=ne(t,null!=n?n:{}),o=e.split(","),s=new Set(o);return te({definition(e){e.addOption({names:o,allowBinding:!1,arity:0,hidden:r.hidden,description:r.description,required:r.required})},transformer(e,t,n){let r=i;for(const{name:e,value:t}of n.options)s.has(e)&&(r=t);return r}})}function $e(e,...t){return"string"==typeof e?function(e,t,n){const[i,r]=ne(t,null!=n?n:{}),{arity:o=1}=r,s=e.split(","),a=new Set(s);return te({definition(e){e.addOption({names:s,arity:r.tolerateBoolean?0:o,hidden:r.hidden,description:r.description,required:r.required})},transformer(e,t,n,o){let s,c=i;void 0!==r.env&&o.env[r.env]&&(s=r.env,c=o.env[r.env]);for(const{name:e,value:t}of n.options)a.has(e)&&(s=e,c=t);return"string"==typeof c?oe(null!=s?s:t,c,r.validator):c}})}(e,...t):function(e={}){const{required:t=!0}=e;return te({definition(t,n){var i;t.addPositional({name:null!==(i=e.name)&&void 0!==i?i:n,required:e.required})},transformer(n,i,r){var o;for(let n=0;n<r.positionals.length;++n){if(r.positionals[n].extra===ke)continue;if(t&&!0===r.positionals[n].extra)continue;if(!t&&!1===r.positionals[n].extra)continue;const[s]=r.positionals.splice(n,1);return oe(null!==(o=e.name)&&void 0!==o?o:i,s.value,e.validator)}}})}(e)}function De(...e){(process.env.ENVIRONMENT||process.env.DEBUG)&&console.log(...e)}Ne.paths=[["-v"],["--version"]];function Me(e,t){try{u.accessSync(e),((e,t)=>{try{u.writeFileSync(e,t||"","utf8")}catch(e){throw new Error(`Failed to overwrite document: ${e}`)}})(e,t)}catch(n){const i=p.dirname(e);u.mkdirSync(i,{recursive:!0}),u.writeFileSync(e,t||"","utf8")}}var Fe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ze(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Be,qe,Ue={exports:{}};
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Lodash <https://lodash.com/>
|
|
@@ -41,4 +41,4 @@ const bp=function(e){return"number"==typeof e?e-e==0:"string"==typeof e&&""!==e.
|
|
|
41
41
|
*/
|
|
42
42
|
const jp=b,Lp=yp,Np=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),Ip=e=>"number"==typeof e||"string"==typeof e&&""!==e,$p=e=>Number.isInteger(+e),Dp=e=>{let t=`${e}`,n=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++n];);return n>0},Mp=(e,t,n)=>{if(t>0){let n="-"===e[0]?"-":"";n&&(e=e.slice(1)),e=n+e.padStart(n?t-1:t,"0")}return!1===n?String(e):e},Fp=(e,t)=>{let n="-"===e[0]?"-":"";for(n&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return n?"-"+e:e},zp=(e,t,n,i)=>{if(n)return Lp(e,t,{wrap:!1,...i});let r=String.fromCharCode(e);return e===t?r:`[${r}-${String.fromCharCode(t)}]`},Bp=(e,t,n)=>{if(Array.isArray(e)){let t=!0===n.wrap,i=n.capture?"":"?:";return t?`(${i}${e.join("|")})`:e.join("|")}return Lp(e,t,n)},qp=(...e)=>new RangeError("Invalid range arguments: "+jp.inspect(...e)),Up=(e,t,n)=>{if(!0===n.strictRanges)throw qp([e,t]);return[]},Hp=(e,t,n=1,i={})=>{let r=Number(e),o=Number(t);if(!Number.isInteger(r)||!Number.isInteger(o)){if(!0===i.strictRanges)throw qp([e,t]);return[]}0===r&&(r=0),0===o&&(o=0);let s=r>o,a=String(e),c=String(t),l=String(n);n=Math.max(Math.abs(n),1);let u=Dp(a)||Dp(c)||Dp(l),p=u?Math.max(a.length,c.length,l.length):0,d=!1===u&&!1===((e,t,n)=>"string"==typeof e||"string"==typeof t||!0===n.stringify)(e,t,i),f=i.transform||(e=>t=>!0===e?Number(t):String(t))(d);if(i.toRegex&&1===n)return zp(Fp(e,p),Fp(t,p),!0,i);let m={negatives:[],positives:[]},h=[],g=0;for(;s?r>=o:r<=o;)!0===i.toRegex&&n>1?m[(v=r)<0?"negatives":"positives"].push(Math.abs(v)):h.push(Mp(f(r,g),p,d)),r=s?r-n:r+n,g++;var v;return!0===i.toRegex?n>1?((e,t,n)=>{e.negatives.sort(((e,t)=>e<t?-1:e>t?1:0)),e.positives.sort(((e,t)=>e<t?-1:e>t?1:0));let i,r=t.capture?"":"?:",o="",s="";return e.positives.length&&(o=e.positives.map((e=>Fp(String(e),n))).join("|")),e.negatives.length&&(s=`-(${r}${e.negatives.map((e=>Fp(String(e),n))).join("|")})`),i=o&&s?`${o}|${s}`:o||s,t.wrap?`(${r}${i})`:i})(m,i,p):Bp(h,null,{wrap:!1,...i}):h},Wp=(e,t,n,i={})=>{if(null==t&&Ip(e))return[e];if(!Ip(e)||!Ip(t))return Up(e,t,i);if("function"==typeof n)return Wp(e,t,1,{transform:n});if(Np(n))return Wp(e,t,0,n);let r={...i};return!0===r.capture&&(r.wrap=!0),n=n||r.step||1,$p(n)?$p(e)&&$p(t)?Hp(e,t,n,r):((e,t,n=1,i={})=>{if(!$p(e)&&e.length>1||!$p(t)&&t.length>1)return Up(e,t,i);let r=i.transform||(e=>String.fromCharCode(e)),o=`${e}`.charCodeAt(0),s=`${t}`.charCodeAt(0),a=o>s,c=Math.min(o,s),l=Math.max(o,s);if(i.toRegex&&1===n)return zp(c,l,!1,i);let u=[],p=0;for(;a?o>=s:o<=s;)u.push(r(o,p)),o=a?o-n:o+n,p++;return!0===i.toRegex?Bp(u,null,{wrap:!1,options:i}):u})(e,t,Math.max(Math.abs(n),1),r):null==n||Np(n)?Wp(e,t,1,n):((e,t)=>{if(!0===t.strictRanges)throw new TypeError(`Expected step "${e}" to be a number`);return[]})(n,r)};const Gp=Wp,Vp=gp;var Kp=(e,t={})=>{const n=(e,i={})=>{const r=Vp.isInvalidBrace(i),o=!0===e.invalid&&!0===t.escapeInvalid,s=!0===r||!0===o,a=!0===t.escapeInvalid?"\\":"";let c="";if(!0===e.isOpen)return a+e.value;if(!0===e.isClose)return console.log("node.isClose",a,e.value),a+e.value;if("open"===e.type)return s?a+e.value:"(";if("close"===e.type)return s?a+e.value:")";if("comma"===e.type)return"comma"===e.prev.type?"":s?e.value:"|";if(e.value)return e.value;if(e.nodes&&e.ranges>0){const n=Vp.reduce(e.nodes),i=Gp(...n,{...t,wrap:!1,toRegex:!0,strictZeros:!0});if(0!==i.length)return n.length>1&&i.length>1?`(${i})`:i}if(e.nodes)for(const t of e.nodes)c+=n(t,e);return c};return n(e)};const Jp=Wp,Yp=xp,Zp=gp,Xp=(e="",t="",n=!1)=>{const i=[];if(e=[].concat(e),!(t=[].concat(t)).length)return e;if(!e.length)return n?Zp.flatten(t).map((e=>`{${e}}`)):t;for(const r of e)if(Array.isArray(r))for(const e of r)i.push(Xp(e,t,n));else for(let e of t)!0===n&&"string"==typeof e&&(e=`{${e}}`),i.push(Array.isArray(e)?Xp(r,e,n):r+e);return Zp.flatten(i)};var Qp=(e,t={})=>{const n=void 0===t.rangeLimit?1e3:t.rangeLimit,i=(e,r={})=>{e.queue=[];let o=r,s=r.queue;for(;"brace"!==o.type&&"root"!==o.type&&o.parent;)o=o.parent,s=o.queue;if(e.invalid||e.dollar)return void s.push(Xp(s.pop(),Yp(e,t)));if("brace"===e.type&&!0!==e.invalid&&2===e.nodes.length)return void s.push(Xp(s.pop(),["{}"]));if(e.nodes&&e.ranges>0){const i=Zp.reduce(e.nodes);if(Zp.exceedsLimit(...i,t.step,n))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let r=Jp(...i,t);return 0===r.length&&(r=Yp(e,t)),s.push(Xp(s.pop(),r)),void(e.nodes=[])}const a=Zp.encloseBrace(e);let c=e.queue,l=e;for(;"brace"!==l.type&&"root"!==l.type&&l.parent;)l=l.parent,c=l.queue;for(let t=0;t<e.nodes.length;t++){const n=e.nodes[t];"comma"!==n.type||"brace"!==e.type?"close"!==n.type?n.value&&"open"!==n.type?c.push(Xp(c.pop(),n.value)):n.nodes&&i(n,e):s.push(Xp(s.pop(),c,a)):(1===t&&c.push(""),c.push(""))}return c};return Zp.flatten(i(e))};const ed=xp,{MAX_LENGTH:td,CHAR_BACKSLASH:nd,CHAR_BACKTICK:id,CHAR_COMMA:rd,CHAR_DOT:od,CHAR_LEFT_PARENTHESES:sd,CHAR_RIGHT_PARENTHESES:ad,CHAR_LEFT_CURLY_BRACE:cd,CHAR_RIGHT_CURLY_BRACE:ld,CHAR_LEFT_SQUARE_BRACKET:ud,CHAR_RIGHT_SQUARE_BRACKET:pd,CHAR_DOUBLE_QUOTE:dd,CHAR_SINGLE_QUOTE:fd,CHAR_NO_BREAK_SPACE:md,CHAR_ZERO_WIDTH_NOBREAK_SPACE:hd}={MAX_LENGTH:1e4,CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_COMMA:",",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_NO_BREAK_SPACE:" ",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SINGLE_QUOTE:"'",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\ufeff"};var gd=(e,t={})=>{if("string"!=typeof e)throw new TypeError("Expected a string");const n=t||{},i="number"==typeof n.maxLength?Math.min(td,n.maxLength):td;if(e.length>i)throw new SyntaxError(`Input length (${e.length}), exceeds max characters (${i})`);const r={type:"root",input:e,nodes:[]},o=[r];let s=r,a=r,c=0;const l=e.length;let u,p=0,d=0;const f=()=>e[p++],m=e=>{if("text"===e.type&&"dot"===a.type&&(a.type="text"),!a||"text"!==a.type||"text"!==e.type)return s.nodes.push(e),e.parent=s,e.prev=a,a=e,e;a.value+=e.value};for(m({type:"bos"});p<l;)if(s=o[o.length-1],u=f(),u!==hd&&u!==md)if(u!==nd)if(u!==pd)if(u!==ud)if(u!==sd)if(u!==ad)if(u!==dd&&u!==fd&&u!==id)if(u!==cd)if(u!==ld)if(u===rd&&d>0){if(s.ranges>0){s.ranges=0;const e=s.nodes.shift();s.nodes=[e,{type:"text",value:ed(s)}]}m({type:"comma",value:u}),s.commas++}else if(u===od&&d>0&&0===s.commas){const e=s.nodes;if(0===d||0===e.length){m({type:"text",value:u});continue}if("dot"===a.type){if(s.range=[],a.value+=u,a.type="range",3!==s.nodes.length&&5!==s.nodes.length){s.invalid=!0,s.ranges=0,a.type="text";continue}s.ranges++,s.args=[];continue}if("range"===a.type){e.pop();const t=e[e.length-1];t.value+=a.value+u,a=t,s.ranges--;continue}m({type:"dot",value:u})}else m({type:"text",value:u});else{if("brace"!==s.type){m({type:"text",value:u});continue}const e="close";s=o.pop(),s.close=!0,m({type:e,value:u}),d--,s=o[o.length-1]}else{d++;const e=a.value&&"$"===a.value.slice(-1)||!0===s.dollar;s=m({type:"brace",open:!0,close:!1,dollar:e,depth:d,commas:0,ranges:0,nodes:[]}),o.push(s),m({type:"open",value:u})}else{const e=u;let n;for(!0!==t.keepQuotes&&(u="");p<l&&(n=f());)if(n!==nd){if(n===e){!0===t.keepQuotes&&(u+=n);break}u+=n}else u+=n+f();m({type:"text",value:u})}else{if("paren"!==s.type){m({type:"text",value:u});continue}s=o.pop(),m({type:"text",value:u}),s=o[o.length-1]}else s=m({type:"paren",nodes:[]}),o.push(s),m({type:"text",value:u});else{let e;for(c++;p<l&&(e=f());)if(u+=e,e!==ud)if(e!==nd){if(e===pd&&(c--,0===c))break}else u+=f();else c++;m({type:"text",value:u})}else m({type:"text",value:"\\"+u});else m({type:"text",value:(t.keepEscaping?u:"")+f()});do{if(s=o.pop(),"root"!==s.type){s.nodes.forEach((e=>{e.nodes||("open"===e.type&&(e.isOpen=!0),"close"===e.type&&(e.isClose=!0),e.nodes||(e.type="text"),e.invalid=!0)}));const e=o[o.length-1],t=e.nodes.indexOf(s);e.nodes.splice(t,1,...s.nodes)}}while(o.length>0);return m({type:"eos"}),r};const vd=xp,xd=Kp,bd=Qp,yd=gd,_d=(e,t={})=>{let n=[];if(Array.isArray(e))for(const i of e){const e=_d.create(i,t);Array.isArray(e)?n.push(...e):n.push(e)}else n=[].concat(_d.create(e,t));return t&&!0===t.expand&&!0===t.nodupes&&(n=[...new Set(n)]),n};_d.parse=(e,t={})=>yd(e,t),_d.stringify=(e,t={})=>vd("string"==typeof e?_d.parse(e,t):e,t),_d.compile=(e,t={})=>("string"==typeof e&&(e=_d.parse(e,t)),xd(e,t)),_d.expand=(e,t={})=>{"string"==typeof e&&(e=_d.parse(e,t));let n=bd(e,t);return!0===t.noempty&&(n=n.filter(Boolean)),!0===t.nodupes&&(n=[...new Set(n)]),n},_d.create=(e,t={})=>""===e||e.length<3?[e]:!0!==t.expand?_d.compile(e,t):_d.expand(e,t);const wd=b,Ed=_d,Sd=Cu,kd=Il,Rd=e=>""===e||"./"===e,Td=(e,t,n)=>{t=[].concat(t),e=[].concat(e);let i=new Set,r=new Set,o=new Set,s=0,a=e=>{o.add(e.output),n&&n.onResult&&n.onResult(e)};for(let o=0;o<t.length;o++){let c=Sd(String(t[o]),{...n,onResult:a},!0),l=c.state.negated||c.state.negatedExtglob;l&&s++;for(let t of e){let e=c(t,!0);(l?!e.isMatch:e.isMatch)&&(l?i.add(e.output):(i.delete(e.output),r.add(e.output)))}}let c=(s===t.length?[...o]:[...r]).filter((e=>!i.has(e)));if(n&&0===c.length){if(!0===n.failglob)throw new Error(`No matches found for "${t.join(", ")}"`);if(!0===n.nonull||!0===n.nullglob)return n.unescape?t.map((e=>e.replace(/\\/g,""))):t}return c};Td.match=Td,Td.matcher=(e,t)=>Sd(e,t),Td.any=Td.isMatch=(e,t,n)=>Sd(t,n)(e),Td.not=(e,t,n={})=>{t=[].concat(t).map(String);let i=new Set,r=[],o=new Set(Td(e,t,{...n,onResult:e=>{n.onResult&&n.onResult(e),r.push(e.output)}}));for(let e of r)o.has(e)||i.add(e);return[...i]},Td.contains=(e,t,n)=>{if("string"!=typeof e)throw new TypeError(`Expected a string: "${wd.inspect(e)}"`);if(Array.isArray(t))return t.some((t=>Td.contains(e,t,n)));if("string"==typeof t){if(Rd(e)||Rd(t))return!1;if(e.includes(t)||e.startsWith("./")&&e.slice(2).includes(t))return!0}return Td.isMatch(e,t,{...n,contains:!0})},Td.matchKeys=(e,t,n)=>{if(!kd.isObject(e))throw new TypeError("Expected the first argument to be an object");let i=Td(Object.keys(e),t,n),r={};for(let t of i)r[t]=e[t];return r},Td.some=(e,t,n)=>{let i=[].concat(e);for(let e of[].concat(t)){let t=Sd(String(e),n);if(i.some((e=>t(e))))return!0}return!1},Td.every=(e,t,n)=>{let i=[].concat(e);for(let e of[].concat(t)){let t=Sd(String(e),n);if(!i.every((e=>t(e))))return!1}return!0},Td.all=(e,t,n)=>{if("string"!=typeof e)throw new TypeError(`Expected a string: "${wd.inspect(e)}"`);return[].concat(t).every((t=>Sd(t,n)(e)))},Td.capture=(e,t,n)=>{let i=kd.isWindows(n),r=Sd.makeRe(String(e),{...n,capture:!0}).exec(i?kd.toPosixSlashes(t):t);if(r)return r.slice(1).map((e=>void 0===e?"":e))},Td.makeRe=(...e)=>Sd.makeRe(...e),Td.scan=(...e)=>Sd.scan(...e),Td.parse=(e,t)=>{let n=[];for(let i of[].concat(e||[]))for(let e of Ed(String(i),t))n.push(Sd.parse(e,t));return n},Td.braces=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return t&&!0===t.nobrace||!/\{.*\}/.test(e)?[e]:Ed(e,t)},Td.braceExpand=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return Td.braces(e,{...t,expand:!0})};var Od=Td;Object.defineProperty(rp,"__esModule",{value:!0}),rp.removeDuplicateSlashes=rp.matchAny=rp.convertPatternsToRe=rp.makeRe=rp.getPatternParts=rp.expandBraceExpansion=rp.expandPatternsWithBraceExpansion=rp.isAffectDepthOfReadingPattern=rp.endsWithSlashGlobStar=rp.hasGlobStar=rp.getBaseDirectory=rp.isPatternRelatedToParentDirectory=rp.getPatternsOutsideCurrentDirectory=rp.getPatternsInsideCurrentDirectory=rp.getPositivePatterns=rp.getNegativePatterns=rp.isPositivePattern=rp.isNegativePattern=rp.convertToNegativePattern=rp.convertToPositivePattern=rp.isDynamicPattern=rp.isStaticPattern=void 0;const Cd=p,Ad=function(e,t){Object.assign({flipBackslashes:!0},t).flipBackslashes&&pp&&e.indexOf("/")<0&&(e=e.replace(dp,"/")),fp.test(e)&&(e+="/"),e+="a";do{e=up(e)}while(lp(e)||mp.test(e));return e.replace(hp,"$1")},Pd=Od,jd="**",Ld="\\",Nd=/[*?]|^!/,Id=/\[[^[]*]/,$d=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,Dd=/[!*+?@]\([^(]*\)/,Md=/,|\.\./,Fd=/(?!^)\/{2,}/g;function zd(e,t={}){return!Bd(e,t)}function Bd(e,t={}){return""!==e&&(!(!1!==t.caseSensitiveMatch&&!e.includes(Ld))||(!!(Nd.test(e)||Id.test(e)||$d.test(e))||(!(!1===t.extglob||!Dd.test(e))||!(!1===t.braceExpansion||!function(e){const t=e.indexOf("{");if(-1===t)return!1;const n=e.indexOf("}",t+1);if(-1===n)return!1;const i=e.slice(t,n);return Md.test(i)}(e)))))}function qd(e){return e.startsWith("!")&&"("!==e[1]}function Ud(e){return!qd(e)}function Hd(e){return e.startsWith("..")||e.startsWith("./..")}function Wd(e){return e.endsWith("/"+jd)}function Gd(e){const t=Pd.braces(e,{expand:!0,nodupes:!0,keepEscaping:!0});return t.sort(((e,t)=>e.length-t.length)),t.filter((e=>""!==e))}function Vd(e,t){return Pd.makeRe(e,t)}rp.isStaticPattern=zd,rp.isDynamicPattern=Bd,rp.convertToPositivePattern=function(e){return qd(e)?e.slice(1):e},rp.convertToNegativePattern=function(e){return"!"+e},rp.isNegativePattern=qd,rp.isPositivePattern=Ud,rp.getNegativePatterns=function(e){return e.filter(qd)},rp.getPositivePatterns=function(e){return e.filter(Ud)},rp.getPatternsInsideCurrentDirectory=function(e){return e.filter((e=>!Hd(e)))},rp.getPatternsOutsideCurrentDirectory=function(e){return e.filter(Hd)},rp.isPatternRelatedToParentDirectory=Hd,rp.getBaseDirectory=function(e){return Ad(e,{flipBackslashes:!1})},rp.hasGlobStar=function(e){return e.includes(jd)},rp.endsWithSlashGlobStar=Wd,rp.isAffectDepthOfReadingPattern=function(e){const t=Cd.basename(e);return Wd(e)||zd(t)},rp.expandPatternsWithBraceExpansion=function(e){return e.reduce(((e,t)=>e.concat(Gd(t))),[])},rp.expandBraceExpansion=Gd,rp.getPatternParts=function(e,t){let{parts:n}=Pd.scan(e,Object.assign(Object.assign({},t),{parts:!0}));return 0===n.length&&(n=[e]),n[0].startsWith("/")&&(n[0]=n[0].slice(1),n.unshift("")),n},rp.makeRe=Vd,rp.convertPatternsToRe=function(e,t){return e.map((e=>Vd(e,t)))},rp.matchAny=function(e,t){return t.some((t=>t.test(e)))},rp.removeDuplicateSlashes=function(e){return e.replace(Fd,"/")};var Kd={};Object.defineProperty(Kd,"__esModule",{value:!0}),Kd.merge=void 0;const Jd=Fu;function Yd(e){e.forEach((e=>e.emit("close")))}Kd.merge=function(e){const t=Jd(e);return e.forEach((e=>{e.once("error",(e=>t.emit("error",e)))})),t.once("close",(()=>Yd(e))),t.once("end",(()=>Yd(e))),t};var Zd={};Object.defineProperty(Zd,"__esModule",{value:!0}),Zd.isEmpty=Zd.isString=void 0,Zd.isString=function(e){return"string"==typeof e},Zd.isEmpty=function(e){return""===e},Object.defineProperty(qu,"__esModule",{value:!0}),qu.string=qu.stream=qu.pattern=qu.path=qu.fs=qu.errno=qu.array=void 0;const Xd=Uu;qu.array=Xd;const Qd=Hu;qu.errno=Qd;const ef=Wu;qu.fs=ef;const tf=Vu;qu.path=tf;const nf=rp;qu.pattern=nf;const rf=Kd;qu.stream=rf;const of=Zd;qu.string=of,Object.defineProperty(Bu,"__esModule",{value:!0}),Bu.convertPatternGroupToTask=Bu.convertPatternGroupsToTasks=Bu.groupPatternsByBaseDirectory=Bu.getNegativePatternsAsPositive=Bu.getPositivePatterns=Bu.convertPatternsToTasks=Bu.generate=void 0;const sf=qu;function af(e,t){let n=e;return t.braceExpansion&&(n=sf.pattern.expandPatternsWithBraceExpansion(n)),t.baseNameMatch&&(n=n.map((e=>e.includes("/")?e:`**/${e}`))),n.map((e=>sf.pattern.removeDuplicateSlashes(e)))}function cf(e,t,n){const i=[],r=sf.pattern.getPatternsOutsideCurrentDirectory(e),o=sf.pattern.getPatternsInsideCurrentDirectory(e),s=pf(r),a=pf(o);return i.push(...df(s,t,n)),"."in a?i.push(ff(".",o,t,n)):i.push(...df(a,t,n)),i}function lf(e){return sf.pattern.getPositivePatterns(e)}function uf(e,t){return sf.pattern.getNegativePatterns(e).concat(t).map(sf.pattern.convertToPositivePattern)}function pf(e){return e.reduce(((e,t)=>{const n=sf.pattern.getBaseDirectory(t);return n in e?e[n].push(t):e[n]=[t],e}),{})}function df(e,t,n){return Object.keys(e).map((i=>ff(i,e[i],t,n)))}function ff(e,t,n,i){return{dynamic:i,positive:t,negative:n,base:e,patterns:[].concat(t,n.map(sf.pattern.convertToNegativePattern))}}Bu.generate=function(e,t){const n=af(e,t),i=af(t.ignore,t),r=lf(n),o=uf(n,i),s=r.filter((e=>sf.pattern.isStaticPattern(e,t))),a=r.filter((e=>sf.pattern.isDynamicPattern(e,t))),c=cf(s,o,!1),l=cf(a,o,!0);return c.concat(l)},Bu.convertPatternsToTasks=cf,Bu.getPositivePatterns=lf,Bu.getNegativePatternsAsPositive=uf,Bu.groupPatternsByBaseDirectory=pf,Bu.convertPatternGroupsToTasks=df,Bu.convertPatternGroupToTask=ff;var mf={},hf={},gf={},vf={},xf={},bf={},yf={},_f={},wf={};function Ef(e,t){e(t)}function Sf(e,t){e(null,t)}Object.defineProperty(wf,"__esModule",{value:!0}),wf.read=void 0,wf.read=function(e,t,n){t.fs.lstat(e,((i,r)=>{null===i?r.isSymbolicLink()&&t.followSymbolicLink?t.fs.stat(e,((e,i)=>{if(null!==e)return t.throwErrorOnBrokenSymbolicLink?void Ef(n,e):void Sf(n,r);t.markSymbolicLink&&(i.isSymbolicLink=()=>!0),Sf(n,i)})):Sf(n,r):Ef(n,i)}))};var kf={};Object.defineProperty(kf,"__esModule",{value:!0}),kf.read=void 0,kf.read=function(e,t){const n=t.fs.lstatSync(e);if(!n.isSymbolicLink()||!t.followSymbolicLink)return n;try{const n=t.fs.statSync(e);return t.markSymbolicLink&&(n.isSymbolicLink=()=>!0),n}catch(e){if(!t.throwErrorOnBrokenSymbolicLink)return n;throw e}};var Rf={},Tf={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createFileSystemAdapter=e.FILE_SYSTEM_ADAPTER=void 0;const t=u;e.FILE_SYSTEM_ADAPTER={lstat:t.lstat,stat:t.stat,lstatSync:t.lstatSync,statSync:t.statSync},e.createFileSystemAdapter=function(t){return void 0===t?e.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},e.FILE_SYSTEM_ADAPTER),t)}}(Tf),Object.defineProperty(Rf,"__esModule",{value:!0});const Of=Tf;Rf.default=class{constructor(e={}){this._options=e,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=Of.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(e,t){return null!=e?e:t}},Object.defineProperty(_f,"__esModule",{value:!0}),_f.statSync=_f.stat=_f.Settings=void 0;const Cf=wf,Af=kf,Pf=Rf;function jf(e={}){return e instanceof Pf.default?e:new Pf.default(e)}
|
|
43
43
|
/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */let Lf;_f.Settings=Pf.default,_f.stat=function(e,t,n){"function"!=typeof t?Cf.read(e,jf(t),n):Cf.read(e,jf(),t)},_f.statSync=function(e,t){const n=jf(t);return Af.read(e,n)};var Nf=function(e,t){let n,i,r,o=!0;Array.isArray(e)?(n=[],i=e.length):(r=Object.keys(e),n={},i=r.length);function s(e){function i(){t&&t(e,n),t=null}o?If(i):i()}function a(e,t,r){n[e]=r,(0==--i||t)&&s(t)}i?r?r.forEach((function(t){e[t]((function(e,n){a(t,e,n)}))})):e.forEach((function(e,t){e((function(e,n){a(t,e,n)}))})):s(null);o=!1};
|
|
44
|
-
/*! run-parallel. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */const If="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:Fe):e=>(Lf||(Lf=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0)));var $f={};Object.defineProperty($f,"__esModule",{value:!0}),$f.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;const Df=process.versions.node.split(".");if(void 0===Df[0]||void 0===Df[1])throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);const Mf=Number.parseInt(Df[0],10),Ff=Number.parseInt(Df[1],10),zf=Mf>10,Bf=10===Mf&&Ff>=10;$f.IS_SUPPORT_READDIR_WITH_FILE_TYPES=zf||Bf;var qf={},Uf={};Object.defineProperty(Uf,"__esModule",{value:!0}),Uf.createDirentFromStats=void 0;class Hf{constructor(e,t){this.name=e,this.isBlockDevice=t.isBlockDevice.bind(t),this.isCharacterDevice=t.isCharacterDevice.bind(t),this.isDirectory=t.isDirectory.bind(t),this.isFIFO=t.isFIFO.bind(t),this.isFile=t.isFile.bind(t),this.isSocket=t.isSocket.bind(t),this.isSymbolicLink=t.isSymbolicLink.bind(t)}}Uf.createDirentFromStats=function(e,t){return new Hf(e,t)},Object.defineProperty(qf,"__esModule",{value:!0}),qf.fs=void 0;const Wf=Uf;qf.fs=Wf;var Gf={};Object.defineProperty(Gf,"__esModule",{value:!0}),Gf.joinPathSegments=void 0,Gf.joinPathSegments=function(e,t,n){return e.endsWith(n)?e+t:e+n+t},Object.defineProperty(yf,"__esModule",{value:!0}),yf.readdir=yf.readdirWithFileTypes=yf.read=void 0;const Vf=_f,Kf=Nf,Jf=$f,Yf=qf,Zf=Gf;function Xf(e,t,n){t.fs.readdir(e,{withFileTypes:!0},((i,r)=>{if(null!==i)return void em(n,i);const o=r.map((n=>({dirent:n,name:n.name,path:Zf.joinPathSegments(e,n.name,t.pathSegmentSeparator)})));if(!t.followSymbolicLinks)return void tm(n,o);const s=o.map((e=>function(e,t){return n=>{e.dirent.isSymbolicLink()?t.fs.stat(e.path,((i,r)=>{if(null!==i)return t.throwErrorOnBrokenSymbolicLink?void n(i):void n(null,e);e.dirent=Yf.fs.createDirentFromStats(e.name,r),n(null,e)})):n(null,e)}}(e,t)));Kf(s,((e,t)=>{null===e?tm(n,t):em(n,e)}))}))}function Qf(e,t,n){t.fs.readdir(e,((i,r)=>{if(null!==i)return void em(n,i);const o=r.map((n=>{const i=Zf.joinPathSegments(e,n,t.pathSegmentSeparator);return e=>{Vf.stat(i,t.fsStatSettings,((r,o)=>{if(null!==r)return void e(r);const s={name:n,path:i,dirent:Yf.fs.createDirentFromStats(n,o)};t.stats&&(s.stats=o),e(null,s)}))}}));Kf(o,((e,t)=>{null===e?tm(n,t):em(n,e)}))}))}function em(e,t){e(t)}function tm(e,t){e(null,t)}yf.read=function(e,t,n){t.stats||!Jf.IS_SUPPORT_READDIR_WITH_FILE_TYPES?Qf(e,t,n):Xf(e,t,n)},yf.readdirWithFileTypes=Xf,yf.readdir=Qf;var nm={};Object.defineProperty(nm,"__esModule",{value:!0}),nm.readdir=nm.readdirWithFileTypes=nm.read=void 0;const im=_f,rm=$f,om=qf,sm=Gf;function am(e,t){return t.fs.readdirSync(e,{withFileTypes:!0}).map((n=>{const i={dirent:n,name:n.name,path:sm.joinPathSegments(e,n.name,t.pathSegmentSeparator)};if(i.dirent.isSymbolicLink()&&t.followSymbolicLinks)try{const e=t.fs.statSync(i.path);i.dirent=om.fs.createDirentFromStats(i.name,e)}catch(e){if(t.throwErrorOnBrokenSymbolicLink)throw e}return i}))}function cm(e,t){return t.fs.readdirSync(e).map((n=>{const i=sm.joinPathSegments(e,n,t.pathSegmentSeparator),r=im.statSync(i,t.fsStatSettings),o={name:n,path:i,dirent:om.fs.createDirentFromStats(n,r)};return t.stats&&(o.stats=r),o}))}nm.read=function(e,t){return!t.stats&&rm.IS_SUPPORT_READDIR_WITH_FILE_TYPES?am(e,t):cm(e,t)},nm.readdirWithFileTypes=am,nm.readdir=cm;var lm={},um={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createFileSystemAdapter=e.FILE_SYSTEM_ADAPTER=void 0;const t=u;e.FILE_SYSTEM_ADAPTER={lstat:t.lstat,stat:t.stat,lstatSync:t.lstatSync,statSync:t.statSync,readdir:t.readdir,readdirSync:t.readdirSync},e.createFileSystemAdapter=function(t){return void 0===t?e.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},e.FILE_SYSTEM_ADAPTER),t)}}(um),Object.defineProperty(lm,"__esModule",{value:!0});const pm=p,dm=_f,fm=um;lm.default=class{constructor(e={}){this._options=e,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=fm.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,pm.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new dm.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(e,t){return null!=e?e:t}},Object.defineProperty(bf,"__esModule",{value:!0}),bf.Settings=bf.scandirSync=bf.scandir=void 0;const mm=yf,hm=nm,gm=lm;function vm(e={}){return e instanceof gm.default?e:new gm.default(e)}bf.Settings=gm.default,bf.scandir=function(e,t,n){"function"!=typeof t?mm.read(e,vm(t),n):mm.read(e,vm(),t)},bf.scandirSync=function(e,t){const n=vm(t);return hm.read(e,n)};var xm={exports:{}};var bm=function(e){var t=new e,n=t;return{get:function(){var i=t;return i.next?t=i.next:(t=new e,n=t),i.next=null,i},release:function(e){n.next=e,n=e}}};function ym(e,t,n){if("function"==typeof e&&(n=t,t=e,e=null),!(n>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");var i=bm(wm),r=null,o=null,s=0,a=null,c={push:function(u,p){var d=i.get();d.context=e,d.release=l,d.value=u,d.callback=p||_m,d.errorHandler=a,s>=n||c.paused?o?(o.next=d,o=d):(r=d,o=d,c.saturated()):(s++,t.call(e,d.value,d.worked))},drain:_m,saturated:_m,pause:function(){c.paused=!0},paused:!1,get concurrency(){return n},set concurrency(e){if(!(e>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");if(n=e,!c.paused)for(;r&&s<n;)s++,l()},running:function(){return s},resume:function(){if(!c.paused)return;if(c.paused=!1,null===r)return s++,void l();for(;r&&s<n;)s++,l()},idle:function(){return 0===s&&0===c.length()},length:function(){var e=r,t=0;for(;e;)e=e.next,t++;return t},getQueue:function(){var e=r,t=[];for(;e;)t.push(e.value),e=e.next;return t},unshift:function(u,p){var d=i.get();d.context=e,d.release=l,d.value=u,d.callback=p||_m,d.errorHandler=a,s>=n||c.paused?r?(d.next=r,r=d):(r=d,o=d,c.saturated()):(s++,t.call(e,d.value,d.worked))},empty:_m,kill:function(){r=null,o=null,c.drain=_m},killAndDrain:function(){r=null,o=null,c.drain(),c.drain=_m},error:function(e){a=e}};return c;function l(a){a&&i.release(a);var l=r;l&&s<=n?c.paused?s--:(o===r&&(o=null),r=l.next,l.next=null,t.call(e,l.value,l.worked),null===o&&c.empty()):0==--s&&c.drain()}}function _m(){}function wm(){this.value=null,this.callback=_m,this.next=null,this.release=_m,this.context=null,this.errorHandler=null;var e=this;this.worked=function(t,n){var i=e.callback,r=e.errorHandler,o=e.value;e.value=null,e.callback=_m,e.errorHandler&&r(t,o),i.call(e.context,t,n),e.release(e)}}xm.exports=ym,xm.exports.promise=function(e,t,n){"function"==typeof e&&(n=t,t=e,e=null);var i=ym(e,(function(e,n){t.call(this,e).then((function(e){n(null,e)}),n)}),n),r=i.push,o=i.unshift;return i.push=function(e){var t=new Promise((function(t,n){r(e,(function(e,i){e?n(e):t(i)}))}));return t.catch(_m),t},i.unshift=function(e){var t=new Promise((function(t,n){o(e,(function(e,i){e?n(e):t(i)}))}));return t.catch(_m),t},i.drained=function(){if(i.idle())return new Promise((function(e){e()}));var e=i.drain;return new Promise((function(t){i.drain=function(){e(),t()}}))},i};var Em=xm.exports,Sm={};Object.defineProperty(Sm,"__esModule",{value:!0}),Sm.joinPathSegments=Sm.replacePathSegmentSeparator=Sm.isAppliedFilter=Sm.isFatalError=void 0,Sm.isFatalError=function(e,t){return null===e.errorFilter||!e.errorFilter(t)},Sm.isAppliedFilter=function(e,t){return null===e||e(t)},Sm.replacePathSegmentSeparator=function(e,t){return e.split(/[/\\]/).join(t)},Sm.joinPathSegments=function(e,t,n){return""===e?t:e.endsWith(n)?e+t:e+n+t};var km={};Object.defineProperty(km,"__esModule",{value:!0});const Rm=Sm;km.default=class{constructor(e,t){this._root=e,this._settings=t,this._root=Rm.replacePathSegmentSeparator(e,t.pathSegmentSeparator)}},Object.defineProperty(xf,"__esModule",{value:!0});const Tm=C,Om=bf,Cm=Em,Am=Sm,Pm=km;class jm extends Pm.default{constructor(e,t){super(e,t),this._settings=t,this._scandir=Om.scandir,this._emitter=new Tm.EventEmitter,this._queue=Cm(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit("end")}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate((()=>{this._pushToQueue(this._root,this._settings.basePath)})),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw new Error("The reader is already destroyed");this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(e){this._emitter.on("entry",e)}onError(e){this._emitter.once("error",e)}onEnd(e){this._emitter.once("end",e)}_pushToQueue(e,t){const n={directory:e,base:t};this._queue.push(n,(e=>{null!==e&&this._handleError(e)}))}_worker(e,t){this._scandir(e.directory,this._settings.fsScandirSettings,((n,i)=>{if(null===n){for(const t of i)this._handleEntry(t,e.base);t(null,void 0)}else t(n,void 0)}))}_handleError(e){!this._isDestroyed&&Am.isFatalError(this._settings,e)&&(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit("error",e))}_handleEntry(e,t){if(this._isDestroyed||this._isFatalError)return;const n=e.path;void 0!==t&&(e.path=Am.joinPathSegments(t,e.name,this._settings.pathSegmentSeparator)),Am.isAppliedFilter(this._settings.entryFilter,e)&&this._emitEntry(e),e.dirent.isDirectory()&&Am.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,void 0===t?void 0:e.path)}_emitEntry(e){this._emitter.emit("entry",e)}}xf.default=jm,Object.defineProperty(vf,"__esModule",{value:!0});const Lm=xf;vf.default=class{constructor(e,t){this._root=e,this._settings=t,this._reader=new Lm.default(this._root,this._settings),this._storage=[]}read(e){this._reader.onError((t=>{!function(e,t){e(t)}(e,t)})),this._reader.onEntry((e=>{this._storage.push(e)})),this._reader.onEnd((()=>{!function(e,t){e(null,t)}(e,this._storage)})),this._reader.read()}};var Nm={};Object.defineProperty(Nm,"__esModule",{value:!0});const Im=v,$m=xf;Nm.default=class{constructor(e,t){this._root=e,this._settings=t,this._reader=new $m.default(this._root,this._settings),this._stream=new Im.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError((e=>{this._stream.emit("error",e)})),this._reader.onEntry((e=>{this._stream.push(e)})),this._reader.onEnd((()=>{this._stream.push(null)})),this._reader.read(),this._stream}};var Dm={},Mm={};Object.defineProperty(Mm,"__esModule",{value:!0});const Fm=bf,zm=Sm,Bm=km;class qm extends Bm.default{constructor(){super(...arguments),this._scandir=Fm.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(e,t){this._queue.add({directory:e,base:t})}_handleQueue(){for(const e of this._queue.values())this._handleDirectory(e.directory,e.base)}_handleDirectory(e,t){try{const n=this._scandir(e,this._settings.fsScandirSettings);for(const e of n)this._handleEntry(e,t)}catch(e){this._handleError(e)}}_handleError(e){if(zm.isFatalError(this._settings,e))throw e}_handleEntry(e,t){const n=e.path;void 0!==t&&(e.path=zm.joinPathSegments(t,e.name,this._settings.pathSegmentSeparator)),zm.isAppliedFilter(this._settings.entryFilter,e)&&this._pushToStorage(e),e.dirent.isDirectory()&&zm.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,void 0===t?void 0:e.path)}_pushToStorage(e){this._storage.push(e)}}Mm.default=qm,Object.defineProperty(Dm,"__esModule",{value:!0});const Um=Mm;Dm.default=class{constructor(e,t){this._root=e,this._settings=t,this._reader=new Um.default(this._root,this._settings)}read(){return this._reader.read()}};var Hm={};Object.defineProperty(Hm,"__esModule",{value:!0});const Wm=p,Gm=bf;Hm.default=class{constructor(e={}){this._options=e,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,Wm.sep),this.fsScandirSettings=new Gm.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(e,t){return null!=e?e:t}},Object.defineProperty(gf,"__esModule",{value:!0}),gf.Settings=gf.walkStream=gf.walkSync=gf.walk=void 0;const Vm=vf,Km=Nm,Jm=Dm,Ym=Hm;function Zm(e={}){return e instanceof Ym.default?e:new Ym.default(e)}gf.Settings=Ym.default,gf.walk=function(e,t,n){"function"!=typeof t?new Vm.default(e,Zm(t)).read(n):new Vm.default(e,Zm()).read(t)},gf.walkSync=function(e,t){const n=Zm(t);return new Jm.default(e,n).read()},gf.walkStream=function(e,t){const n=Zm(t);return new Km.default(e,n).read()};var Xm={};Object.defineProperty(Xm,"__esModule",{value:!0});const Qm=p,eh=_f,th=qu;Xm.default=class{constructor(e){this._settings=e,this._fsStatSettings=new eh.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return Qm.resolve(this._settings.cwd,e)}_makeEntry(e,t){const n={name:t,path:t,dirent:th.fs.createDirentFromStats(t,e)};return this._settings.stats&&(n.stats=e),n}_isFatalError(e){return!th.errno.isEnoentCodeError(e)&&!this._settings.suppressErrors}};var nh={};Object.defineProperty(nh,"__esModule",{value:!0});const ih=v,rh=_f,oh=gf,sh=Xm;class ah extends sh.default{constructor(){super(...arguments),this._walkStream=oh.walkStream,this._stat=rh.stat}dynamic(e,t){return this._walkStream(e,t)}static(e,t){const n=e.map(this._getFullEntryPath,this),i=new ih.PassThrough({objectMode:!0});i._write=(r,o,s)=>this._getEntry(n[r],e[r],t).then((e=>{null!==e&&t.entryFilter(e)&&i.push(e),r===n.length-1&&i.end(),s()})).catch(s);for(let e=0;e<n.length;e++)i.write(e);return i}_getEntry(e,t,n){return this._getStat(e).then((e=>this._makeEntry(e,t))).catch((e=>{if(n.errorFilter(e))return null;throw e}))}_getStat(e){return new Promise(((t,n)=>{this._stat(e,this._fsStatSettings,((e,i)=>null===e?t(i):n(e)))}))}}nh.default=ah,Object.defineProperty(hf,"__esModule",{value:!0});const ch=gf,lh=Xm,uh=nh;class ph extends lh.default{constructor(){super(...arguments),this._walkAsync=ch.walk,this._readerStream=new uh.default(this._settings)}dynamic(e,t){return new Promise(((n,i)=>{this._walkAsync(e,t,((e,t)=>{null===e?n(t):i(e)}))}))}async static(e,t){const n=[],i=this._readerStream.static(e,t);return new Promise(((e,t)=>{i.once("error",t),i.on("data",(e=>n.push(e))),i.once("end",(()=>e(n)))}))}}hf.default=ph;var dh={},fh={},mh={},hh={};Object.defineProperty(hh,"__esModule",{value:!0});const gh=qu;hh.default=class{constructor(e,t,n){this._patterns=e,this._settings=t,this._micromatchOptions=n,this._storage=[],this._fillStorage()}_fillStorage(){for(const e of this._patterns){const t=this._getPatternSegments(e),n=this._splitSegmentsIntoSections(t);this._storage.push({complete:n.length<=1,pattern:e,segments:t,sections:n})}}_getPatternSegments(e){return gh.pattern.getPatternParts(e,this._micromatchOptions).map((e=>gh.pattern.isDynamicPattern(e,this._settings)?{dynamic:!0,pattern:e,patternRe:gh.pattern.makeRe(e,this._micromatchOptions)}:{dynamic:!1,pattern:e}))}_splitSegmentsIntoSections(e){return gh.array.splitWhen(e,(e=>e.dynamic&&gh.pattern.hasGlobStar(e.pattern)))}},Object.defineProperty(mh,"__esModule",{value:!0});const vh=hh;class xh extends vh.default{match(e){const t=e.split("/"),n=t.length,i=this._storage.filter((e=>!e.complete||e.segments.length>n));for(const e of i){const i=e.sections[0];if(!e.complete&&n>i.length)return!0;const r=t.every(((t,n)=>{const i=e.segments[n];return!(!i.dynamic||!i.patternRe.test(t))||!i.dynamic&&i.pattern===t}));if(r)return!0}return!1}}mh.default=xh,Object.defineProperty(fh,"__esModule",{value:!0});const bh=qu,yh=mh;fh.default=class{constructor(e,t){this._settings=e,this._micromatchOptions=t}getFilter(e,t,n){const i=this._getMatcher(t),r=this._getNegativePatternsRe(n);return t=>this._filter(e,t,i,r)}_getMatcher(e){return new yh.default(e,this._settings,this._micromatchOptions)}_getNegativePatternsRe(e){const t=e.filter(bh.pattern.isAffectDepthOfReadingPattern);return bh.pattern.convertPatternsToRe(t,this._micromatchOptions)}_filter(e,t,n,i){if(this._isSkippedByDeep(e,t.path))return!1;if(this._isSkippedSymbolicLink(t))return!1;const r=bh.path.removeLeadingDotSegment(t.path);return!this._isSkippedByPositivePatterns(r,n)&&this._isSkippedByNegativePatterns(r,i)}_isSkippedByDeep(e,t){return this._settings.deep!==1/0&&this._getEntryLevel(e,t)>=this._settings.deep}_getEntryLevel(e,t){const n=t.split("/").length;if(""===e)return n;return n-e.split("/").length}_isSkippedSymbolicLink(e){return!this._settings.followSymbolicLinks&&e.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(e,t){return!this._settings.baseNameMatch&&!t.match(e)}_isSkippedByNegativePatterns(e,t){return!bh.pattern.matchAny(e,t)}};var _h={};Object.defineProperty(_h,"__esModule",{value:!0});const wh=qu;_h.default=class{constructor(e,t){this._settings=e,this._micromatchOptions=t,this.index=new Map}getFilter(e,t){const n=wh.pattern.convertPatternsToRe(e,this._micromatchOptions),i=wh.pattern.convertPatternsToRe(t,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}));return e=>this._filter(e,n,i)}_filter(e,t,n){const i=wh.path.removeLeadingDotSegment(e.path);if(this._settings.unique&&this._isDuplicateEntry(i))return!1;if(this._onlyFileFilter(e)||this._onlyDirectoryFilter(e))return!1;if(this._isSkippedByAbsoluteNegativePatterns(i,n))return!1;const r=e.dirent.isDirectory(),o=this._isMatchToPatterns(i,t,r)&&!this._isMatchToPatterns(i,n,r);return this._settings.unique&&o&&this._createIndexRecord(i),o}_isDuplicateEntry(e){return this.index.has(e)}_createIndexRecord(e){this.index.set(e,void 0)}_onlyFileFilter(e){return this._settings.onlyFiles&&!e.dirent.isFile()}_onlyDirectoryFilter(e){return this._settings.onlyDirectories&&!e.dirent.isDirectory()}_isSkippedByAbsoluteNegativePatterns(e,t){if(!this._settings.absolute)return!1;const n=wh.path.makeAbsolute(this._settings.cwd,e);return wh.pattern.matchAny(n,t)}_isMatchToPatterns(e,t,n){const i=wh.pattern.matchAny(e,t);return!i&&n?wh.pattern.matchAny(e+"/",t):i}};var Eh={};Object.defineProperty(Eh,"__esModule",{value:!0});const Sh=qu;Eh.default=class{constructor(e){this._settings=e}getFilter(){return e=>this._isNonFatalError(e)}_isNonFatalError(e){return Sh.errno.isEnoentCodeError(e)||this._settings.suppressErrors}};var kh={};Object.defineProperty(kh,"__esModule",{value:!0});const Rh=qu;kh.default=class{constructor(e){this._settings=e}getTransformer(){return e=>this._transform(e)}_transform(e){let t=e.path;return this._settings.absolute&&(t=Rh.path.makeAbsolute(this._settings.cwd,t),t=Rh.path.unixify(t)),this._settings.markDirectories&&e.dirent.isDirectory()&&(t+="/"),this._settings.objectMode?Object.assign(Object.assign({},e),{path:t}):t}},Object.defineProperty(dh,"__esModule",{value:!0});const Th=p,Oh=fh,Ch=_h,Ah=Eh,Ph=kh;dh.default=class{constructor(e){this._settings=e,this.errorFilter=new Ah.default(this._settings),this.entryFilter=new Ch.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new Oh.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new Ph.default(this._settings)}_getRootDirectory(e){return Th.resolve(this._settings.cwd,e.base)}_getReaderOptions(e){const t="."===e.base?"":e.base;return{basePath:t,pathSegmentSeparator:"/",concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(t,e.positive,e.negative),entryFilter:this.entryFilter.getFilter(e.positive,e.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}},Object.defineProperty(mf,"__esModule",{value:!0});const jh=hf,Lh=dh;class Nh extends Lh.default{constructor(){super(...arguments),this._reader=new jh.default(this._settings)}async read(e){const t=this._getRootDirectory(e),n=this._getReaderOptions(e);return(await this.api(t,e,n)).map((e=>n.transform(e)))}api(e,t,n){return t.dynamic?this._reader.dynamic(e,n):this._reader.static(t.patterns,n)}}mf.default=Nh;var Ih={};Object.defineProperty(Ih,"__esModule",{value:!0});const $h=v,Dh=nh,Mh=dh;class Fh extends Mh.default{constructor(){super(...arguments),this._reader=new Dh.default(this._settings)}read(e){const t=this._getRootDirectory(e),n=this._getReaderOptions(e),i=this.api(t,e,n),r=new $h.Readable({objectMode:!0,read:()=>{}});return i.once("error",(e=>r.emit("error",e))).on("data",(e=>r.emit("data",n.transform(e)))).once("end",(()=>r.emit("end"))),r.once("close",(()=>i.destroy())),r}api(e,t,n){return t.dynamic?this._reader.dynamic(e,n):this._reader.static(t.patterns,n)}}Ih.default=Fh;var zh={},Bh={};Object.defineProperty(Bh,"__esModule",{value:!0});const qh=_f,Uh=gf,Hh=Xm;class Wh extends Hh.default{constructor(){super(...arguments),this._walkSync=Uh.walkSync,this._statSync=qh.statSync}dynamic(e,t){return this._walkSync(e,t)}static(e,t){const n=[];for(const i of e){const e=this._getFullEntryPath(i),r=this._getEntry(e,i,t);null!==r&&t.entryFilter(r)&&n.push(r)}return n}_getEntry(e,t,n){try{const n=this._getStat(e);return this._makeEntry(n,t)}catch(e){if(n.errorFilter(e))return null;throw e}}_getStat(e){return this._statSync(e,this._fsStatSettings)}}Bh.default=Wh,Object.defineProperty(zh,"__esModule",{value:!0});const Gh=Bh,Vh=dh;class Kh extends Vh.default{constructor(){super(...arguments),this._reader=new Gh.default(this._settings)}read(e){const t=this._getRootDirectory(e),n=this._getReaderOptions(e);return this.api(t,e,n).map(n.transform)}api(e,t,n){return t.dynamic?this._reader.dynamic(e,n):this._reader.static(t.patterns,n)}}zh.default=Kh;var Jh={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;const t=u,n=_,i=Math.max(n.cpus().length,1);e.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:t.lstat,lstatSync:t.lstatSync,stat:t.stat,statSync:t.statSync,readdir:t.readdir,readdirSync:t.readdirSync};e.default=class{constructor(e={}){this._options=e,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,i),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0),this.ignore=[].concat(this.ignore)}_getValue(e,t){return void 0===e?t:e}_getFileSystemMethods(t={}){return Object.assign(Object.assign({},e.DEFAULT_FILE_SYSTEM_ADAPTER),t)}}}(Jh);const Yh=Bu,Zh=mf,Xh=Ih,Qh=zh,eg=Jh,tg=qu;async function ng(e,t){rg(e);const n=ig(e,Zh.default,t),i=await Promise.all(n);return tg.array.flatten(i)}function ig(e,t,n){const i=[].concat(e),r=new eg.default(n),o=Yh.generate(i,r),s=new t(r);return o.map(s.read,s)}function rg(e){if(![].concat(e).every((e=>tg.string.isString(e)&&!tg.string.isEmpty(e))))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}!function(e){function t(e,t){rg(e);const n=ig(e,Qh.default,t);return tg.array.flatten(n)}function n(e,t){rg(e);const n=ig(e,Xh.default,t);return tg.stream.merge(n)}var i,r;e.glob=e,e.globSync=t,e.globStream=n,e.async=e,e.sync=t,e.stream=n,e.generateTasks=function(e,t){rg(e);const n=[].concat(e),i=new eg.default(t);return Yh.generate(n,i)},e.isDynamicPattern=function(e,t){rg(e);const n=new eg.default(t);return tg.pattern.isDynamicPattern(e,n)},e.escapePath=function(e){return rg(e),tg.path.escape(e)},e.convertPathToPattern=function(e){return rg(e),tg.path.convertPathToPattern(e)},(i=e.posix||(e.posix={})).escapePath=function(e){return rg(e),tg.path.escapePosixPath(e)},i.convertPathToPattern=function(e){return rg(e),tg.path.convertPosixPathToPattern(e)},(r=e.win32||(e.win32={})).escapePath=function(e){return rg(e),tg.path.escapeWindowsPath(e)},r.convertPathToPattern=function(e){return rg(e),tg.path.convertWindowsPathToPattern(e)}}(ng||(ng={}));var og={exports:{}},sg={};const{promisify:ag}=b,cg=u;async function lg(e,t,n){if("string"!=typeof n)throw new TypeError("Expected a string, got "+typeof n);try{return(await ag(cg[e])(n))[t]()}catch(e){if("ENOENT"===e.code)return!1;throw e}}function ug(e,t,n){if("string"!=typeof n)throw new TypeError("Expected a string, got "+typeof n);try{return cg[e](n)[t]()}catch(e){if("ENOENT"===e.code)return!1;throw e}}sg.isFile=lg.bind(null,"stat","isFile"),sg.isDirectory=lg.bind(null,"stat","isDirectory"),sg.isSymlink=lg.bind(null,"lstat","isSymbolicLink"),sg.isFileSync=ug.bind(null,"statSync","isFile"),sg.isDirectorySync=ug.bind(null,"statSync","isDirectory"),sg.isSymlinkSync=ug.bind(null,"lstatSync","isSymbolicLink");const pg=p,dg=sg,fg=e=>e.length>1?`{${e.join(",")}}`:e[0],mg=(e,t)=>{const n="!"===e[0]?e.slice(1):e;return pg.isAbsolute(n)?n:pg.join(t,n)},hg=(e,t)=>{if(t.files&&!Array.isArray(t.files))throw new TypeError(`Expected \`files\` to be of type \`Array\` but received type \`${typeof t.files}\``);if(t.extensions&&!Array.isArray(t.extensions))throw new TypeError(`Expected \`extensions\` to be of type \`Array\` but received type \`${typeof t.extensions}\``);return t.files&&t.extensions?t.files.map((n=>pg.posix.join(e,((e,t)=>pg.extname(e)?`**/${e}`:`**/${e}.${fg(t)}`)(n,t.extensions)))):t.files?t.files.map((t=>pg.posix.join(e,`**/${t}`))):t.extensions?[pg.posix.join(e,`**/*.${fg(t.extensions)}`)]:[pg.posix.join(e,"**")]};function gg(e){return Array.isArray(e)?e:[e]}og.exports=async(e,t)=>{if("string"!=typeof(t={cwd:process.cwd(),...t}).cwd)throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof t.cwd}\``);const n=await Promise.all([].concat(e).map((async e=>await dg.isDirectory(mg(e,t.cwd))?hg(e,t):e)));return[].concat.apply([],n)},og.exports.sync=(e,t)=>{if("string"!=typeof(t={cwd:process.cwd(),...t}).cwd)throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof t.cwd}\``);const n=[].concat(e).map((e=>dg.isDirectorySync(mg(e,t.cwd))?hg(e,t):e));return[].concat.apply([],n)};const vg=/^\s+$/,xg=/(?:[^\\]|^)\\$/,bg=/^\\!/,yg=/^\\#/,_g=/\r?\n/g,wg=/^\.*\/|^\.+$/;let Eg="node-ignore";"undefined"!=typeof Symbol&&(Eg=Symbol.for("node-ignore"));const Sg=Eg,kg=/([0-z])-([0-z])/g,Rg=()=>!1,Tg=[[/^\uFEFF/,()=>""],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(0===n.indexOf("\\")?" ":"")],[/(\\+?)\s/g,(e,t)=>{const{length:n}=t;return t.slice(0,n-n%2)+" "}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,"[^\\/]*")],[/\\\\\\(?=[$.|*+(){^])/g,()=>"\\"],[/\\\\/g,()=>"\\"],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,i,r)=>"\\"===t?`\\[${n}${(e=>{const{length:t}=e;return e.slice(0,t-t%2)})(i)}${r}`:"]"===r&&i.length%2==0?`[${(e=>e.replace(kg,((e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:"")))(n)}${i}]`:"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:"[^/]*"}(?=$|\\/$)`]],Og=Object.create(null),Cg=e=>"string"==typeof e;class Ag{constructor(e,t,n,i){this.origin=e,this.pattern=t,this.negative=n,this.regex=i}}const Pg=(e,t)=>{const n=e;let i=!1;0===e.indexOf("!")&&(i=!0,e=e.substr(1));const r=((e,t)=>{let n=Og[e];return n||(n=Tg.reduce(((t,[n,i])=>t.replace(n,i.bind(e))),e),Og[e]=n),t?new RegExp(n,"i"):new RegExp(n)})(e=e.replace(bg,"!").replace(yg,"#"),t);return new Ag(n,e,i,r)},jg=(e,t)=>{throw new t(e)},Lg=(e,t,n)=>{if(!Cg(e))return n(`path must be a string, but got \`${t}\``,TypeError);if(!e)return n("path must not be empty",TypeError);if(Lg.isNotRelative(e)){return n(`path should be a ${"`path.relative()`d"} string, but got "${t}"`,RangeError)}return!0},Ng=e=>wg.test(e);Lg.isNotRelative=Ng,Lg.convert=e=>e;class Ig{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){var i,r,o;i=this,r=Sg,o=!0,Object.defineProperty(i,r,{value:o}),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[Sg])return this._rules=this._rules.concat(e._rules),void(this._added=!0);if((e=>e&&Cg(e)&&!vg.test(e)&&!xg.test(e)&&0!==e.indexOf("#"))(e)){const t=Pg(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,gg(Cg(e)?(e=>e.split(_g))(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let n=!1,i=!1;return this._rules.forEach((r=>{const{negative:o}=r;if(i===o&&n!==i||o&&!n&&!i&&!t)return;r.regex.test(e)&&(n=!o,i=o)})),{ignored:n,unignored:i}}_test(e,t,n,i){const r=e&&Lg.convert(e);return Lg(r,e,this._allowRelativePaths?Rg:jg),this._t(r,t,n,i)}_t(e,t,n,i){if(e in t)return t[e];if(i||(i=e.split("/")),i.pop(),!i.length)return t[e]=this._testOne(e,n);const r=this._t(i.join("/")+"/",t,n,i);return t[e]=r.ignored?r:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return gg(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}}const $g=e=>new Ig(e);if($g.isPathValid=e=>Lg(e&&Lg.convert(e),e,Rg),$g.default=$g,"undefined"!=typeof process&&(process.env&&process.env.IGNORE_TEST_WIN32||"win32"===process.platform)){const e=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,"/");Lg.convert=e;const t=/^[a-z]:\//i;Lg.isNotRelative=e=>t.test(e)||Ng(e)}const Dg=[{id:"bat",extensions:[".bat",".cmd"]},{id:"clojure",extensions:[".clj",".cljs",".cljc",".cljx",".clojure",".edn"]},{id:"coffeescript",extensions:[".coffee",".cson",".iced"]},{id:"jsonc",extensions:[".code-workspace","language-configuration.json","icon-theme.json","color-theme.json"],names:["settings.json","launch.json","tasks.json","keybindings.json","extensions.json","argv.json","profiles.json","devcontainer.json",".devcontainer.json"]},{id:"json",extensions:[".code-profile"]},{id:"c",extensions:[".c",".i"]},{id:"cpp",extensions:[".cpp",".cc",".cxx",".c++",".hpp",".hh",".hxx",".h++",".h",".ii",".ino",".inl",".ipp",".ixx",".tpp",".txx",".hpp.in",".h.in"]},{id:"cuda-cpp",extensions:[".cu",".cuh"]},{id:"csharp",extensions:[".cs",".csx",".cake"]},{id:"css",extensions:[".css"],mimeTypes:["text/css"]},{id:"dart",extensions:[".dart"]},{id:"diff",extensions:[".diff",".patch",".rej"]},{id:"dockerfile",extensions:[".dockerfile",".containerfile"],patterns:["Dockerfile.*","Containerfile.*"],names:["Dockerfile","Containerfile"]},{id:"ignore",names:[".vscodeignore"]},{id:"fsharp",extensions:[".fs",".fsi",".fsx",".fsscript"]},{id:"git-commit",names:["COMMIT_EDITMSG","MERGE_MSG"]},{id:"git-rebase",patterns:["**/rebase-merge/done"],names:["git-rebase-todo"]},{id:"ignore",extensions:[".gitignore_global",".gitignore",".git-blame-ignore-revs"]},{id:"go",extensions:[".go"]},{id:"groovy",extensions:[".groovy",".gvy",".gradle",".jenkinsfile",".nf"],firstLine:"^#!.*\\bgroovy\\b",patterns:["Jenkinsfile*"],names:["Jenkinsfile"]},{id:"handlebars",extensions:[".handlebars",".hbs",".hjs"],mimeTypes:["text/x-handlebars-template"]},{id:"hlsl",extensions:[".hlsl",".hlsli",".fx",".fxh",".vsh",".psh",".cginc",".compute"]},{id:"html",extensions:[".html",".htm",".shtml",".xhtml",".xht",".mdoc",".jsp",".asp",".aspx",".jshtm",".volt",".ejs",".rhtml"],mimeTypes:["text/html","text/x-jshtm","text/template","text/ng-template","application/xhtml+xml"]},{id:"ini",extensions:[".ini"]},{id:"properties",extensions:[".conf",".properties",".cfg",".directory",".gitattributes",".gitconfig",".gitmodules",".editorconfig",".repo"],patterns:["**/.config/git/config","**/.git/config"],names:["gitconfig",".env"]},{id:"java",extensions:[".java",".jav"]},{id:"javascriptreact",extensions:[".jsx"]},{id:"javascript",extensions:[".js",".es6",".mjs",".cjs",".pac"],firstLine:"^#!.*\\bnode",names:["jakefile"],mimeTypes:["text/javascript"]},{id:"jsx-tags"},{id:"json",extensions:[".json",".bowerrc",".jscsrc",".webmanifest",".js.map",".css.map",".ts.map",".har",".jslintrc",".jsonld",".geojson",".ipynb",".vuerc"],names:["composer.lock",".watchmanconfig"],mimeTypes:["application/json","application/manifest+json"]},{id:"jsonc",extensions:[".jsonc",".eslintrc",".eslintrc.json",".jsfmtrc",".jshintrc",".swcrc",".hintrc",".babelrc"],names:["babel.config.json",".babelrc.json",".ember-cli","typedoc.json"]},{id:"jsonl",extensions:[".jsonl"],names:[]},{id:"snippets",extensions:[".code-snippets"],patterns:["**/User/snippets/*.json","**/User/profiles/*/snippets/*.json"]},{id:"julia",extensions:[".jl"],firstLine:"^#!\\s*/.*\\bjulia[0-9.-]*\\b"},{id:"juliamarkdown",extensions:[".jmd"]},{id:"tex",extensions:[".sty",".cls",".bbx",".cbx"]},{id:"latex",extensions:[".tex",".ltx",".ctx"]},{id:"bibtex",extensions:[".bib"]},{id:"cpp_embedded_latex"},{id:"markdown_latex_combined"},{id:"less",extensions:[".less"],mimeTypes:["text/x-less","text/less"]},{id:"log",extensions:[".log","*.log.?"]},{id:"lua",extensions:[".lua"]},{id:"makefile",extensions:[".mak",".mk"],firstLine:"^#!\\s*/usr/bin/make",names:["Makefile","makefile","GNUmakefile","OCamlMakefile"]},{id:"markdown",extensions:[".md",".mkd",".mdwn",".mdown",".markdown",".markdn",".mdtxt",".mdtext",".workbook"]},{id:"markdown-math"},{id:"ignore",extensions:[".npmignore"]},{id:"properties",extensions:[".npmrc"]},{id:"objective-c",extensions:[".m"]},{id:"objective-cpp",extensions:[".mm"]},{id:"perl",extensions:[".pl",".pm",".pod",".t",".PL",".psgi"],firstLine:"^#!.*\\bperl\\b"},{id:"raku",extensions:[".raku",".rakumod",".rakutest",".rakudoc",".nqp",".p6",".pl6",".pm6"],firstLine:"(^#!.*\\bperl6\\b)|use\\s+v6|raku|=begin\\spod|my\\sclass"},{id:"php",extensions:[".php",".php4",".php5",".phtml",".ctp"],firstLine:"^#!\\s*/.*\\bphp\\b",mimeTypes:["application/x-php"]},{id:"powershell",extensions:[".ps1",".psm1",".psd1",".pssc",".psrc"],firstLine:"^#!\\s*/.*\\bpwsh\\b"},{id:"jade",extensions:[".pug",".jade"]},{id:"python",extensions:[".py",".rpy",".pyw",".cpy",".gyp",".gypi",".pyi",".ipy",".pyt"],firstLine:"^#!\\s*/?.*\\bpython[0-9.-]*\\b",names:["SConstruct","SConscript"]},{id:"r",extensions:[".r",".rhistory",".rprofile",".rt"]},{id:"razor",extensions:[".cshtml",".razor"],mimeTypes:["text/x-cshtml"]},{id:"restructuredtext",extensions:[".rst"]},{id:"ruby",extensions:[".rb",".rbx",".rjs",".gemspec",".rake",".ru",".erb",".podspec",".rbi"],firstLine:"^#!\\s*/.*\\bruby\\b",names:["rakefile","gemfile","guardfile","podfile","capfile","cheffile","hobofile","vagrantfile","appraisals","rantfile","berksfile","berksfile.lock","thorfile","puppetfile","dangerfile","brewfile","fastfile","appfile","deliverfile","matchfile","scanfile","snapfile","gymfile"]},{id:"rust",extensions:[".rs"]},{id:"scss",extensions:[".scss"],mimeTypes:["text/x-scss","text/scss"]},{id:"search-result",extensions:[".code-search"]},{id:"shaderlab",extensions:[".shader"]},{id:"shellscript",extensions:[".sh",".bash",".bashrc",".bash_aliases",".bash_profile",".bash_login",".ebuild",".profile",".bash_logout",".xprofile",".xsession",".xsessionrc",".Xsession",".zsh",".zshrc",".zprofile",".zlogin",".zlogout",".zshenv",".zsh-theme",".fish",".ksh",".csh",".cshrc",".tcshrc",".yashrc",".yash_profile"],firstLine:"^#!.*\\b(bash|fish|zsh|sh|ksh|dtksh|pdksh|mksh|ash|dash|yash|sh|csh|jcsh|tcsh|itcsh).*|^#\\s*-\\*-[^*]*mode:\\s*shell-script[^*]*-\\*-",patterns:[".env.*"],names:["APKBUILD","PKGBUILD",".envrc",".hushlogin","zshrc","zshenv","zlogin","zprofile","zlogout","bashrc_Apple_Terminal","zshrc_Apple_Terminal"],mimeTypes:["text/x-shellscript"]},{id:"sql",extensions:[".sql",".dsql"]},{id:"swift",extensions:[".swift"]},{id:"typescript",extensions:[".ts",".cts",".mts"]},{id:"typescriptreact",extensions:[".tsx"]},{id:"jsonc",patterns:["tsconfig.*.json","jsconfig.*.json","tsconfig-*.json","jsconfig-*.json"],names:["tsconfig.json","jsconfig.json"]},{id:"json",extensions:[".tsbuildinfo"]},{id:"vb",extensions:[".vb",".brs",".vbs",".bas",".vba"]},{id:"xml",extensions:[".xml",".xsd",".ascx",".atom",".axml",".axaml",".bpmn",".cpt",".csl",".csproj",".csproj.user",".dita",".ditamap",".dtd",".ent",".mod",".dtml",".fsproj",".fxml",".iml",".isml",".jmx",".launch",".menu",".mxml",".nuspec",".opml",".owl",".proj",".props",".pt",".publishsettings",".pubxml",".pubxml.user",".rbxlx",".rbxmx",".rdf",".rng",".rss",".shproj",".storyboard",".svg",".targets",".tld",".tmx",".vbproj",".vbproj.user",".vcxproj",".vcxproj.filters",".wsdl",".wxi",".wxl",".wxs",".xaml",".xbl",".xib",".xlf",".xliff",".xpdl",".xul",".xoml"],firstLine:"(\\<\\?xml.*)|(\\<svg)|(\\<\\!doctype\\s+svg)"},{id:"xsl",extensions:[".xsl",".xslt"]},{id:"dockercompose",patterns:["compose.yml","compose.yaml","compose.*.yml","compose.*.yaml","*docker*compose*.yml","*docker*compose*.yaml"]},{id:"yaml",extensions:[".yml",".eyaml",".eyml",".yaml",".cff",".yaml-tmlanguage",".yaml-tmpreferences",".yaml-tmtheme"],firstLine:"^#cloud-config"}];class Mg{static default=new Mg;entries=[];static{for(const e of Dg)Mg.default.registerLanguage(e.id,e)}registerLanguage(e,t){const n=(e=>{const{extensions:t,names:n,patterns:r,firstLine:o}=e,s=o?new RegExp(o):null,a=r?$u(r.map((e=>e.includes("/")?`**/${e}`:e))):null;return(e,r)=>!!(t&&t.includes(i.extname(e))||n&&n.includes(e)||a&&a(e)||s&&s.test(r))})(t);this.entries.push({id:e,detect:n})}detect(e,t){const n=t.indexOf("\n"),i=-1===n?t:t.slice(0,n),r=this.entries.find((t=>t.detect(e,i.trim())));return r?.id??null}}function Fg(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let zg={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function Bg(e){zg=e}const qg=/[&<>"']/,Ug=new RegExp(qg.source,"g"),Hg=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Wg=new RegExp(Hg.source,"g"),Gg={"&":"&","<":"<",">":">",'"':""","'":"'"},Vg=e=>Gg[e];function Kg(e,t){if(t){if(qg.test(e))return e.replace(Ug,Vg)}else if(Hg.test(e))return e.replace(Wg,Vg);return e}const Jg=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function Yg(e){return e.replace(Jg,((e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const Zg=/(^|[^\[])\^/g;function Xg(e,t){let n="string"==typeof e?e:e.source;t=t||"";const i={replace:(e,t)=>{let r="string"==typeof t?t:t.source;return r=r.replace(Zg,"$1"),n=n.replace(e,r),i},getRegex:()=>new RegExp(n,t)};return i}function Qg(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const ev={exec:()=>null};function tv(e,t){const n=e.replace(/\|/g,((e,t,n)=>{let i=!1,r=t;for(;--r>=0&&"\\"===n[r];)i=!i;return i?"|":" |"})),i=n.split(/ \|/);let r=0;if(i[0].trim()||i.shift(),i.length>0&&!i[i.length-1].trim()&&i.pop(),t)if(i.length>t)i.splice(t);else for(;i.length<t;)i.push("");for(;r<i.length;r++)i[r]=i[r].trim().replace(/\\\|/g,"|");return i}function nv(e,t,n){const i=e.length;if(0===i)return"";let r=0;for(;r<i;){if(e.charAt(i-r-1)!==t)break;r++}return e.slice(0,i-r)}function iv(e,t,n,i){const r=t.href,o=t.title?Kg(t.title):null,s=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){i.state.inLink=!0;const e={type:"link",raw:n,href:r,title:o,text:s,tokens:i.inlineTokens(s)};return i.state.inLink=!1,e}return{type:"image",raw:n,href:r,title:o,text:Kg(s)}}class rv{options;rules;lexer;constructor(e){this.options=e||zg}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:nv(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t){const n=e.match(/^(\s+)(?:```)/);if(null===n)return t;const i=n[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[n]=t;return n.length>=i.length?e.slice(i.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=nv(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const e=nv(t[0].replace(/^ *>[ \t]?/gm,""),"\n"),n=this.lexer.state.top;this.lexer.state.top=!0;const i=this.lexer.blockTokens(e);return this.lexer.state.top=n,{type:"blockquote",raw:t[0],tokens:i,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const i=n.length>1,r={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");const o=new RegExp(`^( {0,3}${n})((?:[\t ][^\\n]*)?(?:\\n|$))`);let s="",a="",c=!1;for(;e;){let n=!1;if(!(t=o.exec(e)))break;if(this.rules.block.hr.test(e))break;s=t[0],e=e.substring(s.length);let i=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),l=e.split("\n",1)[0],u=0;this.options.pedantic?(u=2,a=i.trimStart()):(u=t[2].search(/[^ ]/),u=u>4?1:u,a=i.slice(u),u+=t[1].length);let p=!1;if(!i&&/^ *$/.test(l)&&(s+=l+"\n",e=e.substring(l.length+1),n=!0),!n){const t=new RegExp(`^ {0,${Math.min(3,u-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),n=new RegExp(`^ {0,${Math.min(3,u-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),r=new RegExp(`^ {0,${Math.min(3,u-1)}}(?:\`\`\`|~~~)`),o=new RegExp(`^ {0,${Math.min(3,u-1)}}#`);for(;e;){const c=e.split("\n",1)[0];if(l=c,this.options.pedantic&&(l=l.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),r.test(l))break;if(o.test(l))break;if(t.test(l))break;if(n.test(e))break;if(l.search(/[^ ]/)>=u||!l.trim())a+="\n"+l.slice(u);else{if(p)break;if(i.search(/[^ ]/)>=4)break;if(r.test(i))break;if(o.test(i))break;if(n.test(i))break;a+="\n"+l}p||l.trim()||(p=!0),s+=c+"\n",e=e.substring(c.length+1),i=l.slice(u)}}r.loose||(c?r.loose=!0:/\n *\n *$/.test(s)&&(c=!0));let d,f=null;this.options.gfm&&(f=/^\[[ xX]\] /.exec(a),f&&(d="[ ] "!==f[0],a=a.replace(/^\[[ xX]\] +/,""))),r.items.push({type:"list_item",raw:s,task:!!f,checked:d,loose:!1,text:a,tokens:[]}),r.raw+=s}r.items[r.items.length-1].raw=s.trimEnd(),r.items[r.items.length-1].text=a.trimEnd(),r.raw=r.raw.trimEnd();for(let e=0;e<r.items.length;e++)if(this.lexer.state.top=!1,r.items[e].tokens=this.lexer.blockTokens(r.items[e].text,[]),!r.loose){const t=r.items[e].tokens.filter((e=>"space"===e.type)),n=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));r.loose=n}if(r.loose)for(let e=0;e<r.items.length;e++)r.items[e].loose=!0;return r}}html(e){const t=this.rules.block.html.exec(e);if(t){return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}}def(e){const t=this.rules.block.def.exec(e);if(t){const e=t[1].toLowerCase().replace(/\s+/g," "),n=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:i}}}table(e){const t=this.rules.block.table.exec(e);if(!t)return;if(!/[:|]/.test(t[2]))return;const n=tv(t[1]),i=t[2].replace(/^\||\| *$/g,"").split("|"),r=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(const e of i)/^ *-+: *$/.test(e)?o.align.push("right"):/^ *:-+: *$/.test(e)?o.align.push("center"):/^ *:-+ *$/.test(e)?o.align.push("left"):o.align.push(null);for(const e of n)o.header.push({text:e,tokens:this.lexer.inline(e)});for(const e of r)o.rows.push(tv(e,o.header.length).map((e=>({text:e,tokens:this.lexer.inline(e)}))));return o}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:Kg(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const t=nv(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let i=0;i<e.length;i++)if("\\"===e[i])i++;else if(e[i]===t[0])n++;else if(e[i]===t[1]&&(n--,n<0))return i;return-1}(t[2],"()");if(e>-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],i="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],i=e[3])}else i=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^</.test(n)&&(n=this.options.pedantic&&!/>$/.test(e)?n.slice(1):n.slice(1,-1)),iv(t,{href:n?n.replace(this.rules.inline.anyPunctuation,"$1"):n,title:i?i.replace(this.rules.inline.anyPunctuation,"$1"):i},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const e=t[(n[2]||n[1]).replace(/\s+/g," ").toLowerCase()];if(!e){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return iv(n,e,n[0],this.lexer)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!i)return;if(i[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(i[1]||i[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const n=[...i[0]].length-1;let r,o,s=n,a=0;const c="*"===i[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);null!=(i=c.exec(t));){if(r=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!r)continue;if(o=[...r].length,i[3]||i[4]){s+=o;continue}if((i[5]||i[6])&&n%3&&!((n+o)%3)){a+=o;continue}if(s-=o,s>0)continue;o=Math.min(o,o+s+a);const t=[...i[0]][0].length,c=e.slice(0,n+i.index+t+o);if(Math.min(n,o)%2){const e=c.slice(1,-1);return{type:"em",raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}const l=c.slice(2,-2);return{type:"strong",raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const n=/[^ ]/.test(e),i=/^ /.test(e)&&/ $/.test(e);return n&&i&&(e=e.substring(1,e.length-1)),e=Kg(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=Kg(t[1]),n="mailto:"+e):(e=Kg(t[1]),n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=Kg(t[0]),n="mailto:"+e;else{let i;do{i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(i!==t[0]);e=Kg(t[0]),n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:Kg(t[0]),{type:"text",raw:t[0],text:e}}}}const ov=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,sv=/(?:[*+-]|\d{1,9}[.)])/,av=Xg(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,sv).getRegex(),cv=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,lv=/(?!\s*\])(?:\\.|[^\[\]\\])+/,uv=Xg(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",lv).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),pv=Xg(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,sv).getRegex(),dv="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",fv=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,mv=Xg("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",fv).replace("tag",dv).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),hv=Xg(cv).replace("hr",ov).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",dv).getRegex(),gv={blockquote:Xg(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",hv).getRegex(),code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,def:uv,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:ov,html:mv,lheading:av,list:pv,newline:/^(?: *(?:\n|$))+/,paragraph:hv,table:ev,text:/^[^\n]+/},vv=Xg("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ov).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",dv).getRegex(),xv={...gv,table:vv,paragraph:Xg(cv).replace("hr",ov).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",vv).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",dv).getRegex()},bv={...gv,html:Xg("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",fv).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ev,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Xg(cv).replace("hr",ov).replace("heading"," *#{1,6} *[^\n]").replace("lheading",av).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},yv=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,_v=/^( {2,}|\\)\n(?!\s*$)/,wv="\\p{P}$+<=>`^|~",Ev=Xg(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,wv).getRegex(),Sv=Xg(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,wv).getRegex(),kv=Xg("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,wv).getRegex(),Rv=Xg("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,wv).getRegex(),Tv=Xg(/\\([punct])/,"gu").replace(/punct/g,wv).getRegex(),Ov=Xg(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Cv=Xg(fv).replace("(?:--\x3e|$)","--\x3e").getRegex(),Av=Xg("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Cv).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Pv=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,jv=Xg(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Pv).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Lv=Xg(/^!?\[(label)\]\[(ref)\]/).replace("label",Pv).replace("ref",lv).getRegex(),Nv=Xg(/^!?\[(ref)\](?:\[\])?/).replace("ref",lv).getRegex(),Iv={_backpedal:ev,anyPunctuation:Tv,autolink:Ov,blockSkip:/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,br:_v,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:ev,emStrongLDelim:Sv,emStrongRDelimAst:kv,emStrongRDelimUnd:Rv,escape:yv,link:jv,nolink:Nv,punctuation:Ev,reflink:Lv,reflinkSearch:Xg("reflink|nolink(?!\\()","g").replace("reflink",Lv).replace("nolink",Nv).getRegex(),tag:Av,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:ev},$v={...Iv,link:Xg(/^!?\[(label)\]\((.*?)\)/).replace("label",Pv).getRegex(),reflink:Xg(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Pv).getRegex()},Dv={...Iv,escape:Xg(yv).replace("])","~|])").getRegex(),url:Xg(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Mv={...Dv,br:Xg(_v).replace("{2,}","*").getRegex(),text:Xg(Dv.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Fv={normal:gv,gfm:xv,pedantic:bv},zv={normal:Iv,gfm:Dv,breaks:Mv,pedantic:$v};class Bv{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||zg,this.options.tokenizer=this.options.tokenizer||new rv,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:Fv.normal,inline:zv.normal};this.options.pedantic?(t.block=Fv.pedantic,t.inline=zv.pedantic):this.options.gfm&&(t.block=Fv.gfm,this.options.breaks?t.inline=zv.breaks:t.inline=zv.gfm),this.tokenizer.rules=t}static get rules(){return{block:Fv,inline:zv}}static lex(e,t){return new Bv(t).lex(e)}static lexInline(e,t){return new Bv(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){const t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[]){let n,i,r,o;for(e=this.options.pedantic?e.replace(/\t/g," ").replace(/^ +$/gm,""):e.replace(/^( *)(\t+)/gm,((e,t,n)=>t+" ".repeat(n.length)));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((i=>!!(n=i.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),1===n.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),i=t[t.length-1],!i||"paragraph"!==i.type&&"text"!==i.type?t.push(n):(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(e))e=e.substring(n.raw.length),i=t[t.length-1],!i||"paragraph"!==i.type&&"text"!==i.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(i.raw+="\n"+n.raw,i.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text);else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else{if(r=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const n=e.slice(1);let i;this.options.extensions.startBlock.forEach((e=>{i=e.call({lexer:this},n),"number"==typeof i&&i>=0&&(t=Math.min(t,i))})),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(r)))i=t[t.length-1],o&&"paragraph"===i.type?(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n),o=r.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),i=t[t.length-1],i&&"text"===i.type?(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,i,r,o,s,a,c=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(o=this.tokenizer.rules.inline.reflinkSearch.exec(c));)e.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(c=c.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+c.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(o=this.tokenizer.rules.inline.blockSkip.exec(c));)c=c.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+c.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(o=this.tokenizer.rules.inline.anyPunctuation.exec(c));)c=c.slice(0,o.index)+"++"+c.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(s||(a=""),s=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((i=>!!(n=i.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.escape(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(e))e=e.substring(n.raw.length),i=t[t.length-1],i&&"text"===n.type&&"text"===i.type?(i.raw+=n.raw,i.text+=n.text):t.push(n);else if(n=this.tokenizer.link(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(n.raw.length),i=t[t.length-1],i&&"text"===n.type&&"text"===i.type?(i.raw+=n.raw,i.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(e,c,a))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(e))e=e.substring(n.raw.length),t.push(n);else if(this.state.inLink||!(n=this.tokenizer.url(e))){if(r=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const n=e.slice(1);let i;this.options.extensions.startInline.forEach((e=>{i=e.call({lexer:this},n),"number"==typeof i&&i>=0&&(t=Math.min(t,i))})),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(r))e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(a=n.raw.slice(-1)),s=!0,i=t[t.length-1],i&&"text"===i.type?(i.raw+=n.raw,i.text+=n.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(n.raw.length),t.push(n);return t}}class qv{options;constructor(e){this.options=e||zg}code(e,t,n){const i=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+"\n",i?'<pre><code class="language-'+Kg(i)+'">'+(n?e:Kg(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:Kg(e,!0))+"</code></pre>\n"}blockquote(e){return`<blockquote>\n${e}</blockquote>\n`}html(e,t){return e}heading(e,t,n){return`<h${t}>${e}</h${t}>\n`}hr(){return"<hr>\n"}list(e,t,n){const i=t?"ol":"ul";return"<"+i+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+i+">\n"}listitem(e,t,n){return`<li>${e}</li>\n`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>\n`}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"}tablerow(e){return`<tr>\n${e}</tr>\n`}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>\n`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){const i=Qg(e);if(null===i)return n;let r='<a href="'+(e=i)+'"';return t&&(r+=' title="'+t+'"'),r+=">"+n+"</a>",r}image(e,t,n){const i=Qg(e);if(null===i)return n;let r=`<img src="${e=i}" alt="${n}"`;return t&&(r+=` title="${t}"`),r+=">",r}text(e){return e}}class Uv{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class Hv{options;renderer;textRenderer;constructor(e){this.options=e||zg,this.options.renderer=this.options.renderer||new qv,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Uv}static parse(e,t){return new Hv(t).parse(e)}static parseInline(e,t){return new Hv(t).parseInline(e)}parse(e,t=!0){let n="";for(let i=0;i<e.length;i++){const r=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const e=r,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(e.type)){n+=t||"";continue}}switch(r.type){case"space":continue;case"hr":n+=this.renderer.hr();continue;case"heading":{const e=r;n+=this.renderer.heading(this.parseInline(e.tokens),e.depth,Yg(this.parseInline(e.tokens,this.textRenderer)));continue}case"code":{const e=r;n+=this.renderer.code(e.text,e.lang,!!e.escaped);continue}case"table":{const e=r;let t="",i="";for(let t=0;t<e.header.length;t++)i+=this.renderer.tablecell(this.parseInline(e.header[t].tokens),{header:!0,align:e.align[t]});t+=this.renderer.tablerow(i);let o="";for(let t=0;t<e.rows.length;t++){const n=e.rows[t];i="";for(let t=0;t<n.length;t++)i+=this.renderer.tablecell(this.parseInline(n[t].tokens),{header:!1,align:e.align[t]});o+=this.renderer.tablerow(i)}n+=this.renderer.table(t,o);continue}case"blockquote":{const e=r,t=this.parse(e.tokens);n+=this.renderer.blockquote(t);continue}case"list":{const e=r,t=e.ordered,i=e.start,o=e.loose;let s="";for(let t=0;t<e.items.length;t++){const n=e.items[t],i=n.checked,r=n.task;let a="";if(n.task){const e=this.renderer.checkbox(!!i);o?n.tokens.length>0&&"paragraph"===n.tokens[0].type?(n.tokens[0].text=e+" "+n.tokens[0].text,n.tokens[0].tokens&&n.tokens[0].tokens.length>0&&"text"===n.tokens[0].tokens[0].type&&(n.tokens[0].tokens[0].text=e+" "+n.tokens[0].tokens[0].text)):n.tokens.unshift({type:"text",text:e+" "}):a+=e+" "}a+=this.parse(n.tokens,o),s+=this.renderer.listitem(a,r,!!i)}n+=this.renderer.list(s,t,i);continue}case"html":{const e=r;n+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=r;n+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let o=r,s=o.tokens?this.parseInline(o.tokens):o.text;for(;i+1<e.length&&"text"===e[i+1].type;)o=e[++i],s+="\n"+(o.tokens?this.parseInline(o.tokens):o.text);n+=t?this.renderer.paragraph(s):s;continue}default:{const e='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let i=0;i<e.length;i++){const r=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const e=this.options.extensions.renderers[r.type].call({parser:this},r);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){n+=e||"";continue}}switch(r.type){case"escape":{const e=r;n+=t.text(e.text);break}case"html":{const e=r;n+=t.html(e.text);break}case"link":{const e=r;n+=t.link(e.href,e.title,this.parseInline(e.tokens,t));break}case"image":{const e=r;n+=t.image(e.href,e.title,e.text);break}case"strong":{const e=r;n+=t.strong(this.parseInline(e.tokens,t));break}case"em":{const e=r;n+=t.em(this.parseInline(e.tokens,t));break}case"codespan":{const e=r;n+=t.codespan(e.text);break}case"br":n+=t.br();break;case"del":{const e=r;n+=t.del(this.parseInline(e.tokens,t));break}case"text":{const e=r;n+=t.text(e.text);break}default:{const e='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}}class Wv{options;constructor(e){this.options=e||zg}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}const Gv=new class{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.#e(Bv.lex,Hv.parse);parseInline=this.#e(Bv.lexInline,Hv.parseInline);Parser=Hv;Renderer=qv;TextRenderer=Uv;Lexer=Bv;Tokenizer=rv;Hooks=Wv;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(const i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{const e=i;for(const i of e.header)n=n.concat(this.walkTokens(i.tokens,t));for(const i of e.rows)for(const e of i)n=n.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=i;n=n.concat(this.walkTokens(e.items,t));break}default:{const e=i;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach((i=>{const r=e[i].flat(1/0);n=n.concat(this.walkTokens(r,t))})):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let i=e.renderer.apply(this,t);return!1===i&&(i=n.apply(this,t)),i}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){const t=this.defaults.renderer||new qv(this.defaults);for(const n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if("options"===n)continue;const i=n,r=e.renderer[i],o=t[i];t[i]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=o.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new rv(this.defaults);for(const n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;const i=n,r=e.tokenizer[i],o=t[i];t[i]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=o.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new Wv;for(const n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if("options"===n)continue;const i=n,r=e.hooks[i],o=t[i];Wv.passThroughHooks.has(n)?t[i]=e=>{if(this.defaults.async)return Promise.resolve(r.call(t,e)).then((e=>o.call(t,e)));const n=r.call(t,e);return o.call(t,n)}:t[i]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=o.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,i=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(i.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Bv.lex(e,t??this.defaults)}parser(e,t){return Hv.parse(e,t??this.defaults)}#e(e,t){return(n,i)=>{const r={...i},o={...this.defaults,...r};!0===this.defaults.async&&!1===r.async&&(o.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),o.async=!0);const s=this.#t(!!o.silent,!!o.async);if(null==n)return s(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof n)return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(o.hooks&&(o.hooks.options=o),o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(n):n).then((t=>e(t,o))).then((e=>o.hooks?o.hooks.processAllTokens(e):e)).then((e=>o.walkTokens?Promise.all(this.walkTokens(e,o.walkTokens)).then((()=>e)):e)).then((e=>t(e,o))).then((e=>o.hooks?o.hooks.postprocess(e):e)).catch(s);try{o.hooks&&(n=o.hooks.preprocess(n));let i=e(n,o);o.hooks&&(i=o.hooks.processAllTokens(i)),o.walkTokens&&this.walkTokens(i,o.walkTokens);let r=t(i,o);return o.hooks&&(r=o.hooks.postprocess(r)),r}catch(e){return s(e)}}}#t(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="<p>An error occurred:</p><pre>"+Kg(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Vv(e,t){return Gv.parse(e,t)}Vv.options=Vv.setOptions=function(e){return Gv.setOptions(e),Vv.defaults=Gv.defaults,Bg(Vv.defaults),Vv},Vv.getDefaults=Fg,Vv.defaults=zg,Vv.use=function(...e){return Gv.use(...e),Vv.defaults=Gv.defaults,Bg(Vv.defaults),Vv},Vv.walkTokens=function(e,t){return Gv.walkTokens(e,t)},Vv.parseInline=Gv.parseInline,Vv.Parser=Hv,Vv.parser=Hv.parse,Vv.Renderer=qv,Vv.TextRenderer=Uv,Vv.Lexer=Bv,Vv.lexer=Bv.lex,Vv.Tokenizer=rv,Vv.Hooks=Wv,Vv.parse=Vv,Vv.options,Vv.setOptions,Vv.use,Vv.walkTokens,Vv.parseInline,Hv.parse,Bv.lex;!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.stringSimilarity=void 0;e.stringSimilarity=function(e,t,n,i){if(void 0===n&&(n=2),void 0===i&&(i=!1),i||(e=e.toLowerCase(),t=t.toLowerCase()),e.length<n||t.length<n)return 0;for(var r=new Map,o=0;o<e.length-(n-1);o++){var s=e.substr(o,n);r.set(s,r.has(s)?r.get(s)+1:1)}for(var a=0,c=0;c<t.length-(n-1);c++){var l=t.substr(c,n),u=r.has(l)?r.get(l):0;u>0&&(r.set(l,u-1),a++)}return 2*a/(e.length+t.length-2*(n-1))},e.default=e.stringSimilarity}({});var Kv=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Jv=Kv,Yv=Object.create,Zv=function(){function e(){}return function(t){if(!Jv(t))return{};if(Yv)return Yv(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();var Xv=function(){},Qv=Zv,ex=Xv;function tx(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}tx.prototype=Qv(ex.prototype),tx.prototype.constructor=tx;var nx=tx;var ix=function(e,t){for(var n=-1,i=t.length,r=e.length;++n<i;)e[r+n]=t[n];return e},rx="object"==typeof Fe&&Fe&&Fe.Object===Object&&Fe,ox="object"==typeof self&&self&&self.Object===Object&&self,sx=rx||ox||Function("return this")(),ax=sx.Symbol,cx=ax,lx=Object.prototype,ux=lx.hasOwnProperty,px=lx.toString,dx=cx?cx.toStringTag:void 0;var fx=function(e){var t=ux.call(e,dx),n=e[dx];try{e[dx]=void 0;var i=!0}catch(e){}var r=px.call(e);return i&&(t?e[dx]=n:delete e[dx]),r},mx=Object.prototype.toString;var hx=fx,gx=function(e){return mx.call(e)},vx=ax?ax.toStringTag:void 0;var xx=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":vx&&vx in Object(e)?hx(e):gx(e)};var bx=function(e){return null!=e&&"object"==typeof e},yx=xx,_x=bx;var wx=function(e){return _x(e)&&"[object Arguments]"==yx(e)},Ex=bx,Sx=Object.prototype,kx=Sx.hasOwnProperty,Rx=Sx.propertyIsEnumerable,Tx=wx(function(){return arguments}())?wx:function(e){return Ex(e)&&kx.call(e,"callee")&&!Rx.call(e,"callee")},Ox=Array.isArray,Cx=Tx,Ax=Ox,Px=ax?ax.isConcatSpreadable:void 0;var jx=ix,Lx=function(e){return Ax(e)||Cx(e)||!!(Px&&e&&e[Px])};var Nx=function e(t,n,i,r,o){var s=-1,a=t.length;for(i||(i=Lx),o||(o=[]);++s<a;){var c=t[s];n>0&&i(c)?n>1?e(c,n-1,i,r,o):jx(o,c):r||(o[o.length]=c)}return o},Ix=Nx;var $x=function(e){return(null==e?0:e.length)?Ix(e,1):[]};var Dx=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)},Mx=Math.max;var Fx=function(e,t,n){return t=Mx(void 0===t?e.length-1:t,0),function(){for(var i=arguments,r=-1,o=Mx(i.length-t,0),s=Array(o);++r<o;)s[r]=i[t+r];r=-1;for(var a=Array(t+1);++r<t;)a[r]=i[r];return a[t]=n(s),Dx(e,this,a)}};var zx=function(e){return function(){return e}},Bx=xx,qx=Kv;var Ux,Hx=function(e){if(!qx(e))return!1;var t=Bx(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Wx=sx["__core-js_shared__"],Gx=(Ux=/[^.]+$/.exec(Wx&&Wx.keys&&Wx.keys.IE_PROTO||""))?"Symbol(src)_1."+Ux:"";var Vx=function(e){return!!Gx&&Gx in e},Kx=Function.prototype.toString;var Jx=Hx,Yx=Vx,Zx=Kv,Xx=function(e){if(null!=e){try{return Kx.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Qx=/^\[object .+?Constructor\]$/,eb=Function.prototype,tb=Object.prototype,nb=eb.toString,ib=tb.hasOwnProperty,rb=RegExp("^"+nb.call(ib).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var ob=function(e){return!(!Zx(e)||Yx(e))&&(Jx(e)?rb:Qx).test(Xx(e))},sb=function(e,t){return null==e?void 0:e[t]};var ab=function(e,t){var n=sb(e,t);return ob(n)?n:void 0},cb=ab,lb=function(){try{var e=cb(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var ub=zx,pb=lb,db=pb?function(e,t){return pb(e,"toString",{configurable:!0,enumerable:!1,value:ub(t),writable:!0})}:function(e){return e},fb=db,mb=Date.now;var hb=function(e){var t=0,n=0;return function(){var i=mb(),r=16-(i-n);if(n=i,r>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(fb),gb=$x,vb=Fx,xb=hb;var bb=function(e){return xb(vb(e,void 0,gb),e+"")},yb=ab(sx,"WeakMap");var _b=yb&&new yb,wb=_b?function(e){return _b.get(e)}:function(){},Eb={},Sb=Object.prototype.hasOwnProperty;var kb=function(e){for(var t=e.name+"",n=Eb[t],i=Sb.call(Eb,t)?n.length:0;i--;){var r=n[i],o=r.func;if(null==o||o==e)return r.name}return t},Rb=Zv,Tb=Xv;function Ob(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}Ob.prototype=Rb(Tb.prototype),Ob.prototype.constructor=Ob;var Cb=Ob;var Ab=function(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n<i;)t[n]=e[n];return t},Pb=Cb,jb=nx,Lb=Ab;var Nb=Cb,Ib=nx,$b=Xv,Db=Ox,Mb=bx,Fb=function(e){if(e instanceof Pb)return e.clone();var t=new jb(e.__wrapped__,e.__chain__);return t.__actions__=Lb(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t},zb=Object.prototype.hasOwnProperty;function Bb(e){if(Mb(e)&&!Db(e)&&!(e instanceof Nb)){if(e instanceof Ib)return e;if(zb.call(e,"__wrapped__"))return Fb(e)}return new Ib(e)}Bb.prototype=$b.prototype,Bb.prototype.constructor=Bb;var qb=Cb,Ub=wb,Hb=kb,Wb=Bb;var Gb=nx,Vb=bb,Kb=wb,Jb=kb,Yb=Ox,Zb=function(e){var t=Hb(e),n=Wb[t];if("function"!=typeof n||!(t in qb.prototype))return!1;if(e===n)return!0;var i=Ub(n);return!!i&&e===i[0]};var Xb,Qb=function(e){return Vb((function(t){var n=t.length,i=n,r=Gb.prototype.thru;for(e&&t.reverse();i--;){var o=t[i];if("function"!=typeof o)throw new TypeError("Expected a function");if(r&&!s&&"wrapper"==Jb(o))var s=new Gb([],!0)}for(i=s?i:n;++i<n;){o=t[i];var a=Jb(o),c="wrapper"==a?Kb(o):void 0;s=c&&Zb(c[0])&&424==c[1]&&!c[4].length&&1==c[9]?s[Jb(c[0])].apply(s,c[3]):1==o.length&&Zb(o)?s[a]():s.thru(o)}return function(){var e=arguments,i=e[0];if(s&&1==e.length&&Yb(i))return s.plant(i).value();for(var r=0,o=n?t[r].apply(this,e):i;++r<n;)o=t[r].call(this,o);return o}}))};Qb(),function(e){e.EDIT="edit",e.PREVIEW="preview"}(Xb||(Xb={}));for(var ey,ty,ny,iy,ry,oy,sy,ay,cy,ly,uy,py,dy,fy,my,hy,gy,vy,xy,by,yy,_y,wy,Ey,Sy,ky,Ry,Ty,Oy,Cy,Ay,Py,jy=0;jy<4;jy++)(4294967296*Math.random()).toString(16);!function(e){e.VERSION_UPDATE_TITLE="version.update.title",e.VERSION_UPDATE_INSTALL="version.update.install",e.VERSION_UPDATE_IGNORE="version.update.ignore",e.COMMON_GENERATE_ERROR="common.generate.error",e.COMMON_UNKNOWN_ERROR="common.unknown.error",e.COMMON_REQUEST_ERROR="common.request.error",e.COMMON_CODE="common.code",e.COMMON_FUNCTION="common.function",e.COMMON_USING="common.using",e.COMMON_WITHOUT="common.without",e.COMMON_COMMA="common.comma",e.COMMON_FRAMEWORK="common.framework",e.COMMON_RELATED="common.related",e.COMMON_PROMPT="common.prompt",e.COMMON_THINKING="common.thinking",e.COMMON_SEARCH_RESULT="common.searchResult",e.COMMON_AUTHORIZE="common.authorize",e.COMMON_DENY="common.deny",e.COMMON_NAVIGATE_TO_SETTING="common.navigateToSetting",e.COMMON_CUSTOMIZE_ERROR="common.customize.error",e.COMMON_PRIVATE_ERROR="common.private.error",e.LOG_LEVEL_PLACEHOLDER="log.level.placeholder",e.DO_NOT_SHOW_AGAIN="do.not.show.again"}(ey||(ey={})),function(e){e.NOT_SUPPORT="statusBar.not.support.text",e.ENABLE="statusBar.enable.text",e.NO_SUGGESTIONS="statusBar.nosuggestions",e.TITLE="statusBar.title"}(ty||(ty={})),function(e){e.PANEL_ACCEPT="completion.panel.accept.text",e.PANEL_ACCEPT_TOOLTIP="completion.panel.accept.tooltip",e.PANEL_CODELENS_DISABLED="completion.panel.codelens.disabled.text",e.PANEL_TITLE="completion.panel.title",e.PANEL_EMPTY="completion.panel.empty.text",e.PANEL_HIDDEN="completion.panel.hidden.text",e.PANEL_SYNTHESIZING="completion.panel.synthesizing.text",e.DECORATION_BASIC="completion.decoration.basic",e.DECORATION_WITH_WIDGET="completion.decoration.widget.text",e.DECORATION_ACCEPT_LINE="completion.decoration.acceptLine.text"}(ny||(ny={})),function(e){e.EMPTY_TEXT="nl2code.empty.text",e.NO_SELECTION="nl2code.no.selection.text"}(iy||(iy={})),function(e){e.CODELENS_TITLE="optimize.codelens.title",e.CODELENS_TOOLTIP="optimize.codelens.tooltip",e.OPTIMIZE_ERROR="optimize.error",e.OPTIMIZE_CODE_PROMPT="optimize.code.prompt",e.NO_SELECTION="optimize.no.selection.text",e.OPTIMIZE_FUNCTION_PROMPT="optimize.function.prompt"}(ry||(ry={})),function(e){e.EXPLAIN_SELECTED_CODE="explain.codeActions.title",e.OPTIMIZE_SELECTED_CODE="optimize.codeActions.title",e.INLINECHAT_SELECTED_CODE="inlinechat.codeActions.title"}(oy||(oy={})),function(e){e.CODELENS_TITLE="chatTrial.codelens.title"}(sy||(sy={})),function(e){e.CODELENS_TITLE="inlinechat.codelens.title"}(ay||(ay={})),function(e){e.CHAT_TIPS_TITLE="chatTips.selectedCode.title",e.CHAT_TIPS_CODE_BLANK_ROW_TITLE="chatTips.blankRow.title"}(cy||(cy={})),function(e){e.GENERATING_TITLE="decorations.generating.title",e.LINE_COMMENT_CODE_TRIGGER_TITLE="decorations.lineComent.trigger.title"}(ly||(ly={})),function(e){e.PROMPT="comment.prompt",e.CODELENS_TITLE="comment.codelens.title",e.CODELENS_TOOLTIP="comment.codelens.tooltip",e.INLINECHAT_TITLE="comment.inlinechat.title",e.GENERATE_ERROR="comment.generate.error"}(uy||(uy={})),function(e){e.PROMPT="docstring.prompt",e.CODELENS_TITLE="docstring.codelens.title",e.CODELENS_TOOLTIP="docstring.codelens.tooltip",e.INLINECHAT_TITLE="docstring.inlinechat.title",e.GENERATE_ERROR="docstring.generate.error"}(py||(py={})),function(e){e.PROMPT="split.prompt",e.CODELENS_TITLE="split.codelens.title",e.CODELENS_TOOLTIP="split.codelens.tooltip",e.GENERATE_ERROR="split.generate.error"}(dy||(dy={})),function(e){e.CODELENS_TITLE="explain.codelens.title",e.CODELENS_TOOLTIP="explain.codelens.tooltip",e.GENERATE_ERROR="explain.generate.error",e.NO_SELECTION="explain.no.selection.text",e.PROMPT="explain.prompt"}(fy||(fy={})),function(e){e.CODELENS_TITLE="unitTest.codelens.title",e.CODELENS_TOOLTIP="unitTest.codelens.tooltip",e.GENERATE_ERROR="unitTest.generate.error",e.ACCEPT_ERROR="unitTest.accept.error",e.PROMPT="unitTest.prompt"}(my||(my={})),function(e){e.PROMPT="inlineLog.prompt",e.CODELENS_TITLE="inlineLog.codelens.title",e.CODELENS_TOOLTIP="inlineLog.codelens.tooltip",e.GENERATE_ERROR="inlineLog.generate.error"}(hy||(hy={})),function(e){e.TITLE="diff.title",e.ACCEPT="diff.accept",e.REJECT="diff.reject",e.OPEN_DUAL_SCREEN_DIFF="diff.dualScreenDiff.open"}(gy||(gy={})),function(e){e.WEBVIEW_TITLE="chat.webview.title",e.NO_INSERT_POSITION="chat.no.insertPosition.text"}(vy||(vy={})),function(e){e.PATH_ERROR="accept.path.error"}(xy||(xy={})),function(e){e.ACTION="quickFix.action.text",e.PROMPT="quickFix.prompt",e.PROMPT_SUFFIX="quickFix.prompt.suffix",e.GENERATE_ERROR="quickFix.generate.error",e.FIX_MAX_LEN="quickFix.fix.maxLen.text"}(by||(by={})),function(e){e.LOGIN_MESSAGE="login.message",e.LOGIN_ACTION_TEXT="login.action.text",e.LOGIN_ACTION_WITH_LICENSE="login.action.withLicense.text",e.LOGIN_DEVICE_ERROR="login.device.error",e.LOGIN_LOGGING_IN="login.loggingIn.text",e.LOGIN_SUCCESS="login.success",e.LOGIN_IDE_SUCCESS="login.ide.success",e.LOGIN_FAILED="login.failed",e.LOGIN_TOKEN_ERROR="login.token.error",e.LOGIN_KEY_ERROR="login.key.error",e.LOGIN_INTERNAL_USER="login.internalUser.message",e.LOGIN_INSTALL_INTERNAL="login.install.internal",e.LOGIN_AGREEMENT="login.agreement.message",e.RENEW_ACTION="renew.action.text",e.QUICK_PICK_PLACEHOLDER="command.quick.pick.placeholder"}(yy||(yy={})),function(e){e.TOOLTIP="regexHover.tooltip",e.PROMPT="regexHover.prompt"}(_y||(_y={})),function(e){e.MAXIMUM_FILES="embeddings.maximum.files.message",e.PROGRESS="embeddings.progress.message",e.PROGRESS_TOOLTIP="embeddings.progress.tooltip.message"}(wy||(wy={})),function(e){e.TITLE="openPlatform.title.text",e.WEBVIEW_TITLE="openPlatform.webview.title"}(Ey||(Ey={})),function(e){e.MODAL_AUTH_TITLE="autoWork.auth.modal.title",e.INDEXING_MESSAGE="autoWork.indexing.message",e.CONNECTION_INTERRUPT="autoWork.connection.interrupt.message",e.INDEXING_REMINDER="autoWork.indexing.reminder.text",e.ERROR="autoWork.error",e.TASK_THOUGHT="autoWork.task.thought",e.TASK_ANSWER="autoWork.task.answer",e.AUTO_DEBUG="autoWork.autoDebug",e.AUTO_DEBUG_PROMPT="autoWork.autoDebug.prompt",e.AUTO_DEBUG_STAGE_THOUGHT="autoWork.autoDebug.thought",e.AUTO_DEBUG_STAGE_SEARCH="autoWork.autoDebug.search",e.AUTO_DEBUG_STAGE_ANSWER="autoWork.autoDebug.answer"}(Sy||(Sy={})),function(e){e.PERMISSION_WORKSPACE="comatePlus.permission.workspace.text",e.PERMISSION_DISK="comatePlus.permission.disk.text",e.PERMISSION_USER="comatePlus.permission.user.text",e.AUTH_MESSAGE="comatePlus.auth.message",e.USER_INFO_ERROR="comatePlus.userInfo.error",e.CLEAR_PERMISSION="comatePlus.clear.permission",e.SPLIT_ERROR="comatePlus.split.error",e.NO_SELECTION="comatePlus.noSelection",e.NOT_A_FUNCTION="comatePlus.not.function.text"}(ky||(ky={})),function(e){e.INLINECHAT_GENERATE="inlinechat.placeholder.generate",e.INLINECHAT_SELECTED="inlinechat.placeholder.selected",e.INLINECHAT_UNSELECTED="inlinechat.placeholder.unselected",e.INLINECHAT_TITLE="inlinechat.title",e.INLINCHAT_ERROR="inlinechat.placeholder.error"}(Ry||(Ry={})),function(e){e.GENERATE_ERROR="messageGenerate.generate.error",e.NO_DIFF_ERROR="messageGenerate.noDiff.error",e.GET_DIFF_ERROR="messageGenerate.getDiff.error",e.EMPTY_CONTENT_ERROR="messageGenerate.emptyContent.error"}(Ty||(Ty={})),function(e){e.GENERATE_ERROR="kernel.zulu.error"}(Oy||(Oy={})),function(e){e.DEVELOPMENT="development",e.PRODUCTION="production",e.TEST="test"}(Cy||(Cy={})),function(e){e.SAAS="saas",e.INTERNAL="internal",e.POC="poc"}(Ay||(Ay={})),function(e){e.VSCode="vscode",e.JetBrains="jetbrains",e.VS="vs",e.Xcode="xcode",e.Eclipse="eclipse",e.ComateLocal="comate-local",e.Web="web"}(Py||(Py={}));const Ly="kernel/extensionConfig/fetch";class Ny{url="https://comate.baidu.com/api/ok";async ping(e={}){const{timeout:t=5e3,retries:n=3,retryDelay:i=1e3,proxy:r}=e;for(let e=1;e<=n;e++){const o=await this.singlePing(t,e,r);if(o.success||e===n)return o;e<n&&await this.delay(i)}throw new Error("All ping attempts failed")}getProxyConfig(e){const t=e||process.env.http_proxy||process.env.HTTP_PROXY||process.env.https_proxy||process.env.HTTPS_PROXY;if(!t)return{proxy:null};try{new k(t);return{proxy:t,agent:new w.Agent({keepAlive:!0,maxSockets:10})}}catch(e){return console.warn(`Invalid proxy URL: ${t}`),{proxy:null}}}async singlePing(e,t,n){const i=Date.now(),{proxy:r,agent:o}=this.getProxyConfig(n);return new Promise((n=>{let s;if(r){const o=new k(r),a=new k(this.url),c={hostname:o.hostname,port:o.port||("https:"===o.protocol?443:80),path:this.url,method:"GET",timeout:e,headers:{Host:a.hostname,"User-Agent":"Comate-Ping/1.0"}};if(o.username&&o.password){const e=Buffer.from(`${o.username}:${o.password}`).toString("base64");c.headers["Proxy-Authorization"]=`Basic ${e}`}s=w.request(c,(e=>{const o=Date.now()-i;n({success:200===e.statusCode,statusCode:e.statusCode,responseTime:o,attempt:t,timestamp:(new Date).toISOString(),proxy:r})}))}else s=E.request(this.url,{method:"GET",timeout:e,agent:o},(e=>{const r=Date.now()-i;n({success:200===e.statusCode,statusCode:e.statusCode,responseTime:r,attempt:t,timestamp:(new Date).toISOString()})}));s.on("error",(e=>{const o=Date.now()-i;n({success:!1,responseTime:o,error:e.message,attempt:t,timestamp:(new Date).toISOString(),proxy:r||void 0})})),s.on("timeout",(()=>{s.destroy();const e=Date.now()-i;n({success:!1,responseTime:e,error:"Request timeout",attempt:t,timestamp:(new Date).toISOString(),proxy:r||void 0})})),s.end()}))}delay(e){return new Promise((t=>setTimeout(t,e)))}async continuousPing(e,t=1e3,n={}){const i=[];console.log(`🌐 Proxy: ${this.getProxyConfig(n.proxy).proxy||"Direct connection"}\n`);for(let r=0;r<e;r++){const o=await this.ping(n);i.push(o);const s=o.proxy?` (via ${o.proxy})`:"";console.log(`Ping ${r+1}/${e}: ${o.success?"✅":"❌"} ${o.responseTime}ms${s}`),r<e-1&&await this.delay(t)}return i}static getStats(e){const t=e.filter((e=>e.success)),n=e.map((e=>e.responseTime));return{total:e.length,successful:t.length,failed:e.length-t.length,successRate:t.length/e.length*100,avgResponseTime:n.reduce(((e,t)=>e+t),0)/n.length,minResponseTime:Math.min(...n),maxResponseTime:Math.max(...n)}}static async testProxy(e){try{const t=new k(e);return new Promise((e=>{const n=w.request({hostname:t.hostname,port:t.port||80,method:"CONNECT",path:"www.baidu.com:80",timeout:5e3});n.on("connect",(()=>{e(!0)})),n.on("error",(()=>{e(!1)})),n.on("timeout",(()=>{n.destroy(),e(!1)})),n.end()}))}catch{return!1}}}var Iy,$y="0.2.0";function Dy(){try{const e="win32"===process.platform,t=m(e?"where rg":"which rg",{encoding:"utf8",stdio:"pipe"}).trim(),i=e?t.split("\n")[0]:t;if(i&&n(i))return i}catch(e){De("Failed to find ripgrep path:",e)}return""}(()=>{var e={975:e=>{function t(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function n(e,t){for(var n,i="",r=0,o=-1,s=0,a=0;a<=e.length;++a){if(a<e.length)n=e.charCodeAt(a);else{if(47===n)break;n=47}if(47===n){if(o===a-1||1===s);else if(o!==a-1&&2===s){if(i.length<2||2!==r||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2))if(i.length>2){var c=i.lastIndexOf("/");if(c!==i.length-1){-1===c?(i="",r=0):r=(i=i.slice(0,c)).length-1-i.lastIndexOf("/"),o=a,s=0;continue}}else if(2===i.length||1===i.length){i="",r=0,o=a,s=0;continue}t&&(i.length>0?i+="/..":i="..",r=2)}else i.length>0?i+="/"+e.slice(o+1,a):i=e.slice(o+1,a),r=a-o-1;o=a,s=0}else 46===n&&-1!==s?++s:s=-1}return i}var i={resolve:function(){for(var e,i="",r=!1,o=arguments.length-1;o>=-1&&!r;o--){var s;o>=0?s=arguments[o]:(void 0===e&&(e=process.cwd()),s=e),t(s),0!==s.length&&(i=s+"/"+i,r=47===s.charCodeAt(0))}return i=n(i,!r),r?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(e){if(t(e),0===e.length)return".";var i=47===e.charCodeAt(0),r=47===e.charCodeAt(e.length-1);return 0!==(e=n(e,!i)).length||i||(e="."),e.length>0&&r&&(e+="/"),i?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,n=0;n<arguments.length;++n){var r=arguments[n];t(r),r.length>0&&(void 0===e?e=r:e+="/"+r)}return void 0===e?".":i.normalize(e)},relative:function(e,n){if(t(e),t(n),e===n)return"";if((e=i.resolve(e))===(n=i.resolve(n)))return"";for(var r=1;r<e.length&&47===e.charCodeAt(r);++r);for(var o=e.length,s=o-r,a=1;a<n.length&&47===n.charCodeAt(a);++a);for(var c=n.length-a,l=s<c?s:c,u=-1,p=0;p<=l;++p){if(p===l){if(c>l){if(47===n.charCodeAt(a+p))return n.slice(a+p+1);if(0===p)return n.slice(a+p)}else s>l&&(47===e.charCodeAt(r+p)?u=p:0===p&&(u=0));break}var d=e.charCodeAt(r+p);if(d!==n.charCodeAt(a+p))break;47===d&&(u=p)}var f="";for(p=r+u+1;p<=o;++p)p!==o&&47!==e.charCodeAt(p)||(0===f.length?f+="..":f+="/..");return f.length>0?f+n.slice(a+u):(a+=u,47===n.charCodeAt(a)&&++a,n.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var n=e.charCodeAt(0),i=47===n,r=-1,o=!0,s=e.length-1;s>=1;--s)if(47===(n=e.charCodeAt(s))){if(!o){r=s;break}}else o=!1;return-1===r?i?"/":".":i&&1===r?"//":e.slice(0,r)},basename:function(e,n){if(void 0!==n&&"string"!=typeof n)throw new TypeError('"ext" argument must be a string');t(e);var i,r=0,o=-1,s=!0;if(void 0!==n&&n.length>0&&n.length<=e.length){if(n.length===e.length&&n===e)return"";var a=n.length-1,c=-1;for(i=e.length-1;i>=0;--i){var l=e.charCodeAt(i);if(47===l){if(!s){r=i+1;break}}else-1===c&&(s=!1,c=i+1),a>=0&&(l===n.charCodeAt(a)?-1==--a&&(o=i):(a=-1,o=c))}return r===o?o=c:-1===o&&(o=e.length),e.slice(r,o)}for(i=e.length-1;i>=0;--i)if(47===e.charCodeAt(i)){if(!s){r=i+1;break}}else-1===o&&(s=!1,o=i+1);return-1===o?"":e.slice(r,o)},extname:function(e){t(e);for(var n=-1,i=0,r=-1,o=!0,s=0,a=e.length-1;a>=0;--a){var c=e.charCodeAt(a);if(47!==c)-1===r&&(o=!1,r=a+1),46===c?-1===n?n=a:1!==s&&(s=1):-1!==n&&(s=-1);else if(!o){i=a+1;break}}return-1===n||-1===r||0===s||1===s&&n===r-1&&n===i+1?"":e.slice(n,r)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var n=t.dir||t.root,i=t.base||(t.name||"")+(t.ext||"");return n?n===t.root?n+i:n+"/"+i:i}(0,e)},parse:function(e){t(e);var n={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return n;var i,r=e.charCodeAt(0),o=47===r;o?(n.root="/",i=1):i=0;for(var s=-1,a=0,c=-1,l=!0,u=e.length-1,p=0;u>=i;--u)if(47!==(r=e.charCodeAt(u)))-1===c&&(l=!1,c=u+1),46===r?-1===s?s=u:1!==p&&(p=1):-1!==s&&(p=-1);else if(!l){a=u+1;break}return-1===s||-1===c||0===p||1===p&&s===c-1&&s===a+1?-1!==c&&(n.base=n.name=0===a&&o?e.slice(1,c):e.slice(a,c)):(0===a&&o?(n.name=e.slice(1,s),n.base=e.slice(1,c)):(n.name=e.slice(a,s),n.base=e.slice(a,c)),n.ext=e.slice(s,c)),a>0?n.dir=e.slice(0,a-1):o&&(n.dir="/"),n},sep:"/",delimiter:":",win32:null,posix:null};i.posix=i,e.exports=i}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i](o,o.exports,n),o.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};let r;if(n.r(i),n.d(i,{URI:()=>d,Utils:()=>R}),"object"==typeof process)r="win32"===process.platform;else if("object"==typeof navigator){let e=navigator.userAgent;r=e.indexOf("Windows")>=0}const o=/^\w[\w\d+.-]*$/,s=/^\//,a=/^\/\//;function c(e,t){if(!e.scheme&&t)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${e.authority}", path: "${e.path}", query: "${e.query}", fragment: "${e.fragment}"}`);if(e.scheme&&!o.test(e.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(e.path)if(e.authority){if(!s.test(e.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(a.test(e.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}const l="",u="/",p=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class d{static isUri(e){return e instanceof d||!!e&&"string"==typeof e.authority&&"string"==typeof e.fragment&&"string"==typeof e.path&&"string"==typeof e.query&&"string"==typeof e.scheme&&"string"==typeof e.fsPath&&"function"==typeof e.with&&"function"==typeof e.toString}scheme;authority;path;query;fragment;constructor(e,t,n,i,r,o=!1){"object"==typeof e?(this.scheme=e.scheme||l,this.authority=e.authority||l,this.path=e.path||l,this.query=e.query||l,this.fragment=e.fragment||l):(this.scheme=function(e,t){return e||t?e:"file"}(e,o),this.authority=t||l,this.path=function(e,t){switch(e){case"https":case"http":case"file":t?t[0]!==u&&(t=u+t):t=u}return t}(this.scheme,n||l),this.query=i||l,this.fragment=r||l,c(this,o))}get fsPath(){return x(this)}with(e){if(!e)return this;let{scheme:t,authority:n,path:i,query:r,fragment:o}=e;return void 0===t?t=this.scheme:null===t&&(t=l),void 0===n?n=this.authority:null===n&&(n=l),void 0===i?i=this.path:null===i&&(i=l),void 0===r?r=this.query:null===r&&(r=l),void 0===o?o=this.fragment:null===o&&(o=l),t===this.scheme&&n===this.authority&&i===this.path&&r===this.query&&o===this.fragment?this:new m(t,n,i,r,o)}static parse(e,t=!1){const n=p.exec(e);return n?new m(n[2]||l,w(n[4]||l),w(n[5]||l),w(n[7]||l),w(n[9]||l),t):new m(l,l,l,l,l)}static file(e){let t=l;if(r&&(e=e.replace(/\\/g,u)),e[0]===u&&e[1]===u){const n=e.indexOf(u,2);-1===n?(t=e.substring(2),e=u):(t=e.substring(2,n),e=e.substring(n)||u)}return new m("file",t,e,l,l)}static from(e){const t=new m(e.scheme,e.authority,e.path,e.query,e.fragment);return c(t,!0),t}toString(e=!1){return b(this,e)}toJSON(){return this}static revive(e){if(e){if(e instanceof d)return e;{const t=new m(e);return t._formatted=e.external,t._fsPath=e._sep===f?e.fsPath:null,t}}return e}}const f=r?1:void 0;class m extends d{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=x(this)),this._fsPath}toString(e=!1){return e?b(this,!0):(this._formatted||(this._formatted=b(this,!1)),this._formatted)}toJSON(){const e={$mid:1};return this._fsPath&&(e.fsPath=this._fsPath,e._sep=f),this._formatted&&(e.external=this._formatted),this.path&&(e.path=this.path),this.scheme&&(e.scheme=this.scheme),this.authority&&(e.authority=this.authority),this.query&&(e.query=this.query),this.fragment&&(e.fragment=this.fragment),e}}const h={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function g(e,t,n){let i,r=-1;for(let o=0;o<e.length;o++){const s=e.charCodeAt(o);if(s>=97&&s<=122||s>=65&&s<=90||s>=48&&s<=57||45===s||46===s||95===s||126===s||t&&47===s||n&&91===s||n&&93===s||n&&58===s)-1!==r&&(i+=encodeURIComponent(e.substring(r,o)),r=-1),void 0!==i&&(i+=e.charAt(o));else{void 0===i&&(i=e.substr(0,o));const t=h[s];void 0!==t?(-1!==r&&(i+=encodeURIComponent(e.substring(r,o)),r=-1),i+=t):-1===r&&(r=o)}}return-1!==r&&(i+=encodeURIComponent(e.substring(r))),void 0!==i?i:e}function v(e){let t;for(let n=0;n<e.length;n++){const i=e.charCodeAt(n);35===i||63===i?(void 0===t&&(t=e.substr(0,n)),t+=h[i]):void 0!==t&&(t+=e[n])}return void 0!==t?t:e}function x(e,t){let n;return n=e.authority&&e.path.length>1&&"file"===e.scheme?`//${e.authority}${e.path}`:47===e.path.charCodeAt(0)&&(e.path.charCodeAt(1)>=65&&e.path.charCodeAt(1)<=90||e.path.charCodeAt(1)>=97&&e.path.charCodeAt(1)<=122)&&58===e.path.charCodeAt(2)?e.path[1].toLowerCase()+e.path.substr(2):e.path,r&&(n=n.replace(/\//g,"\\")),n}function b(e,t){const n=t?v:g;let i="",{scheme:r,authority:o,path:s,query:a,fragment:c}=e;if(r&&(i+=r,i+=":"),(o||"file"===r)&&(i+=u,i+=u),o){let e=o.indexOf("@");if(-1!==e){const t=o.substr(0,e);o=o.substr(e+1),e=t.lastIndexOf(":"),-1===e?i+=n(t,!1,!1):(i+=n(t.substr(0,e),!1,!1),i+=":",i+=n(t.substr(e+1),!1,!0)),i+="@"}o=o.toLowerCase(),e=o.lastIndexOf(":"),-1===e?i+=n(o,!1,!0):(i+=n(o.substr(0,e),!1,!0),i+=o.substr(e))}if(s){if(s.length>=3&&47===s.charCodeAt(0)&&58===s.charCodeAt(2)){const e=s.charCodeAt(1);e>=65&&e<=90&&(s=`/${String.fromCharCode(e+32)}:${s.substr(3)}`)}else if(s.length>=2&&58===s.charCodeAt(1)){const e=s.charCodeAt(0);e>=65&&e<=90&&(s=`${String.fromCharCode(e+32)}:${s.substr(2)}`)}i+=n(s,!0,!1)}return a&&(i+="?",i+=n(a,!1,!1)),c&&(i+="#",i+=t?c:g(c,!1,!1)),i}function y(e){try{return decodeURIComponent(e)}catch{return e.length>3?e.substr(0,3)+y(e.substr(3)):e}}const _=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function w(e){return e.match(_)?e.replace(_,(e=>y(e))):e}var E=n(975);const S=E.posix||E,k="/";var R;!function(e){e.joinPath=function(e,...t){return e.with({path:S.join(e.path,...t)})},e.resolvePath=function(e,...t){let n=e.path,i=!1;n[0]!==k&&(n=k+n,i=!0);let r=S.resolve(n,...t);return i&&r[0]===k&&!e.authority&&(r=r.substring(1)),e.with({path:r})},e.dirname=function(e){if(0===e.path.length||e.path===k)return e;let t=S.dirname(e.path);return 1===t.length&&46===t.charCodeAt(0)&&(t=""),e.with({path:t})},e.basename=function(e){return S.basename(e.path)},e.extname=function(e){return S.extname(e.path)}}(R||(R={})),Iy=i})();const{URI:My,Utils:Fy}=Iy;var zy,By,qy={},Uy={},Hy={},Wy={},Gy={};function Vy(){if(zy)return Gy;function e(e){return"string"==typeof e||e instanceof String}function t(e){return Array.isArray(e)}return zy=1,Object.defineProperty(Gy,"__esModule",{value:!0}),Gy.stringArray=Gy.array=Gy.func=Gy.error=Gy.number=Gy.string=Gy.boolean=void 0,Gy.boolean=function(e){return!0===e||!1===e},Gy.string=e,Gy.number=function(e){return"number"==typeof e||e instanceof Number},Gy.error=function(e){return e instanceof Error},Gy.func=function(e){return"function"==typeof e},Gy.array=t,Gy.stringArray=function(n){return t(n)&&n.every((t=>e(t)))},Gy}function Ky(){if(By)return Wy;By=1,Object.defineProperty(Wy,"__esModule",{value:!0}),Wy.Message=Wy.NotificationType9=Wy.NotificationType8=Wy.NotificationType7=Wy.NotificationType6=Wy.NotificationType5=Wy.NotificationType4=Wy.NotificationType3=Wy.NotificationType2=Wy.NotificationType1=Wy.NotificationType0=Wy.NotificationType=Wy.RequestType9=Wy.RequestType8=Wy.RequestType7=Wy.RequestType6=Wy.RequestType5=Wy.RequestType4=Wy.RequestType3=Wy.RequestType2=Wy.RequestType1=Wy.RequestType=Wy.RequestType0=Wy.AbstractMessageSignature=Wy.ParameterStructures=Wy.ResponseError=Wy.ErrorCodes=void 0;const e=Vy();var t,n;!function(e){e.ParseError=-32700,e.InvalidRequest=-32600,e.MethodNotFound=-32601,e.InvalidParams=-32602,e.InternalError=-32603,e.jsonrpcReservedErrorRangeStart=-32099,e.serverErrorStart=-32099,e.MessageWriteError=-32099,e.MessageReadError=-32098,e.PendingResponseRejected=-32097,e.ConnectionInactive=-32096,e.ServerNotInitialized=-32002,e.UnknownErrorCode=-32001,e.jsonrpcReservedErrorRangeEnd=-32e3,e.serverErrorEnd=-32e3}(t||(Wy.ErrorCodes=t={}));class i extends Error{constructor(n,r,o){super(r),this.code=e.number(n)?n:t.UnknownErrorCode,this.data=o,Object.setPrototypeOf(this,i.prototype)}toJson(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data),e}}Wy.ResponseError=i;class r{constructor(e){this.kind=e}static is(e){return e===r.auto||e===r.byName||e===r.byPosition}toString(){return this.kind}}Wy.ParameterStructures=r,r.auto=new r("auto"),r.byPosition=new r("byPosition"),r.byName=new r("byName");class o{constructor(e,t){this.method=e,this.numberOfParams=t}get parameterStructures(){return r.auto}}Wy.AbstractMessageSignature=o;Wy.RequestType0=class extends o{constructor(e){super(e,0)}};Wy.RequestType=class extends o{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Wy.RequestType1=class extends o{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Wy.RequestType2=class extends o{constructor(e){super(e,2)}};Wy.RequestType3=class extends o{constructor(e){super(e,3)}};Wy.RequestType4=class extends o{constructor(e){super(e,4)}};Wy.RequestType5=class extends o{constructor(e){super(e,5)}};Wy.RequestType6=class extends o{constructor(e){super(e,6)}};Wy.RequestType7=class extends o{constructor(e){super(e,7)}};Wy.RequestType8=class extends o{constructor(e){super(e,8)}};Wy.RequestType9=class extends o{constructor(e){super(e,9)}};Wy.NotificationType=class extends o{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Wy.NotificationType0=class extends o{constructor(e){super(e,0)}};Wy.NotificationType1=class extends o{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Wy.NotificationType2=class extends o{constructor(e){super(e,2)}};Wy.NotificationType3=class extends o{constructor(e){super(e,3)}};Wy.NotificationType4=class extends o{constructor(e){super(e,4)}};Wy.NotificationType5=class extends o{constructor(e){super(e,5)}};Wy.NotificationType6=class extends o{constructor(e){super(e,6)}};Wy.NotificationType7=class extends o{constructor(e){super(e,7)}};Wy.NotificationType8=class extends o{constructor(e){super(e,8)}};return Wy.NotificationType9=class extends o{constructor(e){super(e,9)}},function(t){t.isRequest=function(t){const n=t;return n&&e.string(n.method)&&(e.string(n.id)||e.number(n.id))},t.isNotification=function(t){const n=t;return n&&e.string(n.method)&&void 0===t.id},t.isResponse=function(t){const n=t;return n&&(void 0!==n.result||!!n.error)&&(e.string(n.id)||e.number(n.id)||null===n.id)}}(n||(Wy.Message=n={})),Wy}var Jy,Yy={};function Zy(){if(Jy)return Yy;var e,t;Jy=1,Object.defineProperty(Yy,"__esModule",{value:!0}),Yy.LRUCache=Yy.LinkedMap=Yy.Touch=void 0,function(e){e.None=0,e.First=1,e.AsOld=e.First,e.Last=2,e.AsNew=e.Last}(t||(Yy.Touch=t={}));class n{constructor(){this[e]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(e){return this._map.has(e)}get(e,n=t.None){const i=this._map.get(e);if(i)return n!==t.None&&this.touch(i,n),i.value}set(e,n,i=t.None){let r=this._map.get(e);if(r)r.value=n,i!==t.None&&this.touch(r,i);else{switch(r={key:e,value:n,next:void 0,previous:void 0},i){case t.None:this.addItemLast(r);break;case t.First:this.addItemFirst(r);break;case t.Last:default:this.addItemLast(r)}this._map.set(e,r),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){const t=this._map.get(e);if(t)return this._map.delete(e),this.removeItem(t),this._size--,t.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");const e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){const n=this._state;let i=this._head;for(;i;){if(t?e.bind(t)(i.value,i.key,this):e(i.value,i.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");i=i.next}}keys(){const e=this._state;let t=this._head;const n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){const e={value:t.key,done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return n}values(){const e=this._state;let t=this._head;const n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){const e={value:t.value,done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return n}entries(){const e=this._state;let t=this._head;const n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){const e={value:[t.key,t.value],done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return n}[(e=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(0===e)return void this.clear();let t=this._head,n=this.size;for(;t&&n>e;)this._map.delete(t.key),t=t.next,n--;this._head=t,this._size=n,t&&(t.previous=void 0),this._state++}addItemFirst(e){if(this._head||this._tail){if(!this._head)throw new Error("Invalid list");e.next=this._head,this._head.previous=e}else this._tail=e;this._head=e,this._state++}addItemLast(e){if(this._head||this._tail){if(!this._tail)throw new Error("Invalid list");e.previous=this._tail,this._tail.next=e}else this._head=e;this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{const t=e.next,n=e.previous;if(!t||!n)throw new Error("Invalid list");t.previous=n,n.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,n){if(!this._head||!this._tail)throw new Error("Invalid list");if(n===t.First||n===t.Last)if(n===t.First){if(e===this._head)return;const t=e.next,n=e.previous;e===this._tail?(n.next=void 0,this._tail=n):(t.previous=n,n.next=t),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(n===t.Last){if(e===this._tail)return;const t=e.next,n=e.previous;e===this._head?(t.previous=void 0,this._head=t):(t.previous=n,n.next=t),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}toJSON(){const e=[];return this.forEach(((t,n)=>{e.push([n,t])})),e}fromJSON(e){this.clear();for(const[t,n]of e)this.set(t,n)}}Yy.LinkedMap=n;return Yy.LRUCache=class extends n{constructor(e,t=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,t),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get ratio(){return this._ratio}set ratio(e){this._ratio=Math.min(Math.max(0,e),1),this.checkTrim()}get(e,n=t.AsNew){return super.get(e,n)}peek(e){return super.get(e,t.None)}set(e,n){return super.set(e,n,t.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}},Yy}var Xy,Qy={};var e_,t_,n_={},i_={};function r_(){if(e_)return i_;let e;function t(){if(void 0===e)throw new Error("No runtime abstraction layer installed");return e}return e_=1,Object.defineProperty(i_,"__esModule",{value:!0}),function(t){t.install=function(t){if(void 0===t)throw new Error("No runtime abstraction layer provided");e=t}}(t||(t={})),i_.default=t,i_}function o_(){if(t_)return n_;t_=1,Object.defineProperty(n_,"__esModule",{value:!0}),n_.Emitter=n_.Event=void 0;const e=r_();var t;!function(e){const t={dispose(){}};e.None=function(){return t}}(t||(n_.Event=t={}));class n{add(e,t=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(t),Array.isArray(n)&&n.push({dispose:()=>this.remove(e,t)})}remove(e,t=null){if(!this._callbacks)return;let n=!1;for(let i=0,r=this._callbacks.length;i<r;i++)if(this._callbacks[i]===e){if(this._contexts[i]===t)return this._callbacks.splice(i,1),void this._contexts.splice(i,1);n=!0}if(n)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...t){if(!this._callbacks)return[];const n=[],i=this._callbacks.slice(0),r=this._contexts.slice(0);for(let o=0,s=i.length;o<s;o++)try{n.push(i[o].apply(r[o],t))}catch(t){(0,e.default)().console.error(t)}return n}isEmpty(){return!this._callbacks||0===this._callbacks.length}dispose(){this._callbacks=void 0,this._contexts=void 0}}class i{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,t,r)=>{this._callbacks||(this._callbacks=new n),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,t);const o={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,t),o.dispose=i._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(r)&&r.push(o),o}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}return n_.Emitter=i,i._noop=function(){},n_}var s_,a_={};function c_(){if(s_)return a_;s_=1,Object.defineProperty(a_,"__esModule",{value:!0}),a_.CancellationTokenSource=a_.CancellationToken=void 0;const e=r_(),t=Vy(),n=o_();var i;!function(e){e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:n.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:n.Event.None}),e.is=function(n){const i=n;return i&&(i===e.None||i===e.Cancelled||t.boolean(i.isCancellationRequested)&&!!i.onCancellationRequested)}}(i||(a_.CancellationToken=i={}));const r=Object.freeze((function(t,n){const i=(0,e.default)().timer.setTimeout(t.bind(n),0);return{dispose(){i.dispose()}}}));class o{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?r:(this._emitter||(this._emitter=new n.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}return a_.CancellationTokenSource=class{get token(){return this._token||(this._token=new o),this._token}cancel(){this._token?this._token.cancel():this._token=i.Cancelled}dispose(){this._token?this._token instanceof o&&this._token.dispose():this._token=i.None}},a_}var l_,u_={};var p_,d_,f_={},m_={};function h_(){if(p_)return m_;p_=1,Object.defineProperty(m_,"__esModule",{value:!0}),m_.Semaphore=void 0;const e=r_();return m_.Semaphore=class{constructor(e=1){if(e<=0)throw new Error("Capacity must be greater than 0");this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise(((t,n)=>{this._waiting.push({thunk:e,resolve:t,reject:n}),this.runNext()}))}get active(){return this._active}runNext(){0!==this._waiting.length&&this._active!==this._capacity&&(0,e.default)().timer.setImmediate((()=>this.doRunNext()))}doRunNext(){if(0===this._waiting.length||this._active===this._capacity)return;const e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{const t=e.thunk();t instanceof Promise?t.then((t=>{this._active--,e.resolve(t),this.runNext()}),(t=>{this._active--,e.reject(t),this.runNext()})):(this._active--,e.resolve(t),this.runNext())}catch(t){this._active--,e.reject(t),this.runNext()}}},m_}var g_,v_={};var x_,b_={};var y_,__,w_={};function E_(){return y_||(y_=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.ConnectionOptions=e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.RequestCancellationReceiverStrategy=e.IdCancellationReceiverStrategy=e.ConnectionStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=e.NullLogger=e.ProgressType=e.ProgressToken=void 0;const t=r_(),n=Vy(),i=Ky(),r=Zy(),o=o_(),s=c_();var a,c,l,u,p,d,f,m,h,g,v,x,b,y,_,w,E,S,k;!function(e){e.type=new i.NotificationType("$/cancelRequest")}(a||(a={})),function(e){e.is=function(e){return"string"==typeof e||"number"==typeof e}}(c||(e.ProgressToken=c={})),function(e){e.type=new i.NotificationType("$/progress")}(l||(l={}));e.ProgressType=class{constructor(){}},function(e){e.is=function(e){return n.func(e)}}(u||(u={})),e.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}}),function(e){e[e.Off=0]="Off",e[e.Messages=1]="Messages",e[e.Compact=2]="Compact",e[e.Verbose=3]="Verbose"}(p||(e.Trace=p={})),function(e){e.Off="off",e.Messages="messages",e.Compact="compact",e.Verbose="verbose"}(d||(e.TraceValues=d={})),function(e){e.fromString=function(t){if(!n.string(t))return e.Off;switch(t=t.toLowerCase()){case"off":default:return e.Off;case"messages":return e.Messages;case"compact":return e.Compact;case"verbose":return e.Verbose}},e.toString=function(t){switch(t){case e.Off:return"off";case e.Messages:return"messages";case e.Compact:return"compact";case e.Verbose:return"verbose";default:return"off"}}}(p||(e.Trace=p={})),function(e){e.Text="text",e.JSON="json"}(f||(e.TraceFormat=f={})),function(e){e.fromString=function(t){return n.string(t)&&"json"===(t=t.toLowerCase())?e.JSON:e.Text}}(f||(e.TraceFormat=f={})),function(e){e.type=new i.NotificationType("$/setTrace")}(m||(e.SetTraceNotification=m={})),function(e){e.type=new i.NotificationType("$/logTrace")}(h||(e.LogTraceNotification=h={})),function(e){e[e.Closed=1]="Closed",e[e.Disposed=2]="Disposed",e[e.AlreadyListening=3]="AlreadyListening"}(g||(e.ConnectionErrors=g={}));class R extends Error{constructor(e,t){super(t),this.code=e,Object.setPrototypeOf(this,R.prototype)}}e.ConnectionError=R,function(e){e.is=function(e){const t=e;return t&&n.func(t.cancelUndispatched)}}(v||(e.ConnectionStrategy=v={})),function(e){e.is=function(e){const t=e;return t&&(void 0===t.kind||"id"===t.kind)&&n.func(t.createCancellationTokenSource)&&(void 0===t.dispose||n.func(t.dispose))}}(x||(e.IdCancellationReceiverStrategy=x={})),function(e){e.is=function(e){const t=e;return t&&"request"===t.kind&&n.func(t.createCancellationTokenSource)&&(void 0===t.dispose||n.func(t.dispose))}}(b||(e.RequestCancellationReceiverStrategy=b={})),function(e){e.Message=Object.freeze({createCancellationTokenSource:e=>new s.CancellationTokenSource}),e.is=function(e){return x.is(e)||b.is(e)}}(y||(e.CancellationReceiverStrategy=y={})),function(e){e.Message=Object.freeze({sendCancellation:(e,t)=>e.sendNotification(a.type,{id:t}),cleanup(e){}}),e.is=function(e){const t=e;return t&&n.func(t.sendCancellation)&&n.func(t.cleanup)}}(_||(e.CancellationSenderStrategy=_={})),function(e){e.Message=Object.freeze({receiver:y.Message,sender:_.Message}),e.is=function(e){const t=e;return t&&y.is(t.receiver)&&_.is(t.sender)}}(w||(e.CancellationStrategy=w={})),function(e){e.is=function(e){const t=e;return t&&n.func(t.handleMessage)}}(E||(e.MessageStrategy=E={})),function(e){e.is=function(e){const t=e;return t&&(w.is(t.cancellationStrategy)||v.is(t.connectionStrategy)||E.is(t.messageStrategy))}}(S||(e.ConnectionOptions=S={})),function(e){e[e.New=1]="New",e[e.Listening=2]="Listening",e[e.Closed=3]="Closed",e[e.Disposed=4]="Disposed"}(k||(k={})),e.createMessageConnection=function(d,v,b,y){const _=void 0!==b?b:e.NullLogger;let S=0,T=0,O=0;const C="2.0";let A;const P=new Map;let j;const L=new Map,N=new Map;let I,$,D=new r.LinkedMap,M=new Map,F=new Set,z=new Map,B=p.Off,q=f.Text,U=k.New;const H=new o.Emitter,W=new o.Emitter,G=new o.Emitter,V=new o.Emitter,K=new o.Emitter,J=y&&y.cancellationStrategy?y.cancellationStrategy:w.Message;function Y(e){if(null===e)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+e.toString()}function Z(e,t){var n;i.Message.isRequest(t)?e.set(Y(t.id),t):i.Message.isResponse(t)?e.set(null===(n=t.id)?"res-unknown-"+(++O).toString():"res-"+n.toString(),t):e.set("not-"+(++T).toString(),t)}function X(e){}function Q(){return U===k.Listening}function ee(){return U===k.Closed}function te(){return U===k.Disposed}function ne(){U!==k.New&&U!==k.Listening||(U=k.Closed,W.fire(void 0))}function ie(){I||0===D.size||(I=(0,t.default)().timer.setImmediate((()=>{I=void 0,function(){if(0===D.size)return;const e=D.shift();try{const t=y?.messageStrategy;E.is(t)?t.handleMessage(e,re):re(e)}finally{ie()}}()})))}function re(e){i.Message.isRequest(e)?function(e){if(te())return;function t(t,n,r){const o={jsonrpc:C,id:e.id};t instanceof i.ResponseError?o.error=t.toJson():o.result=void 0===t?null:t,ae(o,n,r),v.write(o).catch((()=>_.error("Sending response failed.")))}function r(t,n,i){const r={jsonrpc:C,id:e.id,error:t.toJson()};ae(r,n,i),v.write(r).catch((()=>_.error("Sending response failed.")))}function o(t,n,i){void 0===t&&(t=null);const r={jsonrpc:C,id:e.id,result:t};ae(r,n,i),v.write(r).catch((()=>_.error("Sending response failed.")))}!function(e){if(B===p.Off||!$)return;if(q===f.Text){let t;B!==p.Verbose&&B!==p.Compact||!e.params||(t=`Params: ${se(e.params)}\n\n`),$.log(`Received request '${e.method} - (${e.id})'.`,t)}else le("receive-request",e)}(e);const s=P.get(e.method);let a,c;s&&(a=s.type,c=s.handler);const l=Date.now();if(c||A){const s=e.id??String(Date.now()),u=x.is(J.receiver)?J.receiver.createCancellationTokenSource(s):J.receiver.createCancellationTokenSource(e);null!==e.id&&F.has(e.id)&&u.cancel(),null!==e.id&&z.set(s,u);try{let p;if(c)if(void 0===e.params){if(void 0!==a&&0!==a.numberOfParams)return void r(new i.ResponseError(i.ErrorCodes.InvalidParams,`Request ${e.method} defines ${a.numberOfParams} params but received none.`),e.method,l);p=c(u.token)}else if(Array.isArray(e.params)){if(void 0!==a&&a.parameterStructures===i.ParameterStructures.byName)return void r(new i.ResponseError(i.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by name but received parameters by position`),e.method,l);p=c(...e.params,u.token)}else{if(void 0!==a&&a.parameterStructures===i.ParameterStructures.byPosition)return void r(new i.ResponseError(i.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by position but received parameters by name`),e.method,l);p=c(e.params,u.token)}else A&&(p=A(e.method,e.params,u.token));const d=p;p?d.then?d.then((n=>{z.delete(s),t(n,e.method,l)}),(t=>{z.delete(s),t instanceof i.ResponseError?r(t,e.method,l):t&&n.string(t.message)?r(new i.ResponseError(i.ErrorCodes.InternalError,`Request ${e.method} failed with message: ${t.message}`),e.method,l):r(new i.ResponseError(i.ErrorCodes.InternalError,`Request ${e.method} failed unexpectedly without providing any details.`),e.method,l)})):(z.delete(s),t(p,e.method,l)):(z.delete(s),o(p,e.method,l))}catch(o){z.delete(s),o instanceof i.ResponseError?t(o,e.method,l):o&&n.string(o.message)?r(new i.ResponseError(i.ErrorCodes.InternalError,`Request ${e.method} failed with message: ${o.message}`),e.method,l):r(new i.ResponseError(i.ErrorCodes.InternalError,`Request ${e.method} failed unexpectedly without providing any details.`),e.method,l)}}else r(new i.ResponseError(i.ErrorCodes.MethodNotFound,`Unhandled method ${e.method}`),e.method,l)}(e):i.Message.isNotification(e)?function(e){if(te())return;let t,n;if(e.method===a.type.method){const t=e.params.id;return F.delete(t),void ce(e)}{const i=L.get(e.method);i&&(n=i.handler,t=i.type)}if(n||j)try{if(ce(e),n)if(void 0===e.params)void 0!==t&&0!==t.numberOfParams&&t.parameterStructures!==i.ParameterStructures.byName&&_.error(`Notification ${e.method} defines ${t.numberOfParams} params but received none.`),n();else if(Array.isArray(e.params)){const r=e.params;e.method===l.type.method&&2===r.length&&c.is(r[0])?n({token:r[0],value:r[1]}):(void 0!==t&&(t.parameterStructures===i.ParameterStructures.byName&&_.error(`Notification ${e.method} defines parameters by name but received parameters by position`),t.numberOfParams!==e.params.length&&_.error(`Notification ${e.method} defines ${t.numberOfParams} params but received ${r.length} arguments`)),n(...r))}else void 0!==t&&t.parameterStructures===i.ParameterStructures.byPosition&&_.error(`Notification ${e.method} defines parameters by position but received parameters by name`),n(e.params);else j&&j(e.method,e.params)}catch(t){t.message?_.error(`Notification handler '${e.method}' failed with message: ${t.message}`):_.error(`Notification handler '${e.method}' failed unexpectedly.`)}else G.fire(e)}(e):i.Message.isResponse(e)?function(e){if(te())return;if(null===e.id)e.error?_.error(`Received response message without id: Error is: \n${JSON.stringify(e.error,void 0,4)}`):_.error("Received response message without id. No further error information provided.");else{const t=e.id,n=M.get(t);if(function(e,t){if(B===p.Off||!$)return;if(q===f.Text){let n;if(B!==p.Verbose&&B!==p.Compact||(e.error&&e.error.data?n=`Error data: ${se(e.error.data)}\n\n`:e.result?n=`Result: ${se(e.result)}\n\n`:void 0===e.error&&(n="No result returned.\n\n")),t){const i=e.error?` Request failed: ${e.error.message} (${e.error.code}).`:"";$.log(`Received response '${t.method} - (${e.id})' in ${Date.now()-t.timerStart}ms.${i}`,n)}else $.log(`Received response ${e.id} without active response promise.`,n)}else le("receive-response",e)}(e,n),void 0!==n){M.delete(t);try{if(e.error){const t=e.error;n.reject(new i.ResponseError(t.code,t.message,t.data))}else{if(void 0===e.result)throw new Error("Should never happen.");n.resolve(e.result)}}catch(e){e.message?_.error(`Response handler '${n.method}' failed with message: ${e.message}`):_.error(`Response handler '${n.method}' failed unexpectedly.`)}}}}(e):function(e){if(!e)return void _.error("Received empty message.");_.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(e,null,4)}`);const t=e;if(n.string(t.id)||n.number(t.id)){const e=t.id,n=M.get(e);n&&n.reject(new Error("The received response has neither a result nor an error property."))}}(e)}d.onClose(ne),d.onError((function(e){H.fire([e,void 0,void 0])})),v.onClose(ne),v.onError((function(e){H.fire(e)}));const oe=e=>{try{if(i.Message.isNotification(e)&&e.method===a.type.method){const t=e.params.id,n=Y(t),r=D.get(n);if(i.Message.isRequest(r)){const i=y?.connectionStrategy,o=i&&i.cancelUndispatched?i.cancelUndispatched(r,X):void 0;if(o&&(void 0!==o.error||void 0!==o.result))return D.delete(n),z.delete(t),o.id=r.id,ae(o,e.method,Date.now()),void v.write(o).catch((()=>_.error("Sending response for canceled message failed.")))}const o=z.get(t);if(void 0!==o)return o.cancel(),void ce(e);F.add(t)}Z(D,e)}finally{ie()}};function se(e){if(null!=e)switch(B){case p.Verbose:return JSON.stringify(e,null,4);case p.Compact:return JSON.stringify(e);default:return}}function ae(e,t,n){if(B!==p.Off&&$)if(q===f.Text){let i;B!==p.Verbose&&B!==p.Compact||(e.error&&e.error.data?i=`Error data: ${se(e.error.data)}\n\n`:e.result?i=`Result: ${se(e.result)}\n\n`:void 0===e.error&&(i="No result returned.\n\n")),$.log(`Sending response '${t} - (${e.id})'. Processing request took ${Date.now()-n}ms`,i)}else le("send-response",e)}function ce(e){if(B!==p.Off&&$&&e.method!==h.type.method)if(q===f.Text){let t;B!==p.Verbose&&B!==p.Compact||(t=e.params?`Params: ${se(e.params)}\n\n`:"No parameters provided.\n\n"),$.log(`Received notification '${e.method}'.`,t)}else le("receive-notification",e)}function le(e,t){if(!$||B===p.Off)return;const n={isLSPMessage:!0,type:e,message:t,timestamp:Date.now()};$.log(n)}function ue(){if(ee())throw new R(g.Closed,"Connection is closed.");if(te())throw new R(g.Disposed,"Connection is disposed.")}function pe(e){return void 0===e?null:e}function de(e){return null===e?void 0:e}function fe(e){return null!=e&&!Array.isArray(e)&&"object"==typeof e}function me(e,t){switch(e){case i.ParameterStructures.auto:return fe(t)?de(t):[pe(t)];case i.ParameterStructures.byName:if(!fe(t))throw new Error("Received parameters by name but param is not an object literal.");return de(t);case i.ParameterStructures.byPosition:return[pe(t)];default:throw new Error(`Unknown parameter structure ${e.toString()}`)}}function he(e,t){let n;const i=e.numberOfParams;switch(i){case 0:n=void 0;break;case 1:n=me(e.parameterStructures,t[0]);break;default:n=[];for(let e=0;e<t.length&&e<i;e++)n.push(pe(t[e]));if(t.length<i)for(let e=t.length;e<i;e++)n.push(null)}return n}const ge={sendNotification:(e,...t)=>{let r,o;if(ue(),n.string(e)){r=e;const n=t[0];let s=0,a=i.ParameterStructures.auto;i.ParameterStructures.is(n)&&(s=1,a=n);let c=t.length;const l=c-s;switch(l){case 0:o=void 0;break;case 1:o=me(a,t[s]);break;default:if(a===i.ParameterStructures.byName)throw new Error(`Received ${l} parameters for 'by Name' notification parameter structure.`);o=t.slice(s,c).map((e=>pe(e)))}}else{const n=t;r=e.method,o=he(e,n)}const s={jsonrpc:C,method:r,params:o};return function(e){if(B!==p.Off&&$)if(q===f.Text){let t;B!==p.Verbose&&B!==p.Compact||(t=e.params?`Params: ${se(e.params)}\n\n`:"No parameters provided.\n\n"),$.log(`Sending notification '${e.method}'.`,t)}else le("send-notification",e)}(s),v.write(s).catch((e=>{throw _.error("Sending notification failed."),e}))},onNotification:(e,t)=>{let i;return ue(),n.func(e)?j=e:t&&(n.string(e)?(i=e,L.set(e,{type:void 0,handler:t})):(i=e.method,L.set(e.method,{type:e,handler:t}))),{dispose:()=>{void 0!==i?L.delete(i):j=void 0}}},onProgress:(e,t,n)=>{if(N.has(t))throw new Error(`Progress handler for token ${t} already registered`);return N.set(t,n),{dispose:()=>{N.delete(t)}}},sendProgress:(e,t,n)=>ge.sendNotification(l.type,{token:t,value:n}),onUnhandledProgress:V.event,sendRequest:(e,...t)=>{let r,o,a;if(ue(),function(){if(!Q())throw new Error("Call listen() first.")}(),n.string(e)){r=e;const n=t[0],c=t[t.length-1];let l=0,u=i.ParameterStructures.auto;i.ParameterStructures.is(n)&&(l=1,u=n);let p=t.length;s.CancellationToken.is(c)&&(p-=1,a=c);const d=p-l;switch(d){case 0:o=void 0;break;case 1:o=me(u,t[l]);break;default:if(u===i.ParameterStructures.byName)throw new Error(`Received ${d} parameters for 'by Name' request parameter structure.`);o=t.slice(l,p).map((e=>pe(e)))}}else{const n=t;r=e.method,o=he(e,n);const i=e.numberOfParams;a=s.CancellationToken.is(n[i])?n[i]:void 0}const c=S++;let l;a&&(l=a.onCancellationRequested((()=>{const e=J.sender.sendCancellation(ge,c);return void 0===e?(_.log(`Received no promise from cancellation strategy when cancelling id ${c}`),Promise.resolve()):e.catch((()=>{_.log(`Sending cancellation messages for id ${c} failed`)}))})));const u={jsonrpc:C,id:c,method:r,params:o};return function(e){if(B!==p.Off&&$)if(q===f.Text){let t;B!==p.Verbose&&B!==p.Compact||!e.params||(t=`Params: ${se(e.params)}\n\n`),$.log(`Sending request '${e.method} - (${e.id})'.`,t)}else le("send-request",e)}(u),"function"==typeof J.sender.enableCancellation&&J.sender.enableCancellation(u),new Promise((async(e,t)=>{const n={method:r,timerStart:Date.now(),resolve:t=>{e(t),J.sender.cleanup(c),l?.dispose()},reject:e=>{t(e),J.sender.cleanup(c),l?.dispose()}};try{M.set(c,n),await v.write(u)}catch(e){throw M.delete(c),n.reject(new i.ResponseError(i.ErrorCodes.MessageWriteError,e.message?e.message:"Unknown reason")),_.error("Sending request failed."),e}}))},onRequest:(e,t)=>{ue();let i=null;return u.is(e)?(i=void 0,A=e):n.string(e)?(i=null,void 0!==t&&(i=e,P.set(e,{handler:t,type:void 0}))):void 0!==t&&(i=e.method,P.set(e.method,{type:e,handler:t})),{dispose:()=>{null!==i&&(void 0!==i?P.delete(i):A=void 0)}}},hasPendingResponse:()=>M.size>0,trace:async(e,t,i)=>{let r=!1,o=f.Text;void 0!==i&&(n.boolean(i)?r=i:(r=i.sendNotification||!1,o=i.traceFormat||f.Text)),B=e,q=o,$=B===p.Off?void 0:t,!r||ee()||te()||await ge.sendNotification(m.type,{value:p.toString(e)})},onError:H.event,onClose:W.event,onUnhandledNotification:G.event,onDispose:K.event,end:()=>{v.end()},dispose:()=>{if(te())return;U=k.Disposed,K.fire(void 0);const e=new i.ResponseError(i.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(const t of M.values())t.reject(e);M=new Map,z=new Map,F=new Set,D=new r.LinkedMap,n.func(v.dispose)&&v.dispose(),n.func(d.dispose)&&d.dispose()},listen:()=>{ue(),function(){if(Q())throw new R(g.AlreadyListening,"Connection is already listening")}(),U=k.Listening,d.listen(oe)},inspect:()=>{(0,t.default)().console.log("inspect")}};return ge.onNotification(h.type,(e=>{if(B===p.Off||!$)return;const t=B===p.Verbose||B===p.Compact;$.log(e.message,t?e.verbose:void 0)})),ge.onNotification(l.type,(e=>{const t=N.get(e.token);t?t(e.value):V.fire(e)})),ge}}(w_)),w_}function S_(){return __||(__=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ProgressType=e.ProgressToken=e.createMessageConnection=e.NullLogger=e.ConnectionOptions=e.ConnectionStrategy=e.AbstractMessageBuffer=e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=e.SharedArrayReceiverStrategy=e.SharedArraySenderStrategy=e.CancellationToken=e.CancellationTokenSource=e.Emitter=e.Event=e.Disposable=e.LRUCache=e.Touch=e.LinkedMap=e.ParameterStructures=e.NotificationType9=e.NotificationType8=e.NotificationType7=e.NotificationType6=e.NotificationType5=e.NotificationType4=e.NotificationType3=e.NotificationType2=e.NotificationType1=e.NotificationType0=e.NotificationType=e.ErrorCodes=e.ResponseError=e.RequestType9=e.RequestType8=e.RequestType7=e.RequestType6=e.RequestType5=e.RequestType4=e.RequestType3=e.RequestType2=e.RequestType1=e.RequestType0=e.RequestType=e.Message=e.RAL=void 0,e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=void 0;const t=Ky();Object.defineProperty(e,"Message",{enumerable:!0,get:function(){return t.Message}}),Object.defineProperty(e,"RequestType",{enumerable:!0,get:function(){return t.RequestType}}),Object.defineProperty(e,"RequestType0",{enumerable:!0,get:function(){return t.RequestType0}}),Object.defineProperty(e,"RequestType1",{enumerable:!0,get:function(){return t.RequestType1}}),Object.defineProperty(e,"RequestType2",{enumerable:!0,get:function(){return t.RequestType2}}),Object.defineProperty(e,"RequestType3",{enumerable:!0,get:function(){return t.RequestType3}}),Object.defineProperty(e,"RequestType4",{enumerable:!0,get:function(){return t.RequestType4}}),Object.defineProperty(e,"RequestType5",{enumerable:!0,get:function(){return t.RequestType5}}),Object.defineProperty(e,"RequestType6",{enumerable:!0,get:function(){return t.RequestType6}}),Object.defineProperty(e,"RequestType7",{enumerable:!0,get:function(){return t.RequestType7}}),Object.defineProperty(e,"RequestType8",{enumerable:!0,get:function(){return t.RequestType8}}),Object.defineProperty(e,"RequestType9",{enumerable:!0,get:function(){return t.RequestType9}}),Object.defineProperty(e,"ResponseError",{enumerable:!0,get:function(){return t.ResponseError}}),Object.defineProperty(e,"ErrorCodes",{enumerable:!0,get:function(){return t.ErrorCodes}}),Object.defineProperty(e,"NotificationType",{enumerable:!0,get:function(){return t.NotificationType}}),Object.defineProperty(e,"NotificationType0",{enumerable:!0,get:function(){return t.NotificationType0}}),Object.defineProperty(e,"NotificationType1",{enumerable:!0,get:function(){return t.NotificationType1}}),Object.defineProperty(e,"NotificationType2",{enumerable:!0,get:function(){return t.NotificationType2}}),Object.defineProperty(e,"NotificationType3",{enumerable:!0,get:function(){return t.NotificationType3}}),Object.defineProperty(e,"NotificationType4",{enumerable:!0,get:function(){return t.NotificationType4}}),Object.defineProperty(e,"NotificationType5",{enumerable:!0,get:function(){return t.NotificationType5}}),Object.defineProperty(e,"NotificationType6",{enumerable:!0,get:function(){return t.NotificationType6}}),Object.defineProperty(e,"NotificationType7",{enumerable:!0,get:function(){return t.NotificationType7}}),Object.defineProperty(e,"NotificationType8",{enumerable:!0,get:function(){return t.NotificationType8}}),Object.defineProperty(e,"NotificationType9",{enumerable:!0,get:function(){return t.NotificationType9}}),Object.defineProperty(e,"ParameterStructures",{enumerable:!0,get:function(){return t.ParameterStructures}});const n=Zy();Object.defineProperty(e,"LinkedMap",{enumerable:!0,get:function(){return n.LinkedMap}}),Object.defineProperty(e,"LRUCache",{enumerable:!0,get:function(){return n.LRUCache}}),Object.defineProperty(e,"Touch",{enumerable:!0,get:function(){return n.Touch}});const i=(Xy||(Xy=1,Object.defineProperty(Qy,"__esModule",{value:!0}),Qy.Disposable=void 0,function(e){e.create=function(e){return{dispose:e}}}(r||(Qy.Disposable=r={}))),Qy);var r;Object.defineProperty(e,"Disposable",{enumerable:!0,get:function(){return i.Disposable}});const o=o_();Object.defineProperty(e,"Event",{enumerable:!0,get:function(){return o.Event}}),Object.defineProperty(e,"Emitter",{enumerable:!0,get:function(){return o.Emitter}});const s=c_();Object.defineProperty(e,"CancellationTokenSource",{enumerable:!0,get:function(){return s.CancellationTokenSource}}),Object.defineProperty(e,"CancellationToken",{enumerable:!0,get:function(){return s.CancellationToken}});const a=function(){if(l_)return u_;l_=1,Object.defineProperty(u_,"__esModule",{value:!0}),u_.SharedArrayReceiverStrategy=u_.SharedArraySenderStrategy=void 0;const e=c_();var t;!function(e){e.Continue=0,e.Cancelled=1}(t||(t={})),u_.SharedArraySenderStrategy=class{constructor(){this.buffers=new Map}enableCancellation(e){if(null===e.id)return;const n=new SharedArrayBuffer(4);new Int32Array(n,0,1)[0]=t.Continue,this.buffers.set(e.id,n),e.$cancellationData=n}async sendCancellation(e,n){const i=this.buffers.get(n);if(void 0===i)return;const r=new Int32Array(i,0,1);Atomics.store(r,0,t.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};class n{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===t.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}}class i{constructor(e){this.token=new n(e)}cancel(){}dispose(){}}return u_.SharedArrayReceiverStrategy=class{constructor(){this.kind="request"}createCancellationTokenSource(t){const n=t.$cancellationData;return void 0===n?new e.CancellationTokenSource:new i(n)}},u_}();Object.defineProperty(e,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return a.SharedArraySenderStrategy}}),Object.defineProperty(e,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return a.SharedArrayReceiverStrategy}});const c=function(){if(d_)return f_;d_=1,Object.defineProperty(f_,"__esModule",{value:!0}),f_.ReadableStreamMessageReader=f_.AbstractMessageReader=f_.MessageReader=void 0;const e=r_(),t=Vy(),n=o_(),i=h_();var r,o;!function(e){e.is=function(e){let n=e;return n&&t.func(n.listen)&&t.func(n.dispose)&&t.func(n.onError)&&t.func(n.onClose)&&t.func(n.onPartialMessage)}}(r||(f_.MessageReader=r={}));class s{constructor(){this.errorEmitter=new n.Emitter,this.closeEmitter=new n.Emitter,this.partialMessageEmitter=new n.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e){this.errorEmitter.fire(this.asError(e))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(e){this.partialMessageEmitter.fire(e)}asError(e){return e instanceof Error?e:new Error(`Reader received error. Reason: ${t.string(e.message)?e.message:"unknown"}`)}}return f_.AbstractMessageReader=s,function(t){t.fromOptions=function(t){let n,i;const r=new Map;let o;const s=new Map;if(void 0===t||"string"==typeof t)n=t??"utf-8";else{if(n=t.charset??"utf-8",void 0!==t.contentDecoder&&(i=t.contentDecoder,r.set(i.name,i)),void 0!==t.contentDecoders)for(const e of t.contentDecoders)r.set(e.name,e);if(void 0!==t.contentTypeDecoder&&(o=t.contentTypeDecoder,s.set(o.name,o)),void 0!==t.contentTypeDecoders)for(const e of t.contentTypeDecoders)s.set(e.name,e)}return void 0===o&&(o=(0,e.default)().applicationJson.decoder,s.set(o.name,o)),{charset:n,contentDecoder:i,contentDecoders:r,contentTypeDecoder:o,contentTypeDecoders:s}}}(o||(o={})),f_.ReadableStreamMessageReader=class extends s{constructor(t,n){super(),this.readable=t,this.options=o.fromOptions(n),this.buffer=(0,e.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new i.Semaphore(1)}set partialMessageTimeout(e){this._partialMessageTimeout=e}get partialMessageTimeout(){return this._partialMessageTimeout}listen(e){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=e;const t=this.readable.onData((e=>{this.onData(e)}));return this.readable.onError((e=>this.fireError(e))),this.readable.onClose((()=>this.fireClose())),t}onData(e){try{for(this.buffer.append(e);;){if(-1===this.nextMessageLength){const e=this.buffer.tryReadHeaders(!0);if(!e)return;const t=e.get("content-length");if(!t)return void this.fireError(new Error(`Header must provide a Content-Length property.\n${JSON.stringify(Object.fromEntries(e))}`));const n=parseInt(t);if(isNaN(n))return void this.fireError(new Error(`Content-Length value must be a number. Got ${t}`));this.nextMessageLength=n}const e=this.buffer.tryReadBody(this.nextMessageLength);if(void 0===e)return void this.setPartialMessageTimer();this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock((async()=>{const t=void 0!==this.options.contentDecoder?await this.options.contentDecoder.decode(e):e,n=await this.options.contentTypeDecoder.decode(t,this.options);this.callback(n)})).catch((e=>{this.fireError(e)}))}}catch(e){this.fireError(e)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),this._partialMessageTimeout<=0||(this.partialMessageTimer=(0,e.default)().timer.setTimeout(((e,t)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:t}),this.setPartialMessageTimer())}),this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}},f_}();Object.defineProperty(e,"MessageReader",{enumerable:!0,get:function(){return c.MessageReader}}),Object.defineProperty(e,"AbstractMessageReader",{enumerable:!0,get:function(){return c.AbstractMessageReader}}),Object.defineProperty(e,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return c.ReadableStreamMessageReader}});const l=function(){if(g_)return v_;g_=1,Object.defineProperty(v_,"__esModule",{value:!0}),v_.WriteableStreamMessageWriter=v_.AbstractMessageWriter=v_.MessageWriter=void 0;const e=r_(),t=Vy(),n=h_(),i=o_();var r,o;!function(e){e.is=function(e){let n=e;return n&&t.func(n.dispose)&&t.func(n.onClose)&&t.func(n.onError)&&t.func(n.write)}}(r||(v_.MessageWriter=r={}));class s{constructor(){this.errorEmitter=new i.Emitter,this.closeEmitter=new i.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,t,n){this.errorEmitter.fire([this.asError(e),t,n])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(e){return e instanceof Error?e:new Error(`Writer received error. Reason: ${t.string(e.message)?e.message:"unknown"}`)}}return v_.AbstractMessageWriter=s,function(t){t.fromOptions=function(t){return void 0===t||"string"==typeof t?{charset:t??"utf-8",contentTypeEncoder:(0,e.default)().applicationJson.encoder}:{charset:t.charset??"utf-8",contentEncoder:t.contentEncoder,contentTypeEncoder:t.contentTypeEncoder??(0,e.default)().applicationJson.encoder}}}(o||(o={})),v_.WriteableStreamMessageWriter=class extends s{constructor(e,t){super(),this.writable=e,this.options=o.fromOptions(t),this.errorCount=0,this.writeSemaphore=new n.Semaphore(1),this.writable.onError((e=>this.fireError(e))),this.writable.onClose((()=>this.fireClose()))}async write(e){return this.writeSemaphore.lock((async()=>this.options.contentTypeEncoder.encode(e,this.options).then((e=>void 0!==this.options.contentEncoder?this.options.contentEncoder.encode(e):e)).then((t=>{const n=[];return n.push("Content-Length: ",t.byteLength.toString(),"\r\n"),n.push("\r\n"),this.doWrite(e,n,t)}),(e=>{throw this.fireError(e),e}))))}async doWrite(e,t,n){try{return await this.writable.write(t.join(""),"ascii"),this.writable.write(n)}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){this.writable.end()}},v_}();Object.defineProperty(e,"MessageWriter",{enumerable:!0,get:function(){return l.MessageWriter}}),Object.defineProperty(e,"AbstractMessageWriter",{enumerable:!0,get:function(){return l.AbstractMessageWriter}}),Object.defineProperty(e,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return l.WriteableStreamMessageWriter}});const u=(x_||(x_=1,Object.defineProperty(b_,"__esModule",{value:!0}),b_.AbstractMessageBuffer=void 0,b_.AbstractMessageBuffer=class{constructor(e="utf-8"){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){const t="string"==typeof e?this.fromString(e,this._encoding):e;this._chunks.push(t),this._totalLength+=t.byteLength}tryReadHeaders(e=!1){if(0===this._chunks.length)return;let t=0,n=0,i=0,r=0;e:for(;n<this._chunks.length;){const e=this._chunks[n];for(i=0;i<e.length;){switch(e[i]){case 13:switch(t){case 0:t=1;break;case 2:t=3;break;default:t=0}break;case 10:switch(t){case 1:t=2;break;case 3:t=4,i++;break e;default:t=0}break;default:t=0}i++}r+=e.byteLength,n++}if(4!==t)return;const o=this._read(r+i),s=new Map,a=this.toString(o,"ascii").split("\r\n");if(a.length<2)return s;for(let t=0;t<a.length-2;t++){const n=a[t],i=n.indexOf(":");if(-1===i)throw new Error(`Message header must separate key and value using ':'\n${n}`);const r=n.substr(0,i),o=n.substr(i+1).trim();s.set(e?r.toLowerCase():r,o)}return s}tryReadBody(e){if(!(this._totalLength<e))return this._read(e)}get numberOfBytes(){return this._totalLength}_read(e){if(0===e)return this.emptyBuffer();if(e>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===e){const t=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(t)}if(this._chunks[0].byteLength>e){const t=this._chunks[0],n=this.asNative(t,e);return this._chunks[0]=t.slice(e),this._totalLength-=e,n}const t=this.allocNative(e);let n=0;for(;e>0;){const i=this._chunks[0];if(i.byteLength>e){const r=i.slice(0,e);t.set(r,n),n+=e,this._chunks[0]=i.slice(e),this._totalLength-=e,e-=e}else t.set(i,n),n+=i.byteLength,this._chunks.shift(),this._totalLength-=i.byteLength,e-=i.byteLength}return t}}),b_);Object.defineProperty(e,"AbstractMessageBuffer",{enumerable:!0,get:function(){return u.AbstractMessageBuffer}});const p=E_();Object.defineProperty(e,"ConnectionStrategy",{enumerable:!0,get:function(){return p.ConnectionStrategy}}),Object.defineProperty(e,"ConnectionOptions",{enumerable:!0,get:function(){return p.ConnectionOptions}}),Object.defineProperty(e,"NullLogger",{enumerable:!0,get:function(){return p.NullLogger}}),Object.defineProperty(e,"createMessageConnection",{enumerable:!0,get:function(){return p.createMessageConnection}}),Object.defineProperty(e,"ProgressToken",{enumerable:!0,get:function(){return p.ProgressToken}}),Object.defineProperty(e,"ProgressType",{enumerable:!0,get:function(){return p.ProgressType}}),Object.defineProperty(e,"Trace",{enumerable:!0,get:function(){return p.Trace}}),Object.defineProperty(e,"TraceValues",{enumerable:!0,get:function(){return p.TraceValues}}),Object.defineProperty(e,"TraceFormat",{enumerable:!0,get:function(){return p.TraceFormat}}),Object.defineProperty(e,"SetTraceNotification",{enumerable:!0,get:function(){return p.SetTraceNotification}}),Object.defineProperty(e,"LogTraceNotification",{enumerable:!0,get:function(){return p.LogTraceNotification}}),Object.defineProperty(e,"ConnectionErrors",{enumerable:!0,get:function(){return p.ConnectionErrors}}),Object.defineProperty(e,"ConnectionError",{enumerable:!0,get:function(){return p.ConnectionError}}),Object.defineProperty(e,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return p.CancellationReceiverStrategy}}),Object.defineProperty(e,"CancellationSenderStrategy",{enumerable:!0,get:function(){return p.CancellationSenderStrategy}}),Object.defineProperty(e,"CancellationStrategy",{enumerable:!0,get:function(){return p.CancellationStrategy}}),Object.defineProperty(e,"MessageStrategy",{enumerable:!0,get:function(){return p.MessageStrategy}});const d=r_();e.RAL=d.default}(Hy)),Hy}Object.defineProperty(Uy,"__esModule",{value:!0});const k_=b,R_=S_();class T_ extends R_.AbstractMessageBuffer{constructor(e="utf-8"){super(e)}emptyBuffer(){return T_.emptyBuffer}fromString(e,t){return Buffer.from(e,t)}toString(e,t){return e instanceof Buffer?e.toString(t):new k_.TextDecoder(t).decode(e)}asNative(e,t){return void 0===t?e instanceof Buffer?e:Buffer.from(e):e instanceof Buffer?e.slice(0,t):Buffer.from(e,0,t)}allocNative(e){return Buffer.allocUnsafe(e)}}T_.emptyBuffer=Buffer.allocUnsafe(0);class O_{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),R_.Disposable.create((()=>this.stream.off("close",e)))}onError(e){return this.stream.on("error",e),R_.Disposable.create((()=>this.stream.off("error",e)))}onEnd(e){return this.stream.on("end",e),R_.Disposable.create((()=>this.stream.off("end",e)))}onData(e){return this.stream.on("data",e),R_.Disposable.create((()=>this.stream.off("data",e)))}}class C_{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),R_.Disposable.create((()=>this.stream.off("close",e)))}onError(e){return this.stream.on("error",e),R_.Disposable.create((()=>this.stream.off("error",e)))}onEnd(e){return this.stream.on("end",e),R_.Disposable.create((()=>this.stream.off("end",e)))}write(e,t){return new Promise(((n,i)=>{const r=e=>{null==e?n():i(e)};"string"==typeof e?this.stream.write(e,t,r):this.stream.write(e,r)}))}end(){this.stream.end()}}const A_=Object.freeze({messageBuffer:Object.freeze({create:e=>new T_(e)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(e,t)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(e,void 0,0),t.charset))}catch(e){return Promise.reject(e)}}}),decoder:Object.freeze({name:"application/json",decode:(e,t)=>{try{return e instanceof Buffer?Promise.resolve(JSON.parse(e.toString(t.charset))):Promise.resolve(JSON.parse(new k_.TextDecoder(t.charset).decode(e)))}catch(e){return Promise.reject(e)}}})}),stream:Object.freeze({asReadableStream:e=>new O_(e),asWritableStream:e=>new C_(e)}),console:console,timer:Object.freeze({setTimeout(e,t,...n){const i=setTimeout(e,t,...n);return{dispose:()=>clearTimeout(i)}},setImmediate(e,...t){const n=setImmediate(e,...t);return{dispose:()=>clearImmediate(n)}},setInterval(e,t,...n){const i=setInterval(e,t,...n);return{dispose:()=>clearInterval(i)}}})});function P_(){return A_}!function(e){e.install=function(){R_.RAL.install(A_)}}(P_||(P_={})),Uy.default=P_,function(e){var t=Fe&&Fe.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),n=Fe&&Fe.__exportStar||function(e,n){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(n,i)||t(n,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.createServerSocketTransport=e.createClientSocketTransport=e.createServerPipeTransport=e.createClientPipeTransport=e.generateRandomPipeName=e.StreamMessageWriter=e.StreamMessageReader=e.SocketMessageWriter=e.SocketMessageReader=e.PortMessageWriter=e.PortMessageReader=e.IPCMessageWriter=e.IPCMessageReader=void 0;const i=Uy;i.default.install();const r=p,o=_,s=R,a=N,c=S_();n(S_(),e);class l extends c.AbstractMessageReader{constructor(e){super(),this.process=e;let t=this.process;t.on("error",(e=>this.fireError(e))),t.on("close",(()=>this.fireClose()))}listen(e){return this.process.on("message",e),c.Disposable.create((()=>this.process.off("message",e)))}}e.IPCMessageReader=l;class u extends c.AbstractMessageWriter{constructor(e){super(),this.process=e,this.errorCount=0;const t=this.process;t.on("error",(e=>this.fireError(e))),t.on("close",(()=>this.fireClose))}write(e){try{return"function"==typeof this.process.send&&this.process.send(e,void 0,void 0,(t=>{t?(this.errorCount++,this.handleError(t,e)):this.errorCount=0})),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}}e.IPCMessageWriter=u;class d extends c.AbstractMessageReader{constructor(e){super(),this.onData=new c.Emitter,e.on("close",(()=>this.fireClose)),e.on("error",(e=>this.fireError(e))),e.on("message",(e=>{this.onData.fire(e)}))}listen(e){return this.onData.event(e)}}e.PortMessageReader=d;class f extends c.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.on("close",(()=>this.fireClose())),e.on("error",(e=>this.fireError(e)))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}}e.PortMessageWriter=f;class m extends c.ReadableStreamMessageReader{constructor(e,t="utf-8"){super((0,i.default)().stream.asReadableStream(e),t)}}e.SocketMessageReader=m;class h extends c.WriteableStreamMessageWriter{constructor(e,t){super((0,i.default)().stream.asWritableStream(e),t),this.socket=e}dispose(){super.dispose(),this.socket.destroy()}}e.SocketMessageWriter=h;class g extends c.ReadableStreamMessageReader{constructor(e,t){super((0,i.default)().stream.asReadableStream(e),t)}}e.StreamMessageReader=g;class v extends c.WriteableStreamMessageWriter{constructor(e,t){super((0,i.default)().stream.asWritableStream(e),t)}}e.StreamMessageWriter=v;const x=process.env.XDG_RUNTIME_DIR,b=new Map([["linux",107],["darwin",103]]);e.generateRandomPipeName=function(){const e=(0,s.randomBytes)(21).toString("hex");if("win32"===process.platform)return`\\\\.\\pipe\\vscode-jsonrpc-${e}-sock`;let t;t=x?r.join(x,`vscode-ipc-${e}.sock`):r.join(o.tmpdir(),`vscode-${e}.sock`);const n=b.get(process.platform);return void 0!==n&&t.length>n&&(0,i.default)().console.warn(`WARNING: IPC handle "${t}" is longer than ${n} characters.`),t},e.createClientPipeTransport=function(e,t="utf-8"){let n;const i=new Promise(((e,t)=>{n=e}));return new Promise(((r,o)=>{let s=(0,a.createServer)((e=>{s.close(),n([new m(e,t),new h(e,t)])}));s.on("error",o),s.listen(e,(()=>{s.removeListener("error",o),r({onConnected:()=>i})}))}))},e.createServerPipeTransport=function(e,t="utf-8"){const n=(0,a.createConnection)(e);return[new m(n,t),new h(n,t)]},e.createClientSocketTransport=function(e,t="utf-8"){let n;const i=new Promise(((e,t)=>{n=e}));return new Promise(((r,o)=>{const s=(0,a.createServer)((e=>{s.close(),n([new m(e,t),new h(e,t)])}));s.on("error",o),s.listen(e,"127.0.0.1",(()=>{s.removeListener("error",o),r({onConnected:()=>i})}))}))},e.createServerSocketTransport=function(e,t="utf-8"){const n=(0,a.createConnection)(e,"127.0.0.1");return[new m(n,t),new h(n,t)]},e.createMessageConnection=function(e,t,n,i){n||(n=c.NullLogger);const r=function(e){const t=e;return void 0!==t.read&&void 0!==t.addListener}(e)?new g(e):e,o=function(e){const t=e;return void 0!==t.write&&void 0!==t.addListener}(t)?new v(t):t;return c.ConnectionStrategy.is(i)&&(i={connectionStrategy:i}),(0,c.createMessageConnection)(r,o,n,i)}}(qy);var j_=qy;const L_=[],N_={enableInlineSuggestion:void 0,superCompletion:!0,completionMode:{autoCompletion:!0,manualCompletion:!0},disabledLanguage:[],completionSpeedAndAccuracy:"extremeAccurate",codelensDisplayMode:"expand",enableDocstringOutputInEditor:{functionDocstringOutputInEditor:!0,inlineCommentOutputInEditor:!0},enableStreamingSession:void 0,enableCodelens:{enableInlineUnitTest:!0,enableInlineExplain:!0,enableInlineDocstring:!0,enableInlineSplit:!0,enableInlineComment:!0,enableInlineOptimize:!0,enableInlineLog:!0},username:"",license:"",enableSecurityScanBox:void 0,displayLanguage:"zh-cn",enableSecurityEnhancement:!1,enableSecurityIntelligence:void 0,enableDebugIntelligence:void 0,enableCodebaseEnhancedContext:void 0,completionLength:"auto",enableCommentEnhancement:void 0,privateService:"",smartPaste:!0,beta:void 0,terminalAutoExecution:"turbo",terminalAutoExecutionDenyList:L_,terminalAutoExecutionAllowList:[],zuluConfig:{terminalAutoExecution:"turbo",terminalAutoExecutionDenyList:L_,terminalAutoExecutionAllowList:[]}},I_=r(L(import.meta.url));class $_{cwd;shell="bin/bash";license;username;ideSeries;ideVersion;ideName;platform;deviceId;pluginVersion;httpProxy;ripgrepPath;extensionConfig=N_;client;isReady=!1;_readyResolver;isSerivceReady=!1;_readyServiceResolver;constructor(e){this.cwd=e.cwd,this.shell=e.shell,this.license=e.license,this.username=e.username,this.ideSeries=e.ideSeries,this.ideVersion=e.ideVersion,this.ideName=e.ideName,this.platform=e.platform,this.deviceId=e.deviceId,this.pluginVersion=e.pluginVersion,this.httpProxy=e.httpProxy,this.extensionConfig.username=e.username,this.extensionConfig.license=e.license,this.ripgrepPath=e.ripgrepPath}async start(){const e=await this.engineExec(),t=new j_.StreamMessageReader(e.stdout),n=new j_.StreamMessageWriter(e.stdin);this.client=j_.createMessageConnection(t,n),this.client.onRequest("USER_DETAIL",(async()=>({status:"success",payload:{name:this.username,license:this.license,ideVersion:this.ideVersion,platform:this.platform,version:this.pluginVersion,language:"zh",customizeService:void 0,device:this.deviceId}}))),this.client.onRequest("kernel/kernelConfig/fetch",(async()=>({code:0,message:"success",data:{appRoot:this.cwd,appHost:"desktop",deviceId:this.deviceId,ideName:this.ideName,ideSeries:this.ideSeries,ideVersion:this.ideVersion,environment:Cy.PRODUCTION,extensionVersion:this.pluginVersion,platform:this.platform,themeColor:"dark",ideTerminalInfo:{defaultShell:this.shell}}}))),this.client.onRequest(Ly,(async()=>(De("KERNEL CLIENT REC <--------",Ly),{code:0,message:"success",data:N_}))),this.client.onNotification("kernel/system/initialized",(()=>{this.isReady=!0,this._readyResolver?.()})),this.client.onNotification("ENGINE_SERVICE_INITIALIZED",(()=>{this.isSerivceReady=!0,this._readyServiceResolver?.()})),this.client.listen(),this.setupLogHandlers(),await this.initializeLSP(),De("LSP Client started")}async sendRequest(e,t){if(De("COMATE PLUSE CLIENT send --------\x3e",e,JSON.stringify(t)),!this.client)throw new Error("Client not initialized");return this.client.sendRequest(e,t)}onRequest(e,t){if(!this.client)throw new Error("Client not initialized:"+e);return this.client.onRequest(e,t)}onNotification(e,t){if(!this.client)throw new Error("Client not initialized:"+e);this.client.onNotification(e,t)}async handleConfigChange(){this.client?this.client.sendRequest("ide/extensionConfig/didChange",N_):console.warn("Client not initialized")}async initializeLSP(){if(!this.client)throw new Error("Client not initialized");const e={processId:process.pid,clientInfo:{name:"vscode-comate-client",version:"1.0.0"},rootPath:this.cwd,rootUri:My.file(this.cwd).toString(),capabilities:{workspace:{workspaceFolders:!0,configuration:!0},textDocument:{synchronization:{dynamicRegistration:!1,willSave:!1,willSaveWaitUntil:!1,didSave:!1}}},initializationOptions:{},workspaceFolders:[{uri:My.file(this.cwd).toString(),name:"workspace"}]};try{De("Sending initialize request...");De("Initialize response:",await this.client.sendRequest("initialize",e)),De("Sending initialized notification..."),this.client.sendNotification("initialized",{}),De("LSP initialization completed")}catch(e){throw console.error("LSP initialization failed:",e),e}}setupLogHandlers(){this.client&&(this.client.onNotification("window/logMessage",(e=>{De(e)})),this.client.onNotification("window/showMessage",(e=>{De(e)})),this.client.onRequest("window/showMessageRequest",(e=>(De(e),e.actions?.[0]||null))),this.client.onNotification("comate/log",(e=>{De(e)})),this.client.onNotification("$/progress",(e=>{De(e)})))}handleVirtualEditor(){this.client?.onRequest("VIRTUAL_EDITOR_EVENT",(async()=>{}))}async engineExec(){const e={cwd:this.cwd,env:{...process.env,IDE:this.ideName,COMATE_VERSION:this.pluginVersion,COMATE_ENGINE_APP_NAME:"VS Code",COMATE_ENGINE_PLATFORM:"baidu-saas",COMATE_ENGINE_DEBUG:"true",PLATFORM:this.platform,HTTP_PROXY_URL:this.httpProxy,HTTP_HOST:process.env.HTTP_HOST||"",RIPGREP_BIN_PATH:this.ripgrepPath,DISPLAY_LANGUAGE:"zh",KEEP_ALIVE:"true"}},t=o(I_,"../../comate-engine/bin/comate.js");return h(t,[],{stdio:"pipe",execArgv:[],...e})}async dispose(){if(this.client)try{await this.client.sendRequest("shutdown",null),this.client.sendNotification("exit")}catch(e){console.error("Error during LSP shutdown:",e)}finally{this.client.dispose()}}}const D_=t=>{const n={license:"",username:"zulu-cli",query:"用html写一个input,可以输入",cwd:process.cwd(),httpProxy:process.env.HTTP_PROXY||process.env.HTTPS_PROXY||process.env.http_proxy||process.env.https_proxy||"",shell:process.env.SHELL?process.env.SHELL:process.env.COMSPEC?process.env.COMSPEC:"win32"===P.platform()?"cmd.exe":"/bin/sh",ideSeries:"vscode",ideVersion:"1.100.1",ideName:Py.VSCode,platform:process.env.PLATFORM||Ay.SAAS,deviceId:e(),pluginVersion:"3.10.0",ripgrepPath:Dy(),...t};return new $_(n)};class M_ extends se{static paths=[se.Default];ping=Ie("--ping",!1,{description:"测试网络连通性"});help=Ie("--help",!1,{description:"帮助信息"});version=Ie("--version",!1,{description:"版本信息"});async execute(){if(!(this.help||this.version||this.ping)){const e=new Le;return e.context=this.context,e.cli=this.cli,await e.execute()}return this.help?(this.context.stdout.write(this.cli.usage(this)),0):this.ping?(await async function(){const e=new Ny;console.log("🏓 Starting Comate API ping test with proxy support...\n");const t=process.env.http_proxy||process.env.HTTP_PROXY||process.env.https_proxy||process.env.HTTPS_PROXY;if(t){console.log(`🌐 Detected proxy from environment: ${t}`);const e=await Ny.testProxy(t);console.log(`🔍 Proxy test: ${e?"✅ Working":"❌ Failed"}\n`)}else console.log("🌐 No proxy detected, using direct connection\n");console.log("Single ping:");const n=await e.ping({timeout:5e3,retries:3,retryDelay:1e3});console.log(n),console.log("\n"+"=".repeat(50)+"\n"),console.log("Continuous ping (5 times):");const i=await e.continuousPing(5,1e3,{timeout:5e3,retries:2}),r=Ny.getStats(i);console.log("\n📊 Statistics:"),console.log(`Total: ${r.total}`),console.log(`Successful: ${r.successful}`),console.log(`Failed: ${r.failed}`),console.log(`Success Rate: ${r.successRate.toFixed(2)}%`),console.log(`Avg Response Time: ${r.avgResponseTime.toFixed(2)}ms`),console.log(`Min Response Time: ${r.minResponseTime}ms`),console.log(`Max Response Time: ${r.maxResponseTime}ms`)}(),0):(this.context.stdout.write(this.cli.usage(this)),0)}}const F_=new Pe({binaryName:"zulu",binaryLabel:"AI Coding Agent Zulu",binaryVersion:$y});function z_(){F_.runExit(process.argv.slice(2))}F_.register(Le),F_.register(Ne),F_.register(M_),F_.register(class extends se{static paths=[["run"]];static usage={description:"与 Zulu 一起工作,对完整代码库进行全面修改"};license=$e("--license",{description:"License"});query=$e("--query",{description:"问题描述"});search=$e("--search",{description:"本地检索的查询内容"});cwd=$e("--cwd",{description:"工作路径,默认执行时所在地址"});ripgrep=$e("--ripgrep",{description:"ripgrep 的绝对路径"});max=$e("--max",{description:"max 模式的模型 id"});async execute(){if(!(this.license||this.query||this.cwd||this.help||this.ripgrep)){const e=new Le;return e.context=this.context,e.cli=this.cli,await e.execute()}if(this.help)return this.context.stdout.write(this.cli.usage(this)),0;if(!this.license)return this.context.stderr.write("Error: --license is required\n"),1;if(this.cwd&&!n(this.cwd))return this.context.stderr.write(`Error: Directory '${this.cwd}' does not exist\n`),1;let e=this.ripgrep;if(e&&!n(e))return this.context.stderr.write(`Error: ripgrep path '${e}' does not exist\n`),1;e||(e=Dy()),De("License:",this.license),De("Query:",this.query),De("CWD:",this.cwd);const t={license:this.license,query:this.query,cwd:this.cwd||process.cwd(),ripgrepPath:e,max:this.max},i=D_(t);return await i.start(),await async function({kernelProvider:e,query:t,max:n}){new Xe(e).start();let i={};const r=n?{model:{modelId:n,requestType:"COMATE_MULTIPLE_MODE",mode:"MAX"}}:{};e.onRequest("COMATE_AGENT_UPDATE_MESSAGE",(async e=>{if(De("============"),De(JSON.stringify(e,null,2)),"conversation-status"===e.data.type){const t=e.data.conversationInfo.status;t===ut.Failed||t===ut.Cancelled?(console.error(JSON.stringify(e,null,2)),process.exit(1)):t===ut.Completed&&(console.log(JSON.stringify(i,null,2)),process.exit(0))}else"partial-message-data"===e.data.type&&(i=e.data)})),e.onNotification("ENGINE_SERVICE_INITIALIZED",(async()=>{const n=await e.sendRequest("COMATE_AGENT_START_NEW_CHAT",{agentPayload:{conversationId:"",messageType:"add-message",conversationType:"E2EBotConversation",payload:{query:t,knowledgeList:[],...r}}});e.sendRequest("COMATE_AGENT_NEW_MESSAGE",{agentPayload:{messageType:"add-message",conversationId:n.id,payload:{query:t,knowledgeList:[],...r}}}),e.sendRequest("COMATE_AGENT_SET_FOREGROUND_CONVERSATION",{agentPayload:{conversationId:n.id}})}))}({kernelProvider:i,query:this.query,max:this.max}),0}}),F_.register(class extends se{static paths=[["search"]];static usage={description:"本地检索"};query=$e("--query",{description:"搜索查询内容"});async execute(){if(this.help)return this.context.stdout.write(this.cli.usage(this)),0;if(!this.query)return this.context.stderr.write("Error: --query is required\n"),1;De("Query:",this.query);const e={query:this.query,username:"zhangcong06"},t=D_(e);return await t.start(),await function(e){const{kernelProvider:t,query:n}=e;t.onNotification("ENGINE_SERVICE_INITIALIZED",(async()=>{const e=await t.sendRequest("kernel/embedding/search",{query:n});console.log(JSON.stringify(e,null,2)),process.exit(0)}))}({kernelProvider:t,query:this.query}),0}});const B_=/^[a-zA-Z_][a-zA-Z0-9_]*$/;function q_(e){return null===e?"null":void 0===e?"undefined":""===e?"an empty string":"symbol"==typeof e?`<${e.toString()}>`:Array.isArray(e)?"an array":JSON.stringify(e)}function U_(e,t){var n,i,r;return"number"==typeof t?`${null!==(n=null==e?void 0:e.p)&&void 0!==n?n:"."}[${t}]`:B_.test(t)?`${null!==(i=null==e?void 0:e.p)&&void 0!==i?i:""}.${t}`:`${null!==(r=null==e?void 0:e.p)&&void 0!==r?r:"."}[${JSON.stringify(t)}]`}function H_({errors:e,p:t}={},n){return null==e||e.push(`${null!=t?t:"."}: ${n}`),!1}function W_(e,t){return n=>{const i=e[t];return e[t]=n,W_(e,t).bind(null,i)}}function G_(){return Z_({test:(e,t)=>"string"==typeof e||H_(t,`Expected a string (got ${q_(e)})`)})}function V_(e,{delimiter:t}={}){return Z_({test:(n,i)=>{var r;const o=n;if("string"==typeof n&&void 0!==t&&void 0!==(null==i?void 0:i.coercions)){if(void 0===(null==i?void 0:i.coercion))return H_(i,"Unbound coercion result");n=n.split(t)}if(!Array.isArray(n))return H_(i,`Expected an array (got ${q_(n)})`);let s=!0;for(let t=0,r=n.length;t<r&&(s=e(n[t],Object.assign(Object.assign({},i),{p:U_(i,t),coercion:W_(n,t)}))&&s,s||null!=(null==i?void 0:i.errors));++t);return n!==o&&i.coercions.push([null!==(r=i.p)&&void 0!==r?r:".",i.coercion.bind(null,n)]),s}})}function K_(e,{delimiter:t}={}){const n=X_(e.length);return Z_({test:(i,r)=>{var o;if("string"==typeof i&&void 0!==t&&void 0!==(null==r?void 0:r.coercions)){if(void 0===(null==r?void 0:r.coercion))return H_(r,"Unbound coercion result");i=i.split(t),r.coercions.push([null!==(o=r.p)&&void 0!==o?o:".",r.coercion.bind(null,i)])}if(!Array.isArray(i))return H_(r,`Expected a tuple (got ${q_(i)})`);let s=n(i,Object.assign({},r));for(let t=0,n=i.length;t<n&&t<e.length&&(s=e[t](i[t],Object.assign(Object.assign({},r),{p:U_(r,t),coercion:W_(i,t)}))&&s,s||null!=(null==r?void 0:r.errors));++t);return s}})}function J_(e,{keys:t=null}={}){const n=V_(K_([null!=t?t:G_(),e]));return Z_({test:(i,r)=>{var o;if(Array.isArray(i)&&void 0!==(null==r?void 0:r.coercions))return void 0===(null==r?void 0:r.coercion)?H_(r,"Unbound coercion result"):!!n(i,Object.assign(Object.assign({},r),{coercion:void 0}))&&(i=Object.fromEntries(i),r.coercions.push([null!==(o=r.p)&&void 0!==o?o:".",r.coercion.bind(null,i)]),!0);if("object"!=typeof i||null===i)return H_(r,`Expected an object (got ${q_(i)})`);const s=Object.keys(i);let a=!0;for(let n=0,o=s.length;n<o&&(a||null!=(null==r?void 0:r.errors));++n){const o=s[n],c=i[o];"__proto__"!==o&&"constructor"!==o?(null===t||t(o,r))&&e(c,Object.assign(Object.assign({},r),{p:U_(r,o),coercion:W_(i,o)}))||(a=!1):a=H_(Object.assign(Object.assign({},r),{p:U_(r,o)}),"Unsafe property name")}return a}})}function Y_(e){return()=>e}function Z_({test:e}){return Y_(e)()}function X_(e){return Z_({test:(t,n)=>t.length===e||H_(n,`Expected to have a length of exactly ${e} elements (got ${t.length})`)})}function Q_(e,...t){const n=Array.isArray(t[0])?t[0]:t;return Z_({test:(t,i)=>{var r,o;const s={value:t},a=void 0!==(null==i?void 0:i.coercions)?W_(s,"value"):void 0,c=void 0!==(null==i?void 0:i.coercions)?[]:void 0;if(!e(t,Object.assign(Object.assign({},i),{coercion:a,coercions:c})))return!1;const l=[];if(void 0!==c)for(const[,e]of c)l.push(e());try{if(void 0!==(null==i?void 0:i.coercions)){if(s.value!==t){if(void 0===(null==i?void 0:i.coercion))return H_(i,"Unbound coercion result");i.coercions.push([null!==(r=i.p)&&void 0!==r?r:".",i.coercion.bind(null,s.value)])}null===(o=null==i?void 0:i.coercions)||void 0===o||o.push(...c)}return n.every((e=>e(s.value,i)))}finally{for(const e of l)e()}}})}var ew;!function(e){e.Forbids="Forbids",e.Requires="Requires"}(ew||(ew={})),ew.Forbids,ew.Requires;var tw=Object.freeze({__proto__:null,get KeyRelationship(){return ew},applyCascade:function(e,...t){return Q_(e,Array.isArray(t[0])?t[0]:t)},cascade:Q_,hasExactLength:X_,isArray:V_,isDict:function(e,t={}){return J_(e,t)},isRecord:J_,isString:G_,isTuple:K_,isUnknown:function(){return Z_({test:(e,t)=>!0})},makeTrait:Y_,makeValidator:Z_});export{z_ as run};
|
|
44
|
+
/*! run-parallel. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */const If="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:Fe):e=>(Lf||(Lf=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0)));var $f={};Object.defineProperty($f,"__esModule",{value:!0}),$f.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;const Df=process.versions.node.split(".");if(void 0===Df[0]||void 0===Df[1])throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);const Mf=Number.parseInt(Df[0],10),Ff=Number.parseInt(Df[1],10),zf=Mf>10,Bf=10===Mf&&Ff>=10;$f.IS_SUPPORT_READDIR_WITH_FILE_TYPES=zf||Bf;var qf={},Uf={};Object.defineProperty(Uf,"__esModule",{value:!0}),Uf.createDirentFromStats=void 0;class Hf{constructor(e,t){this.name=e,this.isBlockDevice=t.isBlockDevice.bind(t),this.isCharacterDevice=t.isCharacterDevice.bind(t),this.isDirectory=t.isDirectory.bind(t),this.isFIFO=t.isFIFO.bind(t),this.isFile=t.isFile.bind(t),this.isSocket=t.isSocket.bind(t),this.isSymbolicLink=t.isSymbolicLink.bind(t)}}Uf.createDirentFromStats=function(e,t){return new Hf(e,t)},Object.defineProperty(qf,"__esModule",{value:!0}),qf.fs=void 0;const Wf=Uf;qf.fs=Wf;var Gf={};Object.defineProperty(Gf,"__esModule",{value:!0}),Gf.joinPathSegments=void 0,Gf.joinPathSegments=function(e,t,n){return e.endsWith(n)?e+t:e+n+t},Object.defineProperty(yf,"__esModule",{value:!0}),yf.readdir=yf.readdirWithFileTypes=yf.read=void 0;const Vf=_f,Kf=Nf,Jf=$f,Yf=qf,Zf=Gf;function Xf(e,t,n){t.fs.readdir(e,{withFileTypes:!0},((i,r)=>{if(null!==i)return void em(n,i);const o=r.map((n=>({dirent:n,name:n.name,path:Zf.joinPathSegments(e,n.name,t.pathSegmentSeparator)})));if(!t.followSymbolicLinks)return void tm(n,o);const s=o.map((e=>function(e,t){return n=>{e.dirent.isSymbolicLink()?t.fs.stat(e.path,((i,r)=>{if(null!==i)return t.throwErrorOnBrokenSymbolicLink?void n(i):void n(null,e);e.dirent=Yf.fs.createDirentFromStats(e.name,r),n(null,e)})):n(null,e)}}(e,t)));Kf(s,((e,t)=>{null===e?tm(n,t):em(n,e)}))}))}function Qf(e,t,n){t.fs.readdir(e,((i,r)=>{if(null!==i)return void em(n,i);const o=r.map((n=>{const i=Zf.joinPathSegments(e,n,t.pathSegmentSeparator);return e=>{Vf.stat(i,t.fsStatSettings,((r,o)=>{if(null!==r)return void e(r);const s={name:n,path:i,dirent:Yf.fs.createDirentFromStats(n,o)};t.stats&&(s.stats=o),e(null,s)}))}}));Kf(o,((e,t)=>{null===e?tm(n,t):em(n,e)}))}))}function em(e,t){e(t)}function tm(e,t){e(null,t)}yf.read=function(e,t,n){t.stats||!Jf.IS_SUPPORT_READDIR_WITH_FILE_TYPES?Qf(e,t,n):Xf(e,t,n)},yf.readdirWithFileTypes=Xf,yf.readdir=Qf;var nm={};Object.defineProperty(nm,"__esModule",{value:!0}),nm.readdir=nm.readdirWithFileTypes=nm.read=void 0;const im=_f,rm=$f,om=qf,sm=Gf;function am(e,t){return t.fs.readdirSync(e,{withFileTypes:!0}).map((n=>{const i={dirent:n,name:n.name,path:sm.joinPathSegments(e,n.name,t.pathSegmentSeparator)};if(i.dirent.isSymbolicLink()&&t.followSymbolicLinks)try{const e=t.fs.statSync(i.path);i.dirent=om.fs.createDirentFromStats(i.name,e)}catch(e){if(t.throwErrorOnBrokenSymbolicLink)throw e}return i}))}function cm(e,t){return t.fs.readdirSync(e).map((n=>{const i=sm.joinPathSegments(e,n,t.pathSegmentSeparator),r=im.statSync(i,t.fsStatSettings),o={name:n,path:i,dirent:om.fs.createDirentFromStats(n,r)};return t.stats&&(o.stats=r),o}))}nm.read=function(e,t){return!t.stats&&rm.IS_SUPPORT_READDIR_WITH_FILE_TYPES?am(e,t):cm(e,t)},nm.readdirWithFileTypes=am,nm.readdir=cm;var lm={},um={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createFileSystemAdapter=e.FILE_SYSTEM_ADAPTER=void 0;const t=u;e.FILE_SYSTEM_ADAPTER={lstat:t.lstat,stat:t.stat,lstatSync:t.lstatSync,statSync:t.statSync,readdir:t.readdir,readdirSync:t.readdirSync},e.createFileSystemAdapter=function(t){return void 0===t?e.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},e.FILE_SYSTEM_ADAPTER),t)}}(um),Object.defineProperty(lm,"__esModule",{value:!0});const pm=p,dm=_f,fm=um;lm.default=class{constructor(e={}){this._options=e,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=fm.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,pm.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new dm.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(e,t){return null!=e?e:t}},Object.defineProperty(bf,"__esModule",{value:!0}),bf.Settings=bf.scandirSync=bf.scandir=void 0;const mm=yf,hm=nm,gm=lm;function vm(e={}){return e instanceof gm.default?e:new gm.default(e)}bf.Settings=gm.default,bf.scandir=function(e,t,n){"function"!=typeof t?mm.read(e,vm(t),n):mm.read(e,vm(),t)},bf.scandirSync=function(e,t){const n=vm(t);return hm.read(e,n)};var xm={exports:{}};var bm=function(e){var t=new e,n=t;return{get:function(){var i=t;return i.next?t=i.next:(t=new e,n=t),i.next=null,i},release:function(e){n.next=e,n=e}}};function ym(e,t,n){if("function"==typeof e&&(n=t,t=e,e=null),!(n>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");var i=bm(wm),r=null,o=null,s=0,a=null,c={push:function(u,p){var d=i.get();d.context=e,d.release=l,d.value=u,d.callback=p||_m,d.errorHandler=a,s>=n||c.paused?o?(o.next=d,o=d):(r=d,o=d,c.saturated()):(s++,t.call(e,d.value,d.worked))},drain:_m,saturated:_m,pause:function(){c.paused=!0},paused:!1,get concurrency(){return n},set concurrency(e){if(!(e>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");if(n=e,!c.paused)for(;r&&s<n;)s++,l()},running:function(){return s},resume:function(){if(!c.paused)return;if(c.paused=!1,null===r)return s++,void l();for(;r&&s<n;)s++,l()},idle:function(){return 0===s&&0===c.length()},length:function(){var e=r,t=0;for(;e;)e=e.next,t++;return t},getQueue:function(){var e=r,t=[];for(;e;)t.push(e.value),e=e.next;return t},unshift:function(u,p){var d=i.get();d.context=e,d.release=l,d.value=u,d.callback=p||_m,d.errorHandler=a,s>=n||c.paused?r?(d.next=r,r=d):(r=d,o=d,c.saturated()):(s++,t.call(e,d.value,d.worked))},empty:_m,kill:function(){r=null,o=null,c.drain=_m},killAndDrain:function(){r=null,o=null,c.drain(),c.drain=_m},error:function(e){a=e}};return c;function l(a){a&&i.release(a);var l=r;l&&s<=n?c.paused?s--:(o===r&&(o=null),r=l.next,l.next=null,t.call(e,l.value,l.worked),null===o&&c.empty()):0==--s&&c.drain()}}function _m(){}function wm(){this.value=null,this.callback=_m,this.next=null,this.release=_m,this.context=null,this.errorHandler=null;var e=this;this.worked=function(t,n){var i=e.callback,r=e.errorHandler,o=e.value;e.value=null,e.callback=_m,e.errorHandler&&r(t,o),i.call(e.context,t,n),e.release(e)}}xm.exports=ym,xm.exports.promise=function(e,t,n){"function"==typeof e&&(n=t,t=e,e=null);var i=ym(e,(function(e,n){t.call(this,e).then((function(e){n(null,e)}),n)}),n),r=i.push,o=i.unshift;return i.push=function(e){var t=new Promise((function(t,n){r(e,(function(e,i){e?n(e):t(i)}))}));return t.catch(_m),t},i.unshift=function(e){var t=new Promise((function(t,n){o(e,(function(e,i){e?n(e):t(i)}))}));return t.catch(_m),t},i.drained=function(){if(i.idle())return new Promise((function(e){e()}));var e=i.drain;return new Promise((function(t){i.drain=function(){e(),t()}}))},i};var Em=xm.exports,Sm={};Object.defineProperty(Sm,"__esModule",{value:!0}),Sm.joinPathSegments=Sm.replacePathSegmentSeparator=Sm.isAppliedFilter=Sm.isFatalError=void 0,Sm.isFatalError=function(e,t){return null===e.errorFilter||!e.errorFilter(t)},Sm.isAppliedFilter=function(e,t){return null===e||e(t)},Sm.replacePathSegmentSeparator=function(e,t){return e.split(/[/\\]/).join(t)},Sm.joinPathSegments=function(e,t,n){return""===e?t:e.endsWith(n)?e+t:e+n+t};var km={};Object.defineProperty(km,"__esModule",{value:!0});const Rm=Sm;km.default=class{constructor(e,t){this._root=e,this._settings=t,this._root=Rm.replacePathSegmentSeparator(e,t.pathSegmentSeparator)}},Object.defineProperty(xf,"__esModule",{value:!0});const Tm=C,Om=bf,Cm=Em,Am=Sm,Pm=km;class jm extends Pm.default{constructor(e,t){super(e,t),this._settings=t,this._scandir=Om.scandir,this._emitter=new Tm.EventEmitter,this._queue=Cm(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit("end")}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate((()=>{this._pushToQueue(this._root,this._settings.basePath)})),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw new Error("The reader is already destroyed");this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(e){this._emitter.on("entry",e)}onError(e){this._emitter.once("error",e)}onEnd(e){this._emitter.once("end",e)}_pushToQueue(e,t){const n={directory:e,base:t};this._queue.push(n,(e=>{null!==e&&this._handleError(e)}))}_worker(e,t){this._scandir(e.directory,this._settings.fsScandirSettings,((n,i)=>{if(null===n){for(const t of i)this._handleEntry(t,e.base);t(null,void 0)}else t(n,void 0)}))}_handleError(e){!this._isDestroyed&&Am.isFatalError(this._settings,e)&&(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit("error",e))}_handleEntry(e,t){if(this._isDestroyed||this._isFatalError)return;const n=e.path;void 0!==t&&(e.path=Am.joinPathSegments(t,e.name,this._settings.pathSegmentSeparator)),Am.isAppliedFilter(this._settings.entryFilter,e)&&this._emitEntry(e),e.dirent.isDirectory()&&Am.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,void 0===t?void 0:e.path)}_emitEntry(e){this._emitter.emit("entry",e)}}xf.default=jm,Object.defineProperty(vf,"__esModule",{value:!0});const Lm=xf;vf.default=class{constructor(e,t){this._root=e,this._settings=t,this._reader=new Lm.default(this._root,this._settings),this._storage=[]}read(e){this._reader.onError((t=>{!function(e,t){e(t)}(e,t)})),this._reader.onEntry((e=>{this._storage.push(e)})),this._reader.onEnd((()=>{!function(e,t){e(null,t)}(e,this._storage)})),this._reader.read()}};var Nm={};Object.defineProperty(Nm,"__esModule",{value:!0});const Im=v,$m=xf;Nm.default=class{constructor(e,t){this._root=e,this._settings=t,this._reader=new $m.default(this._root,this._settings),this._stream=new Im.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError((e=>{this._stream.emit("error",e)})),this._reader.onEntry((e=>{this._stream.push(e)})),this._reader.onEnd((()=>{this._stream.push(null)})),this._reader.read(),this._stream}};var Dm={},Mm={};Object.defineProperty(Mm,"__esModule",{value:!0});const Fm=bf,zm=Sm,Bm=km;class qm extends Bm.default{constructor(){super(...arguments),this._scandir=Fm.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(e,t){this._queue.add({directory:e,base:t})}_handleQueue(){for(const e of this._queue.values())this._handleDirectory(e.directory,e.base)}_handleDirectory(e,t){try{const n=this._scandir(e,this._settings.fsScandirSettings);for(const e of n)this._handleEntry(e,t)}catch(e){this._handleError(e)}}_handleError(e){if(zm.isFatalError(this._settings,e))throw e}_handleEntry(e,t){const n=e.path;void 0!==t&&(e.path=zm.joinPathSegments(t,e.name,this._settings.pathSegmentSeparator)),zm.isAppliedFilter(this._settings.entryFilter,e)&&this._pushToStorage(e),e.dirent.isDirectory()&&zm.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,void 0===t?void 0:e.path)}_pushToStorage(e){this._storage.push(e)}}Mm.default=qm,Object.defineProperty(Dm,"__esModule",{value:!0});const Um=Mm;Dm.default=class{constructor(e,t){this._root=e,this._settings=t,this._reader=new Um.default(this._root,this._settings)}read(){return this._reader.read()}};var Hm={};Object.defineProperty(Hm,"__esModule",{value:!0});const Wm=p,Gm=bf;Hm.default=class{constructor(e={}){this._options=e,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,Wm.sep),this.fsScandirSettings=new Gm.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(e,t){return null!=e?e:t}},Object.defineProperty(gf,"__esModule",{value:!0}),gf.Settings=gf.walkStream=gf.walkSync=gf.walk=void 0;const Vm=vf,Km=Nm,Jm=Dm,Ym=Hm;function Zm(e={}){return e instanceof Ym.default?e:new Ym.default(e)}gf.Settings=Ym.default,gf.walk=function(e,t,n){"function"!=typeof t?new Vm.default(e,Zm(t)).read(n):new Vm.default(e,Zm()).read(t)},gf.walkSync=function(e,t){const n=Zm(t);return new Jm.default(e,n).read()},gf.walkStream=function(e,t){const n=Zm(t);return new Km.default(e,n).read()};var Xm={};Object.defineProperty(Xm,"__esModule",{value:!0});const Qm=p,eh=_f,th=qu;Xm.default=class{constructor(e){this._settings=e,this._fsStatSettings=new eh.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return Qm.resolve(this._settings.cwd,e)}_makeEntry(e,t){const n={name:t,path:t,dirent:th.fs.createDirentFromStats(t,e)};return this._settings.stats&&(n.stats=e),n}_isFatalError(e){return!th.errno.isEnoentCodeError(e)&&!this._settings.suppressErrors}};var nh={};Object.defineProperty(nh,"__esModule",{value:!0});const ih=v,rh=_f,oh=gf,sh=Xm;class ah extends sh.default{constructor(){super(...arguments),this._walkStream=oh.walkStream,this._stat=rh.stat}dynamic(e,t){return this._walkStream(e,t)}static(e,t){const n=e.map(this._getFullEntryPath,this),i=new ih.PassThrough({objectMode:!0});i._write=(r,o,s)=>this._getEntry(n[r],e[r],t).then((e=>{null!==e&&t.entryFilter(e)&&i.push(e),r===n.length-1&&i.end(),s()})).catch(s);for(let e=0;e<n.length;e++)i.write(e);return i}_getEntry(e,t,n){return this._getStat(e).then((e=>this._makeEntry(e,t))).catch((e=>{if(n.errorFilter(e))return null;throw e}))}_getStat(e){return new Promise(((t,n)=>{this._stat(e,this._fsStatSettings,((e,i)=>null===e?t(i):n(e)))}))}}nh.default=ah,Object.defineProperty(hf,"__esModule",{value:!0});const ch=gf,lh=Xm,uh=nh;class ph extends lh.default{constructor(){super(...arguments),this._walkAsync=ch.walk,this._readerStream=new uh.default(this._settings)}dynamic(e,t){return new Promise(((n,i)=>{this._walkAsync(e,t,((e,t)=>{null===e?n(t):i(e)}))}))}async static(e,t){const n=[],i=this._readerStream.static(e,t);return new Promise(((e,t)=>{i.once("error",t),i.on("data",(e=>n.push(e))),i.once("end",(()=>e(n)))}))}}hf.default=ph;var dh={},fh={},mh={},hh={};Object.defineProperty(hh,"__esModule",{value:!0});const gh=qu;hh.default=class{constructor(e,t,n){this._patterns=e,this._settings=t,this._micromatchOptions=n,this._storage=[],this._fillStorage()}_fillStorage(){for(const e of this._patterns){const t=this._getPatternSegments(e),n=this._splitSegmentsIntoSections(t);this._storage.push({complete:n.length<=1,pattern:e,segments:t,sections:n})}}_getPatternSegments(e){return gh.pattern.getPatternParts(e,this._micromatchOptions).map((e=>gh.pattern.isDynamicPattern(e,this._settings)?{dynamic:!0,pattern:e,patternRe:gh.pattern.makeRe(e,this._micromatchOptions)}:{dynamic:!1,pattern:e}))}_splitSegmentsIntoSections(e){return gh.array.splitWhen(e,(e=>e.dynamic&&gh.pattern.hasGlobStar(e.pattern)))}},Object.defineProperty(mh,"__esModule",{value:!0});const vh=hh;class xh extends vh.default{match(e){const t=e.split("/"),n=t.length,i=this._storage.filter((e=>!e.complete||e.segments.length>n));for(const e of i){const i=e.sections[0];if(!e.complete&&n>i.length)return!0;const r=t.every(((t,n)=>{const i=e.segments[n];return!(!i.dynamic||!i.patternRe.test(t))||!i.dynamic&&i.pattern===t}));if(r)return!0}return!1}}mh.default=xh,Object.defineProperty(fh,"__esModule",{value:!0});const bh=qu,yh=mh;fh.default=class{constructor(e,t){this._settings=e,this._micromatchOptions=t}getFilter(e,t,n){const i=this._getMatcher(t),r=this._getNegativePatternsRe(n);return t=>this._filter(e,t,i,r)}_getMatcher(e){return new yh.default(e,this._settings,this._micromatchOptions)}_getNegativePatternsRe(e){const t=e.filter(bh.pattern.isAffectDepthOfReadingPattern);return bh.pattern.convertPatternsToRe(t,this._micromatchOptions)}_filter(e,t,n,i){if(this._isSkippedByDeep(e,t.path))return!1;if(this._isSkippedSymbolicLink(t))return!1;const r=bh.path.removeLeadingDotSegment(t.path);return!this._isSkippedByPositivePatterns(r,n)&&this._isSkippedByNegativePatterns(r,i)}_isSkippedByDeep(e,t){return this._settings.deep!==1/0&&this._getEntryLevel(e,t)>=this._settings.deep}_getEntryLevel(e,t){const n=t.split("/").length;if(""===e)return n;return n-e.split("/").length}_isSkippedSymbolicLink(e){return!this._settings.followSymbolicLinks&&e.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(e,t){return!this._settings.baseNameMatch&&!t.match(e)}_isSkippedByNegativePatterns(e,t){return!bh.pattern.matchAny(e,t)}};var _h={};Object.defineProperty(_h,"__esModule",{value:!0});const wh=qu;_h.default=class{constructor(e,t){this._settings=e,this._micromatchOptions=t,this.index=new Map}getFilter(e,t){const n=wh.pattern.convertPatternsToRe(e,this._micromatchOptions),i=wh.pattern.convertPatternsToRe(t,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}));return e=>this._filter(e,n,i)}_filter(e,t,n){const i=wh.path.removeLeadingDotSegment(e.path);if(this._settings.unique&&this._isDuplicateEntry(i))return!1;if(this._onlyFileFilter(e)||this._onlyDirectoryFilter(e))return!1;if(this._isSkippedByAbsoluteNegativePatterns(i,n))return!1;const r=e.dirent.isDirectory(),o=this._isMatchToPatterns(i,t,r)&&!this._isMatchToPatterns(i,n,r);return this._settings.unique&&o&&this._createIndexRecord(i),o}_isDuplicateEntry(e){return this.index.has(e)}_createIndexRecord(e){this.index.set(e,void 0)}_onlyFileFilter(e){return this._settings.onlyFiles&&!e.dirent.isFile()}_onlyDirectoryFilter(e){return this._settings.onlyDirectories&&!e.dirent.isDirectory()}_isSkippedByAbsoluteNegativePatterns(e,t){if(!this._settings.absolute)return!1;const n=wh.path.makeAbsolute(this._settings.cwd,e);return wh.pattern.matchAny(n,t)}_isMatchToPatterns(e,t,n){const i=wh.pattern.matchAny(e,t);return!i&&n?wh.pattern.matchAny(e+"/",t):i}};var Eh={};Object.defineProperty(Eh,"__esModule",{value:!0});const Sh=qu;Eh.default=class{constructor(e){this._settings=e}getFilter(){return e=>this._isNonFatalError(e)}_isNonFatalError(e){return Sh.errno.isEnoentCodeError(e)||this._settings.suppressErrors}};var kh={};Object.defineProperty(kh,"__esModule",{value:!0});const Rh=qu;kh.default=class{constructor(e){this._settings=e}getTransformer(){return e=>this._transform(e)}_transform(e){let t=e.path;return this._settings.absolute&&(t=Rh.path.makeAbsolute(this._settings.cwd,t),t=Rh.path.unixify(t)),this._settings.markDirectories&&e.dirent.isDirectory()&&(t+="/"),this._settings.objectMode?Object.assign(Object.assign({},e),{path:t}):t}},Object.defineProperty(dh,"__esModule",{value:!0});const Th=p,Oh=fh,Ch=_h,Ah=Eh,Ph=kh;dh.default=class{constructor(e){this._settings=e,this.errorFilter=new Ah.default(this._settings),this.entryFilter=new Ch.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new Oh.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new Ph.default(this._settings)}_getRootDirectory(e){return Th.resolve(this._settings.cwd,e.base)}_getReaderOptions(e){const t="."===e.base?"":e.base;return{basePath:t,pathSegmentSeparator:"/",concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(t,e.positive,e.negative),entryFilter:this.entryFilter.getFilter(e.positive,e.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}},Object.defineProperty(mf,"__esModule",{value:!0});const jh=hf,Lh=dh;class Nh extends Lh.default{constructor(){super(...arguments),this._reader=new jh.default(this._settings)}async read(e){const t=this._getRootDirectory(e),n=this._getReaderOptions(e);return(await this.api(t,e,n)).map((e=>n.transform(e)))}api(e,t,n){return t.dynamic?this._reader.dynamic(e,n):this._reader.static(t.patterns,n)}}mf.default=Nh;var Ih={};Object.defineProperty(Ih,"__esModule",{value:!0});const $h=v,Dh=nh,Mh=dh;class Fh extends Mh.default{constructor(){super(...arguments),this._reader=new Dh.default(this._settings)}read(e){const t=this._getRootDirectory(e),n=this._getReaderOptions(e),i=this.api(t,e,n),r=new $h.Readable({objectMode:!0,read:()=>{}});return i.once("error",(e=>r.emit("error",e))).on("data",(e=>r.emit("data",n.transform(e)))).once("end",(()=>r.emit("end"))),r.once("close",(()=>i.destroy())),r}api(e,t,n){return t.dynamic?this._reader.dynamic(e,n):this._reader.static(t.patterns,n)}}Ih.default=Fh;var zh={},Bh={};Object.defineProperty(Bh,"__esModule",{value:!0});const qh=_f,Uh=gf,Hh=Xm;class Wh extends Hh.default{constructor(){super(...arguments),this._walkSync=Uh.walkSync,this._statSync=qh.statSync}dynamic(e,t){return this._walkSync(e,t)}static(e,t){const n=[];for(const i of e){const e=this._getFullEntryPath(i),r=this._getEntry(e,i,t);null!==r&&t.entryFilter(r)&&n.push(r)}return n}_getEntry(e,t,n){try{const n=this._getStat(e);return this._makeEntry(n,t)}catch(e){if(n.errorFilter(e))return null;throw e}}_getStat(e){return this._statSync(e,this._fsStatSettings)}}Bh.default=Wh,Object.defineProperty(zh,"__esModule",{value:!0});const Gh=Bh,Vh=dh;class Kh extends Vh.default{constructor(){super(...arguments),this._reader=new Gh.default(this._settings)}read(e){const t=this._getRootDirectory(e),n=this._getReaderOptions(e);return this.api(t,e,n).map(n.transform)}api(e,t,n){return t.dynamic?this._reader.dynamic(e,n):this._reader.static(t.patterns,n)}}zh.default=Kh;var Jh={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;const t=u,n=_,i=Math.max(n.cpus().length,1);e.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:t.lstat,lstatSync:t.lstatSync,stat:t.stat,statSync:t.statSync,readdir:t.readdir,readdirSync:t.readdirSync};e.default=class{constructor(e={}){this._options=e,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,i),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0),this.ignore=[].concat(this.ignore)}_getValue(e,t){return void 0===e?t:e}_getFileSystemMethods(t={}){return Object.assign(Object.assign({},e.DEFAULT_FILE_SYSTEM_ADAPTER),t)}}}(Jh);const Yh=Bu,Zh=mf,Xh=Ih,Qh=zh,eg=Jh,tg=qu;async function ng(e,t){rg(e);const n=ig(e,Zh.default,t),i=await Promise.all(n);return tg.array.flatten(i)}function ig(e,t,n){const i=[].concat(e),r=new eg.default(n),o=Yh.generate(i,r),s=new t(r);return o.map(s.read,s)}function rg(e){if(![].concat(e).every((e=>tg.string.isString(e)&&!tg.string.isEmpty(e))))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}!function(e){function t(e,t){rg(e);const n=ig(e,Qh.default,t);return tg.array.flatten(n)}function n(e,t){rg(e);const n=ig(e,Xh.default,t);return tg.stream.merge(n)}var i,r;e.glob=e,e.globSync=t,e.globStream=n,e.async=e,e.sync=t,e.stream=n,e.generateTasks=function(e,t){rg(e);const n=[].concat(e),i=new eg.default(t);return Yh.generate(n,i)},e.isDynamicPattern=function(e,t){rg(e);const n=new eg.default(t);return tg.pattern.isDynamicPattern(e,n)},e.escapePath=function(e){return rg(e),tg.path.escape(e)},e.convertPathToPattern=function(e){return rg(e),tg.path.convertPathToPattern(e)},(i=e.posix||(e.posix={})).escapePath=function(e){return rg(e),tg.path.escapePosixPath(e)},i.convertPathToPattern=function(e){return rg(e),tg.path.convertPosixPathToPattern(e)},(r=e.win32||(e.win32={})).escapePath=function(e){return rg(e),tg.path.escapeWindowsPath(e)},r.convertPathToPattern=function(e){return rg(e),tg.path.convertWindowsPathToPattern(e)}}(ng||(ng={}));var og={exports:{}},sg={};const{promisify:ag}=b,cg=u;async function lg(e,t,n){if("string"!=typeof n)throw new TypeError("Expected a string, got "+typeof n);try{return(await ag(cg[e])(n))[t]()}catch(e){if("ENOENT"===e.code)return!1;throw e}}function ug(e,t,n){if("string"!=typeof n)throw new TypeError("Expected a string, got "+typeof n);try{return cg[e](n)[t]()}catch(e){if("ENOENT"===e.code)return!1;throw e}}sg.isFile=lg.bind(null,"stat","isFile"),sg.isDirectory=lg.bind(null,"stat","isDirectory"),sg.isSymlink=lg.bind(null,"lstat","isSymbolicLink"),sg.isFileSync=ug.bind(null,"statSync","isFile"),sg.isDirectorySync=ug.bind(null,"statSync","isDirectory"),sg.isSymlinkSync=ug.bind(null,"lstatSync","isSymbolicLink");const pg=p,dg=sg,fg=e=>e.length>1?`{${e.join(",")}}`:e[0],mg=(e,t)=>{const n="!"===e[0]?e.slice(1):e;return pg.isAbsolute(n)?n:pg.join(t,n)},hg=(e,t)=>{if(t.files&&!Array.isArray(t.files))throw new TypeError(`Expected \`files\` to be of type \`Array\` but received type \`${typeof t.files}\``);if(t.extensions&&!Array.isArray(t.extensions))throw new TypeError(`Expected \`extensions\` to be of type \`Array\` but received type \`${typeof t.extensions}\``);return t.files&&t.extensions?t.files.map((n=>pg.posix.join(e,((e,t)=>pg.extname(e)?`**/${e}`:`**/${e}.${fg(t)}`)(n,t.extensions)))):t.files?t.files.map((t=>pg.posix.join(e,`**/${t}`))):t.extensions?[pg.posix.join(e,`**/*.${fg(t.extensions)}`)]:[pg.posix.join(e,"**")]};function gg(e){return Array.isArray(e)?e:[e]}og.exports=async(e,t)=>{if("string"!=typeof(t={cwd:process.cwd(),...t}).cwd)throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof t.cwd}\``);const n=await Promise.all([].concat(e).map((async e=>await dg.isDirectory(mg(e,t.cwd))?hg(e,t):e)));return[].concat.apply([],n)},og.exports.sync=(e,t)=>{if("string"!=typeof(t={cwd:process.cwd(),...t}).cwd)throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof t.cwd}\``);const n=[].concat(e).map((e=>dg.isDirectorySync(mg(e,t.cwd))?hg(e,t):e));return[].concat.apply([],n)};const vg=/^\s+$/,xg=/(?:[^\\]|^)\\$/,bg=/^\\!/,yg=/^\\#/,_g=/\r?\n/g,wg=/^\.*\/|^\.+$/;let Eg="node-ignore";"undefined"!=typeof Symbol&&(Eg=Symbol.for("node-ignore"));const Sg=Eg,kg=/([0-z])-([0-z])/g,Rg=()=>!1,Tg=[[/^\uFEFF/,()=>""],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(0===n.indexOf("\\")?" ":"")],[/(\\+?)\s/g,(e,t)=>{const{length:n}=t;return t.slice(0,n-n%2)+" "}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,"[^\\/]*")],[/\\\\\\(?=[$.|*+(){^])/g,()=>"\\"],[/\\\\/g,()=>"\\"],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,i,r)=>"\\"===t?`\\[${n}${(e=>{const{length:t}=e;return e.slice(0,t-t%2)})(i)}${r}`:"]"===r&&i.length%2==0?`[${(e=>e.replace(kg,((e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:"")))(n)}${i}]`:"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:"[^/]*"}(?=$|\\/$)`]],Og=Object.create(null),Cg=e=>"string"==typeof e;class Ag{constructor(e,t,n,i){this.origin=e,this.pattern=t,this.negative=n,this.regex=i}}const Pg=(e,t)=>{const n=e;let i=!1;0===e.indexOf("!")&&(i=!0,e=e.substr(1));const r=((e,t)=>{let n=Og[e];return n||(n=Tg.reduce(((t,[n,i])=>t.replace(n,i.bind(e))),e),Og[e]=n),t?new RegExp(n,"i"):new RegExp(n)})(e=e.replace(bg,"!").replace(yg,"#"),t);return new Ag(n,e,i,r)},jg=(e,t)=>{throw new t(e)},Lg=(e,t,n)=>{if(!Cg(e))return n(`path must be a string, but got \`${t}\``,TypeError);if(!e)return n("path must not be empty",TypeError);if(Lg.isNotRelative(e)){return n(`path should be a ${"`path.relative()`d"} string, but got "${t}"`,RangeError)}return!0},Ng=e=>wg.test(e);Lg.isNotRelative=Ng,Lg.convert=e=>e;class Ig{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){var i,r,o;i=this,r=Sg,o=!0,Object.defineProperty(i,r,{value:o}),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[Sg])return this._rules=this._rules.concat(e._rules),void(this._added=!0);if((e=>e&&Cg(e)&&!vg.test(e)&&!xg.test(e)&&0!==e.indexOf("#"))(e)){const t=Pg(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,gg(Cg(e)?(e=>e.split(_g))(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let n=!1,i=!1;return this._rules.forEach((r=>{const{negative:o}=r;if(i===o&&n!==i||o&&!n&&!i&&!t)return;r.regex.test(e)&&(n=!o,i=o)})),{ignored:n,unignored:i}}_test(e,t,n,i){const r=e&&Lg.convert(e);return Lg(r,e,this._allowRelativePaths?Rg:jg),this._t(r,t,n,i)}_t(e,t,n,i){if(e in t)return t[e];if(i||(i=e.split("/")),i.pop(),!i.length)return t[e]=this._testOne(e,n);const r=this._t(i.join("/")+"/",t,n,i);return t[e]=r.ignored?r:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return gg(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}}const $g=e=>new Ig(e);if($g.isPathValid=e=>Lg(e&&Lg.convert(e),e,Rg),$g.default=$g,"undefined"!=typeof process&&(process.env&&process.env.IGNORE_TEST_WIN32||"win32"===process.platform)){const e=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,"/");Lg.convert=e;const t=/^[a-z]:\//i;Lg.isNotRelative=e=>t.test(e)||Ng(e)}const Dg=[{id:"bat",extensions:[".bat",".cmd"]},{id:"clojure",extensions:[".clj",".cljs",".cljc",".cljx",".clojure",".edn"]},{id:"coffeescript",extensions:[".coffee",".cson",".iced"]},{id:"jsonc",extensions:[".code-workspace","language-configuration.json","icon-theme.json","color-theme.json"],names:["settings.json","launch.json","tasks.json","keybindings.json","extensions.json","argv.json","profiles.json","devcontainer.json",".devcontainer.json"]},{id:"json",extensions:[".code-profile"]},{id:"c",extensions:[".c",".i"]},{id:"cpp",extensions:[".cpp",".cc",".cxx",".c++",".hpp",".hh",".hxx",".h++",".h",".ii",".ino",".inl",".ipp",".ixx",".tpp",".txx",".hpp.in",".h.in"]},{id:"cuda-cpp",extensions:[".cu",".cuh"]},{id:"csharp",extensions:[".cs",".csx",".cake"]},{id:"css",extensions:[".css"],mimeTypes:["text/css"]},{id:"dart",extensions:[".dart"]},{id:"diff",extensions:[".diff",".patch",".rej"]},{id:"dockerfile",extensions:[".dockerfile",".containerfile"],patterns:["Dockerfile.*","Containerfile.*"],names:["Dockerfile","Containerfile"]},{id:"ignore",names:[".vscodeignore"]},{id:"fsharp",extensions:[".fs",".fsi",".fsx",".fsscript"]},{id:"git-commit",names:["COMMIT_EDITMSG","MERGE_MSG"]},{id:"git-rebase",patterns:["**/rebase-merge/done"],names:["git-rebase-todo"]},{id:"ignore",extensions:[".gitignore_global",".gitignore",".git-blame-ignore-revs"]},{id:"go",extensions:[".go"]},{id:"groovy",extensions:[".groovy",".gvy",".gradle",".jenkinsfile",".nf"],firstLine:"^#!.*\\bgroovy\\b",patterns:["Jenkinsfile*"],names:["Jenkinsfile"]},{id:"handlebars",extensions:[".handlebars",".hbs",".hjs"],mimeTypes:["text/x-handlebars-template"]},{id:"hlsl",extensions:[".hlsl",".hlsli",".fx",".fxh",".vsh",".psh",".cginc",".compute"]},{id:"html",extensions:[".html",".htm",".shtml",".xhtml",".xht",".mdoc",".jsp",".asp",".aspx",".jshtm",".volt",".ejs",".rhtml"],mimeTypes:["text/html","text/x-jshtm","text/template","text/ng-template","application/xhtml+xml"]},{id:"ini",extensions:[".ini"]},{id:"properties",extensions:[".conf",".properties",".cfg",".directory",".gitattributes",".gitconfig",".gitmodules",".editorconfig",".repo"],patterns:["**/.config/git/config","**/.git/config"],names:["gitconfig",".env"]},{id:"java",extensions:[".java",".jav"]},{id:"javascriptreact",extensions:[".jsx"]},{id:"javascript",extensions:[".js",".es6",".mjs",".cjs",".pac"],firstLine:"^#!.*\\bnode",names:["jakefile"],mimeTypes:["text/javascript"]},{id:"jsx-tags"},{id:"json",extensions:[".json",".bowerrc",".jscsrc",".webmanifest",".js.map",".css.map",".ts.map",".har",".jslintrc",".jsonld",".geojson",".ipynb",".vuerc"],names:["composer.lock",".watchmanconfig"],mimeTypes:["application/json","application/manifest+json"]},{id:"jsonc",extensions:[".jsonc",".eslintrc",".eslintrc.json",".jsfmtrc",".jshintrc",".swcrc",".hintrc",".babelrc"],names:["babel.config.json",".babelrc.json",".ember-cli","typedoc.json"]},{id:"jsonl",extensions:[".jsonl"],names:[]},{id:"snippets",extensions:[".code-snippets"],patterns:["**/User/snippets/*.json","**/User/profiles/*/snippets/*.json"]},{id:"julia",extensions:[".jl"],firstLine:"^#!\\s*/.*\\bjulia[0-9.-]*\\b"},{id:"juliamarkdown",extensions:[".jmd"]},{id:"tex",extensions:[".sty",".cls",".bbx",".cbx"]},{id:"latex",extensions:[".tex",".ltx",".ctx"]},{id:"bibtex",extensions:[".bib"]},{id:"cpp_embedded_latex"},{id:"markdown_latex_combined"},{id:"less",extensions:[".less"],mimeTypes:["text/x-less","text/less"]},{id:"log",extensions:[".log","*.log.?"]},{id:"lua",extensions:[".lua"]},{id:"makefile",extensions:[".mak",".mk"],firstLine:"^#!\\s*/usr/bin/make",names:["Makefile","makefile","GNUmakefile","OCamlMakefile"]},{id:"markdown",extensions:[".md",".mkd",".mdwn",".mdown",".markdown",".markdn",".mdtxt",".mdtext",".workbook"]},{id:"markdown-math"},{id:"ignore",extensions:[".npmignore"]},{id:"properties",extensions:[".npmrc"]},{id:"objective-c",extensions:[".m"]},{id:"objective-cpp",extensions:[".mm"]},{id:"perl",extensions:[".pl",".pm",".pod",".t",".PL",".psgi"],firstLine:"^#!.*\\bperl\\b"},{id:"raku",extensions:[".raku",".rakumod",".rakutest",".rakudoc",".nqp",".p6",".pl6",".pm6"],firstLine:"(^#!.*\\bperl6\\b)|use\\s+v6|raku|=begin\\spod|my\\sclass"},{id:"php",extensions:[".php",".php4",".php5",".phtml",".ctp"],firstLine:"^#!\\s*/.*\\bphp\\b",mimeTypes:["application/x-php"]},{id:"powershell",extensions:[".ps1",".psm1",".psd1",".pssc",".psrc"],firstLine:"^#!\\s*/.*\\bpwsh\\b"},{id:"jade",extensions:[".pug",".jade"]},{id:"python",extensions:[".py",".rpy",".pyw",".cpy",".gyp",".gypi",".pyi",".ipy",".pyt"],firstLine:"^#!\\s*/?.*\\bpython[0-9.-]*\\b",names:["SConstruct","SConscript"]},{id:"r",extensions:[".r",".rhistory",".rprofile",".rt"]},{id:"razor",extensions:[".cshtml",".razor"],mimeTypes:["text/x-cshtml"]},{id:"restructuredtext",extensions:[".rst"]},{id:"ruby",extensions:[".rb",".rbx",".rjs",".gemspec",".rake",".ru",".erb",".podspec",".rbi"],firstLine:"^#!\\s*/.*\\bruby\\b",names:["rakefile","gemfile","guardfile","podfile","capfile","cheffile","hobofile","vagrantfile","appraisals","rantfile","berksfile","berksfile.lock","thorfile","puppetfile","dangerfile","brewfile","fastfile","appfile","deliverfile","matchfile","scanfile","snapfile","gymfile"]},{id:"rust",extensions:[".rs"]},{id:"scss",extensions:[".scss"],mimeTypes:["text/x-scss","text/scss"]},{id:"search-result",extensions:[".code-search"]},{id:"shaderlab",extensions:[".shader"]},{id:"shellscript",extensions:[".sh",".bash",".bashrc",".bash_aliases",".bash_profile",".bash_login",".ebuild",".profile",".bash_logout",".xprofile",".xsession",".xsessionrc",".Xsession",".zsh",".zshrc",".zprofile",".zlogin",".zlogout",".zshenv",".zsh-theme",".fish",".ksh",".csh",".cshrc",".tcshrc",".yashrc",".yash_profile"],firstLine:"^#!.*\\b(bash|fish|zsh|sh|ksh|dtksh|pdksh|mksh|ash|dash|yash|sh|csh|jcsh|tcsh|itcsh).*|^#\\s*-\\*-[^*]*mode:\\s*shell-script[^*]*-\\*-",patterns:[".env.*"],names:["APKBUILD","PKGBUILD",".envrc",".hushlogin","zshrc","zshenv","zlogin","zprofile","zlogout","bashrc_Apple_Terminal","zshrc_Apple_Terminal"],mimeTypes:["text/x-shellscript"]},{id:"sql",extensions:[".sql",".dsql"]},{id:"swift",extensions:[".swift"]},{id:"typescript",extensions:[".ts",".cts",".mts"]},{id:"typescriptreact",extensions:[".tsx"]},{id:"jsonc",patterns:["tsconfig.*.json","jsconfig.*.json","tsconfig-*.json","jsconfig-*.json"],names:["tsconfig.json","jsconfig.json"]},{id:"json",extensions:[".tsbuildinfo"]},{id:"vb",extensions:[".vb",".brs",".vbs",".bas",".vba"]},{id:"xml",extensions:[".xml",".xsd",".ascx",".atom",".axml",".axaml",".bpmn",".cpt",".csl",".csproj",".csproj.user",".dita",".ditamap",".dtd",".ent",".mod",".dtml",".fsproj",".fxml",".iml",".isml",".jmx",".launch",".menu",".mxml",".nuspec",".opml",".owl",".proj",".props",".pt",".publishsettings",".pubxml",".pubxml.user",".rbxlx",".rbxmx",".rdf",".rng",".rss",".shproj",".storyboard",".svg",".targets",".tld",".tmx",".vbproj",".vbproj.user",".vcxproj",".vcxproj.filters",".wsdl",".wxi",".wxl",".wxs",".xaml",".xbl",".xib",".xlf",".xliff",".xpdl",".xul",".xoml"],firstLine:"(\\<\\?xml.*)|(\\<svg)|(\\<\\!doctype\\s+svg)"},{id:"xsl",extensions:[".xsl",".xslt"]},{id:"dockercompose",patterns:["compose.yml","compose.yaml","compose.*.yml","compose.*.yaml","*docker*compose*.yml","*docker*compose*.yaml"]},{id:"yaml",extensions:[".yml",".eyaml",".eyml",".yaml",".cff",".yaml-tmlanguage",".yaml-tmpreferences",".yaml-tmtheme"],firstLine:"^#cloud-config"}];class Mg{static default=new Mg;entries=[];static{for(const e of Dg)Mg.default.registerLanguage(e.id,e)}registerLanguage(e,t){const n=(e=>{const{extensions:t,names:n,patterns:r,firstLine:o}=e,s=o?new RegExp(o):null,a=r?$u(r.map((e=>e.includes("/")?`**/${e}`:e))):null;return(e,r)=>!!(t&&t.includes(i.extname(e))||n&&n.includes(e)||a&&a(e)||s&&s.test(r))})(t);this.entries.push({id:e,detect:n})}detect(e,t){const n=t.indexOf("\n"),i=-1===n?t:t.slice(0,n),r=this.entries.find((t=>t.detect(e,i.trim())));return r?.id??null}}function Fg(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let zg={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function Bg(e){zg=e}const qg=/[&<>"']/,Ug=new RegExp(qg.source,"g"),Hg=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Wg=new RegExp(Hg.source,"g"),Gg={"&":"&","<":"<",">":">",'"':""","'":"'"},Vg=e=>Gg[e];function Kg(e,t){if(t){if(qg.test(e))return e.replace(Ug,Vg)}else if(Hg.test(e))return e.replace(Wg,Vg);return e}const Jg=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function Yg(e){return e.replace(Jg,((e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const Zg=/(^|[^\[])\^/g;function Xg(e,t){let n="string"==typeof e?e:e.source;t=t||"";const i={replace:(e,t)=>{let r="string"==typeof t?t:t.source;return r=r.replace(Zg,"$1"),n=n.replace(e,r),i},getRegex:()=>new RegExp(n,t)};return i}function Qg(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const ev={exec:()=>null};function tv(e,t){const n=e.replace(/\|/g,((e,t,n)=>{let i=!1,r=t;for(;--r>=0&&"\\"===n[r];)i=!i;return i?"|":" |"})),i=n.split(/ \|/);let r=0;if(i[0].trim()||i.shift(),i.length>0&&!i[i.length-1].trim()&&i.pop(),t)if(i.length>t)i.splice(t);else for(;i.length<t;)i.push("");for(;r<i.length;r++)i[r]=i[r].trim().replace(/\\\|/g,"|");return i}function nv(e,t,n){const i=e.length;if(0===i)return"";let r=0;for(;r<i;){if(e.charAt(i-r-1)!==t)break;r++}return e.slice(0,i-r)}function iv(e,t,n,i){const r=t.href,o=t.title?Kg(t.title):null,s=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){i.state.inLink=!0;const e={type:"link",raw:n,href:r,title:o,text:s,tokens:i.inlineTokens(s)};return i.state.inLink=!1,e}return{type:"image",raw:n,href:r,title:o,text:Kg(s)}}class rv{options;rules;lexer;constructor(e){this.options=e||zg}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:nv(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t){const n=e.match(/^(\s+)(?:```)/);if(null===n)return t;const i=n[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[n]=t;return n.length>=i.length?e.slice(i.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=nv(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const e=nv(t[0].replace(/^ *>[ \t]?/gm,""),"\n"),n=this.lexer.state.top;this.lexer.state.top=!0;const i=this.lexer.blockTokens(e);return this.lexer.state.top=n,{type:"blockquote",raw:t[0],tokens:i,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const i=n.length>1,r={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");const o=new RegExp(`^( {0,3}${n})((?:[\t ][^\\n]*)?(?:\\n|$))`);let s="",a="",c=!1;for(;e;){let n=!1;if(!(t=o.exec(e)))break;if(this.rules.block.hr.test(e))break;s=t[0],e=e.substring(s.length);let i=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),l=e.split("\n",1)[0],u=0;this.options.pedantic?(u=2,a=i.trimStart()):(u=t[2].search(/[^ ]/),u=u>4?1:u,a=i.slice(u),u+=t[1].length);let p=!1;if(!i&&/^ *$/.test(l)&&(s+=l+"\n",e=e.substring(l.length+1),n=!0),!n){const t=new RegExp(`^ {0,${Math.min(3,u-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),n=new RegExp(`^ {0,${Math.min(3,u-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),r=new RegExp(`^ {0,${Math.min(3,u-1)}}(?:\`\`\`|~~~)`),o=new RegExp(`^ {0,${Math.min(3,u-1)}}#`);for(;e;){const c=e.split("\n",1)[0];if(l=c,this.options.pedantic&&(l=l.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),r.test(l))break;if(o.test(l))break;if(t.test(l))break;if(n.test(e))break;if(l.search(/[^ ]/)>=u||!l.trim())a+="\n"+l.slice(u);else{if(p)break;if(i.search(/[^ ]/)>=4)break;if(r.test(i))break;if(o.test(i))break;if(n.test(i))break;a+="\n"+l}p||l.trim()||(p=!0),s+=c+"\n",e=e.substring(c.length+1),i=l.slice(u)}}r.loose||(c?r.loose=!0:/\n *\n *$/.test(s)&&(c=!0));let d,f=null;this.options.gfm&&(f=/^\[[ xX]\] /.exec(a),f&&(d="[ ] "!==f[0],a=a.replace(/^\[[ xX]\] +/,""))),r.items.push({type:"list_item",raw:s,task:!!f,checked:d,loose:!1,text:a,tokens:[]}),r.raw+=s}r.items[r.items.length-1].raw=s.trimEnd(),r.items[r.items.length-1].text=a.trimEnd(),r.raw=r.raw.trimEnd();for(let e=0;e<r.items.length;e++)if(this.lexer.state.top=!1,r.items[e].tokens=this.lexer.blockTokens(r.items[e].text,[]),!r.loose){const t=r.items[e].tokens.filter((e=>"space"===e.type)),n=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));r.loose=n}if(r.loose)for(let e=0;e<r.items.length;e++)r.items[e].loose=!0;return r}}html(e){const t=this.rules.block.html.exec(e);if(t){return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}}def(e){const t=this.rules.block.def.exec(e);if(t){const e=t[1].toLowerCase().replace(/\s+/g," "),n=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:i}}}table(e){const t=this.rules.block.table.exec(e);if(!t)return;if(!/[:|]/.test(t[2]))return;const n=tv(t[1]),i=t[2].replace(/^\||\| *$/g,"").split("|"),r=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(const e of i)/^ *-+: *$/.test(e)?o.align.push("right"):/^ *:-+: *$/.test(e)?o.align.push("center"):/^ *:-+ *$/.test(e)?o.align.push("left"):o.align.push(null);for(const e of n)o.header.push({text:e,tokens:this.lexer.inline(e)});for(const e of r)o.rows.push(tv(e,o.header.length).map((e=>({text:e,tokens:this.lexer.inline(e)}))));return o}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:Kg(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const t=nv(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let i=0;i<e.length;i++)if("\\"===e[i])i++;else if(e[i]===t[0])n++;else if(e[i]===t[1]&&(n--,n<0))return i;return-1}(t[2],"()");if(e>-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],i="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],i=e[3])}else i=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^</.test(n)&&(n=this.options.pedantic&&!/>$/.test(e)?n.slice(1):n.slice(1,-1)),iv(t,{href:n?n.replace(this.rules.inline.anyPunctuation,"$1"):n,title:i?i.replace(this.rules.inline.anyPunctuation,"$1"):i},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const e=t[(n[2]||n[1]).replace(/\s+/g," ").toLowerCase()];if(!e){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return iv(n,e,n[0],this.lexer)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!i)return;if(i[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(i[1]||i[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const n=[...i[0]].length-1;let r,o,s=n,a=0;const c="*"===i[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);null!=(i=c.exec(t));){if(r=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!r)continue;if(o=[...r].length,i[3]||i[4]){s+=o;continue}if((i[5]||i[6])&&n%3&&!((n+o)%3)){a+=o;continue}if(s-=o,s>0)continue;o=Math.min(o,o+s+a);const t=[...i[0]][0].length,c=e.slice(0,n+i.index+t+o);if(Math.min(n,o)%2){const e=c.slice(1,-1);return{type:"em",raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}const l=c.slice(2,-2);return{type:"strong",raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const n=/[^ ]/.test(e),i=/^ /.test(e)&&/ $/.test(e);return n&&i&&(e=e.substring(1,e.length-1)),e=Kg(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=Kg(t[1]),n="mailto:"+e):(e=Kg(t[1]),n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=Kg(t[0]),n="mailto:"+e;else{let i;do{i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(i!==t[0]);e=Kg(t[0]),n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:Kg(t[0]),{type:"text",raw:t[0],text:e}}}}const ov=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,sv=/(?:[*+-]|\d{1,9}[.)])/,av=Xg(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,sv).getRegex(),cv=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,lv=/(?!\s*\])(?:\\.|[^\[\]\\])+/,uv=Xg(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",lv).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),pv=Xg(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,sv).getRegex(),dv="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",fv=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,mv=Xg("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",fv).replace("tag",dv).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),hv=Xg(cv).replace("hr",ov).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",dv).getRegex(),gv={blockquote:Xg(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",hv).getRegex(),code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,def:uv,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:ov,html:mv,lheading:av,list:pv,newline:/^(?: *(?:\n|$))+/,paragraph:hv,table:ev,text:/^[^\n]+/},vv=Xg("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ov).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",dv).getRegex(),xv={...gv,table:vv,paragraph:Xg(cv).replace("hr",ov).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",vv).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",dv).getRegex()},bv={...gv,html:Xg("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",fv).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ev,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Xg(cv).replace("hr",ov).replace("heading"," *#{1,6} *[^\n]").replace("lheading",av).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},yv=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,_v=/^( {2,}|\\)\n(?!\s*$)/,wv="\\p{P}$+<=>`^|~",Ev=Xg(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,wv).getRegex(),Sv=Xg(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,wv).getRegex(),kv=Xg("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,wv).getRegex(),Rv=Xg("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,wv).getRegex(),Tv=Xg(/\\([punct])/,"gu").replace(/punct/g,wv).getRegex(),Ov=Xg(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Cv=Xg(fv).replace("(?:--\x3e|$)","--\x3e").getRegex(),Av=Xg("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Cv).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Pv=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,jv=Xg(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Pv).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Lv=Xg(/^!?\[(label)\]\[(ref)\]/).replace("label",Pv).replace("ref",lv).getRegex(),Nv=Xg(/^!?\[(ref)\](?:\[\])?/).replace("ref",lv).getRegex(),Iv={_backpedal:ev,anyPunctuation:Tv,autolink:Ov,blockSkip:/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,br:_v,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:ev,emStrongLDelim:Sv,emStrongRDelimAst:kv,emStrongRDelimUnd:Rv,escape:yv,link:jv,nolink:Nv,punctuation:Ev,reflink:Lv,reflinkSearch:Xg("reflink|nolink(?!\\()","g").replace("reflink",Lv).replace("nolink",Nv).getRegex(),tag:Av,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:ev},$v={...Iv,link:Xg(/^!?\[(label)\]\((.*?)\)/).replace("label",Pv).getRegex(),reflink:Xg(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Pv).getRegex()},Dv={...Iv,escape:Xg(yv).replace("])","~|])").getRegex(),url:Xg(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Mv={...Dv,br:Xg(_v).replace("{2,}","*").getRegex(),text:Xg(Dv.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Fv={normal:gv,gfm:xv,pedantic:bv},zv={normal:Iv,gfm:Dv,breaks:Mv,pedantic:$v};class Bv{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||zg,this.options.tokenizer=this.options.tokenizer||new rv,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:Fv.normal,inline:zv.normal};this.options.pedantic?(t.block=Fv.pedantic,t.inline=zv.pedantic):this.options.gfm&&(t.block=Fv.gfm,this.options.breaks?t.inline=zv.breaks:t.inline=zv.gfm),this.tokenizer.rules=t}static get rules(){return{block:Fv,inline:zv}}static lex(e,t){return new Bv(t).lex(e)}static lexInline(e,t){return new Bv(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){const t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[]){let n,i,r,o;for(e=this.options.pedantic?e.replace(/\t/g," ").replace(/^ +$/gm,""):e.replace(/^( *)(\t+)/gm,((e,t,n)=>t+" ".repeat(n.length)));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((i=>!!(n=i.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),1===n.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),i=t[t.length-1],!i||"paragraph"!==i.type&&"text"!==i.type?t.push(n):(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(e))e=e.substring(n.raw.length),i=t[t.length-1],!i||"paragraph"!==i.type&&"text"!==i.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(i.raw+="\n"+n.raw,i.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text);else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else{if(r=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const n=e.slice(1);let i;this.options.extensions.startBlock.forEach((e=>{i=e.call({lexer:this},n),"number"==typeof i&&i>=0&&(t=Math.min(t,i))})),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(r)))i=t[t.length-1],o&&"paragraph"===i.type?(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n),o=r.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),i=t[t.length-1],i&&"text"===i.type?(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,i,r,o,s,a,c=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(o=this.tokenizer.rules.inline.reflinkSearch.exec(c));)e.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(c=c.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+c.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(o=this.tokenizer.rules.inline.blockSkip.exec(c));)c=c.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+c.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(o=this.tokenizer.rules.inline.anyPunctuation.exec(c));)c=c.slice(0,o.index)+"++"+c.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(s||(a=""),s=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((i=>!!(n=i.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.escape(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(e))e=e.substring(n.raw.length),i=t[t.length-1],i&&"text"===n.type&&"text"===i.type?(i.raw+=n.raw,i.text+=n.text):t.push(n);else if(n=this.tokenizer.link(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(n.raw.length),i=t[t.length-1],i&&"text"===n.type&&"text"===i.type?(i.raw+=n.raw,i.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(e,c,a))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(e))e=e.substring(n.raw.length),t.push(n);else if(this.state.inLink||!(n=this.tokenizer.url(e))){if(r=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const n=e.slice(1);let i;this.options.extensions.startInline.forEach((e=>{i=e.call({lexer:this},n),"number"==typeof i&&i>=0&&(t=Math.min(t,i))})),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(r))e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(a=n.raw.slice(-1)),s=!0,i=t[t.length-1],i&&"text"===i.type?(i.raw+=n.raw,i.text+=n.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(n.raw.length),t.push(n);return t}}class qv{options;constructor(e){this.options=e||zg}code(e,t,n){const i=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+"\n",i?'<pre><code class="language-'+Kg(i)+'">'+(n?e:Kg(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:Kg(e,!0))+"</code></pre>\n"}blockquote(e){return`<blockquote>\n${e}</blockquote>\n`}html(e,t){return e}heading(e,t,n){return`<h${t}>${e}</h${t}>\n`}hr(){return"<hr>\n"}list(e,t,n){const i=t?"ol":"ul";return"<"+i+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+i+">\n"}listitem(e,t,n){return`<li>${e}</li>\n`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>\n`}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"}tablerow(e){return`<tr>\n${e}</tr>\n`}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>\n`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){const i=Qg(e);if(null===i)return n;let r='<a href="'+(e=i)+'"';return t&&(r+=' title="'+t+'"'),r+=">"+n+"</a>",r}image(e,t,n){const i=Qg(e);if(null===i)return n;let r=`<img src="${e=i}" alt="${n}"`;return t&&(r+=` title="${t}"`),r+=">",r}text(e){return e}}class Uv{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class Hv{options;renderer;textRenderer;constructor(e){this.options=e||zg,this.options.renderer=this.options.renderer||new qv,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Uv}static parse(e,t){return new Hv(t).parse(e)}static parseInline(e,t){return new Hv(t).parseInline(e)}parse(e,t=!0){let n="";for(let i=0;i<e.length;i++){const r=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const e=r,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(e.type)){n+=t||"";continue}}switch(r.type){case"space":continue;case"hr":n+=this.renderer.hr();continue;case"heading":{const e=r;n+=this.renderer.heading(this.parseInline(e.tokens),e.depth,Yg(this.parseInline(e.tokens,this.textRenderer)));continue}case"code":{const e=r;n+=this.renderer.code(e.text,e.lang,!!e.escaped);continue}case"table":{const e=r;let t="",i="";for(let t=0;t<e.header.length;t++)i+=this.renderer.tablecell(this.parseInline(e.header[t].tokens),{header:!0,align:e.align[t]});t+=this.renderer.tablerow(i);let o="";for(let t=0;t<e.rows.length;t++){const n=e.rows[t];i="";for(let t=0;t<n.length;t++)i+=this.renderer.tablecell(this.parseInline(n[t].tokens),{header:!1,align:e.align[t]});o+=this.renderer.tablerow(i)}n+=this.renderer.table(t,o);continue}case"blockquote":{const e=r,t=this.parse(e.tokens);n+=this.renderer.blockquote(t);continue}case"list":{const e=r,t=e.ordered,i=e.start,o=e.loose;let s="";for(let t=0;t<e.items.length;t++){const n=e.items[t],i=n.checked,r=n.task;let a="";if(n.task){const e=this.renderer.checkbox(!!i);o?n.tokens.length>0&&"paragraph"===n.tokens[0].type?(n.tokens[0].text=e+" "+n.tokens[0].text,n.tokens[0].tokens&&n.tokens[0].tokens.length>0&&"text"===n.tokens[0].tokens[0].type&&(n.tokens[0].tokens[0].text=e+" "+n.tokens[0].tokens[0].text)):n.tokens.unshift({type:"text",text:e+" "}):a+=e+" "}a+=this.parse(n.tokens,o),s+=this.renderer.listitem(a,r,!!i)}n+=this.renderer.list(s,t,i);continue}case"html":{const e=r;n+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=r;n+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let o=r,s=o.tokens?this.parseInline(o.tokens):o.text;for(;i+1<e.length&&"text"===e[i+1].type;)o=e[++i],s+="\n"+(o.tokens?this.parseInline(o.tokens):o.text);n+=t?this.renderer.paragraph(s):s;continue}default:{const e='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let i=0;i<e.length;i++){const r=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const e=this.options.extensions.renderers[r.type].call({parser:this},r);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){n+=e||"";continue}}switch(r.type){case"escape":{const e=r;n+=t.text(e.text);break}case"html":{const e=r;n+=t.html(e.text);break}case"link":{const e=r;n+=t.link(e.href,e.title,this.parseInline(e.tokens,t));break}case"image":{const e=r;n+=t.image(e.href,e.title,e.text);break}case"strong":{const e=r;n+=t.strong(this.parseInline(e.tokens,t));break}case"em":{const e=r;n+=t.em(this.parseInline(e.tokens,t));break}case"codespan":{const e=r;n+=t.codespan(e.text);break}case"br":n+=t.br();break;case"del":{const e=r;n+=t.del(this.parseInline(e.tokens,t));break}case"text":{const e=r;n+=t.text(e.text);break}default:{const e='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}}class Wv{options;constructor(e){this.options=e||zg}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}const Gv=new class{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.#e(Bv.lex,Hv.parse);parseInline=this.#e(Bv.lexInline,Hv.parseInline);Parser=Hv;Renderer=qv;TextRenderer=Uv;Lexer=Bv;Tokenizer=rv;Hooks=Wv;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(const i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{const e=i;for(const i of e.header)n=n.concat(this.walkTokens(i.tokens,t));for(const i of e.rows)for(const e of i)n=n.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=i;n=n.concat(this.walkTokens(e.items,t));break}default:{const e=i;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach((i=>{const r=e[i].flat(1/0);n=n.concat(this.walkTokens(r,t))})):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let i=e.renderer.apply(this,t);return!1===i&&(i=n.apply(this,t)),i}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){const t=this.defaults.renderer||new qv(this.defaults);for(const n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if("options"===n)continue;const i=n,r=e.renderer[i],o=t[i];t[i]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=o.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new rv(this.defaults);for(const n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;const i=n,r=e.tokenizer[i],o=t[i];t[i]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=o.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new Wv;for(const n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if("options"===n)continue;const i=n,r=e.hooks[i],o=t[i];Wv.passThroughHooks.has(n)?t[i]=e=>{if(this.defaults.async)return Promise.resolve(r.call(t,e)).then((e=>o.call(t,e)));const n=r.call(t,e);return o.call(t,n)}:t[i]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=o.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,i=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(i.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Bv.lex(e,t??this.defaults)}parser(e,t){return Hv.parse(e,t??this.defaults)}#e(e,t){return(n,i)=>{const r={...i},o={...this.defaults,...r};!0===this.defaults.async&&!1===r.async&&(o.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),o.async=!0);const s=this.#t(!!o.silent,!!o.async);if(null==n)return s(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof n)return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(o.hooks&&(o.hooks.options=o),o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(n):n).then((t=>e(t,o))).then((e=>o.hooks?o.hooks.processAllTokens(e):e)).then((e=>o.walkTokens?Promise.all(this.walkTokens(e,o.walkTokens)).then((()=>e)):e)).then((e=>t(e,o))).then((e=>o.hooks?o.hooks.postprocess(e):e)).catch(s);try{o.hooks&&(n=o.hooks.preprocess(n));let i=e(n,o);o.hooks&&(i=o.hooks.processAllTokens(i)),o.walkTokens&&this.walkTokens(i,o.walkTokens);let r=t(i,o);return o.hooks&&(r=o.hooks.postprocess(r)),r}catch(e){return s(e)}}}#t(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="<p>An error occurred:</p><pre>"+Kg(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Vv(e,t){return Gv.parse(e,t)}Vv.options=Vv.setOptions=function(e){return Gv.setOptions(e),Vv.defaults=Gv.defaults,Bg(Vv.defaults),Vv},Vv.getDefaults=Fg,Vv.defaults=zg,Vv.use=function(...e){return Gv.use(...e),Vv.defaults=Gv.defaults,Bg(Vv.defaults),Vv},Vv.walkTokens=function(e,t){return Gv.walkTokens(e,t)},Vv.parseInline=Gv.parseInline,Vv.Parser=Hv,Vv.parser=Hv.parse,Vv.Renderer=qv,Vv.TextRenderer=Uv,Vv.Lexer=Bv,Vv.lexer=Bv.lex,Vv.Tokenizer=rv,Vv.Hooks=Wv,Vv.parse=Vv,Vv.options,Vv.setOptions,Vv.use,Vv.walkTokens,Vv.parseInline,Hv.parse,Bv.lex;!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.stringSimilarity=void 0;e.stringSimilarity=function(e,t,n,i){if(void 0===n&&(n=2),void 0===i&&(i=!1),i||(e=e.toLowerCase(),t=t.toLowerCase()),e.length<n||t.length<n)return 0;for(var r=new Map,o=0;o<e.length-(n-1);o++){var s=e.substr(o,n);r.set(s,r.has(s)?r.get(s)+1:1)}for(var a=0,c=0;c<t.length-(n-1);c++){var l=t.substr(c,n),u=r.has(l)?r.get(l):0;u>0&&(r.set(l,u-1),a++)}return 2*a/(e.length+t.length-2*(n-1))},e.default=e.stringSimilarity}({});var Kv=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Jv=Kv,Yv=Object.create,Zv=function(){function e(){}return function(t){if(!Jv(t))return{};if(Yv)return Yv(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();var Xv=function(){},Qv=Zv,ex=Xv;function tx(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}tx.prototype=Qv(ex.prototype),tx.prototype.constructor=tx;var nx=tx;var ix=function(e,t){for(var n=-1,i=t.length,r=e.length;++n<i;)e[r+n]=t[n];return e},rx="object"==typeof Fe&&Fe&&Fe.Object===Object&&Fe,ox="object"==typeof self&&self&&self.Object===Object&&self,sx=rx||ox||Function("return this")(),ax=sx.Symbol,cx=ax,lx=Object.prototype,ux=lx.hasOwnProperty,px=lx.toString,dx=cx?cx.toStringTag:void 0;var fx=function(e){var t=ux.call(e,dx),n=e[dx];try{e[dx]=void 0;var i=!0}catch(e){}var r=px.call(e);return i&&(t?e[dx]=n:delete e[dx]),r},mx=Object.prototype.toString;var hx=fx,gx=function(e){return mx.call(e)},vx=ax?ax.toStringTag:void 0;var xx=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":vx&&vx in Object(e)?hx(e):gx(e)};var bx=function(e){return null!=e&&"object"==typeof e},yx=xx,_x=bx;var wx=function(e){return _x(e)&&"[object Arguments]"==yx(e)},Ex=bx,Sx=Object.prototype,kx=Sx.hasOwnProperty,Rx=Sx.propertyIsEnumerable,Tx=wx(function(){return arguments}())?wx:function(e){return Ex(e)&&kx.call(e,"callee")&&!Rx.call(e,"callee")},Ox=Array.isArray,Cx=Tx,Ax=Ox,Px=ax?ax.isConcatSpreadable:void 0;var jx=ix,Lx=function(e){return Ax(e)||Cx(e)||!!(Px&&e&&e[Px])};var Nx=function e(t,n,i,r,o){var s=-1,a=t.length;for(i||(i=Lx),o||(o=[]);++s<a;){var c=t[s];n>0&&i(c)?n>1?e(c,n-1,i,r,o):jx(o,c):r||(o[o.length]=c)}return o},Ix=Nx;var $x=function(e){return(null==e?0:e.length)?Ix(e,1):[]};var Dx=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)},Mx=Math.max;var Fx=function(e,t,n){return t=Mx(void 0===t?e.length-1:t,0),function(){for(var i=arguments,r=-1,o=Mx(i.length-t,0),s=Array(o);++r<o;)s[r]=i[t+r];r=-1;for(var a=Array(t+1);++r<t;)a[r]=i[r];return a[t]=n(s),Dx(e,this,a)}};var zx=function(e){return function(){return e}},Bx=xx,qx=Kv;var Ux,Hx=function(e){if(!qx(e))return!1;var t=Bx(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Wx=sx["__core-js_shared__"],Gx=(Ux=/[^.]+$/.exec(Wx&&Wx.keys&&Wx.keys.IE_PROTO||""))?"Symbol(src)_1."+Ux:"";var Vx=function(e){return!!Gx&&Gx in e},Kx=Function.prototype.toString;var Jx=Hx,Yx=Vx,Zx=Kv,Xx=function(e){if(null!=e){try{return Kx.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Qx=/^\[object .+?Constructor\]$/,eb=Function.prototype,tb=Object.prototype,nb=eb.toString,ib=tb.hasOwnProperty,rb=RegExp("^"+nb.call(ib).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var ob=function(e){return!(!Zx(e)||Yx(e))&&(Jx(e)?rb:Qx).test(Xx(e))},sb=function(e,t){return null==e?void 0:e[t]};var ab=function(e,t){var n=sb(e,t);return ob(n)?n:void 0},cb=ab,lb=function(){try{var e=cb(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var ub=zx,pb=lb,db=pb?function(e,t){return pb(e,"toString",{configurable:!0,enumerable:!1,value:ub(t),writable:!0})}:function(e){return e},fb=db,mb=Date.now;var hb=function(e){var t=0,n=0;return function(){var i=mb(),r=16-(i-n);if(n=i,r>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(fb),gb=$x,vb=Fx,xb=hb;var bb=function(e){return xb(vb(e,void 0,gb),e+"")},yb=ab(sx,"WeakMap");var _b=yb&&new yb,wb=_b?function(e){return _b.get(e)}:function(){},Eb={},Sb=Object.prototype.hasOwnProperty;var kb=function(e){for(var t=e.name+"",n=Eb[t],i=Sb.call(Eb,t)?n.length:0;i--;){var r=n[i],o=r.func;if(null==o||o==e)return r.name}return t},Rb=Zv,Tb=Xv;function Ob(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}Ob.prototype=Rb(Tb.prototype),Ob.prototype.constructor=Ob;var Cb=Ob;var Ab=function(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n<i;)t[n]=e[n];return t},Pb=Cb,jb=nx,Lb=Ab;var Nb=Cb,Ib=nx,$b=Xv,Db=Ox,Mb=bx,Fb=function(e){if(e instanceof Pb)return e.clone();var t=new jb(e.__wrapped__,e.__chain__);return t.__actions__=Lb(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t},zb=Object.prototype.hasOwnProperty;function Bb(e){if(Mb(e)&&!Db(e)&&!(e instanceof Nb)){if(e instanceof Ib)return e;if(zb.call(e,"__wrapped__"))return Fb(e)}return new Ib(e)}Bb.prototype=$b.prototype,Bb.prototype.constructor=Bb;var qb=Cb,Ub=wb,Hb=kb,Wb=Bb;var Gb=nx,Vb=bb,Kb=wb,Jb=kb,Yb=Ox,Zb=function(e){var t=Hb(e),n=Wb[t];if("function"!=typeof n||!(t in qb.prototype))return!1;if(e===n)return!0;var i=Ub(n);return!!i&&e===i[0]};var Xb,Qb=function(e){return Vb((function(t){var n=t.length,i=n,r=Gb.prototype.thru;for(e&&t.reverse();i--;){var o=t[i];if("function"!=typeof o)throw new TypeError("Expected a function");if(r&&!s&&"wrapper"==Jb(o))var s=new Gb([],!0)}for(i=s?i:n;++i<n;){o=t[i];var a=Jb(o),c="wrapper"==a?Kb(o):void 0;s=c&&Zb(c[0])&&424==c[1]&&!c[4].length&&1==c[9]?s[Jb(c[0])].apply(s,c[3]):1==o.length&&Zb(o)?s[a]():s.thru(o)}return function(){var e=arguments,i=e[0];if(s&&1==e.length&&Yb(i))return s.plant(i).value();for(var r=0,o=n?t[r].apply(this,e):i;++r<n;)o=t[r].call(this,o);return o}}))};Qb(),function(e){e.EDIT="edit",e.PREVIEW="preview"}(Xb||(Xb={}));for(var ey,ty,ny,iy,ry,oy,sy,ay,cy,ly,uy,py,dy,fy,my,hy,gy,vy,xy,by,yy,_y,wy,Ey,Sy,ky,Ry,Ty,Oy,Cy,Ay,Py,jy=0;jy<4;jy++)(4294967296*Math.random()).toString(16);!function(e){e.VERSION_UPDATE_TITLE="version.update.title",e.VERSION_UPDATE_INSTALL="version.update.install",e.VERSION_UPDATE_IGNORE="version.update.ignore",e.COMMON_GENERATE_ERROR="common.generate.error",e.COMMON_UNKNOWN_ERROR="common.unknown.error",e.COMMON_REQUEST_ERROR="common.request.error",e.COMMON_CODE="common.code",e.COMMON_FUNCTION="common.function",e.COMMON_USING="common.using",e.COMMON_WITHOUT="common.without",e.COMMON_COMMA="common.comma",e.COMMON_FRAMEWORK="common.framework",e.COMMON_RELATED="common.related",e.COMMON_PROMPT="common.prompt",e.COMMON_THINKING="common.thinking",e.COMMON_SEARCH_RESULT="common.searchResult",e.COMMON_AUTHORIZE="common.authorize",e.COMMON_DENY="common.deny",e.COMMON_NAVIGATE_TO_SETTING="common.navigateToSetting",e.COMMON_CUSTOMIZE_ERROR="common.customize.error",e.COMMON_PRIVATE_ERROR="common.private.error",e.LOG_LEVEL_PLACEHOLDER="log.level.placeholder",e.DO_NOT_SHOW_AGAIN="do.not.show.again"}(ey||(ey={})),function(e){e.NOT_SUPPORT="statusBar.not.support.text",e.ENABLE="statusBar.enable.text",e.NO_SUGGESTIONS="statusBar.nosuggestions",e.TITLE="statusBar.title"}(ty||(ty={})),function(e){e.PANEL_ACCEPT="completion.panel.accept.text",e.PANEL_ACCEPT_TOOLTIP="completion.panel.accept.tooltip",e.PANEL_CODELENS_DISABLED="completion.panel.codelens.disabled.text",e.PANEL_TITLE="completion.panel.title",e.PANEL_EMPTY="completion.panel.empty.text",e.PANEL_HIDDEN="completion.panel.hidden.text",e.PANEL_SYNTHESIZING="completion.panel.synthesizing.text",e.DECORATION_BASIC="completion.decoration.basic",e.DECORATION_WITH_WIDGET="completion.decoration.widget.text",e.DECORATION_ACCEPT_LINE="completion.decoration.acceptLine.text"}(ny||(ny={})),function(e){e.EMPTY_TEXT="nl2code.empty.text",e.NO_SELECTION="nl2code.no.selection.text"}(iy||(iy={})),function(e){e.CODELENS_TITLE="optimize.codelens.title",e.CODELENS_TOOLTIP="optimize.codelens.tooltip",e.OPTIMIZE_ERROR="optimize.error",e.OPTIMIZE_CODE_PROMPT="optimize.code.prompt",e.NO_SELECTION="optimize.no.selection.text",e.OPTIMIZE_FUNCTION_PROMPT="optimize.function.prompt"}(ry||(ry={})),function(e){e.EXPLAIN_SELECTED_CODE="explain.codeActions.title",e.OPTIMIZE_SELECTED_CODE="optimize.codeActions.title",e.INLINECHAT_SELECTED_CODE="inlinechat.codeActions.title"}(oy||(oy={})),function(e){e.CODELENS_TITLE="chatTrial.codelens.title"}(sy||(sy={})),function(e){e.CODELENS_TITLE="inlinechat.codelens.title"}(ay||(ay={})),function(e){e.CHAT_TIPS_TITLE="chatTips.selectedCode.title",e.CHAT_TIPS_CODE_BLANK_ROW_TITLE="chatTips.blankRow.title"}(cy||(cy={})),function(e){e.GENERATING_TITLE="decorations.generating.title",e.LINE_COMMENT_CODE_TRIGGER_TITLE="decorations.lineComent.trigger.title"}(ly||(ly={})),function(e){e.PROMPT="comment.prompt",e.CODELENS_TITLE="comment.codelens.title",e.CODELENS_TOOLTIP="comment.codelens.tooltip",e.INLINECHAT_TITLE="comment.inlinechat.title",e.GENERATE_ERROR="comment.generate.error"}(uy||(uy={})),function(e){e.PROMPT="docstring.prompt",e.CODELENS_TITLE="docstring.codelens.title",e.CODELENS_TOOLTIP="docstring.codelens.tooltip",e.INLINECHAT_TITLE="docstring.inlinechat.title",e.GENERATE_ERROR="docstring.generate.error"}(py||(py={})),function(e){e.PROMPT="split.prompt",e.CODELENS_TITLE="split.codelens.title",e.CODELENS_TOOLTIP="split.codelens.tooltip",e.GENERATE_ERROR="split.generate.error"}(dy||(dy={})),function(e){e.CODELENS_TITLE="explain.codelens.title",e.CODELENS_TOOLTIP="explain.codelens.tooltip",e.GENERATE_ERROR="explain.generate.error",e.NO_SELECTION="explain.no.selection.text",e.PROMPT="explain.prompt"}(fy||(fy={})),function(e){e.CODELENS_TITLE="unitTest.codelens.title",e.CODELENS_TOOLTIP="unitTest.codelens.tooltip",e.GENERATE_ERROR="unitTest.generate.error",e.ACCEPT_ERROR="unitTest.accept.error",e.PROMPT="unitTest.prompt"}(my||(my={})),function(e){e.PROMPT="inlineLog.prompt",e.CODELENS_TITLE="inlineLog.codelens.title",e.CODELENS_TOOLTIP="inlineLog.codelens.tooltip",e.GENERATE_ERROR="inlineLog.generate.error"}(hy||(hy={})),function(e){e.TITLE="diff.title",e.ACCEPT="diff.accept",e.REJECT="diff.reject",e.OPEN_DUAL_SCREEN_DIFF="diff.dualScreenDiff.open"}(gy||(gy={})),function(e){e.WEBVIEW_TITLE="chat.webview.title",e.NO_INSERT_POSITION="chat.no.insertPosition.text"}(vy||(vy={})),function(e){e.PATH_ERROR="accept.path.error"}(xy||(xy={})),function(e){e.ACTION="quickFix.action.text",e.PROMPT="quickFix.prompt",e.PROMPT_SUFFIX="quickFix.prompt.suffix",e.GENERATE_ERROR="quickFix.generate.error",e.FIX_MAX_LEN="quickFix.fix.maxLen.text"}(by||(by={})),function(e){e.LOGIN_MESSAGE="login.message",e.LOGIN_ACTION_TEXT="login.action.text",e.LOGIN_ACTION_WITH_LICENSE="login.action.withLicense.text",e.LOGIN_DEVICE_ERROR="login.device.error",e.LOGIN_LOGGING_IN="login.loggingIn.text",e.LOGIN_SUCCESS="login.success",e.LOGIN_IDE_SUCCESS="login.ide.success",e.LOGIN_FAILED="login.failed",e.LOGIN_TOKEN_ERROR="login.token.error",e.LOGIN_KEY_ERROR="login.key.error",e.LOGIN_INTERNAL_USER="login.internalUser.message",e.LOGIN_INSTALL_INTERNAL="login.install.internal",e.LOGIN_AGREEMENT="login.agreement.message",e.RENEW_ACTION="renew.action.text",e.QUICK_PICK_PLACEHOLDER="command.quick.pick.placeholder"}(yy||(yy={})),function(e){e.TOOLTIP="regexHover.tooltip",e.PROMPT="regexHover.prompt"}(_y||(_y={})),function(e){e.MAXIMUM_FILES="embeddings.maximum.files.message",e.PROGRESS="embeddings.progress.message",e.PROGRESS_TOOLTIP="embeddings.progress.tooltip.message"}(wy||(wy={})),function(e){e.TITLE="openPlatform.title.text",e.WEBVIEW_TITLE="openPlatform.webview.title"}(Ey||(Ey={})),function(e){e.MODAL_AUTH_TITLE="autoWork.auth.modal.title",e.INDEXING_MESSAGE="autoWork.indexing.message",e.CONNECTION_INTERRUPT="autoWork.connection.interrupt.message",e.INDEXING_REMINDER="autoWork.indexing.reminder.text",e.ERROR="autoWork.error",e.TASK_THOUGHT="autoWork.task.thought",e.TASK_ANSWER="autoWork.task.answer",e.AUTO_DEBUG="autoWork.autoDebug",e.AUTO_DEBUG_PROMPT="autoWork.autoDebug.prompt",e.AUTO_DEBUG_STAGE_THOUGHT="autoWork.autoDebug.thought",e.AUTO_DEBUG_STAGE_SEARCH="autoWork.autoDebug.search",e.AUTO_DEBUG_STAGE_ANSWER="autoWork.autoDebug.answer"}(Sy||(Sy={})),function(e){e.PERMISSION_WORKSPACE="comatePlus.permission.workspace.text",e.PERMISSION_DISK="comatePlus.permission.disk.text",e.PERMISSION_USER="comatePlus.permission.user.text",e.AUTH_MESSAGE="comatePlus.auth.message",e.USER_INFO_ERROR="comatePlus.userInfo.error",e.CLEAR_PERMISSION="comatePlus.clear.permission",e.SPLIT_ERROR="comatePlus.split.error",e.NO_SELECTION="comatePlus.noSelection",e.NOT_A_FUNCTION="comatePlus.not.function.text"}(ky||(ky={})),function(e){e.INLINECHAT_GENERATE="inlinechat.placeholder.generate",e.INLINECHAT_SELECTED="inlinechat.placeholder.selected",e.INLINECHAT_UNSELECTED="inlinechat.placeholder.unselected",e.INLINECHAT_TITLE="inlinechat.title",e.INLINCHAT_ERROR="inlinechat.placeholder.error"}(Ry||(Ry={})),function(e){e.GENERATE_ERROR="messageGenerate.generate.error",e.NO_DIFF_ERROR="messageGenerate.noDiff.error",e.GET_DIFF_ERROR="messageGenerate.getDiff.error",e.EMPTY_CONTENT_ERROR="messageGenerate.emptyContent.error"}(Ty||(Ty={})),function(e){e.GENERATE_ERROR="kernel.zulu.error"}(Oy||(Oy={})),function(e){e.DEVELOPMENT="development",e.PRODUCTION="production",e.TEST="test"}(Cy||(Cy={})),function(e){e.SAAS="saas",e.INTERNAL="internal",e.POC="poc"}(Ay||(Ay={})),function(e){e.VSCode="vscode",e.JetBrains="jetbrains",e.VS="vs",e.Xcode="xcode",e.Eclipse="eclipse",e.ComateLocal="comate-local",e.Web="web"}(Py||(Py={}));const Ly="kernel/extensionConfig/fetch";class Ny{url="https://comate.baidu.com/api/ok";async ping(e={}){const{timeout:t=5e3,retries:n=3,retryDelay:i=1e3,proxy:r}=e;for(let e=1;e<=n;e++){const o=await this.singlePing(t,e,r);if(o.success||e===n)return o;e<n&&await this.delay(i)}throw new Error("All ping attempts failed")}getProxyConfig(e){const t=e||process.env.http_proxy||process.env.HTTP_PROXY||process.env.https_proxy||process.env.HTTPS_PROXY;if(!t)return{proxy:null};try{new k(t);return{proxy:t,agent:new w.Agent({keepAlive:!0,maxSockets:10})}}catch(e){return console.warn(`Invalid proxy URL: ${t}`),{proxy:null}}}async singlePing(e,t,n){const i=Date.now(),{proxy:r,agent:o}=this.getProxyConfig(n);return new Promise((n=>{let s;if(r){const o=new k(r),a=new k(this.url),c={hostname:o.hostname,port:o.port||("https:"===o.protocol?443:80),path:this.url,method:"GET",timeout:e,headers:{Host:a.hostname,"User-Agent":"Comate-Ping/1.0"}};if(o.username&&o.password){const e=Buffer.from(`${o.username}:${o.password}`).toString("base64");c.headers["Proxy-Authorization"]=`Basic ${e}`}s=w.request(c,(e=>{const o=Date.now()-i;n({success:200===e.statusCode,statusCode:e.statusCode,responseTime:o,attempt:t,timestamp:(new Date).toISOString(),proxy:r})}))}else s=E.request(this.url,{method:"GET",timeout:e,agent:o},(e=>{const r=Date.now()-i;n({success:200===e.statusCode,statusCode:e.statusCode,responseTime:r,attempt:t,timestamp:(new Date).toISOString()})}));s.on("error",(e=>{const o=Date.now()-i;n({success:!1,responseTime:o,error:e.message,attempt:t,timestamp:(new Date).toISOString(),proxy:r||void 0})})),s.on("timeout",(()=>{s.destroy();const e=Date.now()-i;n({success:!1,responseTime:e,error:"Request timeout",attempt:t,timestamp:(new Date).toISOString(),proxy:r||void 0})})),s.end()}))}delay(e){return new Promise((t=>setTimeout(t,e)))}async continuousPing(e,t=1e3,n={}){const i=[];console.log(`🌐 Proxy: ${this.getProxyConfig(n.proxy).proxy||"Direct connection"}\n`);for(let r=0;r<e;r++){const o=await this.ping(n);i.push(o);const s=o.proxy?` (via ${o.proxy})`:"";console.log(`Ping ${r+1}/${e}: ${o.success?"✅":"❌"} ${o.responseTime}ms${s}`),r<e-1&&await this.delay(t)}return i}static getStats(e){const t=e.filter((e=>e.success)),n=e.map((e=>e.responseTime));return{total:e.length,successful:t.length,failed:e.length-t.length,successRate:t.length/e.length*100,avgResponseTime:n.reduce(((e,t)=>e+t),0)/n.length,minResponseTime:Math.min(...n),maxResponseTime:Math.max(...n)}}static async testProxy(e){try{const t=new k(e);return new Promise((e=>{const n=w.request({hostname:t.hostname,port:t.port||80,method:"CONNECT",path:"www.baidu.com:80",timeout:5e3});n.on("connect",(()=>{e(!0)})),n.on("error",(()=>{e(!1)})),n.on("timeout",(()=>{n.destroy(),e(!1)})),n.end()}))}catch{return!1}}}var Iy,$y="0.2.0";function Dy(){try{const e="win32"===process.platform,t=m(e?"where rg":"which rg",{encoding:"utf8",stdio:"pipe"}).trim(),i=e?t.split("\n")[0]:t;if(i&&n(i))return i}catch(e){De("Failed to find ripgrep path:",e)}return""}(()=>{var e={975:e=>{function t(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function n(e,t){for(var n,i="",r=0,o=-1,s=0,a=0;a<=e.length;++a){if(a<e.length)n=e.charCodeAt(a);else{if(47===n)break;n=47}if(47===n){if(o===a-1||1===s);else if(o!==a-1&&2===s){if(i.length<2||2!==r||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2))if(i.length>2){var c=i.lastIndexOf("/");if(c!==i.length-1){-1===c?(i="",r=0):r=(i=i.slice(0,c)).length-1-i.lastIndexOf("/"),o=a,s=0;continue}}else if(2===i.length||1===i.length){i="",r=0,o=a,s=0;continue}t&&(i.length>0?i+="/..":i="..",r=2)}else i.length>0?i+="/"+e.slice(o+1,a):i=e.slice(o+1,a),r=a-o-1;o=a,s=0}else 46===n&&-1!==s?++s:s=-1}return i}var i={resolve:function(){for(var e,i="",r=!1,o=arguments.length-1;o>=-1&&!r;o--){var s;o>=0?s=arguments[o]:(void 0===e&&(e=process.cwd()),s=e),t(s),0!==s.length&&(i=s+"/"+i,r=47===s.charCodeAt(0))}return i=n(i,!r),r?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(e){if(t(e),0===e.length)return".";var i=47===e.charCodeAt(0),r=47===e.charCodeAt(e.length-1);return 0!==(e=n(e,!i)).length||i||(e="."),e.length>0&&r&&(e+="/"),i?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,n=0;n<arguments.length;++n){var r=arguments[n];t(r),r.length>0&&(void 0===e?e=r:e+="/"+r)}return void 0===e?".":i.normalize(e)},relative:function(e,n){if(t(e),t(n),e===n)return"";if((e=i.resolve(e))===(n=i.resolve(n)))return"";for(var r=1;r<e.length&&47===e.charCodeAt(r);++r);for(var o=e.length,s=o-r,a=1;a<n.length&&47===n.charCodeAt(a);++a);for(var c=n.length-a,l=s<c?s:c,u=-1,p=0;p<=l;++p){if(p===l){if(c>l){if(47===n.charCodeAt(a+p))return n.slice(a+p+1);if(0===p)return n.slice(a+p)}else s>l&&(47===e.charCodeAt(r+p)?u=p:0===p&&(u=0));break}var d=e.charCodeAt(r+p);if(d!==n.charCodeAt(a+p))break;47===d&&(u=p)}var f="";for(p=r+u+1;p<=o;++p)p!==o&&47!==e.charCodeAt(p)||(0===f.length?f+="..":f+="/..");return f.length>0?f+n.slice(a+u):(a+=u,47===n.charCodeAt(a)&&++a,n.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var n=e.charCodeAt(0),i=47===n,r=-1,o=!0,s=e.length-1;s>=1;--s)if(47===(n=e.charCodeAt(s))){if(!o){r=s;break}}else o=!1;return-1===r?i?"/":".":i&&1===r?"//":e.slice(0,r)},basename:function(e,n){if(void 0!==n&&"string"!=typeof n)throw new TypeError('"ext" argument must be a string');t(e);var i,r=0,o=-1,s=!0;if(void 0!==n&&n.length>0&&n.length<=e.length){if(n.length===e.length&&n===e)return"";var a=n.length-1,c=-1;for(i=e.length-1;i>=0;--i){var l=e.charCodeAt(i);if(47===l){if(!s){r=i+1;break}}else-1===c&&(s=!1,c=i+1),a>=0&&(l===n.charCodeAt(a)?-1==--a&&(o=i):(a=-1,o=c))}return r===o?o=c:-1===o&&(o=e.length),e.slice(r,o)}for(i=e.length-1;i>=0;--i)if(47===e.charCodeAt(i)){if(!s){r=i+1;break}}else-1===o&&(s=!1,o=i+1);return-1===o?"":e.slice(r,o)},extname:function(e){t(e);for(var n=-1,i=0,r=-1,o=!0,s=0,a=e.length-1;a>=0;--a){var c=e.charCodeAt(a);if(47!==c)-1===r&&(o=!1,r=a+1),46===c?-1===n?n=a:1!==s&&(s=1):-1!==n&&(s=-1);else if(!o){i=a+1;break}}return-1===n||-1===r||0===s||1===s&&n===r-1&&n===i+1?"":e.slice(n,r)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var n=t.dir||t.root,i=t.base||(t.name||"")+(t.ext||"");return n?n===t.root?n+i:n+"/"+i:i}(0,e)},parse:function(e){t(e);var n={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return n;var i,r=e.charCodeAt(0),o=47===r;o?(n.root="/",i=1):i=0;for(var s=-1,a=0,c=-1,l=!0,u=e.length-1,p=0;u>=i;--u)if(47!==(r=e.charCodeAt(u)))-1===c&&(l=!1,c=u+1),46===r?-1===s?s=u:1!==p&&(p=1):-1!==s&&(p=-1);else if(!l){a=u+1;break}return-1===s||-1===c||0===p||1===p&&s===c-1&&s===a+1?-1!==c&&(n.base=n.name=0===a&&o?e.slice(1,c):e.slice(a,c)):(0===a&&o?(n.name=e.slice(1,s),n.base=e.slice(1,c)):(n.name=e.slice(a,s),n.base=e.slice(a,c)),n.ext=e.slice(s,c)),a>0?n.dir=e.slice(0,a-1):o&&(n.dir="/"),n},sep:"/",delimiter:":",win32:null,posix:null};i.posix=i,e.exports=i}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i](o,o.exports,n),o.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};let r;if(n.r(i),n.d(i,{URI:()=>d,Utils:()=>R}),"object"==typeof process)r="win32"===process.platform;else if("object"==typeof navigator){let e=navigator.userAgent;r=e.indexOf("Windows")>=0}const o=/^\w[\w\d+.-]*$/,s=/^\//,a=/^\/\//;function c(e,t){if(!e.scheme&&t)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${e.authority}", path: "${e.path}", query: "${e.query}", fragment: "${e.fragment}"}`);if(e.scheme&&!o.test(e.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(e.path)if(e.authority){if(!s.test(e.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(a.test(e.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}const l="",u="/",p=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class d{static isUri(e){return e instanceof d||!!e&&"string"==typeof e.authority&&"string"==typeof e.fragment&&"string"==typeof e.path&&"string"==typeof e.query&&"string"==typeof e.scheme&&"string"==typeof e.fsPath&&"function"==typeof e.with&&"function"==typeof e.toString}scheme;authority;path;query;fragment;constructor(e,t,n,i,r,o=!1){"object"==typeof e?(this.scheme=e.scheme||l,this.authority=e.authority||l,this.path=e.path||l,this.query=e.query||l,this.fragment=e.fragment||l):(this.scheme=function(e,t){return e||t?e:"file"}(e,o),this.authority=t||l,this.path=function(e,t){switch(e){case"https":case"http":case"file":t?t[0]!==u&&(t=u+t):t=u}return t}(this.scheme,n||l),this.query=i||l,this.fragment=r||l,c(this,o))}get fsPath(){return x(this)}with(e){if(!e)return this;let{scheme:t,authority:n,path:i,query:r,fragment:o}=e;return void 0===t?t=this.scheme:null===t&&(t=l),void 0===n?n=this.authority:null===n&&(n=l),void 0===i?i=this.path:null===i&&(i=l),void 0===r?r=this.query:null===r&&(r=l),void 0===o?o=this.fragment:null===o&&(o=l),t===this.scheme&&n===this.authority&&i===this.path&&r===this.query&&o===this.fragment?this:new m(t,n,i,r,o)}static parse(e,t=!1){const n=p.exec(e);return n?new m(n[2]||l,w(n[4]||l),w(n[5]||l),w(n[7]||l),w(n[9]||l),t):new m(l,l,l,l,l)}static file(e){let t=l;if(r&&(e=e.replace(/\\/g,u)),e[0]===u&&e[1]===u){const n=e.indexOf(u,2);-1===n?(t=e.substring(2),e=u):(t=e.substring(2,n),e=e.substring(n)||u)}return new m("file",t,e,l,l)}static from(e){const t=new m(e.scheme,e.authority,e.path,e.query,e.fragment);return c(t,!0),t}toString(e=!1){return b(this,e)}toJSON(){return this}static revive(e){if(e){if(e instanceof d)return e;{const t=new m(e);return t._formatted=e.external,t._fsPath=e._sep===f?e.fsPath:null,t}}return e}}const f=r?1:void 0;class m extends d{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=x(this)),this._fsPath}toString(e=!1){return e?b(this,!0):(this._formatted||(this._formatted=b(this,!1)),this._formatted)}toJSON(){const e={$mid:1};return this._fsPath&&(e.fsPath=this._fsPath,e._sep=f),this._formatted&&(e.external=this._formatted),this.path&&(e.path=this.path),this.scheme&&(e.scheme=this.scheme),this.authority&&(e.authority=this.authority),this.query&&(e.query=this.query),this.fragment&&(e.fragment=this.fragment),e}}const h={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function g(e,t,n){let i,r=-1;for(let o=0;o<e.length;o++){const s=e.charCodeAt(o);if(s>=97&&s<=122||s>=65&&s<=90||s>=48&&s<=57||45===s||46===s||95===s||126===s||t&&47===s||n&&91===s||n&&93===s||n&&58===s)-1!==r&&(i+=encodeURIComponent(e.substring(r,o)),r=-1),void 0!==i&&(i+=e.charAt(o));else{void 0===i&&(i=e.substr(0,o));const t=h[s];void 0!==t?(-1!==r&&(i+=encodeURIComponent(e.substring(r,o)),r=-1),i+=t):-1===r&&(r=o)}}return-1!==r&&(i+=encodeURIComponent(e.substring(r))),void 0!==i?i:e}function v(e){let t;for(let n=0;n<e.length;n++){const i=e.charCodeAt(n);35===i||63===i?(void 0===t&&(t=e.substr(0,n)),t+=h[i]):void 0!==t&&(t+=e[n])}return void 0!==t?t:e}function x(e,t){let n;return n=e.authority&&e.path.length>1&&"file"===e.scheme?`//${e.authority}${e.path}`:47===e.path.charCodeAt(0)&&(e.path.charCodeAt(1)>=65&&e.path.charCodeAt(1)<=90||e.path.charCodeAt(1)>=97&&e.path.charCodeAt(1)<=122)&&58===e.path.charCodeAt(2)?e.path[1].toLowerCase()+e.path.substr(2):e.path,r&&(n=n.replace(/\//g,"\\")),n}function b(e,t){const n=t?v:g;let i="",{scheme:r,authority:o,path:s,query:a,fragment:c}=e;if(r&&(i+=r,i+=":"),(o||"file"===r)&&(i+=u,i+=u),o){let e=o.indexOf("@");if(-1!==e){const t=o.substr(0,e);o=o.substr(e+1),e=t.lastIndexOf(":"),-1===e?i+=n(t,!1,!1):(i+=n(t.substr(0,e),!1,!1),i+=":",i+=n(t.substr(e+1),!1,!0)),i+="@"}o=o.toLowerCase(),e=o.lastIndexOf(":"),-1===e?i+=n(o,!1,!0):(i+=n(o.substr(0,e),!1,!0),i+=o.substr(e))}if(s){if(s.length>=3&&47===s.charCodeAt(0)&&58===s.charCodeAt(2)){const e=s.charCodeAt(1);e>=65&&e<=90&&(s=`/${String.fromCharCode(e+32)}:${s.substr(3)}`)}else if(s.length>=2&&58===s.charCodeAt(1)){const e=s.charCodeAt(0);e>=65&&e<=90&&(s=`${String.fromCharCode(e+32)}:${s.substr(2)}`)}i+=n(s,!0,!1)}return a&&(i+="?",i+=n(a,!1,!1)),c&&(i+="#",i+=t?c:g(c,!1,!1)),i}function y(e){try{return decodeURIComponent(e)}catch{return e.length>3?e.substr(0,3)+y(e.substr(3)):e}}const _=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function w(e){return e.match(_)?e.replace(_,(e=>y(e))):e}var E=n(975);const S=E.posix||E,k="/";var R;!function(e){e.joinPath=function(e,...t){return e.with({path:S.join(e.path,...t)})},e.resolvePath=function(e,...t){let n=e.path,i=!1;n[0]!==k&&(n=k+n,i=!0);let r=S.resolve(n,...t);return i&&r[0]===k&&!e.authority&&(r=r.substring(1)),e.with({path:r})},e.dirname=function(e){if(0===e.path.length||e.path===k)return e;let t=S.dirname(e.path);return 1===t.length&&46===t.charCodeAt(0)&&(t=""),e.with({path:t})},e.basename=function(e){return S.basename(e.path)},e.extname=function(e){return S.extname(e.path)}}(R||(R={})),Iy=i})();const{URI:My,Utils:Fy}=Iy;var zy,By,qy={},Uy={},Hy={},Wy={},Gy={};function Vy(){if(zy)return Gy;function e(e){return"string"==typeof e||e instanceof String}function t(e){return Array.isArray(e)}return zy=1,Object.defineProperty(Gy,"__esModule",{value:!0}),Gy.stringArray=Gy.array=Gy.func=Gy.error=Gy.number=Gy.string=Gy.boolean=void 0,Gy.boolean=function(e){return!0===e||!1===e},Gy.string=e,Gy.number=function(e){return"number"==typeof e||e instanceof Number},Gy.error=function(e){return e instanceof Error},Gy.func=function(e){return"function"==typeof e},Gy.array=t,Gy.stringArray=function(n){return t(n)&&n.every((t=>e(t)))},Gy}function Ky(){if(By)return Wy;By=1,Object.defineProperty(Wy,"__esModule",{value:!0}),Wy.Message=Wy.NotificationType9=Wy.NotificationType8=Wy.NotificationType7=Wy.NotificationType6=Wy.NotificationType5=Wy.NotificationType4=Wy.NotificationType3=Wy.NotificationType2=Wy.NotificationType1=Wy.NotificationType0=Wy.NotificationType=Wy.RequestType9=Wy.RequestType8=Wy.RequestType7=Wy.RequestType6=Wy.RequestType5=Wy.RequestType4=Wy.RequestType3=Wy.RequestType2=Wy.RequestType1=Wy.RequestType=Wy.RequestType0=Wy.AbstractMessageSignature=Wy.ParameterStructures=Wy.ResponseError=Wy.ErrorCodes=void 0;const e=Vy();var t,n;!function(e){e.ParseError=-32700,e.InvalidRequest=-32600,e.MethodNotFound=-32601,e.InvalidParams=-32602,e.InternalError=-32603,e.jsonrpcReservedErrorRangeStart=-32099,e.serverErrorStart=-32099,e.MessageWriteError=-32099,e.MessageReadError=-32098,e.PendingResponseRejected=-32097,e.ConnectionInactive=-32096,e.ServerNotInitialized=-32002,e.UnknownErrorCode=-32001,e.jsonrpcReservedErrorRangeEnd=-32e3,e.serverErrorEnd=-32e3}(t||(Wy.ErrorCodes=t={}));class i extends Error{constructor(n,r,o){super(r),this.code=e.number(n)?n:t.UnknownErrorCode,this.data=o,Object.setPrototypeOf(this,i.prototype)}toJson(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data),e}}Wy.ResponseError=i;class r{constructor(e){this.kind=e}static is(e){return e===r.auto||e===r.byName||e===r.byPosition}toString(){return this.kind}}Wy.ParameterStructures=r,r.auto=new r("auto"),r.byPosition=new r("byPosition"),r.byName=new r("byName");class o{constructor(e,t){this.method=e,this.numberOfParams=t}get parameterStructures(){return r.auto}}Wy.AbstractMessageSignature=o;Wy.RequestType0=class extends o{constructor(e){super(e,0)}};Wy.RequestType=class extends o{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Wy.RequestType1=class extends o{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Wy.RequestType2=class extends o{constructor(e){super(e,2)}};Wy.RequestType3=class extends o{constructor(e){super(e,3)}};Wy.RequestType4=class extends o{constructor(e){super(e,4)}};Wy.RequestType5=class extends o{constructor(e){super(e,5)}};Wy.RequestType6=class extends o{constructor(e){super(e,6)}};Wy.RequestType7=class extends o{constructor(e){super(e,7)}};Wy.RequestType8=class extends o{constructor(e){super(e,8)}};Wy.RequestType9=class extends o{constructor(e){super(e,9)}};Wy.NotificationType=class extends o{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Wy.NotificationType0=class extends o{constructor(e){super(e,0)}};Wy.NotificationType1=class extends o{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Wy.NotificationType2=class extends o{constructor(e){super(e,2)}};Wy.NotificationType3=class extends o{constructor(e){super(e,3)}};Wy.NotificationType4=class extends o{constructor(e){super(e,4)}};Wy.NotificationType5=class extends o{constructor(e){super(e,5)}};Wy.NotificationType6=class extends o{constructor(e){super(e,6)}};Wy.NotificationType7=class extends o{constructor(e){super(e,7)}};Wy.NotificationType8=class extends o{constructor(e){super(e,8)}};return Wy.NotificationType9=class extends o{constructor(e){super(e,9)}},function(t){t.isRequest=function(t){const n=t;return n&&e.string(n.method)&&(e.string(n.id)||e.number(n.id))},t.isNotification=function(t){const n=t;return n&&e.string(n.method)&&void 0===t.id},t.isResponse=function(t){const n=t;return n&&(void 0!==n.result||!!n.error)&&(e.string(n.id)||e.number(n.id)||null===n.id)}}(n||(Wy.Message=n={})),Wy}var Jy,Yy={};function Zy(){if(Jy)return Yy;var e,t;Jy=1,Object.defineProperty(Yy,"__esModule",{value:!0}),Yy.LRUCache=Yy.LinkedMap=Yy.Touch=void 0,function(e){e.None=0,e.First=1,e.AsOld=e.First,e.Last=2,e.AsNew=e.Last}(t||(Yy.Touch=t={}));class n{constructor(){this[e]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(e){return this._map.has(e)}get(e,n=t.None){const i=this._map.get(e);if(i)return n!==t.None&&this.touch(i,n),i.value}set(e,n,i=t.None){let r=this._map.get(e);if(r)r.value=n,i!==t.None&&this.touch(r,i);else{switch(r={key:e,value:n,next:void 0,previous:void 0},i){case t.None:this.addItemLast(r);break;case t.First:this.addItemFirst(r);break;case t.Last:default:this.addItemLast(r)}this._map.set(e,r),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){const t=this._map.get(e);if(t)return this._map.delete(e),this.removeItem(t),this._size--,t.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");const e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){const n=this._state;let i=this._head;for(;i;){if(t?e.bind(t)(i.value,i.key,this):e(i.value,i.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");i=i.next}}keys(){const e=this._state;let t=this._head;const n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){const e={value:t.key,done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return n}values(){const e=this._state;let t=this._head;const n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){const e={value:t.value,done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return n}entries(){const e=this._state;let t=this._head;const n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){const e={value:[t.key,t.value],done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return n}[(e=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(0===e)return void this.clear();let t=this._head,n=this.size;for(;t&&n>e;)this._map.delete(t.key),t=t.next,n--;this._head=t,this._size=n,t&&(t.previous=void 0),this._state++}addItemFirst(e){if(this._head||this._tail){if(!this._head)throw new Error("Invalid list");e.next=this._head,this._head.previous=e}else this._tail=e;this._head=e,this._state++}addItemLast(e){if(this._head||this._tail){if(!this._tail)throw new Error("Invalid list");e.previous=this._tail,this._tail.next=e}else this._head=e;this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{const t=e.next,n=e.previous;if(!t||!n)throw new Error("Invalid list");t.previous=n,n.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,n){if(!this._head||!this._tail)throw new Error("Invalid list");if(n===t.First||n===t.Last)if(n===t.First){if(e===this._head)return;const t=e.next,n=e.previous;e===this._tail?(n.next=void 0,this._tail=n):(t.previous=n,n.next=t),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(n===t.Last){if(e===this._tail)return;const t=e.next,n=e.previous;e===this._head?(t.previous=void 0,this._head=t):(t.previous=n,n.next=t),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}toJSON(){const e=[];return this.forEach(((t,n)=>{e.push([n,t])})),e}fromJSON(e){this.clear();for(const[t,n]of e)this.set(t,n)}}Yy.LinkedMap=n;return Yy.LRUCache=class extends n{constructor(e,t=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,t),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get ratio(){return this._ratio}set ratio(e){this._ratio=Math.min(Math.max(0,e),1),this.checkTrim()}get(e,n=t.AsNew){return super.get(e,n)}peek(e){return super.get(e,t.None)}set(e,n){return super.set(e,n,t.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}},Yy}var Xy,Qy={};var e_,t_,n_={},i_={};function r_(){if(e_)return i_;let e;function t(){if(void 0===e)throw new Error("No runtime abstraction layer installed");return e}return e_=1,Object.defineProperty(i_,"__esModule",{value:!0}),function(t){t.install=function(t){if(void 0===t)throw new Error("No runtime abstraction layer provided");e=t}}(t||(t={})),i_.default=t,i_}function o_(){if(t_)return n_;t_=1,Object.defineProperty(n_,"__esModule",{value:!0}),n_.Emitter=n_.Event=void 0;const e=r_();var t;!function(e){const t={dispose(){}};e.None=function(){return t}}(t||(n_.Event=t={}));class n{add(e,t=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(t),Array.isArray(n)&&n.push({dispose:()=>this.remove(e,t)})}remove(e,t=null){if(!this._callbacks)return;let n=!1;for(let i=0,r=this._callbacks.length;i<r;i++)if(this._callbacks[i]===e){if(this._contexts[i]===t)return this._callbacks.splice(i,1),void this._contexts.splice(i,1);n=!0}if(n)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...t){if(!this._callbacks)return[];const n=[],i=this._callbacks.slice(0),r=this._contexts.slice(0);for(let o=0,s=i.length;o<s;o++)try{n.push(i[o].apply(r[o],t))}catch(t){(0,e.default)().console.error(t)}return n}isEmpty(){return!this._callbacks||0===this._callbacks.length}dispose(){this._callbacks=void 0,this._contexts=void 0}}class i{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,t,r)=>{this._callbacks||(this._callbacks=new n),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,t);const o={dispose:()=>{this._callbacks&&(this._callbacks.remove(e,t),o.dispose=i._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(r)&&r.push(o),o}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}}return n_.Emitter=i,i._noop=function(){},n_}var s_,a_={};function c_(){if(s_)return a_;s_=1,Object.defineProperty(a_,"__esModule",{value:!0}),a_.CancellationTokenSource=a_.CancellationToken=void 0;const e=r_(),t=Vy(),n=o_();var i;!function(e){e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:n.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:n.Event.None}),e.is=function(n){const i=n;return i&&(i===e.None||i===e.Cancelled||t.boolean(i.isCancellationRequested)&&!!i.onCancellationRequested)}}(i||(a_.CancellationToken=i={}));const r=Object.freeze((function(t,n){const i=(0,e.default)().timer.setTimeout(t.bind(n),0);return{dispose(){i.dispose()}}}));class o{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?r:(this._emitter||(this._emitter=new n.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}return a_.CancellationTokenSource=class{get token(){return this._token||(this._token=new o),this._token}cancel(){this._token?this._token.cancel():this._token=i.Cancelled}dispose(){this._token?this._token instanceof o&&this._token.dispose():this._token=i.None}},a_}var l_,u_={};var p_,d_,f_={},m_={};function h_(){if(p_)return m_;p_=1,Object.defineProperty(m_,"__esModule",{value:!0}),m_.Semaphore=void 0;const e=r_();return m_.Semaphore=class{constructor(e=1){if(e<=0)throw new Error("Capacity must be greater than 0");this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise(((t,n)=>{this._waiting.push({thunk:e,resolve:t,reject:n}),this.runNext()}))}get active(){return this._active}runNext(){0!==this._waiting.length&&this._active!==this._capacity&&(0,e.default)().timer.setImmediate((()=>this.doRunNext()))}doRunNext(){if(0===this._waiting.length||this._active===this._capacity)return;const e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("To many thunks active");try{const t=e.thunk();t instanceof Promise?t.then((t=>{this._active--,e.resolve(t),this.runNext()}),(t=>{this._active--,e.reject(t),this.runNext()})):(this._active--,e.resolve(t),this.runNext())}catch(t){this._active--,e.reject(t),this.runNext()}}},m_}var g_,v_={};var x_,b_={};var y_,__,w_={};function E_(){return y_||(y_=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.ConnectionOptions=e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.RequestCancellationReceiverStrategy=e.IdCancellationReceiverStrategy=e.ConnectionStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=e.NullLogger=e.ProgressType=e.ProgressToken=void 0;const t=r_(),n=Vy(),i=Ky(),r=Zy(),o=o_(),s=c_();var a,c,l,u,p,d,f,m,h,g,v,x,b,y,_,w,E,S,k;!function(e){e.type=new i.NotificationType("$/cancelRequest")}(a||(a={})),function(e){e.is=function(e){return"string"==typeof e||"number"==typeof e}}(c||(e.ProgressToken=c={})),function(e){e.type=new i.NotificationType("$/progress")}(l||(l={}));e.ProgressType=class{constructor(){}},function(e){e.is=function(e){return n.func(e)}}(u||(u={})),e.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}}),function(e){e[e.Off=0]="Off",e[e.Messages=1]="Messages",e[e.Compact=2]="Compact",e[e.Verbose=3]="Verbose"}(p||(e.Trace=p={})),function(e){e.Off="off",e.Messages="messages",e.Compact="compact",e.Verbose="verbose"}(d||(e.TraceValues=d={})),function(e){e.fromString=function(t){if(!n.string(t))return e.Off;switch(t=t.toLowerCase()){case"off":default:return e.Off;case"messages":return e.Messages;case"compact":return e.Compact;case"verbose":return e.Verbose}},e.toString=function(t){switch(t){case e.Off:return"off";case e.Messages:return"messages";case e.Compact:return"compact";case e.Verbose:return"verbose";default:return"off"}}}(p||(e.Trace=p={})),function(e){e.Text="text",e.JSON="json"}(f||(e.TraceFormat=f={})),function(e){e.fromString=function(t){return n.string(t)&&"json"===(t=t.toLowerCase())?e.JSON:e.Text}}(f||(e.TraceFormat=f={})),function(e){e.type=new i.NotificationType("$/setTrace")}(m||(e.SetTraceNotification=m={})),function(e){e.type=new i.NotificationType("$/logTrace")}(h||(e.LogTraceNotification=h={})),function(e){e[e.Closed=1]="Closed",e[e.Disposed=2]="Disposed",e[e.AlreadyListening=3]="AlreadyListening"}(g||(e.ConnectionErrors=g={}));class R extends Error{constructor(e,t){super(t),this.code=e,Object.setPrototypeOf(this,R.prototype)}}e.ConnectionError=R,function(e){e.is=function(e){const t=e;return t&&n.func(t.cancelUndispatched)}}(v||(e.ConnectionStrategy=v={})),function(e){e.is=function(e){const t=e;return t&&(void 0===t.kind||"id"===t.kind)&&n.func(t.createCancellationTokenSource)&&(void 0===t.dispose||n.func(t.dispose))}}(x||(e.IdCancellationReceiverStrategy=x={})),function(e){e.is=function(e){const t=e;return t&&"request"===t.kind&&n.func(t.createCancellationTokenSource)&&(void 0===t.dispose||n.func(t.dispose))}}(b||(e.RequestCancellationReceiverStrategy=b={})),function(e){e.Message=Object.freeze({createCancellationTokenSource:e=>new s.CancellationTokenSource}),e.is=function(e){return x.is(e)||b.is(e)}}(y||(e.CancellationReceiverStrategy=y={})),function(e){e.Message=Object.freeze({sendCancellation:(e,t)=>e.sendNotification(a.type,{id:t}),cleanup(e){}}),e.is=function(e){const t=e;return t&&n.func(t.sendCancellation)&&n.func(t.cleanup)}}(_||(e.CancellationSenderStrategy=_={})),function(e){e.Message=Object.freeze({receiver:y.Message,sender:_.Message}),e.is=function(e){const t=e;return t&&y.is(t.receiver)&&_.is(t.sender)}}(w||(e.CancellationStrategy=w={})),function(e){e.is=function(e){const t=e;return t&&n.func(t.handleMessage)}}(E||(e.MessageStrategy=E={})),function(e){e.is=function(e){const t=e;return t&&(w.is(t.cancellationStrategy)||v.is(t.connectionStrategy)||E.is(t.messageStrategy))}}(S||(e.ConnectionOptions=S={})),function(e){e[e.New=1]="New",e[e.Listening=2]="Listening",e[e.Closed=3]="Closed",e[e.Disposed=4]="Disposed"}(k||(k={})),e.createMessageConnection=function(d,v,b,y){const _=void 0!==b?b:e.NullLogger;let S=0,T=0,O=0;const C="2.0";let A;const P=new Map;let j;const L=new Map,N=new Map;let I,$,D=new r.LinkedMap,M=new Map,F=new Set,z=new Map,B=p.Off,q=f.Text,U=k.New;const H=new o.Emitter,W=new o.Emitter,G=new o.Emitter,V=new o.Emitter,K=new o.Emitter,J=y&&y.cancellationStrategy?y.cancellationStrategy:w.Message;function Y(e){if(null===e)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+e.toString()}function Z(e,t){var n;i.Message.isRequest(t)?e.set(Y(t.id),t):i.Message.isResponse(t)?e.set(null===(n=t.id)?"res-unknown-"+(++O).toString():"res-"+n.toString(),t):e.set("not-"+(++T).toString(),t)}function X(e){}function Q(){return U===k.Listening}function ee(){return U===k.Closed}function te(){return U===k.Disposed}function ne(){U!==k.New&&U!==k.Listening||(U=k.Closed,W.fire(void 0))}function ie(){I||0===D.size||(I=(0,t.default)().timer.setImmediate((()=>{I=void 0,function(){if(0===D.size)return;const e=D.shift();try{const t=y?.messageStrategy;E.is(t)?t.handleMessage(e,re):re(e)}finally{ie()}}()})))}function re(e){i.Message.isRequest(e)?function(e){if(te())return;function t(t,n,r){const o={jsonrpc:C,id:e.id};t instanceof i.ResponseError?o.error=t.toJson():o.result=void 0===t?null:t,ae(o,n,r),v.write(o).catch((()=>_.error("Sending response failed.")))}function r(t,n,i){const r={jsonrpc:C,id:e.id,error:t.toJson()};ae(r,n,i),v.write(r).catch((()=>_.error("Sending response failed.")))}function o(t,n,i){void 0===t&&(t=null);const r={jsonrpc:C,id:e.id,result:t};ae(r,n,i),v.write(r).catch((()=>_.error("Sending response failed.")))}!function(e){if(B===p.Off||!$)return;if(q===f.Text){let t;B!==p.Verbose&&B!==p.Compact||!e.params||(t=`Params: ${se(e.params)}\n\n`),$.log(`Received request '${e.method} - (${e.id})'.`,t)}else le("receive-request",e)}(e);const s=P.get(e.method);let a,c;s&&(a=s.type,c=s.handler);const l=Date.now();if(c||A){const s=e.id??String(Date.now()),u=x.is(J.receiver)?J.receiver.createCancellationTokenSource(s):J.receiver.createCancellationTokenSource(e);null!==e.id&&F.has(e.id)&&u.cancel(),null!==e.id&&z.set(s,u);try{let p;if(c)if(void 0===e.params){if(void 0!==a&&0!==a.numberOfParams)return void r(new i.ResponseError(i.ErrorCodes.InvalidParams,`Request ${e.method} defines ${a.numberOfParams} params but received none.`),e.method,l);p=c(u.token)}else if(Array.isArray(e.params)){if(void 0!==a&&a.parameterStructures===i.ParameterStructures.byName)return void r(new i.ResponseError(i.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by name but received parameters by position`),e.method,l);p=c(...e.params,u.token)}else{if(void 0!==a&&a.parameterStructures===i.ParameterStructures.byPosition)return void r(new i.ResponseError(i.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by position but received parameters by name`),e.method,l);p=c(e.params,u.token)}else A&&(p=A(e.method,e.params,u.token));const d=p;p?d.then?d.then((n=>{z.delete(s),t(n,e.method,l)}),(t=>{z.delete(s),t instanceof i.ResponseError?r(t,e.method,l):t&&n.string(t.message)?r(new i.ResponseError(i.ErrorCodes.InternalError,`Request ${e.method} failed with message: ${t.message}`),e.method,l):r(new i.ResponseError(i.ErrorCodes.InternalError,`Request ${e.method} failed unexpectedly without providing any details.`),e.method,l)})):(z.delete(s),t(p,e.method,l)):(z.delete(s),o(p,e.method,l))}catch(o){z.delete(s),o instanceof i.ResponseError?t(o,e.method,l):o&&n.string(o.message)?r(new i.ResponseError(i.ErrorCodes.InternalError,`Request ${e.method} failed with message: ${o.message}`),e.method,l):r(new i.ResponseError(i.ErrorCodes.InternalError,`Request ${e.method} failed unexpectedly without providing any details.`),e.method,l)}}else r(new i.ResponseError(i.ErrorCodes.MethodNotFound,`Unhandled method ${e.method}`),e.method,l)}(e):i.Message.isNotification(e)?function(e){if(te())return;let t,n;if(e.method===a.type.method){const t=e.params.id;return F.delete(t),void ce(e)}{const i=L.get(e.method);i&&(n=i.handler,t=i.type)}if(n||j)try{if(ce(e),n)if(void 0===e.params)void 0!==t&&0!==t.numberOfParams&&t.parameterStructures!==i.ParameterStructures.byName&&_.error(`Notification ${e.method} defines ${t.numberOfParams} params but received none.`),n();else if(Array.isArray(e.params)){const r=e.params;e.method===l.type.method&&2===r.length&&c.is(r[0])?n({token:r[0],value:r[1]}):(void 0!==t&&(t.parameterStructures===i.ParameterStructures.byName&&_.error(`Notification ${e.method} defines parameters by name but received parameters by position`),t.numberOfParams!==e.params.length&&_.error(`Notification ${e.method} defines ${t.numberOfParams} params but received ${r.length} arguments`)),n(...r))}else void 0!==t&&t.parameterStructures===i.ParameterStructures.byPosition&&_.error(`Notification ${e.method} defines parameters by position but received parameters by name`),n(e.params);else j&&j(e.method,e.params)}catch(t){t.message?_.error(`Notification handler '${e.method}' failed with message: ${t.message}`):_.error(`Notification handler '${e.method}' failed unexpectedly.`)}else G.fire(e)}(e):i.Message.isResponse(e)?function(e){if(te())return;if(null===e.id)e.error?_.error(`Received response message without id: Error is: \n${JSON.stringify(e.error,void 0,4)}`):_.error("Received response message without id. No further error information provided.");else{const t=e.id,n=M.get(t);if(function(e,t){if(B===p.Off||!$)return;if(q===f.Text){let n;if(B!==p.Verbose&&B!==p.Compact||(e.error&&e.error.data?n=`Error data: ${se(e.error.data)}\n\n`:e.result?n=`Result: ${se(e.result)}\n\n`:void 0===e.error&&(n="No result returned.\n\n")),t){const i=e.error?` Request failed: ${e.error.message} (${e.error.code}).`:"";$.log(`Received response '${t.method} - (${e.id})' in ${Date.now()-t.timerStart}ms.${i}`,n)}else $.log(`Received response ${e.id} without active response promise.`,n)}else le("receive-response",e)}(e,n),void 0!==n){M.delete(t);try{if(e.error){const t=e.error;n.reject(new i.ResponseError(t.code,t.message,t.data))}else{if(void 0===e.result)throw new Error("Should never happen.");n.resolve(e.result)}}catch(e){e.message?_.error(`Response handler '${n.method}' failed with message: ${e.message}`):_.error(`Response handler '${n.method}' failed unexpectedly.`)}}}}(e):function(e){if(!e)return void _.error("Received empty message.");_.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(e,null,4)}`);const t=e;if(n.string(t.id)||n.number(t.id)){const e=t.id,n=M.get(e);n&&n.reject(new Error("The received response has neither a result nor an error property."))}}(e)}d.onClose(ne),d.onError((function(e){H.fire([e,void 0,void 0])})),v.onClose(ne),v.onError((function(e){H.fire(e)}));const oe=e=>{try{if(i.Message.isNotification(e)&&e.method===a.type.method){const t=e.params.id,n=Y(t),r=D.get(n);if(i.Message.isRequest(r)){const i=y?.connectionStrategy,o=i&&i.cancelUndispatched?i.cancelUndispatched(r,X):void 0;if(o&&(void 0!==o.error||void 0!==o.result))return D.delete(n),z.delete(t),o.id=r.id,ae(o,e.method,Date.now()),void v.write(o).catch((()=>_.error("Sending response for canceled message failed.")))}const o=z.get(t);if(void 0!==o)return o.cancel(),void ce(e);F.add(t)}Z(D,e)}finally{ie()}};function se(e){if(null!=e)switch(B){case p.Verbose:return JSON.stringify(e,null,4);case p.Compact:return JSON.stringify(e);default:return}}function ae(e,t,n){if(B!==p.Off&&$)if(q===f.Text){let i;B!==p.Verbose&&B!==p.Compact||(e.error&&e.error.data?i=`Error data: ${se(e.error.data)}\n\n`:e.result?i=`Result: ${se(e.result)}\n\n`:void 0===e.error&&(i="No result returned.\n\n")),$.log(`Sending response '${t} - (${e.id})'. Processing request took ${Date.now()-n}ms`,i)}else le("send-response",e)}function ce(e){if(B!==p.Off&&$&&e.method!==h.type.method)if(q===f.Text){let t;B!==p.Verbose&&B!==p.Compact||(t=e.params?`Params: ${se(e.params)}\n\n`:"No parameters provided.\n\n"),$.log(`Received notification '${e.method}'.`,t)}else le("receive-notification",e)}function le(e,t){if(!$||B===p.Off)return;const n={isLSPMessage:!0,type:e,message:t,timestamp:Date.now()};$.log(n)}function ue(){if(ee())throw new R(g.Closed,"Connection is closed.");if(te())throw new R(g.Disposed,"Connection is disposed.")}function pe(e){return void 0===e?null:e}function de(e){return null===e?void 0:e}function fe(e){return null!=e&&!Array.isArray(e)&&"object"==typeof e}function me(e,t){switch(e){case i.ParameterStructures.auto:return fe(t)?de(t):[pe(t)];case i.ParameterStructures.byName:if(!fe(t))throw new Error("Received parameters by name but param is not an object literal.");return de(t);case i.ParameterStructures.byPosition:return[pe(t)];default:throw new Error(`Unknown parameter structure ${e.toString()}`)}}function he(e,t){let n;const i=e.numberOfParams;switch(i){case 0:n=void 0;break;case 1:n=me(e.parameterStructures,t[0]);break;default:n=[];for(let e=0;e<t.length&&e<i;e++)n.push(pe(t[e]));if(t.length<i)for(let e=t.length;e<i;e++)n.push(null)}return n}const ge={sendNotification:(e,...t)=>{let r,o;if(ue(),n.string(e)){r=e;const n=t[0];let s=0,a=i.ParameterStructures.auto;i.ParameterStructures.is(n)&&(s=1,a=n);let c=t.length;const l=c-s;switch(l){case 0:o=void 0;break;case 1:o=me(a,t[s]);break;default:if(a===i.ParameterStructures.byName)throw new Error(`Received ${l} parameters for 'by Name' notification parameter structure.`);o=t.slice(s,c).map((e=>pe(e)))}}else{const n=t;r=e.method,o=he(e,n)}const s={jsonrpc:C,method:r,params:o};return function(e){if(B!==p.Off&&$)if(q===f.Text){let t;B!==p.Verbose&&B!==p.Compact||(t=e.params?`Params: ${se(e.params)}\n\n`:"No parameters provided.\n\n"),$.log(`Sending notification '${e.method}'.`,t)}else le("send-notification",e)}(s),v.write(s).catch((e=>{throw _.error("Sending notification failed."),e}))},onNotification:(e,t)=>{let i;return ue(),n.func(e)?j=e:t&&(n.string(e)?(i=e,L.set(e,{type:void 0,handler:t})):(i=e.method,L.set(e.method,{type:e,handler:t}))),{dispose:()=>{void 0!==i?L.delete(i):j=void 0}}},onProgress:(e,t,n)=>{if(N.has(t))throw new Error(`Progress handler for token ${t} already registered`);return N.set(t,n),{dispose:()=>{N.delete(t)}}},sendProgress:(e,t,n)=>ge.sendNotification(l.type,{token:t,value:n}),onUnhandledProgress:V.event,sendRequest:(e,...t)=>{let r,o,a;if(ue(),function(){if(!Q())throw new Error("Call listen() first.")}(),n.string(e)){r=e;const n=t[0],c=t[t.length-1];let l=0,u=i.ParameterStructures.auto;i.ParameterStructures.is(n)&&(l=1,u=n);let p=t.length;s.CancellationToken.is(c)&&(p-=1,a=c);const d=p-l;switch(d){case 0:o=void 0;break;case 1:o=me(u,t[l]);break;default:if(u===i.ParameterStructures.byName)throw new Error(`Received ${d} parameters for 'by Name' request parameter structure.`);o=t.slice(l,p).map((e=>pe(e)))}}else{const n=t;r=e.method,o=he(e,n);const i=e.numberOfParams;a=s.CancellationToken.is(n[i])?n[i]:void 0}const c=S++;let l;a&&(l=a.onCancellationRequested((()=>{const e=J.sender.sendCancellation(ge,c);return void 0===e?(_.log(`Received no promise from cancellation strategy when cancelling id ${c}`),Promise.resolve()):e.catch((()=>{_.log(`Sending cancellation messages for id ${c} failed`)}))})));const u={jsonrpc:C,id:c,method:r,params:o};return function(e){if(B!==p.Off&&$)if(q===f.Text){let t;B!==p.Verbose&&B!==p.Compact||!e.params||(t=`Params: ${se(e.params)}\n\n`),$.log(`Sending request '${e.method} - (${e.id})'.`,t)}else le("send-request",e)}(u),"function"==typeof J.sender.enableCancellation&&J.sender.enableCancellation(u),new Promise((async(e,t)=>{const n={method:r,timerStart:Date.now(),resolve:t=>{e(t),J.sender.cleanup(c),l?.dispose()},reject:e=>{t(e),J.sender.cleanup(c),l?.dispose()}};try{M.set(c,n),await v.write(u)}catch(e){throw M.delete(c),n.reject(new i.ResponseError(i.ErrorCodes.MessageWriteError,e.message?e.message:"Unknown reason")),_.error("Sending request failed."),e}}))},onRequest:(e,t)=>{ue();let i=null;return u.is(e)?(i=void 0,A=e):n.string(e)?(i=null,void 0!==t&&(i=e,P.set(e,{handler:t,type:void 0}))):void 0!==t&&(i=e.method,P.set(e.method,{type:e,handler:t})),{dispose:()=>{null!==i&&(void 0!==i?P.delete(i):A=void 0)}}},hasPendingResponse:()=>M.size>0,trace:async(e,t,i)=>{let r=!1,o=f.Text;void 0!==i&&(n.boolean(i)?r=i:(r=i.sendNotification||!1,o=i.traceFormat||f.Text)),B=e,q=o,$=B===p.Off?void 0:t,!r||ee()||te()||await ge.sendNotification(m.type,{value:p.toString(e)})},onError:H.event,onClose:W.event,onUnhandledNotification:G.event,onDispose:K.event,end:()=>{v.end()},dispose:()=>{if(te())return;U=k.Disposed,K.fire(void 0);const e=new i.ResponseError(i.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(const t of M.values())t.reject(e);M=new Map,z=new Map,F=new Set,D=new r.LinkedMap,n.func(v.dispose)&&v.dispose(),n.func(d.dispose)&&d.dispose()},listen:()=>{ue(),function(){if(Q())throw new R(g.AlreadyListening,"Connection is already listening")}(),U=k.Listening,d.listen(oe)},inspect:()=>{(0,t.default)().console.log("inspect")}};return ge.onNotification(h.type,(e=>{if(B===p.Off||!$)return;const t=B===p.Verbose||B===p.Compact;$.log(e.message,t?e.verbose:void 0)})),ge.onNotification(l.type,(e=>{const t=N.get(e.token);t?t(e.value):V.fire(e)})),ge}}(w_)),w_}function S_(){return __||(__=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ProgressType=e.ProgressToken=e.createMessageConnection=e.NullLogger=e.ConnectionOptions=e.ConnectionStrategy=e.AbstractMessageBuffer=e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=e.SharedArrayReceiverStrategy=e.SharedArraySenderStrategy=e.CancellationToken=e.CancellationTokenSource=e.Emitter=e.Event=e.Disposable=e.LRUCache=e.Touch=e.LinkedMap=e.ParameterStructures=e.NotificationType9=e.NotificationType8=e.NotificationType7=e.NotificationType6=e.NotificationType5=e.NotificationType4=e.NotificationType3=e.NotificationType2=e.NotificationType1=e.NotificationType0=e.NotificationType=e.ErrorCodes=e.ResponseError=e.RequestType9=e.RequestType8=e.RequestType7=e.RequestType6=e.RequestType5=e.RequestType4=e.RequestType3=e.RequestType2=e.RequestType1=e.RequestType0=e.RequestType=e.Message=e.RAL=void 0,e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=void 0;const t=Ky();Object.defineProperty(e,"Message",{enumerable:!0,get:function(){return t.Message}}),Object.defineProperty(e,"RequestType",{enumerable:!0,get:function(){return t.RequestType}}),Object.defineProperty(e,"RequestType0",{enumerable:!0,get:function(){return t.RequestType0}}),Object.defineProperty(e,"RequestType1",{enumerable:!0,get:function(){return t.RequestType1}}),Object.defineProperty(e,"RequestType2",{enumerable:!0,get:function(){return t.RequestType2}}),Object.defineProperty(e,"RequestType3",{enumerable:!0,get:function(){return t.RequestType3}}),Object.defineProperty(e,"RequestType4",{enumerable:!0,get:function(){return t.RequestType4}}),Object.defineProperty(e,"RequestType5",{enumerable:!0,get:function(){return t.RequestType5}}),Object.defineProperty(e,"RequestType6",{enumerable:!0,get:function(){return t.RequestType6}}),Object.defineProperty(e,"RequestType7",{enumerable:!0,get:function(){return t.RequestType7}}),Object.defineProperty(e,"RequestType8",{enumerable:!0,get:function(){return t.RequestType8}}),Object.defineProperty(e,"RequestType9",{enumerable:!0,get:function(){return t.RequestType9}}),Object.defineProperty(e,"ResponseError",{enumerable:!0,get:function(){return t.ResponseError}}),Object.defineProperty(e,"ErrorCodes",{enumerable:!0,get:function(){return t.ErrorCodes}}),Object.defineProperty(e,"NotificationType",{enumerable:!0,get:function(){return t.NotificationType}}),Object.defineProperty(e,"NotificationType0",{enumerable:!0,get:function(){return t.NotificationType0}}),Object.defineProperty(e,"NotificationType1",{enumerable:!0,get:function(){return t.NotificationType1}}),Object.defineProperty(e,"NotificationType2",{enumerable:!0,get:function(){return t.NotificationType2}}),Object.defineProperty(e,"NotificationType3",{enumerable:!0,get:function(){return t.NotificationType3}}),Object.defineProperty(e,"NotificationType4",{enumerable:!0,get:function(){return t.NotificationType4}}),Object.defineProperty(e,"NotificationType5",{enumerable:!0,get:function(){return t.NotificationType5}}),Object.defineProperty(e,"NotificationType6",{enumerable:!0,get:function(){return t.NotificationType6}}),Object.defineProperty(e,"NotificationType7",{enumerable:!0,get:function(){return t.NotificationType7}}),Object.defineProperty(e,"NotificationType8",{enumerable:!0,get:function(){return t.NotificationType8}}),Object.defineProperty(e,"NotificationType9",{enumerable:!0,get:function(){return t.NotificationType9}}),Object.defineProperty(e,"ParameterStructures",{enumerable:!0,get:function(){return t.ParameterStructures}});const n=Zy();Object.defineProperty(e,"LinkedMap",{enumerable:!0,get:function(){return n.LinkedMap}}),Object.defineProperty(e,"LRUCache",{enumerable:!0,get:function(){return n.LRUCache}}),Object.defineProperty(e,"Touch",{enumerable:!0,get:function(){return n.Touch}});const i=(Xy||(Xy=1,Object.defineProperty(Qy,"__esModule",{value:!0}),Qy.Disposable=void 0,function(e){e.create=function(e){return{dispose:e}}}(r||(Qy.Disposable=r={}))),Qy);var r;Object.defineProperty(e,"Disposable",{enumerable:!0,get:function(){return i.Disposable}});const o=o_();Object.defineProperty(e,"Event",{enumerable:!0,get:function(){return o.Event}}),Object.defineProperty(e,"Emitter",{enumerable:!0,get:function(){return o.Emitter}});const s=c_();Object.defineProperty(e,"CancellationTokenSource",{enumerable:!0,get:function(){return s.CancellationTokenSource}}),Object.defineProperty(e,"CancellationToken",{enumerable:!0,get:function(){return s.CancellationToken}});const a=function(){if(l_)return u_;l_=1,Object.defineProperty(u_,"__esModule",{value:!0}),u_.SharedArrayReceiverStrategy=u_.SharedArraySenderStrategy=void 0;const e=c_();var t;!function(e){e.Continue=0,e.Cancelled=1}(t||(t={})),u_.SharedArraySenderStrategy=class{constructor(){this.buffers=new Map}enableCancellation(e){if(null===e.id)return;const n=new SharedArrayBuffer(4);new Int32Array(n,0,1)[0]=t.Continue,this.buffers.set(e.id,n),e.$cancellationData=n}async sendCancellation(e,n){const i=this.buffers.get(n);if(void 0===i)return;const r=new Int32Array(i,0,1);Atomics.store(r,0,t.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};class n{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===t.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}}class i{constructor(e){this.token=new n(e)}cancel(){}dispose(){}}return u_.SharedArrayReceiverStrategy=class{constructor(){this.kind="request"}createCancellationTokenSource(t){const n=t.$cancellationData;return void 0===n?new e.CancellationTokenSource:new i(n)}},u_}();Object.defineProperty(e,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return a.SharedArraySenderStrategy}}),Object.defineProperty(e,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return a.SharedArrayReceiverStrategy}});const c=function(){if(d_)return f_;d_=1,Object.defineProperty(f_,"__esModule",{value:!0}),f_.ReadableStreamMessageReader=f_.AbstractMessageReader=f_.MessageReader=void 0;const e=r_(),t=Vy(),n=o_(),i=h_();var r,o;!function(e){e.is=function(e){let n=e;return n&&t.func(n.listen)&&t.func(n.dispose)&&t.func(n.onError)&&t.func(n.onClose)&&t.func(n.onPartialMessage)}}(r||(f_.MessageReader=r={}));class s{constructor(){this.errorEmitter=new n.Emitter,this.closeEmitter=new n.Emitter,this.partialMessageEmitter=new n.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e){this.errorEmitter.fire(this.asError(e))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(e){this.partialMessageEmitter.fire(e)}asError(e){return e instanceof Error?e:new Error(`Reader received error. Reason: ${t.string(e.message)?e.message:"unknown"}`)}}return f_.AbstractMessageReader=s,function(t){t.fromOptions=function(t){let n,i;const r=new Map;let o;const s=new Map;if(void 0===t||"string"==typeof t)n=t??"utf-8";else{if(n=t.charset??"utf-8",void 0!==t.contentDecoder&&(i=t.contentDecoder,r.set(i.name,i)),void 0!==t.contentDecoders)for(const e of t.contentDecoders)r.set(e.name,e);if(void 0!==t.contentTypeDecoder&&(o=t.contentTypeDecoder,s.set(o.name,o)),void 0!==t.contentTypeDecoders)for(const e of t.contentTypeDecoders)s.set(e.name,e)}return void 0===o&&(o=(0,e.default)().applicationJson.decoder,s.set(o.name,o)),{charset:n,contentDecoder:i,contentDecoders:r,contentTypeDecoder:o,contentTypeDecoders:s}}}(o||(o={})),f_.ReadableStreamMessageReader=class extends s{constructor(t,n){super(),this.readable=t,this.options=o.fromOptions(n),this.buffer=(0,e.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new i.Semaphore(1)}set partialMessageTimeout(e){this._partialMessageTimeout=e}get partialMessageTimeout(){return this._partialMessageTimeout}listen(e){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=e;const t=this.readable.onData((e=>{this.onData(e)}));return this.readable.onError((e=>this.fireError(e))),this.readable.onClose((()=>this.fireClose())),t}onData(e){try{for(this.buffer.append(e);;){if(-1===this.nextMessageLength){const e=this.buffer.tryReadHeaders(!0);if(!e)return;const t=e.get("content-length");if(!t)return void this.fireError(new Error(`Header must provide a Content-Length property.\n${JSON.stringify(Object.fromEntries(e))}`));const n=parseInt(t);if(isNaN(n))return void this.fireError(new Error(`Content-Length value must be a number. Got ${t}`));this.nextMessageLength=n}const e=this.buffer.tryReadBody(this.nextMessageLength);if(void 0===e)return void this.setPartialMessageTimer();this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock((async()=>{const t=void 0!==this.options.contentDecoder?await this.options.contentDecoder.decode(e):e,n=await this.options.contentTypeDecoder.decode(t,this.options);this.callback(n)})).catch((e=>{this.fireError(e)}))}}catch(e){this.fireError(e)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),this._partialMessageTimeout<=0||(this.partialMessageTimer=(0,e.default)().timer.setTimeout(((e,t)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:t}),this.setPartialMessageTimer())}),this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}},f_}();Object.defineProperty(e,"MessageReader",{enumerable:!0,get:function(){return c.MessageReader}}),Object.defineProperty(e,"AbstractMessageReader",{enumerable:!0,get:function(){return c.AbstractMessageReader}}),Object.defineProperty(e,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return c.ReadableStreamMessageReader}});const l=function(){if(g_)return v_;g_=1,Object.defineProperty(v_,"__esModule",{value:!0}),v_.WriteableStreamMessageWriter=v_.AbstractMessageWriter=v_.MessageWriter=void 0;const e=r_(),t=Vy(),n=h_(),i=o_();var r,o;!function(e){e.is=function(e){let n=e;return n&&t.func(n.dispose)&&t.func(n.onClose)&&t.func(n.onError)&&t.func(n.write)}}(r||(v_.MessageWriter=r={}));class s{constructor(){this.errorEmitter=new i.Emitter,this.closeEmitter=new i.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,t,n){this.errorEmitter.fire([this.asError(e),t,n])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(e){return e instanceof Error?e:new Error(`Writer received error. Reason: ${t.string(e.message)?e.message:"unknown"}`)}}return v_.AbstractMessageWriter=s,function(t){t.fromOptions=function(t){return void 0===t||"string"==typeof t?{charset:t??"utf-8",contentTypeEncoder:(0,e.default)().applicationJson.encoder}:{charset:t.charset??"utf-8",contentEncoder:t.contentEncoder,contentTypeEncoder:t.contentTypeEncoder??(0,e.default)().applicationJson.encoder}}}(o||(o={})),v_.WriteableStreamMessageWriter=class extends s{constructor(e,t){super(),this.writable=e,this.options=o.fromOptions(t),this.errorCount=0,this.writeSemaphore=new n.Semaphore(1),this.writable.onError((e=>this.fireError(e))),this.writable.onClose((()=>this.fireClose()))}async write(e){return this.writeSemaphore.lock((async()=>this.options.contentTypeEncoder.encode(e,this.options).then((e=>void 0!==this.options.contentEncoder?this.options.contentEncoder.encode(e):e)).then((t=>{const n=[];return n.push("Content-Length: ",t.byteLength.toString(),"\r\n"),n.push("\r\n"),this.doWrite(e,n,t)}),(e=>{throw this.fireError(e),e}))))}async doWrite(e,t,n){try{return await this.writable.write(t.join(""),"ascii"),this.writable.write(n)}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){this.writable.end()}},v_}();Object.defineProperty(e,"MessageWriter",{enumerable:!0,get:function(){return l.MessageWriter}}),Object.defineProperty(e,"AbstractMessageWriter",{enumerable:!0,get:function(){return l.AbstractMessageWriter}}),Object.defineProperty(e,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return l.WriteableStreamMessageWriter}});const u=(x_||(x_=1,Object.defineProperty(b_,"__esModule",{value:!0}),b_.AbstractMessageBuffer=void 0,b_.AbstractMessageBuffer=class{constructor(e="utf-8"){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){const t="string"==typeof e?this.fromString(e,this._encoding):e;this._chunks.push(t),this._totalLength+=t.byteLength}tryReadHeaders(e=!1){if(0===this._chunks.length)return;let t=0,n=0,i=0,r=0;e:for(;n<this._chunks.length;){const e=this._chunks[n];for(i=0;i<e.length;){switch(e[i]){case 13:switch(t){case 0:t=1;break;case 2:t=3;break;default:t=0}break;case 10:switch(t){case 1:t=2;break;case 3:t=4,i++;break e;default:t=0}break;default:t=0}i++}r+=e.byteLength,n++}if(4!==t)return;const o=this._read(r+i),s=new Map,a=this.toString(o,"ascii").split("\r\n");if(a.length<2)return s;for(let t=0;t<a.length-2;t++){const n=a[t],i=n.indexOf(":");if(-1===i)throw new Error(`Message header must separate key and value using ':'\n${n}`);const r=n.substr(0,i),o=n.substr(i+1).trim();s.set(e?r.toLowerCase():r,o)}return s}tryReadBody(e){if(!(this._totalLength<e))return this._read(e)}get numberOfBytes(){return this._totalLength}_read(e){if(0===e)return this.emptyBuffer();if(e>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===e){const t=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(t)}if(this._chunks[0].byteLength>e){const t=this._chunks[0],n=this.asNative(t,e);return this._chunks[0]=t.slice(e),this._totalLength-=e,n}const t=this.allocNative(e);let n=0;for(;e>0;){const i=this._chunks[0];if(i.byteLength>e){const r=i.slice(0,e);t.set(r,n),n+=e,this._chunks[0]=i.slice(e),this._totalLength-=e,e-=e}else t.set(i,n),n+=i.byteLength,this._chunks.shift(),this._totalLength-=i.byteLength,e-=i.byteLength}return t}}),b_);Object.defineProperty(e,"AbstractMessageBuffer",{enumerable:!0,get:function(){return u.AbstractMessageBuffer}});const p=E_();Object.defineProperty(e,"ConnectionStrategy",{enumerable:!0,get:function(){return p.ConnectionStrategy}}),Object.defineProperty(e,"ConnectionOptions",{enumerable:!0,get:function(){return p.ConnectionOptions}}),Object.defineProperty(e,"NullLogger",{enumerable:!0,get:function(){return p.NullLogger}}),Object.defineProperty(e,"createMessageConnection",{enumerable:!0,get:function(){return p.createMessageConnection}}),Object.defineProperty(e,"ProgressToken",{enumerable:!0,get:function(){return p.ProgressToken}}),Object.defineProperty(e,"ProgressType",{enumerable:!0,get:function(){return p.ProgressType}}),Object.defineProperty(e,"Trace",{enumerable:!0,get:function(){return p.Trace}}),Object.defineProperty(e,"TraceValues",{enumerable:!0,get:function(){return p.TraceValues}}),Object.defineProperty(e,"TraceFormat",{enumerable:!0,get:function(){return p.TraceFormat}}),Object.defineProperty(e,"SetTraceNotification",{enumerable:!0,get:function(){return p.SetTraceNotification}}),Object.defineProperty(e,"LogTraceNotification",{enumerable:!0,get:function(){return p.LogTraceNotification}}),Object.defineProperty(e,"ConnectionErrors",{enumerable:!0,get:function(){return p.ConnectionErrors}}),Object.defineProperty(e,"ConnectionError",{enumerable:!0,get:function(){return p.ConnectionError}}),Object.defineProperty(e,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return p.CancellationReceiverStrategy}}),Object.defineProperty(e,"CancellationSenderStrategy",{enumerable:!0,get:function(){return p.CancellationSenderStrategy}}),Object.defineProperty(e,"CancellationStrategy",{enumerable:!0,get:function(){return p.CancellationStrategy}}),Object.defineProperty(e,"MessageStrategy",{enumerable:!0,get:function(){return p.MessageStrategy}});const d=r_();e.RAL=d.default}(Hy)),Hy}Object.defineProperty(Uy,"__esModule",{value:!0});const k_=b,R_=S_();class T_ extends R_.AbstractMessageBuffer{constructor(e="utf-8"){super(e)}emptyBuffer(){return T_.emptyBuffer}fromString(e,t){return Buffer.from(e,t)}toString(e,t){return e instanceof Buffer?e.toString(t):new k_.TextDecoder(t).decode(e)}asNative(e,t){return void 0===t?e instanceof Buffer?e:Buffer.from(e):e instanceof Buffer?e.slice(0,t):Buffer.from(e,0,t)}allocNative(e){return Buffer.allocUnsafe(e)}}T_.emptyBuffer=Buffer.allocUnsafe(0);class O_{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),R_.Disposable.create((()=>this.stream.off("close",e)))}onError(e){return this.stream.on("error",e),R_.Disposable.create((()=>this.stream.off("error",e)))}onEnd(e){return this.stream.on("end",e),R_.Disposable.create((()=>this.stream.off("end",e)))}onData(e){return this.stream.on("data",e),R_.Disposable.create((()=>this.stream.off("data",e)))}}class C_{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),R_.Disposable.create((()=>this.stream.off("close",e)))}onError(e){return this.stream.on("error",e),R_.Disposable.create((()=>this.stream.off("error",e)))}onEnd(e){return this.stream.on("end",e),R_.Disposable.create((()=>this.stream.off("end",e)))}write(e,t){return new Promise(((n,i)=>{const r=e=>{null==e?n():i(e)};"string"==typeof e?this.stream.write(e,t,r):this.stream.write(e,r)}))}end(){this.stream.end()}}const A_=Object.freeze({messageBuffer:Object.freeze({create:e=>new T_(e)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(e,t)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(e,void 0,0),t.charset))}catch(e){return Promise.reject(e)}}}),decoder:Object.freeze({name:"application/json",decode:(e,t)=>{try{return e instanceof Buffer?Promise.resolve(JSON.parse(e.toString(t.charset))):Promise.resolve(JSON.parse(new k_.TextDecoder(t.charset).decode(e)))}catch(e){return Promise.reject(e)}}})}),stream:Object.freeze({asReadableStream:e=>new O_(e),asWritableStream:e=>new C_(e)}),console:console,timer:Object.freeze({setTimeout(e,t,...n){const i=setTimeout(e,t,...n);return{dispose:()=>clearTimeout(i)}},setImmediate(e,...t){const n=setImmediate(e,...t);return{dispose:()=>clearImmediate(n)}},setInterval(e,t,...n){const i=setInterval(e,t,...n);return{dispose:()=>clearInterval(i)}}})});function P_(){return A_}!function(e){e.install=function(){R_.RAL.install(A_)}}(P_||(P_={})),Uy.default=P_,function(e){var t=Fe&&Fe.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),n=Fe&&Fe.__exportStar||function(e,n){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(n,i)||t(n,e,i)};Object.defineProperty(e,"__esModule",{value:!0}),e.createMessageConnection=e.createServerSocketTransport=e.createClientSocketTransport=e.createServerPipeTransport=e.createClientPipeTransport=e.generateRandomPipeName=e.StreamMessageWriter=e.StreamMessageReader=e.SocketMessageWriter=e.SocketMessageReader=e.PortMessageWriter=e.PortMessageReader=e.IPCMessageWriter=e.IPCMessageReader=void 0;const i=Uy;i.default.install();const r=p,o=_,s=R,a=N,c=S_();n(S_(),e);class l extends c.AbstractMessageReader{constructor(e){super(),this.process=e;let t=this.process;t.on("error",(e=>this.fireError(e))),t.on("close",(()=>this.fireClose()))}listen(e){return this.process.on("message",e),c.Disposable.create((()=>this.process.off("message",e)))}}e.IPCMessageReader=l;class u extends c.AbstractMessageWriter{constructor(e){super(),this.process=e,this.errorCount=0;const t=this.process;t.on("error",(e=>this.fireError(e))),t.on("close",(()=>this.fireClose))}write(e){try{return"function"==typeof this.process.send&&this.process.send(e,void 0,void 0,(t=>{t?(this.errorCount++,this.handleError(t,e)):this.errorCount=0})),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}}e.IPCMessageWriter=u;class d extends c.AbstractMessageReader{constructor(e){super(),this.onData=new c.Emitter,e.on("close",(()=>this.fireClose)),e.on("error",(e=>this.fireError(e))),e.on("message",(e=>{this.onData.fire(e)}))}listen(e){return this.onData.event(e)}}e.PortMessageReader=d;class f extends c.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.on("close",(()=>this.fireClose())),e.on("error",(e=>this.fireError(e)))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}}e.PortMessageWriter=f;class m extends c.ReadableStreamMessageReader{constructor(e,t="utf-8"){super((0,i.default)().stream.asReadableStream(e),t)}}e.SocketMessageReader=m;class h extends c.WriteableStreamMessageWriter{constructor(e,t){super((0,i.default)().stream.asWritableStream(e),t),this.socket=e}dispose(){super.dispose(),this.socket.destroy()}}e.SocketMessageWriter=h;class g extends c.ReadableStreamMessageReader{constructor(e,t){super((0,i.default)().stream.asReadableStream(e),t)}}e.StreamMessageReader=g;class v extends c.WriteableStreamMessageWriter{constructor(e,t){super((0,i.default)().stream.asWritableStream(e),t)}}e.StreamMessageWriter=v;const x=process.env.XDG_RUNTIME_DIR,b=new Map([["linux",107],["darwin",103]]);e.generateRandomPipeName=function(){const e=(0,s.randomBytes)(21).toString("hex");if("win32"===process.platform)return`\\\\.\\pipe\\vscode-jsonrpc-${e}-sock`;let t;t=x?r.join(x,`vscode-ipc-${e}.sock`):r.join(o.tmpdir(),`vscode-${e}.sock`);const n=b.get(process.platform);return void 0!==n&&t.length>n&&(0,i.default)().console.warn(`WARNING: IPC handle "${t}" is longer than ${n} characters.`),t},e.createClientPipeTransport=function(e,t="utf-8"){let n;const i=new Promise(((e,t)=>{n=e}));return new Promise(((r,o)=>{let s=(0,a.createServer)((e=>{s.close(),n([new m(e,t),new h(e,t)])}));s.on("error",o),s.listen(e,(()=>{s.removeListener("error",o),r({onConnected:()=>i})}))}))},e.createServerPipeTransport=function(e,t="utf-8"){const n=(0,a.createConnection)(e);return[new m(n,t),new h(n,t)]},e.createClientSocketTransport=function(e,t="utf-8"){let n;const i=new Promise(((e,t)=>{n=e}));return new Promise(((r,o)=>{const s=(0,a.createServer)((e=>{s.close(),n([new m(e,t),new h(e,t)])}));s.on("error",o),s.listen(e,"127.0.0.1",(()=>{s.removeListener("error",o),r({onConnected:()=>i})}))}))},e.createServerSocketTransport=function(e,t="utf-8"){const n=(0,a.createConnection)(e,"127.0.0.1");return[new m(n,t),new h(n,t)]},e.createMessageConnection=function(e,t,n,i){n||(n=c.NullLogger);const r=function(e){const t=e;return void 0!==t.read&&void 0!==t.addListener}(e)?new g(e):e,o=function(e){const t=e;return void 0!==t.write&&void 0!==t.addListener}(t)?new v(t):t;return c.ConnectionStrategy.is(i)&&(i={connectionStrategy:i}),(0,c.createMessageConnection)(r,o,n,i)}}(qy);var j_=qy;const L_={enableInlineSuggestion:void 0,superCompletion:!0,completionMode:{autoCompletion:!0,manualCompletion:!0},disabledLanguage:[],completionSpeedAndAccuracy:"extremeAccurate",codelensDisplayMode:"expand",enableDocstringOutputInEditor:{functionDocstringOutputInEditor:!0,inlineCommentOutputInEditor:!0},enableStreamingSession:void 0,enableCodelens:{enableInlineUnitTest:!0,enableInlineExplain:!0,enableInlineDocstring:!0,enableInlineSplit:!0,enableInlineComment:!0,enableInlineOptimize:!0,enableInlineLog:!0},username:"",license:"",enableSecurityScanBox:void 0,displayLanguage:"zh-cn",enableSecurityEnhancement:!1,enableSecurityIntelligence:void 0,enableDebugIntelligence:void 0,enableCodebaseEnhancedContext:void 0,completionLength:"auto",enableCommentEnhancement:void 0,privateService:"",smartPaste:!0,beta:void 0,enableTerminalAutoExecution:!0,terminalAutoExecutionDenyList:[],terminalAutoExecutionAllowList:[],zuluConfig:{enableTerminalAutoExecution:!0,terminalAutoExecutionDenyList:[],terminalAutoExecutionAllowList:[]}},N_=r(L(import.meta.url));class I_{cwd;shell="bin/bash";license;username;ideSeries;ideVersion;ideName;platform;deviceId;pluginVersion;httpProxy;ripgrepPath;extensionConfig=L_;client;isReady=!1;_readyResolver;isSerivceReady=!1;_readyServiceResolver;constructor(e){this.cwd=e.cwd,this.shell=e.shell,this.license=e.license,this.username=e.username,this.ideSeries=e.ideSeries,this.ideVersion=e.ideVersion,this.ideName=e.ideName,this.platform=e.platform,this.deviceId=e.deviceId,this.pluginVersion=e.pluginVersion,this.httpProxy=e.httpProxy,this.extensionConfig.username=e.username,this.extensionConfig.license=e.license,this.ripgrepPath=e.ripgrepPath}async start(){const e=await this.engineExec(),t=new j_.StreamMessageReader(e.stdout),n=new j_.StreamMessageWriter(e.stdin);this.client=j_.createMessageConnection(t,n),this.client.onRequest("USER_DETAIL",(async()=>({status:"success",payload:{name:this.username,license:this.license,ideVersion:this.ideVersion,platform:this.platform,version:this.pluginVersion,language:"zh",customizeService:void 0,device:this.deviceId}}))),this.client.onRequest("kernel/kernelConfig/fetch",(async()=>({code:0,message:"success",data:{appRoot:this.cwd,appHost:"desktop",deviceId:this.deviceId,ideName:this.ideName,ideSeries:this.ideSeries,ideVersion:this.ideVersion,environment:Cy.PRODUCTION,extensionVersion:this.pluginVersion,platform:this.platform,themeColor:"dark",ideTerminalInfo:{defaultShell:this.shell}}}))),this.client.onRequest(Ly,(async()=>(De("KERNEL CLIENT REC <--------",Ly),{code:0,message:"success",data:L_}))),this.client.onNotification("kernel/system/initialized",(()=>{this.isReady=!0,this._readyResolver?.()})),this.client.onNotification("ENGINE_SERVICE_INITIALIZED",(()=>{this.isSerivceReady=!0,this._readyServiceResolver?.()})),this.client.listen(),this.setupLogHandlers(),await this.initializeLSP(),De("LSP Client started")}async sendRequest(e,t){if(De("COMATE PLUSE CLIENT send --------\x3e",e,JSON.stringify(t)),!this.client)throw new Error("Client not initialized");return this.client.sendRequest(e,t)}onRequest(e,t){if(!this.client)throw new Error("Client not initialized:"+e);return this.client.onRequest(e,t)}onNotification(e,t){if(!this.client)throw new Error("Client not initialized:"+e);this.client.onNotification(e,t)}async handleConfigChange(){this.client?this.client.sendRequest("ide/extensionConfig/didChange",L_):console.warn("Client not initialized")}async initializeLSP(){if(!this.client)throw new Error("Client not initialized");const e={processId:process.pid,clientInfo:{name:"vscode-comate-client",version:"1.0.0"},rootPath:this.cwd,rootUri:My.file(this.cwd).toString(),capabilities:{workspace:{workspaceFolders:!0,configuration:!0},textDocument:{synchronization:{dynamicRegistration:!1,willSave:!1,willSaveWaitUntil:!1,didSave:!1}}},initializationOptions:{},workspaceFolders:[{uri:My.file(this.cwd).toString(),name:"workspace"}]};try{De("Sending initialize request...");De("Initialize response:",await this.client.sendRequest("initialize",e)),De("Sending initialized notification..."),this.client.sendNotification("initialized",{}),De("LSP initialization completed")}catch(e){throw console.error("LSP initialization failed:",e),e}}setupLogHandlers(){this.client&&(this.client.onNotification("window/logMessage",(e=>{De(e)})),this.client.onNotification("window/showMessage",(e=>{De(e)})),this.client.onRequest("window/showMessageRequest",(e=>(De(e),e.actions?.[0]||null))),this.client.onNotification("comate/log",(e=>{De(e)})),this.client.onNotification("$/progress",(e=>{De(e)})))}handleVirtualEditor(){this.client?.onRequest("VIRTUAL_EDITOR_EVENT",(async()=>{}))}async engineExec(){const e={cwd:this.cwd,env:{...process.env,IDE:this.ideName,COMATE_VERSION:this.pluginVersion,COMATE_ENGINE_APP_NAME:"VS Code",COMATE_ENGINE_PLATFORM:"baidu-saas",COMATE_ENGINE_DEBUG:"true",PLATFORM:this.platform,HTTP_PROXY_URL:this.httpProxy,HTTP_HOST:process.env.HTTP_HOST||"",RIPGREP_BIN_PATH:this.ripgrepPath,DISPLAY_LANGUAGE:"zh",KEEP_ALIVE:"true"}},t=o(N_,"../../comate-engine/bin/comate.js");return h(t,[],{stdio:"pipe",execArgv:[],...e})}async dispose(){if(this.client)try{await this.client.sendRequest("shutdown",null),this.client.sendNotification("exit")}catch(e){console.error("Error during LSP shutdown:",e)}finally{this.client.dispose()}}}const $_=t=>{const n={license:"",username:"zulu-cli",query:"用html写一个input,可以输入",cwd:process.cwd(),httpProxy:process.env.HTTP_PROXY||process.env.HTTPS_PROXY||process.env.http_proxy||process.env.https_proxy||"",shell:process.env.SHELL?process.env.SHELL:process.env.COMSPEC?process.env.COMSPEC:"win32"===P.platform()?"cmd.exe":"/bin/sh",ideSeries:"vscode",ideVersion:"1.100.1",ideName:Py.VSCode,platform:process.env.PLATFORM||Ay.SAAS,deviceId:e(),pluginVersion:"3.10.0",ripgrepPath:Dy(),...t};return new I_(n)};class D_ extends se{static paths=[se.Default];ping=Ie("--ping",!1,{description:"测试网络连通性"});help=Ie("--help",!1,{description:"帮助信息"});version=Ie("--version",!1,{description:"版本信息"});async execute(){if(!(this.help||this.version||this.ping)){const e=new Le;return e.context=this.context,e.cli=this.cli,await e.execute()}return this.help?(this.context.stdout.write(this.cli.usage(this)),0):this.ping?(await async function(){const e=new Ny;console.log("🏓 Starting Comate API ping test with proxy support...\n");const t=process.env.http_proxy||process.env.HTTP_PROXY||process.env.https_proxy||process.env.HTTPS_PROXY;if(t){console.log(`🌐 Detected proxy from environment: ${t}`);const e=await Ny.testProxy(t);console.log(`🔍 Proxy test: ${e?"✅ Working":"❌ Failed"}\n`)}else console.log("🌐 No proxy detected, using direct connection\n");console.log("Single ping:");const n=await e.ping({timeout:5e3,retries:3,retryDelay:1e3});console.log(n),console.log("\n"+"=".repeat(50)+"\n"),console.log("Continuous ping (5 times):");const i=await e.continuousPing(5,1e3,{timeout:5e3,retries:2}),r=Ny.getStats(i);console.log("\n📊 Statistics:"),console.log(`Total: ${r.total}`),console.log(`Successful: ${r.successful}`),console.log(`Failed: ${r.failed}`),console.log(`Success Rate: ${r.successRate.toFixed(2)}%`),console.log(`Avg Response Time: ${r.avgResponseTime.toFixed(2)}ms`),console.log(`Min Response Time: ${r.minResponseTime}ms`),console.log(`Max Response Time: ${r.maxResponseTime}ms`)}(),0):(this.context.stdout.write(this.cli.usage(this)),0)}}const M_=new Pe({binaryName:"zulu",binaryLabel:"AI Coding Agent Zulu",binaryVersion:$y});function F_(){M_.runExit(process.argv.slice(2))}M_.register(Le),M_.register(Ne),M_.register(D_),M_.register(class extends se{static paths=[["run"]];static usage={description:"与 Zulu 一起工作,对完整代码库进行全面修改"};license=$e("--license",{description:"License"});query=$e("--query",{description:"问题描述"});search=$e("--search",{description:"本地检索的查询内容"});cwd=$e("--cwd",{description:"工作路径,默认执行时所在地址"});ripgrep=$e("--ripgrep",{description:"ripgrep 的绝对路径"});max=$e("--max",{description:"max 模式的模型 id"});async execute(){if(!(this.license||this.query||this.cwd||this.help||this.ripgrep)){const e=new Le;return e.context=this.context,e.cli=this.cli,await e.execute()}if(this.help)return this.context.stdout.write(this.cli.usage(this)),0;if(!this.license)return this.context.stderr.write("Error: --license is required\n"),1;if(this.cwd&&!n(this.cwd))return this.context.stderr.write(`Error: Directory '${this.cwd}' does not exist\n`),1;let e=this.ripgrep;if(e&&!n(e))return this.context.stderr.write(`Error: ripgrep path '${e}' does not exist\n`),1;e||(e=Dy()),De("License:",this.license),De("Query:",this.query),De("CWD:",this.cwd);const t={license:this.license,query:this.query,cwd:this.cwd||process.cwd(),ripgrepPath:e,max:this.max},i=$_(t);return await i.start(),await async function({kernelProvider:e,query:t,max:n}){new Xe(e).start();let i={};const r=n?{model:{modelId:n,requestType:"COMATE_MULTIPLE_MODE",mode:"MAX"}}:{};e.onRequest("COMATE_AGENT_UPDATE_MESSAGE",(async e=>{if(De("============"),De(JSON.stringify(e,null,2)),"conversation-status"===e.data.type){const t=e.data.conversationInfo.status;t===ut.Failed||t===ut.Cancelled?(console.error(JSON.stringify(e,null,2)),process.exit(1)):t===ut.Completed&&(console.log(JSON.stringify(i,null,2)),process.exit(0))}else"partial-message-data"===e.data.type&&(i=e.data)})),e.onNotification("ENGINE_SERVICE_INITIALIZED",(async()=>{const n=await e.sendRequest("COMATE_AGENT_START_NEW_CHAT",{agentPayload:{conversationId:"",messageType:"add-message",conversationType:"E2EBotConversation",payload:{query:t,knowledgeList:[],...r}}});e.sendRequest("COMATE_AGENT_NEW_MESSAGE",{agentPayload:{messageType:"add-message",conversationId:n.id,payload:{query:t,knowledgeList:[],...r}}}),e.sendRequest("COMATE_AGENT_SET_FOREGROUND_CONVERSATION",{agentPayload:{conversationId:n.id}})}))}({kernelProvider:i,query:this.query,max:this.max}),0}}),M_.register(class extends se{static paths=[["search"]];static usage={description:"本地检索"};query=$e("--query",{description:"搜索查询内容"});async execute(){if(this.help)return this.context.stdout.write(this.cli.usage(this)),0;if(!this.query)return this.context.stderr.write("Error: --query is required\n"),1;De("Query:",this.query);const e={query:this.query,username:"zhangcong06"},t=$_(e);return await t.start(),await function(e){const{kernelProvider:t,query:n}=e;t.onNotification("ENGINE_SERVICE_INITIALIZED",(async()=>{const e=await t.sendRequest("kernel/embedding/search",{query:n});console.log(JSON.stringify(e,null,2)),process.exit(0)}))}({kernelProvider:t,query:this.query}),0}});const z_=/^[a-zA-Z_][a-zA-Z0-9_]*$/;function B_(e){return null===e?"null":void 0===e?"undefined":""===e?"an empty string":"symbol"==typeof e?`<${e.toString()}>`:Array.isArray(e)?"an array":JSON.stringify(e)}function q_(e,t){var n,i,r;return"number"==typeof t?`${null!==(n=null==e?void 0:e.p)&&void 0!==n?n:"."}[${t}]`:z_.test(t)?`${null!==(i=null==e?void 0:e.p)&&void 0!==i?i:""}.${t}`:`${null!==(r=null==e?void 0:e.p)&&void 0!==r?r:"."}[${JSON.stringify(t)}]`}function U_({errors:e,p:t}={},n){return null==e||e.push(`${null!=t?t:"."}: ${n}`),!1}function H_(e,t){return n=>{const i=e[t];return e[t]=n,H_(e,t).bind(null,i)}}function W_(){return Y_({test:(e,t)=>"string"==typeof e||U_(t,`Expected a string (got ${B_(e)})`)})}function G_(e,{delimiter:t}={}){return Y_({test:(n,i)=>{var r;const o=n;if("string"==typeof n&&void 0!==t&&void 0!==(null==i?void 0:i.coercions)){if(void 0===(null==i?void 0:i.coercion))return U_(i,"Unbound coercion result");n=n.split(t)}if(!Array.isArray(n))return U_(i,`Expected an array (got ${B_(n)})`);let s=!0;for(let t=0,r=n.length;t<r&&(s=e(n[t],Object.assign(Object.assign({},i),{p:q_(i,t),coercion:H_(n,t)}))&&s,s||null!=(null==i?void 0:i.errors));++t);return n!==o&&i.coercions.push([null!==(r=i.p)&&void 0!==r?r:".",i.coercion.bind(null,n)]),s}})}function V_(e,{delimiter:t}={}){const n=Z_(e.length);return Y_({test:(i,r)=>{var o;if("string"==typeof i&&void 0!==t&&void 0!==(null==r?void 0:r.coercions)){if(void 0===(null==r?void 0:r.coercion))return U_(r,"Unbound coercion result");i=i.split(t),r.coercions.push([null!==(o=r.p)&&void 0!==o?o:".",r.coercion.bind(null,i)])}if(!Array.isArray(i))return U_(r,`Expected a tuple (got ${B_(i)})`);let s=n(i,Object.assign({},r));for(let t=0,n=i.length;t<n&&t<e.length&&(s=e[t](i[t],Object.assign(Object.assign({},r),{p:q_(r,t),coercion:H_(i,t)}))&&s,s||null!=(null==r?void 0:r.errors));++t);return s}})}function K_(e,{keys:t=null}={}){const n=G_(V_([null!=t?t:W_(),e]));return Y_({test:(i,r)=>{var o;if(Array.isArray(i)&&void 0!==(null==r?void 0:r.coercions))return void 0===(null==r?void 0:r.coercion)?U_(r,"Unbound coercion result"):!!n(i,Object.assign(Object.assign({},r),{coercion:void 0}))&&(i=Object.fromEntries(i),r.coercions.push([null!==(o=r.p)&&void 0!==o?o:".",r.coercion.bind(null,i)]),!0);if("object"!=typeof i||null===i)return U_(r,`Expected an object (got ${B_(i)})`);const s=Object.keys(i);let a=!0;for(let n=0,o=s.length;n<o&&(a||null!=(null==r?void 0:r.errors));++n){const o=s[n],c=i[o];"__proto__"!==o&&"constructor"!==o?(null===t||t(o,r))&&e(c,Object.assign(Object.assign({},r),{p:q_(r,o),coercion:H_(i,o)}))||(a=!1):a=U_(Object.assign(Object.assign({},r),{p:q_(r,o)}),"Unsafe property name")}return a}})}function J_(e){return()=>e}function Y_({test:e}){return J_(e)()}function Z_(e){return Y_({test:(t,n)=>t.length===e||U_(n,`Expected to have a length of exactly ${e} elements (got ${t.length})`)})}function X_(e,...t){const n=Array.isArray(t[0])?t[0]:t;return Y_({test:(t,i)=>{var r,o;const s={value:t},a=void 0!==(null==i?void 0:i.coercions)?H_(s,"value"):void 0,c=void 0!==(null==i?void 0:i.coercions)?[]:void 0;if(!e(t,Object.assign(Object.assign({},i),{coercion:a,coercions:c})))return!1;const l=[];if(void 0!==c)for(const[,e]of c)l.push(e());try{if(void 0!==(null==i?void 0:i.coercions)){if(s.value!==t){if(void 0===(null==i?void 0:i.coercion))return U_(i,"Unbound coercion result");i.coercions.push([null!==(r=i.p)&&void 0!==r?r:".",i.coercion.bind(null,s.value)])}null===(o=null==i?void 0:i.coercions)||void 0===o||o.push(...c)}return n.every((e=>e(s.value,i)))}finally{for(const e of l)e()}}})}var Q_;!function(e){e.Forbids="Forbids",e.Requires="Requires"}(Q_||(Q_={})),Q_.Forbids,Q_.Requires;var ew=Object.freeze({__proto__:null,get KeyRelationship(){return Q_},applyCascade:function(e,...t){return X_(e,Array.isArray(t[0])?t[0]:t)},cascade:X_,hasExactLength:Z_,isArray:G_,isDict:function(e,t={}){return K_(e,t)},isRecord:K_,isString:W_,isTuple:V_,isUnknown:function(){return Y_({test:(e,t)=>!0})},makeTrait:J_,makeValidator:Y_});export{F_ as run};
|