var_J=Object.create,Zu=Object.defineProperty,PJ=Object.getPrototypeOf,TJ=Object.prototype.hasOwnProperty,RJ=Object.getOwnPropertyNames,NP=Object.getOwnPropertyDescriptor;varqP=r=>Zu(r,"__esModule",{value:!0});varg=(r,e)=>()=>(e||(e={exports:{}},r(e.exports,e)),e.exports),fo=(r,e)=>{qP(r);for(vartine)Zu(r,t,{get:e[t],enumerable:!0})},kJ=(r,e,t)=>{if(qP(r),e&&typeofe=="object"||typeofe=="function")for(letiofRJ(e))!TJ.call(r,i)&&i!=="default"&&Zu(r,i,{get:()=>e[i],enumerable:!(t=NP(e,i))||t.enumerable});returnr},S=r=>r&&r.__esModule?r:kJ(Zu(r!=null?_J(PJ(r)):{},"default",{value:r,enumerable:!0}),r),Ty=(r,e,t,i)=>{for(varn=i>1?void0:i?NP(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(n=(i?s(e,t,n):s(n))||n);returni&&n&&Zu(e,t,n),n};varBP=g((cSe,$P)=>{"use strict";varIJ="Function.prototype.bind called on incompatible ",Ry=Array.prototype.slice,FJ=Object.prototype.toString,AJ="[object Function]";$P.exports=function(e){vart=this;if(typeoft!="function"||FJ.call(t)!==AJ)thrownewTypeError(IJ+t);for(vari=Ry.call(arguments,1),n,o=function(){if(thisinstanceofn){varc=t.apply(this,i.concat(Ry.call(arguments)));returnObject(c)===c?c:this}elsereturnt.apply(e,i.concat(Ry.call(arguments)))},s=Math.max(0,t.length-i.length),a=[],l=0;l<s;l++)a.push("$"+l);if(n=Function("binder","return function ("+a.join(",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){varu=function(){};u.prototype=t.prototype,n.prototype=newu,u.prototype=null}returnn}});varun=g((fSe,jP)=>{"use strict";varOJ=BP();jP.exports=Function.prototype.bind||OJ});varky=g((pSe,UP)=>{"use strict";varWP=Object.prototype.toString;UP.exports=function(e){vart=WP.call(e),i=t==="[object Arguments]";returni||(i=t!=="[object Array]"&&e!==null&&typeofe=="object"&&typeofe.length=="number"&&e.length>=0&&WP.call(e.callee)==="[object Function]"),i}});varZP=g((dSe,HP)=>{"use strict";varzP;Object.keys||(Qu=Object.prototype.hasOwnProperty,Iy=Object.prototype.toString,GP=ky(),Fy=Object.prototype.propertyIsEnumerable,VP=!Fy.call({toString:null},"toString"),KP=Fy.call(function(){},"prototype"),ec=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Ed=function(r){vare=r.constructor;returne&&e.prototype===r},JP={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},YP=function(){if(typeofwindow=="undefined")return!1;for(varrinwindow)try{if(!JP["$"+r]&&Qu.call(window,r)&&window[r]!==null&&typeofwindow[r]=="object")try{Ed(window[r])}catch(e){return!0}}catch(e){return!0}return!1}(),XP=function(r){if(typeofwindow=="undefined"||!YP)returnEd(r);try{returnEd(r)}catch(e){return!1}},zP=function(e){vart=e!==null&&typeofe=="object",i=Iy.call(e)==="[object Function]",n=GP(e),o=t&&Iy.call(e)==="[object String]",s=[];if(!t&&!i&&!n)thrownewTypeError("Object.keys called on a non-object");vara=KP&&i;if(o&&e.length>0&&!Qu.call(e,0))for(varl=0;l<e.length;++l)s.push(String(l));if(n&&e.length>0)for(varu=0;u<e.length;++u)s.push(String(u));elsefor(varcine)!(a&&c==="prototype")&&Qu.call(e,c)&&s.push(String(c));if(VP)for(varf=XP(e),p=0;p<ec.length;++p)!(f&&ec[p]==="constructor")&&Qu.call(e,ec[p])&&s.push(ec[p]);returns});varQu,Iy,GP,Fy,VP,KP,ec,Ed,JP,YP,XP;HP.exports=zP});varrT=g((hSe,QP)=>{"use strict";varLJ=Array.prototype.slice,MJ=ky(),eT=Object.keys,Cd=eT?function(e){returneT(e)}:ZP(),tT=Object.keys;Cd.shim=function(){if(Object.keys){vare=function(){vart=Object.keys(arguments);returnt&&t.length===arguments.length}(1,2);e||(Object.keys=function(i){returnMJ(i)?tT(LJ.call(i)):tT(i)})}elseObject.keys=Cd;returnObject.keys||Cd};QP.exports=Cd});varFn=g((mSe,iT)=>{"use strict";varNJ=rT(),qJ=typeofSymbol=="function"&&typeofSymbol("foo")=="symbol",$J=Object.prototype.toString,BJ=Array.prototype.c
`;function kI(r,e){if(On.existsSync(r))return;let t=On.openSync(r,e.flags,e.mode);On.closeSync(t)}var II=class{constructor(e,t,i,n){An("In RollingFileStream");function o(){if(!e||!t||t<=0)throw new Error("You must specify a filename and file size")}o(),this.filename=e,this.size=t,this.backups=i||1,this.options=n,this.currentSize=0;function s(a){let l=0;try{l=On.statSync(a).size}catch(u){kI(a,n)}return l}this.currentSize=s(this.filename)}shouldRoll(){return An("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(e){let t=this,i=new RegExp(`^${Ua.basename(e)}`);function n(u){return i.test(u)}function o(u){return parseInt(u.substring(`${Ua.basename(e)}.`.length),10)||0}function s(u,c){return o(u)>o(c)?1:o(u)<o(c)?-1:0}function a(u){let c=o(u);if(An(`Indexof${u}is${c}`),c<t.backups){try{On.unlinkSync(`${e}.${c+1}`)}catch(f){}An(`Renaming${u}->${e}.${c+1}`),On.renameSync(Ua.join(Ua.dirname(e),u),`${e}.${c+1}`)}}function l(){An("Renaming the old files"),On.readdirSync(Ua.dirname(e)).filter(n).sort(s).reverse().forEach(a)}An("Rolling, rolling, rolling"),l()}write(e,t){let i=this;function n(){An("writing the chunk to the file"),i.currentSize+=e.length,On.appendFileSync(i.filename,e)}An("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),n()}};function fee(r,e,t,i,n,o){An("fileSync appender created"),r=Ua.normalize(r),i=i===void 0?5:i,i=i===0?1:i;function s(l,u,c){let f;return u?f=new II(l,u,c,o):f=(p=>(kI(p,o),{write(d){On.appendFileSync(p,d)}}))(l),f}let a=s(r,t,i);return l=>{a.write(e(l,n)+cee)}}function pee(r,e){let t=e.basicLayout;r.layout&&(t=e.layout(r.layout.type,r.layout));let i={flags:r.flags||"a",encoding:r.encoding||"utf8",mode:r.mode||420};return fee(r.filename,t,r.maxLogSize,r.backups,r.timezoneOffset,i)}RI.exports.configure=pee});var kb=g((GEe,AI)=>{var dee=require("path"),ks=gt()("log4js:appenders"),hi=bs(),OI=Ld(),hee=Ds(),mee=eb(),gee=TR(),pn=new Map;pn.set("console",kR());pn.set("stdout",FR());pn.set("stderr",OR());pn.set("logLevelFilter",MR());pn.set("categoryFilter",$R());pn.set("noLogFilter",UR());pn.set("file",_I());pn.set("dateFile",TI());pn.set("fileSync",FI());var Dc=new Map,Rb=(r,e)=>{ks("Loading module from ",r);try{return require(r)}catch(t){hi.throwExceptionIf(e,t.code!=="MODULE_NOT_FOUND",`appender"${r}"couldnotbeloaded(errorwas:${t})`);return}},vee=(r,e)=>pn.get(r)||Rb(`./${r}`,e)||Rb(r,e)||""||Rb(dee.join(process.cwd(),r),e),Xd=new Set,LI=(r,e)=>{if(Dc.has(r))return Dc.get(r);if(!e.appenders[r])return!1;if(Xd.has(r))throw new Error(`Dependencyloopdetectedforappender${r}.`);Xd.add(r),ks(`Creatingappender${r}`);let t=yee(r,e);return Xd.delete(r),Dc.set(r,t),t},yee=(r,e)=>{let t=e.appenders[r],i=t.type.configure?t.type:vee(t.type,e);return hi.throwExceptionIf(e,hi.not(i),`appender"${r}"isnotvalid(type"${t.type}"couldnotbefound)`),i.appender&&ks(`DEPRECATION:Appender${t.type}exportsanappenderfunction.`),i.shutdown&&ks(`DEPRECATION:Appender${t.type}exportsashutdownfunction.`),ks(`${r}:clustering.isMaster?${OI.isMaster()}`),ks(`${r}:appenderModuleis${require("util").inspect(i)}`),OI.onlyOnMaster(()=>(ks(`callingappenderModule.configurefor${r}/${t.type}`),i.configure(gee.modifyConfig(t),mee,n=>LI(n,e),hee)),()=>{})},MI=r=>{Dc.clear(),Xd.clear();let e=[];Object.values(r.categories).forEach(t=>{e.push(...t.appenders)}),Object.keys(r.appenders).forEach(t=>{(e.includes(t)||r.appenders[t].type==="tcp-server")&&LI(t,r)})};MI({appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"trace"}}});hi.addListener(r=>{hi.throwExceptionIf(r,hi.not(hi.anObject(r.appenders)),'must have a property "appenders" of type object.');let e=Object.keys(r.appenders);hi.throwExceptionIf(r,hi.not(e.length),"must define at least one appender."),e.forEach(t=>{hi.throwExceptionIf(r,hi.not(r.appenders[t].type),`appender"${t}"isnotvalid(mustbeanobjectwithproperty"type")`)})});hi.addListener(MI);AI.exports=Dc});var Fb=g((VEe,NI)=>{var Is=gt()("log4js:categories"),at=b
${JSON.stringify(T.error,void0,4)}`):t.error("Received response message without id. No further error information provided.");else{let B=String(T.id),V=m[B];if(Oi(T,V),V){delete m[B];try{if(T.error){let te=T.error;V.reject(new ne.ResponseError(te.code,te.message,te.data))}else if(T.result!==void 0)V.resolve(T.result);else throw new Error("Should never happen.")}catch(te){te.message?t.error(`Responsehandler'${V.method}'failedwithmessage:${te.message}`):t.error(`Responsehandler'${V.method}'failedunexpectedly.`)}}}}function Fa(T){if(We())return;let B,V;if(T.method===of.type.method)V=te=>{let Qe=te.id,si=y[String(Qe)];si&&si.cancel()};else{let te=f[T.method];te&&(V=te.handler,B=te.type)}if(V||c)try{Ct(T),T.params===void 0||B!==void 0&&B.numberOfParams===0?V?V():c(T.method):jt.array(T.params)&&(B===void 0||B.numberOfParams>1)?V?V(...T.params):c(T.method,...T.params):V?V(T.params):c(T.method,T.params)}catch(te){te.message?t.error(`Notificationhandler'${T.method}'failedwithmessage:${te.message}`):t.error(`Notificationhandler'${T.method}'failedunexpectedly.`)}else _.fire(T)}function Aa(T){if(!T){t.error("Received empty message.");return}t.error(`Receivedmessagewhichisneitheraresponsenoranotificationmessage:
${JSON.stringify(T,null,4)}`);let B=T;if(jt.string(B.id)||jt.number(B.id)){let V=String(B.id),te=m[V];te&&te.reject(new Error("The received response has neither a result nor an error property."))}}function Se(T){if(!(v===yt.Off||!w))if(x===ji.Text){let B;v===yt.Verbose&&T.params&&(B=`Params:${JSON.stringify(T.params,null,4)}
`+(d.tokens?this.parseInline(d.tokens):d.text);i+=t?this.renderer.paragraph(p):p;continue}default:{let _='Token with "'+d.type+'" type was not found.';if(this.options.silent){console.error(_);return}else throw new Error(_)}}return i}parseInline(e,t){t=t||this.renderer;let i="",n,o,s=e.length;for(n=0;n<s;n++)switch(o=e[n],o.type){case"escape":{i+=t.text(o.text);break}case"html":{i+=t.html(o.text);break}case"link":{i+=t.link(o.href,o.title,this.parseInline(o.tokens,t));break}case"image":{i+=t.image(o.href,o.title,o.text);break}case"strong":{i+=t.strong(this.parseInline(o.tokens,t));break}case"em":{i+=t.em(this.parseInline(o.tokens,t));break}case"codespan":{i+=t.codespan(o.text);break}case"br":{i+=t.br();break}case"del":{i+=t.del(this.parseInline(o.tokens,t));break}case"text":{i+=t.text(o.text);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent){console.error(a);return}else throw new Error(a)}}return i}}});var x$=g((xTe,g$)=>{var kf=u$(),If=m$(),v$=zx(),y$=Vx(),Mfe=Kx(),Nfe=Jx(),{merge:Pm,checkSanitizeDeprecation:b$,escape:w$}=Vs(),{getDefaults:qfe,changeDefaults:$fe,defaults:Bfe}=kl();function Re(r,e,t){if(typeof r=="undefined"||r===null)throw new Error("marked(): input parameter is undefined or null");if(typeof r!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected");if(typeof e=="function"&&(t=e,e=null),e=Pm({},Re.defaults,e||{}),b$(e),t){let i=e.highlight,n;try{n=kf.lex(r,e)}catch(a){return t(a)}let o=function(a){let l;if(!a)try{l=If.parse(n,e)}catch(u){a=u}return e.highlight=i,a?t(a):t(null,l)};if(!i||i.length<3||(delete e.highlight,!n.length))return o();let s=0;Re.walkTokens(n,function(a){a.type==="code"&&(s++,setTimeout(()=>{i(a.text,a.lang,function(l,u){if(l)return o(l);u!=null&&u!==a.text&&(a.text=u,a.escaped=!0),s--,s===0&&o()})},0))}),s===0&&o();return}try{let i=kf.lex(r,e);return e.walkTokens&&Re.walkTokens(i,e.walkTokens),If.parse(i,e)}catch(i){if(i.message+=`
Pleasereportthistohttps://github.com/markedjs/marked.`,e.silent)return"<p>An error occurred:</p><pre>"+w$(i.message+"",!0)+"</pre>";throw i}}Re.options=Re.setOptions=function(r){return Pm(Re.defaults,r),$fe(Re.defaults),Re};Re.getDefaults=qfe;Re.defaults=Bfe;Re.use=function(r){let e=Pm({},r);if(r.renderer){let t=Re.defaults.renderer||new y$;for(let i in r.renderer){let n=t[i];t[i]=(...o)=>{let s=r.renderer[i].apply(t,o);return s===!1&&(s=n.apply(t,o)),s}}e.renderer=t}if(r.tokenizer){let t=Re.defaults.tokenizer||new v$;for(let i in r.tokenizer){let n=t[i];t[i]=(...o)=>{let s=r.tokenizer[i].apply(t,o);return s===!1&&(s=n.apply(t,o)),s}}e.tokenizer=t}if(r.walkTokens){let t=Re.defaults.walkTokens;e.walkTokens=i=>{r.walkTokens(i),t&&t(i)}}Re.setOptions(e)};Re.walkTokens=function(r,e){for(let t of r)switch(e(t),t.type){case"table":{for(let i of t.tokens.header)Re.walkTokens(i,e);for(let i of t.tokens.cells)for(let n of i)Re.walkTokens(n,e);break}case"list":{Re.walkTokens(t.items,e);break}default:t.tokens&&Re.walkTokens(t.tokens,e)}};Re.parseInline=function(r,e){if(typeof r=="undefined"||r===null)throw new Error("marked.parseInline(): input parameter is undefined or null");if(typeof r!="string")throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected");e=Pm({},Re.defaults,e||{}),b$(e);try{let t=kf.lexInline(r,e);return e.walkTokens&&Re.walkTokens(t,e.walkTokens),If.parseInline(t,e)}catch(t){if(t.message+=`
Pleasereportthistohttps://github.com/markedjs/marked.`,e.silent)return"<p>An error occurred:</p><pre>"+w$(t.message+"",!0)+"</pre>";throw t}};Re.Parser=If;Re.parser=If.parse;Re.Renderer=y$;Re.TextRenderer=Mfe;Re.Lexer=kf;Re.lexer=kf.lex;Re.Tokenizer=v$;Re.Slugger=Nfe;Re.parse=Re;g$.exports=Re});var S$=g((DTe,D$)=>{"use strict";var jfe=/[|\\{}()[\]^$+*?.]/g;D$.exports=function(r){if(typeof r!="string")throw new TypeError("Expected a string");return r.replace(jfe,"\\$&")}});var C$=g((STe,E$)=>{"use strict";E$.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var Zx=g((ETe,_$)=>{var Js=C$(),P$={};for(var Xx in Js)Js.hasOwnProperty(Xx)&&(P$[Js[Xx]]=Xx);var ee=_$.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"}
`],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e",""],["a","\x07"]]);function U$(r){return r[0]==="u"&&r.length===5||r[0]==="x"&&r.length===3?String.fromCharCode(parseInt(r.slice(1),16)):npe.get(r)||r}function ope(r,e){let t=[],i=e.trim().split(/\s*,\s*/g),n;for(let o of i)if(!isNaN(o))t.push(Number(o));else if(n=o.match(rpe))t.push(n[2].replace(ipe,(s,a,l)=>a?U$(a):l));else throw new Error(`InvalidChalktemplatestyleargument:${o}(instyle'${r}')`);return t}function spe(r){j$.lastIndex=0;let e=[],t;for(;(t=j$.exec(r))!==null;){let i=t[1];if(t[2]){let n=ope(i,t[2]);e.push([i].concat(n))}else e.push([i])}return e}function W$(r,e){let t={};for(let n of e)for(let o of n.styles)t[o[0]]=n.inverse?null:o.slice(1);let i=r;for(let n of Object.keys(t))if(Array.isArray(t[n])){if(!(n in i))throw new Error(`UnknownChalkstyle:${n}`);t[n].length>0?i=i[n].apply(i,t[n]):i=i[n]}return i}B$.exports=(r,e)=>{let t=[],i=[],n=[];if(e.replace(tpe,(o,s,a,l,u,c)=>{if(s)n.push(U$(s));else if(l){let f=n.join("");n=[],i.push(t.length===0?f:W$(r,t)(f)),t.push({inverse:a,styles:spe(l)})}else if(u){if(t.length===0)throw new Error("Found extraneous } in Chalk template literal");i.push(W$(r,t)(n.join(""))),n=[],t.pop()}else n.push(c)}),i.push(n.join("")),t.length>0){let o=`Chalktemplateliteralismissing${t.length}closingbracket${t.length===1?"":"s"}(\`}\`)`;thrownewError(o)}returni.join("")}});varJ$=g((ITe,Ff)=>{"use strict";vartD=S$(),xt=L$(),rD=$$().stdout,ape=H$(),z$=process.platform==="win32"&&!(process.env.TERM||"").toLowerCase().startsWith("xterm"),G$=["ansi","ansi","ansi256","ansi16m"],V$=newSet(["gray"]),Ol=Object.create(null);functionK$(r,e){e=e||{};lett=rD?rD.level:0;r.level=e.level===void0?t:e.level,r.enabled="enabled"ine?e.enabled:r.level>0}functionAf(r){if(!this||!(thisinstanceofAf)||this.template){lete={};returnK$(e,r),e.template=function(){lett=[].slice.call(arguments);returnlpe.apply(null,[e.template].concat(t))},Object.setPrototypeOf(e,Af.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=Af,e.template}K$(this,r)}z$&&(xt.blue.open="[94m");for(letrofObject.keys(xt))xt[r].closeRe=newRegExp(tD(xt[r].close),"g"),Ol[r]={get(){lete=xt[r];returnFm.call(this,this._styles?this._styles.concat(e):[e],this._empty,r)}};Ol.visible={get(){returnFm.call(this,this._styles||[],!0,"visible")}};xt.color.closeRe=newRegExp(tD(xt.color.close),"g");for(letrofObject.keys(xt.color.ansi))V$.has(r)||(Ol[r]={get(){lete=this.level;returnfunction(){leti={open:xt.color[G$[e]][r].apply(null,arguments),close:xt.color.close,closeRe:xt.color.closeRe};returnFm.call(this,this._styles?this._styles.concat(i):[i],this._empty,r)}}});xt.bgColor.closeRe=newRegExp(tD(xt.bgColor.close),"g");for(letrofObject.keys(xt.bgColor.ansi)){if(V$.has(r))continue;lete="bg"+r[0].toUpperCase()+r.slice(1);Ol[e]={get(){lett=this.level;returnfunction(){letn={open:xt.bgColor[G$[t]][r].apply(null,arguments),close:xt.bgColor.close,closeRe:xt.bgColor.closeRe};returnFm.call(this,this._styles?this._styles.concat(n):[n],this._empty,r)}}}}varupe=Object.defineProperties(()=>{},Ol);functionFm(r,e,t){leti=function(){returncpe.apply(i,arguments)};i._styles=r,i._empty=e;letn=this;returnObject.defineProperty(i,"level",{enumerable:!0,get(){returnn.level},set(o){n.level=o}}),Object.defineProperty(i,"enabled",{enumerable:!0,get(){returnn.enabled},set(o){n.enabled=o}}),i.hasGrey=this.hasGrey||t==="gray"||t==="grey",i.__proto__=upe,i}functioncpe(){letr=arguments,e=r.length,t=String(arguments[0]);if(e===0)return"";if(e>1)for(letn=1;n<e;n++)t+=" "+r[n];if(!this.enabled||this.level<=0||!t)returnthis._empty?"":t;leti=xt.dim.open;z$&&this.hasGrey&&(xt.dim.open="");for(letnofthis._styles.slice().reverse())t=n.open+t.replace(n.closeRe,n.open)+n.close,t=t.replace(/\r?\n/g,`${n.close}$&${n.open}`);returnxt.dim.open=i,t}functionlpe(r,e){if(!Array.isArray(e))return[].slice.call(arguments,1).join(" ");lett=[].slice.call(arguments,2),i=[e.raw[0]];for(letn=1;n<e.length;n++)i.push(String(t[n-1]).repla
globstarwhile`,r,c,e,f,p),this.matchOne(r.slice(c),e.slice(f),t))return this.debug("globstar found match!",c,s,p),!0;if(p==="."||p===".."||!i.dot&&p.charAt(0)==="."){this.debug("dot detected!",r,c,e,f);break}this.debug("globstar swallow a segment, and continue"),c++}return!!(t&&(this.debug(`
>>>nomatch,partial?`,r,c,e,f),c===s))}var d;if(typeof l=="string"?(i.nocase?d=u.toLowerCase()===l.toLowerCase():d=u===l,this.debug("string match",l,u,d)):(d=u.match(l),this.debug("pattern match",l,u,d)),!d)return!1}if(n===s&&o===a)return!0;if(n===s)return t;if(o===a){var h=n===s-1&&r[n]==="";return h}throw new Error("wtf?")};function Pde(r){return r.replace(/\\(.)/g,"$1")}function Rde(r){return r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var gj=g((sIe,hj)=>{var p0=4294967296,mj=[];for(var ep=0;ep<256;ep++)mj[ep]=(ep>15?"":"0")+ep.toString(16);var tp=hj.exports=function(r,e){r instanceof Buffer?(this.buffer=r,this.offset=e||0):Object.prototype.toString.call(r)=="[object Uint8Array]"?(this.buffer=new Buffer(r),this.offset=e||0):(this.buffer=this.buffer||new Buffer(8),this.offset=0,this.setValue.apply(this,arguments))};tp.MAX_INT=Math.pow(2,53);tp.MIN_INT=-Math.pow(2,53);tp.prototype={constructor:tp,_2scomp:function(){for(var r=this.buffer,e=this.offset,t=1,i=e+7;i>=e;i--){var n=(r[i]^255)+t;r[i]=n&255,t=n>>8}},setValue:function(r,e){var t=!1;if(arguments.length==1)if(typeof r=="number"){if(t=r<0,r=Math.abs(r),e=r%p0,r=r/p0,r>p0)throw new RangeError(r+" is outside Int64 range");r=r|0}else if(typeof r=="string")r=(r+"").replace(/^0x/,""),e=r.substr(-8),r=r.length>8?r.substr(0,r.length-8):"",r=parseInt(r,16),e=parseInt(e,16);else throw new Error(r+" must be a Number or String");for(var i=this.buffer,n=this.offset,o=7;o>=0;o--)i[n+o]=e&255,e=o==4?r:e>>>8;t&&this._2scomp()},toNumber:function(r){for(var e=this.buffer,t=this.offset,i=e[t]&128,n=0,o=1,s=7,a=1;s>=0;s--,a*=256){var l=e[t+s];i&&(l=(l^255)+o,o=l>>8,l=l&255),n+=l*a}return!r&&n>=tp.MAX_INT?i?-Infinity:Infinity:i?-n:n},valueOf:function(){return this.toNumber(!1)},toString:function(r){return this.valueOf().toString(r||10)},toOctetString:function(r){for(var e=new Array(8),t=this.buffer,i=this.offset,n=0;n<8;n++)e[n]=mj[t[i+n]];return e.join(r||"")},toBuffer:function(r){if(r&&this.offset===0)return this.buffer;var e=new Buffer(8);return this.buffer.copy(e,0,this.offset,this.offset+8),e},copy:function(r,e){this.buffer.copy(r,e||0,this.offset,this.offset+8)},compare:function(r){if((this.buffer[this.offset]&128)!=(r.buffer[r.offset]&128))return r.buffer[r.offset]-this.buffer[this.offset];for(var e=0;e<8;e++)if(this.buffer[this.offset+e]!==r.buffer[r.offset+e])return this.buffer[this.offset+e]-r.buffer[r.offset+e];return 0},equals:function(r){return this.compare(r)===0},inspect:function(){return"[Int64 value:"+this+" octets:"+this.toOctetString(" ")+"]"}}});var Pj=g(rp=>{var vj=require("events").EventEmitter,Mde=require("util"),Nde=require("os"),aIe=require("assert"),ip=gj(),Wo=Nde.endianness()=="BE";function yj(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function Ot(r){this.buf=Buffer.alloc(yj(r||8192)),this.readOffset=0,this.writeOffset=0}rp.Accumulator=Ot;Ot.prototype.writeAvail=function(){return this.buf.length-this.writeOffset};Ot.prototype.readAvail=function(){return this.writeOffset-this.readOffset};Ot.prototype.reserve=function(r){if(!(r<this.writeAvail())&&(this.readOffset>0&&(this.buf.copy(this.buf,0,this.readOffset,this.writeOffset),this.writeOffset-=this.readOffset,this.readOffset=0),!(r<this.writeAvail()))){var e=Buffer.alloc(yj(this.buf.length+r-this.writeAvail()));this.buf.copy(e),this.buf=e}};Ot.prototype.append=function(r){if(Buffer.isBuffer(r))this.reserve(r.length),r.copy(this.buf,this.writeOffset,0,r.length),this.writeOffset+=r.length;else{var e=Buffer.byteLength(r);this.reserve(e),this.buf.write(r,this.writeOffset),this.writeOffset+=e}};Ot.prototype.assertReadableSize=function(r){if(this.readAvail()<r)throw new Error("wanted to read "+r+" bytes but only have "+this.readAvail())};Ot.prototype.peekString=function(r){return this.assertReadableSize(r),this.buf.toString("utf-8",this.readOffset,this.readOffset+r)};Ot.prototype.readString=function(r){var e=this.peekString(r);return this.readOffset+=r,e};Ot.prototype.peekInt=function(r){switch(this.assertReadableSize(r),r){case 1:return this.buf.readInt8(this.readOffset,r);case 2:return Wo?this.bu
`).some(e=>e.indexOf("(https.js:")!==-1||e.indexOf("node:https:")!==-1)}function lv(r,e){return new lv.Agent(r,e)}(function(r){class e extends Dve.EventEmitter{constructor(i,n){super();let o=n;typeof i=="function"?this.callback=i:i&&(o=i),this.timeout=null,o&&typeof o.timeout=="number"&&(this.timeout=o.timeout),this.maxFreeSockets=1,this.maxSockets=1,this.maxTotalSockets=Infinity,this.sockets={},this.freeSockets={},this.requests={},this.options={}}get defaultPort(){return typeof this.explicitDefaultPort=="number"?this.explicitDefaultPort:nE()?443:80}set defaultPort(i){this.explicitDefaultPort=i}get protocol(){return typeof this.explicitProtocol=="string"?this.explicitProtocol:nE()?"https:":"http:"}set protocol(i){this.explicitProtocol=i}callback(i,n,o){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(i,n){let o=Object.assign({},n);typeof o.secureEndpoint!="boolean"&&(o.secureEndpoint=nE()),o.host==null&&(o.host="localhost"),o.port==null&&(o.port=o.secureEndpoint?443:80),o.protocol==null&&(o.protocol=o.secureEndpoint?"https:":"http:"),o.host&&o.path&&delete o.path,delete o.agent,delete o.hostname,delete o._defaultAgent,delete o.defaultPort,delete o.createConnection,i._last=!0,i.shouldKeepAlive=!1;let s=!1,a=null,l=o.timeout||this.timeout,u=d=>{i._hadError||(i.emit("error",d),i._hadError=!0)},c=()=>{a=null,s=!0;let d=new Error(`A"socket"wasnotcreatedforHTTPrequestbefore${l}ms`);d.code="ETIMEOUT",u(d)},f=d=>{s||(a!==null&&(clearTimeout(a),a=null),u(d))},p=d=>{if(s)return;if(a!=null&&(clearTimeout(a),a=null),Cve(d)){Op("Callback returned another Agent instance %o",d.constructor.name),d.addRequest(i,o);return}if(d){d.once("free",()=>{this.freeSocket(d,o)}),i.onSocket(d);return}let h=new Error(`noDuplexstreamwasreturnedtoagent-basefor\`${i.method}${i.path}\``);u(h)};if(typeofthis.callback!="function"){u(newError("`callback` is not defined"));return}this.promisifiedCallback||(this.callback.length>=3?(Op("Converting legacy callback function to promise"),this.promisifiedCallback=Eve.default(this.callback)):this.promisifiedCallback=this.callback),typeofl=="number"&&l>0&&(a=setTimeout(c,l)),"port"ino&&typeofo.port!="number"&&(o.port=Number(o.port));try{Op("Resolving socket for %o request: %o",o.protocol,`${i.method}${i.path}`),Promise.resolve(this.promisifiedCallback(i,o)).then(p,f)}catch(d){Promise.reject(d).catch(f)}}freeSocket(i,n){Op("Freeing socket %o %o",i.constructor.name,n),i.destroy()}destroy(){Op("Destroying agent %o",this.constructor.name)}}r.Agent=e,r.prototype=r.Agent.prototype})(lv||(lv={}));h5.exports=lv});varv5=g(ba=>{"use strict";var_ve=ba&&ba.__awaiter||function(r,e,t,i){functionn(o){returnoinstanceoft?o:newt(function(s){s(o)})}returnnew(t||(t=Promise))(function(o,s){functiona(c){try{u(i.next(c))}catch(f){s(f)}}functionl(c){try{u(i.throw(c))}catch(f){s(f)}}functionu(c){c.done?o(c.value):n(c.value).then(a,l)}u((i=i.apply(r,e||[])).next())})},Lp=ba&&ba.__importDefault||function(r){returnr&&r.__esModule?r:{default:r}};Object.defineProperty(ba,"__esModule",{value:!0});varPve=Lp(require("net")),Tve=Lp(require("tls")),sE=Lp(require("url")),Rve=Lp(gt()),kve=Lp(p5()),Ive=oE(),os=Rve.default("http-proxy-agent");functionFve(r){returntypeofr=="string"?/^https:?$/i.test(r):!1}varg5=classextendsIve.Agent{constructor(e){lett;if(typeofe=="string"?t=sE.default.parse(e):t=e,!t)thrownewError("an HTTP(S) proxy server `host` and `port` must be specified!");os("Creating new HttpProxyAgent instance: %o",t),super(t);leti=Object.assign({},t);this.secureProxy=t.secureProxy||Fve(i.protocol),i.host=i.hostname||i.host,typeofi.port=="string"&&(i.port=parseInt(i.port,10)),!i.port&&i.host&&(i.port=this.secureProxy?443:80),i.host&&i.path&&(deletei.path,deletei.pathname),this.proxy=i}callback(e,t){return_ve(this,void0,void0,function*(){let{proxy:i,secureProxy:n}=this,o=sE.default.parse(e.path);o.protocol||(o.protocol="http:"),o.hostname||(o.hostname=t.hostname||t.host||null),o.port==null&&typeoft.port&&(o.port=String(t.port
\r
`)+4,e.output[0]=e._header+a.substring(l),os("Output buffer: %o",e.output)):e.outputData&&e.outputData.length>0&&(os("Patching connection write() output buffer with updated header"),a=e.outputData[0].data,l=a.indexOf(`\r
`)===-1){Np("have not received end of HTTP headers yet..."),o();return}let h=p.toString("ascii",0,p.indexOf(`\r
`)),m=+h.split(" ")[1];Np("got proxy server response: %o",h),e({statusCode:m,buffered:p})}r.on("error",u),r.on("close",a),r.on("end",l),o()})}Mp.default=Mve});var E5=g(wa=>{"use strict";var Nve=wa&&wa.__awaiter||function(r,e,t,i){function n(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(c){try{u(i.next(c))}catch(f){s(f)}}function l(c){try{u(i.throw(c))}catch(f){s(f)}}function u(c){c.done?o(c.value):n(c.value).then(a,l)}u((i=i.apply(r,e||[])).next())})},Eu=wa&&wa.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(wa,"__esModule",{value:!0});var x5=Eu(require("net")),D5=Eu(require("tls")),qve=Eu(require("url")),$ve=Eu(require("assert")),Bve=Eu(gt()),jve=oE(),Uve=Eu(w5()),qp=Bve.default("https-proxy-agent:agent"),S5=class extends jve.Agent{constructor(e){let t;if(typeof e=="string"?t=qve.default.parse(e):t=e,!t)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");qp("creating new HttpsProxyAgent instance: %o",t),super(t);let i=Object.assign({},t);this.secureProxy=t.secureProxy||zve(i.protocol),i.host=i.hostname||i.host,typeof i.port=="string"&&(i.port=parseInt(i.port,10)),!i.port&&i.host&&(i.port=this.secureProxy?443:80),this.secureProxy&&!("ALPNProtocols"in i)&&(i.ALPNProtocols=["http 1.1"]),i.host&&i.path&&(delete i.path,delete i.pathname),this.proxy=i}callback(e,t){return Nve(this,void 0,void 0,function*(){let{proxy:i,secureProxy:n}=this,o;n?(qp("Creating `tls.Socket`: %o",i),o=D5.default.connect(i)):(qp("Creating `net.Socket`: %o",i),o=x5.default.connect(i));let s=Object.assign({},i.headers),l=`CONNECT${`${t.host}:${t.port}`}HTTP/1.1\r
`;i.auth&&(s["Proxy-Authorization"]=`Basic${Buffer.from(i.auth).toString("base64")}`);let{host:u,port:c,secureEndpoint:f}=t;Hve(c,f)||(u+=`:${c}`),s.Host=u,s.Connection="close";for(let y of Object.keys(s))l+=`${y}:${s[y]}\r
`;let p=Uve.default(o);o.write(`${l}\r
`);let{statusCode:d,buffered:h}=yield p;if(d===200){if(e.once("socket",Wve),t.secureEndpoint){let y=t.servername||t.host;if(!y)throw new Error('Could not determine "servername"');return qp("Upgrading socket connection to TLS"),D5.default.connect(Object.assign(Object.assign({},Gve(t,"host","hostname","path","port")),{socket:o,servername:y}))}return o}o.destroy();let m=new x5.default.Socket;return m.readable=!0,e.once("socket",y=>{qp("replaying proxy buffer for failed request"),$ve.default(y.listenerCount("data")>0),y.push(h),y.push(null)}),m})}};wa.default=S5;function Wve(r){r.resume()}function Hve(r,e){return Boolean(!e&&r===80||e&&r===443)}function zve(r){return typeof r=="string"?/^https:?$/i.test(r):!1}function Gve(r,...e){let t={},i;for(i in r)e.includes(i)||(t[i]=r[i]);return t}});var _5=g((cE,C5)=>{"use strict";var Vve=cE&&cE.__importDefault||function(r){return r&&r.__esModule?r:{default:r}},fE=Vve(E5());function pE(r){return new fE.default(r)}(function(r){r.HttpsProxyAgent=fE.default,r.prototype=fE.default.prototype})(pE||(pE={}));C5.exports=pE});var T5=g((pLe,P5)=>{"use strict";var Kve=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];P5.exports=(r,e)=>{if(e._readableState.autoDestroy)throw new Error("The second stream must have the `autoDestroy` option set to `false`");let t=new Set(Object.keys(r).concat(Kve)),i={};for(let n of t)n in e||(i[n]={get(){let o=r[n];return typeof o=="function"?o.bind(r):o},set(o){r[n]=o},enumerable:!0,configurable:!1});return Object.defineProperties(e,i),r.once("aborted",()=>{e.destroy(),e.emit("aborted")}),r.once("close",()=>{r.complete&&e.readable?e.once("end",()=>{e.emit("close")}):e.emit("close")}),e}});var k5=g((dLe,R5)=>{"use strict";var{Transform:Jve,PassThrough:Yve}=require("stream"),dE=require("zlib"),Xve=T5();R5.exports=r=>{let e=(r.headers["content-encoding"]||"").toLowerCase();if(!["gzip","deflate","br"].includes(e))return r;let t=e==="br";if(t&&typeof dE.createBrotliDecompress!="function")return r.destroy(new Error("Brotli is not supported on Node.js < 12")),r;let i=!0,n=new Jve({transform(a,l,u){i=!1,u(null,a)},flush(a){a()}}),o=new Yve({autoDestroy:!1,destroy(a,l){r.destroy(),l(a)}}),s=t?dE.createBrotliDecompress():dE.createUnzip();return s.once("error",a=>{if(i&&!r.readable){o.end();return}o.destroy(a)}),Xve(r,o),r.pipe(n).pipe(s).pipe(o),o}});var Uz=g(Uye=>{fo(Uye,{BaseLanguageClient:()=>yv,BasicList:()=>Mt,Buffer:()=>Ou.Buffer,CancellationToken:()=>ie.CancellationToken,CancellationTokenSource:()=>ie.CancellationTokenSource,ClientState:()=>be,CloseAction:()=>ro,CodeActionKind:()=>ie.CodeActionKind,CompletionItemKind:()=>ie.CompletionItemKind,CompletionTriggerKind:()=>ie.CompletionTriggerKind,ConfigurationTarget:()=>pt,Diagnostic:()=>ie.Diagnostic,DiagnosticSeverity:()=>ie.DiagnosticSeverity,DiagnosticTag:()=>ie.DiagnosticTag,Disposable:()=>ie.Disposable,Document:()=>Zm,DocumentHighlightKind:()=>ie.DocumentHighlightKind,Emitter:()=>ie.Emitter,ErrorAction:()=>Tu,Event:()=>ie.Event,ExtensionType:()=>Jr,FileChangeType:()=>ie.FileChangeType,FileSystemWatcher:()=>tg,FloatFactory:()=>mn,Highligher:()=>ss,InsertTextFormat:()=>ie.InsertTextFormat,LanguageClient:()=>Cv,Location:()=>ie.Location,LocationLink:()=>ie.LocationLink,MarkupKind:()=>ie.MarkupKind,MessageLevel:()=>gn,MessageTransports:()=>Hp,Mru:()=>Gl,Mutex:()=>ar,Neovim:()=>Ou.Neovim,NotificationType:()=>ie.NotificationType,NotificationType0:()=>ie.NotificationType0,NullLogger:()=>tH,PatternType:()=>Kr,Position:()=>ie.Position,ProgressType:()=>jz.ProgressType,ProposedFeatures:()=>_v,Range:()=>ie.Range,RequestType:()=>ie.RequestType,RequestType0:()=>ie.RequestType0,RevealOutputChannelOn:()=>ii,ServiceStat:()=>ye,SettingMonitor:()=>$H,SignatureHelpTriggerKind:()=>ie.SignatureHelpTriggerKind,SourceType:()=>Yr,State:()=>ni,SymbolKind:()=>ie.SymbolKind,TextDocumentFeature:()=>Ge,TextEdit:()=>ie.TextEdit,TransportKind:()=>Gt,Uri:()=>$,Watchman:()=>ta,Window:()=>Ou.Window,ansiparse:()=>N
`+e.prev}function ty(r,e){var t=y_(r),i=[];if(t){i.length=r.length;for(var n=0;n<r.length;n++)i[n]=ka(r,n)?e(r[n],r):""}for(var o in r)!ka(r,o)||t&&String(Number(o))===o&&o<r.length||(/[^\w$]/.test(o)?i.push(e(o,r)+": "+e(r[o],r)):i.push(o+": "+e(r[o],r)));if(typeof e7=="function")for(var s=e7(r),a=0;a<s.length;a++)Wbe.call(r,s[a])&&i.push("["+e(s[a])+"]: "+e(r[s[a]],r));return i}});var Hu=g((q9e,a7)=>{"use strict";a7.exports=function(e){return typeof e=="string"||typeof e=="symbol"}});var u7=g(($9e,l7)=>{"use strict";l7.exports=function(e){if(e===null)return"Null";if(typeof e=="undefined")return"Undefined";if(typeof e=="function"||typeof e=="object")return"Object";if(typeof e=="number")return"Number";if(typeof e=="boolean")return"Boolean";if(typeof e=="string")return"String"}});var pr=g((B9e,c7)=>{"use strict";var lwe=u7();c7.exports=function(e){return typeof e=="symbol"?"Symbol":typeof e=="bigint"?"BigInt":lwe(e)}});var fd=g((j9e,f7)=>{"use strict";var uwe=Ae(),p7=uwe("%TypeError%"),cwe=w_(),fwe=Hu(),pwe=pr();f7.exports=function(e,t){if(pwe(e)!=="Object")throw new p7("Assertion failed: Type(O) is not Object");if(!fwe(t))throw new p7("Assertion failed: IsPropertyKey(P) is not true, got "+cwe(t));return e[t]}});var h7=g((U9e,d7)=>{"use strict";var dwe=Ae(),hwe=dwe("%TypeError%");d7.exports=function(e,t){if(e==null)throw new hwe(t||"Cannot call method on "+e);return e}});var x_=g((W9e,m7)=>{"use strict";m7.exports=h7()});var v7=g((H9e,g7)=>{"use strict";var mwe=Ae(),gwe=mwe("%Object%"),vwe=x_();g7.exports=function(e){return vwe(e),gwe(e)}});var b7=g((z9e,y7)=>{"use strict";var ywe=Ae(),bwe=ywe("%TypeError%"),wwe=Hu(),xwe=v7();y7.exports=function(e,t){if(!wwe(t))throw new bwe("Assertion failed: IsPropertyKey(P) is not true");var i=xwe(e);return i[t]}});var D7=g((G9e,w7)=>{"use strict";var x7=Function.prototype.toString,zu=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,D_,ry;if(typeof zu=="function"&&typeof Object.defineProperty=="function")try{D_=Object.defineProperty({},"length",{get:function(){throw ry}}),ry={},zu(function(){throw 42},null,D_)}catch(r){r!==ry&&(zu=null)}else zu=null;var Dwe=/^\s*class\b/,S_=function(e){try{var t=x7.call(e);return Dwe.test(t)}catch(i){return!1}},Swe=function(e){try{return S_(e)?!1:(x7.call(e),!0)}catch(t){return!1}},Ewe=Object.prototype.toString,Cwe="[object Function]",_we="[object GeneratorFunction]",Pwe=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol";w7.exports=zu?function(e){if(!e||typeof e!="function"&&typeof e!="object")return!1;if(typeof e=="function"&&!e.prototype)return!0;try{zu(e,null,D_)}catch(t){if(t!==ry)return!1}return!S_(e)}:function(e){if(!e||typeof e!="function"&&typeof e!="object")return!1;if(typeof e=="function"&&!e.prototype)return!0;if(Pwe)return Swe(e);if(S_(e))return!1;var t=Ewe.call(e);return t===Cwe||t===_we}});var iy=g((V9e,S7)=>{"use strict";S7.exports=D7()});var _7=g((K9e,E7)=>{"use strict";var Twe=Ae(),C7=Twe("%TypeError%"),Rwe=b7(),kwe=iy(),Iwe=Hu();E7.exports=function(e,t){if(!Iwe(t))throw new C7("Assertion failed: IsPropertyKey(P) is not true");var i=Rwe(e,t);if(i!=null){if(!kwe(i))throw new C7(t+"is not a function");return i}}});var I7=g((J9e,P7)=>{"use strict";var Fwe=Li()(),T7=Fwe&&typeof Symbol.toStringTag=="symbol",R7,k7,E_,C_;T7&&(R7=Function.call.bind(Object.prototype.hasOwnProperty),k7=Function.call.bind(RegExp.prototype.exec),E_={},ny=function(){throw E_},C_={toString:ny,valueOf:ny},typeof Symbol.toPrimitive=="symbol"&&(C_[Symbol.toPrimitive]=ny));var ny,Awe=Object.prototype.toString,Owe=Object.getOwnPropertyDescriptor,Lwe="[object RegExp]";P7.exports=T7?function(e){if(!e||typeof e!="object")return!1;var t=Owe(e,"lastIndex"),i=t&&R7(t,"value");if(!i)return!1;try{k7(e,C_)}catch(n){return n===E_}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:Awe.call(e)===Lwe}});var __=g((Y9e,F7)=>{"use strict";F7.exports=function(e){return!!e}});var L7=g((X9e,A7)=>{"use strict";var Mwe=Ae(),O7=Mwe("%Symbol.match%",!0),Nwe=I7(),qwe=__();A7.exports=function(e){if(!e||typeof e!="object")return!1;if(O7){var t=e[O7];if(typeof
\v\f\r\xA0\u1680\u180E\u2000\u2001\u2002\u2003`,"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028","\u2029\uFEFF"].join(""),vDe=new RegExp("(^["+DV+"]+)|(["+DV+"]+$)","g"),yDe=wV("String.prototype.replace"),bDe=function(r){return yDe(r,vDe,"")},wDe=gV();vV.exports=function r(e){var t=cDe(e)?e:wDe(e,yV);if(typeof t=="symbol")throw new lDe("Cannot convert a Symbol value to a number");if(typeof t=="string"){if(fDe(t))return r(bV(xV(t,2),2));if(pDe(t))return r(bV(xV(t,2),8));if(gDe(t)||dDe(t))return NaN;var i=bDe(t);if(i!==t)return r(i)}return yV(t)}});var CV=g((O7e,EV)=>{"use strict";var xDe=XG(),DDe=SV();EV.exports=function(e){var t=DDe(e);return t!==0&&(t=xDe(t)),t===0?0:t}});var eP=g((L7e,_V)=>{"use strict";var PV=Y_(),SDe=CV();_V.exports=function(e){var t=SDe(e);return t<=0?0:t>PV?PV:t}});var tP=g((M7e,TV)=>{"use strict";TV.exports=function(e){return typeof e=="number"&&e>=55296&&e<=56319}});var rP=g((N7e,RV)=>{"use strict";RV.exports=function(e){return typeof e=="number"&&e>=56320&&e<=57343}});var AV=g((q7e,kV)=>{"use strict";var IV=Ae(),EDe=IV("%TypeError%"),FV=IV("%String.fromCharCode%"),CDe=tP(),_De=rP();kV.exports=function(e,t){if(!CDe(e)||!_De(t))throw new EDe("Assertion failed: `lead` must be a leading surrogate char code, and `trail` must be a trailing surrogate char code");return FV(e)+FV(t)}});var $V=g(($7e,OV)=>{"use strict";var PDe=Ae(),LV=PDe("%TypeError%"),MV=Ra(),TDe=tP(),NV=rP(),RDe=pr(),kDe=AV(),IDe=MV("String.prototype.charAt"),qV=MV("String.prototype.charCodeAt");OV.exports=function(e,t){if(RDe(e)!=="String")throw new LV("Assertion failed: `string` must be a String");var i=e.length;if(t<0||t>=i)throw new LV("Assertion failed: `position` must be >= 0, and < the length of `string`");var n=qV(e,t),o=IDe(e,t),s=TDe(n),a=NV(n);if(!s&&!a)return{"[[CodePoint]]":o,"[[CodeUnitCount]]":1,"[[IsUnpairedSurrogate]]":!1};if(a||t+1===i)return{"[[CodePoint]]":o,"[[CodeUnitCount]]":1,"[[IsUnpairedSurrogate]]":!0};var l=qV(e,t+1);return NV(l)?{"[[CodePoint]]":kDe(n,l),"[[CodeUnitCount]]":2,"[[IsUnpairedSurrogate]]":!1}:{"[[CodePoint]]":o,"[[CodeUnitCount]]":1,"[[IsUnpairedSurrogate]]":!0}}});var jV=g((B7e,BV)=>{"use strict";var FDe=Ae(),ADe=FDe("%Math.abs%");BV.exports=function(e){return ADe(e)}});var WV=g((j7e,UV)=>{"use strict";var ODe=Math.floor;UV.exports=function(e){return ODe(e)}});var zV=g((U7e,HV)=>{"use strict";var LDe=jV(),MDe=WV(),NDe=uy(),qDe=X_();HV.exports=function(e){if(typeof e!="number"||NDe(e)||!qDe(e))return!1;var t=LDe(e);return MDe(t)===t}});var KV=g((W7e,GV)=>{"use strict";var $De=Ae(),BDe=$V(),jDe=zV(),VV=pr(),UDe=Y_(),iP=$De("%TypeError%");GV.exports=function(e,t,i){if(VV(e)!=="String")throw new iP("Assertion failed: `S` must be a String");if(!jDe(t)||t<0||t>UDe)throw new iP("Assertion failed: `length` must be an integer >= 0 and <= 2**53");if(VV(i)!=="Boolean")throw new iP("Assertion failed: `unicode` must be a Boolean");if(!i)return t+1;var n=e.length;if(t+1>=n)return t+1;var o=BDe(e,t);return t+o["[[CodeUnitCount]]"]}});var YV=g((H7e,JV)=>{"use strict";var WDe=Ae(),HDe=WDe("%TypeError%"),zDe=pr();JV.exports=function(e,t){if(zDe(t)!=="Boolean")throw new HDe("Assertion failed: Type(done) is not Boolean");return{value:e,done:t}}});var QV=g((z7e,XV)=>{"use strict";var GDe=Ae(),ZV=GDe("%Array%"),VDe=!ZV.isArray&&Ra()("Object.prototype.toString");XV.exports=ZV.isArray||function(e){return VDe(e)==="[object Array]"}});var nK=g((G7e,eK)=>{"use strict";var nP=Ae(),tK=nP("%Object.create%",!0),rK=nP("%TypeError%"),iK=nP("%SyntaxError%"),KDe=QV(),JDe=pr(),YDe=!({__proto__:null}instanceof Object);eK.exports=function(e){if(e!==null&&JDe(e)!=="Object")throw new rK("Assertion failed: `proto` must be null or an object");var t=arguments.length<2?[]:arguments[1];if(!KDe(t))throw new rK("Assertion failed: `additionalInternalSlotsList` must be an Array");if(t.length>0)throw new iK("es-abstract does not yet support internal slots");if(tK)return tK(e);if(YDe)return{__proto__:e};if(e===null)throw new iK("native Object.create support is required to create null objects");var i=function(){};return i.
`+n.stack:""} `),pq.error(`Handler Error on ${e}`,n.stack)}}on(e,t,i,n){if(Array.isArray(e)){leto=n||[];for(letsofe)this.on(s,t,i,o);returnOx.Disposable.create(()=>{z(o)})}else{leto=this.handlers.get(e)||[],s=Error().stack,a=u=>newPromise((c,f)=>{letp;try{Promise.resolve(t.apply(i||null,u)).then(()=>{p&&clearTimeout(p),c(void0)},d=>{p&&clearTimeout(p),f(d)}),p=setTimeout(()=>{pq.warn(`Handler of ${e} blocked more than 2s:`,s)},2e3)}catch(d){f(d)}});o.push(a),this.handlers.set(e,o);letl=Ox.Disposable.create(()=>{letu=o.indexOf(a);u!==-1&&o.splice(u,1)});returnn&&n.push(l),l}}},A=newdq;varbJ=S(require("events")),wJ=S(require("path")),AP=S(require("fs")),xd=S(W());varWv=S(W());varXj=S(Gr()),Zj=S(Pf()),dt=S(W());varLB=S(Gr()),Lm=S(W());varhD=S(x$());varbB=S(uB());varwr=S(hB());functionmB(r){return`${wr.default.gray.open}${r}${wr.default.gray.close}`}functionlD(r){return`${wr.default.magenta.open}${r}${wr.default.magenta.close}`}functiongB(r){return`${wr.default.bold.open}${r}${wr.default.bold.close}`}functionAm(r){return`${wr.default.underline.open}${r}${wr.default.underline.close}`}functionvB(r){return`${wr.default.italic.open}${r}${wr.default.italic.close}`}functionyB(r){return`${wr.default.yellow.open}${r}${wr.default.yellow.close}`}functionuD(r){return`${wr.default.blue.open}${r}${wr.default.blue.close}`}varHTe=j()("markdown-renderer"),wB="^*||*^",cD="*|*|*|*",wpe=newRegExp(xB(cD),"g"),DB="*#COLON|*",xpe=newRegExp(xB(DB),"g"),Dpe=[" "],Spe="\r",SB={code:Ki,blockquote:Ki,html:mB,heading:lD,firstHeading:lD,hr:Ki,listitem:Ki,list:Epe,table:Ki,paragraph:Ki,strong:gB,em:vB,codespan:yB,del:Am,link:Am,href:Am,text:Ki,unescape:!0,emoji:!1,width:80,showSectionPrefix:!0,tab:2,tableOptions:{}};functionEB(r,e){returne?r.replace(Spe,/\n/g):r}function_pe(r,e){returntypeofr=="number"?newArray(r+1).join(" "):typeofr=="string"&&Cpe(r)?r:newArray(e+1).join(" ")}functionCpe(r){returnDpe.some(function(e){returnr.match("^("+e+")+$")})}functionPpe(r,e){returne.replace(/(^|\n)(.+)/g,"$1"+r+"$2")}functionTpe(r,e){returne&&r+e.split(`
`));for(let c of l.replace(/\s*$/,"").split(/\n/)){if(!c.length){let p=e[e.length-1];p&&p.length&&(e.push(c),n++);continue}if(/\s*```\s*([A-Za-z0-9_,]+)?$/.test(c)){letp=e[e.length-1];o?(o=!1,i.push({filetype:s,startLine:a,endLine:n})):(o=!0,s=c.replace(/^\s*```\s*/,""),s=="js"&&(s="javascript"),s=="ts"&&(s="typescript"),s=="bash"&&(s="sh"),a=n),p&&p.length&&(e.push(""),n++);continue}if(o){e.push(c),n++;continue}letf=Nl(c,!0);if(f.highlights)for(letpoff.highlights){let{hlGroup:d,span:h}=p;t.push({hlGroup:d,lnum:n,colStart:h[0],colEnd:h[1]})}e.push(f.line),n++}return{lines:e,highlights:t,codes:i}}varar=class{constructor(){this.tasks=[];this.count=1}sched(){this.count>0&&this.tasks.length>0&&(this.count--,this.tasks.shift()())}getbusy(){returnthis.count==0}acquire(){returnnewPromise(e=>{lett=()=>{leti=!1;e(()=>{i||(i=!0,this.count++,this.sched())})};this.tasks.push(t),process.nextTick(this.sched.bind(this))})}use(e){returnthis.acquire().then(t=>e().then(i=>(t(),i)).catch(i=>{throwt(),i}))}};varMB=process.env.VIM_NODE_RPC=="1",NB=j()("model-float"),mD=class{constructor(e){this.nvim=e;this.winid=0;this._bufnr=0;this.mutex=newar;this.disposables=[];this.alignTop=!1;this.pumAlignTop=!1;this.autoHide=!0;this.mutex=newar,A.on("BufEnter",t=>{t==this._bufnr||t==this.targetBufnr||this.close()},null,this.disposables),A.on("InsertEnter",t=>{t==this._bufnr||!this.autoHide||this.close()},null,this.disposables),A.on("InsertLeave",()=>{this.close()},null,this.disposables),A.on("MenuPopupChanged",(t,i)=>{(this.pumAlignTop=i>t.row)==this.alignTop&&this.close()},null,this.disposables),this.onCursorMoved=LB.default(this._onCursorMoved.bind(this),300),A.on("CursorMoved",this.onCursorMoved.bind(this,!1),null,this.disposables),A.on("CursorMovedI",this.onCursorMoved.bind(this,!0),null,this.disposables),this.disposables.push(Lm.Disposable.create(()=>{this.onCursorMoved.clear(),this.cancel()}))}_onCursorMoved(e,t,i){if(t!=this._bufnr&&!(t==this.targetBufnr&&Ne(i,this.cursor))){if(this.autoHide){this.close();return}if(!e||t!=this.targetBufnr){this.close();return}}}asynccreate(e,t=!1,i=0){if(this.onCursorMoved.clear(),e.length==0||e.every(o=>o.content.length==0)){this.close();return}letn=awaitthis.mutex.acquire();try{awaitthis.createPopup(e,{offsetX:i}),n()}catch(o){n(),NB.error("Error on create popup:",o.message),this.close()}}asyncshow(e,t={}){if(this.onCursorMoved.clear(),e.length==0||e.every(n=>n.content.length==0)){this.close();return}leti=awaitthis.mutex.acquire();try{awaitthis.createPopup(e,t),i()}catch(n){i(),NB.error("Error on create popup:",n.message),this.close()}}asynccreatePopup(e,t){letn=(this.tokenSource=newLm.CancellationTokenSource).token;e=e.filter(m=>m.content.trim().length>0);let{lines:o,codes:s,highlights:a}=Om(e),l={pumAlignTop:this.pumAlignTop,preferTop:typeoft.preferTop=="boolean"?t.preferTop:!1,offsetX:t.offsetX||0,title:t.title||"",close:t.close?1:0,codes:s,highlights:a,modes:t.modes||["n","i","ic","s"]};t.maxHeight&&(l.maxHeight=t.maxHeight),t.maxWidth&&(l.maxWidth=t.maxWidth),t.border&&!t.border.every(m=>m==0)&&(l.border=t.border),t.title&&!l.border&&(l.border=[1,1,1,1]),t.highlight&&(l.highlight=t.highlight),t.borderhighlight&&(l.borderhighlight=[t.borderhighlight]),t.cursorline&&(l.cursorline=1),this.autoHide=t.autoHide!=!1,this.autoHide&&(l.autohide=1);letu=awaitthis.nvim.call("coc#float#create_cursor_float",[this.winid,this._bufnr,o,l]);if(MB&&this.nvim.command("redraw",!0),!u||u.length==0){this.winid=null;return}let[c,f,p,d]=u;if(this.winid=p,n.isCancellationRequested){this.close();return}leth=awaitthis.nvim.call("coc#float#cursor_relative",[p]);h&&(this.alignTop=h.row<0),this._bufnr=d,this.tokenSource.dispose(),this.tokenSource=null,this.targetBufnr=c,this.cursor=f,this.onCursorMoved.clear()}close(){let{winid:e,nvim:t}=this;this.cancel(),e&&(this.winid=0,t.pauseNotification(),t.call("coc#float#close",[e],!0),MB&&this.nvim.command("redraw",!0),t.resumeNotification(!1,!0))}cancel(){let{tokenSource:e}=this;e&&(e.cancel(),this.tokenSource=null)}dispose(){z(this.disposables)}getbufnr(){
augroupend`;try{let o=ke.default.join(process.env.TMPDIR,`coc.nvim-${process.pid}`);Dt.default.existsSync(o)||Dt.default.mkdirpSync(o);let s=ke.default.join(o,`coc-${process.pid}.vim`);Dt.default.writeFileSync(s,n,"utf8");let a=`source${s}`;this.env.isCygwin&&Cl.isWindows&&(a=`execute"source".substitute(system('cygpath ${s.replace(/\\/g,"/")}'),'\\n','','g')`),this.nvim.command(a).logError()}catch(o){C.showMessage(`Can't create tmp file: ${o.message}`,"error")}}async onBufReadCmd(e,t){let i=this.schemeProviderMap.get(e);if(!i){C.showMessage(`Provider for ${e} not found`,"error");return}let n=new le.CancellationTokenSource,o=await Promise.resolve(i.provideTextDocumentContent($.parse(t),n.token)),s=await this.nvim.buffer;await s.setLines(o.split(/\r?\n/),{start:0,end:-1,strictIndexing:!1}),setTimeout(async()=>{await A.fire("BufCreate",[s.id])},30)}async attach(){if(this._attached)return;this._attached=!0;let[e,t,i]=await this.nvim.eval(`[map(getbufinfo({'bufloaded': 1}),'v:val["bufnr"]'),bufnr('%'),win_getid()]`);this.bufnr=t,await Promise.all(e.map(n=>this.onBufCreate(n))),this._initialized||(this._onDidWorkspaceInitialized.fire(void 0),this._initialized=!0),await A.fire("BufEnter",[t]),await A.fire("BufWinEnter",[t,i])}getChangedUris(e){let t=new Set,i=new Set;for(let n of e)if(le.TextDocumentEdit.is(n)){let{textDocument:o}=n,{uri:s,version:a}=o;if(t.add(s),a!=null&&a>0){let l=this.getDocument(s);if(!l)throw new Error(`${s}notloaded`);if(l.version!=a)throw new Error(`${s}changedbeforeapplyedit`)}}else if(le.CreateFile.is(n)||le.DeleteFile.is(n)){if(!Jm(n.uri))throw new Error(`changeofscheme${n.uri}notsupported`);i.add(n.uri),t.add(n.uri)}else if(le.RenameFile.is(n)){if(!Jm(n.oldUri)||!Jm(n.newUri))throw new Error(`changeofscheme${n.oldUri}notsupported`);let o=$.parse(n.newUri).fsPath;if(Dt.default.existsSync(o))throw new Error(`file"${o}"alreadyexistsforrename`);t.add(n.oldUri)}else throw new Error(`Invaliddocumentchange:${JSON.stringify(n,null,2)}`);return Array.from(t)}createConfigurations(){let e=ke.default.normalize(process.env.COC_VIMCONFIG)||ke.default.join(Qi.default.homedir(),".vim"),t=ke.default.join(e,Gi);return new Q3(t,new ej(this))}attachChangedEvents(){if(this.isVim){let e=t=>{let i=this.getDocument(t);i&&i.attached&&i.fetchContent()};A.on("TextChangedI",e,null,this.disposables),A.on("TextChanged",e,null,this.disposables)}}async onBufCreate(e){let t=typeof e=="number"?this.nvim.createBuffer(e):e,i=t.id;if(this.creatingSources.has(i))return;let n=this.getDocument(i),o=new le.CancellationTokenSource;try{n&&this.onBufUnload(i,!0),n=new Zm(t,this._env,this.maxFileSize);let s=o.token;this.creatingSources.set(i,o),await n.init(this.nvim,s)||(n=null)}catch(s){op.error("Error on create buffer:",s),n=null}if(this.creatingSources.get(i)==o&&(o.dispose(),this.creatingSources.delete(i)),!(!n||!n.textDocument)){if(this.buffers.set(i,n),n.attached&&n.onDocumentDetach(s=>{let a=this.getDocument(s);a&&this.onBufUnload(a.bufnr)}),n.buftype==""&&n.schema=="file"&&(this.configurations.checkFolderConfiguration(n.uri),!this.getConfiguration("workspace").get("ignoredFiletypes",[]).includes(n.filetype))){let l=this.resolveRoot(n);l&&(this.addWorkspaceFolder(l),this.bufnr==t.id&&(this._root=l))}if(n.enabled){let s=Object.assign(n.textDocument,{bufnr:i});this._onDidOpenDocument.fire(s),n.onDocumentChange(a=>this._onDidChangeDocument.fire(a))}op.debug("buffer created",t.id)}}onBufEnter(e){this.bufnr=e;let t=this.getDocument(e);if(t){this.configurations.setFolderConfiguration(t.uri);let i=this.getWorkspaceFolder(t.uri);i&&(this._root=$.parse(i.uri).fsPath)}}async checkCurrentBuffer(e){this.bufnr=e,await this.checkBuffer(e)}onBufWritePost(e){let t=this.buffers.get(e);!t||this._onDidSaveDocument.fire(t.textDocument)}onBufUnload(e,t=!1){if(op.debug("buffer unload",e),!t){let n=this.creatingSources.get(e);n&&(n.cancel(),this.creatingSources.delete(e))}if(this.terminals.has(e)){let n=this.terminals.get(e);this._onDidCloseTerminal.fire(n),this.terminals.delete(e)}let i=this.buffers.get(e);if(i){let n=Object
`)!=`
`&&(e.call("append",[0,a],!0),e.command("normal! Gdd",!0)),e.call("winrestview",[c],!0),await e.resumeNotification()}get folderPaths(){return this.workspaceFolders.map(e=>$.parse(e.uri).fsPath)}get floatSupported(){let{env:e}=this;return e.floating||e.textprop}removeWorkspaceFolder(e){let t=this._workspaceFolders.findIndex(i=>$.parse(i.uri).fsPath==e);if(t!=-1){let i=this._workspaceFolders[t];this._workspaceFolders.splice(t,1),this._onDidChangeWorkspaceFolders.fire({removed:[i],added:[]})}}renameWorkspaceFolder(e,t){let i=this._workspaceFolders.findIndex(s=>$.parse(s.uri).fsPath==e);if(i==-1)return;let n=this._workspaceFolders[i],o={uri:$.file(t).toString(),name:ke.default.dirname(t)};this._workspaceFolders.splice(i,1),this._workspaceFolders.push(o),this._onDidChangeWorkspaceFolders.fire({removed:[n],added:[o]})}addRootPattern(e,t){let i=this.rootPatterns.get(e)||[];for(let n of t)i.includes(n)||i.push(n);this.rootPatterns.set(e,i)}get insertMode(){return this._insertMode}async detach(){if(!!this._attached){this._attached=!1,Xs.dispose();for(let e of this.buffers.keys())await A.fire("BufUnload",[e])}}dispose(){this._disposed=!0;for(let e of this.documents)e.detach();z(this.disposables),ta.dispose(),this.configurations.dispose(),this.buffers.clear()}addWorkspaceFolder(e){if(e==Qi.default.homedir())return;let{_workspaceFolders:t}=this,i=$.file(e).toString(),n={uri:i,name:ke.default.basename(e)};return t.findIndex(o=>o.uri==i)==-1&&(t.push(n),this._initialized&&this._onDidChangeWorkspaceFolders.fire({added:[n],removed:[]})),n}getServerRootPatterns(e){let t=this.getConfiguration().get("languageserver",{}),i=[];for(let n of Object.keys(t)){let o=t[n],{filetypes:s,rootPatterns:a}=o;s&&a&&s.includes(e)&&i.push(...a)}return i=i.concat(this.rootPatterns.get(e)||[]),i.length?eg(i):null}},b=new Uj;var Kl=j()("window"),zj=class{constructor(){this.mutex=new ar}get nvim(){return b.nvim}dispose(){var e;(e=this.statusLine)==null||e.dispose()}showMessage(e,t="more"){if(this.mutex.busy||!this.nvim)return;let{messageLevel:i}=this,n=process.env.VIM_NODE_RPC=="1"?"callTimer":"call";global.hasOwnProperty("__TEST__")&&Kl.info(e);let o="Error",s=gn.Error;switch(t){case"more":s=gn.More,o="MoreMsg";break;case"warning":s=gn.Warning,o="WarningMsg";break}s>=i&&this.nvim[n]("coc#util#echo_messages",[o,("[coc.nvim] "+e).split(`
`),0,i]]);return t[s-1]}async withProgress(e,t){return this.checkDialog()?await new ZB(this.nvim,{task:t,title:e.title,cancellable:e.cancellable}).show(this.notificationPreference):void 0}createNotification(e,t,i){return new Promise(n=>{let o={content:t,borderhighlight:e,close:!0,buttons:i.map((a,l)=>({text:a,index:l})),callback:a=>{n(a)}};new qf(this.nvim,o).show(this.notificationPreference).then(a=>{a||(Kl.error("Unable to open notification window"),n(-1)),i.length||n(-1)},a=>{Kl.error("Unable to open notification window",a),n(-1)})})}get dialogPreference(){let e=b.getConfiguration("dialog");return{maxWidth:e.get("maxWidth"),maxHeight:e.get("maxHeight"),floatHighlight:e.get("floatHighlight"),floatBorderHighlight:e.get("floatBorderHighlight"),pickerButtons:e.get("pickerButtons"),pickerButtonShortcut:e.get("pickerButtonShortcut"),confirmKey:e.get("confirmKey")}}get notificationPreference(){let e=b.getConfiguration("notification");return{top:e.get("marginTop"),right:e.get("marginRight"),maxWidth:e.get("maxWidth"),maxHeight:e.get("maxHeight"),highlight:e.get("highlightGroup"),minProgressWidth:e.get("minProgressWidth")}}checkDialog(){return b.env.dialog?!0:(this.showMessage("Dialog requires vim >= 8.2.0750 or neovim >= 0.4.0, please upgrade your vim","warning"),!1)}get enableMessageDialog(){return b.env.dialog?b.getConfiguration("coc.preferences").get("enableMessageDialog",!1):!1}get messageLevel(){switch(b.getConfiguration("coc.preferences").get("messageLevel","more")){case"error":return gn.Error;case"warning":return gn.Warning;default:return gn.More}}},C=new zj;var Vj=S(Gr()),Qr=S(W());var Lt=S(W());function sp(r){switch(r){case Lt.DiagnosticSeverity.Error:return"Error";case Lt.DiagnosticSeverity.Warning:return"Warning";case Lt.DiagnosticSeverity.Information:return"Information";case Lt.DiagnosticSeverity.Hint:return"Hint";default:return"Error"}}function Gj(r){switch(r){case Lt.DiagnosticSeverity.Error:return"E";case Lt.DiagnosticSeverity.Warning:return"W";case Lt.DiagnosticSeverity.Information:return"I";case Lt.DiagnosticSeverity.Hint:return"I";default:return"Error"}}function S0(r){switch(r){case"hint":return Lt.DiagnosticSeverity.Hint;case"information":return Lt.DiagnosticSeverity.Information;case"warning":return Lt.DiagnosticSeverity.Warning;case"error":return Lt.DiagnosticSeverity.Error;default:return Lt.DiagnosticSeverity.Hint}}function fg(r){switch(r){case Lt.DiagnosticSeverity.Error:return"CocError";case Lt.DiagnosticSeverity.Warning:return"CocWarning";case Lt.DiagnosticSeverity.Information:return"CocInfo";case Lt.DiagnosticSeverity.Hint:return"CocHint";default:return"CocError"}}function pg(r,e){let{start:t}=e.range,i=e.source||"coc.nvim",n=e.message.split(`
`)[0],o=sp(e.severity).slice(0,1).toUpperCase();return{bufnr:r,lnum:t.line+1,col:t.character+1,text:`[${i}${e.code?" "+e.code:""}]${n}[${o}]`,type:o}}var Xde=j()("diagnostic-buffer"),Kj="CocDiagnostic",Zde=Symbol("CocError"),Qde=Symbol("CocWarning"),ehe=Symbol("CocInformation"),the=Symbol("CocHint"),E0=class{constructor(e,t,i,n,o){this.nvim=e;this.bufnr=t;this.uri=i;this.config=n;this.onRefresh=o;this.diagnostics=[];this._disposed=!1;this.refresh=Vj.default(s=>{this._refresh(s).logError()},300)}get displayByAle(){return this.config.displayByAle}onChange(){this.refresh.clear()}forceRefresh(e){this.refresh.clear(),this._refresh(e).logError()}refreshAle(e){let t=Jj(this.diagnostics);this.diagnostics=e;let i=new Map;e.forEach(n=>{let o=i.get(n.collection)||[];o.push(n),i.set(n.collection,o)});for(let n of t)i.has(n)||i.set(n,[]);this.nvim.pauseNotification();for(let[n,o]of i.entries()){let s=o.map(l=>{let u=l.range||Qr.Range.create(0,0,1,0);return{text:l.message,code:l.code,lnum:u.start.line+1,col:u.start.character+1,end_lnum:u.end.line+1,end_col:u.end.character,type:Gj(l.severity)}}),a=global.hasOwnProperty("__TEST__")?"MockAleResults":"ale#other_source#ShowResults";this.nvim.call(a,[this.bufnr,n,s],!0)}this.nvim.resumeNotification().then(n=>{Array.isArray(n)&&n[1]!=null&&Xde.error("Error on displayByAle:",n[1][2])}).logError()}async _refresh(e){if(Ne(this.diagnostics,e))return;let{refreshOnInsertMode:t}=this.config,{nvim:i}=this,n=await i.eval(`[coc#util#check_refresh(${this.bufnr}),mode(),line("."),getloclist(bufwinid(${this.bufnr}),{'title':1})]`);if(n[0]==0||this._disposed)return;let o=n[1];if(!(!t&&o.startsWith("i")&&e.length)){if(this.displayByAle)this.refreshAle(e);else{this.diagnostics=e;let s=n[2];i.pauseNotification(),this.setDiagnosticInfo(e),this.addSigns(e),this.addHighlight(e),this.updateLocationList(n[3],e),this.showVirtualText(e,s),this.nvim.command("redraw",!0);let a=await this.nvim.resumeNotification();if(Array.isArray(a)&&a[1])throw new Error(a[1])}this.onRefresh(e)}}updateLocationList(e,t){if(!this.config.locationlistUpdate||!e||e.title!=="Diagnostics of coc")return;let i=[];for(let n of t){let o=pg(this.bufnr,n);i.push(o)}this.nvim.call("setloclist",[0,[],"r",{title:"Diagnostics of coc",items:i}],!0)}addSigns(e){if(!this.config.enableSign)return;this.clearSigns();let{nvim:t,bufnr:i}=this,n=new Map;for(let o of e){let{range:s,severity:a}=o,l=s.start.line,u=fg(a),c=n.get(l)||[],f=rhe(a);c.includes(f)||(c.push(f),n.set(l,c),t.call("sign_place",[0,Kj,u,i,{lnum:l+1,priority:14-(a||0)}],!0))}}clearSigns(){let{nvim:e,bufnr:t}=this;e.call("sign_unplace",[Kj,{buffer:t}],!0)}setDiagnosticInfo(e){let t=[0,0,0,0],i={error:0,warning:0,information:0,hint:0,lnums:t};for(let n of e)switch(n.severity){case Qr.DiagnosticSeverity.Warning:i.warning=i.warning+1,t[1]=t[1]||n.range.start.line+1;break;case Qr.DiagnosticSeverity.Information:i.information=i.information+1,t[2]=t[2]||n.range.start.line+1;break;case Qr.DiagnosticSeverity.Hint:i.hint=i.hint+1,t[3]=t[3]||n.range.start.line+1;break;default:t[0]=t[0]||n.range.start.line+1,i.error=i.error+1}this.nvim.call("coc#util#set_buf_var",[this.bufnr,"coc_diagnostic_info",i],!0),this.nvim.call("coc#util#do_autocmd",["CocDiagnosticChange"],!0)}showVirtualText(e,t){let{buffer:i,config:n}=this;if(!n.virtualText)return;let o=this.config.virtualTextSrcId,s=this.config.virtualTextPrefix;this.config.virtualTextCurrentLineOnly&&(e=e.filter(a=>{let{start:l,end:u}=a.range;return l.line<=t-1&&u.line>=t-1})),i.clearNamespace(o);for(let a of[...e].reverse()){let{line:l}=a.range.start,u=fg(a.severity)+"VirtualText",c=a.message.split(/\n/).map(f=>f.trim()).filter(f=>f.length>0).slice(0,this.config.virtualTextLines).join(this.config.virtualTextLineSeparator);i.setVirtualText(o,l,[[s+c,u]],{}).logError()}}addHighlight(e){if(this.clearHighlight(),e.length==0)return;let t=new Map;for(let i of e){let{range:n,severity:o}=i,s=t.get(o)||[];s.push(n),t.set(o,s)}for(let i of[Qr.DiagnosticSeverity.Hint,Qr.DiagnosticSeverity.Information,Qr.DiagnosticSeverity.Warning,Qr.DiagnosticSeverity.Error]){let n=t.
`).split(/\r?\n/);f.length&&(await this.nvim.command('echo ""'),this.lastMessage=f[0].slice(0,30),await C.echoLines(f,e))}}async jumpRelated(){let e=await this.getCurrentDiagnostics();if(!e)return;let t=e.find(n=>n.relatedInformation!=null);if(!t)return;let i=t.relatedInformation.map(n=>n.location);i.length==1?await b.jumpTo(i[0].uri,i[0].range.start):i.length>1&&await b.showLocations(i)}reset(){this.timer&&clearTimeout(this.timer),this.buffers.reset();for(let e of this.collections)e.dispose();this.collections=[]}dispose(){var e;this.buffers.dispose(),this.timer&&clearTimeout(this.timer);for(let t of this.collections)t.dispose();(e=this.floatFactory)==null||e.close(),this.collections=[],z(this.disposables)}get nvim(){return b.nvim}setConfiguration(e){if(e&&!e.affectsConfiguration("diagnostic"))return;let t=b.getConfiguration("diagnostic"),i=t.get("messageTarget","float");i=="float"&&!b.env.floating&&!b.env.textprop&&(i="echo");let n=t.get("enableHighlightLineNumber",!0);(!b.isNvim||Zj.default.lt(b.env.version,"v0.3.2"))&&(n=!1),this.config={messageTarget:i,enableHighlightLineNumber:n,virtualTextSrcId:b.createNameSpace("diagnostic-virtualText"),checkCurrentLine:t.get("checkCurrentLine",!1),enableSign:b.env.sign&&t.get("enableSign",!0),locationlistUpdate:t.get("locationlistUpdate",!0),maxWindowHeight:t.get("maxWindowHeight",10),maxWindowWidth:t.get("maxWindowWidth",80),enableMessage:t.get("enableMessage","always"),messageDelay:t.get("messageDelay",200),virtualText:t.get("virtualText",!1)&&this.nvim.hasFunction("nvim_buf_set_virtual_text"),virtualTextCurrentLineOnly:t.get("virtualTextCurrentLineOnly",!0),virtualTextPrefix:t.get("virtualTextPrefix"," "),virtualTextLineSeparator:t.get("virtualTextLineSeparator"," \\ "),virtualTextLines:t.get("virtualTextLines",3),displayByAle:t.get("displayByAle",!1),level:S0(t.get("level","hint")),signPriority:t.get("signPriority",10),errorSign:t.get("errorSign",">>"),warningSign:t.get("warningSign",">>"),infoSign:t.get("infoSign",">>"),hintSign:t.get("hintSign",">>"),refreshOnInsertMode:t.get("refreshOnInsertMode",!1),filetypeMap:t.get("filetypeMap",{}),showUnused:t.get("showUnused",!0),showDeprecated:t.get("showDeprecated",!0),format:t.get("format","[%source%code] [%severity] %message")},this.enabled=t.get("enable",!0),this.defineSigns()}getCollectionByName(e){return this.collections.find(t=>t.name==e)}getCollections(e){return this.collections.filter(t=>t.has(e))}toggleDiagnostic(){let{enabled:e}=this;this.enabled=!e;for(let t of this.buffers.items)if(this.enabled){let i=this.getDiagnostics(t.uri);t.forceRefresh(i)}else t.clear()}refreshBuffer(e,t=!1){if(!this.enabled)return!1;let i=this.buffers.getItem(e);if(!i)return!1;let n=this.getDiagnostics(i.uri);return t?i.forceRefresh(n):i.refresh(n),!0}},St=new Qj;var ht;(function(r){r[r.Null=0]="Null",r[r.Backspace=8]="Backspace",r[r.Tab=9]="Tab",r[r.LineFeed=10]="LineFeed",r[r.CarriageReturn=13]="CarriageReturn",r[r.Space=32]="Space",r[r.ExclamationMark=33]="ExclamationMark",r[r.DoubleQuote=34]="DoubleQuote",r[r.Hash=35]="Hash",r[r.DollarSign=36]="DollarSign",r[r.PercentSign=37]="PercentSign",r[r.Ampersand=38]="Ampersand",r[r.SingleQuote=39]="SingleQuote",r[r.OpenParen=40]="OpenParen",r[r.CloseParen=41]="CloseParen",r[r.Asterisk=42]="Asterisk",r[r.Plus=43]="Plus",r[r.Comma=44]="Comma",r[r.Dash=45]="Dash",r[r.Period=46]="Period",r[r.Slash=47]="Slash",r[r.Digit0=48]="Digit0",r[r.Digit1=49]="Digit1",r[r.Digit2=50]="Digit2",r[r.Digit3=51]="Digit3",r[r.Digit4=52]="Digit4",r[r.Digit5=53]="Digit5",r[r.Digit6=54]="Digit6",r[r.Digit7=55]="Digit7",r[r.Digit8=56]="Digit8",r[r.Digit9=57]="Digit9",r[r.Colon=58]="Colon",r[r.Semicolon=59]="Semicolon",r[r.LessThan=60]="LessThan",r[r.Equals=61]="Equals",r[r.GreaterThan=62]="GreaterThan",r[r.QuestionMark=63]="QuestionMark",r[r.AtSign=64]="AtSign",r[r.A=65]="A",r[r.B=66]="B",r[r.C=67]="C",r[r.D=68]="D",r[r.E=69]="E",r[r.F=70]="F",r[r.G=71]="G",r[r.H=72]="H",r[r.I=73]="I",r[r.J=74]="J",r[r.K=75]="K",r[r.L=76]="L",r[r.M=77]="M",r[r.N=78]="N",r[r.O=79]="O",r[r.P=80]="P",r[r.Q=81]="Q",r[r.R=82]="R",r[r.S=83]="S",r[r
`;for(let l of s.relatedInformation){let u=WE.default.basename($.parse(l.location.uri).fsPath),c=l.location.range.start.line;a=`${a}
${u}(line${c+1}):${l.message}`;let f=o.get(l.location.uri)||[];f.push(D.Diagnostic.create(l.location.range,l.message,D.DiagnosticSeverity.Hint,s.code,s.source)),o.set(l.location.uri,f)}s.message=a}this._diagnostics.set(Array.from(o))}}else this._diagnostics.set(e,t)}createConnection(){let e=(i,n,o)=>{as.error("connection error:",i,n),this.handleConnectionError(i,n,o)},t=()=>{this.handleConnectionClosed()};return this.createMessageTransports(this._clientOptions.stdioEncoding||"utf8").then(i=>uye(i.reader,i.writer,e,t))}handleConnectionClosed(){if(this.state===4||this.state===5)return;try{this._resolvedConnection&&this._resolvedConnection.dispose()}catch(t){}let e=1;try{e=this._clientOptions.errorHandler.closed()}catch(t){}this._connectionPromise=void 0,this._resolvedConnection=void 0,e===1?(this.error("Connection to server got closed. Server will not be restarted."),this.state=5,this.cleanUp(!1,!0)):e===2&&(this.info("Connection to server got closed. Server will restart."),this.cleanUp(!1,!0),this.state=0,this.start())}restart(){this.cleanUp(!0,!1),this.start()}handleConnectionError(e,t,i){this._clientOptions.errorHandler.error(e,t,i)===2&&(this.error("Connection to server is erroring. Shutting down server."),this.stop())}hookConfigurationChanged(e){b.onDidChangeConfiguration(()=>{this.refreshTrace(e,!0)})}refreshTrace(e,t=!1){let i=b.getConfiguration(this._id),n=D.Trace.Off,o=D.TraceFormat.Text;if(i){let s=i.get("trace.server","off");typeof s=="string"?n=D.Trace.fromString(s):(n=D.Trace.fromString(i.get("trace.server.verbosity","off")),o=D.TraceFormat.fromString(i.get("trace.server.format","text")))}this._trace=n,this._traceFormat=o,e.trace(this._trace,this._tracer,{sendNotification:t,traceFormat:this._traceFormat})}hookFileEvents(e){let t=this._clientOptions.synchronize.fileEvents;if(!t)return;let i;Array.isArray(t)?i=t:i=[t],!!i&&this._dynamicFeatures.get(D.DidChangeWatchedFilesNotification.type.method).registerRaw($e(),i)}registerFeatures(e){for(let t of e)this.registerFeature(t)}registerFeature(e){if(this._features.push(e),zE.is(e)){let t=e.messages;if(Array.isArray(t))for(let i of t)this._method2Message.set(i.method,i),this._dynamicFeatures.set(i.method,e);else this._method2Message.set(t.method,t),this._dynamicFeatures.set(t.method,e)}}getFeature(e){return this._dynamicFeatures.get(e)}registerBuiltinFeatures(){this.registerFeature(new PH(this)),this.registerFeature(new nH(this,this._syncedDocuments)),this.registerFeature(new sH(this)),this.registerFeature(new aH(this)),this.registerFeature(new lH(this)),this.registerFeature(new uH(this)),this.registerFeature(new oH(this,this._syncedDocuments)),this.registerFeature(new cH(this,e=>this.notifyFileEvent(e))),this._clientOptions.disableCompletion||this.registerFeature(new pH(this)),this.registerFeature(new dH(this)),this.registerFeature(new hH(this)),this.registerFeature(new mH(this)),this.registerFeature(new gH(this)),this.registerFeature(new vH(this)),this.registerFeature(new yH(this)),this.registerFeature(new bH(this)),this.registerFeature(new wH(this)),this.registerFeature(new xH(this)),this.registerFeature(new DH(this)),this.registerFeature(new SH(this)),this.registerFeature(new EH(this)),this.registerFeature(new CH(this)),this.registerFeature(new _H(this)),this.registerFeature(new TH(this))}fillInitializeParams(e){for(let t of this._features)Lo(t.fillInitializeParams)&&t.fillInitializeParams(e)}computeClientCapabilities(){let e={};re(e,"workspace").applyEdit=!0;let t=re(re(e,"workspace"),"workspaceEdit");t.documentChanges=!0,t.resourceOperations=[D.ResourceOperationKind.Create,D.ResourceOperationKind.Rename,D.ResourceOperationKind.Delete],t.failureHandling=D.FailureHandlingKind.TextOnlyTransactional;let i=re(re(e,"textDocument"),"publishDiagnostics");i.relatedInformation=!0,i.versionSupport=!1,i.tagSupport={valueSet:[D.DiagnosticTag.Unnecessary,D.DiagnosticTag.Deprecated]};for(let n of this._features)n.fillClientCapabilities(e);return e}initializeFeatures(e){let t=this._clientOptions.documentSelector;for(let i of this._features)i.initialize(this._capabilities,t)
`)?i:i+`
`)}},$H=class{constructor(e,t){this._client=e;this._setting=t;this._listeners=[]}start(){return b.onDidChangeConfiguration(e=>{e.affectsConfiguration(this._setting)&&this.onDidChangeConfiguration()},null,this._listeners),this.onDidChangeConfiguration(),{dispose:()=>{z(this._listeners),this._client.needsStop()&&this._client.stop()}}}onDidChangeConfiguration(){let e=this._setting.indexOf("."),t=e>=0?this._setting.substr(0,e):this._setting,i=e>=0?this._setting.substr(e+1):void 0,n=i?b.getConfiguration(t).get(i,!0):b.getConfiguration(t);n&&this._client.needsStart()?this._client.start():!n&&this._client.needsStop()&&this._client.stop()}},_v;(function(e){function r(t){return[]}e.createAll=r})(_v||(_v={}));var Ea=j()("services");function pye(r){switch(r){case ye.Initial:return"init";case ye.Running:return"running";case ye.Starting:return"starting";case ye.StartFailed:return"startFailed";case ye.Stopping:return"stopping";case ye.Stopped:return"stopped";default:return"unknown"}}var WH=class extends BH.EventEmitter{constructor(){super(...arguments);this.registered=new Map;this.disposables=[]}init(){b.onDidOpenTextDocument(e=>{this.start(e)},null,this.disposables),b.onDidChangeConfiguration(e=>{e.affectsConfiguration("languageserver")&&this.createCustomServices()},null,this.disposables),this.createCustomServices()}dispose(){this.removeAllListeners(),z(this.disposables);for(let e of this.registered.values())e.dispose()}regist(e){let{id:t}=e;if(t||Ea.error("invalid service configuration. ",e.name),!this.registered.get(t))return this.registered.set(t,e),Ea.info(`registeredservice"${t}"`),this.shouldStart(e)&&e.start(),e.state==ye.Running&&this.emit("ready",t),e.onServiceReady(()=>{Ea.info(`service${t}started`),this.emit("ready",t)},null,this.disposables),Ru.Disposable.create(()=>{e.stop(),e.dispose(),this.registered.delete(t)})}getService(e){let t=this.registered.get(e);return t||(t=this.registered.get(`languageserver.${e}`)),t}shouldStart(e){if(e.state!=ye.Initial)return!1;let t=e.selector;for(let i of b.documents)if(b.match(t,i.textDocument))return!0;return!1}start(e){let t=this.getServices(e);for(let i of t)i.state==ye.Initial&&i.start()}getServices(e){let t=[];for(let i of this.registered.values())b.match(i.selector,e)>0&&t.push(i);return t}stop(e){let t=this.registered.get(e);if(!t){C.showMessage(`Service${e}notfound`,"error");return}return Promise.resolve(t.stop())}stopAll(){for(let e of this.registered.values())e.stop()}async toggle(e){let t=this.registered.get(e);if(!t){C.showMessage(`Service${e}notfound`,"error");return}let{state:i}=t;try{i==ye.Running?await Promise.resolve(t.stop()):i==ye.Initial?await t.start():i==ye.Stopped&&await t.restart()}catch(n){C.showMessage(`Serviceerror:${n.message}`,"error")}}getServiceStats(){let e=[];for(let[t,i]of this.registered)e.push({id:t,languageIds:dye(i.selector),state:pye(i.state)});return e}createCustomServices(){let e=b.getConfiguration().get("languageserver",{});for(let t of Object.keys(e)){let i=e[t];this.registLanguageClient(t,i)}}waitClient(e){let t=this.getService(e);return t&&t.state==ye.Running?Promise.resolve():t?new Promise(i=>{t.onServiceReady(()=>{i()})}):new Promise(i=>{let n=o=>{(o==e||o==`languageserver.${e}`)&&(this.off("ready",n),i())};this.on("ready",n)})}async registNotification(e,t){await this.waitClient(e);let i=this.getService(e);if(!i.client){C.showMessage(`Notalanguageclient:${e}`,"error");return}i.client.onNotification(t,async o=>{await b.nvim.call("coc#do_notify",[e,t,o])})}async sendNotification(e,t,i){if(!t)throw new Error("method required for ontification");let n=this.getService(e);if(!n||!n.client)throw new Error(`Languageserver${e}notfound`);if(n.state==ye.Starting&&await n.client.onReady(),n.state!=ye.Running)throw new Error(`Languageserver${e}notrunning`);await Promise.resolve(n.client.sendNotification(t,i))}async sendRequest(e,t,i,n){if(!t)throw new Error("method required for sendRequest");let o=this.getService(e);if(o||await He(100),o=this.getService(e),!o||!o.client)throw new Error(`Languageserver${e}notfound`);if(o.stat
${l.stack}`),s()})}));for(let s of i){let a=s.split(":"),l=a[0];if(l=="onLanguage"){if(b.filetypes.has(a[1])){await o();return}b.onDidOpenTextDocument(u=>{u.languageId==a[1]&&o()},null,n)}else if(l=="onCommand")me.onCommandList.push(a[1]),A.on("Command",async u=>{u==a[1]&&(await o(),await He(500))},null,n);else if(l=="workspaceContains"){let u=async()=>{let f=b.workspaceFolders.map(p=>$.parse(p.uri).fsPath);for(let p of f)if(Bo(p,a[1].split(/\s+/)))return await o(),!0};if(await u())return;b.onDidChangeWorkspaceFolders(u,null,n)}else if(l=="onFileSystem"){for(let u of b.documents)if($.parse(u.uri).scheme==a[1]){await o();return}b.onDidOpenTextDocument(u=>{$.parse(u.uri).scheme==a[1]&&o()},null,n)}else C.showMessage(`Unsupportedevent${s}of${e}`,"error")}}createExtension(e,t,i){let n=t.name,o=!1,s=null,a=Fe.default.join(e,t.main||"index.js"),l,u=[],c={activate:async()=>{if(o)return s;let p={subscriptions:u,extensionPath:e,globalState:this.memos.createMemento(`${n}|global`),workspaceState:this.memos.createMemento(`${n}|${b.rootPath}`),asAbsolutePath:d=>Fe.default.join(e,d),storagePath:Fe.default.join(this.root,`${n}-data`),logger:Xz(n)};if(o=!0,!l)try{let d=!(t.engines||{}).hasOwnProperty("coc");l=Gz(n,a,d)}catch(d){Sr.error(`ErroroncreateExtension${n}from${a}`,d);return}try{s=await Promise.resolve(l.activate(p)),Sr.debug("activate:",n)}catch(d){o=!1,Sr.error(`Erroronactiveextension${n}:${d.stack}`,d)}return s}};Object.defineProperties(c,{id:{get:()=>n,enumerable:!0},packageJSON:{get:()=>t,enumerable:!0},extensionPath:{get:()=>e,enumerable:!0},isActive:{get:()=>o,enumerable:!0},exports:{get:()=>s,enumerable:!0}}),this.extensions.set(n,{id:n,type:i,isLocal:i==Jr.Local,extension:c,directory:e,filepath:a,deactivate:()=>{if(!!o&&(o=!1,z(u),u.splice(0,u.length),u=[],l&&l.deactivate))try{return Promise.resolve(l.deactivate()).catch(p=>{Sr.error(`Erroron${n}deactivate:`,p)})}catch(p){Sr.error(`Erroron${n}deactivate:`,p)}}});let{contributes:f}=t;if(f){let{configuration:p,rootPatterns:d,commands:h}=f;if(p&&p.properties){let{properties:m}=p,y={};for(let v of Object.keys(m)){let x=m[v].default;x!=null&&(y[v]=x)}b.configurations.extendsDefaults(y)}if(d&&d.length)for(let m of d)b.addRootPattern(m.filetype,m.patterns);if(h&&h.length)for(let m of h)me.titles.set(m.command,m.title)}this._onDidLoadExtension.fire(c),this.activated&&this.setupActiveEvents(n,t).logError()}filterGlobalExtensions(e){e=e.map(s=>s.replace(/@.*$/,""));let t=e.filter(s=>!this.disabled.has(s));t=t.filter(s=>!this.extensions.has(s));let i=this.loadJson(),n=[],o=[];if(i&&i.dependencies)for(let s of Object.keys(i.dependencies)){let a=i.dependencies[s];typeof a=="string"&&st.default.existsSync(Fe.default.join(this.modulesFolder,s,"package.json"))&&(o.push(s),/^https?:/.test(a)&&n.push(a))}return t=t.filter(s=>/^https?:/.test(s)?!n.some(a=>a.startsWith(s)):!o.includes(s)),t}get modulesFolder(){return Fe.default.join(this.root,global.hasOwnProperty("__TEST__")?"":"node_modules")}canActivate(e){return!this.disabled.has(e)&&this.extensions.has(e)}async unloadExtension(e){this.extensions.get(e)&&(await this.deactivate(e),this.extensions.delete(e),this._onDidUnloadExtension.fire(e))}checkDirectory(e){try{let t=Fe.default.join(e,"package.json");if(!st.default.existsSync(t))throw new Error("package.json not found");let i=JSON.parse(st.default.readFileSync(t,"utf8")),{name:n,engines:o,main:s}=i;if(!n||!o)throw new Error("can't find name & engines in package.json");if(!o||!wt(o))throw new Error(`invalidenginesin${t}`);if(s&&!st.default.existsSync(Fe.default.join(e,s)))throw new Error(`mainfile${s}notfound,youmayneedtobuildtheproject.`);let a=Object.keys(o);if(!a.includes("coc")&&!a.includes("vscode"))throw new Error("Engines in package.json doesn't have coc or vscode");if(a.includes("coc")){let l=o.coc.replace(/^\^/,">=");if(!Jz.default.satisfies(b.version,l))throw new Error(`Pleaseupdatecoc.nvim,${i.name}requirescoc.nvim${o.coc}`)}return!0}catch(t){return t}}dispose(){z(this.disposables)}},ge=new Zz;var K4e=j()("model-source"),OC=class{c
`)&&Me(t.start,t.end)==0&&Me(this.range.start,t.start)==0&&this._placeholders.findIndex(s=>Me(s.range.start,t.start)==0)!==-1)return!1;let n=gD(this.range.start,e);return n.line==0&&n.character==0||this.adjustPosition(n.character,n.line),!0}get isPlainText(){return this._placeholders.length>1?!1:this._placeholders.every(e=>e.value=="")}get finalCount(){return this._placeholders.filter(e=>e.isFinalTabstop).length}toString(){return this.tmSnippet.toString()}get range(){let{position:e}=this,t=this.tmSnippet.toString(),n=kt.create("untitled:/1","snippet",0,t).positionAt(t.length),o=n.line==0?e.character+n.character:n.character;return oo.Range.create(e,oo.Position.create(e.line+n.line,o))}get firstPlaceholder(){let e=0;for(let t of this._placeholders)t.index!=0&&(e==0||t.index<e)&&(e=t.index);return this.getPlaceholder(e)}get lastPlaceholder(){let e=0;for(let t of this._placeholders)(e==0||t.index>e)&&(e=t.index);return this.getPlaceholder(e)}getPlaceholderById(e){return this._placeholders.find(t=>t.id==e)}getPlaceholder(e){let t=this._placeholders.filter(n=>n.index==e),i=t.filter(n=>!n.transform);return i.length?i[0]:t[0]}getPrevPlaceholder(e){if(e==0)return this.lastPlaceholder;let t=this.getPlaceholder(e-1);return t||this.getPrevPlaceholder(e-1)}getNextPlaceholder(e){let t=this._placeholders.map(o=>o.index),i=Math.max.apply(null,t);if(e>=i)return this.finalPlaceholder;let n=this.getPlaceholder(e+1);return n||this.getNextPlaceholder(e+1)}get finalPlaceholder(){return this._placeholders.find(e=>e.isFinalTabstop)}getPlaceholderByRange(e){return this._placeholders.find(t=>Ji(e,t.range))}insertSnippet(e,t,i){let{start:n}=e.range,o=oo.Position.create(i.start.line-n.line,i.start.line==n.line?i.start.character-n.character:i.start.character),s=oo.Position.create(i.end.line-n.line,i.end.line==n.line?i.end.character-n.character:i.end.character),a=oo.Range.create(o,s),l=this.tmSnippet.insertSnippet(t,e.id,a);return this.update(),l}updatePlaceholder(e,t){let{start:i,end:n}=t.range,{range:o}=this,{value:s,id:a,index:l}=e,u=jB(e.range,s,t),c=0;if(!u.includes(`
`),o=n.length-(t.end.line-t.start.line+1);if(this.line=this.line+o,t.end.line==this.line){let s=t.start.line==t.end.line?t.end.character-t.start.character:t.end.character;n.length>1&&t.start.line==t.end.line&&(s=s+t.start.character);let a=0;n.length>1?a=n[n.length-1].length:t.start.line==t.end.line?a=i.length:a=t.start.character+i.length;let l=a-s;for(let u of["start","end","currStart","currEnd"])this[u]+=l}}sync(){this.start=this.currStart,this.end=this.currEnd}get textEdit(){return{range:this.range,newText:this.text}}},WC=UC;var rd=S(W());function HC(r,e){let t=[];for(let i=e.start.line;i<=e.end.line;i++){let n=r.getline(i)||"",o=i==e.start.line?e.start.character:0,s=i==e.end.line?e.end.character:n.length;o!=s&&t.push(rd.Range.create(i,o,i,s))}return t}function S9(r,e){let{start:t,end:i}=e;t.line>i.line&&([t,i]=[i,t]);let n=t.character<i.character?t.character:i.character,o=t.character<i.character?i.character:t.character,s=[];for(let a=t.line;a<=i.line;a++){let l=r.getline(a);s.push(rd.Range.create(a,n,a,Math.min(l.length,o)))}return s}function zC(r,e){let{line:t,character:i}=e;return rd.Position.create(r.line+t,t==0?r.character+i:i)}function E9(r,e){if(r.newText.length!=e.newText.length)return!1;let{range:t}=r;return t.end.character-t.start.character==e.range.end.character-e.range.start.character}var a9e=j()("cursors-session"),GC=class{constructor(e,t,i){this.nvim=e;this.doc=t;this.config=i;this._onDidCancel=new qu.Emitter;this.onDidCancel=this._onDidCancel.event;this.disposables=[];this.ranges=[];this.activated=!0;this.changing=!1;this.changed=!1;this.doc.forceSync(),this.textDocument=this.doc.textDocument,this.buffer.setVar("coc_cursors_activated",1,!0);let{cancelKey:n,nextKey:o,previousKey:s}=this.config;this.disposables.push(b.registerLocalKeymap("n",n,()=>{this.cancel()},!0)),this.disposables.push(b.registerLocalKeymap("n",o,async()=>{if(!this.activated)return;let a=this.ranges.map(u=>u.currRange),l=await C.getCursorPosition();for(let u of a)if(Me(u.start,l)>0){await C.moveTo(u.start);return}a.length&&await C.moveTo(a[0].start)},!0)),this.disposables.push(b.registerLocalKeymap("n",s,async()=>{if(!this.activated)return;let a=this.ranges.map(u=>u.currRange);a.reverse();let l=await C.getCursorPosition();for(let u of a)if(Me(u.end,l)<0){await C.moveTo(u.start);return}a.length&&await C.moveTo(a[a.length-1].start)},!0)),this.doc.onDocumentChange(this.onChange,this,this.disposables)}async onChange(e){if(!this.activated||this.ranges.length==0||this.changing)return;let t=e.contentChanges[0],{text:i,range:n}=t,o=this.ranges.some(l=>ql(n,l.currRange)),s=this.ranges[0].currRange.start;if(i.endsWith(`
`)&&Me(s,n.end)==0&&(o=!1),!o){this.ranges.forEach(l=>{l.adjustFromEdit({range:n,newText:i})}),this.doHighlights(),this.textDocument=this.doc.textDocument;return}this.changed=!0;let a=this.getTextRange(n,i);a?await this.applySingleEdit(a,{range:n,newText:i}):(this.applyComposedEdit(e.original,{range:n,newText:i}),this.activated&&(this.ranges.forEach(l=>{l.sync()}),this.textDocument=this.doc.textDocument))}doHighlights(){let{nvim:e,buffer:t,ranges:i}=this;t.clearNamespace("cursors");let n=i.map(o=>o.currRange);t.highlightRanges("cursors","CocCursorRange",n),e.command("redraw",!0)}addRanges(e){let{nvim:t,doc:i}=this;if(this.changed)return C.showMessage("Can't add ranges after range change."),!1;this.ranges=this.ranges.filter(a=>{let{currRange:l}=a;return!e.some(u=>Mm(u,l))});let{textDocument:n}=i;for(let a of e){let{line:l}=a.start,u=new WC(l,a.start.character,a.end.character,n.getText(a),0);this.ranges.push(u)}this.ranges.sort((a,l)=>Me(a.range.start,l.range.start));let o=0,s=-1;for(let a of this.ranges){let{line:l}=a;l!=s&&(o=0),a.preCount=o,o=o+1,s=l}return t.pauseNotification(),this.doHighlights(),t.resumeNotification(!1,!0),!0}cancel(){if(!this.activated)return;let{nvim:e}=this;this.activated=!1;let{cancelKey:t,nextKey:i,previousKey:n}=this.config;e.pauseNotification(),this.buffer.clearNamespace("cursors"),this.buffer.setVar("coc_cursors_activated",0,!0),e.command("redraw",!0),e.resumeNotification(!1,!0),this._onDidCancel.fire()}dispose(){if(!!this.doc){this._onDidCancel.dispose();for(let e of this.disposables)e.dispose();this.ranges=[],this.doc=null,this.textDocument=null}}get buffer(){return this.nvim.createBuffer(this.doc.bufnr)}getTextRange(e,t){let{ranges:i}=this;if(t.indexOf(`
`)!==-1||e.start.line!=e.end.line)return null;i.sort((n,o)=>n.line!=o.line?n.line-o.line:n.currRange.start.character-o.currRange.start.character);for(let n=0;n<i.length;n++){let o=i[n];if(Ji(e,o.currRange))return o;if(o.line==e.start.line&&t.length&&e.start.character==o.currRange.end.character){let s=i[n+1];return s&&Wt(s.currRange.start,e)?null:o}}return null}adjustRanges(e,t,i){let{ranges:n}=this;if(t.start.character==t.end.character)if(e.currRange.end.character==t.start.character)n.forEach(s=>{s.add(s.text.length,i)});else{let s=t.start.character-e.currRange.start.character;n.forEach(a=>{a.add(Math.min(a.text.length,s),i)})}else{let o=t.end.character-t.start.character;if(e.currRange.end.character==t.end.character)if(e.currRange.start.character==t.start.character)if(i.includes(e.text)){let a=i.indexOf(e.text),l=a==0?"":i.slice(0,a),u=i.slice(a+e.text.length);l&&n.forEach(c=>c.add(0,l)),u&&n.forEach(c=>c.add(c.text.length,u))}else if(e.text.includes(i)){let a=e.text.indexOf(i),l=e.text.length-(a+i.length);a!=0&&n.forEach(u=>u.replace(0,a)),l>0&&n.forEach(u=>u.replace(u.text.length-l,u.text.length))}else this.cancel();else n.forEach(a=>{let l=a.text.length;a.replace(Math.max(0,l-o),l,i)});else{let a=t.start.character-e.currRange.start.character;n.forEach(l=>{let u=l.text.length;l.replace(a,Math.min(a+o,u),i)})}}}addRange(e,t){if(this.changed){C.showMessage("Can't add range after range change.");return}let{ranges:i}=this,n=i.findIndex(o=>ql(o.range,e));if(n!==-1){i.splice(n,1);for(let o of i)o.line==e.start.line&&o.start>e.start.character&&(o.preCount=o.preCount-1)}else{let o=0,s=0,{line:a}=e.start;for(let u of i){if(u.line>a||u.line==a&&u.start>e.end.character)break;u.line==a&&o++,s++}let l=new WC(a,e.start.character,e.end.character,t,o);i.splice(s,0,l);for(let u of i)u.line==e.start.line&&u.start>e.start.character&&(u.preCount=u.preCount+1)}this.ranges.length==0?this.cancel():this.doHighlights()}async applySingleEdit(e,t){let{range:i,newText:n}=t,{doc:o}=this;if(this.adjustRanges(e,i,n),this.ranges.length==1){this.doHighlights();return}let s=this.ranges.map(d=>d.textEdit),l=kt.applyEdits(this.textDocument,s).split(`
`),u=new Set,c=[];for(let d of this.ranges)u.has(d.line)||(u.add(d.line),c.push([d.line,l[d.line]]));let{nvim:f}=this;this.changing=!0,await o.changeLines(c),this.changing=!1,this.activated&&(this.ranges.forEach(d=>{d.sync()}),this.textDocument=this.doc.textDocument),f.pauseNotification();let{cursor:p}=A;if(e.preCount>0&&p.bufnr==o.bufnr&&e.line+1==p.lnum){let d=e.preCount*(n.length-(i.end.character-i.start.character));f.call("cursor",[p.lnum,p.col+d],!0)}this.doHighlights(),f.resumeNotification(!1,!0)}applyComposedEdit(e,t){let{range:i,newText:n}=t,{ranges:o}=this,s=kt.create("file:///1","",0,e),a=[],l=Nu.default(e,n),u=0;for(let c=0;c<l.length;c++){let f=l[c],p=zC(i.start,s.positionAt(u));if(f[0]==Nu.default.EQUAL)u=u+f[1].length;else if(f[0]==Nu.default.DELETE){let d=zC(i.start,s.positionAt(u+f[1].length));l[c+1]&&l[c+1][0]==Nu.default.INSERT?(a.push({range:qu.Range.create(p,d),newText:l[c+1][1]}),c=c+1):a.push({range:qu.Range.create(p,d),newText:""}),u=u+f[1].length}else f[0]==Nu.default.INSERT&&a.push({range:qu.Range.create(p,p),newText:f[1]})}if(a.some(c=>c.newText.includes(`
`)||c.range.start.line!=c.range.end.line)){this.cancel();return}if(a.length==o.length){let c;for(let f=0;f<a.length;f++){let p=a[f],d=this.ranges[f];if(!ql(d.currRange,p.range)){this.cancel();return}if(c&&!E9(p,c)){this.cancel();return}d.applyEdit(p),c=p}}else if(a.length==o.length*2)for(let c=0;c<a.length-1;c=c+2){let f=a[c],p=a[c+1];if(f.newText.length==0&&p.newText.length==0){let d=this.ranges[c/2];if(Me(d.currRange.end,p.range.end)!=0){this.cancel();return}let h=f.range.start.character-d.currRange.start.character;d.replace(h,f.range.end.character-f.range.start.character,"");let m=p.range.end.character-p.range.start.character,y=d.text.length;d.replace(y-m,y)}else if(Gn(f.range)&&Gn(p.range)){let d=this.ranges[c/2];if(Me(d.currRange.end,p.range.start)!=0){this.cancel();return}let h=f.range.start.character-d.currRange.start.character;d.add(h,f.newText);let m=d.text.length;d.add(m,p.newText)}else{this.cancel();return}}else{this.cancel();return}this.doHighlights()}},C9=GC;var m9e=j()("cursors"),VC=class{constructor(e){this.nvim=e;this.sessionsMap=new Map;this.disposables=[];this.loadConfig(),b.onDidChangeConfiguration(t=>{t.affectsConfiguration("cursors")&&this.loadConfig()},null,this.disposables),A.on("BufUnload",t=>{let i=this.getSession(t);!i||(i.dispose(),this.sessionsMap.delete(t))},null,this.disposables)}loadConfig(){let e=b.getConfiguration("cursors");this.config={nextKey:e.get("nextKey","<C-n>"),previousKey:e.get("previousKey","<C-p>"),cancelKey:e.get("cancelKey","<esc>")}}getSession(e){return this.sessionsMap.get(e)}async isActivated(){let e=await this.nvim.call("bufnr",["%"]);return this.sessionsMap.get(e)!=null}async select(e,t,i){let n=b.getDocument(e);if(!n||!n.attached){C.showMessage(`buffer${e}notattached.`);return}let{nvim:o}=this,s=this.createSession(n),a=await C.getCursorPosition(),l;if(t=="operator"){await o.command(`normal!${i=="line"?"'[":"`["}`);let u=await C.getCursorPosition();await o.command(`normal!${i=="line"?"']":"`]"}`);let c=await C.getCursorPosition();await C.moveTo(a);let f=Me(u,c);if(f==0)return;f>=0&&([u,c]=[c,u]);let p=n.getline(c.line);c.character<p.length&&(c.character=c.character+1);let d=HC(n,$u.Range.create(u,c));for(let h of d){let m=n.textDocument.getText(h);s.addRange(h,m)}}else if(t=="word"){if(l=n.getWordRangeAtPosition(a),!l){let f=n.getline(a.line);a.character==f.length?l=$u.Range.create(a.line,Math.max(0,f.length-1),a.line,f.length):l=$u.Range.create(a.line,a.character,a.line,a.character+1)}let c=n.getline(a.line).slice(l.start.character,l.end.character);s.addRange(l,c)}else if(t=="position"){let u=n.getline(a.line);a.character>=u.length?l=$u.Range.create(a.line,u.length-1,a.line,u.length):l=$u.Range.create(a.line,a.character,a.line,a.character+1),s.addRange(l,u.slice(l.start.character,l.end.character))}else if(t=="range"){await o.call("eval",'feedkeys("\\<esc>", "in")');let u=await b.getSelectedRange(i,n);if(!u||Me(u.start,u.end)==0)return;let c=i==""?S9(n,u):HC(n,u);for(let f of c){let p=n.textDocument.getText(f);s.addRange(f,p)}}else{C.showMessage(`${t}notsupported`,"error");return}(t=="word"||t=="position")&&await o.command(`silent!callrepeat#set("\\<Plug>(coc-cursors-${t})",-1)`)}createSession(e){let t=this.getSession(e.bufnr);return t||(t=new C9(this.nvim,e,this.config),this.sessionsMap.set(e.bufnr,t),t.onDidCancel(()=>{t.dispose(),this.sessionsMap.delete(e.bufnr)}),t)}async addRanges(e){let{nvim:t}=this,i=await t.call("bufnr",["%"]),n=b.getDocument(i);return!n||!n.attached?(C.showMessage("Document not attached","error"),!1):this.createSession(n).addRanges(e)}reset(){for(let e of this.sessionsMap.values())e.cancel();this.sessionsMap.clear()}dispose(){for(let e of this.sessionsMap.values())e.dispose();this.sessionsMap.clear();for(let e of this.disposables)e.dispose()}},_9=VC;var Ue=S(W());var KC=S(Gr()),JC=S(W());var ube=j()("codelens-buffer"),YC=class{constructor(e,t,i){this.nvim=e;this.bufnr=t;this.config=i;this._disposed=!1;this.fetchCodelenses=KC.default(()=>{this._fetchCodeLenses().logError()},global.hasOwnProperty("__TEST__")?10:100),this.resolveCodeLe
`+n+"\n```"),r.push({content:n,filetype:t}))}async function mt(r){let{changedtick:e}=r;await r.patchChange(),e!=r.changedtick&&await He(50)}function yd(r){let e=vd(r);return`${xP(e.red.toString(16))}${xP(e.green.toString(16))}${xP(e.blue.toString(16))}`}function xP(r){return r.length==1?`0${r}`:r}function vd(r){let{red:e,green:t,blue:i}=r;return{red:Math.round(e*255),green:Math.round(t*255),blue:Math.round(i*255)}}function HK(r){let e=[r.red,r.green,r.blue],t=[];for(let n=0;n<e.length;n++){let o=e[n];t[n]=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4)}return .2126*t[0]+.7152*t[1]+.0722*t[2]<=.5}var zK=S(Gr()),GK=S(W());var VK=j()("colors-buffer"),DP=class{constructor(e,t,i,n){this.nvim=e;this.bufnr=t;this.enabled=i;this.usedColors=n;this._colors=[];this.highlight=zK.default(()=>{this.doHighlight().catch(o=>{VK.error("Erroroncolorhighlight:",o.stack)})},global.hasOwnProperty("__TEST__")?10:500)}onChange(){this.cancel(),this.highlight()}get buffer(){return this.nvim.createBuffer(this.bufnr)}get colors(){return this._colors}hasColor(){return this._colors.length>0}setState(e){this.enabled=e,e?this.highlight():this.clearHighlight()}async doHighlight(){let e=b.getDocument(this.bufnr);if(!(!e||!this.enabled))try{this.tokenSource=new GK.CancellationTokenSource;let{token:t}=this.tokenSource;if(this.version&&e.version==this.version)return;let{version:i}=e,n;if(n=await U.provideDocumentColors(e.textDocument,t),n=n||[],t.isCancellationRequested)return;this.version=i,await this.addHighlight(n,t)}catch(t){VK.error("Erroronhighlight:",t)}}async addHighlight(e,t){if(e=e||[],Ne(this._colors,e))return;let{nvim:i}=this;this._colors=e;let n=oj(e,100);i.pauseNotification(),this.buffer.clearNamespace("color"),this.defineColors(e),i.resumeNotification(!1,!0);for(let o of n){if(t.isCancellationRequested){this._colors=[];return}i.pauseNotification();let s=this.getColorRanges(o);for(let a of s)this.highlightColor(a.ranges,a.color);i.resumeNotification(!1,!0)}b.isVim&&this.nvim.command("redraw",!0)}highlightColor(e,t){let{red:i,green:n,blue:o}=vd(t),s=`BG${yd(t)}`;this.buffer.highlightRanges("color",s,e)}defineColors(e){for(let t of e){let i=yd(t.color);this.usedColors.has(i)||(this.nvim.command(`hi BG${i} guibg=#${i} guifg=#${HK(t.color)?"ffffff":"000000"}`,!0),this.usedColors.add(i))}}getColorRanges(e){let t=[];for(let i of e){let{color:n,range:o}=i,s=t.findIndex(a=>Ne(vd(a.color),vd(n)));s==-1?t.push({color:n,ranges:[o]}):t[s].ranges.push(o)}return t}clearHighlight(){this.highlight.clear(),this._colors=[],this.version=null,this.buffer.clearNamespace("color")}hasColorAtPostion(e){let{colors:t}=this;return t.some(i=>Wt(e,i.range)==0)}cancel(){this.tokenSource&&(this.tokenSource.cancel(),this.tokenSource=null)}dispose(){this.highlight.clear(),this.cancel()}},KK=DP;var AGe=j()("colors"),SP=class{constructor(e){this.nvim=e;this._enabled=!0;this.disposables=[];let t=b.getConfiguration("coc.preferences");this._enabled=t.get("colorSupport",!0),b.isVim&&!b.env.textprop&&(this._enabled=!1);let i=new Set;this.highlighters=b.registerBufferSync(n=>{let o=new KK(this.nvim,n.bufnr,this._enabled,i);return o.highlight(),o}),ge.onDidActiveExtension(()=>{this.highlightAll()},null,this.disposables),b.onDidChangeConfiguration(async n=>{if(!(b.isVim&&!b.env.textprop)&&n.affectsConfiguration("coc.preferences.colorSupport")){let s=b.getConfiguration("coc.preferences").get("colorSupport",!0);if(s!=this._enabled){this._enabled=s;for(let a of this.highlighters.items)a.setState(s)}}},null,this.disposables)}async pickPresentation(){let e=await this.currentColorInfomation();if(!e)return C.showMessage("Colornotfoundatcurrentposition","warning");let t=await b.document,i=new JK.CancellationTokenSource,n=await U.provideColorPresentations(e,t.textDocument,i.token);if(!n||n.length==0)return;let o=await C.showMenuPicker(n.map(c=>c.label),"choosecolor:");if(o==-1)return;lets=n[o],{textEdit:a,additionalTextEdits:l,label:u}=s;a||(a={range:e.range,newText:u}),awaitt.applyEdits([a]),l&&awaitt.applyEdits(l)}asyncpickColor(){lete=awaitthis.currentColorInfomation();if(!e
`).length-1;E!=0&&f.push({delta:E,lnum:w.line+d})}}}else f=[{delta:c,lnum:a.start.line}];let p=!1;for(let d of n)for(let h of d.ranges){let m=f.filter(y=>y.lnum<h.lnum-1);if(m.length){let y=m.reduce((v,x)=>v+x.delta,0);h.lnum=h.lnum+y,p=!0}}!p||(i.pauseNotification(),this.highlightLineNr(),i.resumeNotification().then(d=>{Array.isArray(d)&&d[1]!=null&&lJ.error("Error on highlightLineNr:",d[1])}).logError())}async onDocumentChange(e){if(e.bufnr==this.bufnr||this.changing)return;let{uri:t}=e.textDocument,{range:i,text:n}=e.contentChanges[0],o=$.parse(t).fsPath,s=this._fileItems.find(u=>u.filepath==o);if(!s)return;let a=n.split(`
`})):(s.ranges.splice(u,1),l.push({range:this.getFileRangeRange(c,!1),newText:""}))}}this._fileItems=this._fileItems.filter(u=>u.ranges&&u.ranges.length>0),l.length&&(this.changing=!0,await this.document.applyEdits(l),this.changing=!1),this.nvim.pauseNotification(),this.highlightLineNr(),this.buffer.setOption("modified",!1,!0),await this.nvim.resumeNotification()}async getFileChanges(){if(this._disposed)return[];let e=[],t=await this.buffer.lines;t.push(Ju);let i=[],n,o;for(let s=0;s<t.length;s++){let a=t[s];if(a.startsWith(Ju)){if(n&&(e.push({filepath:n,lines:i.slice(),lnum:o}),n=void 0,i=[]),a.length>1){let l=a.match(/^\u3000(.*)/);l&&(n=this.getAbsolutePath(l[1].replace(/\s+$/,"")),o=s+1,i=[])}}else i.push(a)}return e}async splitOpen(){let{nvim:e}=this,i=await e.createWindow(this.opts.fromWinid).valid,n=await e.eval('getline(1,line("."))'),o=n.length;for(let s=0;s<o;s++){let l=n[o-s-1].match(/^\u3000(.+)/);if(l){let u=l[1].trim(),c=this.getLinesRange(o-s);if(!c)return;let f=c[0]+s-1,p=this.getAbsolutePath(u);e.pauseNotification(),i?(e.call("win_gotoid",[this.opts.fromWinid],!0),this.nvim.call("coc#util#jump",["edit",p,[f,1]],!0)):this.nvim.call("coc#util#jump",["belowright vs",p,[f,1]],!0),e.command("normal! zz",!0);let[,d]=await e.resumeNotification();d&&C.showMessage(`Erroronopen${u}:${d}`,"error"),i||(this.opts.fromWinid=await e.call("win_getid"));break}}}async addFileItems(e){if(this._disposed)return;let{cwd:t}=this.opts,{document:i}=this,n=await this.mutex.acquire();try{i.dirty&&i.forceSync();for(let f of e){let p=this._fileItems.find(d=>d.filepath==f.filepath);p?p.ranges.push(...f.ranges):this._fileItems.push(f)}let o=i.lineCount,s=new ss,a=[];for(let f of e)for(let p of f.ranges){s.addLine(Ju),s.addLine(Ju),p.lnum=o+s.length,s.addText(`${Ye(t,f.filepath)?wd.default.relative(t,f.filepath):f.filepath}`);let d=String(p.start+1).length+String(p.end).length+4;this.srcId||s.addText(" ".repeat(d));let h=0-s.length-o;p.highlights&&a.push(...p.highlights.map(y=>Q0e(y,h)));let{lines:m}=p;m||(m=await this.getLines(f.filepath,p.start,p.end),p.lines=m),s.addLines(m)}let{nvim:l,buffer:u}=this;if(this.changing=!0,l.pauseNotification(),s.render(u,o),this.highlightLineNr(),u.setOption("modified",!1,!0),u.setOption("undolevels",1e3,!0),o==2&&a.length){let f=a[0].start;l.call("coc#util#jumpTo",[f.line,f.character],!0)}b.isVim&&l.command("redraw",!0);let[,c]=await l.resumeNotification();if(c)throw new Error(c[2]);await i.patchChange(),this.changing=!1,await me.executeCommand("editor.action.addRanges",a)}catch(o){this.changing=!1,lJ.error("Error on add file item:",o)}n()}async save(){let{nvim:e}=this,t=this.document,{buffer:i}=t;await t.patchChange();let n=await this.getFileChanges();if(!n)return;n.sort((l,u)=>l.lnum-u.lnum);let o=[],s=new Map;for(let l=0;l<n.length;l++){let u=n[l],{filepath:c,lnum:f}=u,p=s.get(c)||0,d=this._fileItems.find(m=>m.filepath==c),h=d?d.ranges.find(m=>m.lnum==f):null;if(!h||Ne(h.lines,u.lines)){o.push(l),p&&h&&(h.start=h.start+p,h.end=h.end+p);continue}if(u.start=h.start,u.end=h.end,p!=0&&(h.start=h.start+p),u.lines.length!=h.lines.length){let y=u.lines.length-h.lines.length+p;s.set(c,y),h.end=h.end+y}else h.end=h.end+p;h.lines=u.lines}if(o.length&&(n=n.filter((l,u)=>!o.includes(u))),n.length==0)return C.showMessage("No change.","more"),await i.setOption("modified",!1),!1;let a={};for(let l of n){let u=$.file(l.filepath).toString(),c=a[u]||[];c.push({range:Ey.Range.create(l.start,0,l.end,0),newText:l.lines.join(`
`)+`
`}),a[u]=c}return this.changing=!0,await b.applyEdit({changes:a}),this.changing=!1,e.pauseNotification(),i.setOption("modified",!1,!0),this.config.saveToFile&&e.command("silent noa wa",!0),this.highlightLineNr(),await e.resumeNotification(),!0}getFileRange(e){for(let t of this._fileItems)for(let i of t.ranges)if(i.lnum==e)return i;return null}getLinesRange(e){for(let t of this._fileItems)for(let i of t.ranges)if(i.lnum==e)return[i.start,i.end];return null}async getLines(e,t,i){let n=$.file(e).toString(),o=b.getDocument(n);return o?o.getLines(t,i):await Y3(e,t,i-1)}getAbsolutePath(e){return wd.default.isAbsolute(e)?e:wd.default.join(this.opts.cwd,e)}getFileRangeRange(e,t=!0){let{document:i}=this;if(!i)return null;let{lnum:n}=e;if(!i.getline(n-1).startsWith("\u3000"))return null;let s=t?n:n-1,a=i.lineCount;for(let l=n;l<i.lineCount;l++)if(i.getline(l).startsWith("\u3000")){a=t?l:l+1;break}return Ey.Range.create(s,0,a,0)}highlightLineNr(){let{_fileItems:e,nvim:t,srcId:i,bufnr:n}=this,{winid:o,cwd:s}=this.opts,a={};if(i){t.call("nvim_buf_clear_namespace",[n,i,0,-1],!0);for(let l of e)for(let u of l.ranges){let c=`${u.start+1}:${u.end}`;a[u.lnum]=[u.start+1,u.end],t.call("nvim_buf_set_virtual_text",[n,i,u.lnum-1,[[c,"LineNr"]],{}],!0)}}else{this.matchIds.size&&(t.call("coc#highlight#clear_matches",[o,Array.from(this.matchIds)],!0),this.matchIds.clear());let l=2e3;for(let u of e){let c=`${s?wd.default.relative(s,u.filepath):u.filepath}`,f=ue(c)+1;for(let p of u.ranges){let d=`:${p.start+1}:${p.end}`;for(let h=0;h<d.length;h++){let m=d[h];this.matchIds.add(l),a[p.lnum]=[p.start+1,p.end],t.call("matchaddpos",["Conceal",[[p.lnum,f+h]],99,l,{conceal:m,window:o}],!0),l++}}}}this.buffer.setVar("line_infos",a,!0)}get valid(){return this.buffer.valid}get buffer(){return this.nvim.createBuffer(this.bufnr)}get document(){return this._disposed?null:b.getDocument(this.bufnr)}dispose(){this._disposed=!0,z(this.disposables)}},uJ=TP;function Q0e(r,e){let{start:t,end:i}=r;return Ey.Range.create(t.line-e,t.character,i.line-e,i.character)}var eSe=j()("handler-refactor"),tSe="__coc_refactor__",rSe=0;var RP=class{constructor(){this.buffers=new Map;this.disposables=[];this._onCreate=new Yu.Emitter;this.onCreate=this._onCreate.event;this.nvim=b.nvim,b.isNvim&&this.nvim.hasFunction("nvim_buf_set_virtual_text")&&(this.srcId=b.createNameSpace("coc-refactor")),this.setConfiguration(),b.onDidChangeConfiguration(this.setConfiguration,this,this.disposables),b.onDidCloseTextDocument(e=>{this.buffers.get(e.bufnr)&&this.buffers.delete(e.bufnr)},null,this.disposables),b.onDidChangeTextDocument(e=>{let t=this.buffers.get(e.bufnr);t&&t.onChange(e)},null,this.disposables)}setConfiguration(e){if(e&&!e.affectsConfiguration("refactor"))return;let t=b.getConfiguration("refactor");this.config=Object.assign(this.config||{},{afterContext:t.get("afterContext",3),beforeContext:t.get("beforeContext",3),openCommand:t.get("openCommand","edit"),saveToFile:t.get("saveToFile",!0)})}getBuffer(e){return this.buffers.get(e)}async search(e){let t=await this.createRefactorBuffer();if(!t)return;let i=await this.nvim.call("getcwd",[]);await new aJ(this.nvim).run(e,i,t)}async createRefactorBuffer(e){let{nvim:t}=this,[i,n]=await t.eval("[win_getid(),getcwd()]"),{openCommand:o}=this.config;t.pauseNotification(),t.command(`${o}${tSe}${rSe++}`,!0),t.command("setl buftype=acwrite nobuflisted bufhidden=wipe nofen wrap conceallevel=2 concealcursor=n",!0),t.command("setl undolevels=-1 nolist nospell noswapfile foldmethod=expr foldexpr=coc#util#refactor_foldlevel(v:lnum)",!0),t.command("setl foldtext=coc#util#refactor_fold_text(v:foldstart)",!0),t.call("setline",[1,["Save current buffer to make changes",Ju]],!0),t.call("matchadd",["Comment","\\%1l"],!0),t.call("matchadd",["Conceal","^\\%u3000"],!0),t.call("matchadd",["Label","^\\%u3000\\zs\\S\\+"],!0),t.command("setl nomod",!0),e&&t.command(`runtime!syntax/${e}.vim`,!0),t.call("coc#util#do_autocmd",["CocRefactorOpen"],!0);let[,s]=await t.resumeNotification();if(s){eSe.error(s),C.showMessage(`Erroronopenrefactorwindow:${s}`,"error");ret
`)||(s+=d.length),this.signaturePosition=an.Position.create(t.line,t.character-d.length)}else this.signaturePosition=t;let{preferAbove:c,maxWindowHeight:f,maxWindowWidth:p}=this.config;await this.signatureFactory.show(l,{maxWidth:p,maxHeight:f,preferTop:c,autoHide:!1,offsetX:s,modes:["i","ic","s"]})}echoSignature(e){var s;let{signatures:t,activeParameter:i}=e,n=b.env.columns;t=t.slice(0,b.env.cmdheight);let o=[];for(let a of t){let l=[],{label:u}=a;u=u.replace(/\n/g," "),u.length>=n-16&&(u=u.slice(0,n-16)+"...");let c=u.indexOf("(");if(c==-1)l=[{text:u,type:"Normal"}];else{l.push({text:u.slice(0,c),type:"Label"});let f=u.slice(c);if(o.length==0&&i!=null){let p=(s=a.parameters)==null?void 0:s[i];if(p){let d,h;if(typeof p.label=="string"){let m=f.slice(0),y=m.match(new RegExp("\\b"+p.label.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"\\b")),v=y?y.index:m.indexOf(p.label);v==-1?l.push({text:f,type:"Normal"}):(d=v,h=v+p.label.length)}else[d,h]=p.label,d=d-c,h=h-c;d!=null&&h!=null&&(l.push({text:f.slice(0,d),type:"Normal"}),l.push({text:f.slice(d,h),type:"MoreMsg"}),l.push({text:f.slice(h),type:"Normal"}))}}else l.push({text:f,type:"Normal"})}o.push(l)}this.nvim.callTimer("coc#util#echo_signatures",[o],!0)}dispose(){z(this.disposables),this.timer&&clearTimeout(this.timer),this.tokenSource&&(this.tokenSource.cancel(),this.tokenSource.dispose())}},dJ=kP;function pJ(r){return!!(an.MarkupContent.is(r)&&r.kind==an.MarkupKind.Markdown)}var hJ=S(Gr()),uo=S(W());var IP=class{constructor(e){this.nvim=e;this.disposables=[];this.buffers=b.registerBufferSync(t=>{if(t.buftype!="")return;let i=new mJ(t.bufnr);return i.onDidUpdate(async n=>{await A.fire("SymbolsUpdate",[i.bufnr,n])}),i}),A.on("CursorHold",async t=>{!this.functionUpdate||this.buffers.getItem(t)==null||await this.getCurrentFunctionSymbol(t)},null,this.disposables)}get functionUpdate(){return b.getConfiguration("coc.preferences").get("currentFunctionSymbolAutoUpdate",!1)}get labels(){return b.getConfiguration("suggest").get("completionItemKindLabels",{})}async getDocumentSymbols(e){let t=this.buffers.getItem(e);return t==null?void 0:t.getSymbols()}async getCurrentFunctionSymbol(e){e||(e=await this.nvim.call("bufnr",["%"]));let t=await C.getCursorPosition(),i=await this.getDocumentSymbols(e),n=this.nvim.createBuffer(e);if(!i||i.length===0)return n.setVar("coc_current_function","",!0),this.nvim.call("coc#util#do_autocmd",["CocStatusChange"],!0),"";i=i.filter(s=>["Class","Method","Function","Struct"].includes(s.kind));let o="";for(let s of i.reverse())if(s.range&&Wt(t,s.range)==0&&!s.text.endsWith(") callback")){o=s.text;let a=this.labels[s.kind.toLowerCase()];a&&(o=`${a}${o}`);break}return this.functionUpdate&&(n.setVar("coc_current_function",o,!0),this.nvim.call("coc#util#do_autocmd",["CocStatusChange"],!0)),o}async selectSymbolRange(e,t,i){let n=await this.nvim.call("bufnr",["%"]),o=b.getDocument(n);if(!o||!o.attached)return;let s;if(t)s=await b.getSelectedRange(t,o);else{let c=await C.getCursorPosition();s=uo.Range.create(c,c)}let a=await this.getDocumentSymbols(n);if(!a||a.length===0){C.showMessage("No symbols found","warning");return}let l=a.filter(c=>c.kind=="Property");a=a.filter(c=>i.includes(c.kind));let u;for(let c of a.reverse())if(c.range&&!Ne(c.range,s)&&Ji(s,c.range)){u=c.range;break}if(!u){for(let c of l)if(c.range&&!Ne(c.range,s)&&Ji(s,c.range)){u=c.range;break}}if(e&&u){let{start:c,end:f}=u,p=o.getline(c.line+1),d=o.getline(f.line-1);u=uo.Range.create(c.line+1,p.match(/^\s*/)[0].length,f.line-1,d.length)}u&&await b.selectRange(u)}dispose(){this.buffers.dispose(),z(this.disposables)}},gJ=IP,mJ=class{constructor(e){this.bufnr=e;this.disposables=[];this.autoUpdate=!1;this.symbols=[];this._onDidUpdate=new uo.Emitter;this.onDidUpdate=this._onDidUpdate.event;this.fetchSymbols=hJ.default(()=>{this._fetchSymbols().logError()},global.hasOwnProperty("__TEST__")?10:500)}async getSymbols(){let e=b.getDocument(this.bufnr);return e?(e.forceSync(),this.autoUpdate=!0,e.version==this.version?this.symbols:(this.cancel(),await this._fetchSymbols(),this.symbols)):[]}onChange(){this.can
`))};this.disposables.push(b.registerTextDocumentContentProvider("coc",t)),this.disposables.push(me.registerCommand("editor.action.pickColor",()=>this.pickColor())),me.titles.set("editor.action.pickColor","pick color from system color picker when possible."),this.disposables.push(me.registerCommand("editor.action.colorPresentation",()=>this.pickPresentation())),me.titles.set("editor.action.colorPresentation","change color presentation."),this.disposables.push(me.registerCommand("editor.action.organizeImport",async i=>{await this.organizeImport(i)})),me.titles.set("editor.action.organizeImport","run organize import code action.")}async organizeImport(e){e||(e=await this.nvim.call("bufnr",["%"]));let t=b.getDocument(e);if(!t||!t.attached)throw new Error(`buffer${e}notattached`);await mt(t);let i=await this.getCodeActions(t,void 0,[Ue.CodeActionKind.SourceOrganizeImports]);if(i&&i.length){await this.applyCodeAction(i[0]);return}throw new Error("Organize import action not found.")}checkProvier(e,t){if(!U.hasProvider(e,t))throw new Error(`${e}providernotfoundforcurrentbuffer,yourlanguageserverdon'tsupportit.`)}async withRequestToken(e,t,i){this.requestTokenSource&&(this.requestTokenSource.cancel(),this.requestTokenSource.dispose()),this.requestTimer&&clearTimeout(this.requestTimer);let n=this.requestStatusItem;this.requestTokenSource=new Ue.CancellationTokenSource;let{token:o}=this.requestTokenSource;o.onCancellationRequested(()=>{n.text=`${e}requestcanceled`,n.isProgress=!1,this.requestTimer=setTimeout(()=>{n.hide()},500)}),n.isProgress=!0,n.text=`requesting${e}`,n.show();let s;try{s=await Promise.resolve(t(o))}catch(a){C.showMessage(a.message,"error"),vJ.error(`Erroron${e}`,a)}return this.requestTokenSource&&(this.requestTokenSource.dispose(),this.requestTokenSource=void 0),o.isCancellationRequested?null:(n.hide(),i&&(!s||Array.isArray(s)&&s.length==0)?(C.showMessage(`${e}notfound`,"warning"),null):s)}async getCurrentFunctionSymbol(){let{doc:e}=await this.getCurrentState();return this.checkProvier("documentSymbol",e.textDocument),await this.symbols.getCurrentFunctionSymbol()}async selectSymbolRange(e,t,i){let{doc:n}=await this.getCurrentState();return this.checkProvier("documentSymbol",n.textDocument),await this.symbols.selectSymbolRange(e,t,i)}async getDocumentSymbols(e){let t=b.getDocument(e);if(!t||!t.attached)throw new Error(`buffer${e}notattached`);return this.checkProvier("documentSymbol",t.textDocument),await this.symbols.getDocumentSymbols(e)}async hasProvider(e){let t=await this.nvim.call("bufnr","%"),i=b.getDocument(t);return i?U.hasProvider(e,i.textDocument):!1}async onHover(e){let{doc:t,position:i,winid:n}=await this.getCurrentState();this.checkProvier("hover",t.textDocument);let o=e!=null?e:this.preferences.hoverTarget;o=="float"&&this.hoverFactory.close(),await mt(t);let s=await this.withRequestToken("hover",l=>U.getHover(t.textDocument,i,l),!0);if(s==null)return!1;let a=s.find(l=>Ue.Range.is(l.range));if(a==null?void 0:a.range){let l=this.nvim.createWindow(n),u=await l.highlightRanges("CocHoverRange",[a.range],99);setTimeout(()=>{u.length&&l.clearMatches(u),b.isVim&&this.nvim.command("redraw",!0)},1e3)}return await this.previewHover(s,o),!0}async getHover(){let e=[],{doc:t,position:i}=await this.getCurrentState();this.checkProvier("hover",t.textDocument),await mt(t);let n=new Ue.CancellationTokenSource,o=await U.getHover(t.textDocument,i,n.token);if(Array.isArray(o))for(let s of o){let{contents:a}=s;Array.isArray(a)?a.forEach(l=>{e.push(typeof l=="string"?l:l.value)}):Ue.MarkupContent.is(a)?e.push(a.value):e.push(typeof a=="string"?a:a.value)}return e=e.filter(s=>s!=null&&s.length>0),e}async gotoDefinition(e){let{doc:t,position:i}=await this.getCurrentState();this.checkProvier("definition",t.textDocument),await mt(t);let n=await this.withRequestToken("definition",o=>U.getDefinition(t.textDocument,i,o),!0);return n==null?!1:(await this.handleLocations(n,e),!0)}async gotoDeclaration(e){let{doc:t,position:i}=await this.getCurrentState();this.checkProvier("declaration",t.textDocument),aw