@comate/zulu 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.d.ts +56 -25
  2. package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.js +3 -3
  3. package/comate-engine/node_modules/@comate/preview-proxy/dist/index.js +35 -35
  4. package/comate-engine/node_modules/@comate/preview-proxy/static/comate-preview-injector.js +1 -1
  5. package/comate-engine/node_modules/better-sqlite3/node_modules/.bin/prebuild-install +4 -4
  6. package/comate-engine/node_modules/sqlite-vec-darwin-x64/README.md +1 -0
  7. package/comate-engine/node_modules/sqlite-vec-darwin-x64/package.json +1 -0
  8. package/comate-engine/node_modules/sqlite-vec-darwin-x64/vec0.dylib +0 -0
  9. package/comate-engine/node_modules/sqlite-vec-linux-arm64/README.md +1 -0
  10. package/comate-engine/node_modules/sqlite-vec-linux-arm64/package.json +1 -0
  11. package/comate-engine/node_modules/sqlite-vec-linux-arm64/vec0.so +0 -0
  12. package/comate-engine/node_modules/sqlite-vec-linux-x64/README.md +1 -0
  13. package/comate-engine/node_modules/sqlite-vec-linux-x64/package.json +1 -0
  14. package/comate-engine/node_modules/sqlite-vec-linux-x64/vec0.so +0 -0
  15. package/comate-engine/node_modules/sqlite-vec-windows-x64/README.md +1 -0
  16. package/comate-engine/node_modules/sqlite-vec-windows-x64/package.json +1 -0
  17. package/comate-engine/node_modules/sqlite-vec-windows-x64/vec0.dll +0 -0
  18. package/comate-engine/package.json +6 -0
  19. package/comate-engine/server.js +72 -72
  20. package/dist/bundle/index.js +2 -2
  21. package/package.json +1 -1
  22. package/comate-engine/node_modules/better-sqlite3/build/Release/better_sqlite3.node +0 -0
@@ -1,4 +1,4 @@
1
- import{randomUUID as e}from"node:crypto";import{existsSync as t}from"node:fs";import{unlink as n,readFile as i,writeFile as r,mkdir as o}from"node:fs/promises";import s,{dirname as a,join as c}from"node:path";import*as l from"fs";import u from"fs";import*as p from"path";import d from"path";import{EventEmitter as f}from"node:events";import{spawn as h,execSync as m,fork as g}from"node:child_process";import v from"constants";import y,{Readable as x}from"stream";import b from"util";import _ from"assert";import*as w from"os";import E from"os";import S from"http";import k from"https";import R,{URL as T}from"url";import O from"crypto";import A from"tty";import C from"zlib";import P,{EventEmitter as j}from"events";import L from"node:os";import"node:process";import{fileURLToPath as N}from"node:url";import"node:stream";import I from"net";const D=0,F=1,M=2,$="",B="\0",U=-1,z=/^(-h|--help)(?:=([0-9]+))?$/,q=/^(--[a-z]+(?:-[a-z]+)*|-[a-zA-Z]+)$/,H=/^-[a-zA-Z]{2,}$/,W=/^([^=]+)=([\s\S]*)$/,G="1"===process.env.DEBUG_CLI;class V extends Error{constructor(e){super(e),this.clipanion={type:"usage"},this.name="UsageError"}}class K 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${Y(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${Y(e)}`}}class J 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${Y(e)}`}}const Y=e=>`While running ${e.filter((e=>e!==B)).map((e=>{const t=JSON.stringify(e);return e.match(/\s/)||0===e.length||t!==`"${e}"`?t:e})).join(" ")}`,Z=Array(80).fill("━");for(let e=0;e<=24;++e)Z[Z.length-e]=`[38;5;${232+e}m━`;const X={header:e=>`━━━ ${e}${e.length<75?` ${Z.slice(e.length+5).join("")}`:":"}`,bold:e=>`${e}`,error:e=>`${e}`,code:e=>`${e}`},Q={header:e=>e,bold:e=>e,error:e=>e,code:e=>e};function ee(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 te=Symbol("clipanion/isOption");function ne(e){return{...e,[te]:!0}}function ie(e,t){return void 0===e||"object"!=typeof e||null===e||Array.isArray(e)?[e,t]:[void 0,e]}function re(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 oe(e,t){return 1===t.length?new V(`${e}${re(t[0],{mergeName:!0})}`):new V(`${e}:\n${t.map((e=>`\n- ${re(e)}`)).join("")}`)}function se(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 oe(`Invalid value for ${e}`,i);for(const[,e]of r)e();return t}class ae{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 bT})),r=[],o=[];if(!i(t(n()),e)(this,{errors:r,coercions:o}))throw oe("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 ce(e){G&&console.log(e)}ae.isOption=te,ae.Default=[];const le={candidateUsage:null,requiredOptions:[],errorMessage:null,ignoreOptions:!1,path:[],positionals:[],options:[],remainder:null,selectedIndex:U};function ue(e,t){return e.nodes.push(t),e.nodes.length-1}function pe(e,t,n=!1){ce(`Running a vm on ${JSON.stringify(t)}`);let i=[{node:D,state:{candidateUsage:null,requiredOptions:[],errorMessage:null,ignoreOptions:!1,options:[],path:[],positionals:[],remainder:null,selectedIndex:null}}];!function(e,{prefix:t=""}={}){if(G){ce(`${t}Nodes are:`);for(let n=0;n<e.nodes.length;++n)ce(`${t} ${n}: ${JSON.stringify(e.nodes[n])}`)}}(e,{prefix:" "});const r=[$,...t];for(let o=0;o<r.length;++o){const s=r[o];ce(` Processing ${JSON.stringify(s)}`);const a=[];for(const{node:t,state:c}of i){ce(` Current node is ${t}`);const i=e.nodes[t];if(t===M){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?we(ke,n,c,s):c}),ce(` Static transition to ${t} found`)}else ce(" 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?we(ke,n,c,s):c}),ce(` 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)}}),ce(` Static transition to ${e} found (partial match)`);e=!0}e||ce(" No partial static transition found")}if(s!==B)for(const[e,{to:t,reducer:n}]of i.dynamics)we(Se,e,c,s)&&(a.push({node:t,state:void 0!==n?we(ke,n,c,s):c}),ce(` Dynamic transition to ${t} found (via ${e})`))}if(0===a.length&&s===B&&1===t.length)return[{node:D,state:le}];if(0===a.length)throw new K(t,i.filter((({node:e})=>e!==M)).map((({state:e})=>({usage:e.candidateUsage,reason:null}))));if(a.every((({node:e})=>e===M)))throw new K(t,a.map((({state:e})=>({usage:e.candidateUsage,reason:e.errorMessage}))));i=he(a)}if(i.length>0){ce(" Results:");for(const e of i)ce(` - ${e.node} -> ${JSON.stringify(e.state)}`)}else ce(" No results");return i}function de(e,t){if(null!==t.selectedIndex)return!0;if(Object.prototype.hasOwnProperty.call(e.statics,B))for(const{to:t}of e.statics[B])if(t===F)return!0;return!1}function fe(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===U||e.requiredOptions.every((t=>t.some((t=>e.options.find((e=>e.name===t))))))));if(0===i.length)throw new K(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===U?n.push(i):t.push(i);n.length>0&&t.push({...le,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 J(e,u.map((e=>e.candidateUsage)));return u[0]}(t,pe(e,[...t,B]).map((({state:e})=>e)))}function he(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 ge(e){return e===F||e===M}function ve(e,t=0){return{to:ge(e.to)?e.to:e.to>2?e.to+t-2:e.to+t,reducer:e.reducer}}function ye(e,t=0){const n={dynamics:[],shortcuts:[],statics:{}};for(const[i,r]of e.dynamics)n.dynamics.push([i,ve(r,t)]);for(const i of e.shortcuts)n.shortcuts.push(ve(i,t));for(const[i,r]of Object.entries(e.statics))n.statics[i]=r.map((e=>ve(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 _e(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 we(e,t,n,i){if(Array.isArray(t)){const[r,...o]=t;return e[r](n,i,...o)}return e[t](n,i)}function Ee(e,t){const n=Array.isArray(e)?Se[e[0]]:Se[e];if(void 0===n.suggest)return null;const i=Array.isArray(e)?e.slice(1):[];return n.suggest(t,...i)}const Se={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&&H.test(t)&&[...t.slice(1)].every((e=>n.includes(`-${e}`))),isBoundOption:(e,t,n,i)=>{const r=t.match(W);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&&z.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)};Se.isOption.suggest=(e,t,n=!0)=>n?null:[t];const ke={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(W);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:Re})}),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(z);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===B?{...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}.`}}},Re=Symbol();class Te{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===Re)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===Re?this.arity.extra!==Re&&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===Re)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=Re}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===Re?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=D;const n=this.usage().usage,i=this.options.filter((e=>e.required)).map((e=>e.names));t=ue(e,{dynamics:[],shortcuts:[],statics:{}}),_e(e,D,$,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=ue(e,{dynamics:[],shortcuts:[],statics:{}});be(e,i,t),this.registerOptions(e,t),i=t}for(let t=0;t<n.length;++t){const r=ue(e,{dynamics:[],shortcuts:[],statics:{}});_e(e,i,n[t],r,"pushPath"),i=r}if(this.arity.leading.length>0||!this.arity.proxy){const t=ue(e,{dynamics:[],shortcuts:[],statics:{}});xe(e,i,"isHelp",t,["useHelp",this.cliIndex]),xe(e,t,"always",t,"pushExtra"),_e(e,t,B,F,["setSelectedIndex",U]),this.registerOptions(e,i)}this.arity.leading.length>0&&_e(e,i,B,M,["setError","Not enough positional arguments"]);let o=i;for(let t=0;t<this.arity.leading.length;++t){const n=ue(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)&&_e(e,n,B,M,["setError","Not enough positional arguments"]),xe(e,o,"isNotOptionLike",n,"pushPositional"),o=n}let s=o;if(this.arity.extra===Re||this.arity.extra.length>0){const t=ue(e,{dynamics:[],shortcuts:[],statics:{}});if(be(e,o,t),this.arity.extra===Re){const n=ue(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=ue(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&&_e(e,s,B,M,["setError","Not enough positional arguments"]);let a=s;for(let t=0;t<this.arity.trailing.length;++t){const n=ue(e,{dynamics:[],shortcuts:[],statics:{}});this.arity.proxy||this.registerOptions(e,n),t+1<this.arity.trailing.length&&_e(e,n,B,M,["setError","Not enough positional arguments"]),xe(e,a,"isNotOptionLike",n,"pushPositional"),a=n}xe(e,a,r,M,["setError","Extraneous positional argument"]),_e(e,a,B,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],M,["setError","Unsupported option name"]),xe(e,t,["isInvalidOption"],M,["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=ue(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=ue(e,{dynamics:[],shortcuts:[],statics:{}});_e(e,r,B,M,"setOptionArityError"),xe(e,r,"isOptionLike",M,"setOptionArityError");xe(e,r,"isNotOptionLike",t,1===n.arity?"setStringValue":"pushStringValue"),r=t}be(e,r,t)}}}}class Oe{constructor({binaryName:e="..."}={}){this.builders=[],this.opts={binaryName:e}}static build(e,t={}){return new Oe(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 Te(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)ge(e)||t.nodes.push(ye(r.nodes[e],i));i+=r.nodes.length-2}for(const e of n)be(t,D,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(D)}(n),{machine:n,contexts:t,process:e=>fe(n,e),suggest:(e,t)=>function(e,t,n){const i=n&&t.length>0?[""]:[],r=pe(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=de(r,n);for(const[e,n]of Object.entries(r.statics))(o&&e!==B||!e.startsWith("-")&&n.some((({reducer:e})=>"pushPath"===e)))&&a([...i,e],t);if(o)for(const[e,{to:o}]of r.dynamics){if(o===M)continue;const r=Ee(e,n);if(null!==r)for(const e of r)a([...i,e],t)}}return[...o].sort()}(n,e,t)}}}let Ae;let Ce=class e extends ae{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 Pe=Symbol("clipanion/errorCommand");class je{constructor({binaryLabel:e,binaryName:t="...",binaryVersion:n,enableCapture:i=!1,enableColors:r}={}){this.registrations=new Map,this.builder=new Oe({binaryName:t}),this.binaryLabel=e,this.binaryName=t,this.binaryVersion=n,this.enableCapture=i,this.enableColors=r}static from(e,t={}){const n=new je(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[ae.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={...je.defaultContext,...t};if(r.selectedIndex===U){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[Pe]=i,e}}}async run(e,t){var n,i;let r;const o={...je.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=Ae;if(void 0===t){if(e.stdout===process.stdout&&e.stderr===process.stderr)return null;const{AsyncLocalStorage:n}=require("async_hooks");t=Ae=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:Le;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?ee(n.usage.category,{format:this.format(e),paragraphs:!1}):void 0,c=void 0!==n.usage.description?ee(n.usage.description,{format:this.format(e),paragraphs:!1}):void 0,l=void 0!==n.usage.details?ee(n.usage.details,{format:this.format(e),paragraphs:!0}):void 0,u=void 0!==n.usage.examples?n.usage.examples.map((([t,n])=>[ee(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 ae?e.constructor:e;let s="";if(o)if(n){const{description:e="",details:n="",examples:r=[]}=o.usage||{};""!==e&&(s+=ee(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))} ${ee(i,{format:this.format(t),paragraphs:!1})}`}if(""!==n&&(s+="\n",s+=`${this.format(t).header("Details")}\n`,s+="\n",s+=ee(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+=ee(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?ee(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+=` ${ee(n,{format:this.format(t),paragraphs:!1})}`}}s+="\n",s+=ee("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[Pe])&&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:je.defaultContext.colorDepth>1)?X:Q}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 Le(e){return e()}je.defaultContext={env:process.env,stdin:process.stdin,stdout:process.stdout,stderr:process.stderr,colorDepth:A&&"getColorDepth"in A.WriteStream.prototype?A.WriteStream.prototype.getColorDepth():"0"===process.env.FORCE_COLOR?1:"1"===process.env.FORCE_COLOR||void 0!==process.stdout&&process.stdout.isTTY?8:1};class Ne extends ae{async execute(){this.context.stdout.write(this.cli.usage())}}Ne.paths=[["-h"],["--help"]];class Ie extends ae{async execute(){var e;this.context.stdout.write(`${null!==(e=this.cli.binaryVersion)&&void 0!==e?e:"<unknown>"}\n`)}}function De(e,t,n){const[i,r]=ie(t,null!=n?n:{}),o=e.split(","),s=new Set(o);return ne({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 Fe(e,...t){return"string"==typeof e?function(e,t,n){const[i,r]=ie(t,null!=n?n:{}),{arity:o=1}=r,s=e.split(","),a=new Set(s);return ne({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?se(null!=s?s:t,c,r.validator):c}})}(e,...t):function(e={}){const{required:t=!0}=e;return ne({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===Re)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 se(null!==(o=e.name)&&void 0!==o?o:i,s.value,e.validator)}}})}(e)}function Me(...e){(process.env.ENVIRONMENT||process.env.DEBUG)&&console.log(...e)}Ie.paths=[["-v"],["--version"]];function $e(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=d.dirname(e);u.mkdirSync(i,{recursive:!0}),u.writeFileSync(e,t||"","utf8")}}var Be="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Ue(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ze,qe,He={exports:{}};
1
+ import{randomUUID as e}from"node:crypto";import{existsSync as t}from"node:fs";import{unlink as n,readFile as i,writeFile as r,mkdir as o}from"node:fs/promises";import s,{dirname as a,join as c}from"node:path";import*as l from"fs";import u from"fs";import*as p from"path";import d from"path";import{EventEmitter as f}from"node:events";import{spawn as h,execSync as m,fork as g}from"node:child_process";import v from"constants";import y,{Readable as x}from"stream";import b from"util";import _ from"assert";import*as w from"os";import E from"os";import S from"http";import k from"https";import R,{URL as T}from"url";import O from"crypto";import A from"tty";import C from"zlib";import P,{EventEmitter as j}from"events";import L from"node:os";import"node:process";import{fileURLToPath as N}from"node:url";import"node:stream";import I from"net";const D=0,F=1,M=2,$="",B="\0",U=-1,z=/^(-h|--help)(?:=([0-9]+))?$/,q=/^(--[a-z]+(?:-[a-z]+)*|-[a-zA-Z]+)$/,H=/^-[a-zA-Z]{2,}$/,W=/^([^=]+)=([\s\S]*)$/,G="1"===process.env.DEBUG_CLI;class V extends Error{constructor(e){super(e),this.clipanion={type:"usage"},this.name="UsageError"}}class K 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${Y(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${Y(e)}`}}class J 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${Y(e)}`}}const Y=e=>`While running ${e.filter((e=>e!==B)).map((e=>{const t=JSON.stringify(e);return e.match(/\s/)||0===e.length||t!==`"${e}"`?t:e})).join(" ")}`,Z=Array(80).fill("━");for(let e=0;e<=24;++e)Z[Z.length-e]=`[38;5;${232+e}m━`;const X={header:e=>`━━━ ${e}${e.length<75?` ${Z.slice(e.length+5).join("")}`:":"}`,bold:e=>`${e}`,error:e=>`${e}`,code:e=>`${e}`},Q={header:e=>e,bold:e=>e,error:e=>e,code:e=>e};function ee(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 te=Symbol("clipanion/isOption");function ne(e){return{...e,[te]:!0}}function ie(e,t){return void 0===e||"object"!=typeof e||null===e||Array.isArray(e)?[e,t]:[void 0,e]}function re(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 oe(e,t){return 1===t.length?new V(`${e}${re(t[0],{mergeName:!0})}`):new V(`${e}:\n${t.map((e=>`\n- ${re(e)}`)).join("")}`)}function se(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 oe(`Invalid value for ${e}`,i);for(const[,e]of r)e();return t}class ae{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 vT})),r=[],o=[];if(!i(t(n()),e)(this,{errors:r,coercions:o}))throw oe("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 ce(e){G&&console.log(e)}ae.isOption=te,ae.Default=[];const le={candidateUsage:null,requiredOptions:[],errorMessage:null,ignoreOptions:!1,path:[],positionals:[],options:[],remainder:null,selectedIndex:U};function ue(e,t){return e.nodes.push(t),e.nodes.length-1}function pe(e,t,n=!1){ce(`Running a vm on ${JSON.stringify(t)}`);let i=[{node:D,state:{candidateUsage:null,requiredOptions:[],errorMessage:null,ignoreOptions:!1,options:[],path:[],positionals:[],remainder:null,selectedIndex:null}}];!function(e,{prefix:t=""}={}){if(G){ce(`${t}Nodes are:`);for(let n=0;n<e.nodes.length;++n)ce(`${t} ${n}: ${JSON.stringify(e.nodes[n])}`)}}(e,{prefix:" "});const r=[$,...t];for(let o=0;o<r.length;++o){const s=r[o];ce(` Processing ${JSON.stringify(s)}`);const a=[];for(const{node:t,state:c}of i){ce(` Current node is ${t}`);const i=e.nodes[t];if(t===M){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?we(ke,n,c,s):c}),ce(` Static transition to ${t} found`)}else ce(" 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?we(ke,n,c,s):c}),ce(` 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)}}),ce(` Static transition to ${e} found (partial match)`);e=!0}e||ce(" No partial static transition found")}if(s!==B)for(const[e,{to:t,reducer:n}]of i.dynamics)we(Se,e,c,s)&&(a.push({node:t,state:void 0!==n?we(ke,n,c,s):c}),ce(` Dynamic transition to ${t} found (via ${e})`))}if(0===a.length&&s===B&&1===t.length)return[{node:D,state:le}];if(0===a.length)throw new K(t,i.filter((({node:e})=>e!==M)).map((({state:e})=>({usage:e.candidateUsage,reason:null}))));if(a.every((({node:e})=>e===M)))throw new K(t,a.map((({state:e})=>({usage:e.candidateUsage,reason:e.errorMessage}))));i=he(a)}if(i.length>0){ce(" Results:");for(const e of i)ce(` - ${e.node} -> ${JSON.stringify(e.state)}`)}else ce(" No results");return i}function de(e,t){if(null!==t.selectedIndex)return!0;if(Object.prototype.hasOwnProperty.call(e.statics,B))for(const{to:t}of e.statics[B])if(t===F)return!0;return!1}function fe(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===U||e.requiredOptions.every((t=>t.some((t=>e.options.find((e=>e.name===t))))))));if(0===i.length)throw new K(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===U?n.push(i):t.push(i);n.length>0&&t.push({...le,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 J(e,u.map((e=>e.candidateUsage)));return u[0]}(t,pe(e,[...t,B]).map((({state:e})=>e)))}function he(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 ge(e){return e===F||e===M}function ve(e,t=0){return{to:ge(e.to)?e.to:e.to>2?e.to+t-2:e.to+t,reducer:e.reducer}}function ye(e,t=0){const n={dynamics:[],shortcuts:[],statics:{}};for(const[i,r]of e.dynamics)n.dynamics.push([i,ve(r,t)]);for(const i of e.shortcuts)n.shortcuts.push(ve(i,t));for(const[i,r]of Object.entries(e.statics))n.statics[i]=r.map((e=>ve(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 _e(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 we(e,t,n,i){if(Array.isArray(t)){const[r,...o]=t;return e[r](n,i,...o)}return e[t](n,i)}function Ee(e,t){const n=Array.isArray(e)?Se[e[0]]:Se[e];if(void 0===n.suggest)return null;const i=Array.isArray(e)?e.slice(1):[];return n.suggest(t,...i)}const Se={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&&H.test(t)&&[...t.slice(1)].every((e=>n.includes(`-${e}`))),isBoundOption:(e,t,n,i)=>{const r=t.match(W);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&&z.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)};Se.isOption.suggest=(e,t,n=!0)=>n?null:[t];const ke={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(W);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:Re})}),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(z);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===B?{...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}.`}}},Re=Symbol();class Te{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===Re)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===Re?this.arity.extra!==Re&&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===Re)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=Re}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===Re?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=D;const n=this.usage().usage,i=this.options.filter((e=>e.required)).map((e=>e.names));t=ue(e,{dynamics:[],shortcuts:[],statics:{}}),_e(e,D,$,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=ue(e,{dynamics:[],shortcuts:[],statics:{}});be(e,i,t),this.registerOptions(e,t),i=t}for(let t=0;t<n.length;++t){const r=ue(e,{dynamics:[],shortcuts:[],statics:{}});_e(e,i,n[t],r,"pushPath"),i=r}if(this.arity.leading.length>0||!this.arity.proxy){const t=ue(e,{dynamics:[],shortcuts:[],statics:{}});xe(e,i,"isHelp",t,["useHelp",this.cliIndex]),xe(e,t,"always",t,"pushExtra"),_e(e,t,B,F,["setSelectedIndex",U]),this.registerOptions(e,i)}this.arity.leading.length>0&&_e(e,i,B,M,["setError","Not enough positional arguments"]);let o=i;for(let t=0;t<this.arity.leading.length;++t){const n=ue(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)&&_e(e,n,B,M,["setError","Not enough positional arguments"]),xe(e,o,"isNotOptionLike",n,"pushPositional"),o=n}let s=o;if(this.arity.extra===Re||this.arity.extra.length>0){const t=ue(e,{dynamics:[],shortcuts:[],statics:{}});if(be(e,o,t),this.arity.extra===Re){const n=ue(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=ue(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&&_e(e,s,B,M,["setError","Not enough positional arguments"]);let a=s;for(let t=0;t<this.arity.trailing.length;++t){const n=ue(e,{dynamics:[],shortcuts:[],statics:{}});this.arity.proxy||this.registerOptions(e,n),t+1<this.arity.trailing.length&&_e(e,n,B,M,["setError","Not enough positional arguments"]),xe(e,a,"isNotOptionLike",n,"pushPositional"),a=n}xe(e,a,r,M,["setError","Extraneous positional argument"]),_e(e,a,B,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],M,["setError","Unsupported option name"]),xe(e,t,["isInvalidOption"],M,["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=ue(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=ue(e,{dynamics:[],shortcuts:[],statics:{}});_e(e,r,B,M,"setOptionArityError"),xe(e,r,"isOptionLike",M,"setOptionArityError");xe(e,r,"isNotOptionLike",t,1===n.arity?"setStringValue":"pushStringValue"),r=t}be(e,r,t)}}}}class Oe{constructor({binaryName:e="..."}={}){this.builders=[],this.opts={binaryName:e}}static build(e,t={}){return new Oe(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 Te(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)ge(e)||t.nodes.push(ye(r.nodes[e],i));i+=r.nodes.length-2}for(const e of n)be(t,D,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(D)}(n),{machine:n,contexts:t,process:e=>fe(n,e),suggest:(e,t)=>function(e,t,n){const i=n&&t.length>0?[""]:[],r=pe(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=de(r,n);for(const[e,n]of Object.entries(r.statics))(o&&e!==B||!e.startsWith("-")&&n.some((({reducer:e})=>"pushPath"===e)))&&a([...i,e],t);if(o)for(const[e,{to:o}]of r.dynamics){if(o===M)continue;const r=Ee(e,n);if(null!==r)for(const e of r)a([...i,e],t)}}return[...o].sort()}(n,e,t)}}}let Ae;let Ce=class e extends ae{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 Pe=Symbol("clipanion/errorCommand");class je{constructor({binaryLabel:e,binaryName:t="...",binaryVersion:n,enableCapture:i=!1,enableColors:r}={}){this.registrations=new Map,this.builder=new Oe({binaryName:t}),this.binaryLabel=e,this.binaryName=t,this.binaryVersion=n,this.enableCapture=i,this.enableColors=r}static from(e,t={}){const n=new je(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[ae.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={...je.defaultContext,...t};if(r.selectedIndex===U){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[Pe]=i,e}}}async run(e,t){var n,i;let r;const o={...je.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=Ae;if(void 0===t){if(e.stdout===process.stdout&&e.stderr===process.stderr)return null;const{AsyncLocalStorage:n}=require("async_hooks");t=Ae=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:Le;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?ee(n.usage.category,{format:this.format(e),paragraphs:!1}):void 0,c=void 0!==n.usage.description?ee(n.usage.description,{format:this.format(e),paragraphs:!1}):void 0,l=void 0!==n.usage.details?ee(n.usage.details,{format:this.format(e),paragraphs:!0}):void 0,u=void 0!==n.usage.examples?n.usage.examples.map((([t,n])=>[ee(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 ae?e.constructor:e;let s="";if(o)if(n){const{description:e="",details:n="",examples:r=[]}=o.usage||{};""!==e&&(s+=ee(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))} ${ee(i,{format:this.format(t),paragraphs:!1})}`}if(""!==n&&(s+="\n",s+=`${this.format(t).header("Details")}\n`,s+="\n",s+=ee(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+=ee(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?ee(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+=` ${ee(n,{format:this.format(t),paragraphs:!1})}`}}s+="\n",s+=ee("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[Pe])&&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:je.defaultContext.colorDepth>1)?X:Q}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 Le(e){return e()}je.defaultContext={env:process.env,stdin:process.stdin,stdout:process.stdout,stderr:process.stderr,colorDepth:A&&"getColorDepth"in A.WriteStream.prototype?A.WriteStream.prototype.getColorDepth():"0"===process.env.FORCE_COLOR?1:"1"===process.env.FORCE_COLOR||void 0!==process.stdout&&process.stdout.isTTY?8:1};class Ne extends ae{async execute(){this.context.stdout.write(this.cli.usage())}}Ne.paths=[["-h"],["--help"]];class Ie extends ae{async execute(){var e;this.context.stdout.write(`${null!==(e=this.cli.binaryVersion)&&void 0!==e?e:"<unknown>"}\n`)}}function De(e,t,n){const[i,r]=ie(t,null!=n?n:{}),o=e.split(","),s=new Set(o);return ne({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 Fe(e,...t){return"string"==typeof e?function(e,t,n){const[i,r]=ie(t,null!=n?n:{}),{arity:o=1}=r,s=e.split(","),a=new Set(s);return ne({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?se(null!=s?s:t,c,r.validator):c}})}(e,...t):function(e={}){const{required:t=!0}=e;return ne({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===Re)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 se(null!==(o=e.name)&&void 0!==o?o:i,s.value,e.validator)}}})}(e)}function Me(...e){(process.env.ENVIRONMENT||process.env.DEBUG)&&console.log(...e)}Ie.paths=[["-v"],["--version"]];function $e(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=d.dirname(e);u.mkdirSync(i,{recursive:!0}),u.writeFileSync(e,t||"","utf8")}}var Be="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Ue(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ze,qe,He={exports:{}};
2
2
  /**
3
3
  * @license
4
4
  * Lodash <https://lodash.com/>
@@ -41,4 +41,4 @@ const vp=function(e){return"number"==typeof e?e-e==0:"string"==typeof e&&""!==e.
41
41
  */
