1
0
Fork 0
mirror of synced 2024-11-15 21:48:57 -05:00
ultimate-vim/sources_non_forked/coc.nvim/build/index.js

327 lines
1.5 MiB
JavaScript
Raw Normal View History

2022-05-18 13:29:28 -04:00
"use strict";(function () {
var v = process.version
var parts = v.slice(1).split('.')
var major = parseInt(parts[0], 10)
var minor = parseInt(parts[1], 10)
if (major < 12 || (major == 12 && minor < 12)) {
throw new Error('coc.nvim requires node >= v12.12.0, current version: ' + v)
}
})();
var Dte=Object.create;var Nh=Object.defineProperty,Ete=Object.defineProperties,_te=Object.getOwnPropertyDescriptor,Pte=Object.getOwnPropertyDescriptors,Rte=Object.getOwnPropertyNames,tR=Object.getOwnPropertySymbols,Lte=Object.getPrototypeOf,nR=Object.prototype.hasOwnProperty,Ite=Object.prototype.propertyIsEnumerable;var iR=(n,e,t)=>e in n?Nh(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,me=(n,e)=>{for(var t in e||(e={}))nR.call(e,t)&&iR(n,t,e[t]);if(tR)for(var t of tR(e))Ite.call(e,t)&&iR(n,t,e[t]);return n},Hh=(n,e)=>Ete(n,Pte(e)),rR=n=>Nh(n,"__esModule",{value:!0});var P=(n,e)=>()=>(n&&(e=n(n=0)),e);var m=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),vs=(n,e)=>{for(var t in e)Nh(n,t,{get:e[t],enumerable:!0})},oR=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Rte(e))!nR.call(n,r)&&(t||r!=="default")&&Nh(n,r,{get:()=>e[r],enumerable:!(i=_te(e,r))||i.enumerable});return n},S=(n,e)=>oR(rR(Nh(n!=null?Dte(Lte(n)):{},"default",!e&&n&&n.__esModule?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n),Fa=(n=>(e,t)=>n&&n.get(e)||(t=oR(rR({}),e,1),n&&n.set(e,t),t))(typeof WeakMap!="undefined"?new WeakMap:0);var aR=m((mDe,sR)=>{var lu=1e3,uu=lu*60,cu=uu*60,Oa=cu*24,jte=Oa*7,Fte=Oa*365.25;sR.exports=function(n,e){e=e||{};var t=typeof n;if(t==="string"&&n.length>0)return Ote(n);if(t==="number"&&isFinite(n))return e.long?Ate(n):Mte(n);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(n))};function Ote(n){if(n=String(n),!(n.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(n);if(!!e){var t=parseFloat(e[1]),i=(e[2]||"ms").toLowerCase();switch(i){case"years":case"year":case"yrs":case"yr":case"y":return t*Fte;case"weeks":case"week":case"w":return t*jte;case"days":case"day":case"d":return t*Oa;case"hours":case"hour":case"hrs":case"hr":case"h":return t*cu;case"minutes":case"minute":case"mins":case"min":case"m":return t*uu;case"seconds":case"second":case"secs":case"sec":case"s":return t*lu;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Mte(n){var e=Math.abs(n);return e>=Oa?Math.round(n/Oa)+"d":e>=cu?Math.round(n/cu)+"h":e>=uu?Math.round(n/uu)+"m":e>=lu?Math.round(n/lu)+"s":n+"ms"}function Ate(n){var e=Math.abs(n);return e>=Oa?lp(n,e,Oa,"day"):e>=cu?lp(n,e,cu,"hour"):e>=uu?lp(n,e,uu,"minute"):e>=lu?lp(n,e,lu,"second"):n+" ms"}function lp(n,e,t,i){var r=e>=t*1.5;return Math.round(n/t)+" "+i+(r?"s":"")}});var gC=m((bDe,lR)=>{function Nte(n){t.debug=t,t.default=t,t.coerce=l,t.disable=o,t.enable=r,t.enabled=s,t.humanize=aR(),t.destroy=u,Object.keys(n).forEach(c=>{t[c]=n[c]}),t.names=[],t.skips=[],t.formatters={};function e(c){let h=0;for(let d=0;d<c.length;d++)h=(h<<5)-h+c.charCodeAt(d),h|=0;return t.colors[Math.abs(h)%t.colors.length]}t.selectColor=e;function t(c){let h,d=null,g,f;function p(...b){if(!p.enabled)return;let y=p,w=Number(new Date),x=w-(h||w);y.diff=x,y.prev=h,y.curr=w,h=w,b[0]=t.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let k=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(j,O)=>{if(j==="%%")return"%";k++;let W=t.formatters[O];if(typeof W=="function"){let H=b[k];j=W.call(y,H),b.splice(k,1),k--}return j}),t.formatArgs.call(y,b),(y.log||t.log).apply(y,b)}return p.namespace=c,p.useColors=t.useColors(),p.color=t.selectColor(c),p.extend=i,p.destroy=t.destroy,Object.defineProperty(p,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(g!==t.namespaces&&(g=t.namespaces,f=t.enabled(c)),f),set:b=>{d=b}}),typeof t.init=="function"&&t.init(p),p}function i(c,h){let d=t(this.namespace+(typeof h>"u"?":":h)+c);return d.log=this.log,d}function r(c){t.save(c),t.namespaces=c,t.names=[],t.skips=[];let h,d=(typeof c=="string"?c:"").split(/[\s,]+/),g=d.length;for(h=0;h<g;h++)!d[h]||(c=d[h].replace(/\*/g,".*?"),c[0]==="-"?t.skips.push(new RegExp("^"+c.slice(1)+"$")):t.names.push(new RegExp("^"+c+"$")))}function o(){let c=[...t.names.map(a),...t.skips.map(a).map(h=>"-"+h)].join(",");retur
`).join(`
`+o),n.push(r+"m+"+hp.exports.humanize(this.diff)+"\x1B[0m")}else n[0]=Kte()+e+" "+n[0]}function Kte(){return gi.inspectOpts.hideDate?"":new Date().toISOString()+" "}function zte(...n){return process.stderr.write(cp.format(...n)+`
`)}function Qte(n){n?process.env.DEBUG=n:delete process.env.DEBUG}function Vte(){return process.env.DEBUG}function eie(n){n.inspectOpts={};let e=Object.keys(gi.inspectOpts);for(let t=0;t<e.length;t++)n.inspectOpts[e[t]]=gi.inspectOpts[e[t]]}hp.exports=gC()(gi);var{formatters:pR}=hp.exports;pR.o=function(n){return this.inspectOpts.colors=this.useColors,cp.inspect(n,this.inspectOpts).split(`
`).map(e=>e.trim()).join(" ")};pR.O=function(n){return this.inspectOpts.colors=this.useColors,cp.inspect(n,this.inspectOpts)}});var jt=m((wDe,mC)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?mC.exports=uR():mC.exports=mR()});var yR=m((xDe,bR)=>{"use strict";bR.exports=tie;function hu(n){return n instanceof Buffer?Buffer.from(n):new n.constructor(n.buffer.slice(),n.byteOffset,n.length)}function tie(n){if(n=n||{},n.circles)return iie(n);return n.proto?i:t;function e(r,o){for(var s=Object.keys(r),a=new Array(s.length),l=0;l<s.length;l++){var u=s[l],c=r[u];typeof c!="object"||c===null?a[u]=c:c instanceof Date?a[u]=new Date(c):ArrayBuffer.isView(c)?a[u]=hu(c):a[u]=o(c)}return a}function t(r){if(typeof r!="object"||r===null)return r;if(r instanceof Date)return new Date(r);if(Array.isArray(r))return e(r,t);if(r instanceof Map)return new Map(e(Array.from(r),t));if(r instanceof Set)return new Set(e(Array.from(r),t));var o={};for(var s in r)if(Object.hasOwnProperty.call(r,s)!==!1){var a=r[s];typeof a!="object"||a===null?o[s]=a:a instanceof Date?o[s]=new Date(a):a instanceof Map?o[s]=new Map(e(Array.from(a),t)):a instanceof Set?o[s]=new Set(e(Array.from(a),t)):ArrayBuffer.isView(a)?o[s]=hu(a):o[s]=t(a)}return o}function i(r){if(typeof r!="object"||r===null)return r;if(r instanceof Date)return new Date(r);if(Array.isArray(r))return e(r,i);if(r instanceof Map)return new Map(e(Array.from(r),i));if(r instanceof Set)return new Set(e(Array.from(r),i));var o={};for(var s in r){var a=r[s];typeof a!="object"||a===null?o[s]=a:a instanceof Date?o[s]=new Date(a):a instanceof Map?o[s]=new Map(e(Array.from(a),i)):a instanceof Set?o[s]=new Set(e(Array.from(a),i)):ArrayBuffer.isView(a)?o[s]=hu(a):o[s]=i(a)}return o}}function iie(n){var e=[],t=[];return n.proto?o:r;function i(s,a){for(var l=Object.keys(s),u=new Array(l.length),c=0;c<l.length;c++){var h=l[c],d=s[h];if(typeof d!="object"||d===null)u[h]=d;else if(d instanceof Date)u[h]=new Date(d);else if(ArrayBuffer.isView(d))u[h]=hu(d);else{var g=e.indexOf(d);g!==-1?u[h]=t[g]:u[h]=a(d)}}return u}function r(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return i(s,r);if(s instanceof Map)return new Map(i(Array.from(s),r));if(s instanceof Set)return new Set(i(Array.from(s),r));var a={};e.push(s),t.push(a);for(var l in s)if(Object.hasOwnProperty.call(s,l)!==!1){var u=s[l];if(typeof u!="object"||u===null)a[l]=u;else if(u instanceof Date)a[l]=new Date(u);else if(u instanceof Map)a[l]=new Map(i(Array.from(u),r));else if(u instanceof Set)a[l]=new Set(i(Array.from(u),r));else if(ArrayBuffer.isView(u))a[l]=hu(u);else{var c=e.indexOf(u);c!==-1?a[l]=t[c]:a[l]=r(u)}}return e.pop(),t.pop(),a}function o(s){if(typeof s!="object"||s===null)return s;if(s instanceof Date)return new Date(s);if(Array.isArray(s))return i(s,o);if(s instanceof Map)return new Map(i(Array.from(s),o));if(s instanceof Set)return new Set(i(Array.from(s),o));var a={};e.push(s),t.push(a);for(var l in s){var u=s[l];if(typeof u!="object"||u===null)a[l]=u;else if(u instanceof Date)a[l]=new Date(u);else if(u instanceof Map)a[l]=new Map(i(Array.from(u),o));else if(u instanceof Set)a[l]=new Set(i(Array.from(u),o));else if(ArrayBuffer.isView(u))a[l]=hu(u);else{var c=e.indexOf(u);c!==-1?a[l]=t[c]:a[l]=o(u)}}return e.pop(),t.pop(),a}}});var Aa=m((CDe,CR)=>{var nie=require("util"),Ma=jt()("log4js:configuration"),dp=[],gp=[],vR=n=>!n,wR=n=>n&&typeof n=="object"&&!Array.isArray(n),rie=n=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(n),oie=n=>n&&typeof n=="number"&&Number.isInteger(n),sie=n=>{gp.push(n),Ma(`Added listener, now ${gp.length} listeners`)},aie=n=>{dp.push(n),Ma(`Added pre-processing listener, now ${dp.length} listeners`)},xR=(n,e,t)=>{(Array.isArray(e)?e:[e]).forEach(r=>{if(r)throw new Error(`Problem with log4js configuration: (${nie.inspect(n,{depth:5})}) - ${t}`)})},lie=n=>{Ma("New configuration to be validated: ",n),xR(n,vR(wR(n)),"must be an object."),Ma(`Calling pre-processing listeners (${dp.length})`),dp.forEach(e=>e(n)),Ma("Configuration pre-processing f
`)}}function Eie(n,e){let t=e.colouredLayout;return n.layout&&(t=e.layout(n.layout.type,n.layout)),Die(t,n.timezoneOffset)}sL.configure=Eie});var uL=m((IDe,lL)=>{function _ie(n,e){return t=>{process.stderr.write(`${n(t,e)}
`)}}function Pie(n,e){let t=e.colouredLayout;return n.layout&&(t=e.layout(n.layout.type,n.layout)),_ie(t,n.timezoneOffset)}lL.exports.configure=Pie});var hL=m((jDe,cL)=>{function Rie(n,e,t,i){let r=i.getLevel(n),o=i.getLevel(e,i.FATAL);return s=>{let a=s.level;a.isGreaterThanOrEqualTo(r)&&a.isLessThanOrEqualTo(o)&&t(s)}}function Lie(n,e,t,i){let r=t(n.appender);return Rie(n.level,n.maxLevel,r,i)}cL.exports.configure=Lie});var fL=m((FDe,gL)=>{var dL=jt()("log4js:categoryFilter");function Iie(n,e){return typeof n=="string"&&(n=[n]),t=>{dL(`Checking ${t.categoryName} against ${n}`),n.indexOf(t.categoryName)===-1&&(dL("Not excluded, sending to appender"),e(t))}}function jie(n,e,t){let i=t(n.appender);return Iie(n.exclude,i)}gL.exports.configure=jie});var bL=m((ODe,mL)=>{var pL=jt()("log4js:noLogFilter");function Fie(n){return n.filter(t=>t!=null&&t!=="")}function Oie(n,e){return t=>{pL(`Checking data: ${t.data} against filters: ${n}`),typeof n=="string"&&(n=[n]),n=Fie(n);let i=new RegExp(n.join("|"),"i");(n.length===0||t.data.findIndex(r=>i.test(r))<0)&&(pL("Not excluded, sending to appender"),e(t))}}function Mie(n,e,t){let i=t(n.appender);return Oie(n.exclude,i)}mL.exports.configure=Mie});var gt=m(CC=>{"use strict";CC.fromCallback=function(n){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")n.apply(this,e);else return new Promise((t,i)=>{n.call(this,...e,(r,o)=>r!=null?i(r):t(o))})},"name",{value:n.name})};CC.fromPromise=function(n){return Object.defineProperty(function(...e){let t=e[e.length-1];if(typeof t!="function")return n.apply(this,e);n.apply(this,e.slice(0,-1)).then(i=>t(null,i),t)},"name",{value:n.name})}});var vL=m((ADe,yL)=>{var Cs=require("constants"),Aie=process.cwd,vp=null,Nie=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return vp||(vp=Aie.call(process)),vp};try{process.cwd()}catch{}typeof process.chdir=="function"&&(SC=process.chdir,process.chdir=function(n){vp=null,SC.call(process,n)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,SC));var SC;yL.exports=Hie;function Hie(n){Cs.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(n),n.lutimes||t(n),n.chown=o(n.chown),n.fchown=o(n.fchown),n.lchown=o(n.lchown),n.chmod=i(n.chmod),n.fchmod=i(n.fchmod),n.lchmod=i(n.lchmod),n.chownSync=s(n.chownSync),n.fchownSync=s(n.fchownSync),n.lchownSync=s(n.lchownSync),n.chmodSync=r(n.chmodSync),n.fchmodSync=r(n.fchmodSync),n.lchmodSync=r(n.lchmodSync),n.stat=a(n.stat),n.fstat=a(n.fstat),n.lstat=a(n.lstat),n.statSync=l(n.statSync),n.fstatSync=l(n.fstatSync),n.lstatSync=l(n.lstatSync),n.lchmod||(n.lchmod=function(c,h,d){d&&process.nextTick(d)},n.lchmodSync=function(){}),n.lchown||(n.lchown=function(c,h,d,g){g&&process.nextTick(g)},n.lchownSync=function(){}),Nie==="win32"&&(n.rename=function(c){return function(h,d,g){var f=Date.now(),p=0;c(h,d,function b(y){if(y&&(y.code==="EACCES"||y.code==="EPERM")&&Date.now()-f<6e4){setTimeout(function(){n.stat(d,function(w,x){w&&w.code==="ENOENT"?c(h,d,b):g(y)})},p),p<100&&(p+=10);return}g&&g(y)})}}(n.rename)),n.read=function(c){function h(d,g,f,p,b,y){var w;if(y&&typeof y=="function"){var x=0;w=function(k,L,j){if(k&&k.code==="EAGAIN"&&x<10)return x++,c.call(n,d,g,f,p,b,w);y.apply(this,arguments)}}return c.call(n,d,g,f,p,b,w)}return Object.setPrototypeOf&&Object.setPrototypeOf(h,c),h}(n.read),n.readSync=function(c){return function(h,d,g,f,p){for(var b=0;;)try{return c.call(n,h,d,g,f,p)}catch(y){if(y.code==="EAGAIN"&&b<10){b++;continue}throw y}}}(n.readSync);function e(c){c.lchmod=function(h,d,g){c.open(h,Cs.O_WRONLY|Cs.O_SYMLINK,d,function(f,p){if(f){g&&g(f);return}c.fchmod(p,d,function(b){c.close(p,function(y){g&&g(b||y)})})})},c.lchmodSync=function(h,d){var g=c.openSync(h,Cs.O_WRONLY|Cs.O_SYMLINK,d),f=!0,p;try{p=c.fchmodSync(g,d),f=!1}finally{if(f)try{c.closeSync(g)}catch{}else c.closeSync(g)}return p}}function t(c){Cs.hasOwnProperty("O_SYMLINK")?(c.lutimes=function(h,d,g,f){c.open(h,Cs.O_SYMLINK,function(p,b){if(p){f&&f(p);return}c.futimes(b,d,g,function(y){c.close(b,function(w){f&&f(y||w)})
GFS4: `),console.error(n)});fi[pr]||(kL=global[pr]||[],DL(fi,kL),fi.close=function(n){function e(t,i){return n.call(fi,t,function(r){r||Ss(),typeof i=="function"&&i.apply(this,arguments)})}return Object.defineProperty(e,xp,{value:n}),e}(fi.close),fi.closeSync=function(n){function e(t){n.apply(fi,arguments),Ss()}return Object.defineProperty(e,xp,{value:n}),e}(fi.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){$h(fi[pr]),require("assert").equal(fi[pr].length,0)}));var kL;global[pr]||DL(global,fi[pr]);kC.exports=TC(Jie(fi));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!fi.__patched&&(kC.exports=TC(fi),fi.__patched=!0);function TC(n){Wie(n),n.gracefulify=TC,n.createReadStream=L,n.createWriteStream=j;var e=n.readFile;n.readFile=t;function t(H,N,I){return typeof N=="function"&&(I=N,N=null),A(H,N,I);function A(Z,K,ae){return e(Z,K,function(je){je&&(je.code==="EMFILE"||je.code==="ENFILE")?gu([A,[Z,K,ae]]):(typeof ae=="function"&&ae.apply(this,arguments),Ss())})}}var i=n.writeFile;n.writeFile=r;function r(H,N,I,A){return typeof I=="function"&&(A=I,I=null),Z(H,N,I,A);function Z(K,ae,je,Pe){return i(K,ae,je,function(Ve){Ve&&(Ve.code==="EMFILE"||Ve.code==="ENFILE")?gu([Z,[K,ae,je,Pe]]):(typeof Pe=="function"&&Pe.apply(this,arguments),Ss())})}}var o=n.appendFile;o&&(n.appendFile=s);function s(H,N,I,A){return typeof I=="function"&&(A=I,I=null),Z(H,N,I,A);function Z(K,ae,je,Pe){return o(K,ae,je,function(Ve){Ve&&(Ve.code==="EMFILE"||Ve.code==="ENFILE")?gu([Z,[K,ae,je,Pe]]):(typeof Pe=="function"&&Pe.apply(this,arguments),Ss())})}}var a=n.copyFile;a&&(n.copyFile=l);function l(H,N,I,A){return typeof I=="function"&&(A=I,I=0),a(H,N,I,function(Z){Z&&(Z.code==="EMFILE"||Z.code==="ENFILE")?gu([a,[H,N,I,A]]):(typeof A=="function"&&A.apply(this,arguments),Ss())})}var u=n.readdir;n.readdir=c;function c(H,N,I){var A=[H];return typeof N!="function"?A.push(N):I=N,A.push(Z),h(A);function Z(K,ae){ae&&ae.sort&&ae.sort(),K&&(K.code==="EMFILE"||K.code==="ENFILE")?gu([h,[A]]):(typeof I=="function"&&I.apply(this,arguments),Ss())}}function h(H){return u.apply(n,H)}if(process.version.substr(0,4)==="v0.8"){var d=Zie(n);y=d.ReadStream,x=d.WriteStream}var g=n.ReadStream;g&&(y.prototype=Object.create(g.prototype),y.prototype.open=w);var f=n.WriteStream;f&&(x.prototype=Object.create(f.prototype),x.prototype.open=k),Object.defineProperty(n,"ReadStream",{get:function(){return y},set:function(H){y=H},enumerable:!0,configurable:!0}),Object.defineProperty(n,"WriteStream",{get:function(){return x},set:function(H){x=H},enumerable:!0,configurable:!0});var p=y;Object.defineProperty(n,"FileReadStream",{get:function(){return p},set:function(H){p=H},enumerable:!0,configurable:!0});var b=x;Object.defineProperty(n,"FileWriteStream",{get:function(){return b},set:function(H){b=H},enumerable:!0,configurable:!0});function y(H,N){return this instanceof y?(g.apply(this,arguments),this):y.apply(Object.create(y.prototype),arguments)}function w(){var H=this;W(H.path,H.flags,H.mode,function(N,I){N?(H.autoClose&&H.destroy(),H.emit("error",N)):(H.fd=I,H.emit("open",I),H.read())})}function x(H,N){return this instanceof x?(f.apply(this,arguments),this):x.apply(Object.create(x.prototype),arguments)}function k(){var H=this;W(H.path,H.flags,H.mode,function(N,I){N?(H.destroy(),H.emit("error",N)):(H.fd=I,H.emit("open",I))})}function L(H,N){return new n.ReadStream(H,N)}function j(H,N){return new n.WriteStream(H,N)}var O=n.open;n.open=W;function W(H,N,I,A){return typeof I=="function"&&(A=I,I=null),Z(H,N,I,A);function Z(K,ae,je,Pe){return O(K,ae,je,function(Ve,Tt){Ve&&(Ve.code==="EMFILE"||Ve.code==="ENFILE")?gu([Z,[K,ae,je,Pe]]):(typeof Pe=="function"&&Pe.apply(this,arguments),Ss())})}}return n}function gu(n){$h("ENQUEUE",n[0].name,n[1]),fi[pr].push(n)}function Ss(){var n=fi[pr].shift();n&&($h("RETRY",n[0].name,n[1]),n[0].apply(null,n[1]))}});var Ba=m(Ts=>{"use strict";var EL=gt().fromCallback,_n=Ge(),Xie=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat",
see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat:i,destStat:r}=Gh.checkPathsSync(n,e,"copy",t);return Gh.checkParentPathsSync(n,i,e,"copy"),ane(r,n,e,t)}function ane(n,e,t,i){if(i.filter&&!i.filter(e,t))return;let r=Uh.dirname(t);return Ti.existsSync(r)||rne(r),HL(n,e,t,i)}function lne(n,e,t,i){if(!(i.filter&&!i.filter(e,t)))return HL(n,e,t,i)}function HL(n,e,t,i){let o=(i.dereference?Ti.statSync:Ti.lstatSync)(e);if(o.isDirectory())return pne(o,n,e,t,i);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return une(o,n,e,t,i);if(o.isSymbolicLink())return yne(n,e,t,i);throw o.isSocket()?new Error(`Cannot copy a socket file: ${e}`):o.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}function une(n,e,t,i,r){return e?cne(n,t,i,r):qL(n,t,i,r)}function cne(n,e,t,i){if(i.overwrite)return Ti.unlinkSync(t),qL(n,e,t,i);if(i.errorOnExist)throw new Error(`'${t}' already exists`)}function qL(n,e,t,i){return Ti.copyFileSync(e,t),i.preserveTimestamps&&hne(n.mode,e,t),LC(t,n.mode)}function hne(n,e,t){return dne(n)&&gne(t,n),fne(e,t)}function dne(n){return(n&128)===0}function gne(n,e){return LC(n,e|128)}function LC(n,e){return Ti.chmodSync(n,e)}function fne(n,e){let t=Ti.statSync(n);return one(e,t.atime,t.mtime)}function pne(n,e,t,i,r){return e?BL(t,i,r):mne(n.mode,t,i,r)}function mne(n,e,t,i){return Ti.mkdirSync(t),BL(e,t,i),LC(t,n)}function BL(n,e,t){Ti.readdirSync(n).forEach(i=>bne(i,n,e,t))}function bne(n,e,t,i){let r=Uh.join(e,n),o=Uh.join(t,n),{destStat:s}=Gh.checkPathsSync(r,o,"copy",i);return lne(s,r,o,i)}function yne(n,e,t,i){let r=Ti.readlinkSync(e);if(i.dereference&&(r=Uh.resolve(process.cwd(),r)),n){let o;try{o=Ti.readlinkSync(t)}catch(s){if(s.code==="EINVAL"||s.code==="UNKNOWN")return Ti.symlinkSync(r,t);throw s}if(i.dereference&&(o=Uh.resolve(process.cwd(),o)),Gh.isSrcSubdir(r,o))throw new Error(`Cannot copy '${r}' to a subdirectory of itself, '${o}'.`);if(Ti.statSync(t).isDirectory()&&Gh.isSrcSubdir(o,r))throw new Error(`Cannot overwrite '${o}' with '${r}'.`);return vne(r,t)}else return Ti.symlinkSync(r,t)}function vne(n,e){return Ti.unlinkSync(e),Ti.symlinkSync(n,e)}YL.exports=sne});var IC=m((UDe,ZL)=>{"use strict";ZL.exports={copySync:WL()}});var ks=m((GDe,$L)=>{"use strict";var wne=gt().fromPromise,JL=Ba();function xne(n){return JL.access(n).then(()=>!0).catch(()=>!1)}$L.exports={pathExists:wne(xne),pathExistsSync:JL.existsSync}});var eI=m((KDe,VL)=>{"use strict";var nn=Ge(),Kh=require("path"),Cne=mr().mkdirs,Sne=ks().pathExists,Tne=PC().utimesMillis,zh=Ya();function kne(n,e,t,i){typeof t=="function"&&!i?(i=t,t={}):typeof t=="function"&&(t={filter:t}),i=i||function(){},t=t||{},t.clobber="clobber"in t?!!t.clobber:!0,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
see https://github.com/jprichardson/node-fs-extra/issues/269`),zh.checkPaths(n,e,"copy",t,(r,o)=>{if(r)return i(r);let{srcStat:s,destStat:a}=o;zh.checkParentPaths(n,s,e,"copy",l=>l?i(l):t.filter?GL(XL,a,n,e,t,i):XL(a,n,e,t,i))})}function XL(n,e,t,i,r){let o=Kh.dirname(t);Sne(o,(s,a)=>{if(s)return r(s);if(a)return Sp(n,e,t,i,r);Cne(o,l=>l?r(l):Sp(n,e,t,i,r))})}function GL(n,e,t,i,r,o){Promise.resolve(r.filter(t,i)).then(s=>s?n(e,t,i,r,o):o(),s=>o(s))}function Dne(n,e,t,i,r){return i.filter?GL(Sp,n,e,t,i,r):Sp(n,e,t,i,r)}function Sp(n,e,t,i,r){(i.dereference?nn.stat:nn.lstat)(e,(s,a)=>s?r(s):a.isDirectory()?jne(a,n,e,t,i,r):a.isFile()||a.isCharacterDevice()||a.isBlockDevice()?Ene(a,n,e,t,i,r):a.isSymbolicLink()?Mne(n,e,t,i,r):a.isSocket()?r(new Error(`Cannot copy a socket file: ${e}`)):a.isFIFO()?r(new Error(`Cannot copy a FIFO pipe: ${e}`)):r(new Error(`Unknown file: ${e}`)))}function Ene(n,e,t,i,r,o){return e?_ne(n,t,i,r,o):KL(n,t,i,r,o)}function _ne(n,e,t,i,r){if(i.overwrite)nn.unlink(t,o=>o?r(o):KL(n,e,t,i,r));else return i.errorOnExist?r(new Error(`'${t}' already exists`)):r()}function KL(n,e,t,i,r){nn.copyFile(e,t,o=>o?r(o):i.preserveTimestamps?Pne(n.mode,e,t,r):Tp(t,n.mode,r))}function Pne(n,e,t,i){return Rne(n)?Lne(t,n,r=>r?i(r):UL(n,e,t,i)):UL(n,e,t,i)}function Rne(n){return(n&128)===0}function Lne(n,e,t){return Tp(n,e|128,t)}function UL(n,e,t,i){Ine(e,t,r=>r?i(r):Tp(t,n,i))}function Tp(n,e,t){return nn.chmod(n,e,t)}function Ine(n,e,t){nn.stat(n,(i,r)=>i?t(i):Tne(e,r.atime,r.mtime,t))}function jne(n,e,t,i,r,o){return e?zL(t,i,r,o):Fne(n.mode,t,i,r,o)}function Fne(n,e,t,i,r){nn.mkdir(t,o=>{if(o)return r(o);zL(e,t,i,s=>s?r(s):Tp(t,n,r))})}function zL(n,e,t,i){nn.readdir(n,(r,o)=>r?i(r):QL(o,n,e,t,i))}function QL(n,e,t,i,r){let o=n.pop();return o?One(n,o,e,t,i,r):r()}function One(n,e,t,i,r,o){let s=Kh.join(t,e),a=Kh.join(i,e);zh.checkPaths(s,a,"copy",r,(l,u)=>{if(l)return o(l);let{destStat:c}=u;Dne(c,s,a,r,h=>h?o(h):QL(n,t,i,r,o))})}function Mne(n,e,t,i,r){nn.readlink(e,(o,s)=>{if(o)return r(o);if(i.dereference&&(s=Kh.resolve(process.cwd(),s)),n)nn.readlink(t,(a,l)=>a?a.code==="EINVAL"||a.code==="UNKNOWN"?nn.symlink(s,t,r):r(a):(i.dereference&&(l=Kh.resolve(process.cwd(),l)),zh.isSrcSubdir(s,l)?r(new Error(`Cannot copy '${s}' to a subdirectory of itself, '${l}'.`)):n.isDirectory()&&zh.isSrcSubdir(l,s)?r(new Error(`Cannot overwrite '${l}' with '${s}'.`)):Ane(s,t,r)));else return nn.symlink(s,t,r)})}function Ane(n,e,t){nn.unlink(e,i=>i?t(i):nn.symlink(n,e,t))}VL.exports=kne});var jC=m((zDe,tI)=>{"use strict";var Nne=gt().fromCallback;tI.exports={copy:Nne(eI())}});var cI=m((QDe,uI)=>{"use strict";var iI=Ge(),sI=require("path"),st=require("assert"),Qh=process.platform==="win32";function aI(n){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(t=>{n[t]=n[t]||iI[t],t=t+"Sync",n[t]=n[t]||iI[t]}),n.maxBusyTries=n.maxBusyTries||3}function FC(n,e,t){let i=0;typeof e=="function"&&(t=e,e={}),st(n,"rimraf: missing path"),st.strictEqual(typeof n,"string","rimraf: path should be a string"),st.strictEqual(typeof t,"function","rimraf: callback function required"),st(e,"rimraf: invalid options argument provided"),st.strictEqual(typeof e,"object","rimraf: options should be object"),aI(e),nI(n,e,function r(o){if(o){if((o.code==="EBUSY"||o.code==="ENOTEMPTY"||o.code==="EPERM")&&i<e.maxBusyTries){i++;let s=i*100;return setTimeout(()=>nI(n,e,r),s)}o.code==="ENOENT"&&(o=null)}t(o)})}function nI(n,e,t){st(n),st(e),st(typeof t=="function"),e.lstat(n,(i,r)=>{if(i&&i.code==="ENOENT")return t(null);if(i&&i.code==="EPERM"&&Qh)return rI(n,e,i,t);if(r&&r.isDirectory())return kp(n,e,i,t);e.unlink(n,o=>{if(o){if(o.code==="ENOENT")return t(null);if(o.code==="EPERM")return Qh?rI(n,e,o,t):kp(n,e,o,t);if(o.code==="EISDIR")return kp(n,e,o,t)}return t(o)})})}function rI(n,e,t,i){st(n),st(e),st(typeof i=="function"),e.chmod(n,438,r=>{r?i(r.code==="ENOENT"?null:t):e.stat(n,(o,s)=>{o?i(o.code==="ENOENT"?null:t):s.isDirectory()?kp(n,e,t,i):e.unlink(n,i)})})}function oI(n,e,t){let i;st(n),st(e);try{e.chmodSync(n,438)}catch(r){if(r.code==="ENOENT")
`,finalEOL:t=!0,replacer:i=null,spaces:r}={}){let o=t?e:"";return JSON.stringify(n,i,r).replace(/\n/g,e)+o}function fre(n){return Buffer.isBuffer(n)&&(n=n.toString("utf8")),n.replace(/^\uFEFF/,"")}JI.exports={stringify:gre,stripBom:fre}});var OC=m((lEe,UI)=>{var bu;try{bu=Ge()}catch{bu=require("fs")}var Lp=gt(),{stringify:$I,stripBom:XI}=mu();async function pre(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||bu,i="throws"in e?e.throws:!0,r=await Lp.fromCallback(t.readFile)(n,e);r=XI(r);let o;try{o=JSON.parse(r,e?e.reviver:null)}catch(s){if(i)throw s.message=`${n}: ${s.message}`,s;return null}return o}var mre=Lp.fromPromise(pre);function bre(n,e={}){typeof e=="string"&&(e={encoding:e});let t=e.fs||bu,i="throws"in e?e.throws:!0;try{let r=t.readFileSync(n,e);return r=XI(r),JSON.parse(r,e.reviver)}catch(r){if(i)throw r.message=`${n}: ${r.message}`,r;return null}}async function yre(n,e,t={}){let i=t.fs||bu,r=$I(e,t);await Lp.fromCallback(i.writeFile)(n,r,t)}var vre=Lp.fromPromise(yre);function wre(n,e,t={}){let i=t.fs||bu,r=$I(e,t);return i.writeFileSync(n,r,t)}var xre={readFile:mre,readFileSync:bre,writeFile:vre,writeFileSync:wre};UI.exports=xre});var KI=m((uEe,GI)=>{"use strict";var Ip=OC();GI.exports={readJson:Ip.readFile,readJsonSync:Ip.readFileSync,writeJson:Ip.writeFile,writeJsonSync:Ip.writeFileSync}});var jp=m((cEe,VI)=>{"use strict";var Cre=gt().fromCallback,td=Ge(),zI=require("path"),QI=mr(),Sre=ks().pathExists;function Tre(n,e,t,i){typeof t=="function"&&(i=t,t="utf8");let r=zI.dirname(n);Sre(r,(o,s)=>{if(o)return i(o);if(s)return td.writeFile(n,e,t,i);QI.mkdirs(r,a=>{if(a)return i(a);td.writeFile(n,e,t,i)})})}function kre(n,...e){let t=zI.dirname(n);if(td.existsSync(t))return td.writeFileSync(n,...e);QI.mkdirsSync(t),td.writeFileSync(n,...e)}VI.exports={outputFile:Cre(Tre),outputFileSync:kre}});var tj=m((hEe,ej)=>{"use strict";var{stringify:Dre}=mu(),{outputFile:Ere}=jp();async function _re(n,e,t={}){let i=Dre(e,t);await Ere(n,i,t)}ej.exports=_re});var nj=m((dEe,ij)=>{"use strict";var{stringify:Pre}=mu(),{outputFileSync:Rre}=jp();function Lre(n,e,t){let i=Pre(e,t);Rre(n,i,t)}ij.exports=Lre});var oj=m((gEe,rj)=>{"use strict";var Ire=gt().fromPromise,Bi=KI();Bi.outputJson=Ire(tj());Bi.outputJsonSync=nj();Bi.outputJSON=Bi.outputJson;Bi.outputJSONSync=Bi.outputJsonSync;Bi.writeJSON=Bi.writeJson;Bi.writeJSONSync=Bi.writeJsonSync;Bi.readJSON=Bi.readJson;Bi.readJSONSync=Bi.readJsonSync;rj.exports=Bi});var cj=m((fEe,uj)=>{"use strict";var aj=Ge(),AC=require("path"),jre=IC().copySync,lj=Vh().removeSync,Fre=mr().mkdirpSync,sj=Ya();function Ore(n,e,t){t=t||{};let i=t.overwrite||t.clobber||!1,{srcStat:r,isChangingCase:o=!1}=sj.checkPathsSync(n,e,"move",t);return sj.checkParentPathsSync(n,r,e,"move"),Mre(e)||Fre(AC.dirname(e)),Are(n,e,i,o)}function Mre(n){let e=AC.dirname(n);return AC.parse(e).root===e}function Are(n,e,t,i){if(i)return MC(n,e,t);if(t)return lj(e),MC(n,e,t);if(aj.existsSync(e))throw new Error("dest already exists.");return MC(n,e,t)}function MC(n,e,t){try{aj.renameSync(n,e)}catch(i){if(i.code!=="EXDEV")throw i;return Nre(n,e,t)}}function Nre(n,e,t){return jre(n,e,{overwrite:t,errorOnExist:!0}),lj(n)}uj.exports=Ore});var dj=m((pEe,hj)=>{"use strict";hj.exports={moveSync:cj()}});var bj=m((mEe,mj)=>{"use strict";var Hre=Ge(),HC=require("path"),qre=jC().copy,pj=Vh().remove,Bre=mr().mkdirp,Yre=ks().pathExists,gj=Ya();function Wre(n,e,t,i){typeof t=="function"&&(i=t,t={});let r=t.overwrite||t.clobber||!1;gj.checkPaths(n,e,"move",t,(o,s)=>{if(o)return i(o);let{srcStat:a,isChangingCase:l=!1}=s;gj.checkParentPaths(n,a,e,"move",u=>{if(u)return i(u);if(Zre(e))return fj(n,e,r,l,i);Bre(HC.dirname(e),c=>c?i(c):fj(n,e,r,l,i))})})}function Zre(n){let e=HC.dirname(n);return HC.parse(e).root===e}function fj(n,e,t,i,r){if(i)return NC(n,e,t,r);if(t)return pj(e,o=>o?r(o):NC(n,e,t,r));Yre(e,(o,s)=>o?r(o):s?r(new Error("dest already exists.")):NC(n,e,t,r))}function NC(n,e,t,i){Hre.rename(n,e,r=>r?r.code!=="EXDEV"?i(r):Jre(n,e,t,i):i())}function Jre(n,e,t,i){qre(n,e,{overwrite:t,errorOnExist:!0},o=>o?i(o):pj(n,i))}mj.exports=
`;function Xj(n,e){if(Zr.existsSync(n))return;let t=Zr.openSync(n,e.flags,e.mode);Zr.closeSync(t)}var Uj=class{constructor(e,t,i,r){Do("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,this.options=r,this.currentSize=0;function s(a){let l=0;try{l=Zr.statSync(a).size}catch{Xj(a,r)}return l}this.currentSize=s(this.filename)}shouldRoll(){return Do("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(`^${yu.basename(e)}`);function r(u){return i.test(u)}function o(u){return parseInt(u.substring(`${yu.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(Do(`Index of ${u} is ${c}`),t.backups===0)Zr.truncateSync(e,0);else if(c<t.backups){try{Zr.unlinkSync(`${e}.${c+1}`)}catch{}Do(`Renaming ${u} -> ${e}.${c+1}`),Zr.renameSync(yu.join(yu.dirname(e),u),`${e}.${c+1}`)}}function l(){Do("Renaming the old files"),Zr.readdirSync(yu.dirname(e)).filter(r).sort(s).reverse().forEach(a)}Do("Rolling, rolling, rolling"),l()}write(e,t){let i=this;function r(){Do("writing the chunk to the file"),i.currentSize+=e.length,Zr.appendFileSync(i.filename,e)}Do("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),r()}};function Coe(n,e,t,i,r,o){Do("fileSync appender created"),n=yu.normalize(n),i=!i&&i!==0?5:i;function s(l,u,c){let h;return u?h=new Uj(l,u,c,o):h=(d=>(Xj(d,o),{write(g){Zr.appendFileSync(d,g)}}))(l),h}let a=s(n,t,i);return l=>{a.write(e(l,r)+xoe)}}function Soe(n,e){let t=e.basicLayout;n.layout&&(t=e.layout(n.layout.type,n.layout));let i={flags:n.flags||"a",encoding:n.encoding||"utf8",mode:n.mode||384};return Coe(n.filename,t,n.maxLogSize,n.backups,n.timezoneOffset,i)}Gj.exports.configure=Soe});var Qj=m((REe,zj)=>{var Jr=jt()("log4js:tcp"),Toe=require("net");function koe(n,e){let t=!1,i=[],r,o=3,s="__LOG4JS__";function a(h){Jr("Writing log event to socket"),t=r.write(`${e(h)}${s}`,"utf8")}function l(){let h;for(Jr("emptying buffer");h=i.shift();)a(h)}function u(){Jr(`appender creating socket to ${n.host||"localhost"}:${n.port||5e3}`),s=`${n.endMsg||"__LOG4JS__"}`,r=Toe.createConnection(n.port||5e3,n.host||"localhost"),r.on("connect",()=>{Jr("socket connected"),l(),t=!0}),r.on("drain",()=>{Jr("drain event received, emptying buffer"),t=!0,l()}),r.on("timeout",r.end.bind(r)),r.on("error",h=>{Jr("connection error",h),t=!1,l()}),r.on("close",u)}u();function c(h){t?a(h):(Jr("buffering log event because it cannot write at the moment"),i.push(h))}return c.shutdown=function(h){Jr("shutdown called"),i.length&&o?(Jr("buffer has items, waiting 100ms to empty"),o-=1,setTimeout(()=>{c.shutdown(h)},100)):(r.removeAllListeners("close"),r.end(h))},c}function Doe(n,e){Jr(`configure with config = ${n}`);let t=function(i){return i.serialise()};return n.layout&&(t=e.layout(n.layout.type,n.layout)),koe(n,t)}zj.exports.configure=Doe});var ZC=m((LEe,WC)=>{var Eoe=require("path"),Za=jt()("log4js:appenders"),Jn=Aa(),Vj=yp(),_oe=qa(),Poe=yC(),Roe=nL(),yr=new Map;yr.set("console",oL());yr.set("stdout",aL());yr.set("stderr",uL());yr.set("logLevelFilter",hL());yr.set("categoryFilter",fL());yr.set("noLogFilter",bL());yr.set("file",Zj());yr.set("dateFile",$j());yr.set("fileSync",Kj());yr.set("tcp",Qj());var nd=new Map,YC=(n,e)=>{Za("Loading module from ",n);try{return require(n)}catch(t){Jn.throwExceptionIf(e,t.code!=="MODULE_NOT_FOUND",`appender "${n}" could not be loaded (error was: ${t})`);return}},Loe=(n,e)=>yr.get(n)||YC(`./${n}`,e)||YC(n,e)||""||YC(Eoe.join(process.cwd(),n),e),qp=new Set,eF=(n,e)=>{if(nd.has(n))return nd.get(n);if(!e.appenders[n])return!1;if(qp.has(n))throw new Error(`Dependency loop detected for appender ${n}.`);qp.add(n),Za(`Creating appender ${n}`);let t=Ioe(n,e);return qp.delete(n),nd.set(n,t),t},Ioe=(n,e)=>{let t=e.appenders[n],i=t.type.configure?t.type:Loe(t.type,e);return Jn.throwExceptionIf(e,Jn.not(i),`appender "${n}" is not valid (type "${t.type}" could not be found)
`).slice(e),i=Yoe.exec(t[0]);return i&&i.length===6?{functionName:i[1],fileName:i[2],lineNumber:parseInt(i[3],10),columnNumber:parseInt(i[4],10),callStack:t.join(`
`)}:null}var Wp=class{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.parseCallStack=Woe,aF(`Logger created (${this.category}, ${this.level})`)}get level(){return Eo.getLevel(Yp.getLevelForCategory(this.category),Eo.TRACE)}set level(e){Yp.setLevelForCategory(this.category,Eo.getLevel(e,this.level))}get useCallStack(){return Yp.getEnableCallStackForCategory(this.category)}set useCallStack(e){Yp.setEnableCallStackForCategory(this.category,e===!0)}log(e,...t){let i=Eo.getLevel(e);i||(this._log(Eo.WARN,"log4js:logger.log: invalid value for log-level as first parameter given: ",e),i=Eo.INFO),this.isLevelEnabled(i)&&this._log(i,t)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,t){aF(`sending log data (${e}) to appenders`);let i=new Hoe(this.category,e,t,this.context,this.useCallStack&&this.parseCallStack(new Error));qoe.send(i)}addContext(e,t){this.context[e]=t}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){this.parseCallStack=e}};function lF(n){let e=Eo.getLevel(n),i=e.toString().toLowerCase().replace(/_([a-z])/g,o=>o[1].toUpperCase()),r=i[0].toUpperCase()+i.slice(1);Wp.prototype[`is${r}Enabled`]=function(){return this.isLevelEnabled(e)},Wp.prototype[i]=function(...o){this.log(e,...o)}}Eo.levels.forEach(lF);Boe.addListener(()=>{Eo.levels.forEach(lF)});uF.exports=Wp});var gF=m((FEe,dF)=>{var vu=qa(),Zoe=':remote-addr - - ":method :url HTTP/:http-version" :status :content-length ":referrer" ":user-agent"';function Joe(n){return n.originalUrl||n.url}function $oe(n,e,t){let i=o=>{let s=o.concat();for(let a=0;a<s.length;++a)for(let l=a+1;l<s.length;++l)s[a].token==s[l].token&&s.splice(l--,1);return s},r=[];return r.push({token:":url",replacement:Joe(n)}),r.push({token:":protocol",replacement:n.protocol}),r.push({token:":hostname",replacement:n.hostname}),r.push({token:":method",replacement:n.method}),r.push({token:":status",replacement:e.__statusCode||e.statusCode}),r.push({token:":response-time",replacement:e.responseTime}),r.push({token:":date",replacement:new Date().toUTCString()}),r.push({token:":referrer",replacement:n.headers.referer||n.headers.referrer||""}),r.push({token:":http-version",replacement:`${n.httpVersionMajor}.${n.httpVersionMinor}`}),r.push({token:":remote-addr",replacement:n.headers["x-forwarded-for"]||n.ip||n._remoteAddress||n.socket&&(n.socket.remoteAddress||n.socket.socket&&n.socket.socket.remoteAddress)}),r.push({token:":user-agent",replacement:n.headers["user-agent"]}),r.push({token:":content-length",replacement:e.getHeader("content-length")||e.__headers&&e.__headers["Content-Length"]||"-"}),r.push({token:/:req\[([^\]]+)]/g,replacement(o,s){return n.headers[s.toLowerCase()]}}),r.push({token:/:res\[([^\]]+)]/g,replacement(o,s){return e.getHeader(s.toLowerCase())||e.__headers&&e.__headers[s]}}),i(t.concat(r))}function hF(n,e){for(let t=0;t<e.length;t++)n=n.replace(e[t].token,e[t].replacement);return n}function Xoe(n){let e=null;if(n instanceof RegExp&&(e=n),typeof n=="string"&&(e=new RegExp(n)),Array.isArray(n)){let t=n.map(i=>i.source?i.source:i);e=new RegExp(t.join("|"))}return e}function Uoe(n,e,t){let i=e;if(t){let r=t.find(o=>{let s=!1;return o.from&&o.to?s=n>=o.from&&n<=o.to:s=o.codes.indexOf(n)!==-1,s});r&&(i=vu.getLevel(r.level,i))}return i}dF.exports=function(e,t){typeof t=="string"||typeof t=="function"?t={format:t}:t=t||{};let i=e,r=vu.getLevel(t.level,vu.INFO),o=t.format||Zoe,s=Xoe(t.nolog);return(a,l,u)=>{if(a._logging||s&&s.test(a.originalUrl))return u();if(i.isLevelEnabled(r)||t.level==="auto"){let c=new Date,{writeHead:h}=l;a._logging=!0,l.writeHead=(d,g)=>{l.writeHead=h,l.writeHead(d,g),l.__statusCode=d,l.__headers=g||{}},l.on("finish",()=>{l.responseTime=new Date-c,l.statusCode&&t.level==="auto"&&(r=vu.INFO,l.statusCode>=300&&(r=vu.WARN),l.statusCode>=400&&(r=vu.ERROR)),r=Uoe(l.statusCode,r,t.statusRules);let d=$oe(a,l,t.tokens||[]);if(t.context&&i.addContext("res",l),typeof o=="function"){let g=o(a,l,f=>hF(f,d));g&&i.log(r,g)}else i.log(r,hF(o,d));t.context&&i.remove
see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat:i,destStat:r}=ld.checkPathsSync(n,e,"copy");return ld.checkParentPathsSync(n,i,e,"copy"),Tse(r,n,e,t)}function Tse(n,e,t,i){if(i.filter&&!i.filter(e,t))return;let r=ad.dirname(t);return ki.existsSync(r)||xse(r),NF(n,e,t,i)}function NF(n,e,t,i){if(!(i.filter&&!i.filter(e,t)))return kse(n,e,t,i)}function kse(n,e,t,i){let o=(i.dereference?ki.statSync:ki.lstatSync)(e);if(o.isDirectory())return Ise(o,n,e,t,i);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return Dse(o,n,e,t,i);if(o.isSymbolicLink())return Ose(n,e,t,i)}function Dse(n,e,t,i,r){return e?Ese(n,t,i,r):HF(n,t,i,r)}function Ese(n,e,t,i){if(i.overwrite)return ki.unlinkSync(t),HF(n,e,t,i);if(i.errorOnExist)throw new Error(`'${t}' already exists`)}function HF(n,e,t,i){return ki.copyFileSync(e,t),i.preserveTimestamps&&_se(n.mode,e,t),tS(t,n.mode)}function _se(n,e,t){return Pse(n)&&Rse(t,n),Lse(e,t)}function Pse(n){return(n&128)===0}function Rse(n,e){return tS(n,e|128)}function tS(n,e){return ki.chmodSync(n,e)}function Lse(n,e){let t=ki.statSync(n);return Cse(e,t.atime,t.mtime)}function Ise(n,e,t,i,r){if(!e)return jse(n.mode,t,i,r);if(e&&!e.isDirectory())throw new Error(`Cannot overwrite non-directory '${i}' with directory '${t}'.`);return qF(t,i,r)}function jse(n,e,t,i){return ki.mkdirSync(t),qF(e,t,i),tS(t,n)}function qF(n,e,t){ki.readdirSync(n).forEach(i=>Fse(i,n,e,t))}function Fse(n,e,t,i){let r=ad.join(e,n),o=ad.join(t,n),{destStat:s}=ld.checkPathsSync(r,o,"copy");return NF(s,r,o,i)}function Ose(n,e,t,i){let r=ki.readlinkSync(e);if(i.dereference&&(r=ad.resolve(process.cwd(),r)),n){let o;try{o=ki.readlinkSync(t)}catch(s){if(s.code==="EINVAL"||s.code==="UNKNOWN")return ki.symlinkSync(r,t);throw s}if(i.dereference&&(o=ad.resolve(process.cwd(),o)),ld.isSrcSubdir(r,o))throw new Error(`Cannot copy '${r}' to a subdirectory of itself, '${o}'.`);if(ki.statSync(t).isDirectory()&&ld.isSrcSubdir(o,r))throw new Error(`Cannot overwrite '${o}' with '${r}'.`);return Mse(r,t)}else return ki.symlinkSync(r,t)}function Mse(n,e){return ki.unlinkSync(e),ki.symlinkSync(n,e)}BF.exports=Sse});var iS=m((ZEe,WF)=>{"use strict";WF.exports={copySync:YF()}});var js=m((JEe,JF)=>{"use strict";var Ase=gt().fromPromise,ZF=od();function Nse(n){return ZF.access(n).then(()=>!0).catch(()=>!1)}JF.exports={pathExists:Ase(Nse),pathExistsSync:ZF.existsSync}});var eO=m(($Ee,VF)=>{"use strict";var on=Ge(),ud=require("path"),Hse=vr().mkdirs,qse=js().pathExists,Bse=QC().utimesMillis,cd=sd();function Yse(n,e,t,i){typeof t=="function"&&!i?(i=t,t={}):typeof t=="function"&&(t={filter:t}),i=i||function(){},t=t||{},t.clobber="clobber"in t?!!t.clobber:!0,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
see https://github.com/jprichardson/node-fs-extra/issues/269`),cd.checkPaths(n,e,"copy",(r,o)=>{if(r)return i(r);let{srcStat:s,destStat:a}=o;cd.checkParentPaths(n,s,e,"copy",l=>l?i(l):t.filter?GF($F,a,n,e,t,i):$F(a,n,e,t,i))})}function $F(n,e,t,i,r){let o=ud.dirname(t);qse(o,(s,a)=>{if(s)return r(s);if(a)return nS(n,e,t,i,r);Hse(o,l=>l?r(l):nS(n,e,t,i,r))})}function GF(n,e,t,i,r,o){Promise.resolve(r.filter(t,i)).then(s=>s?n(e,t,i,r,o):o(),s=>o(s))}function nS(n,e,t,i,r){return i.filter?GF(XF,n,e,t,i,r):XF(n,e,t,i,r)}function XF(n,e,t,i,r){(i.dereference?on.stat:on.lstat)(e,(s,a)=>{if(s)return r(s);if(a.isDirectory())return Gse(a,n,e,t,i,r);if(a.isFile()||a.isCharacterDevice()||a.isBlockDevice())return Wse(a,n,e,t,i,r);if(a.isSymbolicLink())return Qse(n,e,t,i,r)})}function Wse(n,e,t,i,r,o){return e?Zse(n,t,i,r,o):KF(n,t,i,r,o)}function Zse(n,e,t,i,r){if(i.overwrite)on.unlink(t,o=>o?r(o):KF(n,e,t,i,r));else return i.errorOnExist?r(new Error(`'${t}' already exists`)):r()}function KF(n,e,t,i,r){on.copyFile(e,t,o=>o?r(o):i.preserveTimestamps?Jse(n.mode,e,t,r):Up(t,n.mode,r))}function Jse(n,e,t,i){return $se(n)?Xse(t,n,r=>r?i(r):UF(n,e,t,i)):UF(n,e,t,i)}function $se(n){return(n&128)===0}function Xse(n,e,t){return Up(n,e|128,t)}function UF(n,e,t,i){Use(e,t,r=>r?i(r):Up(t,n,i))}function Up(n,e,t){return on.chmod(n,e,t)}function Use(n,e,t){on.stat(n,(i,r)=>i?t(i):Bse(e,r.atime,r.mtime,t))}function Gse(n,e,t,i,r,o){return e?e&&!e.isDirectory()?o(new Error(`Cannot overwrite non-directory '${i}' with directory '${t}'.`)):zF(t,i,r,o):Kse(n.mode,t,i,r,o)}function Kse(n,e,t,i,r){on.mkdir(t,o=>{if(o)return r(o);zF(e,t,i,s=>s?r(s):Up(t,n,r))})}function zF(n,e,t,i){on.readdir(n,(r,o)=>r?i(r):QF(o,n,e,t,i))}function QF(n,e,t,i,r){let o=n.pop();return o?zse(n,o,e,t,i,r):r()}function zse(n,e,t,i,r,o){let s=ud.join(t,e),a=ud.join(i,e);cd.checkPaths(s,a,"copy",(l,u)=>{if(l)return o(l);let{destStat:c}=u;nS(c,s,a,r,h=>h?o(h):QF(n,t,i,r,o))})}function Qse(n,e,t,i,r){on.readlink(e,(o,s)=>{if(o)return r(o);if(i.dereference&&(s=ud.resolve(process.cwd(),s)),n)on.readlink(t,(a,l)=>a?a.code==="EINVAL"||a.code==="UNKNOWN"?on.symlink(s,t,r):r(a):(i.dereference&&(l=ud.resolve(process.cwd(),l)),cd.isSrcSubdir(s,l)?r(new Error(`Cannot copy '${s}' to a subdirectory of itself, '${l}'.`)):n.isDirectory()&&cd.isSrcSubdir(l,s)?r(new Error(`Cannot overwrite '${l}' with '${s}'.`)):Vse(s,t,r)));else return on.symlink(s,t,r)})}function Vse(n,e,t){on.unlink(e,i=>i?t(i):on.symlink(n,e,t))}VF.exports=Yse});var rS=m((XEe,tO)=>{"use strict";var eae=gt().fromCallback;tO.exports={copy:eae(eO())}});var cO=m((UEe,uO)=>{"use strict";var iO=Ge(),sO=require("path"),at=require("assert"),hd=process.platform==="win32";function aO(n){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(t=>{n[t]=n[t]||iO[t],t=t+"Sync",n[t]=n[t]||iO[t]}),n.maxBusyTries=n.maxBusyTries||3}function oS(n,e,t){let i=0;typeof e=="function"&&(t=e,e={}),at(n,"rimraf: missing path"),at.strictEqual(typeof n,"string","rimraf: path should be a string"),at.strictEqual(typeof t,"function","rimraf: callback function required"),at(e,"rimraf: invalid options argument provided"),at.strictEqual(typeof e,"object","rimraf: options should be object"),aO(e),nO(n,e,function r(o){if(o){if((o.code==="EBUSY"||o.code==="ENOTEMPTY"||o.code==="EPERM")&&i<e.maxBusyTries){i++;let s=i*100;return setTimeout(()=>nO(n,e,r),s)}o.code==="ENOENT"&&(o=null)}t(o)})}function nO(n,e,t){at(n),at(e),at(typeof t=="function"),e.lstat(n,(i,r)=>{if(i&&i.code==="ENOENT")return t(null);if(i&&i.code==="EPERM"&&hd)return rO(n,e,i,t);if(r&&r.isDirectory())return Gp(n,e,i,t);e.unlink(n,o=>{if(o){if(o.code==="ENOENT")return t(null);if(o.code==="EPERM")return hd?rO(n,e,o,t):Gp(n,e,o,t);if(o.code==="EISDIR")return Gp(n,e,o,t)}return t(o)})})}function rO(n,e,t,i){at(n),at(e),at(typeof i=="function"),e.chmod(n,438,r=>{r?i(r.code==="ENOENT"?null:t):e.stat(n,(o,s)=>{o?i(o.code==="ENOENT"?null:t):s.isDirectory()?Gp(n,e,t,i):e.unlink(n,i)})})}function oO(n,e,t){let i;at(n),at(e);try{e.chmodSync(n,438)}catch(r){if(r.code==="ENOENT")return;throw t}try{i
`+i.split(/\r?\n/).slice(3).join(`
`),e.endsWith("get_var")||this.client.logError(`request error on "${e}"`,t,s[1],i),o(l)}else r(a)})})}getArgsByPrefix(e){return this.prefix!=="nvim_"&&e[0]!=this?[lce?this.data:this,...e]:e}getVar(e){return this.request(`${this.prefix}get_var`,[e]).then(t=>t,t=>null)}setVar(e,t,i=!1){if(i){this.notify(`${this.prefix}set_var`,[e,t]);return}return this.request(`${this.prefix}set_var`,[e,t])}deleteVar(e){this.notify(`${this.prefix}del_var`,[e])}getOption(e){return this.request(`${this.prefix}get_option`,[e])}setOption(e,t,i){if(i){this.notify(`${this.prefix}set_option`,[e,t]);return}return this.request(`${this.prefix}set_option`,[e,t])}notify(e,t=[]){this.transport.notify(e,this.getArgsByPrefix(t))}};ym.BaseApi=eA});var kd=m(vm=>{"use strict";Object.defineProperty(vm,"__esModule",{value:!0});vm.Buffer=void 0;var uce=Td(),tA=class extends uce.BaseApi{constructor(){super(...arguments);this.prefix="nvim_buf_"}async attach(e=!1,t={}){return await this.request(`${this.prefix}attach`,[e,t])}async detach(){return await this.request(`${this.prefix}detach`,[])}get id(){return this.data}get length(){return this.request(`${this.prefix}line_count`,[])}get lines(){return this.getLines()}get changedtick(){return this.request(`${this.prefix}get_changedtick`,[])}get commands(){return this.getCommands()}getCommands(e={}){return this.request(`${this.prefix}get_commands`,[e])}getLines({start:e,end:t,strictIndexing:i}={start:0,end:-1,strictIndexing:!0}){let r=typeof i>"u"?!0:i;return this.request(`${this.prefix}get_lines`,[e,t,r])}setLines(e,t,i=!1){let{start:r,end:o,strictIndexing:s}=t!=null?t:{};r=r!=null?r:0,o=o!=null?o:r+1;let a=s!=null?s:!0;return this[i?"notify":"request"](`${this.prefix}set_lines`,[r,o,a,typeof e=="string"?[e]:e])}setVirtualText(e,t,i,r={}){return this.client.isVim?Promise.resolve(-1):(this.notify(`${this.prefix}set_virtual_text`,[e,t,i,r]),Promise.resolve(e))}deleteExtMark(e,t){this.client.isVim||this.notify(`${this.prefix}del_extmark`,[e,t])}async getExtMarkById(e,t,i={}){return this.client.isVim?Promise.resolve([]):this.request(`${this.prefix}get_extmark_by_id`,[e,t,i])}async getExtMarks(e,t,i,r={}){return this.client.isVim?Promise.resolve([]):this.request(`${this.prefix}get_extmarks`,[e,t,i,r])}setExtMark(e,t,i,r={}){this.client.isVim||this.notify(`${this.prefix}set_extmark`,[e,t,i,r])}insert(e,t){return this.setLines(e,{start:t,end:t,strictIndexing:!0})}replace(e,t){let i=typeof e=="string"?[e]:e;return this.setLines(i,{start:t,end:t+i.length,strictIndexing:!1})}remove(e,t,i=!1){return this.setLines([],{start:e,end:t,strictIndexing:i})}append(e){return this.setLines(e,{start:-1,end:-1,strictIndexing:!1})}get name(){return this.request(`${this.prefix}get_name`,[])}setName(e){return this.request(`${this.prefix}set_name`,[e])}get valid(){return this.request(`${this.prefix}is_valid`,[])}mark(e){return this.request(`${this.prefix}get_mark`,[e])}getKeymap(e){return this.request(`${this.prefix}get_keymap`,[e])}setKeymap(e,t,i,r={}){this.client.call("coc#compat#buf_add_keymap",[this.id,e,t,i,r],!0)}get loaded(){return this.request(`${this.prefix}is_loaded`,[])}getOffset(e){return this.request(`${this.prefix}get_offset`,[e])}addHighlight({hlGroup:e,line:t,colStart:i,colEnd:r,srcId:o}){if(!e)throw new Error("hlGroup should not empty");let s=typeof r<"u"?r:-1,a=typeof i<"u"?i:-0,l=typeof o<"u"?o:-1,u=l==0?"request":"notify",c=this[u](`${this.prefix}add_highlight`,[l,e,t,a,s]);return u==="request"?c:Promise.resolve(null)}clearHighlight(e={}){let t={srcId:-1,lineStart:0,lineEnd:-1},{srcId:i,lineStart:r,lineEnd:o}=Object.assign({},t,e);return this.notify(`${this.prefix}clear_highlight`,[i,r,o])}highlightRanges(e,t,i){this.client.call("coc#highlight#ranges",[this.id,e,t,i],!0)}clearNamespace(e,t=0,i=-1){this.client.call("coc#highlight#clear_highlight",[this.id,e,t,i],!0)}placeSign(e){let t={lnum:e.lnum};typeof e.priority=="number"&&(t.priority=e.priority),this.client.call("sign_place",[e.id||0,e.group||"",e.name,this.id,t],!0)}unplaceSign(e){let t={buffer:this.id};e.id!=null&&(t.id=e.id),this.client.call("sign_unplace",[e.group|
`}debug(e,...t){oA!="debug"||this.stream==null||this.stream.write(this.getText("debug",e,t))}info(e,...t){this.stream!=null&&this.stream.write(this.getText("info",e,t))}warn(e,...t){this.stream!=null&&this.stream.write(this.getText("warn",e,t))}error(e,...t){this.stream!=null&&this.stream.write(this.getText("error",e,t))}trace(e,...t){oA!="trace"||this.stream==null||this.stream.write(this.getText("trace",e,t))}};function wce(n){return new aA(n)}Hs.createLogger=wce});var JS=m(ZS=>{"use strict";Object.defineProperty(ZS,"__esModule",{value:!0});var xce=require("events"),Cce=Mu(),lA=process.env.NODE_CLIENT_LOG_LEVEL=="debug",_d=(0,Cce.createLogger)("transport"),uA=class extends xce.EventEmitter{constructor(e){super();this.logger=e,this.pauseLevel=0,this.paused=new Map}debug(e,...t){!lA||_d.debug(e,...t)}info(e,...t){_d.info(e,...t)}debugMessage(e){if(!lA)return;let t=e[0];t==0?_d.debug("receive request:",e.slice(1)):t==1||(t==2?_d.debug("receive notification:",e.slice(1)):_d.debug("unknown message:",e))}pauseNotification(){this.pauseLevel=this.pauseLevel+1,this.paused.set(this.pauseLevel,[])}cancelNotification(){let{pauseLevel:e}=this;e>0&&(this.paused.delete(e),this.pauseLevel=e-1)}resumeNotification(e=!1){let{pauseLevel:t}=this;if(t==0)return e?null:Promise.resolve([[],null]);let i=Error().stack;this.pauseLevel=t-1;let r=this.paused.get(t);return this.paused.delete(t),r&&r.length?new Promise((o,s)=>{if(!e)return this.request("nvim_call_atomic",[r],(a,l)=>{if(a){let u=new Error(`call_atomic error: ${a[1]}`);return u.stack=i,s(u)}if(Array.isArray(l)&&l[1]!=null){let[u,c,h]=l[1],[d,g]=r[u],f=new Error(`call_atomic request error on "${d}": ${h}`);return f.stack=i,this.logger.error(`call_atomic request error ${c} on "${d}"`,g,h,i),s(f)}o(l)});this.notify("nvim_call_atomic",[r]),o(void 0)}):e?null:Promise.resolve([[],void 0])}};ZS.default=uA});var dA=m(Un=>{"use strict";var Sce=Un&&Un.__createBinding||(Object.create?function(n,e,t,i){i===void 0&&(i=t);var r=Object.getOwnPropertyDescriptor(e,t);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(n,i,r)}:function(n,e,t,i){i===void 0&&(i=t),n[i]=e[t]}),Tce=Un&&Un.__setModuleDefault||(Object.create?function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}:function(n,e){n.default=e}),kce=Un&&Un.__importStar||function(n){if(n&&n.__esModule)return n;var e={};if(n!=null)for(var t in n)t!=="default"&&Object.prototype.hasOwnProperty.call(n,t)&&Sce(e,n,t);return Tce(e,n),e},cA=Un&&Un.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Un,"__esModule",{value:!0});Un.NvimTransport=void 0;var Io=kce(z1()),Dce=cA(V1()),Ece=rA(),_ce=cA(JS()),hA=class extends _ce.default{constructor(e){super(e);this.pending=new Map,this.nextRequestId=1,this.attached=!1;let t=this.setupCodec();this.encodeStream=Io.createEncodeStream({codec:t}),this.decodeStream=Io.createDecodeStream({codec:t}),this.decodeStream.on("data",i=>{this.parseMessage(i)}),this.decodeStream.on("end",()=>{this.detach(),this.emit("detach")})}parseMessage(e){let t=e[0];if(this.debugMessage(e),t===0)this.emit("request",e[2].toString(),e[3],this.createResponse(e[1]));else if(t===1){let i=e[1],r=this.pending.get(i);if(r){this.pending.delete(i);let o=e[2];o&&o.length!=2&&(o=[0,o instanceof Error?o.message:o]),r(o,e[3])}}else t===2?this.emit("notification",e[1].toString(),e[2]):console.error(`Invalid message type ${t}`)}setupCodec(){let e=Io.createCodec();return Ece.Metadata.forEach(({constructor:t},i)=>{e.addExtPacker(i,t,r=>Io.encode(r.data)),e.addExtUnpacker(i,r=>new t({transport:this,client:this.client,data:Io.decode(r)}))}),this.codec=e,this.codec}attach(e,t,i){this.encodeStream=this.encodeStream.pipe(e);let r=new Dce.default;t.pipe(r).pipe(this.decodeStream),this.writer=e,this.reader=t,this.client=i,this.attached=!0}detach(){!this.attached||(this.attached=!1,this.encodeStream.unpipe(this.writer),this.reader.unpipe(this.decodeStream))}request(e,t,i){if(!this.attached)return;let r=this.nextRequestId;this.nextRequ
`)}catch{Au.error("Send error:",e)}}redraw(e){this.send(["redraw",e?"force":""])}command(e){this.send(["ex",e])}expr(e){this.send(["expr",e])}call(e,t,i){if(!i){this.send(["call",e,t]);return}this.send(["call",e,t,i])}dispose(){this.removeAllListeners()}};Pd.default=fA});var bA=m($S=>{"use strict";Object.defineProperty($S,"__esModule",{value:!0});var Ice=Mu(),V0e=(0,Ice.createLogger)("request"),jce=process.env.COC_NVIM=="1"?"coc#api#call":"nvim#api#call",mA=class{constructor(e,t,i){this.connection=e,this.cb=t,this.id=i}request(e,t=[]){this.method=e,this.connection.call(jce,[e.slice(5),t],this.id)}callback(e,t,i){let{method:r,cb:o}=this;if(t)return o([0,t.toString()]);switch(r){case"nvim_list_wins":case"nvim_tabpage_list_wins":return o(null,i.map(s=>e.createWindow(s)));case"nvim_tabpage_get_win":case"nvim_get_current_win":case"nvim_open_win":return o(null,e.createWindow(i));case"nvim_list_bufs":return o(null,i.map(s=>e.createBuffer(s)));case"nvim_win_get_buf":case"nvim_create_buf":case"nvim_get_current_buf":return o(null,e.createBuffer(i));case"nvim_list_tabpages":return o(null,i.map(s=>e.createTabpage(s)));case"nvim_get_current_tabpage":return o(null,e.createTabpage(i));default:return o(null,i)}}};$S.default=mA});var vA=m(Nu=>{"use strict";var XS=Nu&&Nu.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Nu,"__esModule",{value:!0});Nu.VimTransport=void 0;var Fce=XS(JS()),Oce=XS(pA()),Mce=XS(bA()),yA=class extends Fce.default{constructor(e){super(e);this.pending=new Map,this.nextRequestId=-1,this.attached=!1,this.errText="",this.outText="",this.notifyMethod=process.env.COC_NVIM=="1"?"coc#api#notify":"nvim#api#notify"}attach(e,t,i){let r=this.connection=new Oce.default(t,e);this.attached=!0,this.client=i,r.on("request",(o,s)=>{let[a,l]=s;this.emit("request",a,l,this.createResponse(o))}),r.on("notification",o=>{let[s,a]=o;this.emit("notification",s.toString(),a)}),r.on("response",(o,s)=>{let a=this.pending.get(o);if(a){this.pending.delete(o);let l=null,u=null;Array.isArray(s)?(l=s[0],u=s[1]):l=s,a.callback(this.client,l,u)}})}send(e){this.connection.send(e)}detach(){!this.attached||(this.attached=!1,this.connection.dispose())}request(e,t,i){if(!this.attached)return i([0,"transport disconnected"]);let r=this.nextRequestId;this.nextRequestId=this.nextRequestId-1;let o=Date.now();this.debug("request to vim:",r,e,t);let s=setTimeout(()=>{this.debug("request to vim cost more than 1s",e,t)},1e3),a=new Mce.default(this.connection,(l,u)=>{clearTimeout(s),this.debug("response from vim cost:",r,`${Date.now()-o}ms`),i(l,u)},r);this.pending.set(r,a),a.request(e,t)}notify(e,t){if(!this.attached)return;if(this.pauseLevel!=0){let r=this.paused.get(this.pauseLevel);if(r){r.push([e,t]);return}}let i=e.slice(5);if(i=="err_write"){this.errText=this.errText+t[0].toString();return}if(i=="out_write"){let r=t[0].toString()||"";if(!r.includes(`
`))this.outText=this.outText+r;else{let o=this.outText+t[0].toString();this.outText="",this.connection.call(this.notifyMethod,[i,[o]])}return}if(i=="err_writeln"){let r=this.errText+t[0].toString();this.errText="",this.connection.call(this.notifyMethod,[i,[r]]);return}this.connection.call(this.notifyMethod,[i,t])}createResponse(e){let t=!1,{connection:i}=this,r=Date.now(),o=setTimeout(()=>{this.debug("request to client cost more than 1s",e)},1e3);return{send:(s,a)=>{if(clearTimeout(o),t||!this.attached)return;t=!0;let l=null;a&&(l=typeof s=="string"?s:s.toString()),this.debug("response of client cost:",e,`${Date.now()-r}ms`),i.response(e,[l,a?null:s])}}}};Nu.VimTransport=yA});var xA=m(Cm=>{"use strict";Object.defineProperty(Cm,"__esModule",{value:!0});Cm.Neovim=void 0;var Ace=Td(),Nce=kd(),Hce=Ed(),qce=Dd(),Bce=process.env.VIM_NODE_RPC=="1",wA=class extends Ace.BaseApi{constructor(){super(...arguments);this.prefix="nvim_",this.Buffer=Nce.Buffer,this.Window=qce.Window,this.Tabpage=Hce.Tabpage}getArgs(e){return e?Array.isArray(e)?e:[e]:[]}get apiInfo(){return this.request(`${this.prefix}get_api_info`)}get buffers(){return this.request(`${this.prefix}list_bufs`)}get buffer(){return this.request(`${this.prefix}get_current_buf`)}async setBuffer(e){await this.request(`${this.prefix}set_current_buf`,[e])}get chans(){return this.request(`${this.prefix}list_chans`)}getChanInfo(e){return this.request(`${this.prefix}get_chan_info`,[e])}createNamespace(e=""){return process.env.COC_NVIM=="1"?(e=e.startsWith("coc-")?e.slice(4):e,this.request(`${this.prefix}call_function`,["coc#highlight#create_namespace",[e]])):this.request(`${this.prefix}create_namespace`,[e])}get namespaces(){return this.request(`${this.prefix}get_namespaces`,[])}get commands(){return this.getCommands()}getCommands(e={}){return this.request(`${this.prefix}get_commands`,[e])}get tabpages(){return this.request(`${this.prefix}list_tabpages`)}get tabpage(){return this.request(`${this.prefix}get_current_tabpage`)}async setTabpage(e){await this.request(`${this.prefix}set_current_tabpage`,[e])}get windows(){return this.getWindows()}get window(){return this.request(`${this.prefix}get_current_win`)}getWindows(){return this.request(`${this.prefix}list_wins`)}async setWindow(e){await this.request(`${this.prefix}set_current_win`,[e])}get runtimePaths(){return this.request(`${this.prefix}list_runtime_paths`)}setDirectory(e){return this.request(`${this.prefix}set_current_dir`,[e])}get line(){return this.getLine()}createNewBuffer(e=!1,t=!1){return this.request(`${this.prefix}create_buf`,[e,t])}openFloatWindow(e,t,i){return this.request(`${this.prefix}open_win`,[e,t,i])}getLine(){return this.request(`${this.prefix}get_current_line`)}setLine(e){return this.request(`${this.prefix}set_current_line`,[e])}getKeymap(e){return this.request(`${this.prefix}get_keymap`,[e])}get mode(){return this.request(`${this.prefix}get_mode`)}get colorMap(){return this.request(`${this.prefix}get_color_map`)}getColorByName(e){return this.request(`${this.prefix}get_color_by_name`,[e])}getHighlight(e,t=!0){let i=typeof e=="string"?"by_name":"by_id";return this.request(`${this.prefix}get_hl_${i}`,[e,t])}getHighlightByName(e,t=!0){return this.request(`${this.prefix}get_hl_by_name`,[e,t])}getHighlightById(e,t=!0){return this.request(`${this.prefix}get_hl_by_id`,[e,t])}deleteCurrentLine(){return this.request(`${this.prefix}del_current_line`)}eval(e){return this.request(`${this.prefix}eval`,[e])}lua(e,t=[]){return this.request(`${this.prefix}exec_lua`,[e,t])}executeLua(e,t=[]){let i=this.getArgs(t);return this.lua(e,i)}callDictFunction(e,t,i=[]){let r=this.getArgs(i);return this.request(`${this.prefix}call_dict_function`,[e,t,r])}call(e,t=[],i){let r=this.getArgs(t);return i?(this.notify(`${this.prefix}call_function`,[e,r]),null):this.request(`${this.prefix}call_function`,[e,r])}callTimer(e,t=[],i){let r=this.getArgs(t);return i?(this.notify(`${this.prefix}call_function`,["coc#util#timer",[e,r]]),null):Bce?(this.notify(`${this.prefix}call_function`,["coc#util#timer",[e,r]]),new Promise(o=>{setTimeout(()=>{o(nul
`)}errWrite(e){this.notify(`${this.prefix}err_write`,[e])}errWriteLine(e){this.notify(`${this.prefix}err_writeln`,[e])}get uis(){return this.request(`${this.prefix}list_uis`)}uiAttach(e,t,i){return this.request(`${this.prefix}ui_attach`,[e,t,i])}uiDetach(){return this.request(`${this.prefix}ui_detach`,[])}uiTryResize(e,t){return this.request(`${this.prefix}ui_try_resize`,[e,t])}uiSetOption(e,t){return this.request(`${this.prefix}ui_set_option`,[e,t])}subscribe(e){return this.request(`${this.prefix}subscribe`,[e])}unsubscribe(e){return this.request(`${this.prefix}unsubscribe`,[e])}setClientInfo(e,t,i,r,o){this.notify(`${this.prefix}set_client_info`,[e,t,i,r,o])}async quit(){this.command("qa!",!0),this.transport&&this.transport.detach()}};Cm.Neovim=wA});var Tm=m(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});Hu.NeovimClient=Hu.AsyncResponse=void 0;var Yce=dA(),Wce=vA(),Zce=xA(),Jce=kd(),$ce=Dd(),Xce=Ed(),Uce=Mu(),CA=(0,Uce.createLogger)("client"),Sm=process.env.VIM_NODE_RPC=="1",US=class{constructor(e,t){this.requestId=e,this.cb=t,this.finished=!1}finish(e,t){if(!this.finished){if(this.finished=!0,e){this.cb(new Error(e));return}this.cb(null,t)}}};Hu.AsyncResponse=US;var SA=class extends Zce.Neovim{constructor(e){super({});this.logger=e,this.requestId=1,this.responses=new Map,this.attachedBuffers=new Map,this.isVim=Sm,Object.defineProperty(this,"client",{value:this});let t=Sm?new Wce.VimTransport(e):new Yce.NvimTransport(e);this.setTransport(t),this.transportAttached=!1,this.handleRequest=this.handleRequest.bind(this),this.handleNotification=this.handleNotification.bind(this)}echoError(e){let t=process.env.COC_NVIM=="1"?"[coc.nvim] ":"";e instanceof Error?(this.errWriteLine(t+e.message+" use :CocOpenLog for details"),this.logError(e.message||"Unknown error",e.stack)):(this.errWriteLine(t+e),this.logError(e.toString(),Error().stack))}logError(e,...t){!this.logger||this.logger.error(e,...t)}createBuffer(e){return new Jce.Buffer({transport:this.transport,data:e,client:this})}createWindow(e){return new $ce.Window({transport:this.transport,data:e,client:this})}createTabpage(e){return new Xce.Tabpage({transport:this.transport,data:e,client:this})}send(e){this.transport.send(e)}redrawVim(e){!Sm||this.transport.notify("nvim_command",["redraw"+(e?"!":"")])}attach({reader:e,writer:t},i=!0){this.transport.attach(t,e,this),this.transportAttached=!0,this.setupTransport(i)}detach(){this.transport.detach(),this.transportAttached=!1}get isApiReady(){return this.transportAttached&&typeof this._channelId<"u"}get channelId(){return this._isReady.then(()=>this._channelId)}isAttached(e){return this.attachedBuffers.has(e)}handleRequest(e,t,i){this.emit("request",e,t,i)}sendAsyncRequest(e,t){let i=this.requestId;return this.requestId=i+1,this.notify("nvim_call_function",["coc#rpc#async_request",[i,e,t||[]]]),new Promise((r,o)=>{let s=new US(i,(a,l)=>{if(a)return o(a);r(l)});this.responses.set(i,s)})}emitNotification(e,t){if(e.endsWith("_event")){if(e.startsWith("nvim_buf_")){let i=e.replace(/nvim_buf_(.*)_event/,"$1"),{id:r}=t[0];if(!this.attachedBuffers.has(r))return;(this.attachedBuffers.get(r).get(i)||[]).forEach(a=>a(...t)),i==="detach"&&this.attachedBuffers.delete(r);return}if(e.startsWith("nvim_async_request")){let[i,r,o]=t;this.handleRequest(r,o,{send:(s,a)=>{this.notify("nvim_call_function",["coc#rpc#async_response",[i,s,a]])}});return}if(e.startsWith("nvim_async_response")){let[i,r,o]=t,s=this.responses.get(i);if(!s){console.error(`Response not found for request ${i}`);return}this.responses.delete(i),s.finish(r,o);return}if(e==="nvim_error_event"){this.logger.error("Error event from nvim:",t[0],t[1]);return}this.logger.debug(`Unhandled event: ${e}`,t)}else this.emit("notification",e,t)}handleNotification(e,t){this.emitNotification(e,t)}setupTransport(e=!0){if(!this.transportAttached)throw new Error("Not attached to input/output");this.transport.on("request",this.handleRequest),this.transport.on("notification",this.handleNotification),this.transport.on("detach",()=>{this.emit("disconnect"),this.transport.removeAllLi
`,EA=class{constructor(e="utf-8"){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){let t=typeof e=="string"?this.fromString(e,this._encoding):e;this._chunks.push(t),this._totalLength+=t.byteLength}tryReadHeaders(){if(this._chunks.length===0)return;let e=0,t=0,i=0,r=0;e:for(;t<this._chunks.length;){let l=this._chunks[t];i=0;t:for(;i<l.length;){switch(l[i]){case she:switch(e){case 0:e=1;break;case 2:e=3;break;default:e=0}break;case ahe:switch(e){case 1:e=2;break;case 3:e=4,i++;break e;default:e=0}break;default:e=0}i++}r+=l.byteLength,t++}if(e!==4)return;let o=this._read(r+i),s=new Map,a=this.toString(o,"ascii").split(lhe);if(a.length<2)return s;for(let l=0;l<a.length-2;l++){let u=a[l],c=u.indexOf(":");if(c===-1)throw new Error("Message header must separate key and value using :");let h=u.substr(0,c),d=u.substr(c+1).trim();s.set(h,d)}return s}tryReadBody(e){if(!(this._totalLength<e))return this._read(e)}get numberOfBytes(){return this._totalLength}_read(e){if(e===0)return this.emptyBuffer();if(e>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===e){let o=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(o)}if(this._chunks[0].byteLength>e){let o=this._chunks[0],s=this.asNative(o,e);return this._chunks[0]=o.slice(e),this._totalLength-=e,s}let t=this.allocNative(e),i=0,r=0;for(;e>0;){let o=this._chunks[r];if(o.byteLength>e){let s=o.slice(0,e);t.set(s,i),i+=e,this._chunks[r]=o.slice(e),this._totalLength-=e,e-=e}else t.set(o,i),i+=o.byteLength,this._chunks.shift(),this._totalLength-=o.byteLength,e-=o.byteLength}return t}};Dm.AbstractMessageBuffer=EA});var jA=m(eT=>{"use strict";Object.defineProperty(eT,"__esModule",{value:!0});var uhe=jo(),PA=require("util"),il=QS(),che=_A(),Id=class extends che.AbstractMessageBuffer{constructor(e="utf-8"){super(e)}emptyBuffer(){return Id.emptyBuffer}fromString(e,t){return Buffer.from(e,t)}toString(e,t){return e instanceof Buffer?e.toString(t):new PA.TextDecoder(t).decode(e)}asNative(e,t){return t===void 0?e instanceof Buffer?e:Buffer.from(e):e instanceof Buffer?e.slice(0,t):Buffer.from(e,0,t)}allocNative(e){return Buffer.allocUnsafe(e)}};Id.emptyBuffer=Buffer.allocUnsafe(0);var RA=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),il.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),il.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),il.Disposable.create(()=>this.stream.off("end",e))}onData(e){return this.stream.on("data",e),il.Disposable.create(()=>this.stream.off("data",e))}},LA=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),il.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),il.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),il.Disposable.create(()=>this.stream.off("end",e))}write(e,t){return new Promise((i,r)=>{let o=s=>{s==null?i():r(s)};typeof e=="string"?this.stream.write(e,t,o):this.stream.write(e,o)})}end(){this.stream.end()}},IA=Object.freeze({messageBuffer:Object.freeze({create:n=>new Id(n)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(n,e)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(n,void 0,0),e.charset))}catch(t){return Promise.reject(t)}}}),decoder:Object.freeze({name:"application/json",decode:(n,e)=>{try{return n instanceof Buffer?Promise.resolve(JSON.parse(n.toString(e.charset))):Promise.resolve(JSON.parse(new PA.TextDecoder(e.charset).decode(n)))}catch(t){return Promise.reject(t)}}})}),stream:Object.freeze({asReadableStream:n=>new RA(n),asWritableStream:n=>new LA(n)}),console,timer:Object.freeze({setTimeout(n,e,...t){return setTimeout(n,e,...t)},clearTimeout(n){clearTimeout(n)},setImmediate(n,...e){return setImmediate(n,...e)},clearImmediate(n){clearImmediate(n)}})});function VS(){return IA}(function(n){function e(){uhe.default.install(IA)}n.install=e})(VS||(VS={}));eT.def
`,Ehe;(function(n){function e(t){let i=t;return i&&Fd.func(i.dispose)&&Fd.func(i.onClose)&&Fd.func(i.onError)&&Fd.func(i.write)}n.is=e})(Ehe=Oo.MessageWriter||(Oo.MessageWriter={}));var cT=class{constructor(){this.errorEmitter=new gN.Emitter,this.closeEmitter=new gN.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,t,i){this.errorEmitter.fire([this.asError(e),t,i])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(e){return e instanceof Error?e:new Error(`Writer received error. Reason: ${Fd.string(e.message)?e.message:"unknown"}`)}};Oo.AbstractMessageWriter=cT;var uT;(function(n){function e(t){var i,r;return t===void 0||typeof t=="string"?{charset:t!=null?t:"utf-8",contentTypeEncoder:dN.default().applicationJson.encoder}:{charset:(i=t.charset)!==null&&i!==void 0?i:"utf-8",contentEncoder:t.contentEncoder,contentTypeEncoder:(r=t.contentTypeEncoder)!==null&&r!==void 0?r:dN.default().applicationJson.encoder}}n.fromOptions=e})(uT||(uT={}));var pN=class extends cT{constructor(e,t){super();this.writable=e,this.options=uT.fromOptions(t),this.errorCount=0,this.writeSemaphore=new khe.Semaphore(1),this.writable.onError(i=>this.fireError(i)),this.writable.onClose(()=>this.fireClose())}async write(e){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(e,this.options).then(i=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(i):i).then(i=>{let r=[];return r.push(Dhe,i.byteLength.toString(),fN),r.push(fN),this.doWrite(e,r,i)},i=>{throw this.fireError(i),i}))}async doWrite(e,t,i){try{return await this.writable.write(t.join(""),"ascii"),this.writable.write(i)}catch(r){return this.handleError(r,e),Promise.reject(r)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){this.writable.end()}};Oo.WriteableStreamMessageWriter=pN});var yN=m(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});Mo.LRUCache=Mo.LinkedMap=Mo.Touch=void 0;var Ji;(function(n){n.None=0,n.First=1,n.AsOld=n.First,n.Last=2,n.AsNew=n.Last})(Ji=Mo.Touch||(Mo.Touch={}));var hT=class{constructor(){this[Symbol.toStringTag]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){var e;return(e=this._head)===null||e===void 0?void 0:e.value}get last(){var e;return(e=this._tail)===null||e===void 0?void 0:e.value}has(e){return this._map.has(e)}get(e,t=Ji.None){let i=this._map.get(e);if(!!i)return t!==Ji.None&&this.touch(i,t),i.value}set(e,t,i=Ji.None){let r=this._map.get(e);if(r)r.value=t,i!==Ji.None&&this.touch(r,i);else{switch(r={key:e,value:t,next:void 0,previous:void 0},i){case Ji.None:this.addItemLast(r);break;case Ji.First:this.addItemFirst(r);break;case Ji.Last:this.addItemLast(r);break;default:this.addItemLast(r);break}this._map.set(e,r),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){let t=this._map.get(e);if(!!t)return this._map.delete(e),this.removeItem(t),this._size--,t.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){let i=this._state,r=this._head;for(;r;){if(t?e.bind(t)(r.value,r.key,this):e(r.value,r.key,this),this._state!==i)throw new Error("LinkedMap got modified during iteration.");r=r.next}}keys(){let e=this,t=this._state,i=this._head,r={[Symbol.iterator](){return r},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(i){let o={value:i.key,done:!1};return i=i.next,o}else return{value:void 0,done:!0}}};return r}values(){let e=this,t=this._state,i=this._head,r={[Symbol.iterator](){return r},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(i){let o={value:i.value,done:!1};return i=i.next,o}else return{
${JSON.stringify(E.error,void 0,4)}`):r.error("Received response message without id. No further error information provided.");else{let $=String(E.id),G=b[$];if(Dn(E,G),G){delete b[$];try{if(E.error){let ue=E.error;G.reject(new pe.ResponseError(ue.code,ue.message,ue.data))}else if(E.result!==void 0)G.resolve(E.result);else throw new Error("Should never happen.")}catch(ue){ue.message?r.error(`Response handler '${G.method}' failed with message: ${ue.message}`):r.error(`Response handler '${G.method}' failed unexpectedly.`)}}}}function Re(E){if(Tt())return;let $,G;if(E.method===Md.type.method)G=ue=>{let Ye=ue.id,Lt=y[String(Ye)];Lt&&Lt.cancel()};else{let ue=d[E.method];ue&&(G=ue.handler,$=ue.type)}if(G||h)try{fr(E),G?E.params===void 0?($!==void 0&&$.numberOfParams!==0&&$.parameterStructures!==pe.ParameterStructures.byName&&r.error(`Notification ${E.method} defines ${$.numberOfParams} params but recevied none.`),G()):Array.isArray(E.params)?($!==void 0&&($.parameterStructures===pe.ParameterStructures.byName&&r.error(`Notification ${E.method} defines parameters by name but received parameters by position`),$.numberOfParams!==E.params.length&&r.error(`Notification ${E.method} defines ${$.numberOfParams} params but received ${E.params.length} argumennts`)),G(...E.params)):($!==void 0&&$.parameterStructures===pe.ParameterStructures.byPosition&&r.error(`Notification ${E.method} defines parameters by position but received parameters by name`),G(E.params)):h&&h(E.method,E.params)}catch(ue){ue.message?r.error(`Notification handler '${E.method}' failed with message: ${ue.message}`):r.error(`Notification handler '${E.method}' failed unexpectedly.`)}else W.fire(E)}function Te(E){if(!E){r.error("Received empty message.");return}r.error(`Received message which is neither a response nor a notification message:
${JSON.stringify(E,null,4)}`);let $=E;if(oi.string($.id)||oi.number($.id)){let G=String($.id),ue=b[G];ue&&ue.reject(new Error("The received response has neither a result nor an error property."))}}function ke(E){if(!(w===Wt.Off||!k))if(x===xr.Text){let $;w===Wt.Verbose&&E.params&&($=`Params: ${JSON.stringify(E.params,null,4)}
`),k.log(`Sending request '${E.method} - (${E.id})'.`,$)}else ms("send-request",E)}function Le(E){if(!(w===Wt.Off||!k))if(x===xr.Text){let $;w===Wt.Verbose&&(E.params?$=`Params: ${JSON.stringify(E.params,null,4)}
`:$=`No parameters provided.
`),k.log(`Sending notification '${E.method}'.`,$)}else ms("send-notification",E)}function Rt(E,$,G){if(!(w===Wt.Off||!k))if(x===xr.Text){let ue;w===Wt.Verbose&&(E.error&&E.error.data?ue=`Error data: ${JSON.stringify(E.error.data,null,4)}
`:E.result?ue=`Result: ${JSON.stringify(E.result,null,4)}
`:E.error===void 0&&(ue=`No result returned.
`)),k.log(`Sending response '${$} - (${E.id})'. Processing request took ${Date.now()-G}ms`,ue)}else ms("send-response",E)}function gr(E){if(!(w===Wt.Off||!k))if(x===xr.Text){let $;w===Wt.Verbose&&E.params&&($=`Params: ${JSON.stringify(E.params,null,4)}
`),k.log(`Received request '${E.method} - (${E.id})'.`,$)}else ms("receive-request",E)}function fr(E){if(!(w===Wt.Off||!k||E.method===fT.type.method))if(x===xr.Text){let $;w===Wt.Verbose&&(E.params?$=`Params: ${JSON.stringify(E.params,null,4)}
`:$=`No parameters provided.
`),k.log(`Received notification '${E.method}'.`,$)}else ms("receive-notification",E)}function Dn(E,$){if(!(w===Wt.Off||!k))if(x===xr.Text){let G;if(w===Wt.Verbose&&(E.error&&E.error.data?G=`Error data: ${JSON.stringify(E.error.data,null,4)}
`:E.result?G=`Result: ${JSON.stringify(E.result,null,4)}
`:E.error===void 0&&(G=`No result returned.
`)),$){let ue=E.error?` Request failed: ${E.error.message} (${E.error.code}).`:"";k.log(`Received response '${$.method} - (${E.id})' in ${Date.now()-$.timerStart}ms.${ue}`,G)}else k.log(`Received response ${E.id} without active response promise.`,G)}else ms("receive-response",E)}function ms(E,$){if(!k||w===Wt.Off)return;let G={isLSPMessage:!0,type:E,message:$,timestamp:Date.now()};k.log(G)}function bs(){if(Ve())throw new sl(Rm.Closed,"Connection is closed.");if(Tt())throw new sl(Rm.Disposed,"Connection is disposed.")}function Tte(){if(Pe())throw new sl(Rm.AlreadyListening,"Connection is already listening")}function kte(){if(!Pe())throw new Error("Call listen() first.")}function Ah(E){return E===void 0?null:E}function QP(E){if(E!==null)return E}function VP(E){return E!=null&&!Array.isArray(E)&&typeof E=="object"}function dC(E,$){switch(E){case pe.ParameterStructures.auto:return VP($)?QP($):[Ah($)];case pe.ParameterStructures.byName:if(!VP($))throw new Error("Recevied parameters by name but param is not an object literal.");return QP($);case pe.ParameterStructures.byPosition:return[Ah($)];default:throw new Error(`Unknown parameter structure ${E.toString()}`)}}function eR(E,$){let G,ue=E.numberOfParams;switch(ue){case 0:G=void 0;break;case 1:G=dC(E.parameterStructures,$[0]);break;default:G=[];for(let Ye=0;Ye<$.length&&Ye<ue;Ye++)G.push(Ah($[Ye]));if($.length<ue)for(let Ye=$.length;Ye<ue;Ye++)G.push(null);break}return G}let au={sendNotification:(E,...$)=>{bs();let G,ue;if(oi.string(E)){G=E;let Lt=$[0],Gt=0,ii=pe.ParameterStructures.auto;pe.ParameterStructures.is(Lt)&&(Gt=1,ii=Lt);let Ze=$.length,It=Ze-Gt;switch(It){case 0:ue=void 0;break;case 1:ue=dC(ii,$[Gt]);break;default:if(ii===pe.ParameterStructures.byName)throw new Error(`Recevied ${It} parameters for 'by Name' notification parameter structure.`);ue=$.slice(Gt,Ze).map(Je=>Ah(Je));break}}else{let Lt=$;G=E.method,ue=eR(E,Lt)}let Ye={jsonrpc:l,method:G,params:ue};Le(Ye),e.write(Ye)},onNotification:(E,$)=>{bs();let G;return oi.func(E)?h=E:$&&(oi.string(E)?(G=E,d[E]={type:void 0,handler:$}):(G=E.method,d[E.method]={type:E,handler:$})),{dispose:()=>{G!==void 0?delete d[G]:h=void 0}}},onProgress:(E,$,G)=>{if(g.has($))throw new Error(`Progress handler for token ${$} already registered`);return g.set($,G),{dispose:()=>{g.delete($)}}},sendProgress:(E,$,G)=>{au.sendNotification(Lm.type,{token:$,value:G})},onUnhandledProgress:H.event,sendRequest:(E,...$)=>{bs(),kte();let G,ue,Ye;if(oi.string(E)){G=E;let Ze=$[0],It=$[$.length-1],Je=0,Kt=pe.ParameterStructures.auto;pe.ParameterStructures.is(Ze)&&(Je=1,Kt=Ze);let tn=$.length;dT.CancellationToken.is(It)&&(tn=tn-1,Ye=It);let ja=tn-Je;switch(ja){case 0:ue=void 0;break;case 1:ue=dC(Kt,$[Je]);break;default:if(Kt===pe.ParameterStructures.byName)throw new Error(`Recevied ${ja} parameters for 'by Name' request parameter structure.`);ue=$.slice(Je,tn).map(ys=>Ah(ys));break}}else{let Ze=$;G=E.method,ue=eR(E,Ze);let It=E.numberOfParams;Ye=dT.CancellationToken.is(Ze[It])?Ze[It]:void 0}let Lt=o++,Gt;return Ye&&(Gt=Ye.onCancellationRequested(()=>{I.sender.sendCancellation(au,Lt)})),new Promise((Ze,It)=>{let Je={jsonrpc:l,id:Lt,method:G,params:ue},Kt=ys=>{Ze(ys),I.sender.cleanup(Lt),Gt==null||Gt.dispose()},tn=ys=>{It(ys),I.sender.cleanup(Lt),Gt==null||Gt.dispose()},ja={method:G,timerStart:Date.now(),resolve:Kt,reject:tn};ke(Je);try{e.write(Je)}catch(ys){ja.reject(new pe.ResponseError(pe.ErrorCodes.MessageWriteError,ys.message?ys.message:"Unknown reason")),ja=null}ja&&(b[String(Lt)]=ja)})},onRequest:(E,$)=>{bs();let G=null;return gT.is(E)?(G=void 0,u=E):oi.string(E)?(G=null,$!==void 0&&(G=E,c[E]={handler:$,type:void 0})):$!==void 0&&(G=E.method,c[E.method]={type:E,handler:$}),{dispose:()=>{G!==null&&(G!==void 0?delete c[G]:u=void 0)}}},trace:(E,$,G)=>{let ue=!1,Ye=xr.Text;G!==void 0&&(oi.boolean(G)?ue=G:(ue=G.sendNotification||!1,Ye=G.traceFormat||xr.Text)),w=E,x=Ye,w===Wt.Off?k=void 0:k=$,ue&&!Ve()&&!Tt()&&au.sendNotification(CN.type,{value:Wt.toString(E)})},onError:j.event,onClose:O.event,onUnhandledNotification:W.event,onDispose:N.event,end:()=>
`,`\r
`,"\r"];(function(n){function e(o,s,a,l){return new Xhe(o,s,a,l)}n.create=e;function t(o){var s=o;return!!(B.defined(s)&&B.string(s.uri)&&(B.undefined(s.languageId)||B.string(s.languageId))&&B.uinteger(s.lineCount)&&B.func(s.getText)&&B.func(s.positionAt)&&B.func(s.offsetAt))}n.is=t;function i(o,s){for(var a=o.getText(),l=r(s,function(f,p){var b=f.range.start.line-p.range.start.line;return b===0?f.range.start.character-p.range.start.character:b}),u=a.length,c=l.length-1;c>=0;c--){var h=l[c],d=o.offsetAt(h.range.start),g=o.offsetAt(h.range.end);if(g<=u)a=a.substring(0,d)+h.newText+a.substring(g,a.length);else throw new Error("Overlapping edit");u=d}return a}n.applyEdits=i;function r(o,s){if(o.length<=1)return o;var a=o.length/2|0,l=o.slice(0,a),u=o.slice(a);r(l,s),r(u,s);for(var c=0,h=0,d=0;c<l.length&&h<u.length;){var g=s(l[c],u[h]);g<=0?o[d++]=l[c++]:o[d++]=u[h++]}for(;c<l.length;)o[d++]=l[c++];for(;h<u.length;)o[d++]=u[h++];return o}})(ok||(ok={}));Xhe=function(){function n(e,t,i,r){this._uri=e,this._languageId=t,this._version=i,this._content=r,this._lineOffsets=void 0}return Object.defineProperty(n.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),n.prototype.getText=function(e){if(e){var t=this.offsetAt(e.start),i=this.offsetAt(e.end);return this._content.substring(t,i)}return this._content},n.prototype.update=function(e,t){this._content=e.text,this._version=t,this._lineOffsets=void 0},n.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var e=[],t=this._content,i=!0,r=0;r<t.length;r++){i&&(e.push(r),i=!1);var o=t.charAt(r);i=o==="\r"||o===`
`,o==="\r"&&r+1<t.length&&t.charAt(r+1)===`
`&&r++}i&&t.length>0&&e.push(t.length),this._lineOffsets=e}return this._lineOffsets},n.prototype.positionAt=function(e){e=Math.max(Math.min(e,this._content.length),0);var t=this.getLineOffsets(),i=0,r=t.length;if(r===0)return mi.create(0,e);for(;i<r;){var o=Math.floor((i+r)/2);t[o]>e?r=o:i=o+1}var s=i-1;return mi.create(s,e-t[s])},n.prototype.offsetAt=function(e){var t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;var i=t[e.line],r=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(i+e.character,r),i)},Object.defineProperty(n.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),n}();(function(n){var e=Object.prototype.toString;function t(g){return typeof g<"u"}n.defined=t;function i(g){return typeof g>"u"}n.undefined=i;function r(g){return g===!0||g===!1}n.boolean=r;function o(g){return e.call(g)==="[object String]"}n.string=o;function s(g){return e.call(g)==="[object Number]"}n.number=s;function a(g,f,p){return e.call(g)==="[object Number]"&&f<=g&&g<=p}n.numberRange=a;function l(g){return e.call(g)==="[object Number]"&&-2147483648<=g&&g<=2147483647}n.integer=l;function u(g){return e.call(g)==="[object Number]"&&0<=g&&g<=2147483647}n.uinteger=u;function c(g){return e.call(g)==="[object Function]"}n.func=c;function h(g){return g!==null&&typeof g=="object"}n.objectLiteral=h;function d(g,f){return Array.isArray(g)&&g.every(f)}n.typedArray=d})(B||(B={}))});var si=m(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.ProtocolNotificationType=Kn.ProtocolNotificationType0=Kn.ProtocolRequestType=Kn.ProtocolRequestType0=Kn.RegistrationType=void 0;var Qu=$u(),FN=class{constructor(e){this.method=e}};Kn.RegistrationType=FN;var ON=class extends Qu.RequestType0{constructor(e){super(e)}};Kn.ProtocolRequestType0=ON;var MN=class extends Qu.RequestType{constructor(e){super(e,Qu.ParameterStructures.byName)}};Kn.ProtocolRequestType=MN;var AN=class extends Qu.NotificationType0{constructor(e){super(e)}};Kn.ProtocolNotificationType0=AN;var NN=class extends Qu.NotificationType{constructor(e){super(e,Qu.ParameterStructures.byName)}};Kn.ProtocolNotificationType=NN});var BN=m(Zt=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.objectLiteral=Zt.typedArray=Zt.stringArray=Zt.array=Zt.func=Zt.error=Zt.number=Zt.string=Zt.boolean=void 0;function Uhe(n){return n===!0||n===!1}Zt.boolean=Uhe;function HN(n){return typeof n=="string"||n instanceof String}Zt.string=HN;function Ghe(n){return typeof n=="number"||n instanceof Number}Zt.number=Ghe;function Khe(n){return n instanceof Error}Zt.error=Khe;function zhe(n){return typeof n=="function"}Zt.func=zhe;function qN(n){return Array.isArray(n)}Zt.array=qN;function Qhe(n){return qN(n)&&n.every(e=>HN(e))}Zt.stringArray=Qhe;function Vhe(n,e){return Array.isArray(n)&&n.every(e)}Zt.typedArray=Vhe;function ede(n){return n!==null&&typeof n=="object"}Zt.objectLiteral=ede});var YN=m(Yd=>{"use strict";Object.defineProperty(Yd,"__esModule",{value:!0});Yd.ImplementationRequest=void 0;var tde=si(),ide;(function(n){n.method="textDocument/implementation",n.type=new tde.ProtocolRequestType(n.method)})(ide=Yd.ImplementationRequest||(Yd.ImplementationRequest={}))});var WN=m(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});Wd.TypeDefinitionRequest=void 0;var nde=si(),rde;(function(n){n.method="textDocument/typeDefinition",n.type=new nde.ProtocolRequestType(n.method)})(rde=Wd.TypeDefinitionRequest||(Wd.TypeDefinitionRequest={}))});var JN=m(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});qs.DidChangeWorkspaceFoldersNotification=qs.WorkspaceFoldersRequest=void 0;var ZN=si(),ode;(function(n){n.type=new ZN.ProtocolRequestType0("workspace/workspaceFolders")})(ode=qs.WorkspaceFoldersRequest||(qs.WorkspaceFoldersRequest={}));var sde;(function(n){n.type=new ZN.ProtocolNotificationType("workspace/didChangeWorkspaceFolders")})(sde=qs.DidChangeWorkspaceFoldersNotification||(qs.DidChangeWorkspaceFoldersNotification={}))});var $N=m(Zd=>{"use str
${s}
${l}`));return}i(a)})})}function rc(n,e){let t=(0,XH.default)(e,100);try{let i=UH.default.watch(n,{persistent:!0,recursive:!1,encoding:"utf8"},()=>{t()});return ul.Disposable.create(()=>{t.clear(),i.close()})}catch{return ul.Disposable.create(()=>{t.clear()})}}function QH(n){try{return process.kill(n,0)==!0}catch(e){return e.code==="EPERM"}}function bk(n){return n=="n"||n=="o"||n=="x"||n=="v"?"<C-U>":n=="i"?"<C-o>":n=="s"?"<Esc>":""}function ig(n,e,t=3){if(n.length==0)return Promise.resolve();let i=0,r=n.length,o=n.slice();return new Promise(s=>{let a=l=>{let u=()=>{if(i=i+1,i==r)s();else if(o.length){let c=o.shift();a(c)}};e(l).then(u,u)};for(let l=0;l<Math.min(t,o.length);l++){let u=o.shift();a(u)}})}var $H,XH,UH,GH,mk,ul,KH,tPe,Er,z=P(()=>{"use strict";$H=require("child_process"),XH=S(_i()),UH=S(require("fs")),GH=S(hk()),mk=S(require("path")),ul=S(q());we();KH=S(Vd());nc();tPe=Y()("util-index"),Er="coc-settings.json"});function oc(n){return n&&typeof n.word=="string"&&n.user_data!==""}function zn(n){return typeof n=="boolean"}function Ee(n){return typeof n=="string"}function $m(n){return typeof n=="number"}function Zs(n){return typeof n=="function"}function Dt(n){return n!=null&&typeof n=="object"&&!Array.isArray(n)&&!(n instanceof RegExp)&&!(n instanceof Date)}function VH(n){if(!Dt(n))return!1;for(let e in n)if(Hfe.call(n,e))return!1;return!0}function yk(n,e){return Array.isArray(n)&&n.every(e)}var Hfe,jn=P(()=>{"use strict";Hfe=Object.prototype.hasOwnProperty});function _r(n){if(!n||typeof n!="object"||n instanceof RegExp)return n;let e=Array.isArray(n)?[]:{};return Object.keys(n).forEach(t=>{n[t]&&typeof n[t]=="object"?e[t]=_r(n[t]):e[t]=n[t]}),e}function eq(n){if(!n||typeof n!="object")return n;let e=[n];for(;e.length>0;){let t=e.shift();Object.freeze(t);for(let i in t)if(qfe.call(t,i)){let r=t[i];typeof r=="object"&&!Object.isFrozen(r)&&e.push(r)}}return n}function vk(n,e,t=!0){return Dt(n)?(Dt(e)&&Object.keys(e).forEach(i=>{i in n?t&&(Dt(n[i])&&Dt(e[i])?vk(n[i],e[i],t):n[i]=e[i]):n[i]=e[i]}),n):e}function _e(n,e){if(n===e)return!0;if(n==null||e===null||e===void 0||typeof n!=typeof e||typeof n!="object"||Array.isArray(n)!==Array.isArray(e))return!1;let t,i;if(Array.isArray(n)){if(n.length!==e.length)return!1;for(t=0;t<n.length;t++)if(!_e(n[t],e[t]))return!1}else{let r=[];for(i in n)r.push(i);r.sort();let o=[];for(i in e)o.push(i);if(o.sort(),!_e(r,o))return!1;for(t=0;t<r.length;t++)if(!_e(n[r[t]],e[r[t]]))return!1}return!0}var qfe,Ht=P(()=>{"use strict";jn();qfe=Object.prototype.hasOwnProperty});function tq(n,e){let t=[];for(let i=0;i<n.length;i++)n[i]==e&&t.push(i);return t}function V(n){return Buffer.byteLength(n)}function cn(n){return(n==null?void 0:n.length)>0?n[0].toUpperCase()+n.slice(1):""}function et(n,e){let t=n.slice(0,e);return Buffer.byteLength(t)}function yi(n,e){return Buffer.from(n,"utf8").slice(0,e).toString("utf8").length}function tt(n,e,t){return Buffer.from(n,"utf8").slice(e,t).toString("utf8")}function ac(n){let e=n.charCodeAt(0);return e>128?!1:!!(e==95||e>=48&&e<=57||wk(e))}function wk(n){return n>=65&&n<=90||n>=97&&n<=122}function iq(n,e){return e&&n.endsWith(`
`)?n.slice(0,-1).split(`
`):n.split(`
`)}var Fe=P(()=>{"use strict"});var lc,Bfe,nq,_,he=P(()=>{"use strict";lc=S(q());z();Ht();Fe();Bfe=Y()("events"),nq=class{constructor(){this.handlers=new Map;this._recentInserts=[];this._lastChange=0;this._insertMode=!1;this._pumAlignTop=!1;this._pumVisible=!1}get cursor(){return this._cursor}get bufnr(){return this._bufnr}get pumvisible(){return this._pumVisible}get pumAlignTop(){return this._pumAlignTop}get insertMode(){return this._insertMode}get lastChangeTs(){return this._lastChange}race(e,t){let i=[];return new Promise(r=>{if(typeof t=="number"){let o=setTimeout(()=>{J(i),r(void 0)},t);i.push(lc.Disposable.create(()=>{clearTimeout(o)}))}else lc.CancellationToken.is(t)&&t.onCancellationRequested(()=>{J(i),r(void 0)},null,i);e.forEach(o=>{this.on(o,(...s)=>{J(i),r({name:o,args:s})},null,i)})})}async fire(e,t){var r,o;let i=this.handlers.get(e);if(e=="InsertEnter")this._insertMode=!0;else if(e=="InsertLeave")this._insertMode=!1,this._pumVisible=!1,this._recentInserts=[];else if(e=="CursorHoldI"||e=="CursorMovedI")this._bufnr=t[0],this._insertMode||(this._insertMode=!0,this.fire("InsertEnter",[t[0]]));else if(e=="CursorHold"||e=="CursorMoved")this._bufnr=t[0],this._insertMode&&(this._insertMode=!1,this.fire("InsertLeave",[t[0]]));else if(e=="MenuPopupChanged")this._pumVisible=!0,this._pumAlignTop=t[1]>t[0].row;else if(e=="CompleteDone")this._pumVisible=!1;else if(e=="InsertCharPre")this._recentInserts.push([t[1],t[0]]);else if(e=="TextChanged")this._lastChange=Date.now();else if(e=="BufEnter")this._bufnr=t[0];else if(e=="TextChangedI"||e=="TextChangedP"){let s=this._recentInserts.filter(u=>u[0]==t[0]);this._bufnr=t[0],this._recentInserts=[],this._pumVisible=e=="TextChangedP",this._lastChange=Date.now();let a=t[1],l=tt((r=a.line)!=null?r:"",0,a.col-1);if(a.pre=l,this._cursor=Object.freeze({bufnr:t[0],lnum:a.lnum,col:a.col,insert:!0}),s.length&&l.length){let u=l.slice(-1);s.findIndex(c=>c[1]==u)!==-1&&(a.insertChar=u,process.nextTick(()=>{this.fire("TextInsert",[...t,u])}))}}if(e=="CursorMoved"||e=="CursorMovedI"){t.push(this._recentInserts.length>0);let s={bufnr:t[0],lnum:t[1][0],col:t[1][1],insert:e=="CursorMovedI"};if(this._cursor&&_e(this._cursor,s))return;this._cursor=Object.freeze(s)}if(i)try{t.forEach(s=>{typeof s=="object"&&Object.freeze(s)}),await Promise.all(i.slice().map(s=>s(t)))}catch(s){if(s instanceof Error&&((o=s.message)==null?void 0:o.includes("transport disconnected")))return;Bfe.error(`Error on event: ${e}`,s instanceof Error?s.stack:s)}}on(e,t,i,r){if(Array.isArray(e)){let o=r||[];for(let s of e)this.on(s,t,i,o);return lc.Disposable.create(()=>{J(o)})}else{let o=this.handlers.get(e)||[],s=l=>new Promise((u,c)=>{try{Promise.resolve(t.apply(i!=null?i:null,l)).then(()=>{u(void 0)},h=>{c(h)})}catch(h){c(h)}});o.push(s),this.handlers.set(e,o);let a=lc.Disposable.create(()=>{let l=o.indexOf(s);l!==-1&&o.splice(l,1)});return Array.isArray(r)&&r.push(a),a}}},_=new nq});function cq(){return{baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function Yfe(n){uc=n}function ai(n,e){if(e){if(Wfe.test(n))return n.replace(Zfe,rq)}else if(Jfe.test(n))return n.replace($fe,rq);return n}function hq(n){return n.replace(Ufe,(e,t)=>(t=t.toLowerCase(),t==="colon"?":":t.charAt(0)==="#"?t.charAt(1)==="x"?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}function ut(n,e){n=n.source||n,e=e||"";let t={replace:(i,r)=>(r=r.source||r,r=r.replace(Gfe,"$1"),n=n.replace(i,r),t),getRegex:()=>new RegExp(n,e)};return t}function oq(n,e,t){if(n){let i;try{i=decodeURIComponent(hq(t)).replace(Kfe,"").toLowerCase()}catch{return null}if(i.indexOf("javascript:")===0||i.indexOf("vbscript:")===0||i.indexOf("data:")===0)return null}e&&!zfe.test(t)&&(t=tpe(e,t));try{t=encodeURI(t).replace(/%25/g,"%")}catch{return null}return t}function tpe(n,e){Xm[" "+n]||(Qfe.test(n)?Xm[" "+n]=n+"/":Xm[" "+n]=Um(n,"/",!0)
`).map(r=>{let o=r.match(/^\s+/);if(o===null)return r;let[s]=o;return s.length>=i.length?r.slice(i.length):r}).join(`
`)}function rpe(n){return n.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function uq(n){let e="",t,i,r=n.length;for(t=0;t<r;t++)i=n.charCodeAt(t),Math.random()>.5&&(i="x"+i.toString(16)),e+="&#"+i+";";return e}function ge(n,e,t){if(typeof n>"u"||n===null)throw new Error("marked(): input parameter is undefined or null");if(typeof n!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected");if(typeof e=="function"&&(t=e,e=null),e=Pr({},ge.defaults,e||{}),dq(e),t){let i=e.highlight,r;try{r=Kr.lex(n,e)}catch(a){return t(a)}let o=function(a){let l;if(!a)try{e.walkTokens&&ge.walkTokens(r,e.walkTokens),l=zr.parse(r,e)}catch(u){a=u}return e.highlight=i,a?t(a):t(null,l)};if(!i||i.length<3||(delete e.highlight,!r.length))return o();let s=0;ge.walkTokens(r,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=Kr.lex(n,e);return e.walkTokens&&ge.walkTokens(i,e.walkTokens),zr.parse(i,e)}catch(i){if(i.message+=`
Please report this to https://github.com/markedjs/marked.`,e.silent)return"<p>An error occurred:</p><pre>"+ai(i.message+"",!0)+"</pre>";throw i}}var uc,Wfe,Zfe,Jfe,$fe,Xfe,rq,Ufe,Gfe,Kfe,zfe,Xm,Qfe,Vfe,epe,Gm,Km,ce,ee,Kr,zm,xk,Ck,zr,uPe,cPe,hPe,dPe,gPe,fPe,pPe,gq=P(()=>{uc=cq();Wfe=/[&<>"']/,Zfe=/[&<>"']/g,Jfe=/[<>"']|&(?!#?\w+;)/,$fe=/[<>"']|&(?!#?\w+;)/g,Xfe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},rq=n=>Xfe[n];Ufe=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;Gfe=/(^|[^\[])\^/g;Kfe=/[^\w:]/g,zfe=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;Xm={},Qfe=/^[^:]+:\/*[^/]*$/,Vfe=/^([^:]+:)[\s\S]*$/,epe=/^([^:]+:\/*[^/]*)[\s\S]*$/;Gm={exec:function(){}};Km=class{constructor(e){this.options=e||uc}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let i=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?i:Um(i,`
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let i=t[0],r=npe(i,t[3]||"");return{type:"code",raw:i,lang:t[2]?t[2].trim():t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let i=t[2].trim();if(/#$/.test(i)){let o=Um(i,"#");(this.options.pedantic||!o||/ $/.test(o))&&(i=o.trim())}let r={type:"heading",raw:t[0],depth:t[1].length,text:i,tokens:[]};return this.lexer.inline(r.text,r.tokens),r}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let i=t[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:t[0],tokens:this.lexer.blockTokens(i,[]),text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let i,r,o,s,a,l,u,c,h,d,g,f,p=t[1].trim(),b=p.length>1,y={type:"list",raw:"",ordered:b,start:b?+p.slice(0,-1):"",loose:!1,items:[]};p=b?`\\d{1,9}\\${p.slice(-1)}`:`\\${p}`,this.options.pedantic&&(p=b?p:"[*+-]");let w=new RegExp(`^( {0,3}${p})((?: [^\\n]*)?(?:\\n|$))`);for(;e&&(f=!1,!(!(t=w.exec(e))||this.rules.block.hr.test(e)));){if(i=t[0],e=e.substring(i.length),c=t[2].split(`
`,1)[0],h=e.split(`
`,1)[0],this.options.pedantic?(s=2,g=c.trimLeft()):(s=t[2].search(/[^ ]/),s=s>4?1:s,g=c.slice(s),s+=t[1].length),l=!1,!c&&/^ *$/.test(h)&&(i+=h+`
`,e=e.substring(h.length+1),f=!0),!f){let k=new RegExp(`^ {0,${Math.min(3,s-1)}}(?:[*+-]|\\d{1,9}[.)])`);for(;e&&(d=e.split(`
`,1)[0],c=d,this.options.pedantic&&(c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!k.test(c));){if(c.search(/[^ ]/)>=s||!c.trim())g+=`
`+c.slice(s);else if(!l)g+=`
`+c;else break;!l&&!c.trim()&&(l=!0),i+=d+`
`,e=e.substring(d.length+1)}}y.loose||(u?y.loose=!0:/\n *\n *$/.test(i)&&(u=!0)),this.options.gfm&&(r=/^\[[ xX]\] /.exec(g),r&&(o=r[0]!=="[ ] ",g=g.replace(/^\[[ xX]\] +/,""))),y.items.push({type:"list_item",raw:i,task:!!r,checked:o,loose:!1,text:g}),y.raw+=i}y.items[y.items.length-1].raw=i.trimRight(),y.items[y.items.length-1].text=g.trimRight(),y.raw=y.raw.trimRight();let x=y.items.length;for(a=0;a<x;a++){this.lexer.state.top=!1,y.items[a].tokens=this.lexer.blockTokens(y.items[a].text,[]);let k=y.items[a].tokens.filter(j=>j.type==="space"),L=k.every(j=>{let O=j.raw.split(""),W=0;for(let H of O)if(H===`
`&&(W+=1),W>1)return!0;return!1});!y.loose&&k.length&&L&&(y.loose=!0,y.items[a].loose=!0)}return y}}html(e){let t=this.rules.block.html.exec(e);if(t){let i={type:"html",raw:t[0],pre:!this.options.sanitizer&&(t[1]==="pre"||t[1]==="script"||t[1]==="style"),text:t[0]};return this.options.sanitize&&(i.type="paragraph",i.text=this.options.sanitizer?this.options.sanitizer(t[0]):ai(t[0]),i.tokens=[],this.lexer.inline(i.text,i.tokens)),i}}def(e){let t=this.rules.block.def.exec(e);if(t){t[3]&&(t[3]=t[3].substring(1,t[3].length-1));let i=t[1].toLowerCase().replace(/\s+/g," ");return{type:"def",tag:i,raw:t[0],href:t[2],title:t[3]}}}table(e){let t=this.rules.block.table.exec(e);if(t){let i={type:"table",header:sq(t[1]).map(r=>({text:r})),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
`):[]};if(i.header.length===i.align.length){i.raw=t[0];let r=i.align.length,o,s,a,l;for(o=0;o<r;o++)/^ *-+: *$/.test(i.align[o])?i.align[o]="right":/^ *:-+: *$/.test(i.align[o])?i.align[o]="center":/^ *:-+ *$/.test(i.align[o])?i.align[o]="left":i.align[o]=null;for(r=i.rows.length,o=0;o<r;o++)i.rows[o]=sq(i.rows[o],i.header.length).map(u=>({text:u}));for(r=i.header.length,s=0;s<r;s++)i.header[s].tokens=[],this.lexer.inlineTokens(i.header[s].text,i.header[s].tokens);for(r=i.rows.length,s=0;s<r;s++)for(l=i.rows[s],a=0;a<l.length;a++)l[a].tokens=[],this.lexer.inlineTokens(l[a].text,l[a].tokens);return i}}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let i={type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:[]};return this.lexer.inline(i.text,i.tokens),i}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let i={type:"paragraph",raw:t[0],text:t[1].charAt(t[1].length-1)===`
`?t[1].slice(0,-1):t[1],tokens:[]};return this.lexer.inline(i.text,i.tokens),i}}text(e){let t=this.rules.block.text.exec(e);if(t){let i={type:"text",raw:t[0],text:t[0],tokens:[]};return this.lexer.inline(i.text,i.tokens),i}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:ai(t[1])}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):ai(t[0]):t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let i=t[2].trim();if(!this.options.pedantic&&/^</.test(i)){if(!/>$/.test(i))return;let s=Um(i.slice(0,-1),"\\");if((i.length-s.length)%2===0)return}else{let s=ipe(t[2],"()");if(s>-1){let l=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,l).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){let s=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(r);s&&(r=s[1],o=s[3])}else o=t[3]?t[3].slice(1,-1):"";return r=r.trim(),/^</.test(r)&&(this.options.pedantic&&!/>$/.test(i)?r=r.slice(1):r=r.slice(1,-1)),lq(t,{href:r&&r.replace(this.rules.inline._escapes,"$1"),title:o&&o.replace(this.rules.inline._escapes,"$1")},t[0],this.lexer)}}reflink(e,t){let i;if((i=this.rules.inline.reflink.exec(e))||(i=this.rules.inline.nolink.exec(e))){let r=(i[2]||i[1]).replace(/\s+/g," ");if(r=t[r.toLowerCase()],!r||!r.href){let o=i[0].charAt(0);return{type:"text",raw:o,text:o}}return lq(i,r,i[0],this.lexer)}}emStrong(e,t,i=""){let r=this.rules.inline.emStrong.lDelim.exec(e);if(!r||r[3]&&i.match(/[\p{L}\p{N}]/u))return;let o=r[1]||r[2]||"";if(!o||o&&(i===""||this.rules.inline.punctuation.exec(i))){let s=r[0].length-1,a,l,u=s,c=0,h=r[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(h.lastIndex=0,t=t.slice(-1*e.length+s);(r=h.exec(t))!=null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(l=a.length,r[3]||r[4]){u+=l;continue}else if((r[5]||r[6])&&s%3&&!((s+l)%3)){c+=l;continue}if(u-=l,u>0)continue;if(l=Math.min(l,l+u+c),Math.min(s,l)%2){let g=e.slice(1,s+r.index+l);return{type:"em",raw:e.slice(0,s+r.index+l+1),text:g,tokens:this.lexer.inlineTokens(g,[])}}let d=e.slice(2,s+r.index+l-1);return{type:"strong",raw:e.slice(0,s+r.index+l+1),text:d,tokens:this.lexer.inlineTokens(d,[])}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let i=t[2].replace(/\n/g," "),r=/[^ ]/.test(i),o=/^ /.test(i)&&/ $/.test(i);return r&&o&&(i=i.substring(1,i.length-1)),i=ai(i,!0),{type:"codespan",raw:t[0],text:i}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2],[])}}autolink(e,t){let i=this.rules.inline.autolink.exec(e);if(i){let r,o;return i[2]==="@"?(r=ai(this.options.mangle?t(i[1]):i[1]),o="mailto:"+r):(r=ai(i[1]),o=r),{type:"link",raw:i[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}url(e,t){let i;if(i=this.rules.inline.url.exec(e)){let r,o;if(i[2]==="@")r=ai(this.options.mangle?t(i[0]):i[0]),o="mailto:"+r;else{let s;do s=i[0],i[0]=this.rules.inline._backpedal.exec(i[0])[0];while(s!==i[0]);r=ai(i[0]),i[1]==="www."?o="http://"+r:o=r}return{type:"link",raw:i[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e,t){let i=this.rules.inline.text.exec(e);if(i){let r;return this.lexer.state.inRawBlock?r=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):ai(i[0]):i[0]:r=ai(this.options.smartypants?t(i[0]):i[0]),{type:"text",raw:i[0],text:r}}}},ce={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fenc
]`).replace("lheading",ce.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});ee={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Gm,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^[^_*]*?\_\_[^_*]*?\*[^_*]*?(?=\_\_)|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,rDelimUnd:/^[^_*]*?\*\*[^_*]*?\_[^_*]*?(?=\*\*)|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Gm,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};ee._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";ee.punctuation=ut(ee.punctuation).replace(/punctuation/g,ee._punctuation).getRegex();ee.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;ee.escapedEmSt=/\\\*|\\_/g;ee._comment=ut(ce._comment).replace("(?:-->|$)","-->").getRegex();ee.emStrong.lDelim=ut(ee.emStrong.lDelim).replace(/punct/g,ee._punctuation).getRegex();ee.emStrong.rDelimAst=ut(ee.emStrong.rDelimAst,"g").replace(/punct/g,ee._punctuation).getRegex();ee.emStrong.rDelimUnd=ut(ee.emStrong.rDelimUnd,"g").replace(/punct/g,ee._punctuation).getRegex();ee._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;ee._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;ee._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;ee.autolink=ut(ee.autolink).replace("scheme",ee._scheme).replace("email",ee._email).getRegex();ee._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;ee.tag=ut(ee.tag).replace("comment",ee._comment).replace("attribute",ee._attribute).getRegex();ee._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;ee._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;ee._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;ee.link=ut(ee.link).replace("label",ee._label).replace("href",ee._href).replace("title",ee._title).getRegex();ee.reflink=ut(ee.reflink).replace("label",ee._label).replace("ref",ce._label).getRegex();ee.nolink=ut(ee.nolink).replace("ref",ce._label).getRegex();ee.reflinkSearch=ut(ee.reflinkSearch,"g").replace("reflink",ee.reflink).replace("nolink",ee.nolink).getRegex();ee.normal=Pr({},ee);ee.pedantic=Pr({},ee.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:ut(/^!?\[(label)\]\((.*?)\)/).replace("label",ee._label).getRegex(),reflink:ut(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ee._label).getRegex()});ee.gfm=Pr({},ee.normal,{escape:ut(ee.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/});ee.gfm.url=ut(ee.gfm.url,"i").replace("email",ee.gfm._extended_email).getRegex();ee.breaks=Pr({},ee.gfm,{br:ut(ee.br).
`).replace(/\t/g," "),this.blockTokens(e,this.tokens);let t;for(;t=this.inlineQueue.shift();)this.inlineTokens(t.src,t.tokens);return this.tokens}blockTokens(e,t=[]){this.options.pedantic&&(e=e.replace(/^ +$/gm,""));let i,r,o,s;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(a=>(i=a.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))){if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length),i.raw.length===1&&t.length>0?t[t.length-1].raw+=`
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length),r=t[t.length-1],r&&(r.type==="paragraph"||r.type==="text")?(r.raw+=`
`+i.raw,r.text+=`
`+i.text,this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length),r=t[t.length-1],r&&(r.type==="paragraph"||r.type==="text")?(r.raw+=`
`+i.raw,r.text+=`
`+i.raw,this.inlineQueue[this.inlineQueue.length-1].src=r.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title});continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(o=e,this.options.extensions&&this.options.extensions.startBlock){let a=1/0,l=e.slice(1),u;this.options.extensions.startBlock.forEach(function(c){u=c.call({lexer:this},l),typeof u=="number"&&u>=0&&(a=Math.min(a,u))}),a<1/0&&a>=0&&(o=e.substring(0,a+1))}if(this.state.top&&(i=this.tokenizer.paragraph(o))){r=t[t.length-1],s&&r.type==="paragraph"?(r.raw+=`
`+i.raw,r.text+=`
`+i.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(i),s=o.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length),r=t[t.length-1],r&&r.type==="text"?(r.raw+=`
`+i.raw,r.text+=`
`+i.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(i);continue}if(e){let a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,t}inline(e,t){this.inlineQueue.push({src:e,tokens:t})}inlineTokens(e,t=[]){let i,r,o,s=e,a,l,u;if(this.tokens.links){let c=Object.keys(this.tokens.links);if(c.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)c.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,a.index)+"["+aq("a",a[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)s=s.slice(0,a.index)+"["+aq("a",a[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(a=this.tokenizer.rules.inline.escapedEmSt.exec(s))!=null;)s=s.slice(0,a.index)+"++"+s.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;e;)if(l||(u=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(c=>(i=c.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))){if(i=this.tokenizer.escape(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.tag(e)){e=e.substring(i.raw.length),r=t[t.length-1],r&&i.type==="text"&&r.type==="text"?(r.raw+=i.raw,r.text+=i.text):t.push(i);continue}if(i=this.tokenizer.link(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(i.raw.length),r=t[t.length-1],r&&i.type==="text"&&r.type==="text"?(r.raw+=i.raw,r.text+=i.text):t.push(i);continue}if(i=this.tokenizer.emStrong(e,s,u)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.codespan(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.br(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.del(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.autolink(e,uq)){e=e.substring(i.raw.length),t.push(i);continue}if(!this.state.inLink&&(i=this.tokenizer.url(e,uq))){e=e.substring(i.raw.length),t.push(i);continue}if(o=e,this.options.extensions&&this.options.extensions.startInline){let c=1/0,h=e.slice(1),d;this.options.extensions.startInline.forEach(function(g){d=g.call({lexer:this},h),typeof d=="number"&&d>=0&&(c=Math.min(c,d))}),c<1/0&&c>=0&&(o=e.substring(0,c+1))}if(i=this.tokenizer.inlineText(o,rpe)){e=e.substring(i.raw.length),i.raw.slice(-1)!=="_"&&(u=i.raw.slice(-1)),l=!0,r=t[t.length-1],r&&r.type==="text"?(r.raw+=i.raw,r.text+=i.text):t.push(i);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return t}},zm=class{constructor(e){this.options=e||uc}code(e,t,i){let r=(t||"").match(/\S*/)[0];if(this.options.highlight){let o=this.options.highlight(e,r);o!=null&&o!==e&&(i=!0,e=o)}return e=e.replace(/\n$/,"")+`
`,r?'<pre><code class="'+this.options.langPrefix+ai(r,!0)+'">'+(i?e:ai(e,!0))+`</code></pre>
`:"<pre><code>"+(i?e:ai(e,!0))+`</code></pre>
`}blockquote(e){return`<blockquote>
`+e+`</blockquote>
`}html(e){return e}heading(e,t,i,r){return this.options.headerIds?"<h"+t+' id="'+this.options.headerPrefix+r.slug(i)+'">'+e+"</h"+t+`>
`:"<h"+t+">"+e+"</h"+t+`>
`}hr(){return this.options.xhtml?`<hr/>
`:`<hr>
`}list(e,t,i){let r=t?"ol":"ul",o=t&&i!==1?' start="'+i+'"':"";return"<"+r+o+`>
`+e+"</"+r+`>
`}listitem(e){return"<li>"+e+`</li>
`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "}paragraph(e){return"<p>"+e+`</p>
`}table(e,t){return t&&(t="<tbody>"+t+"</tbody>"),`<table>
<thead>
`+e+`</thead>
`+t+`</table>
`}tablerow(e){return`<tr>
`+e+`</tr>
`}tablecell(e,t){let i=t.header?"th":"td";return(t.align?"<"+i+' align="'+t.align+'">':"<"+i+">")+e+"</"+i+`>
`}strong(e){return"<strong>"+e+"</strong>"}em(e){return"<em>"+e+"</em>"}codespan(e){return"<code>"+e+"</code>"}br(){return this.options.xhtml?"<br/>":"<br>"}del(e){return"<del>"+e+"</del>"}link(e,t,i){if(e=oq(this.options.sanitize,this.options.baseUrl,e),e===null)return i;let r='<a href="'+ai(e)+'"';return t&&(r+=' title="'+t+'"'),r+=">"+i+"</a>",r}image(e,t,i){if(e=oq(this.options.sanitize,this.options.baseUrl,e),e===null)return i;let r='<img src="'+e+'" alt="'+i+'"';return t&&(r+=' title="'+t+'"'),r+=this.options.xhtml?"/>":">",r}text(e){return e}},xk=class{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,i){return""+i}image(e,t,i){return""+i}br(){return""}},Ck=class{constructor(){this.seen={}}serialize(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(e,t){let i=e,r=0;if(this.seen.hasOwnProperty(i)){r=this.seen[e];do r++,i=e+"-"+r;while(this.seen.hasOwnProperty(i))}return t||(this.seen[e]=r,this.seen[i]=0),i}slug(e,t={}){let i=this.serialize(e);return this.getNextSafeSlug(i,t.dryrun)}},zr=class{constructor(e){this.options=e||uc,this.options.renderer=this.options.renderer||new zm,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new xk,this.slugger=new Ck}static parse(e,t){return new zr(t).parse(e)}static parseInline(e,t){return new zr(t).parseInline(e)}parse(e,t=!0){let i="",r,o,s,a,l,u,c,h,d,g,f,p,b,y,w,x,k,L,j,O=e.length;for(r=0;r<O;r++){if(g=e[r],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[g.type]&&(j=this.options.extensions.renderers[g.type].call({parser:this},g),j!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(g.type))){i+=j||"";continue}switch(g.type){case"space":continue;case"hr":{i+=this.renderer.hr();continue}case"heading":{i+=this.renderer.heading(this.parseInline(g.tokens),g.depth,hq(this.parseInline(g.tokens,this.textRenderer)),this.slugger);continue}case"code":{i+=this.renderer.code(g.text,g.lang,g.escaped);continue}case"table":{for(h="",c="",a=g.header.length,o=0;o<a;o++)c+=this.renderer.tablecell(this.parseInline(g.header[o].tokens),{header:!0,align:g.align[o]});for(h+=this.renderer.tablerow(c),d="",a=g.rows.length,o=0;o<a;o++){for(u=g.rows[o],c="",l=u.length,s=0;s<l;s++)c+=this.renderer.tablecell(this.parseInline(u[s].tokens),{header:!1,align:g.align[s]});d+=this.renderer.tablerow(c)}i+=this.renderer.table(h,d);continue}case"blockquote":{d=this.parse(g.tokens),i+=this.renderer.blockquote(d);continue}case"list":{for(f=g.ordered,p=g.start,b=g.loose,a=g.items.length,d="",o=0;o<a;o++)w=g.items[o],x=w.checked,k=w.task,y="",w.task&&(L=this.renderer.checkbox(x),b?w.tokens.length>0&&w.tokens[0].type==="paragraph"?(w.tokens[0].text=L+" "+w.tokens[0].text,w.tokens[0].tokens&&w.tokens[0].tokens.length>0&&w.tokens[0].tokens[0].type==="text"&&(w.tokens[0].tokens[0].text=L+" "+w.tokens[0].tokens[0].text)):w.tokens.unshift({type:"text",text:L}):y+=L),y+=this.parse(w.tokens,b),d+=this.renderer.listitem(y,k,x);i+=this.renderer.list(d,f,p);continue}case"html":{i+=this.renderer.html(g.text);continue}case"paragraph":{i+=this.renderer.paragraph(this.parseInline(g.tokens));continue}case"text":{for(d=g.tokens?this.parseInline(g.tokens):g.text;r+1<O&&e[r+1].type==="text";)g=e[++r],d+=`
`+(g.tokens?this.parseInline(g.tokens):g.text);i+=t?this.renderer.paragraph(d):d;continue}default:{let W='Token with "'+g.type+'" type was not found.';if(this.options.silent){console.error(W);return}else throw new Error(W)}}}return i}parseInline(e,t){t=t||this.renderer;let i="",r,o,s,a=e.length;for(r=0;r<a;r++){if(o=e[r],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]&&(s=this.options.extensions.renderers[o.type].call({parser:this},o),s!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type))){i+=s||"";continue}switch(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 l='Token with "'+o.type+'" type was not found.';if(this.options.silent){console.error(l);return}else throw new Error(l)}}}return i}};ge.options=ge.setOptions=function(n){return Pr(ge.defaults,n),Yfe(ge.defaults),ge};ge.getDefaults=cq;ge.defaults=uc;ge.use=function(...n){let e=Pr({},...n),t=ge.defaults.extensions||{renderers:{},childTokens:{}},i;n.forEach(r=>{if(r.extensions&&(i=!0,r.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if(o.renderer){let s=t.renderers?t.renderers[o.name]:null;s?t.renderers[o.name]=function(...a){let l=o.renderer.apply(this,a);return l===!1&&(l=s.apply(this,a)),l}:t.renderers[o.name]=o.renderer}if(o.tokenizer){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");t[o.level]?t[o.level].unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}o.childTokens&&(t.childTokens[o.name]=o.childTokens)})),r.renderer){let o=ge.defaults.renderer||new zm;for(let s in r.renderer){let a=o[s];o[s]=(...l)=>{let u=r.renderer[s].apply(o,l);return u===!1&&(u=a.apply(o,l)),u}}e.renderer=o}if(r.tokenizer){let o=ge.defaults.tokenizer||new Km;for(let s in r.tokenizer){let a=o[s];o[s]=(...l)=>{let u=r.tokenizer[s].apply(o,l);return u===!1&&(u=a.apply(o,l)),u}}e.tokenizer=o}if(r.walkTokens){let o=ge.defaults.walkTokens;e.walkTokens=function(s){r.walkTokens.call(this,s),o&&o.call(this,s)}}i&&(e.extensions=t),ge.setOptions(e)})};ge.walkTokens=function(n,e){for(let t of n)switch(e.call(ge,t),t.type){case"table":{for(let i of t.header)ge.walkTokens(i.tokens,e);for(let i of t.rows)for(let r of i)ge.walkTokens(r.tokens,e);break}case"list":{ge.walkTokens(t.items,e);break}default:ge.defaults.extensions&&ge.defaults.extensions.childTokens&&ge.defaults.extensions.childTokens[t.type]?ge.defaults.extensions.childTokens[t.type].forEach(function(i){ge.walkTokens(t[i],e)}):t.tokens&&ge.walkTokens(t.tokens,e)}};ge.parseInline=function(n,e){if(typeof n>"u"||n===null)throw new Error("marked.parseInline(): input parameter is undefined or null");if(typeof n!="string")throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected");e=Pr({},ge.defaults,e||{}),dq(e);try{let t=Kr.lexInline(n,e);return e.walkTokens&&ge.walkTokens(t,e.walkTokens),zr.parseInline(t,e)}catch(t){if(t.message+=`
Please report this to https://github.com/markedjs/marked.`,e.silent)return"<p>An error occurred:</p><pre>"+ai(t.message+"",!0)+"</pre>";throw t}};ge.Parser=zr;ge.parser=zr.parse;ge.Renderer=zm;ge.TextRenderer=xk;ge.Lexer=Kr;ge.lexer=Kr.lex;ge.Tokenizer=Km;ge.Slugger=Ck;ge.parse=ge;uPe=ge.options,cPe=ge.setOptions,hPe=ge.use,dPe=ge.walkTokens,gPe=ge.parseInline,fPe=zr.parse,pPe=Kr.lex});var bq=m((bPe,mq)=>{var pq={};mq.exports=pq;var fq={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(fq).forEach(function(n){var e=fq[n],t=pq[n]=[];t.open="\x1B["+e[0]+"m",t.close="\x1B["+e[1]+"m"})});var vq=m((yPe,yq)=>{var ng=process.argv;yq.exports=function(){return ng.indexOf("--no-color")!==-1||ng.indexOf("--color=false")!==-1?!1:ng.indexOf("--color")!==-1||ng.indexOf("--color=true")!==-1||ng.indexOf("--color=always")!==-1?!0:process.stdout&&!process.stdout.isTTY?!1:process.platform==="win32"||"COLORTERM"in process.env?!0:process.env.TERM==="dumb"?!1:!!/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)}()});var xq=m((vPe,wq)=>{wq.exports=function(e,t){var i="";e=e||"Run the trap, drop the bass",e=e.split("");var r={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return e.forEach(function(o){o=o.toLowerCase();var s=r[o]||[" "],a=Math.floor(Math.random()*s.length);typeof r[o]<"u"?i+=r[o][a]:i+=o}),i}});var Sq=m((wPe,Cq)=>{Cq.exports=function(e,t){e=e||" he is here ";var i={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},r=[].concat(i.up,i.down,i.mid),o={};function s(u){var c=Math.floor(Math.random()*u);return c}function a(u){var c=!1;return r.filter(function(h){c=h===u}),c}function l(u,c){var h="",d,g;c=c||{},c.up=c.up||!0,c.mid=c.mid||!0,c.down=c.down||!0,c.size=c.size||"maxi",u=u.split("");fo
`);return i.reduce(function(r,o){return o.length>r?o.length:r},0)}});var Yq=m((PPe,kk)=>{var ppe=Hq(),cl=Bq(),Tk=cl.repeat,mpe=cl.truncate,bpe=cl.pad;function rg(n){this.options=cl.options({chars:{top:"\u2500","top-mid":"\u252C","top-left":"\u250C","top-right":"\u2510",bottom:"\u2500","bottom-mid":"\u2534","bottom-left":"\u2514","bottom-right":"\u2518",left:"\u2502","left-mid":"\u251C",mid:"\u2500","mid-mid":"\u253C",right:"\u2502","right-mid":"\u2524",middle:"\u2502"},truncate:"\u2026",colWidths:[],colAligns:[],style:{"padding-left":1,"padding-right":1,head:["red"],border:["grey"],compact:!1},head:[]},n)}rg.prototype.__proto__=Array.prototype;rg.prototype.__defineGetter__("width",function(){var n=this.toString().split(`
`);return n.length?n[0].length:0});rg.prototype.render;rg.prototype.toString=function(){var n="",e=this.options,t=e.style,i=e.head,r=e.chars,o=e.truncate,s=e.colWidths||new Array(this.head.length),a=0;if(!i.length&&!this.length)return"";if(!s.length){var l=this.slice(0);i.length&&(l=l.concat([i])),l.forEach(function(y){if(typeof y=="object"&&y.length)u(y);else{var w=Object.keys(y)[0],x=y[w];s[0]=Math.max(s[0]||0,c(w)||0),typeof x=="object"&&x.length?u(x,1):s[1]=Math.max(s[1]||0,c(x)||0)}})}a=(s.length==1?s[0]:s.reduce(function(y,w){return y+w}))+s.length+1;function u(y,x){var x=x||0;y.forEach(function(k,L){s[L+x]=Math.max(s[L+x]||0,c(k)||0)})}function c(y){return typeof y=="object"&&y.width!=null?y.width:(typeof y=="object"?cl.strlen(y.text):cl.strlen(y))+(t["padding-left"]||0)+(t["padding-right"]||0)}function h(j,w,x,k){var L=0,j=w+Tk(j,a-2)+x;return s.forEach(function(O,W){W!=s.length-1&&(L+=O+1,j=j.substr(0,L)+k+j.substr(L+1))}),f(e.style.border,j)}function d(){var y=h(r.top,r["top-left"]||r.top,r["top-right"]||r.top,r["top-mid"]);y&&(n+=y+`
`)}function g(y,w){var x=[],k=0;if(!Array.isArray(y)&&typeof y=="object"){var L=Object.keys(y)[0],j=y[L],O=!0;Array.isArray(j)?(y=j,y.unshift(L)):y=[L,j]}y.forEach(function(N,I){var A=N.toString().split(`
`).reduce(function(K,ae){return K.push(p(ae,I)),K},[]),Z=A.length;Z>k&&(k=Z),x.push({contents:A,height:Z})});var W=new Array(k);x.forEach(function(N,I){N.contents.forEach(function(K,ae){W[ae]||(W[ae]=[]),(w||O&&I===0&&e.style.head)&&(K=f(e.style.head,K)),W[ae].push(K)});for(var A=N.height,Z=k;A<Z;A++)W[A]||(W[A]=[]),W[A].push(p("",I))});var H="";return W.forEach(function(N,I){H.length>0&&(H+=`
`+f(e.style.border,r.left)),H+=N.join(f(e.style.border,r.middle))+f(e.style.border,r.right)}),f(e.style.border,r.left)+H}function f(y,w){return w?(y.forEach(function(x){w=ppe[x](w)}),w):""}function p(x,w){var x=String(typeof x=="object"&&x.text?x.text:x),k=cl.strlen(x),L=s[w]-(t["padding-left"]||0)-(t["padding-right"]||0),j=e.colAligns[w]||"left";return Tk(" ",t["padding-left"]||0)+(k==L?x:k<L?bpe(x,L+(x.length-k)," ",j=="left"?"right":j=="middle"?"both":"left"):o?mpe(x,L,o):x)+Tk(" ",t["padding-right"]||0)}i.length&&(d(),n+=g(i,t.head)+`
`),this.length&&this.forEach(function(y,w){if(!i.length&&w==0)d();else if(!t.compact||w<!!i.length||y.length==0){var x=h(r.mid,r["left-mid"],r["right-mid"],r["mid-mid"]);x&&(n+=x+`
`)}y.hasOwnProperty("length")&&!y.length||(n+=g(y)+`
`)});var b=h(r.bottom,r["bottom-left"]||r.bottom,r["bottom-right"]||r.bottom,r["bottom-mid"]);return b?n+=b:n=n.slice(0,-1),n};kk.exports=rg;kk.exports.version="0.0.1"});var $q=m((RPe,Jq)=>{"use strict";var Wq=(n=0)=>e=>`\x1B[${38+n};5;${e}m`,Zq=(n=0)=>(e,t,i)=>`\x1B[${38+n};2;${e};${t};${i}m`;function ype(){let n=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[t,i]of Object.entries(e)){for(let[r,o]of Object.entries(i))e[r]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},i[r]=e[r],n.set(o[0],o[1]);Object.defineProperty(e,t,{value:i,enumerable:!1})}return Object.defineProperty(e,"codes",{value:n,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",e.color.ansi256=Wq(),e.color.ansi16m=Zq(),e.bgColor.ansi256=Wq(10),e.bgColor.ansi16m=Zq(10),Object.defineProperties(e,{rgbToAnsi256:{value:(t,i,r)=>t===i&&i===r?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(i/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value:t=>{let i=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(t.toString(16));if(!i)return[0,0,0];let{colorString:r}=i.groups;r.length===3&&(r=r.split("").map(s=>s+s).join(""));let o=Number.parseInt(r,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:t=>e.rgbToAnsi256(...e.hexToRgb(t)),enumerable:!1}}),e}Object.defineProperty(Jq,"exports",{enumerable:!0,get:ype})});function Xq(n){return`${vi.default.gray.open}${n}${vi.default.gray.close}`}function Dk(n){return`${vi.default.magenta.open}${n}${vi.default.magenta.close}`}function Uq(n){return`${vi.default.bold.open}${n}${vi.default.bold.close}`}function Ek(n){return`${vi.default.underline.open}${n}${vi.default.underline.close}`}function Gq(n){return`${vi.default.strikethrough.open}${n}${vi.default.strikethrough.close}`}function Kq(n){return`${vi.default.italic.open}${n}${vi.default.italic.close}`}function zq(n){return`${vi.default.yellow.open}${n}${vi.default.yellow.close}`}function _k(n){return`${vi.default.blue.open}${n}${vi.default.blue.close}`}var vi,Qq=P(()=>{"use strict";vi=S($q())});function Rr(n){return n}function Spe(n){return Xq(n.replace(/(<([^>]+)>)/ig,""))}function Vq(n,e){return e?n.replace(Cpe,/\n/g):n}function kpe(n,e){return e.replace(/(^|\n)(.+)/g,"$1"+n+"$2")}function Dpe(n,e){return e&&n+e.split(`
`).join(`
`+n)}function Ppe(n,e){let t=new RegExp("(\\S(?: | )?)((?:"+e+")+)("+oB+"(?:.*)+)$","gm");return n.replace(t,`$1
`+e+"$2$3")}function aB(n){return" ".repeat(n.length)}function Rpe(n,e){return sB(e,n)?e:aB(Lk)+e}function Lpe(n,e){let t=Rpe.bind(null,e);return n.split(`
`).filter(Rr).map(t).join(`
`)}function Ipe(n,e,t){return sB(e,n)?{num:t+1,line:e.replace(Lk,eB(t+1))}:{num:t,line:aB(eB(t))+e}}function jpe(n,e){let t=Ipe.bind(null,e),i=0;return n.split(`
`).filter(Rr).map(r=>{let o=t(r,i);return i=o.num,o.line}).join(`
`)}function Fpe(n,e,t){return n=n.trim(),n=e?jpe(n,t):Lpe(n,t),n}function og(n){return n+`
`}function Ope(n){return n.replace(xpe,":")}function tB(n,e=null){if(!n)return[];e=e||Rr;let t=e(n).split(`
`),i=[];return t.forEach(function(r){if(!r)return;let o=r.replace(wpe,"").split(nB);i.push(o.splice(0,o.length-1))}),i}function lB(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function Mpe(n){return n.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'")}var iB,LPe,nB,Rk,wpe,rB,xpe,Cpe,Tpe,Epe,_pe,oB,sB,Lk,eB,Pk,uB,Ik,cB=P(()=>{"use strict";iB=S(Yq());Qq();LPe=Y()("markdown-renderer"),nB="^*||*^",Rk="*|*|*|*",wpe=new RegExp(lB(Rk),"g"),rB="*#COLON|*",xpe=new RegExp(lB(rB),"g"),Cpe="\r";Tpe={code:Rr,blockquote:Rr,html:Spe,heading:Dk,firstHeading:Dk,hr:Rr,listitem:Rr,list:Fpe,table:Rr,paragraph:Rr,strong:Uq,em:Kq,codespan:zq,del:Gq,link:Ek,href:Ek,text:Rr,unescape:!0,emoji:!1,width:80,showSectionPrefix:!0,tab:2,tableOptions:{}};Epe="\\*",_pe="\\d+\\.",oB="(?:"+[Epe,_pe].join("|")+")";sB=function(n,e){return n.match("^(?:"+e+")*"+oB)};Lk="* ";eB=function(n){return n+". "};Pk=new Map,uB=class{constructor(e={},t={}){this.options=e;this.highlightOptions=t;this.o=Object.assign({},Tpe,e),this.tab=" ",this.tableSettings=this.o.tableOptions,this.unescape=this.o.unescape?Mpe:Rr,this.highlightOptions=t||{},this.transform=this.compose(Ope,this.unescape)}text(e){return this.o.text(e)}code(e,t,i){return"``` "+t+`
`+e+"\n```\n"}blockquote(e){return og(this.o.blockquote(Dpe(this.tab,e.trim())))}html(e){return this.o.html(e)}heading(e,t,i){return e=this.transform(e),e=(this.o.showSectionPrefix?new Array(t+1).join("#")+" ":"")+e,og(t===1?this.o.firstHeading(e):this.o.heading(e))}hr(){return`\u2500\u2500\u2500
`}list(e,t){return e=this.o.list(e,t,this.tab),og(Ppe(kpe(this.tab,e),this.tab))}listitem(e){let t=this.compose(this.o.listitem,this.transform);return e.indexOf(`
`)!==-1&&(e=e.trim()),`
`+Lk+t(e)}checkbox(e){return"["+(e?"X":" ")+"] "}paragraph(e){return e=this.compose(this.o.paragraph,this.transform)(e),og(e)}table(e,t){let i=new iB.default(Object.assign({},{head:tB(e)[0]},this.tableSettings));return tB(t,this.transform).forEach(function(r){i.push(r)}),og(this.o.table(i.toString()))}tablerow(e){return Rk+e+Rk+`
`}tablecell(e,t){return e+nB}strong(e){return this.o.strong(e)}em(e){return e=Vq(e,this.o.reflowText),this.o.em(e)}codespan(e){return e=Vq(e,this.o.reflowText),this.o.codespan(e.replace(/:/g,rB))}br(){return`
`}del(e){return this.o.del(e)}link(e,t,i){let r;try{r=decodeURIComponent(unescape(e)).replace(/[^\w:]/g,"").toLowerCase()}catch{return""}if(r.startsWith("javascript:"))return"";if(i&&e&&i!=e&&Pk.set(i,e),i&&i!=e)return _k(i);let o=this.o.href(e);return this.o.link(o)}image(e,t,i){let r="!["+i;return t&&(r+=" \u2013 "+t),r+"]("+e+")"}compose(...e){return(...t)=>{for(let i=e.length;i-- >0;)t=[e[i].apply(this,t)];return t[0]}}static getLinks(){let e=[];for(let[t,i]of Pk.entries())e.push(`${_k(t)}: ${i}`);return Pk.clear(),e}},Ik=uB});function dc(n,e=!1){let t=sg(n),i=[],r="";for(let o of t){if(!o.text)continue;let{foreground:s,background:a}=o,l=V(r),u=[l,l+V(o.text)];if(s&&a){let c=`CocList${cn(s)}${cn(a)}`;i.push({span:u,hlGroup:c})}else if(s){let c;e?s=="yellow"?c="CocMarkdownCode":s=="blue"?c="CocMarkdownLink":s=="magenta"?c="CocMarkdownHeader":c=`CocListFg${cn(s)}`:c=`CocListFg${cn(s)}`,i.push({span:u,hlGroup:c})}else if(a){let c=`CocListBg${cn(a)}`;i.push({span:u,hlGroup:c})}o.bold?i.push({span:u,hlGroup:"CocBold"}):o.italic?i.push({span:u,hlGroup:"CocItalic"}):o.underline?i.push({span:u,hlGroup:"CocUnderline"}):o.strikethrough&&i.push({span:u,hlGroup:"CocStrikeThrough"}),r=r+o.text}return{line:r,highlights:i}}function sg(n){let e=null,t=null,i="",r=[],o=[],s={},a;a=()=>{let l,u;i.length?i=i.substr(0,i.length-1):o.length&&(l=o.length-1,u=o[l].text,u.length===1?o.pop():o[l].text=u.substr(0,u.length-1))};for(let l=0;l<n.length;l++){if(e!=null){e=="\x1B"&&n[l]=="["?(i&&(s.text=i,o.push(s),s={},i=""),i==""&&(n[l+1]=="m"||n[l+1]=="K")&&((s.foreground||s.background)&&(s.text="",o.push(s)),s={}),e=null,t=""):(i+=e+n[l],e=null);continue}else if(t!=null){n[l]==";"?(r.push(t),t=""):n[l]=="m"||n[l]=="K"?(r.push(t),t=null,i="",r.forEach(u=>{hB[u]?s.foreground=hB[u]:dB[u]?s.background=dB[u]:u==39?delete s.foreground:u==49?delete s.background:gB[u]?s[gB[u]]=!0:u==22?s.bold=!1:u==23?s.italic=!1:u==24?s.underline=!1:u==29&&(s.strikethrough=!1)}),r=[]):t+=n[l];continue}n[l]=="\x1B"?e=n[l]:n[l]=="\b"?a():i+=n[l]}return i&&(s.text=i+(e||""),o.push(s)),o}var hB,dB,gB,gc=P(()=>{"use strict";Fe();hB={30:"black",31:"red",32:"green",33:"yellow",34:"blue",35:"magenta",36:"cyan",37:"white",90:"grey"},dB={40:"black",41:"red",42:"green",43:"yellow",44:"blue",45:"magenta",46:"cyan",47:"white"},gB={1:"bold",3:"italic",4:"underline",9:"strikethrough"}});var pB=m((OPe,fB)=>{"use strict";fB.exports=({onlyFirst:n=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,n?void 0:"g")}});var Qm=m((MPe,mB)=>{"use strict";var Ape=pB();mB.exports=n=>typeof n=="string"?n.replace(Ape(),""):n});function Vm(n,e={}){let t=[],i=[],r=[],o=0;for(let s of n){let a=t.length,{content:l,filetype:u}=s,c=s.highlights;if(u=="markdown"){let h=qpe(l,e);r.push(...h.codes.map(d=>(d.startLine=d.startLine+a,d.endLine=d.endLine+a,d))),i.push(...h.highlights.map(d=>(d.lnum=d.lnum+a,d))),t.push(...h.lines)}else{let h=l.trim().split(/\r?\n/);Npe.includes(s.filetype)?r.push({hlGroup:`Coc${u}Float`,startLine:a,endLine:a+h.length}):r.push({filetype:s.filetype,startLine:a,endLine:a+h.length}),t.push(...h)}if(Array.isArray(c)&&i.push(...c.map(h=>Object.assign({},h,{lnum:h.lnum+a}))),Array.isArray(s.active)){let h=Hpe(l,a,s.active);h.length&&i.push(...h)}o!=n.length-1&&t.push("\u2500"),o=o+1}return{lines:t,highlights:i,codes:r}}function Hpe(n,e,t){let i=[],[r,o]=t,s=n.split(/\r?\n/),a=0,l=!1;for(let u=0;u<s.length;u++){let c=s[u];if(l)if(a+c.length>o){let h=V(c.slice(0,o-a));i.push({colStart:0,colEnd:h,lnum:u+e,hlGroup:"CocUnderline"}),l=!1;break}else{let h=V(c);i.push({colStart:0,colEnd:h,lnum:u+e,hlGroup:"CocUnderline"})}else if(a+c.length>r){l=!0;let h=V(c.slice(0,r-a));if(a+c.length>o){let d=V(c.slice(0,o-a));l=!1,i.push({colStart:h,colEnd:d,lnum:u+e,hlGroup:"CocUnderline"});break}else{let d=V(c);i.push({colStart:h,colEnd:d,lnum:u+e,hlGroup:"CocUnderline"})}}a=a+c.length+1}return i}function qpe(n,e){ge.setOpt
`+c.join(`
`)),u=u.replace(/\s*$/,"");let h=u.split(/\n/);for(let d=0;d<h.length;d++){let g=h[d];if(!g.length){t[t.length-1]&&(t.push(g),o++);continue}if(e.excludeImages&&g.indexOf("![")!==-1&&(g=g.replace(/\s*!\[.*?\]\(.*?\)/g,""),!(0,bB.default)(g).trim().length))continue;if(/\s*```\s*([A-Za-z0-9_,]+)?$/.test(g)){if(s)s=!1,r.push({filetype:a,startLine:l,endLine:o});else{let p=h[d-1];p&&/^\s*```\s*/.test(p)&&(t.push(""),o++),s=!0,a=g.replace(/^\s*```\s*/,""),a=="js"&&(a="javascript"),a=="ts"&&(a="typescript"),a=="bash"&&(a="sh"),l=o}continue}if(s){t.push(g),o++;continue}let f=dc(g,!0);if(f.highlights)for(let p of f.highlights){let{hlGroup:b,span:y}=p;i.push({hlGroup:b,lnum:o,colStart:y[0],colEnd:y[1]})}t.push(f.line),o++}return{lines:t,highlights:i,codes:r}}var bB,Npe,BPe,jk=P(()=>{"use strict";gq();cB();gc();Fe();bB=S(Qm()),Npe=["Error","Warning","Info","Hint"],BPe=Y()("markdown-index")});var Qt,Qr=P(()=>{"use strict";Qt=class{constructor(){this.tasks=[];this.count=1}sched(){this.count>0&&this.tasks.length>0&&(this.count--,this.tasks.shift()())}get busy(){return this.count==0}acquire(){return new Promise(e=>{let t=()=>{let i=!1;e(()=>{i||(i=!0,this.count++,this.sched())})};this.tasks.push(t),process.nextTick(this.sched.bind(this))})}use(e){return this.acquire().then(t=>e().then(i=>(t(),i)).catch(i=>{throw t(),i}))}}});var yB,vB,Bpe,KPe,li,Bo=P(()=>{"use strict";yB=S(_i()),vB=S(q());he();jk();z();Qr();Ht();Bpe=process.env.VIM_NODE_RPC=="1",KPe=Y()("model-float"),li=class{constructor(e){this.nvim=e;this.winid=0;this._bufnr=0;this.mutex=new Qt;this.disposables=[];this.onCursorMoved=(0,yB.default)(this._onCursorMoved.bind(this),100)}bindEvents(e,t){let i=["InsertLeave","InsertEnter","BufEnter"];for(let r of i)_.on(r,o=>{o!=this._bufnr&&this.close()},null,this.disposables);_.on("MenuPopupChanged",()=>{_.pumAlignTop==t&&this.close()},null,this.disposables),this.disposables.push(vB.Disposable.create(()=>{this.onCursorMoved.clear()})),_.on("CursorMoved",this.onCursorMoved.bind(this,e),this,this.disposables),_.on("CursorMovedI",this.onCursorMoved.bind(this,e),this,this.disposables)}unbind(){this.disposables.length&&(J(this.disposables),this.disposables=[])}_onCursorMoved(e,t,i){if(t!=this._bufnr&&!(t==this.targetBufnr&&_e(i,this.cursor))&&(e||t!=this.targetBufnr||!_.insertMode)){this.close();return}}async create(e,t=!1,i=0){await this.show(e,{offsetX:i})}applyFloatConfig(e,t){for(let i of Object.keys(t)){if(i=="border"){t.border&&(e.border=[1,1,1,1]);continue}e[i]=t[i]}return e}async show(e,t={}){if(e.length==0||e.every(o=>o.content.length==0)){this.close();return}let i=Date.now(),r=await this.mutex.acquire();try{await this.createPopup(e,t,i),r()}catch(o){this.nvim.echoError(o),r()}}async createPopup(e,t,i){e=e.filter(p=>p.content.trim().length>0);let{lines:r,codes:o,highlights:s}=Vm(e),a={pumAlignTop:_.pumAlignTop,preferTop:typeof t.preferTop=="boolean"?t.preferTop:!1,offsetX:t.offsetX||0,title:t.title||"",close:t.close?1:0,codes:o,highlights:s,modes:t.modes||["n","i","ic","s"]};Bpe||(typeof t.winblend=="number"&&(a.winblend=t.winblend),t.focusable!=null&&(a.focusable=t.focusable?1:0),t.shadow&&(a.shadow=1)),t.maxHeight&&(a.maxHeight=t.maxHeight),t.maxWidth&&(a.maxWidth=t.maxWidth),t.border&&!t.border.every(p=>p==0)&&(a.border=t.border),t.title&&!a.border&&(a.border=[1,1,1,1]),t.highlight&&(a.highlight=t.highlight),t.borderhighlight&&(a.borderhighlight=[t.borderhighlight]),t.cursorline&&(a.cursorline=1);let l=t.autoHide!=!1;l&&(a.autohide=1),this.unbind();let u=await this.nvim.call("coc#dialog#create_cursor_float",[this.winid,this._bufnr,r,a]);if(this.nvim.redrawVim(),!u||u.length==0||this.closeTs>i){let p=u&&u.length>0?u[2]:this.winid;p&&(this.winid=0,this.nvim.call("coc#float#close",[p],!0),this.nvim.redrawVim());return}let[c,h,d,g,f]=u;this.winid=d,this._bufnr=g,this.targetBufnr=c,this.cursor=h,this.bindEvents(l,f==1)}close(){let{winid:e,nvim:t}=this;this.closeTs=Date.now(),this.unbind(),e&&(this.winid=0,t.call("coc#float#close",[e],!0),t.redrawVim())}checkRetrigger(e){return!!(this.winid&&this.targetBufnr==e)}get bufnr(){return this
%s`,L,L,w,i);var j=w.type==="*"?Ak:w.type==="?"?Mk:"\\"+w.type;r=!0,i=i.slice(0,w.reStart)+j+"\\("+L}f(),o&&(i+="\\\\");var O=!1;switch(i.charAt(0)){case".":case"[":case"(":O=!0}for(var W=a.length-1;W>-1;W--){var H=a[W],N=i.slice(0,H.reStart),I=i.slice(H.reStart,H.reEnd-8),A=i.slice(H.reEnd-8,H.reEnd),Z=i.slice(H.reEnd);A+=Z;var K=N.split("(").length-1,ae=Z;for(p=0;p<K;p++)ae=ae.replace(/\)[+*?]?/,"");Z=ae;var je="";Z===""&&e!==eb&&(je="$");var Pe=N+I+Z+je+A;i=Pe}if(i!==""&&r&&(i="(?=.)"+i),O&&(i=d+i),e===eb)return[i,r];if(!r)return ame(n);var Ve=t.nocase?"i":"";try{var Tt=new RegExp("^"+i+"$",Ve)}catch{return new RegExp("$.")}return Tt._glob=n,Tt._src=i,Tt}Qn.makeRe=function(n,e){return new ui(n,e||{}).makeRe()};ui.prototype.makeRe=ome;function ome(){if(this.regexp||this.regexp===!1)return this.regexp;var n=this.set;if(!n.length)return this.regexp=!1,this.regexp;var e=this.options,t=e.noglobstar?Ak:e.dot?Qpe:Vpe,i=e.nocase?"i":"",r=n.map(function(o){return o.map(function(s){return s===Nk?t:typeof s=="string"?lme(s):s._src}).join("\\/")}).join("|");r="^(?:"+r+")$",this.negate&&(r="^(?!"+r+").*$");try{this.regexp=new RegExp(r,i)}catch{this.regexp=!1}return this.regexp}Qn.match=function(n,e,t){t=t||{};var i=new ui(e,t);return n=n.filter(function(r){return i.match(r)}),i.options.nonull&&!n.length&&n.push(e),n};ui.prototype.match=sme;function sme(n,e){if(this.debug("match",n,this.pattern),this.comment)return!1;if(this.empty)return n==="";if(n==="/"&&e)return!0;var t=this.options;ag.sep!=="/"&&(n=n.split(ag.sep).join("/")),n=n.split(NB),this.debug(this.pattern,"split",n);var i=this.set;this.debug(this.pattern,"set",i);var r,o;for(o=n.length-1;o>=0&&(r=n[o],!r);o--);for(o=0;o<i.length;o++){var s=i[o],a=n;t.matchBase&&s.length===1&&(a=[r]);var l=this.matchOne(a,s,e);if(l)return t.flipNegate?!0:!this.negate}return t.flipNegate?!1:this.negate}ui.prototype.matchOne=function(n,e,t){var i=this.options;this.debug("matchOne",{this:this,file:n,pattern:e}),this.debug("matchOne",n.length,e.length);for(var r=0,o=0,s=n.length,a=e.length;r<s&&o<a;r++,o++){this.debug("matchOne loop");var l=e[o],u=n[r];if(this.debug(e,l,u),l===!1)return!1;if(l===Nk){this.debug("GLOBSTAR",[e,l,u]);var c=r,h=o+1;if(h===a){for(this.debug("** at the end");r<s;r++)if(n[r]==="."||n[r]===".."||!i.dot&&n[r].charAt(0)===".")return!1;return!0}for(;c<s;){var d=n[c];if(this.debug(`
globstar while`,n,c,e,h,d),this.matchOne(n.slice(c),e.slice(h),t))return this.debug("globstar found match!",c,s,d),!0;if(d==="."||d===".."||!i.dot&&d.charAt(0)==="."){this.debug("dot detected!",n,c,e,h);break}this.debug("globstar swallow a segment, and continue"),c++}return!!(t&&(this.debug(`
>>> no match, partial?`,n,c,e,h),c===s))}var g;if(typeof l=="string"?(i.nocase?g=u.toLowerCase()===l.toLowerCase():g=u===l,this.debug("string match",l,u,g)):(g=u.match(l),this.debug("pattern match",l,u,g)),!g)return!1}if(r===s&&o===a)return!0;if(r===s)return t;if(o===a){var f=r===s-1&&n[r]==="";return f}throw new Error("wtf?")};function ame(n){return n.replace(/\\(.)/g,"$1")}function lme(n){return n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var BB=m(Hk=>{var hl=require("path"),Xs=process.platform==="win32",$s=require("fs"),ume=process.env.NODE_DEBUG&&/fs/.test(process.env.NODE_DEBUG);function cme(){var n;if(ume){var e=new Error;n=t}else n=i;return n;function t(r){r&&(e.message=r.message,r=e,i(r))}function i(r){if(r){if(process.throwDeprecation)throw r;if(!process.noDeprecation){var o="fs: missing callback "+(r.stack||r.message);process.traceDeprecation?console.trace(o):console.error(o)}}}}function hme(n){return typeof n=="function"?n:cme()}var iRe=hl.normalize;Xs?Yo=/(.*?)(?:[\/\\]+|$)/g:Yo=/(.*?)(?:[\/]+|$)/g;var Yo;Xs?lg=/^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/:lg=/^[\/]*/;var lg;Hk.realpathSync=function(e,t){if(e=hl.resolve(e),t&&Object.prototype.hasOwnProperty.call(t,e))return t[e];var i=e,r={},o={},s,a,l,u;c();function c(){var b=lg.exec(e);s=b[0].length,a=b[0],l=b[0],u="",Xs&&!o[l]&&($s.lstatSync(l),o[l]=!0)}for(;s<e.length;){Yo.lastIndex=s;var h=Yo.exec(e);if(u=a,a+=h[0],l=u+h[1],s=Yo.lastIndex,!(o[l]||t&&t[l]===l)){var d;if(t&&Object.prototype.hasOwnProperty.call(t,l))d=t[l];else{var g=$s.lstatSync(l);if(!g.isSymbolicLink()){o[l]=!0,t&&(t[l]=l);continue}var f=null;if(!Xs){var p=g.dev.toString(32)+":"+g.ino.toString(32);r.hasOwnProperty(p)&&(f=r[p])}f===null&&($s.statSync(l),f=$s.readlinkSync(l)),d=hl.resolve(u,f),t&&(t[l]=d),Xs||(r[p]=f)}e=hl.resolve(d,e.slice(s)),c()}}return t&&(t[i]=e),e};Hk.realpath=function(e,t,i){if(typeof i!="function"&&(i=hme(t),t=null),e=hl.resolve(e),t&&Object.prototype.hasOwnProperty.call(t,e))return process.nextTick(i.bind(null,null,t[e]));var r=e,o={},s={},a,l,u,c;h();function h(){var b=lg.exec(e);a=b[0].length,l=b[0],u=b[0],c="",Xs&&!s[u]?$s.lstat(u,function(y){if(y)return i(y);s[u]=!0,d()}):process.nextTick(d)}function d(){if(a>=e.length)return t&&(t[r]=e),i(null,e);Yo.lastIndex=a;var b=Yo.exec(e);return c=l,l+=b[0],u=c+b[1],a=Yo.lastIndex,s[u]||t&&t[u]===u?process.nextTick(d):t&&Object.prototype.hasOwnProperty.call(t,u)?p(t[u]):$s.lstat(u,g)}function g(b,y){if(b)return i(b);if(!y.isSymbolicLink())return s[u]=!0,t&&(t[u]=u),process.nextTick(d);if(!Xs){var w=y.dev.toString(32)+":"+y.ino.toString(32);if(o.hasOwnProperty(w))return f(null,o[w],u)}$s.stat(u,function(x){if(x)return i(x);$s.readlink(u,function(k,L){Xs||(o[w]=L),f(k,L)})})}function f(b,y,w){if(b)return i(b);var x=hl.resolve(c,y);t&&(t[w]=x),p(x)}function p(b){e=hl.resolve(b,e.slice(a)),h()}}});var Wk=m((rRe,JB)=>{JB.exports=Us;Us.realpath=Us;Us.sync=Yk;Us.realpathSync=Yk;Us.monkeypatch=gme;Us.unmonkeypatch=fme;var pc=require("fs"),qk=pc.realpath,Bk=pc.realpathSync,dme=process.version,YB=/^v[0-5]\./.test(dme),WB=BB();function ZB(n){return n&&n.syscall==="realpath"&&(n.code==="ELOOP"||n.code==="ENOMEM"||n.code==="ENAMETOOLONG")}function Us(n,e,t){if(YB)return qk(n,e,t);typeof e=="function"&&(t=e,e=null),qk(n,e,function(i,r){ZB(i)?WB.realpath(n,e,t):t(i,r)})}function Yk(n,e){if(YB)return Bk(n,e);try{return Bk(n,e)}catch(t){if(ZB(t))return WB.realpathSync(n,e);throw t}}function gme(){pc.realpath=Us,pc.realpathSync=Yk}function fme(){pc.realpath=qk,pc.realpathSync=Bk}});var $B=m((oRe,Zk)=>{typeof Object.create=="function"?Zk.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Zk.exports=function(e,t){if(t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}}});var XB=m((sRe,$k)=>{try{if(Jk=require("util"),typeof Jk.inherits!="function")throw"";$k.exports=Jk.inherits}catch{$k.exports=$B()}var Jk});var ib=m((aRe,tb)=>{"use strict";function UB(n){return n.charAt(0)==="/"}funct
See: https://github.com/isaacs/node-glob/issues/167`);return new Vt(n,e).found}function Vt(n,e){if(!n)throw new Error("must provide pattern");if(typeof e=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof Vt))return new Vt(n,e);if(kme(this,n,e),this.noprocess)return this;var t=this.minimatch.set.length;this.matches=new Array(t);for(var i=0;i<t;i++)this._process(this.minimatch.set[i],i,!1);this._finish()}Vt.prototype._finish=function(){if(eY(this instanceof Vt),this.realpath){var n=this;this.matches.forEach(function(e,t){var i=n.matches[t]=Object.create(null);for(var r in e)try{r=n._makeAbs(r);var o=Tme.realpathSync(r,n.realpathCache);i[o]=!0}catch(s){if(s.syscall==="stat")i[n._makeAbs(r)]=!0;else throw s}})}dl.finish(this)};Vt.prototype._process=function(n,e,t){eY(this instanceof Vt);for(var i=0;typeof n[i]=="string";)i++;var r;switch(i){case n.length:this._processSimple(n.join("/"),e);return;case 0:r=null;break;default:r=n.slice(0,i).join("/");break}var o=n.slice(i),s;r===null?s=".":((nb(r)||nb(n.join("/")))&&(!r||!nb(r))&&(r="/"+r),s=r);var a=this._makeAbs(s);if(!Dme(this,s)){var l=o[0]===VB.GLOBSTAR;l?this._processGlobStar(r,s,a,o,e,t):this._processReaddir(r,s,a,o,e,t)}};Vt.prototype._processReaddir=function(n,e,t,i,r,o){var s=this._readdir(t,o);if(!!s){for(var a=i[0],l=!!this.minimatch.negate,u=a._glob,c=this.dot||u.charAt(0)===".",h=[],d=0;d<s.length;d++){var g=s[d];if(g.charAt(0)!=="."||c){var f;l&&!n?f=!g.match(a):f=g.match(a),f&&h.push(g)}}var p=h.length;if(p!==0){if(i.length===1&&!this.mark&&!this.stat){this.matches[r]||(this.matches[r]=Object.create(null));for(var d=0;d<p;d++){var g=h[d];n&&(n.slice(-1)!=="/"?g=n+"/"+g:g=n+g),g.charAt(0)==="/"&&!this.nomount&&(g=Gk.join(this.root,g)),this._emitMatch(r,g)}return}i.shift();for(var d=0;d<p;d++){var g=h[d],b;n?b=[n,g]:b=[g],this._process(b.concat(i),r,o)}}}};Vt.prototype._emitMatch=function(n,e){if(!Eme(this,e)){var t=this._makeAbs(e);if(this.mark&&(e=this._mark(e)),this.absolute&&(e=t),!this.matches[n][e]){if(this.nodir){var i=this.cache[t];if(i==="DIR"||Array.isArray(i))return}this.matches[n][e]=!0,this.stat&&this._stat(e)}}};Vt.prototype._readdirInGlobStar=function(n){if(this.follow)return this._readdir(n,!1);var e,t,i;try{t=this.fs.lstatSync(n)}catch(o){if(o.code==="ENOENT")return null}var r=t&&t.isSymbolicLink();return this.symlinks[n]=r,!r&&t&&!t.isDirectory()?this.cache[n]="FILE":e=this._readdir(n,!1),e};Vt.prototype._readdir=function(n,e){var t;if(e&&!Kk(this.symlinks,n))return this._readdirInGlobStar(n);if(Kk(this.cache,n)){var i=this.cache[n];if(!i||i==="FILE")return null;if(Array.isArray(i))return i}try{return this._readdirEntries(n,this.fs.readdirSync(n))}catch(r){return this._readdirError(n,r),null}};Vt.prototype._readdirEntries=function(n,e){if(!this.mark&&!this.stat)for(var t=0;t<e.length;t++){var i=e[t];n==="/"?i=n+i:i=n+"/"+i,this.cache[i]=!0}return this.cache[n]=e,e};Vt.prototype._readdirError=function(n,e){switch(e.code){case"ENOTSUP":case"ENOTDIR":var t=this._makeAbs(n);if(this.cache[t]="FILE",t===this.cwdAbs){var i=new Error(e.code+" invalid cwd "+this.cwd);throw i.path=this.cwd,i.code=e.code,i}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(n)]=!1;break;default:if(this.cache[this._makeAbs(n)]=!1,this.strict)throw e;this.silent||console.error("glob error",e);break}};Vt.prototype._processGlobStar=function(n,e,t,i,r,o){var s=this._readdir(t,o);if(!!s){var a=i.slice(1),l=n?[n]:[],u=l.concat(a);this._process(u,r,!1);var c=s.length,h=this.symlinks[t];if(!(h&&o))for(var d=0;d<c;d++){var g=s[d];if(!(g.charAt(0)==="."&&!this.dot)){var f=l.concat(s[d],a);this._process(f,r,!0);var p=l.concat(s[d],i);this._process(p,r,!0)}}}};Vt.prototype._processSimple=function(n,e){var t=this._stat(n);if(this.matches[e]||(this.matches[e]=Object.create(null)),!!t){if(n&&nb(n)&&!this.nomount){var i=/[\/\\]$/.test(n);n.charAt(0)==="/"?n=Gk.join(this.root,n):(n=Gk.resolve(this.root,n),i&&(n+="/"))}process.platform==="win32"&&(n=n.replace(/\\/g,"/")),this._emitMatch(e,n)}};Vt.prototype._stat=function(n){var e=this._makeAbs(n),t=n.slice(-1)==="/";if(n.length>this.maxLength)return!1;if(!this.stat&&Kk(this.cache,e)){var s=this.cache[e];if(Array.isArray(s)&&(s="DIR
`)}_append(e){let{nvim:t}=this,i=this.lines.length-1,r=e.split(/\r?\n/),o=this.lines[i]+r[0];this.lines[i]=o;let s=r.slice(1);this.lines=this.lines.concat(s),this.created&&(t.pauseNotification(),t.call("setbufline",[this.bufname,"$",o],!0),s.length&&t.call("appendbufline",[this.bufname,"$",s],!0),t.resumeNotification(!1,!0))}append(e){!this.validate()||this._append(e)}appendLine(e){!this.validate()||this._append(e+`
`)}clear(e){if(!this.validate())return;let{nvim:t}=this;this.lines=e?this.lines.slice(-e):[],this.created&&(t.pauseNotification(),t.call("deletebufline",[this.bufname,1,"$"],!0),this.lines.length&&t.call("appendbufline",[this.bufname,"$",this.lines],!0),t.resumeNotification(!0,!0))}hide(){this.created=!1,this.nvim.command(`exe 'silent! bd! '.fnameescape('${this.bufname}')`,!0)}get bufname(){return`output:///${this.name}`}show(e){let{nvim:t}=this;t.pauseNotification(),t.command(`exe 'vsplit '.fnameescape('${this.bufname}')`,!0),e&&t.command("wincmd p",!0),t.resumeNotification(!0,!0),this.created=!0}validate(){return!this._disposed}dispose(){this.onDispose&&this.onDispose(),this._disposed=!0,this.hide(),this.lines=[]}}});var kRe,DY,Wo,gb=P(()=>{"use strict";he();kY();kRe=Y()("core-channels"),DY=class{constructor(){this.outputChannels=new Map;this.bufnrs=new Map;this.disposable=_.on("BufUnload",e=>{let t=this.bufnrs.get(e);if(t){let i=this.outputChannels.get(t);i&&(i.created=!1)}})}getProvider(e){return{onDidChange:null,provideTextDocumentContent:async i=>{let r=this.get(i.path.slice(1));if(!r)return"";e.pauseNotification(),e.call("bufnr",["%"],!0),e.command("setlocal nospell nofoldenable nowrap noswapfile",!0),e.command("setlocal buftype=nofile bufhidden=hide",!0),e.command("setfiletype log",!0);let o=await e.resumeNotification();return this.bufnrs.set(o[0][0],r.name),r.created=!0,r.content}}}get names(){return Array.from(this.outputChannels.keys())}get(e){return this.outputChannels.get(e)}create(e,t){if(this.outputChannels.has(e))return this.outputChannels.get(e);let i=new db(e,t,()=>{this.outputChannels.delete(e)});return this.outputChannels.set(e,i),i}show(e,t){let i=this.outputChannels.get(e);!i||i.show(t)}dispose(){this.disposable.dispose();for(let e of this.outputChannels.values())e.dispose();this.outputChannels.clear()}},Wo=new DY});var ERe,fb,EY=P(()=>{"use strict";ERe=Y()("model-terminal"),fb=class{constructor(e,t,i,r,o){this.cmd=e;this.args=t;this.nvim=i;this._name=r;this.strictEnv=o;this.pid=0}async start(e,t){let{nvim:i}=this,r=[this.cmd,...this.args],[o,s]=await i.call("coc#terminal#start",[r,e,t||{},!!this.strictEnv]);this.bufnr=o,this.pid=s}onExit(e){this.exitStatus={code:e===-1?void 0:e}}get name(){return this._name||this.cmd}get processId(){return Promise.resolve(this.pid)}sendText(e,t=!0){!this.bufnr||this.nvim.call("coc#terminal#send",[this.bufnr,e,t],!0)}async show(e){let{bufnr:t,nvim:i}=this;if(!t)return;let[r,o,s]=await i.eval(`[bufloaded(${t}),bufwinid(${t}),win_getid()]`);return r?(s==o||(i.pauseNotification(),o==-1?(i.command(`below ${t}sb`,!0),i.command("resize 8",!0),i.call("coc#util#do_autocmd",["CocTerminalOpen"],!0)):i.call("win_gotoid",[o],!0),i.command("normal! G",!0),e&&i.command("wincmd p",!0),await i.resumeNotification()),!0):!1}async hide(){let{bufnr:e,nvim:t}=this;!e||await t.eval(`coc#window#close(bufwinid(${e}))`)}dispose(){this.exitStatus||(this.exitStatus={code:void 0});let{bufnr:e,nvim:t}=this;!e||(this.bufnr=void 0,t.call("coc#terminal#close",[e],!0))}}});var cD,Zme,pb,_Y=P(()=>{"use strict";EY();cD=S(q());z();he();Zme=Y()("core-terminals"),pb=class{constructor(){this._terminals=new Map;this.disposables=[];this._onDidOpenTerminal=new cD.Emitter;this._onDidCloseTerminal=new cD.Emitter;this.onDidCloseTerminal=this._onDidCloseTerminal.event;this.onDidOpenTerminal=this._onDidOpenTerminal.event;_.on("BufUnload",e=>{if(this._terminals.has(e)){Zme.debug("terminal detach",e);let t=this._terminals.get(e);this._onDidCloseTerminal.fire(t),this._terminals.delete(e)}},null,this.disposables),_.on("TermExit",(e,t)=>{let i=this._terminals.get(e);i&&(i.onExit(t),i.dispose())},null,this.disposables)}get terminals(){return Array.from(this._terminals.values())}async createTerminal(e,t){let i=t.cwd,r=t.shellPath,o=t.shellArgs;r||(r=await e.getOption("shell")),i||(i=await e.call("getcwd"));let s=new fb(r,o||[],e,t.name,t.strictEnv);return await s.start(i,t.env),this._terminals.set(s.bufnr,s),this._onDidOpenTerminal.fire(s),s}reset(){for(let e of this._terminals.values())e.dispose();this._terminals.cle
`)],!0)}async function IY(n,e){if(e==="line"){let i=await n.call("line",["."]);return wc.Range.create(i-1,0,i,0)}if(e==="cursor"){let[i,r]=await n.eval("coc#cursor#position()");return wc.Range.create(i,r,i,r)}let t=await n.call("coc#cursor#get_selection",[e==="char"?1:0]);return t?wc.Range.create(t[0],t[1],t[2],t[3]):null}async function jY(n,e,t){let{start:i,end:r}=e,[o,s]=await n.eval(`[getline(${i.line+1}),getline(${r.line+1})]`),a=o.length>0?V(o.slice(0,i.character)):0,l,u,c=r.character==0;if(c){u=r.line==0?0:r.line-1;let h=await n.call("getline",[u+1]);l=V(h)}else u=r.line,l=s.length>0?V(s.slice(0,r.character)):0;n.pauseNotification(),n.command(`noa call cursor(${i.line+1},${a+1})`,!0),n.command("normal! v",!0),n.command(`noa call cursor(${u+1},${l})`,!0),c&&n.command("normal! $",!0),await n.resumeNotification(t)}var wc,Jme,bb=P(()=>{"use strict";wc=S(q());Fe();Jme=process.env.VIM_NODE_RPC=="1"});var yb,dD=P(()=>{yb="0.0.80"});var gg,fg,vb,wb,pg,xb,Lr=P(()=>{"use strict";gg=(i=>(i[i.Buffer=0]="Buffer",i[i.LanguageServer=1]="LanguageServer",i[i.Global=2]="Global",i))(gg||{}),fg=(i=>(i[i.Native=0]="Native",i[i.Remote=1]="Remote",i[i.Service=2]="Service",i))(fg||{}),vb=(i=>(i[i.More=0]="More",i[i.Warning=1]="Warning",i[i.Error=2]="Error",i))(vb||{}),wb=(i=>(i[i.Global=0]="Global",i[i.User=1]="User",i[i.Workspace=2]="Workspace",i))(wb||{}),pg=(s=>(s[s.Initial=0]="Initial",s[s.Starting=1]="Starting",s[s.StartFailed=2]="StartFailed",s[s.Running=3]="Running",s[s.Stopping=4]="Stopping",s[s.Stopped=5]="Stopped",s))(pg||{}),xb=(r=>(r[r.Unknown=0]="Unknown",r[r.File=1]="File",r[r.Directory=2]="Directory",r[r.SymbolicLink=64]="SymbolicLink",r))(xb||{})});function gD(n,e){if(n.length<=1)return n;let t=n.length/2|0,i=n.slice(0,t),r=n.slice(t);gD(i,e),gD(r,e);let o=0,s=0,a=0;for(;o<i.length&&s<r.length;)e(i[o],r[s])<=0?n[a++]=i[o++]:n[a++]=r[s++];for(;o<i.length;)n[a++]=i[o++];for(;s<r.length;)n[a++]=r[s++];return n}function FY(n,e,t=0){let i=e?[t]:[];for(let r=0;r<n.length;r++){let o=n.charCodeAt(r);(o===13||o===10)&&(o===13&&r+1<n.length&&n.charCodeAt(r+1)===10&&r++,i.push(t+r+1))}return i}function OY(n){let e=n.start,t=n.end;return e.line>t.line||e.line===t.line&&e.character>t.character?{start:t,end:e}:n}function Xme(n){let e=OY(n.range);return e!==n.range?{newText:n.newText,range:e}:n}var Cc,Fn,Sc=P(()=>{"use strict";Cc=class{constructor(e,t,i,r){this._uri=e,this._languageId=t,this._version=i,this._content=r,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let t=this.offsetAt(e.start),i=this.offsetAt(e.end);return this._content.substring(t,i)}return this._content}update(e,t){for(let i of e)if(Cc.isIncremental(i)){let r=OY(i.range),o=this.offsetAt(r.start),s=this.offsetAt(r.end);this._content=this._content.substring(0,o)+i.text+this._content.substring(s,this._content.length);let a=Math.max(r.start.line,0),l=Math.max(r.end.line,0),u=this._lineOffsets,c=FY(i.text,!1,o);if(l-a===c.length)for(let d=0,g=c.length;d<g;d++)u[d+a+1]=c[d];else c.length<1e4?u.splice(a+1,l-a,...c):this._lineOffsets=u=u.slice(0,a+1).concat(c,u.slice(l+1));let h=i.text.length-(s-o);if(h!==0)for(let d=a+1+c.length,g=u.length;d<g;d++)u[d]=u[d]+h}else if(Cc.isFull(i))this._content=i.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=t}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=FY(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),i=0,r=t.length;if(r===0)return{line:0,character:e};for(;i<r;){let s=Math.floor((i+r)/2);t[s]>e?r=s:i=s+1}let o=i-1;return{line:o,character:e-t[o]}}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let i=t[e.line],r=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(i+e.character,r),i)}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let t=e;return t!=null&&typeof t.text=="string"&&t.ra
`;break;case 114:x+="\r";break;case 116:x+=" ";break;case 117:var O=d(4,!0);O>=0?x+=String.fromCharCode(O):h=4;break;default:h=5}k=i;continue}if(L>=0&&L<=31)if(mg(L)){x+=n.substring(k,i),h=2;break}else h=6;i++}return x}function b(){if(r="",h=0,o=i,l=a,c=u,i>=t)return o=t,s=17;var x=n.charCodeAt(i);if(fD(x)){do i++,r+=String.fromCharCode(x),x=n.charCodeAt(i);while(fD(x));return s=15}if(mg(x))return i++,r+=String.fromCharCode(x),x===13&&n.charCodeAt(i)===10&&(i++,r+=`
`),a++,u=i,s=14;switch(x){case 123:return i++,s=1;case 125:return i++,s=2;case 91:return i++,s=3;case 93:return i++,s=4;case 58:return i++,s=6;case 44:return i++,s=5;case 34:return i++,r=p(),s=10;case 47:var k=i-1;if(n.charCodeAt(i+1)===47){for(i+=2;i<t&&!mg(n.charCodeAt(i));)i++;return r=n.substring(k,i),s=12}if(n.charCodeAt(i+1)===42){i+=2;for(var L=t-1,j=!1;i<L;){var O=n.charCodeAt(i);if(O===42&&n.charCodeAt(i+1)===47){i+=2,j=!0;break}i++,mg(O)&&(O===13&&n.charCodeAt(i)===10&&i++,a++,u=i)}return j||(i++,h=1),r=n.substring(k,i),s=13}return r+=String.fromCharCode(x),i++,s=16;case 45:if(r+=String.fromCharCode(x),i++,i===t||!Tc(n.charCodeAt(i)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return r+=f(),s=11;default:for(;i<t&&y(x);)i++,x=n.charCodeAt(i);if(o!==i){switch(r=n.substring(o,i),r){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return r+=String.fromCharCode(x),i++,s=16}}function y(x){if(fD(x)||mg(x))return!1;switch(x){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function w(){var x;do x=b();while(x>=12&&x<=15);return x}return{setPosition:g,getPosition:function(){return i},scan:e?w:b,getToken:function(){return s},getTokenValue:function(){return r},getTokenOffset:function(){return o},getTokenLength:function(){return i-o},getTokenStartLine:function(){return l},getTokenStartCharacter:function(){return o-c},getTokenError:function(){return h}}}function fD(n){return n===32||n===9||n===11||n===12||n===160||n===5760||n>=8192&&n<=8203||n===8239||n===8287||n===12288||n===65279}function mg(n){return n===10||n===13||n===8232||n===8233}function Tc(n){return n>=48&&n<=57}var Cb=P(()=>{"use strict"});function mD(n,e,t){var i,r,o,s,a;if(e){for(s=e.offset,a=s+e.length,o=s;o>0&&!yg(n,o-1);)o--;for(var l=a;l<n.length&&!yg(n,l);)l++;r=n.substring(o,l),i=Gme(r,t)}else r=n,i=0,o=0,s=0,a=n.length;var u=Kme(t,n),c=!1,h=0,d;t.insertSpaces?d=pD(" ",t.tabSize||4):d=" ";var g=bg(r,!1),f=!1;function p(){return u+pD(d,i+h)}function b(){var A=g.scan();for(c=!1;A===15||A===14;)c=c||A===14,A=g.scan();return f=A===16||g.getTokenError()!==0,A}var y=[];function w(A,Z,K){!f&&(!e||Z<a&&K>s)&&n.substring(Z,K)!==A&&y.push({offset:Z,length:K-Z,content:A})}var x=b();if(x!==17){var k=g.getTokenOffset()+o,L=pD(d,i);w(L,o,k)}for(;x!==17;){for(var j=g.getTokenOffset()+g.getTokenLength()+o,O=b(),W="",H=!1;!c&&(O===12||O===13);){var N=g.getTokenOffset()+o;w(" ",j,N),j=g.getTokenOffset()+g.getTokenLength()+o,H=O===12,W=H?p():"",O=b()}if(O===2)x!==1&&(h--,W=p());else if(O===4)x!==3&&(h--,W=p());else{switch(x){case 3:case 1:h++,W=p();break;case 5:case 12:W=p();break;case 13:c?W=p():H||(W=" ");break;case 6:H||(W=" ");break;case 10:if(O===6){H||(W="");break}case 7:case 8:case 9:case 11:case 2:case 4:O===12||O===13?H||(W=" "):O!==5&&O!==17&&(f=!0);break;case 16:f=!0;break}c&&(O===12||O===13)&&(W=p())}O===17&&(W=t.insertFinalNewline?u:"");var I=g.getTokenOffset()+o;w(W,j,I),x=O}return y}function pD(n,e){for(var t="",i=0;i<e;i++)t+=n;return t}function Gme(n,e){for(var t=0,i=0,r=e.tabSize||4;t<n.length;){var o=n.charAt(t);if(o===" ")i++;else if(o===" ")i+=r;else break;t++}return Math.floor(i/r)}function Kme(n,e){for(var t=0;t<e.length;t++){var i=e.charAt(t);if(i==="\r")return t+1<e.length&&e.charAt(t+1)===`
`?`\r
`:"\r";if(i===`
`)return`
`}return n&&n.eol||`
`}function yg(n,e){return`\r
`.indexOf(n.charAt(e))!==-1}var bD=P(()=>{"use strict";Cb()});function MY(n,e,t){e===void 0&&(e=[]),t===void 0&&(t=vg.DEFAULT);var i=null,r=[],o=[];function s(l){Array.isArray(r)?r.push(l):i!==null&&(r[i]=l)}var a={onObjectBegin:function(){var l={};s(l),o.push(r),r=l,i=null},onObjectProperty:function(l){i=l},onObjectEnd:function(){r=o.pop()},onArrayBegin:function(){var l=[];s(l),o.push(r),r=l,i=null},onArrayEnd:function(){r=o.pop()},onLiteralValue:s,onError:function(l,u,c){e.push({error:l,offset:u,length:c})}};return vD(n,a,t),r[0]}function yD(n,e,t){e===void 0&&(e=[]),t===void 0&&(t=vg.DEFAULT);var i={type:"array",offset:-1,length:-1,children:[],parent:void 0};function r(l){i.type==="property"&&(i.length=l-i.offset,i=i.parent)}function o(l){return i.children.push(l),l}var s={onObjectBegin:function(l){i=o({type:"object",offset:l,length:-1,parent:i,children:[]})},onObjectProperty:function(l,u,c){i=o({type:"property",offset:u,length:-1,parent:i,children:[]}),i.children.push({type:"string",value:l,offset:u,length:c,parent:i})},onObjectEnd:function(l,u){r(l+u),i.length=l+u-i.offset,i=i.parent,r(l+u)},onArrayBegin:function(l,u){i=o({type:"array",offset:l,length:-1,parent:i,children:[]})},onArrayEnd:function(l,u){i.length=l+u-i.offset,i=i.parent,r(l+u)},onLiteralValue:function(l,u,c){o({type:Qme(l),offset:u,length:c,parent:i,value:l}),r(u+c)},onSeparator:function(l,u,c){i.type==="property"&&(l===":"?i.colonOffset=u:l===","&&r(u))},onError:function(l,u,c){e.push({error:l,offset:u,length:c})}};vD(n,s,t);var a=i.children[0];return a&&delete a.parent,a}function Sb(n,e){if(!!n){for(var t=n,i=0,r=e;i<r.length;i++){var o=r[i];if(typeof o=="string"){if(t.type!=="object"||!Array.isArray(t.children))return;for(var s=!1,a=0,l=t.children;a<l.length;a++){var u=l[a];if(Array.isArray(u.children)&&u.children[0].value===o){t=u.children[1],s=!0;break}}if(!s)return}else{var c=o;if(t.type!=="array"||c<0||!Array.isArray(t.children)||c>=t.children.length)return;t=t.children[c]}}return t}}function vD(n,e,t){t===void 0&&(t=vg.DEFAULT);var i=bg(n,!1);function r(H){return H?function(){return H(i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter())}:function(){return!0}}function o(H){return H?function(N){return H(N,i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter())}:function(){return!0}}var s=r(e.onObjectBegin),a=o(e.onObjectProperty),l=r(e.onObjectEnd),u=r(e.onArrayBegin),c=r(e.onArrayEnd),h=o(e.onLiteralValue),d=o(e.onSeparator),g=r(e.onComment),f=o(e.onError),p=t&&t.disallowComments,b=t&&t.allowTrailingComma;function y(){for(;;){var H=i.scan();switch(i.getTokenError()){case 4:w(14);break;case 5:w(15);break;case 3:w(13);break;case 1:p||w(11);break;case 2:w(12);break;case 6:w(16);break}switch(H){case 12:case 13:p?w(10):g();break;case 16:w(1);break;case 15:case 14:break;default:return H}}}function w(H,N,I){if(N===void 0&&(N=[]),I===void 0&&(I=[]),f(H),N.length+I.length>0)for(var A=i.getToken();A!==17;){if(N.indexOf(A)!==-1){y();break}else if(I.indexOf(A)!==-1)break;A=y()}}function x(H){var N=i.getTokenValue();return H?h(N):a(N),y(),!0}function k(){switch(i.getToken()){case 11:var H=i.getTokenValue(),N=Number(H);isNaN(N)&&(w(2),N=0),h(N);break;case 7:h(null);break;case 8:h(!0);break;case 9:h(!1);break;default:return!1}return y(),!0}function L(){return i.getToken()!==10?(w(3,[],[2,5]),!1):(x(!1),i.getToken()===6?(d(":"),y(),W()||w(4,[],[2,5])):w(5,[],[2,5]),!0)}function j(){s(),y();for(var H=!1;i.getToken()!==2&&i.getToken()!==17;){if(i.getToken()===5){if(H||w(4,[],[]),d(","),y(),i.getToken()===2&&b)break}else H&&w(6,[],[]);L()||w(4,[],[2,5]),H=!0}return l(),i.getToken()!==2?w(7,[2],[]):y(),!0}function O(){u(),y();for(var H=!1;i.getToken()!==4&&i.getToken()!==17;){if(i.getToken()===5){if(H||w(4,[],[]),d(","),y(),i.getToken()===4&&b)break}else H&&w(6,[],[]);W()||w(4,[],[4,5]),H=!0}return c(),i.getToken()!==4?w(8,[4],[]):y(),!0}function W(){switch(i.getToken()){case 3:return O();case 1:return j();case 10:return x(!0);default:return k()}}return y(),i.getToken()===17?t.allowEmptyContent?!0
augroup coc_dynamic_autocmd
autocmd!
${i.join(`
`)}
augroup end`;if(this.nvim.hasFunction("nvim_exec"))this.nvim.exec(r,!1);else{let o=PD.default.join(process.env.TMPDIR||QY.default.tmpdir(),`coc.nvim-${process.pid}.vim`);_D.default.mkdirSync(o,{recursive:!0});let s=PD.default.join(o,`coc-${process.pid}.vim`);_D.default.writeFileSync(s,r,"utf8");let a=`source ${s}`;this.env.isCygwin&&qo.isWindows&&(a=`execute "source" . substitute(system('cygpath ${s.replace(/\\/g,"/")}'), '\\n', '', 'g')`),this.nvim.command(a)}}dispose(){this.nvim.command("augroup coc_dynamic_autocmd| autocmd!|augroup end",!0),J(this.disposables)}}});var bl,Ib,tW=P(()=>{"use strict";bl=S(q());we();he();z();Ib=class{constructor(e){this.documents=e;this.disposables=[];this.providers=new Map;this._onDidProviderChange=new bl.Emitter;this.onDidProviderChange=this._onDidProviderChange.event}attach(e){this.nvim=e,_.on("BufReadCmd",this.onBufReadCmd,this,this.disposables)}get schemes(){return Array.from(this.providers.keys())}async onBufReadCmd(e,t){let i=this.providers.get(e);if(!i)return;let r=new bl.CancellationTokenSource,o=await Promise.resolve(i.provideTextDocumentContent(M.parse(t),r.token)),s=await this.nvim.buffer;await s.setLines(o.split(/\r?\n/),{start:0,end:-1,strictIndexing:!1}),process.nextTick(()=>{_.fire("BufCreate",[s.id])})}registerTextDocumentContentProvider(e,t){this.providers.set(e,t),this._onDidProviderChange.fire();let i=[];return t.onDidChange&&t.onDidChange(async r=>{let{buffer:o}=this.documents.getDocument(r.toString()),s=new bl.CancellationTokenSource,a=await Promise.resolve(t.provideTextDocumentContent(r,s.token));await o.setLines(a.split(/\r?\n/),{start:0,end:-1,strictIndexing:!1})},null,i),bl.Disposable.create(()=>{this.providers.delete(e),J(i),this._onDidProviderChange.fire()})}dispose(){J(this.disposables),this._onDidProviderChange.dispose(),this.providers.clear()}}});var rW=m((YLe,jb)=>{"use strict";jb.exports=cbe;jb.exports.format=iW;jb.exports.parse=nW;var abe=/\B(?=(\d{3})+(?!\d))/g,lbe=/(?:\.0*|(\.[^0]+)0+)$/,zs={b:1,kb:1<<10,mb:1<<20,gb:1<<30,tb:Math.pow(1024,4),pb:Math.pow(1024,5)},ube=/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;function cbe(n,e){return typeof n=="string"?nW(n):typeof n=="number"?iW(n,e):null}function iW(n,e){if(!Number.isFinite(n))return null;var t=Math.abs(n),i=e&&e.thousandsSeparator||"",r=e&&e.unitSeparator||"",o=e&&e.decimalPlaces!==void 0?e.decimalPlaces:2,s=Boolean(e&&e.fixedDecimals),a=e&&e.unit||"";(!a||!zs[a.toLowerCase()])&&(t>=zs.pb?a="PB":t>=zs.tb?a="TB":t>=zs.gb?a="GB":t>=zs.mb?a="MB":t>=zs.kb?a="KB":a="B");var l=n/zs[a.toLowerCase()],u=l.toFixed(o);return s||(u=u.replace(lbe,"$1")),i&&(u=u.replace(abe,i)),u+r+a}function nW(n){if(typeof n=="number"&&!isNaN(n))return n;if(typeof n!="string")return null;var e=ube.exec(n),t,i="b";return e?(t=parseFloat(e[1]),i=e[4].toLowerCase()):(t=parseInt(n,10),i="b"),Math.floor(zs[i]*t)}});var Ob=m((WLe,hW)=>{var eo=-1,Ir=1,dn=0;function Sg(n,e,t,i){if(n===e)return n?[[dn,n]]:[];if(t!=null){var r=pbe(n,e,t);if(r)return r}var o=LD(n,e),s=n.substring(0,o);n=n.substring(o),e=e.substring(o),o=ID(n,e);var a=n.substring(n.length-o);n=n.substring(0,n.length-o),e=e.substring(0,e.length-o);var l=hbe(n,e);return s&&l.unshift([dn,s]),a&&l.push([dn,a]),sW(l,i),l}function hbe(n,e){var t;if(!n)return[[Ir,e]];if(!e)return[[eo,n]];var i=n.length>e.length?n:e,r=n.length>e.length?e:n,o=i.indexOf(r);if(o!==-1)return t=[[Ir,i.substring(0,o)],[dn,r],[Ir,i.substring(o+r.length)]],n.length>e.length&&(t[0][0]=t[2][0]=eo),t;if(r.length===1)return[[eo,n],[Ir,e]];var s=gbe(n,e);if(s){var a=s[0],l=s[1],u=s[2],c=s[3],h=s[4],d=Sg(a,u),g=Sg(l,c);return d.concat([[dn,h]],g)}return dbe(n,e)}function dbe(n,e){for(var t=n.length,i=e.length,r=Math.ceil((t+i)/2),o=r,s=2*r,a=new Array(s),l=new Array(s),u=0;u<s;u++)a[u]=-1,l[u]=-1;a[o+1]=0,l[o+1]=0;for(var c=t-i,h=c%2!==0,d=0,g=0,f=0,p=0,b=0;b<r;b++){for(var y=-b+d;y<=b-g;y+=2){var w=o+y,x;y===-b||y!==b&&a[w-1]<a[w+1]?x=a[w+1]:x=a[w-1]+1;for(var k=x-y;x<t&&k<i&&n.charAt(x)===e.charAt(k);)x++,k++;if(a[w]=x,x>t)g+=2;else if(k>i)d+=2;else if(h){var L=o+c-y;if(L>=0&&L<s&&l[L]!==-1){var j=t-l[L];
`)+`
`:"";if(!(d.length===0&&a===r-c))return ln.replace(Me.create(a,0,r-c,0),d)}var Mb,$Le,jD=P(()=>{"use strict";Mb=S(Ob());No();Fe();$Le=Y()("util-diff")});function Qs(n){let{newText:e}=n,t=Ab(n.range),i=t.end.line-t.start.line;return e.split(/\r?\n/).length-i-1}function Ab(n){let e=n.start,t=n.end;return e.line>t.line||e.line===t.line&&e.character>t.character?{start:t,end:e}:n}function FD(n,e){if(n.length<=1)return n;let t=n.length/2|0,i=n.slice(0,t),r=n.slice(t);FD(i,e),FD(r,e);let o=0,s=0,a=0;for(;o<i.length&&s<r.length;)e(i[o],r[s])<=0?n[a++]=i[o++]:n[a++]=r[s++];for(;o<i.length;)n[a++]=i[o++];for(;s<r.length;)n[a++]=r[s++];return n}function pW(n){let{changes:e,documentChanges:t}=n;return!(t&&t.length||e&&Object.keys(e).length)}function mW(n,e){let t=[],i=n.end,r=i.line>0&&i.character==0,o;for(let s=0;s<e.length;s++){let a=e[s],{newText:l}=a,u=xY(a.range);if(o){if(wY(o,u.start)&&Ct(u)&&l.length>0){let h=t[t.length-1];h.newText=l,o=void 0;continue}o=void 0}l.includes("\r")&&(l=l.replace(/\r\n/g,`
`));let c=xe(u.end,i);if(c>0&&(u.end={line:i.line,character:i.character}),n.getText(u)!==l){if(c===0&&r&&!Ct(u)&&l.endsWith(`
`)){l=l.slice(0,-1);let h=n.lines[i.line-1];u.end=Vs.Position.create(i.line-1,h.length)}else l.length==0&&(o=u.start);t.push({range:u,newText:l})}}return FD(t,(s,a)=>{let l=s.range.start.line-a.range.start.line;return l===0?s.range.start.character-a.range.start.character:l})}function bW(n,e){var s,a;if(e.length==1){let{start:l,end:u}=e[0].range,{lines:c}=n,h=(s=c[l.line])!=null?s:"",d=(a=c[u.line])!=null?a:"",g=h.substring(0,l.character)+e[0].newText+d.substring(u.character);return u.line>=c.length&&n.eol?g==""?[...c.slice(0,l.line)]:(g.endsWith(`
`)&&(g=g.slice(0,-1)),[...c.slice(0,l.line),...g.split(`
`)]):[...c.slice(0,l.line),...g.split(`
`),...c.slice(u.line+1)]}let t=n.getText(),i=0,r=[];for(let l of e){let u=n.offsetAt(l.range.start);if(u<i)throw new Error("Overlapping edit");u>i&&r.push(t.substring(i,u)),l.newText.length&&r.push(l.newText),i=n.offsetAt(l.range.end)}r.push(t.substring(i));let o=r.join("");if(o!==t)return iq(o,n.eol)}function yW(n,e){return e.map(t=>{var c,h;let{start:i,end:r}=t.range,o=(c=n[i.line])!=null?c:"",s=V(o.slice(0,i.character)),a=r.line==i.line?o:(h=n[r.line])!=null?h:"",l=V(a.slice(0,r.character)),{newText:u}=t;return[u.length>0?u.split(`
`):[],i.line,s,r.line,l]})}function Nb(n,e){let{range:t,newText:i}=e;if(xe(t.end,n)<=0){let r=i.split(`
`),o=r.length-(t.end.line-t.start.line)-1,s=n.character;if(t.end.line==n.line){let a=r[r.length-1].length;r.length>1?s=a+s-t.end.character:s=t.start.character+a+s-t.end.character}return{line:o,character:s-n.character}}return{line:0,character:0}}function mbe(n,e){let{line:t,character:i}=n,{range:r,newText:o}=e,{end:s}=r,a=o.split(`
`),l=a.length-(s.line-r.start.line)-1;if(a.length>1){let c=a[a.length-1].length;return{line:t+l,character:c+i-s.character}}let u=r.start.character-r.end.character;return{line:t+l,character:u+o.length+i}}function vW(n,e){let t=Vs.Position.create(n.line,n.character),i=!1;for(let r=e.length-1;r>=0;r--){let o=e[r];if(i){t.line+=Qs(o);continue}xe(o.range.end,t)>0||(o.range.end.line==t.line?t=mbe(t,o):(i=!0,t.line+=Qs(o)))}return t}function OD(n,e){let t=0;for(let i of e){let r=Ab(i.range);xe(r.end,n)<=0&&(t+=Qs(i))}return t}function wW(n,e,t){var c,h;let i=n[0].range.start,r=n[n.length-1].range.end,o=e.length-r.line,s=((c=e[r.line])!=null?c:"").length-r.character,a=t.length-o,l=((h=t[a])!=null?h:"").length-s,u=bbe(i,Vs.Position.create(a,l),t);return Vs.TextEdit.replace(Vs.Range.create(i,r),u)}function bbe(n,e,t){var r,o;if(n.line===e.line)return((r=t[n.line])!=null?r:"").slice(n.character,e.character);let i=[];for(let s=n.line;s<=e.line;s++){let a=(o=t[s])!=null?o:"";s===n.line?i.push(a.slice(n.character)):s===e.line?i.push(a.slice(0,e.character)):i.push(a)}return i.join(`
`)}var Vs,ea=P(()=>{"use strict";Vs=S(q());bt();Fe()});var MD,tIe,ir,Tg,xW=P(()=>{"use strict";MD=S(q());z();Sc();tIe=Y()("model-chars"),ir=class{constructor(e,t){this.start=e,this.end=t||e}static fromKeywordOption(e){let t=e.split(","),i=[];for(let r of t)if(r=="@")i.push(new ir(65,90)),i.push(new ir(97,122));else if(r=="@-@")i.push(new ir(64));else if(/^([A-Za-z])-([A-Za-z])$/.test(r)){let o=r.match(/^([A-Za-z])-([A-Za-z])$/);i.push(new ir(o[1].charCodeAt(0),o[2].charCodeAt(0)))}else if(/^\d+-\d+$/.test(r)){let o=r.match(/^(\d+)-(\d+)$/);i.push(new ir(Number(o[1]),Number(o[2])))}else if(/^\d+$/.test(r))i.push(new ir(Number(r)));else{let o=r.charCodeAt(0);i.some(s=>s.contains(o))||i.push(new ir(o))}return i}contains(e){return e>=this.start&&e<=this.end}},Tg=class{constructor(e){this.ranges=[];e&&(this.ranges=ir.fromKeywordOption(e))}addKeyword(e){let t=e.charCodeAt(0),{ranges:i}=this;i.some(r=>r.contains(t))||i.push(new ir(t))}clone(){let e=new Tg;return e.ranges=this.ranges.slice(),e}setKeywordOption(e){this.ranges=ir.fromKeywordOption(e)}async matchLines(e,t=2,i){let r=new Set,o=Date.now();for(let s of e){if(s.length===0)continue;let a="";Date.now()-o>15&&(await Ur(),o=Date.now());for(let l of s){if(i&&i.isCancellationRequested)return;let u=l.codePointAt(0);this.isKeywordCode(u)?a=a+l:a.length>0&&(a.length>=t&&a.length<48&&r.add(a),a="")}a.length>=t&&a.length<48&&r.add(a)}return r}isKeywordCode(e){return e>255?!0:e<33?!1:this.ranges.some(t=>t.contains(e))}isKeywordChar(e){let{ranges:t}=this;if(/\s/.test(e))return!1;let i=e.charCodeAt(0);return i>255?!0:i<33?!1:t.some(r=>r.contains(i))}isKeyword(e){for(let t=0,i=e.length;t<i;t++)if(!this.isKeywordChar(e[t]))return!1;return!0}getLocalifyBonus(e,t,i,r=10*1024){let o=new Map,s=Math.max(0,e.line-50),a=Math.min(i.length,e.line+50),l=i.slice(s,a).join(`
`);if(l.length>r){let p=l.length,b=!1;for(;a>e.line+1;){let y=i[a-1].length;if(p-y<r){b=!0;break}a=a-1,p-=y}if(!b)for(;s<=e.line;){let y=i[s].length;if(p-y<r)break;p-=y,s+=1}l=i.slice(s,a).join(`
`)}e=MD.Position.create(e.line-s,e.character),t=MD.Position.create(t.line-s,t.character);let u=Fn.create("","",1,l),c=u.offsetAt(e),h=l.length,d=h-u.offsetAt(t),g=0,f=!1;for(let p=0;p<c;p++){let b=this.isKeyword(l[p]);if(!f&&b)g=p;else if(f&&!b&&p-g>1){let y=l.substring(g,p);o.set(y,p/c)}f=b}g=h-d,f=!1;for(let p=g;p<l.length;p++){let b=this.isKeyword(l[p]);if(!f&&b)g=p;else if(f&&(!b||p==h-1)&&p-g>1){let y=p==h-1?p+1:p,w=l.substring(g,y),x=o.get(w)||0,k=h-p+(y-g);k!==d&&o.set(w,Math.max(x,k/d))}f=b}return o}}});var AD,ND,CW=P(()=>{"use strict";AD=S(q()),ND=class{constructor(e,t,i){this._line=e,this._text=t,this._isLastLine=i}get lineNumber(){return this._line}get text(){return this._text}get range(){return AD.Range.create(this._line,0,this._line,this._text.length)}get rangeIncludingLineBreak(){return this._isLastLine?this.range:AD.Range.create(this._line,0,this._line+1,0)}get firstNonWhitespaceCharacterIndex(){return/^(\s*)/.exec(this._text)[1].length}get isEmptyOrWhitespace(){return this.firstNonWhitespaceCharacterIndex===this._text.length}}});function ybe(n,e){let t=[],i=0;for(let r of n)t.push(i),i+=r.length+1;return e&&t.push(i),t}var Hb,kg,SW=P(()=>{"use strict";Hb=S(q());CW();kg=class{constructor(e,t,i,r,o,s){this.uri=e;this.languageId=t;this.version=i;this.lines=r;this.bufnr=o;this.eol=s}get content(){return this._content||(this._content=this.lines.join(`
`)+(this.eol?`
`:"")),this._content}get length(){if(!this._content){let e=this.lines.reduce((t,i)=>t+i.length+1,0);return this.eol?e:e-1}return this._content.length}get end(){let e=this.lineCount-1;return this.eol?Hb.Position.create(e,0):Hb.Position.create(e,this.lines[e].length)}get lineCount(){return this.lines.length+(this.eol?1:0)}getText(e){var t;if(e){let{start:i,end:r}=e;return i.line===r.line?i.character===r.character?"":((t=this.lines[i.line])!=null?t:"").substring(i.character,r.character):this.content.substring(this.offsetAt(e.start),this.offsetAt(e.end))}return this.content}lineAt(e){var i;let t=Hb.Position.is(e)?e.line:e;if(typeof t!="number"||t<0||t>=this.lineCount||Math.floor(t)!==t)throw new Error("Illegal value for `line`");return new ND(t,(i=this.lines[t])!=null?i:"",t===this.lineCount-1)}positionAt(e){e=Math.max(Math.min(e,this.content.length),0);let t=this.getLineOffsets(),i=0,r=t.length;if(r===0)return{line:0,character:e};for(;i<r;){let s=Math.floor((i+r)/2);t[s]>e?r=s:i=s+1}let o=i-1;return{line:o,character:e-t[o]}}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this.content.length;if(e.line<0)return 0;let i=t[e.line],r=e.line+1<t.length?t[e.line+1]:this.content.length;return Math.max(Math.min(i+e.character,r),i)}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=ybe(this.lines,this.eol)),this._lineOffsets}}});function HD(n){_.fire("BufDetach",[n])}var qD,Jo,SIe,qb,TW=P(()=>{"use strict";qD=S(_i()),Jo=S(q());we();he();jD();z();Ht();bt();Fe();ea();xW();SW();SIe=Y()("model-document"),qb=class{constructor(e,t,i,r){this.buffer=e;this.env=t;this.nvim=i;this.isIgnored=!1;this.eol=!0;this._disposed=!1;this._attached=!1;this._previewwindow=!1;this._winid=-1;this.disposables=[];this.lines=[];this._onDocumentChange=new Jo.Emitter;this.onDocumentChange=this._onDocumentChange.event;this.fireContentChanges=(0,qD.default)(()=>{this._fireContentChanges()},global.__TEST__?20:150),this.fetchContent=(0,qD.default)(()=>{this._fetchContent()},100),this.init(r)}get content(){return this.syncLines.join(`
`)+(this.eol?`
`:"")}get attached(){return this._attached}get textDocument(){return this._textDocument}get syncLines(){return this._textDocument.lines}get version(){return this._textDocument.version}get bufnr(){return this.buffer.id}get bufname(){return this._bufname}get filetype(){return this._filetype}get uri(){return this._uri}get isCommandLine(){return this.uri&&this.uri.endsWith("%5BCommand%20Line%5D")}get enabled(){return this.getVar("enabled",!0)}get languageId(){let{_filetype:e}=this;return e.includes(".")?e.match(/(.*?)\./)[1]:e}get changedtick(){return this._changedtick}convertFiletype(e){switch(e){case"javascript.jsx":return"javascriptreact";case"typescript.jsx":case"typescript.tsx":return"typescriptreact";case"tex":return"latex";default:return this.env.filetypeMap[e]||e}}get schema(){return M.parse(this.uri).scheme}get lineCount(){return this.lines.length}get winid(){return this._winid}get indentkeys(){return this._indentkeys}get previewwindow(){return this._previewwindow}init(e){let t=this.buftype=e.buftype;this._indentkeys=e.indentkeys,this._bufname=e.bufname,this._previewwindow=!!e.previewwindow,this._winid=e.winid,this.variables=e.variables||{},this._changedtick=e.changedtick,this.eol=e.eol==1,this._uri=Jm(e.fullpath,this.bufnr,t,this.env.isCygwin),Array.isArray(e.lines)&&(this.lines=e.lines,this._noFetch=!0,this._attached=!0,this.attach()),this._filetype=this.convertFiletype(e.filetype),this.setIskeyword(e.iskeyword),this.createTextDocument(1,this.lines)}attach(){if(this.env.isVim)return;let e=this.lines;this.buffer.attach(!0).then(t=>{t||HD(this.bufnr)},t=>{HD(this.bufnr)}),this.buffer.listen("lines",(t,i,r,o,s)=>{if(!(t.id!==this.bufnr||!this._attached||i==null)&&i>this._changedtick){if(this._changedtick=i,e=[...e.slice(0,r),...s,...o==-1?[]:e.slice(o)],e.length==0&&(e=[""]),this.lines=e,_.pumvisible)return;this.fireContentChanges()}},this.disposables),this.buffer.listen("detach",()=>{HD(this.bufnr)},this.disposables)}get dirty(){return this.lines!==this.syncLines}get hasChanged(){return this.dirty?!_e(this.lines,this.syncLines):!1}_fireContentChanges(e){var s;if(this.lines===this.syncLines)return;let t=this._textDocument,i=[];if(!e){let{cursor:a,insertMode:l}=_,u;if(a&&a.bufnr==this.bufnr){let c=(s=this.lines[a.lnum-1])!=null?s:"";u=Jo.Position.create(a.lnum-1,yi(c,a.col-1))}e=fW(t.lines,this.lines,u,l)}let r;e?(r=t.getText(e.range),i.push({range:e.range,text:e.newText,rangeLength:r.length})):r="";let o=this.createTextDocument(this.version+(e?1:0),this.lines);this._onDocumentChange.fire(Object.freeze({bufnr:this.bufnr,original:r,originalLines:t.lines,textDocument:{version:o.version,uri:this.uri},contentChanges:i}))}async applyEdits(e,t=!1,i=!1){var p,b;if(Array.isArray(arguments[1])&&(e=arguments[1]),!this._attached||e.length===0)return;this._forceSync();let r=this.textDocument;if(e=mW(r,e),e.length===0)return;let o=bW(r,e);if(!o)return;let s=r.lines,a=dW(s,o,e[0].range.start.line);if(a.start===a.end&&a.replacement.length==0)return;let l=a.start===a.end&&a.start===s.length+(this.eol?0:1),u=s.slice(a.start,a.end),c=[];this.nvim.hasFunction("nvim_buf_set_text")&&e.length<200&&a.start!==a.end&&e[e.length-1].range.end.line<s.length+(this.eol?0:1)&&(c=yW(s,e));let h,d=_.bufnr==this.bufnr,g;if(i&&d&&!l){let y=Jo.Position.is(i)?i:void 0;if(i===!0&&this.bufnr===((p=_.cursor)==null?void 0:p.bufnr)){let{col:w,lnum:x}=_.cursor;y=Jo.Position.create(x-1,yi(this.lines[x-1],w-1))}if(y){let w=vW(y,e);if(xe(y,w)!==0){let x=(b=o[w.line])!=null?b:"",k=et(x,w.character)+1;h=[w.line+1,k]}g=et(this.lines[y.line],y.character)+1}}this.nvim.pauseNotification(),d&&t&&this.nvim.command("undojoin",!0),l?this.buffer.setLines(a.replacement,{start:-1,end:-1},!0):this.nvim.call("coc#ui#set_lines",[this.bufnr,this._changedtick,u,a.replacement,a.start,a.end,c,h,g],!0),this.nvim.resumeNotification(d,!0);let f=e.length==1?e[0]:wW(e,s,o);await zH(),this.lines=o,this.fireContentChanges.clear(),this._fireContentChanges(f)}async changeLines(e){let t=[],i=this.lines.slice();for(let[r,o]of e)i[r]!=o&&(t.push([r,o]),i[r]=o);!t.length||(this.nvim.call("coc#u
`);return this.eol?e+`
`:e}getVar(e,t){let i=this.variables[`coc_${e}`];return i===void 0?t:i}getPosition(e,t){let i=this.getline(e-1);if(!i||t==0)return{line:e-1,character:0};let r=tt(i,0,t-1);return{line:e-1,character:r.length}}getEndOffset(e,t,i){let r=0,o=this.lines.length;for(let s=e-1;s<o;s++){let a=this.lines[s],l=a.length;if(s==e-1&&l!=0){let u=global.Buffer.from(a,"utf8");u.byteLength<=t-1||(r=r+u.slice(t-1,u.length).toString("utf8").length,i||(r=r-1))}else r=r+l;if(!this.eol&&s==o-1)break;r=r+1}return r}setFiletype(e){this._filetype=this.convertFiletype(e);let t=this._textDocument.lines;this._textDocument=new kg(this.uri,this.languageId,1,t,this.bufnr,this.eol)}setIskeyword(e){let t=this.chars=new Tg(e),i=this.getVar("additional_keywords",[]);if(i&&Array.isArray(i))for(let r of i)t.addKeyword(r)}detach(){this._disposed||(J(this.disposables),this._disposed=!0,this._attached=!1,this.lines=[],this.fetchContent.clear(),this.fireContentChanges.clear(),this._onDocumentChange.dispose())}getLocalifyBonus(e,t,i){return this.chars.getLocalifyBonus(e,t,this.lines,i)}async synchronize(){if(!this.attached)return;let{changedtick:e}=this;await this.patchChange(),e!=this.changedtick&&await Qe(50)}onTextChange(e,t){if(e==="TextChanged"||e==="TextChangedI"&&!t.insertChar||!this._noFetch){this._noFetch=!1,this.fetchContent();return}let{line:i,changedtick:r,lnum:o}=t;r!==this.changedtick&&(this.changeLine(o,i,r),e!=="TextChangedP"&&this._forceSync())}onCursorHold(e){this.variables=e}}});var kW,BD,YD,yl,gn,Bb,Yb,DW=P(()=>{"use strict";kW=S(rW()),BD=S(require("fs")),YD=S(require("os")),yl=S(require("path")),gn=S(q());we();he();TW();z();Xe();Fe();Bb=Y()("core-documents"),Yb=class{constructor(e,t){this.configurations=e;this.workspaceFolder=t;this._initialized=!1;this._attached=!1;this._currentResolve=!1;this.disposables=[];this.creating=new Map;this.buffers=new Map;this.winids=new Set;this.resolves=[];this._onDidOpenTextDocument=new gn.Emitter;this._onDidCloseDocument=new gn.Emitter;this._onDidChangeDocument=new gn.Emitter;this._onDidSaveDocument=new gn.Emitter;this._onWillSaveDocument=new gn.Emitter;this.onDidOpenTextDocument=this._onDidOpenTextDocument.event;this.onDidCloseDocument=this._onDidCloseDocument.event;this.onDidChangeDocument=this._onDidChangeDocument.event;this.onDidSaveTextDocument=this._onDidSaveDocument.event;this.onWillSaveTextDocument=this._onWillSaveDocument.event;this._cwd=process.cwd()}async attach(e,t){if(this._attached)return;this.nvim=e,this._env=t,this._attached=!0;let r=this.configurations.getConfiguration("coc.preferences").get("maxFileSize","10MB");this.maxFileSize=kW.default.parse(r),e.setVar("coc_max_filesize",this.maxFileSize,!0);let{bufnrs:o,winid:s,bufnr:a,winids:l}=await this.nvim.call("coc#util#all_state");this.winids=new Set(l),this._bufnr=a,await Promise.all(o.map(c=>this.createDocument(c))),_.on("BufDetach",this.onBufDetach,this,this.disposables),_.on("VimLeavePre",()=>{this.resolveCurrent(void 0)},null,this.disposables),_.on("WinEnter",c=>{this.winids.add(c)},null,this.disposables),_.on("BufWinEnter",(c,h)=>{this.winids.add(h)},null,this.disposables),_.on("DirChanged",c=>{this._cwd=c},null,this.disposables),_.on("CursorHold",async()=>{let{bufnrs:c,winids:h}=await this.nvim.call("coc#util#all_state");for(let d of this.buffers.keys())c.includes(d)||_.fire("BufUnload",[d]);for(let d of this.winids)h.includes(d)||_.fire("WinClosed",[d]);this.winids=new Set(h)},null,this.disposables);let u=c=>{this._bufnr=c,this.createDocument(c)};_.on("CursorMoved",u,null,this.disposables),_.on("CursorMovedI",u,null,this.disposables),_.on("BufUnload",this.onBufUnload,this,this.disposables),_.on("BufEnter",this.onBufEnter,this,this.disposables),_.on("BufCreate",this.onBufCreate,this,this.disposables),_.on("TermOpen",this.onBufCreate,this,this.disposables),_.on("BufWritePost",this.onBufWritePost,this,this.disposables),_.on("BufWritePre",this.onBufWritePre,this,this.disposables),_.on("FileType",this.onFileTypeChange,this,this.disposables),_.fire("BufEnter",[a]),_.fire("BufWinEnter",[a,s]),_.on("BufEnter",c=>{this.createDocument(c)},null,thi
`)+`
`}reset(){this.creating.clear();for(let e of this.buffers.keys())this.onBufUnload(e);this.buffers.clear(),this._root=process.cwd()}dispose(){for(let e of this.buffers.keys())this.onBufUnload(e);this._attached=!1,this.buffers.clear(),J(this.disposables)}}});function wbe(n,e,t){let i=ta.default.join(n,e);if(typeof t!="string"){let r=t.baseUri.fsPath;if(!Ae(r,i))return!1;let o=ta.default.relative(r,i);return(0,WD.default)(o,t.pattern,{dot:!0})}return(0,WD.default)(e,t,{dot:!0})}var ci,EW,WD,_W,ta,PW,qt,vbe,Wb,RW=P(()=>{"use strict";ci=S(Rn()),EW=S(rb()),WD=S(Vn()),_W=S(require("os")),ta=S(require("path")),PW=require("util"),qt=S(q());we();z();Xe();Fe();bb();vbe=Y()("core-files"),Wb=class{constructor(e,t,i){this.documents=e;this.configurations=t;this.workspaceFolderControl=i;this._onDidCreateFiles=new qt.Emitter;this._onDidRenameFiles=new qt.Emitter;this._onDidDeleteFiles=new qt.Emitter;this._onWillCreateFiles=new qt.Emitter;this._onWillRenameFiles=new qt.Emitter;this._onWillDeleteFiles=new qt.Emitter;this.onDidCreateFiles=this._onDidCreateFiles.event;this.onDidRenameFiles=this._onDidRenameFiles.event;this.onDidDeleteFiles=this._onDidDeleteFiles.event;this.onWillCreateFiles=this._onWillCreateFiles.event;this.onWillRenameFiles=this._onWillRenameFiles.event;this.onWillDeleteFiles=this._onWillDeleteFiles.event}attach(e,t){this.nvim=e,this.env=t}async openTextDocument(e){e=typeof e=="string"?M.file(e):e;let t=this.documents.getDocument(e.toString());if(t)return await this.jumpTo(e.toString(),null,"drop"),t;let i=e.scheme;if(i=="file"){if(!ci.default.existsSync(e.fsPath))throw new Error(`${e.fsPath} doesn't exist.`);ci.default.accessSync(e.fsPath,ci.default.constants.R_OK)}return i=="untitled"?(await this.nvim.command(`edit ${e.path}`),t=await this.documents.document,await this.jumpTo(t.uri),t):(t=await this.loadResource(e.toString()),t&&await this.jumpTo(t.uri),t)}async jumpTo(e,t,i){let r=this.configurations.getConfiguration("coc.preferences"),o=i||r.get("jumpCommand","edit"),{nvim:s}=this,a=this.documents.getDocument(e),l=a?a.bufnr:-1;if(l!=-1&&o=="edit"){if(s.pauseNotification(),s.command("silent! normal! m'",!0),s.command(`buffer ${l}`,!0),s.command("if &filetype ==# '' | filetype detect | endif",!0),t){let u=a.getline(t.line),c=V(u.slice(0,t.character))+1;s.call("cursor",[t.line+1,c],!0)}await s.resumeNotification(!0)}else{let{fsPath:u,scheme:c}=M.parse(e),h=t==null?null:[t.line,t.character];if(c=="file"){let d=dg(ta.default.normalize(u));await this.nvim.call("coc#util#jump",[o,d,h])}else _W.default.platform()=="win32"&&(e=e.replace(/\/?/,"?")),await this.nvim.call("coc#util#jump",[o,e,h])}}async openResource(e){let{nvim:t}=this,i=M.parse(e);if(/^https?/.test(i.scheme)){await t.call("coc#ui#open_url",e);return}let r=await t.getOption("wildignore");await t.setOption("wildignore",""),await this.jumpTo(e),await t.setOption("wildignore",r)}loadResource(e){let t=this.documents.getDocument(e);return t?Promise.resolve(t):this.loadResources([e]).then(i=>Array.isArray(i)?i[0]:void 0)}async loadResources(e){let{documents:t}=this,i=e.map(o=>{let s=M.parse(o);return s.scheme=="file"?s.fsPath:o}),r=await this.nvim.call("coc#ui#open_files",[i]);return await Promise.all(r.map(o=>t.createDocument(o)))}async renameCurrent(){let{nvim:e,documents:t}=this,i=await e.call("bufnr","%"),r=await e.call("getcwd"),o=t.getDocument(i);if(!o||o.buftype!=""||o.schema!="file"){e.echoError("current buffer is not file.");return}let s=M.parse(o.uri).fsPath,a=await e.callAsync("coc#util#with_callback",["input",["New path: ",s,"file"]]);if(a=a?a.trim():null,a==s||!a)return;let l=await o.buffer.lines,u=ci.default.existsSync(s);if(u){if(await e.eval("&modified")&&await e.command("noa w"),s.toLowerCase()!=a.toLowerCase()&&ci.default.existsSync(a)){if(!await xc(this.nvim,`${a} exists, overwrite?`))return;ci.default.unlinkSync(a)}ci.default.renameSync(s,a)}this._onWillRenameFiles.fire({files:[{newUri:M.parse(a),oldUri:M.parse(s)}],waitUntil:async d=>{let g=await Promise.resolve(d);g&&qt.WorkspaceEdit.is(g)&&await this.applyEdit(g)}}),this._onDidRenameFiles.fire({f
`)!=`
`&&(e.call("append",[0,l],!0),e.command("normal! Gdd",!0)),e.call("winrestview",[h],!0),await e.resumeNotification()}async createFile(e,t={}){let{documents:i}=this,r=await Mt(e);if(r&&!t.overwrite&&!t.ignoreIfExists){tr(this.nvim,`${e} already exists!`,"Error");return}if(!r||t.overwrite)if(e.endsWith("/"))e=i.expand(e),await ci.default.mkdirp(e);else{let o=M.file(e).toString();if(i.getDocument(o))return;ci.default.existsSync(ta.default.dirname(e))||ci.default.mkdirpSync(ta.default.dirname(e)),ci.default.writeFileSync(e,"","utf8"),await this.loadResource(o)}}async deleteFile(e,t={}){let{ignoreIfNotExists:i,recursive:r}=t,o=await Mt(e.replace(/\/$/,"")),s=o&&o.isDirectory();if(e.endsWith("/")&&!s){tr(this.nvim,`${e} is not directory`,"Error");return}if(!o&&!i){tr(this.nvim,`${e} doesn't exist`,"Error");return}if(o!=null){if(s&&!r){tr(this.nvim,"Can't remove directory, recursive not set","Error");return}try{if(s&&r?await ci.default.remove(e):s?await ci.default.rmdir(e):await ci.default.unlink(e),!s){let a=M.file(e).toString(),l=this.documents.getDocument(a);l&&await this.nvim.command(`silent! bwipeout! ${l.bufnr}`)}}catch(a){tr(this.nvim,`Error on delete ${e}: ${a}`,"Error")}}}async renameFile(e,t,i={}){let{overwrite:r,ignoreIfExists:o}=i,{nvim:s,documents:a}=this;try{let l=await Mt(t);if(l&&!r&&!o)throw new Error(`${t} already exists`);if(!l||r){let u=M.file(e).toString(),c=M.file(t).toString(),h=a.getDocument(u);if(h!=null){let d=h.bufnr==a.bufnr,g=a.getDocument(c);g&&await this.nvim.command(`silent ${g.bufnr}bwipeout!`);let f=h.getDocumentContent();if(await ci.default.writeFile(t,f,"utf8"),!d)await s.call("coc#ui#open_files",[[t]]),await s.command(`silent ${h.bufnr}bwipeout!`);else{let p=await s.call("winsaveview");s.pauseNotification(),s.call("coc#util#open_file",["keepalt edit",t],!0),s.command(`silent ${h.bufnr}bwipeout!`,!0),s.call("winrestview",[p],!0),await s.resumeNotification()}await ci.default.unlink(e)}else await pY(e,t)}}catch(l){tr(this.nvim,`Rename error: ${l}`,"Error")}}async currentUri(){let e=await this.nvim.call("bufnr",["%"]),t=this.documents.getDocument(e);return t?t.uri:null}async applyEdit(e){let{nvim:t,documents:i,configurations:r}=this,{documentChanges:o,changes:s}=e,a=await this.currentUri(),l=!1,u=[],c=0,h=r.getConfiguration("coc.preferences"),d=!global.__TEST__&&h.get("promptWorkspaceEdit",!0),g=h.get("listOfWorkspaceEdit","quickfix");try{if(o&&o.length){let f=this.getChangedUris(o);if(c=f.length,d){let b=f.reduce((y,w)=>y+(i.getDocument(w)==null?1:0),0);if(b&&!await xc(this.nvim,`${b} documents on disk would be loaded for change, confirm?`))return}let p=new Map;for(let b of o)if(qt.TextDocumentEdit.is(b)){let{textDocument:y,edits:w}=b,x=await this.loadResource(y.uri),k=y.uri===a;k&&(l=!0),await x.applyEdits(w,!1,k);for(let L of w)u.push({uri:x.uri,range:L.range})}else if(qt.CreateFile.is(b)){let y=M.parse(b.uri).fsPath;await this.createFile(y,b.options)}else qt.RenameFile.is(b)?(p.set(b.oldUri,b.newUri),await this.renameFile(M.parse(b.oldUri).fsPath,M.parse(b.newUri).fsPath,b.options)):qt.DeleteFile.is(b)&&await this.deleteFile(M.parse(b.uri).fsPath,b.options);p.size&&u.forEach(b=>{let y=p.get(b.uri);y&&(b.uri=y)})}else if(s){let f=Object.keys(s),p=f.filter(b=>i.getDocument(b)==null);if(p.length){if(d&&!await xc(this.nvim,`${p.length} documents on disk would be loaded for change, confirm?`))return;await this.loadResources(p)}for(let b of Object.keys(s)){let y=i.getDocument(b),w=M.parse(b).toString()===b;w&&(l=!0);let x=s[b];for(let k of x)u.push({uri:y.uri,range:k.range});await y.applyEdits(x,!1,w)}c=f.length}if(l&&this.nvim.redrawVim(),u.length){let f=await this.documents.getQuickfixList(u),p=u.every(b=>b.uri==a);g=="quickfix"?(await this.nvim.call("setqflist",[f]),p||tr(this.nvim,`changed ${c} buffers, use :wa to save changes to disk and :copen to open quickfix list`,"MoreMsg")):g=="location"&&(await t.setVar("coc_jump_locations",f),p||tr(this.nvim,`changed ${c} buffers, use :wa to save changes to disk and :CocList location to manage changed locations`,"MoreMsg"))}}catch(f){return vbe.error(
`)),e[e.length-1]==""&&(e=e.slice(0,-1)),ia(e)}catch{return[]}}loadSync(){if(!aa.default.existsSync(this.file))return[];try{let e=aa.default.readFileSync(this.file,"utf8");return e=e.trim(),e.length?e.trim().split(`
`):[]}catch{return[]}}async add(e){let t;try{t=aa.default.readFileSync(this.file),t[0]===239&&t[1]===187&&t[2]===191&&(t=t.slice(3)),t=Buffer.concat([Buffer.from(e,"utf8"),new Uint8Array([10]),t])}catch{t=Buffer.concat([Buffer.from(e,"utf8"),new Uint8Array([10])])}await aa.default.writeFile(this.file,t,"utf8")}async remove(e){let t=await this.load(),i=t.length;t=t.filter(r=>r!=e),t.length!=i&&await aa.default.writeFile(this.file,t.join(`
`),"utf8")}async clean(){try{await aa.default.unlink(this.file)}catch{}}}});var wy,xy,T$=P(()=>{"use strict";wy=S(q());he();z();xy=class{constructor(e,t){this.nvim=e;this.id=t;this.disposables=[];this._onExit=new wy.Emitter;this._onStderr=new wy.Emitter;this._onStdout=new wy.Emitter;this.onExit=this._onExit.event;this.onStdout=this._onStdout.event;this.onStderr=this._onStderr.event;_.on("TaskExit",(i,r)=>{i==this.id&&this._onExit.fire(r)},null,this.disposables),_.on("TaskStderr",(i,r)=>{i==this.id&&this._onStderr.fire(r)},null,this.disposables),_.on("TaskStdout",(i,r)=>{i==this.id&&this._onStdout.fire(r)},null,this.disposables)}async start(e){let{nvim:t}=this;return await t.call("coc#task#start",[this.id,e])}async stop(){let{nvim:e}=this;await e.call("coc#task#stop",[this.id])}get running(){let{nvim:e}=this;return e.call("coc#task#running",[this.id])}dispose(){let{nvim:e}=this;e.call("coc#task#stop",[this.id],!0),this._onStdout.dispose(),this._onStderr.dispose(),this._onExit.dispose(),J(this.disposables)}}});var E$,TE,la,k$,D$,$ve,_$,v,Q=P(()=>{"use strict";E$=S(Rn()),TE=S(require("os")),la=S(require("path"));we();dD();GY();zY();eW();gb();tW();DW();RW();lZ();p$();m$();b$();bb();y$();w$();C$();he();S$();CE();Kg();T$();z();k$=29,D$=Y()("workspace"),$ve=["showMessage","runTerminalCommand","openTerminal","showQuickpick","menuPick","openLocalConfig","showPrompt","createStatusBarItem","createOutputChannel","showOutputChannel","requestInput","echoLines","getCursorPosition","moveTo","getOffset","getSelectedRange","selectRange","createTerminal"],_$=class{constructor(){this.version=yb;let e=la.default.normalize(process.env.COC_VIMCONFIG)||la.default.join(TE.default.homedir(),".vim"),t=la.default.join(e,Er);this.configurations=new Zo(t,new Rb(this)),this.workspaceFolderControl=new yy(this.configurations);let i=this.documentsManager=new Yb(this.configurations,this.workspaceFolderControl);this.contentProvider=new Ib(i),this.watchers=new my,this.autocmds=new Lb(this.contentProvider,this.watchers),this.keymaps=new fy(i),this.locations=new py(this.configurations,i,this.contentProvider),this.files=new Wb(i,this.configurations,this.workspaceFolderControl),this.editors=new by(i),this.onDidRuntimePathChange=this.watchers.onDidRuntimePathChange,this.onDidChangeWorkspaceFolders=this.workspaceFolderControl.onDidChangeWorkspaceFolders,this.onDidChangeConfiguration=this.configurations.onDidChange,this.onDidOpenTextDocument=i.onDidOpenTextDocument,this.onDidChangeTextDocument=i.onDidChangeDocument,this.onDidCloseTextDocument=i.onDidCloseDocument,this.onDidSaveTextDocument=i.onDidSaveTextDocument,this.onWillSaveTextDocument=i.onWillSaveTextDocument,this.onDidCreateFiles=this.files.onDidCreateFiles,this.onDidRenameFiles=this.files.onDidRenameFiles,this.onDidDeleteFiles=this.files.onDidDeleteFiles,this.onWillCreateFiles=this.files.onWillCreateFiles,this.onWillRenameFiles=this.files.onWillRenameFiles,this.onWillDeleteFiles=this.files.onWillDeleteFiles;let r=global.__TEST__?null:this.getWatchmanPath();this.fileSystemWatchers=new Ig(this.workspaceFolderControl,r)}async init(e){let{nvim:t}=this;for(let o of $ve)Object.defineProperty(this,o,{get:()=>(...s)=>{let a=`
`+Error().stack.split(`
`).slice(2,4).join(`
`);return D$.warn(`workspace.${o} is deprecated, please use window.${o} instead.`,a),e[o].apply(e,s)}});for(let o of["onDidOpenTerminal","onDidCloseTerminal"])Object.defineProperty(this,o,{get:()=>{let s=`
`+Error().stack.split(`
`).slice(2,4).join(`
`);return D$.warn(`workspace.${o} is deprecated, please use window.${o} instead.`,s),e[o]}});let i=this._env=await t.call("coc#util#vim_info");e.init(i),this._env.apiversion!=k$&&t.echoError(`API version ${this._env.apiversion} is not ${k$}, please build coc.nvim by 'yarn install' after pull source code.`),this.workspaceFolderControl.setWorkspaceFolders(this._env.workspaceFolders),this.configurations.updateUserConfig(this._env.config),this.files.attach(t,i),this.contentProvider.attach(t),this.keymaps.attach(t),this.autocmds.attach(t,i),this.locations.attach(t,i),this.watchers.attach(t,i),await this.attach(),await this.editors.attach(t);let r=Wo.create("watchman",t);this.fileSystemWatchers.attach(r)}get cwd(){return this.documentsManager.cwd}get env(){return this._env}get root(){return this.documentsManager.root||this.cwd}get rootPath(){return this.root}get bufnr(){return this.documentsManager.bufnr}get insertMode(){return _.insertMode}get floatSupported(){return this.env.floating||this.env.textprop}get uri(){return this.documentsManager.uri}get workspaceFolder(){return this.workspaceFolders[0]}get textDocuments(){return this.documentsManager.textDocuments}get documents(){return this.documentsManager.documents}get document(){return this.documentsManager.document}get workspaceFolders(){return this.workspaceFolderControl.workspaceFolders}get folderPaths(){return this.workspaceFolders.map(e=>M.parse(e.uri).fsPath)}get channelNames(){return Wo.names}get pluginRoot(){return la.default.dirname(__dirname)}get isVim(){return this._env.isVim}get isNvim(){return!this._env.isVim}get completeOpt(){return this._env.completeOpt}get filetypes(){return this.documentsManager.filetypes}get languageIds(){return this.documentsManager.languageIds}createNameSpace(e){return h$(e)}getConfigFile(e){return this.configurations.getConfigFile(e)}has(e){return c$(this.env,e)}registerAutocmd(e){return this.autocmds.registerAutocmd(e)}watchOption(e,t,i){this.watchers.watchOption(e,t,i)}watchGlobal(e,t,i){this.watchers.watchGlobal(e,t||function(){},i)}match(e,t){return wE(e,t.uri,t.languageId)}createFileSystemWatcher(e,t,i,r){return this.fileSystemWatchers.createFileSystemWatcher(e,t,i,r)}getWatchmanPath(){return d$(this.configurations)}getConfiguration(e,t){return this.configurations.getConfiguration(e,t)}getDocument(e){return this.documentsManager.getDocument(e)}isAttached(e){let t=this.documentsManager.getDocument(e);return t!=null&&t.attached}getAttachedDocument(e){let t=this.getDocument(e);if(!t)throw new Error(`Buffer ${e} not created.`);if(!t.attached)throw new Error(`Buffer ${e} not attached, try :CocCommand document.checkBuffer`);return t}getQuickfixItem(e,t,i="",r){return this.documentsManager.getQuickfixItem(e,t,i,r)}createMru(e){return new to(e)}async getQuickfixList(e){return this.documentsManager.getQuickfixList(e)}async showLocations(e){await this.locations.showLocations(e)}getLine(e,t){return this.documentsManager.getLine(e,t)}getWorkspaceFolder(e){return this.workspaceFolderControl.getWorkspaceFolder(M.parse(e))}readFile(e){return this.documentsManager.readFile(e)}async getCurrentState(){let e=await this.document,t=await mb(this.nvim);return{document:e.textDocument,position:t}}async getFormatOptions(e){return this.documentsManager.getFormatOptions(e)}resolveModule(e){return f$(e)}async runCommand(e,t,i){return t=t||this.cwd,Gr(e,{cwd:t},i)}expand(e){return this.documentsManager.expand(e)}async callAsync(e,t){return this.isNvim?await this.nvim.call(e,t):await this.nvim.callAsync("coc#util#with_callback",[e,t])}registerTextDocumentContentProvider(e,t){return this.contentProvider.registerTextDocumentContentProvider(e,t)}registerKeymap(e,t,i,r={}){return this.keymaps.registerKeymap(e,t,i,r)}registerExprKeymap(e,t,i,r=!1){return this.keymaps.registerExprKeymap(e,t,i,r)}registerLocalKeymap(e,t,i,r=!1){return this.keymaps.registerLocalKeymap(e,t,i,r)}createTask(e){return new xy(this.nvim,e)}createDatabase(e){let t;global.hasOwnProperty("__TEST__")?(t=la.default.join(TE.default.tmpdir(),`coc-${process.pid}`),E$.default.mkdirpSync(t)):t=la.defau
`,r=Buffer.byteLength(i),o=Math.floor(Math.log(r)/Math.log(10))+1;return r+o>=Math.pow(10,o)&&(o+=1),o+r+i}};sv.parse=(n,e,t)=>new sv(zwe(Qwe(n),e),t);var zwe=(n,e)=>e?Object.keys(n).reduce((t,i)=>(t[i]=n[i],t),e):n,Qwe=n=>n.replace(/\n$/,"").split(`
`).reduce(Vwe,Object.create(null)),Vwe=(n,e)=>{let t=parseInt(e,10);if(t!==Buffer.byteLength(e)+1)return n;e=e.substr((t+" ").length);let i=e.split("="),r=i.shift().replace(/^SCHILY\.(dev|ino|nlink)/,"$1");if(!r)return n;let o=i.join("=");return n[r]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(r)?new Date(o*1e3):/^[0-9]+$/.test(o)?+o:o,n};TU.exports=sv});var Jc=m((oHe,kU)=>{kU.exports=n=>{let e=n.length-1,t=-1;for(;e>-1&&n.charAt(e)==="/";)t=e,e--;return t===-1?n:n.slice(0,t)}});var lv=m((sHe,DU)=>{"use strict";DU.exports=n=>class extends n{warn(e,t,i={}){this.file&&(i.file=this.file),this.cwd&&(i.cwd=this.cwd),i.code=t instanceof Error&&t.code||e,i.tarCode=e,!this.strict&&i.recoverable!==!1?(t instanceof Error&&(i=Object.assign(t,i),t=t.message),this.emit("warn",i.tarCode,t,i)):t instanceof Error?this.emit("error",Object.assign(t,i)):this.emit("error",Object.assign(new Error(`${e}: ${t}`),i))}}});var r0=m((aHe,EU)=>{"use strict";var uv=["|","<",">","?",":"],n0=uv.map(n=>String.fromCharCode(61440+n.charCodeAt(0))),exe=new Map(uv.map((n,e)=>[n,n0[e]])),txe=new Map(n0.map((n,e)=>[n,uv[e]]));EU.exports={encode:n=>uv.reduce((e,t)=>e.split(t).join(exe.get(t)),n),decode:n=>n0.reduce((e,t)=>e.split(t).join(txe.get(t)),n)}});var o0=m((lHe,PU)=>{var{isAbsolute:ixe,parse:_U}=require("path").win32;PU.exports=n=>{let e="",t=_U(n);for(;ixe(n)||t.root;){let i=n.charAt(0)==="/"&&n.slice(0,4)!=="//?/"?"/":t.root;n=n.substr(i.length),e+=i,t=_U(n)}return[e,n]}});var LU=m((uHe,RU)=>{"use strict";RU.exports=(n,e,t)=>(n&=4095,t&&(n=(n|384)&-19),e&&(n&256&&(n|=64),n&32&&(n|=8),n&4&&(n|=1)),n)});var f0=m((dHe,$U)=>{"use strict";var NU=qc(),HU=av(),qU=Zc(),no=require("fs"),IU=require("path"),io=Yc(),nxe=Jc(),BU=(n,e)=>e?(n=io(n).replace(/^\.(\/|$)/,""),nxe(e)+"/"+n):io(n),rxe=16*1024*1024,jU=Symbol("process"),FU=Symbol("file"),OU=Symbol("directory"),a0=Symbol("symlink"),MU=Symbol("hardlink"),sf=Symbol("header"),cv=Symbol("read"),l0=Symbol("lstat"),hv=Symbol("onlstat"),u0=Symbol("onread"),c0=Symbol("onreadlink"),h0=Symbol("openfile"),d0=Symbol("onopenfile"),fa=Symbol("close"),dv=Symbol("mode"),g0=Symbol("awaitDrain"),s0=Symbol("ondrain"),ro=Symbol("prefix"),AU=Symbol("hadError"),YU=lv(),oxe=r0(),WU=o0(),ZU=LU(),gv=YU(class extends NU{constructor(e,t){t=t||{};super(t);if(typeof e!="string")throw new TypeError("path is required");this.path=io(e),this.portable=!!t.portable,this.myuid=process.getuid&&process.getuid()||0,this.myuser=process.env.USER||"",this.maxReadSize=t.maxReadSize||rxe,this.linkCache=t.linkCache||new Map,this.statCache=t.statCache||new Map,this.preservePaths=!!t.preservePaths,this.cwd=io(t.cwd||process.cwd()),this.strict=!!t.strict,this.noPax=!!t.noPax,this.noMtime=!!t.noMtime,this.mtime=t.mtime||null,this.prefix=t.prefix?io(t.prefix):null,this.fd=null,this.blockLen=null,this.blockRemain=null,this.buf=null,this.offset=null,this.length=null,this.pos=null,this.remain=null,typeof t.onwarn=="function"&&this.on("warn",t.onwarn);let i=!1;if(!this.preservePaths){let[r,o]=WU(this.path);r&&(this.path=o,i=r)}this.win32=!!t.win32||process.platform==="win32",this.win32&&(this.path=oxe.decode(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=io(t.absolute||IU.resolve(this.cwd,e)),this.path===""&&(this.path="./"),i&&this.warn("TAR_ENTRY_INFO",`stripping ${i} from absolute path`,{entry:this,path:i+this.path}),this.statCache.has(this.absolute)?this[hv](this.statCache.get(this.absolute)):this[l0]()}emit(e,...t){return e==="error"&&(this[AU]=!0),super.emit(e,...t)}[l0](){no.lstat(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[hv](t)})}[hv](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=axe(e),this.emit("stat",e),this[jU]()}[jU](){switch(this.type){case"File":return this[FU]();case"Directory":return this[OU]();case"SymbolicLink":return this[a0]();default:return this.end()}}[dv](e){return ZU(e,this.type==="Directory",this.portable)}[ro](e){return BU(e,this.prefix)}[sf](){this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.header=new qU({path:this[ro](this.path),linkpat
`).some(e=>e.indexOf("(https.js:")!==-1||e.indexOf("node:https:")!==-1)}function Xv(n,e){return new Xv.Agent(n,e)}(function(n){class e extends CSe.EventEmitter{constructor(i,r){super();let o=r;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=1/0,this.sockets={},this.freeSockets={},this.requests={},this.options={}}get defaultPort(){return typeof this.explicitDefaultPort=="number"?this.explicitDefaultPort:d_()?443:80}set defaultPort(i){this.explicitDefaultPort=i}get protocol(){return typeof this.explicitProtocol=="string"?this.explicitProtocol:d_()?"https:":"http:"}set protocol(i){this.explicitProtocol=i}callback(i,r,o){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(i,r){let o=Object.assign({},r);typeof o.secureEndpoint!="boolean"&&(o.secureEndpoint=d_()),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=g=>{i._hadError||(i.emit("error",g),i._hadError=!0)},c=()=>{a=null,s=!0;let g=new Error(`A "socket" was not created for HTTP request before ${l}ms`);g.code="ETIMEOUT",u(g)},h=g=>{s||(a!==null&&(clearTimeout(a),a=null),u(g))},d=g=>{if(s)return;if(a!=null&&(clearTimeout(a),a=null),kSe(g)){xf("Callback returned another Agent instance %o",g.constructor.name),g.addRequest(i,o);return}if(g){g.once("free",()=>{this.freeSocket(g,o)}),i.onSocket(g);return}let f=new Error(`no Duplex stream was returned to agent-base for \`${i.method} ${i.path}\``);u(f)};if(typeof this.callback!="function"){u(new Error("`callback` is not defined"));return}this.promisifiedCallback||(this.callback.length>=3?(xf("Converting legacy callback function to promise"),this.promisifiedCallback=TSe.default(this.callback)):this.promisifiedCallback=this.callback),typeof l=="number"&&l>0&&(a=setTimeout(c,l)),"port"in o&&typeof o.port!="number"&&(o.port=Number(o.port));try{xf("Resolving socket for %o request: %o",o.protocol,`${i.method} ${i.path}`),Promise.resolve(this.promisifiedCallback(i,o)).then(d,h)}catch(g){Promise.reject(g).catch(h)}}freeSocket(i,r){xf("Freeing socket %o %o",i.constructor.name,r),i.destroy()}destroy(){xf("Destroying agent %o",this.constructor.name)}}n.Agent=e,n.prototype=n.Agent.prototype})(Xv||(Xv={}));D3.exports=Xv});var _3=m(Hl=>{"use strict";var DSe=Hl&&Hl.__awaiter||function(n,e,t,i){function r(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(h){s(h)}}function l(c){try{u(i.throw(c))}catch(h){s(h)}}function u(c){c.done?o(c.value):r(c.value).then(a,l)}u((i=i.apply(n,e||[])).next())})},Cf=Hl&&Hl.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Hl,"__esModule",{value:!0});var ESe=Cf(require("net")),_Se=Cf(require("tls")),p_=Cf(require("url")),PSe=Cf(jt()),RSe=Cf(S3()),LSe=f_(),ka=(0,PSe.default)("http-proxy-agent");function ISe(n){return typeof n=="string"?/^https:?$/i.test(n):!1}var E3=class extends LSe.Agent{constructor(e){let t;if(typeof e=="string"?t=p_.default.parse(e):t=e,!t)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");ka("Creating new HttpProxyAgent instance: %o",t);super(t);let i=Object.assign({},t);this.secureProxy=t.secureProxy||ISe(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),i.host&&i.path&&(delete i.path,delete i.pathname),this.proxy=i}callback(e,t){return DSe(this,void 0,void 0,function*(){let{proxy:i,secureProxy:r}=this,o=p_.default.parse(e.path);o.protocol||(o.protocol="http:"),o.hostname||(o.hostname=t.hostname||t.host||null),o.port==null&&typeof t.port&&(o.port=String(t.port)
\r
`)+4,e.output[0]=e._header+a.substring(l),ka("Output buffer: %o",e.output)):e.outputData&&e.outputData.length>0&&(ka("Patching connection write() output buffer with updated header"),a=e.outputData[0].data,l=a.indexOf(`\r
\r
`)+4,e.outputData[0].data=e._header+a.substring(l),ka("Output buffer: %o",e.outputData[0].data))}return yield(0,RSe.default)(s,"connect"),s})}};Hl.default=E3});var R3=m((y_,P3)=>{"use strict";var jSe=y_&&y_.__importDefault||function(n){return n&&n.__esModule?n:{default:n}},m_=jSe(_3());function b_(n){return new m_.default(n)}(function(n){n.HttpProxyAgent=m_.default,n.prototype=m_.default.prototype})(b_||(b_={}));P3.exports=b_});var L3=m(Tf=>{"use strict";var FSe=Tf&&Tf.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Tf,"__esModule",{value:!0});var OSe=FSe(jt()),Sf=OSe.default("https-proxy-agent:parse-proxy-response");function MSe(n){return new Promise((e,t)=>{let i=0,r=[];function o(){let h=n.read();h?c(h):n.once("readable",o)}function s(){n.removeListener("end",l),n.removeListener("error",u),n.removeListener("close",a),n.removeListener("readable",o)}function a(h){Sf("onclose had error %o",h)}function l(){Sf("onend")}function u(h){s(),Sf("onerror %o",h),t(h)}function c(h){r.push(h),i+=h.length;let d=Buffer.concat(r,i);if(d.indexOf(`\r
\r
`)===-1){Sf("have not received end of HTTP headers yet..."),o();return}let f=d.toString("ascii",0,d.indexOf(`\r
`)),p=+f.split(" ")[1];Sf("got proxy server response: %o",f),e({statusCode:p,buffered:d})}n.on("error",u),n.on("close",a),n.on("end",l),o()})}Tf.default=MSe});var O3=m(ql=>{"use strict";var ASe=ql&&ql.__awaiter||function(n,e,t,i){function r(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(h){s(h)}}function l(c){try{u(i.throw(c))}catch(h){s(h)}}function u(c){c.done?o(c.value):r(c.value).then(a,l)}u((i=i.apply(n,e||[])).next())})},lh=ql&&ql.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(ql,"__esModule",{value:!0});var I3=lh(require("net")),j3=lh(require("tls")),NSe=lh(require("url")),HSe=lh(require("assert")),qSe=lh(jt()),BSe=f_(),YSe=lh(L3()),kf=qSe.default("https-proxy-agent:agent"),F3=class extends BSe.Agent{constructor(e){let t;if(typeof e=="string"?t=NSe.default.parse(e):t=e,!t)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");kf("creating new HttpsProxyAgent instance: %o",t);super(t);let i=Object.assign({},t);this.secureProxy=t.secureProxy||JSe(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 ASe(this,void 0,void 0,function*(){let{proxy:i,secureProxy:r}=this,o;r?(kf("Creating `tls.Socket`: %o",i),o=j3.default.connect(i)):(kf("Creating `net.Socket`: %o",i),o=I3.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:h}=t;ZSe(c,h)||(u+=`:${c}`),s.Host=u,s.Connection="close";for(let b of Object.keys(s))l+=`${b}: ${s[b]}\r
`;let d=YSe.default(o);o.write(`${l}\r
`);let{statusCode:g,buffered:f}=yield d;if(g===200){if(e.once("socket",WSe),t.secureEndpoint){let b=t.servername||t.host;if(!b)throw new Error('Could not determine "servername"');return kf("Upgrading socket connection to TLS"),j3.default.connect(Object.assign(Object.assign({},$Se(t,"host","hostname","path","port")),{socket:o,servername:b}))}return o}o.destroy();let p=new I3.default.Socket;return p.readable=!0,e.once("socket",b=>{kf("replaying proxy buffer for failed request"),HSe.default(b.listenerCount("data")>0),b.push(f),b.push(null)}),p})}};ql.default=F3;function WSe(n){n.resume()}function ZSe(n,e){return Boolean(!e&&n===80||e&&n===443)}function JSe(n){return typeof n=="string"?/^https:?$/i.test(n):!1}function $Se(n,...e){let t={},i;for(i in n)e.includes(i)||(t[i]=n[i]);return t}});var A3=m((x_,M3)=>{"use strict";var XSe=x_&&x_.__importDefault||function(n){return n&&n.__esModule?n:{default:n}},v_=XSe(O3());function w_(n){return new v_.default(n)}(function(n){n.HttpsProxyAgent=v_.default,n.prototype=v_.default.prototype})(w_||(w_={}));M3.exports=w_});var H3=m((VHe,N3)=>{"use strict";var USe=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];N3.exports=(n,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(n).concat(USe)),i={};for(let r of t)r in e||(i[r]={get(){let o=n[r];return typeof o=="function"?o.bind(n):o},set(o){n[r]=o},enumerable:!0,configurable:!1});return Object.defineProperties(e,i),n.once("aborted",()=>{e.destroy(),e.emit("aborted")}),n.once("close",()=>{n.complete&&e.readable?e.once("end",()=>{e.emit("close")}):e.emit("close")}),e}});var B3=m((eqe,q3)=>{"use strict";var{Transform:GSe,PassThrough:KSe}=require("stream"),C_=require("zlib"),zSe=H3();q3.exports=n=>{let e=(n.headers["content-encoding"]||"").toLowerCase();if(!["gzip","deflate","br"].includes(e))return n;let t=e==="br";if(t&&typeof C_.createBrotliDecompress!="function")return n.destroy(new Error("Brotli is not supported on Node.js < 12")),n;let i=!0,r=new GSe({transform(a,l,u){i=!1,u(null,a)},flush(a){a()}}),o=new KSe({autoDestroy:!1,destroy(a,l){n.destroy(),l(a)}}),s=t?C_.createBrotliDecompress():C_.createUnzip();return s.once("error",a=>{if(i&&!n.readable){o.end();return}o.destroy(a)}),zSe(n,o),n.pipe(r).pipe(s).pipe(o),o}});function QSe(n){let e;n.protocol==="http:"?e=process.env.HTTP_PROXY||process.env.http_proxy||null:n.protocol==="https:"&&(e=process.env.HTTPS_PROXY||process.env.https_proxy||process.env.HTTP_PROXY||process.env.http_proxy||null);let t=process.env.NO_PROXY||process.env.no_proxy;if(t==="*")e=null;else if(t){let i=n.hostname.replace(/^\.*/,".").toLowerCase(),r=n.port||n.protocol.startsWith("https")?"443":"80",o=t.split(",");for(let s=0,a=o.length;s<a;s++){let l=o[s].trim().toLowerCase();if(l.includes(":")){let u=l.split(":",2),c=u[0].replace(/^\.*/,"."),h=u[1];if(r===h&&i.endsWith(c)){e=null;break}}else if(l=l.replace(/^\.*/,"."),i.endsWith(l)){e=null;break}}}return e}function VSe(n,e){let t=e.proxyUrl||QSe(n);if(t){let i=(0,S_.parse)(t);if(!/^https?:$/.test(i.protocol))return null;let r={host:i.hostname,port:i.port?Number(i.port):i.protocol==="https"?"443":"80",auth:i.auth,rejectUnauthorized:typeof e.strictSSL=="boolean"?e.strictSSL:!0};return X3.info(`Using proxy ${t} from ${e.proxyUrl?"configuration":"system environment"} for ${n.hostname}:`),n.protocol==="http:"?(0,Z3.default)(r):(0,J3.default)(r)}return null}function T_(n,e={}){let t=v.getConfiguration("http"),{data:i}=e,r=tTe(i),o={proxyUrl:t.get("proxy",""),strictSSL:t.get("proxyStrictSSL",!0),proxyAuthorization:t.get("proxyAuthorization",null),proxyCA:t.get("proxyCA",null)};e.query&&!n.includes("?")&&(n=`${n}?${(0,W3.stringify)(e.query)}`);let s=Object.assign(e.headers||{},{"Proxy-Authorization":o.proxyAuthorization}),a=(0,S_.parse)(n),l=VSe(a,o),u={method:e.method||"GET",hostname:a.hostname,port:a.port?parseInt(a.port,10):a.protocol==="
`)){for(let i of e.split(/\r?\n/))this.addLine(i,t);return}if(t&&this._highlights.push({lnum:this.lines.length,colStart:e.match(/^\s*/)[0].length,colEnd:V(e),hlGroup:t}),e.includes("\x1B")){let i=dc(e);for(let r of i.highlights){let{span:o,hlGroup:s}=r;o[0]!=o[1]&&this._highlights.push({lnum:this.lines.length,colStart:o[0],colEnd:o[1],hlGroup:s})}this.lines.push(i.line)}else this.lines.push(e)}addLines(e){this.lines.push(...e)}addTexts(e){let t=this.lines.length,i="";for(let r of e){let o=V(i);r.hlGroup&&this._highlights.push({lnum:t,colStart:o,colEnd:o+V(r.text),hlGroup:r.hlGroup}),i+=r.text}this.lines.push(i)}addText(e,t){let{lines:i}=this,r=i[i.length-1]||"";if(t){let o=V(r);this._highlights.push({lnum:i.length?i.length-1:0,colStart:o,colEnd:o+V(e),hlGroup:t})}i.length?i[i.length-1]=`${r}${e}`:i.push(e)}get length(){return this.lines.length}getline(e){return this.lines[e]||""}get highlights(){return this._highlights}get content(){return this.lines.join(`
`)}render(e,t=0,i=-1){e.setLines(this.lines,{start:t,end:i,strictIndexing:!1},!0);for(let r of this._highlights)e.addHighlight({hlGroup:r.hlGroup,colStart:r.colStart,colEnd:r.colEnd==null?-1:r.colEnd,line:t+r.lnum,srcId:-1})}}});function __(n){return n?new Error(`Illegal argument: ${n}`):new Error("Illegal argument")}var rK=P(()=>{"use strict"});var iw,oK=P(()=>{"use strict";we();rK();iw=class{constructor(e,t){if(typeof e!="string"&&(!e||!M.isUri(e)&&typeof e.uri!="string"))throw __("base");if(typeof t!="string")throw __("pattern");typeof e=="string"?this.baseUri=M.file(e):M.isUri(e)?this.baseUri=e:this.baseUri=M.parse(e.uri),this.pattern=t}toJSON(){return{pattern:this.pattern,baseUri:this.baseUri.toJSON()}}}});var aK=m((Pqe,sK)=>{"use strict";sK.exports=q()});function lK(n,e){if(!n.killed)if(uTe)try{let t={stdio:["pipe","pipe","ignore"]};return e&&(t.cwd=e),_f.execFileSync("taskkill",["/T","/F","/PID",n.pid.toString()],t),!0}catch{return!1}else if(hTe||cTe)try{let t=(0,nw.join)(dTe,"bin/terminateProcess.sh");return!_f.spawnSync(t,[n.pid.toString()]).error}catch{return!1}else return n.kill("SIGKILL"),!0}var _f,nw,uTe,cTe,hTe,dTe,uK=P(()=>{"use strict";_f=S(require("child_process")),nw=require("path"),uTe=process.platform==="win32",cTe=process.platform==="darwin",hTe=process.platform==="linux",dTe=(0,nw.dirname)(__dirname)});var cK,Bqe,Pf,P_=P(()=>{"use strict";cK=S(q());z();De();"use strict";Bqe=Y()("language-client-progressPart"),Pf=class{constructor(e,t,i){this.client=e;this.token=t;this.disposables=[];this._cancelled=!1;this.statusBarItem=D.createStatusBarItem(99,{progress:!0}),this.disposables.push(e.onProgress(cK.WorkDoneProgress.type,this.token,r=>{switch(r.kind){case"begin":this.begin(r);break;case"report":this.report(r);break;case"end":this.done(r.message),i&&i(this);break}}))}begin(e){typeof this.title!="string"&&(this.title=e.title,this.report(e))}report(e){let t=this.statusBarItem,i=[];this.title&&i.push(this.title),typeof e.percentage=="number"&&i.push(e.percentage.toFixed(0)+"%"),e.message&&i.push(e.message),t.text=i.join(" "),t.show()}cancel(){this._cancelled||(this._cancelled=!0,J(this.disposables))}done(e){if(this._cancelled)return;let t=this.statusBarItem;t.text=`${this.title} ${e||"finished"}`,setTimeout(()=>{t.dispose()},300),this.cancel()}}});var R_,L_,hK=P(()=>{"use strict";R_=S(q()),L_=class{constructor(e){this.defaultDelay=e,this.timeout=void 0,this.completionPromise=void 0,this.onSuccess=void 0,this.task=void 0}trigger(e,t=this.defaultDelay){return this.task=e,t>=0&&this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise(i=>{this.onSuccess=i}).then(()=>{this.completionPromise=void 0,this.onSuccess=void 0;let i=this.task();return this.task=void 0,i})),(t>=0||this.timeout===void 0)&&(this.timeout=(0,R_.RAL)().timer.setTimeout(()=>{this.timeout=void 0,this.onSuccess(void 0)},t>=0?t:this.defaultDelay)),this.completionPromise}forceDelivery(){if(!this.completionPromise)return;this.cancelTimeout();let e=this.task();return this.completionPromise=void 0,this.onSuccess=void 0,this.task=void 0,e}isTriggered(){return this.timeout!==void 0}cancel(){this.cancelTimeout(),this.completionPromise=void 0}dispose(){this.cancelTimeout()}cancelTimeout(){this.timeout!==void 0&&((0,R_.RAL)().timer.clearTimeout(this.timeout),this.timeout=void 0)}}});function dK(n){return{uri:n.uri,languageId:n.languageId,version:n.version,text:n.getText()}}function gK(n){return{textDocument:{uri:n.uri}}}function fK(n){return{textDocument:{uri:n.uri,version:n.version},contentChanges:[{text:n.getText()}]}}function I_(n){return{textDocument:rw(n.document),reason:n.reason}}function rw(n){return{uri:n.uri,version:n.version}}function pK(n,e){let t={textDocument:rw(n)};return e&&(t.text=n.getText()),t}function Rf(n){return n.toString()}function mK(n,e,t){return{textDocument:{uri:n.uri},position:e,context:zi(t,["option"])}}function wn(n,e){return{textDocument:{uri:n.uri},position:e}}function bK(n,e,t){return{textDocument:Yl(n),position:e,context:t}}function Yl(n){return{uri:n.uri}}function yK(n,e,t){return{textDocument:{
`+Error().stack.split(`
`).slice(2,4).join(`
`);if(lo.warn(`${u} in the client options is deprecated. use disabledFeatures instead.`,c),this.warn(`${u} in the client options is deprecated. use disabledFeatures instead.`,c),i[u]===!0){let h=u.slice(7);this._clientOptions.disabledFeatures.push(h[0].toLowerCase()+h.slice(1))}}this.state=0,this._connectionPromise=void 0,this._resolvedConnection=void 0,this._initializeResult=void 0,this._listeners=void 0,this._providers=void 0,this._diagnostics=void 0,this._fileEvents=[],this._fileEventDelayer=new L_(250),this._onReady=new Promise((u,c)=>{this._onReadyCallbacks=new M_(u,c)}),this._onStop=void 0,this._stateChangeEmitter=new C.Emitter,this._trace=C.Trace.Off,this._tracer={log:(u,c)=>{Ee(u)?this.logTrace(u,c):this.logObjectTrace(u)}},this._syncedDocuments=new Map;let a=v.getConfiguration("coc.preferences");this._markdownSupport=a.get("enableMarkdown",!0),this.registerBuiltinFeatures()}get supportedMarkupKind(){return this._markdownSupport?[C.MarkupKind.Markdown,C.MarkupKind.PlainText]:[C.MarkupKind.PlainText]}get state(){return this._state}get id(){return this._id}get name(){return this._name}set state(e){let t=this.getPublicState();this._state=e;let i=this.getPublicState();i!==t&&this._stateChangeEmitter.fire({oldState:t,newState:i})}getPublicState(){return this.state===3?2:this.state===1?3:1}get initializeResult(){return this._initializeResult}sendRequest(e,...t){if(!this.isConnectionActive())throw new Error("Language client is not ready yet");try{return this._resolvedConnection.sendRequest(e,...t)}catch(i){throw this.error(`Sending request ${Ee(e)?e:e.method} failed.`,i),i}}onRequest(e,t){if(!this.isConnectionActive())throw new Error("Language client is not ready yet");try{return this._resolvedConnection.onRequest(e,t)}catch(i){throw this.error(`Registering request handler ${Ee(e)?e:e.method} failed.`,i),i}}sendNotification(e,t){if(!this.isConnectionActive())throw new Error("Language client is not ready yet");try{this._resolvedConnection.sendNotification(e,t)}catch(i){throw this.error(`Sending notification ${Ee(e)?e:e.method} failed.`,i),i}}onNotification(e,t){if(!this.isConnectionActive())throw new Error("Language client is not ready yet");try{return this._resolvedConnection.onNotification(e,t)}catch(i){throw this.error(`Registering notification handler ${Ee(e)?e:e.method} failed.`,i),i}}onProgress(e,t,i){if(!this.isConnectionActive())throw new Error("Language client is not ready yet");try{if(e==C.WorkDoneProgress.type){let r=this._clientOptions.middleware.handleWorkDoneProgress;if(r!==void 0)return this._resolvedConnection.onProgress(e,t,o=>{r(t,o,()=>i(o))})}return this._resolvedConnection.onProgress(e,t,i)}catch(r){throw this.error(`Registering progress handler for token ${t} failed.`,r),r}}sendProgress(e,t,i){if(!this.isConnectionActive())throw new Error("Language client is not ready yet");try{this._resolvedConnection.sendProgress(e,t,i)}catch(r){throw this.error(`Sending progress for token ${t} failed.`,r),r}}get clientOptions(){return this._clientOptions}get onDidChangeState(){return this._stateChangeEmitter.event}get outputChannel(){if(!this._outputChannel){let{outputChannelName:e}=this._clientOptions;this._outputChannel=D.createOutputChannel(e||this._name)}return this._outputChannel}get diagnostics(){return this._diagnostics}createDefaultErrorHandler(e){return new SK(this._id,e!=null?e:4)}set trace(e){this._trace=e,this.onReady().then(()=>{this.resolveConnection().then(t=>{t.trace(this._trace,this._tracer,{sendNotification:!1,traceFormat:this._traceFormat})})},()=>{})}logObjectTrace(e){e.isLSPMessage&&e.type?this.outputChannel.append(`[LSP - ${new Date().toLocaleTimeString()}] `):this.outputChannel.append(`[Trace - ${new Date().toLocaleTimeString()}] `),e&&this.outputChannel.appendLine(`${JSON.stringify(e)}`)}data2String(e){if(e instanceof C.ResponseError){let t=e;return` Message: ${t.message}
Code: ${t.code} ${t.data?`
`+t.data.toString():""}`}return e instanceof Error?Ee(e.stack)?e.stack:e.message:Ee(e)?e:e.toString()}_appendOutput(e,t,i){let r=3;switch(e){case"Info":r=1;break;case"Warn":r=2;break}this.outputChannel.appendLine(`[${e} - ${new Date().toLocaleTimeString()}] ${t}`);let o;i&&(o=this.data2String(i),this.outputChannel.appendLine(o)),this._clientOptions.revealOutputChannelOn<=r&&this.outputChannel.show(!0)}info(e,t){this._appendOutput("Info",e,t)}warn(e,t){this._appendOutput("Warn",e,t)}error(e,t){this._appendOutput("Error",e,t)}logTrace(e,t){this.outputChannel.appendLine(`[Trace - ${new Date().toLocaleTimeString()}] ${e}`),t&&this.outputChannel.appendLine(this.data2String(t))}needsStart(){return this.state===0||this.state===4||this.state===5}needsStop(){return this.state===1||this.state===3}onReady(){return this._onReady}get started(){return this.state!=0}isConnectionActive(){return this.state===3&&!!this._resolvedConnection}start(){if(this._rootPath=this.resolveRootPath(),this._rootPath===!1)return this.warn("Required root pattern not resolved, server won't start."),C.Disposable.create(()=>{});if(this._onReadyCallbacks.isUsed&&(this._onReady=new Promise((e,t)=>{this._onReadyCallbacks=new M_(e,t)})),this._listeners=[],this._providers=[],!this._diagnostics){let e=this._clientOptions,t=e.diagnosticCollectionName?e.diagnosticCollectionName:this._id;e.disabledFeatures.includes("diagnostics")||(this._diagnostics=F.createDiagnosticCollection(t))}return this.state=1,this.resolveConnection().then(e=>(e.onLogMessage(t=>{let i;switch(t.type){case C.MessageType.Error:i="error",this.error(t.message);break;case C.MessageType.Warning:i="warning",this.warn(t.message);break;case C.MessageType.Info:i="info",this.info(t.message);break;default:i="log",this.outputChannel.appendLine(t.message)}if(global.hasOwnProperty("__TEST__")){console.log(`[${i}] ${t.message}`);return}}),e.onShowMessage(t=>{switch(t.type){case C.MessageType.Error:D.showErrorMessage(t.message);break;case C.MessageType.Warning:D.showWarningMessage(t.message);break;case C.MessageType.Info:D.showInformationMessage(t.message);break;default:D.showInformationMessage(t.message)}}),e.onRequest(C.ShowMessageRequest.type,t=>{let i;switch(t.type){case C.MessageType.Error:i=D.showErrorMessage.bind(D);break;case C.MessageType.Warning:i=D.showWarningMessage.bind(D);break;case C.MessageType.Info:i=D.showInformationMessage.bind(D);break;default:i=D.showInformationMessage.bind(D)}let r=t.actions||[];return i(t.message,...r).then(o=>o==null?null:o)}),e.onRequest(C.ShowDocumentRequest.type,async t=>{var o;let i=async s=>{try{if(s.external===!0||/^https?:\/\//.test(s.uri))return await v.openResource(s.uri),{success:!0};{let{selection:a,takeFocus:l}=s;return l===!1?await v.loadFile(s.uri):(await v.jumpTo(s.uri,a==null?void 0:a.start),xe(a.start,a.end)!=0&&await D.selectRange(a)),{success:!0}}}catch{return{success:!0}}},r=(o=this._clientOptions.middleware.window)==null?void 0:o.showDocument;return r!==void 0?r(t,i):i(t)}),e.onTelemetry(t=>{}),e.listen(),this.initialize(e))).then(void 0,e=>{this.state=2,this._onReadyCallbacks.reject(e),this.error("Starting client failed ",e)}),C.Disposable.create(()=>{this.needsStop()&&this.stop()})}resolveConnection(){return this._connectionPromise||(this._connectionPromise=this.createConnection()),this._connectionPromise}resolveRootPath(){if(this._clientOptions.workspaceFolder)return M.parse(this._clientOptions.workspaceFolder.uri).fsPath;let{ignoredRootPaths:e}=this._clientOptions,t=v.getConfiguration(this.id),i=t.get("rootPatterns",[]),r=t.get("requireRootPattern",!1),o;if(i&&i.length){let a=v.getDocument(v.bufnr);if(a&&a.schema=="file"){let l=F_.default.dirname(M.parse(a.uri).fsPath);o=ab(l,i,v.cwd)}}if(r&&!o)return!1;let s=o||v.rootPath||v.cwd;return ei(s,xK.default.homedir())||Array.isArray(e)&&e.some(a=>ei(s,a))?(this.warn(`Ignored rootPath ${s} of client "${this._id}"`),null):s}initialize(e){let{initializationOptions:t,progressOnInitialization:i}=this._clientOptions;this.refreshTrace(e,!1);let r=this._rootPath,o={processId:process.pid,rootPath:r||null,ro
Related diagnostics:
`;for(let l of s.relatedInformation){let u=F_.default.basename(M.parse(l.location.uri).fsPath),c=l.location.range.start.line;a=`${a}
${u}(line ${c+1}): ${l.message}`;let h=o.get(l.location.uri)||[];h.push(C.Diagnostic.create(l.location.range,l.message,C.DiagnosticSeverity.Hint,s.code,s.source)),o.set(l.location.uri,h)}s.message=a}this._diagnostics.set(Array.from(o))}}else this._diagnostics.set(e,t)}createConnection(){let e=(i,r,o)=>{lo.error("connection error:",i,r),this.handleConnectionError(i,r,o)},t=()=>{this.handleConnectionClosed()};return this.createMessageTransports(this._clientOptions.stdioEncoding||"utf8").then(i=>gTe(i.reader,i.writer,e,t,this._clientOptions.connectionOptions))}handleConnectionClosed(){if(this.state===5){lo.debug(`client ${this._id} normal close`);return}try{this._resolvedConnection&&this._resolvedConnection.dispose()}catch{}let e=1;if(this.state!==4)try{e=this._clientOptions.errorHandler.closed()}catch{}this._connectionPromise=void 0,this._resolvedConnection=void 0,e===1?(this.error("Connection to server got closed. Server will not be restarted."),this.state===1?(this._onReadyCallbacks.reject(new Error("Connection to server got closed. Server will not be restarted.")),this.state=2):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){v.onDidChangeConfiguration(t=>{t.affectsConfiguration(this._id)&&this.refreshTrace(e,!0)},null,this._listeners)}refreshTrace(e,t=!1){let i=v.getConfiguration(this._id),r=C.Trace.Off,o=C.TraceFormat.Text;if(i){let s=i.get("trace.server","off");typeof s=="string"?r=C.Trace.fromString(s):(r=C.Trace.fromString(i.get("trace.server.verbosity","off")),o=C.TraceFormat.fromString(i.get("trace.server.format","text")))}t&&this._trace==r&&this._traceFormat==o||(this._trace=r,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(C.DidChangeWatchedFilesNotification.type.method).registerRaw(Be(),i)}registerFeatures(e){for(let t of e)this.registerFeature(t)}registerFeature(e){if(this._features.push(e),O_.is(e)){let t=e.registrationType;this._dynamicFeatures.set(t.method,e)}}getFeature(e){return this._dynamicFeatures.get(e)}registerBuiltinFeatures(){let{disabledFeatures:e}=this._clientOptions;e.includes("configuration")||this.registerFeature(new GK(this)),this.registerFeature(new DK(this,this._syncedDocuments)),this.registerFeature(new _K(this)),this.registerFeature(new EK(this,this._syncedDocuments)),e.includes("willSave")||this.registerFeature(new PK(this)),e.includes("willSaveWaitUntil")||this.registerFeature(new RK(this)),e.includes("didSave")||this.registerFeature(new LK(this)),e.includes("fileSystemWatcher")||this.registerFeature(new IK(this,t=>this.notifyFileEvent(t))),e.includes("completion")||this.registerFeature(new FK(this)),e.includes("hover")||this.registerFeature(new OK(this)),e.includes("signatureHelp")||this.registerFeature(new MK(this)),e.includes("references")||this.registerFeature(new NK(this)),e.includes("definition")||this.registerFeature(new AK(this)),e.includes("documentHighlight")||this.registerFeature(new HK(this)),e.includes("documentSymbol")||this.registerFeature(new qK(this)),e.includes("codeAction")||this.registerFeature(new YK(this)),e.includes("workspaceSymbol")||this.registerFeature(new BK(this)),e.includes("codeLens")||this.registerFeature(new WK(this)),e.includes("documentFormatting")||this.registerFeature(new ZK(this)),e.includes("documentRangeFormatting")||this.registerFeature(new JK(this)),e.includes("documentOnTypeFormatting")||this.registerFeature(new $K(this)),e.includes("rename")||this.registerFeature(new XK(this)),e.includes("documentLink")||this.registerFeature(new UK(this)),e.includes("executeCommand")||this.registerFeature(new KK(this))}fillIni
`)?i:i+`
`)}},hP=class{constructor(e,t){this._client=e;this._setting=t;this._listeners=[]}start(){return v.onDidChangeConfiguration(e=>{e.affectsConfiguration(this._setting)&&this.onDidChangeConfiguration()},null,this._listeners),this.onDidChangeConfiguration(),{dispose:()=>{J(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,r=i?v.getConfiguration(t).get(i,!0):v.getConfiguration(t);r&&this._client.needsStart()?this._client.start():!r&&this._client.needsStop()&&this._client.stop()}},mTe={createAll:n=>[]}});function bTe(n){switch(n){case 0:return"init";case 3:return"running";case 1:return"starting";case 2:return"startFailed";case 4:return"stopping";case 5:return"stopped";default:return"unknown"}}function yTe(n){let e=n.map(t=>typeof t=="string"?t:t.language);return e=e.filter(t=>typeof t=="string"),Array.from(new Set(e))}function vTe(n,e,t){let{command:i,module:r,port:o,args:s,filetypes:a}=t;if(s=s||[],!a)return D.showMessage(`Wrong configuration of LS "${e}", filetypes not found`,"error"),null;if(!i&&!r&&!o)return D.showMessage(`Wrong configuration of LS "${e}", no command or module specified.`,"error"),null;let l;if(r){if(r=v.expand(r),!yz.default.existsSync(r))return D.showMessage(`Module file "${r}" not found for LS "${e}"`,"error"),null;l={module:r,runtime:t.runtime||process.execPath,args:s,transport:xTe(t),options:CTe(t)}}else i?l={command:i,args:s,options:STe(t)}:o&&(l=()=>new Promise((g,f)=>{let p=new vz.default.Socket,b=t.host||"127.0.0.1";$l.info(`languageserver "${n}" connecting to ${b}:${o}`),p.connect(o,b,()=>{g({reader:p,writer:p})}),p.on("error",y=>{f(new Error(`Connection error for ${n}: ${y.message}`))})}));let u=Array.from(t.disabledFeatures||[]);for(let g of["disableWorkspaceFolders","disableCompletion","disableDiagnostics"])if(t[g]===!0){let f=g.slice(7);u.push(f[0].toLowerCase()+f.slice(1))}let c=!!t.disableSnippetCompletion;return[{ignoredRootPaths:(t.ignoredRootPaths||[]).map(g=>v.expand(g)),disableSnippetCompletion:c,disableDynamicRegister:!!t.disableDynamicRegister,disabledFeatures:u,formatterPriority:t.formatterPriority||0,documentSelector:xz(t.filetypes,t.additionalSchemes),revealOutputChannelOn:wTe(t.revealOutputChannelOn),synchronize:{configurationSection:`${n}.settings`},diagnosticCollectionName:e,outputChannelName:n,stdioEncoding:t.stdioEncoding||"utf8",progressOnInitialization:t.progressOnInitialization!==!1,initializationOptions:t.initializationOptions||{}},l]}function wTe(n){switch(n){case"info":return 1;case"warn":return 2;case"error":return 3;case"never":return 4;default:return 4}}function xz(n,e){let t=[],i=["file","untitled"].concat(e||[]);return n?(n.forEach(r=>{t.push(...i.map(o=>({language:r,scheme:o})))}),t):i.map(r=>({scheme:r}))}function xTe(n){let{transport:e,transportPort:t}=n;return!e||e=="ipc"?1:e=="stdio"?0:e=="pipe"?2:{kind:3,port:t}}function CTe(n){return{cwd:n.cwd,execArgv:n.execArgv||[],env:n.env||void 0}}function STe(n){return{cwd:n.cwd,detached:!!n.detached,shell:!!n.shell,env:n.env||void 0}}function mz(n){switch(n){case 2:return"running";case 3:return"starting";case 1:return"stopped";default:return"unknown"}}var bz,yz,vz,fh,$l,wz,Ai,Of=P(()=>{"use strict";bz=require("events"),yz=S(require("fs")),vz=S(require("net")),fh=S(q());dP();Lr();z();De();Q();$l=Y()("services");wz=class extends bz.EventEmitter{constructor(){super(...arguments);this.registered=new Map;this.disposables=[]}init(){v.onDidOpenTextDocument(e=>{this.start(e)},null,this.disposables),v.onDidChangeConfiguration(e=>{e.affectsConfiguration("languageserver")&&this.createCustomServices()},null,this.disposables),this.createCustomServices()}dispose(){this.removeAllListeners(),J(this.disposables);for(let e of this.registered.values())e.dispose()}regist(e){let{id:t}=e;if(t||$l.error("invalid service configuration. ",e.name),!this.registered.get(t))return this.registered.set(t,e),$l.info(`registered service "${t}"`),this.shouldStart(e)&&e.start(),e.state==3&&thi
`),"error"),!1):!0}waitClient(e){let t=this.getService(e);return t&&t.state==3?Promise.resolve():t?new Promise(i=>{t.onServiceReady(()=>{i()})}):new Promise(i=>{let r=o=>{(o==e||o==`languageserver.${e}`)&&(this.off("ready",r),i())};this.on("ready",r)})}async registNotification(e,t){await this.waitClient(e);let i=this.getService(e);if(!i.client){D.showMessage(`Not a language client: ${e}`,"error");return}i.client.onNotification(t,async o=>{v.nvim.call("coc#do_notify",[e,t,o],!0)})}async sendNotification(e,t,i){if(!t)throw new Error("method required for ontification");let r=this.getService(e);if(!r||!r.client)throw new Error(`Language server ${e} not found`);if(r.state==1&&await r.client.onReady(),r.state!=3)throw new Error(`Language server ${e} not running`);await Promise.resolve(r.client.sendNotification(t,i))}async sendRequest(e,t,i,r){if(!t)throw new Error("method required for sendRequest");let o=this.getService(e);if(o||await Qe(100),o=this.getService(e),!o||!o.client)throw new Error(`Language server ${e} not found`);if(o.state==1&&await o.client.onReady(),o.state!=3)throw new Error(`Language server ${e} not running`);return r||(r=new fh.CancellationTokenSource().token),await Promise.resolve(o.client.sendRequest(t,i,r))}registLanguageClient(e,t){let i=typeof e=="string"?`languageserver.${e}`:e.id,r=[],o=new fh.Emitter,s=typeof e=="string"?null:e;if(this.registered.has(i))return;let a=!1,l={id:i,client:s,name:typeof e=="string"?e:e.name,selector:typeof e=="string"?xz(t.filetypes,t.additionalSchemes):e.clientOptions.documentSelector,state:0,onServiceReady:o.event,start:()=>{if(l.state==1||l.state==3||s&&!s.needsStart())return;if(a&&s)return s.restart(),Promise.resolve();if(!a){if(typeof e=="string"&&!s){let c=v.getConfiguration().get("languageserver",{})[e];if(!c||c.enable===!1)return;let h=vTe(i,e,c);if(!h)return;s=new Ff(i,e,h[1],h[0]),l.selector=h[0].documentSelector,l.client=s}s.onDidChangeState(c=>{let{oldState:h,newState:d}=c;d==3?l.state=1:d==2?l.state=3:d==1&&(l.state=5);let g=mz(h),f=mz(d);$l.info(`${s.name} state change: ${g} => ${f}`)},null,r),a=!0}l.state=1,$l.debug(`starting service: ${i}`);let u=s.start();return r.push(u),new Promise(c=>{s.onReady().then(()=>{o.fire(void 0),c()},h=>{D.showMessage(`Server ${i} failed to start: ${h}`,"error"),$l.error(`Server ${i} failed to start:`,h),l.state=2,c()})})},dispose:async()=>{o.dispose(),J(r)},stop:async()=>{!s||!s.needsStop()||await Promise.resolve(s.stop())},restart:async()=>{s?(l.state=1,s.restart()):await l.start()}};return this.regist(l)}};Ai=new wz});var Cz,Xl,ph,ww=P(()=>{"use strict";Q();De();Cz=require("events"),Xl=["<esc>","<space>","<tab>","<s-tab>","<bs>","<right>","<left>","<up>","<down>","<home>","<end>","<cr>","<FocusGained>","<FocusLost>","<ScrollWheelUp>","<ScrollWheelDown>","<LeftMouse>","<LeftDrag>","<LeftRelease>","<2-LeftMouse>","<C-a>","<C-b>","<C-c>","<C-d>","<C-e>","<C-f>","<C-g>","<C-h>","<C-i>","<C-j>","<C-k>","<C-l>","<C-m>","<C-n>","<C-o>","<C-p>","<C-q>","<C-r>","<C-s>","<C-t>","<C-u>","<C-v>","<C-w>","<C-x>","<C-y>","<C-z>","<A-a>","<A-b>","<A-c>","<A-d>","<A-e>","<A-f>","<A-g>","<A-h>","<A-i>","<A-j>","<A-k>","<A-l>","<A-m>","<A-n>","<A-o>","<A-p>","<A-q>","<A-r>","<A-s>","<A-t>","<A-u>","<A-v>","<A-w>","<A-x>","<A-y>","<A-z>"],ph=class extends Cz.EventEmitter{constructor(){super();this.configuration=v.getConfiguration("list"),this.disposable=v.onDidChangeConfiguration(e=>{e.affectsConfiguration("list")&&(this.configuration=v.getConfiguration("list"),this.emit("change"))})}get(e,t){return this.configuration.get(e,t)}get previousKey(){return this.fixKey(this.configuration.get("previousKeymap","<C-j>"))}get nextKey(){return this.fixKey(this.configuration.get("nextKeymap","<C-k>"))}dispose(){this.disposable.dispose(),this.removeAllListeners()}fixKey(e){if(Xl.includes(e))return e;let t=Xl.find(i=>i.toLowerCase()==e.toLowerCase());return t||(D.showMessage(`Configured key "${e}" not supported.`,"error"),null)}}});var zXe,xw,Sz=P(()=>{"use strict";De();ww();zXe=Y()("list-mappings"),xw=class{constructor(e,t,i){this.manager=e;this.nvim=t;th
`)&&(t=e.label=t.replace(/\r?\n/g," ")),t.includes(MTe)){let{line:r,highlights:o}=dc(t);e.label=r,Array.isArray(e.ansiHighlights)||(e.ansiHighlights=o)}return e.converted=!0,e}dispose(){this.stop()}}});var pP,Bz,NTe,AUe,Lw,Yz=P(()=>{"use strict";pP=S(_i()),Bz=S(q());go();Bl();z();De();Q();Dz();_z();qz();NTe=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],AUe=Y()("list-session"),Lw=class{constructor(e,t,i,r,o=[],s){this.nvim=e;this.prompt=t;this.list=i;this.listOptions=r;this.listArgs=o;this.config=s;this.loadingFrame="";this.hidden=!1;this.disposables=[];this.args=[];this.ui=new Tw(e,i.name,r,s),this.history=new Sw(t,i.name),this.worker=new Rw(e,i,t,r,{interactiveDebounceTime:s.get("interactiveDebounceTime",100),extendedSearchMode:s.get("extendedSearchMode",!0)}),this.interactiveDebounceTime=s.get("interactiveDebounceTime",100);let a=(0,pP.default)(async()=>{let[d,g,f]=await e.eval('[coc#list#has_preview(),win_getid(),line(".")]');if(d&&g==this.winid){let p=this.ui.lnumToIndex(f);await this.doPreview(p)}},50);this.disposables.push({dispose:()=>{a.clear()}}),this.ui.onDidChangeLine(a,null,this.disposables),this.ui.onDidChangeLine(this.resolveItem,this,this.disposables),this.ui.onDidLineChange(this.resolveItem,this,this.disposables);let l=(0,pP.default)(async()=>{this.updateStatus();let{autoPreview:d}=this.listOptions;if(!d){let[g,f]=await e.eval("[coc#list#has_preview(),mode()]");if(!g||f!="n")return}await this.doAction("preview")},50);this.disposables.push({dispose:()=>{l.clear()}}),this.ui.onDidLineChange(l,null,this.disposables),this.ui.onDidOpen(async()=>{typeof this.list.doHighlight=="function"&&this.list.doHighlight(),v.isVim&&this.prompt.drawPrompt(),this.listOptions.first&&await this.doAction()},null,this.disposables),this.ui.onDidClose(async()=>{await this.hide()},null,this.disposables),this.ui.onDidDoubleClick(async()=>{await this.doAction()},null,this.disposables),this.worker.onDidChangeItems(async({items:d,reload:g,append:f,finished:p})=>{if(!this.hidden)if(f)await this.ui.appendItems(d);else{let b=this.config.get("height",10);p&&!r.interactive&&r.input.length==0&&(b=Math.min(d.length,b)),await this.ui.drawItems(d,Math.max(1,b),g)}},null,this.disposables);let u=0,c,h;this.disposables.push(Bz.Disposable.create(()=>{c&&clearTimeout(c),h&&clearInterval(h)})),this.worker.onDidChangeLoading(d=>{this.hidden||(c&&clearTimeout(c),d?(u=Date.now(),h=setInterval(()=>{let g=Math.floor((Date.now()-u)%1e3/100);this.loadingFrame=NTe[g],this.updateStatus()},100)):c=setTimeout(()=>{this.loadingFrame="",h&&clearInterval(h),h=null,this.updateStatus()},Math.max(0,200-(Date.now()-u))))},null,this.disposables)}async start(e){this.args=e,this.cwd=v.cwd,this.hidden=!1;let{listOptions:t,listArgs:i}=this,r=await this.nvim.eval('[win_getid(),bufnr("%"),winheight("%")]');this.listArgs=i,this.history.load(t.input||""),this.window=this.nvim.createWindow(r[0]),this.buffer=this.nvim.createBuffer(r[1]),this.savedHeight=r[2],await this.worker.loadItems(this.context)}async reloadItems(){!this.ui.winid||await this.worker.loadItems(this.context,!0)}async call(e){var o,s;await this.nvim.call("coc#prompt#stop_prompt",["list"]);let t=await this.ui.getItems(),i={name:this.name,args:this.listArgs,input:this.prompt.input,winid:(o=this.window)==null?void 0:o.id,bufnr:(s=this.buffer)==null?void 0:s.id,targets:t},r=await this.nvim.call(e,[i]);return this.prompt.start(),r}async chooseAction(){let{nvim:e,defaultAction:t}=this,{actions:i}=this.list,r=i.map(h=>h.name),o=r.indexOf(t.name);o!=-1&&(r.splice(o,1),r.unshift(t.name));let s=new Set,a=[],l=[],u=v.env.dialog&&this.config.get("menuAction",!1);for(let h of r){let d=0;for(let g of h){if(!s.has(g)){s.add(g),a.push(`${h.slice(0,d)}&${h.slice(d)}`);break}d++}d==h.length&&l.push(h)}l.length&&!u&&(r=r.filter(h=>!l.includes(h)));let c;u?(e.call("coc#prompt#stop_prompt",["list"],!0),c=await D.showMenuPicker(r,{title:"Choose action",shortcuts:!0}),c=c+1,v.isVim&&await Qe(10),this.prompt.start()):(await e.call("coc#prompt#stop_prompt",["list"]),c=await e.call("confirm"
`)]),await Qe(10),this.prompt.start()),c&&await this.doAction(r[c-1])}async doAction(e){let{list:t}=this,i;if(e!=null){if(i=t.actions.find(o=>o.name==e),!i){D.showMessage(`Action ${e} not found`,"error");return}}else i=this.defaultAction;let r;if(e=="preview"){let o=await this.ui.item;r=o?[o]:[]}else r=await this.ui.getItems();r.length&&await this.doItemAction(r,i)}async doPreview(e){let t=this.ui.getItem(e),i=this.list.actions.find(r=>r.name=="preview");!t||!i||await this.doItemAction([t],i)}async first(){await this.doDefaultAction(0)}async last(){await this.doDefaultAction(this.ui.length-1)}async previous(){await this.doDefaultAction(this.ui.index-1)}async next(){await this.doDefaultAction(this.ui.index+1)}async doDefaultAction(e){let{ui:t}=this,i=t.getItem(e);!i||(t.index=e,await this.doItemAction([i],this.defaultAction),await t.echoMessage(i))}get name(){return this.list.name}get winid(){return this.ui.winid}get length(){return this.ui.length}get defaultAction(){let{defaultAction:e,actions:t,name:i}=this.list,r=v.getConfiguration(`list.source.${i}`),o;if(r.defaultAction&&(o=t.find(s=>s.name==r.defaultAction)),o||(o=t.find(s=>s.name==e)),o||(o=t[0]),!o)throw new Error(`default action "${e}" not found`);return o}async hide(e=!1){if(this.hidden)return;let{nvim:t,timer:i,window:r}=this,{winid:o,tabnr:s}=this.ui;i&&clearTimeout(i),this.worker.stop(),this.history.add(),this.ui.reset(),this.hidden=!0;let{isVim:a}=v;if(t.pauseNotification(),a||t.call("coc#prompt#stop_prompt",["list"],!0),s&&t.call("coc#list#close_preview",[s],!0),r&&t.call("win_gotoid",[r.id],!0),o&&t.call("coc#window#close",[o],!0),r&&this.savedHeight&&this.listOptions.position!=="tab"&&t.call("coc#window#set_height",[r.id,this.savedHeight],!0),e)return t.resumeNotification(!1,!0);await t.resumeNotification(!1),a&&(await Qe(10),t.call("feedkeys",["\x1B","int"],!0),t.command("redraw",!0))}toggleMode(){let e=this.prompt.mode=="normal"?"insert":"normal";this.prompt.mode=e,this.listOptions.mode=e,this.updateStatus()}stop(){this.worker.stop()}async resolveItem(){let e=this.ui.index,t=this.ui.getItem(e);if(!t||t.resolved)return;let{list:i}=this;if(typeof i.resolveItem=="function"){let r=t.label,o=await Promise.resolve(i.resolveItem(t));if(o&&e==this.ui.index){let s=fP(this.prompt.input,o);this.ui.updateItem(Object.assign({highlights:s},o),e,r!=o.label)}}}async showHelp(){await this.hide();let{list:e,nvim:t}=this;if(!e)return;t.pauseNotification(),t.command("tabe +setl\\ previewwindow [LIST HELP]",!0),t.command("setl nobuflisted noswapfile buftype=nofile bufhidden=wipe",!0),await t.resumeNotification();let i=e.options&&e.options.length,r=await t.buffer,o=new vn;if(o.addLine("NAME","Label"),o.addLine(` ${e.name} - ${e.description||""}
`),o.addLine("SYNOPSIS","Label"),o.addLine(` :CocList [LIST OPTIONS] ${e.name}${i?" [ARGUMENTS]":""}
`),e.detail){o.addLine("DESCRIPTION","Label");let a=e.detail.split(`
`).map(l=>" "+l);o.addLine(a.join(`
`)+`
`)}if(i){o.addLine("ARGUMENTS","Label"),o.addLine("");for(let a of e.options)o.addLine(a.name,"Special"),o.addLine(` ${a.description}`),o.addLine("");o.addLine("")}let s=v.getConfiguration(`list.source.${e.name}`);if(Object.keys(s).length){o.addLine("CONFIGURATIONS","Label"),o.addLine("");let a={};ye.all.forEach(l=>{let{packageJSON:u}=l,{contributes:c}=u;if(!c)return;let{configuration:h}=c;if(h){let{properties:d}=h;if(d)for(let g of Object.keys(d))a[g]=d[g]}});for(let l of Object.keys(s)){let u=s[l],c=`list.source.${e.name}.${l}`,h=a[c]&&a[c].description?a[c].description:l;o.addLine(` "${c}"`,"MoreMsg"),o.addText(` - ${h}, current value: `),o.addText(JSON.stringify(u),"Special")}o.addLine("")}o.addLine("ACTIONS","Label"),o.addLine(` ${e.actions.map(a=>a.name).join(", ")}`),o.addLine(""),o.addLine("see ':h coc-list-options' for available list options.","Comment"),t.pauseNotification(),o.render(r,0,-1),t.command("setl nomod",!0),t.command("setl nomodifiable",!0),t.command("normal! gg",!0),t.command("nnoremap <buffer> q :bd!<CR>",!0),await t.resumeNotification()}async switchMatcher(){let{matcher:e,interactive:t}=this.listOptions;if(t)return;let i=["fuzzy","strict","regex"],r=i.indexOf(e)+1;r>=i.length&&(r=0),this.listOptions.matcher=i[r],this.prompt.matcher=i[r],await this.worker.drawItems()}updateStatus(){let{ui:e,list:t,nvim:i}=this;if(!e.bufnr)return;let r=i.createBuffer(e.bufnr),o={mode:this.prompt.mode.toUpperCase(),args:this.args.join(" "),name:t.name,cwd:this.cwd,loading:this.loadingFrame,total:this.worker.length};r.setVar("list_status",o,!0),i.command("redraws",!0)}get context(){let{winid:e}=this.ui;return{options:this.listOptions,args:this.listArgs,input:this.prompt.input,cwd:v.cwd,window:this.window,buffer:this.buffer,listWindow:e?this.nvim.createWindow(e):void 0}}onMouseEvent(e){switch(e){case"<LeftMouse>":return this.ui.onMouse("mouseDown");case"<LeftDrag>":return this.ui.onMouse("mouseDrag");case"<LeftRelease>":return this.ui.onMouse("mouseUp");case"<2-LeftMouse>":return this.ui.onMouse("doubleClick")}}async doNumberSelect(e){if(!this.listOptions.numberSelect)return!1;let t=e.charCodeAt(0);if(t>=48&&t<=57){let i=Number(e);if(i==0&&(i=10),this.ui.length>=i)return this.nvim.pauseNotification(),this.ui.setCursor(i),await this.nvim.resumeNotification(),await this.doAction(),!0}return!1}jumpBack(){let{window:e,nvim:t}=this;e&&(t.pauseNotification(),t.call("coc#prompt#stop_prompt",["list"],!0),this.nvim.call("win_gotoid",[e.id],!0),t.resumeNotification(!1,!0))}async resume(){this.winid&&await this.hide();let e=await this.nvim.eval('[win_getid(),bufnr("%"),winheight("%")]');this.hidden=!1,this.window=this.nvim.createWindow(e[0]),this.buffer=this.nvim.createBuffer(e[1]),this.savedHeight=e[2],this.prompt.start(),await this.ui.resume(),this.listOptions.autoPreview&&await this.doAction("preview")}async doItemAction(e,t){let{noQuit:i,position:r}=this.listOptions,{nvim:o}=this,s=t.persist===!0||t.name=="preview";r==="tab"&&t.tabPersist&&(s=!0);let a=this.winid&&(s||i);try{if(a?s||(o.pauseNotification(),o.call("coc#prompt#stop_prompt",["list"],!0),o.call("win_gotoid",[this.context.window.id],!0),await o.resumeNotification()):await this.hide(),t.multiple)await Promise.resolve(t.execute(e,this.context));else if(t.parallel)await Promise.all(e.map(l=>Promise.resolve(t.execute(l,this.context))));else for(let l of e)await Promise.resolve(t.execute(l,this.context));a&&this.ui.restoreWindow(),t.reload&&a&&await this.reloadItems()}catch(l){this.nvim.echoError(l)}}onInputChange(){this.timer&&clearTimeout(this.timer),this.listOptions.input=this.prompt.input,this.listOptions.interactive?(this.worker.stop(),this.timer=setTimeout(async()=>{await this.worker.loadItems(this.context)},this.interactiveDebounceTime)):this.worker.drawItems()}dispose(){this.hide(!0),J(this.disposables),this.worker.dispose(),this.ui.dispose()}}});var Wz,Zz,Jz,HTe,Iw,$z=P(()=>{"use strict";Wz=require("child_process"),Zz=require("events"),Jz=S(require("readline"));z();Q();HTe=Y()("list-commandTask"),Iw=class extends Zz.EventEmitter{constructor(e){super();this.o
`,"\v","\f","\r","","","","","","","","","","","","","","\x1B","","","",""," ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~","\x7F","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""," ","!","C/","PS","$?","Y=","|","SS",'"',"(c)","a","<<","!","","(r)","-","deg","+-","2","3","'","u","P","*",",","1","o",">>","1/4","1/2","3/4","?","A","A","A","A","A","A","AE","C","E","E","E","E","I","I","I","I","D","N","O","O","O","O","O","x","O","U","U","U","U","U","Th","ss","a","a","a","a","a","a","ae","c","e","e","e","e","i","i","i","i","d","n","o","o","o","o","o","/","o","u","u","u","u","y","th","y"]});var TQ=m((o3e,SQ)=>{SQ.exports=["A","a","A","a","A","a","C","c","C","c","C","c","C","c","D","d","D","d","E","e","E","e","E","e","E","e","E","e","G","g","G","g","G","g","G","g","H","h","H","h","I","i","I","i","I","i","I","i","I","i","IJ","","J","j","K","k","k","L","l","L","l","L","l","L","l","L","l","N","n","N","n","N","n","'n","ng","NG","O","o","O","o","O","o","OE","oe","R","r","R","r","R","r","S","s","S","s","S","s","S","s","T","t","T","t","T","t","U","u","U","u","U","u","U","u","U","u","U","u","W","w","Y","y","Y","Z","z","Z","z","Z","z","s","b","B","B","b","6","6","O","C","c","D","D","D","d","d","3","@","E","F","f","G","G","hv","I","I","K","k","l","l","W","N","n","O","O","o","OI","oi","P","p","YR","2","2","SH","sh","t","T","t","T","U","u","Y","V","Y","y","Z","z","ZH","ZH","zh","zh","2","5","5","ts","w","|","||","|=","!","DZ","Dz","dz","LJ","Lj","lj","NJ","Nj","nj","A","a","I","i","O","o","U","u","U","u","U","u","U","u","U","u","@","A","a","A","a","AE","ae","G","g","G","g","K","k","O","o","O","o","ZH","zh","j","DZ","D","dz","G","g","HV","W","N","n","A","a","AE","ae","O","o"]});var DQ=m((s3e,kQ)=>{kQ.exports=["A","a","A","a","E","e","E","e","I","i","I","i","O","o","O","o","R","r","R","r","U","u","U","u","S","s","T","t","Y","y","H","h","[?]","[?]","OU","ou","Z","z","A","a","E","e","O","o","O","o","O","o","O","o","Y","y","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","a","a","a","b","o","c","d","d","e","@","@","e","e","e","e","j","g","g","g","g","u","Y","h","h","i","i","I","l","l","l","lZ","W","W","m","n","n","n","o","OE","O","F","R","R","R","R","r","r","R","R","R","s","S","j","S","S","t","t","U","U","v","^","W","Y","Y","z","z","Z","Z","?","?","?","C","@","B","E","G","H","j","k","L","q","?","?","dz","dZ","dz","ts","tS","tC","fN","ls","lz","WW","]]","[?]","[?]","k","h","j","r","r","r","r","w","y","'",'"',"`","'","`","`","'","?","?","<",">","^","V","^","V","'","-","/","\\",",","_","\\","/",":",".","`","'","^","V","+","-","V",".","@",",","~",'"',"R","X","G","l","s","x","?","","","","","","","","V","=",'"',"[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]"]});var _Q=m((a3e,EQ)=>{EQ.exports=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","","","","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","'",",","[?]","[?]","[?]","[?]","","[?]","[?]","[?]","?","[?]","[?]","[?]","[?]","[?]","","","A",";","E","E","I","[?]","O","[?]","U","O","I","A","B","G","D","E","Z","E","Th","I","K","L","M","N","Ks","O","P","R","[?]","S","T","U","Ph","Kh","Ps","O","I","U","a","e","e","i","u","a","b","g","d","e","z","e","th","i","k","l","m","n","x","o","p","r","s","s","t","u","ph","kh"
`,`
`,"","","","",""," ","%0","%00","'","''","'''","`","``","```","^","<",">","*","!!","!?","-","_","-","^","***","--","/","-[","]-","[?]","?!","!?","7","PP","(]","[)","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","","","","","","","0","","","","4","5","6","7","8","9","+","-","=","(",")","n","0","1","2","3","4","5","6","7","8","9","+","-","=","(",")","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","ECU","CL","Cr","FF","L","mil","N","Pts","Rs","W","NS","D","EU","K","T","Dr","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","","","","","","","","","","","","","","","","","","","","","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]"]});var C4=m((L3e,x4)=>{x4.exports=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]"," 1/3 "," 2/3 "," 1/5 "," 2/5 "," 3/5 "," 4/5 "," 1/6 "," 5/6 "," 1/8 "," 3/8 "," 5/8 "," 7/8 "," 1/","I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII","L","C","D","M","i","ii","iii","iv","v","vi","vii","viii","ix","x","xi","xii","l","c","d","m","(D","D)","((|))",")","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","-","|","-","|","-","|","\\","/","\\","/","-","-","~","~","-","|","-","|","-","-","-","|","-","|","|","-","-","-","-","-","-","|","|","|","|","|","|","|","^","V","\\","=","V","^","-","-","|","|","-","-","|","|","=","|","=","=","|","=","|","=","=","=","=","=","=","|","=","|","=","|","\\","/","\\","/","=","=","~","~","|","|","-","|","-","|","-","-","-","|","-","|","|","|","|","|","|","|","-","\\","\\","|","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]"]});var T4=m((I3e,S4)=>{S4.exports=["[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]"]});var D4=m((j3e,k4)=>{k4.exports=["[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]","[?]
`)}function u9(n){let{range:e,context:t,line:i}=n,r=["import re, os, vim, string, random",`path = vim.eval('expand("%:p")') or ""`,"fn = os.path.basename(path)"];t?(r.push("snip = ContextSnippet()"),r.push(`context = ${t}`)):r.push("context = True");let o=`(${e.start.line},${Buffer.byteLength(i.slice(0,e.start.character))})`,s=`(${e.start.line},${Buffer.byteLength(i.slice(0,e.end.character))})`,a=i.match(/^\s*/)[0];return r.push(`snip = SnippetUtil("${Bf(a)}", ${o}, ${s}, context)`),r}async function wh(n,e){try{await n.command(`pyx ${QTe(e.join(`
`))}`)}catch(t){let i=new Error(t instanceof Error?t.message:t.toString());throw i.stack=`Error on execute python code:
${e.join(`
`)}
`+(t instanceof Error?t.stack:t),i}}function Yf(n){let e=Object.keys(n),t=e.length?Math.max.apply(null,e.map(r=>Number(r))):0,i=new Array(t).fill('""');for(let[r,o]of Object.entries(n))i[r]=`"${Bf(o)}"`;return`t = (${i.join(",")},)`}function QTe(n,e=!1){if(!zTe&&e===!1)return n;let t=["import traceback, vim","vim.vars['errmsg'] = ''","try:"];return t.push(...n.split(`
`).map(i=>" "+i)),t.push("except Exception as e:"),t.push(" vim.vars['errmsg'] = traceback.format_exc()"),t.join(`
`)}function Bf(n){return n.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\t/g,"\\t").replace(/\n/g,"\\n")}function c9(n){if(n.indexOf("\\z")!==-1)throw new Error("pattern \\z not supported");if(n.indexOf("(?s)")!==-1)throw new Error("pattern (?s) not supported");if(n.indexOf("(?x)")!==-1)throw new Error("pattern (?x) not supported");if(n.indexOf(`
`)!==-1)throw new Error("pattern \\n not supported");if(eke.test(n))throw new Error("pattern (?id/name)yes-pattern|no-pattern not supported");return n.replace(rke,(e,t)=>e=="\\A"?"^":e.startsWith("(?#")?"":e.startsWith("(?P<")?"(?"+e.slice(3):e.startsWith("(?P=")?`\\k<${t}>`:"")}var s9,a9,TQe,zTe,VTe,eke,tke,ike,nke,rke,yP=P(()=>{"use strict";s9=require("child_process"),a9=require("util"),TQe=Y()("snippets-eval"),zTe=process.env.VIM_NODE_RPC=="1";VTe=/\\A/,eke=/\(\?\(\w+\).+\|/,tke=/\(\?#.*?\)/,ike=/\(\?P<\w+>.*?\)/,nke=/\(\?P=(\w+)\)/,rke=new RegExp(`${tke.source}|${VTe.source}|${ike.source}|${nke.source}`,"g")});function h9(n,e){let t=[...n];for(;t.length>0;){let i=t.shift();if(!e(i))break;t.unshift(...i.children)}}function lke(n,e=[]){let t="",i=n.length,r=0,o=!1,s=!1;for(;r<i;){let a=n[r];if(a.charCodeAt(0)===92&&!e.includes(r)){let l=n[r+1];if(ake.includes(l)){r++;continue}if(l=="u"||l=="l"){let u=n[r+2];u&&(t=t+(l=="u"?u.toUpperCase():u.toLowerCase())),r=r+3;continue}if(l=="U"||l=="L"){l=="U"?o=!0:s=!0,r=r+2;continue}if(l=="E"){o=!1,s=!1,r=r+2;continue}if(l=="n"){t+=`
`,r=r+2;continue}if(l=="t"){t+=" ",r=r+2;continue}}o?a=a.toUpperCase():s&&(a=a.toLowerCase()),t+=a,r++}return t}var d9,oke,ske,Nr,vP,as,vt,ss,wP,rt,Wf,Gw,Zf,hr,yo,Jf,Pa,ake,Kw=P(()=>{"use strict";d9=S(r9());na();o9();Fe();yP();oke=Y()("snippets-parser"),ske=["d","g","i","m","s","u","y"],Nr=class{static isDigitCharacter(e){return e>=48&&e<=57}static isVariableCharacter(e){return e===95||e>=97&&e<=122||e>=65&&e<=90}constructor(){this.text("")}text(e){this.value=e,this.pos=0}tokenText(e){return this.value.substr(e.pos,e.len)}next(){if(this.pos>=this.value.length)return{type:14,pos:this.pos,len:0};let e=this.pos,t=0,i=this.value.charCodeAt(e),r;if(r=Nr._table[i],typeof r=="number")return this.pos+=1,{type:r,pos:e,len:1};if(Nr.isDigitCharacter(i)){r=8;do t+=1,i=this.value.charCodeAt(e+t);while(Nr.isDigitCharacter(i));return this.pos+=t,{type:r,pos:e,len:t}}if(Nr.isVariableCharacter(i)){r=9;do i=this.value.charCodeAt(e+ ++t);while(Nr.isVariableCharacter(i)||Nr.isDigitCharacter(i));return this.pos+=t,{type:r,pos:e,len:t}}r=10;do t+=1,i=this.value.charCodeAt(e+t);while(!isNaN(i)&&typeof Nr._table[i]>"u"&&!Nr.isDigitCharacter(i)&&!Nr.isVariableCharacter(i));return this.pos+=t,{type:r,pos:e,len:t}}},vP=Nr;vP._table={[36]:0,[58]:1,[44]:2,[123]:3,[125]:4,[92]:5,[47]:6,[124]:7,[43]:11,[45]:12,[63]:13,[40]:15,[41]:16,[96]:17,[33]:18};as=class{constructor(){this._children=[]}appendChild(e){return e instanceof vt&&this._children[this._children.length-1]instanceof vt?this._children[this._children.length-1].value+=e.value:(e.parent=this,this._children.push(e)),this}setOnlyChild(e){e.parent=this,this._children=[e]}replaceChildren(e){for(let t of e)t.parent=this;this._children=e}get children(){return this._children}get snippet(){let e=this;for(;;){if(!e)return;if(e instanceof Jf)return e;e=e.parent}}toString(){return this.children.reduce((e,t)=>e+t.toString(),"")}len(){return 0}},vt=class extends as{constructor(e){super();this.value=e}static escape(e){return e.replace(/\$|}|\\/g,"\\$&")}toString(){return this.value}toTextmateString(){return vt.escape(this.value)}len(){return this.value.length}clone(){return new vt(this.value)}},ss=class extends as{constructor(e,t,i){super();this.code=e;this.kind=t;this._value="";this._related=[];if(t==="python"){let{_related:r}=this,o,s=/\bt\[(\d+)\]/g;for(;o=s.exec(e),o!=null;){let a=parseInt(o[1],10);r.includes(a)||r.push(a)}}i!==void 0&&(this._value=i)}get related(){return this._related}update(e){if(this.kind!=="python")return;let t=new Set;this.code=this.code.replace(/\bt\[(\d+)\]/g,(i,r)=>{let o=Number(r),s=e.has(o)?e.get(o):o;return t.add(s),`t[${s}]`}),this._related=Array.from(t)}get index(){if(this.parent instanceof rt)return this.parent.index}async resolve(e){if(!this.code.length)return;let t=await l9(e,this.kind,this.code,this._value);t!=null&&(this._value=t)}len(){return this._value.length}toString(){return this._value}get value(){return this._value}toTextmateString(){let e="";return this.kind=="python"?e="!p ":this.kind=="shell"?e="":this.kind=="vim"&&(e="!v "),"`"+e+this.code+"`"}clone(){return new ss(this.code,this.kind,this.value)}},wP=class extends as{},rt=class extends wP{constructor(e){super();this.index=e;this.primary=!1}get isFinalTabstop(){return this.index===0}get choice(){return this._children.length===1&&this._children[0]instanceof Wf?this._children[0]:void 0}toTextmateString(){let e="";return this.transform&&(e=this.transform.toTextmateString()),this.children.length===0&&!this.transform?`$${this.index}`:this.children.length===0?`\${${this.index}${e}}`:this.choice?`\${${this.index}|${this.choice.toTextmateString()}|${e}}`:`\${${this.index}:${this.children.map(t=>t.toTextmateString()).join("")}${e}}`}clone(){let e=new rt(this.index);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}},Wf=class extends as{constructor(){super(...arguments);this.options=[]}appendChild(e){return e instanceof vt&&(e.parent=this,this.options.push(e)),this}toString(){return this.options[0].value}toTextmateString(){return this.options.map(e=>e.value.repl
`)){let i="";this.snippet.walk(l=>{if(l==this)return!1;if(l instanceof vt){let u=l.toString().split(/\r?\n/);i=u[u.length-1].match(/^\s*/)[0]}return!0});let r=t.split(`
`),o=r.filter(l=>l.length>0).map(l=>l.match(/^\s*/)[0]),s=o.length==0?"":o.reduce((l,u)=>l.length<u.length?l:u);t=r.map((l,u)=>u==0||l.length==0||!l.startsWith(s)?l:i+l.slice(s.length)).join(`
`)}return this.transform&&(t=this.transform.resolve(t||"")),t!==void 0?(this._children=[new vt(t)],!0):!1}toTextmateString(){let e="";return this.transform&&(e=this.transform.toTextmateString()),this.children.length===0?`\${${this.name}${e}}`:`\${${this.name}:${this.children.map(t=>t.toTextmateString()).join("")}${e}}`}clone(){let e=new yo(this.name,this.resolved);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}};Jf=class extends as{constructor(e){super();this.ultisnip=e===!0}get hasPython(){return this.ultisnip?this.pyBlocks.length>0:!1}get hasCodeBlock(){if(!this.ultisnip)return!1;let{pyBlocks:e,otherBlocks:t}=this;return e.length>0||t.length>0}get values(){if(this._values)return this._values;let e={},t=0;this.placeholders.forEach(i=>{t=Math.max(i.index,t),i.transform==null&&(i.primary||e[i.index]===void 0)&&(e[i.index]=i.toString())});for(let i=0;i<=t;i++)e[i]===void 0&&(e[i]="");return this._values=e,e}get orderedPyIndexBlocks(){let e=[],t=this.pyBlocks.filter(s=>typeof s.index=="number");if(t.length==0)return e;let i=t.map(s=>s.index),r=[],o=s=>{let{related:a}=s;return a.length==0||a.every(l=>!i.includes(l)||r.includes(l))?(r.push(s.index),e.push(s),!0):!1};for(;t.length>0;){let s=!1;for(let a of t)o(a)&&(s=!0);if(!s)break;t=t.filter(a=>!r.includes(a.index))}return e}async evalCodeBlocks(e,t){let{pyBlocks:i,otherBlocks:r}=this;if(await Promise.all(r.map(o=>{let s=o.value;return o.resolve(e).then(()=>{o.parent instanceof rt&&s!==o.value&&this.onPlaceholderUpdate(o.parent)})})),i.length){let o=Yf(this.values);await wh(e,[...t,o]);for(let a of i){let l=a.value;await a.resolve(e),l!==a.value&&a.parent instanceof rt&&(this.onPlaceholderUpdate(a.parent),await wh(e,[Yf(this.values)]))}for(let a of this.orderedPyIndexBlocks)await this.updatePyIndexBlock(e,a);let s=i.filter(a=>a.index===void 0&&a.related.length>0);for(let a of s)await a.resolve(e)}}async updatePythonCodes(e,t){let i;if(t instanceof rt)i=t.index;else for(;t.parent;){if(t instanceof rt){i=t.index;break}t=t.parent}if(i===void 0)return;let r=this.getDependentPyIndexBlocks(i);await wh(e,[Yf(this.values)]);for(let s of r)await this.updatePyIndexBlock(e,s);let o=this.pyBlocks.filter(s=>s.index===void 0&&s.related.length>0);for(let s of o)await s.resolve(e)}getDependentPyIndexBlocks(e){let t=[],i=[],r=this.pyBlocks.filter(s=>typeof s.index=="number"),o=s=>{let a=r.filter(l=>!i.includes(l.index)&&l.related.includes(s));a.length>0&&(t.push(...a),a.forEach(l=>{o(l.index)}))};return o(e),t}async updatePyIndexBlock(e,t){let i=t.value;await t.resolve(e),i!==t.value&&(t.parent instanceof rt&&this.onPlaceholderUpdate(t.parent),await wh(e,[Yf(this.values)]))}get placeholderInfo(){if(!this._placeholders){let e=[],t=[],i=[],r=[];this.walk(o=>{if(o instanceof rt)r.push(o);else if(o instanceof yo){let s=o.name.charCodeAt(0);(s<65||s>90)&&e.push(o)}else o instanceof ss&&(o.kind==="python"?t.push(o):i.push(o));return!0}),this._placeholders={placeholders:r,pyBlocks:t,otherBlocks:i,variables:e}}return this._placeholders}get variables(){return this.placeholderInfo.variables}get placeholders(){return this.placeholderInfo.placeholders}get pyBlocks(){return this.placeholderInfo.pyBlocks}get otherBlocks(){return this.placeholderInfo.otherBlocks}get maxIndexNumber(){let{placeholders:e}=this;return e.reduce((t,i)=>Math.max(t,i.index),0)}get first(){var o,s;let{placeholders:e,variables:t}=this,[i,r]=LW(e.filter(a=>!a.transform),a=>a.index!==0);if(i.length){let a=Math.min.apply(null,i.map(u=>u.index)),l=i.filter(u=>u.index==a);return(o=l.find(u=>u.primary))!=null?o:l[0]}return t.length?t[0]:(s=r.find(a=>a.primary))!=null?s:r[0]}insertSnippet(e,t,i,r){let o=t instanceof rt?t.index:this.maxIndexNumber+1,[s,a]=i,l=r?Uw(r):void 0,u=new Pa(!!r,l).parse(e,!0),c=u.maxIndexNumber+1,h=new Map;for(let p of u.placeholders){let b=p.index;p.isFinalTabstop?p.index=c+o:p.index=p.index+o,h.set(b,p.index)}r&&u.pyBlocks.forEach(p=>{p.update(h)});let d=new Map;this.walk(p=>{if(p instanceof rt&&p.index>o){let b=p.index;p.index=p.index+c,d.set(b,p.index)
`:"";if(r.indexOf(`
`)==-1){let s=new ss(o+r.trim(),"python");e.appendChild(s)}else{let s=r.split(/\r?\n/);s=s.filter(u=>!/^\s*$/.test(u));let a=s[0]?s[0].match(/^\s*/)[0]:"";a.length&&s.every(u=>u.startsWith(a))&&(s=s.map(u=>u.slice(a.length))),a==" "&&s[0].startsWith(a)&&(s[0]=s[0].slice(1));let l=new ss(o+s.join(`
`),"python");e.appendChild(l)}return!0}}return this._backTo(t),!1}_parseAnything(e){if(this._token.type!==14){let t=this._scanner.tokenText(this._token);return e.appendChild(new vt(t)),this._accept(void 0),!0}return!1}},ake=[":","(",")","{","}"]});function xP(n,e){let{range:t,newText:i}=n,r=e.length,o=i.length;if(r===0||o===0)return n;let{start:s,end:a}=t,l=0;for(let d=1;d<=Math.min(o,r)&&i[d-1]===e[d-1];d++)l=d;let u=0,c=Math.min(o-l,r-l);if(c>0)for(let d=1;d<=c&&i[o-d]===e[r-d];d++)u=d;let h=u==0?i.slice(l):i.slice(l,-u);return l>0&&(s=Ri(s,i.slice(0,l))),u>0&&(a=Ri(t.start,e.slice(0,-u))),Ni.TextEdit.replace(Ni.Range.create(s,a),h)}function g9(n,e,t){let i=Ni.Range.create(n,Ri(n,t));return ct(e,i)==0}function f9(n,e,t){var o;if(t.lines.length<n.line)return!1;let r=!0;for(let s=n.line;s>=0;s--){let a=(o=t.lines[s])!=null?o:"";if(s===n.line){let l=e.lines[s].slice(0,n.character);if(!a.startsWith(l)){r=!1;break}}else if(a!==e.lines[s]){r=!1;break}}return r}function p9(n,e,t){let i=e.lines.length;if(t.lines.length<i-n.line)return;let r,o=t.lines.length-i;for(let s=n.line;s<i;s++){let a=t.lines[s+o];if(s==n.line){let l=e.lines[s].slice(n.character);if(l.length&&!a.endsWith(l))break;r=Ni.Position.create(s+o,a.length-l.length)}else if(a!==e.lines[s]){r=void 0;break}}return r}function m9(n,e,t){var a,l;let i=[],r=[],o=n.split(`
`),s=t.start.line-e.start.line;for(let u=0;u<=s;u++){let c=(a=o[u])!=null?a:"";u==s?i.push(u==0?c.substring(0,t.start.character-e.start.character):c.substring(0,t.start.character)):i.push(c)}s=e.end.line-t.end.line;for(let u=0;u<=s;u++){let c=(l=o[t.end.line-e.start.line+u])!=null?l:"";u==0?s==0?r.push(e.end.character==t.end.character?"":c.slice(t.end.character-e.end.character)):r.push(c.substring(t.end.character)):r.push(c)}return[i.join(`
`),r.join(`
`)]}function b9(n,e,t){let i=n.split(/\r?\n/),r=t.insertSpaces?" ".repeat(t.tabSize):" ",o=t.tabSize||2;return i=i.map((s,a)=>{let l=s.match(/^\s*/)[0],u=l,c=l.startsWith(" ");return c&&t.insertSpaces?u=r.repeat(l.length):!c&&!t.insertSpaces&&(u=r.repeat(l.length/o)),(a==0||s.length==0?"":e)+u+s.slice(l.length)}),i.join(`
`)}function y9(n){return!!(/^\s/.test(n)||n.indexOf(`
`)!==-1)}var Ni,HQe,zw,CP=P(()=>{"use strict";Ni=S(q());Sc();bt();ea();yP();Kw();HQe=Y()("snippets-snipet"),zw=class{constructor(e,t,i,r){this.snippetString=e;this.position=t;this.nvim=i;this.resolver=r}async init(e,t=!1){let i=e?Uw(e):void 0,o=new Pa(!!e,i).parse(this.snippetString,!0);this.tmSnippet=o,await this.resolve(e),this.synchronize(),t||(this.nvim.call("coc#compat#del_var",["coc_selected_text"],!0),this.nvim.call("coc#compat#del_var",["coc_last_placeholder"],!0))}async resolve(e){let{snippet:t}=this.tmSnippet,{resolver:i,nvim:r}=this;if(i&&await t.resolveVariables(i),e&&e.noPython!==!0){let o=[];t.hasPython&&(o=u9(e)),await t.evalCodeBlocks(r,o)}}getRanges(e){let t=e.marker;if(e.value.length==0)return[];let r=this._placeholders.filter(l=>l.index==e.index).map(l=>l.range),o=this.tmSnippet.enclosingPlaceholders(t),s,a=t.parent;if(t instanceof rt){let l=t.index;s=this.tmSnippet.placeholders.filter(u=>u.index==l&&u.parent==a)}else{let l=t.name;s=this.tmSnippet.variables.filter(u=>u.name==l&&u.parent==a)}return o.forEach(l=>{let u=this._placeholders.filter(c=>c.index==l.index&&c.marker!==l);if(!!u.length)for(let c of s){let h=this.tmSnippet.getTextBefore(c,l);u.forEach(d=>{if(d.transform)r.push(d.range);else{let g=d.range.start;r.push(Ni.Range.create(Ri(g,h),Ri(g,h+c.toString())))}})}}),r.filter(l=>!Ct(l))}getSortedPlaceholders(e){let t=e?[e]:[],i=this._placeholders.filter(r=>r!==e&&!r.transform);return i.sort((r,o)=>r.primary!==o.primary?r.primary?-1:1:r.index==0||o.index==0?r.index==0?1:-1:r.index-o.index),t.push(...i),t}get hasPython(){return this.tmSnippet.pyBlocks.length>0}resetStartPosition(e){this.position=e,this.synchronize()}get start(){return Object.assign({},this.position)}get range(){return Ni.Range.create(this.position,Ri(this.position,this._text))}get text(){return this._text}get finalCount(){return this._placeholders.filter(e=>e.index==0).length}get placeholders(){return this._placeholders.map(e=>e.marker)}get firstPlaceholder(){let e=0;for(let t of this._placeholders)t.index==0||t.transform||(e==0||t.index<e)&&(e=t.index);return this.getPlaceholder(e)}getPlaceholderByMarker(e){return this._placeholders.find(t=>t.marker===e)}getPlaceholder(e){let t=this._placeholders.filter(r=>r.index==e&&!r.transform),i=t.find(r=>r.primary)||t[0];return i!=null?i:t[0]}getPrevPlaceholder(e){if(e<=1)return;let t=this._placeholders.filter(r=>r.index<e&&r.index!=0&&!r.transform),i;for(;e>1;){e=e-1;let r=t.filter(o=>o.index==e);if(r.length){i=r.find(o=>o.primary)||r[0];break}}return i}getNextPlaceholder(e){let t=this._placeholders.filter(s=>!s.transform),i,r=t.map(s=>s.index),o=Math.max.apply(null,r);for(let s=e+1;s<=o+1;s++){let a=s==o+1?0:s,l=t.filter(u=>u.index==a);if(l.length){i=l.find(u=>u.primary)||l[0];break}}return i}getPlaceholderByRange(e){return this._placeholders.find(t=>Pi(e,t.range))}async insertSnippet(e,t,i,r){if(r){let{start:s,end:a}=e.range;this.nvim.setVar("coc_last_placeholder",{current_text:e.value,start:{line:s.line,col:s.character,character:s.character},end:{line:a.line,col:a.character,character:a.character}},!0)}let o=this.tmSnippet.insertSnippet(t,e.marker,i,r);return await this.resolve(r),this.synchronize(),o}getNewText(e,t){let{before:i,after:r}=e;if(!!t.startsWith(i)&&!(t.length<i.length+r.length)&&!!t.endsWith(r))return r.length?t.slice(i.length,-r.length):t.slice(i.length)}async updatePlaceholder(e,t,i,r){let o=this.position,{marker:s,before:a}=e,l=this.tmSnippet.clone();r.onCancellationRequested(()=>{this.tmSnippet=l,this.synchronize()});let u=Ni.Range.create(o,Ri(o,a));if(await this.tmSnippet.update(this.nvim,s,i),r.isCancellationRequested)return;this.synchronize();let c=this._placeholders.find(d=>d.marker==s),h=c?c.before:a;return{text:this._text,delta:Nb(t,Ni.TextEdit.replace(u,h))}}removeText(e,t){let i=this.tmSnippet.deleteText(e,t);return i&&this.synchronize(),i}synchronize(){let e=this.tmSnippet,{line:t,character:i}=this.position,r=Fn.create("untitled:/1","snippet",0,e.toString()),{placeholders:o,variables:s,maxIndexNumber:a}=e,l=new Map,u=a+1;this._placeholders=[...o,...s].map(c=>{l
`)){let h=o.getline(t.start.line),d=h.slice(t.end.character);if(d.length){let g=t.end.character,f=d.match(/^\s*/)[0].length,p=Hi.Range.create(t.end.line,g,t.end.line,g+f);a.push(Hi.TextEdit.replace(p,h.match(/^\s*/)[0]))}}}if(await this.applyEdits(a),this.textDocument=o.textDocument,this.activate(),i&&this.current){let u=this.snippet.getPlaceholderByMarker(this.current);await this.selectPlaceholder(u,!0)}return this._isActive}async applyEdits(e){this._applying=!0,await this.document.applyEdits(e),this._applying=!1}getReplacePlaceholder(e){if(!this.snippet)return;let t=this.findPlaceholder(e);if(!(!t||t.index==0))return t}activate(){this._isActive||(this._isActive=!0,this.nvim.call("coc#snippet#enable",[this.preferComplete?1:0],!0))}deactivate(){this.cancel(),this._isActive&&(this.disposable.dispose(),this._isActive=!1,this.current=null,this.nvim.call("coc#snippet#disable",[],!0),this.enableHighlight&&this.nvim.call("coc#highlight#clear_highlight",[this.bufnr,SP,0,-1],!0),this._onCancelEvent.fire(void 0),ls.debug(`session ${this.bufnr} cancelled`))}get isActive(){return this._isActive}get bufnr(){return this.document.bufnr}async nextPlaceholder(){await this.forceSynchronize();let e=this.placeholder;if(!e)return;let t=this.snippet.getNextPlaceholder(e.index);t&&await this.selectPlaceholder(t)}async previousPlaceholder(){await this.forceSynchronize();let e=this.placeholder;if(!e)return;let t=this.snippet.getPrevPlaceholder(e.index);t&&await this.selectPlaceholder(t)}async selectCurrentPlaceholder(e=!0){if(await this.forceSynchronize(),!this.snippet)return;let t=this.snippet.getPlaceholderByMarker(this.current);t&&await this.selectPlaceholder(t,e)}async selectPlaceholder(e,t=!0){let{nvim:i,document:r}=this;if(!r||!e)return;let{start:o,end:s}=e.range,a=s.character-o.character,l=V(r.getline(o.line).slice(0,o.character))+1,u=this.current=e.marker;if(u instanceof rt&&u.choice&&u.choice.options.length){let c=u.choice.options.map(h=>h.value);await i.call("coc#snippet#show_choices",[o.line+1,l,a,c]),t&&i.call("coc#util#do_autocmd",["CocJumpPlaceholder"],!0)}else{let c=this.snippet.finalCount;await this.select(e,t),this.highlights(e),e.index==0&&(c==1?(ls.info("Jump to final placeholder, cancelling snippet session"),this.deactivate()):i.call("coc#snippet#disable",[],!0))}}highlights(e,t=!0){if(!this.enableHighlight)return;let i=this.document.buffer;this.nvim.pauseNotification(),i.clearNamespace(SP);let r=this.snippet.getRanges(e);r.length&&i.highlightRanges(SP,"CocSnippetVisual",r),this.nvim.resumeNotification(t,!0)}async select(e,t=!0){let{range:i,value:r}=e,{nvim:o}=this;r.length>0?await o.call("coc#snippet#select",[i.end,r]):await o.call("coc#snippet#move",[i.start]),t&&o.call("coc#util#do_autocmd",["CocJumpPlaceholder"],!0),o.redrawVim()}async checkPosition(){if(!this.isActive)return;let e=await D.getCursorPosition();this.snippet&&ct(e,this.snippet.range)!=0&&(ls.info("Cursor insert out of range, cancelling snippet session"),this.deactivate())}findPlaceholder(e){let{placeholder:t}=this;return t&&Pi(e,t.range)?t:this.snippet.getPlaceholderByRange(e)||null}async synchronize(e){this.cancel(),await this.mutex.use(()=>{let t=this.textDocument?this.textDocument.version:-1;return e&&(this.document.version!=e.version||e.version-t!==1)&&(e=void 0),this._synchronize(e?e.change:void 0)})}async _synchronize(e){let{document:t,textDocument:i}=this;if(!t.attached||!this._isActive)return;let r=Date.now(),o=t.textDocument;if(o.version==i.version||_e(i.lines,o.lines))return;let{range:s,text:a}=this.snippet;e&&!Pi(e.range,s)&&(e=void 0);let l=p9(s.end,i,o);if(!l){ls.info("Content change after snippet, cancel snippet session"),this.deactivate();return}if(!f9(s.start,i,o)){let y=o.getText(Hi.Range.create(Hi.Position.create(0,0),l));if(y.endsWith(a)){let w=o.positionAt(y.length-a.length);this.snippet.resetStartPosition(w),this.textDocument=o,ls.info("Content change before snippet, reset snippet position");return}ls.info("Before and snippet body changed, cancel snippet session"),this.deactivate();return}let c=this.tokenSource=new Hi.CancellationToken
`),filetype:"txt"}]:[];await e.show(l,{modes:["n"]})}},500)),global.__TEST__)return;this.checkExtensions().logError();let t=v.getConfiguration("coc.preferences"),i=t.get("extensionUpdateCheck","never"),r=t.get("silentAutoupdate",!0);if(i!="never"){let o=new Date,s=new Date(o.getFullYear(),o.getMonth(),o.getDate()-(i=="daily"?0:7)),a=this.db.fetch("lastUpdate");if(a&&Number(a)>s.getTime())return;this.outputChannel.appendLine("Start auto update..."),this.updateExtensions(!1,r).logError()}}async updateExtensions(e,t=!1){if(!this.npm)return;let i=await this.getLockedList(),r=await this.globalExtensionStats();r=r.filter(l=>![...i,...this.disabled].includes(l.id)),this.db.push("lastUpdate",Date.now()),t&&D.showMessage("Updating extensions, checkout output:///extensions for details.","more");let o=this.installBuffer=new zg(!0,e,t?this.outputChannel:void 0);o.setExtensions(r.map(l=>l.id)),await o.show(v.nvim);let s=ew(this.npm,this.modulesFolder);await ig(r,l=>{let{id:u}=l;o.startProgress([u]);let c=l.exotic?l.uri:null,h=s(u);return h.on("message",(d,g)=>{o.addMessage(u,d,g)}),h.update(c).then(d=>{o.finishProgress(u,!0),d&&this.loadExtension(d).logError()},d=>{o.addMessage(u,d.message),o.finishProgress(u,!1)})},t?1:3)}async checkExtensions(){let{globalExtensions:e}=v.env;if(e&&e.length){let t=this.filterGlobalExtensions(e);this.installExtensions(t).logError()}}get installer(){return ew(this.npm,this.modulesFolder)}async installExtensions(e=[]){let{npm:t}=this;if(!t||!e.length)return;e=ia(e);let i=this.installBuffer=new zg;i.setExtensions(e),await i.show(v.nvim);let r=ew(this.npm,this.modulesFolder);await ig(e,s=>{i.startProgress([s]);let a=r(s);return a.on("message",(l,u)=>{i.addMessage(s,l,u)}),a.install().then(l=>{i.finishProgress(s,!0);let u=Ie.default.join(this.modulesFolder,l);this.loadExtension(u).logError()},l=>{i.addMessage(s,l.message),i.finishProgress(s,!1),en.error(`Error on install ${s}`,l)})})}getMissingExtensions(){let e=this.loadJson()||{dependencies:{}},t=[];for(let i of Object.keys(e.dependencies)){let r=Ie.default.join(this.modulesFolder,i);if(!pt.default.existsSync(r)){let o=e.dependencies[i];o.startsWith("http")?t.push(o):t.push(i)}}return t}get npm(){let e=v.getConfiguration("npm").get("binPath","npm");e=v.expand(e);for(let t of[e,"yarnpkg","yarn","npm"])try{return M9.default.sync(t)}catch{continue}return D.showMessage("Can't find npm or yarn in your $PATH","error"),null}get all(){return Array.from(this.extensions.values()).map(e=>e.extension).filter(e=>!this.isDisabled(e.id))}getExtension(e){return this.extensions.get(e)}getExtensionState(e){if(this.isDisabled(e))return"disabled";let i=this.extensions.get(e);if(!i)return"unknown";let{extension:r}=i;return r.isActive?"activated":"loaded"}async getExtensionStates(){let e=await this.localExtensionStats([]),t=await this.globalExtensionStats();return e.concat(t.filter(i=>e.find(r=>r.id==i.id)==null))}async getLockedList(){let e=await this.db.fetch("extension");return e=e||{},Object.keys(e).filter(t=>e[t].locked===!0)}async toggleLock(e){let t=`extension.${e}.locked`;await this.db.fetch(t)?this.db.delete(t):this.db.push(t,!0)}async toggleExtension(e){let t=this.getExtensionState(e);if(t==null)return;t=="activated"&&await this.deactivate(e);let i=`extension.${e}.disabled`;if(this.db.push(i,t!="disabled"),t!="disabled")this.disabled.add(e),await this.unloadExtension(e);else{this.disabled.delete(e);let r=Ie.default.join(this.modulesFolder,e);pt.default.existsSync(r)&&await this.loadExtension(r)}await Qe(200)}async reloadExtension(e){let t=this.extensions.get(e);if(!t){D.showMessage(`Extension ${e} not registered`,"error");return}if(t.type==3){D.showMessage(`Can't reload internal extension "${t.id}"`,"warning");return}t.type==2?await this.loadExtensionFile(t.filepath):t.directory?await this.loadExtension(t.directory):D.showMessage(`Can't reload extension ${t.id}`,"warning")}async cleanExtensions(){let e=this.modulesFolder;if(!pt.default.existsSync(e))return[];let t=this.globalExtensions,i=[];for(let r of t){let o=Ie.default.join(e,r),s=await pt.default.lstat(o);!s||
${a.message}
${a.stack}`)});return}let r=[],o=!1,s=()=>{if(!o)return o=!0,J(r),new Promise(a=>{if(!this.canActivate(e))return this.outputChannel.appendLine(`Extension ${e} is disabled or not loaded.`),a();this.activate(e).then(()=>{a()},l=>{D.showMessage(`Error on activate extension ${e}: ${l.message}`),this.outputChannel.appendLine(`Error on activate extension ${e}:${l.message}
${l.stack}`),a()})})};for(let a of i){let l=a.split(":"),u=l[0];if(u=="onLanguage"){if(v.languageIds.has(l[1])||v.filetypes.has(l[1])){await s();return}v.onDidOpenTextDocument(c=>{let h=v.getDocument(c.bufnr);(c.languageId==l[1]||h.filetype==l[1])&&s()},null,r)}else if(u=="onCommand")re.onCommandList.push(l[1]),_.on("Command",async c=>{c==l[1]&&(await s(),await Qe(500))},null,r);else if(u=="workspaceContains"){let c=async()=>{let d=v.workspaceFolders.map(g=>M.parse(g.uri).fsPath);for(let g of d)for(let f of l[1].split(/\s+/))if(await bY(g,f))return await s(),!0;return!1};if(v.onDidChangeWorkspaceFolders(c,null,r),await c())return}else if(u=="onFileSystem"){for(let c of v.documents)if(M.parse(c.uri).scheme==l[1]){await s();return}v.onDidOpenTextDocument(c=>{M.parse(c.uri).scheme==l[1]&&s()},null,r)}else D.showMessage(`Unsupported event ${a} of ${e}`,"error")}}createExtension(e,t,i){let r=t.name,o=!1,s,a=Ie.default.join(e,t.main||"index.js"),l,u=[],c,h={activate:()=>{if(s)return s;let g={subscriptions:u,extensionPath:e,globalState:this.memos.createMemento(`${r}|global`),workspaceState:this.memos.createMemento(`${r}|${v.rootPath}`),asAbsolutePath:f=>Ie.default.join(e,f),storagePath:Ie.default.join(this.root,`${r}-data`),logger:A9(r)};if(!l)try{let f=!(t.engines||{}).hasOwnProperty("coc");l=L9(r,a,f)}catch(f){en.error(`Error on createExtension ${r} from ${a}`,f);return}return s=new Promise((f,p)=>{try{Promise.resolve(l.activate(g)).then(b=>{o=!0,c=b,f(b)},b=>{en.error(`Error on active extension ${r}: ${b.message}`,b),p(b)})}catch(b){en.error(`Error on active extension ${r}: ${b}`,b instanceof Error?b.stack:b),p(b)}}),s}};Object.defineProperties(h,{id:{get:()=>r,enumerable:!0},packageJSON:{get:()=>t,enumerable:!0},extensionPath:{get:()=>e,enumerable:!0},isActive:{get:()=>o,enumerable:!0},exports:{get:()=>{if(!o)throw new Error(`Invalid access to exports, extension "${r}" not activated`);return c},enumerable:!0}}),this.extensions.set(r,{id:r,type:i,isLocal:i==1,extension:h,directory:e,filepath:a,deactivate:()=>{if(!!o&&(s=void 0,c=void 0,o=!1,J(u),u.splice(0,u.length),u=[],l&&l.deactivate))try{return Promise.resolve(l.deactivate()).catch(g=>{en.error(`Error on ${r} deactivate: `,g)})}catch(g){en.error(`Error on ${r} deactivate: `,g)}}});let{contributes:d}=t;if(d){let{configuration:g,rootPatterns:f,commands:p}=d;if(g&&g.properties){let{properties:b}=g,y={};for(let w of Object.keys(b)){let x=b[w].default;x!=null&&(y[w]=x)}v.configurations.extendsDefaults(y)}if(f&&f.length)for(let b of f)v.workspaceFolderControl.addRootPattern(b.filetype,b.patterns);if(p&&p.length)for(let b of p)re.titles.set(b.command,b.title)}this._onDidLoadExtension.fire(h),this.activated&&this.setupActiveEvents(r,t).logError()}filterGlobalExtensions(e){let t=new Map;e.forEach(s=>{let a=this.getExtensionName(s);a&&t.set(a,s)});let i=this.loadJson(),r=[],o=[];if(i&&i.dependencies)for(let s of Object.keys(i.dependencies)){let a=i.dependencies[s];typeof a=="string"&&pt.default.existsSync(Ie.default.join(this.modulesFolder,s,"package.json"))&&(o.push(s),/^https?:/.test(a)&&r.push(a))}for(let s of t.keys()){if(this.disabled.has(s)||this.extensions.has(s)){t.delete(s);continue}(/^https?:/.test(s)&&r.some(a=>a.startsWith(s))||o.includes(s))&&t.delete(s)}return Array.from(t.values())}getExtensionName(e){return/^https?:/.test(e)||!e.includes("@")?e:e.replace(/@[\d.]+$/,"")}get modulesFolder(){return Ie.default.join(this.root,global.__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=Ie.default.join(e,"package.json");if(!pt.default.existsSync(t))throw new Error("package.json not found");let i=JSON.parse(pt.default.readFileSync(t,"utf8")),{name:r,engines:o,main:s}=i;if(!r||!o)throw new Error("can't find name & engines in package.json");if(!o||!Dt(o))throw new Error(`invalid engines in ${t}`);if(s&&!pt.default.existsSync(Ie.default.join(e,s)))throw new Error(`main f
`])})}get nvim(){return v.nvim}createNativeSources(){this.disposables.push((X9(),Fa($9)).regist(this.sourceMap,this.keywords)),this.disposables.push((K9(),Fa(G9)).regist(this.sourceMap,this.keywords)),this.disposables.push((tee(),Fa(eee)).regist(this.sourceMap))}createLanguageSource(e,t,i,r,o,s,a){let l=new rx(e,t,r,i,o||[],a||[],s,this.completeConfig);return iee.debug("created service source",e),this.sourceMap.set(e,l),{dispose:()=>{this.sourceMap.delete(e)}}}async createVimSourceExtension(e,t){let i=cx.default.basename(t,".vim");try{await e.command(`source ${t}`);let r=await e.call("coc#util#remote_fns",i);for(let c of["init","complete"])if(!r.includes(c))return D.showMessage(`${c} not found for source ${i}`,"error"),null;let o=await e.call(`coc#source#${i}#init`,[]),s={name:`coc-source-${i}`,engines:{coc:">= 0.0.1"},activationEvents:o.filetypes?o.filetypes.map(c=>`onLanguage:${c}`):["*"],contributes:{configuration:{properties:{[`coc.source.${i}.enable`]:{type:"boolean",default:!0},[`coc.source.${i}.firstMatch`]:{type:"boolean",default:!!o.firstMatch},[`coc.source.${i}.triggerCharacters`]:{type:"number",default:o.triggerCharacters||[]},[`coc.source.${i}.priority`]:{type:"number",default:o.priority||9},[`coc.source.${i}.shortcut`]:{type:"string",default:o.shortcut||i.slice(0,3).toUpperCase(),description:"Shortcut text shown in complete menu."},[`coc.source.${i}.disableSyntaxes`]:{type:"array",default:[],items:{type:"string"}},[`coc.source.${i}.filetypes`]:{type:"array",default:o.filetypes||null,description:"Enabled filetypes.",items:{type:"string"}}}}}},a=new ox({name:i,filepath:t,sourceType:1,optionalFns:r.filter(c=>!["init","complete"].includes(c))}),l=!1,u={id:s.name,packageJSON:s,exports:void 0,extensionPath:t,activate:()=>(l=!0,this.addSource(a),Promise.resolve())};Object.defineProperty(u,"isActive",{get:()=>l}),ye.registerExtension(u,()=>{l=!1,this.removeSource(a)})}catch(r){D.showMessage(`Error on create vim source ${i}: ${r}`,"error")}}createRemoteSources(){let{runtimepath:e}=v.env,t=e.split(",");for(let i of t)this.createVimSources(i).logError()}async createVimSources(e){if(this.remoteSourcePaths.includes(e))return;this.remoteSourcePaths.push(e);let t=cx.default.join(e,"autoload/coc/source"),i=await Mt(t);if(i&&i.isDirectory()){let r=await ree.default.promisify(nee.default.readdir)(t);r=r.filter(s=>s.endsWith(".vim"));let o=r.map(s=>cx.default.join(t,s));if(o.length==0)return;await Promise.all(o.map(s=>this.createVimSourceExtension(this.nvim,s)))}}get names(){return Array.from(this.sourceMap.keys())}get sources(){return Array.from(this.sourceMap.values())}has(e){return this.names.findIndex(t=>t==e)!=-1}getSource(e){return e&&this.sourceMap.get(e)||null}shouldCommit(e,t){if(!e||!e.source)return!1;let i=this.getSource(e.source);return i&&i.sourceType==2&&typeof i.shouldCommit=="function"?i.shouldCommit(e,t):!1}getCompleteSources(e){let{filetype:t,disabled:i}=e,r=tt(e.line,0,e.colnr-1),o=e.input==""&&!!e.triggerCharacter,s=Jm(e.filepath,e.bufnr,"",v.env.isCygwin);return i=Array.isArray(i)?i:[],o?this.getTriggerSources(r,t,s,i):this.getNormalSources(e.filetype,s,i)}getNormalSources(e,t,i=[]){let r=e.split(".");return this.sources.filter(o=>{let{filetypes:s,triggerOnly:a,name:l,documentSelector:u,enable:c}=o;return!(i.includes(l)||!c||a||s&&!ZD(s,r)||u&&r.every(h=>v.match(u,{uri:t,languageId:h})==0))})}checkTrigger(e,t,i){let{triggerCharacters:r,triggerPatterns:o}=e;return!!((r==null?void 0:r.length)>0&&r.includes(i)||(o==null?void 0:o.length)>0&&o.findIndex(s=>s.test(t))!==-1)}shouldTrigger(e,t,i){return this.getTriggerSources(e,t,i).length>0}getTriggerSources(e,t,i,r=[]){if(!e)return[];let o=e[e.length-1],s=t.split(".");return this.sources.filter(a=>{let{filetypes:l,enable:u,documentSelector:c,name:h}=a;return r.includes(h)||!u||l&&!ZD(l,s)||c&&s.every(d=>v.match(c,{uri:i,languageId:d})==0)?!1:this.checkTrigger(a,e,o)})}addSource(e){let{name:t}=e;return this.names.includes(t)&&iee.warn(`Recreate source ${t}`),this.sourceMap.set(t,e),ot.Disposable.create(()=>{this.sourceMap.delete(t)})}removeSource(e){let t=typeof
`)==-1&&(c+=" ",h(u,"CocTreeDescription"),c+=u),{line:c,highlights:s}}async appendTreeNode(e,t,i,r,o){let s=1,a=await this.getTreeItem(e),l=this.getRenderedLine(a,i,t);if(o.push(...l.highlights),r.push({level:t,line:l.line,node:e}),a.collapsibleState==2){let u=t+1,c=await Promise.resolve(this.provider.getChildren(e))||[];for(let h of c){let d=await this.appendTreeNode(h,u,i+s,r,o);s=s+d}}return s}updateUI(e,t,i=0,r=-1,o=!1){if(!this.bufnr)return;let{nvim:s,winid:a}=this,l=s.createBuffer(this.bufnr);if(s.pauseNotification(),l.setOption("modifiable",!0,!0),l.setLines(e,{start:i,end:r,strictIndexing:!1},!0),this.autoWidth&&this.nvim.call("coc#window#adjust_width",[a],!0),t.length){let u=r==-1?-1:i+e.length;s.call("coc#highlight#update_highlights",[this.bufnr,LP,t,i,u],!0)}l.setOption("modifiable",!1,!0),o||this.redraw(),s.resumeNotification(!1,!0)}async reveal(e,t={}){var l;if((l=this.filter)!=null&&l.activated)return;let i=this.getItemLnum(e)!=null,{select:r,focus:o,expand:s}=t,a=e;if(typeof this.provider.getParent!="function")throw new Error("missing getParent function from provider for reveal.");if(!i)for(;a;){let u=await Promise.resolve(this.provider.getParent(a));if(u){let c=await this.getTreeItem(u);c.collapsibleState=2,a=u}else break}if(s){let u=await this.getTreeItem(e);if(u.collapsibleState==0)return;if(u.collapsibleState=2,typeof s=="number"&&s>1){let c=Math.min(s,2),h=await Promise.resolve(this.provider.getChildren(e));for(;(h==null?void 0:h.length)>0;){let d=[];for(let g of h){let f=await this.getTreeItem(g);if(f.collapsibleState!=0&&(f.collapsibleState=2,c>1)){let p=await Promise.resolve(this.provider.getChildren(g));d.push(...p)}}h=d,c=c-1}}}(!i||s)&&await this.render(),r!==!1&&this.selectItem(e),o&&this.focusItem(e)}updateHeadLines(e=!1){let{titleCount:t,messageCount:i}=this.lineState,r=e?-1:t+i,o=[],s=[];try{if(this.message&&(s.push({hlGroup:"MoreMsg",colStart:0,colEnd:V(this.message),lnum:0}),o.push(this.message),o.push("")),this.title){if(s.push({hlGroup:"CocTreeTitle",colStart:0,colEnd:V(this.title),lnum:o.length}),this.description){let a=V(this.title)+1;s.push({hlGroup:"Comment",colStart:a,colEnd:a+V(this.description),lnum:o.length})}o.push(this.title+(this.description?" "+this.description:""))}this.lineState.messageCount=this.message?2:0,this.lineState.titleCount=this.title?1:0,this.updateUI(o,s,0,r),e||this.refreshSigns()}catch(a){this.nvim.echoError(a)}}refreshSigns(){let{selection:e,nvim:t,bufnr:i}=this;if(!e.length||!i||!v.env.sign)return;let r=t.createBuffer(i);t.pauseNotification(),r.unplaceSign({group:"CocTree"});for(let o of e){let s=this.getItemLnum(o);s!=null&&r.placeSign({id:IP+s,lnum:s+1,name:"CocTreeSelected",group:"CocTree"})}t.resumeNotification(!1,!0)}async render(){if(!this.bufnr)return;let e=await this.mutex.acquire();try{let t=[],i=[],{startLnum:r}=this,o=await Promise.resolve(this.provider.getChildren()),s=0,a=r,l=[];if(!(o!=null&&o.length))this.message="No results";else{this.message=="No results"&&(this.message="");for(let c of o)a+=await this.appendTreeNode(c,s,a,l,i)}t.push(...l.map(c=>c.line)),this.renderedItems=l;let u=this.startLnum-r;u&&i.forEach(c=>c.lnum=c.lnum+u),this.updateUI(t,i,this.startLnum,-1),this._onDidRefrash.fire(),this.retryTimers=0,e()}catch(t){this.renderedItems=[],this.nodesMap.clear(),this.lineState={titleCount:0,messageCount:1},e();let i=`${t}`.replace(/\r?\n/g," ");if(this.updateUI([i],[{hlGroup:"WarningMsg",colStart:0,colEnd:V(i),lnum:0}]),this.retryTimers==5)return;this.timer=setTimeout(()=>{this.retryTimers=this.retryTimers+1,this.render()},500)}}async show(e="belowright 30vs"){if(this._creating)return!1;this._creating=!0;let{nvim:t}=this,i=this.winid,[r,o,s,a]=await t.eval(`[bufnr("%"),win_getid(),tabpagenr(),bufloaded(${this.bufnr||-1})]`);this._targetBufnr=r,this._targetWinId=o,this._targetTabId=D.getTabId(s),a||(this.bufnr=void 0);let l=await t.call("coc#window#find",["cocViewId",this.viewId]);if(this.bufnr&&l!==-1&&await t.call("winbufnr",[l])==this.bufnr){this._creating=!1;return}if(t.pauseNotification(),this.bufnr)l!=-1?(t.call("win_gotoid",[l],!
`),0,i]]);return t[s-1]}async withProgress(e,t){let i=Error().stack;if(!this.checkDialog())return;let r=new mx(this.nvim,{task:t,title:e.title,cancellable:e.cancellable}),s=v.getConfiguration("notification").get("minProgressWidth",30);return await new Promise((l,u)=>{r.show(Object.assign(this.getNotificationPreference(i),{minWidth:s})).then(c=>{c||u(new Error("Unable to create notification window."))},u),r.onDidFinish(l)})}createTreeView(e,t){let i=(vx(),Fa(bee)).default;return new i(e,t)}async diffHighlights(e,t,i,r,o){let s=[e,t];Array.isArray(r)&&s.push(r[0],r[1]);let a=await this.nvim.call("coc#highlight#get_highlights",s);if(!a||(o==null?void 0:o.isCancellationRequested))return null;i.sort((b,y)=>b.lnum-y.lnum);let l=[],u=v.has("nvim-0.6.0"),c=[],h=[],d=0,g=i.length-1,f=0,p=new Map;if(a.forEach(b=>{f=Math.max(f,b[1]);let y=p.get(b[1]);y?y.push(b):p.set(b[1],[b])}),a.length>0){let b=Array.isArray(r)?r[0]:0;for(let y=b;y<=f;y++){let w=p.get(y)||[],x=[];for(let k=d;k<=g;k++){let L=i[k];if(L.lnum==y)d=k+1,x.push(L);else{d=k;break}}x.length==0?w.length&&(u?c.push(...w.map(k=>k[4])):l.push(y)):w.length==0?h.push(...x.map(k=>OP(k))):(x.length!=w.length||!x.every((k,L)=>Mke(k,w[L])))&&(u?c.push(...w.map(k=>k[4])):l.push(y),h.push(...x.map(k=>OP(k))))}}for(let b=d;b<=g;b++)h.push(OP(i[b]));return{remove:l,add:h,removeMarkers:c}}async applyDiffHighlights(e,t,i,r,o=!1){let{nvim:s}=this,{remove:a,add:l,removeMarkers:u}=r;a.length===0&&l.length===0&&u.length===0||(s.pauseNotification(),u.length&&s.call("coc#highlight#del_markers",[e,t,u],!0),a.length&&s.call("coc#highlight#clear",[e,t,a],!0),l.length&&s.call("coc#highlight#set",[e,t,l,i],!0),o?s.resumeNotification(!0,!0):await s.resumeNotification(!0))}async bufferCheck(){let e=await v.document,t;if(e.attached||(e.enabled?e.buftype!==""&&e.buftype!=="acwrite"?t=`Document not attached with buftype '${e.buftype}'`:t="Document not attached, file size exceed coc.preferences.maxFileSize":t="Document not attached, b:coc_enabled is 0"),t){await this.showDialog({title:"Buffer check result",content:t,highlight:"WarningMsg"});return}let i=new vn;i.addLine("Provider state","Title"),i.addLine("");for(let r of Oke){let o=F.hasProvider(r,e.textDocument);i.addTexts([{text:"-",hlGroup:"Comment"},{text:" "},o?{text:"\u2713",hlGroup:"CocListFgGreen"}:{text:"\u2717",hlGroup:"CocListFgRed"},{text:" "},{text:r,hlGroup:o?"Normal":"CocFadeOut"}])}await this.showDialog({title:"Buffer check result",content:i.content,highlights:i.highlights})}createNotification(e,t,i,r){return new Promise(o=>{let s={kind:e,content:t,buttons:i.map((l,u)=>({text:l,index:u})),callback:l=>{o(l)}};new Vl(this.nvim,s).show(this.getNotificationPreference(r)).then(l=>{l||(FP.error("Unable to open notification window"),o(-1)),i.length||o(-1)},l=>{FP.error("Unable to open notification window",l),o(-1)})})}parseSource(e){let t=e.split(/\r?\n/).slice(2)[0];if(!t)return;t=t.replace(/^\s*at\s*/,"");let i;if(t.endsWith(")")){let s=t.match(/(\((.*?):\d+:\d+\))$/);s&&(i=s[2])}else{let s=t.match(/(.*?):\d+:\d+$/);s&&(i=s[1])}if(!i)return;let r=(go(),Fa(H9)).default.getExtensionsInfo(),o=r.find(s=>ei(s.filepath,i));if(o)return o.name.startsWith("single")?Th.default.basename(o.filepath):o.name;if(o=r.find(s=>Ae(s.directory,i)),o)return o.name;if(Ae(jke,i))return"coc.nvim"}get dialogPreference(){let e=v.getConfiguration("dialog");return{rounded:e.get("rounded",!0),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"),shortcutHighlight:e.get("shortcutHighlight")}}get inputPreference(){let e=v.getConfiguration("dialog");return{rounded:e.get("rounded",!0),maxWidth:e.get("maxWidth"),highlight:e.get("floatHighlight"),borderhighlight:e.get("floatBorderHighlight")}}getNotificationPreference(e){let t=this.parseSource(e),i=v.getConfiguration("notification");return{broder:i.get("border",!0),focusable:i.get("focusable",!0),marginRight:i.get("ma
`)[0],a=kh(e.severity).slice(0,1).toUpperCase();return{bufnr:n,lnum:i.line+1,end_lnum:r.line+1,col:Array.isArray(t)?et((l=t[i.line])!=null?l:"",i.character)+1:i.character+1,end_col:Array.isArray(t)?et((u=t[r.line])!=null?u:"",r.character)+1:r.character+1,text:`[${o}${e.code?" "+e.code:""}] ${s} [${a}]`,type:a}}function wx(n,e){if((n.severity||1)!=(e.severity||1))return(n.severity||1)-(e.severity||1);let t=xe(n.range.start,e.range.start);return t!=0?t:n.source>e.source?1:-1}function See(n){let e=n.tags||[];if(e.includes(At.DiagnosticTag.Deprecated))return"CocDeprecatedHighlight";if(e.includes(At.DiagnosticTag.Unnecessary))return"CocUnusedHighlight";switch(n.severity){case At.DiagnosticSeverity.Warning:return"CocWarningHighlight";case At.DiagnosticSeverity.Information:return"CocInfoHighlight";case At.DiagnosticSeverity.Hint:return"CocHintHighlight";default:return"CocErrorHighlight"}}var At,NP=P(()=>{"use strict";At=S(q());bt();Fe()});var _ee,xx,Ake,Tee,kee,Dee,Eee,HP,Pee=P(()=>{"use strict";_ee=S(_i()),xx=S(q());he();Ht();bt();Q();NP();Ake=Y()("diagnostic-buffer"),Tee="CocDiagnostic",kee="diagnostic",Dee=["CocErrorHighlight","CocWarningHighlight","CocInfoHighlight","CocHintHighlight","CocDeprecatedHighlight","CocUnusedHighlight"],Eee=global.hasOwnProperty("__TEST__")?"MockAleResults":"ale#other_source#ShowResults",HP=class{constructor(e,t,i,r){this.nvim=e;this.doc=t;this.config=i;this.onRefresh=r;this.diagnosticsMap=new Map;this._disposed=!1;this._dirty=!1;this._changeTs=0;this._textChangeTs=0;this._changedTick=0;let o=global.hasOwnProperty("__TEST__")?10:500;this.refreshHighlights=(0,_ee.debounce)(this._refresh.bind(this),o)}get dirty(){return this._dirty}get bufnr(){return this.doc.bufnr}get uri(){return this.doc.uri}onChange(e){this._changeTs=Date.now(),this.refreshHighlights.clear(),e.contentChanges.length===0&&this._refresh()}onTextChange(){this._textChangeTs=Date.now()}get displayByAle(){return this.config.displayByAle}clearHighlight(e){this.buffer.clearNamespace(kee+e)}clearSigns(e){this.buffer.unplaceSign({group:Tee+e})}get diagnostics(){let e=[];for(let t of this.diagnosticsMap.values())e.push(...t);return e}get buffer(){return this.nvim.createBuffer(this.bufnr)}refreshAle(e,t){let i=t.map(r=>{let o=r.range;return{text:r.message,code:r.code,lnum:o.start.line+1,col:o.start.character+1,end_lnum:o.end.line+1,end_col:o.end.character,type:xee(r.severity)}});this.nvim.call(Eee,[this.bufnr,"coc"+e,i],!0)}async update(e,t){let{diagnosticsMap:i}=this,r=i.get(e)||[];if(this.dirty===!1&&t.length==0&&r.length==0||(i.set(e,t),this._dirty===!1&&this.doc.changedtick==this._changedTick&&_e(r,t)))return;let o=await this.getDiagnosticInfo();if(!o||o.winid==-1){this._dirty=!0;return}if(this._textChangeTs>this._changeTs){this._dirty=!0,this.refreshHighlights();return}if(this._dirty)this.refresh(this.diagnosticsMap,o);else{let s=new Map;s.set(e,t),this.refresh(s,o)}}async reset(e,t){let{diagnosticsMap:i}=this;for(let o of i.keys())e[o]==null&&(e[o]=[]);for(let[o,s]of Object.entries(e))this.diagnosticsMap.set(o,s);let r=await this.getDiagnosticInfo(t);if(!r){this._dirty=!0;return}this.refresh(this.diagnosticsMap,r)}async getDiagnosticInfo(e){let{refreshOnInsertMode:t}=this.config,{nvim:i,bufnr:r}=this,o=!t;if(e)o=!1;else if(_.insertMode&&!t)return;return await i.call("coc#util#diagnostic_info",[r,o])}refresh(e,t){let{nvim:i,displayByAle:r}=this;if(this._dirty=!1,this._changedTick=this.doc.changedtick,r){i.pauseNotification();for(let[o,s]of e.entries())this.refreshAle(o,s);i.resumeNotification(!0,!0)}else{let o=[];Ake.debug("Update UI",this.bufnr,Array.from(e.keys())),i.pauseNotification();for(let[s,a]of e.entries())a.length==0&&o.push(s),this.addSigns(s,a),this.updateHighlights(s,a);this.showVirtualText(t.lnum,t.bufnr),this.updateLocationList(t.winid,t.locationlist),this.setDiagnosticInfo(),i.resumeNotification(!0,!0),o.forEach(s=>{this.diagnosticsMap.delete(s)}),this.onRefresh(this.diagnostics)}}updateLocationList(e,t){if(!this.config.locationlistUpdate||e==-1||t!=="Diagnostics of coc")return;let i=this.toLocationListItems(this.diagn
`)||!Ct(r))));if(Ct(r)&&o.length>0&&(o=o.slice(0,1)),o.length==0)ep.debug("no affected ranges"),this.ranges.forEach(s=>{s.adjustFromEdit({range:r,newText:i})}),this.doHighlights();else if(o.length==1&&Pi(r,o[0].range)){if(ep.debug("affected single range"),i.includes(`
`)){this.cancel();return}await this.applySingleEdit(o[0],{range:r,newText:i})}else if(!i.length||!this.validChange(r,i)){ep.debug("filter affected ranges.");let s=this.ranges.filter(a=>!o.includes(a));s.length>0?(this.ranges=s,s.forEach(a=>{a.adjustFromEdit({range:r,newText:i})}),this.doHighlights()):this.cancel()}else{ep.debug("Check undo & redo");let s=this.ranges[0],a=this.ranges[this.ranges.length-1],l=e.originalLines.slice(s.line,a.line+1),u=this.doc.textDocument.lines.slice(s.line,a.line+1);this.applyComposedEdit(l,u)}}validChange(e,t){if(Qs(hs.TextEdit.replace(e,t))!=0||!Pi(e,this.range))return!1;let i=this.ranges[0],r=this.ranges[this.ranges.length-1];return!(e.start.line!=i.position.line||e.end.line!=r.position.line)}get range(){let e=this.ranges[0],t=this.ranges[this.ranges.length-1];return hs.Range.create(e.position,t.range.end)}doHighlights(){let{nvim:e,ranges:t,doc:i}=this,r=i.buffer,o=[];t.forEach(s=>{i.addHighlights(o,"CocCursorRange",s.range,{combine:!1,start_incl:!0,end_incl:!0})}),o.sort((s,a)=>s.lnum!=a.lnum?s.lnum-a.lnum:s.colStart!=a.colStart?s.colStart-a.colStart:0),r.updateHighlights("cursors",o,{priority:4096}),e.redrawVim()}get currentRanges(){return this.ranges.map(e=>e.range)}cancel(){if(!this.activated)return;ep.debug("cursors cancel");let{nvim:e,doc:t}=this,i=t.buffer;this.activated=!1,this.ranges=[],e.pauseNotification(),i.clearNamespace("cursors"),i.setVar("coc_cursors_activated",0,!0),e.resumeNotification(!0,!0),this._onDidUpdate.fire(),this._onDidCancel.fire()}dispose(){!this.doc||(this._onDidCancel.dispose(),this._onDidUpdate.dispose(),J(this.disposables),this.ranges=[],this.doc=null)}async applySingleEdit(e,t){let{doc:i,ranges:r}=this;r.filter(u=>u!==e&&u.position.line==e.position.line).forEach(u=>u.adjustFromEdit(t));let s=Dx(e,t.range,t.newText),a=Qf(s);r.forEach(u=>u.applyChange(s));let l=r.filter(u=>u!==e).map(u=>u.textEdit);if(this.changing=!0,await i.applyEdits(l,!0,!0),this.changing=!1,a!=0)for(let u of r){let c=Vf(u,this.ranges,e);u.move(c*a)}this.doHighlights()}applyComposedEdit(e,t){var y,w,x;let i=(0,_h.default)(e[0],t[0]),r=this.ranges[0],o=r.position.character,s=r.position.line,a=r.text.length,l=i[0];if(o>0&&(l[0]!=_h.default.EQUAL||!l[1].startsWith(e[0].slice(0,o))))return this.cancel(),!1;let u=0,c=!1,h=[];for(let k=0;k<i.length;k++){let[L,j]=i[k];if(k==0&&o>0&&(j=j.slice(o)),L==_h.default.EQUAL){if(u+=j.length,u>a)break}else if(L==_h.default.DELETE){let O=u;if(u+=j.length,u>a){c=!0;break}h.push({offset:O,remove:j})}else{let O=i[k-1];O&&O[0]==_h.default.DELETE?h[h.length-1].add=j:h.push({offset:u,add:j})}}if(c||!h.length)return this.cancel(),!1;let d=Fn.create("file:///1","",0,e.join(`
`)),g;if(h.length==1)g={offset:h[0].offset,remove:h[0].remove?h[0].remove.length:0,insert:(y=h[0].add)!=null?y:""};else if(Bke(h,a))g={prepend:[h[0].remove?h[0].remove.length:0,(w=h[0].add)!=null?w:""],append:[h[1].remove?h[1].remove.length:0,(x=h[1].add)!=null?x:""]};else{let k=r.text,L="",j="",O=h[0].offset;for(let W of h){if(W.offset>O+L.length){let H=k.slice(O+L.length,W.offset);L+=H,j+=H}W.add&&(j+=W.add),W.remove&&(L+=W.remove)}g={offset:O,remove:L.length,insert:j}}let f=this.ranges.map(k=>{let L=k.position.line-s,{start:j,end:O}=k.range,W=hs.Range.create(L,j.character,L,O.character);return k.applyChange(g),hs.TextEdit.replace(W,k.text)});if(Fn.applyEdits(d,f)!==t.join(`
`))return this.cancel(),!1;let b=Qf(g);if(b!=0)for(let k of this.ranges){let L=Vf(k,this.ranges);k.move(L*b)}return this.doHighlights(),!0}};function Bke(n,e){return!(n.length!=2||n[0].offset!=0||n[1].offset+(n[1].remove?n[1].remove.length:0)!==e)}var att=Y()("cursors"),_x=class{constructor(e){this.nvim=e;this.sessionsMap=new Map;this.disposables=[];v.onDidCloseTextDocument(t=>{let i=this.getSession(t.bufnr);!i||(this.sessionsMap.delete(t.bufnr),i.cancel())},null,this.disposables)}cancel(e){let t=v.getDocument(e);if(!t)return;let i=this.getSession(t.bufnr);i&&i.cancel()}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 r=v.getAttachedDocument(e),{nvim:o}=this,s=this.createSession(r),a=await D.getCursorPosition(),l;if(t=="operator"){await o.command(`normal! ${i=="line"?"'[":"`["}`);let u=await D.getCursorPosition();await o.command(`normal! ${i=="line"?"']":"`]"}`);let c=await D.getCursorPosition();await D.moveTo(a);let h=xe(u,c);if(h==0)return;h>=0&&([u,c]=[c,u]);let d=r.getline(c.line);c.character<d.length&&(c.character=c.character+1);let g=WP(r,Ph.Range.create(u,c));s.addRanges(g)}else if(t=="word"){if(l=r.getWordRangeAtPosition(a),!l){let u=r.getline(a.line);a.character==u.length?l=Ph.Range.create(a.line,Math.max(0,u.length-1),a.line,u.length):l=Ph.Range.create(a.line,a.character,a.line,a.character+1)}s.addRange(l),await o.command(`silent! call repeat#set("\\<Plug>(coc-cursors-${t})", -1)`)}else if(t=="position"){let u=r.getline(a.line);a.character>=u.length?l=Ph.Range.create(a.line,u.length-1,a.line,u.length):l=Ph.Range.create(a.line,a.character,a.line,a.character+1),s.addRange(l),await o.command(`silent! call repeat#set("\\<Plug>(coc-cursors-${t})", -1)`)}else if(t=="range"){await o.call("eval",'feedkeys("\\<esc>", "in")');let u=await D.getSelectedRange(i);if(!u)return;let c=i==""?Jee(r,u):WP(r,u);for(let h of c)s.addRange(h)}else throw new Error(`select kind "${t}" not supported`)}createSession(e){let{bufnr:t}=e,i=this.getSession(t);return i||(i=new Ex(this.nvim,e),this.sessionsMap.set(t,i),i.onDidCancel(()=>{i.dispose(),this.sessionsMap.delete(t)}),i)}async addRanges(e){let{nvim:t}=this,i=await t.call("bufnr",["%"]),r=v.getAttachedDocument(i);return this.createSession(r).addRanges(e)}reset(){for(let e of this.sessionsMap.values())e.cancel();this.sessionsMap.clear()}};Ul();he();go();var aC=S(q());he();Se();z();De();Q();var Rh=S(q());xi();Ul();Se();De();Q();var ptt=Y()("handler-codeActions"),Px=class{constructor(e,t){this.nvim=e;this.handler=t;t.addDisposable(re.registerCommand("editor.action.organizeImport",async i=>{await this.organizeImport(i)})),re.titles.set("editor.action.organizeImport","run organize import code action.")}async codeActionRange(e,t,i){let{doc:r}=await this.handler.getCurrentState();await r.synchronize();let o=r.getline(t-1),s=Rh.Range.create(e-1,0,t-1,o.length),a=await this.getCodeActions(r,s,i?[i]:null);if(a=a.filter(c=>!c.disabled),!a||a.length==0){D.showMessage(`No${i?" "+i:""} code action available`,"warning");return}let l=await D.showMenuPicker(a.map(c=>c.title),"Choose action"),u=a[l];u&&await this.applyCodeAction(u)}async organizeImport(e){let{doc:t}=await this.handler.getCurrentState();if(e&&t.bufnr!=e)return;await t.synchronize();let i=await this.getCodeActions(t,void 0,[Rh.CodeActionKind.SourceOrganizeImports]);if(i&&i.length){await this.applyCodeAction(i[0]);return}throw new Error("Organize import action not found.")}async getCodeActions(e,t,i){t=t||Rh.Range.create(0,0,e.lineCount,0);let o={diagnostics:Pt.getDiagnosticsInRange(e.textDocument,t)};i&&Array.isArray(i)&&(o.only=i);let s=await this.handler.withRequestToken("code action",a=>F.getCodeActions(e.textDocument,t,o,a));return!s||s.length==0?[]:(s.sort((a,l)=>a.isPreferred&&!l.isPreferred?-1:l.isPreferred&&!a.isPreferred||a.disabled&&!l.disabled?1:l.disabled&&!a.disabled?-1:0),s)}get floatActions(){return v.floatSupported?v.getConfiguration("coc.preferences").get("floatActions",!0):!1}async doCodeAction(e,t){let
`,e),i){let r=await t.call("line",".")-1,o=v.getDocument(e);if(!o)return;await o.patchChange();let s=o.getline(r-1),a=o.getline(r),l=s[s.length-1];if(l&&Qee.has(l)){let u=a.trim()[0];if(u&&Qee.get(l)==u){let c=[],h=await v.getFormatOptions(o.uri),d=h.insertSpaces?" ".repeat(h.tabSize):" ",g=a.match(/^\s*/)[0],f=ds.Position.create(r-1,s.length);if(o.filetype=="vim"){let p=`
`+g+d;c.push({range:ds.Range.create(r,g.length,r,g.length),newText:" \\ "}),p=p+"\\ ",c.push({range:ds.Range.create(f,f),newText:p}),await o.applyEdits(c),await D.moveTo(ds.Position.create(r,p.length-1))}else await t.eval(`feedkeys("\\<Esc>O", 'in')`)}}}}async documentRangeFormat(e,t){this.handler.checkProvier("formatRange",e.textDocument),await e.synchronize();let i;if(t){if(i=await D.getSelectedRange(t),!i)return-1}else{let[s,a,l]=await this.nvim.eval("[v:lnum,v:count,mode()]");if(a==0||l=="i"||l=="R")return-1;i=ds.Range.create(s-1,0,s-1+a,0)}let r=await v.getFormatOptions(e.uri),o=await this.handler.withRequestToken("Format range",s=>F.provideDocumentRangeFormattingEdits(e.textDocument,i,r,s));return o&&o.length>0?(await e.applyEdits(o,!1,!0),0):-1}};var iu=S(q());he();Se();z();Q();var Eit=Y()("documentHighlight"),Ax=class{constructor(e,t){this.nvim=e;this.handler=t;this.disposables=[];this.highlights=new Map;_.on(["CursorMoved","CursorMovedI"],()=>{this.cancel(),this.clearHighlights()},null,this.disposables),this.getConfiguration(),v.onDidChangeConfiguration(this.getConfiguration,this,this.disposables)}getConfiguration(e){let t=v.getConfiguration("documentHighlight");(!e||e.affectsConfiguration("documentHighlight"))&&(this.config=Object.assign(this.config||{},{priority:t.get("priority",-1),timeout:t.get("timeout",300)}))}isEnabled(e,t){let i=v.getDocument(e);return!(!i||!i.attached||t||!F.hasProvider("documentHighlight",i.textDocument))}clearHighlights(){if(this.highlights.size!=0){for(let e of this.highlights.keys())this.nvim.createWindow(e).clearMatchGroup("^CocHighlight");this.highlights.clear()}}async highlight(){let{nvim:e}=this;this.cancel();let[t,i,r,o]=await e.eval(`[bufnr("%"),win_getid(),coc#cursor#position(),get(b:,'coc_cursors_activated',0)]`);if(!this.isEnabled(t,o))return;let s=v.getDocument(t),a=await this.getHighlights(s,iu.Position.create(r[0],r[1]));if(!a)return;let l={};for(let c of a){if(!c.range)continue;let h=c.kind==iu.DocumentHighlightKind.Text?"CocHighlightText":c.kind==iu.DocumentHighlightKind.Read?"CocHighlightRead":"CocHighlightWrite";l[h]=l[h]||[],l[h].push(c.range)}let u=e.createWindow(i);e.pauseNotification(),u.clearMatchGroup("^CocHighlight");for(let c of Object.keys(l))u.highlightRanges(c,l[c],this.config.priority,!0);e.resumeNotification(!0,!0),this.highlights.set(i,a)}async getSymbolsRanges(){let{doc:e,position:t}=await this.handler.getCurrentState();this.handler.checkProvier("documentHighlight",e.textDocument);let i=await this.getHighlights(e,t);return i?i.map(r=>r.range):null}hasHighlights(e){return this.highlights.get(e)!=null}async getHighlights(e,t){let r=e.getline(t.line)[t.character];if(!r||!e.isWord(r))return null;await e.synchronize(),this.cancel();let o=this.tokenSource=new iu.CancellationTokenSource,s=this.timer=setTimeout(()=>{o.token.isCancellationRequested||o.cancel()},this.config.timeout),a=await F.getDocumentHighLight(e.textDocument,t,o.token);return clearTimeout(s),o.token.isCancellationRequested?null:a}cancel(){this.tokenSource&&(this.tokenSource.cancel(),this.tokenSource.dispose(),this.tokenSource=null)}dispose(){this.timer&&clearTimeout(this.timer),this.cancel(),this.highlights.clear(),J(this.disposables)}};var Vee=S(require("fs")),gs=S(q());we();Se();Bo();z();Xe();Q();var Ait=Y()("handler-hover"),Nx=class{constructor(e,t){this.nvim=e;this.handler=t;this.disposables=[];this.documentLines=[];this.hasProvider=!1;this.excludeImages=!0;this.loadConfiguration(),v.onDidChangeConfiguration(this.loadConfiguration,this,this.disposables),this.hoverFactory=new li(e),this.disposables.push(this.hoverFactory)}registerProvider(){if(this.hasProvider)return;this.hasProvider=!0;let{nvim:e}=this,t={onDidChange:null,provideTextDocumentContent:async()=>(e.pauseNotification(),e.command("setlocal conceallevel=2 nospell nofoldenable wrap",!0),e.command("setlocal bufhidden=wipe nobuflisted",!0),e.command("setfiletype markdown",!0),e.command(`if winnr('j') != winnr('k') | exe "normal! z${Math.min(this.documentLines.length,this.config.previewMaxHeight)}\\<cr> | endif"`,!0),await e.resume
`))};this.disposables.push(v.registerTextDocumentContentProvider("coc",t))}loadConfiguration(e){if(!e||e.affectsConfiguration("hover")){let t=v.getConfiguration("hover"),i=t.get("target","float");this.config={floatConfig:t.get("floatConfig",{}),autoHide:t.get("autoHide",!0),target:i=="float"&&!v.floatSupported?"preview":i,previewMaxHeight:t.get("previewMaxHeight",12)},this.config.target=="preview"&&this.registerProvider();let r=v.getConfiguration("coc.preferences");this.excludeImages=r.get("excludeImageLinksInMarkdownDocument",!0)}}async onHover(e){let{doc:t,position:i,winid:r}=await this.handler.getCurrentState();e=="preview"&&this.registerProvider(),this.handler.checkProvier("hover",t.textDocument),await t.synchronize();let o=await this.handler.withRequestToken("hover",a=>F.getHover(t.textDocument,i,a),!0);if(o==null||!o.length)return!1;let s=o.find(a=>gs.Range.is(a.range));if(s!=null&&s.range){let a=this.nvim.createWindow(r);a.highlightRanges("CocHoverRange",[s.range],99,!0),this.timer=setTimeout(()=>{a.clearMatchGroup("CocHoverRange"),this.nvim.redrawVim()},500)}return await this.previewHover(o,e),!0}async definitionHover(e){let{doc:t,position:i}=await this.handler.getCurrentState();e=="preview"&&this.registerProvider(),this.handler.checkProvier("hover",t.textDocument),await t.synchronize();let r=await this.handler.withRequestToken("hover",s=>F.getHover(t.textDocument,i,s),!0);if(!(r!=null&&r.length))return!1;let o=await this.handler.withRequestToken("definitionHover",s=>F.getDefinitionLinks(t.textDocument,i,s),!1);if(o!=null&&o.length)for(let s of o){if(!s.targetRange)continue;let{start:a,end:l}=s.targetRange,u=l.line-a.line>=100?a.line+100:l.character==0?l.line-1:l.line,c=await $ke(s.targetUri,a.line,u);if(c.length){let h=c[0].match(/^\s*/)[0];h&&(c=c.map(d=>d.startsWith(h)?d.substring(h.length):d)),r.push({content:c.join(`
`),filetype:t.filetype})}}return await this.previewHover(r,e),!0}async previewHover(e,t){let i=[];t=t||this.config.target;let r=t==="preview";for(let s of e){if(Jke(s)){i.push(s);continue}let{contents:a}=s;if(Array.isArray(a))for(let l of a)typeof l=="string"?ip(i,l,"markdown",r):ip(i,l.value,l.language,r);else gs.MarkedString.is(a)?typeof a=="string"?ip(i,a,"markdown",r):ip(i,a.value,a.language,r):gs.MarkupContent.is(a)&&ip(i,a.value,eg(a)?"markdown":"txt",r)}if(t=="float"){let s=this.hoverFactory.applyFloatConfig({modes:["n"],autoHide:this.config.autoHide,excludeImages:this.excludeImages,maxWidth:80},this.config.floatConfig);await this.hoverFactory.show(i,s);return}let o=i.reduce((s,a)=>{let l=a.content.split(/\r?\n/);return s.length>0&&s.push(""),s.push(...l),s},[]);if(t=="echo"){let s=o.join(`
`).trim();await this.nvim.call("coc#ui#echo_hover",[s])}else this.documentLines=o,await this.nvim.command("noswapfile pedit coc://document")}async getHover(){let e=[],{doc:t,position:i}=await this.handler.getCurrentState();this.handler.checkProvier("hover",t.textDocument),await t.synchronize();let r=new gs.CancellationTokenSource,o=await F.getHover(t.textDocument,i,r.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)}):gs.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}dispose(){this.timer&&clearTimeout(this.timer),J(this.disposables)}};function ip(n,e,t,i=!1){let r=e.trim();!r.length||(i&&t!=="markdown"&&(r="``` "+t+`
`+r+"\n```"),n.push({content:r,filetype:t}))}function Jke(n){return n?typeof n.filetype=="string"&&typeof n.content=="string":!1}async function $ke(n,e,t){let i=v.getDocument(n);if(i)return i.getLines(e,t+1);let r=M.parse(n).fsPath;return Vee.default.existsSync(r)?await Ks(r,e,t):[]}var nu=S(q());he();Se();Bo();z();bt();De();Q();var Xit=Y()("handler-links"),Xke=/CocAction(Async)?\(["']openLink["']\)/,Hx=class{constructor(e,t){this.nvim=e;this.handler=t;this.disposables=[];this.setConfiguration(),v.onDidChangeConfiguration(this.setConfiguration,this,this.disposables),this.floatFactory=new li(e),_.on("CursorHold",async()=>{!this._tooltip||!e.hasFunction("nvim_get_keymap")||await this.showTooltip()},null,this.disposables),_.on(["CursorMoved","InsertEnter"],()=>{this.cancel()},null,this.disposables)}setConfiguration(e){if(!e||e.affectsConfiguration("links")){let t=v.getConfiguration("links");this._tooltip=t.get("tooltip",!1)}}async showTooltip(){let{nvim:e,floatFactory:t}=this,r=(await e.getKeymap("n")).find(u=>Xke.test(u.rhs)),o=r?r.lhs:void 0,s=await this.getCurrentLink();if(!s||!s.target)return;let a="";if(s.tooltip&&(a=s.tooltip+" "),o&&(a+=`Press "${o}" to open link`),!a.length)return;let l={content:a,filetype:"txt"};await t.show([l],{autoHide:!0})}async getLinks(){try{let{doc:e}=await this.handler.getCurrentState();if(!F.hasProvider("documentLink",e.textDocument))return[];let t=this.tokenSource=new nu.CancellationTokenSource,i=await F.getDocumentLinks(e.textDocument,t.token);return t.token.isCancellationRequested?[]:i}catch{return[]}}async openLink(e){if(!e.target)throw new Error("Failed to resolve link target");await v.openResource(e.target)}async getCurrentLink(){let e=await this.getLinks(),t=await D.getCursorPosition();if(e&&e.length){for(let a of e)if(ct(t,a.range)==0){if(!a.target){let l=this.tokenSource=this.tokenSource||new nu.CancellationTokenSource;if(a=await F.resolveDocumentLink(a,this.tokenSource.token),!a.target||l.token.isCancellationRequested)continue}return a}}let i=await this.nvim.call("getline",["."]),r=/\w+?:\/\/[^)\]'" ]+/g,o,s;for(;(o=r.exec(i))!==null;){let a=o.index;if(a<=t.character&&a+o[0].length>=t.character){s=nu.DocumentLink.create(nu.Range.create(t.line,a,t.line,a+o[0].length),o[0]);break}}return s}async openCurrentLink(){let e=await this.getCurrentLink();return e?(await this.openLink(e),!0):!1}cancel(){this.tokenSource&&(this.tokenSource.cancel(),this.tokenSource=null)}dispose(){var e;(e=this.floatFactory)==null||e.dispose(),J(this.disposables)}};var qr=S(q());we();Se();Of();Q();var int=Y()("handler-hover"),qx=class{constructor(e,t){this.nvim=e;this.handler=t}async request(e,t){let{doc:i,position:r}=await this.handler.getCurrentState();return this.handler.checkProvier(e,i.textDocument),await i.synchronize(),await this.handler.withRequestToken(e,o=>t(i.textDocument,r,o),!0)}async definitions(){let{doc:e,position:t}=await this.handler.getCurrentState();this.handler.checkProvier("definition",e.textDocument),await e.synchronize();let i=new qr.CancellationTokenSource;return F.getDefinition(e.textDocument,t,i.token)}async declarations(){let{doc:e,position:t}=await this.handler.getCurrentState();this.handler.checkProvier("declaration",e.textDocument),await e.synchronize();let i=new qr.CancellationTokenSource;return F.getDeclaration(e.textDocument,t,i.token)}async typeDefinitions(){let{doc:e,position:t}=await this.handler.getCurrentState();this.handler.checkProvier("typeDefinition",e.textDocument),await e.synchronize();let i=new qr.CancellationTokenSource;return F.getTypeDefinition(e.textDocument,t,i.token)}async implementations(){let{doc:e,position:t}=await this.handler.getCurrentState();this.handler.checkProvier("implementation",e.textDocument),await e.synchronize();let i=new qr.CancellationTokenSource;return F.getImplementation(e.textDocument,t,i.token)}async references(e){let{doc:t,position:i}=await this.handler.getCurrentState();this.handler.checkProvier("reference",t.textDocument),await t.synchronize();let r=new qr.CancellationTokenSource;return F.getReferences(t.textDocument,{includeDeclar
`)))}else{l.push(u);let f=this.getDeleteRange(c);a.push(Ue.TextEdit.replace(f,""))}}l.length&&(i.ranges=i.ranges.filter((u,c)=>!l.includes(c))),this._fileItems=this._fileItems.filter(u=>u.ranges&&u.ranges.length>0),a.length&&(this.adjustLnums(a),this.changing=!0,await this.document.applyEdits(a),this.changing=!1),this.nvim.pauseNotification(),this.highlightLineNr(),this.buffer.setOption("modified",!1,!0),await this.nvim.resumeNotification(!0)}adjustLnums(e){for(let t of this._fileItems)for(let i of t.ranges){let r=i.lnum-1;i.lnum+=OD(Ue.Position.create(r,0),e)}}async getFileChanges(){let e=[],t=await this.buffer.lines;t.push(Br);let i=[],r,o;for(let s=0;s<t.length;s++){let a=t[s];if(a.startsWith(Br)){if(r&&(e.push({filepath:r,lines:i.slice(),lnum:o}),r=void 0,i=[]),a.length>1){let l=a.match(/^\u3000(.*)/);l&&(r=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,o=(await e.eval("strpart(getline('.'), 0 ,col('.') - 1)")).length,s=await this.searchCurrentRange();if(s){let a=this.getAbsolutePath(s.filepath);e.pauseNotification(),i?(e.call("win_gotoid",[this.opts.fromWinid],!0),this.nvim.call("coc#util#jump",["edit",a,[s.line,o]],!0)):this.nvim.call("coc#util#jump",["belowright vs",a,[s.line,o]],!0),e.command("normal! zz",!0),await e.resumeNotification(!0),i||(this.opts.fromWinid=await e.call("win_getid"))}}async searchCurrentRange(){let{nvim:e}=this,t=await e.eval('getline(1,line("."))'),i=t.length;for(let r=0;r<i;r++)if(t[i-r-1].match(/^\u3000(.+)/)){let a=this.getFileRange(i-r);return Object.assign({line:a.start+(r==0?1:r)-1},a)}}async addFileItems(e){if(this._disposed)return;let{cwd:t}=this.opts,{document:i}=this,r=await this.mutex.acquire();try{await i.synchronize();let o=i.lineCount,s=new vn,a=[];for(let c of e){let h=[];for(let d of c.ranges){s.addLine(Br),s.addLine(Br);let g=o+s.length;s.addText(`${Ae(t,c.filepath)?np.default.relative(t,c.filepath):c.filepath}`);let f=String(d.start+1).length+String(d.end).length+4;this.srcId||s.addText(" ".repeat(f));let p=0-s.length-o;d.highlights&&a.push(...d.highlights.map(k=>Gke(k,p)));let{lines:b,start:y,end:w,highlights:x}=d;b||(b=await this.getLines(c.filepath,y,w)),h.push({lines:b,lnum:g,start:y,highlights:x}),s.addLines(b)}if(h.length){let d={filepath:c.filepath,ranges:h},g=this._fileItems.find(f=>f.filepath==c.filepath);g?g.ranges.push(...d.ranges):this._fileItems.push(d)}}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 c=a[0].start;l.call("coc#cursor#move_to",[c.line,c.character],!0)}await l.resumeNotification(!0),await i.patchChange(),this.changing=!1,await D.cursors.addRanges(a)}catch(o){this.changing=!1,Uke.error("Error on add file item:",o)}r()}findRange(e,t){let r=this.fileItems.find(o=>ei(this.getAbsolutePath(o.filepath),e)).ranges.find(o=>o.lnum==t);if(!r)throw new Error(`File range not found at lnum: ${t}`);return r}async save(){let{nvim:e}=this,t=this.document,{buffer:i}=t;await t.patchChange();let r=await this.getFileChanges();if(!r)return;r.sort((a,l)=>a.lnum-l.lnum);let o=[];for(let a=0;a<r.length;a++){let l=r[a],u=this.findRange(l.filepath,l.lnum);_e(u.lines,l.lines)||(o.push(Object.assign({start:u.start,end:u.start+u.lines.length},l)),u.lines=l.lines)}if(o.length==0)return await D.showInformationMessage("No change."),await i.setOption("modified",!1),!1;let s={};for(let a of o){let l=M.file(a.filepath).toString(),u=s[l]||[];u.push({range:Ue.Range.create(a.start,0,a.end,0),newText:a.lines.join(`
`)+`
`}),s[l]=u}this.changing=!0,await v.applyEdit({changes:s}),this.changing=!1;for(let a of this.fileItems){let l=M.file(this.getAbsolutePath(a.filepath)).toString(),u=s[l];u&&u.length>0&&a.ranges.forEach(c=>{c.start+=OD(Ue.Position.create(c.start,0),u)})}return e.pauseNotification(),i.setOption("modified",!1,!0),this.config.saveToFile&&e.command("silent noa wa",!0),this.highlightLineNr(),await e.resumeNotification(),!0}async getLines(e,t,i){let r=M.file(e).toString(),o=v.getDocument(r);return o?o.getLines(t,i):await Ks(e,t,i-1)}getAbsolutePath(e){return np.default.isAbsolute(e)?e:np.default.join(this.opts.cwd,e)}highlightLineNr(){let{fileItems:e,nvim:t,srcId:i,bufnr:r}=this,{winid:o,cwd:s}=this.opts,a={};if(i){t.call("nvim_buf_clear_namespace",[r,i,0,-1],!0);for(let l of e)for(let u of l.ranges){let c=u.start+u.lines.length,h=`${u.start+1}:${c}`;a[u.lnum]=[u.start+1,c],t.call("nvim_buf_set_virtual_text",[r,i,u.lnum-1,[[h,"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?np.default.relative(s,u.filepath):u.filepath}`,h=V(c)+1;for(let d of u.ranges){let g=d.start+d.lines.length,f=`:${d.start+1}:${g}`;for(let p=0;p<f.length;p++){let b=f[p];this.matchIds.add(l),a[d.lnum]=[d.start+1,g],t.call("matchaddpos",["Conceal",[[d.lnum,h+p]],99,l,{conceal:b,window:o}],!0),l++}}}}this.buffer.setVar("line_infos",a,!0)}getDeleteRange(e){let{document:t}=this,i=e.lnum-1,r,o=t.lineCount;for(let s=i;s<o;s++){if(s+1==o){r=Ue.Position.create(o,0);break}let a=t.getline(s);if(a===Br){r=Ue.Position.create(s+1,0);break}if(s!=i&&a.startsWith(Br)){r=Ue.Position.create(s,0);break}}return Ue.Range.create(Ue.Position.create(i,0),r)}getReplaceRange(e){let{document:t}=this,i=e.lnum,r,o=t.lineCount;for(let s=i;s<o;s++){let a=t.getline(s);if(s+1==o){r=Ue.Position.create(s,a.length);break}if(t.getline(s+1).startsWith("\u3000")){r=Ue.Position.create(s,a.length);break}}return Ue.Range.create(Ue.Position.create(i,0),r)}get valid(){return this.buffer.valid}get buffer(){return this.nvim.createBuffer(this.bufnr)}get document(){return v.getDocument(this.bufnr)}dispose(){this._disposed=!0,J(this.disposables)}};function Gke(n,e){let{start:t,end:i}=n;return Ue.Range.create(t.line-e,t.character,i.line-e,i.character)}function Kke(n){let{contentChanges:e,bufnr:t,textDocument:i,original:r,originalLines:o}=n,{range:s,text:a}=e[0],l=[{range:s,text:a}];if(r){let u=r.split(/\r?\n/),c=u[u.length-1];if(c.startsWith(Br)){let g=o[s.start.line].slice(0,s.start.character);if(g==c){r=g+u.slice(0,-1).join(`
`)+`
`;let{start:f,end:p}=s;l[0].range=Ue.Range.create(f.line,0,p.line,0)}}let h=o[s.start.line-1],d=u.length>1?u[u.length-2]:"";if(c==""&&d.startsWith(Br)&&h==d&&s.start.character==0&&s.end.character==0){r=h+`
`+u.slice(0,-2).join(`
`)+`
`;let{start:g,end:f}=s;l[0].range=Ue.Range.create(g.line-1,0,f.line-1,0)}}else if(Ct(s)&&s.start.character!=0){let u=a.split(/\r?\n/),c=u[u.length-1],h=o[s.start.line].slice(0,s.start.character);if(c.startsWith(Br)&&h==c){l[0].text=h+u.slice(0,-1).join(`
`)+`
`;let{start:d,end:g}=s;l[0].range=Ue.Range.create(d.line,0,g.line,0)}}return{contentChanges:l,bufnr:t,textDocument:i,original:r,originalLines:o}}var ete=require("child_process"),tte=require("events"),UP=S(require("path")),ite=S(require("readline"));No();Bl();gc();Qr();De();var zke=Y()("handler-search"),Qke=["--color","ansi","--colors","path:fg:black","--colors","line:fg:green","--colors","match:fg:red","--no-messages","--heading","-n"],Vke="\x1B",nte=class extends tte.EventEmitter{start(e,t,i){this.process=(0,ete.spawn)(e,t,{cwd:i}),this.process.on("error",c=>{this.emit("error",c.message)});let r=ite.default.createInterface(this.process.stdout),o,s,a=[],l=[],u=!0;r.on("line",c=>{if(c.includes(Vke)){let h=sg(c);if(h[0].foreground=="black"){s={filepath:UP.default.join(i,h[0].text),ranges:[]};return}if(h[0].foreground=="green"){let g=parseInt(h[0].text,10)-1,f=h[0].text.length+1;u&&(o=g,u=!1);let p="";for(let y of h){if(y.foreground=="red"){let w=g-o,x=p.length-f;l.push(Me.create(w,x,w,x+y.text.length))}p+=y.text}let b=p.slice(f);a.push(b)}}else{let h=c.trim().length==0;s&&(h||c.trim()=="--")&&s.ranges.push({lines:a,highlights:l,start:o}),h&&(this.emit("item",s),s=null),a=[],l=[],u=!0}}),r.on("close",()=>{s&&(a.length&&s.ranges.push({lines:a,highlights:l,start:o}),this.emit("item",s)),a=l=s=null,this.emit("end")})}dispose(){this.process&&this.process.kill()}},Wx=class{constructor(e,t="rg"){this.nvim=e;this.cmd=t}run(e,t,i){let{nvim:r,cmd:o}=this,{afterContext:s,beforeContext:a}=i.config,l=["-A",s.toString(),"-B",a.toString()].concat(Qke,e),u=eDe(e);u&&l.pop(),l.push("--",u?UP.default.isAbsolute(u)?u:`./${u.replace(/^\.\//,"")}`:"./"),this.task=new nte,this.task.start(o,l,t);let c=new Qt,h=0,d=0,g=Date.now(),f=[],p=async()=>{if(f.length==0)return;let b=f.slice();f=[];let y=await c.acquire();try{await i.addFileItems(b)}catch(w){zke.error(w)}y()};return new Promise((b,y)=>{let w=setInterval(p,300);this.task.on("item",async x=>{h++,d=d+x.ranges.reduce((k,L)=>k+L.highlights.length,0),f.push(x)}),this.task.on("error",x=>{clearInterval(w),D.showMessage(`Error on command "${o}": ${x}`,"error"),this.task=null,y(new Error(x))}),this.task.on("end",async()=>{clearInterval(w);try{await p(),(await c.acquire())(),this.task.removeAllListeners(),this.task=null;let k=i.buffer;if(k){if(r.pauseNotification(),h==0)k.setLines(["No match found"],{start:1,end:2,strictIndexing:!1},!0),k.addHighlight({line:1,srcId:-1,colEnd:-1,colStart:0,hlGroup:"Error"}),k.setOption("modified",!1,!0);else{let L=new vn;L.addText("Files","MoreMsg"),L.addText(": "),L.addText(`${h} `,"Number"),L.addText("Matches","MoreMsg"),L.addText(": "),L.addText(`${d} `,"Number"),L.addText("Duration","MoreMsg"),L.addText(": "),L.addText(`${Date.now()-g}ms`,"Number"),L.render(k,1,2)}k.setOption("modified",!1,!0),r.resumeNotification(!1,!0)}}catch(x){y(x);return}b()})})}abort(){var e;(e=this.task)==null||e.dispose()}};function eDe(n){if(n.length<2)return;let e=n.length;if(!n[e-1].startsWith("-")&&!n[e-2].startsWith("-"))return n[e-1]}var Xnt=Y()("handler-refactor"),tDe="__coc_refactor__",iDe=0,Zx=class{constructor(e,t){this.nvim=e;this.handler=t;this.buffers=new Map;this.disposables=[];this._onCreate=new Ih.Emitter;this.onCreate=this._onCreate.event;this.setConfiguration(),v.onDidChangeConfiguration(this.setConfiguration,this,this.disposables),_.on("BufUnload",i=>{let r=this.buffers.get(i);r&&(r.dispose(),this.buffers.delete(i))},null,this.disposables),v.onDidChangeTextDocument(i=>{let r=this.buffers.get(i.bufnr);r&&r.onChange(i)},null,this.disposables)}async init(){v.isNvim&&this.nvim.hasFunction("nvim_create_namespace")&&(this.srcId=await this.nvim.createNamespace("coc-refactor"))}has(e){return this.buffers.has(e)}setConfiguration(e){if(e&&!e.affectsConfiguration("refactor"))return;let t=v.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),showMenu:t.get("showMenu","<Tab>")})}async doRefactor(){let{doc:e,position
Modifiers: ${s.join(", ")}
Highlight group: ${o.hlGroup||""}`,highlights:a}];await this.floatFactory.show(l,{autoHide:!0,focusable:!0,title:"Semantic token info",borderhighlight:"MoreMsg",border:[1,1,1,1]})}else this.floatFactory.close()}async fetchHighlightGroups(){let e=await this.nvim.call("coc#util#semantic_hlgroups");this.config.highlightGroups=e}async getCurrentItem(){let e=await this.nvim.buffer,t=this.highlighters.getItem(e.id);return t}getItem(e){return this.highlighters.getItem(e)}async highlightCurrent(){let e=await this.getCurrentItem();if(!e||!e.enabled)throw new Error("Unable to perform semantic highlights for current buffer.");await this.fetchHighlightGroups(),await e.forceHighlight()}async showHighlightInfo(){var a;let e=await this.nvim.buffer,{nvim:t}=this,i=this.highlighters.getItem(e.id);if(!i)return t.echoError("Document not attached.");let r=new vn;t.pauseNotification(),t.command(`vs +setl\\ buftype=nofile __coc_semantic_highlights_${e.id}__`,!0),t.command("setl bufhidden=wipe noswapfile nobuflisted wrap undolevels=-1",!0),t.call("bufnr",["%"],!0);let o=await t.resumeNotification();r.addLine("Semantic highlights info",Gx),r.addLine("");try{i.checkState();let l=i.highlights||[];r.addLine("The number of semantic tokens: "),r.addText(String(l.length),"Number"),r.addLine(""),r.addLine("Semantic highlight groups used by current buffer",Gx),r.addLine("");let u=ia(l.filter(d=>d.hlGroup!=null).map(({hlGroup:d})=>d));for(let d of u)r.addTexts([{text:"-",hlGroup:"Comment"},{text:" "},{text:d,hlGroup:d}]);r.addLine(""),r.addLine("Tokens types that current Language Server supported:",Gx),r.addLine("");let c=v.getDocument(i.bufnr),h=(a=F.getLegend(c.textDocument))!=null?a:F.getLegend(c.textDocument,!0);if(h.tokenTypes.length){for(let d of[...new Set(h.tokenTypes)]){let g=Fh+cn(d);r.addTexts([{text:"-",hlGroup:"Comment"},{text:" "},{text:g,hlGroup:g}])}r.addLine("")}else r.addLine("No token types supported","Comment"),r.addLine("");if(r.addLine("Tokens modifiers that current Language Server supported:",Gx),r.addLine(""),h.tokenModifiers.length){for(let d of[...new Set(h.tokenModifiers)]){let g=Fh+cn(d);r.addTexts([{text:"-",hlGroup:"Comment"},{text:" "},{text:g,hlGroup:g}])}r.addLine("")}else r.addLine("No token modifiers exist","Comment"),r.addLine("")}catch(l){r.addLine(l instanceof Error?l.message:l.toString(),"Error")}t.pauseNotification();let s=o[0][2];r.render(t.createBuffer(s)),t.resumeNotification(!0,!0)}dispose(){this.floatFactory.dispose(),this.highlighters.dispose(),J(this.disposables)}};var op=S(q());he();Se();Bo();z();Fe();Q();var yot=Y()("handler-signature"),zx=class{constructor(e,t){this.nvim=e;this.handler=t;this.disposables=[];this.signatureFactory=new li(e),this.loadConfiguration(),this.disposables.push(this.signatureFactory),v.onDidChangeConfiguration(this.loadConfiguration,this,this.disposables),_.on("CursorMovedI",async(i,r)=>{let o=this.lastPosition;!o||o.bufnr==i&&o.lnum==r[0]&&o.col<=r[1]||this.signatureFactory.close()},null,this.disposables),_.on(["InsertLeave","BufEnter"],()=>{var i;(i=this.tokenSource)==null||i.cancel()},null,this.disposables),_.on("TextChangedI",()=>{this.config.hideOnChange&&this.signatureFactory.close()},null,this.disposables),_.on("TextInsert",async(i,r,o)=>{if(!this.config.trigger)return;let s=this.getTextDocument(i);!s||!F.shouldTriggerSignatureHelp(s.textDocument,o)||await this._triggerSignatureHelp(s,{line:r.lnum-1,character:r.pre.length},!1)},null,this.disposables)}getTextDocument(e){let t=v.getDocument(e);if(!(!t||t.isCommandLine||!t.attached))return t}loadConfiguration(e){if(!e||e.affectsConfiguration("signature")){let t=v.getConfiguration("signature"),i=t.get("target","float");i=="float"&&!v.floatSupported&&(i="echo"),this.config={target:i,floatConfig:t.get("floatConfig",{}),trigger:t.get("enable",!0),wait:Math.max(t.get("triggerSignatureWait",500),200),preferAbove:t.get("preferShownAbove",!0),hideOnChange:t.get("hideOnTextChange",!1)}}}async triggerSignatureHelp(){let{doc:e,position:t}=await this.handler.getCurrentState();return F.hasProvider("signature",e.textDocument)?await this._t
`)||!Ct(r))));if(o.length==1&&Pi(r,o[0].range)){if(i.includes(`
`)){this.cancelEdit();return}cDe.debug("affected single range"),await this.applySingleEdit(o[0],{range:r,newText:i})}else this.cancelEdit()}async applySingleEdit(e,t){let{bufnr:i,ranges:r}=this,o=v.getDocument(i);r.filter(c=>c!==e&&c.position.line==e.position.line).forEach(c=>c.adjustFromEdit(t));let a=Dx(e,t.range,t.newText),l=Qf(a);r.forEach(c=>c.applyChange(a));let u=r.filter(c=>c!==e).map(c=>c.textEdit);if(this.changing=!0,await o.applyEdits(u,!0,!0),this.changing=!1,l!=0)for(let c of r){let h=Vf(c,this.ranges,e);c.move(h*l)}this.doHighlights()}doHighlights(){let{window:e,ranges:t}=this;e&&t&&(this.nvim.pauseNotification(),e.clearMatchGroup("^CocLinkedEditing"),e.highlightRanges("CocLinkedEditing",t.map(i=>i.range),99,!0),this.nvim.resumeNotification(!0,!0))}_checkPosition(e,t){if(_.pumvisible||!v.isAttached(e))return;let i=v.getDocument(e);if(!v.getConfiguration("coc.preferences",i.uri).get("enableLinkedEditing",!1)||!F.hasProvider("linkedEditing",i.textDocument))return;let s=yi(i.getline(t[0]-1),t[1]-1),a=nC.Position.create(t[0]-1,s);if(this.ranges){if(this.ranges.some(l=>ct(a,l.range)==0))return;this.cancelEdit()}this.enable(i,a)}async enable(e,t){let i=e.textDocument,o=(this.tokenSource=new nC.CancellationTokenSource).token,s=await this.nvim.window,a=await F.provideLinkedEdits(i,t,o);if(o.isCancellationRequested||!a||a.ranges.length==0)return;let l=a.ranges.map(u=>new Eh(u.start.line,u.start.character,i.getText(u)));this.wordPattern=a.wordPattern,this.bufnr=e.bufnr,this.window=s,this.ranges=l,this.doHighlights()}cancel(){this.tokenSource&&(this.tokenSource.cancel(),this.tokenSource=null)}};he();Se();Q();var bte=S(_i()),Mh=S(q());Se();PE();bt();var hDe=global.hasOwnProperty("__TEST__")?10:100,dDe="CocInlayHint",oC=class{constructor(e,t,i){this.nvim=e;this.doc=t;this.config=i;this.regions=new ru;this.currentHints=[];this._onDidRefresh=new Mh.Emitter;this.onDidRefresh=this._onDidRefresh.event;this.render=(0,bte.default)(()=>{this.renderRange()},hDe),this.render()}get current(){return this.currentHints}clearCache(){this.currentHints=[],this.regions.clear(),this.render.clear()}onChange(){this.clearCache(),this.cancel(),this.render()}cancel(){this.render.clear(),this.tokenSource&&(this.tokenSource.cancel(),this.tokenSource=null)}async renderRange(){if(this.cancel(),!F.hasProvider("inlayHint",this.doc.textDocument))return;this.tokenSource=new Mh.CancellationTokenSource;let e=this.tokenSource.token,t=await this.nvim.call("coc#window#visible_range",[this.doc.bufnr]);if(t==null||this.doc.dirty||e.isCancellationRequested||this.regions.has(t[0],t[1]))return;let i=Mh.Range.create(t[0]-1,0,t[1],0),r=await F.provideInlayHints(this.doc.textDocument,i,e);r==null||e.isCancellationRequested||(this.regions.add(t[0],t[1]),this.currentHints=this.currentHints.filter(o=>ct(o.position,i)!==0),this.currentHints.push(...r),this.setVirtualText(i,r))}setVirtualText(e,t){let{nvim:i,doc:r}=this,o=this.config.srcId,s=r.buffer,a={};for(let l of t){let u=[[Gy(l),dDe]];a[l.position.line]===void 0?a[l.position.line]=u:(a[l.position.line].push([" ","Normal"]),a[l.position.line].push(u[0]))}i.pauseNotification(),s.clearNamespace(o,e.start.line,e.end.line+1);for(let l of Object.keys(a))s.setExtMark(o,Number(l),0,{virt_text:a[l],virt_text_pos:"eol"});i.resumeNotification(!1,!0),this._onDidRefresh.fire()}clearVirtualText(){let e=this.config.srcId;this.doc.buffer.clearNamespace(e)}dispose(){this.cancel()}};var sC=class{constructor(e,t){this.config={};e.createNamespace("coc-inlayHint").then(i=>{this.config.srcId=i}),this.buffers=v.registerBufferSync(i=>{if(!!v.has("nvim-0.5.0"))return new oC(e,i,this.config)}),t.addDisposable(this.buffers),t.addDisposable(F.onDidInlayHintRefresh(async i=>{for(let r of this.buffers.items)v.match(i,r.doc.textDocument)&&(r.clearCache(),F.hasProvider("inlayHint",r.doc.textDocument)?await r.renderRange():r.clearVirtualText())})),t.addDisposable(_.on("CursorMoved",i=>{this.refresh(i)})),t.addDisposable(_.on("WinScrolled",async i=>{let r=await e.call("winbufnr",[i]);r!=-1&&this.refresh(r)}))}getItem(e){return this.buffers.getIt
`+n.stack):console.error("UnhandledRejection: "+n),cC.error("unhandledRejection ",e,n)});
/*!
* bytes
* Copyright(c) 2012-2014 TJ Holowaychuk
* Copyright(c) 2015 Jed Watson
* MIT Licensed
*/
/*!
* content-disposition
* Copyright(c) 2014-2017 Douglas Christopher Wilson
* MIT Licensed
*/
/*! (c) 2020 Andrea Giammarchi */
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
/**
* event-lite.js - Light-weight EventEmitter (less than 1KB when gzipped)
*
* @copyright Yusuke Kawasaki
* @license MIT
* @constructor
* @see https://github.com/kawanet/event-lite
* @see http://kawanet.github.io/event-lite/EventLite.html
* @example
* var EventLite = require("event-lite");
*
* function MyClass() {...} // your class
*
* EventLite.mixin(MyClass.prototype); // import event methods
*
* var obj = new MyClass();
* obj.on("foo", function() {...}); // add event listener
* obj.once("bar", function() {...}); // add one-time event listener
* obj.emit("foo"); // dispatch event
* obj.emit("bar"); // dispatch another event
* obj.off("foo"); // remove event listener
*/