42
42
  const Cp=b,Pp=yp,jp=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),Lp=e=>"number"==typeof e||"string"==typeof e&&""!==e,Np=e=>Number.isInteger(+e),Ip=e=>{let t=`${e}`,n=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++n];);return n>0},Dp=(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},Mp=(e,t,n,i)=>{if(n)return Pp(e,t,{wrap:!1,...i});let r=String.fromCharCode(e);return e===t?r:`[${r}-${String.fromCharCode(t)}]`},$p=(e,t,n)=>{if(Array.isArray(e)){let t=!0===n.wrap,i=n.capture?"":"?:";return t?`(${i}${e.join("|")})`:e.join("|")}return Pp(e,t,n)},Bp=(...e)=>new RangeError("Invalid range arguments: "+Cp.inspect(...e)),Up=(e,t,n)=>{if(!0===n.strictRanges)throw Bp([e,t]);return[]},zp=(e,t,n=1,i={})=>{let r=Number(e),o=Number(t);if(!Number.isInteger(r)||!Number.isInteger(o)){if(!0===i.strictRanges)throw Bp([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=Ip(a)||Ip(c)||Ip(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 Mp(Fp(e,p),Fp(t,p),!0,i);let h={negatives:[],positives:[]},m=[],g=0;for(;s?r>=o:r<=o;)!0===i.toRegex&&n>1?h[(v=r)<0?"negatives":"positives"].push(Math.abs(v)):m.push(Dp(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})(h,i,p):$p(m,null,{wrap:!1,...i}):m},qp=(e,t,n,i={})=>{if(null==t&&Lp(e))return[e];if(!Lp(e)||!Lp(t))return Up(e,t,i);if("function"==typeof n)return qp(e,t,1,{transform:n});if(jp(n))return qp(e,t,0,n);let r={...i};return!0===r.capture&&(r.wrap=!0),n=n||r.step||1,Np(n)?Np(e)&&Np(t)?zp(e,t,n,r):((e,t,n=1,i={})=>{if(!Np(e)&&e.length>1||!Np(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 Mp(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?$p(u,null,{wrap:!1,options:i}):u})(e,t,Math.max(Math.abs(n),1),r):null==n||jp(n)?qp(e,t,1,n):((e,t)=>{if(!0===t.strictRanges)throw new TypeError(`Expected step "${e}" to be a number`);return[]})(n,r)};const Hp=qp,Wp=hp;var Gp=(e,t={})=>{const n=(e,i={})=>{const r=Wp.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=Wp.reduce(e.nodes),i=Hp(...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 Vp=qp,Kp=gp,Jp=hp,Yp=(e="",t="",n=!1)=>{const i=[];if(e=[].concat(e),!(t=[].concat(t)).length)return e;if(!e.length)return n?Jp.flatten(t).map((e=>`{${e}}`)):t;for(const r of e)if(Array.isArray(r))for(const e of r)i.push(Yp(e,t,n));else for(let e of t)!0===n&&"string"==typeof e&&(e=`{${e}}`),i.push(Array.isArray(e)?Yp(r,e,n):r+e);return Jp.flatten(i)};var Zp=(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(Yp(s.pop(),Kp(e,t)));if("brace"===e.type&&!0!==e.invalid&&2===e.nodes.length)return void s.push(Yp(s.pop(),["{}"]));if(e.nodes&&e.ranges>0){const i=Jp.reduce(e.nodes);if(Jp.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=Vp(...i,t);return 0===r.length&&(r=Kp(e,t)),s.push(Yp(s.pop(),r)),void(e.nodes=[])}const a=Jp.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(Yp(c.pop(),n.value)):n.nodes&&i(n,e):s.push(Yp(s.pop(),c,a)):(1===t&&c.push(""),c.push(""))}return c};return Jp.flatten(i(e))};const Xp=gp,{MAX_LENGTH:Qp,CHAR_BACKSLASH:ed,CHAR_BACKTICK:td,CHAR_COMMA:nd,CHAR_DOT:id,CHAR_LEFT_PARENTHESES:rd,CHAR_RIGHT_PARENTHESES:od,CHAR_LEFT_CURLY_BRACE:sd,CHAR_RIGHT_CURLY_BRACE:ad,CHAR_LEFT_SQUARE_BRACKET:cd,CHAR_RIGHT_SQUARE_BRACKET:ld,CHAR_DOUBLE_QUOTE:ud,CHAR_SINGLE_QUOTE:pd,CHAR_NO_BREAK_SPACE:dd,CHAR_ZERO_WIDTH_NOBREAK_SPACE:fd}={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 hd=(e,t={})=>{if("string"!=typeof e)throw new TypeError("Expected a string");const n=t||{},i="number"==typeof n.maxLength?Math.min(Qp,n.maxLength):Qp;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++],h=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(h({type:"bos"});p<l;)if(s=o[o.length-1],u=f(),u!==fd&&u!==dd)if(u!==ed)if(u!==ld)if(u!==cd)if(u!==rd)if(u!==od)if(u!==ud&&u!==pd&&u!==td)if(u!==sd)if(u!==ad)if(u===nd&&d>0){if(s.ranges>0){s.ranges=0;const e=s.nodes.shift();s.nodes=[e,{type:"text",value:Xp(s)}]}h({type:"comma",value:u}),s.commas++}else if(u===id&&d>0&&0===s.commas){const e=s.nodes;if(0===d||0===e.length){h({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}h({type:"dot",value:u})}else h({type:"text",value:u});else{if("brace"!==s.type){h({type:"text",value:u});continue}const e="close";s=o.pop(),s.close=!0,h({type:e,value:u}),d--,s=o[o.length-1]}else{d++;const e=a.value&&"$"===a.value.slice(-1)||!0===s.dollar;s=h({type:"brace",open:!0,close:!1,dollar:e,depth:d,commas:0,ranges:0,nodes:[]}),o.push(s),h({type:"open",value:u})}else{const e=u;let n;for(!0!==t.keepQuotes&&(u="");p<l&&(n=f());)if(n!==ed){if(n===e){!0===t.keepQuotes&&(u+=n);break}u+=n}else u+=n+f();h({type:"text",value:u})}else{if("paren"!==s.type){h({type:"text",value:u});continue}s=o.pop(),h({type:"text",value:u}),s=o[o.length-1]}else s=h({type:"paren",nodes:[]}),o.push(s),h({type:"text",value:u});else{let e;for(c++;p<l&&(e=f());)if(u+=e,e!==cd)if(e!==ed){if(e===ld&&(c--,0===c))break}else u+=f();else c++;h({type:"text",value:u})}else h({type:"text",value:"\\"+u});else h({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 h({type:"eos"}),r};const md=gp,gd=Gp,vd=Zp,yd=hd,xd=(e,t={})=>{let n=[];if(Array.isArray(e))for(const i of e){const e=xd.create(i,t);Array.isArray(e)?n.push(...e):n.push(e)}else n=[].concat(xd.create(e,t));return t&&!0===t.expand&&!0===t.nodupes&&(n=[...new Set(n)]),n};xd.parse=(e,t={})=>yd(e,t),xd.stringify=(e,t={})=>md("string"==typeof e?xd.parse(e,t):e,t),xd.compile=(e,t={})=>("string"==typeof e&&(e=xd.parse(e,t)),gd(e,t)),xd.expand=(e,t={})=>{"string"==typeof e&&(e=xd.parse(e,t));let n=vd(e,t);return!0===t.noempty&&(n=n.filter(Boolean)),!0===t.nodupes&&(n=[...new Set(n)]),n},xd.create=(e,t={})=>""===e||e.length<3?[e]:!0!==t.expand?xd.compile(e,t):xd.expand(e,t);const bd=b,_d=xd,wd=Tu,Ed=Ll,Sd=e=>""===e||"./"===e,kd=(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=wd(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};kd.match=kd,kd.matcher=(e,t)=>wd(e,t),kd.any=kd.isMatch=(e,t,n)=>wd(t,n)(e),kd.not=(e,t,n={})=>{t=[].concat(t).map(String);let i=new Set,r=[],o=new Set(kd(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]},kd.contains=(e,t,n)=>{if("string"!=typeof e)throw new TypeError(`Expected a string: "${bd.inspect(e)}"`);if(Array.isArray(t))return t.some((t=>kd.contains(e,t,n)));if("string"==typeof t){if(Sd(e)||Sd(t))return!1;if(e.includes(t)||e.startsWith("./")&&e.slice(2).includes(t))return!0}return kd.isMatch(e,t,{...n,contains:!0})},kd.matchKeys=(e,t,n)=>{if(!Ed.isObject(e))throw new TypeError("Expected the first argument to be an object");let i=kd(Object.keys(e),t,n),r={};for(let t of i)r[t]=e[t];return r},kd.some=(e,t,n)=>{let i=[].concat(e);for(let e of[].concat(t)){let t=wd(String(e),n);if(i.some((e=>t(e))))return!0}return!1},kd.every=(e,t,n)=>{let i=[].concat(e);for(let e of[].concat(t)){let t=wd(String(e),n);if(!i.every((e=>t(e))))return!1}return!0},kd.all=(e,t,n)=>{if("string"!=typeof e)throw new TypeError(`Expected a string: "${bd.inspect(e)}"`);return[].concat(t).every((t=>wd(t,n)(e)))},kd.capture=(e,t,n)=>{let i=Ed.isWindows(n),r=wd.makeRe(String(e),{...n,capture:!0}).exec(i?Ed.toPosixSlashes(t):t);if(r)return r.slice(1).map((e=>void 0===e?"":e))},kd.makeRe=(...e)=>wd.makeRe(...e),kd.scan=(...e)=>wd.scan(...e),kd.parse=(e,t)=>{let n=[];for(let i of[].concat(e||[]))for(let e of _d(String(i),t))n.push(wd.parse(e,t));return n},kd.braces=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return t&&!0===t.nobrace||!/\{.*\}/.test(e)?[e]:_d(e,t)},kd.braceExpand=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return kd.braces(e,{...t,expand:!0})};var Rd=kd;Object.defineProperty(np,"__esModule",{value:!0}),np.removeDuplicateSlashes=np.matchAny=np.convertPatternsToRe=np.makeRe=np.getPatternParts=np.expandBraceExpansion=np.expandPatternsWithBraceExpansion=np.isAffectDepthOfReadingPattern=np.endsWithSlashGlobStar=np.hasGlobStar=np.getBaseDirectory=np.isPatternRelatedToParentDirectory=np.getPatternsOutsideCurrentDirectory=np.getPatternsInsideCurrentDirectory=np.getPositivePatterns=np.getNegativePatterns=np.isPositivePattern=np.isNegativePattern=np.convertToNegativePattern=np.convertToPositivePattern=np.isDynamicPattern=np.isStaticPattern=void 0;const Td=d,Od=function(e,t){Object.assign({flipBackslashes:!0},t).flipBackslashes&&lp&&e.indexOf("/")<0&&(e=e.replace(up,"/")),pp.test(e)&&(e+="/"),e+="a";do{e=cp(e)}while(ap(e)||dp.test(e));return e.replace(fp,"$1")},Ad=Rd,Cd="**",Pd="\\",jd=/[*?]|^!/,Ld=/\[[^[]*]/,Nd=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,Id=/[!*+?@]\([^(]*\)/,Dd=/,|\.\./,Fd=/(?!^)\/{2,}/g;function Md(e,t={}){return!$d(e,t)}function $d(e,t={}){return""!==e&&(!(!1!==t.caseSensitiveMatch&&!e.includes(Pd))||(!!(jd.test(e)||Ld.test(e)||Nd.test(e))||(!(!1===t.extglob||!Id.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 Dd.test(i)}(e)))))}function Bd(e){return e.startsWith("!")&&"("!==e[1]}function Ud(e){return!Bd(e)}function zd(e){return e.startsWith("..")||e.startsWith("./..")}function qd(e){return e.endsWith("/"+Cd)}function Hd(e){const t=Ad.braces(e,{expand:!0,nodupes:!0,keepEscaping:!0});return t.sort(((e,t)=>e.length-t.length)),t.filter((e=>""!==e))}function Wd(e,t){return Ad.makeRe(e,t)}np.isStaticPattern=Md,np.isDynamicPattern=$d,np.convertToPositivePattern=function(e){return Bd(e)?e.slice(1):e},np.convertToNegativePattern=function(e){return"!"+e},np.isNegativePattern=Bd,np.isPositivePattern=Ud,np.getNegativePatterns=function(e){return e.filter(Bd)},np.getPositivePatterns=function(e){return e.filter(Ud)},np.getPatternsInsideCurrentDirectory=function(e){return e.filter((e=>!zd(e)))},np.getPatternsOutsideCurrentDirectory=function(e){return e.filter(zd)},np.isPatternRelatedToParentDirectory=zd,np.getBaseDirectory=function(e){return Od(e,{flipBackslashes:!1})},np.hasGlobStar=function(e){return e.includes(Cd)},np.endsWithSlashGlobStar=qd,np.isAffectDepthOfReadingPattern=function(e){const t=Td.basename(e);return qd(e)||Md(t)},np.expandPatternsWithBraceExpansion=function(e){return e.reduce(((e,t)=>e.concat(Hd(t))),[])},np.expandBraceExpansion=Hd,np.getPatternParts=function(e,t){let{parts:n}=Ad.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},np.makeRe=Wd,np.convertPatternsToRe=function(e,t){return e.map((e=>Wd(e,t)))},np.matchAny=function(e,t){return t.some((t=>t.test(e)))},np.removeDuplicateSlashes=function(e){return e.replace(Fd,"/")};var Gd={};Object.defineProperty(Gd,"__esModule",{value:!0}),Gd.merge=void 0;const Vd=Fu;function Kd(e){e.forEach((e=>e.emit("close")))}Gd.merge=function(e){const t=Vd(e);return e.forEach((e=>{e.once("error",(e=>t.emit("error",e)))})),t.once("close",(()=>Kd(e))),t.once("end",(()=>Kd(e))),t};var Jd={};Object.defineProperty(Jd,"__esModule",{value:!0}),Jd.isEmpty=Jd.isString=void 0,Jd.isString=function(e){return"string"==typeof e},Jd.isEmpty=function(e){return""===e},Object.defineProperty(Bu,"__esModule",{value:!0}),Bu.string=Bu.stream=Bu.pattern=Bu.path=Bu.fs=Bu.errno=Bu.array=void 0;const Yd=Uu;Bu.array=Yd;const Zd=zu;Bu.errno=Zd;const Xd=qu;Bu.fs=Xd;const Qd=Wu;Bu.path=Qd;const ef=np;Bu.pattern=ef;const tf=Gd;Bu.stream=tf;const nf=Jd;Bu.string=nf,Object.defineProperty($u,"__esModule",{value:!0}),$u.convertPatternGroupToTask=$u.convertPatternGroupsToTasks=$u.groupPatternsByBaseDirectory=$u.getNegativePatternsAsPositive=$u.getPositivePatterns=$u.convertPatternsToTasks=$u.generate=void 0;const rf=Bu;function of(e,t){let n=e;return t.braceExpansion&&(n=rf.pattern.expandPatternsWithBraceExpansion(n)),t.baseNameMatch&&(n=n.map((e=>e.includes("/")?e:`**/${e}`))),n.map((e=>rf.pattern.removeDuplicateSlashes(e)))}function sf(e,t,n){const i=[],r=rf.pattern.getPatternsOutsideCurrentDirectory(e),o=rf.pattern.getPatternsInsideCurrentDirectory(e),s=lf(r),a=lf(o);return i.push(...uf(s,t,n)),"."in a?i.push(pf(".",o,t,n)):i.push(...uf(a,t,n)),i}function af(e){return rf.pattern.getPositivePatterns(e)}function cf(e,t){return rf.pattern.getNegativePatterns(e).concat(t).map(rf.pattern.convertToPositivePattern)}function lf(e){return e.reduce(((e,t)=>{const n=rf.pattern.getBaseDirectory(t);return n in e?e[n].push(t):e[n]=[t],e}),{})}function uf(e,t,n){return Object.keys(e).map((i=>pf(i,e[i],t,n)))}function pf(e,t,n,i){return{dynamic:i,positive:t,negative:n,base:e,patterns:[].concat(t,n.map(rf.pattern.convertToNegativePattern))}}$u.generate=function(e,t){const n=of(e,t),i=of(t.ignore,t),r=af(n),o=cf(n,i),s=r.filter((e=>rf.pattern.isStaticPattern(e,t))),a=r.filter((e=>rf.pattern.isDynamicPattern(e,t))),c=sf(s,o,!1),l=sf(a,o,!0);return c.concat(l)},$u.convertPatternsToTasks=sf,$u.getPositivePatterns=af,$u.getNegativePatternsAsPositive=cf,$u.groupPatternsByBaseDirectory=lf,$u.convertPatternGroupsToTasks=uf,$u.convertPatternGroupToTask=pf;var df={},ff={},hf={},mf={},gf={},vf={},yf={},xf={},bf={};function _f(e,t){e(t)}function wf(e,t){e(null,t)}Object.defineProperty(bf,"__esModule",{value:!0}),bf.read=void 0,bf.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 _f(n,e):void wf(n,r);t.markSymbolicLink&&(i.isSymbolicLink=()=>!0),wf(n,i)})):wf(n,r):_f(n,i)}))};var Ef={};Object.defineProperty(Ef,"__esModule",{value:!0}),Ef.read=void 0,Ef.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 Sf={},kf={};!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)}}(kf),Object.defineProperty(Sf,"__esModule",{value:!0});const Rf=kf;Sf.default=class{constructor(e={}){this._options=e,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=Rf.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(xf,"__esModule",{value:!0}),xf.statSync=xf.stat=xf.Settings=void 0;const Tf=bf,Of=Ef,Af=Sf;function Cf(e={}){return e instanceof Af.default?e:new Af.default(e)}
43
43
  /*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */let Pf;xf.Settings=Af.default,xf.stat=function(e,t,n){"function"!=typeof t?Tf.read(e,Cf(t),n):Tf.read(e,Cf(),t)},xf.statSync=function(e,t){const n=Cf(t);return Of.read(e,n)};var jf=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?Lf(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 Lf="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:Be):e=>(Pf||(Pf=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0)));var Nf={};Object.defineProperty(Nf,"__esModule",{value:!0}),Nf.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;const If=process.versions.node.split(".");if(void 0===If[0]||void 0===If[1])throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);const Df=Number.parseInt(If[0],10),Ff=Number.parseInt(If[1],10),Mf=Df>10,$f=10===Df&&Ff>=10;Nf.IS_SUPPORT_READDIR_WITH_FILE_TYPES=Mf||$f;var Bf={},Uf={};Object.defineProperty(Uf,"__esModule",{value:!0}),Uf.createDirentFromStats=void 0;class zf{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 zf(e,t)},Object.defineProperty(Bf,"__esModule",{value:!0}),Bf.fs=void 0;const qf=Uf;Bf.fs=qf;var Hf={};Object.defineProperty(Hf,"__esModule",{value:!0}),Hf.joinPathSegments=void 0,Hf.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 Wf=xf,Gf=jf,Vf=Nf,Kf=Bf,Jf=Hf;function Yf(e,t,n){t.fs.readdir(e,{withFileTypes:!0},((i,r)=>{if(null!==i)return void Xf(n,i);const o=r.map((n=>({dirent:n,name:n.name,path:Jf.joinPathSegments(e,n.name,t.pathSegmentSeparator)})));if(!t.followSymbolicLinks)return void Qf(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=Kf.fs.createDirentFromStats(e.name,r),n(null,e)})):n(null,e)}}(e,t)));Gf(s,((e,t)=>{null===e?Qf(n,t):Xf(n,e)}))}))}function Zf(e,t,n){t.fs.readdir(e,((i,r)=>{if(null!==i)return void Xf(n,i);const o=r.map((n=>{const i=Jf.joinPathSegments(e,n,t.pathSegmentSeparator);return e=>{Wf.stat(i,t.fsStatSettings,((r,o)=>{if(null!==r)return void e(r);const s={name:n,path:i,dirent:Kf.fs.createDirentFromStats(n,o)};t.stats&&(s.stats=o),e(null,s)}))}}));Gf(o,((e,t)=>{null===e?Qf(n,t):Xf(n,e)}))}))}function Xf(e,t){e(t)}function Qf(e,t){e(null,t)}yf.read=function(e,t,n){t.stats||!Vf.IS_SUPPORT_READDIR_WITH_FILE_TYPES?Zf(e,t,n):Yf(e,t,n)},yf.readdirWithFileTypes=Yf,yf.readdir=Zf;var eh={};Object.defineProperty(eh,"__esModule",{value:!0}),eh.readdir=eh.readdirWithFileTypes=eh.read=void 0;const th=xf,nh=Nf,ih=Bf,rh=Hf;function oh(e,t){return t.fs.readdirSync(e,{withFileTypes:!0}).map((n=>{const i={dirent:n,name:n.name,path:rh.joinPathSegments(e,n.name,t.pathSegmentSeparator)};if(i.dirent.isSymbolicLink()&&t.followSymbolicLinks)try{const e=t.fs.statSync(i.path);i.dirent=ih.fs.createDirentFromStats(i.name,e)}catch(e){if(t.throwErrorOnBrokenSymbolicLink)throw e}return i}))}function sh(e,t){return t.fs.readdirSync(e).map((n=>{const i=rh.joinPathSegments(e,n,t.pathSegmentSeparator),r=th.statSync(i,t.fsStatSettings),o={name:n,path:i,dirent:ih.fs.createDirentFromStats(n,r)};return t.stats&&(o.stats=r),o}))}eh.read=function(e,t){return!t.stats&&nh.IS_SUPPORT_READDIR_WITH_FILE_TYPES?oh(e,t):sh(e,t)},eh.readdirWithFileTypes=oh,eh.readdir=sh;var ah={},ch={};!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)}}(ch),Object.defineProperty(ah,"__esModule",{value:!0});const lh=d,uh=xf,ph=ch;ah.default=class{constructor(e={}){this._options=e,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=ph.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,lh.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new uh.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(e,t){return null!=e?e:t}},Object.defineProperty(vf,"__esModule",{value:!0}),vf.Settings=vf.scandirSync=vf.scandir=void 0;const dh=yf,fh=eh,hh=ah;function mh(e={}){return e instanceof hh.default?e:new hh.default(e)}vf.Settings=hh.default,vf.scandir=function(e,t,n){"function"!=typeof t?dh.read(e,mh(t),n):dh.read(e,mh(),t)},vf.scandirSync=function(e,t){const n=mh(t);return fh.read(e,n)};var gh={exports:{}};var vh=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 yh(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=vh(bh),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||xh,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:xh,saturated:xh,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||xh,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:xh,kill:function(){r=null,o=null,c.drain=xh},killAndDrain:function(){r=null,o=null,c.drain(),c.drain=xh},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 xh(){}function bh(){this.value=null,this.callback=xh,this.next=null,this.release=xh,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=xh,e.errorHandler&&r(t,o),i.call(e.context,t,n),e.release(e)}}gh.exports=yh,gh.exports.promise=function(e,t,n){"function"==typeof e&&(n=t,t=e,e=null);var i=yh(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(xh),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(xh),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 _h=gh.exports,wh={};Object.defineProperty(wh,"__esModule",{value:!0}),wh.joinPathSegments=wh.replacePathSegmentSeparator=wh.isAppliedFilter=wh.isFatalError=void 0,wh.isFatalError=function(e,t){return null===e.errorFilter||!e.errorFilter(t)},wh.isAppliedFilter=function(e,t){return null===e||e(t)},wh.replacePathSegmentSeparator=function(e,t){return e.split(/[/\\]/).join(t)},wh.joinPathSegments=function(e,t,n){return""===e?t:e.endsWith(n)?e+t:e+n+t};var Eh={};Object.defineProperty(Eh,"__esModule",{value:!0});const Sh=wh;Eh.default=class{constructor(e,t){this._root=e,this._settings=t,this._root=Sh.replacePathSegmentSeparator(e,t.pathSegmentSeparator)}},Object.defineProperty(gf,"__esModule",{value:!0});const kh=P,Rh=vf,Th=_h,Oh=wh,Ah=Eh;class Ch extends Ah.default{constructor(e,t){super(e,t),this._settings=t,this._scandir=Rh.scandir,this._emitter=new kh.EventEmitter,this._queue=Th(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&&Oh.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=Oh.joinPathSegments(t,e.name,this._settings.pathSegmentSeparator)),Oh.isAppliedFilter(this._settings.entryFilter,e)&&this._emitEntry(e),e.dirent.isDirectory()&&Oh.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,void 0===t?void 0:e.path)}_emitEntry(e){this._emitter.emit("entry",e)}}gf.default=Ch,Object.defineProperty(mf,"__esModule",{value:!0});const Ph=gf;mf.default=class{constructor(e,t){this._root=e,this._settings=t,this._reader=new Ph.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 jh={};Object.defineProperty(jh,"__esModule",{value:!0});const Lh=y,Nh=gf;jh.default=class{constructor(e,t){this._root=e,this._settings=t,this._reader=new Nh.default(this._root,this._settings),this._stream=new Lh.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 Ih={},Dh={};Object.defineProperty(Dh,"__esModule",{value:!0});const Fh=vf,Mh=wh,$h=Eh;class Bh extends $h.default{constructor(){super(...arguments),this._scandir=Fh.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(Mh.isFatalError(this._settings,e))throw e}_handleEntry(e,t){const n=e.path;void 0!==t&&(e.path=Mh.joinPathSegments(t,e.name,this._settings.pathSegmentSeparator)),Mh.isAppliedFilter(this._settings.entryFilter,e)&&this._pushToStorage(e),e.dirent.isDirectory()&&Mh.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,void 0===t?void 0:e.path)}_pushToStorage(e){this._storage.push(e)}}Dh.default=Bh,Object.defineProperty(Ih,"__esModule",{value:!0});const Uh=Dh;Ih.default=class{constructor(e,t){this._root=e,this._settings=t,this._reader=new Uh.default(this._root,this._settings)}read(){return this._reader.read()}};var zh={};Object.defineProperty(zh,"__esModule",{value:!0});const qh=d,Hh=vf;zh.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,qh.sep),this.fsScandirSettings=new Hh.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(hf,"__esModule",{value:!0}),hf.Settings=hf.walkStream=hf.walkSync=hf.walk=void 0;const Wh=mf,Gh=jh,Vh=Ih,Kh=zh;function Jh(e={}){return e instanceof Kh.default?e:new Kh.default(e)}hf.Settings=Kh.default,hf.walk=function(e,t,n){"function"!=typeof t?new Wh.default(e,Jh(t)).read(n):new Wh.default(e,Jh()).read(t)},hf.walkSync=function(e,t){const n=Jh(t);return new Vh.default(e,n).read()},hf.walkStream=function(e,t){const n=Jh(t);return new Gh.default(e,n).read()};var Yh={};Object.defineProperty(Yh,"__esModule",{value:!0});const Zh=d,Xh=xf,Qh=Bu;Yh.default=class{constructor(e){this._settings=e,this._fsStatSettings=new Xh.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return Zh.resolve(this._settings.cwd,e)}_makeEntry(e,t){const n={name:t,path:t,dirent:Qh.fs.createDirentFromStats(t,e)};return this._settings.stats&&(n.stats=e),n}_isFatalError(e){return!Qh.errno.isEnoentCodeError(e)&&!this._settings.suppressErrors}};var em={};Object.defineProperty(em,"__esModule",{value:!0});const tm=y,nm=xf,im=hf,rm=Yh;class om extends rm.default{constructor(){super(...arguments),this._walkStream=im.walkStream,this._stat=nm.stat}dynamic(e,t){return this._walkStream(e,t)}static(e,t){const n=e.map(this._getFullEntryPath,this),i=new tm.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)))}))}}em.default=om,Object.defineProperty(ff,"__esModule",{value:!0});const sm=hf,am=Yh,cm=em;class lm extends am.default{constructor(){super(...arguments),this._walkAsync=sm.walk,this._readerStream=new cm.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)))}))}}ff.default=lm;var um={},pm={},dm={},fm={};Object.defineProperty(fm,"__esModule",{value:!0});const hm=Bu;fm.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 hm.pattern.getPatternParts(e,this._micromatchOptions).map((e=>hm.pattern.isDynamicPattern(e,this._settings)?{dynamic:!0,pattern:e,patternRe:hm.pattern.makeRe(e,this._micromatchOptions)}:{dynamic:!1,pattern:e}))}_splitSegmentsIntoSections(e){return hm.array.splitWhen(e,(e=>e.dynamic&&hm.pattern.hasGlobStar(e.pattern)))}},Object.defineProperty(dm,"__esModule",{value:!0});const mm=fm;class gm extends mm.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}}dm.default=gm,Object.defineProperty(pm,"__esModule",{value:!0});const vm=Bu,ym=dm;pm.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 ym.default(e,this._settings,this._micromatchOptions)}_getNegativePatternsRe(e){const t=e.filter(vm.pattern.isAffectDepthOfReadingPattern);return vm.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=vm.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!vm.pattern.matchAny(e,t)}};var xm={};Object.defineProperty(xm,"__esModule",{value:!0});const bm=Bu;xm.default=class{constructor(e,t){this._settings=e,this._micromatchOptions=t,this.index=new Map}getFilter(e,t){const n=bm.pattern.convertPatternsToRe(e,this._micromatchOptions),i=bm.pattern.convertPatternsToRe(t,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}));return e=>this._filter(e,n,i)}_filter(e,t,n){const i=bm.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=bm.path.makeAbsolute(this._settings.cwd,e);return bm.pattern.matchAny(n,t)}_isMatchToPatterns(e,t,n){const i=bm.pattern.matchAny(e,t);return!i&&n?bm.pattern.matchAny(e+"/",t):i}};var _m={};Object.defineProperty(_m,"__esModule",{value:!0});const wm=Bu;_m.default=class{constructor(e){this._settings=e}getFilter(){return e=>this._isNonFatalError(e)}_isNonFatalError(e){return wm.errno.isEnoentCodeError(e)||this._settings.suppressErrors}};var Em={};Object.defineProperty(Em,"__esModule",{value:!0});const Sm=Bu;Em.default=class{constructor(e){this._settings=e}getTransformer(){return e=>this._transform(e)}_transform(e){let t=e.path;return this._settings.absolute&&(t=Sm.path.makeAbsolute(this._settings.cwd,t),t=Sm.path.unixify(t)),this._settings.markDirectories&&e.dirent.isDirectory()&&(t+="/"),this._settings.objectMode?Object.assign(Object.assign({},e),{path:t}):t}},Object.defineProperty(um,"__esModule",{value:!0});const km=d,Rm=pm,Tm=xm,Om=_m,Am=Em;um.default=class{constructor(e){this._settings=e,this.errorFilter=new Om.default(this._settings),this.entryFilter=new Tm.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new Rm.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new Am.default(this._settings)}_getRootDirectory(e){return km.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(df,"__esModule",{value:!0});const Cm=ff,Pm=um;class jm extends Pm.default{constructor(){super(...arguments),this._reader=new Cm.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)}}df.default=jm;var Lm={};Object.defineProperty(Lm,"__esModule",{value:!0});const Nm=y,Im=em,Dm=um;class Fm extends Dm.default{constructor(){super(...arguments),this._reader=new Im.default(this._settings)}read(e){const t=this._getRootDirectory(e),n=this._getReaderOptions(e),i=this.api(t,e,n),r=new Nm.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)}}Lm.default=Fm;var Mm={},$m={};Object.defineProperty($m,"__esModule",{value:!0});const Bm=xf,Um=hf,zm=Yh;class qm extends zm.default{constructor(){super(...arguments),this._walkSync=Um.walkSync,this._statSync=Bm.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)}}$m.default=qm,Object.defineProperty(Mm,"__esModule",{value:!0});const Hm=$m,Wm=um;class Gm extends Wm.default{constructor(){super(...arguments),this._reader=new Hm.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)}}Mm.default=Gm;var Vm={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;const t=u,n=E,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)}}}(Vm);const Km=$u,Jm=df,Ym=Lm,Zm=Mm,Xm=Vm,Qm=Bu;async function eg(e,t){ng(e);const n=tg(e,Jm.default,t),i=await Promise.all(n);return Qm.array.flatten(i)}function tg(e,t,n){const i=[].concat(e),r=new Xm.default(n),o=Km.generate(i,r),s=new t(r);return o.map(s.read,s)}function ng(e){if(![].concat(e).every((e=>Qm.string.isString(e)&&!Qm.string.isEmpty(e))))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}!function(e){function t(e,t){ng(e);const n=tg(e,Zm.default,t);return Qm.array.flatten(n)}function n(e,t){ng(e);const n=tg(e,Ym.default,t);return Qm.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){ng(e);const n=[].concat(e),i=new Xm.default(t);return Km.generate(n,i)},e.isDynamicPattern=function(e,t){ng(e);const n=new Xm.default(t);return Qm.pattern.isDynamicPattern(e,n)},e.escapePath=function(e){return ng(e),Qm.path.escape(e)},e.convertPathToPattern=function(e){return ng(e),Qm.path.convertPathToPattern(e)},(i=e.posix||(e.posix={})).escapePath=function(e){return ng(e),Qm.path.escapePosixPath(e)},i.convertPathToPattern=function(e){return ng(e),Qm.path.convertPosixPathToPattern(e)},(r=e.win32||(e.win32={})).escapePath=function(e){return ng(e),Qm.path.escapeWindowsPath(e)},r.convertPathToPattern=function(e){return ng(e),Qm.path.convertWindowsPathToPattern(e)}}(eg||(eg={}));var ig={exports:{}},rg={};const{promisify:og}=b,sg=u;async function ag(e,t,n){if("string"!=typeof n)throw new TypeError("Expected a string, got "+typeof n);try{return(await og(sg[e])(n))[t]()}catch(e){if("ENOENT"===e.code)return!1;throw e}}function cg(e,t,n){if("string"!=typeof n)throw new TypeError("Expected a string, got "+typeof n);try{return sg[e](n)[t]()}catch(e){if("ENOENT"===e.code)return!1;throw e}}rg.isFile=ag.bind(null,"stat","isFile"),rg.isDirectory=ag.bind(null,"stat","isDirectory"),rg.isSymlink=ag.bind(null,"lstat","isSymbolicLink"),rg.isFileSync=cg.bind(null,"statSync","isFile"),rg.isDirectorySync=cg.bind(null,"statSync","isDirectory"),rg.isSymlinkSync=cg.bind(null,"lstatSync","isSymbolicLink");const lg=d,ug=rg,pg=e=>e.length>1?`{${e.join(",")}}`:e[0],dg=(e,t)=>{const n="!"===e[0]?e.slice(1):e;return lg.isAbsolute(n)?n:lg.join(t,n)},fg=(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=>lg.posix.join(e,((e,t)=>lg.extname(e)?`**/${e}`:`**/${e}.${pg(t)}`)(n,t.extensions)))):t.files?t.files.map((t=>lg.posix.join(e,`**/${t}`))):t.extensions?[lg.posix.join(e,`**/*.${pg(t.extensions)}`)]:[lg.posix.join(e,"**")]};function hg(e){return Array.isArray(e)?e:[e]}ig.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 ug.isDirectory(dg(e,t.cwd))?fg(e,t):e)));return[].concat.apply([],n)},ig.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=>ug.isDirectorySync(dg(e,t.cwd))?fg(e,t):e));return[].concat.apply([],n)};const mg=/^\s+$/,gg=/(?:[^\\]|^)\\$/,vg=/^\\!/,yg=/^\\#/,xg=/\r?\n/g,bg=/^\.*\/|^\.+$/;let _g="node-ignore";"undefined"!=typeof Symbol&&(_g=Symbol.for("node-ignore"));const wg=_g,Eg=/([0-z])-([0-z])/g,Sg=()=>!1,kg=[[/^\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(Eg,((e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:"")))(n)}${i}]`:"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:"[^/]*"}(?=$|\\/$)`]],Rg=Object.create(null),Tg=e=>"string"==typeof e;class Og{constructor(e,t,n,i){this.origin=e,this.pattern=t,this.negative=n,this.regex=i}}const Ag=(e,t)=>{const n=e;let i=!1;0===e.indexOf("!")&&(i=!0,e=e.substr(1));const r=((e,t)=>{let n=Rg[e];return n||(n=kg.reduce(((t,[n,i])=>t.replace(n,i.bind(e))),e),Rg[e]=n),t?new RegExp(n,"i"):new RegExp(n)})(e=e.replace(vg,"!").replace(yg,"#"),t);return new Og(n,e,i,r)},Cg=(e,t)=>{throw new t(e)},Pg=(e,t,n)=>{if(!Tg(e))return n(`path must be a string, but got \`${t}\``,TypeError);if(!e)return n("path must not be empty",TypeError);if(Pg.isNotRelative(e)){return n(`path should be a ${"`path.relative()`d"} string, but got "${t}"`,RangeError)}return!0},jg=e=>bg.test(e);Pg.isNotRelative=jg,Pg.convert=e=>e;class Lg{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){var i,r,o;i=this,r=wg,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[wg])return this._rules=this._rules.concat(e._rules),void(this._added=!0);if((e=>e&&Tg(e)&&!mg.test(e)&&!gg.test(e)&&0!==e.indexOf("#"))(e)){const t=Ag(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,hg(Tg(e)?(e=>e.split(xg))(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&&Pg.convert(e);return Pg(r,e,this._allowRelativePaths?Sg:Cg),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 hg(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}}const Ng=e=>new Lg(e);if(Ng.isPathValid=e=>Pg(e&&Pg.convert(e),e,Sg),Ng.default=Ng,"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,"/");Pg.convert=e;const t=/^[a-z]:\//i;Pg.isNotRelative=e=>t.test(e)||jg(e)}const Ig=[{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 Dg{static default=new Dg;entries=[];static{for(const e of Ig)Dg.default.registerLanguage(e.id,e)}registerLanguage(e,t){const n=(e=>{const{extensions:t,names:n,patterns:i,firstLine:r}=e,o=r?new RegExp(r):null,a=i?Nu(i.map((e=>e.includes("/")?`**/${e}`:e))):null;return(e,i)=>!!(t&&t.includes(s.extname(e))||n&&n.includes(e)||a&&a(e)||o&&o.test(i))})(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 Mg={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function $g(e){Mg=e}const Bg=/[&<>"']/,Ug=new RegExp(Bg.source,"g"),zg=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,qg=new RegExp(zg.source,"g"),Hg={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Wg=e=>Hg[e];function Gg(e,t){if(t){if(Bg.test(e))return e.replace(Ug,Wg)}else if(zg.test(e))return e.replace(qg,Wg);return e}const Vg=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function Kg(e){return e.replace(Vg,((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 Jg=/(^|[^\[])\^/g;function Yg(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(Jg,"$1"),n=n.replace(e,r),i},getRegex:()=>new RegExp(n,t)};return i}function Zg(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const Xg={exec:()=>null};function Qg(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 ev(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 tv(e,t,n,i){const r=t.href,o=t.title?Gg(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:Gg(s)}}class nv{options;rules;lexer;constructor(e){this.options=e||Mg}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:ev(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=ev(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=ev(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=Qg(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(Qg(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:Gg(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=ev(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)),tv(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 tv(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=Gg(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=Gg(t[1]),n="mailto:"+e):(e=Gg(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=Gg(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=Gg(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]:Gg(t[0]),{type:"text",raw:t[0],text:e}}}}const iv=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,rv=/(?:[*+-]|\d{1,9}[.)])/,ov=Yg(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,rv).getRegex(),sv=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,av=/(?!\s*\])(?:\\.|[^\[\]\\])+/,cv=Yg(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",av).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),lv=Yg(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,rv).getRegex(),uv="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",pv=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,dv=Yg("^ {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",pv).replace("tag",uv).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),fv=Yg(sv).replace("hr",iv).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",uv).getRegex(),hv={blockquote:Yg(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",fv).getRegex(),code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,def:cv,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:iv,html:dv,lheading:ov,list:lv,newline:/^(?: *(?:\n|$))+/,paragraph:fv,table:Xg,text:/^[^\n]+/},mv=Yg("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",iv).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",uv).getRegex(),gv={...hv,table:mv,paragraph:Yg(sv).replace("hr",iv).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",mv).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",uv).getRegex()},vv={...hv,html:Yg("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",pv).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:Xg,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Yg(sv).replace("hr",iv).replace("heading"," *#{1,6} *[^\n]").replace("lheading",ov).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},yv=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,xv=/^( {2,}|\\)\n(?!\s*$)/,bv="\\p{P}$+<=>`^|~",_v=Yg(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,bv).getRegex(),wv=Yg(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,bv).getRegex(),Ev=Yg("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,bv).getRegex(),Sv=Yg("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,bv).getRegex(),kv=Yg(/\\([punct])/,"gu").replace(/punct/g,bv).getRegex(),Rv=Yg(/^<(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(),Tv=Yg(pv).replace("(?:--\x3e|$)","--\x3e").getRegex(),Ov=Yg("^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",Tv).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Av=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Cv=Yg(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Av).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Pv=Yg(/^!?\[(label)\]\[(ref)\]/).replace("label",Av).replace("ref",av).getRegex(),jv=Yg(/^!?\[(ref)\](?:\[\])?/).replace("ref",av).getRegex(),Lv={_backpedal:Xg,anyPunctuation:kv,autolink:Rv,blockSkip:/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,br:xv,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:Xg,emStrongLDelim:wv,emStrongRDelimAst:Ev,emStrongRDelimUnd:Sv,escape:yv,link:Cv,nolink:jv,punctuation:_v,reflink:Pv,reflinkSearch:Yg("reflink|nolink(?!\\()","g").replace("reflink",Pv).replace("nolink",jv).getRegex(),tag:Ov,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:Xg},Nv={...Lv,link:Yg(/^!?\[(label)\]\((.*?)\)/).replace("label",Av).getRegex(),reflink:Yg(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Av).getRegex()},Iv={...Lv,escape:Yg(yv).replace("])","~|])").getRegex(),url:Yg(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},Dv={...Iv,br:Yg(xv).replace("{2,}","*").getRegex(),text:Yg(Iv.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Fv={normal:hv,gfm:gv,pedantic:vv},Mv={normal:Lv,gfm:Iv,breaks:Dv,pedantic:Nv};class $v{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Mg,this.options.tokenizer=this.options.tokenizer||new nv,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:Mv.normal};this.options.pedantic?(t.block=Fv.pedantic,t.inline=Mv.pedantic):this.options.gfm&&(t.block=Fv.gfm,this.options.breaks?t.inline=Mv.breaks:t.inline=Mv.gfm),this.tokenizer.rules=t}static get rules(){return{block:Fv,inline:Mv}}static lex(e,t){return new $v(t).lex(e)}static lexInline(e,t){return new $v(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 Bv{options;constructor(e){this.options=e||Mg}code(e,t,n){const i=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+"\n",i?'<pre><code class="language-'+Gg(i)+'">'+(n?e:Gg(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:Gg(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=Zg(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=Zg(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 zv{options;renderer;textRenderer;constructor(e){this.options=e||Mg,this.options.renderer=this.options.renderer||new Bv,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Uv}static parse(e,t){return new zv(t).parse(e)}static parseInline(e,t){return new zv(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,Kg(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 qv{options;constructor(e){this.options=e||Mg}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}const Hv=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($v.lex,zv.parse);parseInline=this.#e($v.lexInline,zv.parseInline);Parser=zv;Renderer=Bv;TextRenderer=Uv;Lexer=$v;Tokenizer=nv;Hooks=qv;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 Bv(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 nv(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 qv;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];qv.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 $v.lex(e,t??this.defaults)}parser(e,t){return zv.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>"+Gg(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Wv(e,t){return Hv.parse(e,t)}Wv.options=Wv.setOptions=function(e){return Hv.setOptions(e),Wv.defaults=Hv.defaults,$g(Wv.defaults),Wv},Wv.getDefaults=Fg,Wv.defaults=Mg,Wv.use=function(...e){return Hv.use(...e),Wv.defaults=Hv.defaults,$g(Wv.defaults),Wv},Wv.walkTokens=function(e,t){return Hv.walkTokens(e,t)},Wv.parseInline=Hv.parseInline,Wv.Parser=zv,Wv.parser=zv.parse,Wv.Renderer=Bv,Wv.TextRenderer=Uv,Wv.Lexer=$v,Wv.lexer=$v.lex,Wv.Tokenizer=nv,Wv.Hooks=qv,Wv.parse=Wv,Wv.options,Wv.setOptions,Wv.use,Wv.walkTokens,Wv.parseInline,zv.parse,$v.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 Gv=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Vv=Gv,Kv=Object.create,Jv=function(){function e(){}return function(t){if(!Vv(t))return{};if(Kv)return Kv(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();var Yv=function(){},Zv=Jv,Xv=Yv;function Qv(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}Qv.prototype=Zv(Xv.prototype),Qv.prototype.constructor=Qv;var ey=Qv;var ty=function(e,t){for(var n=-1,i=t.length,r=e.length;++n<i;)e[r+n]=t[n];return e},ny="object"==typeof Be&&Be&&Be.Object===Object&&Be,iy="object"==typeof self&&self&&self.Object===Object&&self,ry=ny||iy||Function("return this")(),oy=ry.Symbol,sy=oy,ay=Object.prototype,cy=ay.hasOwnProperty,ly=ay.toString,uy=sy?sy.toStringTag:void 0;var py=function(e){var t=cy.call(e,uy),n=e[uy];try{e[uy]=void 0;var i=!0}catch(e){}var r=ly.call(e);return i&&(t?e[uy]=n:delete e[uy]),r},dy=Object.prototype.toString;var fy=py,hy=function(e){return dy.call(e)},my=oy?oy.toStringTag:void 0;var gy=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":my&&my in Object(e)?fy(e):hy(e)};var vy=function(e){return null!=e&&"object"==typeof e},yy=gy,xy=vy;var by=function(e){return xy(e)&&"[object Arguments]"==yy(e)},_y=vy,wy=Object.prototype,Ey=wy.hasOwnProperty,Sy=wy.propertyIsEnumerable,ky=by(function(){return arguments}())?by:function(e){return _y(e)&&Ey.call(e,"callee")&&!Sy.call(e,"callee")},Ry=Array.isArray,Ty=ky,Oy=Ry,Ay=oy?oy.isConcatSpreadable:void 0;var Cy=ty,Py=function(e){return Oy(e)||Ty(e)||!!(Ay&&e&&e[Ay])};var jy=function e(t,n,i,r,o){var s=-1,a=t.length;for(i||(i=Py),o||(o=[]);++s<a;){var c=t[s];n>0&&i(c)?n>1?e(c,n-1,i,r,o):Cy(o,c):r||(o[o.length]=c)}return o},Ly=jy;var Ny=function(e){return(null==e?0:e.length)?Ly(e,1):[]};var Iy=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)},Dy=Math.max;var Fy=function(e,t,n){return t=Dy(void 0===t?e.length-1:t,0),function(){for(var i=arguments,r=-1,o=Dy(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),Iy(e,this,a)}};var My=function(e){return function(){return e}},$y=gy,By=Gv;var Uy,zy=function(e){if(!By(e))return!1;var t=$y(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},qy=ry["__core-js_shared__"],Hy=(Uy=/[^.]+$/.exec(qy&&qy.keys&&qy.keys.IE_PROTO||""))?"Symbol(src)_1."+Uy:"";var Wy=function(e){return!!Hy&&Hy in e},Gy=Function.prototype.toString;var Vy=zy,Ky=Wy,Jy=Gv,Yy=function(e){if(null!=e){try{return Gy.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Zy=/^\[object .+?Constructor\]$/,Xy=Function.prototype,Qy=Object.prototype,ex=Xy.toString,tx=Qy.hasOwnProperty,nx=RegExp("^"+ex.call(tx).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var ix=function(e){return!(!Jy(e)||Ky(e))&&(Vy(e)?nx:Zy).test(Yy(e))},rx=function(e,t){return null==e?void 0:e[t]};var ox=function(e,t){var n=rx(e,t);return ix(n)?n:void 0},sx=ox,ax=function(){try{var e=sx(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var cx=My,lx=ax,ux=lx?function(e,t){return lx(e,"toString",{configurable:!0,enumerable:!1,value:cx(t),writable:!0})}:function(e){return e},px=ux,dx=Date.now;var fx=function(e){var t=0,n=0;return function(){var i=dx(),r=16-(i-n);if(n=i,r>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(px),hx=Ny,mx=Fy,gx=fx;var vx=function(e){return gx(mx(e,void 0,hx),e+"")},yx=ox(ry,"WeakMap");var xx=yx&&new yx,bx=xx?function(e){return xx.get(e)}:function(){},_x={},wx=Object.prototype.hasOwnProperty;var Ex=function(e){for(var t=e.name+"",n=_x[t],i=wx.call(_x,t)?n.length:0;i--;){var r=n[i],o=r.func;if(null==o||o==e)return r.name}return t},Sx=Jv,kx=Yv;function Rx(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}Rx.prototype=Sx(kx.prototype),Rx.prototype.constructor=Rx;var Tx=Rx;var Ox=function(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n<i;)t[n]=e[n];return t},Ax=Tx,Cx=ey,Px=Ox;var jx=Tx,Lx=ey,Nx=Yv,Ix=Ry,Dx=vy,Fx=function(e){if(e instanceof Ax)return e.clone();var t=new Cx(e.__wrapped__,e.__chain__);return t.__actions__=Px(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t},Mx=Object.prototype.hasOwnProperty;function $x(e){if(Dx(e)&&!Ix(e)&&!(e instanceof jx)){if(e instanceof Lx)return e;if(Mx.call(e,"__wrapped__"))return Fx(e)}return new Lx(e)}$x.prototype=Nx.prototype,$x.prototype.constructor=$x;var Bx=Tx,Ux=bx,zx=Ex,qx=$x;var Hx=ey,Wx=vx,Gx=bx,Vx=Ex,Kx=Ry,Jx=function(e){var t=zx(e),n=qx[t];if("function"!=typeof n||!(t in Bx.prototype))return!1;if(e===n)return!0;var i=Ux(n);return!!i&&e===i[0]};var Yx,Zx=function(e){return Wx((function(t){var n=t.length,i=n,r=Hx.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"==Vx(o))var s=new Hx([],!0)}for(i=s?i:n;++i<n;){o=t[i];var a=Vx(o),c="wrapper"==a?Gx(o):void 0;s=c&&Jx(c[0])&&424==c[1]&&!c[4].length&&1==c[9]?s[Vx(c[0])].apply(s,c[3]):1==o.length&&Jx(o)?s[a]():s.thru(o)}return function(){var e=arguments,i=e[0];if(s&&1==e.length&&Kx(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}}))};Zx(),function(e){e.EDIT="edit",e.PREVIEW="preview"}(Yx||(Yx={}));class Xx{diff(e,t,n={}){let i;"function"==typeof n?(i=n,n={}):"callback"in n&&(i=n.callback);const r=this.castInput(e,n),o=this.castInput(t,n),s=this.removeEmpty(this.tokenize(r,n)),a=this.removeEmpty(this.tokenize(o,n));return this.diffWithOptionsObj(s,a,n,i)}diffWithOptionsObj(e,t,n,i){var r;const o=e=>(e=this.postProcess(e,n),i?void setTimeout((function(){i(e)}),0):e),s=t.length,a=e.length;let c=1,l=s+a;null!=n.maxEditLength&&(l=Math.min(l,n.maxEditLength));const u=null!==(r=n.timeout)&&void 0!==r?r:1/0,p=Date.now()+u,d=[{oldPos:-1,lastComponent:void 0}];let f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=a&&f+1>=s)return o(this.buildValues(d[0].lastComponent,t,e));let h=-1/0,m=1/0;const g=()=>{for(let i=Math.max(h,-c);i<=Math.min(m,c);i+=2){let r;const c=d[i-1],l=d[i+1];c&&(d[i-1]=void 0);let u=!1;if(l){const e=l.oldPos-i;u=l&&0<=e&&e<s}const p=c&&c.oldPos+1<a;if(u||p){if(r=!p||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(r,t,e,i,n),r.oldPos+1>=a&&f+1>=s)return o(this.buildValues(r.lastComponent,t,e))||!0;d[i]=r,r.oldPos+1>=a&&(m=Math.min(m,i-1)),f+1>=s&&(h=Math.max(h,i+1))}else d[i]=void 0}c++};if(i)!function e(){setTimeout((function(){if(c>l||Date.now()>p)return i(void 0);g()||e()}),0)}();else for(;c<=l&&Date.now()<=p;){const e=g();if(e)return e}}addToPath(e,t,n,i,r){const o=e.lastComponent;return o&&!r.oneChangePerToken&&o.added===t&&o.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:t,removed:n,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:t,removed:n,previousComponent:o}}}extractCommon(e,t,n,i,r){const o=t.length,s=n.length;let a=e.oldPos,c=a-i,l=0;for(;c+1<o&&a+1<s&&this.equals(n[a+1],t[c+1],r);)c++,a++,l++,r.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!r.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=a,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){const t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){const i=[];let r;for(;e;)i.push(e),r=e.previousComponent,delete e.previousComponent,e=r;i.reverse();const o=i.length;let s=0,a=0,c=0;for(;s<o;s++){const e=i[s];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let i=t.slice(a,a+e.count);i=i.map((function(e,t){const i=n[c+t];return i.length>e.length?i:e})),e.value=this.join(i)}else e.value=this.join(t.slice(a,a+e.count));a+=e.count,e.added||(c+=e.count)}}return i}}function Qx(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,"\n"));const n=[],i=e.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let e=0;e<i.length;e++){const r=i[e];e%2&&!t.newlineIsToken?n[n.length-1]+=r:n.push(r)}return n}new class extends Xx{constructor(){super(...arguments),this.tokenize=Qx}equals(e,t,n){return n.ignoreWhitespace?(n.newlineIsToken&&e.includes("\n")||(e=e.trim()),n.newlineIsToken&&t.includes("\n")||(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith("\n")&&(e=e.slice(0,-1)),t.endsWith("\n")&&(t=t.slice(0,-1))),super.equals(e,t,n)}};const eb=e=>e.replace(/\s|\t/g,"").replace(/[;|,]$/,"").toLowerCase();new class extends Xx{constructor(){super(),this.tokenize=Qx}equals(e,t,n){const i=super.equals(e,t,n);return!i&&e.length>12&&t.length>12?((e,t)=>eb(e)===eb(t))(e,t):i}};for(var tb,nb,ib,rb,ob,sb,ab,cb,lb,ub,pb,db,fb,hb,mb,gb,vb,yb,xb,bb,_b,wb,Eb,Sb,kb,Rb,Tb,Ob,Ab,Cb,Pb,jb,Lb=0;Lb<4;Lb++)(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"}(tb||(tb={})),function(e){e.NOT_SUPPORT="statusBar.not.support.text",e.ENABLE="statusBar.enable.text",e.NO_SUGGESTIONS="statusBar.nosuggestions",e.TITLE="statusBar.title"}(nb||(nb={})),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"}(ib||(ib={})),function(e){e.EMPTY_TEXT="nl2code.empty.text",e.NO_SELECTION="nl2code.no.selection.text"}(rb||(rb={})),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"}(ob||(ob={})),function(e){e.EXPLAIN_SELECTED_CODE="explain.codeActions.title",e.OPTIMIZE_SELECTED_CODE="optimize.codeActions.title",e.INLINECHAT_SELECTED_CODE="inlinechat.codeActions.title"}(sb||(sb={})),function(e){e.CODELENS_TITLE="chatTrial.codelens.title"}(ab||(ab={})),function(e){e.CODELENS_TITLE="inlinechat.codelens.title"}(cb||(cb={})),function(e){e.CHAT_TIPS_TITLE="chatTips.selectedCode.title",e.CHAT_TIPS_CODE_BLANK_ROW_TITLE="chatTips.blankRow.title"}(lb||(lb={})),function(e){e.GENERATING_TITLE="decorations.generating.title",e.LINE_COMMENT_CODE_TRIGGER_TITLE="decorations.lineComent.trigger.title"}(ub||(ub={})),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"}(pb||(pb={})),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"}(db||(db={})),function(e){e.PROMPT="split.prompt",e.CODELENS_TITLE="split.codelens.title",e.CODELENS_TOOLTIP="split.codelens.tooltip",e.GENERATE_ERROR="split.generate.error"}(fb||(fb={})),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"}(hb||(hb={})),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"}(mb||(mb={})),function(e){e.PROMPT="inlineLog.prompt",e.CODELENS_TITLE="inlineLog.codelens.title",e.CODELENS_TOOLTIP="inlineLog.codelens.tooltip",e.GENERATE_ERROR="inlineLog.generate.error"}(gb||(gb={})),function(e){e.TITLE="diff.title",e.ACCEPT="diff.accept",e.REJECT="diff.reject",e.OPEN_DUAL_SCREEN_DIFF="diff.dualScreenDiff.open"}(vb||(vb={})),function(e){e.WEBVIEW_TITLE="chat.webview.title",e.NO_INSERT_POSITION="chat.no.insertPosition.text"}(yb||(yb={})),function(e){e.PATH_ERROR="accept.path.error"}(xb||(xb={})),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"}(bb||(bb={})),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"}(_b||(_b={})),function(e){e.TOOLTIP="regexHover.tooltip",e.PROMPT="regexHover.prompt"}(wb||(wb={})),function(e){e.MAXIMUM_FILES="embeddings.maximum.files.message",e.PROGRESS="embeddings.progress.message",e.PROGRESS_TOOLTIP="embeddings.progress.tooltip.message"}(Eb||(Eb={})),function(e){e.TITLE="openPlatform.title.text",e.WEBVIEW_TITLE="openPlatform.webview.title"}(Sb||(Sb={})),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"}(kb||(kb={})),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"}(Rb||(Rb={})),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"}(Tb||(Tb={})),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"}(Ob||(Ob={})),function(e){e.GENERATE_ERROR="kernel.zulu.error"}(Ab||(Ab={})),function(e){e.DEVELOPMENT="development",e.PRODUCTION="production",e.TEST="test"}(Cb||(Cb={})),function(e){e.SAAS="saas",e.INTERNAL="internal",e.POC="poc"}(Pb||(Pb={})),function(e){e.VSCode="vscode",e.JetBrains="jetbrains",e.VS="vs",e.Xcode="xcode",e.Eclipse="eclipse",e.ComateLocal="comate-local",e.Web="web"}(jb||(jb={}));const Nb="kernel/extensionConfig/fetch";class Ib{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 T(t);return{proxy:t,agent:new S.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),s=process.env.HTTP_HOST;let a=this.url,c=!0;if(s){const e=new T(this.url),t=new T(s);a=`${t.protocol}//${t.host}${e.pathname}${e.search}`,c="https:"===t.protocol}else c="https:"===new T(this.url).protocol;return new Promise((n=>{let s;if(r){const o=new T(r),c=new T(a),l={hostname:o.hostname,port:o.port||("https:"===o.protocol?443:80),path:a,method:"GET",timeout:e,headers:{Host:c.hostname,"User-Agent":"Comate-Ping/1.0"}};if(o.username&&o.password){const e=Buffer.from(`${o.username}:${o.password}`).toString("base64");l.headers["Proxy-Authorization"]=`Basic ${e}`}s=S.request(l,(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=(c?k:S).request(a,{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 T(e);return new Promise((e=>{const n=S.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 Db,Fb="0.3.0";function Mb(){try{const e="win32"===process.platform,n=m(e?"where rg":"which rg",{encoding:"utf8",stdio:"pipe"}).trim(),i=e?n.split("\n")[0]:n;if(i&&t(i))return i}catch(e){Me("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 y(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 h(t,n,i,r,o)}static parse(e,t=!1){const n=p.exec(e);return n?new h(n[2]||l,w(n[4]||l),w(n[5]||l),w(n[7]||l),w(n[9]||l),t):new h(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 h("file",t,e,l,l)}static from(e){const t=new h(e.scheme,e.authority,e.path,e.query,e.fragment);return c(t,!0),t}toString(e=!1){return x(this,e)}toJSON(){return this}static revive(e){if(e){if(e instanceof d)return e;{const t=new h(e);return t._formatted=e.external,t._fsPath=e._sep===f?e.fsPath:null,t}}return e}}const f=r?1:void 0;class h extends d{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=y(this)),this._fsPath}toString(e=!1){return e?x(this,!0):(this._formatted||(this._formatted=x(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 m={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=m[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+=m[i]):void 0!==t&&(t+=e[n])}return void 0!==t?t:e}function y(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 x(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 b(e){try{return decodeURIComponent(e)}catch{return e.length>3?e.substr(0,3)+b(e.substr(3)):e}}const _=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function w(e){return e.match(_)?e.replace(_,(e=>b(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={})),Db=i})();const{URI:$b,Utils:Bb}=Db;var Ub,zb,qb={},Hb={},Wb={},Gb={},Vb={};function Kb(){if(Ub)return Vb;function e(e){return"string"==typeof e||e instanceof String}function t(e){return Array.isArray(e)}return Ub=1,Object.defineProperty(Vb,"__esModule",{value:!0}),Vb.stringArray=Vb.array=Vb.func=Vb.error=Vb.number=Vb.string=Vb.boolean=void 0,Vb.boolean=function(e){return!0===e||!1===e},Vb.string=e,Vb.number=function(e){return"number"==typeof e||e instanceof Number},Vb.error=function(e){return e instanceof Error},Vb.func=function(e){return"function"==typeof e},Vb.array=t,Vb.stringArray=function(n){return t(n)&&n.every((t=>e(t)))},Vb}function Jb(){if(zb)return Gb;zb=1,Object.defineProperty(Gb,"__esModule",{value:!0}),Gb.Message=Gb.NotificationType9=Gb.NotificationType8=Gb.NotificationType7=Gb.NotificationType6=Gb.NotificationType5=Gb.NotificationType4=Gb.NotificationType3=Gb.NotificationType2=Gb.NotificationType1=Gb.NotificationType0=Gb.NotificationType=Gb.RequestType9=Gb.RequestType8=Gb.RequestType7=Gb.RequestType6=Gb.RequestType5=Gb.RequestType4=Gb.RequestType3=Gb.RequestType2=Gb.RequestType1=Gb.RequestType=Gb.RequestType0=Gb.AbstractMessageSignature=Gb.ParameterStructures=Gb.ResponseError=Gb.ErrorCodes=void 0;const e=Kb();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||(Gb.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}}Gb.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}}Gb.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}}Gb.AbstractMessageSignature=o;Gb.RequestType0=class extends o{constructor(e){super(e,0)}};Gb.RequestType=class extends o{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Gb.RequestType1=class extends o{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Gb.RequestType2=class extends o{constructor(e){super(e,2)}};Gb.RequestType3=class extends o{constructor(e){super(e,3)}};Gb.RequestType4=class extends o{constructor(e){super(e,4)}};Gb.RequestType5=class extends o{constructor(e){super(e,5)}};Gb.RequestType6=class extends o{constructor(e){super(e,6)}};Gb.RequestType7=class extends o{constructor(e){super(e,7)}};Gb.RequestType8=class extends o{constructor(e){super(e,8)}};Gb.RequestType9=class extends o{constructor(e){super(e,9)}};Gb.NotificationType=class extends o{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Gb.NotificationType0=class extends o{constructor(e){super(e,0)}};Gb.NotificationType1=class extends o{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Gb.NotificationType2=class extends o{constructor(e){super(e,2)}};Gb.NotificationType3=class extends o{constructor(e){super(e,3)}};Gb.NotificationType4=class extends o{constructor(e){super(e,4)}};Gb.NotificationType5=class extends o{constructor(e){super(e,5)}};Gb.NotificationType6=class extends o{constructor(e){super(e,6)}};Gb.NotificationType7=class extends o{constructor(e){super(e,7)}};Gb.NotificationType8=class extends o{constructor(e){super(e,8)}};return Gb.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||(Gb.Message=n={})),Gb}var Yb,Zb={};function Xb(){if(Yb)return Zb;var e,t;Yb=1,Object.defineProperty(Zb,"__esModule",{value:!0}),Zb.LRUCache=Zb.LinkedMap=Zb.Touch=void 0,function(e){e.None=0,e.First=1,e.AsOld=e.First,e.Last=2,e.AsNew=e.Last}(t||(Zb.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)}}Zb.LinkedMap=n;return Zb.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))}},Zb}var Qb,e_={};var t_,n_,i_={},r_={};function o_(){if(t_)return r_;let e;function t(){if(void 0===e)throw new Error("No runtime abstraction layer installed");return e}return t_=1,Object.defineProperty(r_,"__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={})),r_.default=t,r_}function s_(){if(n_)return i_;n_=1,Object.defineProperty(i_,"__esModule",{value:!0}),i_.Emitter=i_.Event=void 0;const e=o_();var t;!function(e){const t={dispose(){}};e.None=function(){return t}}(t||(i_.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 i_.Emitter=i,i._noop=function(){},i_}var a_,c_={};function l_(){if(a_)return c_;a_=1,Object.defineProperty(c_,"__esModule",{value:!0}),c_.CancellationTokenSource=c_.CancellationToken=void 0;const e=o_(),t=Kb(),n=s_();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||(c_.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 c_.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}},c_}var u_,p_={};var d_,f_,h_={},m_={};function g_(){if(d_)return m_;d_=1,Object.defineProperty(m_,"__esModule",{value:!0}),m_.Semaphore=void 0;const e=o_();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 v_,y_={};var x_,b_={};var __,w_,E_={};function S_(){return __||(__=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=o_(),n=Kb(),i=Jb(),r=Xb(),o=s_(),s=l_();var a,c,l,u,p,d,f,h,m,g,v,y,x,b,_,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")}(h||(e.SetTraceNotification=h={})),function(e){e.type=new i.NotificationType("$/logTrace")}(m||(e.LogTraceNotification=m={})),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))}}(y||(e.IdCancellationReceiverStrategy=y={})),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))}}(x||(e.RequestCancellationReceiverStrategy=x={})),function(e){e.Message=Object.freeze({createCancellationTokenSource:e=>new s.CancellationTokenSource}),e.is=function(e){return y.is(e)||x.is(e)}}(b||(e.CancellationReceiverStrategy=b={})),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:b.Message,sender:_.Message}),e.is=function(e){const t=e;return t&&b.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,x,b){const _=void 0!==x?x:e.NullLogger;let S=0,T=0,O=0;const A="2.0";let C;const P=new Map;let j;const L=new Map,N=new Map;let I,D,F=new r.LinkedMap,M=new Map,$=new Set,B=new Map,U=p.Off,z=f.Text,q=k.New;const H=new o.Emitter,W=new o.Emitter,G=new o.Emitter,V=new o.Emitter,K=new o.Emitter,J=b&&b.cancellationStrategy?b.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 q===k.Listening}function ee(){return q===k.Closed}function te(){return q===k.Disposed}function ne(){q!==k.New&&q!==k.Listening||(q=k.Closed,W.fire(void 0))}function ie(){I||0===F.size||(I=(0,t.default)().timer.setImmediate((()=>{I=void 0,function(){if(0===F.size)return;const e=F.shift();try{const t=b?.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:A,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:A,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:A,id:e.id,result:t};ae(r,n,i),v.write(r).catch((()=>_.error("Sending response failed.")))}!function(e){if(U===p.Off||!D)return;if(z===f.Text){let t;U!==p.Verbose&&U!==p.Compact||!e.params||(t=`Params: ${se(e.params)}\n\n`),D.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||C){const s=e.id??String(Date.now()),u=y.is(J.receiver)?J.receiver.createCancellationTokenSource(s):J.receiver.createCancellationTokenSource(e);null!==e.id&&$.has(e.id)&&u.cancel(),null!==e.id&&B.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 C&&(p=C(e.method,e.params,u.token));const d=p;p?d.then?d.then((n=>{B.delete(s),t(n,e.method,l)}),(t=>{B.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)})):(B.delete(s),t(p,e.method,l)):(B.delete(s),o(p,e.method,l))}catch(o){B.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 $.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(U===p.Off||!D)return;if(z===f.Text){let n;if(U!==p.Verbose&&U!==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}).`:"";D.log(`Received response '${t.method} - (${e.id})' in ${Date.now()-t.timerStart}ms.${i}`,n)}else D.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=F.get(n);if(i.Message.isRequest(r)){const i=b?.connectionStrategy,o=i&&i.cancelUndispatched?i.cancelUndispatched(r,X):void 0;if(o&&(void 0!==o.error||void 0!==o.result))return F.delete(n),B.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=B.get(t);if(void 0!==o)return o.cancel(),void ce(e);$.add(t)}Z(F,e)}finally{ie()}};function se(e){if(null!=e)switch(U){case p.Verbose:return JSON.stringify(e,null,4);case p.Compact:return JSON.stringify(e);default:return}}function ae(e,t,n){if(U!==p.Off&&D)if(z===f.Text){let i;U!==p.Verbose&&U!==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")),D.log(`Sending response '${t} - (${e.id})'. Processing request took ${Date.now()-n}ms`,i)}else le("send-response",e)}function ce(e){if(U!==p.Off&&D&&e.method!==m.type.method)if(z===f.Text){let t;U!==p.Verbose&&U!==p.Compact||(t=e.params?`Params: ${se(e.params)}\n\n`:"No parameters provided.\n\n"),D.log(`Received notification '${e.method}'.`,t)}else le("receive-notification",e)}function le(e,t){if(!D||U===p.Off)return;const n={isLSPMessage:!0,type:e,message:t,timestamp:Date.now()};D.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 he(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 me(e,t){let n;const i=e.numberOfParams;switch(i){case 0:n=void 0;break;case 1:n=he(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=he(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=me(e,n)}const s={jsonrpc:A,method:r,params:o};return function(e){if(U!==p.Off&&D)if(z===f.Text){let t;U!==p.Verbose&&U!==p.Compact||(t=e.params?`Params: ${se(e.params)}\n\n`:"No parameters provided.\n\n"),D.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=he(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=me(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:A,id:c,method:r,params:o};return function(e){if(U!==p.Off&&D)if(z===f.Text){let t;U!==p.Verbose&&U!==p.Compact||!e.params||(t=`Params: ${se(e.params)}\n\n`),D.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,C=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):C=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)),U=e,z=o,D=U===p.Off?void 0:t,!r||ee()||te()||await ge.sendNotification(h.type,{value:p.toString(e)})},onError:H.event,onClose:W.event,onUnhandledNotification:G.event,onDispose:K.event,end:()=>{v.end()},dispose:()=>{if(te())return;q=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,B=new Map,$=new Set,F=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")}(),q=k.Listening,d.listen(oe)},inspect:()=>{(0,t.default)().console.log("inspect")}};return ge.onNotification(m.type,(e=>{if(U===p.Off||!D)return;const t=U===p.Verbose||U===p.Compact;D.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}}(E_)),E_}function k_(){return w_||(w_=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=Jb();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=Xb();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=(Qb||(Qb=1,Object.defineProperty(e_,"__esModule",{value:!0}),e_.Disposable=void 0,function(e){e.create=function(e){return{dispose:e}}}(r||(e_.Disposable=r={}))),e_);var r;Object.defineProperty(e,"Disposable",{enumerable:!0,get:function(){return i.Disposable}});const o=s_();Object.defineProperty(e,"Event",{enumerable:!0,get:function(){return o.Event}}),Object.defineProperty(e,"Emitter",{enumerable:!0,get:function(){return o.Emitter}});const s=l_();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(u_)return p_;u_=1,Object.defineProperty(p_,"__esModule",{value:!0}),p_.SharedArrayReceiverStrategy=p_.SharedArraySenderStrategy=void 0;const e=l_();var t;!function(e){e.Continue=0,e.Cancelled=1}(t||(t={})),p_.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 p_.SharedArrayReceiverStrategy=class{constructor(){this.kind="request"}createCancellationTokenSource(t){const n=t.$cancellationData;return void 0===n?new e.CancellationTokenSource:new i(n)}},p_}();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(f_)return h_;f_=1,Object.defineProperty(h_,"__esModule",{value:!0}),h_.ReadableStreamMessageReader=h_.AbstractMessageReader=h_.MessageReader=void 0;const e=o_(),t=Kb(),n=s_(),i=g_();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||(h_.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 h_.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={})),h_.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))}},h_}();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(v_)return y_;v_=1,Object.defineProperty(y_,"__esModule",{value:!0}),y_.WriteableStreamMessageWriter=y_.AbstractMessageWriter=y_.MessageWriter=void 0;const e=o_(),t=Kb(),n=g_(),i=s_();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||(y_.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 y_.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={})),y_.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()}},y_}();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=S_();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=o_();e.RAL=d.default}(Wb)),Wb}Object.defineProperty(Hb,"__esModule",{value:!0});const R_=b,T_=k_();class O_ extends T_.AbstractMessageBuffer{constructor(e="utf-8"){super(e)}emptyBuffer(){return O_.emptyBuffer}fromString(e,t){return Buffer.from(e,t)}toString(e,t){return e instanceof Buffer?e.toString(t):new R_.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)}}O_.emptyBuffer=Buffer.allocUnsafe(0);class A_{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),T_.Disposable.create((()=>this.stream.off("close",e)))}onError(e){return this.stream.on("error",e),T_.Disposable.create((()=>this.stream.off("error",e)))}onEnd(e){return this.stream.on("end",e),T_.Disposable.create((()=>this.stream.off("end",e)))}onData(e){return this.stream.on("data",e),T_.Disposable.create((()=>this.stream.off("data",e)))}}class C_{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),T_.Disposable.create((()=>this.stream.off("close",e)))}onError(e){return this.stream.on("error",e),T_.Disposable.create((()=>this.stream.off("error",e)))}onEnd(e){return this.stream.on("end",e),T_.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 P_=Object.freeze({messageBuffer:Object.freeze({create:e=>new O_(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 R_.TextDecoder(t.charset).decode(e)))}catch(e){return Promise.reject(e)}}})}),stream:Object.freeze({asReadableStream:e=>new A_(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 j_(){return P_}!function(e){e.install=function(){T_.RAL.install(P_)}}(j_||(j_={})),Hb.default=j_,function(e){var t=Be&&Be.__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=Be&&Be.__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=Hb;i.default.install();const r=d,o=E,s=O,a=I,c=k_();n(k_(),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 p 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=p;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 h extends c.ReadableStreamMessageReader{constructor(e,t="utf-8"){super((0,i.default)().stream.asReadableStream(e),t)}}e.SocketMessageReader=h;class m 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=m;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 y=process.env.XDG_RUNTIME_DIR,x=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=y?r.join(y,`vscode-ipc-${e}.sock`):r.join(o.tmpdir(),`vscode-${e}.sock`);const n=x.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 h(e,t),new m(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 h(n,t),new m(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 h(e,t),new m(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 h(n,t),new m(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)}}(qb);var L_=qb;const 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,enableTerminalAutoExecution:!0,terminalAutoExecutionDenyList:[],terminalAutoExecutionAllowList:[],zuluConfig:{enableTerminalAutoExecution:!0,terminalAutoExecutionDenyList:[],terminalAutoExecutionAllowList:[]}},I_=a(N(import.meta.url));class D_{cwd;shell="bin/bash";license;username;ideSeries;ideVersion;ideName;platform;deviceId;pluginVersion;httpProxy;ripgrepPath;extensionConfig=N_;queryDelay;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,this.queryDelay=e.queryDelay}async start(){const e=await this.engineExec(),t=new L_.StreamMessageReader(e.stdout),n=new L_.StreamMessageWriter(e.stdin);this.client=L_.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:Cb.PRODUCTION,extensionVersion:this.pluginVersion,platform:this.platform,themeColor:"dark",ideTerminalInfo:{defaultShell:this.shell}}}))),this.client.onRequest(Nb,(async()=>(Me("KERNEL CLIENT REC <--------",Nb),{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(),Me("LSP Client started")}async sendRequest(e,t){if(Me("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:$b.file(this.cwd).toString(),capabilities:{workspace:{workspaceFolders:!0,configuration:!0},textDocument:{synchronization:{dynamicRegistration:!1,willSave:!1,willSaveWaitUntil:!1,didSave:!1}}},initializationOptions:{},workspaceFolders:[{uri:$b.file(this.cwd).toString(),name:"workspace"}]};try{Me("Sending initialize request...");Me("Initialize response:",await this.client.sendRequest("initialize",e)),Me("Sending initialized notification..."),this.client.sendNotification("initialized",{}),Me("LSP initialization completed")}catch(e){throw console.error("LSP initialization failed:",e),e}}setupLogHandlers(){this.client&&(this.client.onNotification("window/logMessage",(e=>{Me(e)})),this.client.onNotification("window/showMessage",(e=>{Me(e)})),this.client.onRequest("window/showMessageRequest",(e=>(Me(e),e.actions?.[0]||null))),this.client.onNotification("comate/log",(e=>{Me(e)})),this.client.onNotification("$/progress",(e=>{Me(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",ZULU_TIMEOUT:String(this.queryDelay)}},t=c(I_,"../../comate-engine/bin/comate.js");return g(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()}}}function F_(e,t,n,i){const r={data:{type:e,status:t,message:n,...i}};console.log(JSON.stringify(r,null,2))}function M_(e,t){return function(){return e.apply(t,arguments)}}const{toString:$_}=Object.prototype,{getPrototypeOf:B_}=Object,{iterator:U_,toStringTag:z_}=Symbol,q_=(e=>t=>{const n=$_.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),H_=e=>(e=e.toLowerCase(),t=>q_(t)===e),W_=e=>t=>typeof t===e,{isArray:G_}=Array,V_=W_("undefined");function K_(e){return null!==e&&!V_(e)&&null!==e.constructor&&!V_(e.constructor)&&Z_(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const J_=H_("ArrayBuffer");const Y_=W_("string"),Z_=W_("function"),X_=W_("number"),Q_=e=>null!==e&&"object"==typeof e,ew=e=>{if("object"!==q_(e))return!1;const t=B_(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||z_ in e||U_ in e)},tw=H_("Date"),nw=H_("File"),iw=H_("Blob"),rw=H_("FileList"),ow=H_("URLSearchParams"),[sw,aw,cw,lw]=["ReadableStream","Request","Response","Headers"].map(H_);function uw(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let i,r;if("object"!=typeof e&&(e=[e]),G_(e))for(i=0,r=e.length;i<r;i++)t.call(null,e[i],i,e);else{if(K_(e))return;const r=n?Object.getOwnPropertyNames(e):Object.keys(e),o=r.length;let s;for(i=0;i<o;i++)s=r[i],t.call(null,e[s],s,e)}}function pw(e,t){if(K_(e))return null;t=t.toLowerCase();const n=Object.keys(e);let i,r=n.length;for(;r-- >0;)if(i=n[r],t===i.toLowerCase())return i;return null}const dw="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,fw=e=>!V_(e)&&e!==dw;const hw=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&B_(Uint8Array)),mw=H_("HTMLFormElement"),gw=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),vw=H_("RegExp"),yw=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),i={};uw(n,((n,r)=>{let o;!1!==(o=t(n,r,e))&&(i[r]=o||n)})),Object.defineProperties(e,i)};const xw=H_("AsyncFunction"),bw=((e,t)=>e?setImmediate:t?((e,t)=>(dw.addEventListener("message",(({source:n,data:i})=>{n===dw&&i===e&&t.length&&t.shift()()}),!1),n=>{t.push(n),dw.postMessage(e,"*")}))(`axios@${Math.random()}`,[]):e=>setTimeout(e))("function"==typeof setImmediate,Z_(dw.postMessage)),_w="undefined"!=typeof queueMicrotask?queueMicrotask.bind(dw):"undefined"!=typeof process&&process.nextTick||bw;var ww={isArray:G_,isArrayBuffer:J_,isBuffer:K_,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Z_(e.append)&&("formdata"===(t=q_(e))||"object"===t&&Z_(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&J_(e.buffer),t},isString:Y_,isNumber:X_,isBoolean:e=>!0===e||!1===e,isObject:Q_,isPlainObject:ew,isEmptyObject:e=>{if(!Q_(e)||K_(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:sw,isRequest:aw,isResponse:cw,isHeaders:lw,isUndefined:V_,isDate:tw,isFile:nw,isBlob:iw,isRegExp:vw,isFunction:Z_,isStream:e=>Q_(e)&&Z_(e.pipe),isURLSearchParams:ow,isTypedArray:hw,isFileList:rw,forEach:uw,merge:function e(){const{caseless:t}=fw(this)&&this||{},n={},i=(i,r)=>{const o=t&&pw(n,r)||r;ew(n[o])&&ew(i)?n[o]=e(n[o],i):ew(i)?n[o]=e({},i):G_(i)?n[o]=i.slice():n[o]=i};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&uw(arguments[e],i);return n},extend:(e,t,n,{allOwnKeys:i}={})=>(uw(t,((t,i)=>{n&&Z_(t)?e[i]=M_(t,n):e[i]=t}),{allOwnKeys:i}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,i)=>{let r,o,s;const a={};if(t=t||{},null==e)return t;do{for(r=Object.getOwnPropertyNames(e),o=r.length;o-- >0;)s=r[o],i&&!i(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==n&&B_(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:q_,kindOfTest:H_,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const i=e.indexOf(t,n);return-1!==i&&i===n},toArray:e=>{if(!e)return null;if(G_(e))return e;let t=e.length;if(!X_(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[U_]).call(e);let i;for(;(i=n.next())&&!i.done;){const n=i.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const i=[];for(;null!==(n=e.exec(t));)i.push(n);return i},isHTMLForm:mw,hasOwnProperty:gw,hasOwnProp:gw,reduceDescriptors:yw,freezeMethods:e=>{yw(e,((t,n)=>{if(Z_(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const i=e[n];Z_(i)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(e,t)=>{const n={},i=e=>{e.forEach((e=>{n[e]=!0}))};return G_(e)?i(e):i(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:pw,global:dw,isContextDefined:fw,isSpecCompliantForm:function(e){return!!(e&&Z_(e.append)&&"FormData"===e[z_]&&e[U_])},toJSONObject:e=>{const t=new Array(10),n=(e,i)=>{if(Q_(e)){if(t.indexOf(e)>=0)return;if(K_(e))return e;if(!("toJSON"in e)){t[i]=e;const r=G_(e)?[]:{};return uw(e,((e,t)=>{const o=n(e,i+1);!V_(o)&&(r[t]=o)})),t[i]=void 0,r}}return e};return n(e,0)},isAsyncFn:xw,isThenable:e=>e&&(Q_(e)||Z_(e))&&Z_(e.then)&&Z_(e.catch),setImmediate:bw,asap:_w,isIterable:e=>null!=e&&Z_(e[U_])};function Ew(e,t,n,i,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),i&&(this.request=i),r&&(this.response=r,this.status=r.status?r.status:null)}ww.inherits(Ew,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ww.toJSONObject(this.config),code:this.code,status:this.status}}});const Sw=Ew.prototype,kw={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{kw[e]={value:e}})),Object.defineProperties(Ew,kw),Object.defineProperty(Sw,"isAxiosError",{value:!0}),Ew.from=(e,t,n,i,r,o)=>{const s=Object.create(Sw);return ww.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),Ew.call(s,e.message,t,n,i,r),s.cause=e,s.name=e.name,o&&Object.assign(s,o),s};var Rw,Tw,Ow=Object,Aw=Error,Cw=EvalError,Pw=RangeError,jw=ReferenceError,Lw=SyntaxError;function Nw(){return Tw?Rw:(Tw=1,Rw=TypeError)}var Iw=URIError,Dw=Math.abs,Fw=Math.floor,Mw=Math.max,$w=Math.min,Bw=Math.pow,Uw=Math.round,zw=Number.isNaN||function(e){return e!=e},qw=Object.getOwnPropertyDescriptor;if(qw)try{qw([],"length")}catch(e){qw=null}var Hw=qw,Ww=Object.defineProperty||!1;if(Ww)try{Ww({},"a",{value:1})}catch(e){Ww=!1}var Gw,Vw,Kw,Jw,Yw,Zw,Xw,Qw,eE=Ww;function tE(){return Vw?Gw:(Vw=1,Gw=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),n=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(var i in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0})}function nE(){return Zw?Yw:(Zw=1,Yw="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null)}function iE(){return Qw?Xw:(Qw=1,Xw=Ow.getPrototypeOf||null)}var rE,oE,sE,aE,cE,lE,uE,pE,dE,fE,hE,mE,gE,vE,yE,xE,bE,_E,wE=Object.prototype.toString,EE=Math.max,SE=function(e,t){for(var n=[],i=0;i<e.length;i+=1)n[i]=e[i];for(var r=0;r<t.length;r+=1)n[r+e.length]=t[r];return n},kE=function(e){var t=this;if("function"!=typeof t||"[object Function]"!==wE.apply(t))throw new TypeError("Function.prototype.bind called on incompatible "+t);for(var n,i=function(e,t){for(var n=[],i=t,r=0;i<e.length;i+=1,r+=1)n[r]=e[i];return n}(arguments,1),r=EE(0,t.length-i.length),o=[],s=0;s<r;s++)o[s]="$"+s;if(n=Function("binder","return function ("+function(e,t){for(var n="",i=0;i<e.length;i+=1)n+=e[i],i+1<e.length&&(n+=t);return n}(o,",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof n){var r=t.apply(this,SE(i,arguments));return Object(r)===r?r:this}return t.apply(e,SE(i,arguments))})),t.prototype){var a=function(){};a.prototype=t.prototype,n.prototype=new a,a.prototype=null}return n},RE=Function.prototype.bind||kE;function TE(){return oE?rE:(oE=1,rE=Function.prototype.call)}function OE(){if(pE)return uE;pE=1;var e=RE,t=aE?sE:(aE=1,sE=Function.prototype.apply),n=TE(),i=lE?cE:(lE=1,cE="undefined"!=typeof Reflect&&Reflect&&Reflect.apply);return uE=i||e.call(n,t)}function AE(){if(mE)return hE;mE=1;var e,t=function(){if(fE)return dE;fE=1;var e=RE,t=Nw(),n=TE(),i=OE();return dE=function(r){if(r.length<1||"function"!=typeof r[0])throw new t("a function is required");return i(e,n,r)}}(),n=Hw;try{e=[].__proto__===Array.prototype}catch(e){if(!e||"object"!=typeof e||!("code"in e)||"ERR_PROTO_ACCESS"!==e.code)throw e}var i=!!e&&n&&n(Object.prototype,"__proto__"),r=Object,o=r.getPrototypeOf;return hE=i&&"function"==typeof i.get?t([i.get]):"function"==typeof o&&function(e){return o(null==e?e:r(e))}}var CE,PE=Function.prototype.call,jE=Object.prototype.hasOwnProperty,LE=RE.call(PE,jE),NE=Ow,IE=Aw,DE=Cw,FE=Pw,ME=jw,$E=Lw,BE=Nw(),UE=Iw,zE=Dw,qE=Fw,HE=Mw,WE=$w,GE=Bw,VE=Uw,KE=function(e){return zw(e)||0===e?e:e<0?-1:1},JE=Function,YE=function(e){try{return JE('"use strict"; return ('+e+").constructor;")()}catch(e){}},ZE=Hw,XE=eE,QE=function(){throw new BE},eS=ZE?function(){try{return QE}catch(e){try{return ZE(arguments,"callee").get}catch(e){return QE}}}():QE,tS=function(){if(Jw)return Kw;Jw=1;var e="undefined"!=typeof Symbol&&Symbol,t=tE();return Kw=function(){return"function"==typeof e&&("function"==typeof Symbol&&("symbol"==typeof e("foo")&&("symbol"==typeof Symbol("bar")&&t())))}}()(),nS=function(){if(vE)return gE;vE=1;var e=nE(),t=iE(),n=AE();return gE=e?function(t){return e(t)}:t?function(e){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new TypeError("getProto: not an object");return t(e)}:n?function(e){return n(e)}:null}(),iS=iE(),rS=nE(),oS=xE?yE:(xE=1,yE=Function.prototype.apply),sS=_E?bE:(_E=1,bE=Function.prototype.call),aS={},cS="undefined"!=typeof Uint8Array&&nS?nS(Uint8Array):CE,lS={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?CE:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?CE:ArrayBuffer,"%ArrayIteratorPrototype%":tS&&nS?nS([][Symbol.iterator]()):CE,"%AsyncFromSyncIteratorPrototype%":CE,"%AsyncFunction%":aS,"%AsyncGenerator%":aS,"%AsyncGeneratorFunction%":aS,"%AsyncIteratorPrototype%":aS,"%Atomics%":"undefined"==typeof Atomics?CE:Atomics,"%BigInt%":"undefined"==typeof BigInt?CE:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?CE:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?CE:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?CE:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":IE,"%eval%":eval,"%EvalError%":DE,"%Float16Array%":"undefined"==typeof Float16Array?CE:Float16Array,"%Float32Array%":"undefined"==typeof Float32Array?CE:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?CE:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?CE:FinalizationRegistry,"%Function%":JE,"%GeneratorFunction%":aS,"%Int8Array%":"undefined"==typeof Int8Array?CE:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?CE:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?CE:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":tS&&nS?nS(nS([][Symbol.iterator]())):CE,"%JSON%":"object"==typeof JSON?JSON:CE,"%Map%":"undefined"==typeof Map?CE:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&tS&&nS?nS((new Map)[Symbol.iterator]()):CE,"%Math%":Math,"%Number%":Number,"%Object%":NE,"%Object.getOwnPropertyDescriptor%":ZE,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?CE:Promise,"%Proxy%":"undefined"==typeof Proxy?CE:Proxy,"%RangeError%":FE,"%ReferenceError%":ME,"%Reflect%":"undefined"==typeof Reflect?CE:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?CE:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&tS&&nS?nS((new Set)[Symbol.iterator]()):CE,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?CE:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":tS&&nS?nS(""[Symbol.iterator]()):CE,"%Symbol%":tS?Symbol:CE,"%SyntaxError%":$E,"%ThrowTypeError%":eS,"%TypedArray%":cS,"%TypeError%":BE,"%Uint8Array%":"undefined"==typeof Uint8Array?CE:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?CE:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?CE:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?CE:Uint32Array,"%URIError%":UE,"%WeakMap%":"undefined"==typeof WeakMap?CE:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?CE:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?CE:WeakSet,"%Function.prototype.call%":sS,"%Function.prototype.apply%":oS,"%Object.defineProperty%":XE,"%Object.getPrototypeOf%":iS,"%Math.abs%":zE,"%Math.floor%":qE,"%Math.max%":HE,"%Math.min%":WE,"%Math.pow%":GE,"%Math.round%":VE,"%Math.sign%":KE,"%Reflect.getPrototypeOf%":rS};if(nS)try{null.error}catch(e){var uS=nS(nS(e));lS["%Error.prototype%"]=uS}var pS,dS,fS=function e(t){var n;if("%AsyncFunction%"===t)n=YE("async function () {}");else if("%GeneratorFunction%"===t)n=YE("function* () {}");else if("%AsyncGeneratorFunction%"===t)n=YE("async function* () {}");else if("%AsyncGenerator%"===t){var i=e("%AsyncGeneratorFunction%");i&&(n=i.prototype)}else if("%AsyncIteratorPrototype%"===t){var r=e("%AsyncGenerator%");r&&nS&&(n=nS(r.prototype))}return lS[t]=n,n},hS={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},mS=RE,gS=LE,vS=mS.call(sS,Array.prototype.concat),yS=mS.call(oS,Array.prototype.splice),xS=mS.call(sS,String.prototype.replace),bS=mS.call(sS,String.prototype.slice),_S=mS.call(sS,RegExp.prototype.exec),wS=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ES=/\\(\\)?/g,SS=function(e,t){var n,i=e;if(gS(hS,i)&&(i="%"+(n=hS[i])[0]+"%"),gS(lS,i)){var r=lS[i];if(r===aS&&(r=fS(i)),void 0===r&&!t)throw new BE("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:r}}throw new $E("intrinsic "+e+" does not exist!")};var kS=function(e,t){if("string"!=typeof e||0===e.length)throw new BE("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new BE('"allowMissing" argument must be a boolean');if(null===_S(/^%?[^%]*%?$/,e))throw new $E("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=function(e){var t=bS(e,0,1),n=bS(e,-1);if("%"===t&&"%"!==n)throw new $E("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==t)throw new $E("invalid intrinsic syntax, expected opening `%`");var i=[];return xS(e,wS,(function(e,t,n,r){i[i.length]=n?xS(r,ES,"$1"):t||e})),i}(e),i=n.length>0?n[0]:"",r=SS("%"+i+"%",t),o=r.name,s=r.value,a=!1,c=r.alias;c&&(i=c[0],yS(n,vS([0,1],c)));for(var l=1,u=!0;l<n.length;l+=1){var p=n[l],d=bS(p,0,1),f=bS(p,-1);if(('"'===d||"'"===d||"`"===d||'"'===f||"'"===f||"`"===f)&&d!==f)throw new $E("property names with quotes must have matching quotes");if("constructor"!==p&&u||(a=!0),gS(lS,o="%"+(i+="."+p)+"%"))s=lS[o];else if(null!=s){if(!(p in s)){if(!t)throw new BE("base intrinsic for "+e+" exists, but the property is not available.");return}if(ZE&&l+1>=n.length){var h=ZE(s,p);s=(u=!!h)&&"get"in h&&!("originalValue"in h.get)?h.get:s[p]}else u=gS(s,p),s=s[p];u&&!a&&(lS[o]=s)}}return s},RS=kS("%Object.defineProperty%",!0),TS=function(){if(dS)return pS;dS=1;var e=tE();return pS=function(){return e()&&!!Symbol.toStringTag}}()(),OS=LE,AS=Nw(),CS=TS?Symbol.toStringTag:null,PS=fo,jS=b,LS=d,NS=S,IS=k,DS=R.parse,FS=u,MS=y.Stream,$S=O,BS=mo,US=Bo,zS=function(e,t){var n=arguments.length>2&&!!arguments[2]&&arguments[2].force,i=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(void 0!==n&&"boolean"!=typeof n||void 0!==i&&"boolean"!=typeof i)throw new AS("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");!CS||!n&&OS(e,CS)||(RS?RS(e,CS,{configurable:!i,enumerable:!1,value:t,writable:!1}):e[CS]=t)},qS=LE,HS=function(e,t){return Object.keys(t).forEach((function(n){e[n]=e[n]||t[n]})),e};function WS(e){if(!(this instanceof WS))return new WS(e);for(var t in this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],PS.call(this),e=e||{})this[t]=e[t]}jS.inherits(WS,PS),WS.LINE_BREAK="\r\n",WS.DEFAULT_CONTENT_TYPE="application/octet-stream",WS.prototype.append=function(e,t,n){"string"==typeof(n=n||{})&&(n={filename:n});var i=PS.prototype.append.bind(this);if("number"!=typeof t&&null!=t||(t=String(t)),Array.isArray(t))this._error(new Error("Arrays are not supported."));else{var r=this._multiPartHeader(e,t,n),o=this._multiPartFooter();i(r),i(t),i(o),this._trackLength(r,t,n)}},WS.prototype._trackLength=function(e,t,n){var i=0;null!=n.knownLength?i+=Number(n.knownLength):Buffer.isBuffer(t)?i=t.length:"string"==typeof t&&(i=Buffer.byteLength(t)),this._valueLength+=i,this._overheadLength+=Buffer.byteLength(e)+WS.LINE_BREAK.length,t&&(t.path||t.readable&&qS(t,"httpVersion")||t instanceof MS)&&(n.knownLength||this._valuesToMeasure.push(t))},WS.prototype._lengthRetriever=function(e,t){qS(e,"fd")?null!=e.end&&e.end!=1/0&&null!=e.start?t(null,e.end+1-(e.start?e.start:0)):FS.stat(e.path,(function(n,i){if(n)t(n);else{var r=i.size-(e.start?e.start:0);t(null,r)}})):qS(e,"httpVersion")?t(null,Number(e.headers["content-length"])):qS(e,"httpModule")?(e.on("response",(function(n){e.pause(),t(null,Number(n.headers["content-length"]))})),e.resume()):t("Unknown stream")},WS.prototype._multiPartHeader=function(e,t,n){if("string"==typeof n.header)return n.header;var i,r=this._getContentDisposition(t,n),o=this._getContentType(t,n),s="",a={"Content-Disposition":["form-data",'name="'+e+'"'].concat(r||[]),"Content-Type":[].concat(o||[])};for(var c in"object"==typeof n.header&&HS(a,n.header),a)if(qS(a,c)){if(null==(i=a[c]))continue;Array.isArray(i)||(i=[i]),i.length&&(s+=c+": "+i.join("; ")+WS.LINE_BREAK)}return"--"+this.getBoundary()+WS.LINE_BREAK+s+WS.LINE_BREAK},WS.prototype._getContentDisposition=function(e,t){var n;if("string"==typeof t.filepath?n=LS.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e&&(e.name||e.path)?n=LS.basename(t.filename||e&&(e.name||e.path)):e&&e.readable&&qS(e,"httpVersion")&&(n=LS.basename(e.client._httpMessage.path||"")),n)return'filename="'+n+'"'},WS.prototype._getContentType=function(e,t){var n=t.contentType;return!n&&e&&e.name&&(n=BS.lookup(e.name)),!n&&e&&e.path&&(n=BS.lookup(e.path)),!n&&e&&e.readable&&qS(e,"httpVersion")&&(n=e.headers["content-type"]),n||!t.filepath&&!t.filename||(n=BS.lookup(t.filepath||t.filename)),!n&&e&&"object"==typeof e&&(n=WS.DEFAULT_CONTENT_TYPE),n},WS.prototype._multiPartFooter=function(){return function(e){var t=WS.LINE_BREAK;0===this._streams.length&&(t+=this._lastBoundary()),e(t)}.bind(this)},WS.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+WS.LINE_BREAK},WS.prototype.getHeaders=function(e){var t,n={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)qS(e,t)&&(n[t.toLowerCase()]=e[t]);return n},WS.prototype.setBoundary=function(e){if("string"!=typeof e)throw new TypeError("FormData boundary must be a string");this._boundary=e},WS.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary},WS.prototype.getBuffer=function(){for(var e=new Buffer.alloc(0),t=this.getBoundary(),n=0,i=this._streams.length;n<i;n++)"function"!=typeof this._streams[n]&&(e=Buffer.isBuffer(this._streams[n])?Buffer.concat([e,this._streams[n]]):Buffer.concat([e,Buffer.from(this._streams[n])]),"string"==typeof this._streams[n]&&this._streams[n].substring(2,t.length+2)===t||(e=Buffer.concat([e,Buffer.from(WS.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])},WS.prototype._generateBoundary=function(){this._boundary="--------------------------"+$S.randomBytes(12).toString("hex")},WS.prototype.getLengthSync=function(){var e=this._overheadLength+this._valueLength;return this._streams.length&&(e+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),e},WS.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e},WS.prototype.getLength=function(e){var t=this._overheadLength+this._valueLength;this._streams.length&&(t+=this._lastBoundary().length),this._valuesToMeasure.length?US.parallel(this._valuesToMeasure,this._lengthRetriever,(function(n,i){n?e(n):(i.forEach((function(e){t+=e})),e(null,t))})):process.nextTick(e.bind(this,null,t))},WS.prototype.submit=function(e,t){var n,i,r={method:"post"};return"string"==typeof e?(e=DS(e),i=HS({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},r)):(i=HS(e,r)).port||(i.port="https:"===i.protocol?443:80),i.headers=this.getHeaders(e.headers),n="https:"===i.protocol?IS.request(i):NS.request(i),this.getLength(function(e,i){if(e&&"Unknown stream"!==e)this._error(e);else if(i&&n.setHeader("Content-Length",i),this.pipe(n),t){var r,o=function(e,i){return n.removeListener("error",o),n.removeListener("response",r),t.call(this,e,i)};r=o.bind(this,null),n.on("error",o),n.on("response",r)}}.bind(this)),n},WS.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))},WS.prototype.toString=function(){return"[object FormData]"},zS(WS,"FormData");var GS=Ue(WS);function VS(e){return ww.isPlainObject(e)||ww.isArray(e)}function KS(e){return ww.endsWith(e,"[]")?e.slice(0,-2):e}function JS(e,t,n){return e?e.concat(t).map((function(e,t){return e=KS(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}const YS=ww.toFlatObject(ww,{},null,(function(e){return/^is[A-Z]/.test(e)}));function ZS(e,t,n){if(!ww.isObject(e))throw new TypeError("target must be an object");t=t||new(GS||FormData);const i=(n=ww.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!ww.isUndefined(t[e])}))).metaTokens,r=n.visitor||l,o=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&ww.isSpecCompliantForm(t);if(!ww.isFunction(r))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(ww.isDate(e))return e.toISOString();if(ww.isBoolean(e))return e.toString();if(!a&&ww.isBlob(e))throw new Ew("Blob is not supported. Use a Buffer instead.");return ww.isArrayBuffer(e)||ww.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,n,r){let a=e;if(e&&!r&&"object"==typeof e)if(ww.endsWith(n,"{}"))n=i?n:n.slice(0,-2),e=JSON.stringify(e);else if(ww.isArray(e)&&function(e){return ww.isArray(e)&&!e.some(VS)}(e)||(ww.isFileList(e)||ww.endsWith(n,"[]"))&&(a=ww.toArray(e)))return n=KS(n),a.forEach((function(e,i){!ww.isUndefined(e)&&null!==e&&t.append(!0===s?JS([n],i,o):null===s?n:n+"[]",c(e))})),!1;return!!VS(e)||(t.append(JS(r,n,o),c(e)),!1)}const u=[],p=Object.assign(YS,{defaultVisitor:l,convertValue:c,isVisitable:VS});if(!ww.isObject(e))throw new TypeError("data must be an object");return function e(n,i){if(!ww.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+i.join("."));u.push(n),ww.forEach(n,(function(n,o){!0===(!(ww.isUndefined(n)||null===n)&&r.call(t,n,ww.isString(o)?o.trim():o,i,p))&&e(n,i?i.concat(o):[o])})),u.pop()}}(e),t}function XS(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function QS(e,t){this._pairs=[],e&&ZS(e,this,t)}const ek=QS.prototype;function tk(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function nk(e,t,n){if(!t)return e;const i=n&&n.encode||tk;ww.isFunction(n)&&(n={serialize:n});const r=n&&n.serialize;let o;if(o=r?r(t,n):ww.isURLSearchParams(t)?t.toString():new QS(t,n).toString(i),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}ek.append=function(e,t){this._pairs.push([e,t])},ek.toString=function(e){const t=e?function(t){return e.call(this,t,XS)}:XS;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class ik{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){ww.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}var rk={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ok=R.URLSearchParams;const sk="abcdefghijklmnopqrstuvwxyz",ak="0123456789",ck={DIGIT:ak,ALPHA:sk,ALPHA_DIGIT:sk+sk.toUpperCase()+ak};var lk={isNode:!0,classes:{URLSearchParams:ok,FormData:GS,Blob:"undefined"!=typeof Blob&&Blob||null},ALPHABET:ck,generateString:(e=16,t=ck.ALPHA_DIGIT)=>{let n="";const{length:i}=t,r=new Uint32Array(e);O.randomFillSync(r);for(let o=0;o<e;o++)n+=t[r[o]%i];return n},protocols:["http","https","file","data"]};const uk="undefined"!=typeof window&&"undefined"!=typeof document,pk="object"==typeof navigator&&navigator||void 0,dk=uk&&(!pk||["ReactNative","NativeScript","NS"].indexOf(pk.product)<0),fk="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,hk=uk&&window.location.href||"http://localhost";var mk={...Object.freeze({__proto__:null,hasBrowserEnv:uk,hasStandardBrowserEnv:dk,hasStandardBrowserWebWorkerEnv:fk,navigator:pk,origin:hk}),...lk};function gk(e){function t(e,n,i,r){let o=e[r++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=r>=e.length;if(o=!o&&ww.isArray(i)?i.length:o,a)return ww.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!s;i[o]&&ww.isObject(i[o])||(i[o]=[]);return t(e,n,i[o],r)&&ww.isArray(i[o])&&(i[o]=function(e){const t={},n=Object.keys(e);let i;const r=n.length;let o;for(i=0;i<r;i++)o=n[i],t[o]=e[o];return t}(i[o])),!s}if(ww.isFormData(e)&&ww.isFunction(e.entries)){const n={};return ww.forEachEntry(e,((e,i)=>{t(function(e){return ww.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),i,n,0)})),n}return null}const vk={transitional:rk,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",i=n.indexOf("application/json")>-1,r=ww.isObject(e);r&&ww.isHTMLForm(e)&&(e=new FormData(e));if(ww.isFormData(e))return i?JSON.stringify(gk(e)):e;if(ww.isArrayBuffer(e)||ww.isBuffer(e)||ww.isStream(e)||ww.isFile(e)||ww.isBlob(e)||ww.isReadableStream(e))return e;if(ww.isArrayBufferView(e))return e.buffer;if(ww.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(r){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ZS(e,new mk.classes.URLSearchParams,{visitor:function(e,t,n,i){return mk.isNode&&ww.isBuffer(e)?(this.append(t,e.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=ww.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ZS(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return r||i?(t.setContentType("application/json",!1),function(e,t,n){if(ww.isString(e))try{return(t||JSON.parse)(e),ww.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||vk.transitional,n=t&&t.forcedJSONParsing,i="json"===this.responseType;if(ww.isResponse(e)||ww.isReadableStream(e))return e;if(e&&ww.isString(e)&&(n&&!this.responseType||i)){const n=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw Ew.from(e,Ew.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:mk.classes.FormData,Blob:mk.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ww.forEach(["delete","get","head","post","put","patch"],(e=>{vk.headers[e]={}}));const yk=ww.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const xk=Symbol("internals");function bk(e){return e&&String(e).trim().toLowerCase()}function _k(e){return!1===e||null==e?e:ww.isArray(e)?e.map(_k):String(e)}function wk(e,t,n,i,r){return ww.isFunction(i)?i.call(this,t,n):(r&&(t=n),ww.isString(t)?ww.isString(i)?-1!==t.indexOf(i):ww.isRegExp(i)?i.test(t):void 0:void 0)}let Ek=class{constructor(e){e&&this.set(e)}set(e,t,n){const i=this;function r(e,t,n){const r=bk(t);if(!r)throw new Error("header name must be a non-empty string");const o=ww.findKey(i,r);(!o||void 0===i[o]||!0===n||void 0===n&&!1!==i[o])&&(i[o||t]=_k(e))}const o=(e,t)=>ww.forEach(e,((e,n)=>r(e,n,t)));if(ww.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(ww.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let n,i,r;return e&&e.split("\n").forEach((function(e){r=e.indexOf(":"),n=e.substring(0,r).trim().toLowerCase(),i=e.substring(r+1).trim(),!n||t[n]&&yk[n]||("set-cookie"===n?t[n]?t[n].push(i):t[n]=[i]:t[n]=t[n]?t[n]+", "+i:i)})),t})(e),t);else if(ww.isObject(e)&&ww.isIterable(e)){let n,i,r={};for(const t of e){if(!ww.isArray(t))throw TypeError("Object iterator must return a key-value pair");r[i=t[0]]=(n=r[i])?ww.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}o(r,t)}else null!=e&&r(t,e,n);return this}get(e,t){if(e=bk(e)){const n=ww.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=n.exec(e);)t[i[1]]=i[2];return t}(e);if(ww.isFunction(t))return t.call(this,e,n);if(ww.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=bk(e)){const n=ww.findKey(this,e);return!(!n||void 0===this[n]||t&&!wk(0,this[n],n,t))}return!1}delete(e,t){const n=this;let i=!1;function r(e){if(e=bk(e)){const r=ww.findKey(n,e);!r||t&&!wk(0,n[r],r,t)||(delete n[r],i=!0)}}return ww.isArray(e)?e.forEach(r):r(e),i}clear(e){const t=Object.keys(this);let n=t.length,i=!1;for(;n--;){const r=t[n];e&&!wk(0,this[r],r,e,!0)||(delete this[r],i=!0)}return i}normalize(e){const t=this,n={};return ww.forEach(this,((i,r)=>{const o=ww.findKey(n,r);if(o)return t[o]=_k(i),void delete t[r];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(r):String(r).trim();s!==r&&delete t[r],t[s]=_k(i),n[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return ww.forEach(this,((n,i)=>{null!=n&&!1!==n&&(t[i]=e&&ww.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[xk]=this[xk]={accessors:{}}).accessors,n=this.prototype;function i(e){const i=bk(e);t[i]||(!function(e,t){const n=ww.toCamelCase(" "+t);["get","set","has"].forEach((i=>{Object.defineProperty(e,i+n,{value:function(e,n,r){return this[i].call(this,t,e,n,r)},configurable:!0})}))}(n,e),t[i]=!0)}return ww.isArray(e)?e.forEach(i):i(e),this}};function Sk(e,t){const n=this||vk,i=t||n,r=Ek.from(i.headers);let o=i.data;return ww.forEach(e,(function(e){o=e.call(n,o,r.normalize(),t?t.status:void 0)})),r.normalize(),o}function kk(e){return!(!e||!e.__CANCEL__)}function Rk(e,t,n){Ew.call(this,null==e?"canceled":e,Ew.ERR_CANCELED,t,n),this.name="CanceledError"}function Tk(e,t,n){const i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(new Ew("Request failed with status code "+n.status,[Ew.ERR_BAD_REQUEST,Ew.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}function Ok(e,t,n){let i=!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t);return e&&(i||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}Ek.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ww.reduceDescriptors(Ek.prototype,(({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}})),ww.freezeMethods(Ek),ww.inherits(Rk,Ew,{__CANCEL__:!0});const Ak="1.11.0";function Ck(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}const Pk=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;const jk=Symbol("internals");class Lk extends y.Transform{constructor(e){super({readableHighWaterMark:(e=ww.toFlatObject(e,{maxRate:0,chunkSize:65536,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,((e,t)=>!ww.isUndefined(t[e])))).chunkSize});const t=this[jk]={timeWindow:e.timeWindow,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",(e=>{"progress"===e&&(t.isCaptured||(t.isCaptured=!0))}))}_read(e){const t=this[jk];return t.onReadCallback&&t.onReadCallback(),super._read(e)}_transform(e,t,n){const i=this[jk],r=i.maxRate,o=this.readableHighWaterMark,s=i.timeWindow,a=r/(1e3/s),c=!1!==i.minChunkSize?Math.max(i.minChunkSize,.01*a):0,l=(e,t)=>{const n=Buffer.byteLength(e);i.bytesSeen+=n,i.bytes+=n,i.isCaptured&&this.emit("progress",i.bytesSeen),this.push(e)?process.nextTick(t):i.onReadCallback=()=>{i.onReadCallback=null,process.nextTick(t)}},u=(e,t)=>{const n=Buffer.byteLength(e);let u,p=null,d=o,f=0;if(r){const e=Date.now();(!i.ts||(f=e-i.ts)>=s)&&(i.ts=e,u=a-i.bytes,i.bytes=u<0?-u:0,f=0),u=a-i.bytes}if(r){if(u<=0)return setTimeout((()=>{t(null,e)}),s-f);u<d&&(d=u)}d&&n>d&&n-d>c&&(p=e.subarray(d),e=e.subarray(0,d)),l(e,p?()=>{process.nextTick(t,null,p)}:t)};u(e,(function e(t,i){if(t)return n(t);i?u(i,e):n(null)}))}}const{asyncIterator:Nk}=Symbol,Ik=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[Nk]?yield*e[Nk]():yield e},Dk=mk.ALPHABET.ALPHA_DIGIT+"-_",Fk="function"==typeof TextEncoder?new TextEncoder:new b.TextEncoder,Mk="\r\n",$k=Fk.encode(Mk);class Bk{constructor(e,t){const{escapeName:n}=this.constructor,i=ww.isString(t);let r=`Content-Disposition: form-data; name="${n(e)}"${!i&&t.name?`; filename="${n(t.name)}"`:""}${Mk}`;i?t=Fk.encode(String(t).replace(/\r?\n|\r\n?/g,Mk)):r+=`Content-Type: ${t.type||"application/octet-stream"}${Mk}`,this.headers=Fk.encode(r+Mk),this.contentLength=i?t.byteLength:t.size,this.size=this.headers.byteLength+this.contentLength+2,this.name=e,this.value=t}async*encode(){yield this.headers;const{value:e}=this;ww.isTypedArray(e)?yield e:yield*Ik(e),yield $k}static escapeName(e){return String(e).replace(/[\r\n"]/g,(e=>({"\r":"%0D","\n":"%0A",'"':"%22"}[e])))}}class Uk extends y.Transform{__transform(e,t,n){this.push(e),n()}_transform(e,t,n){if(0!==e.length&&(this._transform=this.__transform,120!==e[0])){const e=Buffer.alloc(2);e[0]=120,e[1]=156,this.push(e,t)}this.__transform(e,t,n)}}const zk=(e,t)=>ww.isAsyncFn(e)?function(...n){const i=n.pop();e.apply(this,n).then((e=>{try{t?i(null,...t(e)):i(null,e)}catch(e){i(e)}}),i)}:e;const qk=(e,t,n=3)=>{let i=0;const r=function(e,t){e=e||10;const n=new Array(e),i=new Array(e);let r,o=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=i[s];r||(r=c),n[o]=a,i[o]=c;let u=s,p=0;for(;u!==o;)p+=n[u++],u%=e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),c-r<t)return;const d=l&&c-l;return d?Math.round(1e3*p/d):void 0}}(50,250);return function(e,t){let n,i,r=0,o=1e3/t;const s=(t,o=Date.now())=>{r=o,n=null,i&&(clearTimeout(i),i=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-r;a>=o?s(e,t):(n=e,i||(i=setTimeout((()=>{i=null,s(n)}),o-a)))},()=>n&&s(n)]}((n=>{const o=n.loaded,s=n.lengthComputable?n.total:void 0,a=o-i,c=r(a);i=o;e({loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&o<=s?(s-o)/c:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})}),n)},Hk=(e,t)=>{const n=null!=e;return[i=>t[0]({lengthComputable:n,total:e,loaded:i}),t[1]]},Wk=e=>(...t)=>ww.asap((()=>e(...t))),Gk={flush:C.constants.Z_SYNC_FLUSH,finishFlush:C.constants.Z_SYNC_FLUSH},Vk={flush:C.constants.BROTLI_OPERATION_FLUSH,finishFlush:C.constants.BROTLI_OPERATION_FLUSH},Kk=ww.isFunction(C.createBrotliDecompress),{http:Jk,https:Yk}=Ua,Zk=/https:?/,Xk=mk.protocols.map((e=>e+":")),Qk=(e,[t,n])=>(e.on("end",n).on("error",n),t);function eR(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function tR(e,t,n){let i=t;if(!i&&!1!==i){const e=Fs.getProxyForUrl(n);e&&(i=new URL(e))}if(i){if(i.username&&(i.auth=(i.username||"")+":"+(i.password||"")),i.auth){(i.auth.username||i.auth.password)&&(i.auth=(i.auth.username||"")+":"+(i.auth.password||""));const t=Buffer.from(i.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+t}e.headers.host=e.hostname+(e.port?":"+e.port:"");const t=i.hostname||i.host;e.hostname=t,e.host=t,e.port=i.port,e.path=n,i.protocol&&(e.protocol=i.protocol.includes(":")?i.protocol:`${i.protocol}:`)}e.beforeRedirects.proxy=function(e){tR(e,t,e.href)}}const nR="undefined"!=typeof process&&"process"===ww.kindOf(process),iR=(e,t)=>(({address:e,family:t})=>{if(!ww.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}})(ww.isObject(e)?e:{address:e,family:t});var rR=nR&&function(e){return t=async function(t,n,i){let{data:r,lookup:o,family:s}=e;const{responseType:a,responseEncoding:c}=e,l=e.method.toUpperCase();let u,p,d=!1;if(o){const e=zk(o,(e=>ww.isArray(e)?e:[e]));o=(t,n,i)=>{e(t,n,((e,t,r)=>{if(e)return i(e);const o=ww.isArray(t)?t.map((e=>iR(e))):[iR(t,r)];n.all?i(e,o):i(e,o[0].address,o[0].family)}))}}const f=new j,h=()=>{e.cancelToken&&e.cancelToken.unsubscribe(m),e.signal&&e.signal.removeEventListener("abort",m),f.removeAllListeners()};function m(t){f.emit("abort",!t||t.type?new Rk(null,e,p):t)}i(((e,t)=>{u=!0,t&&(d=!0,h())})),f.once("abort",n),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(m),e.signal&&(e.signal.aborted?m():e.signal.addEventListener("abort",m)));const g=Ok(e.baseURL,e.url,e.allowAbsoluteUrls),v=new URL(g,mk.hasBrowserEnv?mk.origin:void 0),_=v.protocol||Xk[0];if("data:"===_){let i;if("GET"!==l)return Tk(t,n,{status:405,statusText:"method not allowed",headers:{},config:e});try{i=function(e,t,n){const i=n&&n.Blob||mk.classes.Blob,r=Ck(e);if(void 0===t&&i&&(t=!0),"data"===r){e=r.length?e.slice(r.length+1):e;const n=Pk.exec(e);if(!n)throw new Ew("Invalid URL",Ew.ERR_INVALID_URL);const o=n[1],s=n[2],a=n[3],c=Buffer.from(decodeURIComponent(a),s?"base64":"utf8");if(t){if(!i)throw new Ew("Blob is not supported",Ew.ERR_NOT_SUPPORT);return new i([c],{type:o})}return c}throw new Ew("Unsupported protocol "+r,Ew.ERR_NOT_SUPPORT)}(e.url,"blob"===a,{Blob:e.env&&e.env.Blob})}catch(t){throw Ew.from(t,Ew.ERR_BAD_REQUEST,e)}return"text"===a?(i=i.toString(c),c&&"utf8"!==c||(i=ww.stripBOM(i))):"stream"===a&&(i=y.Readable.from(i)),Tk(t,n,{data:i,status:200,statusText:"OK",headers:new Ek,config:e})}if(-1===Xk.indexOf(_))return n(new Ew("Unsupported protocol "+_,Ew.ERR_BAD_REQUEST,e));const w=Ek.from(e.headers).normalize();w.set("User-Agent","axios/"+Ak,!1);const{onUploadProgress:E,onDownloadProgress:R}=e,T=e.maxRate;let O,A;if(ww.isSpecCompliantForm(r)){const e=w.getContentType(/boundary=([-_\w\d]{10,70})/i);r=((e,t,n)=>{const{tag:i="form-data-boundary",size:r=25,boundary:o=i+"-"+mk.generateString(r,Dk)}=n||{};if(!ww.isFormData(e))throw TypeError("FormData instance required");if(o.length<1||o.length>70)throw Error("boundary must be 10-70 characters long");const s=Fk.encode("--"+o+Mk),a=Fk.encode("--"+o+"--"+Mk);let c=a.byteLength;const l=Array.from(e.entries()).map((([e,t])=>{const n=new Bk(e,t);return c+=n.size,n}));c+=s.byteLength*l.length,c=ww.toFiniteNumber(c);const u={"Content-Type":`multipart/form-data; boundary=${o}`};return Number.isFinite(c)&&(u["Content-Length"]=c),t&&t(u),x.from(async function*(){for(const e of l)yield s,yield*e.encode();yield a}())})(r,(e=>{w.set(e)}),{tag:`axios-${Ak}-boundary`,boundary:e&&e[1]||void 0})}else if(ww.isFormData(r)&&ww.isFunction(r.getHeaders)){if(w.set(r.getHeaders()),!w.hasContentLength())try{const e=await b.promisify(r.getLength).call(r);Number.isFinite(e)&&e>=0&&w.setContentLength(e)}catch(e){}}else if(ww.isBlob(r)||ww.isFile(r))r.size&&w.setContentType(r.type||"application/octet-stream"),w.setContentLength(r.size||0),r=y.Readable.from(Ik(r));else if(r&&!ww.isStream(r)){if(Buffer.isBuffer(r));else if(ww.isArrayBuffer(r))r=Buffer.from(new Uint8Array(r));else{if(!ww.isString(r))return n(new Ew("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",Ew.ERR_BAD_REQUEST,e));r=Buffer.from(r,"utf-8")}if(w.setContentLength(r.length,!1),e.maxBodyLength>-1&&r.length>e.maxBodyLength)return n(new Ew("Request body larger than maxBodyLength limit",Ew.ERR_BAD_REQUEST,e))}const P=ww.toFiniteNumber(w.getContentLength());let L,N;ww.isArray(T)?(O=T[0],A=T[1]):O=A=T,r&&(E||O)&&(ww.isStream(r)||(r=y.Readable.from(r,{objectMode:!1})),r=y.pipeline([r,new Lk({maxRate:ww.toFiniteNumber(O)})],ww.noop),E&&r.on("progress",Qk(r,Hk(P,qk(Wk(E),!1,3))))),e.auth&&(L=(e.auth.username||"")+":"+(e.auth.password||"")),!L&&v.username&&(L=v.username+":"+v.password),L&&w.delete("authorization");try{N=nk(v.pathname+v.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(t){const i=new Error(t.message);return i.config=e,i.url=e.url,i.exists=!0,n(i)}w.set("Accept-Encoding","gzip, compress, deflate"+(Kk?", br":""),!1);const I={path:N,method:l,headers:w.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:L,protocol:_,family:s,beforeRedirect:eR,beforeRedirects:{}};let D;!ww.isUndefined(o)&&(I.lookup=o),e.socketPath?I.socketPath=e.socketPath:(I.hostname=v.hostname.startsWith("[")?v.hostname.slice(1,-1):v.hostname,I.port=v.port,tR(I,e.proxy,_+"//"+v.hostname+(v.port?":"+v.port:"")+I.path));const F=Zk.test(I.protocol);if(I.agent=F?e.httpsAgent:e.httpAgent,e.transport?D=e.transport:0===e.maxRedirects?D=F?k:S:(e.maxRedirects&&(I.maxRedirects=e.maxRedirects),e.beforeRedirect&&(I.beforeRedirects.config=e.beforeRedirect),D=F?Yk:Jk),e.maxBodyLength>-1?I.maxBodyLength=e.maxBodyLength:I.maxBodyLength=1/0,e.insecureHTTPParser&&(I.insecureHTTPParser=e.insecureHTTPParser),p=D.request(I,(function(i){if(p.destroyed)return;const r=[i],o=+i.headers["content-length"];if(R||A){const e=new Lk({maxRate:ww.toFiniteNumber(A)});R&&e.on("progress",Qk(e,Hk(o,qk(Wk(R),!0,3)))),r.push(e)}let s=i;const u=i.req||p;if(!1!==e.decompress&&i.headers["content-encoding"])switch("HEAD"!==l&&204!==i.statusCode||delete i.headers["content-encoding"],(i.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":r.push(C.createUnzip(Gk)),delete i.headers["content-encoding"];break;case"deflate":r.push(new Uk),r.push(C.createUnzip(Gk)),delete i.headers["content-encoding"];break;case"br":Kk&&(r.push(C.createBrotliDecompress(Vk)),delete i.headers["content-encoding"])}s=r.length>1?y.pipeline(r,ww.noop):r[0];const m=y.finished(s,(()=>{m(),h()})),g={status:i.statusCode,statusText:i.statusMessage,headers:new Ek(i.headers),config:e,request:u};if("stream"===a)g.data=s,Tk(t,n,g);else{const i=[];let r=0;s.on("data",(function(t){i.push(t),r+=t.length,e.maxContentLength>-1&&r>e.maxContentLength&&(d=!0,s.destroy(),n(new Ew("maxContentLength size of "+e.maxContentLength+" exceeded",Ew.ERR_BAD_RESPONSE,e,u)))})),s.on("aborted",(function(){if(d)return;const t=new Ew("stream has been aborted",Ew.ERR_BAD_RESPONSE,e,u);s.destroy(t),n(t)})),s.on("error",(function(t){p.destroyed||n(Ew.from(t,null,e,u))})),s.on("end",(function(){try{let e=1===i.length?i[0]:Buffer.concat(i);"arraybuffer"!==a&&(e=e.toString(c),c&&"utf8"!==c||(e=ww.stripBOM(e))),g.data=e}catch(t){return n(Ew.from(t,null,e,g.request,g))}Tk(t,n,g)}))}f.once("abort",(e=>{s.destroyed||(s.emit("error",e),s.destroy())}))})),f.once("abort",(e=>{n(e),p.destroy(e)})),p.on("error",(function(t){n(Ew.from(t,null,e,p))})),p.on("socket",(function(e){e.setKeepAlive(!0,6e4)})),e.timeout){const t=parseInt(e.timeout,10);if(Number.isNaN(t))return void n(new Ew("error trying to parse `config.timeout` to int",Ew.ERR_BAD_OPTION_VALUE,e,p));p.setTimeout(t,(function(){if(u)return;let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const i=e.transitional||rk;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new Ew(t,i.clarifyTimeoutError?Ew.ETIMEDOUT:Ew.ECONNABORTED,e,p)),m()}))}if(ww.isStream(r)){let t=!1,n=!1;r.on("end",(()=>{t=!0})),r.once("error",(e=>{n=!0,p.destroy(e)})),r.on("close",(()=>{t||n||m(new Rk("Request stream has been aborted",e,p))})),r.pipe(p)}else p.end(r)},new Promise(((e,n)=>{let i,r;const o=(e,t)=>{r||(r=!0,i&&i(e,t))},s=e=>{o(e,!0),n(e)};t((t=>{o(t),e(t)}),s,(e=>i=e)).catch(s)}));var t},oR=mk.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,mk.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(mk.origin),mk.navigator&&/(msie|trident)/i.test(mk.navigator.userAgent)):()=>!0,sR=mk.hasStandardBrowserEnv?{write(e,t,n,i,r,o){const s=[e+"="+encodeURIComponent(t)];ww.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),ww.isString(i)&&s.push("path="+i),ww.isString(r)&&s.push("domain="+r),!0===o&&s.push("secure"),document.cookie=s.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};const aR=e=>e instanceof Ek?{...e}:e;function cR(e,t){t=t||{};const n={};function i(e,t,n,i){return ww.isPlainObject(e)&&ww.isPlainObject(t)?ww.merge.call({caseless:i},e,t):ww.isPlainObject(t)?ww.merge({},t):ww.isArray(t)?t.slice():t}function r(e,t,n,r){return ww.isUndefined(t)?ww.isUndefined(e)?void 0:i(void 0,e,0,r):i(e,t,0,r)}function o(e,t){if(!ww.isUndefined(t))return i(void 0,t)}function s(e,t){return ww.isUndefined(t)?ww.isUndefined(e)?void 0:i(void 0,e):i(void 0,t)}function a(n,r,o){return o in t?i(n,r):o in e?i(void 0,n):void 0}const c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t,n)=>r(aR(e),aR(t),0,!0)};return ww.forEach(Object.keys({...e,...t}),(function(i){const o=c[i]||r,s=o(e[i],t[i],i);ww.isUndefined(s)&&o!==a||(n[i]=s)})),n}var lR=e=>{const t=cR({},e);let n,{data:i,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:s,headers:a,auth:c}=t;if(t.headers=a=Ek.from(a),t.url=nk(Ok(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),ww.isFormData(i))if(mk.hasStandardBrowserEnv||mk.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(n=a.getContentType())){const[e,...t]=n?n.split(";").map((e=>e.trim())).filter(Boolean):[];a.setContentType([e||"multipart/form-data",...t].join("; "))}if(mk.hasStandardBrowserEnv&&(r&&ww.isFunction(r)&&(r=r(t)),r||!1!==r&&oR(t.url))){const e=o&&s&&sR.read(s);e&&a.set(o,e)}return t};var uR="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){const i=lR(e);let r=i.data;const o=Ek.from(i.headers).normalize();let s,a,c,l,u,{responseType:p,onUploadProgress:d,onDownloadProgress:f}=i;function h(){l&&l(),u&&u(),i.cancelToken&&i.cancelToken.unsubscribe(s),i.signal&&i.signal.removeEventListener("abort",s)}let m=new XMLHttpRequest;function g(){if(!m)return;const i=Ek.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Tk((function(e){t(e),h()}),(function(e){n(e),h()}),{data:p&&"text"!==p&&"json"!==p?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:i,config:e,request:m}),m=null}m.open(i.method.toUpperCase(),i.url,!0),m.timeout=i.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new Ew("Request aborted",Ew.ECONNABORTED,e,m)),m=null)},m.onerror=function(){n(new Ew("Network Error",Ew.ERR_NETWORK,e,m)),m=null},m.ontimeout=function(){let t=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const r=i.transitional||rk;i.timeoutErrorMessage&&(t=i.timeoutErrorMessage),n(new Ew(t,r.clarifyTimeoutError?Ew.ETIMEDOUT:Ew.ECONNABORTED,e,m)),m=null},void 0===r&&o.setContentType(null),"setRequestHeader"in m&&ww.forEach(o.toJSON(),(function(e,t){m.setRequestHeader(t,e)})),ww.isUndefined(i.withCredentials)||(m.withCredentials=!!i.withCredentials),p&&"json"!==p&&(m.responseType=i.responseType),f&&([c,u]=qk(f,!0),m.addEventListener("progress",c)),d&&m.upload&&([a,l]=qk(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",l)),(i.cancelToken||i.signal)&&(s=t=>{m&&(n(!t||t.type?new Rk(null,e,m):t),m.abort(),m=null)},i.cancelToken&&i.cancelToken.subscribe(s),i.signal&&(i.signal.aborted?s():i.signal.addEventListener("abort",s)));const v=Ck(i.url);v&&-1===mk.protocols.indexOf(v)?n(new Ew("Unsupported protocol "+v+":",Ew.ERR_BAD_REQUEST,e)):m.send(r||null)}))};const pR=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,i=new AbortController;const r=function(e){if(!n){n=!0,s();const t=e instanceof Error?e:this.reason;i.abort(t instanceof Ew?t:new Rk(t instanceof Error?t.message:t))}};let o=t&&setTimeout((()=>{o=null,r(new Ew(`timeout ${t} of ms exceeded`,Ew.ETIMEDOUT))}),t);const s=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(r):e.removeEventListener("abort",r)})),e=null)};e.forEach((e=>e.addEventListener("abort",r)));const{signal:a}=i;return a.unsubscribe=()=>ww.asap(s),a}},dR=function*(e,t){let n=e.byteLength;if(n<t)return void(yield e);let i,r=0;for(;r<n;)i=r+t,yield e.slice(r,i),r=i},fR=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},hR=(e,t,n,i)=>{const r=async function*(e,t){for await(const n of fR(e))yield*dR(n,t)}(e,t);let o,s=0,a=e=>{o||(o=!0,i&&i(e))};return new ReadableStream({async pull(e){try{const{done:t,value:i}=await r.next();if(t)return a(),void e.close();let o=i.byteLength;if(n){let e=s+=o;n(e)}e.enqueue(new Uint8Array(i))}catch(e){throw a(e),e}},cancel:e=>(a(e),r.return())},{highWaterMark:2})},mR="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,gR=mR&&"function"==typeof ReadableStream,vR=mR&&("function"==typeof TextEncoder?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),yR=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},xR=gR&&yR((()=>{let e=!1;const t=new Request(mk.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),bR=gR&&yR((()=>ww.isReadableStream(new Response("").body))),_R={stream:bR&&(e=>e.body)};mR&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach((t=>{!_R[t]&&(_R[t]=ww.isFunction(e[t])?e=>e[t]():(e,n)=>{throw new Ew(`Response type '${t}' is not supported`,Ew.ERR_NOT_SUPPORT,n)})}))})(new Response);const wR=async(e,t)=>{const n=ww.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(ww.isBlob(e))return e.size;if(ww.isSpecCompliantForm(e)){const t=new Request(mk.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return ww.isArrayBufferView(e)||ww.isArrayBuffer(e)?e.byteLength:(ww.isURLSearchParams(e)&&(e+=""),ww.isString(e)?(await vR(e)).byteLength:void 0)})(t):n};var ER=mR&&(async e=>{let{url:t,method:n,data:i,signal:r,cancelToken:o,timeout:s,onDownloadProgress:a,onUploadProgress:c,responseType:l,headers:u,withCredentials:p="same-origin",fetchOptions:d}=lR(e);l=l?(l+"").toLowerCase():"text";let f,h=pR([r,o&&o.toAbortSignal()],s);const m=h&&h.unsubscribe&&(()=>{h.unsubscribe()});let g;try{if(c&&xR&&"get"!==n&&"head"!==n&&0!==(g=await wR(u,i))){let e,n=new Request(t,{method:"POST",body:i,duplex:"half"});if(ww.isFormData(i)&&(e=n.headers.get("content-type"))&&u.setContentType(e),n.body){const[e,t]=Hk(g,qk(Wk(c)));i=hR(n.body,65536,e,t)}}ww.isString(p)||(p=p?"include":"omit");const r="credentials"in Request.prototype;f=new Request(t,{...d,signal:h,method:n.toUpperCase(),headers:u.normalize().toJSON(),body:i,duplex:"half",credentials:r?p:void 0});let o=await fetch(f,d);const s=bR&&("stream"===l||"response"===l);if(bR&&(a||s&&m)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=o[t]}));const t=ww.toFiniteNumber(o.headers.get("content-length")),[n,i]=a&&Hk(t,qk(Wk(a),!0))||[];o=new Response(hR(o.body,65536,n,(()=>{i&&i(),m&&m()})),e)}l=l||"text";let v=await _R[ww.findKey(_R,l)||"text"](o,e);return!s&&m&&m(),await new Promise(((t,n)=>{Tk(t,n,{data:v,headers:Ek.from(o.headers),status:o.status,statusText:o.statusText,config:e,request:f})}))}catch(t){if(m&&m(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Ew("Network Error",Ew.ERR_NETWORK,e,f),{cause:t.cause||t});throw Ew.from(t,t&&t.code,e,f)}});const SR={http:rR,xhr:uR,fetch:ER};ww.forEach(SR,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const kR=e=>`- ${e}`,RR=e=>ww.isFunction(e)||null===e||!1===e;var TR=e=>{e=ww.isArray(e)?e:[e];const{length:t}=e;let n,i;const r={};for(let o=0;o<t;o++){let t;if(n=e[o],i=n,!RR(n)&&(i=SR[(t=String(n)).toLowerCase()],void 0===i))throw new Ew(`Unknown adapter '${t}'`);if(i)break;r[t||"#"+o]=i}if(!i){const e=Object.entries(r).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new Ew("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(kR).join("\n"):" "+kR(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return i};function OR(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Rk(null,e)}function AR(e){OR(e),e.headers=Ek.from(e.headers),e.data=Sk.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return TR(e.adapter||vk.adapter)(e).then((function(t){return OR(e),t.data=Sk.call(e,e.transformResponse,t),t.headers=Ek.from(t.headers),t}),(function(t){return kk(t)||(OR(e),t&&t.response&&(t.response.data=Sk.call(e,e.transformResponse,t.response),t.response.headers=Ek.from(t.response.headers))),Promise.reject(t)}))}const CR={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{CR[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const PR={};CR.transitional=function(e,t,n){function i(e,t){return"[Axios v"+Ak+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,r,o)=>{if(!1===e)throw new Ew(i(r," has been removed"+(t?" in "+t:"")),Ew.ERR_DEPRECATED);return t&&!PR[r]&&(PR[r]=!0,console.warn(i(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,o)}},CR.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var jR={assertOptions:function(e,t,n){if("object"!=typeof e)throw new Ew("options must be an object",Ew.ERR_BAD_OPTION_VALUE);const i=Object.keys(e);let r=i.length;for(;r-- >0;){const o=i[r],s=t[o];if(s){const t=e[o],n=void 0===t||s(t,o,e);if(!0!==n)throw new Ew("option "+o+" must be "+n,Ew.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new Ew("Unknown option "+o,Ew.ERR_BAD_OPTION)}},validators:CR};const LR=jR.validators;let NR=class{constructor(e){this.defaults=e||{},this.interceptors={request:new ik,response:new ik}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=cR(this.defaults,t);const{transitional:n,paramsSerializer:i,headers:r}=t;void 0!==n&&jR.assertOptions(n,{silentJSONParsing:LR.transitional(LR.boolean),forcedJSONParsing:LR.transitional(LR.boolean),clarifyTimeoutError:LR.transitional(LR.boolean)},!1),null!=i&&(ww.isFunction(i)?t.paramsSerializer={serialize:i}:jR.assertOptions(i,{encode:LR.function,serialize:LR.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),jR.assertOptions(t,{baseUrl:LR.spelling("baseURL"),withXsrfToken:LR.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=r&&ww.merge(r.common,r[t.method]);r&&ww.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete r[e]})),t.headers=Ek.concat(o,r);const s=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));const c=[];let l;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let u,p=0;if(!a){const e=[AR.bind(this),void 0];for(e.unshift(...s),e.push(...c),u=e.length,l=Promise.resolve(t);p<u;)l=l.then(e[p++],e[p++]);return l}u=s.length;let d=t;for(p=0;p<u;){const e=s[p++],t=s[p++];try{d=e(d)}catch(e){t.call(this,e);break}}try{l=AR.call(this,d)}catch(e){return Promise.reject(e)}for(p=0,u=c.length;p<u;)l=l.then(c[p++],c[p++]);return l}getUri(e){return nk(Ok((e=cR(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};ww.forEach(["delete","get","head","options"],(function(e){NR.prototype[e]=function(t,n){return this.request(cR(n||{},{method:e,url:t,data:(n||{}).data}))}})),ww.forEach(["post","put","patch"],(function(e){function t(t){return function(n,i,r){return this.request(cR(r||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:i}))}}NR.prototype[e]=t(),NR.prototype[e+"Form"]=t(!0)}));const IR={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(IR).forEach((([e,t])=>{IR[t]=e}));const DR=function e(t){const n=new NR(t),i=M_(NR.prototype.request,n);return ww.extend(i,NR.prototype,n,{allOwnKeys:!0}),ww.extend(i,n,null,{allOwnKeys:!0}),i.create=function(n){return e(cR(t,n))},i}(vk);DR.Axios=NR,DR.CanceledError=Rk,DR.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then((e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const i=new Promise((e=>{n.subscribe(e),t=e})).then(e);return i.cancel=function(){n.unsubscribe(t)},i},e((function(e,i,r){n.reason||(n.reason=new Rk(e,i,r),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e((function(e){t=e})),cancel:t}}},DR.isCancel=kk,DR.VERSION=Ak,DR.toFormData=ZS,DR.AxiosError=Ew,DR.Cancel=DR.CanceledError,DR.all=function(e){return Promise.all(e)},DR.spread=function(e){return function(t){return e.apply(null,t)}},DR.isAxiosError=function(e){return ww.isObject(e)&&!0===e.isAxiosError},DR.mergeConfig=cR,DR.AxiosHeaders=Ek,DR.formToJSON=e=>gk(ww.isHTMLForm(e)?new FormData(e):e),DR.getAdapter=TR,DR.HttpStatusCode=IR,DR.default=DR;const{Axios:FR,AxiosError:MR,CanceledError:$R,isCancel:BR,CancelToken:UR,VERSION:zR,all:qR,Cancel:HR,isAxiosError:WR,spread:GR,toFormData:VR,AxiosHeaders:KR,HttpStatusCode:JR,formToJSON:YR,getAdapter:ZR,mergeConfig:XR}=DR,QR="https://comate.baidu.com",eT=DR.create();async function tT({license:e,type:t}){var n;return(await(n=e,eT({baseURL:QR,method:"GET",url:"/api/v2/api/models/available",params:{type:"ZULU",key:n}}))).data.data.filter((e=>e.modes&&e.modes.includes(t))).map((e=>({modelId:e.modelId,displayName:e.displayName})))}eT.interceptors.request.use((async e=>{const t=process.env.HTTP_HOST;if(t&&e.url)try{const n=new URL(t),i=new URL(e.url,e.baseURL||QR);e.url=`${n.protocol}//${n.host}${i.pathname}${i.search}`,e.baseURL=void 0}catch(e){console.warn(`Invalid HTTP_HOST URL: ${t}`)}const n=process.env.HTTP_PROXY||process.env.HTTPS_PROXY||process.env.http_proxy||process.env.https_proxy;if(n&&!e.proxy)try{const t=new URL(n);e.proxy={protocol:t.protocol.slice(0,-1),host:t.hostname,port:parseInt(t.port)||("https:"===t.protocol?443:80),...t.username&&t.password&&{auth:{username:t.username,password:t.password}}}}catch(e){console.warn(`Invalid proxy URL: ${n}`)}return e}));const nT=t=>{const n={license:"",username:"zulu-cli",query:"",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"===L.platform()?"cmd.exe":"/bin/sh",ideSeries:"vscode",ideVersion:"1.100.1",ideName:jb.VSCode,platform:process.env.PLATFORM||Pb.SAAS,deviceId:e(),pluginVersion:"3.10.0",ripgrepPath:Mb(),queryDelay:0,conversationId:"",...t};return new D_(n)};class iT extends ae{static paths=[ae.Default];ping=De("--ping",!1,{description:"测试网络连通性"});help=De("--help",!1,{description:"帮助信息"});version=De("--version",!1,{description:"版本信息"});async execute(){if(!(this.help||this.version||this.ping)){const e=new Ne;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 Ib;console.log("🏓 Starting Comate API ping test with proxy support...\n");const t=process.env.HTTP_HOST;t&&console.log(`🌐 HTTP_HOST override detected: ${t}`);const n=process.env.http_proxy||process.env.HTTP_PROXY||process.env.https_proxy||process.env.HTTPS_PROXY;if(n){console.log(`🌐 Detected proxy from environment: ${n}`);const e=await Ib.testProxy(n);console.log(`🔍 Proxy test: ${e?"✅ Working":"❌ Failed"}\n`)}else console.log("🌐 No proxy detected, using direct connection\n");console.log("Single ping:");const i=await e.ping({timeout:5e3,retries:3,retryDelay:1e3});console.log(i),console.log("\n"+"=".repeat(50)+"\n"),console.log("Continuous ping (5 times):");const r=await e.continuousPing(5,1e3,{timeout:5e3,retries:2}),o=Ib.getStats(r);console.log("\n📊 Statistics:"),console.log(`Total: ${o.total}`),console.log(`Successful: ${o.successful}`),console.log(`Failed: ${o.failed}`),console.log(`Success Rate: ${o.successRate.toFixed(2)}%`),console.log(`Avg Response Time: ${o.avgResponseTime.toFixed(2)}ms`),console.log(`Min Response Time: ${o.minResponseTime}ms`),console.log(`Max Response Time: ${o.maxResponseTime}ms`)}(),0):(this.context.stdout.write(this.cli.usage(this)),0)}}const rT=new je({binaryName:"zulu",binaryLabel:"AI Coding Agent Zulu",binaryVersion:Fb});function oT(){rT.runExit(process.argv.slice(2))}rT.register(Ne),rT.register(Ie),rT.register(iT),rT.register(class extends ae{static paths=[["run"]];static usage={description:"与 Zulu 一起工作,对完整代码库进行全面修改"};license=Fe("--license",{description:"License"});query=Fe("--query",{description:"问题描述"});search=Fe("--search",{description:"本地检索的查询内容"});cwd=Fe("--cwd",{description:"工作路径,默认执行时所在地址"});ripgrep=Fe("--ripgrep",{description:"ripgrep 的绝对路径"});max=Fe("--max",{description:"max模式的模型id。注意,指定模型只能在首轮对话生效,中途无法更换模型"});normal=Fe("--normal",{description:"normal模式的模型id。注意,指定模型只能在首轮对话生效,中途无法更换模型"});conversation=Fe("--conversation",{description:"conversation id,如果需要多轮对话,将上一轮对话的id传入此参数"});queryDelay=Fe("--delay",{description:"模型调用的延迟时间,单位毫秒"});async execute(){if(!(this.license||this.query||this.cwd||this.help||this.ripgrep||this.max||this.normal||this.conversation||this.queryDelay)){const e=new Ne;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.conversation&&this.max)return this.context.stderr.write("Error: --conversation and --max cannot be used together\n"),1;if(this.conversation&&this.normal)return this.context.stderr.write("Error: --conversation and --normal cannot be used together\n"),1;if(""===this.max)return this.context.stderr.write("Error: --max cannot be empty\n"),1;if(""===this.normal)return this.context.stderr.write("Error: --normal cannot be empty\n"),1;if(this.cwd&&!t(this.cwd))return this.context.stderr.write(`Error: Directory '${this.cwd}' does not exist\n`),1;let e=this.ripgrep;if(e&&!t(e))return this.context.stderr.write(`Error: ripgrep path '${e}' does not exist\n`),1;e||(e=Mb()),Me("License:",this.license),Me("Query:",this.query),Me("CWD:",this.cwd),Me("Conversation",this.conversation),Me("Max",this.max),Me("Normal",this.normal);const n={license:this.license,query:this.query,cwd:this.cwd||process.cwd(),ripgrepPath:e,max:this.max,queryDelay:Number(this.queryDelay),conversationId:this.conversation},i=nT(n);return null===await this.validateAndNormalizeMax()?1:(await i.start(),await async function({kernelProvider:e,query:t,max:n,conversation:i,normal:r}){new Qe(e).start();let o={};const s=n?{model:{modelId:n,requestType:"COMATE_MULTIPLE_MODE",mode:"MAX"}}:{model:{modelId:r||"auto",requestType:"COMATE_DEFAULT_MODE",mode:"NORMAL"}};e.onRequest("COMATE_AGENT_UPDATE_MESSAGE",(async e=>{if(Me("============"),Me(JSON.stringify(e,null,2)),"conversation-status"===e.data.type){const t=e.data.conversationInfo.status;if(t===pt.Failed||t===pt.Cancelled){const t=o?.messages.flatMap((e=>e.elements)).find((e=>!0===e.isErrorMessage));t&&(e.errorMessage=t),console.error(JSON.stringify(e,null,2)),process.exit(1)}else t===pt.Completed&&(console.log(JSON.stringify(o,null,2)),process.exit(0))}else"partial-message-data"===e.data.type&&(o=e.data)})),e.onNotification("ENGINE_SERVICE_INITIALIZED",(async()=>{let n="";i?(n=i,await e.sendRequest("COMATE_AGENT_START_NEW_CHAT",{agentPayload:{conversationId:n,messageType:"rebuild-conversation",conversationType:"E2EBotConversation",payload:{}}}),await e.sendRequest("COMATE_AGENT_NEW_MESSAGE",{agentPayload:{conversationId:n,messageType:"rebuild-conversation",payload:{knowledgeList:[]}}}),await e.sendRequest("COMATE_AGENT_SET_FOREGROUND_CONVERSATION",{agentPayload:{conversationId:n}})):n=(await e.sendRequest("COMATE_AGENT_START_NEW_CHAT",{agentPayload:{conversationId:n,messageType:"add-message",conversationType:"E2EBotConversation",payload:{query:t,knowledgeList:[],...s}}})).id,e.sendRequest("COMATE_AGENT_NEW_MESSAGE",{agentPayload:{messageType:"add-message",conversationId:n,payload:{query:t,knowledgeList:[],...s}}}),e.sendRequest("COMATE_AGENT_SET_FOREGROUND_CONVERSATION",{agentPayload:{conversationId:n}})}))}({kernelProvider:i,query:this.query,max:this.max,normal:this.normal,conversation:this.conversation}),0)}validateAndNormalizeMax=async()=>{if(this.conversation)try{const e=await async function(e){const t=w.homedir(),n=p.join(t,".comate-engine","store");if(!l.existsSync(n))return console.warn(`Directory does not exist: ${n}`),null;const i=`chat_session_${e}`,r=p.join(n,i);return l.existsSync(r)?r:null}(this.conversation);if(!e)return console.error("Error finding chat session file in ~/.comate-engine/store:",this.conversation),null;const t=JSON.parse(await i(e,"utf-8")||"{}");if(t.messages&&t.messages.length>0&&t.messages[0]?.payload?.model){const e=t.messages[0].payload.model.modelId,n=t.messages[0].payload.model.mode;e&&"auto"!==e&&("MAX"===n?this.max=e:this.normal=e)}}catch(e){return console.error("Error finding chat session file in ~/.comate-engine/store:",e),null}if(this.max){const e=(await tT({license:this.license,type:"MAX"})).find((e=>e.modelId===this.max||e.displayName===this.max));return e?(this.max=e.modelId,e.modelId):(this.context.stderr.write(`Error: Model '${this.max}' not found in available models\n`),null)}if(this.normal){const e=(await tT({license:this.license,type:"NORMAL"})).find((e=>e.modelId===this.normal||e.displayName===this.normal));return e?(this.normal=e.modelId,e.modelId):(this.context.stderr.write(`Error: Model '${this.normal}' not found in available models\n`),null)}return this.max||this.normal||""}}),rT.register(class extends ae{static paths=[["search"]];static usage={description:"本地检索"};query=Fe("--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;Me("Query:",this.query);const e={query:this.query,username:"zhangcong06"},t=nT(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}}),rT.register(class extends ae{static paths=[["list"]];static usage={description:"本地检索"};license=Fe("--license",{description:"License"});max=De("--max",{description:"列举max模式支持的模型"});normal=De("--normal",{description:"列举normal模式支持的模型"});async 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.max&&this.normal)return this.context.stderr.write("Error: --max and --normal cannot be used together\n"),1;Me("License:",this.license);const e={license:this.license,type:this.max?"MAX":"NORMAL"};return await async function({license:e,type:t}){try{const n=await tT({license:e,type:t});if(0===n.length)return void F_("model-list","Failed","没有可以使用的max模型, 请检查License",{});F_("model-list","Success","获取成功",{modelList:n})}catch(e){F_("model-list","Failed","获取失败",{})}}(e),0}});const sT=/^[a-zA-Z_][a-zA-Z0-9_]*$/;function aT(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 cT(e,t){var n,i,r;return"number"==typeof t?`${null!==(n=null==e?void 0:e.p)&&void 0!==n?n:"."}[${t}]`:sT.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 lT({errors:e,p:t}={},n){return null==e||e.push(`${null!=t?t:"."}: ${n}`),!1}function uT(e,t){return n=>{const i=e[t];return e[t]=n,uT(e,t).bind(null,i)}}function pT(){return gT({test:(e,t)=>"string"==typeof e||lT(t,`Expected a string (got ${aT(e)})`)})}function dT(e,{delimiter:t}={}){return gT({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 lT(i,"Unbound coercion result");n=n.split(t)}if(!Array.isArray(n))return lT(i,`Expected an array (got ${aT(n)})`);let s=!0;for(let t=0,r=n.length;t<r&&(s=e(n[t],Object.assign(Object.assign({},i),{p:cT(i,t),coercion:uT(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 fT(e,{delimiter:t}={}){const n=vT(e.length);return gT({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 lT(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 lT(r,`Expected a tuple (got ${aT(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:cT(r,t),coercion:uT(i,t)}))&&s,s||null!=(null==r?void 0:r.errors));++t);return s}})}function hT(e,{keys:t=null}={}){const n=dT(fT([null!=t?t:pT(),e]));return gT({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)?lT(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 lT(r,`Expected an object (got ${aT(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:cT(r,o),coercion:uT(i,o)}))||(a=!1):a=lT(Object.assign(Object.assign({},r),{p:cT(r,o)}),"Unsafe property name")}return a}})}function mT(e){return()=>e}function gT({test:e}){return mT(e)()}function vT(e){return gT({test:(t,n)=>t.length===e||lT(n,`Expected to have a length of exactly ${e} elements (got ${t.length})`)})}function yT(e,...t){const n=Array.isArray(t[0])?t[0]:t;return gT({test:(t,i)=>{var r,o;const s={value:t},a=void 0!==(null==i?void 0:i.coercions)?uT(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 lT(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 xT;!function(e){e.Forbids="Forbids",e.Requires="Requires"}(xT||(xT={})),xT.Forbids,xT.Requires;var bT=Object.freeze({__proto__:null,get KeyRelationship(){return xT},applyCascade:function(e,...t){return yT(e,Array.isArray(t[0])?t[0]:t)},cascade:yT,hasExactLength:vT,isArray:dT,isDict:function(e,t={}){return hT(e,t)},isRecord:hT,isString:pT,isTuple:fT,isUnknown:function(){return gT({test:(e,t)=>!0})},makeTrait:mT,makeValidator:gT});export{oT as run};
44
+ /*! run-parallel. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */const Lf="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:Be):e=>(Pf||(Pf=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0)));var Nf={};Object.defineProperty(Nf,"__esModule",{value:!0}),Nf.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;const If=process.versions.node.split(".");if(void 0===If[0]||void 0===If[1])throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);const Df=Number.parseInt(If[0],10),Ff=Number.parseInt(If[1],10),Mf=Df>10,$f=10===Df&&Ff>=10;Nf.IS_SUPPORT_READDIR_WITH_FILE_TYPES=Mf||$f;var Bf={},Uf={};Object.defineProperty(Uf,"__esModule",{value:!0}),Uf.createDirentFromStats=void 0;class zf{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 zf(e,t)},Object.defineProperty(Bf,"__esModule",{value:!0}),Bf.fs=void 0;const qf=Uf;Bf.fs=qf;var Hf={};Object.defineProperty(Hf,"__esModule",{value:!0}),Hf.joinPathSegments=void 0,Hf.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 Wf=xf,Gf=jf,Vf=Nf,Kf=Bf,Jf=Hf;function Yf(e,t,n){t.fs.readdir(e,{withFileTypes:!0},((i,r)=>{if(null!==i)return void Xf(n,i);const o=r.map((n=>({dirent:n,name:n.name,path:Jf.joinPathSegments(e,n.name,t.pathSegmentSeparator)})));if(!t.followSymbolicLinks)return void Qf(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=Kf.fs.createDirentFromStats(e.name,r),n(null,e)})):n(null,e)}}(e,t)));Gf(s,((e,t)=>{null===e?Qf(n,t):Xf(n,e)}))}))}function Zf(e,t,n){t.fs.readdir(e,((i,r)=>{if(null!==i)return void Xf(n,i);const o=r.map((n=>{const i=Jf.joinPathSegments(e,n,t.pathSegmentSeparator);return e=>{Wf.stat(i,t.fsStatSettings,((r,o)=>{if(null!==r)return void e(r);const s={name:n,path:i,dirent:Kf.fs.createDirentFromStats(n,o)};t.stats&&(s.stats=o),e(null,s)}))}}));Gf(o,((e,t)=>{null===e?Qf(n,t):Xf(n,e)}))}))}function Xf(e,t){e(t)}function Qf(e,t){e(null,t)}yf.read=function(e,t,n){t.stats||!Vf.IS_SUPPORT_READDIR_WITH_FILE_TYPES?Zf(e,t,n):Yf(e,t,n)},yf.readdirWithFileTypes=Yf,yf.readdir=Zf;var eh={};Object.defineProperty(eh,"__esModule",{value:!0}),eh.readdir=eh.readdirWithFileTypes=eh.read=void 0;const th=xf,nh=Nf,ih=Bf,rh=Hf;function oh(e,t){return t.fs.readdirSync(e,{withFileTypes:!0}).map((n=>{const i={dirent:n,name:n.name,path:rh.joinPathSegments(e,n.name,t.pathSegmentSeparator)};if(i.dirent.isSymbolicLink()&&t.followSymbolicLinks)try{const e=t.fs.statSync(i.path);i.dirent=ih.fs.createDirentFromStats(i.name,e)}catch(e){if(t.throwErrorOnBrokenSymbolicLink)throw e}return i}))}function sh(e,t){return t.fs.readdirSync(e).map((n=>{const i=rh.joinPathSegments(e,n,t.pathSegmentSeparator),r=th.statSync(i,t.fsStatSettings),o={name:n,path:i,dirent:ih.fs.createDirentFromStats(n,r)};return t.stats&&(o.stats=r),o}))}eh.read=function(e,t){return!t.stats&&nh.IS_SUPPORT_READDIR_WITH_FILE_TYPES?oh(e,t):sh(e,t)},eh.readdirWithFileTypes=oh,eh.readdir=sh;var ah={},ch={};!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)}}(ch),Object.defineProperty(ah,"__esModule",{value:!0});const lh=d,uh=xf,ph=ch;ah.default=class{constructor(e={}){this._options=e,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=ph.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,lh.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new uh.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(e,t){return null!=e?e:t}},Object.defineProperty(vf,"__esModule",{value:!0}),vf.Settings=vf.scandirSync=vf.scandir=void 0;const dh=yf,fh=eh,hh=ah;function mh(e={}){return e instanceof hh.default?e:new hh.default(e)}vf.Settings=hh.default,vf.scandir=function(e,t,n){"function"!=typeof t?dh.read(e,mh(t),n):dh.read(e,mh(),t)},vf.scandirSync=function(e,t){const n=mh(t);return fh.read(e,n)};var gh={exports:{}};var vh=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 yh(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=vh(bh),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||xh,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:xh,saturated:xh,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||xh,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:xh,kill:function(){r=null,o=null,c.drain=xh},killAndDrain:function(){r=null,o=null,c.drain(),c.drain=xh},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 xh(){}function bh(){this.value=null,this.callback=xh,this.next=null,this.release=xh,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=xh,e.errorHandler&&r(t,o),i.call(e.context,t,n),e.release(e)}}gh.exports=yh,gh.exports.promise=function(e,t,n){"function"==typeof e&&(n=t,t=e,e=null);var i=yh(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(xh),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(xh),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 _h=gh.exports,wh={};Object.defineProperty(wh,"__esModule",{value:!0}),wh.joinPathSegments=wh.replacePathSegmentSeparator=wh.isAppliedFilter=wh.isFatalError=void 0,wh.isFatalError=function(e,t){return null===e.errorFilter||!e.errorFilter(t)},wh.isAppliedFilter=function(e,t){return null===e||e(t)},wh.replacePathSegmentSeparator=function(e,t){return e.split(/[/\\]/).join(t)},wh.joinPathSegments=function(e,t,n){return""===e?t:e.endsWith(n)?e+t:e+n+t};var Eh={};Object.defineProperty(Eh,"__esModule",{value:!0});const Sh=wh;Eh.default=class{constructor(e,t){this._root=e,this._settings=t,this._root=Sh.replacePathSegmentSeparator(e,t.pathSegmentSeparator)}},Object.defineProperty(gf,"__esModule",{value:!0});const kh=P,Rh=vf,Th=_h,Oh=wh,Ah=Eh;class Ch extends Ah.default{constructor(e,t){super(e,t),this._settings=t,this._scandir=Rh.scandir,this._emitter=new kh.EventEmitter,this._queue=Th(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&&Oh.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=Oh.joinPathSegments(t,e.name,this._settings.pathSegmentSeparator)),Oh.isAppliedFilter(this._settings.entryFilter,e)&&this._emitEntry(e),e.dirent.isDirectory()&&Oh.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,void 0===t?void 0:e.path)}_emitEntry(e){this._emitter.emit("entry",e)}}gf.default=Ch,Object.defineProperty(mf,"__esModule",{value:!0});const Ph=gf;mf.default=class{constructor(e,t){this._root=e,this._settings=t,this._reader=new Ph.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 jh={};Object.defineProperty(jh,"__esModule",{value:!0});const Lh=y,Nh=gf;jh.default=class{constructor(e,t){this._root=e,this._settings=t,this._reader=new Nh.default(this._root,this._settings),this._stream=new Lh.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 Ih={},Dh={};Object.defineProperty(Dh,"__esModule",{value:!0});const Fh=vf,Mh=wh,$h=Eh;class Bh extends $h.default{constructor(){super(...arguments),this._scandir=Fh.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(Mh.isFatalError(this._settings,e))throw e}_handleEntry(e,t){const n=e.path;void 0!==t&&(e.path=Mh.joinPathSegments(t,e.name,this._settings.pathSegmentSeparator)),Mh.isAppliedFilter(this._settings.entryFilter,e)&&this._pushToStorage(e),e.dirent.isDirectory()&&Mh.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,void 0===t?void 0:e.path)}_pushToStorage(e){this._storage.push(e)}}Dh.default=Bh,Object.defineProperty(Ih,"__esModule",{value:!0});const Uh=Dh;Ih.default=class{constructor(e,t){this._root=e,this._settings=t,this._reader=new Uh.default(this._root,this._settings)}read(){return this._reader.read()}};var zh={};Object.defineProperty(zh,"__esModule",{value:!0});const qh=d,Hh=vf;zh.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,qh.sep),this.fsScandirSettings=new Hh.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(hf,"__esModule",{value:!0}),hf.Settings=hf.walkStream=hf.walkSync=hf.walk=void 0;const Wh=mf,Gh=jh,Vh=Ih,Kh=zh;function Jh(e={}){return e instanceof Kh.default?e:new Kh.default(e)}hf.Settings=Kh.default,hf.walk=function(e,t,n){"function"!=typeof t?new Wh.default(e,Jh(t)).read(n):new Wh.default(e,Jh()).read(t)},hf.walkSync=function(e,t){const n=Jh(t);return new Vh.default(e,n).read()},hf.walkStream=function(e,t){const n=Jh(t);return new Gh.default(e,n).read()};var Yh={};Object.defineProperty(Yh,"__esModule",{value:!0});const Zh=d,Xh=xf,Qh=Bu;Yh.default=class{constructor(e){this._settings=e,this._fsStatSettings=new Xh.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return Zh.resolve(this._settings.cwd,e)}_makeEntry(e,t){const n={name:t,path:t,dirent:Qh.fs.createDirentFromStats(t,e)};return this._settings.stats&&(n.stats=e),n}_isFatalError(e){return!Qh.errno.isEnoentCodeError(e)&&!this._settings.suppressErrors}};var em={};Object.defineProperty(em,"__esModule",{value:!0});const tm=y,nm=xf,im=hf,rm=Yh;class om extends rm.default{constructor(){super(...arguments),this._walkStream=im.walkStream,this._stat=nm.stat}dynamic(e,t){return this._walkStream(e,t)}static(e,t){const n=e.map(this._getFullEntryPath,this),i=new tm.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)))}))}}em.default=om,Object.defineProperty(ff,"__esModule",{value:!0});const sm=hf,am=Yh,cm=em;class lm extends am.default{constructor(){super(...arguments),this._walkAsync=sm.walk,this._readerStream=new cm.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)))}))}}ff.default=lm;var um={},pm={},dm={},fm={};Object.defineProperty(fm,"__esModule",{value:!0});const hm=Bu;fm.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 hm.pattern.getPatternParts(e,this._micromatchOptions).map((e=>hm.pattern.isDynamicPattern(e,this._settings)?{dynamic:!0,pattern:e,patternRe:hm.pattern.makeRe(e,this._micromatchOptions)}:{dynamic:!1,pattern:e}))}_splitSegmentsIntoSections(e){return hm.array.splitWhen(e,(e=>e.dynamic&&hm.pattern.hasGlobStar(e.pattern)))}},Object.defineProperty(dm,"__esModule",{value:!0});const mm=fm;class gm extends mm.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}}dm.default=gm,Object.defineProperty(pm,"__esModule",{value:!0});const vm=Bu,ym=dm;pm.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 ym.default(e,this._settings,this._micromatchOptions)}_getNegativePatternsRe(e){const t=e.filter(vm.pattern.isAffectDepthOfReadingPattern);return vm.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=vm.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!vm.pattern.matchAny(e,t)}};var xm={};Object.defineProperty(xm,"__esModule",{value:!0});const bm=Bu;xm.default=class{constructor(e,t){this._settings=e,this._micromatchOptions=t,this.index=new Map}getFilter(e,t){const n=bm.pattern.convertPatternsToRe(e,this._micromatchOptions),i=bm.pattern.convertPatternsToRe(t,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}));return e=>this._filter(e,n,i)}_filter(e,t,n){const i=bm.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=bm.path.makeAbsolute(this._settings.cwd,e);return bm.pattern.matchAny(n,t)}_isMatchToPatterns(e,t,n){const i=bm.pattern.matchAny(e,t);return!i&&n?bm.pattern.matchAny(e+"/",t):i}};var _m={};Object.defineProperty(_m,"__esModule",{value:!0});const wm=Bu;_m.default=class{constructor(e){this._settings=e}getFilter(){return e=>this._isNonFatalError(e)}_isNonFatalError(e){return wm.errno.isEnoentCodeError(e)||this._settings.suppressErrors}};var Em={};Object.defineProperty(Em,"__esModule",{value:!0});const Sm=Bu;Em.default=class{constructor(e){this._settings=e}getTransformer(){return e=>this._transform(e)}_transform(e){let t=e.path;return this._settings.absolute&&(t=Sm.path.makeAbsolute(this._settings.cwd,t),t=Sm.path.unixify(t)),this._settings.markDirectories&&e.dirent.isDirectory()&&(t+="/"),this._settings.objectMode?Object.assign(Object.assign({},e),{path:t}):t}},Object.defineProperty(um,"__esModule",{value:!0});const km=d,Rm=pm,Tm=xm,Om=_m,Am=Em;um.default=class{constructor(e){this._settings=e,this.errorFilter=new Om.default(this._settings),this.entryFilter=new Tm.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new Rm.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new Am.default(this._settings)}_getRootDirectory(e){return km.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(df,"__esModule",{value:!0});const Cm=ff,Pm=um;class jm extends Pm.default{constructor(){super(...arguments),this._reader=new Cm.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)}}df.default=jm;var Lm={};Object.defineProperty(Lm,"__esModule",{value:!0});const Nm=y,Im=em,Dm=um;class Fm extends Dm.default{constructor(){super(...arguments),this._reader=new Im.default(this._settings)}read(e){const t=this._getRootDirectory(e),n=this._getReaderOptions(e),i=this.api(t,e,n),r=new Nm.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)}}Lm.default=Fm;var Mm={},$m={};Object.defineProperty($m,"__esModule",{value:!0});const Bm=xf,Um=hf,zm=Yh;class qm extends zm.default{constructor(){super(...arguments),this._walkSync=Um.walkSync,this._statSync=Bm.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)}}$m.default=qm,Object.defineProperty(Mm,"__esModule",{value:!0});const Hm=$m,Wm=um;class Gm extends Wm.default{constructor(){super(...arguments),this._reader=new Hm.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)}}Mm.default=Gm;var Vm={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;const t=u,n=E,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)}}}(Vm);const Km=$u,Jm=df,Ym=Lm,Zm=Mm,Xm=Vm,Qm=Bu;async function eg(e,t){ng(e);const n=tg(e,Jm.default,t),i=await Promise.all(n);return Qm.array.flatten(i)}function tg(e,t,n){const i=[].concat(e),r=new Xm.default(n),o=Km.generate(i,r),s=new t(r);return o.map(s.read,s)}function ng(e){if(![].concat(e).every((e=>Qm.string.isString(e)&&!Qm.string.isEmpty(e))))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}!function(e){function t(e,t){ng(e);const n=tg(e,Zm.default,t);return Qm.array.flatten(n)}function n(e,t){ng(e);const n=tg(e,Ym.default,t);return Qm.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){ng(e);const n=[].concat(e),i=new Xm.default(t);return Km.generate(n,i)},e.isDynamicPattern=function(e,t){ng(e);const n=new Xm.default(t);return Qm.pattern.isDynamicPattern(e,n)},e.escapePath=function(e){return ng(e),Qm.path.escape(e)},e.convertPathToPattern=function(e){return ng(e),Qm.path.convertPathToPattern(e)},(i=e.posix||(e.posix={})).escapePath=function(e){return ng(e),Qm.path.escapePosixPath(e)},i.convertPathToPattern=function(e){return ng(e),Qm.path.convertPosixPathToPattern(e)},(r=e.win32||(e.win32={})).escapePath=function(e){return ng(e),Qm.path.escapeWindowsPath(e)},r.convertPathToPattern=function(e){return ng(e),Qm.path.convertWindowsPathToPattern(e)}}(eg||(eg={}));var ig={exports:{}},rg={};const{promisify:og}=b,sg=u;async function ag(e,t,n){if("string"!=typeof n)throw new TypeError("Expected a string, got "+typeof n);try{return(await og(sg[e])(n))[t]()}catch(e){if("ENOENT"===e.code)return!1;throw e}}function cg(e,t,n){if("string"!=typeof n)throw new TypeError("Expected a string, got "+typeof n);try{return sg[e](n)[t]()}catch(e){if("ENOENT"===e.code)return!1;throw e}}rg.isFile=ag.bind(null,"stat","isFile"),rg.isDirectory=ag.bind(null,"stat","isDirectory"),rg.isSymlink=ag.bind(null,"lstat","isSymbolicLink"),rg.isFileSync=cg.bind(null,"statSync","isFile"),rg.isDirectorySync=cg.bind(null,"statSync","isDirectory"),rg.isSymlinkSync=cg.bind(null,"lstatSync","isSymbolicLink");const lg=d,ug=rg,pg=e=>e.length>1?`{${e.join(",")}}`:e[0],dg=(e,t)=>{const n="!"===e[0]?e.slice(1):e;return lg.isAbsolute(n)?n:lg.join(t,n)},fg=(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=>lg.posix.join(e,((e,t)=>lg.extname(e)?`**/${e}`:`**/${e}.${pg(t)}`)(n,t.extensions)))):t.files?t.files.map((t=>lg.posix.join(e,`**/${t}`))):t.extensions?[lg.posix.join(e,`**/*.${pg(t.extensions)}`)]:[lg.posix.join(e,"**")]};function hg(e){return Array.isArray(e)?e:[e]}ig.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 ug.isDirectory(dg(e,t.cwd))?fg(e,t):e)));return[].concat.apply([],n)},ig.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=>ug.isDirectorySync(dg(e,t.cwd))?fg(e,t):e));return[].concat.apply([],n)};const mg=/^\s+$/,gg=/(?:[^\\]|^)\\$/,vg=/^\\!/,yg=/^\\#/,xg=/\r?\n/g,bg=/^\.*\/|^\.+$/;let _g="node-ignore";"undefined"!=typeof Symbol&&(_g=Symbol.for("node-ignore"));const wg=_g,Eg=/([0-z])-([0-z])/g,Sg=()=>!1,kg=[[/^\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(Eg,((e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:"")))(n)}${i}]`:"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:"[^/]*"}(?=$|\\/$)`]],Rg=Object.create(null),Tg=e=>"string"==typeof e;class Og{constructor(e,t,n,i){this.origin=e,this.pattern=t,this.negative=n,this.regex=i}}const Ag=(e,t)=>{const n=e;let i=!1;0===e.indexOf("!")&&(i=!0,e=e.substr(1));const r=((e,t)=>{let n=Rg[e];return n||(n=kg.reduce(((t,[n,i])=>t.replace(n,i.bind(e))),e),Rg[e]=n),t?new RegExp(n,"i"):new RegExp(n)})(e=e.replace(vg,"!").replace(yg,"#"),t);return new Og(n,e,i,r)},Cg=(e,t)=>{throw new t(e)},Pg=(e,t,n)=>{if(!Tg(e))return n(`path must be a string, but got \`${t}\``,TypeError);if(!e)return n("path must not be empty",TypeError);if(Pg.isNotRelative(e)){return n(`path should be a ${"`path.relative()`d"} string, but got "${t}"`,RangeError)}return!0},jg=e=>bg.test(e);Pg.isNotRelative=jg,Pg.convert=e=>e;class Lg{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){var i,r,o;i=this,r=wg,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[wg])return this._rules=this._rules.concat(e._rules),void(this._added=!0);if((e=>e&&Tg(e)&&!mg.test(e)&&!gg.test(e)&&0!==e.indexOf("#"))(e)){const t=Ag(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,hg(Tg(e)?(e=>e.split(xg))(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&&Pg.convert(e);return Pg(r,e,this._allowRelativePaths?Sg:Cg),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 hg(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}}const Ng=e=>new Lg(e);if(Ng.isPathValid=e=>Pg(e&&Pg.convert(e),e,Sg),Ng.default=Ng,"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,"/");Pg.convert=e;const t=/^[a-z]:\//i;Pg.isNotRelative=e=>t.test(e)||jg(e)}const Ig=[{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 Dg{static default=new Dg;entries=[];static{for(const e of Ig)Dg.default.registerLanguage(e.id,e)}registerLanguage(e,t){const n=(e=>{const{extensions:t,names:n,patterns:i,firstLine:r}=e,o=r?new RegExp(r):null,a=i?Nu(i.map((e=>e.includes("/")?`**/${e}`:e))):null;return(e,i)=>!!(t&&t.includes(s.extname(e))||n&&n.includes(e)||a&&a(e)||o&&o.test(i))})(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 Mg={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function $g(e){Mg=e}const Bg=/[&<>"']/,Ug=new RegExp(Bg.source,"g"),zg=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,qg=new RegExp(zg.source,"g"),Hg={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Wg=e=>Hg[e];function Gg(e,t){if(t){if(Bg.test(e))return e.replace(Ug,Wg)}else if(zg.test(e))return e.replace(qg,Wg);return e}const Vg=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function Kg(e){return e.replace(Vg,((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 Jg=/(^|[^\[])\^/g;function Yg(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(Jg,"$1"),n=n.replace(e,r),i},getRegex:()=>new RegExp(n,t)};return i}function Zg(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const Xg={exec:()=>null};function Qg(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 ev(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 tv(e,t,n,i){const r=t.href,o=t.title?Gg(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:Gg(s)}}class nv{options;rules;lexer;constructor(e){this.options=e||Mg}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:ev(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=ev(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=ev(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=Qg(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(Qg(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:Gg(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=ev(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)),tv(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 tv(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=Gg(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=Gg(t[1]),n="mailto:"+e):(e=Gg(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=Gg(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=Gg(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]:Gg(t[0]),{type:"text",raw:t[0],text:e}}}}const iv=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,rv=/(?:[*+-]|\d{1,9}[.)])/,ov=Yg(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,rv).getRegex(),sv=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,av=/(?!\s*\])(?:\\.|[^\[\]\\])+/,cv=Yg(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",av).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),lv=Yg(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,rv).getRegex(),uv="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",pv=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,dv=Yg("^ {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",pv).replace("tag",uv).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),fv=Yg(sv).replace("hr",iv).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",uv).getRegex(),hv={blockquote:Yg(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",fv).getRegex(),code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,def:cv,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:iv,html:dv,lheading:ov,list:lv,newline:/^(?: *(?:\n|$))+/,paragraph:fv,table:Xg,text:/^[^\n]+/},mv=Yg("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",iv).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",uv).getRegex(),gv={...hv,table:mv,paragraph:Yg(sv).replace("hr",iv).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",mv).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",uv).getRegex()},vv={...hv,html:Yg("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",pv).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:Xg,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Yg(sv).replace("hr",iv).replace("heading"," *#{1,6} *[^\n]").replace("lheading",ov).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},yv=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,xv=/^( {2,}|\\)\n(?!\s*$)/,bv="\\p{P}$+<=>`^|~",_v=Yg(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,bv).getRegex(),wv=Yg(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,bv).getRegex(),Ev=Yg("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,bv).getRegex(),Sv=Yg("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,bv).getRegex(),kv=Yg(/\\([punct])/,"gu").replace(/punct/g,bv).getRegex(),Rv=Yg(/^<(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(),Tv=Yg(pv).replace("(?:--\x3e|$)","--\x3e").getRegex(),Ov=Yg("^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",Tv).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Av=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Cv=Yg(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Av).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Pv=Yg(/^!?\[(label)\]\[(ref)\]/).replace("label",Av).replace("ref",av).getRegex(),jv=Yg(/^!?\[(ref)\](?:\[\])?/).replace("ref",av).getRegex(),Lv={_backpedal:Xg,anyPunctuation:kv,autolink:Rv,blockSkip:/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,br:xv,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:Xg,emStrongLDelim:wv,emStrongRDelimAst:Ev,emStrongRDelimUnd:Sv,escape:yv,link:Cv,nolink:jv,punctuation:_v,reflink:Pv,reflinkSearch:Yg("reflink|nolink(?!\\()","g").replace("reflink",Pv).replace("nolink",jv).getRegex(),tag:Ov,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:Xg},Nv={...Lv,link:Yg(/^!?\[(label)\]\((.*?)\)/).replace("label",Av).getRegex(),reflink:Yg(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Av).getRegex()},Iv={...Lv,escape:Yg(yv).replace("])","~|])").getRegex(),url:Yg(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},Dv={...Iv,br:Yg(xv).replace("{2,}","*").getRegex(),text:Yg(Iv.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Fv={normal:hv,gfm:gv,pedantic:vv},Mv={normal:Lv,gfm:Iv,breaks:Dv,pedantic:Nv};class $v{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Mg,this.options.tokenizer=this.options.tokenizer||new nv,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:Mv.normal};this.options.pedantic?(t.block=Fv.pedantic,t.inline=Mv.pedantic):this.options.gfm&&(t.block=Fv.gfm,this.options.breaks?t.inline=Mv.breaks:t.inline=Mv.gfm),this.tokenizer.rules=t}static get rules(){return{block:Fv,inline:Mv}}static lex(e,t){return new $v(t).lex(e)}static lexInline(e,t){return new $v(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 Bv{options;constructor(e){this.options=e||Mg}code(e,t,n){const i=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+"\n",i?'<pre><code class="language-'+Gg(i)+'">'+(n?e:Gg(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:Gg(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=Zg(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=Zg(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 zv{options;renderer;textRenderer;constructor(e){this.options=e||Mg,this.options.renderer=this.options.renderer||new Bv,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Uv}static parse(e,t){return new zv(t).parse(e)}static parseInline(e,t){return new zv(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,Kg(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 qv{options;constructor(e){this.options=e||Mg}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}const Hv=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($v.lex,zv.parse);parseInline=this.#e($v.lexInline,zv.parseInline);Parser=zv;Renderer=Bv;TextRenderer=Uv;Lexer=$v;Tokenizer=nv;Hooks=qv;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 Bv(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 nv(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 qv;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];qv.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 $v.lex(e,t??this.defaults)}parser(e,t){return zv.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>"+Gg(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Wv(e,t){return Hv.parse(e,t)}Wv.options=Wv.setOptions=function(e){return Hv.setOptions(e),Wv.defaults=Hv.defaults,$g(Wv.defaults),Wv},Wv.getDefaults=Fg,Wv.defaults=Mg,Wv.use=function(...e){return Hv.use(...e),Wv.defaults=Hv.defaults,$g(Wv.defaults),Wv},Wv.walkTokens=function(e,t){return Hv.walkTokens(e,t)},Wv.parseInline=Hv.parseInline,Wv.Parser=zv,Wv.parser=zv.parse,Wv.Renderer=Bv,Wv.TextRenderer=Uv,Wv.Lexer=$v,Wv.lexer=$v.lex,Wv.Tokenizer=nv,Wv.Hooks=qv,Wv.parse=Wv,Wv.options,Wv.setOptions,Wv.use,Wv.walkTokens,Wv.parseInline,zv.parse,$v.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 Gv=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},Vv=Gv,Kv=Object.create,Jv=function(){function e(){}return function(t){if(!Vv(t))return{};if(Kv)return Kv(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();var Yv=function(){},Zv=Jv,Xv=Yv;function Qv(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}Qv.prototype=Zv(Xv.prototype),Qv.prototype.constructor=Qv;var ey=Qv;var ty=function(e,t){for(var n=-1,i=t.length,r=e.length;++n<i;)e[r+n]=t[n];return e},ny="object"==typeof Be&&Be&&Be.Object===Object&&Be,iy="object"==typeof self&&self&&self.Object===Object&&self,ry=ny||iy||Function("return this")(),oy=ry.Symbol,sy=oy,ay=Object.prototype,cy=ay.hasOwnProperty,ly=ay.toString,uy=sy?sy.toStringTag:void 0;var py=function(e){var t=cy.call(e,uy),n=e[uy];try{e[uy]=void 0;var i=!0}catch(e){}var r=ly.call(e);return i&&(t?e[uy]=n:delete e[uy]),r},dy=Object.prototype.toString;var fy=py,hy=function(e){return dy.call(e)},my=oy?oy.toStringTag:void 0;var gy=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":my&&my in Object(e)?fy(e):hy(e)};var vy=function(e){return null!=e&&"object"==typeof e},yy=gy,xy=vy;var by=function(e){return xy(e)&&"[object Arguments]"==yy(e)},_y=vy,wy=Object.prototype,Ey=wy.hasOwnProperty,Sy=wy.propertyIsEnumerable,ky=by(function(){return arguments}())?by:function(e){return _y(e)&&Ey.call(e,"callee")&&!Sy.call(e,"callee")},Ry=Array.isArray,Ty=ky,Oy=Ry,Ay=oy?oy.isConcatSpreadable:void 0;var Cy=ty,Py=function(e){return Oy(e)||Ty(e)||!!(Ay&&e&&e[Ay])};var jy=function e(t,n,i,r,o){var s=-1,a=t.length;for(i||(i=Py),o||(o=[]);++s<a;){var c=t[s];n>0&&i(c)?n>1?e(c,n-1,i,r,o):Cy(o,c):r||(o[o.length]=c)}return o},Ly=jy;var Ny=function(e){return(null==e?0:e.length)?Ly(e,1):[]};var Iy=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)},Dy=Math.max;var Fy=function(e,t,n){return t=Dy(void 0===t?e.length-1:t,0),function(){for(var i=arguments,r=-1,o=Dy(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),Iy(e,this,a)}};var My=function(e){return function(){return e}},$y=gy,By=Gv;var Uy,zy=function(e){if(!By(e))return!1;var t=$y(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},qy=ry["__core-js_shared__"],Hy=(Uy=/[^.]+$/.exec(qy&&qy.keys&&qy.keys.IE_PROTO||""))?"Symbol(src)_1."+Uy:"";var Wy=function(e){return!!Hy&&Hy in e},Gy=Function.prototype.toString;var Vy=zy,Ky=Wy,Jy=Gv,Yy=function(e){if(null!=e){try{return Gy.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Zy=/^\[object .+?Constructor\]$/,Xy=Function.prototype,Qy=Object.prototype,ex=Xy.toString,tx=Qy.hasOwnProperty,nx=RegExp("^"+ex.call(tx).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var ix=function(e){return!(!Jy(e)||Ky(e))&&(Vy(e)?nx:Zy).test(Yy(e))},rx=function(e,t){return null==e?void 0:e[t]};var ox=function(e,t){var n=rx(e,t);return ix(n)?n:void 0},sx=ox,ax=function(){try{var e=sx(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var cx=My,lx=ax,ux=lx?function(e,t){return lx(e,"toString",{configurable:!0,enumerable:!1,value:cx(t),writable:!0})}:function(e){return e},px=ux,dx=Date.now;var fx=function(e){var t=0,n=0;return function(){var i=dx(),r=16-(i-n);if(n=i,r>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(px),hx=Ny,mx=Fy,gx=fx;var vx=function(e){return gx(mx(e,void 0,hx),e+"")},yx=ox(ry,"WeakMap");var xx=yx&&new yx,bx=xx?function(e){return xx.get(e)}:function(){},_x={},wx=Object.prototype.hasOwnProperty;var Ex=function(e){for(var t=e.name+"",n=_x[t],i=wx.call(_x,t)?n.length:0;i--;){var r=n[i],o=r.func;if(null==o||o==e)return r.name}return t},Sx=Jv,kx=Yv;function Rx(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}Rx.prototype=Sx(kx.prototype),Rx.prototype.constructor=Rx;var Tx=Rx;var Ox=function(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n<i;)t[n]=e[n];return t},Ax=Tx,Cx=ey,Px=Ox;var jx=Tx,Lx=ey,Nx=Yv,Ix=Ry,Dx=vy,Fx=function(e){if(e instanceof Ax)return e.clone();var t=new Cx(e.__wrapped__,e.__chain__);return t.__actions__=Px(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t},Mx=Object.prototype.hasOwnProperty;function $x(e){if(Dx(e)&&!Ix(e)&&!(e instanceof jx)){if(e instanceof Lx)return e;if(Mx.call(e,"__wrapped__"))return Fx(e)}return new Lx(e)}$x.prototype=Nx.prototype,$x.prototype.constructor=$x;var Bx=Tx,Ux=bx,zx=Ex,qx=$x;var Hx=ey,Wx=vx,Gx=bx,Vx=Ex,Kx=Ry,Jx=function(e){var t=zx(e),n=qx[t];if("function"!=typeof n||!(t in Bx.prototype))return!1;if(e===n)return!0;var i=Ux(n);return!!i&&e===i[0]};var Yx,Zx=function(e){return Wx((function(t){var n=t.length,i=n,r=Hx.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"==Vx(o))var s=new Hx([],!0)}for(i=s?i:n;++i<n;){o=t[i];var a=Vx(o),c="wrapper"==a?Gx(o):void 0;s=c&&Jx(c[0])&&424==c[1]&&!c[4].length&&1==c[9]?s[Vx(c[0])].apply(s,c[3]):1==o.length&&Jx(o)?s[a]():s.thru(o)}return function(){var e=arguments,i=e[0];if(s&&1==e.length&&Kx(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}}))};Zx(),function(e){e.EDIT="edit",e.PREVIEW="preview"}(Yx||(Yx={}));class Xx{diff(e,t,n={}){let i;"function"==typeof n?(i=n,n={}):"callback"in n&&(i=n.callback);const r=this.castInput(e,n),o=this.castInput(t,n),s=this.removeEmpty(this.tokenize(r,n)),a=this.removeEmpty(this.tokenize(o,n));return this.diffWithOptionsObj(s,a,n,i)}diffWithOptionsObj(e,t,n,i){var r;const o=e=>(e=this.postProcess(e,n),i?void setTimeout((function(){i(e)}),0):e),s=t.length,a=e.length;let c=1,l=s+a;null!=n.maxEditLength&&(l=Math.min(l,n.maxEditLength));const u=null!==(r=n.timeout)&&void 0!==r?r:1/0,p=Date.now()+u,d=[{oldPos:-1,lastComponent:void 0}];let f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=a&&f+1>=s)return o(this.buildValues(d[0].lastComponent,t,e));let h=-1/0,m=1/0;const g=()=>{for(let i=Math.max(h,-c);i<=Math.min(m,c);i+=2){let r;const c=d[i-1],l=d[i+1];c&&(d[i-1]=void 0);let u=!1;if(l){const e=l.oldPos-i;u=l&&0<=e&&e<s}const p=c&&c.oldPos+1<a;if(u||p){if(r=!p||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(r,t,e,i,n),r.oldPos+1>=a&&f+1>=s)return o(this.buildValues(r.lastComponent,t,e))||!0;d[i]=r,r.oldPos+1>=a&&(m=Math.min(m,i-1)),f+1>=s&&(h=Math.max(h,i+1))}else d[i]=void 0}c++};if(i)!function e(){setTimeout((function(){if(c>l||Date.now()>p)return i(void 0);g()||e()}),0)}();else for(;c<=l&&Date.now()<=p;){const e=g();if(e)return e}}addToPath(e,t,n,i,r){const o=e.lastComponent;return o&&!r.oneChangePerToken&&o.added===t&&o.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:t,removed:n,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:t,removed:n,previousComponent:o}}}extractCommon(e,t,n,i,r){const o=t.length,s=n.length;let a=e.oldPos,c=a-i,l=0;for(;c+1<o&&a+1<s&&this.equals(n[a+1],t[c+1],r);)c++,a++,l++,r.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!r.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=a,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){const t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){const i=[];let r;for(;e;)i.push(e),r=e.previousComponent,delete e.previousComponent,e=r;i.reverse();const o=i.length;let s=0,a=0,c=0;for(;s<o;s++){const e=i[s];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let i=t.slice(a,a+e.count);i=i.map((function(e,t){const i=n[c+t];return i.length>e.length?i:e})),e.value=this.join(i)}else e.value=this.join(t.slice(a,a+e.count));a+=e.count,e.added||(c+=e.count)}}return i}}function Qx(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,"\n"));const n=[],i=e.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let e=0;e<i.length;e++){const r=i[e];e%2&&!t.newlineIsToken?n[n.length-1]+=r:n.push(r)}return n}new class extends Xx{constructor(){super(...arguments),this.tokenize=Qx}equals(e,t,n){return n.ignoreWhitespace?(n.newlineIsToken&&e.includes("\n")||(e=e.trim()),n.newlineIsToken&&t.includes("\n")||(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith("\n")&&(e=e.slice(0,-1)),t.endsWith("\n")&&(t=t.slice(0,-1))),super.equals(e,t,n)}};const eb=e=>e.replace(/\s|\t/g,"").replace(/[;|,]$/,"").toLowerCase();new class extends Xx{constructor(){super(),this.tokenize=Qx}equals(e,t,n){const i=super.equals(e,t,n);return!i&&e.length>12&&t.length>12?((e,t)=>eb(e)===eb(t))(e,t):i}};for(var tb,nb,ib,rb,ob,sb,ab,cb,lb,ub,pb,db,fb,hb,mb,gb,vb,yb,xb,bb,_b,wb,Eb,Sb,kb,Rb,Tb,Ob,Ab,Cb,Pb,jb,Lb=0;Lb<4;Lb++)(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"}(tb||(tb={})),function(e){e.NOT_SUPPORT="statusBar.not.support.text",e.ENABLE="statusBar.enable.text",e.NO_SUGGESTIONS="statusBar.nosuggestions",e.TITLE="statusBar.title"}(nb||(nb={})),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"}(ib||(ib={})),function(e){e.EMPTY_TEXT="nl2code.empty.text",e.NO_SELECTION="nl2code.no.selection.text"}(rb||(rb={})),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"}(ob||(ob={})),function(e){e.EXPLAIN_SELECTED_CODE="explain.codeActions.title",e.OPTIMIZE_SELECTED_CODE="optimize.codeActions.title",e.INLINECHAT_SELECTED_CODE="inlinechat.codeActions.title"}(sb||(sb={})),function(e){e.CODELENS_TITLE="chatTrial.codelens.title"}(ab||(ab={})),function(e){e.CODELENS_TITLE="inlinechat.codelens.title"}(cb||(cb={})),function(e){e.CHAT_TIPS_TITLE="chatTips.selectedCode.title",e.CHAT_TIPS_CODE_BLANK_ROW_TITLE="chatTips.blankRow.title"}(lb||(lb={})),function(e){e.GENERATING_TITLE="decorations.generating.title",e.LINE_COMMENT_CODE_TRIGGER_TITLE="decorations.lineComent.trigger.title"}(ub||(ub={})),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"}(pb||(pb={})),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"}(db||(db={})),function(e){e.PROMPT="split.prompt",e.CODELENS_TITLE="split.codelens.title",e.CODELENS_TOOLTIP="split.codelens.tooltip",e.GENERATE_ERROR="split.generate.error"}(fb||(fb={})),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"}(hb||(hb={})),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"}(mb||(mb={})),function(e){e.PROMPT="inlineLog.prompt",e.CODELENS_TITLE="inlineLog.codelens.title",e.CODELENS_TOOLTIP="inlineLog.codelens.tooltip",e.GENERATE_ERROR="inlineLog.generate.error"}(gb||(gb={})),function(e){e.TITLE="diff.title",e.ACCEPT="diff.accept",e.REJECT="diff.reject",e.OPEN_DUAL_SCREEN_DIFF="diff.dualScreenDiff.open"}(vb||(vb={})),function(e){e.WEBVIEW_TITLE="chat.webview.title",e.NO_INSERT_POSITION="chat.no.insertPosition.text"}(yb||(yb={})),function(e){e.PATH_ERROR="accept.path.error"}(xb||(xb={})),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"}(bb||(bb={})),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"}(_b||(_b={})),function(e){e.TOOLTIP="regexHover.tooltip",e.PROMPT="regexHover.prompt"}(wb||(wb={})),function(e){e.MAXIMUM_FILES="embeddings.maximum.files.message",e.PROGRESS="embeddings.progress.message",e.PROGRESS_TOOLTIP="embeddings.progress.tooltip.message"}(Eb||(Eb={})),function(e){e.TITLE="openPlatform.title.text",e.WEBVIEW_TITLE="openPlatform.webview.title"}(Sb||(Sb={})),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"}(kb||(kb={})),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"}(Rb||(Rb={})),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"}(Tb||(Tb={})),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"}(Ob||(Ob={})),function(e){e.GENERATE_ERROR="kernel.zulu.error"}(Ab||(Ab={})),function(e){e.DEVELOPMENT="development",e.PRODUCTION="production",e.TEST="test"}(Cb||(Cb={})),function(e){e.SAAS="saas",e.INTERNAL="internal",e.POC="poc"}(Pb||(Pb={})),function(e){e.VSCode="vscode",e.JetBrains="jetbrains",e.VS="vs",e.Xcode="xcode",e.Eclipse="eclipse",e.ComateLocal="comate-local",e.Web="web"}(jb||(jb={}));const Nb="kernel/extensionConfig/fetch";class Ib{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 T(t);return{proxy:t,agent:new S.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),s=process.env.HTTP_HOST;let a=this.url,c=!0;if(s){const e=new T(this.url),t=new T(s);a=`${t.protocol}//${t.host}${e.pathname}${e.search}`,c="https:"===t.protocol}else c="https:"===new T(this.url).protocol;return new Promise((n=>{let s;if(r){const o=new T(r),c=new T(a),l={hostname:o.hostname,port:o.port||("https:"===o.protocol?443:80),path:a,method:"GET",timeout:e,headers:{Host:c.hostname,"User-Agent":"Comate-Ping/1.0"}};if(o.username&&o.password){const e=Buffer.from(`${o.username}:${o.password}`).toString("base64");l.headers["Proxy-Authorization"]=`Basic ${e}`}s=S.request(l,(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=(c?k:S).request(a,{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 T(e);return new Promise((e=>{const n=S.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 Db,Fb="0.4.0";function Mb(){try{const e="win32"===process.platform,n=m(e?"where rg":"which rg",{encoding:"utf8",stdio:"pipe"}).trim(),i=e?n.split("\n")[0]:n;if(i&&t(i))return i}catch(e){Me("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 y(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 h(t,n,i,r,o)}static parse(e,t=!1){const n=p.exec(e);return n?new h(n[2]||l,w(n[4]||l),w(n[5]||l),w(n[7]||l),w(n[9]||l),t):new h(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 h("file",t,e,l,l)}static from(e){const t=new h(e.scheme,e.authority,e.path,e.query,e.fragment);return c(t,!0),t}toString(e=!1){return x(this,e)}toJSON(){return this}static revive(e){if(e){if(e instanceof d)return e;{const t=new h(e);return t._formatted=e.external,t._fsPath=e._sep===f?e.fsPath:null,t}}return e}}const f=r?1:void 0;class h extends d{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||(this._fsPath=y(this)),this._fsPath}toString(e=!1){return e?x(this,!0):(this._formatted||(this._formatted=x(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 m={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=m[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+=m[i]):void 0!==t&&(t+=e[n])}return void 0!==t?t:e}function y(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 x(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 b(e){try{return decodeURIComponent(e)}catch{return e.length>3?e.substr(0,3)+b(e.substr(3)):e}}const _=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function w(e){return e.match(_)?e.replace(_,(e=>b(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={})),Db=i})();const{URI:$b,Utils:Bb}=Db;var Ub,zb,qb={},Hb={},Wb={},Gb={},Vb={};function Kb(){if(Ub)return Vb;function e(e){return"string"==typeof e||e instanceof String}function t(e){return Array.isArray(e)}return Ub=1,Object.defineProperty(Vb,"__esModule",{value:!0}),Vb.stringArray=Vb.array=Vb.func=Vb.error=Vb.number=Vb.string=Vb.boolean=void 0,Vb.boolean=function(e){return!0===e||!1===e},Vb.string=e,Vb.number=function(e){return"number"==typeof e||e instanceof Number},Vb.error=function(e){return e instanceof Error},Vb.func=function(e){return"function"==typeof e},Vb.array=t,Vb.stringArray=function(n){return t(n)&&n.every((t=>e(t)))},Vb}function Jb(){if(zb)return Gb;zb=1,Object.defineProperty(Gb,"__esModule",{value:!0}),Gb.Message=Gb.NotificationType9=Gb.NotificationType8=Gb.NotificationType7=Gb.NotificationType6=Gb.NotificationType5=Gb.NotificationType4=Gb.NotificationType3=Gb.NotificationType2=Gb.NotificationType1=Gb.NotificationType0=Gb.NotificationType=Gb.RequestType9=Gb.RequestType8=Gb.RequestType7=Gb.RequestType6=Gb.RequestType5=Gb.RequestType4=Gb.RequestType3=Gb.RequestType2=Gb.RequestType1=Gb.RequestType=Gb.RequestType0=Gb.AbstractMessageSignature=Gb.ParameterStructures=Gb.ResponseError=Gb.ErrorCodes=void 0;const e=Kb();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||(Gb.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}}Gb.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}}Gb.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}}Gb.AbstractMessageSignature=o;Gb.RequestType0=class extends o{constructor(e){super(e,0)}};Gb.RequestType=class extends o{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Gb.RequestType1=class extends o{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Gb.RequestType2=class extends o{constructor(e){super(e,2)}};Gb.RequestType3=class extends o{constructor(e){super(e,3)}};Gb.RequestType4=class extends o{constructor(e){super(e,4)}};Gb.RequestType5=class extends o{constructor(e){super(e,5)}};Gb.RequestType6=class extends o{constructor(e){super(e,6)}};Gb.RequestType7=class extends o{constructor(e){super(e,7)}};Gb.RequestType8=class extends o{constructor(e){super(e,8)}};Gb.RequestType9=class extends o{constructor(e){super(e,9)}};Gb.NotificationType=class extends o{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Gb.NotificationType0=class extends o{constructor(e){super(e,0)}};Gb.NotificationType1=class extends o{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};Gb.NotificationType2=class extends o{constructor(e){super(e,2)}};Gb.NotificationType3=class extends o{constructor(e){super(e,3)}};Gb.NotificationType4=class extends o{constructor(e){super(e,4)}};Gb.NotificationType5=class extends o{constructor(e){super(e,5)}};Gb.NotificationType6=class extends o{constructor(e){super(e,6)}};Gb.NotificationType7=class extends o{constructor(e){super(e,7)}};Gb.NotificationType8=class extends o{constructor(e){super(e,8)}};return Gb.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||(Gb.Message=n={})),Gb}var Yb,Zb={};function Xb(){if(Yb)return Zb;var e,t;Yb=1,Object.defineProperty(Zb,"__esModule",{value:!0}),Zb.LRUCache=Zb.LinkedMap=Zb.Touch=void 0,function(e){e.None=0,e.First=1,e.AsOld=e.First,e.Last=2,e.AsNew=e.Last}(t||(Zb.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)}}Zb.LinkedMap=n;return Zb.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))}},Zb}var Qb,e_={};var t_,n_,i_={},r_={};function o_(){if(t_)return r_;let e;function t(){if(void 0===e)throw new Error("No runtime abstraction layer installed");return e}return t_=1,Object.defineProperty(r_,"__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={})),r_.default=t,r_}function s_(){if(n_)return i_;n_=1,Object.defineProperty(i_,"__esModule",{value:!0}),i_.Emitter=i_.Event=void 0;const e=o_();var t;!function(e){const t={dispose(){}};e.None=function(){return t}}(t||(i_.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 i_.Emitter=i,i._noop=function(){},i_}var a_,c_={};function l_(){if(a_)return c_;a_=1,Object.defineProperty(c_,"__esModule",{value:!0}),c_.CancellationTokenSource=c_.CancellationToken=void 0;const e=o_(),t=Kb(),n=s_();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||(c_.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 c_.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}},c_}var u_,p_={};var d_,f_,h_={},m_={};function g_(){if(d_)return m_;d_=1,Object.defineProperty(m_,"__esModule",{value:!0}),m_.Semaphore=void 0;const e=o_();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 v_,y_={};var x_,b_={};var __,w_,E_={};function S_(){return __||(__=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=o_(),n=Kb(),i=Jb(),r=Xb(),o=s_(),s=l_();var a,c,l,u,p,d,f,h,m,g,v,y,x,b,_,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")}(h||(e.SetTraceNotification=h={})),function(e){e.type=new i.NotificationType("$/logTrace")}(m||(e.LogTraceNotification=m={})),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))}}(y||(e.IdCancellationReceiverStrategy=y={})),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))}}(x||(e.RequestCancellationReceiverStrategy=x={})),function(e){e.Message=Object.freeze({createCancellationTokenSource:e=>new s.CancellationTokenSource}),e.is=function(e){return y.is(e)||x.is(e)}}(b||(e.CancellationReceiverStrategy=b={})),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:b.Message,sender:_.Message}),e.is=function(e){const t=e;return t&&b.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,x,b){const _=void 0!==x?x:e.NullLogger;let S=0,T=0,O=0;const A="2.0";let C;const P=new Map;let j;const L=new Map,N=new Map;let I,D,F=new r.LinkedMap,M=new Map,$=new Set,B=new Map,U=p.Off,z=f.Text,q=k.New;const H=new o.Emitter,W=new o.Emitter,G=new o.Emitter,V=new o.Emitter,K=new o.Emitter,J=b&&b.cancellationStrategy?b.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 q===k.Listening}function ee(){return q===k.Closed}function te(){return q===k.Disposed}function ne(){q!==k.New&&q!==k.Listening||(q=k.Closed,W.fire(void 0))}function ie(){I||0===F.size||(I=(0,t.default)().timer.setImmediate((()=>{I=void 0,function(){if(0===F.size)return;const e=F.shift();try{const t=b?.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:A,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:A,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:A,id:e.id,result:t};ae(r,n,i),v.write(r).catch((()=>_.error("Sending response failed.")))}!function(e){if(U===p.Off||!D)return;if(z===f.Text){let t;U!==p.Verbose&&U!==p.Compact||!e.params||(t=`Params: ${se(e.params)}\n\n`),D.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||C){const s=e.id??String(Date.now()),u=y.is(J.receiver)?J.receiver.createCancellationTokenSource(s):J.receiver.createCancellationTokenSource(e);null!==e.id&&$.has(e.id)&&u.cancel(),null!==e.id&&B.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 C&&(p=C(e.method,e.params,u.token));const d=p;p?d.then?d.then((n=>{B.delete(s),t(n,e.method,l)}),(t=>{B.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)})):(B.delete(s),t(p,e.method,l)):(B.delete(s),o(p,e.method,l))}catch(o){B.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 $.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(U===p.Off||!D)return;if(z===f.Text){let n;if(U!==p.Verbose&&U!==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}).`:"";D.log(`Received response '${t.method} - (${e.id})' in ${Date.now()-t.timerStart}ms.${i}`,n)}else D.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=F.get(n);if(i.Message.isRequest(r)){const i=b?.connectionStrategy,o=i&&i.cancelUndispatched?i.cancelUndispatched(r,X):void 0;if(o&&(void 0!==o.error||void 0!==o.result))return F.delete(n),B.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=B.get(t);if(void 0!==o)return o.cancel(),void ce(e);$.add(t)}Z(F,e)}finally{ie()}};function se(e){if(null!=e)switch(U){case p.Verbose:return JSON.stringify(e,null,4);case p.Compact:return JSON.stringify(e);default:return}}function ae(e,t,n){if(U!==p.Off&&D)if(z===f.Text){let i;U!==p.Verbose&&U!==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")),D.log(`Sending response '${t} - (${e.id})'. Processing request took ${Date.now()-n}ms`,i)}else le("send-response",e)}function ce(e){if(U!==p.Off&&D&&e.method!==m.type.method)if(z===f.Text){let t;U!==p.Verbose&&U!==p.Compact||(t=e.params?`Params: ${se(e.params)}\n\n`:"No parameters provided.\n\n"),D.log(`Received notification '${e.method}'.`,t)}else le("receive-notification",e)}function le(e,t){if(!D||U===p.Off)return;const n={isLSPMessage:!0,type:e,message:t,timestamp:Date.now()};D.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 he(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 me(e,t){let n;const i=e.numberOfParams;switch(i){case 0:n=void 0;break;case 1:n=he(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=he(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=me(e,n)}const s={jsonrpc:A,method:r,params:o};return function(e){if(U!==p.Off&&D)if(z===f.Text){let t;U!==p.Verbose&&U!==p.Compact||(t=e.params?`Params: ${se(e.params)}\n\n`:"No parameters provided.\n\n"),D.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=he(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=me(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:A,id:c,method:r,params:o};return function(e){if(U!==p.Off&&D)if(z===f.Text){let t;U!==p.Verbose&&U!==p.Compact||!e.params||(t=`Params: ${se(e.params)}\n\n`),D.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,C=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):C=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)),U=e,z=o,D=U===p.Off?void 0:t,!r||ee()||te()||await ge.sendNotification(h.type,{value:p.toString(e)})},onError:H.event,onClose:W.event,onUnhandledNotification:G.event,onDispose:K.event,end:()=>{v.end()},dispose:()=>{if(te())return;q=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,B=new Map,$=new Set,F=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")}(),q=k.Listening,d.listen(oe)},inspect:()=>{(0,t.default)().console.log("inspect")}};return ge.onNotification(m.type,(e=>{if(U===p.Off||!D)return;const t=U===p.Verbose||U===p.Compact;D.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}}(E_)),E_}function k_(){return w_||(w_=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=Jb();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=Xb();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=(Qb||(Qb=1,Object.defineProperty(e_,"__esModule",{value:!0}),e_.Disposable=void 0,function(e){e.create=function(e){return{dispose:e}}}(r||(e_.Disposable=r={}))),e_);var r;Object.defineProperty(e,"Disposable",{enumerable:!0,get:function(){return i.Disposable}});const o=s_();Object.defineProperty(e,"Event",{enumerable:!0,get:function(){return o.Event}}),Object.defineProperty(e,"Emitter",{enumerable:!0,get:function(){return o.Emitter}});const s=l_();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(u_)return p_;u_=1,Object.defineProperty(p_,"__esModule",{value:!0}),p_.SharedArrayReceiverStrategy=p_.SharedArraySenderStrategy=void 0;const e=l_();var t;!function(e){e.Continue=0,e.Cancelled=1}(t||(t={})),p_.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 p_.SharedArrayReceiverStrategy=class{constructor(){this.kind="request"}createCancellationTokenSource(t){const n=t.$cancellationData;return void 0===n?new e.CancellationTokenSource:new i(n)}},p_}();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(f_)return h_;f_=1,Object.defineProperty(h_,"__esModule",{value:!0}),h_.ReadableStreamMessageReader=h_.AbstractMessageReader=h_.MessageReader=void 0;const e=o_(),t=Kb(),n=s_(),i=g_();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||(h_.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 h_.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={})),h_.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))}},h_}();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(v_)return y_;v_=1,Object.defineProperty(y_,"__esModule",{value:!0}),y_.WriteableStreamMessageWriter=y_.AbstractMessageWriter=y_.MessageWriter=void 0;const e=o_(),t=Kb(),n=g_(),i=s_();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||(y_.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 y_.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={})),y_.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()}},y_}();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=S_();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=o_();e.RAL=d.default}(Wb)),Wb}Object.defineProperty(Hb,"__esModule",{value:!0});const R_=b,T_=k_();class O_ extends T_.AbstractMessageBuffer{constructor(e="utf-8"){super(e)}emptyBuffer(){return O_.emptyBuffer}fromString(e,t){return Buffer.from(e,t)}toString(e,t){return e instanceof Buffer?e.toString(t):new R_.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)}}O_.emptyBuffer=Buffer.allocUnsafe(0);class A_{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),T_.Disposable.create((()=>this.stream.off("close",e)))}onError(e){return this.stream.on("error",e),T_.Disposable.create((()=>this.stream.off("error",e)))}onEnd(e){return this.stream.on("end",e),T_.Disposable.create((()=>this.stream.off("end",e)))}onData(e){return this.stream.on("data",e),T_.Disposable.create((()=>this.stream.off("data",e)))}}class C_{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),T_.Disposable.create((()=>this.stream.off("close",e)))}onError(e){return this.stream.on("error",e),T_.Disposable.create((()=>this.stream.off("error",e)))}onEnd(e){return this.stream.on("end",e),T_.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 P_=Object.freeze({messageBuffer:Object.freeze({create:e=>new O_(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 R_.TextDecoder(t.charset).decode(e)))}catch(e){return Promise.reject(e)}}})}),stream:Object.freeze({asReadableStream:e=>new A_(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 j_(){return P_}!function(e){e.install=function(){T_.RAL.install(P_)}}(j_||(j_={})),Hb.default=j_,function(e){var t=Be&&Be.__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=Be&&Be.__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=Hb;i.default.install();const r=d,o=E,s=O,a=I,c=k_();n(k_(),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 p 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=p;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 h extends c.ReadableStreamMessageReader{constructor(e,t="utf-8"){super((0,i.default)().stream.asReadableStream(e),t)}}e.SocketMessageReader=h;class m 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=m;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 y=process.env.XDG_RUNTIME_DIR,x=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=y?r.join(y,`vscode-ipc-${e}.sock`):r.join(o.tmpdir(),`vscode-${e}.sock`);const n=x.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 h(e,t),new m(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 h(n,t),new m(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 h(e,t),new m(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 h(n,t),new m(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)}}(qb);var L_=qb;const 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,enableTerminalAutoExecution:!0,terminalAutoExecutionDenyList:[],terminalAutoExecutionAllowList:[],zuluConfig:{enableTerminalAutoExecution:!0,terminalAutoExecutionDenyList:[],terminalAutoExecutionAllowList:[]}},I_=a(N(import.meta.url));class D_{cwd;shell="bin/bash";license;username;ideSeries;ideVersion;ideName;platform;deviceId;pluginVersion;httpProxy;ripgrepPath;extensionConfig=N_;queryDelay;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,this.queryDelay=e.queryDelay}async start(){const e=await this.engineExec(),t=new L_.StreamMessageReader(e.stdout),n=new L_.StreamMessageWriter(e.stdin);this.client=L_.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:Cb.PRODUCTION,extensionVersion:this.pluginVersion,platform:this.platform,themeColor:"dark",ideTerminalInfo:{defaultShell:this.shell}}}))),this.client.onRequest(Nb,(async()=>(Me("KERNEL CLIENT REC <--------",Nb),{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(),Me("LSP Client started")}async sendRequest(e,t){if(Me("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:$b.file(this.cwd).toString(),capabilities:{workspace:{workspaceFolders:!0,configuration:!0},textDocument:{synchronization:{dynamicRegistration:!1,willSave:!1,willSaveWaitUntil:!1,didSave:!1}}},initializationOptions:{},workspaceFolders:[{uri:$b.file(this.cwd).toString(),name:"workspace"}]};try{Me("Sending initialize request...");Me("Initialize response:",await this.client.sendRequest("initialize",e)),Me("Sending initialized notification..."),this.client.sendNotification("initialized",{}),Me("LSP initialization completed")}catch(e){throw console.error("LSP initialization failed:",e),e}}setupLogHandlers(){this.client&&(this.client.onNotification("window/logMessage",(e=>{Me(e)})),this.client.onNotification("window/showMessage",(e=>{Me(e)})),this.client.onRequest("window/showMessageRequest",(e=>(Me(e),e.actions?.[0]||null))),this.client.onNotification("comate/log",(e=>{Me(e)})),this.client.onNotification("$/progress",(e=>{Me(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",ZULU_TIMEOUT:String(this.queryDelay)}},t=c(I_,"../../comate-engine/bin/comate.js");return g(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()}}}function F_(e,t,n,i){const r={data:{type:e,status:t,message:n,...i}};console.log(JSON.stringify(r,null,2))}function M_(e,t){return function(){return e.apply(t,arguments)}}const{toString:$_}=Object.prototype,{getPrototypeOf:B_}=Object,{iterator:U_,toStringTag:z_}=Symbol,q_=(e=>t=>{const n=$_.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),H_=e=>(e=e.toLowerCase(),t=>q_(t)===e),W_=e=>t=>typeof t===e,{isArray:G_}=Array,V_=W_("undefined");function K_(e){return null!==e&&!V_(e)&&null!==e.constructor&&!V_(e.constructor)&&Z_(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const J_=H_("ArrayBuffer");const Y_=W_("string"),Z_=W_("function"),X_=W_("number"),Q_=e=>null!==e&&"object"==typeof e,ew=e=>{if("object"!==q_(e))return!1;const t=B_(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||z_ in e||U_ in e)},tw=H_("Date"),nw=H_("File"),iw=H_("Blob"),rw=H_("FileList"),ow=H_("URLSearchParams"),[sw,aw,cw,lw]=["ReadableStream","Request","Response","Headers"].map(H_);function uw(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let i,r;if("object"!=typeof e&&(e=[e]),G_(e))for(i=0,r=e.length;i<r;i++)t.call(null,e[i],i,e);else{if(K_(e))return;const r=n?Object.getOwnPropertyNames(e):Object.keys(e),o=r.length;let s;for(i=0;i<o;i++)s=r[i],t.call(null,e[s],s,e)}}function pw(e,t){if(K_(e))return null;t=t.toLowerCase();const n=Object.keys(e);let i,r=n.length;for(;r-- >0;)if(i=n[r],t===i.toLowerCase())return i;return null}const dw="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,fw=e=>!V_(e)&&e!==dw;const hw=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&B_(Uint8Array)),mw=H_("HTMLFormElement"),gw=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),vw=H_("RegExp"),yw=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),i={};uw(n,((n,r)=>{let o;!1!==(o=t(n,r,e))&&(i[r]=o||n)})),Object.defineProperties(e,i)};const xw=H_("AsyncFunction"),bw=((e,t)=>e?setImmediate:t?((e,t)=>(dw.addEventListener("message",(({source:n,data:i})=>{n===dw&&i===e&&t.length&&t.shift()()}),!1),n=>{t.push(n),dw.postMessage(e,"*")}))(`axios@${Math.random()}`,[]):e=>setTimeout(e))("function"==typeof setImmediate,Z_(dw.postMessage)),_w="undefined"!=typeof queueMicrotask?queueMicrotask.bind(dw):"undefined"!=typeof process&&process.nextTick||bw;var ww={isArray:G_,isArrayBuffer:J_,isBuffer:K_,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Z_(e.append)&&("formdata"===(t=q_(e))||"object"===t&&Z_(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&J_(e.buffer),t},isString:Y_,isNumber:X_,isBoolean:e=>!0===e||!1===e,isObject:Q_,isPlainObject:ew,isEmptyObject:e=>{if(!Q_(e)||K_(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:sw,isRequest:aw,isResponse:cw,isHeaders:lw,isUndefined:V_,isDate:tw,isFile:nw,isBlob:iw,isRegExp:vw,isFunction:Z_,isStream:e=>Q_(e)&&Z_(e.pipe),isURLSearchParams:ow,isTypedArray:hw,isFileList:rw,forEach:uw,merge:function e(){const{caseless:t}=fw(this)&&this||{},n={},i=(i,r)=>{const o=t&&pw(n,r)||r;ew(n[o])&&ew(i)?n[o]=e(n[o],i):ew(i)?n[o]=e({},i):G_(i)?n[o]=i.slice():n[o]=i};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&uw(arguments[e],i);return n},extend:(e,t,n,{allOwnKeys:i}={})=>(uw(t,((t,i)=>{n&&Z_(t)?e[i]=M_(t,n):e[i]=t}),{allOwnKeys:i}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,i)=>{let r,o,s;const a={};if(t=t||{},null==e)return t;do{for(r=Object.getOwnPropertyNames(e),o=r.length;o-- >0;)s=r[o],i&&!i(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==n&&B_(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:q_,kindOfTest:H_,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const i=e.indexOf(t,n);return-1!==i&&i===n},toArray:e=>{if(!e)return null;if(G_(e))return e;let t=e.length;if(!X_(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[U_]).call(e);let i;for(;(i=n.next())&&!i.done;){const n=i.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const i=[];for(;null!==(n=e.exec(t));)i.push(n);return i},isHTMLForm:mw,hasOwnProperty:gw,hasOwnProp:gw,reduceDescriptors:yw,freezeMethods:e=>{yw(e,((t,n)=>{if(Z_(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const i=e[n];Z_(i)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(e,t)=>{const n={},i=e=>{e.forEach((e=>{n[e]=!0}))};return G_(e)?i(e):i(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:pw,global:dw,isContextDefined:fw,isSpecCompliantForm:function(e){return!!(e&&Z_(e.append)&&"FormData"===e[z_]&&e[U_])},toJSONObject:e=>{const t=new Array(10),n=(e,i)=>{if(Q_(e)){if(t.indexOf(e)>=0)return;if(K_(e))return e;if(!("toJSON"in e)){t[i]=e;const r=G_(e)?[]:{};return uw(e,((e,t)=>{const o=n(e,i+1);!V_(o)&&(r[t]=o)})),t[i]=void 0,r}}return e};return n(e,0)},isAsyncFn:xw,isThenable:e=>e&&(Q_(e)||Z_(e))&&Z_(e.then)&&Z_(e.catch),setImmediate:bw,asap:_w,isIterable:e=>null!=e&&Z_(e[U_])};function Ew(e,t,n,i,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),i&&(this.request=i),r&&(this.response=r,this.status=r.status?r.status:null)}ww.inherits(Ew,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ww.toJSONObject(this.config),code:this.code,status:this.status}}});const Sw=Ew.prototype,kw={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{kw[e]={value:e}})),Object.defineProperties(Ew,kw),Object.defineProperty(Sw,"isAxiosError",{value:!0}),Ew.from=(e,t,n,i,r,o)=>{const s=Object.create(Sw);return ww.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),Ew.call(s,e.message,t,n,i,r),s.cause=e,s.name=e.name,o&&Object.assign(s,o),s};var Rw,Tw,Ow=Object,Aw=Error,Cw=EvalError,Pw=RangeError,jw=ReferenceError,Lw=SyntaxError;function Nw(){return Tw?Rw:(Tw=1,Rw=TypeError)}var Iw=URIError,Dw=Math.abs,Fw=Math.floor,Mw=Math.max,$w=Math.min,Bw=Math.pow,Uw=Math.round,zw=Number.isNaN||function(e){return e!=e},qw=Object.getOwnPropertyDescriptor;if(qw)try{qw([],"length")}catch(e){qw=null}var Hw=qw,Ww=Object.defineProperty||!1;if(Ww)try{Ww({},"a",{value:1})}catch(e){Ww=!1}var Gw,Vw,Kw,Jw,Yw,Zw,Xw,Qw,eE=Ww;function tE(){return Vw?Gw:(Vw=1,Gw=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),n=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(var i in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0})}function nE(){return Zw?Yw:(Zw=1,Yw="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null)}function iE(){return Qw?Xw:(Qw=1,Xw=Ow.getPrototypeOf||null)}var rE,oE,sE,aE,cE,lE,uE,pE,dE,fE,hE,mE,gE,vE,yE=Object.prototype.toString,xE=Math.max,bE=function(e,t){for(var n=[],i=0;i<e.length;i+=1)n[i]=e[i];for(var r=0;r<t.length;r+=1)n[r+e.length]=t[r];return n},_E=function(e){var t=this;if("function"!=typeof t||"[object Function]"!==yE.apply(t))throw new TypeError("Function.prototype.bind called on incompatible "+t);for(var n,i=function(e,t){for(var n=[],i=t,r=0;i<e.length;i+=1,r+=1)n[r]=e[i];return n}(arguments,1),r=xE(0,t.length-i.length),o=[],s=0;s<r;s++)o[s]="$"+s;if(n=Function("binder","return function ("+function(e,t){for(var n="",i=0;i<e.length;i+=1)n+=e[i],i+1<e.length&&(n+=t);return n}(o,",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof n){var r=t.apply(this,bE(i,arguments));return Object(r)===r?r:this}return t.apply(e,bE(i,arguments))})),t.prototype){var a=function(){};a.prototype=t.prototype,n.prototype=new a,a.prototype=null}return n},wE=Function.prototype.bind||_E;function EE(){return oE?rE:(oE=1,rE=Function.prototype.call)}function SE(){return aE?sE:(aE=1,sE=Function.prototype.apply)}function kE(){if(pE)return uE;pE=1;var e=wE,t=SE(),n=EE(),i=lE?cE:(lE=1,cE="undefined"!=typeof Reflect&&Reflect&&Reflect.apply);return uE=i||e.call(n,t)}function RE(){if(mE)return hE;mE=1;var e,t=function(){if(fE)return dE;fE=1;var e=wE,t=Nw(),n=EE(),i=kE();return dE=function(r){if(r.length<1||"function"!=typeof r[0])throw new t("a function is required");return i(e,n,r)}}(),n=Hw;try{e=[].__proto__===Array.prototype}catch(e){if(!e||"object"!=typeof e||!("code"in e)||"ERR_PROTO_ACCESS"!==e.code)throw e}var i=!!e&&n&&n(Object.prototype,"__proto__"),r=Object,o=r.getPrototypeOf;return hE=i&&"function"==typeof i.get?t([i.get]):"function"==typeof o&&function(e){return o(null==e?e:r(e))}}var TE,OE=Function.prototype.call,AE=Object.prototype.hasOwnProperty,CE=wE.call(OE,AE),PE=Ow,jE=Aw,LE=Cw,NE=Pw,IE=jw,DE=Lw,FE=Nw(),ME=Iw,$E=Dw,BE=Fw,UE=Mw,zE=$w,qE=Bw,HE=Uw,WE=function(e){return zw(e)||0===e?e:e<0?-1:1},GE=Function,VE=function(e){try{return GE('"use strict"; return ('+e+").constructor;")()}catch(e){}},KE=Hw,JE=eE,YE=function(){throw new FE},ZE=KE?function(){try{return YE}catch(e){try{return KE(arguments,"callee").get}catch(e){return YE}}}():YE,XE=function(){if(Jw)return Kw;Jw=1;var e="undefined"!=typeof Symbol&&Symbol,t=tE();return Kw=function(){return"function"==typeof e&&("function"==typeof Symbol&&("symbol"==typeof e("foo")&&("symbol"==typeof Symbol("bar")&&t())))}}()(),QE=function(){if(vE)return gE;vE=1;var e=nE(),t=iE(),n=RE();return gE=e?function(t){return e(t)}:t?function(e){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new TypeError("getProto: not an object");return t(e)}:n?function(e){return n(e)}:null}(),eS=iE(),tS=nE(),nS=SE(),iS=EE(),rS={},oS="undefined"!=typeof Uint8Array&&QE?QE(Uint8Array):TE,sS={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?TE:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?TE:ArrayBuffer,"%ArrayIteratorPrototype%":XE&&QE?QE([][Symbol.iterator]()):TE,"%AsyncFromSyncIteratorPrototype%":TE,"%AsyncFunction%":rS,"%AsyncGenerator%":rS,"%AsyncGeneratorFunction%":rS,"%AsyncIteratorPrototype%":rS,"%Atomics%":"undefined"==typeof Atomics?TE:Atomics,"%BigInt%":"undefined"==typeof BigInt?TE:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?TE:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?TE:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?TE:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":jE,"%eval%":eval,"%EvalError%":LE,"%Float16Array%":"undefined"==typeof Float16Array?TE:Float16Array,"%Float32Array%":"undefined"==typeof Float32Array?TE:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?TE:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?TE:FinalizationRegistry,"%Function%":GE,"%GeneratorFunction%":rS,"%Int8Array%":"undefined"==typeof Int8Array?TE:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?TE:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?TE:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":XE&&QE?QE(QE([][Symbol.iterator]())):TE,"%JSON%":"object"==typeof JSON?JSON:TE,"%Map%":"undefined"==typeof Map?TE:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&XE&&QE?QE((new Map)[Symbol.iterator]()):TE,"%Math%":Math,"%Number%":Number,"%Object%":PE,"%Object.getOwnPropertyDescriptor%":KE,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?TE:Promise,"%Proxy%":"undefined"==typeof Proxy?TE:Proxy,"%RangeError%":NE,"%ReferenceError%":IE,"%Reflect%":"undefined"==typeof Reflect?TE:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?TE:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&XE&&QE?QE((new Set)[Symbol.iterator]()):TE,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?TE:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":XE&&QE?QE(""[Symbol.iterator]()):TE,"%Symbol%":XE?Symbol:TE,"%SyntaxError%":DE,"%ThrowTypeError%":ZE,"%TypedArray%":oS,"%TypeError%":FE,"%Uint8Array%":"undefined"==typeof Uint8Array?TE:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?TE:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?TE:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?TE:Uint32Array,"%URIError%":ME,"%WeakMap%":"undefined"==typeof WeakMap?TE:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?TE:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?TE:WeakSet,"%Function.prototype.call%":iS,"%Function.prototype.apply%":nS,"%Object.defineProperty%":JE,"%Object.getPrototypeOf%":eS,"%Math.abs%":$E,"%Math.floor%":BE,"%Math.max%":UE,"%Math.min%":zE,"%Math.pow%":qE,"%Math.round%":HE,"%Math.sign%":WE,"%Reflect.getPrototypeOf%":tS};if(QE)try{null.error}catch(e){var aS=QE(QE(e));sS["%Error.prototype%"]=aS}var cS,lS,uS=function e(t){var n;if("%AsyncFunction%"===t)n=VE("async function () {}");else if("%GeneratorFunction%"===t)n=VE("function* () {}");else if("%AsyncGeneratorFunction%"===t)n=VE("async function* () {}");else if("%AsyncGenerator%"===t){var i=e("%AsyncGeneratorFunction%");i&&(n=i.prototype)}else if("%AsyncIteratorPrototype%"===t){var r=e("%AsyncGenerator%");r&&QE&&(n=QE(r.prototype))}return sS[t]=n,n},pS={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},dS=wE,fS=CE,hS=dS.call(iS,Array.prototype.concat),mS=dS.call(nS,Array.prototype.splice),gS=dS.call(iS,String.prototype.replace),vS=dS.call(iS,String.prototype.slice),yS=dS.call(iS,RegExp.prototype.exec),xS=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,bS=/\\(\\)?/g,_S=function(e,t){var n,i=e;if(fS(pS,i)&&(i="%"+(n=pS[i])[0]+"%"),fS(sS,i)){var r=sS[i];if(r===rS&&(r=uS(i)),void 0===r&&!t)throw new FE("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:r}}throw new DE("intrinsic "+e+" does not exist!")};var wS=function(e,t){if("string"!=typeof e||0===e.length)throw new FE("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new FE('"allowMissing" argument must be a boolean');if(null===yS(/^%?[^%]*%?$/,e))throw new DE("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=function(e){var t=vS(e,0,1),n=vS(e,-1);if("%"===t&&"%"!==n)throw new DE("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==t)throw new DE("invalid intrinsic syntax, expected opening `%`");var i=[];return gS(e,xS,(function(e,t,n,r){i[i.length]=n?gS(r,bS,"$1"):t||e})),i}(e),i=n.length>0?n[0]:"",r=_S("%"+i+"%",t),o=r.name,s=r.value,a=!1,c=r.alias;c&&(i=c[0],mS(n,hS([0,1],c)));for(var l=1,u=!0;l<n.length;l+=1){var p=n[l],d=vS(p,0,1),f=vS(p,-1);if(('"'===d||"'"===d||"`"===d||'"'===f||"'"===f||"`"===f)&&d!==f)throw new DE("property names with quotes must have matching quotes");if("constructor"!==p&&u||(a=!0),fS(sS,o="%"+(i+="."+p)+"%"))s=sS[o];else if(null!=s){if(!(p in s)){if(!t)throw new FE("base intrinsic for "+e+" exists, but the property is not available.");return}if(KE&&l+1>=n.length){var h=KE(s,p);s=(u=!!h)&&"get"in h&&!("originalValue"in h.get)?h.get:s[p]}else u=fS(s,p),s=s[p];u&&!a&&(sS[o]=s)}}return s},ES=wS("%Object.defineProperty%",!0),SS=function(){if(lS)return cS;lS=1;var e=tE();return cS=function(){return e()&&!!Symbol.toStringTag}}()(),kS=CE,RS=Nw(),TS=SS?Symbol.toStringTag:null,OS=fo,AS=b,CS=d,PS=S,jS=k,LS=R.parse,NS=u,IS=y.Stream,DS=O,FS=mo,MS=Bo,$S=function(e,t){var n=arguments.length>2&&!!arguments[2]&&arguments[2].force,i=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(void 0!==n&&"boolean"!=typeof n||void 0!==i&&"boolean"!=typeof i)throw new RS("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");!TS||!n&&kS(e,TS)||(ES?ES(e,TS,{configurable:!i,enumerable:!1,value:t,writable:!1}):e[TS]=t)},BS=CE,US=function(e,t){return Object.keys(t).forEach((function(n){e[n]=e[n]||t[n]})),e};function zS(e){if(!(this instanceof zS))return new zS(e);for(var t in this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],OS.call(this),e=e||{})this[t]=e[t]}AS.inherits(zS,OS),zS.LINE_BREAK="\r\n",zS.DEFAULT_CONTENT_TYPE="application/octet-stream",zS.prototype.append=function(e,t,n){"string"==typeof(n=n||{})&&(n={filename:n});var i=OS.prototype.append.bind(this);if("number"!=typeof t&&null!=t||(t=String(t)),Array.isArray(t))this._error(new Error("Arrays are not supported."));else{var r=this._multiPartHeader(e,t,n),o=this._multiPartFooter();i(r),i(t),i(o),this._trackLength(r,t,n)}},zS.prototype._trackLength=function(e,t,n){var i=0;null!=n.knownLength?i+=Number(n.knownLength):Buffer.isBuffer(t)?i=t.length:"string"==typeof t&&(i=Buffer.byteLength(t)),this._valueLength+=i,this._overheadLength+=Buffer.byteLength(e)+zS.LINE_BREAK.length,t&&(t.path||t.readable&&BS(t,"httpVersion")||t instanceof IS)&&(n.knownLength||this._valuesToMeasure.push(t))},zS.prototype._lengthRetriever=function(e,t){BS(e,"fd")?null!=e.end&&e.end!=1/0&&null!=e.start?t(null,e.end+1-(e.start?e.start:0)):NS.stat(e.path,(function(n,i){if(n)t(n);else{var r=i.size-(e.start?e.start:0);t(null,r)}})):BS(e,"httpVersion")?t(null,Number(e.headers["content-length"])):BS(e,"httpModule")?(e.on("response",(function(n){e.pause(),t(null,Number(n.headers["content-length"]))})),e.resume()):t("Unknown stream")},zS.prototype._multiPartHeader=function(e,t,n){if("string"==typeof n.header)return n.header;var i,r=this._getContentDisposition(t,n),o=this._getContentType(t,n),s="",a={"Content-Disposition":["form-data",'name="'+e+'"'].concat(r||[]),"Content-Type":[].concat(o||[])};for(var c in"object"==typeof n.header&&US(a,n.header),a)if(BS(a,c)){if(null==(i=a[c]))continue;Array.isArray(i)||(i=[i]),i.length&&(s+=c+": "+i.join("; ")+zS.LINE_BREAK)}return"--"+this.getBoundary()+zS.LINE_BREAK+s+zS.LINE_BREAK},zS.prototype._getContentDisposition=function(e,t){var n;if("string"==typeof t.filepath?n=CS.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e&&(e.name||e.path)?n=CS.basename(t.filename||e&&(e.name||e.path)):e&&e.readable&&BS(e,"httpVersion")&&(n=CS.basename(e.client._httpMessage.path||"")),n)return'filename="'+n+'"'},zS.prototype._getContentType=function(e,t){var n=t.contentType;return!n&&e&&e.name&&(n=FS.lookup(e.name)),!n&&e&&e.path&&(n=FS.lookup(e.path)),!n&&e&&e.readable&&BS(e,"httpVersion")&&(n=e.headers["content-type"]),n||!t.filepath&&!t.filename||(n=FS.lookup(t.filepath||t.filename)),!n&&e&&"object"==typeof e&&(n=zS.DEFAULT_CONTENT_TYPE),n},zS.prototype._multiPartFooter=function(){return function(e){var t=zS.LINE_BREAK;0===this._streams.length&&(t+=this._lastBoundary()),e(t)}.bind(this)},zS.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+zS.LINE_BREAK},zS.prototype.getHeaders=function(e){var t,n={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)BS(e,t)&&(n[t.toLowerCase()]=e[t]);return n},zS.prototype.setBoundary=function(e){if("string"!=typeof e)throw new TypeError("FormData boundary must be a string");this._boundary=e},zS.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary},zS.prototype.getBuffer=function(){for(var e=new Buffer.alloc(0),t=this.getBoundary(),n=0,i=this._streams.length;n<i;n++)"function"!=typeof this._streams[n]&&(e=Buffer.isBuffer(this._streams[n])?Buffer.concat([e,this._streams[n]]):Buffer.concat([e,Buffer.from(this._streams[n])]),"string"==typeof this._streams[n]&&this._streams[n].substring(2,t.length+2)===t||(e=Buffer.concat([e,Buffer.from(zS.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])},zS.prototype._generateBoundary=function(){this._boundary="--------------------------"+DS.randomBytes(12).toString("hex")},zS.prototype.getLengthSync=function(){var e=this._overheadLength+this._valueLength;return this._streams.length&&(e+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),e},zS.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e},zS.prototype.getLength=function(e){var t=this._overheadLength+this._valueLength;this._streams.length&&(t+=this._lastBoundary().length),this._valuesToMeasure.length?MS.parallel(this._valuesToMeasure,this._lengthRetriever,(function(n,i){n?e(n):(i.forEach((function(e){t+=e})),e(null,t))})):process.nextTick(e.bind(this,null,t))},zS.prototype.submit=function(e,t){var n,i,r={method:"post"};return"string"==typeof e?(e=LS(e),i=US({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},r)):(i=US(e,r)).port||(i.port="https:"===i.protocol?443:80),i.headers=this.getHeaders(e.headers),n="https:"===i.protocol?jS.request(i):PS.request(i),this.getLength(function(e,i){if(e&&"Unknown stream"!==e)this._error(e);else if(i&&n.setHeader("Content-Length",i),this.pipe(n),t){var r,o=function(e,i){return n.removeListener("error",o),n.removeListener("response",r),t.call(this,e,i)};r=o.bind(this,null),n.on("error",o),n.on("response",r)}}.bind(this)),n},zS.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))},zS.prototype.toString=function(){return"[object FormData]"},$S(zS,"FormData");var qS=Ue(zS);function HS(e){return ww.isPlainObject(e)||ww.isArray(e)}function WS(e){return ww.endsWith(e,"[]")?e.slice(0,-2):e}function GS(e,t,n){return e?e.concat(t).map((function(e,t){return e=WS(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}const VS=ww.toFlatObject(ww,{},null,(function(e){return/^is[A-Z]/.test(e)}));function KS(e,t,n){if(!ww.isObject(e))throw new TypeError("target must be an object");t=t||new(qS||FormData);const i=(n=ww.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!ww.isUndefined(t[e])}))).metaTokens,r=n.visitor||l,o=n.dots,s=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&ww.isSpecCompliantForm(t);if(!ww.isFunction(r))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(ww.isDate(e))return e.toISOString();if(ww.isBoolean(e))return e.toString();if(!a&&ww.isBlob(e))throw new Ew("Blob is not supported. Use a Buffer instead.");return ww.isArrayBuffer(e)||ww.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,n,r){let a=e;if(e&&!r&&"object"==typeof e)if(ww.endsWith(n,"{}"))n=i?n:n.slice(0,-2),e=JSON.stringify(e);else if(ww.isArray(e)&&function(e){return ww.isArray(e)&&!e.some(HS)}(e)||(ww.isFileList(e)||ww.endsWith(n,"[]"))&&(a=ww.toArray(e)))return n=WS(n),a.forEach((function(e,i){!ww.isUndefined(e)&&null!==e&&t.append(!0===s?GS([n],i,o):null===s?n:n+"[]",c(e))})),!1;return!!HS(e)||(t.append(GS(r,n,o),c(e)),!1)}const u=[],p=Object.assign(VS,{defaultVisitor:l,convertValue:c,isVisitable:HS});if(!ww.isObject(e))throw new TypeError("data must be an object");return function e(n,i){if(!ww.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+i.join("."));u.push(n),ww.forEach(n,(function(n,o){!0===(!(ww.isUndefined(n)||null===n)&&r.call(t,n,ww.isString(o)?o.trim():o,i,p))&&e(n,i?i.concat(o):[o])})),u.pop()}}(e),t}function JS(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function YS(e,t){this._pairs=[],e&&KS(e,this,t)}const ZS=YS.prototype;function XS(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function QS(e,t,n){if(!t)return e;const i=n&&n.encode||XS;ww.isFunction(n)&&(n={serialize:n});const r=n&&n.serialize;let o;if(o=r?r(t,n):ww.isURLSearchParams(t)?t.toString():new YS(t,n).toString(i),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}ZS.append=function(e,t){this._pairs.push([e,t])},ZS.toString=function(e){const t=e?function(t){return e.call(this,t,JS)}:JS;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class ek{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){ww.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}var tk={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},nk=R.URLSearchParams;const ik="abcdefghijklmnopqrstuvwxyz",rk="0123456789",ok={DIGIT:rk,ALPHA:ik,ALPHA_DIGIT:ik+ik.toUpperCase()+rk};var sk={isNode:!0,classes:{URLSearchParams:nk,FormData:qS,Blob:"undefined"!=typeof Blob&&Blob||null},ALPHABET:ok,generateString:(e=16,t=ok.ALPHA_DIGIT)=>{let n="";const{length:i}=t,r=new Uint32Array(e);O.randomFillSync(r);for(let o=0;o<e;o++)n+=t[r[o]%i];return n},protocols:["http","https","file","data"]};const ak="undefined"!=typeof window&&"undefined"!=typeof document,ck="object"==typeof navigator&&navigator||void 0,lk=ak&&(!ck||["ReactNative","NativeScript","NS"].indexOf(ck.product)<0),uk="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,pk=ak&&window.location.href||"http://localhost";var dk={...Object.freeze({__proto__:null,hasBrowserEnv:ak,hasStandardBrowserEnv:lk,hasStandardBrowserWebWorkerEnv:uk,navigator:ck,origin:pk}),...sk};function fk(e){function t(e,n,i,r){let o=e[r++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=r>=e.length;if(o=!o&&ww.isArray(i)?i.length:o,a)return ww.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!s;i[o]&&ww.isObject(i[o])||(i[o]=[]);return t(e,n,i[o],r)&&ww.isArray(i[o])&&(i[o]=function(e){const t={},n=Object.keys(e);let i;const r=n.length;let o;for(i=0;i<r;i++)o=n[i],t[o]=e[o];return t}(i[o])),!s}if(ww.isFormData(e)&&ww.isFunction(e.entries)){const n={};return ww.forEachEntry(e,((e,i)=>{t(function(e){return ww.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),i,n,0)})),n}return null}const hk={transitional:tk,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",i=n.indexOf("application/json")>-1,r=ww.isObject(e);r&&ww.isHTMLForm(e)&&(e=new FormData(e));if(ww.isFormData(e))return i?JSON.stringify(fk(e)):e;if(ww.isArrayBuffer(e)||ww.isBuffer(e)||ww.isStream(e)||ww.isFile(e)||ww.isBlob(e)||ww.isReadableStream(e))return e;if(ww.isArrayBufferView(e))return e.buffer;if(ww.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(r){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return KS(e,new dk.classes.URLSearchParams,{visitor:function(e,t,n,i){return dk.isNode&&ww.isBuffer(e)?(this.append(t,e.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=ww.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return KS(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return r||i?(t.setContentType("application/json",!1),function(e,t,n){if(ww.isString(e))try{return(t||JSON.parse)(e),ww.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||hk.transitional,n=t&&t.forcedJSONParsing,i="json"===this.responseType;if(ww.isResponse(e)||ww.isReadableStream(e))return e;if(e&&ww.isString(e)&&(n&&!this.responseType||i)){const n=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw Ew.from(e,Ew.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:dk.classes.FormData,Blob:dk.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ww.forEach(["delete","get","head","post","put","patch"],(e=>{hk.headers[e]={}}));const mk=ww.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const gk=Symbol("internals");function vk(e){return e&&String(e).trim().toLowerCase()}function yk(e){return!1===e||null==e?e:ww.isArray(e)?e.map(yk):String(e)}function xk(e,t,n,i,r){return ww.isFunction(i)?i.call(this,t,n):(r&&(t=n),ww.isString(t)?ww.isString(i)?-1!==t.indexOf(i):ww.isRegExp(i)?i.test(t):void 0:void 0)}let bk=class{constructor(e){e&&this.set(e)}set(e,t,n){const i=this;function r(e,t,n){const r=vk(t);if(!r)throw new Error("header name must be a non-empty string");const o=ww.findKey(i,r);(!o||void 0===i[o]||!0===n||void 0===n&&!1!==i[o])&&(i[o||t]=yk(e))}const o=(e,t)=>ww.forEach(e,((e,n)=>r(e,n,t)));if(ww.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(ww.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let n,i,r;return e&&e.split("\n").forEach((function(e){r=e.indexOf(":"),n=e.substring(0,r).trim().toLowerCase(),i=e.substring(r+1).trim(),!n||t[n]&&mk[n]||("set-cookie"===n?t[n]?t[n].push(i):t[n]=[i]:t[n]=t[n]?t[n]+", "+i:i)})),t})(e),t);else if(ww.isObject(e)&&ww.isIterable(e)){let n,i,r={};for(const t of e){if(!ww.isArray(t))throw TypeError("Object iterator must return a key-value pair");r[i=t[0]]=(n=r[i])?ww.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}o(r,t)}else null!=e&&r(t,e,n);return this}get(e,t){if(e=vk(e)){const n=ww.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=n.exec(e);)t[i[1]]=i[2];return t}(e);if(ww.isFunction(t))return t.call(this,e,n);if(ww.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=vk(e)){const n=ww.findKey(this,e);return!(!n||void 0===this[n]||t&&!xk(0,this[n],n,t))}return!1}delete(e,t){const n=this;let i=!1;function r(e){if(e=vk(e)){const r=ww.findKey(n,e);!r||t&&!xk(0,n[r],r,t)||(delete n[r],i=!0)}}return ww.isArray(e)?e.forEach(r):r(e),i}clear(e){const t=Object.keys(this);let n=t.length,i=!1;for(;n--;){const r=t[n];e&&!xk(0,this[r],r,e,!0)||(delete this[r],i=!0)}return i}normalize(e){const t=this,n={};return ww.forEach(this,((i,r)=>{const o=ww.findKey(n,r);if(o)return t[o]=yk(i),void delete t[r];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(r):String(r).trim();s!==r&&delete t[r],t[s]=yk(i),n[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return ww.forEach(this,((n,i)=>{null!=n&&!1!==n&&(t[i]=e&&ww.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[gk]=this[gk]={accessors:{}}).accessors,n=this.prototype;function i(e){const i=vk(e);t[i]||(!function(e,t){const n=ww.toCamelCase(" "+t);["get","set","has"].forEach((i=>{Object.defineProperty(e,i+n,{value:function(e,n,r){return this[i].call(this,t,e,n,r)},configurable:!0})}))}(n,e),t[i]=!0)}return ww.isArray(e)?e.forEach(i):i(e),this}};function _k(e,t){const n=this||hk,i=t||n,r=bk.from(i.headers);let o=i.data;return ww.forEach(e,(function(e){o=e.call(n,o,r.normalize(),t?t.status:void 0)})),r.normalize(),o}function wk(e){return!(!e||!e.__CANCEL__)}function Ek(e,t,n){Ew.call(this,null==e?"canceled":e,Ew.ERR_CANCELED,t,n),this.name="CanceledError"}function Sk(e,t,n){const i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(new Ew("Request failed with status code "+n.status,[Ew.ERR_BAD_REQUEST,Ew.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}function kk(e,t,n){let i=!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t);return e&&(i||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}bk.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ww.reduceDescriptors(bk.prototype,(({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}})),ww.freezeMethods(bk),ww.inherits(Ek,Ew,{__CANCEL__:!0});const Rk="1.11.0";function Tk(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}const Ok=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;const Ak=Symbol("internals");class Ck extends y.Transform{constructor(e){super({readableHighWaterMark:(e=ww.toFlatObject(e,{maxRate:0,chunkSize:65536,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,((e,t)=>!ww.isUndefined(t[e])))).chunkSize});const t=this[Ak]={timeWindow:e.timeWindow,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",(e=>{"progress"===e&&(t.isCaptured||(t.isCaptured=!0))}))}_read(e){const t=this[Ak];return t.onReadCallback&&t.onReadCallback(),super._read(e)}_transform(e,t,n){const i=this[Ak],r=i.maxRate,o=this.readableHighWaterMark,s=i.timeWindow,a=r/(1e3/s),c=!1!==i.minChunkSize?Math.max(i.minChunkSize,.01*a):0,l=(e,t)=>{const n=Buffer.byteLength(e);i.bytesSeen+=n,i.bytes+=n,i.isCaptured&&this.emit("progress",i.bytesSeen),this.push(e)?process.nextTick(t):i.onReadCallback=()=>{i.onReadCallback=null,process.nextTick(t)}},u=(e,t)=>{const n=Buffer.byteLength(e);let u,p=null,d=o,f=0;if(r){const e=Date.now();(!i.ts||(f=e-i.ts)>=s)&&(i.ts=e,u=a-i.bytes,i.bytes=u<0?-u:0,f=0),u=a-i.bytes}if(r){if(u<=0)return setTimeout((()=>{t(null,e)}),s-f);u<d&&(d=u)}d&&n>d&&n-d>c&&(p=e.subarray(d),e=e.subarray(0,d)),l(e,p?()=>{process.nextTick(t,null,p)}:t)};u(e,(function e(t,i){if(t)return n(t);i?u(i,e):n(null)}))}}const{asyncIterator:Pk}=Symbol,jk=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[Pk]?yield*e[Pk]():yield e},Lk=dk.ALPHABET.ALPHA_DIGIT+"-_",Nk="function"==typeof TextEncoder?new TextEncoder:new b.TextEncoder,Ik="\r\n",Dk=Nk.encode(Ik);class Fk{constructor(e,t){const{escapeName:n}=this.constructor,i=ww.isString(t);let r=`Content-Disposition: form-data; name="${n(e)}"${!i&&t.name?`; filename="${n(t.name)}"`:""}${Ik}`;i?t=Nk.encode(String(t).replace(/\r?\n|\r\n?/g,Ik)):r+=`Content-Type: ${t.type||"application/octet-stream"}${Ik}`,this.headers=Nk.encode(r+Ik),this.contentLength=i?t.byteLength:t.size,this.size=this.headers.byteLength+this.contentLength+2,this.name=e,this.value=t}async*encode(){yield this.headers;const{value:e}=this;ww.isTypedArray(e)?yield e:yield*jk(e),yield Dk}static escapeName(e){return String(e).replace(/[\r\n"]/g,(e=>({"\r":"%0D","\n":"%0A",'"':"%22"}[e])))}}class Mk extends y.Transform{__transform(e,t,n){this.push(e),n()}_transform(e,t,n){if(0!==e.length&&(this._transform=this.__transform,120!==e[0])){const e=Buffer.alloc(2);e[0]=120,e[1]=156,this.push(e,t)}this.__transform(e,t,n)}}const $k=(e,t)=>ww.isAsyncFn(e)?function(...n){const i=n.pop();e.apply(this,n).then((e=>{try{t?i(null,...t(e)):i(null,e)}catch(e){i(e)}}),i)}:e;const Bk=(e,t,n=3)=>{let i=0;const r=function(e,t){e=e||10;const n=new Array(e),i=new Array(e);let r,o=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=i[s];r||(r=c),n[o]=a,i[o]=c;let u=s,p=0;for(;u!==o;)p+=n[u++],u%=e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),c-r<t)return;const d=l&&c-l;return d?Math.round(1e3*p/d):void 0}}(50,250);return function(e,t){let n,i,r=0,o=1e3/t;const s=(t,o=Date.now())=>{r=o,n=null,i&&(clearTimeout(i),i=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-r;a>=o?s(e,t):(n=e,i||(i=setTimeout((()=>{i=null,s(n)}),o-a)))},()=>n&&s(n)]}((n=>{const o=n.loaded,s=n.lengthComputable?n.total:void 0,a=o-i,c=r(a);i=o;e({loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&o<=s?(s-o)/c:void 0,event:n,lengthComputable:null!=s,[t?"download":"upload"]:!0})}),n)},Uk=(e,t)=>{const n=null!=e;return[i=>t[0]({lengthComputable:n,total:e,loaded:i}),t[1]]},zk=e=>(...t)=>ww.asap((()=>e(...t))),qk={flush:C.constants.Z_SYNC_FLUSH,finishFlush:C.constants.Z_SYNC_FLUSH},Hk={flush:C.constants.BROTLI_OPERATION_FLUSH,finishFlush:C.constants.BROTLI_OPERATION_FLUSH},Wk=ww.isFunction(C.createBrotliDecompress),{http:Gk,https:Vk}=Ua,Kk=/https:?/,Jk=dk.protocols.map((e=>e+":")),Yk=(e,[t,n])=>(e.on("end",n).on("error",n),t);function Zk(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function Xk(e,t,n){let i=t;if(!i&&!1!==i){const e=Fs.getProxyForUrl(n);e&&(i=new URL(e))}if(i){if(i.username&&(i.auth=(i.username||"")+":"+(i.password||"")),i.auth){(i.auth.username||i.auth.password)&&(i.auth=(i.auth.username||"")+":"+(i.auth.password||""));const t=Buffer.from(i.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+t}e.headers.host=e.hostname+(e.port?":"+e.port:"");const t=i.hostname||i.host;e.hostname=t,e.host=t,e.port=i.port,e.path=n,i.protocol&&(e.protocol=i.protocol.includes(":")?i.protocol:`${i.protocol}:`)}e.beforeRedirects.proxy=function(e){Xk(e,t,e.href)}}const Qk="undefined"!=typeof process&&"process"===ww.kindOf(process),eR=(e,t)=>(({address:e,family:t})=>{if(!ww.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}})(ww.isObject(e)?e:{address:e,family:t});var tR=Qk&&function(e){return t=async function(t,n,i){let{data:r,lookup:o,family:s}=e;const{responseType:a,responseEncoding:c}=e,l=e.method.toUpperCase();let u,p,d=!1;if(o){const e=$k(o,(e=>ww.isArray(e)?e:[e]));o=(t,n,i)=>{e(t,n,((e,t,r)=>{if(e)return i(e);const o=ww.isArray(t)?t.map((e=>eR(e))):[eR(t,r)];n.all?i(e,o):i(e,o[0].address,o[0].family)}))}}const f=new j,h=()=>{e.cancelToken&&e.cancelToken.unsubscribe(m),e.signal&&e.signal.removeEventListener("abort",m),f.removeAllListeners()};function m(t){f.emit("abort",!t||t.type?new Ek(null,e,p):t)}i(((e,t)=>{u=!0,t&&(d=!0,h())})),f.once("abort",n),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(m),e.signal&&(e.signal.aborted?m():e.signal.addEventListener("abort",m)));const g=kk(e.baseURL,e.url,e.allowAbsoluteUrls),v=new URL(g,dk.hasBrowserEnv?dk.origin:void 0),_=v.protocol||Jk[0];if("data:"===_){let i;if("GET"!==l)return Sk(t,n,{status:405,statusText:"method not allowed",headers:{},config:e});try{i=function(e,t,n){const i=n&&n.Blob||dk.classes.Blob,r=Tk(e);if(void 0===t&&i&&(t=!0),"data"===r){e=r.length?e.slice(r.length+1):e;const n=Ok.exec(e);if(!n)throw new Ew("Invalid URL",Ew.ERR_INVALID_URL);const o=n[1],s=n[2],a=n[3],c=Buffer.from(decodeURIComponent(a),s?"base64":"utf8");if(t){if(!i)throw new Ew("Blob is not supported",Ew.ERR_NOT_SUPPORT);return new i([c],{type:o})}return c}throw new Ew("Unsupported protocol "+r,Ew.ERR_NOT_SUPPORT)}(e.url,"blob"===a,{Blob:e.env&&e.env.Blob})}catch(t){throw Ew.from(t,Ew.ERR_BAD_REQUEST,e)}return"text"===a?(i=i.toString(c),c&&"utf8"!==c||(i=ww.stripBOM(i))):"stream"===a&&(i=y.Readable.from(i)),Sk(t,n,{data:i,status:200,statusText:"OK",headers:new bk,config:e})}if(-1===Jk.indexOf(_))return n(new Ew("Unsupported protocol "+_,Ew.ERR_BAD_REQUEST,e));const w=bk.from(e.headers).normalize();w.set("User-Agent","axios/"+Rk,!1);const{onUploadProgress:E,onDownloadProgress:R}=e,T=e.maxRate;let O,A;if(ww.isSpecCompliantForm(r)){const e=w.getContentType(/boundary=([-_\w\d]{10,70})/i);r=((e,t,n)=>{const{tag:i="form-data-boundary",size:r=25,boundary:o=i+"-"+dk.generateString(r,Lk)}=n||{};if(!ww.isFormData(e))throw TypeError("FormData instance required");if(o.length<1||o.length>70)throw Error("boundary must be 10-70 characters long");const s=Nk.encode("--"+o+Ik),a=Nk.encode("--"+o+"--"+Ik);let c=a.byteLength;const l=Array.from(e.entries()).map((([e,t])=>{const n=new Fk(e,t);return c+=n.size,n}));c+=s.byteLength*l.length,c=ww.toFiniteNumber(c);const u={"Content-Type":`multipart/form-data; boundary=${o}`};return Number.isFinite(c)&&(u["Content-Length"]=c),t&&t(u),x.from(async function*(){for(const e of l)yield s,yield*e.encode();yield a}())})(r,(e=>{w.set(e)}),{tag:`axios-${Rk}-boundary`,boundary:e&&e[1]||void 0})}else if(ww.isFormData(r)&&ww.isFunction(r.getHeaders)){if(w.set(r.getHeaders()),!w.hasContentLength())try{const e=await b.promisify(r.getLength).call(r);Number.isFinite(e)&&e>=0&&w.setContentLength(e)}catch(e){}}else if(ww.isBlob(r)||ww.isFile(r))r.size&&w.setContentType(r.type||"application/octet-stream"),w.setContentLength(r.size||0),r=y.Readable.from(jk(r));else if(r&&!ww.isStream(r)){if(Buffer.isBuffer(r));else if(ww.isArrayBuffer(r))r=Buffer.from(new Uint8Array(r));else{if(!ww.isString(r))return n(new Ew("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",Ew.ERR_BAD_REQUEST,e));r=Buffer.from(r,"utf-8")}if(w.setContentLength(r.length,!1),e.maxBodyLength>-1&&r.length>e.maxBodyLength)return n(new Ew("Request body larger than maxBodyLength limit",Ew.ERR_BAD_REQUEST,e))}const P=ww.toFiniteNumber(w.getContentLength());let L,N;ww.isArray(T)?(O=T[0],A=T[1]):O=A=T,r&&(E||O)&&(ww.isStream(r)||(r=y.Readable.from(r,{objectMode:!1})),r=y.pipeline([r,new Ck({maxRate:ww.toFiniteNumber(O)})],ww.noop),E&&r.on("progress",Yk(r,Uk(P,Bk(zk(E),!1,3))))),e.auth&&(L=(e.auth.username||"")+":"+(e.auth.password||"")),!L&&v.username&&(L=v.username+":"+v.password),L&&w.delete("authorization");try{N=QS(v.pathname+v.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(t){const i=new Error(t.message);return i.config=e,i.url=e.url,i.exists=!0,n(i)}w.set("Accept-Encoding","gzip, compress, deflate"+(Wk?", br":""),!1);const I={path:N,method:l,headers:w.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:L,protocol:_,family:s,beforeRedirect:Zk,beforeRedirects:{}};let D;!ww.isUndefined(o)&&(I.lookup=o),e.socketPath?I.socketPath=e.socketPath:(I.hostname=v.hostname.startsWith("[")?v.hostname.slice(1,-1):v.hostname,I.port=v.port,Xk(I,e.proxy,_+"//"+v.hostname+(v.port?":"+v.port:"")+I.path));const F=Kk.test(I.protocol);if(I.agent=F?e.httpsAgent:e.httpAgent,e.transport?D=e.transport:0===e.maxRedirects?D=F?k:S:(e.maxRedirects&&(I.maxRedirects=e.maxRedirects),e.beforeRedirect&&(I.beforeRedirects.config=e.beforeRedirect),D=F?Vk:Gk),e.maxBodyLength>-1?I.maxBodyLength=e.maxBodyLength:I.maxBodyLength=1/0,e.insecureHTTPParser&&(I.insecureHTTPParser=e.insecureHTTPParser),p=D.request(I,(function(i){if(p.destroyed)return;const r=[i],o=+i.headers["content-length"];if(R||A){const e=new Ck({maxRate:ww.toFiniteNumber(A)});R&&e.on("progress",Yk(e,Uk(o,Bk(zk(R),!0,3)))),r.push(e)}let s=i;const u=i.req||p;if(!1!==e.decompress&&i.headers["content-encoding"])switch("HEAD"!==l&&204!==i.statusCode||delete i.headers["content-encoding"],(i.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":r.push(C.createUnzip(qk)),delete i.headers["content-encoding"];break;case"deflate":r.push(new Mk),r.push(C.createUnzip(qk)),delete i.headers["content-encoding"];break;case"br":Wk&&(r.push(C.createBrotliDecompress(Hk)),delete i.headers["content-encoding"])}s=r.length>1?y.pipeline(r,ww.noop):r[0];const m=y.finished(s,(()=>{m(),h()})),g={status:i.statusCode,statusText:i.statusMessage,headers:new bk(i.headers),config:e,request:u};if("stream"===a)g.data=s,Sk(t,n,g);else{const i=[];let r=0;s.on("data",(function(t){i.push(t),r+=t.length,e.maxContentLength>-1&&r>e.maxContentLength&&(d=!0,s.destroy(),n(new Ew("maxContentLength size of "+e.maxContentLength+" exceeded",Ew.ERR_BAD_RESPONSE,e,u)))})),s.on("aborted",(function(){if(d)return;const t=new Ew("stream has been aborted",Ew.ERR_BAD_RESPONSE,e,u);s.destroy(t),n(t)})),s.on("error",(function(t){p.destroyed||n(Ew.from(t,null,e,u))})),s.on("end",(function(){try{let e=1===i.length?i[0]:Buffer.concat(i);"arraybuffer"!==a&&(e=e.toString(c),c&&"utf8"!==c||(e=ww.stripBOM(e))),g.data=e}catch(t){return n(Ew.from(t,null,e,g.request,g))}Sk(t,n,g)}))}f.once("abort",(e=>{s.destroyed||(s.emit("error",e),s.destroy())}))})),f.once("abort",(e=>{n(e),p.destroy(e)})),p.on("error",(function(t){n(Ew.from(t,null,e,p))})),p.on("socket",(function(e){e.setKeepAlive(!0,6e4)})),e.timeout){const t=parseInt(e.timeout,10);if(Number.isNaN(t))return void n(new Ew("error trying to parse `config.timeout` to int",Ew.ERR_BAD_OPTION_VALUE,e,p));p.setTimeout(t,(function(){if(u)return;let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const i=e.transitional||tk;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new Ew(t,i.clarifyTimeoutError?Ew.ETIMEDOUT:Ew.ECONNABORTED,e,p)),m()}))}if(ww.isStream(r)){let t=!1,n=!1;r.on("end",(()=>{t=!0})),r.once("error",(e=>{n=!0,p.destroy(e)})),r.on("close",(()=>{t||n||m(new Ek("Request stream has been aborted",e,p))})),r.pipe(p)}else p.end(r)},new Promise(((e,n)=>{let i,r;const o=(e,t)=>{r||(r=!0,i&&i(e,t))},s=e=>{o(e,!0),n(e)};t((t=>{o(t),e(t)}),s,(e=>i=e)).catch(s)}));var t},nR=dk.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,dk.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(dk.origin),dk.navigator&&/(msie|trident)/i.test(dk.navigator.userAgent)):()=>!0,iR=dk.hasStandardBrowserEnv?{write(e,t,n,i,r,o){const s=[e+"="+encodeURIComponent(t)];ww.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),ww.isString(i)&&s.push("path="+i),ww.isString(r)&&s.push("domain="+r),!0===o&&s.push("secure"),document.cookie=s.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};const rR=e=>e instanceof bk?{...e}:e;function oR(e,t){t=t||{};const n={};function i(e,t,n,i){return ww.isPlainObject(e)&&ww.isPlainObject(t)?ww.merge.call({caseless:i},e,t):ww.isPlainObject(t)?ww.merge({},t):ww.isArray(t)?t.slice():t}function r(e,t,n,r){return ww.isUndefined(t)?ww.isUndefined(e)?void 0:i(void 0,e,0,r):i(e,t,0,r)}function o(e,t){if(!ww.isUndefined(t))return i(void 0,t)}function s(e,t){return ww.isUndefined(t)?ww.isUndefined(e)?void 0:i(void 0,e):i(void 0,t)}function a(n,r,o){return o in t?i(n,r):o in e?i(void 0,n):void 0}const c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t,n)=>r(rR(e),rR(t),0,!0)};return ww.forEach(Object.keys({...e,...t}),(function(i){const o=c[i]||r,s=o(e[i],t[i],i);ww.isUndefined(s)&&o!==a||(n[i]=s)})),n}var sR=e=>{const t=oR({},e);let n,{data:i,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:s,headers:a,auth:c}=t;if(t.headers=a=bk.from(a),t.url=QS(kk(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),ww.isFormData(i))if(dk.hasStandardBrowserEnv||dk.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(n=a.getContentType())){const[e,...t]=n?n.split(";").map((e=>e.trim())).filter(Boolean):[];a.setContentType([e||"multipart/form-data",...t].join("; "))}if(dk.hasStandardBrowserEnv&&(r&&ww.isFunction(r)&&(r=r(t)),r||!1!==r&&nR(t.url))){const e=o&&s&&iR.read(s);e&&a.set(o,e)}return t};var aR="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){const i=sR(e);let r=i.data;const o=bk.from(i.headers).normalize();let s,a,c,l,u,{responseType:p,onUploadProgress:d,onDownloadProgress:f}=i;function h(){l&&l(),u&&u(),i.cancelToken&&i.cancelToken.unsubscribe(s),i.signal&&i.signal.removeEventListener("abort",s)}let m=new XMLHttpRequest;function g(){if(!m)return;const i=bk.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Sk((function(e){t(e),h()}),(function(e){n(e),h()}),{data:p&&"text"!==p&&"json"!==p?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:i,config:e,request:m}),m=null}m.open(i.method.toUpperCase(),i.url,!0),m.timeout=i.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new Ew("Request aborted",Ew.ECONNABORTED,e,m)),m=null)},m.onerror=function(){n(new Ew("Network Error",Ew.ERR_NETWORK,e,m)),m=null},m.ontimeout=function(){let t=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const r=i.transitional||tk;i.timeoutErrorMessage&&(t=i.timeoutErrorMessage),n(new Ew(t,r.clarifyTimeoutError?Ew.ETIMEDOUT:Ew.ECONNABORTED,e,m)),m=null},void 0===r&&o.setContentType(null),"setRequestHeader"in m&&ww.forEach(o.toJSON(),(function(e,t){m.setRequestHeader(t,e)})),ww.isUndefined(i.withCredentials)||(m.withCredentials=!!i.withCredentials),p&&"json"!==p&&(m.responseType=i.responseType),f&&([c,u]=Bk(f,!0),m.addEventListener("progress",c)),d&&m.upload&&([a,l]=Bk(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",l)),(i.cancelToken||i.signal)&&(s=t=>{m&&(n(!t||t.type?new Ek(null,e,m):t),m.abort(),m=null)},i.cancelToken&&i.cancelToken.subscribe(s),i.signal&&(i.signal.aborted?s():i.signal.addEventListener("abort",s)));const v=Tk(i.url);v&&-1===dk.protocols.indexOf(v)?n(new Ew("Unsupported protocol "+v+":",Ew.ERR_BAD_REQUEST,e)):m.send(r||null)}))};const cR=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,i=new AbortController;const r=function(e){if(!n){n=!0,s();const t=e instanceof Error?e:this.reason;i.abort(t instanceof Ew?t:new Ek(t instanceof Error?t.message:t))}};let o=t&&setTimeout((()=>{o=null,r(new Ew(`timeout ${t} of ms exceeded`,Ew.ETIMEDOUT))}),t);const s=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(r):e.removeEventListener("abort",r)})),e=null)};e.forEach((e=>e.addEventListener("abort",r)));const{signal:a}=i;return a.unsubscribe=()=>ww.asap(s),a}},lR=function*(e,t){let n=e.byteLength;if(n<t)return void(yield e);let i,r=0;for(;r<n;)i=r+t,yield e.slice(r,i),r=i},uR=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},pR=(e,t,n,i)=>{const r=async function*(e,t){for await(const n of uR(e))yield*lR(n,t)}(e,t);let o,s=0,a=e=>{o||(o=!0,i&&i(e))};return new ReadableStream({async pull(e){try{const{done:t,value:i}=await r.next();if(t)return a(),void e.close();let o=i.byteLength;if(n){let e=s+=o;n(e)}e.enqueue(new Uint8Array(i))}catch(e){throw a(e),e}},cancel:e=>(a(e),r.return())},{highWaterMark:2})},dR="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,fR=dR&&"function"==typeof ReadableStream,hR=dR&&("function"==typeof TextEncoder?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),mR=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},gR=fR&&mR((()=>{let e=!1;const t=new Request(dk.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),vR=fR&&mR((()=>ww.isReadableStream(new Response("").body))),yR={stream:vR&&(e=>e.body)};dR&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach((t=>{!yR[t]&&(yR[t]=ww.isFunction(e[t])?e=>e[t]():(e,n)=>{throw new Ew(`Response type '${t}' is not supported`,Ew.ERR_NOT_SUPPORT,n)})}))})(new Response);const xR=async(e,t)=>{const n=ww.toFiniteNumber(e.getContentLength());return null==n?(async e=>{if(null==e)return 0;if(ww.isBlob(e))return e.size;if(ww.isSpecCompliantForm(e)){const t=new Request(dk.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return ww.isArrayBufferView(e)||ww.isArrayBuffer(e)?e.byteLength:(ww.isURLSearchParams(e)&&(e+=""),ww.isString(e)?(await hR(e)).byteLength:void 0)})(t):n};var bR=dR&&(async e=>{let{url:t,method:n,data:i,signal:r,cancelToken:o,timeout:s,onDownloadProgress:a,onUploadProgress:c,responseType:l,headers:u,withCredentials:p="same-origin",fetchOptions:d}=sR(e);l=l?(l+"").toLowerCase():"text";let f,h=cR([r,o&&o.toAbortSignal()],s);const m=h&&h.unsubscribe&&(()=>{h.unsubscribe()});let g;try{if(c&&gR&&"get"!==n&&"head"!==n&&0!==(g=await xR(u,i))){let e,n=new Request(t,{method:"POST",body:i,duplex:"half"});if(ww.isFormData(i)&&(e=n.headers.get("content-type"))&&u.setContentType(e),n.body){const[e,t]=Uk(g,Bk(zk(c)));i=pR(n.body,65536,e,t)}}ww.isString(p)||(p=p?"include":"omit");const r="credentials"in Request.prototype;f=new Request(t,{...d,signal:h,method:n.toUpperCase(),headers:u.normalize().toJSON(),body:i,duplex:"half",credentials:r?p:void 0});let o=await fetch(f,d);const s=vR&&("stream"===l||"response"===l);if(vR&&(a||s&&m)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=o[t]}));const t=ww.toFiniteNumber(o.headers.get("content-length")),[n,i]=a&&Uk(t,Bk(zk(a),!0))||[];o=new Response(pR(o.body,65536,n,(()=>{i&&i(),m&&m()})),e)}l=l||"text";let v=await yR[ww.findKey(yR,l)||"text"](o,e);return!s&&m&&m(),await new Promise(((t,n)=>{Sk(t,n,{data:v,headers:bk.from(o.headers),status:o.status,statusText:o.statusText,config:e,request:f})}))}catch(t){if(m&&m(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Ew("Network Error",Ew.ERR_NETWORK,e,f),{cause:t.cause||t});throw Ew.from(t,t&&t.code,e,f)}});const _R={http:tR,xhr:aR,fetch:bR};ww.forEach(_R,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const wR=e=>`- ${e}`,ER=e=>ww.isFunction(e)||null===e||!1===e;var SR=e=>{e=ww.isArray(e)?e:[e];const{length:t}=e;let n,i;const r={};for(let o=0;o<t;o++){let t;if(n=e[o],i=n,!ER(n)&&(i=_R[(t=String(n)).toLowerCase()],void 0===i))throw new Ew(`Unknown adapter '${t}'`);if(i)break;r[t||"#"+o]=i}if(!i){const e=Object.entries(r).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new Ew("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(wR).join("\n"):" "+wR(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return i};function kR(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ek(null,e)}function RR(e){kR(e),e.headers=bk.from(e.headers),e.data=_k.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return SR(e.adapter||hk.adapter)(e).then((function(t){return kR(e),t.data=_k.call(e,e.transformResponse,t),t.headers=bk.from(t.headers),t}),(function(t){return wk(t)||(kR(e),t&&t.response&&(t.response.data=_k.call(e,e.transformResponse,t.response),t.response.headers=bk.from(t.response.headers))),Promise.reject(t)}))}const TR={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{TR[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const OR={};TR.transitional=function(e,t,n){function i(e,t){return"[Axios v"+Rk+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,r,o)=>{if(!1===e)throw new Ew(i(r," has been removed"+(t?" in "+t:"")),Ew.ERR_DEPRECATED);return t&&!OR[r]&&(OR[r]=!0,console.warn(i(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,o)}},TR.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var AR={assertOptions:function(e,t,n){if("object"!=typeof e)throw new Ew("options must be an object",Ew.ERR_BAD_OPTION_VALUE);const i=Object.keys(e);let r=i.length;for(;r-- >0;){const o=i[r],s=t[o];if(s){const t=e[o],n=void 0===t||s(t,o,e);if(!0!==n)throw new Ew("option "+o+" must be "+n,Ew.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new Ew("Unknown option "+o,Ew.ERR_BAD_OPTION)}},validators:TR};const CR=AR.validators;let PR=class{constructor(e){this.defaults=e||{},this.interceptors={request:new ek,response:new ek}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=oR(this.defaults,t);const{transitional:n,paramsSerializer:i,headers:r}=t;void 0!==n&&AR.assertOptions(n,{silentJSONParsing:CR.transitional(CR.boolean),forcedJSONParsing:CR.transitional(CR.boolean),clarifyTimeoutError:CR.transitional(CR.boolean)},!1),null!=i&&(ww.isFunction(i)?t.paramsSerializer={serialize:i}:AR.assertOptions(i,{encode:CR.function,serialize:CR.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),AR.assertOptions(t,{baseUrl:CR.spelling("baseURL"),withXsrfToken:CR.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=r&&ww.merge(r.common,r[t.method]);r&&ww.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete r[e]})),t.headers=bk.concat(o,r);const s=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));const c=[];let l;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let u,p=0;if(!a){const e=[RR.bind(this),void 0];for(e.unshift(...s),e.push(...c),u=e.length,l=Promise.resolve(t);p<u;)l=l.then(e[p++],e[p++]);return l}u=s.length;let d=t;for(p=0;p<u;){const e=s[p++],t=s[p++];try{d=e(d)}catch(e){t.call(this,e);break}}try{l=RR.call(this,d)}catch(e){return Promise.reject(e)}for(p=0,u=c.length;p<u;)l=l.then(c[p++],c[p++]);return l}getUri(e){return QS(kk((e=oR(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};ww.forEach(["delete","get","head","options"],(function(e){PR.prototype[e]=function(t,n){return this.request(oR(n||{},{method:e,url:t,data:(n||{}).data}))}})),ww.forEach(["post","put","patch"],(function(e){function t(t){return function(n,i,r){return this.request(oR(r||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:i}))}}PR.prototype[e]=t(),PR.prototype[e+"Form"]=t(!0)}));const jR={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(jR).forEach((([e,t])=>{jR[t]=e}));const LR=function e(t){const n=new PR(t),i=M_(PR.prototype.request,n);return ww.extend(i,PR.prototype,n,{allOwnKeys:!0}),ww.extend(i,n,null,{allOwnKeys:!0}),i.create=function(n){return e(oR(t,n))},i}(hk);LR.Axios=PR,LR.CanceledError=Ek,LR.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then((e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const i=new Promise((e=>{n.subscribe(e),t=e})).then(e);return i.cancel=function(){n.unsubscribe(t)},i},e((function(e,i,r){n.reason||(n.reason=new Ek(e,i,r),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e((function(e){t=e})),cancel:t}}},LR.isCancel=wk,LR.VERSION=Rk,LR.toFormData=KS,LR.AxiosError=Ew,LR.Cancel=LR.CanceledError,LR.all=function(e){return Promise.all(e)},LR.spread=function(e){return function(t){return e.apply(null,t)}},LR.isAxiosError=function(e){return ww.isObject(e)&&!0===e.isAxiosError},LR.mergeConfig=oR,LR.AxiosHeaders=bk,LR.formToJSON=e=>fk(ww.isHTMLForm(e)?new FormData(e):e),LR.getAdapter=SR,LR.HttpStatusCode=jR,LR.default=LR;const{Axios:NR,AxiosError:IR,CanceledError:DR,isCancel:FR,CancelToken:MR,VERSION:$R,all:BR,Cancel:UR,isAxiosError:zR,spread:qR,toFormData:HR,AxiosHeaders:WR,HttpStatusCode:GR,formToJSON:VR,getAdapter:KR,mergeConfig:JR}=LR,YR="https://comate.baidu.com",ZR=LR.create();async function XR({license:e,type:t}){var n;return(await(n=e,ZR({baseURL:YR,method:"GET",url:"/api/v2/api/models/available",params:{type:"ZULU",key:n}}))).data.data.filter((e=>e.modes&&e.modes.includes(t))).map((e=>({modelId:e.modelId,displayName:e.displayName})))}ZR.interceptors.request.use((async e=>{const t=process.env.HTTP_HOST;if(t&&e.url)try{const n=new URL(t),i=new URL(e.url,e.baseURL||YR);e.url=`${n.protocol}//${n.host}${i.pathname}${i.search}`,e.baseURL=void 0}catch(e){console.warn(`Invalid HTTP_HOST URL: ${t}`)}const n=process.env.HTTP_PROXY||process.env.HTTPS_PROXY||process.env.http_proxy||process.env.https_proxy;if(n&&!e.proxy)try{const t=new URL(n);e.proxy={protocol:t.protocol.slice(0,-1),host:t.hostname,port:parseInt(t.port)||("https:"===t.protocol?443:80),...t.username&&t.password&&{auth:{username:t.username,password:t.password}}}}catch(e){console.warn(`Invalid proxy URL: ${n}`)}return e}));const QR=t=>{const n={license:"",username:"zulu-cli",query:"",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"===L.platform()?"cmd.exe":"/bin/sh",ideSeries:"vscode",ideVersion:"1.100.1",ideName:jb.VSCode,platform:process.env.PLATFORM||Pb.SAAS,deviceId:e(),pluginVersion:"3.10.0",ripgrepPath:Mb(),queryDelay:0,conversationId:"",...t};return new D_(n)};class eT extends ae{static paths=[ae.Default];ping=De("--ping",!1,{description:"测试网络连通性"});help=De("--help",!1,{description:"帮助信息"});version=De("--version",!1,{description:"版本信息"});async execute(){if(!(this.help||this.version||this.ping)){const e=new Ne;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 Ib;console.log("🏓 Starting Comate API ping test with proxy support...\n");const t=process.env.HTTP_HOST;t&&console.log(`🌐 HTTP_HOST override detected: ${t}`);const n=process.env.http_proxy||process.env.HTTP_PROXY||process.env.https_proxy||process.env.HTTPS_PROXY;if(n){console.log(`🌐 Detected proxy from environment: ${n}`);const e=await Ib.testProxy(n);console.log(`🔍 Proxy test: ${e?"✅ Working":"❌ Failed"}\n`)}else console.log("🌐 No proxy detected, using direct connection\n");console.log("Single ping:");const i=await e.ping({timeout:5e3,retries:3,retryDelay:1e3});console.log(i),console.log("\n"+"=".repeat(50)+"\n"),console.log("Continuous ping (5 times):");const r=await e.continuousPing(5,1e3,{timeout:5e3,retries:2}),o=Ib.getStats(r);console.log("\n📊 Statistics:"),console.log(`Total: ${o.total}`),console.log(`Successful: ${o.successful}`),console.log(`Failed: ${o.failed}`),console.log(`Success Rate: ${o.successRate.toFixed(2)}%`),console.log(`Avg Response Time: ${o.avgResponseTime.toFixed(2)}ms`),console.log(`Min Response Time: ${o.minResponseTime}ms`),console.log(`Max Response Time: ${o.maxResponseTime}ms`)}(),0):(this.context.stdout.write(this.cli.usage(this)),0)}}const tT=new je({binaryName:"zulu",binaryLabel:"AI Coding Agent Zulu",binaryVersion:Fb});function nT(){tT.runExit(process.argv.slice(2))}tT.register(Ne),tT.register(Ie),tT.register(eT),tT.register(class extends ae{static paths=[["run"]];static usage={description:"与 Zulu 一起工作,对完整代码库进行全面修改"};license=Fe("--license",{description:"License"});query=Fe("--query",{description:"问题描述"});search=Fe("--search",{description:"本地检索的查询内容"});cwd=Fe("--cwd",{description:"工作路径,默认执行时所在地址"});ripgrep=Fe("--ripgrep",{description:"ripgrep 的绝对路径"});max=Fe("--max",{description:"max模式的模型id。注意,指定模型只能在首轮对话生效,中途无法更换模型"});normal=Fe("--normal",{description:"normal模式的模型id。注意,指定模型只能在首轮对话生效,中途无法更换模型"});conversation=Fe("--conversation",{description:"conversation id,如果需要多轮对话,将上一轮对话的id传入此参数"});queryDelay=Fe("--delay",{description:"模型调用的延迟时间,单位毫秒"});async execute(){if(!(this.license||this.query||this.cwd||this.help||this.ripgrep||this.max||this.normal||this.conversation||this.queryDelay)){const e=new Ne;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.conversation&&this.max)return this.context.stderr.write("Error: --conversation and --max cannot be used together\n"),1;if(this.conversation&&this.normal)return this.context.stderr.write("Error: --conversation and --normal cannot be used together\n"),1;if(""===this.max)return this.context.stderr.write("Error: --max cannot be empty\n"),1;if(""===this.normal)return this.context.stderr.write("Error: --normal cannot be empty\n"),1;if(this.cwd&&!t(this.cwd))return this.context.stderr.write(`Error: Directory '${this.cwd}' does not exist\n`),1;let e=this.ripgrep;if(e&&!t(e))return this.context.stderr.write(`Error: ripgrep path '${e}' does not exist\n`),1;e||(e=Mb()),Me("License:",this.license),Me("Query:",this.query),Me("CWD:",this.cwd),Me("Conversation",this.conversation),Me("Max",this.max),Me("Normal",this.normal);const n={license:this.license,query:this.query,cwd:this.cwd||process.cwd(),ripgrepPath:e,max:this.max,queryDelay:Number(this.queryDelay),conversationId:this.conversation},i=QR(n);return null===await this.validateAndNormalizeMax()?1:(await i.start(),await async function({kernelProvider:e,query:t,max:n,conversation:i,normal:r}){new Qe(e).start();let o={};const s=n?{model:{modelId:n,requestType:"COMATE_MULTIPLE_MODE",mode:"MAX"}}:{model:{modelId:r||"auto",requestType:"COMATE_DEFAULT_MODE",mode:"NORMAL"}};e.onRequest("COMATE_AGENT_UPDATE_MESSAGE",(async e=>{if(Me("============"),Me(JSON.stringify(e,null,2)),"conversation-status"===e.data.type){const t=e.data.conversationInfo.status;if(t===pt.Failed||t===pt.Cancelled){const t=o?.messages.flatMap((e=>e.elements)).find((e=>!0===e.isErrorMessage));t&&(e.errorMessage=t),console.error(JSON.stringify(e,null,2)),process.exit(1)}else t===pt.Completed&&(console.log(JSON.stringify(o,null,2)),process.exit(0))}else"partial-message-data"===e.data.type&&(o=e.data)})),e.onNotification("ENGINE_SERVICE_INITIALIZED",(async()=>{let n="";i?(n=i,await e.sendRequest("COMATE_AGENT_START_NEW_CHAT",{agentPayload:{conversationId:n,messageType:"rebuild-conversation",conversationType:"E2EBotConversation",payload:{}}}),await e.sendRequest("COMATE_AGENT_NEW_MESSAGE",{agentPayload:{conversationId:n,messageType:"rebuild-conversation",payload:{knowledgeList:[]}}}),await e.sendRequest("COMATE_AGENT_SET_FOREGROUND_CONVERSATION",{agentPayload:{conversationId:n}})):n=(await e.sendRequest("COMATE_AGENT_START_NEW_CHAT",{agentPayload:{conversationId:n,messageType:"add-message",conversationType:"E2EBotConversation",payload:{query:t,knowledgeList:[],...s}}})).id,e.sendRequest("COMATE_AGENT_NEW_MESSAGE",{agentPayload:{messageType:"add-message",conversationId:n,payload:{query:t,knowledgeList:[],...s}}}),e.sendRequest("COMATE_AGENT_SET_FOREGROUND_CONVERSATION",{agentPayload:{conversationId:n}})}))}({kernelProvider:i,query:this.query,max:this.max,normal:this.normal,conversation:this.conversation}),0)}validateAndNormalizeMax=async()=>{if(this.conversation)try{const e=await async function(e){const t=w.homedir(),n=p.join(t,".comate-engine","store");if(!l.existsSync(n))return console.warn(`Directory does not exist: ${n}`),null;const i=`chat_session_${e}`,r=p.join(n,i);return l.existsSync(r)?r:null}(this.conversation);if(!e)return console.error("Error finding chat session file in ~/.comate-engine/store:",this.conversation),null;const t=JSON.parse(await i(e,"utf-8")||"{}");if(t.messages&&t.messages.length>0&&t.messages[0]?.payload?.model){const e=t.messages[0].payload.model.modelId,n=t.messages[0].payload.model.mode;e&&"auto"!==e&&("MAX"===n?this.max=e:this.normal=e)}}catch(e){return console.error("Error finding chat session file in ~/.comate-engine/store:",e),null}if(this.max){const e=(await XR({license:this.license,type:"MAX"})).find((e=>e.modelId===this.max||e.displayName===this.max));return e?(this.max=e.modelId,e.modelId):(this.context.stderr.write(`Error: Model '${this.max}' not found in available models\n`),null)}if(this.normal){const e=(await XR({license:this.license,type:"NORMAL"})).find((e=>e.modelId===this.normal||e.displayName===this.normal));return e?(this.normal=e.modelId,e.modelId):(this.context.stderr.write(`Error: Model '${this.normal}' not found in available models\n`),null)}return this.max||this.normal||""}}),tT.register(class extends ae{static paths=[["search"]];static usage={description:"本地检索"};query=Fe("--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;Me("Query:",this.query);const e={query:this.query,username:"zhangcong06"},t=QR(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}}),tT.register(class extends ae{static paths=[["list"]];static usage={description:"本地检索"};license=Fe("--license",{description:"License"});max=De("--max",{description:"列举max模式支持的模型"});normal=De("--normal",{description:"列举normal模式支持的模型"});async 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.max&&this.normal)return this.context.stderr.write("Error: --max and --normal cannot be used together\n"),1;Me("License:",this.license);const e={license:this.license,type:this.max?"MAX":"NORMAL"};return await async function({license:e,type:t}){try{const n=await XR({license:e,type:t});if(0===n.length)return void F_("model-list","Failed","没有可以使用的max模型, 请检查License",{});F_("model-list","Success","获取成功",{modelList:n})}catch(e){F_("model-list","Failed","获取失败",{})}}(e),0}});const iT=/^[a-zA-Z_][a-zA-Z0-9_]*$/;function rT(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 oT(e,t){var n,i,r;return"number"==typeof t?`${null!==(n=null==e?void 0:e.p)&&void 0!==n?n:"."}[${t}]`:iT.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 sT({errors:e,p:t}={},n){return null==e||e.push(`${null!=t?t:"."}: ${n}`),!1}function aT(e,t){return n=>{const i=e[t];return e[t]=n,aT(e,t).bind(null,i)}}function cT(){return fT({test:(e,t)=>"string"==typeof e||sT(t,`Expected a string (got ${rT(e)})`)})}function lT(e,{delimiter:t}={}){return fT({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 sT(i,"Unbound coercion result");n=n.split(t)}if(!Array.isArray(n))return sT(i,`Expected an array (got ${rT(n)})`);let s=!0;for(let t=0,r=n.length;t<r&&(s=e(n[t],Object.assign(Object.assign({},i),{p:oT(i,t),coercion:aT(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 uT(e,{delimiter:t}={}){const n=hT(e.length);return fT({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 sT(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 sT(r,`Expected a tuple (got ${rT(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:oT(r,t),coercion:aT(i,t)}))&&s,s||null!=(null==r?void 0:r.errors));++t);return s}})}function pT(e,{keys:t=null}={}){const n=lT(uT([null!=t?t:cT(),e]));return fT({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)?sT(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 sT(r,`Expected an object (got ${rT(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:oT(r,o),coercion:aT(i,o)}))||(a=!1):a=sT(Object.assign(Object.assign({},r),{p:oT(r,o)}),"Unsafe property name")}return a}})}function dT(e){return()=>e}function fT({test:e}){return dT(e)()}function hT(e){return fT({test:(t,n)=>t.length===e||sT(n,`Expected to have a length of exactly ${e} elements (got ${t.length})`)})}function mT(e,...t){const n=Array.isArray(t[0])?t[0]:t;return fT({test:(t,i)=>{var r,o;const s={value:t},a=void 0!==(null==i?void 0:i.coercions)?aT(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 sT(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 gT;!function(e){e.Forbids="Forbids",e.Requires="Requires"}(gT||(gT={})),gT.Forbids,gT.Requires;var vT=Object.freeze({__proto__:null,get KeyRelationship(){return gT},applyCascade:function(e,...t){return mT(e,Array.isArray(t[0])?t[0]:t)},cascade:mT,hasExactLength:hT,isArray:lT,isDict:function(e,t={}){return pT(e,t)},isRecord:pT,isString:cT,isTuple:uT,isUnknown:function(){return fT({test:(e,t)=>!0})},makeTrait:dT,makeValidator:fT});export{nT as run};